RSP: Use bool instead of Boolean

This commit is contained in:
zilmar 2023-06-29 12:29:07 +09:30
parent 2ce9eaa667
commit 02da0ccad1
17 changed files with 899 additions and 922 deletions

View File

@ -35,7 +35,7 @@ DWORD Mfc0Count, SemaphoreExit = 0;
void SetCPU(DWORD core) void SetCPU(DWORD core)
{ {
WaitForSingleObjectEx(hMutex, 1000 * 100, FALSE); WaitForSingleObjectEx(hMutex, 1000 * 100, false);
CPUCore = core; CPUCore = core;
switch (core) switch (core)
{ {
@ -169,7 +169,7 @@ DWORD RunRecompilerCPU(DWORD Cycles);
uint32_t DoRspCycles(uint32_t Cycles) uint32_t DoRspCycles(uint32_t Cycles)
{ {
extern Boolean AudioHle, GraphicsHle; extern bool AudioHle, GraphicsHle;
DWORD TaskType = *(DWORD *)(RSPInfo.DMEM + 0xFC0); DWORD TaskType = *(DWORD *)(RSPInfo.DMEM + 0xFC0);
/* if (*RSPInfo.SP_STATUS_REG & SP_STATUS_SIG0) /* if (*RSPInfo.SP_STATUS_REG & SP_STATUS_SIG0)
@ -215,7 +215,7 @@ uint32_t DoRspCycles(uint32_t Cycles)
RSPInfo.ShowCFB(); RSPInfo.ShowCFB();
} }
Compiler.bAudioUcode = (TaskType == 2) ? TRUE : FALSE; Compiler.bAudioUcode = (TaskType == 2) ? true : false;
/* /*
*RSPInfo.SP_STATUS_REG |= (0x0203 ); *RSPInfo.SP_STATUS_REG |= (0x0203 );
@ -232,7 +232,7 @@ uint32_t DoRspCycles(uint32_t Cycles)
StartTimer((DWORD)Timer_RSP_Running); StartTimer((DWORD)Timer_RSP_Running);
} }
WaitForSingleObjectEx(hMutex, 1000 * 100, FALSE); WaitForSingleObjectEx(hMutex, 1000 * 100, false);
if (BreakOnStart) if (BreakOnStart)
{ {

View File

@ -380,7 +380,7 @@ void BuildInterpreterCPU(void)
DWORD RunInterpreterCPU(DWORD Cycles) DWORD RunInterpreterCPU(DWORD Cycles)
{ {
DWORD CycleCount; DWORD CycleCount;
RSP_Running = TRUE; RSP_Running = true;
Enable_RSP_Commands_Window(); Enable_RSP_Commands_Window();
CycleCount = 0; CycleCount = 0;
@ -414,15 +414,15 @@ DWORD RunInterpreterCPU(DWORD Cycles)
if (Stepping_Commands) if (Stepping_Commands)
{ {
WaitingForStep = TRUE; WaitingForStep = true;
SetRSPCommandViewto(*PrgCount); SetRSPCommandViewto(*PrgCount);
UpdateRSPRegistersScreen(); UpdateRSPRegistersScreen();
while (WaitingForStep == TRUE) while (WaitingForStep == true)
{ {
Sleep(20); Sleep(20);
if (!Stepping_Commands) if (!Stepping_Commands)
{ {
WaitingForStep = FALSE; WaitingForStep = false;
} }
} }
} }
@ -453,7 +453,7 @@ DWORD RunInterpreterCPU(DWORD Cycles)
case SINGLE_STEP_DONE: case SINGLE_STEP_DONE:
*PrgCount = (*PrgCount + 4) & 0xFFC; *PrgCount = (*PrgCount + 4) & 0xFFC;
*RSPInfo.SP_STATUS_REG |= SP_STATUS_HALT; *RSPInfo.SP_STATUS_REG |= SP_STATUS_HALT;
RSP_Running = FALSE; RSP_Running = false;
break; break;
} }
} }

View File

@ -34,7 +34,7 @@
#endif #endif
extern UWORD32 Recp, RecpResult, SQroot, SQrootResult; extern UWORD32 Recp, RecpResult, SQroot, SQrootResult;
extern Boolean AudioHle, GraphicsHle; extern bool AudioHle, GraphicsHle;
// Opcode functions // Opcode functions
@ -244,7 +244,7 @@ void RSP_Special_JALR(void)
void RSP_Special_BREAK(void) void RSP_Special_BREAK(void)
{ {
RSP_Running = FALSE; RSP_Running = false;
*RSPInfo.SP_STATUS_REG |= (SP_STATUS_HALT | SP_STATUS_BROKE); *RSPInfo.SP_STATUS_REG |= (SP_STATUS_HALT | SP_STATUS_BROKE);
if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0) if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0)
{ {
@ -348,7 +348,7 @@ void RSP_Cop0_MF(void)
RSP_GPR[RSPOpC.rt].UW = *RSPInfo.SP_STATUS_REG; RSP_GPR[RSPOpC.rt].UW = *RSPInfo.SP_STATUS_REG;
if (Mfc0Count != 0 && RSP_MfStatusCount > Mfc0Count) if (Mfc0Count != 0 && RSP_MfStatusCount > Mfc0Count)
{ {
RSP_Running = FALSE; RSP_Running = false;
} }
break; break;
case 5: RSP_GPR[RSPOpC.rt].UW = *RSPInfo.SP_DMA_FULL_REG; break; case 5: RSP_GPR[RSPOpC.rt].UW = *RSPInfo.SP_DMA_FULL_REG; break;
@ -362,7 +362,7 @@ void RSP_Cop0_MF(void)
{ {
RSP_GPR[RSPOpC.rt].W = *RSPInfo.SP_SEMAPHORE_REG; RSP_GPR[RSPOpC.rt].W = *RSPInfo.SP_SEMAPHORE_REG;
*RSPInfo.SP_SEMAPHORE_REG = 1; *RSPInfo.SP_SEMAPHORE_REG = 1;
RSP_Running = FALSE; RSP_Running = false;
} }
break; break;
case 8: RSP_GPR[RSPOpC.rt].UW = *RSPInfo.DPC_START_REG; break; case 8: RSP_GPR[RSPOpC.rt].UW = *RSPInfo.DPC_START_REG; break;
@ -414,7 +414,7 @@ void RSP_Cop0_MT(void)
{ {
*RSPInfo.MI_INTR_REG |= R4300i_SP_Intr; *RSPInfo.MI_INTR_REG |= R4300i_SP_Intr;
RSPInfo.CheckInterrupts(); RSPInfo.CheckInterrupts();
RSP_Running = FALSE; RSP_Running = false;
} }
if ((RSP_GPR[RSPOpC.rt].W & SP_CLR_SSTEP) != 0) if ((RSP_GPR[RSPOpC.rt].W & SP_CLR_SSTEP) != 0)
{ {
@ -1824,8 +1824,6 @@ void RSP_Vector_VNXOR(void)
void RSP_Vector_VRCP(void) void RSP_Vector_VRCP(void)
{ {
int count, neg;
RecpResult.W = RSP_Vect[RSPOpC.rt].HW[EleSpec[RSPOpC.rs].B[(RSPOpC.rd & 0x7)]]; RecpResult.W = RSP_Vect[RSPOpC.rt].HW[EleSpec[RSPOpC.rs].B[(RSPOpC.rd & 0x7)]];
if (RecpResult.UW == 0) if (RecpResult.UW == 0)
{ {
@ -1833,16 +1831,12 @@ void RSP_Vector_VRCP(void)
} }
else else
{ {
if (RecpResult.W < 0) bool neg = RecpResult.W < 0;
if (neg)
{ {
neg = TRUE;
RecpResult.W = ~RecpResult.W + 1; RecpResult.W = ~RecpResult.W + 1;
} }
else for (int count = 15; count > 0; count--)
{
neg = FALSE;
}
for (count = 15; count > 0; count--)
{ {
if ((RecpResult.W & (1 << count))) if ((RecpResult.W & (1 << count)))
{ {
@ -1856,7 +1850,7 @@ void RSP_Vector_VRCP(void)
RecpResult.W = (long)((0x7FFFFFFF / (double)RecpResult.W)); RecpResult.W = (long)((0x7FFFFFFF / (double)RecpResult.W));
OldModel = _controlfp(OldModel, _MCW_RC); OldModel = _controlfp(OldModel, _MCW_RC);
} }
for (count = 31; count > 0; count--) for (int count = 31; count > 0; count--)
{ {
if ((RecpResult.W & (1 << count))) if ((RecpResult.W & (1 << count)))
{ {
@ -1864,12 +1858,12 @@ void RSP_Vector_VRCP(void)
count = 0; count = 0;
} }
} }
if (neg == TRUE) if (neg == true)
{ {
RecpResult.W = ~RecpResult.W; RecpResult.W = ~RecpResult.W;
} }
} }
for (count = 0; count < 8; count++) for (int count = 0; count < 8; count++)
{ {
RSP_ACCUM[count].HW[1] = RSP_Vect[RSPOpC.rt].UHW[EleSpec[RSPOpC.rs].B[count]]; RSP_ACCUM[count].HW[1] = RSP_Vect[RSPOpC.rt].UHW[EleSpec[RSPOpC.rs].B[count]];
} }
@ -1889,7 +1883,7 @@ void RSP_Vector_VRCPL(void)
{ {
if (RecpResult.W < 0) if (RecpResult.W < 0)
{ {
neg = TRUE; neg = true;
if (RecpResult.UHW[1] == 0xFFFF && RecpResult.HW[0] < 0) if (RecpResult.UHW[1] == 0xFFFF && RecpResult.HW[0] < 0)
{ {
RecpResult.W = ~RecpResult.W + 1; RecpResult.W = ~RecpResult.W + 1;
@ -1901,7 +1895,7 @@ void RSP_Vector_VRCPL(void)
} }
else else
{ {
neg = FALSE; neg = false;
} }
for (count = 31; count > 0; count--) for (count = 31; count > 0; count--)
{ {
@ -1925,7 +1919,7 @@ void RSP_Vector_VRCPL(void)
count = 0; count = 0;
} }
} }
if (neg == TRUE) if (neg == true)
{ {
RecpResult.W = ~RecpResult.W; RecpResult.W = ~RecpResult.W;
} }
@ -1978,12 +1972,12 @@ void RSP_Vector_VRSQ(void)
{ {
if (SQrootResult.W < 0) if (SQrootResult.W < 0)
{ {
neg = TRUE; neg = true;
SQrootResult.W = ~SQrootResult.W + 1; SQrootResult.W = ~SQrootResult.W + 1;
} }
else else
{ {
neg = FALSE; neg = false;
} }
for (count = 15; count > 0; count--) for (count = 15; count > 0; count--)
{ {
@ -2007,7 +2001,7 @@ void RSP_Vector_VRSQ(void)
count = 0; count = 0;
} }
} }
if (neg == TRUE) if (neg == true)
{ {
SQrootResult.W = ~SQrootResult.W; SQrootResult.W = ~SQrootResult.W;
} }
@ -2036,7 +2030,7 @@ void RSP_Vector_VRSQL(void)
{ {
if (SQrootResult.W < 0) if (SQrootResult.W < 0)
{ {
neg = TRUE; neg = true;
if (SQrootResult.UHW[1] == 0xFFFF && SQrootResult.HW[0] < 0) if (SQrootResult.UHW[1] == 0xFFFF && SQrootResult.HW[0] < 0)
{ {
SQrootResult.W = ~SQrootResult.W + 1; SQrootResult.W = ~SQrootResult.W + 1;
@ -2048,7 +2042,7 @@ void RSP_Vector_VRSQL(void)
} }
else else
{ {
neg = FALSE; neg = false;
} }
for (count = 31; count > 0; count--) for (count = 31; count > 0; count--)
{ {
@ -2071,7 +2065,7 @@ void RSP_Vector_VRSQL(void)
count = 0; count = 0;
} }
} }
if (neg == TRUE) if (neg == true)
{ {
SQrootResult.W = ~SQrootResult.W; SQrootResult.W = ~SQrootResult.W;
} }

View File

@ -30,18 +30,18 @@
void ClearAllx86Code(void); void ClearAllx86Code(void);
void ProcessMenuItem(int ID); void ProcessMenuItem(int ID);
#ifdef _WIN32 #ifdef _WIN32
Boolean CALLBACK CompilerDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); bool CALLBACK CompilerDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
HMENU hRSPMenu = NULL; HMENU hRSPMenu = NULL;
#endif #endif
Boolean GraphicsHle = TRUE, AudioHle, ConditionalMove; bool GraphicsHle = true, AudioHle, ConditionalMove;
Boolean DebuggingEnabled = FALSE, bool DebuggingEnabled = false,
Profiling, Profiling,
IndvidualBlock, IndvidualBlock,
ShowErrors, ShowErrors,
BreakOnStart = FALSE, BreakOnStart = false,
LogRDP = FALSE, LogRDP = false,
LogX86Code = FALSE; LogX86Code = false;
uint32_t CPUCore = RecompilerCPU; uint32_t CPUCore = RecompilerCPU;
void * hMutex = NULL; void * hMutex = NULL;
@ -191,7 +191,7 @@ EXPORT void DllAbout(void * hParent)
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD /*fdwReason*/, LPVOID /*lpvReserved*/) BOOL WINAPI DllMain(HINSTANCE hinst, DWORD /*fdwReason*/, LPVOID /*lpvReserved*/)
{ {
hinstDLL = hinst; hinstDLL = hinst;
return TRUE; return true;
} }
void FixMenuState(void) void FixMenuState(void)
@ -233,8 +233,8 @@ EXPORT void GetDllInfo(PLUGIN_INFO * PluginInfo)
#else #else
sprintf(PluginInfo->Name, "RSP plugin %s", VER_FILE_VERSION_STR); sprintf(PluginInfo->Name, "RSP plugin %s", VER_FILE_VERSION_STR);
#endif #endif
PluginInfo->Reserved2 = FALSE; PluginInfo->Reserved2 = false;
PluginInfo->Reserved1 = TRUE; PluginInfo->Reserved1 = true;
} }
/* /*
@ -259,7 +259,7 @@ EXPORT void GetRspDebugInfo(RSPDEBUG_INFO * _DebugInfo)
#endif #endif
_DebugInfo->ProcessMenuItem = ProcessMenuItem; _DebugInfo->ProcessMenuItem = ProcessMenuItem;
_DebugInfo->UseBPoints = TRUE; _DebugInfo->UseBPoints = true;
sprintf(_DebugInfo->BPPanelName, " RSP "); sprintf(_DebugInfo->BPPanelName, " RSP ");
_DebugInfo->Add_BPoint = Add_BPoint; _DebugInfo->Add_BPoint = Add_BPoint;
_DebugInfo->CreateBPPanel = CreateBPPanel; _DebugInfo->CreateBPPanel = CreateBPPanel;
@ -330,32 +330,32 @@ needs five arguments, not two. Also, GCC lacks SEH.
if (Intel_Features & 0x02000000) if (Intel_Features & 0x02000000)
{ {
Compiler.mmx2 = TRUE; Compiler.mmx2 = true;
Compiler.sse = TRUE; Compiler.sse = true;
} }
if (Intel_Features & 0x00800000) if (Intel_Features & 0x00800000)
{ {
Compiler.mmx = TRUE; Compiler.mmx = true;
} }
if (AMD_Features & 0x40000000) if (AMD_Features & 0x40000000)
{ {
Compiler.mmx2 = TRUE; Compiler.mmx2 = true;
} }
if (Intel_Features & 0x00008000) if (Intel_Features & 0x00008000)
{ {
ConditionalMove = TRUE; ConditionalMove = true;
} }
else else
{ {
ConditionalMove = FALSE; ConditionalMove = false;
} }
} }
EXPORT void InitiateRSP(RSP_INFO Rsp_Info, uint32_t * CycleCount) EXPORT void InitiateRSP(RSP_INFO Rsp_Info, uint32_t * CycleCount)
{ {
RSPInfo = Rsp_Info; RSPInfo = Rsp_Info;
AudioHle = GetSystemSetting(Set_AudioHle); AudioHle = GetSystemSetting(Set_AudioHle) != 0;
GraphicsHle = GetSystemSetting(Set_GraphicsHle); GraphicsHle = GetSystemSetting(Set_GraphicsHle) != 0;
*CycleCount = 0; *CycleCount = 0;
AllocateMemory(); AllocateMemory();
@ -402,20 +402,20 @@ void ProcessMenuItem(int ID)
{ {
CheckMenuItem(hRSPMenu, ID_PROFILING_ON, MF_BYCOMMAND | MFS_UNCHECKED); CheckMenuItem(hRSPMenu, ID_PROFILING_ON, MF_BYCOMMAND | MFS_UNCHECKED);
CheckMenuItem(hRSPMenu, ID_PROFILING_OFF, MF_BYCOMMAND | MFS_CHECKED); CheckMenuItem(hRSPMenu, ID_PROFILING_OFF, MF_BYCOMMAND | MFS_CHECKED);
SetSetting(Set_Profiling, FALSE); SetSetting(Set_Profiling, false);
if (DebuggingEnabled) if (DebuggingEnabled)
{ {
Profiling = FALSE; Profiling = false;
} }
} }
else else
{ {
CheckMenuItem(hRSPMenu, ID_PROFILING_ON, MF_BYCOMMAND | MFS_CHECKED); CheckMenuItem(hRSPMenu, ID_PROFILING_ON, MF_BYCOMMAND | MFS_CHECKED);
CheckMenuItem(hRSPMenu, ID_PROFILING_OFF, MF_BYCOMMAND | MFS_UNCHECKED); CheckMenuItem(hRSPMenu, ID_PROFILING_OFF, MF_BYCOMMAND | MFS_UNCHECKED);
SetSetting(Set_Profiling, TRUE); SetSetting(Set_Profiling, true);
if (DebuggingEnabled) if (DebuggingEnabled)
{ {
Profiling = TRUE; Profiling = true;
} }
} }
} }
@ -429,19 +429,19 @@ void ProcessMenuItem(int ID)
if (uState & MFS_CHECKED) if (uState & MFS_CHECKED)
{ {
CheckMenuItem(hRSPMenu, ID_PROFILING_LOGINDIVIDUALBLOCKS, MF_BYCOMMAND | MFS_UNCHECKED); CheckMenuItem(hRSPMenu, ID_PROFILING_LOGINDIVIDUALBLOCKS, MF_BYCOMMAND | MFS_UNCHECKED);
SetSetting(Set_IndvidualBlock, FALSE); SetSetting(Set_IndvidualBlock, false);
if (DebuggingEnabled) if (DebuggingEnabled)
{ {
IndvidualBlock = FALSE; IndvidualBlock = false;
} }
} }
else else
{ {
CheckMenuItem(hRSPMenu, ID_PROFILING_LOGINDIVIDUALBLOCKS, MF_BYCOMMAND | MFS_CHECKED); CheckMenuItem(hRSPMenu, ID_PROFILING_LOGINDIVIDUALBLOCKS, MF_BYCOMMAND | MFS_CHECKED);
SetSetting(Set_IndvidualBlock, TRUE); SetSetting(Set_IndvidualBlock, true);
if (DebuggingEnabled) if (DebuggingEnabled)
{ {
IndvidualBlock = TRUE; IndvidualBlock = true;
} }
} }
} }
@ -453,19 +453,19 @@ void ProcessMenuItem(int ID)
if (uState & MFS_CHECKED) if (uState & MFS_CHECKED)
{ {
CheckMenuItem(hRSPMenu, ID_SHOWCOMPILERERRORS, MF_BYCOMMAND | MFS_UNCHECKED); CheckMenuItem(hRSPMenu, ID_SHOWCOMPILERERRORS, MF_BYCOMMAND | MFS_UNCHECKED);
SetSetting(Set_ShowErrors, FALSE); SetSetting(Set_ShowErrors, false);
if (DebuggingEnabled) if (DebuggingEnabled)
{ {
ShowErrors = FALSE; ShowErrors = false;
} }
} }
else else
{ {
CheckMenuItem(hRSPMenu, ID_SHOWCOMPILERERRORS, MF_BYCOMMAND | MFS_CHECKED); CheckMenuItem(hRSPMenu, ID_SHOWCOMPILERERRORS, MF_BYCOMMAND | MFS_CHECKED);
SetSetting(Set_ShowErrors, TRUE); SetSetting(Set_ShowErrors, true);
if (DebuggingEnabled) if (DebuggingEnabled)
{ {
ShowErrors = TRUE; ShowErrors = true;
} }
} }
} }
@ -480,19 +480,19 @@ void ProcessMenuItem(int ID)
if (uState & MFS_CHECKED) if (uState & MFS_CHECKED)
{ {
CheckMenuItem(hRSPMenu, ID_BREAKONSTARTOFTASK, MF_BYCOMMAND | MFS_UNCHECKED); CheckMenuItem(hRSPMenu, ID_BREAKONSTARTOFTASK, MF_BYCOMMAND | MFS_UNCHECKED);
SetSetting(Set_BreakOnStart, FALSE); SetSetting(Set_BreakOnStart, false);
if (DebuggingEnabled) if (DebuggingEnabled)
{ {
BreakOnStart = FALSE; BreakOnStart = false;
} }
} }
else else
{ {
CheckMenuItem(hRSPMenu, ID_BREAKONSTARTOFTASK, MF_BYCOMMAND | MFS_CHECKED); CheckMenuItem(hRSPMenu, ID_BREAKONSTARTOFTASK, MF_BYCOMMAND | MFS_CHECKED);
SetSetting(Set_BreakOnStart, TRUE); SetSetting(Set_BreakOnStart, true);
if (DebuggingEnabled) if (DebuggingEnabled)
{ {
BreakOnStart = TRUE; BreakOnStart = true;
} }
} }
} }
@ -504,20 +504,20 @@ void ProcessMenuItem(int ID)
if (uState & MFS_CHECKED) if (uState & MFS_CHECKED)
{ {
CheckMenuItem(hRSPMenu, ID_LOGRDPCOMMANDS, MF_BYCOMMAND | MFS_UNCHECKED); CheckMenuItem(hRSPMenu, ID_LOGRDPCOMMANDS, MF_BYCOMMAND | MFS_UNCHECKED);
SetSetting(Set_LogRDP, FALSE); SetSetting(Set_LogRDP, false);
if (DebuggingEnabled) if (DebuggingEnabled)
{ {
LogRDP = FALSE; LogRDP = false;
StopRDPLog(); StopRDPLog();
} }
} }
else else
{ {
CheckMenuItem(hRSPMenu, ID_LOGRDPCOMMANDS, MF_BYCOMMAND | MFS_CHECKED); CheckMenuItem(hRSPMenu, ID_LOGRDPCOMMANDS, MF_BYCOMMAND | MFS_CHECKED);
SetSetting(Set_LogRDP, TRUE); SetSetting(Set_LogRDP, true);
if (DebuggingEnabled) if (DebuggingEnabled)
{ {
LogRDP = TRUE; LogRDP = true;
StartRDPLog(); StartRDPLog();
} }
} }
@ -530,20 +530,20 @@ void ProcessMenuItem(int ID)
if (uState & MFS_CHECKED) if (uState & MFS_CHECKED)
{ {
CheckMenuItem(hRSPMenu, ID_SETTINGS_LOGX86CODE, MF_BYCOMMAND | MFS_UNCHECKED); CheckMenuItem(hRSPMenu, ID_SETTINGS_LOGX86CODE, MF_BYCOMMAND | MFS_UNCHECKED);
SetSetting(Set_LogX86Code, FALSE); SetSetting(Set_LogX86Code, false);
if (DebuggingEnabled) if (DebuggingEnabled)
{ {
LogX86Code = FALSE; LogX86Code = false;
StopCPULog(); StopCPULog();
} }
} }
else else
{ {
CheckMenuItem(hRSPMenu, ID_SETTINGS_LOGX86CODE, MF_BYCOMMAND | MFS_CHECKED); CheckMenuItem(hRSPMenu, ID_SETTINGS_LOGX86CODE, MF_BYCOMMAND | MFS_CHECKED);
SetSetting(Set_LogX86Code, TRUE); SetSetting(Set_LogX86Code, true);
if (DebuggingEnabled) if (DebuggingEnabled)
{ {
LogX86Code = TRUE; LogX86Code = true;
StartCPULog(); StartCPULog();
} }
} }
@ -612,39 +612,39 @@ EXPORT void RomClosed(void)
} }
#ifdef _WIN32 #ifdef _WIN32
static BOOL GetBooleanCheck(HWND hDlg, DWORD DialogID) static bool GetBooleanCheck(HWND hDlg, DWORD DialogID)
{ {
return (IsDlgButtonChecked(hDlg, DialogID) == BST_CHECKED) ? TRUE : FALSE; return (IsDlgButtonChecked(hDlg, DialogID) == BST_CHECKED) ? true : false;
} }
BOOL CALLBACK CompilerDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam*/) bool CALLBACK CompilerDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam*/)
{ {
char Buffer[256]; char Buffer[256];
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
if (Compiler.bDest == TRUE) if (Compiler.bDest == true)
CheckDlgButton(hDlg, IDC_COMPILER_DEST, BST_CHECKED); CheckDlgButton(hDlg, IDC_COMPILER_DEST, BST_CHECKED);
if (Compiler.mmx == TRUE) if (Compiler.mmx == true)
CheckDlgButton(hDlg, IDC_CHECK_MMX, BST_CHECKED); CheckDlgButton(hDlg, IDC_CHECK_MMX, BST_CHECKED);
if (Compiler.mmx2 == TRUE) if (Compiler.mmx2 == true)
CheckDlgButton(hDlg, IDC_CHECK_MMX2, BST_CHECKED); CheckDlgButton(hDlg, IDC_CHECK_MMX2, BST_CHECKED);
if (Compiler.sse == TRUE) if (Compiler.sse == true)
CheckDlgButton(hDlg, IDC_CHECK_SSE, BST_CHECKED); CheckDlgButton(hDlg, IDC_CHECK_SSE, BST_CHECKED);
if (Compiler.bAlignVector == TRUE) if (Compiler.bAlignVector == true)
CheckDlgButton(hDlg, IDC_COMPILER_ALIGNVEC, BST_CHECKED); CheckDlgButton(hDlg, IDC_COMPILER_ALIGNVEC, BST_CHECKED);
if (Compiler.bSections == TRUE) if (Compiler.bSections == true)
CheckDlgButton(hDlg, IDC_COMPILER_SECTIONS, BST_CHECKED); CheckDlgButton(hDlg, IDC_COMPILER_SECTIONS, BST_CHECKED);
if (Compiler.bGPRConstants == TRUE) if (Compiler.bGPRConstants == true)
CheckDlgButton(hDlg, IDC_COMPILER_GPRCONSTANTS, BST_CHECKED); CheckDlgButton(hDlg, IDC_COMPILER_GPRCONSTANTS, BST_CHECKED);
if (Compiler.bReOrdering == TRUE) if (Compiler.bReOrdering == true)
CheckDlgButton(hDlg, IDC_COMPILER_REORDER, BST_CHECKED); CheckDlgButton(hDlg, IDC_COMPILER_REORDER, BST_CHECKED);
if (Compiler.bFlags == TRUE) if (Compiler.bFlags == true)
CheckDlgButton(hDlg, IDC_COMPILER_FLAGS, BST_CHECKED); CheckDlgButton(hDlg, IDC_COMPILER_FLAGS, BST_CHECKED);
if (Compiler.bAccum == TRUE) if (Compiler.bAccum == true)
CheckDlgButton(hDlg, IDC_COMPILER_ACCUM, BST_CHECKED); CheckDlgButton(hDlg, IDC_COMPILER_ACCUM, BST_CHECKED);
SetTimer(hDlg, 1, 250, NULL); SetTimer(hDlg, 1, 250, NULL);
@ -681,18 +681,18 @@ BOOL CALLBACK CompilerDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lPar
SetSetting(Set_AlignVector, Compiler.bAlignVector); SetSetting(Set_AlignVector, Compiler.bAlignVector);
KillTimer(hDlg, 1); KillTimer(hDlg, 1);
EndDialog(hDlg, TRUE); EndDialog(hDlg, true);
break; break;
case IDCANCEL: case IDCANCEL:
KillTimer(hDlg, 1); KillTimer(hDlg, 1);
EndDialog(hDlg, TRUE); EndDialog(hDlg, true);
break; break;
} }
break; break;
default: default:
return FALSE; return false;
} }
return TRUE; return true;
} }
BOOL CALLBACK ConfigDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam*/) BOOL CALLBACK ConfigDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam*/)
@ -703,11 +703,11 @@ BOOL CALLBACK ConfigDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam
switch (uMsg) switch (uMsg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
if (AudioHle == TRUE) if (AudioHle == true)
{ {
CheckDlgButton(hDlg, IDC_AUDIOHLE, BST_CHECKED); CheckDlgButton(hDlg, IDC_AUDIOHLE, BST_CHECKED);
} }
if (GraphicsHle == TRUE) if (GraphicsHle == true)
{ {
CheckDlgButton(hDlg, IDC_GRAPHICSHLE, BST_CHECKED); CheckDlgButton(hDlg, IDC_GRAPHICSHLE, BST_CHECKED);
} }
@ -728,17 +728,17 @@ BOOL CALLBACK ConfigDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam
AudioHle = GetBooleanCheck(hDlg, IDC_AUDIOHLE); AudioHle = GetBooleanCheck(hDlg, IDC_AUDIOHLE);
GraphicsHle = GetBooleanCheck(hDlg, IDC_GRAPHICSHLE); GraphicsHle = GetBooleanCheck(hDlg, IDC_GRAPHICSHLE);
EndDialog(hDlg, TRUE); EndDialog(hDlg, true);
break; break;
case IDCANCEL: case IDCANCEL:
EndDialog(hDlg, TRUE); EndDialog(hDlg, true);
break; break;
} }
break; break;
default: default:
return FALSE; return false;
} }
return TRUE; return true;
} }
#endif #endif
@ -748,29 +748,29 @@ BOOL CALLBACK ConfigDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam
DialogBox(hinstDLL, "RSPCONFIG", GetForegroundWindow(), ConfigDlgProc); DialogBox(hinstDLL, "RSPCONFIG", GetForegroundWindow(), ConfigDlgProc);
}*/ }*/
EXPORT void EnableDebugging(Boolean Enabled) EXPORT void EnableDebugging(int Enabled)
{ {
DebuggingEnabled = Enabled; DebuggingEnabled = Enabled != 0;
if (DebuggingEnabled) if (DebuggingEnabled)
{ {
BreakOnStart = GetSetting(Set_BreakOnStart); BreakOnStart = GetSetting(Set_BreakOnStart) != 0;
CPUCore = GetSetting(Set_CPUCore); CPUCore = GetSetting(Set_CPUCore) != 0;
LogRDP = GetSetting(Set_LogRDP); LogRDP = GetSetting(Set_LogRDP) != 0;
LogX86Code = GetSetting(Set_LogX86Code); LogX86Code = GetSetting(Set_LogX86Code) != 0;
Profiling = GetSetting(Set_Profiling); Profiling = GetSetting(Set_Profiling) != 0;
IndvidualBlock = GetSetting(Set_IndvidualBlock); IndvidualBlock = GetSetting(Set_IndvidualBlock) != 0;
ShowErrors = GetSetting(Set_ShowErrors); ShowErrors = GetSetting(Set_ShowErrors) != 0;
Compiler.bDest = GetSetting(Set_CheckDest); Compiler.bDest = GetSetting(Set_CheckDest) != 0;
Compiler.bAccum = GetSetting(Set_Accum); Compiler.bAccum = GetSetting(Set_Accum) != 0;
Compiler.mmx = GetSetting(Set_Mmx); Compiler.mmx = GetSetting(Set_Mmx) != 0;
Compiler.mmx2 = GetSetting(Set_Mmx2); Compiler.mmx2 = GetSetting(Set_Mmx2) != 0;
Compiler.sse = GetSetting(Set_Sse); Compiler.sse = GetSetting(Set_Sse) != 0;
Compiler.bSections = GetSetting(Set_Sections); Compiler.bSections = GetSetting(Set_Sections) != 0;
Compiler.bReOrdering = GetSetting(Set_ReOrdering); Compiler.bReOrdering = GetSetting(Set_ReOrdering) != 0;
Compiler.bGPRConstants = GetSetting(Set_GPRConstants); Compiler.bGPRConstants = GetSetting(Set_GPRConstants) != 0;
Compiler.bFlags = GetSetting(Set_Flags); Compiler.bFlags = GetSetting(Set_Flags) != 0;
Compiler.bAlignVector = GetSetting(Set_AlignVector); Compiler.bAlignVector = GetSetting(Set_AlignVector) != 0;
SetCPU(CPUCore); SetCPU(CPUCore);
} }
#ifdef _WIN32 #ifdef _WIN32
@ -796,21 +796,21 @@ EXPORT void PluginLoaded(void)
#else #else
CPUCore = InterpreterCPU; CPUCore = InterpreterCPU;
#endif #endif
LogRDP = FALSE; LogRDP = false;
LogX86Code = FALSE; LogX86Code = false;
Profiling = FALSE; Profiling = false;
IndvidualBlock = FALSE; IndvidualBlock = false;
ShowErrors = FALSE; ShowErrors = false;
memset(&Compiler, 0, sizeof(Compiler)); memset(&Compiler, 0, sizeof(Compiler));
Compiler.bDest = TRUE; Compiler.bDest = true;
Compiler.bAlignVector = FALSE; Compiler.bAlignVector = false;
Compiler.bFlags = TRUE; Compiler.bFlags = true;
Compiler.bReOrdering = TRUE; Compiler.bReOrdering = true;
Compiler.bSections = TRUE; Compiler.bSections = true;
Compiler.bAccum = TRUE; Compiler.bAccum = true;
Compiler.bGPRConstants = TRUE; Compiler.bGPRConstants = true;
DetectCpuSpecs(); DetectCpuSpecs();
SetModuleName("RSP"); SetModuleName("RSP");
@ -841,10 +841,10 @@ EXPORT void PluginLoaded(void)
RegisterSetting(Set_Mfc0Count, Data_DWORD_Game, "Mfc0Count", NULL, 0x0, NULL); RegisterSetting(Set_Mfc0Count, Data_DWORD_Game, "Mfc0Count", NULL, 0x0, NULL);
RegisterSetting(Set_SemaphoreExit, Data_DWORD_Game, "SemaphoreExit", NULL, 0x0, NULL); RegisterSetting(Set_SemaphoreExit, Data_DWORD_Game, "SemaphoreExit", NULL, 0x0, NULL);
AudioHle = Set_AudioHle != 0 ? GetSystemSetting(Set_AudioHle) : false; AudioHle = Set_AudioHle != 0 ? GetSystemSetting(Set_AudioHle) != 0 : false;
GraphicsHle = Set_GraphicsHle != 0 ? GetSystemSetting(Set_GraphicsHle) : true; GraphicsHle = Set_GraphicsHle != 0 ? GetSystemSetting(Set_GraphicsHle) != 0 : true;
#ifdef _WIN32 #ifdef _WIN32
hMutex = (HANDLE)CreateMutex(NULL, FALSE, NULL); hMutex = (HANDLE)CreateMutex(NULL, false, NULL);
#endif #endif
SetCPU(CPUCore); SetCPU(CPUCore);
} }

