mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-12-03 17:27:27 +00:00
Fixed empty keyboard bind names on DXGI
This commit is contained in:
parent
39826deadd
commit
684138b0e0
2 changed files with 17 additions and 5 deletions
|
@ -145,13 +145,20 @@ const char* translate_bind_to_name(int bind) {
|
||||||
if (sc == 0) { return name; }
|
if (sc == 0) { return name; }
|
||||||
|
|
||||||
#ifdef HAVE_SDL2
|
#ifdef HAVE_SDL2
|
||||||
const char* sname = SDL_GetKeyName(SDL_GetKeyFromScancode(sc));
|
const char* sc_name = SDL_GetScancodeName(sc);
|
||||||
if (strlen(sname) <= 9) { return sname; }
|
SDL_Keycode kc = SDL_GetKeyFromScancode(sc);
|
||||||
|
if (kc != 0) {
|
||||||
|
const char* kc_name = SDL_GetKeyName(kc);
|
||||||
|
if ((*kc_name & 0x80) == 0) { sc_name = kc_name; }
|
||||||
|
}
|
||||||
|
|
||||||
char* space = strchr(sname, ' ');
|
if (*sc_name == '\0') { return name; }
|
||||||
if (space == NULL) { return sname; }
|
if (strlen(sc_name) <= 9) { return sc_name; }
|
||||||
|
|
||||||
snprintf(name, 10, "%c%s", sname[0], (space + 1));
|
char* space = strchr(sc_name, ' ');
|
||||||
|
if (space == NULL) { return sc_name; }
|
||||||
|
|
||||||
|
snprintf(name, 10, "%c%s", sc_name[0], (space + 1));
|
||||||
#endif
|
#endif
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,6 +108,11 @@ static void controller_sdl_init(void) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WAPI_DXGI
|
||||||
|
extern void WIN_UpdateKeymap(void);
|
||||||
|
WIN_UpdateKeymap();
|
||||||
|
#endif
|
||||||
|
|
||||||
haptics_enabled = (SDL_InitSubSystem(SDL_INIT_HAPTIC) == 0);
|
haptics_enabled = (SDL_InitSubSystem(SDL_INIT_HAPTIC) == 0);
|
||||||
|
|
||||||
// try loading an external gamecontroller mapping file
|
// try loading an external gamecontroller mapping file
|
||||||
|
|
Loading…
Reference in a new issue