From b96da794089ff1a21463306aae0aa2ad25c31d02 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Sun, 4 Jan 2009 14:37:07 +0000 Subject: [PATCH] Misc fixes here and there --- Makefile | 5 +++-- Src/C64_SDL.i | 31 +++++++++++++------------------ Src/Display_SDL.i | 2 +- Src/Makefile | 2 +- Src/char_to_kc.c | 2 +- Src/main_x.i | 2 +- Src/menu.cpp | 2 +- 7 files changed, 21 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 8fb4433..3fdbe07 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ INCLUDES := # options for code generation #--------------------------------------------------------------------------------- -CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) -I$(DEVKITPRO)/SDL/include -U__unix -DHAVE_SDL +CFLAGS = -g -Wall $(MACHDEP) $(INCLUDE) -I$(DEVKITPRO)/SDL/include -U__unix -DHAVE_SDL CXXFLAGS = $(CFLAGS) LDFLAGS = -L$(DEVKITPRO)/SDL/lib -g $(MACHDEP) -Wl,-Map,$(notdir $@).map @@ -104,7 +104,8 @@ $(BUILD): #--------------------------------------------------------------------------------- clean: @echo clean ... - @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol Src/sysconfig.h Frodo FrodoPC \ + FrodoSC #--------------------------------------------------------------------------------- run: diff --git a/Src/C64_SDL.i b/Src/C64_SDL.i index da57f9d..f5de100 100644 --- a/Src/C64_SDL.i +++ b/Src/C64_SDL.i @@ -13,11 +13,10 @@ #if defined(GEKKO) #include #define FONT_PATH "/apps/frodo/FreeMono.ttf" -#define MS_PER_FRAME 30 #else #define FONT_PATH "FreeMono.ttf" -#define MS_PER_FRAME 20 #endif +#define MS_PER_FRAME 40 static struct timeval tv_start; static int MENU_SIZE_X, MENU_SIZE_Y; @@ -217,19 +216,17 @@ void C64::bind_key(Prefs *np) menu_init(&bind_key_menu, this->menu_font, bind_key_messages, 0, 0, MENU_SIZE_X, MENU_SIZE_Y); - menu_init(&key_menu, this->menu_font, keys, - 0, 0, MENU_SIZE_X, MENU_SIZE_Y); int opt = menu_select(real_screen, &bind_key_menu, ~0, NULL); if (opt >= 0) { + menu_init(&key_menu, this->menu_font, keys, + 0, 0, MENU_SIZE_X, MENU_SIZE_Y); int key = menu_select(real_screen, &key_menu, ~0, NULL); -#if defined(GEKKO) np->JoystickKeyBinding[opt] = kcs[key]; -#endif + menu_fini(&key_menu); } menu_fini(&bind_key_menu); - menu_fini(&key_menu); } void C64::display_options(Prefs *np) @@ -343,12 +340,6 @@ void C64::VBlank(bool draw_frame) // Poll joysticks TheCIA1->Joystick1 = poll_joystick(0); TheCIA1->Joystick2 = poll_joystick(1); - - if (ThePrefs.JoystickSwap) { - uint8 tmp = TheCIA1->Joystick1; - TheCIA1->Joystick1 = TheCIA1->Joystick2; - TheCIA1->Joystick2 = tmp; - } // Count TOD clocks TheCIA1->CountTOD(); @@ -403,10 +394,6 @@ void C64::VBlank(bool draw_frame) this->display_options(np); break; case 5: /* Swap joysticks */ - if (submenus[0] == 0) - np->JoystickSwap = false; - else - np->JoystickSwap = true; break; case 7: /* Save / load game */ this->save_load_state(np); @@ -418,6 +405,10 @@ void C64::VBlank(bool draw_frame) default: break; } + if (submenus[0] == 0) + np->JoystickSwap = false; + else + np->JoystickSwap = true; this->NewPrefs(np); ThePrefs = *np; @@ -480,12 +471,16 @@ void C64::open_close_joysticks(bool oldjoy1, bool oldjoy2, bool newjoy1, bool ne uint8 C64::poll_joystick(int port) { #ifdef GEKKO + int controller = port; Uint32 held; uint8 j = 0xff; + if (ThePrefs.JoystickSwap) + controller = !port; + WPAD_ScanPads(); - held = WPAD_ButtonsHeld(port); + held = WPAD_ButtonsHeld(controller); if (held & WPAD_BUTTON_UP) j &= 0xfb; // Left if (held & WPAD_BUTTON_DOWN) diff --git a/Src/Display_SDL.i b/Src/Display_SDL.i index 04a2ebc..f2784b1 100644 --- a/Src/Display_SDL.i +++ b/Src/Display_SDL.i @@ -206,7 +206,7 @@ void C64Display::Update(void) } else if (ThePrefs.DisplayOption == 1) { /* Center, double size */ - srcrect = (SDL_Rect){28, 14, FULL_DISPLAY_X / 2, FULL_DISPLAY_Y / 2}; + srcrect = (SDL_Rect){32, 14, FULL_DISPLAY_X / 2, FULL_DISPLAY_Y / 2}; dstrect = (SDL_Rect){0, 0, FULL_DISPLAY_X, FULL_DISPLAY_Y}; } else { diff --git a/Src/Makefile b/Src/Makefile index d979e79..bfbe4d3 100644 --- a/Src/Makefile +++ b/Src/Makefile @@ -97,7 +97,7 @@ CIA_SC.o: CIA_SC.cpp CIA.h CPUC64.h CPU1541.h VIC.h Prefs.h #------------------------------------------------------------------------- # DO NOT DELETE THIS LINE -- make depend depends on it. -main.o: sysdeps.h sysconfig.h main.h C64.h Display.h Prefs.h SAM.h +main.o: sysdeps.h sysconfig.h main.h C64.h Display.h Prefs.h SAM.h main_x.i Display.o: sysdeps.h sysconfig.h Display.h main.h Prefs.h Display_SDL.i Prefs.o: sysdeps.h sysconfig.h Prefs.h Display.h C64.h main.h SID.o: sysdeps.h sysconfig.h SID.h Prefs.h SID_SDL.i diff --git a/Src/char_to_kc.c b/Src/char_to_kc.c index cf8c2d8..70f5fac 100644 --- a/Src/char_to_kc.c +++ b/Src/char_to_kc.c @@ -26,7 +26,7 @@ static uint8_t char_to_kc[] = /* F1 */ /* F7 */ ['\n'] = MATRIX(0, 1), - ['\008'] = MATRIX(0, 0), + [8] = MATRIX(0, 0), ['E'] = MATRIX(1, 6), ['S'] = MATRIX(1, 5), diff --git a/Src/main_x.i b/Src/main_x.i index e066c02..149835f 100644 --- a/Src/main_x.i +++ b/Src/main_x.i @@ -31,7 +31,7 @@ int main(int argc, char **argv) return 0; fflush(stdout); // Init SDL - if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) { + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER) < 0) { fprintf(stderr, "Couldn't initialize SDL (%s)\n", SDL_GetError()); return 0; } diff --git a/Src/menu.cpp b/Src/menu.cpp index 123bb37..332de2b 100644 --- a/Src/menu.cpp +++ b/Src/menu.cpp @@ -263,7 +263,7 @@ static uint32_t wait_key_press(void) Uint32 remote_keys; WPAD_ScanPads(); - remote_keys = WPAD_ButtonsDown(WPAD_CHAN_0); + remote_keys = WPAD_ButtonsDown(WPAD_CHAN_0) | WPAD_ButtonsDown(WPAD_CHAN_1); if (remote_keys & WPAD_BUTTON_DOWN) keys |= KEY_RIGHT;