Oops, fixed key press bug

This commit is contained in:
simon.kagstrom 2009-01-15 20:33:13 +00:00
parent 6a6cc774ca
commit 31ecb6920d
4 changed files with 23 additions and 16 deletions

View File

@ -1,4 +1,8 @@
version 4:
* Fixed + and - bindings on the wiimote and a keybinding bug which caused
keypresses to go unnoticed. Keys are now handled in turn, i.e., not on
each vblank
* Build the SC version of frodo, which makes some more games work or
some work better. For example, I *think* that the sound in Exploding
fist is now correct

View File

@ -301,7 +301,7 @@ char *C64::bind_one_key(Prefs *np, int which)
const char *cur_binding = "None";
int cur = np->JoystickKeyBinding[which];
for (int i = 1; i < sizeof(key_keycodes) / sizeof(key_keycodes[0]); i++ )
for (unsigned int i = 1; i < sizeof(key_keycodes) / sizeof(key_keycodes[0]); i++ )
{
if (key_keycodes[i] == cur)
{

View File

@ -594,12 +594,14 @@ uint8 C64::poll_joystick(int port)
#ifdef GEKKO
int extra_keys[N_WIIMOTE_BINDINGS];
int controller = port;
Uint32 held = 0;
Uint32 held_other = 0;
Uint32 held_classic = 0;
Uint32 held_classic_other = 0;
WPADData *wpad, *wpad_other;
Uint32 held, held_other, held_classic, held_classic_other;
if (ThePrefs.JoystickSwap)
controller = !port;
held_classic = held_classic_other = 0;
wpad = WPAD_Data(controller);
wpad_other = WPAD_Data(!controller);
@ -610,7 +612,7 @@ uint8 C64::poll_joystick(int port)
if (wpad->exp.type == WPAD_EXP_CLASSIC)
held_classic = wpad->exp.classic.btns_held;
if (wpad_other->exp.type == WPAD_EXP_CLASSIC)
held_classic_other = wpad_other->exp.classic.btns_held;
held_classic_other = wpad_other->exp.classic.btns_held;
if ( (held & WPAD_BUTTON_UP) || (held_classic & CLASSIC_CTRL_BUTTON_LEFT) )
j &= 0xfb; // Left
@ -627,8 +629,6 @@ uint8 C64::poll_joystick(int port)
extra_keys[WIIMOTE_A] = (held | held_other) & WPAD_BUTTON_A;
extra_keys[WIIMOTE_B] = (held | held_other) & WPAD_BUTTON_B;
extra_keys[WIIMOTE_PLUS] = (held | held_other) & WPAD_BUTTON_PLUS;
extra_keys[WIIMOTE_MINUS] = (held | held_other) & WPAD_BUTTON_MINUS;
extra_keys[WIIMOTE_1] = (held | held_other) & WPAD_BUTTON_1;
/* Classic buttons (might not be connected) */
@ -640,23 +640,26 @@ uint8 C64::poll_joystick(int port)
extra_keys[CLASSIC_ZL] = (held_classic | held_classic_other) & CLASSIC_CTRL_BUTTON_ZL;
extra_keys[CLASSIC_ZR] = (held_classic | held_classic_other) & CLASSIC_CTRL_BUTTON_ZR;
extra_keys[WIIMOTE_PLUS] = (held_classic | held_classic_other) & CLASSIC_CTRL_BUTTON_MINUS;
extra_keys[WIIMOTE_MINUS] = (held_classic | held_classic_other) & CLASSIC_CTRL_BUTTON_PLUS;
extra_keys[WIIMOTE_PLUS] = ((held_classic | held_classic_other) & CLASSIC_CTRL_BUTTON_MINUS) |
(held | held_other) & WPAD_BUTTON_PLUS;
extra_keys[WIIMOTE_MINUS] = ((held_classic | held_classic_other) & CLASSIC_CTRL_BUTTON_PLUS) |
(held | held_other) & WPAD_BUTTON_MINUS;
for (int i = 0; i < N_WIIMOTE_BINDINGS; i++)
static int whose_turn;
int kc = ThePrefs.JoystickKeyBinding[whose_turn];
if ( kc >= 0)
{
int kc = ThePrefs.JoystickKeyBinding[i];
if ( kc < 0 )
continue;
if (extra_keys[i])
if (extra_keys[whose_turn])
TheDisplay->UpdateKeyMatrix(kc, false,
TheCIA1->KeyMatrix, TheCIA1->RevMatrix);
else
TheDisplay->UpdateKeyMatrix(kc, true,
TheCIA1->KeyMatrix, TheCIA1->RevMatrix);
}
whose_turn++;
if (whose_turn >= N_WIIMOTE_BINDINGS)
whose_turn = 0;
return j;
#else

View File

@ -17,7 +17,7 @@ DESTDIR =
CXX = g++
CC = gcc
CFLAGS =-DFRODO_SC -g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_SDL -DORBIT2=1 -pthread -I/usr/include/libglade-2.0 -I/usr/include/gtk-2.0 -I/usr/include/libxml2 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/pixman-1 -I/usr/include/libgnomeui-2.0 -I/usr/include/libart-2.0 -I/usr/include/gconf/2 -I/usr/include/gnome-keyring-1 -I/usr/include/libgnome-2.0 -I/usr/include/libbonoboui-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/orbit-2.0 -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/gail-1.0 -I./ -DKBD_LANG=0
CFLAGS =-DFRODO_SC -g -O2 -I/usr/include/SDL -I$(DEVKITPRO)/libogc/include -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_SDL -DORBIT2=1 -pthread -I/usr/include/libglade-2.0 -I/usr/include/gtk-2.0 -I/usr/include/libxml2 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/pixman-1 -I/usr/include/libgnomeui-2.0 -I/usr/include/libart-2.0 -I/usr/include/gconf/2 -I/usr/include/gnome-keyring-1 -I/usr/include/libgnome-2.0 -I/usr/include/libbonoboui-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include -I/usr/include/orbit-2.0 -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 -I/usr/include/gail-1.0 -I./ -DKBD_LANG=0
DEFS = -DHAVE_CONFIG_H -DDATADIR=\"$(datadir)/frodo/\" -DBINDIR=\"$(bindir)/\" -DHAVE_SDL
LDFLAGS = -Wl,-E
LIBS = -L/usr/lib -lSDL -lSDL_ttf -pthread -lglade-2.0 -lxml2 -lgnomeui-2 -lSM -lICE -lbonoboui-2 -lgnomevfs-2 -lgnomecanvas-2 -lgnome-2 -lpopt -lbonobo-2 -lbonobo-activation -lORBit-2 -lart_lgpl_2 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgconf-2 -lgthread-2.0 -lrt -lgmodule-2.0 -ldl -lgobject-2.0 -lglib-2.0