View File

@ -47,7 +47,7 @@ RSPCOMMANDLINE RSPCommandLine[30];
HWND RSPCommandshWnd, hList, hAddress, hFunctionlist, hGoButton, hBreakButton, HWND RSPCommandshWnd, hList, hAddress, hFunctionlist, hGoButton, hBreakButton,
hStepButton, hSkipButton, hBPButton, hR4300iRegisters, hR4300iDebugger, hRSPRegisters, hStepButton, hSkipButton, hBPButton, hR4300iRegisters, hR4300iDebugger, hRSPRegisters,
hMemory, hScrlBar; hMemory, hScrlBar;
Boolean InRSPCommandsWindow; bool InRSPCommandsWindow;
char CommandName[100]; char CommandName[100];
DWORD Stepping_Commands, WaitingForStep; DWORD Stepping_Commands, WaitingForStep;
@ -57,10 +57,10 @@ void Create_RSP_Commands_Window(int Child)
if (Child) if (Child)
{ {
InRSPCommandsWindow = TRUE; InRSPCommandsWindow = true;
DialogBoxA((HINSTANCE)hinstDLL, "RSPCOMMAND", NULL, (DLGPROC)RSP_Commands_Proc); DialogBoxA((HINSTANCE)hinstDLL, "RSPCOMMAND", NULL, (DLGPROC)RSP_Commands_Proc);
InRSPCommandsWindow = FALSE; InRSPCommandsWindow = false;
memset(RSPCommandLine, 0, sizeof(RSPCommandLine)); memset(RSPCommandLine, 0, sizeof(RSPCommandLine));
SetRSPCommandToRunning(); SetRSPCommandToRunning();
} }
@ -68,9 +68,9 @@ void Create_RSP_Commands_Window(int Child)
{ {
if (!InRSPCommandsWindow) if (!InRSPCommandsWindow)
{ {
Stepping_Commands = TRUE; Stepping_Commands = true;
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Create_RSP_Commands_Window, CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Create_RSP_Commands_Window,
(LPVOID)TRUE, 0, &ThreadID); (LPVOID)true, 0, &ThreadID);
} }
else else
{ {
@ -91,16 +91,16 @@ void Disable_RSP_Commands_Window(void)
{ {
return; return;
} }
EnableWindow(hList, FALSE); EnableWindow(hList, false);
EnableWindow(hAddress, FALSE); EnableWindow(hAddress, false);
EnableWindow(hScrlBar, FALSE); EnableWindow(hScrlBar, false);
EnableWindow(hGoButton, FALSE); EnableWindow(hGoButton, false);
EnableWindow(hStepButton, FALSE); EnableWindow(hStepButton, false);
EnableWindow(hSkipButton, FALSE); EnableWindow(hSkipButton, false);
EnableWindow(hR4300iRegisters, FALSE); EnableWindow(hR4300iRegisters, false);
EnableWindow(hRSPRegisters, FALSE); EnableWindow(hRSPRegisters, false);
EnableWindow(hR4300iDebugger, FALSE); EnableWindow(hR4300iDebugger, false);
EnableWindow(hMemory, FALSE); EnableWindow(hMemory, false);
si.cbSize = sizeof(si); si.cbSize = sizeof(si);
si.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; si.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;
@ -108,14 +108,14 @@ void Disable_RSP_Commands_Window(void)
si.nMax = 0; si.nMax = 0;
si.nPos = 1; si.nPos = 1;
si.nPage = 1; si.nPage = 1;
SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE); SetScrollInfo(hScrlBar, SB_CTL, &si, true);
} }
int DisplayRSPCommand(DWORD location, int InsertPos) int DisplayRSPCommand(DWORD location, int InsertPos)
{ {
uint32_t OpCode; uint32_t OpCode;
DWORD LinesUsed = 1, status; DWORD LinesUsed = 1, status;
Boolean Redraw = FALSE; bool Redraw = false;
RSP_LW_IMEM(location, &OpCode); RSP_LW_IMEM(location, &OpCode);
@ -130,15 +130,15 @@ int DisplayRSPCommand(DWORD location, int InsertPos)
} }
if (RSPCommandLine[InsertPos].opcode != OpCode) if (RSPCommandLine[InsertPos].opcode != OpCode)
{ {
Redraw = TRUE; Redraw = true;
} }
if (RSPCommandLine[InsertPos].Location != location) if (RSPCommandLine[InsertPos].Location != location)
{ {
Redraw = TRUE; Redraw = true;
} }
if (RSPCommandLine[InsertPos].status != status) if (RSPCommandLine[InsertPos].status != status)
{ {
Redraw = TRUE; Redraw = true;
} }
if (Redraw) if (Redraw)
{ {
@ -320,19 +320,19 @@ void DrawRSPCommand(LPARAM lParam)
if (*PrgCount == RSPCommandLine[ditem->itemID].Location) if (*PrgCount == RSPCommandLine[ditem->itemID].Location)
{ {
ResetColor = TRUE; ResetColor = true;
hBrush = (HBRUSH)(COLOR_HIGHLIGHT + 1); hBrush = (HBRUSH)(COLOR_HIGHLIGHT + 1);
oldColor = SetTextColor(ditem->hDC, RGB(255, 255, 255)); oldColor = SetTextColor(ditem->hDC, RGB(255, 255, 255));
} }
else else
{ {
ResetColor = FALSE; ResetColor = false;
hBrush = (HBRUSH)GetStockObject(WHITE_BRUSH); hBrush = (HBRUSH)GetStockObject(WHITE_BRUSH);
} }
if (CheckForRSPBPoint(RSPCommandLine[ditem->itemID].Location)) if (CheckForRSPBPoint(RSPCommandLine[ditem->itemID].Location))
{ {
ResetColor = TRUE; ResetColor = true;
if (*PrgCount == RSPCommandLine[ditem->itemID].Location) if (*PrgCount == RSPCommandLine[ditem->itemID].Location)
{ {
SetTextColor(ditem->hDC, RGB(255, 0, 0)); SetTextColor(ditem->hDC, RGB(255, 0, 0));
@ -381,7 +381,7 @@ void DrawRSPCommand(LPARAM lParam)
DT_SINGLELINE | DT_VCENTER); DT_SINGLELINE | DT_VCENTER);
} }
if (ResetColor == TRUE) if (ResetColor == true)
{ {
SetTextColor(ditem->hDC, oldColor); SetTextColor(ditem->hDC, oldColor);
} }
@ -395,18 +395,18 @@ void Enable_RSP_Commands_Window(void)
{ {
return; return;
} }
EnableWindow(hList, TRUE); EnableWindow(hList, true);
EnableWindow(hAddress, TRUE); EnableWindow(hAddress, true);
EnableWindow(hScrlBar, TRUE); EnableWindow(hScrlBar, true);
EnableWindow(hGoButton, TRUE); EnableWindow(hGoButton, true);
EnableWindow(hStepButton, TRUE); EnableWindow(hStepButton, true);
EnableWindow(hSkipButton, FALSE); EnableWindow(hSkipButton, false);
EnableWindow(hR4300iRegisters, TRUE); EnableWindow(hR4300iRegisters, true);
EnableWindow(hRSPRegisters, TRUE); EnableWindow(hRSPRegisters, true);
EnableWindow(hR4300iDebugger, TRUE); EnableWindow(hR4300iDebugger, true);
EnableWindow(hMemory, TRUE); EnableWindow(hMemory, true);
SendMessage(hBPButton, BM_SETSTYLE, BS_PUSHBUTTON, TRUE); SendMessage(hBPButton, BM_SETSTYLE, BS_PUSHBUTTON, true);
SendMessage(hStepButton, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE); SendMessage(hStepButton, BM_SETSTYLE, BS_DEFPUSHBUTTON, true);
SendMessage(RSPCommandshWnd, DM_SETDEFID, IDC_STEP_BUTTON, 0); SendMessage(RSPCommandshWnd, DM_SETDEFID, IDC_STEP_BUTTON, 0);
if (Stepping_Commands) if (Stepping_Commands)
@ -417,7 +417,7 @@ void Enable_RSP_Commands_Window(void)
si.nMax = (0x1000 >> 2) - 1; si.nMax = (0x1000 >> 2) - 1;
si.nPos = (*PrgCount >> 2); si.nPos = (*PrgCount >> 2);
si.nPage = 30; si.nPage = 30;
SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE); SetScrollInfo(hScrlBar, SB_CTL, &si, true);
SetRSPCommandViewto(*PrgCount); SetRSPCommandViewto(*PrgCount);
SetForegroundWindow(RSPCommandshWnd); SetForegroundWindow(RSPCommandshWnd);
@ -426,7 +426,7 @@ void Enable_RSP_Commands_Window(void)
void Enter_RSP_Commands_Window(void) void Enter_RSP_Commands_Window(void)
{ {
Create_RSP_Commands_Window(FALSE); Create_RSP_Commands_Window(false);
} }
void Paint_RSP_Commands(HWND hDlg) void Paint_RSP_Commands(HWND hDlg)
@ -501,7 +501,7 @@ void RefreshRSPCommands(void)
char AsciiAddress[20]; char AsciiAddress[20];
int count; int count;
if (InRSPCommandsWindow == FALSE) if (InRSPCommandsWindow == false)
{ {
return; return;
} }
@ -540,7 +540,7 @@ LRESULT CALLBACK RSP_Commands_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
case WM_PAINT: case WM_PAINT:
Paint_RSP_Commands(hDlg); Paint_RSP_Commands(hDlg);
RedrawWindow(hScrlBar, NULL, NULL, RDW_INVALIDATE | RDW_ERASE); RedrawWindow(hScrlBar, NULL, NULL, RDW_INVALIDATE | RDW_ERASE);
return TRUE; return true;
case WM_COMMAND: case WM_COMMAND:
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
@ -560,7 +560,7 @@ LRESULT CALLBACK RSP_Commands_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
} }
else else
{ {
AddRSP_BPoint(Location, FALSE); AddRSP_BPoint(Location, false);
} }
RefreshRSPCommands(); RefreshRSPCommands();
} }
@ -579,11 +579,11 @@ LRESULT CALLBACK RSP_Commands_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
SetRSPCommandToStepping(); SetRSPCommandToStepping();
break; break;
case IDC_STEP_BUTTON: case IDC_STEP_BUTTON:
WaitingForStep = FALSE; WaitingForStep = false;
break; break;
/*case IDC_SKIP_BUTTON: /*case IDC_SKIP_BUTTON:
SkipNextRSPOpCode = TRUE; SkipNextRSPOpCode = true;
WaitingFor_RSPStep = FALSE; WaitingFor_RSPStep = false;
break;*/ break;*/
case IDC_BP_BUTTON: case IDC_BP_BUTTON:
if (DebugInfo.Enter_BPoint_Window != NULL) if (DebugInfo.Enter_BPoint_Window != NULL)
@ -635,7 +635,7 @@ LRESULT CALLBACK RSP_Commands_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
si.cbSize = sizeof(si); si.cbSize = sizeof(si);
si.fMask = SIF_POS; si.fMask = SIF_POS;
si.nPos = (short int)HIWORD(wParam); si.nPos = (short int)HIWORD(wParam);
SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE); SetScrollInfo(hScrlBar, SB_CTL, &si, true);
break; break;
case SB_LINEDOWN: case SB_LINEDOWN:
if (location < 0xF88) if (location < 0xF88)
@ -645,7 +645,7 @@ LRESULT CALLBACK RSP_Commands_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
si.cbSize = sizeof(si); si.cbSize = sizeof(si);
si.fMask = SIF_POS; si.fMask = SIF_POS;
si.nPos = ((location + 0x4) >> 2); si.nPos = ((location + 0x4) >> 2);
SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE); SetScrollInfo(hScrlBar, SB_CTL, &si, true);
} }
else else
{ {
@ -654,7 +654,7 @@ LRESULT CALLBACK RSP_Commands_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
si.cbSize = sizeof(si); si.cbSize = sizeof(si);
si.fMask = SIF_POS; si.fMask = SIF_POS;
si.nPos = (0xFFC >> 2); si.nPos = (0xFFC >> 2);
SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE); SetScrollInfo(hScrlBar, SB_CTL, &si, true);
} }
break; break;
case SB_LINEUP: case SB_LINEUP:
@ -665,7 +665,7 @@ LRESULT CALLBACK RSP_Commands_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
si.cbSize = sizeof(si); si.cbSize = sizeof(si);
si.fMask = SIF_POS; si.fMask = SIF_POS;
si.nPos = ((location - 0x4) >> 2); si.nPos = ((location - 0x4) >> 2);
SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE); SetScrollInfo(hScrlBar, SB_CTL, &si, true);
} }
else else
{ {
@ -674,7 +674,7 @@ LRESULT CALLBACK RSP_Commands_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
si.cbSize = sizeof(si); si.cbSize = sizeof(si);
si.fMask = SIF_POS; si.fMask = SIF_POS;
si.nPos = 0; si.nPos = 0;
SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE); SetScrollInfo(hScrlBar, SB_CTL, &si, true);
} }
break; break;
case SB_PAGEDOWN: case SB_PAGEDOWN:
@ -685,7 +685,7 @@ LRESULT CALLBACK RSP_Commands_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
si.cbSize = sizeof(si); si.cbSize = sizeof(si);
si.fMask = SIF_POS; si.fMask = SIF_POS;
si.nPos = ((location + 0x74) >> 2); si.nPos = ((location + 0x74) >> 2);
SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE); SetScrollInfo(hScrlBar, SB_CTL, &si, true);
} }
else else
{ {
@ -694,7 +694,7 @@ LRESULT CALLBACK RSP_Commands_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
si.cbSize = sizeof(si); si.cbSize = sizeof(si);
si.fMask = SIF_POS; si.fMask = SIF_POS;
si.nPos = (0xF8F >> 2); si.nPos = (0xF8F >> 2);
SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE); SetScrollInfo(hScrlBar, SB_CTL, &si, true);
} }
break; break;
case SB_PAGEUP: case SB_PAGEUP:
@ -705,7 +705,7 @@ LRESULT CALLBACK RSP_Commands_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
si.cbSize = sizeof(si); si.cbSize = sizeof(si);
si.fMask = SIF_POS; si.fMask = SIF_POS;
si.nPos = ((location - 0x74) >> 2); si.nPos = ((location - 0x74) >> 2);
SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE); SetScrollInfo(hScrlBar, SB_CTL, &si, true);
} }
else else
{ {
@ -714,16 +714,16 @@ LRESULT CALLBACK RSP_Commands_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM l
si.cbSize = sizeof(si); si.cbSize = sizeof(si);
si.fMask = SIF_POS; si.fMask = SIF_POS;
si.nPos = 0; si.nPos = 0;
SetScrollInfo(hScrlBar, SB_CTL, &si, TRUE); SetScrollInfo(hScrlBar, SB_CTL, &si, true);
} }
break; break;
} }
} }
break; break;
default: default:
return FALSE; return false;
} }
return TRUE; return true;
} }
void RSP_Commands_Setup(HWND hDlg) void RSP_Commands_Setup(HWND hDlg)
@ -878,36 +878,36 @@ void RSP_Commands_Setup(HWND hDlg)
void SetRSPCommandToRunning(void) void SetRSPCommandToRunning(void)
{ {
Stepping_Commands = FALSE; Stepping_Commands = false;
if (InRSPCommandsWindow == FALSE) if (InRSPCommandsWindow == false)
{ {
return; return;
} }
EnableWindow(hGoButton, FALSE); EnableWindow(hGoButton, false);
EnableWindow(hBreakButton, TRUE); EnableWindow(hBreakButton, true);
EnableWindow(hStepButton, FALSE); EnableWindow(hStepButton, false);
EnableWindow(hSkipButton, FALSE); EnableWindow(hSkipButton, false);
SendMessage(RSPCommandshWnd, DM_SETDEFID, IDC_BREAK_BUTTON, 0); SendMessage(RSPCommandshWnd, DM_SETDEFID, IDC_BREAK_BUTTON, 0);
SendMessage(hGoButton, BM_SETSTYLE, BS_PUSHBUTTON, TRUE); SendMessage(hGoButton, BM_SETSTYLE, BS_PUSHBUTTON, true);
SendMessage(hBreakButton, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE); SendMessage(hBreakButton, BM_SETSTYLE, BS_DEFPUSHBUTTON, true);
SetFocus(hBreakButton); SetFocus(hBreakButton);
} }
void SetRSPCommandToStepping(void) void SetRSPCommandToStepping(void)
{ {
if (InRSPCommandsWindow == FALSE) if (InRSPCommandsWindow == false)
{ {
return; return;
} }
EnableWindow(hGoButton, TRUE); EnableWindow(hGoButton, true);
EnableWindow(hBreakButton, FALSE); EnableWindow(hBreakButton, false);
EnableWindow(hStepButton, TRUE); EnableWindow(hStepButton, true);
EnableWindow(hSkipButton, TRUE); EnableWindow(hSkipButton, true);
SendMessage(hBreakButton, BM_SETSTYLE, BS_PUSHBUTTON, TRUE); SendMessage(hBreakButton, BM_SETSTYLE, BS_PUSHBUTTON, true);
SendMessage(hStepButton, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE); SendMessage(hStepButton, BM_SETSTYLE, BS_DEFPUSHBUTTON, true);
SendMessage(RSPCommandshWnd, DM_SETDEFID, IDC_STEP_BUTTON, 0); SendMessage(RSPCommandshWnd, DM_SETDEFID, IDC_STEP_BUTTON, 0);
SetFocus(hStepButton); SetFocus(hStepButton);
Stepping_Commands = TRUE; Stepping_Commands = true;
} }
void SetRSPCommandViewto(UINT NewLocation) void SetRSPCommandViewto(UINT NewLocation)
@ -915,7 +915,7 @@ void SetRSPCommandViewto(UINT NewLocation)
unsigned int location; unsigned int location;
char Value[20]; char Value[20];
if (InRSPCommandsWindow == FALSE) if (InRSPCommandsWindow == false)
{ {
return; return;
} }

