From 32fb147ba40aed2fd0435971ecdb2bed655d221d Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Mon, 5 Jan 2009 14:38:10 +0000 Subject: [PATCH] Fixed pause problem on menu entry (fake -1 keypress afterwards) --- Src/C64_SDL.i | 47 +++++++++++++++++++++++++---------------------- Src/Display.h | 2 +- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/Src/C64_SDL.i b/Src/C64_SDL.i index 649042c..edaae74 100644 --- a/Src/C64_SDL.i +++ b/Src/C64_SDL.i @@ -255,7 +255,6 @@ void C64::display_options(Prefs *np) menu_fini(&display_menu); } - void C64::save_load_state(Prefs *np) { menu_t save_load_menu; @@ -338,7 +337,7 @@ void C64::Run(void) } /* From dreamcast port */ -static const char *auto_seq[4] = +static char *auto_seq[4] = { "\nLOAD \"*\",8,1\nRUN\n", "\nLOAD \"*\",9,1\nRUN\n", @@ -353,6 +352,10 @@ extern "C" int get_kc_from_char(char c_in, int *shifted); void C64::VBlank(bool draw_frame) { + // Poll joysticks + TheCIA1->Joystick1 = poll_joystick(0); + TheCIA1->Joystick2 = poll_joystick(1); + // Poll keyboard TheDisplay->PollKeyboard(TheCIA1->KeyMatrix, TheCIA1->RevMatrix, &joykey); if (TheDisplay->quit_requested) @@ -380,9 +383,6 @@ void C64::VBlank(bool draw_frame) } } } - // Poll joysticks - TheCIA1->Joystick1 = poll_joystick(0); - TheCIA1->Joystick2 = poll_joystick(1); // Count TOD clocks TheCIA1->CountTOD(); @@ -460,6 +460,8 @@ void C64::VBlank(bool draw_frame) this->NewPrefs(np); ThePrefs = *np; ThePrefs.Save(PREFS_PATH); + TheDisplay->FakeKeyPress(-1, false, TheCIA1->KeyMatrix, + TheCIA1->RevMatrix); this->have_a_break = false; } @@ -540,23 +542,24 @@ uint8 C64::poll_joystick(int port) j &= 0xef; // Button if (held & WPAD_BUTTON_HOME) this->enter_menu(); - - if ( (held & WPAD_BUTTON_A) && ThePrefs.JoystickKeyBinding[0]) - TheDisplay->FakeKeyPressRepeat(ThePrefs.JoystickKeyBinding[0], - false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix); - if ( (held & WPAD_BUTTON_B) && ThePrefs.JoystickKeyBinding[1]) - TheDisplay->FakeKeyPressRepeat(ThePrefs.JoystickKeyBinding[1], - false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix); - if ( (held & WPAD_BUTTON_PLUS) && ThePrefs.JoystickKeyBinding[2]) - TheDisplay->FakeKeyPressRepeat(ThePrefs.JoystickKeyBinding[2], - false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix); - if ( (held & WPAD_BUTTON_MINUS) && ThePrefs.JoystickKeyBinding[3]) - TheDisplay->FakeKeyPressRepeat(ThePrefs.JoystickKeyBinding[3], - false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix); - if ( (held & WPAD_BUTTON_1) && ThePrefs.JoystickKeyBinding[4]) - TheDisplay->FakeKeyPressRepeat(ThePrefs.JoystickKeyBinding[4], - false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix); - + else + { + if ( (held & WPAD_BUTTON_A) && ThePrefs.JoystickKeyBinding[0]) + TheDisplay->FakeKeyPressRepeat(ThePrefs.JoystickKeyBinding[0], + false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix); + if ( (held & WPAD_BUTTON_B) && ThePrefs.JoystickKeyBinding[1]) + TheDisplay->FakeKeyPressRepeat(ThePrefs.JoystickKeyBinding[1], + false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix); + if ( (held & WPAD_BUTTON_PLUS) && ThePrefs.JoystickKeyBinding[2]) + TheDisplay->FakeKeyPressRepeat(ThePrefs.JoystickKeyBinding[2], + false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix); + if ( (held & WPAD_BUTTON_MINUS) && ThePrefs.JoystickKeyBinding[3]) + TheDisplay->FakeKeyPressRepeat(ThePrefs.JoystickKeyBinding[3], + false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix); + if ( (held & WPAD_BUTTON_1) && ThePrefs.JoystickKeyBinding[4]) + TheDisplay->FakeKeyPressRepeat(ThePrefs.JoystickKeyBinding[4], + false, TheCIA1->KeyMatrix, TheCIA1->RevMatrix); + } return j; #elif defined(HAVE_LINUX_JOYSTICK_H) diff --git a/Src/Display.h b/Src/Display.h index 57c6f66..91f8911 100644 --- a/Src/Display.h +++ b/Src/Display.h @@ -131,7 +131,7 @@ private: char speedometer_string[16]; // Speedometer text void draw_string(SDL_Surface *s, int x, int y, const char *str, uint8 front_color, uint8 back_color); #endif - + #ifdef __unix void draw_led(int num, int state); // Draw one LED static void pulse_handler(...); // LED error blinking