From 0cb43e0c3337d557e6a3ac0887e8d53d61e92621 Mon Sep 17 00:00:00 2001 From: zilmar Date: Thu, 24 Aug 2023 07:04:35 +0930 Subject: [PATCH] RSP: Remove flag to swap vector register endian --- .../Settings/RspSettings.cpp | 3 +- .../Project64-rsp-core/Settings/RspSettings.h | 2 +- .../Settings/RspSettingsID.h | 1 - Source/Project64-rsp-core/cpu/RSPCpu.cpp | 60 +++----- .../cpu/RSPInterpreterOps.cpp | 132 +++++------------- Source/Project64-rsp-core/cpu/RspTypes.cpp | 16 +-- Source/Project64-rsp/Main.cpp | 13 -- Source/Project64-rsp/Project64-rsp.rc | 1 - Source/Project64-rsp/resource.h | 3 +- 9 files changed, 63 insertions(+), 168 deletions(-) diff --git a/Source/Project64-rsp-core/Settings/RspSettings.cpp b/Source/Project64-rsp-core/Settings/RspSettings.cpp index f936ba116..bcc18d6e1 100644 --- a/Source/Project64-rsp-core/Settings/RspSettings.cpp +++ b/Source/Project64-rsp-core/Settings/RspSettings.cpp @@ -6,7 +6,7 @@ uint16_t Set_AudioHle = 0, Set_GraphicsHle = 0; bool GraphicsHle = true, AudioHle, ConditionalMove; -bool DebuggingEnabled = false, Profiling, IndvidualBlock, ShowErrors, AccurateEmulation = false, BreakOnStart = false, LogRDP = false, LogX86Code = false; +bool DebuggingEnabled = false, Profiling, IndvidualBlock, ShowErrors, BreakOnStart = false, LogRDP = false, LogX86Code = false; void InitializeRspSetting(void) { @@ -15,7 +15,6 @@ void InitializeRspSetting(void) Set_AudioHle = FindSystemSettingId("HLE Audio"); RegisterSetting(Set_BreakOnStart, Data_DWORD_General, "Break on Start", NULL, BreakOnStart, NULL); - RegisterSetting(Set_AccurateEmulation, Data_DWORD_General, "Accurate Emulation", NULL, AccurateEmulation, NULL); RegisterSetting(Set_CPUCore, Data_DWORD_General, "CPU Method", NULL, g_CPUCore, NULL); RegisterSetting(Set_LogRDP, Data_DWORD_General, "Log RDP", NULL, LogRDP, NULL); RegisterSetting(Set_LogX86Code, Data_DWORD_General, "Log X86 Code", NULL, LogX86Code, NULL); diff --git a/Source/Project64-rsp-core/Settings/RspSettings.h b/Source/Project64-rsp-core/Settings/RspSettings.h index 638db4715..08bf3e669 100644 --- a/Source/Project64-rsp-core/Settings/RspSettings.h +++ b/Source/Project64-rsp-core/Settings/RspSettings.h @@ -5,4 +5,4 @@ void InitializeRspSetting(void); extern uint16_t Set_AudioHle, Set_GraphicsHle; extern bool GraphicsHle, AudioHle, ConditionalMove; -extern bool DebuggingEnabled, Profiling, IndvidualBlock, ShowErrors, AccurateEmulation, BreakOnStart, LogRDP, LogX86Code; \ No newline at end of file +extern bool DebuggingEnabled, Profiling, IndvidualBlock, ShowErrors, BreakOnStart, LogRDP, LogX86Code; \ No newline at end of file diff --git a/Source/Project64-rsp-core/Settings/RspSettingsID.h b/Source/Project64-rsp-core/Settings/RspSettingsID.h index 85d31676d..196078592 100644 --- a/Source/Project64-rsp-core/Settings/RspSettingsID.h +++ b/Source/Project64-rsp-core/Settings/RspSettingsID.h @@ -3,7 +3,6 @@ enum { Set_BreakOnStart, - Set_AccurateEmulation, Set_CPUCore, Set_LogRDP, Set_LogX86Code, diff --git a/Source/Project64-rsp-core/cpu/RSPCpu.cpp b/Source/Project64-rsp-core/cpu/RSPCpu.cpp index 6458a3f6f..edc8373ff 100644 --- a/Source/Project64-rsp-core/cpu/RSPCpu.cpp +++ b/Source/Project64-rsp-core/cpu/RSPCpu.cpp @@ -52,44 +52,23 @@ void Build_RSP(void) SetCPU(g_CPUCore); g_RSPDebugger->ResetTimerList(); - if (AccurateEmulation) - { - EleSpec[0].DW = 0x0706050403020100; // None - EleSpec[1].DW = 0x0706050403020100; // None - EleSpec[2].DW = 0x0606040402020000; // 0q - EleSpec[3].DW = 0x0707050503030101; // 1q - EleSpec[4].DW = 0x0404040400000000; // 0h - EleSpec[5].DW = 0x0505050501010101; // 1h - EleSpec[6].DW = 0x0606060602020202; // 2h - EleSpec[7].DW = 0x0707070703030303; // 3h - EleSpec[8].DW = 0x0000000000000000; // 0 - EleSpec[9].DW = 0x0101010101010101; // 1 - EleSpec[10].DW = 0x0202020202020202; // 2 - EleSpec[11].DW = 0x0303030303030303; // 3 - EleSpec[12].DW = 0x0404040404040404; // 4 - EleSpec[13].DW = 0x0505050505050505; // 5 - EleSpec[14].DW = 0x0606060606060606; // 6 - EleSpec[15].DW = 0x0707070707070707; // 7 - } - else - { - EleSpec[0].DW = 0x0001020304050607; // None - EleSpec[1].DW = 0x0001020304050607; // None - EleSpec[2].DW = 0x0000020204040606; // 0q - EleSpec[3].DW = 0x0101030305050707; // 1q - EleSpec[4].DW = 0x0000000004040404; // 0h - EleSpec[5].DW = 0x0101010105050505; // 1h - EleSpec[6].DW = 0x0202020206060606; // 2h - EleSpec[7].DW = 0x0303030307070707; // 3h - EleSpec[8].DW = 0x0000000000000000; // 0 - EleSpec[9].DW = 0x0101010101010101; // 1 - EleSpec[10].DW = 0x0202020202020202; // 2 - EleSpec[11].DW = 0x0303030303030303; // 3 - EleSpec[12].DW = 0x0404040404040404; // 4 - EleSpec[13].DW = 0x0505050505050505; // 5 - EleSpec[14].DW = 0x0606060606060606; // 6 - EleSpec[15].DW = 0x0707070707070707; // 7 - } + EleSpec[0].DW = 0x0001020304050607; // None + EleSpec[1].DW = 0x0001020304050607; // None + EleSpec[2].DW = 0x0000020204040606; // 0q + EleSpec[3].DW = 0x0101030305050707; // 1q + EleSpec[4].DW = 0x0000000004040404; // 0h + EleSpec[5].DW = 0x0101010105050505; // 1h + EleSpec[6].DW = 0x0202020206060606; // 2h + EleSpec[7].DW = 0x0303030307070707; // 3h + EleSpec[8].DW = 0x0000000000000000; // 0 + EleSpec[9].DW = 0x0101010101010101; // 1 + EleSpec[10].DW = 0x0202020202020202; // 2 + EleSpec[11].DW = 0x0303030303030303; // 3 + EleSpec[12].DW = 0x0404040404040404; // 4 + EleSpec[13].DW = 0x0505050505050505; // 5 + EleSpec[14].DW = 0x0606060606060606; // 6 + EleSpec[15].DW = 0x0707070707070707; // 7 + Indx[0].DW = 0x0001020304050607; // None Indx[1].DW = 0x0001020304050607; // None Indx[2].DW = 0x0103050700020406; // 0q @@ -112,10 +91,7 @@ void Build_RSP(void) for (uint8_t z = 0; z < 8; z++) { Indx[i].B[z] = 7 - Indx[i].B[z]; - if (!AccurateEmulation) - { - EleSpec[i].B[z] = 7 - EleSpec[i].B[z]; - } + EleSpec[i].B[z] = 7 - EleSpec[i].B[z]; } for (uint8_t z = 0; z < 4; z++) { diff --git a/Source/Project64-rsp-core/cpu/RSPInterpreterOps.cpp b/Source/Project64-rsp-core/cpu/RSPInterpreterOps.cpp index 452ee6222..86ff240c2 100644 --- a/Source/Project64-rsp-core/cpu/RSPInterpreterOps.cpp +++ b/Source/Project64-rsp-core/cpu/RSPInterpreterOps.cpp @@ -1959,16 +1959,8 @@ void RSP_Vector_VMOV(void) { RSP_ACCUM[i].HW[1] = RSP_Vect[RSPOpC.vt].ue(i, RSPOpC.e); } - uint8_t Index = (RSPOpC.de & 0x7); - if (AccurateEmulation) - { - RSP_Vect[RSPOpC.vd].u16(Index) = RSP_Vect[RSPOpC.vt].ue(Index, RSPOpC.e); - } - else - { - uint8_t del = EleSpec[RSPOpC.e].B[7 - Index]; - RSP_Vect[RSPOpC.vd].u16(7 - Index) = RSP_Vect[RSPOpC.vt].s16(del); - } + uint8_t Index = 7 - (RSPOpC.de & 0x7); + RSP_Vect[RSPOpC.vd].u16(Index) = RSP_Vect[RSPOpC.vt].se(Index, RSPOpC.e); } void RSP_Vector_VRSQ(void) @@ -2116,14 +2108,7 @@ void RSP_Vector_VNOOP(void) void RSP_Opcode_LBV(void) { uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 0)) & 0xFFF; - if (AccurateEmulation) - { - RSP_Vect[RSPOpC.rt].s8(RSPOpC.del) = *(RSPInfo.DMEM + (Address ^ 3)); - } - else - { - RSP_Vect[RSPOpC.rt].s8(15 - RSPOpC.del) = *(RSPInfo.DMEM + (Address ^ 3)); - } + RSP_Vect[RSPOpC.rt].u8((uint8_t)(15 - RSPOpC.del)) = *(RSPInfo.DMEM + (Address ^ 3)); } void RSP_Opcode_LSV(void) @@ -2132,14 +2117,7 @@ void RSP_Opcode_LSV(void) uint8_t Length = std::min((uint8_t)2, (uint8_t)(16 - RSPOpC.del)); for (uint8_t i = RSPOpC.del, n = (uint8_t)(Length + RSPOpC.del); i < n; i++, Address++) { - if (AccurateEmulation) - { - RSP_Vect[RSPOpC.rt].s8(i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)); - } - else - { - RSP_Vect[RSPOpC.rt].s8(15 - i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)); - } + RSP_Vect[RSPOpC.rt].u8(15 - i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)); } } @@ -2149,14 +2127,7 @@ void RSP_Opcode_LLV(void) uint8_t Length = std::min((uint8_t)4, (uint8_t)(16 - RSPOpC.del)); for (uint8_t i = RSPOpC.del, n = (uint8_t)(Length + RSPOpC.del); i < n; i++, Address++) { - if (AccurateEmulation) - { - RSP_Vect[RSPOpC.rt].s8(i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)); - } - else - { - RSP_Vect[RSPOpC.rt].s8(15 - i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)); - } + RSP_Vect[RSPOpC.rt].u8(15 - i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)); } } @@ -2166,14 +2137,7 @@ void RSP_Opcode_LDV(void) uint8_t Length = std::min((uint8_t)8, (uint8_t)(16 - RSPOpC.del)); for (uint8_t i = RSPOpC.del, n = (uint8_t)(Length + RSPOpC.del); i < n; i++, Address++) { - if (AccurateEmulation) - { - RSP_Vect[RSPOpC.rt].s8(i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)); - } - else - { - RSP_Vect[RSPOpC.rt].s8(15 - i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)); - } + RSP_Vect[RSPOpC.rt].u8(15 - i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)); } } @@ -2183,14 +2147,7 @@ void RSP_Opcode_LQV(void) uint8_t Length = std::min((uint8_t)(((Address + 0x10) & ~0xF) - Address), (uint8_t)(16 - RSPOpC.del)); for (uint8_t i = RSPOpC.del, n = (uint8_t)(Length + RSPOpC.del); i < n; i++, Address++) { - if (AccurateEmulation) - { - RSP_Vect[RSPOpC.rt].s8(i) = *(RSPInfo.DMEM + (Address ^ 3)); - } - else - { - RSP_Vect[RSPOpC.rt].s8(15 - i) = *(RSPInfo.DMEM + (Address ^ 3)); - } + RSP_Vect[RSPOpC.rt].u8(15 - i) = *(RSPInfo.DMEM + (Address ^ 3)); } } @@ -2201,14 +2158,7 @@ void RSP_Opcode_LRV(void) Address &= 0xFF0; for (uint8_t i = Offset; i < 16; i++, Address++) { - if (AccurateEmulation) - { - RSP_Vect[RSPOpC.rt].s8(i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)); - } - else - { - RSP_Vect[RSPOpC.rt].s8(15 - i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)); - } + RSP_Vect[RSPOpC.rt].u8(15 - i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)); } } @@ -2220,41 +2170,34 @@ void RSP_Opcode_LPV(void) for (uint8_t i = 0; i < 8; i++) { - if (AccurateEmulation) - { - RSP_Vect[RSPOpC.rt].s16(i) = *(RSPInfo.DMEM + ((Address + ((Offset + i) & 0xF) ^ 3) & 0xFFF)) << 8; - } - else - { - RSP_Vect[RSPOpC.rt].s16(7 - i) = *(RSPInfo.DMEM + ((Address + ((Offset + i) & 0xF) ^ 3) & 0xFFF)) << 8; - } + RSP_Vect[RSPOpC.rt].u16(7 - i) = *(RSPInfo.DMEM + ((Address + ((Offset + i) & 0xF) ^ 3) & 0xFFF)) << 8; } } void RSP_Opcode_LUV(void) { uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 3)) & 0xFFF; - RSP_Vect[RSPOpC.rt].s16(7) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del) & 0xF) ^ 3) & 0xFFF)) << 7; - RSP_Vect[RSPOpC.rt].s16(6) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 1) & 0xF) ^ 3) & 0xFFF)) << 7; - RSP_Vect[RSPOpC.rt].s16(5) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 2) & 0xF) ^ 3) & 0xFFF)) << 7; - RSP_Vect[RSPOpC.rt].s16(4) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 3) & 0xF) ^ 3) & 0xFFF)) << 7; - RSP_Vect[RSPOpC.rt].s16(3) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 4) & 0xF) ^ 3) & 0xFFF)) << 7; - RSP_Vect[RSPOpC.rt].s16(2) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 5) & 0xF) ^ 3) & 0xFFF)) << 7; - RSP_Vect[RSPOpC.rt].s16(1) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 6) & 0xF) ^ 3) & 0xFFF)) << 7; - RSP_Vect[RSPOpC.rt].s16(0) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 7) & 0xF) ^ 3) & 0xFFF)) << 7; + RSP_Vect[RSPOpC.rt].u16(7) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del) & 0xF) ^ 3) & 0xFFF)) << 7; + RSP_Vect[RSPOpC.rt].u16(6) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 1) & 0xF) ^ 3) & 0xFFF)) << 7; + RSP_Vect[RSPOpC.rt].u16(5) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 2) & 0xF) ^ 3) & 0xFFF)) << 7; + RSP_Vect[RSPOpC.rt].u16(4) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 3) & 0xF) ^ 3) & 0xFFF)) << 7; + RSP_Vect[RSPOpC.rt].u16(3) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 4) & 0xF) ^ 3) & 0xFFF)) << 7; + RSP_Vect[RSPOpC.rt].u16(2) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 5) & 0xF) ^ 3) & 0xFFF)) << 7; + RSP_Vect[RSPOpC.rt].u16(1) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 6) & 0xF) ^ 3) & 0xFFF)) << 7; + RSP_Vect[RSPOpC.rt].u16(0) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 7) & 0xF) ^ 3) & 0xFFF)) << 7; } void RSP_Opcode_LHV(void) { uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 4)) & 0xFFF; - RSP_Vect[RSPOpC.rt].s16(7) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del) & 0xF) ^ 3) & 0xFFF)) << 7; - RSP_Vect[RSPOpC.rt].s16(6) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 2) & 0xF) ^ 3) & 0xFFF)) << 7; - RSP_Vect[RSPOpC.rt].s16(5) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 4) & 0xF) ^ 3) & 0xFFF)) << 7; - RSP_Vect[RSPOpC.rt].s16(4) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 6) & 0xF) ^ 3) & 0xFFF)) << 7; - RSP_Vect[RSPOpC.rt].s16(3) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 8) & 0xF) ^ 3) & 0xFFF)) << 7; - RSP_Vect[RSPOpC.rt].s16(2) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 10) & 0xF) ^ 3) & 0xFFF)) << 7; - RSP_Vect[RSPOpC.rt].s16(1) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 12) & 0xF) ^ 3) & 0xFFF)) << 7; - RSP_Vect[RSPOpC.rt].s16(0) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 14) & 0xF) ^ 3) & 0xFFF)) << 7; + RSP_Vect[RSPOpC.rt].u16(7) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del) & 0xF) ^ 3) & 0xFFF)) << 7; + RSP_Vect[RSPOpC.rt].u16(6) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 2) & 0xF) ^ 3) & 0xFFF)) << 7; + RSP_Vect[RSPOpC.rt].u16(5) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 4) & 0xF) ^ 3) & 0xFFF)) << 7; + RSP_Vect[RSPOpC.rt].u16(4) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 6) & 0xF) ^ 3) & 0xFFF)) << 7; + RSP_Vect[RSPOpC.rt].u16(3) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 8) & 0xF) ^ 3) & 0xFFF)) << 7; + RSP_Vect[RSPOpC.rt].u16(2) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 10) & 0xF) ^ 3) & 0xFFF)) << 7; + RSP_Vect[RSPOpC.rt].u16(1) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 12) & 0xF) ^ 3) & 0xFFF)) << 7; + RSP_Vect[RSPOpC.rt].u16(0) = *(RSPInfo.DMEM + ((Address + ((0x10 - RSPOpC.del + 14) & 0xF) ^ 3) & 0xFFF)) << 7; } void RSP_Opcode_LFV(void) @@ -2274,7 +2217,7 @@ void RSP_Opcode_LFV(void) for (uint8_t i = RSPOpC.del, n = (uint8_t)(Length + RSPOpC.del); i < n; i++) { - RSP_Vect[RSPOpC.rt].s8(15 - i) = Temp.s8(15 - i); + RSP_Vect[RSPOpC.rt].u8(15 - i) = Temp.s8(15 - i); } } @@ -2289,8 +2232,8 @@ void RSP_Opcode_LTV(void) for (uint8_t i = 0; i < Length; i++) { uint8_t del = ((8 - (RSPOpC.del >> 1) + i) << 1) & 0xF; - RSP_Vect[RSPOpC.rt + i].s8(15 - del) = *(RSPInfo.DMEM + (Address ^ 3)); - RSP_Vect[RSPOpC.rt + i].s8(14 - del) = *(RSPInfo.DMEM + ((Address + 1) ^ 3)); + RSP_Vect[RSPOpC.rt + i].u8(15 - del) = *(RSPInfo.DMEM + (Address ^ 3)); + RSP_Vect[RSPOpC.rt + i].u8(14 - del) = *(RSPInfo.DMEM + ((Address + 1) ^ 3)); Address += 2; } } @@ -2300,7 +2243,7 @@ void RSP_Opcode_LTV(void) void RSP_Opcode_SBV(void) { uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 0)) & 0xFFF; - *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].s8((uint8_t)(15 - RSPOpC.del)); + *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].u8((uint8_t)(15 - RSPOpC.del)); } void RSP_Opcode_SSV(void) @@ -2308,7 +2251,7 @@ void RSP_Opcode_SSV(void) uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 1)) & 0xFFF; for (uint8_t i = RSPOpC.del, n = (uint8_t)(2 + RSPOpC.del); i < n; i++) { - *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].s8(15 - (i & 0xF)); + *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].u8(15 - (i & 0xF)); Address += 1; } } @@ -2318,7 +2261,7 @@ void RSP_Opcode_SLV(void) uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 2)) & 0xFFF; for (uint8_t i = RSPOpC.del, n = (uint8_t)(4 + RSPOpC.del); i < n; i++) { - *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].s8(15 - (i & 0xF)); + *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].u8(15 - (i & 0xF)); Address += 1; } } @@ -2328,7 +2271,7 @@ void RSP_Opcode_SDV(void) uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 3)) & 0xFFF; for (uint8_t i = RSPOpC.del; i < (8 + RSPOpC.del); i++) { - *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].s8(15 - (i & 0xF)); + *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].u8(15 - (i & 0xF)); Address += 1; } } @@ -2339,14 +2282,7 @@ void RSP_Opcode_SQV(void) uint8_t Length = (uint8_t)(((Address + 0x10) & ~0xF) - Address); for (uint8_t i = RSPOpC.del; i < (Length + RSPOpC.del); i++) { - if (AccurateEmulation) - { - *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].s8(i & 0xF); - } - else - { - *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].s8(15 - (i & 0xF)); - } + *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].u8(15 - (i & 0xF)); Address += 1; } } @@ -2359,7 +2295,7 @@ void RSP_Opcode_SRV(void) Address &= 0xFF0; for (uint8_t i = RSPOpC.del, n = (uint8_t)(Length + RSPOpC.del); i < n; i++) { - *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].s8(15 - ((i + Offset) & 0xF)); + *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].u8(15 - ((i + Offset) & 0xF)); Address += 1; } } diff --git a/Source/Project64-rsp-core/cpu/RspTypes.cpp b/Source/Project64-rsp-core/cpu/RspTypes.cpp index d5df59381..ba1846dd1 100644 --- a/Source/Project64-rsp-core/cpu/RspTypes.cpp +++ b/Source/Project64-rsp-core/cpu/RspTypes.cpp @@ -12,41 +12,41 @@ RSPVector::RSPVector() uint16_t & RSPVector::ue(uint8_t Index, uint8_t Element) { Index = EleSpec[Element].B[Index]; - return ((uint16_t *)&m_Reg)[AccurateEmulation ? 7 - Index : Index]; + return ((uint16_t *)&m_Reg)[Index]; } int16_t & RSPVector::se(uint8_t Index, uint8_t Element) { Index = EleSpec[Element].B[Index]; - return ((int16_t *)&m_Reg)[AccurateEmulation ? 7 - Index : Index]; + return ((int16_t *)&m_Reg)[Index]; } int8_t & RSPVector::s8(uint8_t Index) { - return ((int8_t *)&m_Reg)[AccurateEmulation ? 15 - Index : Index]; + return ((int8_t *)&m_Reg)[Index]; } uint8_t & RSPVector::u8(uint8_t Index) { - return ((uint8_t *)&m_Reg)[AccurateEmulation ? 15 - Index : Index]; + return ((uint8_t *)&m_Reg)[Index]; } int16_t & RSPVector::s16(uint8_t Index) { - return ((int16_t *)&m_Reg)[AccurateEmulation ? 7 - Index : Index]; + return ((int16_t *)&m_Reg)[Index]; } uint16_t & RSPVector::u16(uint8_t Index) { - return ((uint16_t *)&m_Reg)[AccurateEmulation ? 7 - Index : Index]; + return ((uint16_t *)&m_Reg)[Index]; } int32_t & RSPVector::s32(uint8_t Index) { - return ((int32_t *)&m_Reg)[AccurateEmulation ? 3 - Index : Index]; + return ((int32_t *)&m_Reg)[Index]; } uint64_t & RSPVector::u64(uint8_t Index) { - return m_Reg[AccurateEmulation ? 1 - Index : Index]; + return m_Reg[Index]; } diff --git a/Source/Project64-rsp/Main.cpp b/Source/Project64-rsp/Main.cpp index 4f8da7c35..d5d415528 100644 --- a/Source/Project64-rsp/Main.cpp +++ b/Source/Project64-rsp/Main.cpp @@ -169,7 +169,6 @@ void FixMenuState(void) CheckMenuItem(hRSPMenu, ID_CPUMETHOD_RECOMPILER, MF_BYCOMMAND | (g_CPUCore == RecompilerCPU ? MFS_CHECKED : MF_UNCHECKED)); CheckMenuItem(hRSPMenu, ID_CPUMETHOD_INTERPT, MF_BYCOMMAND | (g_CPUCore == InterpreterCPU ? MFS_CHECKED : MF_UNCHECKED)); CheckMenuItem(hRSPMenu, ID_BREAKONSTARTOFTASK, MF_BYCOMMAND | (BreakOnStart ? MFS_CHECKED : MF_UNCHECKED)); - CheckMenuItem(hRSPMenu, ID_ACCURATEEMULATION, MF_BYCOMMAND | (AccurateEmulation ? MFS_CHECKED : MF_UNCHECKED)); CheckMenuItem(hRSPMenu, ID_LOGRDPCOMMANDS, MF_BYCOMMAND | (LogRDP ? MFS_CHECKED : MF_UNCHECKED)); CheckMenuItem(hRSPMenu, ID_SETTINGS_LOGX86CODE, MF_BYCOMMAND | (LogX86Code ? MFS_CHECKED : MF_UNCHECKED)); CheckMenuItem(hRSPMenu, ID_PROFILING_ON, MF_BYCOMMAND | (Profiling ? MFS_CHECKED : MF_UNCHECKED)); @@ -409,17 +408,6 @@ void ProcessMenuItem(int ID) } break; } - case ID_ACCURATEEMULATION: - { - bool Checked = (GetMenuState(hRSPMenu, ID_ACCURATEEMULATION, MF_BYCOMMAND) & MFS_CHECKED) != 0; - CheckMenuItem(hRSPMenu, ID_ACCURATEEMULATION, MF_BYCOMMAND | (Checked ? MFS_UNCHECKED : MFS_CHECKED)); - SetSetting(Set_AccurateEmulation, !Checked); - if (DebuggingEnabled) - { - AccurateEmulation = !Checked; - } - break; - } case ID_LOGRDPCOMMANDS: { bool Checked = (GetMenuState(hRSPMenu, ID_LOGRDPCOMMANDS, MF_BYCOMMAND) & MFS_CHECKED) != 0; @@ -659,7 +647,6 @@ EXPORT void EnableDebugging(int Enabled) if (DebuggingEnabled) { BreakOnStart = GetSetting(Set_BreakOnStart) != 0; - AccurateEmulation = GetSetting(Set_AccurateEmulation) != 0; g_CPUCore = (RSPCpuType)GetSetting(Set_CPUCore); LogRDP = GetSetting(Set_LogRDP) != 0; LogX86Code = GetSetting(Set_LogX86Code) != 0; diff --git a/Source/Project64-rsp/Project64-rsp.rc b/Source/Project64-rsp/Project64-rsp.rc index ef1a0cba1..ffc55ad35 100644 --- a/Source/Project64-rsp/Project64-rsp.rc +++ b/Source/Project64-rsp/Project64-rsp.rc @@ -192,7 +192,6 @@ BEGIN BEGIN MENUITEM "Show Compiler Errors", ID_SHOWCOMPILERERRORS MENUITEM "Break on start of task", ID_BREAKONSTARTOFTASK - MENUITEM "Accurate Emulation", ID_ACCURATEEMULATION MENUITEM "Log RDP Commands", ID_LOGRDPCOMMANDS MENUITEM "Log X86 code", ID_SETTINGS_LOGX86CODE END diff --git a/Source/Project64-rsp/resource.h b/Source/Project64-rsp/resource.h index 0767b659c..783663bcb 100644 --- a/Source/Project64-rsp/resource.h +++ b/Source/Project64-rsp/resource.h @@ -37,14 +37,13 @@ #define ID_CPUMETHOD_RECOMPILER 5016 #define ID_CPUMETHOD_INTERPT 5017 #define ID_SETTINGS_LOGX86CODE 5019 -#define ID_ACCURATEEMULATION 5020 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 108 -#define _APS_NEXT_COMMAND_VALUE 5021 +#define _APS_NEXT_COMMAND_VALUE 5020 #define _APS_NEXT_CONTROL_VALUE 1032 #define _APS_NEXT_SYMED_VALUE 101 #endif