Joystick rumble followup. #522
Call `rtcEnableRumble(true);` always regardless of the `rtcEnabled` option, because @negativeExponent points out that they are unrelated. Check for at least SDL version `2.0.9` before using the `SDL_JoystickRumble()` API, since it is not present in earlier versions. Increase rumble duration to twice the poll time to keep the motors running, subsequent poll events will cancel the rumble as necessary. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
4bc9bb84b4
commit
7ee3cbe120
|
@ -229,7 +229,6 @@ void GameArea::LoadGame(const wxString& name)
|
|||
bool enable_rtc = cfg->Read(wxT("rtcEnabled"), rtcEnabled);
|
||||
|
||||
rtcEnable(enable_rtc);
|
||||
rtcEnableRumble(enable_rtc);
|
||||
|
||||
int fsz = cfg->Read(wxT("flashSize"), (long)0);
|
||||
|
||||
|
@ -251,7 +250,6 @@ void GameArea::LoadGame(const wxString& name)
|
|||
cfg->SetPath(wxT("/"));
|
||||
} else {
|
||||
rtcEnable(rtcEnabled);
|
||||
rtcEnableRumble(rtcEnabled);
|
||||
flashSetSize(0x10000 << winFlashSize);
|
||||
|
||||
if (cpuSaveType < 0 || cpuSaveType > 5)
|
||||
|
@ -275,6 +273,8 @@ void GameArea::LoadGame(const wxString& name)
|
|||
soundSetThrottle(throttle);
|
||||
soundFiltering = (float)gopts.gba_sound_filter / 100.0f;
|
||||
|
||||
rtcEnableRumble(true);
|
||||
|
||||
CPUInit(gopts.gba_bios.mb_fn_str(), useBiosFileGBA);
|
||||
|
||||
if (useBiosFileGBA && !useBios) {
|
||||
|
|
|
@ -243,11 +243,13 @@ void wxSDLJoy::Notify()
|
|||
}
|
||||
|
||||
// do rumble only on device 0
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
||||
SDL_Joystick* dev = joystate[0].dev;
|
||||
if (dev) {
|
||||
if (rumbling)
|
||||
SDL_JoystickRumble(dev, 0xFFFF, 0xFFFF, poll_time_ms);
|
||||
SDL_JoystickRumble(dev, 0xFFFF, 0xFFFF, poll_time_ms * 2);
|
||||
else
|
||||
SDL_JoystickRumble(dev, 0, 0, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue