From 1772f1467c9913ba618d938d3d40a2349fe4640d Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 8 Mar 2015 20:17:18 -0400 Subject: [PATCH] Prevent remaining possibilities of overwriting $zero in RSP. In the RSP, MFC0, MFC2, and CFC2 were all susceptible to overwriting $zero. Some of us have tried waiting for some games to use handcoded assembly in an attempt to purposely overwrite $zero in their microcode (to throw off emulators), but so far what few occurrences there have been of this have not included using those 3 opcodes. Since it was decided to centralize the security of register $zero in the main R4300 CPU, it was decided to do so in the RSP as well. --- Source/RSP/Interpreter CPU.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/RSP/Interpreter CPU.c b/Source/RSP/Interpreter CPU.c index b8647093d..0849ef90d 100644 --- a/Source/RSP/Interpreter CPU.c +++ b/Source/RSP/Interpreter CPU.c @@ -444,6 +444,7 @@ DWORD RunInterpreterCPU(DWORD Cycles) { RSP_LW_IMEM(*PrgCount, &RSPOpC.Hex); RSP_Opcode[ RSPOpC.op ](); + RSP_GPR[0].W = 0x00000000; /* MIPS $zero hard-wired to 0 */ switch (RSP_NextInstruction) { case NORMAL: