Skip to content

Commit 23fe9d5

Browse files
committed
BUG correction: no return in resetkey(), causing unexpected behaviors
Signed-off-by: Vincent-FK <[email protected]>
1 parent b65b9ff commit 23fe9d5

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

src/drivers/dingux-sdl/input.cpp

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,11 @@ static int ispressed(int sdlk_code)
169169
return 0;
170170
}
171171

172-
// mega hack to reset once pressed key
173-
static int resetkey(int sdlk_code)
172+
// Hack to force reset one pressed key
173+
static void resetkey(int sdlk_code)
174174
{
175-
Uint8 *keystate = SDL_GetKeyState(NULL);
176-
keystate[sdlk_code] = 0;
175+
g_keyState[sdlk_code] = 0;
176+
return;
177177
}
178178

179179
static int g_fkbEnabled = 0;
@@ -320,20 +320,21 @@ static void KeyboardCommands() {
320320
}
321321

322322
if (ispressed(FUNKEY_AR_CHANGE)) {
323-
printf("Aspect ration change\n");
323+
printf("Aspect ratio change\n");
324324
resetkey(FUNKEY_AR_CHANGE);
325325
aspect_ratio = (aspect_ratio+1)%NB_ASPECT_RATIOS_TYPES;
326326

327-
char shell_cmd[100];
328-
FILE *fp;
329-
sprintf(shell_cmd, "%s %d \" DISPLAY MODE: %s\"",
327+
char shell_cmd_tmp[100];
328+
FILE *fp_tmp;
329+
sprintf(shell_cmd_tmp, "%s %d \" DISPLAY MODE: %s\"",
330330
SHELL_CMD_NOTIF, NOTIF_SECONDS_DISP, aspect_ratio_name[aspect_ratio]);
331-
fp = popen(shell_cmd, "r");
332-
if (fp == NULL) {
333-
printf("Failed to run command %s\n", shell_cmd);
331+
fp_tmp = popen(shell_cmd_tmp, "r");
332+
if (fp_tmp == NULL) {
333+
printf("Failed to run command %s\n", shell_cmd_tmp);
334334
}
335335
}
336336

337+
#if 0
337338
// toggle fastforwad
338339
if(ispressed(DINGOO_L)) {
339340
fastforward = !fastforward;
@@ -409,14 +410,14 @@ static void KeyboardCommands() {
409410
*/
410411

411412
// Famicom disk-system games
412-
if (gametype == GIT_FDS) {
413+
/*if (gametype == GIT_FDS) {
413414
if (_keyonly(Hotkeys[HK_FDS_FLIP]))
414415
FCEUI_FDSFlip();
415416
if (_keyonly(Hotkeys[HK_FDS_SELECT]))
416417
FCEUI_FDSSelect();
417418
if (_keyonly(Hotkeys[HK_FDS_EJECT]))
418419
FCEUI_FDSInsert();
419-
}
420+
}*/
420421

421422
// if not NES Sound Format
422423
if (gametype != GIT_NSF) {
@@ -627,6 +628,9 @@ static void KeyboardCommands() {
627628
if(keyonly(9)) SSM(9);
628629
#undef SSM */
629630
}
631+
632+
633+
#endif //0
630634
}
631635

632636
/**

0 commit comments

Comments
 (0)