mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-24 18:01:03 +00:00
Added support for hat input aka 'dpads'
This commit is contained in:
parent
d1d04df937
commit
c736bc2572
@ -111,10 +111,68 @@ void SDLController::ProcessInput() {
|
||||
pad_id += input_event.jhat.hat * 4;
|
||||
|
||||
switch(input_event.jhat.value) {
|
||||
case SDL_HAT_LEFT: break;
|
||||
case SDL_HAT_RIGHT: pad_id += 1; break;
|
||||
case SDL_HAT_UP: pad_id += 2; break;
|
||||
case SDL_HAT_DOWN: pad_id += 3; break;
|
||||
case SDL_HAT_CENTERED:
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+1, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+2, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+3, joypad_id}).hex;
|
||||
break;
|
||||
|
||||
case SDL_HAT_LEFT:
|
||||
controller.pad_state.hex |= KeyMap::GetPadKey({pad_id, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+1, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+2, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+3, joypad_id}).hex;
|
||||
break;
|
||||
|
||||
case SDL_HAT_LEFTUP:
|
||||
controller.pad_state.hex |= KeyMap::GetPadKey({pad_id, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+1, joypad_id}).hex;
|
||||
controller.pad_state.hex |= KeyMap::GetPadKey({pad_id+2, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+3, joypad_id}).hex;
|
||||
break;
|
||||
|
||||
case SDL_HAT_LEFTDOWN:
|
||||
controller.pad_state.hex |= KeyMap::GetPadKey({pad_id, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+1, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+2, joypad_id}).hex;
|
||||
controller.pad_state.hex |= KeyMap::GetPadKey({pad_id+3, joypad_id}).hex;
|
||||
break;
|
||||
|
||||
case SDL_HAT_RIGHT:
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id, joypad_id}).hex;
|
||||
controller.pad_state.hex |= KeyMap::GetPadKey({pad_id+1, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+2, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+3, joypad_id}).hex;
|
||||
break;
|
||||
|
||||
case SDL_HAT_RIGHTUP:
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id, joypad_id}).hex;
|
||||
controller.pad_state.hex |= KeyMap::GetPadKey({pad_id+1, joypad_id}).hex;
|
||||
controller.pad_state.hex |= KeyMap::GetPadKey({pad_id+2, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+3, joypad_id}).hex;
|
||||
break;
|
||||
|
||||
case SDL_HAT_RIGHTDOWN:
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id, joypad_id}).hex;
|
||||
controller.pad_state.hex |= KeyMap::GetPadKey({pad_id+1, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+2, joypad_id}).hex;
|
||||
controller.pad_state.hex |= KeyMap::GetPadKey({pad_id+3, joypad_id}).hex;
|
||||
break;
|
||||
|
||||
case SDL_HAT_UP:
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+1, joypad_id}).hex;
|
||||
controller.pad_state.hex |= KeyMap::GetPadKey({pad_id+2, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+3, joypad_id}).hex;
|
||||
break;
|
||||
|
||||
case SDL_HAT_DOWN:
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+1, joypad_id}).hex;
|
||||
controller.pad_state.hex &= ~KeyMap::GetPadKey({pad_id+2, joypad_id}).hex;
|
||||
controller.pad_state.hex |= KeyMap::GetPadKey({pad_id+3, joypad_id}).hex;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user