From 67d2fc95a3f8169928e55d2d6441d0142c5bf01a Mon Sep 17 00:00:00 2001 From: LegendOfDragoon Date: Mon, 7 Sep 2015 15:10:19 -0700 Subject: [PATCH] Optimize LHU in RSP Recompiler --- Source/RSP/Recompiler Ops.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/RSP/Recompiler Ops.c b/Source/RSP/Recompiler Ops.c index 7e3eec757..e8b4107b1 100644 --- a/Source/RSP/Recompiler Ops.c +++ b/Source/RSP/Recompiler Ops.c @@ -824,8 +824,15 @@ void Compile_LHU ( void ) { Addr &= 0xfff; if ((Addr & 1) != 0) { - CompilerWarning("Unaligned LHU at constant address PC = %04X", CompilePC); - Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LHU,"RSP_Opcode_LHU"); + if ((Addr & 2) == 0) { + CompilerWarning("Unaligned LHU at constant address PC = %04X", CompilePC); + Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LHU, "RSP_Opcode_LHU"); + } else { + char Address[32]; + sprintf(Address, "Dmem + %Xh", Addr); + MoveZxVariableToX86regHalf(RSPInfo.DMEM + (Addr ^ 2), Address, x86_ECX); + MoveX86regToVariable(x86_ECX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt)); + } return; } else { char Address[32];