From ee15b8318639d9260903a7262a2a6ac088f0eaca Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Sun, 11 Jan 2009 07:40:23 +0000 Subject: [PATCH] For the host: Allow joystick control via kbd --- CHANGES.WII | 4 ++++ Src/C64_SDL.i | 9 ++++++++- Src/Display_SDL.i | 15 ++++++++------- meta.xml | 4 ++-- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/CHANGES.WII b/CHANGES.WII index b9a0f4b..ba4d890 100644 --- a/CHANGES.WII +++ b/CHANGES.WII @@ -1,3 +1,7 @@ +version 3: + + -- Simon Kagstrom + version 2: * Also support the .prg and p00, s00 formats. Only .prg has been tested. * Added support for classic controllers. NOTE: This is untested since I don't diff --git a/Src/C64_SDL.i b/Src/C64_SDL.i index 18f0f2c..6388813 100644 --- a/Src/C64_SDL.i +++ b/Src/C64_SDL.i @@ -476,7 +476,14 @@ void C64::VBlank(bool draw_frame) } } } - +#ifndef GEKKO + // Joystick keyboard emulation + if (TheDisplay->NumLock()) + TheCIA1->Joystick1 &= joykey; + else + TheCIA1->Joystick2 &= joykey; +#endif + // Count TOD clocks TheCIA1->CountTOD(); TheCIA2->CountTOD(); diff --git a/Src/Display_SDL.i b/Src/Display_SDL.i index 888616d..0c2e8bb 100644 --- a/Src/Display_SDL.i +++ b/Src/Display_SDL.i @@ -383,17 +383,18 @@ void C64Display::TranslateKey(SDLKey key, bool key_up, uint8 *key_matrix, uint8 case SDLK_PAGEUP: c64_key = MATRIX(6,0); break; case SDLK_PAGEDOWN: c64_key = MATRIX(6,5); break; - case SDLK_LCTRL: case SDLK_TAB: c64_key = MATRIX(7,2); break; + case SDLK_LCTRL: c64_key = 0x10 | 0x40; break; + case SDLK_TAB: c64_key = MATRIX(7,2); break; case SDLK_RCTRL: c64_key = MATRIX(7,5); break; case SDLK_LSHIFT: c64_key = MATRIX(1,7); break; case SDLK_RSHIFT: c64_key = MATRIX(6,4); break; case SDLK_LALT: case SDLK_LMETA: c64_key = MATRIX(7,5); break; case SDLK_RALT: case SDLK_RMETA: c64_key = MATRIX(7,5); break; - case SDLK_UP: c64_key = MATRIX(0,7)| 0x80; break; - case SDLK_DOWN: c64_key = MATRIX(0,7); break; - case SDLK_LEFT: c64_key = MATRIX(0,2) | 0x80; break; - case SDLK_RIGHT: c64_key = MATRIX(0,2); break; + case SDLK_UP: c64_key = 0x01 | 0x40; break; + case SDLK_DOWN: c64_key = 0x02 | 0x40; break; + case SDLK_LEFT: c64_key = 0x04 | 0x40; break; + case SDLK_RIGHT: c64_key = 0x08 | 0x40; break; case SDLK_F1: c64_key = MATRIX(0,4); break; case SDLK_F2: c64_key = MATRIX(0,4) | 0x80; break; @@ -466,7 +467,7 @@ void C64Display::PollKeyboard(uint8 *key_matrix, uint8 *rev_matrix, uint8 *joyst TheC64->enter_menu(); break; - case SDLK_NUMLOCK: + case SDLK_SCROLLOCK: num_locked = true; break; @@ -491,7 +492,7 @@ void C64Display::PollKeyboard(uint8 *key_matrix, uint8 *rev_matrix, uint8 *joyst // Key released case SDL_KEYUP: - if (event.key.keysym.sym == SDLK_NUMLOCK) + if (event.key.keysym.sym == SDLK_SCROLLOCK) num_locked = false; else TranslateKey(event.key.keysym.sym, true, key_matrix, rev_matrix, joystick); diff --git a/meta.xml b/meta.xml index cd30a09..e4dd541 100644 --- a/meta.xml +++ b/meta.xml @@ -1,8 +1,8 @@ - + Frodo Simon Kagstrom - 2 + 3 20090107 Commodore 64 emulator Frodo is a C64 emulator written by Christian Bauer. It supports C64 disk and tape images in the .d64 and .t64 formats. The port to Wii was done by Simon Kagstrom.