allow entering joystick config

This commit is contained in:
StapleButter
2017-09-30 19:27:47 +02:00
parent acc23f47cc
commit 9f486de76a
2 changed files with 126 additions and 2 deletions

View File

@ -57,6 +57,8 @@ u32 ScreenBuffer[256*384];
bool Touching = false;
SDL_Joystick* Joystick;
void AudioCallback(void* data, Uint8* stream, int len)
{
@ -93,6 +95,12 @@ int EmuThreadFunc(void* burp)
SDL_PauseAudioDevice(audio, 0);
}
// TODO: support more joysticks
if (SDL_NumJoysticks() > 0)
Joystick = SDL_JoystickOpen(0);
else
Joystick = NULL;
u32 nframes = 0;
u32 starttick = SDL_GetTicks();
u32 lasttick = starttick;
@ -172,6 +180,8 @@ int EmuThreadFunc(void* burp)
EmuStatus = 0;
if (Joystick) SDL_JoystickClose(Joystick);
if (audio) SDL_CloseAudioDevice(audio);
NDS::DeInit();
@ -464,6 +474,8 @@ int main(int argc, char** argv)
return 1;
}
SDL_JoystickEventState(SDL_ENABLE);
uiInitOptions ui_opt;
memset(&ui_opt, 0, sizeof(uiInitOptions));
const char* ui_err = uiInit(&ui_opt);