From c7a56f4f574167acc7e3751cf04aa9bf9ebba913 Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 25 Jun 2011 20:09:44 +0300 Subject: psxinterpreter: fix division by zero Based on info from Ryphecha. --- libpcsxcore/psxinterpreter.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libpcsxcore/psxinterpreter.c b/libpcsxcore/psxinterpreter.c index f171205..8eb4749 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() { -- cgit v1.2.3