diff options
author | notaz | 2011-06-25 20:09:44 +0300 |
---|---|---|
committer | notaz | 2011-07-08 00:15:08 +0300 |
commit | c7a56f4f574167acc7e3751cf04aa9bf9ebba913 (patch) | |
tree | a3ad535651e9cb5e3118031af63435fd59ae4e8a /libpcsxcore | |
parent | b03e0caf5e153551cb71065ffaa4361b7f7e492b (diff) | |
download | pcsx_rearmed-c7a56f4f574167acc7e3751cf04aa9bf9ebba913.tar.gz pcsx_rearmed-c7a56f4f574167acc7e3751cf04aa9bf9ebba913.tar.bz2 pcsx_rearmed-c7a56f4f574167acc7e3751cf04aa9bf9ebba913.zip |
psxinterpreter: fix division by zero
Based on info from Ryphecha.
Diffstat (limited to 'libpcsxcore')
-rw-r--r-- | libpcsxcore/psxinterpreter.c | 8 |
1 files changed, 8 insertions, 0 deletions
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() { |