View File

@ -9,4 +9,4 @@ void SetRSPCommandToStepping(void);
void SetRSPCommandViewto(unsigned int NewLocation); void SetRSPCommandViewto(unsigned int NewLocation);
extern DWORD Stepping_Commands, WaitingForStep; extern DWORD Stepping_Commands, WaitingForStep;
extern Boolean InRSPCommandsWindow; extern bool InRSPCommandsWindow;

View File

@ -34,7 +34,7 @@ LRESULT CALLBACK RSP_Registers_Proc(HWND, UINT, WPARAM, LPARAM);
HWND RSP_Registers_hDlg, hTab, hStatic, hGPR[32], hCP0[16], hHIDDEN[12], HWND RSP_Registers_hDlg, hTab, hStatic, hGPR[32], hCP0[16], hHIDDEN[12],
hVECT1[16], hVECT2[16]; hVECT1[16], hVECT2[16];
int InRSPRegisterWindow = FALSE; int InRSPRegisterWindow = false;
WNDPROC RefreshProc; WNDPROC RefreshProc;
// RSP registers // RSP registers
@ -53,16 +53,16 @@ void Create_RSP_Register_Window(int Child)
DWORD ThreadID; DWORD ThreadID;
if (Child) if (Child)
{ {
InRSPRegisterWindow = TRUE; InRSPRegisterWindow = true;
DialogBoxA((HINSTANCE)hinstDLL, "RSPREGISTERS", NULL, (DLGPROC)RSP_Registers_Proc); DialogBoxA((HINSTANCE)hinstDLL, "RSPREGISTERS", NULL, (DLGPROC)RSP_Registers_Proc);
InRSPRegisterWindow = FALSE; InRSPRegisterWindow = false;
} }
else else
{ {
if (!InRSPRegisterWindow) if (!InRSPRegisterWindow)
{ {
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Create_RSP_Register_Window, CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Create_RSP_Register_Window,
(LPVOID)TRUE, 0, &ThreadID); (LPVOID)true, 0, &ThreadID);
} }
else else
{ {
@ -77,7 +77,7 @@ void Create_RSP_Register_Window(int Child)
void Enter_RSP_Register_Window(void) void Enter_RSP_Register_Window(void)
{ {
Create_RSP_Register_Window(FALSE); Create_RSP_Register_Window(false);
} }
void HideRSP_RegisterPanel(int Panel) void HideRSP_RegisterPanel(int Panel)
@ -89,31 +89,31 @@ void HideRSP_RegisterPanel(int Panel)
case GeneralPurpose: case GeneralPurpose:
for (count = 0; count < 32; count++) for (count = 0; count < 32; count++)
{ {
ShowWindow(hGPR[count], FALSE); ShowWindow(hGPR[count], false);
} }
break; break;
case ControlProcessor0: case ControlProcessor0:
for (count = 0; count < 16; count++) for (count = 0; count < 16; count++)
{ {
ShowWindow(hCP0[count], FALSE); ShowWindow(hCP0[count], false);
} }
break; break;
case HiddenRegisters: case HiddenRegisters:
for (count = 0; count < 12; count++) for (count = 0; count < 12; count++)
{ {
ShowWindow(hHIDDEN[count], FALSE); ShowWindow(hHIDDEN[count], false);
} }
break; break;
case Vector1: case Vector1:
for (count = 0; count < 16; count++) for (count = 0; count < 16; count++)
{ {
ShowWindow(hVECT1[count], FALSE); ShowWindow(hVECT1[count], false);
} }
break; break;
case Vector2: case Vector2:
for (count = 0; count < 16; count++) for (count = 0; count < 16; count++)
{ {
ShowWindow(hVECT2[count], FALSE); ShowWindow(hVECT2[count], false);
} }
break; break;
} }
@ -413,18 +413,18 @@ LRESULT CALLBACK RSP_Registers_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
break; break;
case WM_SIZE: case WM_SIZE:
GetClientRect(hDlg, &rcDisp); GetClientRect(hDlg, &rcDisp);
TabCtrl_AdjustRect(hTab, FALSE, &rcDisp); TabCtrl_AdjustRect(hTab, false, &rcDisp);
break; break;
case WM_NOTIFY: case WM_NOTIFY:
switch (((NMHDR *)lParam)->code) switch (((NMHDR *)lParam)->code)
{ {
case TCN_SELCHANGE: case TCN_SELCHANGE:
InvalidateRect(hTab, &rcDisp, TRUE); InvalidateRect(hTab, &rcDisp, true);
HideRSP_RegisterPanel(CurrentPanel); HideRSP_RegisterPanel(CurrentPanel);
item.mask = TCIF_PARAM; item.mask = TCIF_PARAM;
TabCtrl_GetItem(hTab, TabCtrl_GetCurSel(hTab), &item); TabCtrl_GetItem(hTab, TabCtrl_GetCurSel(hTab), &item);
CurrentPanel = (int)item.lParam; CurrentPanel = (int)item.lParam;
InvalidateRect(hStatic, NULL, FALSE); InvalidateRect(hStatic, NULL, false);
UpdateRSPRegistersScreen(); UpdateRSPRegistersScreen();
ShowRSP_RegisterPanel(CurrentPanel); ShowRSP_RegisterPanel(CurrentPanel);
break; break;
@ -439,9 +439,9 @@ LRESULT CALLBACK RSP_Registers_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
break; break;
} }
default: default:
return FALSE; return false;
} }
return TRUE; return true;
} }
void SetupRSP_HiddenPanel(HWND hDlg) void SetupRSP_HiddenPanel(HWND hDlg)
@ -603,31 +603,31 @@ void ShowRSP_RegisterPanel(int Panel)
case GeneralPurpose: case GeneralPurpose:
for (count = 0; count < 32; count++) for (count = 0; count < 32; count++)
{ {
ShowWindow(hGPR[count], TRUE); ShowWindow(hGPR[count], true);
} }
break; break;
case ControlProcessor0: case ControlProcessor0:
for (count = 0; count < 16; count++) for (count = 0; count < 16; count++)
{ {
ShowWindow(hCP0[count], TRUE); ShowWindow(hCP0[count], true);
} }
break; break;
case HiddenRegisters: case HiddenRegisters:
for (count = 0; count < 12; count++) for (count = 0; count < 12; count++)
{ {
ShowWindow(hHIDDEN[count], TRUE); ShowWindow(hHIDDEN[count], true);
} }
break; break;
case Vector1: case Vector1:
for (count = 0; count < 16; count++) for (count = 0; count < 16; count++)
{ {
ShowWindow(hVECT1[count], TRUE); ShowWindow(hVECT1[count], true);
} }
break; break;
case Vector2: case Vector2:
for (count = 0; count < 16; count++) for (count = 0; count < 16; count++)
{ {
ShowWindow(hVECT2[count], TRUE); ShowWindow(hVECT2[count], true);
} }
break; break;
} }

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,7 @@
uint32_t CompilePC, JumpTableSize, BlockID = 0; uint32_t CompilePC, JumpTableSize, BlockID = 0;
DWORD dwBuffer = MainBuffer; DWORD dwBuffer = MainBuffer;
Boolean ChangedPC; bool ChangedPC;
RSP_BLOCK CurrentBlock; RSP_BLOCK CurrentBlock;
RSP_CODE RspCode; RSP_CODE RspCode;
@ -397,7 +397,7 @@ void BuildRecompilerCPU(void)
RSP_Sc2[31] = Compile_UnknownOpcode; RSP_Sc2[31] = Compile_UnknownOpcode;
BlockID = 0; BlockID = 0;
ChangedPC = FALSE; ChangedPC = false;
#ifdef Log_x86Code #ifdef Log_x86Code
Start_x86_Log(); Start_x86_Log();
#endif #endif
@ -419,7 +419,7 @@ void ReOrderInstructions(DWORD StartPC, DWORD EndPC)
PreviousOp.Value = *(DWORD *)(RSPInfo.IMEM + StartPC); PreviousOp.Value = *(DWORD *)(RSPInfo.IMEM + StartPC);
if (TRUE == IsOpcodeBranch(StartPC, PreviousOp)) if (IsOpcodeBranch(StartPC, PreviousOp))
{ {
// The sub block ends here anyway // The sub block ends here anyway
return; return;
@ -464,7 +464,7 @@ void ReOrderInstructions(DWORD StartPC, DWORD EndPC)
} }
CurrentOp.Value = *(DWORD *)(RSPInfo.IMEM + CurrentPC); CurrentOp.Value = *(DWORD *)(RSPInfo.IMEM + CurrentPC);
if (TRUE == CompareInstructions(CurrentPC, &PreviousOp, &CurrentOp)) if (CompareInstructions(CurrentPC, &PreviousOp, &CurrentOp))
{ {
// Move current opcode up // Move current opcode up
*(DWORD *)(RSPInfo.IMEM + CurrentPC - 4) = CurrentOp.Value; *(DWORD *)(RSPInfo.IMEM + CurrentPC - 4) = CurrentOp.Value;
@ -549,7 +549,7 @@ void DetectGPRConstants(RSP_CODE * code)
{ {
DWORD Count, Constant = 0; DWORD Count, Constant = 0;
memset(&code->bIsRegConst, 0, sizeof(Boolean) * 0x20); memset(&code->bIsRegConst, 0, sizeof(bool) * 0x20);
memset(&code->MipsRegConst, 0, sizeof(DWORD) * 0x20); memset(&code->MipsRegConst, 0, sizeof(DWORD) * 0x20);
if (!Compiler.bGPRConstants) if (!Compiler.bGPRConstants)
@ -559,16 +559,16 @@ void DetectGPRConstants(RSP_CODE * code)
CPU_Message("***** Detecting constants *****"); CPU_Message("***** Detecting constants *****");
// R0 is constant zero, R31 or RA is not constant // R0 is constant zero, R31 or RA is not constant
code->bIsRegConst[0] = TRUE; code->bIsRegConst[0] = true;
code->MipsRegConst[0] = 0; code->MipsRegConst[0] = 0;
// Do your global search for them // Do your global search for them
for (Count = 1; Count < 31; Count++) for (Count = 1; Count < 31; Count++)
{ {
if (IsRegisterConstant(Count, &Constant) == TRUE) if (IsRegisterConstant(Count, &Constant))
{ {
CPU_Message("Global: %s is a constant of: %08X", GPR_Name(Count), Constant); CPU_Message("Global: %s is a constant of: %08X", GPR_Name(Count), Constant);
code->bIsRegConst[Count] = TRUE; code->bIsRegConst[Count] = true;
code->MipsRegConst[Count] = Constant; code->MipsRegConst[Count] = Constant;
} }
} }
@ -702,7 +702,7 @@ void BuildBranchLabels(void)
{ {
RspOp.Value = *(DWORD *)(RSPInfo.IMEM + i); RspOp.Value = *(DWORD *)(RSPInfo.IMEM + i);
if (TRUE == IsOpcodeBranch(i, RspOp)) if (IsOpcodeBranch(i, RspOp))
{ {
if (RspCode.LabelCount >= (sizeof(RspCode.BranchLabels) / sizeof(RspCode.BranchLabels[0])) - 1) if (RspCode.LabelCount >= (sizeof(RspCode.BranchLabels) / sizeof(RspCode.BranchLabels[0])) - 1)
{ {
@ -748,23 +748,23 @@ void BuildBranchLabels(void)
#endif #endif
} }
Boolean IsJumpLabel(DWORD PC) bool IsJumpLabel(DWORD PC)
{ {
DWORD Count; DWORD Count;
if (!RspCode.LabelCount) if (!RspCode.LabelCount)
{ {
return FALSE; return false;
} }
for (Count = 0; Count < RspCode.LabelCount; Count++) for (Count = 0; Count < RspCode.LabelCount; Count++)
{ {
if (PC == RspCode.BranchLabels[Count]) if (PC == RspCode.BranchLabels[Count])
{ {
return TRUE; return true;
} }
} }
return FALSE; return false;
} }
void CompilerLinkBlocks(void) void CompilerLinkBlocks(void)
@ -810,7 +810,7 @@ void CompilerRSPBlock(void)
CPU_Message("Start of block: %X", CurrentBlock.StartPC); CPU_Message("Start of block: %X", CurrentBlock.StartPC);
CPU_Message("====== Recompiled code ======"); CPU_Message("====== Recompiled code ======");
if (Compiler.bReOrdering == TRUE) if (Compiler.bReOrdering)
{ {
memcpy(IMEM_SAVE, RSPInfo.IMEM, 0x1000); memcpy(IMEM_SAVE, RSPInfo.IMEM, 0x1000);
ReOrderSubBlock(&CurrentBlock); ReOrderSubBlock(&CurrentBlock);
@ -845,16 +845,16 @@ void CompilerRSPBlock(void)
} }
} }
if (Compiler.bSections == TRUE) if (Compiler.bSections)
{ {
if (TRUE == RSP_DoSections()) if (RSP_DoSections())
{ {
continue; continue;
} }
} }
#ifdef X86_RECOMP_VERBOSE #ifdef X86_RECOMP_VERBOSE
if (FALSE == IsOpcodeNop(CompilePC)) if (!IsOpcodeNop(CompilePC))
{ {
CPU_Message("X86 Address: %08X", RecompPos); CPU_Message("X86 Address: %08X", RecompPos);
} }
@ -930,7 +930,7 @@ void CompilerRSPBlock(void)
} while (NextInstruction != FINISH_BLOCK && (CompilePC < 0x1000 || NextInstruction == DELAY_SLOT)); } while (NextInstruction != FINISH_BLOCK && (CompilePC < 0x1000 || NextInstruction == DELAY_SLOT));
CPU_Message("===== End of recompiled code ====="); CPU_Message("===== End of recompiled code =====");
if (Compiler.bReOrdering == TRUE) if (Compiler.bReOrdering)
{ {
memcpy(RSPInfo.IMEM, IMEM_SAVE, 0x1000); memcpy(RSPInfo.IMEM, IMEM_SAVE, 0x1000);
} }
@ -941,7 +941,7 @@ DWORD RunRecompilerCPU(DWORD Cycles)
{ {
BYTE * Block; BYTE * Block;
RSP_Running = TRUE; RSP_Running = true;
SetJumpTable(JumpTableSize); SetJumpTable(JumpTableSize);
while (RSP_Running) while (RSP_Running)
@ -1008,11 +1008,11 @@ DWORD RunRecompilerCPU(DWORD Cycles)
} }
if (RSP_NextInstruction == SINGLE_STEP) if (RSP_NextInstruction == SINGLE_STEP)
{ {
RSP_Running = FALSE; RSP_Running = false;
} }
} }
if (IsMmxEnabled == TRUE) if (IsMmxEnabled)
{ {
#if defined(_M_IX86) && defined(_MSC_VER) #if defined(_M_IX86) && defined(_MSC_VER)
_asm emms _asm emms

View File

@ -2,7 +2,7 @@
#include "RspTypes.h" #include "RspTypes.h"
extern uint32_t CompilePC, NextInstruction, JumpTableSize; extern uint32_t CompilePC, NextInstruction, JumpTableSize;
extern Boolean ChangedPC; extern bool ChangedPC;
#define CompilerWarning \ #define CompilerWarning \
if (ShowErrors) DisplayError if (ShowErrors) DisplayError
@ -12,17 +12,17 @@ extern Boolean ChangedPC;
#define Low16BitAccum 4 #define Low16BitAccum 4
#define EntireAccum (Low16BitAccum | Middle16BitAccum | High16BitAccum) #define EntireAccum (Low16BitAccum | Middle16BitAccum | High16BitAccum)
Boolean WriteToAccum(int Location, int PC); bool WriteToAccum(int Location, int PC);
Boolean WriteToVectorDest(DWORD DestReg, int PC); bool WriteToVectorDest(DWORD DestReg, int PC);
Boolean UseRspFlags(int PC); bool UseRspFlags(int PC);
Boolean DelaySlotAffectBranch(DWORD PC); bool DelaySlotAffectBranch(DWORD PC);
Boolean CompareInstructions(DWORD PC, RSPOpcode * Top, RSPOpcode * Bottom); bool CompareInstructions(DWORD PC, RSPOpcode * Top, RSPOpcode * Bottom);
Boolean IsOpcodeBranch(DWORD PC, RSPOpcode RspOp); bool IsOpcodeBranch(DWORD PC, RSPOpcode RspOp);
Boolean IsOpcodeNop(DWORD PC); bool IsOpcodeNop(DWORD PC);
Boolean IsNextInstructionMmx(DWORD PC); bool IsNextInstructionMmx(DWORD PC);
Boolean IsRegisterConstant(DWORD Reg, DWORD * Constant); bool IsRegisterConstant(DWORD Reg, DWORD * Constant);
void RSP_Element2Mmx(int MmxReg); void RSP_Element2Mmx(int MmxReg);
void RSP_MultiElement2Mmx(int MmxReg1, int MmxReg2); void RSP_MultiElement2Mmx(int MmxReg1, int MmxReg2);
@ -35,7 +35,7 @@ void BuildRecompilerCPU(void);
void CompilerRSPBlock(void); void CompilerRSPBlock(void);
void CompilerToggleBuffer(void); void CompilerToggleBuffer(void);
Boolean RSP_DoSections(void); bool RSP_DoSections(void);
typedef struct typedef struct
{ {
@ -54,7 +54,7 @@ extern RSP_BLOCK CurrentBlock;
typedef struct typedef struct
{ {
Boolean bIsRegConst[32]; // Boolean toggle for constant bool bIsRegConst[32]; // bool toggle for constant
DWORD MipsRegConst[32]; // Value of register 32-bit DWORD MipsRegConst[32]; // Value of register 32-bit
DWORD BranchLabels[250]; DWORD BranchLabels[250];
DWORD LabelCount; DWORD LabelCount;
@ -69,15 +69,15 @@ extern RSP_CODE RspCode;
typedef struct typedef struct
{ {
Boolean mmx, mmx2, sse; // CPU specs and compiling bool mmx, mmx2, sse; // CPU specs and compiling
Boolean bFlags; // RSP flag analysis bool bFlags; // RSP flag analysis
Boolean bReOrdering; // Instruction reordering bool bReOrdering; // Instruction reordering
Boolean bSections; // Microcode sections bool bSections; // Microcode sections
Boolean bDest; // Vector destination toggle bool bDest; // Vector destination toggle
Boolean bAccum; // Accumulator toggle bool bAccum; // Accumulator toggle
Boolean bGPRConstants; // Analyze GPR constants bool bGPRConstants; // Analyze GPR constants
Boolean bAlignVector; // Align known vector loads bool bAlignVector; // Align known vector loads
Boolean bAudioUcode; // Audio microcode analysis bool bAudioUcode; // Audio microcode analysis
} RSP_COMPILER; } RSP_COMPILER;
extern RSP_COMPILER Compiler; extern RSP_COMPILER Compiler;

File diff suppressed because it is too large Load Diff

View File

@ -829,7 +829,7 @@ void RSP_Sections_VMACF(RSPOpcode RspOp, DWORD AccumStyle)
static DWORD Section_000_VMADN; // Yeah I know, but leave it static DWORD Section_000_VMADN; // Yeah I know, but leave it
Boolean Check_Section_000(void) bool Check_Section_000(void)
{ {
DWORD i; DWORD i;
RSPOpcode op0, op1; RSPOpcode op0, op1;
@ -842,7 +842,7 @@ Boolean Check_Section_000(void)
if (!(op0.op == RSP_CP2 && (op0.rs & 0x10) != 0 && op0.funct == RSP_VECTOR_VMUDN)) if (!(op0.op == RSP_CP2 && (op0.rs & 0x10) != 0 && op0.funct == RSP_VECTOR_VMUDN))
{ {
return FALSE; return false;
} }
Section_000_VMADN = 0; Section_000_VMADN = 0;
@ -859,28 +859,28 @@ Boolean Check_Section_000(void)
Section_000_VMADN++; Section_000_VMADN++;
} }
if ((op1.rs & 0xF) >= 2 && (op1.rs & 0xF) <= 7 && IsMmx2Enabled == FALSE) if ((op1.rs & 0xF) >= 2 && (op1.rs & 0xF) <= 7 && IsMmx2Enabled == false)
{ {
return FALSE; return false;
} }
} }
// We need at least 1 VMADN // We need at least 1 VMADN
if (Section_000_VMADN == 0) if (Section_000_VMADN == 0)
{ {
return FALSE; return false;
} }
// TODO: check destination and flushes // TODO: check destination and flushes
if (TRUE == WriteToAccum(7, CompilePC + 0x4 + (Section_000_VMADN * 4) - 0x4)) if (true == WriteToAccum(7, CompilePC + 0x4 + (Section_000_VMADN * 4) - 0x4))
{ {
return FALSE; return false;
} }
if (IsMmxEnabled == FALSE) if (!IsMmxEnabled)
{ {
return FALSE; return false;
} }
return TRUE; return true;
} }
void Compile_Section_000(void) void Compile_Section_000(void)
@ -925,7 +925,7 @@ void Compile_Section_000(void)
RSP_LW_IMEM(CompilePC, &vmadn.Value); RSP_LW_IMEM(CompilePC, &vmadn.Value);
CompilePC += 4; CompilePC += 4;
RSP_Sections_VMADN(vmadn, Low16BitAccum); RSP_Sections_VMADN(vmadn, Low16BitAccum);
if (WriteToVectorDest(vmadn.sa, CompilePC - 4) == TRUE) if (WriteToVectorDest(vmadn.sa, CompilePC - 4) == true)
{ {
sprintf(Reg, "RSP_Vect[%i].HW[0]", vmadn.sa); sprintf(Reg, "RSP_Vect[%i].HW[0]", vmadn.sa);
MmxMoveQwordRegToVariable(x86_MM0, &RSP_Vect[vmadn.sa].HW[0], Reg); MmxMoveQwordRegToVariable(x86_MM0, &RSP_Vect[vmadn.sa].HW[0], Reg);
@ -944,7 +944,7 @@ void Compile_Section_000(void)
static DWORD Section_001_VMACF; static DWORD Section_001_VMACF;
Boolean Check_Section_001(void) bool Check_Section_001(void)
{ {
DWORD i; DWORD i;
RSPOpcode op0, op1; RSPOpcode op0, op1;
@ -957,7 +957,7 @@ Boolean Check_Section_001(void)
if (!(op0.op == RSP_CP2 && (op0.rs & 0x10) != 0 && op0.funct == RSP_VECTOR_VMULF)) if (!(op0.op == RSP_CP2 && (op0.rs & 0x10) != 0 && op0.funct == RSP_VECTOR_VMULF))
{ {
return FALSE; return false;
} }
Section_001_VMACF = 0; Section_001_VMACF = 0;
@ -974,30 +974,30 @@ Boolean Check_Section_001(void)
Section_001_VMACF++; Section_001_VMACF++;
} }
if ((op1.rs & 0xF) >= 2 && (op1.rs & 0xF) <= 7 && IsMmx2Enabled == FALSE) if ((op1.rs & 0xF) >= 2 && (op1.rs & 0xF) <= 7 && IsMmx2Enabled == false)
{ {
return FALSE; return false;
} }
} }
// We need at least 1 VMACF // We need at least 1 VMACF
if (Section_001_VMACF == 0) if (Section_001_VMACF == 0)
{ {
return FALSE; return false;
} }
if (IsMmxEnabled == FALSE) if (!IsMmxEnabled)
{ {
return FALSE; return false;
} }
// Destinations are checked elsewhere, this is fine // Destinations are checked elsewhere, this is fine
if (TRUE == WriteToAccum(7, CompilePC + 0x4 + (Section_001_VMACF * 4) - 0x4)) if (true == WriteToAccum(7, CompilePC + 0x4 + (Section_001_VMACF * 4) - 0x4))
{ {
return FALSE; return false;
} }
return TRUE; return true;
} }
void Compile_Section_001(void) void Compile_Section_001(void)
@ -1019,7 +1019,7 @@ void Compile_Section_001(void)
RSP_Sections_VMULF(vmulf, Middle16BitAccum); RSP_Sections_VMULF(vmulf, Middle16BitAccum);
if (WriteToVectorDest(vmulf.sa, CompilePC) == TRUE) if (WriteToVectorDest(vmulf.sa, CompilePC) == true)
{ {
sprintf(Reg, "RSP_Vect[%i].HW[0]", vmulf.sa); sprintf(Reg, "RSP_Vect[%i].HW[0]", vmulf.sa);
MmxMoveQwordRegToVariable(x86_MM0, &RSP_Vect[vmulf.sa].HW[0], Reg); MmxMoveQwordRegToVariable(x86_MM0, &RSP_Vect[vmulf.sa].HW[0], Reg);
@ -1034,7 +1034,7 @@ void Compile_Section_001(void)
CompilePC += 4; CompilePC += 4;
RSP_Sections_VMACF(vmacf, Middle16BitAccum); RSP_Sections_VMACF(vmacf, Middle16BitAccum);
if (WriteToVectorDest(vmacf.sa, CompilePC - 4) == TRUE) if (WriteToVectorDest(vmacf.sa, CompilePC - 4) == true)
{ {
sprintf(Reg, "RSP_Vect[%i].HW[0]", vmacf.sa); sprintf(Reg, "RSP_Vect[%i].HW[0]", vmacf.sa);
MmxMoveQwordRegToVariable(x86_MM0, &RSP_Vect[vmacf.sa].HW[0], Reg); MmxMoveQwordRegToVariable(x86_MM0, &RSP_Vect[vmacf.sa].HW[0], Reg);
@ -1046,7 +1046,7 @@ void Compile_Section_001(void)
MmxEmptyMultimediaState(); MmxEmptyMultimediaState();
} }
Boolean Check_Section_002(void) bool Check_Section_002(void)
{ {
DWORD Count; DWORD Count;
RSPOpcode op[0x0C]; RSPOpcode op[0x0C];
@ -1072,48 +1072,48 @@ Boolean Check_Section_002(void)
** 620 VSAW $v28 [8], $v7, $v28 ** 620 VSAW $v28 [8], $v7, $v28
*/ */
if (IsMmxEnabled == FALSE) if (!IsMmxEnabled)
{ {
return FALSE; return false;
} }
if (!(op[0].op == RSP_CP2 && (op[0].rs & 0x10) != 0 && op[0].funct == RSP_VECTOR_VMUDH)) if (!(op[0].op == RSP_CP2 && (op[0].rs & 0x10) != 0 && op[0].funct == RSP_VECTOR_VMUDH))
{ {
return FALSE; return false;
} }
if ((op[0].rs & 0xF) < 8) if ((op[0].rs & 0xF) < 8)
{ {
return FALSE; return false;
} }
for (Count = 1; Count < 10; Count++) for (Count = 1; Count < 10; Count++)
{ {
if (!(op[Count].op == RSP_CP2 && (op[Count].rs & 0x10) != 0 && op[Count].funct == RSP_VECTOR_VMADH)) if (!(op[Count].op == RSP_CP2 && (op[Count].rs & 0x10) != 0 && op[Count].funct == RSP_VECTOR_VMADH))
{ {
return FALSE; return false;
} }
if ((op[Count].rs & 0xF) < 8) if ((op[Count].rs & 0xF) < 8)
{ {
return FALSE; return false;
} }
} }
if (!(op[10].op == RSP_CP2 && (op[10].rs & 0x10) != 0 && op[10].funct == RSP_VECTOR_VSAW)) return FALSE; if (!(op[10].op == RSP_CP2 && (op[10].rs & 0x10) != 0 && op[10].funct == RSP_VECTOR_VSAW)) return false;
if (!(op[11].op == RSP_CP2 && (op[11].rs & 0x10) != 0 && op[11].funct == RSP_VECTOR_VSAW)) return FALSE; if (!(op[11].op == RSP_CP2 && (op[11].rs & 0x10) != 0 && op[11].funct == RSP_VECTOR_VSAW)) return false;
if ((op[10].rs & 0xF) != 9) if ((op[10].rs & 0xF) != 9)
{ {
return FALSE; return false;
} }
if ((op[11].rs & 0xF) != 8) if ((op[11].rs & 0xF) != 8)
{ {
return FALSE; return false;
} }
if (TRUE == WriteToAccum(7, CompilePC + 0x2C)) if (true == WriteToAccum(7, CompilePC + 0x2C))
return FALSE; return false;
return TRUE; return true;
} }
void Compile_Section_002(void) void Compile_Section_002(void)
@ -1168,7 +1168,7 @@ void Compile_Section_002(void)
CompilePC += 12 * sizeof(RSPOpcode); CompilePC += 12 * sizeof(RSPOpcode);
} }
Boolean Check_Section_003(void) bool Check_Section_003(void)
{ {
DWORD Count; DWORD Count;
RSPOpcode op[4]; RSPOpcode op[4];
@ -1186,12 +1186,12 @@ Boolean Check_Section_003(void)
if (op[0].Value == 0x4BF7FDC5 && op[1].Value == 0x4BF6FDCF && op[2].Value == 0x4B92CD8D && op[3].Value == 0x4B1EFDCE) if (op[0].Value == 0x4BF7FDC5 && op[1].Value == 0x4BF6FDCF && op[2].Value == 0x4B92CD8D && op[3].Value == 0x4B1EFDCE)
{ {
if (TRUE == WriteToAccum(7, CompilePC + 0xc)) if (true == WriteToAccum(7, CompilePC + 0xc))
return FALSE; return false;
return TRUE; return true;
} }
return FALSE; return false;
} }
static void resampler_hle() static void resampler_hle()
@ -1249,27 +1249,27 @@ void Compile_Section_003(void)
CompilePC += 4 * sizeof(RSPOpcode); CompilePC += 4 * sizeof(RSPOpcode);
} }
Boolean RSP_DoSections(void) bool RSP_DoSections(void)
{ {
if (TRUE == Check_Section_000()) if (true == Check_Section_000())
{ {
Compile_Section_000(); Compile_Section_000();
return TRUE; return true;
} }
if (TRUE == Check_Section_001()) if (true == Check_Section_001())
{ {
Compile_Section_001(); Compile_Section_001();
return TRUE; return true;
} }
if (TRUE == Check_Section_002()) if (true == Check_Section_002())
{ {
Compile_Section_002(); Compile_Section_002();
return TRUE; return true;
} }
if (TRUE == Check_Section_003()) if (true == Check_Section_003())
{ {
Compile_Section_003(); Compile_Section_003();
return TRUE; return true;
} }
return FALSE; return false;
} }

