[RSP] some scope and spacing formatting clean-ups
This commit is contained in:
parent
86952f5cc6
commit
b890afe78b
|
@ -57,10 +57,12 @@ void BuildRecompilerCPU(void);
|
||||||
|
|
||||||
extern HANDLE hMutex;
|
extern HANDLE hMutex;
|
||||||
|
|
||||||
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)
|
||||||
|
{
|
||||||
case RecompilerCPU:
|
case RecompilerCPU:
|
||||||
BuildRecompilerCPU();
|
BuildRecompilerCPU();
|
||||||
break;
|
break;
|
||||||
|
@ -71,7 +73,8 @@ void SetCPU(DWORD core) {
|
||||||
ReleaseMutex(hMutex);
|
ReleaseMutex(hMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Build_RSP ( void ) {
|
void Build_RSP ( void )
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
extern UWORD32 Recp, RecpResult, SQroot, SQrootResult;
|
extern UWORD32 Recp, RecpResult, SQroot, SQrootResult;
|
||||||
|
|
||||||
|
@ -150,14 +153,17 @@ void Build_RSP ( void ) {
|
||||||
Indx[30].DW = 0x0001020304050706; /* 6 */
|
Indx[30].DW = 0x0001020304050706; /* 6 */
|
||||||
Indx[31].DW = 0x0001020304050607; /* 7 */
|
Indx[31].DW = 0x0001020304050607; /* 7 */
|
||||||
|
|
||||||
for (i = 16; i < 32; i ++) {
|
for (i = 16; i < 32; i ++)
|
||||||
|
{
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
for (count = 0; count < 8; count ++) {
|
for (count = 0; count < 8; count ++)
|
||||||
|
{
|
||||||
Indx[i].B[count] = 7 - Indx[i].B[count];
|
Indx[i].B[count] = 7 - Indx[i].B[count];
|
||||||
EleSpec[i].B[count] = 7 - EleSpec[i].B[count];
|
EleSpec[i].B[count] = 7 - EleSpec[i].B[count];
|
||||||
}
|
}
|
||||||
for (count = 0; count < 4; count ++) {
|
for (count = 0; count < 4; count ++)
|
||||||
|
{
|
||||||
BYTE Temp;
|
BYTE Temp;
|
||||||
|
|
||||||
Temp = Indx[i].B[count];
|
Temp = Indx[i].B[count];
|
||||||
|
@ -182,44 +188,55 @@ void Build_RSP ( void ) {
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
|
|
||||||
DWORD RunInterpreterCPU(DWORD Cycles);
|
DWORD RunInterpreterCPU(DWORD Cycles);
|
||||||
DWORD RunRecompilerCPU ( DWORD Cycles );
|
DWORD RunRecompilerCPU (DWORD Cycles);
|
||||||
|
|
||||||
#define MI_INTR_SP 0x01 /* Bit 0: SP intr */
|
#define MI_INTR_SP 0x01 /* Bit 0: SP intr */
|
||||||
|
|
||||||
__declspec(dllexport) DWORD DoRspCycles ( DWORD Cycles ) {
|
__declspec(dllexport) DWORD DoRspCycles ( DWORD Cycles )
|
||||||
|
{
|
||||||
extern BOOL 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)
|
||||||
|
{
|
||||||
*RSPInfo.SP_STATUS_REG &= ~SP_STATUS_SIG0;
|
*RSPInfo.SP_STATUS_REG &= ~SP_STATUS_SIG0;
|
||||||
*RSPInfo.MI_INTR_REG |= MI_INTR_SP;
|
*RSPInfo.MI_INTR_REG |= MI_INTR_SP;
|
||||||
RSPInfo.CheckInterrupts();
|
RSPInfo.CheckInterrupts();
|
||||||
return Cycles;
|
return Cycles;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if (TaskType == 1 && GraphicsHle && *(DWORD*)(RSPInfo.DMEM + 0x0ff0) != 0) {
|
if (TaskType == 1 && GraphicsHle && *(DWORD*)(RSPInfo.DMEM + 0x0ff0) != 0)
|
||||||
if (RSPInfo.ProcessDList != NULL) {
|
{
|
||||||
|
if (RSPInfo.ProcessDList != NULL)
|
||||||
|
{
|
||||||
RSPInfo.ProcessDList();
|
RSPInfo.ProcessDList();
|
||||||
}
|
}
|
||||||
*RSPInfo.SP_STATUS_REG |= (0x0203 );
|
*RSPInfo.SP_STATUS_REG |= (0x0203 );
|
||||||
if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 ) {
|
if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 )
|
||||||
|
{
|
||||||
*RSPInfo.MI_INTR_REG |= R4300i_SP_Intr;
|
*RSPInfo.MI_INTR_REG |= R4300i_SP_Intr;
|
||||||
RSPInfo.CheckInterrupts();
|
RSPInfo.CheckInterrupts();
|
||||||
}
|
}
|
||||||
|
|
||||||
*RSPInfo.DPC_STATUS_REG &= ~0x0002;
|
*RSPInfo.DPC_STATUS_REG &= ~0x0002;
|
||||||
return Cycles;
|
return Cycles;
|
||||||
} else if (TaskType == 2 && AudioHle) {
|
}
|
||||||
if (RSPInfo.ProcessAList != NULL) {
|
else if (TaskType == 2 && AudioHle)
|
||||||
|
{
|
||||||
|
if (RSPInfo.ProcessAList != NULL)
|
||||||
|
{
|
||||||
RSPInfo.ProcessAList();
|
RSPInfo.ProcessAList();
|
||||||
}
|
}
|
||||||
*RSPInfo.SP_STATUS_REG |= (0x0203 );
|
*RSPInfo.SP_STATUS_REG |= (0x0203 );
|
||||||
if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 ) {
|
if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 )
|
||||||
|
{
|
||||||
*RSPInfo.MI_INTR_REG |= R4300i_SP_Intr;
|
*RSPInfo.MI_INTR_REG |= R4300i_SP_Intr;
|
||||||
RSPInfo.CheckInterrupts();
|
RSPInfo.CheckInterrupts();
|
||||||
}
|
}
|
||||||
return Cycles;
|
return Cycles;
|
||||||
} else if (TaskType == 7) {
|
}
|
||||||
|
else if (TaskType == 7)
|
||||||
|
{
|
||||||
RSPInfo.ShowCFB();
|
RSPInfo.ShowCFB();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,14 +244,16 @@ __declspec(dllexport) DWORD DoRspCycles ( DWORD Cycles ) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*RSPInfo.SP_STATUS_REG |= (0x0203 );
|
*RSPInfo.SP_STATUS_REG |= (0x0203 );
|
||||||
if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 ) {
|
if ((*RSPInfo.SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 )
|
||||||
|
{
|
||||||
*RSPInfo.MI_INTR_REG |= R4300i_SP_Intr;
|
*RSPInfo.MI_INTR_REG |= R4300i_SP_Intr;
|
||||||
RSPInfo.CheckInterrupts();
|
RSPInfo.CheckInterrupts();
|
||||||
}
|
}
|
||||||
//return Cycles;
|
//return Cycles;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (Profiling && !IndvidualBlock) {
|
if (Profiling && !IndvidualBlock)
|
||||||
|
{
|
||||||
StartTimer((DWORD)Timer_RSP_Running);
|
StartTimer((DWORD)Timer_RSP_Running);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +265,8 @@ __declspec(dllexport) DWORD DoRspCycles ( DWORD Cycles ) {
|
||||||
}
|
}
|
||||||
RSP_MfStatusCount = 0;
|
RSP_MfStatusCount = 0;
|
||||||
|
|
||||||
switch (CPUCore) {
|
switch (CPUCore)
|
||||||
|
{
|
||||||
case RecompilerCPU:
|
case RecompilerCPU:
|
||||||
RunRecompilerCPU(Cycles);
|
RunRecompilerCPU(Cycles);
|
||||||
break;
|
break;
|
||||||
|
@ -256,7 +276,8 @@ __declspec(dllexport) DWORD DoRspCycles ( DWORD Cycles ) {
|
||||||
}
|
}
|
||||||
ReleaseMutex(hMutex);
|
ReleaseMutex(hMutex);
|
||||||
|
|
||||||
if (Profiling && !IndvidualBlock) {
|
if (Profiling && !IndvidualBlock)
|
||||||
|
{
|
||||||
StartTimer((DWORD)Timer_R4300_Running);
|
StartTimer((DWORD)Timer_R4300_Running);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,15 +96,18 @@ const char * AboutMsg ( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
/************ Functions ***********/
|
/************ Functions ***********/
|
||||||
DWORD AsciiToHex (char * HexValue) {
|
DWORD AsciiToHex (char * HexValue)
|
||||||
|
{
|
||||||
DWORD Count, Finish, Value = 0;
|
DWORD Count, Finish, Value = 0;
|
||||||
|
|
||||||
Finish = strlen(HexValue);
|
Finish = strlen(HexValue);
|
||||||
if (Finish > 8 ) { Finish = 8; }
|
if (Finish > 8 ) { Finish = 8; }
|
||||||
|
|
||||||
for (Count = 0; Count < Finish; Count++){
|
for (Count = 0; Count < Finish; Count++)
|
||||||
|
{
|
||||||
Value = (Value << 4);
|
Value = (Value << 4);
|
||||||
switch( HexValue[Count] ) {
|
switch( HexValue[Count] )
|
||||||
|
{
|
||||||
case '0': break;
|
case '0': break;
|
||||||
case '1': Value += 1; break;
|
case '1': Value += 1; break;
|
||||||
case '2': Value += 2; break;
|
case '2': Value += 2; break;
|
||||||
|
@ -135,7 +138,8 @@ DWORD AsciiToHex (char * HexValue) {
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayError (char * Message, ...) {
|
void DisplayError (char * Message, ...)
|
||||||
|
{
|
||||||
char Msg[400];
|
char Msg[400];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
@ -152,7 +156,8 @@ void DisplayError (char * Message, ...) {
|
||||||
input: none
|
input: none
|
||||||
output: none
|
output: none
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
__declspec(dllexport) void CloseDLL (void) {
|
__declspec(dllexport) void CloseDLL (void)
|
||||||
|
{
|
||||||
FreeMemory();
|
FreeMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,11 +168,13 @@ __declspec(dllexport) void CloseDLL (void) {
|
||||||
input: a handle to the window that calls this function
|
input: a handle to the window that calls this function
|
||||||
output: none
|
output: none
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
__declspec(dllexport) void DllAbout ( HWND hParent ) {
|
__declspec(dllexport) void DllAbout ( HWND hParent )
|
||||||
|
{
|
||||||
MessageBox(hParent,AboutMsg(),"About",MB_OK | MB_ICONINFORMATION );
|
MessageBox(hParent,AboutMsg(),"About",MB_OK | MB_ICONINFORMATION );
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +186,8 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD /*fdwReason*/, LPVOID /*lpvReserved
|
||||||
filled by the function. (see def above)
|
filled by the function. (see def above)
|
||||||
output: none
|
output: none
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
__declspec(dllexport) void GetDllInfo ( PLUGIN_INFO * PluginInfo ) {
|
__declspec(dllexport) void GetDllInfo ( PLUGIN_INFO * PluginInfo )
|
||||||
|
{
|
||||||
PluginInfo->Version = 0x0102;
|
PluginInfo->Version = 0x0102;
|
||||||
PluginInfo->Type = PLUGIN_TYPE_RSP;
|
PluginInfo->Type = PLUGIN_TYPE_RSP;
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
@ -259,7 +267,8 @@ __declspec(dllexport) void GetRspDebugInfo ( RSPDEBUG_INFO * DebugInfo )
|
||||||
|
|
||||||
RSP_COMPILER Compiler;
|
RSP_COMPILER Compiler;
|
||||||
|
|
||||||
void DetectCpuSpecs(void) {
|
void DetectCpuSpecs(void)
|
||||||
|
{
|
||||||
DWORD Intel_Features = 0;
|
DWORD Intel_Features = 0;
|
||||||
DWORD AMD_Features = 0;
|
DWORD AMD_Features = 0;
|
||||||
|
|
||||||
|
@ -279,24 +288,31 @@ void DetectCpuSpecs(void) {
|
||||||
AMD_Features = Intel_Features = 0;
|
AMD_Features = Intel_Features = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__declspec(dllexport) void InitiateRSP ( RSP_INFO Rsp_Info, DWORD * CycleCount) {
|
__declspec(dllexport) void InitiateRSP ( RSP_INFO Rsp_Info, DWORD * CycleCount)
|
||||||
|
{
|
||||||
RSPInfo = Rsp_Info;
|
RSPInfo = Rsp_Info;
|
||||||
AudioHle = GetSystemSetting(Set_AudioHle);
|
AudioHle = GetSystemSetting(Set_AudioHle);
|
||||||
GraphicsHle = GetSystemSetting(Set_GraphicsHle);
|
GraphicsHle = GetSystemSetting(Set_GraphicsHle);
|
||||||
|
@ -320,14 +336,17 @@ __declspec(dllexport) void InitiateRSP ( RSP_INFO Rsp_Info, DWORD * CycleCount)
|
||||||
above.
|
above.
|
||||||
output: none
|
output: none
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
__declspec(dllexport) void InitiateRSPDebugger ( DEBUG_INFO Debug_Info) {
|
__declspec(dllexport) void InitiateRSPDebugger ( DEBUG_INFO Debug_Info)
|
||||||
|
{
|
||||||
DebugInfo = Debug_Info;
|
DebugInfo = Debug_Info;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessMenuItem(int ID) {
|
void ProcessMenuItem(int ID)
|
||||||
|
{
|
||||||
UINT uState;
|
UINT uState;
|
||||||
|
|
||||||
switch (ID) {
|
switch (ID)
|
||||||
|
{
|
||||||
case ID_RSPCOMMANDS: Enter_RSP_Commands_Window(); break;
|
case ID_RSPCOMMANDS: Enter_RSP_Commands_Window(); break;
|
||||||
case ID_RSPREGISTERS: Enter_RSP_Register_Window(); break;
|
case ID_RSPREGISTERS: Enter_RSP_Register_Window(); break;
|
||||||
case ID_DUMP_RSPCODE: DumpRSPCode(); break;
|
case ID_DUMP_RSPCODE: DumpRSPCode(); break;
|
||||||
|
@ -337,12 +356,15 @@ void ProcessMenuItem(int ID) {
|
||||||
{
|
{
|
||||||
uState = GetMenuState(hRSPMenu, ID_PROFILING_ON, MF_BYCOMMAND);
|
uState = GetMenuState(hRSPMenu, ID_PROFILING_ON, MF_BYCOMMAND);
|
||||||
|
|
||||||
if (uState & MFS_CHECKED) {
|
if (uState & MFS_CHECKED)
|
||||||
|
{
|
||||||
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) { Profiling = FALSE; }
|
if (DebuggingEnabled) { 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);
|
||||||
|
@ -356,11 +378,14 @@ void ProcessMenuItem(int ID) {
|
||||||
{
|
{
|
||||||
uState = GetMenuState(hRSPMenu, ID_PROFILING_LOGINDIVIDUALBLOCKS, MF_BYCOMMAND);
|
uState = GetMenuState(hRSPMenu, ID_PROFILING_LOGINDIVIDUALBLOCKS, MF_BYCOMMAND);
|
||||||
|
|
||||||
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) { IndvidualBlock = FALSE; }
|
if (DebuggingEnabled) { 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) { IndvidualBlock = TRUE; }
|
if (DebuggingEnabled) { IndvidualBlock = TRUE; }
|
||||||
|
@ -371,11 +396,14 @@ void ProcessMenuItem(int ID) {
|
||||||
{
|
{
|
||||||
uState = GetMenuState(hRSPMenu, ID_SHOWCOMPILERERRORS, MF_BYCOMMAND);
|
uState = GetMenuState(hRSPMenu, ID_SHOWCOMPILERERRORS, MF_BYCOMMAND);
|
||||||
|
|
||||||
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) { ShowErrors = FALSE; }
|
if (DebuggingEnabled) { 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) { ShowErrors = TRUE; }
|
if (DebuggingEnabled) { ShowErrors = TRUE; }
|
||||||
|
@ -389,11 +417,14 @@ void ProcessMenuItem(int ID) {
|
||||||
{
|
{
|
||||||
uState = GetMenuState(hRSPMenu, ID_BREAKONSTARTOFTASK, MF_BYCOMMAND);
|
uState = GetMenuState(hRSPMenu, ID_BREAKONSTARTOFTASK, MF_BYCOMMAND);
|
||||||
|
|
||||||
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) { BreakOnStart = FALSE; }
|
if (DebuggingEnabled) { 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) { BreakOnStart = TRUE; }
|
if (DebuggingEnabled) { BreakOnStart = TRUE; }
|
||||||
|
@ -404,7 +435,8 @@ void ProcessMenuItem(int ID) {
|
||||||
{
|
{
|
||||||
uState = GetMenuState(hRSPMenu, ID_LOGRDPCOMMANDS, MF_BYCOMMAND);
|
uState = GetMenuState(hRSPMenu, ID_LOGRDPCOMMANDS, MF_BYCOMMAND);
|
||||||
|
|
||||||
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)
|
||||||
|
@ -412,7 +444,9 @@ void ProcessMenuItem(int ID) {
|
||||||
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)
|
||||||
|
@ -427,7 +461,8 @@ void ProcessMenuItem(int ID) {
|
||||||
{
|
{
|
||||||
uState = GetMenuState(hRSPMenu, ID_SETTINGS_LOGX86CODE, MF_BYCOMMAND);
|
uState = GetMenuState(hRSPMenu, ID_SETTINGS_LOGX86CODE, MF_BYCOMMAND);
|
||||||
|
|
||||||
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)
|
||||||
|
@ -435,7 +470,9 @@ void ProcessMenuItem(int ID) {
|
||||||
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)
|
||||||
|
@ -488,7 +525,8 @@ __declspec(dllexport) void RomOpen (void)
|
||||||
output: none
|
output: none
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
__declspec(dllexport) void RomClosed (void) {
|
__declspec(dllexport) void RomClosed (void) {
|
||||||
if (Profiling) {
|
if (Profiling)
|
||||||
|
{
|
||||||
StopTimer();
|
StopTimer();
|
||||||
GenerateTimerResults();
|
GenerateTimerResults();
|
||||||
}
|
}
|
||||||
|
@ -501,14 +539,17 @@ __declspec(dllexport) void RomClosed (void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
@ -535,16 +576,15 @@ BOOL CALLBACK CompilerDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lPar
|
||||||
|
|
||||||
SetTimer(hDlg, 1, 250, NULL);
|
SetTimer(hDlg, 1, 250, NULL);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_TIMER:
|
case WM_TIMER:
|
||||||
sprintf(Buffer, "x86: %2.2f KB / %2.2f KB", (float)(RecompPos - RecompCode) / 1024.0F,
|
sprintf(Buffer, "x86: %2.2f KB / %2.2f KB", (float)(RecompPos - RecompCode) / 1024.0F,
|
||||||
pLastSecondary?(float)((pLastSecondary - RecompCodeSecondary) / 1024.0F):0);
|
pLastSecondary?(float)((pLastSecondary - RecompCodeSecondary) / 1024.0F):0);
|
||||||
|
|
||||||
SetDlgItemText(hDlg, IDC_COMPILER_BUFFERS, Buffer);
|
SetDlgItemText(hDlg, IDC_COMPILER_BUFFERS, Buffer);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch (GET_WM_COMMAND_ID(wParam, lParam)) {
|
switch (GET_WM_COMMAND_ID(wParam, lParam))
|
||||||
|
{
|
||||||
case IDOK:
|
case IDOK:
|
||||||
Compiler.bDest = GetBooleanCheck(hDlg, IDC_COMPILER_DEST);
|
Compiler.bDest = GetBooleanCheck(hDlg, IDC_COMPILER_DEST);
|
||||||
Compiler.bAccum = GetBooleanCheck(hDlg, IDC_COMPILER_ACCUM);
|
Compiler.bAccum = GetBooleanCheck(hDlg, IDC_COMPILER_ACCUM);
|
||||||
|
@ -570,31 +610,32 @@ BOOL CALLBACK CompilerDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lPar
|
||||||
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*/)
|
||||||
|
{
|
||||||
HWND hWndItem;
|
HWND hWndItem;
|
||||||
DWORD value;
|
DWORD value;
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,9 +644,9 @@ BOOL CALLBACK ConfigDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam
|
||||||
ComboBox_AddString(hWndItem, "Recompiler");
|
ComboBox_AddString(hWndItem, "Recompiler");
|
||||||
ComboBox_SetCurSel(hWndItem, CPUCore);
|
ComboBox_SetCurSel(hWndItem, CPUCore);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch (GET_WM_COMMAND_ID(wParam, lParam)) {
|
switch (GET_WM_COMMAND_ID(wParam, lParam))
|
||||||
|
{
|
||||||
case IDOK:
|
case IDOK:
|
||||||
hWndItem = GetDlgItem(hDlg, IDC_COMPILER_SELECT);
|
hWndItem = GetDlgItem(hDlg, IDC_COMPILER_SELECT);
|
||||||
value = ComboBox_GetCurSel(hWndItem);
|
value = ComboBox_GetCurSel(hWndItem);
|
||||||
|
@ -621,19 +662,20 @@ BOOL CALLBACK ConfigDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*__declspec(dllexport) void DllConfig (HWND hWnd) {
|
/*__declspec(dllexport) void DllConfig (HWND hWnd)
|
||||||
|
{
|
||||||
// DialogBox(hinstDLL, "RSPCONFIG", hWnd, ConfigDlgProc);
|
// DialogBox(hinstDLL, "RSPCONFIG", hWnd, ConfigDlgProc);
|
||||||
DialogBox(hinstDLL, "RSPCONFIG", GetForegroundWindow(), ConfigDlgProc);
|
DialogBox(hinstDLL, "RSPCONFIG", GetForegroundWindow(), ConfigDlgProc);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
__declspec(dllexport) void EnableDebugging (BOOL Enabled) {
|
__declspec(dllexport) void EnableDebugging (BOOL Enabled)
|
||||||
|
{
|
||||||
DebuggingEnabled = Enabled;
|
DebuggingEnabled = Enabled;
|
||||||
if (DebuggingEnabled)
|
if (DebuggingEnabled)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,7 +36,8 @@ extern "C" {
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class CProfiling {
|
class CProfiling
|
||||||
|
{
|
||||||
typedef std::map<DWORD, __int64 > PROFILE_ENRTIES;
|
typedef std::map<DWORD, __int64 > PROFILE_ENRTIES;
|
||||||
typedef PROFILE_ENRTIES::iterator PROFILE_ENRTY;
|
typedef PROFILE_ENRTIES::iterator PROFILE_ENRTY;
|
||||||
typedef PROFILE_ENRTIES::value_type PROFILE_VALUE;
|
typedef PROFILE_ENRTIES::value_type PROFILE_VALUE;
|
||||||
|
@ -89,9 +90,12 @@ public:
|
||||||
__int64 TimeTaken = StopTime - StartTime;
|
__int64 TimeTaken = StopTime - StartTime;
|
||||||
|
|
||||||
PROFILE_ENRTY Entry = m_Entries.find(m_CurrentTimerAddr);
|
PROFILE_ENRTY Entry = m_Entries.find(m_CurrentTimerAddr);
|
||||||
if (Entry != m_Entries.end()) {
|
if (Entry != m_Entries.end())
|
||||||
|
{
|
||||||
Entry->second += TimeTaken;
|
Entry->second += TimeTaken;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_Entries.insert(PROFILE_ENRTIES::value_type(m_CurrentTimerAddr,TimeTaken));
|
m_Entries.insert(PROFILE_ENRTIES::value_type(m_CurrentTimerAddr,TimeTaken));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,22 +121,27 @@ public:
|
||||||
|
|
||||||
//Get the total time
|
//Get the total time
|
||||||
__int64 TotalTime = 0;
|
__int64 TotalTime = 0;
|
||||||
for (PROFILE_ENRTY itemTime = m_Entries.begin(); itemTime != m_Entries.end(); itemTime++ ) {
|
for (PROFILE_ENRTY itemTime = m_Entries.begin(); itemTime != m_Entries.end(); itemTime++ )
|
||||||
|
{
|
||||||
TotalTime += itemTime->second;
|
TotalTime += itemTime->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create a sortable list of items
|
//Create a sortable list of items
|
||||||
std::vector<PROFILE_VALUE *> ItemList;
|
std::vector<PROFILE_VALUE *> ItemList;
|
||||||
for (PROFILE_ENRTY Entry = m_Entries.begin(); Entry != m_Entries.end(); Entry++ ) {
|
for (PROFILE_ENRTY Entry = m_Entries.begin(); Entry != m_Entries.end(); Entry++ )
|
||||||
|
{
|
||||||
ItemList.push_back(&(*Entry));
|
ItemList.push_back(&(*Entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
//sort the list with a basic bubble sort
|
//sort the list with a basic bubble sort
|
||||||
if (ItemList.size() > 0)
|
if (ItemList.size() > 0)
|
||||||
{
|
{
|
||||||
for (size_t OuterPass = 0; OuterPass < (ItemList.size() - 1); OuterPass++ ) {
|
for (size_t OuterPass = 0; OuterPass < (ItemList.size() - 1); OuterPass++ )
|
||||||
for (size_t InnerPass = 0; InnerPass < (ItemList.size() - 1); InnerPass++ ) {
|
{
|
||||||
if (ItemList[InnerPass]->second < ItemList[InnerPass + 1]->second) {
|
for (size_t InnerPass = 0; InnerPass < (ItemList.size() - 1); InnerPass++ )
|
||||||
|
{
|
||||||
|
if (ItemList[InnerPass]->second < ItemList[InnerPass + 1]->second)
|
||||||
|
{
|
||||||
PROFILE_VALUE * TempPtr = ItemList[InnerPass];
|
PROFILE_VALUE * TempPtr = ItemList[InnerPass];
|
||||||
ItemList[InnerPass] = ItemList[InnerPass + 1];
|
ItemList[InnerPass] = ItemList[InnerPass + 1];
|
||||||
ItemList[InnerPass + 1] = TempPtr;
|
ItemList[InnerPass + 1] = TempPtr;
|
||||||
|
@ -148,13 +157,16 @@ public:
|
||||||
{Timer_RDP_Running, "RDP: Running"},
|
{Timer_RDP_Running, "RDP: Running"},
|
||||||
};
|
};
|
||||||
|
|
||||||
for (size_t count = 0; count < ItemList.size(); count++ ) {
|
for (size_t count = 0; count < ItemList.size(); count++ )
|
||||||
|
{
|
||||||
char Buffer[255];
|
char Buffer[255];
|
||||||
float CpuUsage = (float)(((double)ItemList[count]->second / (double)TotalTime) * 100);
|
float CpuUsage = (float)(((double)ItemList[count]->second / (double)TotalTime) * 100);
|
||||||
if (CpuUsage <= 0.2) { continue; }
|
if (CpuUsage <= 0.2) { continue; }
|
||||||
sprintf(Buffer,"Func 0x%08X",ItemList[count]->first);
|
sprintf(Buffer,"Func 0x%08X",ItemList[count]->first);
|
||||||
for (int NameID = 0; NameID < (sizeof(TimerNames) / sizeof(TIMER_NAME)); NameID++) {
|
for (int NameID = 0; NameID < (sizeof(TimerNames) / sizeof(TIMER_NAME)); NameID++)
|
||||||
if (ItemList[count]->first == (DWORD)TimerNames[NameID].Timer) {
|
{
|
||||||
|
if (ItemList[count]->first == (DWORD)TimerNames[NameID].Timer)
|
||||||
|
{
|
||||||
strcpy(Buffer,TimerNames[NameID].Name);
|
strcpy(Buffer,TimerNames[NameID].Name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -165,7 +177,6 @@ public:
|
||||||
|
|
||||||
ShellExecute(NULL,"open",LogFileName.c_str(),NULL,NULL,SW_SHOW);
|
ShellExecute(NULL,"open",LogFileName.c_str(),NULL,NULL,SW_SHOW);
|
||||||
ResetCounters();
|
ResetCounters();
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -176,23 +187,26 @@ CProfiling& GetProfiler ( void )
|
||||||
return Profile;
|
return Profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetTimerList (void) {
|
void ResetTimerList (void)
|
||||||
|
{
|
||||||
GetProfiler().ResetCounters();
|
GetProfiler().ResetCounters();
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD StartTimer (DWORD Address) {
|
DWORD StartTimer (DWORD Address)
|
||||||
|
{
|
||||||
return GetProfiler().StartTimer(Address);
|
return GetProfiler().StartTimer(Address);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StopTimer (void) {
|
void StopTimer (void)
|
||||||
|
{
|
||||||
GetProfiler().StopTimer();
|
GetProfiler().StopTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenerateTimerResults (void) {
|
void GenerateTimerResults (void)
|
||||||
|
{
|
||||||
GetProfiler().GenerateLog();
|
GetProfiler().GenerateLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef todelete
|
#ifdef todelete
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -206,14 +220,16 @@ DWORD StartTimeHi, StartTimeLo, StopTimeHi, StopTimeLo, TSE_Count, TSE_Max;
|
||||||
TIME_STAMP_ENTRY * TS_Entries = NULL;
|
TIME_STAMP_ENTRY * TS_Entries = NULL;
|
||||||
char LastLabel[100];
|
char LastLabel[100];
|
||||||
|
|
||||||
void ResetTimerList (void) {
|
void ResetTimerList (void)
|
||||||
|
{
|
||||||
if (TS_Entries) { free(TS_Entries); }
|
if (TS_Entries) { free(TS_Entries); }
|
||||||
TS_Entries = NULL;
|
TS_Entries = NULL;
|
||||||
TSE_Count = 0;
|
TSE_Count = 0;
|
||||||
TSE_Max = 0;
|
TSE_Max = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartTimer (char * Label) {
|
void StartTimer (char * Label)
|
||||||
|
{
|
||||||
strcpy(LastLabel,Label);
|
strcpy(LastLabel,Label);
|
||||||
_asm {
|
_asm {
|
||||||
pushad
|
pushad
|
||||||
|
@ -224,7 +240,8 @@ void StartTimer (char * Label) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StopTimer (void) {
|
void StopTimer (void)
|
||||||
|
{
|
||||||
_asm {
|
_asm {
|
||||||
pushad
|
pushad
|
||||||
rdtsc
|
rdtsc
|
||||||
|
@ -236,8 +253,10 @@ void StopTimer (void) {
|
||||||
{
|
{
|
||||||
DWORD count;
|
DWORD count;
|
||||||
|
|
||||||
for (count = 0; count < TSE_Count; count ++) {
|
for (count = 0; count < TSE_Count; count ++)
|
||||||
if (strcmp(LastLabel,TS_Entries[count].Label) == 0) {
|
{
|
||||||
|
if (strcmp(LastLabel,TS_Entries[count].Label) == 0)
|
||||||
|
{
|
||||||
__int64 Time = ((unsigned __int64)StopTimeHi << 32) + (unsigned __int64)StopTimeLo;
|
__int64 Time = ((unsigned __int64)StopTimeHi << 32) + (unsigned __int64)StopTimeLo;
|
||||||
Time -= ((unsigned __int64)StartTimeHi << 32) + (unsigned __int64)StartTimeLo;
|
Time -= ((unsigned __int64)StartTimeHi << 32) + (unsigned __int64)StartTimeLo;
|
||||||
TS_Entries[count].TimeTotal += Time;
|
TS_Entries[count].TimeTotal += Time;
|
||||||
|
@ -245,16 +264,21 @@ void StopTimer (void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TSE_Count == 0) {
|
if (TSE_Count == 0)
|
||||||
|
{
|
||||||
TS_Entries = (TIME_STAMP_ENTRY *)malloc(sizeof(TIME_STAMP_ENTRY) * 100);
|
TS_Entries = (TIME_STAMP_ENTRY *)malloc(sizeof(TIME_STAMP_ENTRY) * 100);
|
||||||
if (TS_Entries == NULL) {
|
if (TS_Entries == NULL)
|
||||||
|
{
|
||||||
MessageBox(NULL,"TIME_STAMP_ENTRY == NULL ??","ERROR",MB_OK|MB_ICONERROR|MB_SETFOREGROUND);
|
MessageBox(NULL,"TIME_STAMP_ENTRY == NULL ??","ERROR",MB_OK|MB_ICONERROR|MB_SETFOREGROUND);
|
||||||
}
|
}
|
||||||
TSE_Max = 100;
|
TSE_Max = 100;
|
||||||
} else if (TSE_Count == TSE_Max) {
|
}
|
||||||
|
else if (TSE_Count == TSE_Max)
|
||||||
|
{
|
||||||
TSE_Max += 100;
|
TSE_Max += 100;
|
||||||
TS_Entries = (TIME_STAMP_ENTRY *)realloc(TS_Entries,sizeof(TIME_STAMP_ENTRY) * TSE_Max);
|
TS_Entries = (TIME_STAMP_ENTRY *)realloc(TS_Entries,sizeof(TIME_STAMP_ENTRY) * TSE_Max);
|
||||||
if (TS_Entries == NULL) {
|
if (TS_Entries == NULL)
|
||||||
|
{
|
||||||
MessageBox(NULL,"TIME_STAMP_ENTRY == NULL ??","ERROR",MB_OK|MB_ICONERROR|MB_SETFOREGROUND);
|
MessageBox(NULL,"TIME_STAMP_ENTRY == NULL ??","ERROR",MB_OK|MB_ICONERROR|MB_SETFOREGROUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,7 +288,8 @@ void StopTimer (void) {
|
||||||
TSE_Count +=1;
|
TSE_Count +=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenerateTimerResults (void) {
|
void GenerateTimerResults (void)
|
||||||
|
{
|
||||||
char buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR];
|
char buffer[_MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR];
|
||||||
char fname[_MAX_FNAME],ext[_MAX_EXT], LogFileName[_MAX_PATH];
|
char fname[_MAX_FNAME],ext[_MAX_EXT], LogFileName[_MAX_PATH];
|
||||||
DWORD dwWritten, count, count2;
|
DWORD dwWritten, count, count2;
|
||||||
|
@ -281,9 +306,12 @@ void GenerateTimerResults (void) {
|
||||||
CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
||||||
SetFilePointer(hLogFile,0,NULL,FILE_BEGIN);
|
SetFilePointer(hLogFile,0,NULL,FILE_BEGIN);
|
||||||
|
|
||||||
for (count = 0; count < TSE_Count; count ++) {
|
for (count = 0; count < TSE_Count; count ++)
|
||||||
for (count2 = 0; count2 < (TSE_Count - 1); count2 ++) {
|
{
|
||||||
if (TS_Entries[count2].TimeTotal < TS_Entries[count2 + 1].TimeTotal) {
|
for (count2 = 0; count2 < (TSE_Count - 1); count2 ++)
|
||||||
|
{
|
||||||
|
if (TS_Entries[count2].TimeTotal < TS_Entries[count2 + 1].TimeTotal)
|
||||||
|
{
|
||||||
TIME_STAMP_ENTRY Temp;
|
TIME_STAMP_ENTRY Temp;
|
||||||
memcpy(&Temp,&TS_Entries[count2],sizeof(TIME_STAMP_ENTRY));
|
memcpy(&Temp,&TS_Entries[count2],sizeof(TIME_STAMP_ENTRY));
|
||||||
memcpy(&TS_Entries[count2],&TS_Entries[count2 + 1],sizeof(TIME_STAMP_ENTRY));
|
memcpy(&TS_Entries[count2],&TS_Entries[count2 + 1],sizeof(TIME_STAMP_ENTRY));
|
||||||
|
@ -292,10 +320,12 @@ void GenerateTimerResults (void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TotalTime = 0;
|
TotalTime = 0;
|
||||||
for (count = 0; count < TSE_Count; count ++) {
|
for (count = 0; count < TSE_Count; count ++)
|
||||||
|
{
|
||||||
TotalTime += TS_Entries[count].TimeTotal;
|
TotalTime += TS_Entries[count].TimeTotal;
|
||||||
}
|
}
|
||||||
for (count = 0; count < (TSE_Count < 50?TSE_Count:50); count ++) {
|
for (count = 0; count < (TSE_Count < 50?TSE_Count:50); count ++)
|
||||||
|
{
|
||||||
sprintf(buffer,"%s - %0.2f%c\r\n",
|
sprintf(buffer,"%s - %0.2f%c\r\n",
|
||||||
TS_Entries[count].Label,
|
TS_Entries[count].Label,
|
||||||
(((double)TS_Entries[count].TimeTotal / (double)TotalTime) * 100),'%'
|
(((double)TS_Entries[count].TimeTotal / (double)TotalTime) * 100),'%'
|
||||||
|
|
|
@ -72,29 +72,36 @@ BOOL InRSPCommandsWindow;
|
||||||
char CommandName[100];
|
char CommandName[100];
|
||||||
DWORD Stepping_Commands, WaitingForStep;
|
DWORD Stepping_Commands, WaitingForStep;
|
||||||
|
|
||||||
|
void Create_RSP_Commands_Window ( int Child )
|
||||||
void Create_RSP_Commands_Window ( int Child ) {
|
{
|
||||||
DWORD ThreadID;
|
DWORD ThreadID;
|
||||||
|
|
||||||
if ( Child ) {
|
if ( Child )
|
||||||
|
{
|
||||||
InRSPCommandsWindow = TRUE;
|
InRSPCommandsWindow = TRUE;
|
||||||
DialogBox( hinstDLL, "RSPCOMMAND", NULL,(DLGPROC)RSP_Commands_Proc );
|
DialogBox( hinstDLL, "RSPCOMMAND", NULL,(DLGPROC)RSP_Commands_Proc );
|
||||||
|
|
||||||
InRSPCommandsWindow = FALSE;
|
InRSPCommandsWindow = FALSE;
|
||||||
memset(RSPCommandLine,0,sizeof(RSPCommandLine));
|
memset(RSPCommandLine,0,sizeof(RSPCommandLine));
|
||||||
SetRSPCommandToRunning();
|
SetRSPCommandToRunning();
|
||||||
} else {
|
}
|
||||||
if (!InRSPCommandsWindow) {
|
else
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
SetForegroundWindow(RSPCommandshWnd);
|
SetForegroundWindow(RSPCommandshWnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Disable_RSP_Commands_Window ( void ) {
|
void Disable_RSP_Commands_Window ( void )
|
||||||
|
{
|
||||||
SCROLLINFO si;
|
SCROLLINFO si;
|
||||||
|
|
||||||
if (!InRSPCommandsWindow) { return; }
|
if (!InRSPCommandsWindow) { return; }
|
||||||
|
@ -118,7 +125,8 @@ void Disable_RSP_Commands_Window ( void ) {
|
||||||
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;
|
||||||
BOOL Redraw = FALSE;
|
BOOL Redraw = FALSE;
|
||||||
|
@ -131,15 +139,19 @@ int DisplayRSPCommand (DWORD location, int InsertPos) {
|
||||||
if (RSPCommandLine[InsertPos].opcode != OpCode) { Redraw = TRUE; }
|
if (RSPCommandLine[InsertPos].opcode != OpCode) { Redraw = TRUE; }
|
||||||
if (RSPCommandLine[InsertPos].Location != location) { Redraw = TRUE; }
|
if (RSPCommandLine[InsertPos].Location != location) { Redraw = TRUE; }
|
||||||
if (RSPCommandLine[InsertPos].status != status) { Redraw = TRUE; }
|
if (RSPCommandLine[InsertPos].status != status) { Redraw = TRUE; }
|
||||||
if (Redraw) {
|
if (Redraw)
|
||||||
|
{
|
||||||
RSPCommandLine[InsertPos].Location = location;
|
RSPCommandLine[InsertPos].Location = location;
|
||||||
RSPCommandLine[InsertPos].status = status;
|
RSPCommandLine[InsertPos].status = status;
|
||||||
RSPCommandLine[InsertPos].opcode = OpCode;
|
RSPCommandLine[InsertPos].opcode = OpCode;
|
||||||
sprintf(RSPCommandLine[InsertPos].String," 0x%03X\t%s",location,
|
sprintf(RSPCommandLine[InsertPos].String," 0x%03X\t%s",location,
|
||||||
RSPOpcodeName ( OpCode, location ));
|
RSPOpcodeName ( OpCode, location ));
|
||||||
if ( SendMessage(hList,LB_GETCOUNT,0,0) <= InsertPos) {
|
if ( SendMessage(hList,LB_GETCOUNT,0,0) <= InsertPos)
|
||||||
|
{
|
||||||
SendMessage(hList,LB_INSERTSTRING,(WPARAM)InsertPos, (LPARAM)location);
|
SendMessage(hList,LB_INSERTSTRING,(WPARAM)InsertPos, (LPARAM)location);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
RECT ItemRC;
|
RECT ItemRC;
|
||||||
SendMessage(hList,LB_GETITEMRECT,(WPARAM)InsertPos, (LPARAM)&ItemRC);
|
SendMessage(hList,LB_GETITEMRECT,(WPARAM)InsertPos, (LPARAM)&ItemRC);
|
||||||
RedrawWindow(hList,&ItemRC,NULL, RDW_INVALIDATE );
|
RedrawWindow(hList,&ItemRC,NULL, RDW_INVALIDATE );
|
||||||
|
@ -148,7 +160,8 @@ int DisplayRSPCommand (DWORD location, int InsertPos) {
|
||||||
return LinesUsed;
|
return LinesUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DumpRSPCode (void) {
|
void DumpRSPCode (void)
|
||||||
|
{
|
||||||
char string[100], LogFileName[255], *p ;
|
char string[100], LogFileName[255], *p ;
|
||||||
uint32_t OpCode;
|
uint32_t OpCode;
|
||||||
DWORD location, dwWritten;
|
DWORD location, dwWritten;
|
||||||
|
@ -156,14 +169,17 @@ void DumpRSPCode (void) {
|
||||||
|
|
||||||
strcpy(LogFileName,GetCommandLine() + 1);
|
strcpy(LogFileName,GetCommandLine() + 1);
|
||||||
|
|
||||||
if (strchr(LogFileName,'\"')) {
|
if (strchr(LogFileName,'\"'))
|
||||||
|
{
|
||||||
p = strchr(LogFileName,'\"');
|
p = strchr(LogFileName,'\"');
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strchr(LogFileName,'\\')) {
|
if (strchr(LogFileName,'\\'))
|
||||||
|
{
|
||||||
p = LogFileName;
|
p = LogFileName;
|
||||||
while (strchr(p,'\\')) {
|
while (strchr(p,'\\'))
|
||||||
|
{
|
||||||
p = strchr(p,'\\');
|
p = strchr(p,'\\');
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +201,8 @@ void DumpRSPCode (void) {
|
||||||
CloseHandle(hLogFile);
|
CloseHandle(hLogFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DumpRSPData (void) {
|
void DumpRSPData (void)
|
||||||
|
{
|
||||||
char string[100], LogFileName[255], *p ;
|
char string[100], LogFileName[255], *p ;
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
DWORD location, dwWritten;
|
DWORD location, dwWritten;
|
||||||
|
@ -193,12 +210,14 @@ void DumpRSPData (void) {
|
||||||
|
|
||||||
strcpy(LogFileName,GetCommandLine() + 1);
|
strcpy(LogFileName,GetCommandLine() + 1);
|
||||||
|
|
||||||
if (strchr(LogFileName,'\"')) {
|
if (strchr(LogFileName,'\"'))
|
||||||
|
{
|
||||||
p = strchr(LogFileName,'\"');
|
p = strchr(LogFileName,'\"');
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strchr(LogFileName,'\\')) {
|
if (strchr(LogFileName,'\\'))
|
||||||
|
{
|
||||||
p = LogFileName;
|
p = LogFileName;
|
||||||
while (strchr(p,'\\')) {
|
while (strchr(p,'\\')) {
|
||||||
p = strchr(p,'\\');
|
p = strchr(p,'\\');
|
||||||
|
@ -214,7 +233,8 @@ void DumpRSPData (void) {
|
||||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
||||||
SetFilePointer(hLogFile,0,NULL,FILE_BEGIN);
|
SetFilePointer(hLogFile,0,NULL,FILE_BEGIN);
|
||||||
|
|
||||||
for (location = 0; location < 0x1000; location += 4) {
|
for (location = 0; location < 0x1000; location += 4)
|
||||||
|
{
|
||||||
RSP_LW_DMEM(location, &value);
|
RSP_LW_DMEM(location, &value);
|
||||||
sprintf(string," 0x%03X\t0x%08X\r\n", location, value);
|
sprintf(string," 0x%03X\t0x%08X\r\n", location, value);
|
||||||
WriteFile( hLogFile,string,strlen(string),&dwWritten,NULL );
|
WriteFile( hLogFile,string,strlen(string),&dwWritten,NULL );
|
||||||
|
@ -222,7 +242,8 @@ void DumpRSPData (void) {
|
||||||
CloseHandle(hLogFile);
|
CloseHandle(hLogFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawRSPCommand ( LPARAM lParam ) {
|
void DrawRSPCommand ( LPARAM lParam )
|
||||||
|
{
|
||||||
char Command[150], Offset[30], Instruction[30], Arguments[40];
|
char Command[150], Offset[30], Instruction[30], Arguments[40];
|
||||||
LPDRAWITEMSTRUCT ditem;
|
LPDRAWITEMSTRUCT ditem;
|
||||||
COLORREF oldColor = {0};
|
COLORREF oldColor = {0};
|
||||||
|
@ -234,39 +255,52 @@ void DrawRSPCommand ( LPARAM lParam ) {
|
||||||
ditem = (LPDRAWITEMSTRUCT)lParam;
|
ditem = (LPDRAWITEMSTRUCT)lParam;
|
||||||
strcpy(Command, RSPCommandLine[ditem->itemID].String);
|
strcpy(Command, RSPCommandLine[ditem->itemID].String);
|
||||||
|
|
||||||
if (strchr(Command,'\t')) {
|
if (strchr(Command,'\t'))
|
||||||
|
{
|
||||||
p1 = strchr(Command,'\t');
|
p1 = strchr(Command,'\t');
|
||||||
sprintf(Offset,"%.*s",p1 - Command, Command);
|
sprintf(Offset,"%.*s",p1 - Command, Command);
|
||||||
p1++;
|
p1++;
|
||||||
if (strchr(p1,'\t')) {
|
if (strchr(p1,'\t'))
|
||||||
|
{
|
||||||
p2 = strchr(p1,'\t');
|
p2 = strchr(p1,'\t');
|
||||||
sprintf(Instruction,"%.*s",p2 - p1, p1);
|
sprintf(Instruction,"%.*s",p2 - p1, p1);
|
||||||
sprintf(Arguments,"%s",p2 + 1);
|
sprintf(Arguments,"%s",p2 + 1);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
sprintf(Instruction,"%s",p1);
|
sprintf(Instruction,"%s",p1);
|
||||||
sprintf(Arguments,"\0");
|
sprintf(Arguments,"\0");
|
||||||
}
|
}
|
||||||
sprintf(Command,"\0");
|
sprintf(Command,"\0");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
sprintf(Offset,"\0");
|
sprintf(Offset,"\0");
|
||||||
sprintf(Instruction,"\0");
|
sprintf(Instruction,"\0");
|
||||||
sprintf(Arguments,"\0");
|
sprintf(Arguments,"\0");
|
||||||
}
|
}
|
||||||
|
|
||||||
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));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
oldColor = SetTextColor(ditem->hDC,RGB(255,0,0));
|
oldColor = SetTextColor(ditem->hDC,RGB(255,0,0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,7 +308,8 @@ void DrawRSPCommand ( LPARAM lParam ) {
|
||||||
FillRect( ditem->hDC, &ditem->rcItem,hBrush);
|
FillRect( ditem->hDC, &ditem->rcItem,hBrush);
|
||||||
SetBkMode( ditem->hDC, TRANSPARENT );
|
SetBkMode( ditem->hDC, TRANSPARENT );
|
||||||
|
|
||||||
if (strlen (Command) == 0 ) {
|
if (strlen (Command) == 0 )
|
||||||
|
{
|
||||||
SetRect(&TextRect,ditem->rcItem.left,ditem->rcItem.top, ditem->rcItem.left + 83,
|
SetRect(&TextRect,ditem->rcItem.left,ditem->rcItem.top, ditem->rcItem.left + 83,
|
||||||
ditem->rcItem.bottom);
|
ditem->rcItem.bottom);
|
||||||
DrawText(ditem->hDC,Offset,strlen(Offset), &TextRect,DT_SINGLELINE | DT_VCENTER);
|
DrawText(ditem->hDC,Offset,strlen(Offset), &TextRect,DT_SINGLELINE | DT_VCENTER);
|
||||||
|
@ -286,18 +321,19 @@ void DrawRSPCommand ( LPARAM lParam ) {
|
||||||
SetRect(&TextRect,ditem->rcItem.left + 165,ditem->rcItem.top, ditem->rcItem.right,
|
SetRect(&TextRect,ditem->rcItem.left + 165,ditem->rcItem.top, ditem->rcItem.right,
|
||||||
ditem->rcItem.bottom);
|
ditem->rcItem.bottom);
|
||||||
DrawText(ditem->hDC,Arguments,strlen(Arguments), &TextRect,DT_SINGLELINE | DT_VCENTER);
|
DrawText(ditem->hDC,Arguments,strlen(Arguments), &TextRect,DT_SINGLELINE | DT_VCENTER);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
DrawText(ditem->hDC,Command,strlen(Command), &ditem->rcItem,DT_SINGLELINE | DT_VCENTER);
|
DrawText(ditem->hDC,Command,strlen(Command), &ditem->rcItem,DT_SINGLELINE | DT_VCENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ResetColor == TRUE) {
|
if (ResetColor == TRUE) {
|
||||||
SetTextColor( ditem->hDC, oldColor );
|
SetTextColor( ditem->hDC, oldColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Enable_RSP_Commands_Window ( void )
|
||||||
void Enable_RSP_Commands_Window ( void ) {
|
{
|
||||||
SCROLLINFO si;
|
SCROLLINFO si;
|
||||||
|
|
||||||
if (!InRSPCommandsWindow) { return; }
|
if (!InRSPCommandsWindow) { return; }
|
||||||
|
@ -329,11 +365,13 @@ 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)
|
||||||
|
{
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
RECT rcBox;
|
RECT rcBox;
|
||||||
HFONT hOldFont;
|
HFONT hOldFont;
|
||||||
|
@ -384,7 +422,8 @@ void Paint_RSP_Commands (HWND hDlg) {
|
||||||
EndPaint( hDlg, &ps );
|
EndPaint( hDlg, &ps );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RefreshRSPCommands ( void ) {
|
void RefreshRSPCommands ( void )
|
||||||
|
{
|
||||||
DWORD location, LinesUsed;
|
DWORD location, LinesUsed;
|
||||||
char AsciiAddress[20];
|
char AsciiAddress[20];
|
||||||
int count;
|
int count;
|
||||||
|
@ -395,14 +434,17 @@ void RefreshRSPCommands ( void ) {
|
||||||
location = AsciiToHex(AsciiAddress) & ~3;
|
location = AsciiToHex(AsciiAddress) & ~3;
|
||||||
|
|
||||||
if (location > 0xF88) { location = 0xF88; }
|
if (location > 0xF88) { location = 0xF88; }
|
||||||
for (count = 0 ; count < RSP_MaxCommandLines; count += LinesUsed ){
|
for (count = 0 ; count < RSP_MaxCommandLines; count += LinesUsed )
|
||||||
|
{
|
||||||
LinesUsed = DisplayRSPCommand ( location, count );
|
LinesUsed = DisplayRSPCommand ( location, count );
|
||||||
location += 4;
|
location += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
switch (uMsg) {
|
{
|
||||||
|
switch (uMsg)
|
||||||
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
RSPCommandshWnd = hDlg;
|
RSPCommandshWnd = hDlg;
|
||||||
RSP_Commands_Setup( hDlg );
|
RSP_Commands_Setup( hDlg );
|
||||||
|
@ -411,7 +453,8 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
//StoreCurrentWinPos("RSP Commands",hDlg);
|
//StoreCurrentWinPos("RSP Commands",hDlg);
|
||||||
break;
|
break;
|
||||||
case WM_DRAWITEM:
|
case WM_DRAWITEM:
|
||||||
if (wParam == IDC_LIST) {
|
if (wParam == IDC_LIST)
|
||||||
|
{
|
||||||
DrawRSPCommand (lParam);
|
DrawRSPCommand (lParam);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -420,16 +463,22 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
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))
|
||||||
|
{
|
||||||
case IDC_LIST:
|
case IDC_LIST:
|
||||||
if (HIWORD(wParam) == LBN_DBLCLK ) {
|
if (HIWORD(wParam) == LBN_DBLCLK )
|
||||||
|
{
|
||||||
DWORD Location, Selected;
|
DWORD Location, Selected;
|
||||||
Selected = SendMessage(hList,LB_GETCURSEL,(WPARAM)0, (LPARAM)0);
|
Selected = SendMessage(hList,LB_GETCURSEL,(WPARAM)0, (LPARAM)0);
|
||||||
Location = RSPCommandLine[Selected].Location;
|
Location = RSPCommandLine[Selected].Location;
|
||||||
if (Location != (DWORD)-1) {
|
if (Location != (DWORD)-1)
|
||||||
if (CheckForRSPBPoint(Location)) {
|
{
|
||||||
|
if (CheckForRSPBPoint(Location))
|
||||||
|
{
|
||||||
RemoveRSPBreakPoint(Location);
|
RemoveRSPBreakPoint(Location);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
AddRSP_BPoint(Location, FALSE);
|
AddRSP_BPoint(Location, FALSE);
|
||||||
}
|
}
|
||||||
RefreshRSPCommands();
|
RefreshRSPCommands();
|
||||||
|
@ -437,7 +486,8 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IDC_ADDRESS:
|
case IDC_ADDRESS:
|
||||||
if (HIWORD(wParam) == EN_CHANGE ) {
|
if (HIWORD(wParam) == EN_CHANGE )
|
||||||
|
{
|
||||||
RefreshRSPCommands();
|
RefreshRSPCommands();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -455,7 +505,8 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
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)
|
||||||
|
{
|
||||||
DebugInfo.Enter_BPoint_Window();
|
DebugInfo.Enter_BPoint_Window();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -463,17 +514,20 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
Enter_RSP_Register_Window();
|
Enter_RSP_Register_Window();
|
||||||
break;
|
break;
|
||||||
case IDC_R4300I_DEBUGGER_BUTTON:
|
case IDC_R4300I_DEBUGGER_BUTTON:
|
||||||
if (DebugInfo.Enter_R4300i_Commands_Window != NULL) {
|
if (DebugInfo.Enter_R4300i_Commands_Window != NULL)
|
||||||
|
{
|
||||||
DebugInfo.Enter_R4300i_Commands_Window();
|
DebugInfo.Enter_R4300i_Commands_Window();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IDC_R4300I_REGISTERS_BUTTON:
|
case IDC_R4300I_REGISTERS_BUTTON:
|
||||||
if (DebugInfo.Enter_R4300i_Register_Window != NULL) {
|
if (DebugInfo.Enter_R4300i_Register_Window != NULL)
|
||||||
|
{
|
||||||
DebugInfo.Enter_R4300i_Register_Window();
|
DebugInfo.Enter_R4300i_Register_Window();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IDC_MEMORY_BUTTON:
|
case IDC_MEMORY_BUTTON:
|
||||||
if (DebugInfo.Enter_Memory_Window != NULL) {
|
if (DebugInfo.Enter_Memory_Window != NULL)
|
||||||
|
{
|
||||||
DebugInfo.Enter_Memory_Window();
|
DebugInfo.Enter_Memory_Window();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -483,7 +537,8 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_VSCROLL:
|
case WM_VSCROLL:
|
||||||
if ((HWND)lParam == hScrlBar) {
|
if ((HWND)lParam == hScrlBar)
|
||||||
|
{
|
||||||
DWORD location;
|
DWORD location;
|
||||||
char Value[20];
|
char Value[20];
|
||||||
SCROLLINFO si;
|
SCROLLINFO si;
|
||||||
|
@ -491,7 +546,8 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
GetWindowText(hAddress,Value,sizeof(Value));
|
GetWindowText(hAddress,Value,sizeof(Value));
|
||||||
location = AsciiToHex(Value) & ~3;
|
location = AsciiToHex(Value) & ~3;
|
||||||
|
|
||||||
switch (LOWORD(wParam)) {
|
switch (LOWORD(wParam))
|
||||||
|
{
|
||||||
case SB_THUMBTRACK:
|
case SB_THUMBTRACK:
|
||||||
sprintf(Value,"%03X",((short int)HIWORD(wParam) << 2 ));
|
sprintf(Value,"%03X",((short int)HIWORD(wParam) << 2 ));
|
||||||
SetWindowText(hAddress,Value);
|
SetWindowText(hAddress,Value);
|
||||||
|
@ -501,14 +557,17 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
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)
|
||||||
|
{
|
||||||
sprintf(Value,"%03X",location + 0x4);
|
sprintf(Value,"%03X",location + 0x4);
|
||||||
SetWindowText(hAddress,Value);
|
SetWindowText(hAddress,Value);
|
||||||
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
|
||||||
|
{
|
||||||
sprintf(Value,"%03X",0xF88);
|
sprintf(Value,"%03X",0xF88);
|
||||||
SetWindowText(hAddress,Value);
|
SetWindowText(hAddress,Value);
|
||||||
si.cbSize = sizeof(si);
|
si.cbSize = sizeof(si);
|
||||||
|
@ -518,14 +577,17 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SB_LINEUP:
|
case SB_LINEUP:
|
||||||
if (location > 0x4 ) {
|
if (location > 0x4 )
|
||||||
|
{
|
||||||
sprintf(Value,"%03X",location - 0x4);
|
sprintf(Value,"%03X",location - 0x4);
|
||||||
SetWindowText(hAddress,Value);
|
SetWindowText(hAddress,Value);
|
||||||
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
|
||||||
|
{
|
||||||
sprintf(Value,"%03X",0);
|
sprintf(Value,"%03X",0);
|
||||||
SetWindowText(hAddress,Value);
|
SetWindowText(hAddress,Value);
|
||||||
si.cbSize = sizeof(si);
|
si.cbSize = sizeof(si);
|
||||||
|
@ -535,14 +597,17 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SB_PAGEDOWN:
|
case SB_PAGEDOWN:
|
||||||
if ((location + 0x74)< 0xF88) {
|
if ((location + 0x74)< 0xF88)
|
||||||
|
{
|
||||||
sprintf(Value,"%03X",location + 0x74);
|
sprintf(Value,"%03X",location + 0x74);
|
||||||
SetWindowText(hAddress,Value);
|
SetWindowText(hAddress,Value);
|
||||||
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
|
||||||
|
{
|
||||||
sprintf(Value,"%03X",0xF88);
|
sprintf(Value,"%03X",0xF88);
|
||||||
SetWindowText(hAddress,Value);
|
SetWindowText(hAddress,Value);
|
||||||
si.cbSize = sizeof(si);
|
si.cbSize = sizeof(si);
|
||||||
|
@ -552,14 +617,17 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SB_PAGEUP:
|
case SB_PAGEUP:
|
||||||
if ((location - 0x74) > 0x74 ) {
|
if ((location - 0x74) > 0x74 )
|
||||||
|
{
|
||||||
sprintf(Value,"%03X",location - 0x74);
|
sprintf(Value,"%03X",location - 0x74);
|
||||||
SetWindowText(hAddress,Value);
|
SetWindowText(hAddress,Value);
|
||||||
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
|
||||||
|
{
|
||||||
sprintf(Value,"%03X",0);
|
sprintf(Value,"%03X",0);
|
||||||
SetWindowText(hAddress,Value);
|
SetWindowText(hAddress,Value);
|
||||||
si.cbSize = sizeof(si);
|
si.cbSize = sizeof(si);
|
||||||
|
@ -577,7 +645,8 @@ LRESULT CALLBACK RSP_Commands_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSP_Commands_Setup ( HWND hDlg ) {
|
void RSP_Commands_Setup ( HWND hDlg )
|
||||||
|
{
|
||||||
#define WindowWidth 457
|
#define WindowWidth 457
|
||||||
#define WindowHeight 494
|
#define WindowHeight 494
|
||||||
char Location[10];
|
char Location[10];
|
||||||
|
@ -586,7 +655,8 @@ void RSP_Commands_Setup ( HWND hDlg ) {
|
||||||
hList = CreateWindowEx(WS_EX_STATICEDGE, "LISTBOX","", WS_CHILD | WS_VISIBLE |
|
hList = CreateWindowEx(WS_EX_STATICEDGE, "LISTBOX","", WS_CHILD | WS_VISIBLE |
|
||||||
LBS_OWNERDRAWFIXED | LBS_NOTIFY,14,30,303,445, hDlg,
|
LBS_OWNERDRAWFIXED | LBS_NOTIFY,14,30,303,445, hDlg,
|
||||||
(HMENU)IDC_LIST, hinstDLL,NULL );
|
(HMENU)IDC_LIST, hinstDLL,NULL );
|
||||||
if ( hList) {
|
if ( hList)
|
||||||
|
{
|
||||||
SendMessage(hList,WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
SendMessage(hList,WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
||||||
SendMessage(hList,LB_SETITEMHEIGHT, (WPARAM)0,(LPARAM)MAKELPARAM(14, 0));
|
SendMessage(hList,LB_SETITEMHEIGHT, (WPARAM)0,(LPARAM)MAKELPARAM(14, 0));
|
||||||
}
|
}
|
||||||
|
@ -594,7 +664,8 @@ void RSP_Commands_Setup ( HWND hDlg ) {
|
||||||
sprintf(Location,"%03X",*PrgCount);
|
sprintf(Location,"%03X",*PrgCount);
|
||||||
hAddress = CreateWindowEx(0,"EDIT",Location, WS_CHILD | ES_UPPERCASE | WS_VISIBLE |
|
hAddress = CreateWindowEx(0,"EDIT",Location, WS_CHILD | ES_UPPERCASE | WS_VISIBLE |
|
||||||
WS_BORDER | WS_TABSTOP,375,17,36,18, hDlg,(HMENU)IDC_ADDRESS,hinstDLL, NULL );
|
WS_BORDER | WS_TABSTOP,375,17,36,18, hDlg,(HMENU)IDC_ADDRESS,hinstDLL, NULL );
|
||||||
if (hAddress) {
|
if (hAddress)
|
||||||
|
{
|
||||||
SendMessage(hAddress,WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
SendMessage(hAddress,WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
||||||
SendMessage(hAddress,EM_SETLIMITTEXT, (WPARAM)3,(LPARAM)0);
|
SendMessage(hAddress,EM_SETLIMITTEXT, (WPARAM)3,(LPARAM)0);
|
||||||
}
|
}
|
||||||
|
@ -602,35 +673,40 @@ void RSP_Commands_Setup ( HWND hDlg ) {
|
||||||
hFunctionlist = CreateWindowEx(0,"COMBOBOX","", WS_CHILD | WS_VSCROLL |
|
hFunctionlist = CreateWindowEx(0,"COMBOBOX","", WS_CHILD | WS_VSCROLL |
|
||||||
CBS_DROPDOWNLIST | CBS_SORT | WS_TABSTOP,352,56,89,150,hDlg,
|
CBS_DROPDOWNLIST | CBS_SORT | WS_TABSTOP,352,56,89,150,hDlg,
|
||||||
(HMENU)IDC_FUNCTION_COMBO,hinstDLL,NULL);
|
(HMENU)IDC_FUNCTION_COMBO,hinstDLL,NULL);
|
||||||
if (hFunctionlist) {
|
if (hFunctionlist)
|
||||||
|
{
|
||||||
SendMessage(hFunctionlist,WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
SendMessage(hFunctionlist,WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
||||||
}
|
}
|
||||||
|
|
||||||
hGoButton = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON","&Go", WS_CHILD |
|
hGoButton = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON","&Go", WS_CHILD |
|
||||||
BS_DEFPUSHBUTTON | WS_VISIBLE | WS_TABSTOP, 347,56,100,24, hDlg,(HMENU)IDC_GO_BUTTON,
|
BS_DEFPUSHBUTTON | WS_VISIBLE | WS_TABSTOP, 347,56,100,24, hDlg,(HMENU)IDC_GO_BUTTON,
|
||||||
hinstDLL,NULL );
|
hinstDLL,NULL );
|
||||||
if (hGoButton) {
|
if (hGoButton)
|
||||||
|
{
|
||||||
SendMessage(hGoButton,WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
SendMessage(hGoButton,WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
||||||
}
|
}
|
||||||
|
|
||||||
hBreakButton = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON","&Break", WS_DISABLED |
|
hBreakButton = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON","&Break", WS_DISABLED |
|
||||||
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,85,100,24,hDlg,
|
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,85,100,24,hDlg,
|
||||||
(HMENU)IDC_BREAK_BUTTON,hinstDLL,NULL );
|
(HMENU)IDC_BREAK_BUTTON,hinstDLL,NULL );
|
||||||
if (hBreakButton) {
|
if (hBreakButton)
|
||||||
|
{
|
||||||
SendMessage(hBreakButton,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
SendMessage(hBreakButton,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
||||||
}
|
}
|
||||||
|
|
||||||
hStepButton = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON","&Step", WS_CHILD |
|
hStepButton = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON","&Step", WS_CHILD |
|
||||||
BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,114,100,24,hDlg,
|
BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,114,100,24,hDlg,
|
||||||
(HMENU)IDC_STEP_BUTTON,hinstDLL,NULL );
|
(HMENU)IDC_STEP_BUTTON,hinstDLL,NULL );
|
||||||
if (hStepButton) {
|
if (hStepButton)
|
||||||
|
{
|
||||||
SendMessage(hStepButton,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
SendMessage(hStepButton,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
||||||
}
|
}
|
||||||
|
|
||||||
hSkipButton = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON","&Skip", WS_CHILD |
|
hSkipButton = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON","&Skip", WS_CHILD |
|
||||||
BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,143,100,24,hDlg,
|
BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,143,100,24,hDlg,
|
||||||
(HMENU)IDC_SKIP_BUTTON,hinstDLL,NULL );
|
(HMENU)IDC_SKIP_BUTTON,hinstDLL,NULL );
|
||||||
if (hSkipButton) {
|
if (hSkipButton)
|
||||||
|
{
|
||||||
SendMessage(hSkipButton,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
SendMessage(hSkipButton,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -640,11 +716,13 @@ void RSP_Commands_Setup ( HWND hDlg ) {
|
||||||
if (DebugInfo.Enter_R4300i_Register_Window == NULL) { WndPos += 29;}
|
if (DebugInfo.Enter_R4300i_Register_Window == NULL) { WndPos += 29;}
|
||||||
if (DebugInfo.Enter_Memory_Window == NULL) { WndPos += 29;}
|
if (DebugInfo.Enter_Memory_Window == NULL) { WndPos += 29;}
|
||||||
|
|
||||||
if (DebugInfo.Enter_BPoint_Window != NULL) {
|
if (DebugInfo.Enter_BPoint_Window != NULL)
|
||||||
|
{
|
||||||
hBPButton = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON","&Break Points", WS_CHILD |
|
hBPButton = CreateWindowEx(WS_EX_STATICEDGE, "BUTTON","&Break Points", WS_CHILD |
|
||||||
BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,WndPos,100,24,hDlg,
|
BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,WndPos,100,24,hDlg,
|
||||||
(HMENU)IDC_BP_BUTTON,hinstDLL,NULL );
|
(HMENU)IDC_BP_BUTTON,hinstDLL,NULL );
|
||||||
if (hBPButton) {
|
if (hBPButton)
|
||||||
|
{
|
||||||
SendMessage(hBPButton,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
SendMessage(hBPButton,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -653,36 +731,43 @@ void RSP_Commands_Setup ( HWND hDlg ) {
|
||||||
hRSPRegisters = CreateWindowEx(WS_EX_STATICEDGE,"BUTTON", "RSP &Registers...",
|
hRSPRegisters = CreateWindowEx(WS_EX_STATICEDGE,"BUTTON", "RSP &Registers...",
|
||||||
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,WndPos,100,24,hDlg,
|
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,WndPos,100,24,hDlg,
|
||||||
(HMENU)IDC_RSP_REGISTERS_BUTTON,hinstDLL,NULL );
|
(HMENU)IDC_RSP_REGISTERS_BUTTON,hinstDLL,NULL );
|
||||||
if (hRSPRegisters) {
|
if (hRSPRegisters)
|
||||||
|
{
|
||||||
SendMessage(hRSPRegisters,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
SendMessage(hRSPRegisters,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
||||||
}
|
}
|
||||||
|
|
||||||
WndPos += 29;
|
WndPos += 29;
|
||||||
if (DebugInfo.Enter_R4300i_Commands_Window != NULL) {
|
if (DebugInfo.Enter_R4300i_Commands_Window != NULL)
|
||||||
|
{
|
||||||
hR4300iDebugger = CreateWindowEx(WS_EX_STATICEDGE,"BUTTON", "R4300i &Debugger...",
|
hR4300iDebugger = CreateWindowEx(WS_EX_STATICEDGE,"BUTTON", "R4300i &Debugger...",
|
||||||
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,WndPos,100,24,hDlg,
|
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,WndPos,100,24,hDlg,
|
||||||
(HMENU)IDC_R4300I_DEBUGGER_BUTTON,hinstDLL,NULL );
|
(HMENU)IDC_R4300I_DEBUGGER_BUTTON,hinstDLL,NULL );
|
||||||
if (hR4300iDebugger) {
|
if (hR4300iDebugger)
|
||||||
|
{
|
||||||
SendMessage(hR4300iDebugger,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
SendMessage(hR4300iDebugger,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WndPos += 29;
|
WndPos += 29;
|
||||||
if (DebugInfo.Enter_R4300i_Register_Window != NULL) {
|
if (DebugInfo.Enter_R4300i_Register_Window != NULL)
|
||||||
|
{
|
||||||
hR4300iRegisters = CreateWindowEx(WS_EX_STATICEDGE,"BUTTON","R4300i R&egisters...",
|
hR4300iRegisters = CreateWindowEx(WS_EX_STATICEDGE,"BUTTON","R4300i R&egisters...",
|
||||||
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,WndPos,100,24,hDlg,
|
WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,WndPos,100,24,hDlg,
|
||||||
(HMENU)IDC_R4300I_REGISTERS_BUTTON,hinstDLL,NULL );
|
(HMENU)IDC_R4300I_REGISTERS_BUTTON,hinstDLL,NULL );
|
||||||
if (hR4300iRegisters) {
|
if (hR4300iRegisters)
|
||||||
|
{
|
||||||
SendMessage(hR4300iRegisters,WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
SendMessage(hR4300iRegisters,WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WndPos += 29;
|
WndPos += 29;
|
||||||
if (DebugInfo.Enter_Memory_Window != NULL) {
|
if (DebugInfo.Enter_Memory_Window != NULL)
|
||||||
|
{
|
||||||
hMemory = CreateWindowEx(WS_EX_STATICEDGE,"BUTTON", "&Memory...", WS_CHILD |
|
hMemory = CreateWindowEx(WS_EX_STATICEDGE,"BUTTON", "&Memory...", WS_CHILD |
|
||||||
BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,WndPos,100,24,hDlg,
|
BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 347,WndPos,100,24,hDlg,
|
||||||
(HMENU)IDC_MEMORY_BUTTON,hinstDLL,NULL );
|
(HMENU)IDC_MEMORY_BUTTON,hinstDLL,NULL );
|
||||||
if (hMemory) {
|
if (hMemory)
|
||||||
|
{
|
||||||
SendMessage(hMemory,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
SendMessage(hMemory,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -690,9 +775,12 @@ void RSP_Commands_Setup ( HWND hDlg ) {
|
||||||
hScrlBar = CreateWindowEx(WS_EX_STATICEDGE, "SCROLLBAR","", WS_CHILD | WS_VISIBLE |
|
hScrlBar = CreateWindowEx(WS_EX_STATICEDGE, "SCROLLBAR","", WS_CHILD | WS_VISIBLE |
|
||||||
WS_TABSTOP | SBS_VERT, 318,14,18,439, hDlg, (HMENU)IDC_SCRL_BAR, hinstDLL, NULL );
|
WS_TABSTOP | SBS_VERT, 318,14,18,439, hDlg, (HMENU)IDC_SCRL_BAR, hinstDLL, NULL );
|
||||||
|
|
||||||
if ( RSP_Running ) {
|
if ( RSP_Running )
|
||||||
|
{
|
||||||
Enable_RSP_Commands_Window();
|
Enable_RSP_Commands_Window();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Disable_RSP_Commands_Window();
|
Disable_RSP_Commands_Window();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -705,18 +793,23 @@ void RSP_Commands_Setup ( HWND hDlg ) {
|
||||||
SetWindowPos(hDlg,NULL,X,Y,WindowWidth,WindowHeight, SWP_NOZORDER | SWP_SHOWWINDOW);
|
SetWindowPos(hDlg,NULL,X,Y,WindowWidth,WindowHeight, SWP_NOZORDER | SWP_SHOWWINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
char * RSPSpecialName ( DWORD OpCode, DWORD PC ) {
|
char * RSPSpecialName ( DWORD OpCode, DWORD PC )
|
||||||
|
{
|
||||||
OPCODE command;
|
OPCODE command;
|
||||||
command.Hex = OpCode;
|
command.Hex = OpCode;
|
||||||
|
|
||||||
PC = PC; // unused
|
PC = PC; // unused
|
||||||
|
|
||||||
switch (command.funct) {
|
switch (command.funct)
|
||||||
|
{
|
||||||
case RSP_SPECIAL_SLL:
|
case RSP_SPECIAL_SLL:
|
||||||
if (command.rd != 0) {
|
if (command.rd != 0)
|
||||||
|
{
|
||||||
sprintf(CommandName,"SLL\t%s, %s, 0x%X",GPR_Name(command.rd),
|
sprintf(CommandName,"SLL\t%s, %s, 0x%X",GPR_Name(command.rd),
|
||||||
GPR_Name(command.rt), command.sa);
|
GPR_Name(command.rt), command.sa);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
sprintf(CommandName,"NOP");
|
sprintf(CommandName,"NOP");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -796,11 +889,13 @@ char * RSPSpecialName ( DWORD OpCode, DWORD PC ) {
|
||||||
return CommandName;
|
return CommandName;
|
||||||
}
|
}
|
||||||
|
|
||||||
char * RSPRegimmName ( DWORD OpCode, DWORD PC ) {
|
char * RSPRegimmName ( DWORD OpCode, DWORD PC )
|
||||||
|
{
|
||||||
OPCODE command;
|
OPCODE command;
|
||||||
command.Hex = OpCode;
|
command.Hex = OpCode;
|
||||||
|
|
||||||
switch (command.rt) {
|
switch (command.rt)
|
||||||
|
{
|
||||||
case RSP_REGIMM_BLTZ:
|
case RSP_REGIMM_BLTZ:
|
||||||
sprintf(CommandName,"BLTZ\t%s, 0x%03X",GPR_Name(command.rs),
|
sprintf(CommandName,"BLTZ\t%s, 0x%03X",GPR_Name(command.rs),
|
||||||
(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
||||||
|
@ -814,9 +909,12 @@ char * RSPRegimmName ( DWORD OpCode, DWORD PC ) {
|
||||||
(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
||||||
break;
|
break;
|
||||||
case RSP_REGIMM_BGEZAL:
|
case RSP_REGIMM_BGEZAL:
|
||||||
if (command.rs == 0) {
|
if (command.rs == 0)
|
||||||
|
{
|
||||||
sprintf(CommandName,"BAL\t0x%03X",(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
sprintf(CommandName,"BAL\t0x%03X",(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
sprintf(CommandName,"BGEZAL\t%s, 0x%03X",GPR_Name(command.rs),
|
sprintf(CommandName,"BGEZAL\t%s, 0x%03X",GPR_Name(command.rs),
|
||||||
(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
||||||
}
|
}
|
||||||
|
@ -828,13 +926,15 @@ char * RSPRegimmName ( DWORD OpCode, DWORD PC ) {
|
||||||
return CommandName;
|
return CommandName;
|
||||||
}
|
}
|
||||||
|
|
||||||
char * RSPCop0Name ( DWORD OpCode, DWORD PC ) {
|
char * RSPCop0Name ( DWORD OpCode, DWORD PC )
|
||||||
|
{
|
||||||
OPCODE command;
|
OPCODE command;
|
||||||
command.Hex = OpCode;
|
command.Hex = OpCode;
|
||||||
|
|
||||||
PC = PC; // unused
|
PC = PC; // unused
|
||||||
|
|
||||||
switch (command.rs) {
|
switch (command.rs)
|
||||||
|
{
|
||||||
case RSP_COP0_MF:
|
case RSP_COP0_MF:
|
||||||
sprintf(CommandName,"MFC0\t%s, %s",GPR_Name(command.rt),COP0_Name(command.rd));
|
sprintf(CommandName,"MFC0\t%s, %s",GPR_Name(command.rt),COP0_Name(command.rd));
|
||||||
break;
|
break;
|
||||||
|
@ -848,14 +948,17 @@ char * RSPCop0Name ( DWORD OpCode, DWORD PC ) {
|
||||||
return CommandName;
|
return CommandName;
|
||||||
}
|
}
|
||||||
|
|
||||||
char * RSPCop2Name ( DWORD OpCode, DWORD PC ) {
|
char * RSPCop2Name ( DWORD OpCode, DWORD PC )
|
||||||
|
{
|
||||||
OPCODE command;
|
OPCODE command;
|
||||||
command.Hex = OpCode;
|
command.Hex = OpCode;
|
||||||
|
|
||||||
PC = PC; // unused
|
PC = PC; // unused
|
||||||
|
|
||||||
if ( ( command.rs & 0x10 ) == 0 ) {
|
if ( ( command.rs & 0x10 ) == 0 )
|
||||||
switch (command.rs) {
|
{
|
||||||
|
switch (command.rs)
|
||||||
|
{
|
||||||
case RSP_COP2_MF:
|
case RSP_COP2_MF:
|
||||||
sprintf(CommandName,"MFC2\t%s, $v%d [%d]",GPR_Name(command.rt),
|
sprintf(CommandName,"MFC2\t%s, $v%d [%d]",GPR_Name(command.rt),
|
||||||
command.rd, command.sa >> 1);
|
command.rd, command.sa >> 1);
|
||||||
|
@ -876,8 +979,11 @@ char * RSPCop2Name ( DWORD OpCode, DWORD PC ) {
|
||||||
sprintf(CommandName,"RSP: Unknown\t%02X %02X %02X %02X",
|
sprintf(CommandName,"RSP: Unknown\t%02X %02X %02X %02X",
|
||||||
command.Ascii[3],command.Ascii[2],command.Ascii[1],command.Ascii[0]);
|
command.Ascii[3],command.Ascii[2],command.Ascii[1],command.Ascii[0]);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
switch (command.funct) {
|
else
|
||||||
|
{
|
||||||
|
switch (command.funct)
|
||||||
|
{
|
||||||
case RSP_VECTOR_VMULF:
|
case RSP_VECTOR_VMULF:
|
||||||
sprintf(CommandName,"VMULF\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
sprintf(CommandName,"VMULF\t$v%d, $v%d, $v%d%s",command.sa, command.rd,
|
||||||
command.rt, ElementSpecifier(command.rs & 0xF));
|
command.rt, ElementSpecifier(command.rs & 0xF));
|
||||||
|
@ -1061,13 +1167,15 @@ char * RSPCop2Name ( DWORD OpCode, DWORD PC ) {
|
||||||
return CommandName;
|
return CommandName;
|
||||||
}
|
}
|
||||||
|
|
||||||
char * RSPLc2Name ( DWORD OpCode, DWORD PC ) {
|
char * RSPLc2Name ( DWORD OpCode, DWORD PC )
|
||||||
|
{
|
||||||
OPCODE command;
|
OPCODE command;
|
||||||
command.Hex = OpCode;
|
command.Hex = OpCode;
|
||||||
|
|
||||||
PC = PC; // unused
|
PC = PC; // unused
|
||||||
|
|
||||||
switch (command.rd) {
|
switch (command.rd)
|
||||||
|
{
|
||||||
case RSP_LSC2_BV:
|
case RSP_LSC2_BV:
|
||||||
sprintf(CommandName,"LBV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
sprintf(CommandName,"LBV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
||||||
command.voffset, GPR_Name(command.base));
|
command.voffset, GPR_Name(command.base));
|
||||||
|
@ -1123,13 +1231,15 @@ char * RSPLc2Name ( DWORD OpCode, DWORD PC ) {
|
||||||
return CommandName;
|
return CommandName;
|
||||||
}
|
}
|
||||||
|
|
||||||
char * RSPSc2Name ( DWORD OpCode, DWORD PC ) {
|
char * RSPSc2Name ( DWORD OpCode, DWORD PC )
|
||||||
|
{
|
||||||
OPCODE command;
|
OPCODE command;
|
||||||
command.Hex = OpCode;
|
command.Hex = OpCode;
|
||||||
|
|
||||||
PC = PC; // unused
|
PC = PC; // unused
|
||||||
|
|
||||||
switch (command.rd) {
|
switch (command.rd)
|
||||||
|
{
|
||||||
case RSP_LSC2_BV:
|
case RSP_LSC2_BV:
|
||||||
sprintf(CommandName,"SBV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
sprintf(CommandName,"SBV\t$v%d [%d], 0x%04X (%s)",command.rt, command.del,
|
||||||
command.voffset, GPR_Name(command.base));
|
command.voffset, GPR_Name(command.base));
|
||||||
|
@ -1185,11 +1295,13 @@ char * RSPSc2Name ( DWORD OpCode, DWORD PC ) {
|
||||||
return CommandName;
|
return CommandName;
|
||||||
}
|
}
|
||||||
|
|
||||||
char * RSPOpcodeName ( DWORD OpCode, DWORD PC ) {
|
char * RSPOpcodeName ( DWORD OpCode, DWORD PC )
|
||||||
|
{
|
||||||
OPCODE command;
|
OPCODE command;
|
||||||
command.Hex = OpCode;
|
command.Hex = OpCode;
|
||||||
|
|
||||||
switch (command.op) {
|
switch (command.op)
|
||||||
|
{
|
||||||
case RSP_SPECIAL:
|
case RSP_SPECIAL:
|
||||||
return RSPSpecialName(OpCode,PC);
|
return RSPSpecialName(OpCode,PC);
|
||||||
break;
|
break;
|
||||||
|
@ -1203,12 +1315,17 @@ char * RSPOpcodeName ( DWORD OpCode, DWORD PC ) {
|
||||||
sprintf(CommandName,"JAL\t0x%03X",(command.target << 2) & 0xFFC);
|
sprintf(CommandName,"JAL\t0x%03X",(command.target << 2) & 0xFFC);
|
||||||
break;
|
break;
|
||||||
case RSP_BEQ:
|
case RSP_BEQ:
|
||||||
if (command.rs == 0 && command.rt == 0) {
|
if (command.rs == 0 && command.rt == 0)
|
||||||
|
{
|
||||||
sprintf(CommandName,"B\t0x%03X",(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
sprintf(CommandName,"B\t0x%03X",(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
||||||
} else if (command.rs == 0 || command.rt == 0){
|
}
|
||||||
|
else if (command.rs == 0 || command.rt == 0)
|
||||||
|
{
|
||||||
sprintf(CommandName,"BEQZ\t%s, 0x%03X",GPR_Name(command.rs == 0 ? command.rt : command.rs),
|
sprintf(CommandName,"BEQZ\t%s, 0x%03X",GPR_Name(command.rs == 0 ? command.rt : command.rs),
|
||||||
(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
sprintf(CommandName,"BEQ\t%s, %s, 0x%03X",GPR_Name(command.rs),GPR_Name(command.rt),
|
sprintf(CommandName,"BEQ\t%s, %s, 0x%03X",GPR_Name(command.rs),GPR_Name(command.rt),
|
||||||
(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
(PC + ((short)command.offset << 2) + 4) & 0xFFC);
|
||||||
}
|
}
|
||||||
|
@ -1305,7 +1422,8 @@ char * RSPOpcodeName ( DWORD OpCode, DWORD PC ) {
|
||||||
return CommandName;
|
return CommandName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetRSPCommandToRunning ( void ) {
|
void SetRSPCommandToRunning ( void )
|
||||||
|
{
|
||||||
Stepping_Commands = FALSE;
|
Stepping_Commands = FALSE;
|
||||||
if (InRSPCommandsWindow == FALSE) { return; }
|
if (InRSPCommandsWindow == FALSE) { return; }
|
||||||
EnableWindow(hGoButton, FALSE);
|
EnableWindow(hGoButton, FALSE);
|
||||||
|
@ -1318,7 +1436,8 @@ void SetRSPCommandToRunning ( void ) {
|
||||||
SetFocus(hBreakButton);
|
SetFocus(hBreakButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetRSPCommandToStepping ( void ) {
|
void SetRSPCommandToStepping ( void )
|
||||||
|
{
|
||||||
if (InRSPCommandsWindow == FALSE) { return; }
|
if (InRSPCommandsWindow == FALSE) { return; }
|
||||||
EnableWindow(hGoButton, TRUE);
|
EnableWindow(hGoButton, TRUE);
|
||||||
EnableWindow(hBreakButton, FALSE);
|
EnableWindow(hBreakButton, FALSE);
|
||||||
|
@ -1331,7 +1450,8 @@ void SetRSPCommandToStepping ( void ) {
|
||||||
Stepping_Commands = TRUE;
|
Stepping_Commands = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetRSPCommandViewto ( UINT NewLocation ) {
|
void SetRSPCommandViewto ( UINT NewLocation )
|
||||||
|
{
|
||||||
unsigned int location;
|
unsigned int location;
|
||||||
char Value[20];
|
char Value[20];
|
||||||
|
|
||||||
|
@ -1340,10 +1460,13 @@ void SetRSPCommandViewto ( UINT NewLocation ) {
|
||||||
GetWindowText(hAddress,Value,sizeof(Value));
|
GetWindowText(hAddress,Value,sizeof(Value));
|
||||||
location = AsciiToHex(Value) & ~3;
|
location = AsciiToHex(Value) & ~3;
|
||||||
|
|
||||||
if ( NewLocation < location || NewLocation >= location + 120 ) {
|
if ( NewLocation < location || NewLocation >= location + 120 )
|
||||||
|
{
|
||||||
sprintf(Value,"%03X",NewLocation);
|
sprintf(Value,"%03X",NewLocation);
|
||||||
SetWindowText(hAddress,Value);
|
SetWindowText(hAddress,Value);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
RefreshRSPCommands();
|
RefreshRSPCommands();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,5 +147,3 @@ void UpdateRSPRegistersScreen ( void );
|
||||||
extern UWORD32 RSP_GPR[32], RSP_Flags[4];
|
extern UWORD32 RSP_GPR[32], RSP_Flags[4];
|
||||||
extern UDWORD RSP_ACCUM[8];
|
extern UDWORD RSP_ACCUM[8];
|
||||||
extern VECTOR RSP_Vect[32];
|
extern VECTOR RSP_Vect[32];
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
* should be forwarded to them so if they want them.
|
* should be forwarded to them so if they want them.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define STRINGIZE2(s) #s
|
#define STRINGIZE2(s) #s
|
||||||
#define STRINGIZE(s) STRINGIZE2(s)
|
#define STRINGIZE(s) STRINGIZE2(s)
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,8 @@
|
||||||
#define IDC_LOCATION_EDIT 105
|
#define IDC_LOCATION_EDIT 105
|
||||||
HWND BPoint_Win_hDlg, hRSPLocation = NULL;
|
HWND BPoint_Win_hDlg, hRSPLocation = NULL;
|
||||||
|
|
||||||
void Add_BPoint ( void ) {
|
void Add_BPoint ( void )
|
||||||
|
{
|
||||||
char Title[10];
|
char Title[10];
|
||||||
|
|
||||||
GetWindowText(hRSPLocation,Title,sizeof(Title));
|
GetWindowText(hRSPLocation,Title,sizeof(Title));
|
||||||
|
@ -43,29 +44,35 @@ void Add_BPoint ( void ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int AddRSP_BPoint( DWORD Location, int Confirm ) {
|
int AddRSP_BPoint( DWORD Location, int Confirm )
|
||||||
|
{
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
if (NoOfBpoints == MaxBPoints) {
|
if (NoOfBpoints == MaxBPoints)
|
||||||
|
{
|
||||||
DisplayError("Max amount of Break Points set");
|
DisplayError("Max amount of Break Points set");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (count = 0; count < NoOfBpoints; count ++) {
|
for (count = 0; count < NoOfBpoints; count ++)
|
||||||
if (BPoint[count].Location == Location) {
|
{
|
||||||
|
if (BPoint[count].Location == Location)
|
||||||
|
{
|
||||||
DisplayError("You already have this Break Point");
|
DisplayError("You already have this Break Point");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Confirm) {
|
if (Confirm)
|
||||||
|
{
|
||||||
char Message[150];
|
char Message[150];
|
||||||
int Response;
|
int Response;
|
||||||
|
|
||||||
sprintf(Message,"Break when:\n\nRSP's Program Counter = 0x%03X\n\nIs this correct?",
|
sprintf(Message,"Break when:\n\nRSP's Program Counter = 0x%03X\n\nIs this correct?",
|
||||||
Location);
|
Location);
|
||||||
Response = MessageBox(BPoint_Win_hDlg, Message, "Breakpoint", MB_YESNO | MB_ICONINFORMATION);
|
Response = MessageBox(BPoint_Win_hDlg, Message, "Breakpoint", MB_YESNO | MB_ICONINFORMATION);
|
||||||
if (Response == IDNO) {
|
if (Response == IDNO)
|
||||||
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,18 +85,22 @@ int AddRSP_BPoint( DWORD Location, int Confirm ) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CheckForRSPBPoint ( DWORD Location ) {
|
int CheckForRSPBPoint ( DWORD Location )
|
||||||
|
{
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
for (count = 0; count < NoOfBpoints; count ++){
|
for (count = 0; count < NoOfBpoints; count ++)
|
||||||
if (BPoint[count].Location == Location) {
|
{
|
||||||
|
if (BPoint[count].Location == Location)
|
||||||
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateBPPanel ( HWND hDlg, RECT rcBox ) {
|
void CreateBPPanel ( HWND hDlg, RECT rcBox )
|
||||||
|
{
|
||||||
if (hRSPLocation != NULL) { return; }
|
if (hRSPLocation != NULL) { return; }
|
||||||
|
|
||||||
rcBox = rcBox; // remove warning of unused
|
rcBox = rcBox; // remove warning of unused
|
||||||
|
@ -98,7 +109,8 @@ void CreateBPPanel ( HWND hDlg, RECT rcBox ) {
|
||||||
|
|
||||||
hRSPLocation = CreateWindowEx(0,"EDIT","", WS_CHILD | WS_BORDER | ES_UPPERCASE | WS_TABSTOP,
|
hRSPLocation = CreateWindowEx(0,"EDIT","", WS_CHILD | WS_BORDER | ES_UPPERCASE | WS_TABSTOP,
|
||||||
83,90,100,17,hDlg,(HMENU)IDC_LOCATION_EDIT,RSPInfo.hInst,NULL);
|
83,90,100,17,hDlg,(HMENU)IDC_LOCATION_EDIT,RSPInfo.hInst,NULL);
|
||||||
if (hRSPLocation) {
|
if (hRSPLocation)
|
||||||
|
{
|
||||||
char Title[20];
|
char Title[20];
|
||||||
SendMessage(hRSPLocation,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
SendMessage(hRSPLocation,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0);
|
||||||
SendMessage(hRSPLocation,EM_SETLIMITTEXT,(WPARAM)3,(LPARAM)0);
|
SendMessage(hRSPLocation,EM_SETLIMITTEXT,(WPARAM)3,(LPARAM)0);
|
||||||
|
@ -107,20 +119,24 @@ void CreateBPPanel ( HWND hDlg, RECT rcBox ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HideBPPanel ( void ) {
|
void HideBPPanel ( void )
|
||||||
|
{
|
||||||
ShowWindow(hRSPLocation,FALSE);
|
ShowWindow(hRSPLocation,FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaintBPPanel ( PAINTSTRUCT ps ) {
|
void PaintBPPanel ( PAINTSTRUCT ps )
|
||||||
|
{
|
||||||
TextOut( ps.hdc, 29,60,"Break when the Program Counter equals",37);
|
TextOut( ps.hdc, 29,60,"Break when the Program Counter equals",37);
|
||||||
TextOut( ps.hdc, 59,85,"0x",2);
|
TextOut( ps.hdc, 59,85,"0x",2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowBPPanel ( void ) {
|
void ShowBPPanel ( void )
|
||||||
|
{
|
||||||
ShowWindow(hRSPLocation,TRUE);
|
ShowWindow(hRSPLocation,TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RefreshBpoints ( HWND hList ) {
|
void RefreshBpoints ( HWND hList )
|
||||||
|
{
|
||||||
char Message[100];
|
char Message[100];
|
||||||
int count, location;
|
int count, location;
|
||||||
|
|
||||||
|
@ -131,29 +147,36 @@ void RefreshBpoints ( HWND hList ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveAllBpoint ( void ) {
|
void RemoveAllBpoint ( void )
|
||||||
|
{
|
||||||
NoOfBpoints = 0;
|
NoOfBpoints = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveBpoint ( HWND hList, int index ) {
|
void RemoveBpoint ( HWND hList, int index )
|
||||||
|
{
|
||||||
DWORD location;
|
DWORD location;
|
||||||
|
|
||||||
location = SendMessage(hList,LB_GETITEMDATA,(WPARAM)index,0);
|
location = SendMessage(hList,LB_GETITEMDATA,(WPARAM)index,0);
|
||||||
RemoveRSPBreakPoint(location);
|
RemoveRSPBreakPoint(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveRSPBreakPoint (DWORD Location) {
|
void RemoveRSPBreakPoint (DWORD Location)
|
||||||
|
{
|
||||||
int count, location = -1;
|
int count, location = -1;
|
||||||
|
|
||||||
for (count = 0; count < NoOfBpoints; count ++){
|
for (count = 0; count < NoOfBpoints; count ++)
|
||||||
if (BPoint[count].Location == Location) {
|
{
|
||||||
|
if (BPoint[count].Location == Location)
|
||||||
|
{
|
||||||
location = count;
|
location = count;
|
||||||
count = NoOfBpoints;
|
count = NoOfBpoints;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (location >= 0) {
|
if (location >= 0)
|
||||||
for (count = location; count < NoOfBpoints - 1; count ++ ){
|
{
|
||||||
|
for (count = location; count < NoOfBpoints - 1; count ++ )
|
||||||
|
{
|
||||||
BPoint[count].Location = BPoint[count + 1].Location;
|
BPoint[count].Location = BPoint[count + 1].Location;
|
||||||
}
|
}
|
||||||
NoOfBpoints -= 1;
|
NoOfBpoints -= 1;
|
||||||
|
|
|
@ -32,18 +32,21 @@
|
||||||
|
|
||||||
// #define RSP_SAFE_DMA /* unoptimized dma transfers */
|
// #define RSP_SAFE_DMA /* unoptimized dma transfers */
|
||||||
|
|
||||||
void SP_DMA_READ (void) {
|
void SP_DMA_READ (void)
|
||||||
|
{
|
||||||
DWORD i, j, Length, Skip, Count, End, addr;
|
DWORD i, j, Length, Skip, Count, End, addr;
|
||||||
BYTE *Dest, *Source;
|
BYTE *Dest, *Source;
|
||||||
|
|
||||||
addr = (*RSPInfo.SP_DRAM_ADDR_REG) & 0x00FFFFFF;
|
addr = (*RSPInfo.SP_DRAM_ADDR_REG) & 0x00FFFFFF;
|
||||||
|
|
||||||
if (addr > 0x800000) {
|
if (addr > 0x800000)
|
||||||
|
{
|
||||||
MessageBox(NULL,"SP DMA READ\nSP_DRAM_ADDR_REG not in RDRam space","Error",MB_OK);
|
MessageBox(NULL,"SP DMA READ\nSP_DRAM_ADDR_REG not in RDRam space","Error",MB_OK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*RSPInfo.SP_RD_LEN_REG & 0xFFF) + 1 + (*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) > 0x1000) {
|
if ((*RSPInfo.SP_RD_LEN_REG & 0xFFF) + 1 + (*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) > 0x1000)
|
||||||
|
{
|
||||||
MessageBox(NULL,"SP DMA READ\ncould not fit copy in memory segement","Error",MB_OK);
|
MessageBox(NULL,"SP DMA READ\ncould not fit copy in memory segement","Error",MB_OK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -53,29 +56,40 @@ void SP_DMA_READ (void) {
|
||||||
Count = ((*RSPInfo.SP_RD_LEN_REG >> 12) & 0xFF) + 1;
|
Count = ((*RSPInfo.SP_RD_LEN_REG >> 12) & 0xFF) + 1;
|
||||||
End = ((*RSPInfo.SP_MEM_ADDR_REG & 0x0FFF) & ~7) + (((Count - 1) * Skip) + Length);
|
End = ((*RSPInfo.SP_MEM_ADDR_REG & 0x0FFF) & ~7) + (((Count - 1) * Skip) + Length);
|
||||||
|
|
||||||
if ((*RSPInfo.SP_MEM_ADDR_REG & 0x1000) != 0) {
|
if ((*RSPInfo.SP_MEM_ADDR_REG & 0x1000) != 0)
|
||||||
|
{
|
||||||
Dest = RSPInfo.IMEM + ((*RSPInfo.SP_MEM_ADDR_REG & 0x0FFF) & ~7);
|
Dest = RSPInfo.IMEM + ((*RSPInfo.SP_MEM_ADDR_REG & 0x0FFF) & ~7);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Dest = RSPInfo.DMEM + ((*RSPInfo.SP_MEM_ADDR_REG & 0x0FFF) & ~7);
|
Dest = RSPInfo.DMEM + ((*RSPInfo.SP_MEM_ADDR_REG & 0x0FFF) & ~7);
|
||||||
}
|
}
|
||||||
Source = RSPInfo.RDRAM + (addr & ~7);
|
Source = RSPInfo.RDRAM + (addr & ~7);
|
||||||
|
|
||||||
#if defined(RSP_SAFE_DMA)
|
#if defined(RSP_SAFE_DMA)
|
||||||
for (j = 0 ; j < Count; j++) {
|
for (j = 0 ; j < Count; j++)
|
||||||
for (i = 0 ; i < Length; i++) {
|
{
|
||||||
|
for (i = 0 ; i < Length; i++)
|
||||||
|
{
|
||||||
*(BYTE *)(((DWORD)Dest + j * Length + i) ^ 3) = *(BYTE *)(((DWORD)Source + j * Skip + i) ^ 3);
|
*(BYTE *)(((DWORD)Dest + j * Length + i) ^ 3) = *(BYTE *)(((DWORD)Source + j * Skip + i) ^ 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if ((Skip & 0x3) == 0) {
|
if ((Skip & 0x3) == 0)
|
||||||
for (j = 0; j < Count; j++) {
|
{
|
||||||
|
for (j = 0; j < Count; j++)
|
||||||
|
{
|
||||||
memcpy(Dest, Source, Length);
|
memcpy(Dest, Source, Length);
|
||||||
Source += Skip;
|
Source += Skip;
|
||||||
Dest += Length;
|
Dest += Length;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
for (j = 0 ; j < Count; j++) {
|
else
|
||||||
for (i = 0 ; i < Length; i++) {
|
{
|
||||||
|
for (j = 0 ; j < Count; j++)
|
||||||
|
{
|
||||||
|
for (i = 0 ; i < Length; i++)
|
||||||
|
{
|
||||||
*(BYTE *)(((DWORD)Dest + i) ^ 3) = *(BYTE *)(((DWORD)Source + i) ^ 3);
|
*(BYTE *)(((DWORD)Dest + i) ^ 3) = *(BYTE *)(((DWORD)Source + i) ^ 3);
|
||||||
}
|
}
|
||||||
Source += Skip;
|
Source += Skip;
|
||||||
|
@ -85,7 +99,8 @@ void SP_DMA_READ (void) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* FIXME: could this be a problem DMEM to IMEM (?) */
|
/* FIXME: could this be a problem DMEM to IMEM (?) */
|
||||||
if (CPUCore == RecompilerCPU && (*RSPInfo.SP_MEM_ADDR_REG & 0x1000) != 0) {
|
if (CPUCore == RecompilerCPU && (*RSPInfo.SP_MEM_ADDR_REG & 0x1000) != 0)
|
||||||
|
{
|
||||||
SetJumpTable(End);
|
SetJumpTable(End);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,18 +108,21 @@ void SP_DMA_READ (void) {
|
||||||
*RSPInfo.SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
*RSPInfo.SP_STATUS_REG &= ~SP_STATUS_DMA_BUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SP_DMA_WRITE (void) {
|
void SP_DMA_WRITE (void)
|
||||||
|
{
|
||||||
DWORD i, j, Length, Skip, Count, addr;
|
DWORD i, j, Length, Skip, Count, addr;
|
||||||
BYTE *Dest, *Source;
|
BYTE *Dest, *Source;
|
||||||
|
|
||||||
addr = (*RSPInfo.SP_DRAM_ADDR_REG) & 0x00FFFFFF;
|
addr = (*RSPInfo.SP_DRAM_ADDR_REG) & 0x00FFFFFF;
|
||||||
|
|
||||||
if (addr > 0x800000) {
|
if (addr > 0x800000)
|
||||||
|
{
|
||||||
MessageBox(NULL,"SP DMA WRITE\nSP_DRAM_ADDR_REG not in RDRam space","Error",MB_OK);
|
MessageBox(NULL,"SP DMA WRITE\nSP_DRAM_ADDR_REG not in RDRam space","Error",MB_OK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*RSPInfo.SP_WR_LEN_REG & 0xFFF) + 1 + (*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) > 0x1000) {
|
if ((*RSPInfo.SP_WR_LEN_REG & 0xFFF) + 1 + (*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) > 0x1000)
|
||||||
|
{
|
||||||
MessageBox(NULL,"SP DMA WRITE\ncould not fit copy in memory segement","Error",MB_OK);
|
MessageBox(NULL,"SP DMA WRITE\ncould not fit copy in memory segement","Error",MB_OK);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -116,21 +134,29 @@ void SP_DMA_WRITE (void) {
|
||||||
Source = RSPInfo.DMEM + ((*RSPInfo.SP_MEM_ADDR_REG & 0x1FFF) & ~7);
|
Source = RSPInfo.DMEM + ((*RSPInfo.SP_MEM_ADDR_REG & 0x1FFF) & ~7);
|
||||||
|
|
||||||
#if defined(RSP_SAFE_DMA)
|
#if defined(RSP_SAFE_DMA)
|
||||||
for (j = 0 ; j < Count; j++) {
|
for (j = 0 ; j < Count; j++)
|
||||||
for (i = 0 ; i < Length; i++) {
|
{
|
||||||
|
for (i = 0 ; i < Length; i++)
|
||||||
|
{
|
||||||
*(BYTE *)(((DWORD)Dest + j * Skip + i) ^ 3) = *(BYTE *)(((DWORD)Source + j * Length + i) ^ 3);
|
*(BYTE *)(((DWORD)Dest + j * Skip + i) ^ 3) = *(BYTE *)(((DWORD)Source + j * Length + i) ^ 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if ((Skip & 0x3) == 0) {
|
if ((Skip & 0x3) == 0)
|
||||||
for (j = 0; j < Count; j++) {
|
{
|
||||||
|
for (j = 0; j < Count; j++)
|
||||||
|
{
|
||||||
memcpy(Dest, Source, Length);
|
memcpy(Dest, Source, Length);
|
||||||
Source += Length;
|
Source += Length;
|
||||||
Dest += Skip;
|
Dest += Skip;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
for (j = 0 ; j < Count; j++) {
|
else
|
||||||
for (i = 0 ; i < Length; i++) {
|
{
|
||||||
|
for (j = 0 ; j < Count; j++)
|
||||||
|
{
|
||||||
|
for (i = 0 ; i < Length; i++)
|
||||||
|
{
|
||||||
*(BYTE *)(((DWORD)Dest + i) ^ 3) = *(BYTE *)(((DWORD)Source + i) ^ 3);
|
*(BYTE *)(((DWORD)Dest + i) ^ 3) = *(BYTE *)(((DWORD)Source + i) ^ 3);
|
||||||
}
|
}
|
||||||
Source += Length;
|
Source += Length;
|
||||||
|
|
|
@ -26,4 +26,3 @@
|
||||||
|
|
||||||
void SP_DMA_READ ( void );
|
void SP_DMA_READ ( void );
|
||||||
void SP_DMA_WRITE ( void );
|
void SP_DMA_WRITE ( void );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue