mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-12-01 00:13:04 +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; }
|
||||
|
||||
#ifdef HAVE_SDL2
|
||||
const char* sname = SDL_GetKeyName(SDL_GetKeyFromScancode(sc));
|
||||
if (strlen(sname) <= 9) { return sname; }
|
||||
const char* sc_name = SDL_GetScancodeName(sc);
|
||||
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 (space == NULL) { return sname; }
|
||||
if (*sc_name == '\0') { return name; }
|
||||
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
|
||||
return name;
|
||||
}
|
||||
|
|
|
@ -108,6 +108,11 @@ static void controller_sdl_init(void) {
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef WAPI_DXGI
|
||||
extern void WIN_UpdateKeymap(void);
|
||||
WIN_UpdateKeymap();
|
||||
#endif
|
||||
|
||||
haptics_enabled = (SDL_InitSubSystem(SDL_INIT_HAPTIC) == 0);
|
||||
|
||||
// try loading an external gamecontroller mapping file
|
||||
|
|
Loading…
Reference in a new issue