From 202f99109d57a9d0000e50dad372da751edac6c1 Mon Sep 17 00:00:00 2001 From: Aslan Hud Date: Sat, 21 Feb 2026 14:13:32 +0100 Subject: [PATCH 1/2] fix: MULT/MULTU now write rd in addition to HI/LO (R5900 extension) --- ps2xRecomp/src/lib/code_generator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ps2xRecomp/src/lib/code_generator.cpp b/ps2xRecomp/src/lib/code_generator.cpp index e3ad8672..3c259d07 100644 --- a/ps2xRecomp/src/lib/code_generator.cpp +++ b/ps2xRecomp/src/lib/code_generator.cpp @@ -964,9 +964,9 @@ namespace ps2recomp case SPECIAL_MTLO: return fmt::format("ctx->lo = GPR_U32(ctx, {});", inst.rs); case SPECIAL_MULT: - return fmt::format("{{ int64_t result = (int64_t)GPR_S32(ctx, {}) * (int64_t)GPR_S32(ctx, {}); ctx->lo = (uint32_t)result; ctx->hi = (uint32_t)(result >> 32); }}", inst.rs, inst.rt); + return fmt::format("{{ int64_t result = (int64_t)GPR_S32(ctx, {}) * (int64_t)GPR_S32(ctx, {}); ctx->lo = (uint32_t)result; ctx->hi = (uint32_t)(result >> 32); SET_GPR_S32(ctx, {}, (int32_t)(uint32_t)result); }}", inst.rs, inst.rt, inst.rd); case SPECIAL_MULTU: - return fmt::format("{{ uint64_t result = (uint64_t)GPR_U32(ctx, {}) * (uint64_t)GPR_U32(ctx, {}); ctx->lo = (uint32_t)result; ctx->hi = (uint32_t)(result >> 32); }}", inst.rs, inst.rt); + return fmt::format("{{ uint64_t result = (uint64_t)GPR_U32(ctx, {}) * (uint64_t)GPR_U32(ctx, {}); ctx->lo = (uint32_t)result; ctx->hi = (uint32_t)(result >> 32); SET_GPR_U32(ctx, {}, (uint32_t)result); }}", inst.rs, inst.rt, inst.rd); case SPECIAL_DIV: return fmt::format("{{ int32_t divisor = GPR_S32(ctx, {}); " " int32_t dividend = GPR_S32(ctx, {}); " From faca170150ab000b345860cddc2a1cd24cde05e9 Mon Sep 17 00:00:00 2001 From: Aslan Hud Date: Sat, 21 Feb 2026 14:15:11 +0100 Subject: [PATCH 2/2] fix: EI/DI instructions now toggle COP0 Status bit 16 (EIE) instead of bit 0 (IE) --- ps2xRecomp/src/lib/code_generator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ps2xRecomp/src/lib/code_generator.cpp b/ps2xRecomp/src/lib/code_generator.cpp index 3c259d07..71239771 100644 --- a/ps2xRecomp/src/lib/code_generator.cpp +++ b/ps2xRecomp/src/lib/code_generator.cpp @@ -1258,9 +1258,9 @@ namespace ps2recomp "return;" // Stop execution in this recompiled block ); case COP0_CO_EI: - return fmt::format("ctx->cop0_status |= 0x1; // Enable interrupts"); + return fmt::format("ctx->cop0_status |= 0x10000; // Enable interrupts"); case COP0_CO_DI: - return fmt::format("ctx->cop0_status &= ~0x1; // Disable interrupts"); + return fmt::format("ctx->cop0_status &= ~0x10000; // Disable interrupts"); default: return fmt::format("// Unhandled COP0 CO-OP: 0x{:X}", function); }