View File

@ -5,10 +5,10 @@
#include <stdint.h> #include <stdint.h>
// Profiling // Profiling
#define Default_ProfilingOn FALSE #define Default_ProfilingOn false
#define Default_IndvidualBlock FALSE #define Default_IndvidualBlock false
#define Default_ShowErrors FALSE #define Default_ShowErrors false
#define Default_AudioHle FALSE #define Default_AudioHle false
uint32_t AsciiToHex(char * HexValue); uint32_t AsciiToHex(char * HexValue);
void DisplayError(char * Message, ...); void DisplayError(char * Message, ...);
@ -16,7 +16,7 @@ void DisplayError(char * Message, ...);
#define InterpreterCPU 0 #define InterpreterCPU 0
#define RecompilerCPU 1 #define RecompilerCPU 1
extern int DebuggingEnabled, Profiling, IndvidualBlock, ShowErrors, BreakOnStart, LogRDP, LogX86Code; extern bool DebuggingEnabled, Profiling, IndvidualBlock, ShowErrors, BreakOnStart, LogRDP, LogX86Code;
extern uint32_t CPUCore; extern uint32_t CPUCore;
extern DEBUG_INFO DebugInfo; extern DEBUG_INFO DebugInfo;
extern RSP_INFO RSPInfo; extern RSP_INFO RSPInfo;

