From 7353b966f234b04e29861d28f15eea0d64395417 Mon Sep 17 00:00:00 2001 From: Ran-j Date: Tue, 15 Apr 2025 23:58:22 -0300 Subject: [PATCH] feat: added decodePMFHL function --- ps2xRecomp/src/code_generator.cpp | 2 +- ps2xRecomp/src/r5900_decoder.cpp | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/ps2xRecomp/src/code_generator.cpp b/ps2xRecomp/src/code_generator.cpp index a5b8f4f..98b0c73 100644 --- a/ps2xRecomp/src/code_generator.cpp +++ b/ps2xRecomp/src/code_generator.cpp @@ -1595,7 +1595,7 @@ namespace ps2recomp return fmt::format("// Calls VU0 microprogram at address {} - not implemented in recompiled code", inst.immediate); - case VU0_VRGET: // TODO - Check if this is correct + case VU0_VRGET: return fmt::format("ctx->vu0_vf[{}] = ctx->vu0_r; // Get VU0 R register", inst.rd); diff --git a/ps2xRecomp/src/r5900_decoder.cpp b/ps2xRecomp/src/r5900_decoder.cpp index 39a8fc7..d24c468 100644 --- a/ps2xRecomp/src/r5900_decoder.cpp +++ b/ps2xRecomp/src/r5900_decoder.cpp @@ -531,22 +531,26 @@ namespace ps2recomp void R5900Decoder::decodePMFHL(Instruction &inst) const { - // PMFHL has different variations based on the sa field uint32_t saField = inst.sa; switch (saField) { case PMFHL_LW: - case PMFHL_UW: - case PMFHL_SLW: - case PMFHL_LH: - case PMFHL_SH: - // Set the appropriate flag for the PMFHL variation - inst.pmfhlVariation = saField; + inst.pmfhlVariation = PMFHL_LW; + break; + case PMFHL_UW: + inst.pmfhlVariation = PMFHL_UW; + break; + case PMFHL_SLW: + inst.pmfhlVariation = PMFHL_SLW; + break; + case PMFHL_LH: + inst.pmfhlVariation = PMFHL_LH; + break; + case PMFHL_SH: + inst.pmfhlVariation = PMFHL_SH; break; - default: - // Unknown PMFHL variation inst.pmfhlVariation = 0xFF; break; }