Add classic for the menu, some cleanup

This commit is contained in:
simon.kagstrom 2009-01-10 15:32:52 +00:00
parent cc6cb80401
commit fce0db49b7
3 changed files with 26 additions and 12 deletions

View File

@ -641,7 +641,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->exp.classic.btns_held;
held_classic_other = wpad_other->exp.classic.btns_held;
if ( (held & WPAD_BUTTON_UP) || (held_classic & CLASSIC_CTRL_BUTTON_UP) )
j &= 0xfb; // Left

View File

@ -148,8 +148,11 @@ void C64Display::Update(void)
SDL_Rect srcrect, dstrect;
if (ThePrefs.DisplayOption == 0) {
const int x_border = (DISPLAY_X - FULL_DISPLAY_X / 2) / 2;
const int y_border = (DISPLAY_Y - FULL_DISPLAY_Y / 2) / 2;
/* Center, double size */
srcrect = (SDL_Rect){32, 14, FULL_DISPLAY_X / 2, FULL_DISPLAY_Y / 2};
srcrect = (SDL_Rect){x_border, y_border, FULL_DISPLAY_X / 2, FULL_DISPLAY_Y / 2};
dstrect = (SDL_Rect){0, 0, FULL_DISPLAY_X, FULL_DISPLAY_Y};
}
else {

View File

@ -266,26 +266,37 @@ static uint32_t wait_key_press(void)
while (1)
{
#if defined(GEKKO)
Uint32 remote_keys;
Uint32 remote_keys, classic_keys;
WPADData *wpad, *wpad_other;
WPAD_ScanPads();
remote_keys = WPAD_ButtonsDown(WPAD_CHAN_0) | WPAD_ButtonsDown(WPAD_CHAN_1);
if (remote_keys & WPAD_BUTTON_DOWN)
wpad = WPAD_Data(WPAD_CHAN_0);
wpad_other = WPAD_Data(WPAD_CHAN_1);
remote_keys = wpad->btns_d | wpad_other->btns_d;
classic_keys = 0;
// Check classic controller as well
if (wpad->exp.type == WPAD_EXP_CLASSIC)
classic_keys = wpad->exp.classic.btns_held | wpad_other->exp.classic.btns_held;
if ( (remote_keys & WPAD_BUTTON_DOWN) || (classic_keys & CLASSIC_CTRL_BUTTON_DOWN) )
keys |= KEY_RIGHT;
if (remote_keys & WPAD_BUTTON_UP)
if ( (remote_keys & WPAD_BUTTON_UP) || (classic_keys & CLASSIC_CTRL_BUTTON_UP) )
keys |= KEY_LEFT;
if (remote_keys & WPAD_BUTTON_LEFT)
if ( (remote_keys & WPAD_BUTTON_LEFT) || (classic_keys & CLASSIC_CTRL_BUTTON_LEFT) )
keys |= KEY_DOWN;
if (remote_keys & WPAD_BUTTON_RIGHT)
if ( (remote_keys & WPAD_BUTTON_RIGHT) || (classic_keys & CLASSIC_CTRL_BUTTON_RIGHT) )
keys |= KEY_UP;
if (remote_keys & WPAD_BUTTON_PLUS)
if ( (remote_keys & WPAD_BUTTON_PLUS) || (classic_keys & CLASSIC_CTRL_BUTTON_PLUS) )
keys |= KEY_PAGEUP;
if (remote_keys & WPAD_BUTTON_MINUS)
if ( (remote_keys & WPAD_BUTTON_MINUS) || (classic_keys & CLASSIC_CTRL_BUTTON_MINUS) )
keys |= KEY_PAGEDOWN;
if (remote_keys & (WPAD_BUTTON_A | WPAD_BUTTON_2) )
if ( (remote_keys & (WPAD_BUTTON_A | WPAD_BUTTON_2) ) ||
(classic_keys & (CLASSIC_CTRL_BUTTON_A | CLASSIC_CTRL_BUTTON_X)) )
keys |= KEY_SELECT;
if (remote_keys & (WPAD_BUTTON_1 | WPAD_BUTTON_HOME) )
if ( (remote_keys & (WPAD_BUTTON_1 | WPAD_BUTTON_HOME) ) ||
(classic_keys & (CLASSIC_CTRL_BUTTON_B | CLASSIC_CTRL_BUTTON_Y)) )
keys |= KEY_ESCAPE;
#endif
if (SDL_PollEvent(&ev))