Fix JUTGamePad stopPatternedRumbleAtThePeriod division by zero

Happens for me when loading a save in Death Mountain Twilight. Confirmed in Dolphin with the same save file.

PowerPC does not raise an exception on division by zero, so I assume this is an original game "bug"
This commit is contained in:
PJB3005
2026-03-31 01:12:21 +02:00
parent f361be6dd6
commit 01e88fbd85
+8
View File
@@ -535,6 +535,14 @@ void JUTGamePad::CRumble::stopPatternedRumble(s16 port) {
}
void JUTGamePad::CRumble::stopPatternedRumbleAtThePeriod() {
#if TARGET_PC
if (mFrameCount == 0) {
// Does not trap on hardware
// PowerPC spec says result is "undefined". Let's just write zero.
mLength = 0;
return;
}
#endif
u32 r31 = mFrame % mFrameCount;
mLength = (mFrame + mFrameCount - 1) % mFrameCount;
}