From: notaz Date: Sat, 25 Jun 2011 17:09:44 +0000 (+0300) Subject: psxinterpreter: fix division by zero X-Git-Tag: r9~58 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=commitdiff_plain;h=c7a56f4f574167acc7e3751cf04aa9bf9ebba913 psxinterpreter: fix division by zero Based on info from Ryphecha. --- diff --git a/libpcsxcore/psxinterpreter.c b/libpcsxcore/psxinterpreter.c index f1712050..8eb4749d 100644 --- a/libpcsxcore/psxinterpreter.c +++ b/libpcsxcore/psxinterpreter.c @@ -504,6 +504,10 @@ void psxDIV() { _i32(_rLo_) = _i32(_rRs_) / _i32(_rRt_); _i32(_rHi_) = _i32(_rRs_) % _i32(_rRt_); } + else { + _i32(_rLo_) = _i32(_rRs_) >= 0 ? 0xffffffff : 1; + _i32(_rHi_) = _i32(_rRs_); + } } void psxDIVU() { @@ -511,6 +515,10 @@ void psxDIVU() { _rLo_ = _rRs_ / _rRt_; _rHi_ = _rRs_ % _rRt_; } + else { + _i32(_rLo_) = 0xffffffff; + _i32(_rHi_) = _i32(_rRs_); + } } void psxMULT() {