mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-26 05:24:21 +01:00
Some cleanup and refactoring
This commit is contained in:
parent
835d481221
commit
7ab7e97502
@ -343,8 +343,12 @@ void C64Display::UpdateKeyMatrix(int c64_key, bool key_up,
|
|||||||
uint8 *key_matrix, uint8 *rev_matrix, uint8 *joystick)
|
uint8 *key_matrix, uint8 *rev_matrix, uint8 *joystick)
|
||||||
{
|
{
|
||||||
bool shifted = c64_key & 0x80;
|
bool shifted = c64_key & 0x80;
|
||||||
int c64_byte = (c64_key >> 3) & 7;
|
int c64_byte;
|
||||||
int c64_bit = c64_key & 7;
|
int c64_bit;
|
||||||
|
|
||||||
|
c64_key &= ~0x80;
|
||||||
|
c64_byte = (c64_key >> 3) & 7;
|
||||||
|
c64_bit = c64_key & 7;
|
||||||
|
|
||||||
// Handle joystick emulation
|
// Handle joystick emulation
|
||||||
if (joystick && (c64_key & 0x40)) {
|
if (joystick && (c64_key & 0x40)) {
|
||||||
@ -657,6 +661,7 @@ uint8 C64::poll_joystick(int port)
|
|||||||
Uint32 held_classic = 0;
|
Uint32 held_classic = 0;
|
||||||
WPADData *wpad;
|
WPADData *wpad;
|
||||||
|
|
||||||
|
memset(extra_keys, 0, sizeof(extra_keys));
|
||||||
if (ThePrefs.JoystickSwap)
|
if (ThePrefs.JoystickSwap)
|
||||||
controller = !port;
|
controller = !port;
|
||||||
|
|
||||||
@ -719,7 +724,6 @@ uint8 C64::poll_joystick(int port)
|
|||||||
check_analogue_joystick(&wpad->exp.classic.rjs, extra_keys);
|
check_analogue_joystick(&wpad->exp.classic.rjs, extra_keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Merge common keys */
|
/* Merge common keys */
|
||||||
int active_binded_keys[N_WIIMOTE_BINDINGS];
|
int active_binded_keys[N_WIIMOTE_BINDINGS];
|
||||||
memcpy(active_binded_keys, ThePrefs.JoystickKeyBinding, sizeof(active_binded_keys));
|
memcpy(active_binded_keys, ThePrefs.JoystickKeyBinding, sizeof(active_binded_keys));
|
||||||
@ -729,9 +733,10 @@ uint8 C64::poll_joystick(int port)
|
|||||||
continue;
|
continue;
|
||||||
for (int second = 0; second < N_WIIMOTE_BINDINGS; second++)
|
for (int second = 0; second < N_WIIMOTE_BINDINGS; second++)
|
||||||
{
|
{
|
||||||
if (first != second &&
|
if (first == second)
|
||||||
active_binded_keys[first] ==
|
continue;
|
||||||
active_binded_keys[second]) {
|
if (active_binded_keys[first] == active_binded_keys[second])
|
||||||
|
{
|
||||||
/* Unbind this */
|
/* Unbind this */
|
||||||
extra_keys[second] = 0;
|
extra_keys[second] = 0;
|
||||||
active_binded_keys[second] = -1;
|
active_binded_keys[second] = -1;
|
||||||
@ -744,22 +749,22 @@ uint8 C64::poll_joystick(int port)
|
|||||||
static bool is_pressed[2][N_WIIMOTE_BINDINGS];
|
static bool is_pressed[2][N_WIIMOTE_BINDINGS];
|
||||||
int kc = active_binded_keys[i];
|
int kc = active_binded_keys[i];
|
||||||
|
|
||||||
if ( kc >= 0)
|
if (kc < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (extra_keys[i])
|
||||||
{
|
{
|
||||||
if (extra_keys[i])
|
TheDisplay->UpdateKeyMatrix(kc, false,
|
||||||
{
|
TheCIA1->KeyMatrix, TheCIA1->RevMatrix,
|
||||||
TheDisplay->UpdateKeyMatrix(kc, false,
|
&j);
|
||||||
TheCIA1->KeyMatrix, TheCIA1->RevMatrix,
|
is_pressed[controller][i] = true;
|
||||||
&j);
|
}
|
||||||
is_pressed[controller][i] = true;
|
else if (is_pressed[i])
|
||||||
}
|
{
|
||||||
else if (is_pressed[i])
|
TheDisplay->UpdateKeyMatrix(kc, true,
|
||||||
{
|
TheCIA1->KeyMatrix, TheCIA1->RevMatrix,
|
||||||
TheDisplay->UpdateKeyMatrix(kc, true,
|
&j);
|
||||||
TheCIA1->KeyMatrix, TheCIA1->RevMatrix,
|
is_pressed[controller][i] = false;
|
||||||
&j);
|
|
||||||
is_pressed[controller][i] = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user