@@ -343,10 +343,8 @@ inline void InterpretedCPU::doBranch(uint32_t target, bool fromLink) {
343343 * Format: OP rt, rs, immediate *
344344 *********************************************************/
345345void InterpretedCPU::psxADDI (uint32_t code) {
346- if (!_Rt_) return ;
347-
348- auto rs = _rRs_;
349- auto imm = _Imm_;
346+ const auto rs = _rRs_;
347+ const auto imm = _Imm_;
350348 uint32_t res = rs + imm;
351349
352350 if (_Rt_ == 29 ) {
@@ -369,9 +367,12 @@ void InterpretedCPU::psxADDI(uint32_t code) {
369367 }
370368 }
371369
372- maybeCancelDelayedLoad (_Rt_);
373- _rRt_ = res;
374- } // Rt = Rs + Im (Exception on Integer Overflow)
370+ if (_Rt_ != 0 ) {
371+ maybeCancelDelayedLoad (_Rt_);
372+ _rRt_ = res;
373+ }
374+ }
375+
375376void InterpretedCPU::psxADDIU (uint32_t code) {
376377 if (!_Rt_) return ;
377378 maybeCancelDelayedLoad (_Rt_);
@@ -437,10 +438,8 @@ void InterpretedCPU::psxSLTIU(uint32_t code) {
437438 * Format: OP rd, rs, rt *
438439 *********************************************************/
439440void InterpretedCPU::psxADD (uint32_t code) {
440- if (!_Rd_) return ;
441-
442- auto rs = _rRs_;
443- auto rt = _rRt_;
441+ const auto rs = _rRs_;
442+ const auto rt = _rRt_;
444443 uint32_t res = rs + rt;
445444 if (_Rd_ == 29 ) {
446445 if ((_Rs_ == 29 ) || (_Rt_ == 29 )) {
@@ -462,13 +461,16 @@ void InterpretedCPU::psxADD(uint32_t code) {
462461 }
463462 }
464463
465- maybeCancelDelayedLoad (_Rd_);
466- _rRd_ = res;
467- } // Rd = Rs + Rt (Exception on Integer Overflow)
464+ if (_Rd_ != 0 ) {
465+ maybeCancelDelayedLoad (_Rd_);
466+ _rRd_ = res;
467+ }
468+ }
469+
468470void InterpretedCPU::psxADDU (uint32_t code) {
469471 if (!_Rd_) return ;
470472 maybeCancelDelayedLoad (_Rd_);
471- uint32_t res = _u32 ( _rRs_) + _u32 ( _rRt_) ;
473+ uint32_t res = _rRs_ + _rRt_;
472474 if (_Rd_ == 29 ) {
473475 if ((_Rs_ == 29 ) || (_Rt_ == 29 )) {
474476 PCSX ::g_emulator->m_callStacks ->offsetSP (_rRd_, res - _rRd_);
@@ -479,10 +481,8 @@ void InterpretedCPU::psxADDU(uint32_t code) {
479481 _rRd_ = res;
480482} // Rd = Rs + Rt
481483void InterpretedCPU::psxSUB (uint32_t code) {
482- if (!_Rd_) return ;
483-
484- auto rs = _rRs_;
485- auto rt = _rRt_;
484+ const auto rs = _rRs_;
485+ const auto rt = _rRt_;
486486 uint32_t res = rs - rt;
487487 if (_Rd_ == 29 ) {
488488 if (_Rs_ == 29 ) {
@@ -503,13 +503,16 @@ void InterpretedCPU::psxSUB(uint32_t code) {
503503 return ;
504504 }
505505 }
506- maybeCancelDelayedLoad (_Rd_);
507- _rRd_ = res;
506+
507+ if (_Rd_ != 0 ) {
508+ maybeCancelDelayedLoad (_Rd_);
509+ _rRd_ = res;
510+ }
508511} // Rd = Rs - Rt (Exception on Integer Overflow)
509512void InterpretedCPU::psxSUBU (uint32_t code) {
510513 if (!_Rd_) return ;
511514 maybeCancelDelayedLoad (_Rd_);
512- uint32_t res = _u32 ( _rRs_) - _u32 ( _rRt_) ;
515+ uint32_t res = _rRs_ - _rRt_;
513516 if (_Rd_ == 29 ) {
514517 if (_Rs_ == 29 ) {
515518 PCSX ::g_emulator->m_callStacks ->offsetSP (_rRd_, res - _rRd_);
0 commit comments