For the host: Allow joystick control via kbd

This commit is contained in:
simon.kagstrom 2009-01-11 07:40:23 +00:00
parent bcd011b5be
commit ee15b83186
4 changed files with 22 additions and 10 deletions

View File

@ -1,3 +1,7 @@
version 3:
-- Simon Kagstrom <simon.kagstrom@gmail.com>
version 2: version 2:
* Also support the .prg and p00, s00 formats. Only .prg has been tested. * 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 * Added support for classic controllers. NOTE: This is untested since I don't

View File

@ -476,6 +476,13 @@ 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 // Count TOD clocks
TheCIA1->CountTOD(); TheCIA1->CountTOD();

View File

@ -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_PAGEUP: c64_key = MATRIX(6,0); break;
case SDLK_PAGEDOWN: c64_key = MATRIX(6,5); 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_RCTRL: c64_key = MATRIX(7,5); break;
case SDLK_LSHIFT: c64_key = MATRIX(1,7); break; case SDLK_LSHIFT: c64_key = MATRIX(1,7); break;
case SDLK_RSHIFT: c64_key = MATRIX(6,4); break; case SDLK_RSHIFT: c64_key = MATRIX(6,4); break;
case SDLK_LALT: case SDLK_LMETA: c64_key = MATRIX(7,5); 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_RALT: case SDLK_RMETA: c64_key = MATRIX(7,5); break;
case SDLK_UP: c64_key = MATRIX(0,7)| 0x80; break; case SDLK_UP: c64_key = 0x01 | 0x40; break;
case SDLK_DOWN: c64_key = MATRIX(0,7); break; case SDLK_DOWN: c64_key = 0x02 | 0x40; break;
case SDLK_LEFT: c64_key = MATRIX(0,2) | 0x80; break; case SDLK_LEFT: c64_key = 0x04 | 0x40; break;
case SDLK_RIGHT: c64_key = MATRIX(0,2); break; case SDLK_RIGHT: c64_key = 0x08 | 0x40; break;
case SDLK_F1: c64_key = MATRIX(0,4); break; case SDLK_F1: c64_key = MATRIX(0,4); break;
case SDLK_F2: c64_key = MATRIX(0,4) | 0x80; 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(); TheC64->enter_menu();
break; break;
case SDLK_NUMLOCK: case SDLK_SCROLLOCK:
num_locked = true; num_locked = true;
break; break;
@ -491,7 +492,7 @@ void C64Display::PollKeyboard(uint8 *key_matrix, uint8 *rev_matrix, uint8 *joyst
// Key released // Key released
case SDL_KEYUP: case SDL_KEYUP:
if (event.key.keysym.sym == SDLK_NUMLOCK) if (event.key.keysym.sym == SDLK_SCROLLOCK)
num_locked = false; num_locked = false;
else else
TranslateKey(event.key.keysym.sym, true, key_matrix, rev_matrix, joystick); TranslateKey(event.key.keysym.sym, true, key_matrix, rev_matrix, joystick);

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<app version="1"> <app version="3">
<name>Frodo</name> <name>Frodo</name>
<coder>Simon Kagstrom</coder> <coder>Simon Kagstrom</coder>
<version>2</version> <version>3</version>
<release_date>20090107</release_date> <release_date>20090107</release_date>
<short_description>Commodore 64 emulator</short_description> <short_description>Commodore 64 emulator</short_description>
<long_description>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.</long_description> <long_description>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.</long_description>