move controller logic to PIF

This commit is contained in:
CocoSimone
2023-02-19 14:54:26 +01:00
parent 50ec9a8a9e
commit e665f2d6e9
11 changed files with 154 additions and 151 deletions

View File

@@ -8,12 +8,11 @@ App::App() : window(core) {
}
void App::Run() {
const u8* state = SDL_GetKeyboardState(nullptr);
SDL_EventState(SDL_DROPFILE, SDL_ENABLE);
n64::SI& si = core.mem.mmio.si;
while (!core.done) {
core.Run(window, window.settings.GetVolumeL(), window.settings.GetVolumeL());
core.UpdateController(state);
SDL_Event event;
while (SDL_PollEvent(&event)) {
@@ -27,12 +26,12 @@ void App::Run() {
break;
case SDL_CONTROLLERDEVICEADDED: {
const int index = event.cdevice.which;
core.gamepad = SDL_GameControllerOpen(index);
core.gamepadConnected = true;
si.pif.gamepad = SDL_GameControllerOpen(index);
si.pif.gamepadConnected = true;
} break;
case SDL_CONTROLLERDEVICEREMOVED:
SDL_GameControllerClose(core.gamepad);
core.gamepadConnected = false;
SDL_GameControllerClose(si.pif.gamepad);
si.pif.gamepadConnected = false;
break;
case SDL_KEYDOWN:
switch(event.key.keysym.sym) {