View File

@ -8,23 +8,6 @@
typedef void (*p_func)(void); typedef void (*p_func)(void);
// TODO: Rewrite/remove/address?
/*
`BOOL` is Windows-specific so is going to tend to be avoided.
`int` is the exact replacement.
However, saying "int" all the time for true/false is a little ambiguous.
Maybe in the future, with C++ (or C99) rewrites, we can switch to `bool`.
Until then, a simple type definition will help emphasize true/false logic.
*/
typedef int Boolean;
#if !defined(FALSE) && !defined(TRUE)
#define FALSE 0
#define TRUE 1
#endif
typedef union tagUWORD typedef union tagUWORD
{ {
int32_t W; int32_t W;

View File

@ -35,7 +35,7 @@ char * x86_HalfStrings[8] = {
"ax", "bx", "cx", "dx", "ax", "bx", "cx", "dx",
"si", "di", "bp", "sp"}; "si", "di", "bp", "sp"};
extern Boolean ConditionalMove; extern bool ConditionalMove;
#define x86Byte_Name(Reg) (x86_ByteStrings[(Reg)]) #define x86Byte_Name(Reg) (x86_ByteStrings[(Reg)])
#define x86Half_Name(Reg) (x86_HalfStrings[(Reg)]) #define x86Half_Name(Reg) (x86_HalfStrings[(Reg)])
@ -515,7 +515,7 @@ void Call_Indirect(void * FunctAddress, char * FunctName)
void CondMoveEqual(int Destination, int Source) void CondMoveEqual(int Destination, int Source)
{ {
if (ConditionalMove == FALSE) if (ConditionalMove == false)
{ {
BYTE * Jump; BYTE * Jump;
CPU_Message(" [*]cmove %s, %s", x86_Name(Destination), x86_Name(Source)); CPU_Message(" [*]cmove %s, %s", x86_Name(Destination), x86_Name(Source));
@ -563,7 +563,7 @@ void CondMoveEqual(int Destination, int Source)
void CondMoveNotEqual(int Destination, int Source) void CondMoveNotEqual(int Destination, int Source)
{ {
if (ConditionalMove == FALSE) if (ConditionalMove == false)
{ {
BYTE * Jump; BYTE * Jump;
CPU_Message(" [*]cmovne %s, %s", x86_Name(Destination), x86_Name(Source)); CPU_Message(" [*]cmovne %s, %s", x86_Name(Destination), x86_Name(Source));
@ -611,7 +611,7 @@ void CondMoveNotEqual(int Destination, int Source)
void CondMoveGreater(int Destination, int Source) void CondMoveGreater(int Destination, int Source)
{ {
if (ConditionalMove == FALSE) if (ConditionalMove == false)
{ {
BYTE * Jump; BYTE * Jump;
CPU_Message(" [*]cmovg %s, %s", x86_Name(Destination), x86_Name(Source)); CPU_Message(" [*]cmovg %s, %s", x86_Name(Destination), x86_Name(Source));
@ -659,7 +659,7 @@ void CondMoveGreater(int Destination, int Source)
void CondMoveGreaterEqual(int Destination, int Source) void CondMoveGreaterEqual(int Destination, int Source)
{ {
if (ConditionalMove == FALSE) if (ConditionalMove == false)
{ {
BYTE * Jump; BYTE * Jump;
CPU_Message(" [*]cmovge %s, %s", x86_Name(Destination), x86_Name(Source)); CPU_Message(" [*]cmovge %s, %s", x86_Name(Destination), x86_Name(Source));
@ -707,7 +707,7 @@ void CondMoveGreaterEqual(int Destination, int Source)
void CondMoveLess(int Destination, int Source) void CondMoveLess(int Destination, int Source)
{ {
if (ConditionalMove == FALSE) if (ConditionalMove == false)
{ {
BYTE * Jump; BYTE * Jump;
CPU_Message(" [*]cmovl %s, %s", x86_Name(Destination), x86_Name(Source)); CPU_Message(" [*]cmovl %s, %s", x86_Name(Destination), x86_Name(Source));
@ -755,7 +755,7 @@ void CondMoveLess(int Destination, int Source)
void CondMoveLessEqual(int Destination, int Source) void CondMoveLessEqual(int Destination, int Source)
{ {
if (ConditionalMove == FALSE) if (ConditionalMove == false)
{ {
BYTE * Jump; BYTE * Jump;
CPU_Message(" [*]cmovle %s, %s", x86_Name(Destination), x86_Name(Source)); CPU_Message(" [*]cmovle %s, %s", x86_Name(Destination), x86_Name(Source));

View File

@ -15,7 +15,7 @@ void Add_BPoint(void)
char Title[10]; char Title[10];
GetWindowTextA(hRSPLocation, Title, sizeof(Title)); GetWindowTextA(hRSPLocation, Title, sizeof(Title));
if (!AddRSP_BPoint(AsciiToHex(Title), TRUE)) if (!AddRSP_BPoint(AsciiToHex(Title), true))
{ {
SendMessage(hRSPLocation, EM_SETSEL, (WPARAM)0, (LPARAM)-1); SendMessage(hRSPLocation, EM_SETSEL, (WPARAM)0, (LPARAM)-1);
SetFocus(hRSPLocation); SetFocus(hRSPLocation);
@ -29,7 +29,7 @@ int AddRSP_BPoint(DWORD Location, int Confirm)
if (NoOfBpoints == MaxBPoints) if (NoOfBpoints == MaxBPoints)
{ {
DisplayError("Max amount of breakpoints set"); DisplayError("Max amount of breakpoints set");
return FALSE; return false;
} }
for (count = 0; count < NoOfBpoints; count++) for (count = 0; count < NoOfBpoints; count++)
@ -37,7 +37,7 @@ int AddRSP_BPoint(DWORD Location, int Confirm)
if (BPoint[count].Location == Location) if (BPoint[count].Location == Location)
{ {
DisplayError("You already have this breakpoint"); DisplayError("You already have this breakpoint");
return FALSE; return false;
} }
} }
@ -51,7 +51,7 @@ int AddRSP_BPoint(DWORD Location, int Confirm)
Response = MessageBoxA(BPoint_Win_hDlg, Message, "Breakpoint", MB_YESNO | MB_ICONINFORMATION); Response = MessageBoxA(BPoint_Win_hDlg, Message, "Breakpoint", MB_YESNO | MB_ICONINFORMATION);
if (Response == IDNO) if (Response == IDNO)
{ {
return FALSE; return false;
} }
} }
BPoint[NoOfBpoints].Location = Location; BPoint[NoOfBpoints].Location = Location;
@ -60,7 +60,7 @@ int AddRSP_BPoint(DWORD Location, int Confirm)
{ {
DebugInfo.UpdateBreakPoints(); DebugInfo.UpdateBreakPoints();
} }
return TRUE; return true;
} }
int CheckForRSPBPoint(DWORD Location) int CheckForRSPBPoint(DWORD Location)
@ -71,10 +71,10 @@ int CheckForRSPBPoint(DWORD Location)
{ {
if (BPoint[count].Location == Location) if (BPoint[count].Location == Location)
{ {
return TRUE; return true;
} }
} }
return FALSE; return false;
} }
void CreateBPPanel(void * hDlg, rectangle rcBox) void CreateBPPanel(void * hDlg, rectangle rcBox)
@ -102,7 +102,7 @@ void CreateBPPanel(void * hDlg, rectangle rcBox)
void HideBPPanel(void) void HideBPPanel(void)
{ {
ShowWindow(hRSPLocation, FALSE); ShowWindow(hRSPLocation, false);
} }
void PaintBPPanel(window_paint ps) void PaintBPPanel(window_paint ps)
@ -113,7 +113,7 @@ void PaintBPPanel(window_paint ps)
void ShowBPPanel(void) void ShowBPPanel(void)
{ {
ShowWindow(hRSPLocation, TRUE); ShowWindow(hRSPLocation, true);
} }
void RefreshBpoints(void * hList) void RefreshBpoints(void * hList)

View File

@ -22,7 +22,7 @@ int AllocateMemory(void)
if (RecompCode == NULL) if (RecompCode == NULL)
{ {
DisplayError("Not enough memory for RSP RecompCode!"); DisplayError("Not enough memory for RSP RecompCode!");
return FALSE; return false;
} }
} }
@ -32,7 +32,7 @@ int AllocateMemory(void)
if (RecompCodeSecondary == NULL) if (RecompCodeSecondary == NULL)
{ {
DisplayError("Not enough memory for RSP RecompCode Secondary!"); DisplayError("Not enough memory for RSP RecompCode Secondary!");
return FALSE; return false;
} }
} }
@ -42,14 +42,14 @@ int AllocateMemory(void)
if (JumpTables == NULL) if (JumpTables == NULL)
{ {
DisplayError("Not enough memory for jump table!"); DisplayError("Not enough memory for jump table!");
return FALSE; return false;
} }
} }
JumpTable = (void **)JumpTables; JumpTable = (void **)JumpTables;
RecompPos = RecompCode; RecompPos = RecompCode;
NoOfMaps = 0; NoOfMaps = 0;
return TRUE; return true;
} }
void FreeMemory(void) void FreeMemory(void)