Rsp: Add a rsp AccurateEmulation flag for new rsp work

This commit is contained in:
zilmar 2023-08-17 12:04:06 +09:30
parent 09ef426ac6
commit 54be4d8135
10 changed files with 188 additions and 159 deletions

View File

@ -6,7 +6,7 @@
uint16_t Set_AudioHle = 0, Set_GraphicsHle = 0; uint16_t Set_AudioHle = 0, Set_GraphicsHle = 0;
bool GraphicsHle = true, AudioHle, ConditionalMove; bool GraphicsHle = true, AudioHle, ConditionalMove;
bool DebuggingEnabled = false, Profiling, IndvidualBlock, ShowErrors, BreakOnStart = false, LogRDP = false, LogX86Code = false; bool DebuggingEnabled = false, Profiling, IndvidualBlock, ShowErrors, AccurateEmulation = false, BreakOnStart = false, LogRDP = false, LogX86Code = false;
void InitializeRspSetting(void) void InitializeRspSetting(void)
{ {
@ -15,6 +15,7 @@ void InitializeRspSetting(void)
Set_AudioHle = FindSystemSettingId("HLE Audio"); Set_AudioHle = FindSystemSettingId("HLE Audio");
RegisterSetting(Set_BreakOnStart, Data_DWORD_General, "Break on Start", NULL, BreakOnStart, NULL); 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_CPUCore, Data_DWORD_General, "CPU Method", NULL, g_CPUCore, NULL);
RegisterSetting(Set_LogRDP, Data_DWORD_General, "Log RDP", NULL, LogRDP, NULL); RegisterSetting(Set_LogRDP, Data_DWORD_General, "Log RDP", NULL, LogRDP, NULL);
RegisterSetting(Set_LogX86Code, Data_DWORD_General, "Log X86 Code", NULL, LogX86Code, NULL); RegisterSetting(Set_LogX86Code, Data_DWORD_General, "Log X86 Code", NULL, LogX86Code, NULL);

View File

@ -5,4 +5,4 @@ void InitializeRspSetting(void);
extern uint16_t Set_AudioHle, Set_GraphicsHle; extern uint16_t Set_AudioHle, Set_GraphicsHle;
extern bool GraphicsHle, AudioHle, ConditionalMove; extern bool GraphicsHle, AudioHle, ConditionalMove;
extern bool DebuggingEnabled, Profiling, IndvidualBlock, ShowErrors, BreakOnStart, LogRDP, LogX86Code; extern bool DebuggingEnabled, Profiling, IndvidualBlock, ShowErrors, AccurateEmulation, BreakOnStart, LogRDP, LogX86Code;

View File

@ -3,12 +3,12 @@
enum enum
{ {
Set_BreakOnStart, Set_BreakOnStart,
Set_AccurateEmulation,
Set_CPUCore, Set_CPUCore,
Set_LogRDP, Set_LogRDP,
Set_LogX86Code, Set_LogX86Code,
Set_Profiling, Set_Profiling,
Set_IndvidualBlock, Set_IndvidualBlock,
Set_AccurateEmulation,
Set_ShowErrors, Set_ShowErrors,
// Compiler settings // Compiler settings

View File

@ -2,6 +2,7 @@
#include <Common/CriticalSection.h> #include <Common/CriticalSection.h>
#include <Project64-rsp-core/RSPDebugger.h> #include <Project64-rsp-core/RSPDebugger.h>
#include <Project64-rsp-core/RSPInfo.h> #include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/Settings/RspSettings.h>
#include <Project64-rsp-core/cpu/RSPRegisters.h> #include <Project64-rsp-core/cpu/RSPRegisters.h>
UDWORD EleSpec[16], Indx[16]; UDWORD EleSpec[16], Indx[16];
@ -51,23 +52,44 @@ void Build_RSP(void)
SetCPU(g_CPUCore); SetCPU(g_CPUCore);
g_RSPDebugger->ResetTimerList(); g_RSPDebugger->ResetTimerList();
EleSpec[0].DW = 0x0706050403020100; // None if (AccurateEmulation)
EleSpec[1].DW = 0x0706050403020100; // None {
EleSpec[2].DW = 0x0606040402020000; // 0q EleSpec[0].DW = 0x0706050403020100; // None
EleSpec[3].DW = 0x0707050503030101; // 1q EleSpec[1].DW = 0x0706050403020100; // None
EleSpec[4].DW = 0x0404040400000000; // 0h EleSpec[2].DW = 0x0606040402020000; // 0q
EleSpec[5].DW = 0x0505050501010101; // 1h EleSpec[3].DW = 0x0707050503030101; // 1q
EleSpec[6].DW = 0x0606060602020202; // 2h EleSpec[4].DW = 0x0404040400000000; // 0h
EleSpec[7].DW = 0x0707070703030303; // 3h EleSpec[5].DW = 0x0505050501010101; // 1h
EleSpec[8].DW = 0x0000000000000000; // 0 EleSpec[6].DW = 0x0606060602020202; // 2h
EleSpec[9].DW = 0x0101010101010101; // 1 EleSpec[7].DW = 0x0707070703030303; // 3h
EleSpec[10].DW = 0x0202020202020202; // 2 EleSpec[8].DW = 0x0000000000000000; // 0
EleSpec[11].DW = 0x0303030303030303; // 3 EleSpec[9].DW = 0x0101010101010101; // 1
EleSpec[12].DW = 0x0404040404040404; // 4 EleSpec[10].DW = 0x0202020202020202; // 2
EleSpec[13].DW = 0x0505050505050505; // 5 EleSpec[11].DW = 0x0303030303030303; // 3
EleSpec[14].DW = 0x0606060606060606; // 6 EleSpec[12].DW = 0x0404040404040404; // 4
EleSpec[15].DW = 0x0707070707070707; // 7 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
}
Indx[0].DW = 0x0001020304050607; // None Indx[0].DW = 0x0001020304050607; // None
Indx[1].DW = 0x0001020304050607; // None Indx[1].DW = 0x0001020304050607; // None
Indx[2].DW = 0x0103050700020406; // 0q Indx[2].DW = 0x0103050700020406; // 0q

View File

@ -417,7 +417,6 @@ unsigned int RSP_branch_if(int condition)
{ {
unsigned int new_PC; unsigned int new_PC;
/* RSP_NextInstruction = DELAY_SLOT; */
if (condition) if (condition)
{ {
new_PC = *PrgCount + 4 + ((short)RSPOpC.offset << 2); new_PC = *PrgCount + 4 + ((short)RSPOpC.offset << 2);

View File

@ -1960,7 +1960,15 @@ void RSP_Vector_VMOV(void)
RSP_ACCUM[i].HW[1] = RSP_Vect[RSPOpC.vt].ue(i, RSPOpC.e); RSP_ACCUM[i].HW[1] = RSP_Vect[RSPOpC.vt].ue(i, RSPOpC.e);
} }
uint8_t Index = (RSPOpC.de & 0x7); uint8_t Index = (RSPOpC.de & 0x7);
RSP_Vect[RSPOpC.vd].u16(Index) = RSP_Vect[RSPOpC.vt].ue(Index, RSPOpC.e); if (AccurateEmulation)
{
RSP_Vect[RSPOpC.vd].u16(Index) = RSP_Vect[RSPOpC.vt].ue(Index, RSPOpC.e);
}
else
{
uint8_t del = EleSpec[RSPOpC.e].B[Index];
RSP_Vect[RSPOpC.vd].u16(7 - Index) = RSP_Vect[RSPOpC.vt].s16(7 - del);
}
} }
void RSP_Vector_VRSQ(void) void RSP_Vector_VRSQ(void)
@ -2108,7 +2116,14 @@ void RSP_Vector_VNOOP(void)
void RSP_Opcode_LBV(void) void RSP_Opcode_LBV(void)
{ {
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 0)) & 0xFFF; uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 0)) & 0xFFF;
RSP_Vect[RSPOpC.rt].s8(RSPOpC.del) = *(RSPInfo.DMEM + (Address ^ 3)); 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));
}
} }
void RSP_Opcode_LSV(void) void RSP_Opcode_LSV(void)
@ -2117,7 +2132,14 @@ void RSP_Opcode_LSV(void)
uint8_t Length = std::min((uint8_t)2, (uint8_t)(16 - RSPOpC.del)); 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++) for (uint8_t i = RSPOpC.del, n = (uint8_t)(Length + RSPOpC.del); i < n; i++, Address++)
{ {
RSP_Vect[RSPOpC.rt].s8(i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)); 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));
}
} }
} }
@ -2127,7 +2149,14 @@ void RSP_Opcode_LLV(void)
uint8_t Length = std::min((uint8_t)4, (uint8_t)(16 - RSPOpC.del)); 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++) for (uint8_t i = RSPOpC.del, n = (uint8_t)(Length + RSPOpC.del); i < n; i++, Address++)
{ {
RSP_Vect[RSPOpC.rt].s8(i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)); 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));
}
} }
} }
@ -2135,10 +2164,16 @@ void RSP_Opcode_LDV(void)
{ {
uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 3)) & 0xFFF; uint32_t Address = (uint32_t)(RSP_GPR[RSPOpC.base].W + (RSPOpC.voffset << 3)) & 0xFFF;
uint8_t Length = std::min((uint8_t)8, (uint8_t)(16 - RSPOpC.del)); 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++) for (uint8_t i = RSPOpC.del, n = (uint8_t)(Length + RSPOpC.del); i < n; i++, Address++)
{ {
RSP_Vect[RSPOpC.rt].s8(i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)); if (AccurateEmulation)
Address += 1; {
RSP_Vect[RSPOpC.rt].s8(i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF));
}
else
{
RSP_Vect[RSPOpC.rt].s8(15 - i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF));
}
} }
} }
@ -2148,7 +2183,14 @@ void RSP_Opcode_LQV(void)
uint8_t Length = std::min((uint8_t)(((Address + 0x10) & ~0xF) - Address), (uint8_t)(16 - RSPOpC.del)); 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++) for (uint8_t i = RSPOpC.del, n = (uint8_t)(Length + RSPOpC.del); i < n; i++, Address++)
{ {
RSP_Vect[RSPOpC.rt].s8(i) = *(RSPInfo.DMEM + (Address ^ 3)); if (AccurateEmulation)
{
RSP_Vect[RSPOpC.rt].s8(i) = *(RSPInfo.DMEM + (Address ^ 3));
}
else
{
RSP_Vect[RSPOpC.rt].s8(15 - i) = *(RSPInfo.DMEM + (Address ^ 3));
}
} }
} }
@ -2159,7 +2201,14 @@ void RSP_Opcode_LRV(void)
Address &= 0xFF0; Address &= 0xFF0;
for (uint8_t i = Offset; i < 16; i++, Address++) for (uint8_t i = Offset; i < 16; i++, Address++)
{ {
RSP_Vect[RSPOpC.rt].s8(i) = *(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)); 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));
}
} }
} }
@ -2171,7 +2220,14 @@ void RSP_Opcode_LPV(void)
for (uint8_t i = 0; i < 8; i++) for (uint8_t i = 0; i < 8; i++)
{ {
RSP_Vect[RSPOpC.rt].s16(i) = *(RSPInfo.DMEM + ((Address + ((Offset + i) & 0xF) ^ 3) & 0xFFF)) << 8; 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;
}
} }
} }
@ -2283,7 +2339,14 @@ void RSP_Opcode_SQV(void)
uint8_t Length = (uint8_t)(((Address + 0x10) & ~0xF) - Address); uint8_t Length = (uint8_t)(((Address + 0x10) & ~0xF) - Address);
for (uint8_t i = RSPOpC.del; i < (Length + RSPOpC.del); i++) for (uint8_t i = RSPOpC.del; i < (Length + RSPOpC.del); i++)
{ {
*(RSPInfo.DMEM + ((Address ^ 3) & 0xFFF)) = RSP_Vect[RSPOpC.rt].s8(i & 0xF); 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));
}
Address += 1; Address += 1;
} }
} }

View File

@ -1,4 +1,5 @@
#include "RspTypes.h" #include "RspTypes.h"
#include <Project64-rsp-core/Settings/RspSettings.h>
extern UDWORD EleSpec[16]; extern UDWORD EleSpec[16];
@ -11,41 +12,41 @@ RSPVector::RSPVector()
uint16_t & RSPVector::ue(uint8_t Index, uint8_t Element) uint16_t & RSPVector::ue(uint8_t Index, uint8_t Element)
{ {
Index = EleSpec[Element].B[Index]; Index = EleSpec[Element].B[Index];
return ((uint16_t *)&m_Reg)[7 - Index]; return ((uint16_t *)&m_Reg)[AccurateEmulation ? 7 - Index : Index];
} }
int16_t & RSPVector::se(uint8_t Index, uint8_t Element) int16_t & RSPVector::se(uint8_t Index, uint8_t Element)
{ {
Index = EleSpec[Element].B[Index]; Index = EleSpec[Element].B[Index];
return ((int16_t *)&m_Reg)[7 - Index]; return ((int16_t *)&m_Reg)[AccurateEmulation ? 7 - Index : Index];
} }
int8_t & RSPVector::s8(uint8_t Index) int8_t & RSPVector::s8(uint8_t Index)
{ {
return ((int8_t *)&m_Reg)[15 - Index]; return ((int8_t *)&m_Reg)[AccurateEmulation ? 15 - Index : Index];
} }
uint8_t & RSPVector::u8(uint8_t Index) uint8_t & RSPVector::u8(uint8_t Index)
{ {
return ((uint8_t *)&m_Reg)[15 - Index]; return ((uint8_t *)&m_Reg)[AccurateEmulation ? 15 - Index : Index];
} }
int16_t & RSPVector::s16(uint8_t Index) int16_t & RSPVector::s16(uint8_t Index)
{ {
return ((int16_t *)&m_Reg)[7 - Index]; return ((int16_t *)&m_Reg)[AccurateEmulation ? 7 - Index : Index];
} }
uint16_t & RSPVector::u16(uint8_t Index) uint16_t & RSPVector::u16(uint8_t Index)
{ {
return ((uint16_t *)&m_Reg)[7 - Index]; return ((uint16_t *)&m_Reg)[AccurateEmulation ? 7 - Index : Index];
} }
int32_t & RSPVector::s32(uint8_t Index) int32_t & RSPVector::s32(uint8_t Index)
{ {
return ((int32_t *)&m_Reg)[3 - Index]; return ((int32_t *)&m_Reg)[AccurateEmulation ? 3 - Index : Index];
} }
uint64_t & RSPVector::u64(uint8_t Index) uint64_t & RSPVector::u64(uint8_t Index)
{ {
return m_Reg[1 - Index]; return m_Reg[AccurateEmulation ? 1 - Index : Index];
} }

View File

@ -169,6 +169,7 @@ void FixMenuState(void)
CheckMenuItem(hRSPMenu, ID_CPUMETHOD_RECOMPILER, MF_BYCOMMAND | (g_CPUCore == RecompilerCPU ? MFS_CHECKED : MF_UNCHECKED)); 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_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_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_LOGRDPCOMMANDS, MF_BYCOMMAND | (LogRDP ? MFS_CHECKED : MF_UNCHECKED));
CheckMenuItem(hRSPMenu, ID_SETTINGS_LOGX86CODE, MF_BYCOMMAND | (LogX86Code ? 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)); CheckMenuItem(hRSPMenu, ID_PROFILING_ON, MF_BYCOMMAND | (Profiling ? MFS_CHECKED : MF_UNCHECKED));
@ -350,8 +351,6 @@ EXPORT void InitiateRSPDebugger(DEBUG_INFO Debug_Info)
#ifdef _WIN32 #ifdef _WIN32
void ProcessMenuItem(int ID) void ProcessMenuItem(int ID)
{ {
UINT uState;
switch (ID) switch (ID)
{ {
case ID_RSPCOMMANDS: Enter_RSP_Commands_Window(); break; case ID_RSPCOMMANDS: Enter_RSP_Commands_Window(); break;
@ -361,78 +360,39 @@ void ProcessMenuItem(int ID)
case ID_PROFILING_ON: case ID_PROFILING_ON:
case ID_PROFILING_OFF: case ID_PROFILING_OFF:
{ {
uState = GetMenuState(hRSPMenu, ID_PROFILING_ON, MF_BYCOMMAND); bool ProfilingOn = ID == ID_PROFILING_ON;
CheckMenuItem(hRSPMenu, ID_PROFILING_ON, MF_BYCOMMAND | (ProfilingOn ? MFS_CHECKED : MFS_UNCHECKED));
if (uState & MFS_CHECKED) CheckMenuItem(hRSPMenu, ID_PROFILING_OFF, MF_BYCOMMAND | (ProfilingOn ? MFS_UNCHECKED : MFS_CHECKED));
SetSetting(Set_Profiling, ProfilingOn);
if (DebuggingEnabled)
{ {
CheckMenuItem(hRSPMenu, ID_PROFILING_ON, MF_BYCOMMAND | MFS_UNCHECKED); Profiling = ProfilingOn;
CheckMenuItem(hRSPMenu, ID_PROFILING_OFF, MF_BYCOMMAND | MFS_CHECKED);
SetSetting(Set_Profiling, false);
if (DebuggingEnabled)
{
Profiling = false;
}
}
else
{
CheckMenuItem(hRSPMenu, ID_PROFILING_ON, MF_BYCOMMAND | MFS_CHECKED);
CheckMenuItem(hRSPMenu, ID_PROFILING_OFF, MF_BYCOMMAND | MFS_UNCHECKED);
SetSetting(Set_Profiling, true);
if (DebuggingEnabled)
{
Profiling = true;
}
} }
break;
} }
break;
case ID_PROFILING_RESETSTATS: ResetTimerList(); break; case ID_PROFILING_RESETSTATS: ResetTimerList(); break;
case ID_PROFILING_GENERATELOG: GenerateTimerResults(); break; case ID_PROFILING_GENERATELOG: GenerateTimerResults(); break;
case ID_PROFILING_LOGINDIVIDUALBLOCKS: case ID_PROFILING_LOGINDIVIDUALBLOCKS:
{ {
uState = GetMenuState(hRSPMenu, ID_PROFILING_LOGINDIVIDUALBLOCKS, MF_BYCOMMAND); bool Checked = (GetMenuState(hRSPMenu, ID_PROFILING_LOGINDIVIDUALBLOCKS, MF_BYCOMMAND) & MFS_CHECKED) != 0;
CheckMenuItem(hRSPMenu, ID_PROFILING_LOGINDIVIDUALBLOCKS, MF_BYCOMMAND | (Checked ? MFS_UNCHECKED : MFS_CHECKED));
if (uState & MFS_CHECKED) SetSetting(Set_IndvidualBlock, !Checked);
if (DebuggingEnabled)
{ {
CheckMenuItem(hRSPMenu, ID_PROFILING_LOGINDIVIDUALBLOCKS, MF_BYCOMMAND | MFS_UNCHECKED); IndvidualBlock = !Checked;
SetSetting(Set_IndvidualBlock, false);
if (DebuggingEnabled)
{
IndvidualBlock = false;
}
}
else
{
CheckMenuItem(hRSPMenu, ID_PROFILING_LOGINDIVIDUALBLOCKS, MF_BYCOMMAND | MFS_CHECKED);
SetSetting(Set_IndvidualBlock, true);
if (DebuggingEnabled)
{
IndvidualBlock = true;
}
} }
break; break;
} }
case ID_SHOWCOMPILERERRORS: case ID_SHOWCOMPILERERRORS:
{ {
uState = GetMenuState(hRSPMenu, ID_SHOWCOMPILERERRORS, MF_BYCOMMAND); bool Checked = (GetMenuState(hRSPMenu, ID_SHOWCOMPILERERRORS, MF_BYCOMMAND) & MFS_CHECKED) != 0;
CheckMenuItem(hRSPMenu, ID_SHOWCOMPILERERRORS, MF_BYCOMMAND | (Checked ? MFS_UNCHECKED : MFS_CHECKED));
if (uState & MFS_CHECKED) SetSetting(Set_ShowErrors, !Checked);
if (DebuggingEnabled)
{ {
CheckMenuItem(hRSPMenu, ID_SHOWCOMPILERERRORS, MF_BYCOMMAND | MFS_UNCHECKED); ShowErrors = !Checked;
SetSetting(Set_ShowErrors, false);
if (DebuggingEnabled)
{
ShowErrors = false;
}
}
else
{
CheckMenuItem(hRSPMenu, ID_SHOWCOMPILERERRORS, MF_BYCOMMAND | MFS_CHECKED);
SetSetting(Set_ShowErrors, true);
if (DebuggingEnabled)
{
ShowErrors = true;
}
} }
break;
} }
break; break;
case ID_COMPILER: case ID_COMPILER:
@ -440,97 +400,77 @@ void ProcessMenuItem(int ID)
break; break;
case ID_BREAKONSTARTOFTASK: case ID_BREAKONSTARTOFTASK:
{ {
uState = GetMenuState(hRSPMenu, ID_BREAKONSTARTOFTASK, MF_BYCOMMAND); bool Checked = (GetMenuState(hRSPMenu, ID_BREAKONSTARTOFTASK, MF_BYCOMMAND) & MFS_CHECKED) != 0;
CheckMenuItem(hRSPMenu, ID_BREAKONSTARTOFTASK, MF_BYCOMMAND | (Checked ? MFS_UNCHECKED : MFS_CHECKED));
if (uState & MFS_CHECKED) SetSetting(Set_BreakOnStart, !Checked);
if (DebuggingEnabled)
{ {
CheckMenuItem(hRSPMenu, ID_BREAKONSTARTOFTASK, MF_BYCOMMAND | MFS_UNCHECKED); BreakOnStart = !Checked;
SetSetting(Set_BreakOnStart, false);
if (DebuggingEnabled)
{
BreakOnStart = false;
}
}
else
{
CheckMenuItem(hRSPMenu, ID_BREAKONSTARTOFTASK, MF_BYCOMMAND | MFS_CHECKED);
SetSetting(Set_BreakOnStart, true);
if (DebuggingEnabled)
{
BreakOnStart = true;
}
} }
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;
} }
break;
case ID_LOGRDPCOMMANDS: case ID_LOGRDPCOMMANDS:
{ {
uState = GetMenuState(hRSPMenu, ID_LOGRDPCOMMANDS, MF_BYCOMMAND); bool Checked = (GetMenuState(hRSPMenu, ID_LOGRDPCOMMANDS, MF_BYCOMMAND) & MFS_CHECKED) != 0;
CheckMenuItem(hRSPMenu, ID_LOGRDPCOMMANDS, MF_BYCOMMAND | (Checked ? MFS_UNCHECKED : MFS_CHECKED));
if (uState & MFS_CHECKED) SetSetting(Set_LogRDP, !Checked);
if (DebuggingEnabled)
{ {
CheckMenuItem(hRSPMenu, ID_LOGRDPCOMMANDS, MF_BYCOMMAND | MFS_UNCHECKED); LogRDP = !Checked;
SetSetting(Set_LogRDP, false); if (LogRDP)
if (DebuggingEnabled) {
StartRDPLog();
}
else
{ {
LogRDP = false;
StopRDPLog(); StopRDPLog();
} }
} }
else break;
{
CheckMenuItem(hRSPMenu, ID_LOGRDPCOMMANDS, MF_BYCOMMAND | MFS_CHECKED);
SetSetting(Set_LogRDP, true);
if (DebuggingEnabled)
{
LogRDP = true;
StartRDPLog();
}
}
} }
break;
case ID_SETTINGS_LOGX86CODE: case ID_SETTINGS_LOGX86CODE:
{ {
uState = GetMenuState(hRSPMenu, ID_SETTINGS_LOGX86CODE, MF_BYCOMMAND); bool Checked = (GetMenuState(hRSPMenu, ID_SETTINGS_LOGX86CODE, MF_BYCOMMAND) & MFS_CHECKED) != 0;
CheckMenuItem(hRSPMenu, ID_SETTINGS_LOGX86CODE, MF_BYCOMMAND | (Checked ? MFS_UNCHECKED : MFS_CHECKED));
if (uState & MFS_CHECKED) SetSetting(Set_LogX86Code, !Checked);
if (DebuggingEnabled)
{ {
CheckMenuItem(hRSPMenu, ID_SETTINGS_LOGX86CODE, MF_BYCOMMAND | MFS_UNCHECKED); LogX86Code = !Checked;
SetSetting(Set_LogX86Code, false); if (LogX86Code)
if (DebuggingEnabled) {
StartCPULog();
}
else
{ {
LogX86Code = false;
StopCPULog(); StopCPULog();
} }
} }
else break;
{
CheckMenuItem(hRSPMenu, ID_SETTINGS_LOGX86CODE, MF_BYCOMMAND | MFS_CHECKED);
SetSetting(Set_LogX86Code, true);
if (DebuggingEnabled)
{
LogX86Code = true;
StartCPULog();
}
}
} }
break;
case ID_CPUMETHOD_RECOMPILER: case ID_CPUMETHOD_RECOMPILER:
{
SetSetting(Set_CPUCore, RecompilerCPU); SetSetting(Set_CPUCore, RecompilerCPU);
g_CPUCore = RecompilerCPU; g_CPUCore = RecompilerCPU;
FixMenuState(); FixMenuState();
SetCPU(RecompilerCPU); SetCPU(RecompilerCPU);
break; break;
}
case ID_CPUMETHOD_INTERPT: case ID_CPUMETHOD_INTERPT:
{
SetSetting(Set_CPUCore, InterpreterCPU); SetSetting(Set_CPUCore, InterpreterCPU);
g_CPUCore = InterpreterCPU; g_CPUCore = InterpreterCPU;
FixMenuState(); FixMenuState();
SetCPU(InterpreterCPU); SetCPU(InterpreterCPU);
break; break;
} }
}
} }
#endif #endif
@ -719,6 +659,7 @@ EXPORT void EnableDebugging(int Enabled)
if (DebuggingEnabled) if (DebuggingEnabled)
{ {
BreakOnStart = GetSetting(Set_BreakOnStart) != 0; BreakOnStart = GetSetting(Set_BreakOnStart) != 0;
AccurateEmulation = GetSetting(Set_AccurateEmulation) != 0;
g_CPUCore = (RSPCpuType)GetSetting(Set_CPUCore); g_CPUCore = (RSPCpuType)GetSetting(Set_CPUCore);
LogRDP = GetSetting(Set_LogRDP) != 0; LogRDP = GetSetting(Set_LogRDP) != 0;
LogX86Code = GetSetting(Set_LogX86Code) != 0; LogX86Code = GetSetting(Set_LogX86Code) != 0;

View File

@ -192,6 +192,7 @@ BEGIN
BEGIN BEGIN
MENUITEM "Show Compiler Errors", ID_SHOWCOMPILERERRORS MENUITEM "Show Compiler Errors", ID_SHOWCOMPILERERRORS
MENUITEM "Break on start of task", ID_BREAKONSTARTOFTASK MENUITEM "Break on start of task", ID_BREAKONSTARTOFTASK
MENUITEM "Accurate Emulation", ID_ACCURATEEMULATION
MENUITEM "Log RDP Commands", ID_LOGRDPCOMMANDS MENUITEM "Log RDP Commands", ID_LOGRDPCOMMANDS
MENUITEM "Log X86 code", ID_SETTINGS_LOGX86CODE MENUITEM "Log X86 code", ID_SETTINGS_LOGX86CODE
END END

View File

@ -37,13 +37,14 @@
#define ID_CPUMETHOD_RECOMPILER 5016 #define ID_CPUMETHOD_RECOMPILER 5016
#define ID_CPUMETHOD_INTERPT 5017 #define ID_CPUMETHOD_INTERPT 5017
#define ID_SETTINGS_LOGX86CODE 5019 #define ID_SETTINGS_LOGX86CODE 5019
#define ID_ACCURATEEMULATION 5020
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 108 #define _APS_NEXT_RESOURCE_VALUE 108
#define _APS_NEXT_COMMAND_VALUE 5020 #define _APS_NEXT_COMMAND_VALUE 5021
#define _APS_NEXT_CONTROL_VALUE 1032 #define _APS_NEXT_CONTROL_VALUE 1032
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif