Rsp: Move Recompiler in to rsp-core

This commit is contained in:
zilmar 2023-08-17 08:59:22 +09:30
parent 1f0151e067
commit 6b30c1ae6a
32 changed files with 811 additions and 1062 deletions

View File

@ -41,23 +41,44 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="cpu\RSPCpu.cpp" />
<ClCompile Include="cpu\RspDma.cpp" />
<ClCompile Include="cpu\RSPiInstruction.cpp" />
<ClCompile Include="cpu\RSPInterpreterCPU.cpp" />
<ClCompile Include="cpu\RSPInterpreterOps.cpp" />
<ClCompile Include="cpu\RspLog.cpp" />
<ClCompile Include="cpu\RspMemory.cpp" />
<ClCompile Include="cpu\RSPRegister.cpp" />
<ClCompile Include="cpu\RspTypes.cpp" />
<ClCompile Include="Recompiler\Mmx.cpp" />
<ClCompile Include="Recompiler\RspProfiling.cpp" />
<ClCompile Include="Recompiler\RspRecompilerAnalysis.cpp" />
<ClCompile Include="Recompiler\RspRecompilerCPU.cpp" />
<ClCompile Include="Recompiler\RspRecompilerOps.cpp" />
<ClCompile Include="Recompiler\RspRecompilerSections.cpp" />
<ClCompile Include="Recompiler\Sse.cpp" />
<ClCompile Include="Recompiler\X86.cpp" />
<ClCompile Include="RSPDebugger.cpp" />
<ClCompile Include="RSPInfo.cpp" />
<ClCompile Include="Settings\RspSettings.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="cpu\RSPCpu.h" />
<ClInclude Include="cpu\RspDma.h" />
<ClInclude Include="cpu\RSPInstruction.h" />
<ClInclude Include="cpu\RSPInterpreterCPU.h" />
<ClInclude Include="cpu\RSPInterpreterOps.h" />
<ClInclude Include="cpu\RspLog.h" />
<ClInclude Include="cpu\RspMemory.h" />
<ClInclude Include="cpu\RSPOpcode.h" />
<ClInclude Include="cpu\RSPRegisters.h" />
<ClInclude Include="cpu\RspTypes.h" />
<ClInclude Include="Recompiler\RspProfiling.h" />
<ClInclude Include="Recompiler\RspRecompilerCPU.h" />
<ClInclude Include="Recompiler\RspRecompilerOps.h" />
<ClInclude Include="Recompiler\X86.h" />
<ClInclude Include="RSPDebugger.h" />
<ClInclude Include="RSPInfo.h" />
<ClInclude Include="Settings\RspSettings.h" />
<ClInclude Include="Settings\RspSettingsID.h" />
</ItemGroup>
</Project>

View File

@ -19,6 +19,18 @@
<Filter Include="Header Files\cpu">
<UniqueIdentifier>{68f5d9a3-7e1b-4209-95c4-7daf0d469394}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\Settings">
<UniqueIdentifier>{77da0581-67c2-4483-9b3d-7a92f0e99d39}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Settings">
<UniqueIdentifier>{0868624c-a8c2-4e74-b90b-d0b3bc5e0938}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\Recompiler">
<UniqueIdentifier>{2bca7ea6-354a-456b-976d-dc015b9a110f}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Recompiler">
<UniqueIdentifier>{bb961984-d173-4bd2-8a8b-f9a0416188f4}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="cpu\RSPiInstruction.cpp">
@ -45,6 +57,42 @@
<ClCompile Include="RSPDebugger.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Settings\RspSettings.cpp">
<Filter>Source Files\Settings</Filter>
</ClCompile>
<ClCompile Include="Recompiler\RspRecompilerAnalysis.cpp">
<Filter>Source Files\Recompiler</Filter>
</ClCompile>
<ClCompile Include="Recompiler\RspRecompilerCPU.cpp">
<Filter>Source Files\Recompiler</Filter>
</ClCompile>
<ClCompile Include="Recompiler\RspRecompilerOps.cpp">
<Filter>Source Files\Recompiler</Filter>
</ClCompile>
<ClCompile Include="Recompiler\RspRecompilerSections.cpp">
<Filter>Source Files\Recompiler</Filter>
</ClCompile>
<ClCompile Include="cpu\RspMemory.cpp">
<Filter>Source Files\cpu</Filter>
</ClCompile>
<ClCompile Include="cpu\RspLog.cpp">
<Filter>Source Files\cpu</Filter>
</ClCompile>
<ClCompile Include="Recompiler\Mmx.cpp">
<Filter>Source Files\Recompiler</Filter>
</ClCompile>
<ClCompile Include="Recompiler\Sse.cpp">
<Filter>Source Files\Recompiler</Filter>
</ClCompile>
<ClCompile Include="Recompiler\X86.cpp">
<Filter>Source Files\Recompiler</Filter>
</ClCompile>
<ClCompile Include="Recompiler\RspProfiling.cpp">
<Filter>Source Files\Recompiler</Filter>
</ClCompile>
<ClCompile Include="cpu\RspDma.cpp">
<Filter>Source Files\cpu</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="cpu\RSPInstruction.h">
@ -74,5 +122,32 @@
<ClInclude Include="RSPInfo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Settings\RspSettingsID.h">
<Filter>Header Files\Settings</Filter>
</ClInclude>
<ClInclude Include="Settings\RspSettings.h">
<Filter>Header Files\Settings</Filter>
</ClInclude>
<ClInclude Include="Recompiler\RspRecompilerCPU.h">
<Filter>Header Files\Recompiler</Filter>
</ClInclude>
<ClInclude Include="Recompiler\RspRecompilerOps.h">
<Filter>Header Files\Recompiler</Filter>
</ClInclude>
<ClInclude Include="cpu\RspMemory.h">
<Filter>Header Files\cpu</Filter>
</ClInclude>
<ClInclude Include="cpu\RspLog.h">
<Filter>Header Files\cpu</Filter>
</ClInclude>
<ClInclude Include="Recompiler\X86.h">
<Filter>Header Files\Recompiler</Filter>
</ClInclude>
<ClInclude Include="Recompiler\RspProfiling.h">
<Filter>Header Files\Recompiler</Filter>
</ClInclude>
<ClInclude Include="cpu\RspDma.h">
<Filter>Header Files\cpu</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -1,19 +1,16 @@
#include "Rsp.h"
#include "log.h"
#include "memory.h"
#include "x86.h"
#include <Project64-rsp-core/cpu/RSPRegisters.h>
#include <stdio.h>
#include <windows.h>
#include <Project64-rsp-core/cpu/RspLog.h>
#include <Project64-rsp-core/cpu/RspMemory.h>
#define PUTDST8(dest, value) \
(*((BYTE *)(dest)) = (BYTE)(value)); \
(*((uint8_t *)(dest)) = (uint8_t)(value)); \
dest += 1;
#define PUTDST16(dest, value) \
(*((WORD *)(dest)) = (WORD)(value)); \
(*((uint16_t *)(dest)) = (uint16_t)(value)); \
dest += 2;
#define PUTDST32(dest, value) \
(*((DWORD *)(dest)) = (DWORD)(value)); \
(*((uint32_t *)(dest)) = (uint32_t)(value)); \
dest += 4;
#define PUTDSTPTR(dest, value) \
*(void **)(dest) = (void *)(value); \
@ -33,7 +30,7 @@ void MmxEmptyMultimediaState(void)
void MmxMoveRegToReg(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" movq %s, %s", mmx_Name(Dest), mmx_Name(Source));
@ -65,7 +62,7 @@ void MmxMoveRegToReg(int Dest, int Source)
void MmxMoveQwordVariableToReg(int Dest, void * Variable, char * VariableName)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" movq %s, qword ptr [%s]", mmx_Name(Dest), VariableName);
@ -88,7 +85,7 @@ void MmxMoveQwordVariableToReg(int Dest, void * Variable, char * VariableName)
void MmxMoveQwordRegToVariable(int Dest, void * Variable, char * VariableName)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" movq qword ptr [%s], %s", VariableName, mmx_Name(Dest));
@ -111,7 +108,7 @@ void MmxMoveQwordRegToVariable(int Dest, void * Variable, char * VariableName)
void MmxPorRegToReg(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" por %s, %s", mmx_Name(Dest), mmx_Name(Source));
@ -143,7 +140,7 @@ void MmxPorRegToReg(int Dest, int Source)
void MmxPorVariableToReg(void * Variable, char * VariableName, int Dest)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" por %s, qword ptr [%s]", mmx_Name(Dest), VariableName);
@ -166,7 +163,7 @@ void MmxPorVariableToReg(void * Variable, char * VariableName, int Dest)
void MmxPandRegToReg(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" pand %s, %s", mmx_Name(Dest), mmx_Name(Source));
@ -198,7 +195,7 @@ void MmxPandRegToReg(int Dest, int Source)
void MmxPandVariableToReg(void * Variable, char * VariableName, int Dest)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" pand %s, qword ptr [%s]", mmx_Name(Dest), VariableName);
@ -221,7 +218,7 @@ void MmxPandVariableToReg(void * Variable, char * VariableName, int Dest)
void MmxPandnRegToReg(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" pandn %s, %s", mmx_Name(Dest), mmx_Name(Source));
@ -253,7 +250,7 @@ void MmxPandnRegToReg(int Dest, int Source)
void MmxXorRegToReg(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" pxor %s, %s", mmx_Name(Dest), mmx_Name(Source));
@ -283,9 +280,9 @@ void MmxXorRegToReg(int Dest, int Source)
PUTDST8(RecompPos, 0xC0 | x86Command);
}
void MmxShuffleMemoryToReg(int Dest, void * Variable, char * VariableName, BYTE Immed)
void MmxShuffleMemoryToReg(int Dest, void * Variable, char * VariableName, uint8_t Immed)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" pshufw %s, [%s], %02X", mmx_Name(Dest), VariableName, Immed);
@ -309,7 +306,7 @@ void MmxShuffleMemoryToReg(int Dest, void * Variable, char * VariableName, BYTE
void MmxPcmpeqwRegToReg(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" pcmpeqw %s, %s", mmx_Name(Dest), mmx_Name(Source));
@ -341,7 +338,7 @@ void MmxPcmpeqwRegToReg(int Dest, int Source)
void MmxPmullwRegToReg(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" pmullw %s, %s", mmx_Name(Dest), mmx_Name(Source));
@ -373,7 +370,7 @@ void MmxPmullwRegToReg(int Dest, int Source)
void MmxPmullwVariableToReg(int Dest, void * Variable, char * VariableName)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" pmullw %s, [%s]", mmx_Name(Dest), VariableName);
@ -395,7 +392,7 @@ void MmxPmullwVariableToReg(int Dest, void * Variable, char * VariableName)
void MmxPmulhuwRegToReg(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" pmulhuw %s, %s", mmx_Name(Dest), mmx_Name(Source));
@ -427,7 +424,7 @@ void MmxPmulhuwRegToReg(int Dest, int Source)
void MmxPmulhwRegToReg(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" pmulhw %s, %s", mmx_Name(Dest), mmx_Name(Source));
@ -459,7 +456,7 @@ void MmxPmulhwRegToReg(int Dest, int Source)
void MmxPmulhwRegToVariable(int Dest, void * Variable, char * VariableName)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" pmulhw %s, [%s]", mmx_Name(Dest), VariableName);
@ -479,9 +476,9 @@ void MmxPmulhwRegToVariable(int Dest, void * Variable, char * VariableName)
PUTDSTPTR(RecompPos, Variable);
}
void MmxPsrlwImmed(int Dest, BYTE Immed)
void MmxPsrlwImmed(int Dest, uint8_t Immed)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" psrlw %s, %i", mmx_Name(Dest), Immed);
@ -502,9 +499,9 @@ void MmxPsrlwImmed(int Dest, BYTE Immed)
PUTDST8(RecompPos, Immed);
}
void MmxPsrawImmed(int Dest, BYTE Immed)
void MmxPsrawImmed(int Dest, uint8_t Immed)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" psraw %s, %i", mmx_Name(Dest), Immed);
@ -525,9 +522,9 @@ void MmxPsrawImmed(int Dest, BYTE Immed)
PUTDST8(RecompPos, Immed);
}
void MmxPsllwImmed(int Dest, BYTE Immed)
void MmxPsllwImmed(int Dest, uint8_t Immed)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" psllw %s, %i", mmx_Name(Dest), Immed);
@ -550,7 +547,7 @@ void MmxPsllwImmed(int Dest, BYTE Immed)
void MmxPaddswRegToReg(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" paddsw %s, %s", mmx_Name(Dest), mmx_Name(Source));
@ -582,7 +579,7 @@ void MmxPaddswRegToReg(int Dest, int Source)
void MmxPsubswRegToReg(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" psubsw %s, %s", mmx_Name(Dest), mmx_Name(Source));
@ -614,7 +611,7 @@ void MmxPsubswRegToReg(int Dest, int Source)
void MmxPaddswVariableToReg(int Dest, void * Variable, char * VariableName)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" paddsw %s, [%s]", mmx_Name(Dest), VariableName);
@ -637,7 +634,7 @@ void MmxPaddswVariableToReg(int Dest, void * Variable, char * VariableName)
void MmxPsubswVariableToReg(int Dest, void * Variable, char * VariableName)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" psubsw %s, [%s]", mmx_Name(Dest), VariableName);
@ -660,7 +657,7 @@ void MmxPsubswVariableToReg(int Dest, void * Variable, char * VariableName)
void MmxPaddwRegToReg(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" paddw %s, %s", mmx_Name(Dest), mmx_Name(Source));
@ -692,7 +689,7 @@ void MmxPaddwRegToReg(int Dest, int Source)
void MmxPackSignedDwords(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" packssdw %s, %s", mmx_Name(Dest), mmx_Name(Source));
@ -724,7 +721,7 @@ void MmxPackSignedDwords(int Dest, int Source)
void MmxUnpackLowWord(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" punpcklwd %s, %s", mmx_Name(Dest), mmx_Name(Source));
@ -756,7 +753,7 @@ void MmxUnpackLowWord(int Dest, int Source)
void MmxUnpackHighWord(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" punpckhwd %s, %s", mmx_Name(Dest), mmx_Name(Source));
@ -788,7 +785,7 @@ void MmxUnpackHighWord(int Dest, int Source)
void MmxCompareGreaterWordRegToReg(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" pcmpgtw %s, %s", mmx_Name(Dest), mmx_Name(Source));

View File

@ -1,9 +1,6 @@
#include <stdio.h>
#include <windows.h>
#include <shellapi.h>
#include "profiling.h"
#include "RspProfiling.h"
#pragma warning(disable : 4786)
#include <Common/File.h>
#include <Common/Log.h>
@ -167,8 +164,6 @@ public:
Log.LogF("%s\t%2.2f", Buffer, CpuUsage);
}
}
ShellExecuteA(NULL, "open", LogFileName.c_str(), NULL, NULL, SW_SHOW);
ResetCounters();
}
};
@ -198,140 +193,3 @@ void GenerateTimerResults(void)
{
GetProfiler().GenerateLog();
}
#ifdef todelete
#include <stdio.h>
#include <windows.h>
typedef struct
{
char Label[100];
__int64 TimeTotal;
} TIME_STAMP_ENTRY;
uint32_t StartTimeHi, StartTimeLo, StopTimeHi, StopTimeLo, TSE_Count, TSE_Max;
TIME_STAMP_ENTRY * TS_Entries = NULL;
char LastLabel[100];
void ResetTimerList(void)
{
if (TS_Entries)
{
free(TS_Entries);
}
TS_Entries = NULL;
TSE_Count = 0;
TSE_Max = 0;
}
void StartTimer(char * Label)
{
strcpy(LastLabel, Label);
_asm {
pushad
rdtsc
mov StartTimeHi, edx
mov StartTimeLo, eax
popad
}
}
void StopTimer(void)
{
_asm {
pushad
rdtsc
mov StopTimeHi, edx
mov StopTimeLo, eax
popad
}
if (strlen(LastLabel) == 0)
{
return;
}
{
uint32_t count;
for (count = 0; count < TSE_Count; count++)
{
if (strcmp(LastLabel, TS_Entries[count].Label) == 0)
{
__int64 Time = ((unsigned __int64)StopTimeHi << 32) + (unsigned __int64)StopTimeLo;
Time -= ((unsigned __int64)StartTimeHi << 32) + (unsigned __int64)StartTimeLo;
TS_Entries[count].TimeTotal += Time;
return;
}
}
}
if (TSE_Count == 0)
{
TS_Entries = (TIME_STAMP_ENTRY *)malloc(sizeof(TIME_STAMP_ENTRY) * 100);
if (TS_Entries == NULL)
{
MessageBox(NULL, "TIME_STAMP_ENTRY == NULL ??", "ERROR", MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
}
TSE_Max = 100;
}
else if (TSE_Count == TSE_Max)
{
TSE_Max += 100;
TS_Entries = (TIME_STAMP_ENTRY *)realloc(TS_Entries, sizeof(TIME_STAMP_ENTRY) * TSE_Max);
if (TS_Entries == NULL)
{
MessageBox(NULL, "TIME_STAMP_ENTRY == NULL ??", "ERROR", MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
}
}
strcpy(TS_Entries[TSE_Count].Label, LastLabel);
TS_Entries[TSE_Count].TimeTotal = ((unsigned __int64)StopTimeHi << 32) + (unsigned __int64)StopTimeLo;
TS_Entries[TSE_Count].TimeTotal -= ((unsigned __int64)StartTimeHi << 32) + (unsigned __int64)StartTimeLo;
TSE_Count += 1;
}
void GenerateTimerResults(void)
{
char buffer[_MAX_PATH], drive[_MAX_DRIVE], dir[_MAX_DIR];
char fname[_MAX_FNAME], ext[_MAX_EXT], LogFileName[_MAX_PATH];
uint32_t dwWritten, count, count2;
HANDLE hLogFile = NULL;
__int64 TotalTime;
StopTimer();
GetModuleFileName(NULL, buffer, sizeof(buffer));
_splitpath(buffer, drive, dir, fname, ext);
_makepath(LogFileName, drive, dir, "RSP Profiling", "log");
hLogFile = CreateFile(LogFileName, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
SetFilePointer(hLogFile, 0, NULL, FILE_BEGIN);
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)
{
TIME_STAMP_ENTRY Temp;
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 + 1], &Temp, sizeof(TIME_STAMP_ENTRY));
}
}
}
TotalTime = 0;
for (count = 0; count < TSE_Count; count++)
{
TotalTime += TS_Entries[count].TimeTotal;
}
for (count = 0; count < (TSE_Count < 50 ? TSE_Count : 50); count++)
{
sprintf(buffer, "%s - %0.2f%c\r\n",
TS_Entries[count].Label,
(((double)TS_Entries[count].TimeTotal / (double)TotalTime) * 100), '%');
WriteFile(hLogFile, buffer, strlen(buffer), &dwWritten, NULL);
}
CloseHandle(hLogFile);
ResetTimerList();
}
#endif

View File

@ -1,15 +1,13 @@
#include "RSP Command.h"
#include "Recompiler CPU.h"
#include "Rsp.h"
#include "log.h"
#include "memory.h"
#include "RspRecompilerCPU.h"
#include <Common/StdString.h>
#include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/Settings/RspSettings.h>
#include <Project64-rsp-core/cpu/RSPCpu.h>
#include <Project64-rsp-core/cpu/RSPInstruction.h>
#include <Project64-rsp-core/cpu/RSPInterpreterCPU.h>
#include <Project64-rsp-core/cpu/RSPOpcode.h>
#include <Project64-rsp-core/cpu/RspMemory.h>
#include <Project64-rsp-core/cpu/RspTypes.h>
#include <windows.h>
//#define COMPARE_INSTRUCTIONS_VERBOSE
@ -160,7 +158,7 @@ uint32_t WriteToAccum2(int Location, int PC, bool RecursiveCall)
Instruction_State = RSPPIPELINE_DO_DELAY_SLOT;
break;
default:
CompilerWarning("Unknown opcode in WriteToAccum\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in WriteToAccum\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
break;
@ -194,7 +192,7 @@ uint32_t WriteToAccum2(int Location, int PC, bool RecursiveCall)
break;
default:
CompilerWarning("Unknown opcode in WriteToAccum\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in WriteToAccum\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
break;
@ -323,7 +321,7 @@ uint32_t WriteToAccum2(int Location, int PC, bool RecursiveCall)
case RSP_VECTOR_VSAW:
return true;
default:
CompilerWarning("Unknown opcode in WriteToAccum\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in WriteToAccum\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
}
@ -337,7 +335,7 @@ uint32_t WriteToAccum2(int Location, int PC, bool RecursiveCall)
case RSP_COP2_MF:
break;
default:
CompilerWarning("Unknown opcode in WriteToAccum\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in WriteToAccum\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
}
@ -366,7 +364,7 @@ uint32_t WriteToAccum2(int Location, int PC, bool RecursiveCall)
case RSP_LSC2_HV:
break;
default:
CompilerWarning("Unknown opcode in WriteToAccum\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in WriteToAccum\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
break;
@ -387,12 +385,12 @@ uint32_t WriteToAccum2(int Location, int PC, bool RecursiveCall)
case RSP_LSC2_TV:
break;
default:
CompilerWarning("Unknown opcode in WriteToAccum\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in WriteToAccum\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
break;
default:
CompilerWarning("Unknown opcode in WriteToAccum\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in WriteToAccum\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
switch (Instruction_State)
@ -517,7 +515,7 @@ bool WriteToVectorDest2(uint32_t DestReg, int PC, bool RecursiveCall)
Instruction_State = RSPPIPELINE_DO_DELAY_SLOT;
break;
default:
CompilerWarning("Unknown opcode in WriteToVectorDest\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in WriteToVectorDest\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
break;
@ -551,7 +549,7 @@ bool WriteToVectorDest2(uint32_t DestReg, int PC, bool RecursiveCall)
break;
default:
CompilerWarning("Unknown opcode in WriteToVectorDest\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in WriteToVectorDest\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
break;
@ -686,7 +684,7 @@ bool WriteToVectorDest2(uint32_t DestReg, int PC, bool RecursiveCall)
}
break;
default:
CompilerWarning("Unknown opcode in WriteToVectorDest\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in WriteToVectorDest\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
}
@ -707,7 +705,7 @@ bool WriteToVectorDest2(uint32_t DestReg, int PC, bool RecursiveCall)
}
break;
default:
CompilerWarning("Unknown opcode in WriteToVectorDest\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in WriteToVectorDest\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
}
@ -743,7 +741,7 @@ bool WriteToVectorDest2(uint32_t DestReg, int PC, bool RecursiveCall)
}
break;
default:
CompilerWarning("Unknown opcode in WriteToVectorDest\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in WriteToVectorDest\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
break;
@ -780,7 +778,7 @@ bool WriteToVectorDest2(uint32_t DestReg, int PC, bool RecursiveCall)
int length = 32 - RspOp.rt, count, del = RspOp.del >> 1, vect = RspOp.rt;
for (count = 0; count < length; count++)
{
if (DestReg == vect + del)
if (DestReg == (uint32_t)(vect + del))
{
return true;
}
@ -790,12 +788,12 @@ bool WriteToVectorDest2(uint32_t DestReg, int PC, bool RecursiveCall)
break;
default:
CompilerWarning("Unknown opcode in WriteToVectorDest\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in WriteToVectorDest\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
break;
default:
CompilerWarning("Unknown opcode in WriteToVectorDest\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in WriteToVectorDest\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
switch (Instruction_State)
@ -920,7 +918,7 @@ bool UseRspFlags(int PC)
Instruction_State = RSPPIPELINE_DO_DELAY_SLOT;
break;
default:
CompilerWarning("Unknown opcode in UseRspFlags\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in UseRspFlags\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
break;
@ -951,7 +949,7 @@ bool UseRspFlags(int PC)
break;
default:
CompilerWarning("Unknown opcode in WriteToVectorDest\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in WriteToVectorDest\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
break;
@ -1030,7 +1028,7 @@ bool UseRspFlags(int PC)
break;
default:
CompilerWarning("Unknown opcode in UseRspFlags\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in UseRspFlags\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
}
@ -1046,7 +1044,7 @@ bool UseRspFlags(int PC)
case RSP_COP2_MF:
break;
default:
CompilerWarning("Unknown opcode in UseRspFlags\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in UseRspFlags\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
}
@ -1075,7 +1073,7 @@ bool UseRspFlags(int PC)
case RSP_LSC2_HV:
break;
default:
CompilerWarning("Unknown opcode in UseRspFlags\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in UseRspFlags\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
break;
@ -1096,12 +1094,12 @@ bool UseRspFlags(int PC)
case RSP_LSC2_TV:
break;
default:
CompilerWarning("Unknown opcode in UseRspFlags\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in UseRspFlags\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
break;
default:
CompilerWarning("Unknown opcode in UseRspFlags\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in UseRspFlags\n%s", RSPInstruction(PC, RspOp.Value).NameAndParam().c_str()).c_str());
return true;
}
switch (Instruction_State)
@ -1183,7 +1181,7 @@ bool IsRegisterConstant(uint32_t Reg, uint32_t * Constant)
break;
default:
// CompilerWarning("Unknown opcode in IsRegisterConstant\n%s",RSPOpcodeName(RspOp.Hex,PC));
// CompilerWarning(stdstr_f("Unknown opcode in IsRegisterConstant\n%s",RSPOpcodeName(RspOp.Hex,PC)).c_str());
// return false;
break;
}
@ -1225,7 +1223,7 @@ bool IsRegisterConstant(uint32_t Reg, uint32_t * Constant)
{
return false;
}
Const = (WORD)RspOp.immediate;
Const = (uint16_t)RspOp.immediate;
References++;
}
else
@ -1286,7 +1284,7 @@ bool IsRegisterConstant(uint32_t Reg, uint32_t * Constant)
break;
default:
// CompilerWarning("Unknown opcode in IsRegisterConstant\n%s",RSPOpcodeName(RspOp.Hex,PC));
// CompilerWarning(stdstr_f("Unknown opcode in IsRegisterConstant\n%s",RSPOpcodeName(RspOp.Hex,PC)).c_str());
// return false;
break;
}
@ -1313,7 +1311,7 @@ bool IsRegisterConstant(uint32_t Reg, uint32_t * Constant)
case RSP_SC2:
break;
default:
// CompilerWarning("Unknown opcode in IsRegisterConstant\n%s",RSPOpcodeName(RspOp.Hex,PC));
// CompilerWarning(stdstr_f("Unknown opcode in IsRegisterConstant\n%s",RSPOpcodeName(RspOp.Hex,PC)).c_str());
// return false;
break;
}
@ -1354,7 +1352,7 @@ bool IsOpcodeBranch(uint32_t PC, RSPOpcode RspOp)
case RSP_REGIMM_BGEZAL:
return true;
default:
//CompilerWarning("Unknown opcode in IsOpcodeBranch\n%s",RSPOpcodeName(RspOp.Hex,PC));
//CompilerWarning(stdstr_f(stdstr_f("Unknown opcode in IsOpcodeBranch\n%s",RSPOpcodeName(RspOp.Hex,PC)).c_str());
break;
}
break;
@ -1385,7 +1383,7 @@ bool IsOpcodeBranch(uint32_t PC, RSPOpcode RspOp)
return true;
default:
//CompilerWarning("Unknown opcode in IsOpcodeBranch\n%s",RSPOpcodeName(RspOp.Hex,PC));
//CompilerWarning(stdstr_f("Unknown opcode in IsOpcodeBranch\n%s",RSPOpcodeName(RspOp.Hex,PC)).c_str());
break;
}
break;
@ -1425,7 +1423,7 @@ bool IsOpcodeBranch(uint32_t PC, RSPOpcode RspOp)
break;
default:
//CompilerWarning("Unknown opcode in IsOpcodeBranch\n%s",RSPOpcodeName(RspOp.Hex,PC));
//CompilerWarning(stdstr_f("Unknown opcode in IsOpcodeBranch\n%s",RSPOpcodeName(RspOp.Hex,PC)).c_str());
break;
}
@ -1500,7 +1498,7 @@ void GetInstructionInfo(uint32_t PC, RSPOpcode * RspOp, OPCODE_INFO * info)
break;
default:
CompilerWarning("Unknown opcode in GetInstructionInfo\n%s", RSPInstruction(PC, RspOp->Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in GetInstructionInfo\n%s", RSPInstruction(PC, RspOp->Value).NameAndParam().c_str()).c_str());
info->flags = InvalidOpcode;
break;
}
@ -1549,7 +1547,7 @@ void GetInstructionInfo(uint32_t PC, RSPOpcode * RspOp, OPCODE_INFO * info)
break;
default:
CompilerWarning("Unknown opcode in GetInstructionInfo\n%s", RSPInstruction(PC, RspOp->Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in GetInstructionInfo\n%s", RSPInstruction(PC, RspOp->Value).NameAndParam().c_str()).c_str());
info->flags = InvalidOpcode;
break;
}
@ -1705,7 +1703,7 @@ void GetInstructionInfo(uint32_t PC, RSPOpcode * RspOp, OPCODE_INFO * info)
break;
default:
CompilerWarning("Unknown opcode in GetInstructionInfo\n%s", RSPInstruction(PC, RspOp->Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in GetInstructionInfo\n%s", RSPInstruction(PC, RspOp->Value).NameAndParam().c_str()).c_str());
info->flags = InvalidOpcode;
break;
}
@ -1741,7 +1739,7 @@ void GetInstructionInfo(uint32_t PC, RSPOpcode * RspOp, OPCODE_INFO * info)
info->flags = VEC_Instruction | GPR_Instruction | Store_Operation;
break;
default:
CompilerWarning("Unknown opcode in GetInstructionInfo\n%s", RSPInstruction(PC, RspOp->Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in GetInstructionInfo\n%s", RSPInstruction(PC, RspOp->Value).NameAndParam().c_str()).c_str());
info->flags = InvalidOpcode;
break;
}
@ -1786,7 +1784,7 @@ void GetInstructionInfo(uint32_t PC, RSPOpcode * RspOp, OPCODE_INFO * info)
info->flags = InvalidOpcode;
break;
default:
CompilerWarning("Unknown opcode in GetInstructionInfo\n%s", RSPInstruction(PC, RspOp->Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in GetInstructionInfo\n%s", RSPInstruction(PC, RspOp->Value).NameAndParam().c_str()).c_str());
info->flags = InvalidOpcode;
break;
}
@ -1814,13 +1812,13 @@ void GetInstructionInfo(uint32_t PC, RSPOpcode * RspOp, OPCODE_INFO * info)
info->flags = InvalidOpcode;
break;
default:
CompilerWarning("Unknown opcode in GetInstructionInfo\n%s", RSPInstruction(PC, RspOp->Value).NameAndParam().c_str());
CompilerWarning(stdstr_f("Unknown opcode in GetInstructionInfo\n%s", RSPInstruction(PC, RspOp->Value).NameAndParam().c_str()).c_str());
info->flags = InvalidOpcode;
break;
}
break;
default:
/* CompilerWarning("Unknown opcode in GetInstructionInfo\n%s",RSPOpcodeName(RspOp->Hex,PC));
/* CompilerWarning(stdstr_f("Unknown opcode in GetInstructionInfo\n%s",RSPOpcodeName(RspOp->Hex,PC)).c_str());
*/
info->flags = InvalidOpcode;
break;
@ -2156,7 +2154,7 @@ bool CompareInstructions(uint32_t PC, RSPOpcode * Top, RSPOpcode * Bottom)
return true;
default:
CompilerWarning("Reorder: Unhandled instruction type: %i", InstructionType);
CompilerWarning(stdstr_f("Reorder: Unhandled instruction type: %i", InstructionType).c_str());
}
return false;

View File

@ -1,23 +1,18 @@
#include <float.h>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include "Profiling.h"
#include "RSP Command.h"
#include "Recompiler CPU.h"
#include "Recompiler Ops.h"
#include "Rsp.h"
#include "log.h"
#include "memory.h"
#include "RspRecompilerCPU.h"
#include "RspProfiling.h"
#include "RspRecompilerOps.h"
#include "x86.h"
#include <Common/StdString.h>
#include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/cpu/RSPCpu.h>
#include <Project64-rsp-core/cpu/RSPInstruction.h>
#include <Project64-rsp-core/cpu/RSPInterpreterCPU.h>
#include <Project64-rsp-core/cpu/RSPOpcode.h>
#include <Project64-rsp-core/cpu/RSPRegisters.h>
#include <Project64-rsp-core/cpu/RspLog.h>
#include <Project64-rsp-core/cpu/RspMemory.h>
#include <Project64-rsp-core/cpu/RspTypes.h>
#include <float.h>
#pragma warning(disable : 4152) // Non-standard extension, function/data pointer conversion in expression
@ -33,7 +28,7 @@ bool ChangedPC;
RSP_BLOCK CurrentBlock;
RSP_CODE RspCode;
BYTE *pLastSecondary = NULL, *pLastPrimary = NULL;
uint8_t *pLastSecondary = NULL, *pLastPrimary = NULL;
void BuildRecompilerCPU(void)
{
@ -617,7 +612,7 @@ void CompilerToggleBuffer(void)
void ClearAllx86Code(void)
{
extern uint32_t NoOfMaps, MapsCRC[32];
extern BYTE * JumpTables;
extern uint8_t * JumpTables;
memset(&MapsCRC, 0, sizeof(uint32_t) * 0x20);
NoOfMaps = 0;
@ -640,7 +635,7 @@ void LinkBranches(RSP_BLOCK * Block)
uint32_t OrigPrgCount = *PrgCount;
uint32_t Count, Target;
uint32_t * JumpWord;
BYTE * X86Code;
uint8_t * X86Code;
RSP_BLOCK Save;
if (!CurrentBlock.ResolveCount)
@ -652,7 +647,7 @@ void LinkBranches(RSP_BLOCK * Block)
for (Count = 0; Count < CurrentBlock.ResolveCount; Count++)
{
Target = CurrentBlock.BranchesToResolve[Count].TargetPC;
X86Code = (BYTE *)*(JumpTable + (Target >> 2));
X86Code = (uint8_t *)*(JumpTable + (Target >> 2));
if (!X86Code)
{
@ -668,7 +663,7 @@ void LinkBranches(RSP_BLOCK * Block)
*Block = Save;
CPU_Message("===== (End generate code: %04X) =====", Target);
CPU_Message("");
X86Code = (BYTE *)*(JumpTable + (Target >> 2));
X86Code = (uint8_t *)*(JumpTable + (Target >> 2));
}
JumpWord = CurrentBlock.BranchesToResolve[Count].X86JumpLoc;
@ -770,7 +765,7 @@ bool IsJumpLabel(uint32_t PC)
void CompilerLinkBlocks(void)
{
BYTE * KnownCode = (BYTE *)*(JumpTable + (CompilePC >> 2));
uint8_t * KnownCode = (uint8_t *)*(JumpTable + (CompilePC >> 2));
CPU_Message("***** Linking block to X86: %08X *****", KnownCode);
NextInstruction = RSPPIPELINE_FINISH_BLOCK;
@ -782,7 +777,7 @@ void CompilerLinkBlocks(void)
void CompilerRSPBlock(void)
{
BYTE * IMEM_SAVE = (BYTE *)malloc(0x1000);
uint8_t * IMEM_SAVE = (uint8_t *)malloc(0x1000);
const size_t X86BaseAddress = (size_t)RecompPos;
NextInstruction = RSPPIPELINE_NORMAL;
@ -924,7 +919,7 @@ void CompilerRSPBlock(void)
case RSPPIPELINE_FINISH_BLOCK: break;
default:
DisplayError("RSP main loop\n\nWTF NextInstruction = %d", NextInstruction);
g_Notify->DisplayError(stdstr_f("RSP main loop\n\nWTF NextInstruction = %d", NextInstruction).c_str());
CompilePC += 4;
break;
}
@ -940,14 +935,18 @@ void CompilerRSPBlock(void)
uint32_t RunRecompilerCPU(uint32_t Cycles)
{
BYTE * Block;
#ifndef EXCEPTION_EXECUTE_HANDLER
#define EXCEPTION_EXECUTE_HANDLER 1
#endif
uint8_t * Block;
RSP_Running = true;
SetJumpTable(JumpTableSize);
while (RSP_Running)
{
Block = (BYTE *)*(JumpTable + (*PrgCount >> 2));
Block = (uint8_t *)*(JumpTable + (*PrgCount >> 2));
if (Block == NULL)
{
@ -966,7 +965,9 @@ uint32_t RunRecompilerCPU(uint32_t Cycles)
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
DisplayError("Error CompilePC = %08X", CompilePC);
char ErrorMessage[400];
sprintf(ErrorMessage, "Error CompilePC = %08X", CompilePC);
g_Notify->DisplayError(ErrorMessage);
ClearAllx86Code();
continue;
}
@ -976,7 +977,7 @@ uint32_t RunRecompilerCPU(uint32_t Cycles)
CompilerRSPBlock();
#endif
Block = (BYTE *)*(JumpTable + (*PrgCount >> 2));
Block = (uint8_t *)*(JumpTable + (*PrgCount >> 2));
// We are done compiling, but we may have references
// to fill in still either from this block, or jumps

View File

@ -1,11 +1,15 @@
#pragma once
#include <Project64-rsp-core/Settings/RspSettings.h>
#include <Project64-rsp-core/cpu/RSPOpcode.h>
#include <Project64-rsp-core/cpu/RspTypes.h>
#include <Settings/Settings.h>
extern uint32_t CompilePC, NextInstruction, JumpTableSize;
extern bool ChangedPC;
#define CompilerWarning \
if (ShowErrors) DisplayError
if (ShowErrors) g_Notify->DisplayError
#define High16BitAccum 1
#define Middle16BitAccum 2

View File

@ -1,20 +1,18 @@
#include "Profiling.h"
#include "RSP Command.h"
#include "Recompiler CPU.h"
#include "Rsp.h"
#include "dma.h"
#include "log.h"
#include "memory.h"
#include "Project64-rsp-core/Recompiler/RspRecompilerCPU.h"
#include "RspProfiling.h"
#include "RspRecompilerCPU.h"
#include "x86.h"
#include <Common/StdString.h>
#include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/cpu/RSPCpu.h>
#include <Project64-rsp-core/cpu/RSPInstruction.h>
#include <Project64-rsp-core/cpu/RSPInterpreterCPU.h>
#include <Project64-rsp-core/cpu/RSPInterpreterOps.h>
#include <Project64-rsp-core/cpu/RSPRegisters.h>
#include <Project64-rsp-core/cpu/RspDma.h>
#include <Project64-rsp-core/cpu/RspLog.h>
#include <Project64-rsp-core/cpu/RspMemory.h>
#include <Project64-rsp-core/cpu/RspTypes.h>
#include <stdio.h>
#include <windows.h>
#pragma warning(disable : 4152) // Non-standard extension, function/data pointer conversion in expression
@ -98,7 +96,7 @@ void Branch_AddRef(uint32_t Target, uint32_t * X86Loc)
}
else
{
BYTE * KnownCode = (BYTE *)(*(JumpTable + (Target >> 2)));
uint8_t * KnownCode = (uint8_t *)(*(JumpTable + (Target >> 2)));
if (KnownCode == NULL)
{
@ -131,14 +129,13 @@ void Cheat_r4300iOpcodeNoMessage(p_func FunctAddress, char * FunctName)
void x86_SetBranch8b(void * JumpByte, void * Destination)
{
// Calculate 32-bit relative offset
size_t n = (BYTE *)Destination - ((BYTE *)JumpByte + 1);
SSIZE_T signed_n = (SSIZE_T)n;
size_t n = (uint8_t *)Destination - ((uint8_t *)JumpByte + 1);
intptr_t signed_n = (intptr_t)n;
// Check limits, no pun intended
if (signed_n > +128 || signed_n < -127)
{
CompilerWarning(
"FATAL: Jump out of 8b range %i (PC = %04X)", n, CompilePC);
CompilerWarning(stdstr_f("FATAL: Jump out of 8b range %i (PC = %04X)", n, CompilePC).c_str());
}
else
{
@ -148,7 +145,7 @@ void x86_SetBranch8b(void * JumpByte, void * Destination)
void x86_SetBranch32b(void * JumpByte, void * Destination)
{
*(uint32_t *)(JumpByte) = (uint32_t)((BYTE *)Destination - (BYTE *)((uint32_t *)JumpByte + 1));
*(uint32_t *)(JumpByte) = (uint32_t)((uint8_t *)Destination - (uint8_t *)((uint32_t *)JumpByte + 1));
}
void BreakPoint()
@ -207,7 +204,7 @@ void Compile_J(void)
}
else
{
CompilerWarning("J error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction);
CompilerWarning(stdstr_f("J error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction).c_str());
BreakPoint();
}
}
@ -245,7 +242,7 @@ void Compile_JAL(void)
}
else
{
CompilerWarning("J error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction);
CompilerWarning(stdstr_f("J error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction).c_str());
BreakPoint();
}
}
@ -328,7 +325,7 @@ void Compile_BEQ(void)
}
else
{
CompilerWarning("BEQ error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction);
CompilerWarning(stdstr_f("BEQ error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction).c_str());
BreakPoint();
}
}
@ -411,7 +408,7 @@ void Compile_BNE(void)
}
else
{
CompilerWarning("BNE error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction);
CompilerWarning(stdstr_f("BNE error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction).c_str());
BreakPoint();
}
}
@ -471,7 +468,7 @@ void Compile_BLEZ(void)
}
else
{
CompilerWarning("BLEZ error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction);
CompilerWarning(stdstr_f("BLEZ error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction).c_str());
BreakPoint();
}
}
@ -528,7 +525,7 @@ void Compile_BGTZ(void)
}
else
{
CompilerWarning("BGTZ error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction);
CompilerWarning(stdstr_f("BGTZ error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction).c_str());
BreakPoint();
}
}
@ -811,7 +808,7 @@ void Compile_LB(void)
void Compile_LH(void)
{
int Offset = (short)RSPOpC.offset;
BYTE * Jump[2];
uint8_t * Jump[2];
if (RSPOpC.rt == 0)
return;
@ -831,7 +828,7 @@ void Compile_LH(void)
{
if ((Addr & 2) == 0)
{
CompilerWarning("Unaligned LH at constant address PC = %04X", CompilePC);
CompilerWarning(stdstr_f("Unaligned LH at constant address PC = %04X", CompilePC).c_str());
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LH, "RSP_Opcode_LH");
}
else
@ -884,7 +881,7 @@ void Compile_LH(void)
void Compile_LW(void)
{
int Offset = (short)RSPOpC.offset;
BYTE * Jump[2];
uint8_t * Jump[2];
if (RSPOpC.rt == 0)
return;
@ -901,7 +898,7 @@ void Compile_LW(void)
if ((Addr & 1) != 0)
{
CompilerWarning("Unaligned LW at constant address PC = %04X", CompilePC);
CompilerWarning(stdstr_f("Unaligned LW at constant address PC = %04X", CompilePC).c_str());
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LW, "RSP_Opcode_LW");
}
else if ((Addr & 2) != 0)
@ -1006,7 +1003,7 @@ void Compile_LBU(void)
void Compile_LHU(void)
{
int Offset = (short)RSPOpC.offset;
BYTE * Jump[2];
uint8_t * Jump[2];
if (RSPOpC.rt == 0)
return;
@ -1026,7 +1023,7 @@ void Compile_LHU(void)
{
if ((Addr & 2) == 0)
{
CompilerWarning("Unaligned LHU at constant address PC = %04X", CompilePC);
CompilerWarning(stdstr_f("Unaligned LHU at constant address PC = %04X", CompilePC).c_str());
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LHU, "RSP_Opcode_LHU");
}
else
@ -1096,7 +1093,7 @@ void Compile_SB(void)
if (IsRegConst(RSPOpC.rt))
{
MoveConstByteToVariable(MipsRegConst(RSPOpC.rt), RSPInfo.DMEM + Addr, Address);
MoveConstByteToVariable((uint8_t)MipsRegConst(RSPOpC.rt), RSPInfo.DMEM + Addr, Address);
return;
}
else
@ -1115,7 +1112,7 @@ void Compile_SB(void)
XorConstToX86Reg(x86_EBX, 3);
AndConstToX86Reg(x86_EBX, 0x0fff);
MoveConstByteToN64Mem(MipsRegConst(RSPOpC.rt), x86_EBX);
MoveConstByteToN64Mem((uint8_t)MipsRegConst(RSPOpC.rt), x86_EBX);
}
else
{
@ -1133,7 +1130,7 @@ void Compile_SB(void)
void Compile_SH(void)
{
int Offset = (short)RSPOpC.offset;
BYTE * Jump[2];
uint8_t * Jump[2];
#ifndef Compile_GPRStores
Cheat_r4300iOpcode(RSP_Opcode_SH, "RSP_Opcode_SH");
@ -1149,7 +1146,7 @@ void Compile_SH(void)
if ((Offset & 1) != 0)
{
CompilerWarning("Unaligned SH at constant address PC = %04X", CompilePC);
CompilerWarning(stdstr_f("Unaligned SH at constant address PC = %04X", CompilePC).c_str());
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_SH, "RSP_Opcode_SH");
return;
}
@ -1159,7 +1156,7 @@ void Compile_SH(void)
sprintf(Address, "DMEM + %Xh", Addr);
if (IsRegConst(RSPOpC.rt))
{
MoveConstHalfToVariable(MipsRegConst(RSPOpC.rt), RSPInfo.DMEM + Addr, Address);
MoveConstHalfToVariable((uint16_t)MipsRegConst(RSPOpC.rt), RSPInfo.DMEM + Addr, Address);
}
else
{
@ -1193,7 +1190,7 @@ void Compile_SH(void)
if (IsRegConst(RSPOpC.rt))
{
MoveConstHalfToN64Mem(MipsRegConst(RSPOpC.rt), x86_EBX);
MoveConstHalfToN64Mem((uint16_t)MipsRegConst(RSPOpC.rt), x86_EBX);
}
else
{
@ -1208,7 +1205,7 @@ void Compile_SH(void)
void Compile_SW(void)
{
int Offset = (short)RSPOpC.offset;
BYTE * Jump[2];
uint8_t * Jump[2];
#ifndef Compile_GPRStores
Cheat_r4300iOpcode(RSP_Opcode_SW, "RSP_Opcode_SW");
@ -1226,7 +1223,7 @@ void Compile_SW(void)
{
if (Addr > 0xFFC)
{
DisplayError("There is a problem with:\nRSP_SW_DMEM");
g_Notify->DisplayError("There is a problem with:\nRSP_SW_DMEM");
return;
}
if (IsRegConst(RSPOpC.rt))
@ -1243,7 +1240,7 @@ void Compile_SW(void)
}
else
{
CompilerWarning("Unaligned SW at constant address PC = %04X", CompilePC);
CompilerWarning(stdstr_f("Unaligned SW at constant address PC = %04X", CompilePC).c_str());
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_SW, "RSP_Opcode_SW");
}
return;
@ -1345,12 +1342,12 @@ void Compile_Special_SLL(void)
if (RSPOpC.rd == RSPOpC.rt)
{
ShiftLeftSignVariableImmed(&RSP_GPR[RSPOpC.rd].W, GPR_Name(RSPOpC.rd), (BYTE)RSPOpC.sa);
ShiftLeftSignVariableImmed(&RSP_GPR[RSPOpC.rd].W, GPR_Name(RSPOpC.rd), (uint8_t)RSPOpC.sa);
}
else
{
MoveVariableToX86reg(&RSP_GPR[RSPOpC.rt].W, GPR_Name(RSPOpC.rt), x86_EAX);
ShiftLeftSignImmed(x86_EAX, (BYTE)RSPOpC.sa);
ShiftLeftSignImmed(x86_EAX, (uint8_t)RSPOpC.sa);
MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rd].W, GPR_Name(RSPOpC.rd));
}
}
@ -1367,12 +1364,12 @@ void Compile_Special_SRL(void)
if (RSPOpC.rd == RSPOpC.rt)
{
ShiftRightUnsignVariableImmed(&RSP_GPR[RSPOpC.rd].W, GPR_Name(RSPOpC.rd), (BYTE)RSPOpC.sa);
ShiftRightUnsignVariableImmed(&RSP_GPR[RSPOpC.rd].W, GPR_Name(RSPOpC.rd), (uint8_t)RSPOpC.sa);
}
else
{
MoveVariableToX86reg(&RSP_GPR[RSPOpC.rt].W, GPR_Name(RSPOpC.rt), x86_EAX);
ShiftRightUnsignImmed(x86_EAX, (BYTE)RSPOpC.sa);
ShiftRightUnsignImmed(x86_EAX, (uint8_t)RSPOpC.sa);
MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rd].W, GPR_Name(RSPOpC.rd));
}
}
@ -1389,12 +1386,12 @@ void Compile_Special_SRA(void)
if (RSPOpC.rd == RSPOpC.rt)
{
ShiftRightSignVariableImmed(&RSP_GPR[RSPOpC.rd].W, GPR_Name(RSPOpC.rd), (BYTE)RSPOpC.sa);
ShiftRightSignVariableImmed(&RSP_GPR[RSPOpC.rd].W, GPR_Name(RSPOpC.rd), (uint8_t)RSPOpC.sa);
}
else
{
MoveVariableToX86reg(&RSP_GPR[RSPOpC.rt].W, GPR_Name(RSPOpC.rt), x86_EAX);
ShiftRightSignImmed(x86_EAX, (BYTE)RSPOpC.sa);
ShiftRightSignImmed(x86_EAX, (uint8_t)RSPOpC.sa);
MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rd].W, GPR_Name(RSPOpC.rd));
}
}
@ -1435,7 +1432,7 @@ void UpdateAudioTimer()
void Compile_Special_JR(void)
{
BYTE * Jump;
uint8_t * Jump;
if (NextInstruction == RSPPIPELINE_NORMAL)
{
@ -1486,14 +1483,14 @@ void Compile_Special_JR(void)
}
else
{
CompilerWarning("WTF\n\nJR\nNextInstruction = %X", NextInstruction);
CompilerWarning(stdstr_f("WTF\n\nJR\nNextInstruction = %X", NextInstruction).c_str());
BreakPoint();
}
}
void Compile_Special_JALR(void)
{
BYTE * Jump;
uint8_t * Jump;
uint32_t Const = (CompilePC + 8) & 0xFFC;
if (NextInstruction == RSPPIPELINE_NORMAL)
@ -1528,7 +1525,7 @@ void Compile_Special_JALR(void)
}
else
{
CompilerWarning("WTF\n\nJALR\nNextInstruction = %X", NextInstruction);
CompilerWarning(stdstr_f("WTF\n\nJALR\nNextInstruction = %X", NextInstruction).c_str());
BreakPoint();
}
}
@ -1544,7 +1541,7 @@ void Compile_Special_BREAK(void)
}
else
{
CompilerWarning("WTF\n\nBREAK\nNextInstruction = %X", NextInstruction);
CompilerWarning(stdstr_f("WTF\n\nBREAK\nNextInstruction = %X", NextInstruction).c_str());
BreakPoint();
}
}
@ -1907,7 +1904,7 @@ void Compile_RegImm_BLTZ(void)
}
else
{
CompilerWarning("BLTZ error\nWeird Delay Slot.\n\nNextInstruction = %X\nPC = %X\nEmulation will now stop", NextInstruction, CompilePC);
CompilerWarning(stdstr_f("BLTZ error\nWeird Delay Slot.\n\nNextInstruction = %X\nPC = %X\nEmulation will now stop", NextInstruction, CompilePC).c_str());
BreakPoint();
}
}
@ -1966,7 +1963,7 @@ void Compile_RegImm_BGEZ(void)
}
else
{
CompilerWarning("BGEZ error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction);
CompilerWarning(stdstr_f("BGEZ error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction).c_str());
BreakPoint();
}
}
@ -2009,7 +2006,7 @@ void Compile_RegImm_BLTZAL(void)
}
else
{
CompilerWarning("BLTZAL error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction);
CompilerWarning(stdstr_f("BLTZAL error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction).c_str());
BreakPoint();
}
}
@ -2069,7 +2066,7 @@ void Compile_RegImm_BGEZAL(void)
}
else
{
CompilerWarning("BGEZAL error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction);
CompilerWarning(stdstr_f("BGEZAL error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction).c_str());
BreakPoint();
}
}
@ -2152,7 +2149,7 @@ void Compile_Cop0_MF(void)
}
else
{
CompilerWarning("MF error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction);
CompilerWarning(stdstr_f("MF error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction).c_str());
BreakPoint();
}
break;
@ -2179,7 +2176,7 @@ void Compile_Cop0_MF(void)
}
else
{
CompilerWarning("MF error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction);
CompilerWarning(stdstr_f("MF error\nWeird Delay Slot.\n\nNextInstruction = %X\nEmulation will now stop", NextInstruction).c_str());
BreakPoint();
}
}
@ -2206,7 +2203,7 @@ void Compile_Cop0_MF(void)
break;
default:
DisplayError("We have not implemented RSP MF CP0 reg %s (%d)", COP0_Name(RSPOpC.rd), RSPOpC.rd);
g_Notify->DisplayError(stdstr_f("We have not implemented RSP MF CP0 reg %s (%d)", COP0_Name(RSPOpC.rd), RSPOpC.rd).c_str());
}
#endif
}
@ -2317,7 +2314,7 @@ void Compile_Cop0_MT(void)
#endif
if (RSPOpC.rd == 2 && !ChangedPC)
{
BYTE * Jump;
uint8_t * Jump;
TestConstToVariable(0x1000, RSPInfo.SP_MEM_ADDR_REG, "RSPInfo.SP_MEM_ADDR_REG");
JeLabel8("DontExit", 0);
@ -3028,7 +3025,7 @@ void Compile_Vector_VMUDM(void)
/*sprintf(Reg, "RSP_Vect[%i].HW[%i]", RSPOpC.rd, el);
MoveSxVariableToX86regHalf(&RSP_Vect[RSPOpC.vs].s16(el), Reg, x86_EAX);*/
MoveSxX86RegPtrDispToX86RegHalf(x86_EBP, (BYTE)(el * 2), x86_EAX);
MoveSxX86RegPtrDispToX86RegHalf(x86_EBP, (uint8_t)(el * 2), x86_EAX);
if (!bOptimize)
{
@ -3039,7 +3036,7 @@ void Compile_Vector_VMUDM(void)
}
else
{
MoveZxX86RegPtrDispToX86RegHalf(x86_ECX, (BYTE)(del * 2), x86_EBX);
MoveZxX86RegPtrDispToX86RegHalf(x86_ECX, (uint8_t)(del * 2), x86_EBX);
}
}
@ -3050,7 +3047,7 @@ void Compile_Vector_VMUDM(void)
ShiftRightUnsignImmed(x86_EAX, 16);
/*sprintf(Reg, "RSP_Vect[%i].HW[%i]", RSPOpC.sa, el);
MoveX86regHalfToVariable(x86_EAX, &RSP_Vect[RSPOpC.vd].s16(el), Reg);*/
MoveX86regHalfToX86regPointerDisp(x86_EAX, x86_ECX, (BYTE)(el * 2));
MoveX86regHalfToX86regPointerDisp(x86_EAX, x86_ECX, (uint8_t)(el * 2));
}
else
{
@ -3069,7 +3066,7 @@ void Compile_Vector_VMUDM(void)
{
/*sprintf(Reg, "RSP_Vect[%i].HW[%i]", RSPOpC.sa, el);
MoveX86regHalfToVariable(x86_EDX, &RSP_Vect[RSPOpC.vd].s16(el), Reg);*/
MoveX86regHalfToX86regPointerDisp(x86_EDX, x86_ECX, (BYTE)(el * 2));
MoveX86regHalfToX86regPointerDisp(x86_EDX, x86_ECX, (uint8_t)(el * 2));
}
}
}
@ -3164,7 +3161,7 @@ void Compile_Vector_VMUDN(void)
/*sprintf(Reg, "RSP_Vect[%i].UHW[%i]", RSPOpC.rd, el);
MoveZxVariableToX86regHalf(&RSP_Vect[RSPOpC.vs].u16(el), Reg, x86_EAX);*/
MoveZxX86RegPtrDispToX86RegHalf(x86_EBP, (BYTE)(el * 2), x86_EAX);
MoveZxX86RegPtrDispToX86RegHalf(x86_EBP, (uint8_t)(el * 2), x86_EAX);
if (!bOptimize)
{
@ -3629,7 +3626,7 @@ void Compile_Vector_VMADM(void)
/*sprintf(Reg, "RSP_Vect[%i].HW[%i]", RSPOpC.rd, el);
MoveSxVariableToX86regHalf(&RSP_Vect[RSPOpC.vs].s16(el), Reg, x86_EAX);*/
MoveSxX86RegPtrDispToX86RegHalf(x86_EBP, (BYTE)(el * 2), x86_EAX);
MoveSxX86RegPtrDispToX86RegHalf(x86_EBP, (uint8_t)(el * 2), x86_EAX);
if (!bOptimize)
{
@ -3640,7 +3637,7 @@ void Compile_Vector_VMADM(void)
}
else
{
MoveZxX86RegPtrDispToX86RegHalf(x86_ECX, (BYTE)(del * 2), x86_EBX);
MoveZxX86RegPtrDispToX86RegHalf(x86_ECX, (uint8_t)(del * 2), x86_EBX);
}
}
@ -3665,7 +3662,7 @@ void Compile_Vector_VMADM(void)
/*sprintf(Reg, "RSP_Vect[%i].HW[%i]", RSPOpC.sa, el);
MoveX86regHalfToVariable(x86_EAX, &RSP_Vect[RSPOpC.vd].s16(el), Reg);*/
MoveX86regHalfToX86regPointerDisp(x86_EAX, x86_ECX, (BYTE)(el * 2));
MoveX86regHalfToX86regPointerDisp(x86_EAX, x86_ECX, (uint8_t)(el * 2));
}
}
@ -3714,7 +3711,7 @@ void Compile_Vector_VMADN(void)
/*sprintf(Reg, "RSP_Vect[%i].UHW[%i]", RSPOpC.rd, el);
MoveZxVariableToX86regHalf(&RSP_Vect[RSPOpC.vs].u16(el), Reg, x86_EAX);*/
MoveZxX86RegPtrDispToX86RegHalf(x86_EBP, (BYTE)(el * 2), x86_EAX);
MoveZxX86RegPtrDispToX86RegHalf(x86_EBP, (uint8_t)(el * 2), x86_EAX);
if (!bOptimize)
{
@ -3859,7 +3856,7 @@ void Compile_Vector_VMADH(void)
/*sprintf(Reg, "RSP_Vect[%i].HW[%i]", RSPOpC.rd, el);
MoveSxVariableToX86regHalf(&RSP_Vect[RSPOpC.vs].s16(el), Reg, x86_EAX);*/
MoveSxX86RegPtrDispToX86RegHalf(x86_EBP, (BYTE)(el * 2), x86_EAX);
MoveSxX86RegPtrDispToX86RegHalf(x86_EBP, (uint8_t)(el * 2), x86_EAX);
if (!bOptimize)
{
@ -3870,7 +3867,7 @@ void Compile_Vector_VMADH(void)
}
else
{
MoveSxX86RegPtrDispToX86RegHalf(x86_ECX, (BYTE)(del * 2), x86_EBX);
MoveSxX86RegPtrDispToX86RegHalf(x86_ECX, (uint8_t)(del * 2), x86_EBX);
}
}
@ -3889,7 +3886,7 @@ void Compile_Vector_VMADH(void)
/*sprintf(Reg, "RSP_Vect[%i].HW[%i]", RSPOpC.sa, el);
MoveX86regHalfToVariable(x86_EAX, &RSP_Vect[RSPOpC.vd].s16(el), Reg);*/
MoveX86regHalfToX86regPointerDisp(x86_EAX, x86_ECX, (BYTE)(el * 2));
MoveX86regHalfToX86regPointerDisp(x86_EAX, x86_ECX, (uint8_t)(el * 2));
}
}
Pop(x86_EBP);
@ -4405,7 +4402,7 @@ void Compile_Vector_VADDC(void)
/*sprintf(Reg, "RSP_Vect[%i].HW[%i]", RSPOpC.rd, el);
MoveZxVariableToX86regHalf(&RSP_Vect[RSPOpC.vs].s16(el), Reg, x86_EAX);*/
MoveZxX86RegPtrDispToX86RegHalf(x86_EBP, (BYTE)(el * 2), x86_EAX);
MoveZxX86RegPtrDispToX86RegHalf(x86_EBP, (uint8_t)(el * 2), x86_EAX);
if (bElement == false)
{
@ -4420,7 +4417,7 @@ void Compile_Vector_VADDC(void)
Setnz(x86_EDX);
if ((7 - el) != 0)
{
ShiftLeftSignImmed(x86_EDX, (BYTE)(7 - el));
ShiftLeftSignImmed(x86_EDX, (uint8_t)(7 - el));
}
OrX86RegToX86Reg(x86_ECX, x86_EDX);
@ -4486,13 +4483,13 @@ void Compile_Vector_VSUBC(void)
XorX86RegToX86Reg(x86_EDX, x86_EDX);
TestConstToX86Reg(0x0000FFFF, x86_EAX);
Setnz(x86_EDX);
ShiftLeftSignImmed(x86_EDX, (BYTE)(15 - el));
ShiftLeftSignImmed(x86_EDX, (uint8_t)(15 - el));
OrX86RegToX86Reg(x86_ECX, x86_EDX);
XorX86RegToX86Reg(x86_EDX, x86_EDX);
TestConstToX86Reg(0xFFFF0000, x86_EAX);
Setnz(x86_EDX);
ShiftLeftSignImmed(x86_EDX, (BYTE)(7 - el));
ShiftLeftSignImmed(x86_EDX, (uint8_t)(7 - el));
OrX86RegToX86Reg(x86_ECX, x86_EDX);
if (bWriteToAccum != false)
@ -4569,7 +4566,7 @@ void Compile_Vector_VLT(void)
{
bool bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC);
bool bWriteToAccum = WriteToAccum(Low16BitAccum, CompilePC);
BYTE * jump[3];
uint8_t * jump[3];
uint32_t flag;
char Reg[256];
uint8_t el, del, last;
@ -4600,7 +4597,7 @@ void Compile_Vector_VLT(void)
CompX86RegToX86Reg(x86_EDX, x86_ECX);
JgeLabel8("jge", 0);
jump[0] = (BYTE *)(RecompPos - 1);
jump[0] = (uint8_t *)(RecompPos - 1);
if (bWriteToAccum || bWriteToDest)
{
@ -4610,7 +4607,7 @@ void Compile_Vector_VLT(void)
OrConstToX86Reg((flag & 0xFF), x86_EBX);
JmpLabel8("jmp", 0);
jump[1] = (BYTE *)(RecompPos - 1);
jump[1] = (uint8_t *)(RecompPos - 1);
x86_SetBranch8b(jump[0], RecompPos);
if (bWriteToAccum || bWriteToDest)
@ -4619,7 +4616,7 @@ void Compile_Vector_VLT(void)
MoveX86regHalfToVariable(x86_ECX, &RSP_ACCUM[el].HW[1], Reg);
}
JneLabel8("jne", 0);
jump[2] = (BYTE *)(RecompPos - 1);
jump[2] = (uint8_t *)(RecompPos - 1);
MoveX86RegToX86Reg(x86_ESI, x86_EDI);
AndConstToX86Reg(x86_EDI, flag);
@ -4874,7 +4871,7 @@ void Compile_Vector_VGE(void)
*/
bool bWriteToDest = WriteToVectorDest(RSPOpC.sa, CompilePC);
bool bWriteToAccum = WriteToAccum(Low16BitAccum, CompilePC);
BYTE * jump[3];
uint8_t * jump[3];
uint32_t flag;
char Reg[256];
uint8_t el, del, last = (uint8_t)-1;
@ -4905,7 +4902,7 @@ void Compile_Vector_VGE(void)
CompX86RegToX86Reg(x86_EDX, x86_ECX);
JleLabel8("jle", 0);
jump[0] = (BYTE *)(RecompPos - 1);
jump[0] = (uint8_t *)(RecompPos - 1);
if (bWriteToAccum || bWriteToDest)
{
@ -4915,7 +4912,7 @@ void Compile_Vector_VGE(void)
OrConstToX86Reg((flag & 0xFF), x86_EBX);
JmpLabel8("jmp", 0);
jump[1] = (BYTE *)(RecompPos - 1);
jump[1] = (uint8_t *)(RecompPos - 1);
x86_SetBranch8b(jump[0], RecompPos);
if (bWriteToAccum || bWriteToDest)
@ -4925,7 +4922,7 @@ void Compile_Vector_VGE(void)
}
JneLabel8("jne", 0);
jump[2] = (BYTE *)(RecompPos - 1);
jump[2] = (uint8_t *)(RecompPos - 1);
MoveX86RegToX86Reg(x86_ESI, x86_EDI);
AndConstToX86Reg(x86_EDI, flag);
@ -6002,7 +5999,7 @@ void Compile_Opcode_LSV(void)
sprintf(Reg, "DMEM + %Xh", Addr ^ 2);
MoveVariableToX86regHalf(RSPInfo.DMEM + (Addr ^ 2), Reg, x86_EDX);
sprintf(Reg, "RSP_Vect[%i].B[%i]", RSPOpC.rt, 15 - (RSPOpC.del + 1));
MoveX86regHalfToVariable(x86_EDX, &RSP_Vect[RSPOpC.vt].s8(15 - (RSPOpC.del + 1)), Reg);
MoveX86regHalfToVariable(x86_EDX, &RSP_Vect[RSPOpC.vt].s8((uint8_t)(15 - (RSPOpC.del + 1))), Reg);
}
return;
}
@ -6016,7 +6013,7 @@ void Compile_Opcode_LSV(void)
XorConstToX86Reg(x86_EBX, 2);
MoveN64MemToX86regHalf(x86_ECX, x86_EBX);
sprintf(Reg, "RSP_Vect[%i].B[%i]", RSPOpC.rt, 15 - (RSPOpC.del + 1));
MoveX86regHalfToVariable(x86_ECX, &RSP_Vect[RSPOpC.vt].s8(15 - (RSPOpC.del + 1)), Reg);
MoveX86regHalfToVariable(x86_ECX, &RSP_Vect[RSPOpC.vt].s8((uint8_t)(15 - (RSPOpC.del + 1))), Reg);
}
else
{
@ -6028,10 +6025,10 @@ void Compile_Opcode_LSV(void)
MoveN64MemToX86regByte(x86_EDX, x86_EAX);
sprintf(Reg, "RSP_Vect[%i].B[%i]", RSPOpC.rt, 15 - (RSPOpC.del + 0));
MoveX86regByteToVariable(x86_ECX, &RSP_Vect[RSPOpC.vt].s8(15 - (RSPOpC.del + 0)), Reg);
MoveX86regByteToVariable(x86_ECX, &RSP_Vect[RSPOpC.vt].s8((uint8_t)(15 - (RSPOpC.del + 0))), Reg);
sprintf(Reg, "RSP_Vect[%i].B[%i]", RSPOpC.rt, 15 - (RSPOpC.del + 1));
MoveX86regByteToVariable(x86_EDX, &RSP_Vect[RSPOpC.vt].s8(15 - (RSPOpC.del + 1)), Reg);
MoveX86regByteToVariable(x86_EDX, &RSP_Vect[RSPOpC.vt].s8((uint8_t)(15 - (RSPOpC.del + 1))), Reg);
}
}
@ -6039,7 +6036,7 @@ void Compile_Opcode_LLV(void)
{
char Reg[256];
int offset = (RSPOpC.voffset << 2);
BYTE * Jump[2];
uint8_t * Jump[2];
#ifndef CompileLlv
Cheat_r4300iOpcode(RSP_Opcode_LLV, "RSP_Opcode_LLV");
@ -6069,7 +6066,7 @@ void Compile_Opcode_LLV(void)
sprintf(Reg, "DMEM + %Xh", Addr);
MoveVariableToX86reg(RSPInfo.DMEM + Addr, Reg, x86_EAX);
sprintf(Reg, "RSP_Vect[%i].B[%i]", RSPOpC.rt, 16 - RSPOpC.del - 4);
MoveX86regToVariable(x86_EAX, &RSP_Vect[RSPOpC.vt].s8(16 - RSPOpC.del - 4), Reg);
MoveX86regToVariable(x86_EAX, &RSP_Vect[RSPOpC.vt].s8((uint8_t)(16 - RSPOpC.del - 4)), Reg);
return;
}
@ -6098,7 +6095,7 @@ void Compile_Opcode_LLV(void)
MoveN64MemToX86reg(x86_EAX, x86_EBX);
// Because of byte swapping this swizzle works nicely
sprintf(Reg, "RSP_Vect[%i].B[%i]", RSPOpC.rt, 16 - RSPOpC.del - 4);
MoveX86regToVariable(x86_EAX, &RSP_Vect[RSPOpC.vt].s8(16 - RSPOpC.del - 4), Reg);
MoveX86regToVariable(x86_EAX, &RSP_Vect[RSPOpC.vt].s8((uint8_t)(16 - RSPOpC.del - 4)), Reg);
CPU_Message(" Done:");
*((uint32_t *)(Jump[1])) = (uint32_t)(RecompPos - Jump[1] - 4);
@ -6108,7 +6105,7 @@ void Compile_Opcode_LDV(void)
{
char Reg[256];
int offset = (RSPOpC.voffset << 3), length;
BYTE *Jump[2], *LoopEntry;
uint8_t *Jump[2], *LoopEntry;
#ifndef CompileLdv
Cheat_r4300iOpcode(RSP_Opcode_LDV, "RSP_Opcode_LDV");
@ -6123,7 +6120,7 @@ void Compile_Opcode_LDV(void)
//}
if ((RSPOpC.del & 0x3) != 0)
{
CompilerWarning("LDV's element = %X, PC = %04X", RSPOpC.del, CompilePC);
CompilerWarning(stdstr_f("LDV's element = %X, PC = %04X", RSPOpC.del, CompilePC).c_str());
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LDV, "RSP_Opcode_LDV");
return;
}
@ -6134,7 +6131,7 @@ void Compile_Opcode_LDV(void)
if ((Addr & 3) != 0)
{
CompilerWarning("Unaligned LDV at constant address PC = %04X", CompilePC);
CompilerWarning(stdstr_f("Unaligned LDV at constant address PC = %04X", CompilePC).c_str());
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LDV, "RSP_Opcode_LDV");
return;
}
@ -6145,11 +6142,11 @@ void Compile_Opcode_LDV(void)
MoveVariableToX86reg(RSPInfo.DMEM + Addr + 4, Reg, x86_ECX);
sprintf(Reg, "RSP_Vect[%i].B[%i]", RSPOpC.rt, 16 - RSPOpC.del - 4);
MoveX86regToVariable(x86_EAX, &RSP_Vect[RSPOpC.vt].s8(16 - RSPOpC.del - 4), Reg);
MoveX86regToVariable(x86_EAX, &RSP_Vect[RSPOpC.vt].s8((uint8_t)(16 - RSPOpC.del - 4)), Reg);
if (RSPOpC.del != 12)
{
sprintf(Reg, "RSP_Vect[%i].B[%i]", RSPOpC.rt, 16 - RSPOpC.del - 8);
MoveX86regToVariable(x86_ECX, &RSP_Vect[RSPOpC.vt].s8(16 - RSPOpC.del - 8), Reg);
MoveX86regToVariable(x86_ECX, &RSP_Vect[RSPOpC.vt].s8((uint8_t)(16 - RSPOpC.del - 8)), Reg);
}
return;
}
@ -6168,7 +6165,7 @@ void Compile_Opcode_LDV(void)
CPU_Message(" Unaligned:");
x86_SetBranch32b(Jump[0], RecompPos);
sprintf(Reg, "RSP_Vect[%i].UB[%i]", RSPOpC.rt, 15 - RSPOpC.del);
MoveOffsetToX86reg((size_t)&RSP_Vect[RSPOpC.vt].u8(15 - RSPOpC.del), Reg, x86_EDI);
MoveOffsetToX86reg((size_t)&RSP_Vect[RSPOpC.vt].u8((uint8_t)(15 - RSPOpC.del)), Reg, x86_EDI);
length = 8;
if (RSPOpC.del == 12)
{
@ -6206,7 +6203,7 @@ void Compile_Opcode_LDV(void)
// Because of byte swapping this swizzle works nicely
sprintf(Reg, "RSP_Vect[%i].B[%i]", RSPOpC.rt, 16 - RSPOpC.del - 4);
MoveX86regToVariable(x86_EAX, &RSP_Vect[RSPOpC.vt].s8(16 - RSPOpC.del - 4), Reg);
MoveX86regToVariable(x86_EAX, &RSP_Vect[RSPOpC.vt].s8((uint8_t)(16 - RSPOpC.del - 4)), Reg);
if (RSPOpC.del != 12)
{
sprintf(Reg, "RSP_Vect[%i].B[%i]", RSPOpC.rt, 16 - RSPOpC.del - 8);
@ -6220,7 +6217,7 @@ void Compile_Opcode_LQV(void)
{
char Reg[256];
int offset = (RSPOpC.voffset << 4);
BYTE * Jump[2];
uint8_t * Jump[2];
#ifndef CompileLqv
Cheat_r4300iOpcode(RSP_Opcode_LQV, "RSP_Opcode_LQV");
@ -6242,7 +6239,7 @@ void Compile_Opcode_LQV(void)
if (Addr & 15)
{
CompilerWarning("Unaligned LQV at constant address PC = %04X", CompilePC);
CompilerWarning(stdstr_f("Unaligned LQV at constant address PC = %04X", CompilePC).c_str());
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_LQV, "RSP_Opcode_LQV");
return;
}
@ -6329,7 +6326,7 @@ void Compile_Opcode_LQV(void)
void Compile_Opcode_LRV(void)
{
int offset = (RSPOpC.voffset << 4);
BYTE *Loop, *Jump[2];
uint8_t *Loop, *Jump[2];
#ifndef CompileLrv
Cheat_r4300iOpcode(RSP_Opcode_LRV, "RSP_Opcode_LRV");
@ -6775,9 +6772,9 @@ void Compile_Opcode_SSV(void)
if ((Addr & 1) != 0)
{
sprintf(Reg, "RSP_Vect[%i].B[%i]", RSPOpC.rt, 15 - (RSPOpC.del + 0));
MoveVariableToX86regByte(&RSP_Vect[RSPOpC.vt].s8(15 - (RSPOpC.del + 0)), Reg, x86_ECX);
MoveVariableToX86regByte(&RSP_Vect[RSPOpC.vt].s8((uint8_t)(15 - (RSPOpC.del + 0))), Reg, x86_ECX);
sprintf(Reg, "RSP_Vect[%i].B[%i]", RSPOpC.rt, 15 - (RSPOpC.del + 1));
MoveVariableToX86regByte(&RSP_Vect[RSPOpC.vt].s8(15 - (RSPOpC.del + 1)), Reg, x86_EDX);
MoveVariableToX86regByte(&RSP_Vect[RSPOpC.vt].s8((uint8_t)(15 - (RSPOpC.del + 1))), Reg, x86_EDX);
sprintf(Reg, "DMEM + %Xh", (Addr + 0) ^ 3);
MoveX86regByteToVariable(x86_ECX, RSPInfo.DMEM + ((Addr + 0) ^ 3), Reg);
@ -6787,7 +6784,7 @@ void Compile_Opcode_SSV(void)
else
{
sprintf(Reg, "RSP_Vect[%i].B[%i]", RSPOpC.rt, 15 - (RSPOpC.del + 1));
MoveVariableToX86regHalf(&RSP_Vect[RSPOpC.vt].s8(15 - (RSPOpC.del + 1)), Reg, x86_ECX);
MoveVariableToX86regHalf(&RSP_Vect[RSPOpC.vt].s8((uint8_t)(15 - (RSPOpC.del + 1))), Reg, x86_ECX);
sprintf(Reg, "DMEM + %Xh", Addr ^ 2);
MoveX86regHalfToVariable(x86_ECX, RSPInfo.DMEM + (Addr ^ 2), Reg);
}
@ -6801,7 +6798,7 @@ void Compile_Opcode_SSV(void)
if (Compiler.bAlignVector == true)
{
sprintf(Reg, "RSP_Vect[%i].B[%i]", RSPOpC.rt, 15 - (RSPOpC.del + 1));
MoveVariableToX86regHalf(&RSP_Vect[RSPOpC.vt].s8(15 - (RSPOpC.del + 1)), Reg, x86_ECX);
MoveVariableToX86regHalf(&RSP_Vect[RSPOpC.vt].s8((uint8_t)(15 - (RSPOpC.del + 1))), Reg, x86_ECX);
XorConstToX86Reg(x86_EBX, 2);
MoveX86regHalfToN64Mem(x86_ECX, x86_EBX);
}
@ -6825,7 +6822,7 @@ void Compile_Opcode_SLV(void)
{
char Reg[256];
int offset = (RSPOpC.voffset << 2);
BYTE * Jump[2];
uint8_t * Jump[2];
#ifndef CompileSlv
Cheat_r4300iOpcode(RSP_Opcode_SLV, "RSP_Opcode_SLV");
@ -6851,7 +6848,7 @@ void Compile_Opcode_SLV(void)
}
sprintf(Reg, "RSP_Vect[%i].B[%i]", RSPOpC.rt, 16 - RSPOpC.del - 4);
MoveVariableToX86reg(&RSP_Vect[RSPOpC.vt].s8(16 - RSPOpC.del - 4), Reg, x86_EAX);
MoveVariableToX86reg(&RSP_Vect[RSPOpC.vt].s8((uint8_t)(16 - RSPOpC.del - 4)), Reg, x86_EAX);
sprintf(Reg, "DMEM + %Xh", Addr);
MoveX86regToVariable(x86_EAX, RSPInfo.DMEM + Addr, Reg);
return;
@ -6880,7 +6877,7 @@ void Compile_Opcode_SLV(void)
// Because of byte swapping this swizzle works nicely
sprintf(Reg, "RSP_Vect[%i].B[%i]", RSPOpC.rt, 16 - RSPOpC.del - 4);
MoveVariableToX86reg(&RSP_Vect[RSPOpC.vt].s8(16 - RSPOpC.del - 4), Reg, x86_EAX);
MoveVariableToX86reg(&RSP_Vect[RSPOpC.vt].s8((uint8_t)(16 - RSPOpC.del - 4)), Reg, x86_EAX);
AndConstToX86Reg(x86_EBX, 0x0fff);
MoveX86regToN64Mem(x86_EAX, x86_EBX);
@ -6893,7 +6890,7 @@ void Compile_Opcode_SDV(void)
{
char Reg[256];
int offset = (RSPOpC.voffset << 3);
BYTE *Jump[2], *LoopEntry;
uint8_t *Jump[2], *LoopEntry;
//if ((RSPOpC.del & 0x7) != 0) {
// rsp_UnknownOpcode();
@ -6913,7 +6910,7 @@ void Compile_Opcode_SDV(void)
if ((Addr & 3) != 0)
{
CompilerWarning("Unaligned SDV at constant address PC = %04X", CompilePC);
CompilerWarning(stdstr_f("Unaligned SDV at constant address PC = %04X", CompilePC).c_str());
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_SDV, "RSP_Opcode_SDV");
return;
}
@ -6979,7 +6976,7 @@ void Compile_Opcode_SQV(void)
{
char Reg[256];
int offset = (RSPOpC.voffset << 4);
BYTE * Jump[2];
uint8_t * Jump[2];
#ifndef CompileSqv
Cheat_r4300iOpcode(RSP_Opcode_SQV, "RSP_Opcode_SQV");
@ -7000,7 +6997,7 @@ void Compile_Opcode_SQV(void)
if (Addr & 15)
{
CompilerWarning("Unaligned SQV at constant address %04X", CompilePC);
CompilerWarning(stdstr_f("Unaligned SQV at constant address %04X", CompilePC).c_str());
Cheat_r4300iOpcodeNoMessage(RSP_Opcode_SQV, "RSP_Opcode_SQV");
return;
}

View File

@ -1,21 +1,15 @@
#include <stdio.h>
#include <windows.h>
#include "RSP Command.h"
#include "Recompiler CPU.h"
#include "Rsp.h"
#include "dma.h"
#include "log.h"
#include "memory.h"
#include "RspRecompilerCPU.h"
#include "x86.h"
#include <Project64-rsp-core/cpu/RSPCpu.h>
#include <Project64-rsp-core/cpu/RSPInstruction.h>
#include <Project64-rsp-core/cpu/RSPRegisters.h>
#include <Project64-rsp-core/cpu/RspLog.h>
#include <Project64-rsp-core/cpu/RspMemory.h>
#include <Project64-rsp-core/cpu/RspTypes.h>
#pragma warning(disable : 4152) // Non-standard extension, function/data pointer conversion in expression
void RSP_Sections_VMUDH(RSPOpcode RspOp, DWORD AccumStyle)
void RSP_Sections_VMUDH(RSPOpcode RspOp, uint32_t AccumStyle)
{
char Reg[256];
@ -85,7 +79,7 @@ void RSP_Sections_VMUDH(RSPOpcode RspOp, DWORD AccumStyle)
}
}
void RSP_Sections_VMADH(RSPOpcode RspOp, DWORD AccumStyle)
void RSP_Sections_VMADH(RSPOpcode RspOp, uint32_t AccumStyle)
{
char Reg[256];
@ -156,7 +150,7 @@ void RSP_Sections_VMADH(RSPOpcode RspOp, DWORD AccumStyle)
MmxPaddswRegToReg(x86_MM1, x86_MM1 + 2);
}
void RSP_Sections_VMUDL(RSPOpcode RspOp, DWORD AccumStyle)
void RSP_Sections_VMUDL(RSPOpcode RspOp, uint32_t AccumStyle)
{
char Reg[256];
@ -202,7 +196,7 @@ void RSP_Sections_VMUDL(RSPOpcode RspOp, DWORD AccumStyle)
}
}
void RSP_Sections_VMADL(RSPOpcode RspOp, DWORD AccumStyle)
void RSP_Sections_VMADL(RSPOpcode RspOp, uint32_t AccumStyle)
{
char Reg[256];
@ -249,7 +243,7 @@ void RSP_Sections_VMADL(RSPOpcode RspOp, DWORD AccumStyle)
MmxPaddswRegToReg(x86_MM1, x86_MM1 + 2);
}
void RSP_Sections_VMUDM(RSPOpcode RspOp, DWORD AccumStyle)
void RSP_Sections_VMUDM(RSPOpcode RspOp, uint32_t AccumStyle)
{
char Reg[256];
@ -362,7 +356,7 @@ void RSP_Sections_VMUDM(RSPOpcode RspOp, DWORD AccumStyle)
}
}
void RSP_Sections_VMADM(RSPOpcode RspOp, DWORD AccumStyle)
void RSP_Sections_VMADM(RSPOpcode RspOp, uint32_t AccumStyle)
{
char Reg[256];
@ -478,7 +472,7 @@ void RSP_Sections_VMADM(RSPOpcode RspOp, DWORD AccumStyle)
MmxPaddswRegToReg(x86_MM1, x86_MM1 + 2);
}
void RSP_Sections_VMUDN(RSPOpcode RspOp, DWORD AccumStyle)
void RSP_Sections_VMUDN(RSPOpcode RspOp, uint32_t AccumStyle)
{
char Reg[256];
@ -577,7 +571,7 @@ void RSP_Sections_VMUDN(RSPOpcode RspOp, DWORD AccumStyle)
}
}
void RSP_Sections_VMADN(RSPOpcode RspOp, DWORD AccumStyle)
void RSP_Sections_VMADN(RSPOpcode RspOp, uint32_t AccumStyle)
{
char Reg[256];
@ -679,7 +673,7 @@ void RSP_Sections_VMADN(RSPOpcode RspOp, DWORD AccumStyle)
MmxPaddswRegToReg(x86_MM1, x86_MM1 + 2);
}
void RSP_Sections_VMULF(RSPOpcode RspOp, DWORD AccumStyle)
void RSP_Sections_VMULF(RSPOpcode RspOp, uint32_t AccumStyle)
{
char Reg[256];
@ -752,7 +746,7 @@ void RSP_Sections_VMULF(RSPOpcode RspOp, DWORD AccumStyle)
MmxPsllwImmed(x86_MM1, 1);
}
void RSP_Sections_VMACF(RSPOpcode RspOp, DWORD AccumStyle)
void RSP_Sections_VMACF(RSPOpcode RspOp, uint32_t AccumStyle)
{
char Reg[256];
@ -827,11 +821,11 @@ void RSP_Sections_VMACF(RSPOpcode RspOp, DWORD AccumStyle)
// Microcode sections
static DWORD Section_000_VMADN; // Yeah I know, but leave it
static uint32_t Section_000_VMADN; // Yeah I know, but leave it
bool Check_Section_000(void)
{
DWORD i;
uint32_t i;
RSPOpcode op0, op1;
RSP_LW_IMEM(CompilePC + 0x00, &op0.Value);
@ -887,7 +881,7 @@ void Compile_Section_000(void)
{
char Reg[256];
RSPOpcode vmudn, vmadn = {0};
DWORD i;
uint32_t i;
RSP_LW_IMEM(CompilePC + 0x00, &vmudn.Value);
@ -942,11 +936,11 @@ void Compile_Section_000(void)
MmxEmptyMultimediaState();
}
static DWORD Section_001_VMACF;
static uint32_t Section_001_VMACF;
bool Check_Section_001(void)
{
DWORD i;
uint32_t i;
RSPOpcode op0, op1;
RSP_LW_IMEM(CompilePC + 0x00, &op0.Value);
@ -1002,7 +996,7 @@ bool Check_Section_001(void)
void Compile_Section_001(void)
{
DWORD i;
uint32_t i;
char Reg[256];
RSPOpcode vmulf, vmacf;
@ -1048,7 +1042,7 @@ void Compile_Section_001(void)
bool Check_Section_002(void)
{
DWORD Count;
uint32_t Count;
RSPOpcode op[0x0C];
for (Count = 0; Count < 0x0C; Count++)
@ -1120,7 +1114,7 @@ void Compile_Section_002(void)
{
char Reg[256];
DWORD Count;
uint32_t Count;
RSPOpcode op[0x0C];
RSPOpcode vmudh, vsaw;
@ -1170,7 +1164,7 @@ void Compile_Section_002(void)
bool Check_Section_003(void)
{
DWORD Count;
uint32_t Count;
RSPOpcode op[4];
for (Count = 0; Count < 4; Count++)
@ -1197,11 +1191,11 @@ bool Check_Section_003(void)
static void resampler_hle()
{
UDWORD accum, initial;
DWORD const2 = (DWORD)RSP_Vect[18].u16(4 ^ 7);
uint32_t const2 = (uint32_t)RSP_Vect[18].u16(4 ^ 7);
__int64 const3 = (__int64)((int)RSP_Vect[30].s16(0 ^ 7)) << 16;
// VMUDM $v23, $v31, $v23 [7]
initial.DW = (__int64)((DWORD)RSP_Vect[23].u16(7 ^ 7)) << 16;
initial.DW = (__int64)((uint32_t)RSP_Vect[23].u16(7 ^ 7)) << 16;
// VMADH $v23, $v31, $v22 [7]
initial.W[1] += (int)RSP_Vect[22].s16(7 ^ 7);

View File

@ -1,34 +1,38 @@
#include "Rsp.h"
#include "log.h"
#include "memory.h"
#include "x86.h"
#include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/cpu/RSPRegisters.h>
#include <stdio.h>
#include <windows.h>
#include <Project64-rsp-core/cpu/RspLog.h>
#include <Project64-rsp-core/cpu/RspMemory.h>
#define PUTDST8(dest, value) \
(*((BYTE *)(dest)) = (BYTE)(value)); \
(*((uint8_t *)(dest)) = (uint8_t)(value)); \
dest += 1;
#define PUTDST16(dest, value) \
(*((WORD *)(dest)) = (WORD)(value)); \
(*((uint16_t *)(dest)) = (uint16_t)(value)); \
dest += 2;
#define PUTDST32(dest, value) \
(*((DWORD *)(dest)) = (DWORD)(value)); \
(*((uint32_t *)(dest)) = (uint32_t)(value)); \
dest += 4;
#define PUTDSTPTR(dest, value) \
*(void **)(dest) = (void *)(value); \
dest += sizeof(void *);
char * sse_Strings[8] = {
"xmm0", "xmm1", "xmm2", "xmm3",
"xmm4", "xmm5", "xmm6", "xmm7"};
"xmm0",
"xmm1",
"xmm2",
"xmm3",
"xmm4",
"xmm5",
"xmm6",
"xmm7",
};
#define sse_Name(Reg) (sse_Strings[(Reg)])
void SseMoveAlignedVariableToReg(void * Variable, char * VariableName, int sseReg)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" movaps %s, xmmword ptr [%s]", sse_Name(sseReg), VariableName);
@ -51,7 +55,7 @@ void SseMoveAlignedVariableToReg(void * Variable, char * VariableName, int sseRe
void SseMoveAlignedN64MemToReg(int sseReg, int AddrReg)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" movaps %s, xmmword ptr [Dmem+%s]", sse_Name(sseReg), x86_Name(AddrReg));
@ -85,7 +89,7 @@ void SseMoveAlignedN64MemToReg(int sseReg, int AddrReg)
void SseMoveAlignedRegToVariable(int sseReg, void * Variable, char * VariableName)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" movaps xmmword ptr [%s], %s", VariableName, sse_Name(sseReg));
@ -108,7 +112,7 @@ void SseMoveAlignedRegToVariable(int sseReg, void * Variable, char * VariableNam
void SseMoveAlignedRegToN64Mem(int sseReg, int AddrReg)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" movaps xmmword ptr [Dmem+%s], %s", x86_Name(AddrReg), sse_Name(sseReg));
@ -142,7 +146,7 @@ void SseMoveAlignedRegToN64Mem(int sseReg, int AddrReg)
void SseMoveUnalignedVariableToReg(void * Variable, char * VariableName, int sseReg)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" movups %s, xmmword ptr [%s]", sse_Name(sseReg), VariableName);
@ -165,7 +169,7 @@ void SseMoveUnalignedVariableToReg(void * Variable, char * VariableName, int sse
void SseMoveUnalignedN64MemToReg(int sseReg, int AddrReg)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" movups %s, xmmword ptr [Dmem+%s]", sse_Name(sseReg), x86_Name(AddrReg));
@ -199,7 +203,7 @@ void SseMoveUnalignedN64MemToReg(int sseReg, int AddrReg)
void SseMoveUnalignedRegToVariable(int sseReg, void * Variable, char * VariableName)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" movups xmmword ptr [%s], %s", VariableName, sse_Name(sseReg));
@ -222,7 +226,7 @@ void SseMoveUnalignedRegToVariable(int sseReg, void * Variable, char * VariableN
void SseMoveUnalignedRegToN64Mem(int sseReg, int AddrReg)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" movups xmmword ptr [Dmem+%s], %s", x86_Name(AddrReg), sse_Name(sseReg));
@ -256,7 +260,7 @@ void SseMoveUnalignedRegToN64Mem(int sseReg, int AddrReg)
void SseMoveRegToReg(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" movaps %s, %s", sse_Name(Dest), sse_Name(Source));
@ -289,7 +293,7 @@ void SseMoveRegToReg(int Dest, int Source)
void SseXorRegToReg(int Dest, int Source)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" xorps %s, %s", sse_Name(Dest), sse_Name(Source));
@ -319,9 +323,9 @@ void SseXorRegToReg(int Dest, int Source)
PUTDST8(RecompPos, 0xC0 | x86Command);
}
void SseShuffleReg(int Dest, int Source, BYTE Immed)
void SseShuffleReg(int Dest, int Source, uint8_t Immed)
{
BYTE x86Command = 0;
uint8_t x86Command = 0;
CPU_Message(" shufps %s, %s, %02X", sse_Name(Dest), sse_Name(Source), Immed);

View File

@ -1,3 +1,6 @@
#pragma once
#include <stdint.h>
enum x86RegValues
{
x86_EAX = 0,
@ -37,23 +40,23 @@ enum sseRegValues
void AdcX86RegToX86Reg(int Destination, int Source);
void AdcX86regToVariable(int x86reg, void * Variable, char * VariableName);
void AdcX86regHalfToVariable(int x86reg, void * Variable, char * VariableName);
void AdcConstToX86reg(BYTE Constant, int x86reg);
void AdcConstToVariable(void * Variable, char * VariableName, BYTE Constant);
void AdcConstHalfToVariable(void * Variable, char * VariableName, BYTE Constant);
void AddConstToVariable(DWORD Const, void * Variable, char * VariableName);
void AdcConstToX86reg(uint8_t Constant, int x86reg);
void AdcConstToVariable(void * Variable, char * VariableName, uint8_t Constant);
void AdcConstHalfToVariable(void * Variable, char * VariableName, uint8_t Constant);
void AddConstToVariable(uint32_t Const, void * Variable, char * VariableName);
void AddConstToX86Reg(int x86Reg, size_t Const);
void AddVariableToX86reg(int x86reg, void * Variable, char * VariableName);
void AddX86regToVariable(int x86reg, void * Variable, char * VariableName);
void AddX86regHalfToVariable(int x86reg, void * Variable, char * VariableName);
void AddX86RegToX86Reg(int Destination, int Source);
void AndConstToVariable(DWORD Const, void * Variable, char * VariableName);
void AndConstToX86Reg(int x86Reg, DWORD Const);
void AndConstToVariable(uint32_t Const, void * Variable, char * VariableName);
void AndConstToX86Reg(int x86Reg, uint32_t Const);
void AndVariableToX86Reg(void * Variable, char * VariableName, int x86Reg);
void AndVariableToX86regHalf(void * Variable, char * VariableName, int x86Reg);
void AndX86RegToVariable(void * Variable, char * VariableName, int x86Reg);
void AndX86RegToX86Reg(int Destination, int Source);
void AndX86RegHalfToX86RegHalf(int Destination, int Source);
void X86BreakPoint(LPCSTR FileName, int LineNumber);
void X86BreakPoint(const char * FileName, int LineNumber);
void BsrX86RegToX86Reg(int Destination, int Source);
void Call_Direct(void * FunctAddress, char * FunctName);
void Call_Indirect(void * FunctAddress, char * FunctName);
@ -63,9 +66,9 @@ void CondMoveGreater(int Destination, int Source);
void CondMoveGreaterEqual(int Destination, int Source);
void CondMoveLess(int Destination, int Source);
void CondMoveLessEqual(int Destination, int Source);
void CompConstToVariable(DWORD Const, void * Variable, char * VariableName);
void CompConstHalfToVariable(WORD Const, void * Variable, char * VariableName);
void CompConstToX86reg(int x86Reg, DWORD Const);
void CompConstToVariable(uint32_t Const, void * Variable, char * VariableName);
void CompConstHalfToVariable(uint16_t Const, void * Variable, char * VariableName);
void CompConstToX86reg(int x86Reg, uint32_t Const);
void CompX86regToVariable(int x86Reg, void * Variable, char * VariableName);
void CompVariableToX86reg(int x86Reg, void * Variable, char * VariableName);
void CompX86RegToX86Reg(int Destination, int Source);
@ -77,48 +80,48 @@ void idivX86reg(int x86reg);
void imulX86reg(int x86reg);
void ImulX86RegToX86Reg(int Destination, int Source);
void IncX86reg(int x86Reg);
void JaeLabel32(char * Label, DWORD Value);
void JaLabel8(char * Label, BYTE Value);
void JaLabel32(char * Label, DWORD Value);
void JbLabel8(char * Label, BYTE Value);
void JbLabel32(char * Label, DWORD Value);
void JeLabel8(char * Label, BYTE Value);
void JeLabel32(char * Label, DWORD Value);
void JgeLabel8(char * Label, BYTE Value);
void JgeLabel32(char * Label, DWORD Value);
void JgLabel8(char * Label, BYTE Value);
void JgLabel32(char * Label, DWORD Value);
void JleLabel8(char * Label, BYTE Value);
void JleLabel32(char * Label, DWORD Value);
void JlLabel8(char * Label, BYTE Value);
void JlLabel32(char * Label, DWORD Value);
void JaeLabel32(char * Label, uint32_t Value);
void JaLabel8(char * Label, uint8_t Value);
void JaLabel32(char * Label, uint32_t Value);
void JbLabel8(char * Label, uint8_t Value);
void JbLabel32(char * Label, uint32_t Value);
void JeLabel8(char * Label, uint8_t Value);
void JeLabel32(char * Label, uint32_t Value);
void JgeLabel8(char * Label, uint8_t Value);
void JgeLabel32(char * Label, uint32_t Value);
void JgLabel8(char * Label, uint8_t Value);
void JgLabel32(char * Label, uint32_t Value);
void JleLabel8(char * Label, uint8_t Value);
void JleLabel32(char * Label, uint32_t Value);
void JlLabel8(char * Label, uint8_t Value);
void JlLabel32(char * Label, uint32_t Value);
void JumpX86Reg(int x86reg);
void JmpLabel8(char * Label, BYTE Value);
void JmpLabel32(char * Label, DWORD Value);
void JneLabel8(char * Label, BYTE Value);
void JneLabel32(char * Label, DWORD Value);
void JnsLabel8(char * Label, BYTE Value);
void JnsLabel32(char * Label, DWORD Value);
void JsLabel32(char * Label, DWORD Value);
void JmpLabel8(char * Label, uint8_t Value);
void JmpLabel32(char * Label, uint32_t Value);
void JneLabel8(char * Label, uint8_t Value);
void JneLabel32(char * Label, uint32_t Value);
void JnsLabel8(char * Label, uint8_t Value);
void JnsLabel32(char * Label, uint32_t Value);
void JsLabel32(char * Label, uint32_t Value);
void LeaSourceAndOffset(int x86DestReg, int x86SourceReg, size_t offset);
void MoveConstByteToN64Mem(BYTE Const, int AddrReg);
void MoveConstHalfToN64Mem(WORD Const, int AddrReg);
void MoveConstByteToVariable(BYTE Const, void * Variable, char * VariableName);
void MoveConstHalfToVariable(WORD Const, void * Variable, char * VariableName);
void MoveConstToN64Mem(DWORD Const, int AddrReg);
void MoveConstToN64MemDisp(DWORD Const, int AddrReg, BYTE Disp);
void MoveConstToVariable(DWORD Const, void * Variable, char * VariableName);
void MoveConstToX86reg(DWORD Const, int x86reg);
void MoveConstByteToN64Mem(uint8_t Const, int AddrReg);
void MoveConstHalfToN64Mem(uint16_t Const, int AddrReg);
void MoveConstByteToVariable(uint8_t Const, void * Variable, char * VariableName);
void MoveConstHalfToVariable(uint16_t Const, void * Variable, char * VariableName);
void MoveConstToN64Mem(uint32_t Const, int AddrReg);
void MoveConstToN64MemDisp(uint32_t Const, int AddrReg, uint8_t Disp);
void MoveConstToVariable(uint32_t Const, void * Variable, char * VariableName);
void MoveConstToX86reg(uint32_t Const, int x86reg);
void MoveOffsetToX86reg(size_t Const, char * VariableName, int x86reg);
void MoveX86regByteToX86regPointer(int Source, int AddrReg);
void MoveX86regHalfToX86regPointer(int Source, int AddrReg);
void MoveX86regHalfToX86regPointerDisp(int Source, int AddrReg, BYTE Disp);
void MoveX86regHalfToX86regPointerDisp(int Source, int AddrReg, uint8_t Disp);
void MoveX86regToX86regPointer(int Source, int AddrReg);
void MoveX86RegToX86regPointerDisp(int Source, int AddrReg, BYTE Disp);
void MoveX86RegToX86regPointerDisp(int Source, int AddrReg, uint8_t Disp);
void MoveX86regPointerToX86regByte(int Destination, int AddrReg);
void MoveX86regPointerToX86regHalf(int Destination, int AddrReg);
void MoveX86regPointerToX86reg(int Destination, int AddrReg);
void MoveN64MemDispToX86reg(int x86reg, int AddrReg, BYTE Disp);
void MoveN64MemDispToX86reg(int x86reg, int AddrReg, uint8_t Disp);
void MoveN64MemToX86reg(int x86reg, int AddrReg);
void MoveN64MemToX86regByte(int x86reg, int AddrReg);
void MoveN64MemToX86regHalf(int x86reg, int AddrReg);
@ -127,20 +130,20 @@ void MoveX86regByteToVariable(int x86reg, void * Variable, char * VariableName);
void MoveX86regHalfToN64Mem(int x86reg, int AddrReg);
void MoveX86regHalfToVariable(int x86reg, void * Variable, char * VariableName);
void MoveX86regToN64Mem(int x86reg, int AddrReg);
void MoveX86regToN64MemDisp(int x86reg, int AddrReg, BYTE Disp);
void MoveX86regToN64MemDisp(int x86reg, int AddrReg, uint8_t Disp);
void MoveX86regToVariable(int x86reg, void * Variable, char * VariableName);
void MoveX86RegToX86Reg(int Source, int Destination);
void MoveVariableToX86reg(void * Variable, char * VariableName, int x86reg);
void MoveVariableToX86regByte(void * Variable, char * VariableName, int x86reg);
void MoveVariableToX86regHalf(void * Variable, char * VariableName, int x86reg);
void MoveSxX86RegHalfToX86Reg(int Source, int Destination);
void MoveSxX86RegPtrDispToX86RegHalf(int AddrReg, BYTE Disp, int Destination);
void MoveSxX86RegPtrDispToX86RegHalf(int AddrReg, uint8_t Disp, int Destination);
void MoveSxN64MemToX86regByte(int x86reg, int AddrReg);
void MoveSxN64MemToX86regHalf(int x86reg, int AddrReg);
void MoveSxVariableToX86regByte(void * Variable, char * VariableName, int x86reg);
void MoveSxVariableToX86regHalf(void * Variable, char * VariableName, int x86reg);
void MoveZxX86RegHalfToX86Reg(int Source, int Destination);
void MoveZxX86RegPtrDispToX86RegHalf(int AddrReg, BYTE Disp, int Destination);
void MoveZxX86RegPtrDispToX86RegHalf(int AddrReg, uint8_t Disp, int Destination);
void MoveZxN64MemToX86regByte(int x86reg, int AddrReg);
void MoveZxN64MemToX86regHalf(int x86reg, int AddrReg);
void MoveZxVariableToX86regByte(void * Variable, char * VariableName, int x86reg);
@ -148,8 +151,8 @@ void MoveZxVariableToX86regHalf(void * Variable, char * VariableName, int x86reg
void MulX86reg(int x86reg);
void NegateX86reg(int x86reg);
void NotX86reg(int x86reg);
void OrConstToVariable(DWORD Const, void * Variable, char * VariableName);
void OrConstToX86Reg(DWORD Const, int x86Reg);
void OrConstToVariable(uint32_t Const, void * Variable, char * VariableName);
void OrConstToX86Reg(uint32_t Const, int x86Reg);
void OrVariableToX86Reg(void * Variable, char * VariableName, int x86Reg);
void OrVariableToX86regHalf(void * Variable, char * VariableName, int x86Reg);
void OrX86RegToVariable(void * Variable, char * VariableName, int x86Reg);
@ -158,7 +161,7 @@ void Popad(void);
void Pushad(void);
void Push(int x86reg);
void Pop(int x86reg);
void PushImm32(char * String, DWORD Value);
void PushImm32(char * String, uint32_t Value);
void Ret(void);
void Seta(int x86reg);
void Setae(int x86reg);
@ -176,32 +179,32 @@ void SetaVariable(void * Variable, char * VariableName);
void SetzVariable(void * Variable, char * VariableName);
void SetnzVariable(void * Variable, char * VariableName);
void ShiftLeftSign(int x86reg);
void ShiftLeftSignImmed(int x86reg, BYTE Immediate);
void ShiftLeftSignVariableImmed(void * Variable, char * VariableName, BYTE Immediate);
void ShiftRightSignImmed(int x86reg, BYTE Immediate);
void ShiftRightSignVariableImmed(void * Variable, char * VariableName, BYTE Immediate);
void ShiftLeftSignImmed(int x86reg, uint8_t Immediate);
void ShiftLeftSignVariableImmed(void * Variable, char * VariableName, uint8_t Immediate);
void ShiftRightSignImmed(int x86reg, uint8_t Immediate);
void ShiftRightSignVariableImmed(void * Variable, char * VariableName, uint8_t Immediate);
void ShiftRightUnsign(int x86reg);
void ShiftRightUnsignImmed(int x86reg, BYTE Immediate);
void ShiftRightUnsignVariableImmed(void * Variable, char * VariableName, BYTE Immediate);
void ShiftLeftDoubleImmed(int Destination, int Source, BYTE Immediate);
void ShiftRightDoubleImmed(int Destination, int Source, BYTE Immediate);
void SubConstFromVariable(DWORD Const, void * Variable, char * VariableName);
void SubConstFromX86Reg(int x86Reg, DWORD Const);
void ShiftRightUnsignImmed(int x86reg, uint8_t Immediate);
void ShiftRightUnsignVariableImmed(void * Variable, char * VariableName, uint8_t Immediate);
void ShiftLeftDoubleImmed(int Destination, int Source, uint8_t Immediate);
void ShiftRightDoubleImmed(int Destination, int Source, uint8_t Immediate);
void SubConstFromVariable(uint32_t Const, void * Variable, char * VariableName);
void SubConstFromX86Reg(int x86Reg, uint32_t Const);
void SubVariableFromX86reg(int x86reg, void * Variable, char * VariableName);
void SubX86RegToX86Reg(int Destination, int Source);
void SubX86regFromVariable(int x86reg, void * Variable, char * VariableName);
void SbbX86RegToX86Reg(int Destination, int Source);
void TestConstToVariable(DWORD Const, void * Variable, char * VariableName);
void TestConstToX86Reg(DWORD Const, int x86reg);
void TestConstToVariable(uint32_t Const, void * Variable, char * VariableName);
void TestConstToX86Reg(uint32_t Const, int x86reg);
void TestX86RegToX86Reg(int Destination, int Source);
void XorConstToX86Reg(int x86Reg, DWORD Const);
void XorConstToX86Reg(int x86Reg, uint32_t Const);
void XorX86RegToX86Reg(int Source, int Destination);
void XorVariableToX86reg(void * Variable, char * VariableName, int x86reg);
void XorX86RegToVariable(void * Variable, char * VariableName, int x86reg);
void XorConstToVariable(void * Variable, char * VariableName, DWORD Const);
void XorConstToVariable(void * Variable, char * VariableName, uint32_t Const);
#define _MMX_SHUFFLE(a, b, c, d) \
((BYTE)(((a) << 6) | ((b) << 4) | ((c) << 2) | (d)))
((uint8_t)(((a) << 6) | ((b) << 4) | ((c) << 2) | (d)))
void MmxMoveRegToReg(int Dest, int Source);
void MmxMoveQwordRegToVariable(int Dest, void * Variable, char * VariableName);
@ -212,16 +215,16 @@ void MmxPandVariableToReg(void * Variable, char * VariableName, int Dest);
void MmxPorRegToReg(int Dest, int Source);
void MmxPorVariableToReg(void * Variable, char * VariableName, int Dest);
void MmxXorRegToReg(int Dest, int Source);
void MmxShuffleMemoryToReg(int Dest, void * Variable, char * VariableName, BYTE Immed);
void MmxShuffleMemoryToReg(int Dest, void * Variable, char * VariableName, uint8_t Immed);
void MmxPcmpeqwRegToReg(int Dest, int Source);
void MmxPmullwRegToReg(int Dest, int Source);
void MmxPmullwVariableToReg(int Dest, void * Variable, char * VariableName);
void MmxPmulhuwRegToReg(int Dest, int Source);
void MmxPmulhwRegToReg(int Dest, int Source);
void MmxPmulhwRegToVariable(int Dest, void * Variable, char * VariableName);
void MmxPsrlwImmed(int Dest, BYTE Immed);
void MmxPsrawImmed(int Dest, BYTE Immed);
void MmxPsllwImmed(int Dest, BYTE Immed);
void MmxPsrlwImmed(int Dest, uint8_t Immed);
void MmxPsrawImmed(int Dest, uint8_t Immed);
void MmxPsllwImmed(int Dest, uint8_t Immed);
void MmxPaddswRegToReg(int Dest, int Source);
void MmxPaddswVariableToReg(int Dest, void * Variable, char * VariableName);
void MmxPaddwRegToReg(int Dest, int Source);
@ -261,7 +264,7 @@ typedef union
#pragma warning(pop)
void SseShuffleReg(int Dest, int Source, BYTE Immed);
void SseShuffleReg(int Dest, int Source, uint8_t Immed);
void x86_SetBranch32b(void * JumpByte, void * Destination);
void x86_SetBranch8b(void * JumpByte, void * Destination);
void x86_SetBranch32b(void * Jumpuint8_t, void * Destination);
void x86_SetBranch8b(void * Jumpuint8_t, void * Destination);

View File

@ -0,0 +1,43 @@
#include "RspSettings.h"
#include "RspSettingsID.h"
#include <Project64-rsp-core/Recompiler/RspRecompilerCPU.h>
#include <Project64-rsp-core/cpu/RSPCpu.h>
#include <Settings/Settings.h>
uint16_t Set_AudioHle = 0, Set_GraphicsHle = 0;
bool GraphicsHle = true, AudioHle, ConditionalMove;
bool DebuggingEnabled = false, Profiling, IndvidualBlock, ShowErrors, BreakOnStart = false, LogRDP = false, LogX86Code = false;
void InitializeRspSetting(void)
{
SetModuleName("RSP");
Set_GraphicsHle = FindSystemSettingId("HLE GFX");
Set_AudioHle = FindSystemSettingId("HLE Audio");
RegisterSetting(Set_BreakOnStart, Data_DWORD_General, "Break on Start", NULL, BreakOnStart, NULL);
RegisterSetting(Set_CPUCore, Data_DWORD_General, "CPU Method", NULL, g_CPUCore, NULL);
RegisterSetting(Set_LogRDP, Data_DWORD_General, "Log RDP", NULL, LogRDP, NULL);
RegisterSetting(Set_LogX86Code, Data_DWORD_General, "Log X86 Code", NULL, LogX86Code, NULL);
RegisterSetting(Set_Profiling, Data_DWORD_General, "Profiling", NULL, Profiling, NULL);
RegisterSetting(Set_IndvidualBlock, Data_DWORD_General, "Individual Block", NULL, IndvidualBlock, NULL);
RegisterSetting(Set_ShowErrors, Data_DWORD_General, "Show Errors", NULL, ShowErrors, NULL);
// Compiler settings
RegisterSetting(Set_CheckDest, Data_DWORD_General, "Check Destination Vector", NULL, Compiler.bDest, NULL);
RegisterSetting(Set_Accum, Data_DWORD_General, "Check Destination Accumulator", NULL, Compiler.bAccum, NULL);
RegisterSetting(Set_Mmx, Data_DWORD_General, "Use MMX", NULL, Compiler.mmx, NULL);
RegisterSetting(Set_Mmx2, Data_DWORD_General, "Use MMX2", NULL, Compiler.mmx2, NULL);
RegisterSetting(Set_Sse, Data_DWORD_General, "Use SSE", NULL, Compiler.sse, NULL);
RegisterSetting(Set_Sections, Data_DWORD_General, "Use precompiled sections", NULL, Compiler.bSections, NULL);
RegisterSetting(Set_ReOrdering, Data_DWORD_General, "Reorder opcodes", NULL, Compiler.bReOrdering, NULL);
RegisterSetting(Set_GPRConstants, Data_DWORD_General, "Detect GPR Constants", NULL, Compiler.bGPRConstants, NULL);
RegisterSetting(Set_Flags, Data_DWORD_General, "Check Flag Usage", NULL, Compiler.bFlags, NULL);
RegisterSetting(Set_AlignVector, Data_DWORD_General, "Assume Vector loads align", NULL, Compiler.bAlignVector, NULL);
RegisterSetting(Set_JumpTableSize, Data_DWORD_Game, "JumpTableSize", NULL, 0x800, NULL);
RegisterSetting(Set_Mfc0Count, Data_DWORD_Game, "Mfc0Count", NULL, 0x0, NULL);
RegisterSetting(Set_SemaphoreExit, Data_DWORD_Game, "SemaphoreExit", NULL, 0x0, NULL);
AudioHle = Set_AudioHle != 0 ? GetSystemSetting(Set_AudioHle) != 0 : false;
GraphicsHle = Set_GraphicsHle != 0 ? GetSystemSetting(Set_GraphicsHle) != 0 : true;
}

View File

@ -0,0 +1,8 @@
#pragma once
#include <stdint.h>
void InitializeRspSetting(void);
extern uint16_t Set_AudioHle, Set_GraphicsHle;
extern bool GraphicsHle, AudioHle, ConditionalMove;
extern bool DebuggingEnabled, Profiling, IndvidualBlock, ShowErrors, BreakOnStart, LogRDP, LogX86Code;

View File

@ -0,0 +1,30 @@
#pragma once
enum
{
Set_BreakOnStart,
Set_CPUCore,
Set_LogRDP,
Set_LogX86Code,
Set_Profiling,
Set_IndvidualBlock,
Set_AccurateEmulation,
Set_ShowErrors,
// Compiler settings
Set_CheckDest,
Set_Accum,
Set_Mmx,
Set_Mmx2,
Set_Sse,
Set_Sections,
Set_ReOrdering,
Set_GPRConstants,
Set_Flags,
Set_AlignVector,
// Game settings
Set_JumpTableSize,
Set_Mfc0Count,
Set_SemaphoreExit
};

View File

@ -1,9 +1,12 @@
#include "RSPCpu.h"
#include "RSPInterpreterCPU.h"
#include "RSPRegisters.h"
#include "RspLog.h"
#include <Common/StdString.h>
#include <Project64-rsp-core\RSPDebugger.h>
#include <Project64-rsp-core\RSPInfo.h>
#include <Project64-rsp-core/RSPDebugger.h>
#include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/Settings/RspSettings.h>
#include <Project64-rsp-core/cpu/RspDma.h>
#include <Settings/Settings.h>
#include <algorithm>
#include <float.h>
@ -408,8 +411,6 @@ void RSP_Cop0_MF(void)
void RSP_Cop0_MT(void)
{
__debugbreak();
#ifdef tofix
if (LogRDP && g_CPUCore == InterpreterCPU)
{
RDP_LogMT0(*PrgCount, RSPOpC.rd, RSP_GPR[RSPOpC.rt].UW);
@ -575,20 +576,19 @@ void RSP_Cop0_MT(void)
}
if ((RSP_GPR[RSPOpC.rt].W & DPC_CLR_PIPE_CTR) != 0)
{
DisplayError("RSP: DPC_STATUS_REG: DPC_CLR_PIPE_CTR");
g_Notify->DisplayError("RSP: DPC_STATUS_REG: DPC_CLR_PIPE_CTR");
}
if ((RSP_GPR[RSPOpC.rt].W & DPC_CLR_CMD_CTR) != 0)
{
DisplayError("RSP: DPC_STATUS_REG: DPC_CLR_CMD_CTR");
g_Notify->DisplayError("RSP: DPC_STATUS_REG: DPC_CLR_CMD_CTR");
}
if ((RSP_GPR[RSPOpC.rt].W & DPC_CLR_CLOCK_CTR) != 0)
{ /* DisplayError("RSP: DPC_STATUS_REG: DPC_CLR_CLOCK_CTR"); */
}
break;
default:
DisplayError("We have not implemented RSP MT CP0 reg %s (%d)", COP0_Name(RSPOpC.rd), RSPOpC.rd);
g_Notify->DisplayError(stdstr_f("We have not implemented RSP MT CP0 reg %s (%d)", COP0_Name(RSPOpC.rd), RSPOpC.rd).c_str());
}
#endif
}
// COP2 functions

View File

@ -1,3 +1,4 @@
#pragma once
#include "RspTypes.h"
enum

View File

@ -2,11 +2,11 @@
#include <stdio.h>
#include <string.h>
#include "Rsp.h"
#include "memory.h"
#include "RSPCpu.h"
#include "RSPRegisters.h"
#include "RspMemory.h"
#include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/cpu/RSPCpu.h>
#include <Project64-rsp-core/cpu/RSPRegisters.h>
#include <Settings/Settings.h>
// #define RSP_SAFE_DMA // Unoptimized DMA transfers
@ -19,13 +19,13 @@ void SP_DMA_READ(void)
if (addr > 0x7FFFFF)
{
DisplayError("SP DMA READ\nSP_DRAM_ADDR_REG not in RDRAM space");
g_Notify->DisplayError("SP DMA READ\nSP_DRAM_ADDR_REG not in RDRAM space");
return;
}
if ((*RSPInfo.SP_RD_LEN_REG & 0xFFF) + 1 + (*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) > 0x1000)
{
DisplayError("SP DMA READ\nCould not fit copy in memory segment");
g_Notify->DisplayError("SP DMA READ\nCould not fit copy in memory segment");
return;
}
@ -87,13 +87,13 @@ void SP_DMA_WRITE(void)
if (addr > 0x7FFFFF)
{
DisplayError("SP DMA WRITE\nSP_DRAM_ADDR_REG not in RDRAM space");
g_Notify->DisplayError("SP DMA WRITE\nSP_DRAM_ADDR_REG not in RDRAM space");
return;
}
if ((*RSPInfo.SP_WR_LEN_REG & 0xFFF) + 1 + (*RSPInfo.SP_MEM_ADDR_REG & 0xFFF) > 0x1000)
{
DisplayError("SP DMA WRITE\nCould not fit copy in memory segment");
g_Notify->DisplayError("SP DMA WRITE\nCould not fit copy in memory segment");
return;
}

View File

@ -1,2 +1,4 @@
#pragma once
void SP_DMA_READ(void);
void SP_DMA_WRITE(void);

View File

@ -1,14 +1,10 @@
#include "RspLog.h"
#include "RSPRegisters.h"
#include <Common/File.h>
#include <Common/Log.h>
#include <Common/StdString.h>
#include <Common/path.h>
#include <stdio.h>
#include <windows.h>
#include "Log.h"
#include "Rsp.h"
#include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/cpu/RSPRegisters.h>
CLog * RDPLog = NULL;
CLog * CPULog = NULL;
@ -95,7 +91,7 @@ void RDP_Message(const char * Message, ...)
RDPLog->Log(Msg.c_str());
}
void RDP_LogMT0(DWORD PC, int Reg, DWORD Value)
void RDP_LogMT0(uint32_t PC, int Reg, uint32_t Value)
{
if (RDPLog == NULL)
{
@ -119,7 +115,7 @@ void RDP_LogMT0(DWORD PC, int Reg, DWORD Value)
}
}
void RDP_LogMF0(DWORD PC, int Reg)
void RDP_LogMF0(uint32_t PC, int Reg)
{
switch (Reg)
{
@ -137,19 +133,19 @@ void RDP_LogDlist(void)
{
return;
}
DWORD Length = *RSPInfo.DPC_END_REG - *RSPInfo.DPC_CURRENT_REG;
uint32_t Length = *RSPInfo.DPC_END_REG - *RSPInfo.DPC_CURRENT_REG;
RDP_Message(" Dlist length = %d bytes", Length);
DWORD Pos = *RSPInfo.DPC_CURRENT_REG;
uint32_t Pos = *RSPInfo.DPC_CURRENT_REG;
while (Pos < *RSPInfo.DPC_END_REG)
{
char Hex[100], Ascii[30];
DWORD count;
uint32_t count;
memset(&Hex, 0, sizeof(Hex));
memset(&Ascii, 0, sizeof(Ascii));
BYTE * Mem = RSPInfo.DMEM;
uint8_t * Mem = RSPInfo.DMEM;
if ((*RSPInfo.DPC_STATUS_REG & DPC_STATUS_XBUS_DMEM_DMA) == 0)
{
Mem = RSPInfo.RDRAM;
@ -185,142 +181,9 @@ void RDP_LogDlist(void)
}
}
void RDP_LogLoc(DWORD /*PC*/)
void RDP_LogLoc(uint32_t /*PC*/)
{
// RDP_Message("%03X %08X %08X %08X %08X %08X %08X %08X %08X %08X %08X %08X %08X",PC, RSP_GPR[26].UW, *(DWORD *)&RSPInfo.IMEM[0xDBC],
// RDP_Message("%03X %08X %08X %08X %08X %08X %08X %08X %08X %08X %08X %08X %08X",PC, RSP_GPR[26].UW, *(uint32_t *)&RSPInfo.IMEM[0xDBC],
// RSP_Flags[0].UW, RSP_Vect[0].UW[0],RSP_Vect[0].UW[1],RSP_Vect[0].UW[2],RSP_Vect[0].UW[3],
// RSP_Vect[28].UW[0],RSP_Vect[28].UW[1],RSP_Vect[28].UW[2],RSP_Vect[28].UW[3],RSP_Vect[31].UW[0]);
}
#ifdef old
#include "RSP Registers.h"
#include "log.h"
#include <windows.h>
#ifdef Log_x86Code
static HANDLE hCPULogFile = NULL;
#endif
#ifdef GenerateLog
static HANDLE hLogFile = NULL;
#endif
#ifdef Log_x86Code
void CPU_Message(char * Message, ...)
{
DWORD dwWritten;
char Msg[400];
va_list ap;
va_start(ap, Message);
vsprintf(Msg, Message, ap);
va_end(ap);
strcat(Msg, "\r\n");
WriteFile(hCPULogFile, Msg, strlen(Msg), &dwWritten, NULL);
}
#endif
#ifdef GenerateLog
void Log_Message(char * Message, ...)
{
DWORD dwWritten;
char Msg[400];
va_list ap;
va_start(ap, Message);
vsprintf(Msg, Message, ap);
va_end(ap);
strcat(Msg, "\r\n");
WriteFile(hLogFile, Msg, strlen(Msg), &dwWritten, NULL);
}
#endif
#ifdef Log_x86Code
void Start_x86_Log(void)
{
char path_buffer[_MAX_PATH], drive[_MAX_DRIVE], dir[_MAX_DIR];
char File[_MAX_PATH];
GetModuleFileName(NULL, path_buffer, _MAX_PATH);
_splitpath(path_buffer, drive, dir, NULL, NULL);
sprintf(File, "%s%s\\RSPx86Log.log", drive, dir);
hCPULogFile = CreateFile(File, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
SetFilePointer(hCPULogFile, 0, NULL, FILE_BEGIN);
}
#endif
#ifdef GenerateLog
void Log_MT_CP0(unsigned int PC, int CP0Reg, int Value)
{
switch (CP0Reg)
{
//case 0: Log_Message("%03X: Stored 0x%08X in SP_MEM_ADDR_REG",PC,Value); break;
//case 1: Log_Message("%03X: Stored 0x%08X in SP_DRAM_ADDR_REG",PC,Value); break;
//case 2: Log_Message("%03X: Stored 0x%08X in SP_RD_LEN_REG",PC,Value); break;
case 3:
//Log_Message("%03X: Stored 0x%08X in SP_WR_LEN_REG",PC,Value);
Log_Message("Instruction: %08X%08X", RSP_GPR[25].UW, RSP_GPR[24].UW);
//Log_Message("");
break;
/*case 4: Log_Message("%03X: Stored 0x%08X in SP_STATUS_REG",PC,Value); break;
case 5: Log_Message("%03X: Stored 0x%08X in SP_DMA_FULL_REG",PC,Value); break;
case 6: Log_Message("%03X: Stored 0x%08X in SP_DMA_BUSY_REG",PC,Value); break;
case 7: Log_Message("%03X: Stored 0x%08X in SP_SEMAPHORE_REG",PC,Value); break;
case 8: Log_Message("%03X: Stored 0x%08X in DPC_START_REG",PC,Value); break;
case 9: Log_Message("%03X: Stored 0x%08X in DPC_END_REG",PC,Value); break;
case 10: Log_Message("%03X: Stored 0x%08X in DPC_CURRENT_REG",PC,Value); break;
case 11: Log_Message("%03X: Stored 0x%08X in DPC_STATUS_REG",PC,Value); break;
case 12: Log_Message("%03X: Stored 0x%08X in DPC_CLOCK_REG",PC,Value); break;
case 13: Log_Message("%03X: Stored 0x%08X in DPC_BUFBUSY_REG",PC,Value); break;
case 14: Log_Message("%03X: Stored 0x%08X in DPC_PIPEBUSY_REG",PC,Value); break;
case 15: Log_Message("%03X: Stored 0x%08X in DPC_TMEM_REG",PC,Value); break;
default:
Log_Message("%03X: Unknown RSP CP0 register %d",PC,CP0Reg);
break;*/
}
}
void Start_Log(void)
{
char path_buffer[_MAX_PATH], drive[_MAX_DRIVE], dir[_MAX_DIR];
char File[_MAX_PATH];
GetModuleFileName(NULL, path_buffer, _MAX_PATH);
_splitpath(path_buffer, drive, dir, NULL, NULL);
sprintf(File, "%s%s\\RSP.log", drive, dir);
hLogFile = CreateFile(File, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
SetFilePointer(hLogFile, 0, NULL, FILE_BEGIN);
}
void Stop_Log(void)
{
if (hLogFile)
{
CloseHandle(hLogFile);
hLogFile = NULL;
}
}
#endif
#ifdef Log_x86Code
void Stop_x86_Log(void)
{
if (hCPULogFile)
{
CloseHandle(hCPULogFile);
hCPULogFile = NULL;
}
}
#endif
#endif

View File

@ -1,4 +1,5 @@
#include <windows.h>
#pragma once
#include <stdint.h>
void StartCPULog(void);
void StopCPULog(void);
@ -8,6 +9,6 @@ void StartRDPLog(void);
void StopRDPLog(void);
void RDP_Message(const char * Message, ...);
void RDP_LogDlist(void);
void RDP_LogMT0(DWORD PC, int Reg, DWORD Value);
void RDP_LogMF0(DWORD PC, int Reg);
void RDP_LogLoc(DWORD PC);
void RDP_LogMT0(uint32_t PC, int Reg, uint32_t Value);
void RDP_LogMF0(uint32_t PC, int Reg);
void RDP_LogLoc(uint32_t PC);

View File

@ -1,48 +1,52 @@
#include <Common/MemoryManagement.h>
#include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/cpu/RSPRegisters.h>
#include <Settings/Settings.h>
#include <stdio.h>
#include <string.h>
enum
{
MaxMaps = 32
};
#include "Rsp.h"
#include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/cpu/RSPRegisters.h>
#include <windows.h>
uint32_t NoOfMaps, MapsCRC[MaxMaps];
uint32_t Table;
BYTE *RecompCode, *RecompCodeSecondary, *RecompPos, *JumpTables;
uint8_t *RecompCode, *RecompCodeSecondary, *RecompPos, *JumpTables;
void ** JumpTable;
int AllocateMemory(void)
{
if (RecompCode == NULL)
if (RecompCode == nullptr)
{
RecompCode = (BYTE *)VirtualAlloc(NULL, 0x00400004, MEM_RESERVE, PAGE_EXECUTE_READWRITE);
RecompCode = (BYTE *)VirtualAlloc(RecompCode, 0x00400000, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
RecompCode = (uint8_t *)AllocateAddressSpace(0x00400004);
RecompCode = (uint8_t *)CommitMemory(RecompCode, 0x00400000, MEM_EXECUTE_READWRITE);
if (RecompCode == NULL)
if (RecompCode == nullptr)
{
DisplayError("Not enough memory for RSP RecompCode!");
g_Notify->DisplayError("Not enough memory for RSP RecompCode!");
return false;
}
}
if (RecompCodeSecondary == NULL)
if (RecompCodeSecondary == nullptr)
{
RecompCodeSecondary = (BYTE *)VirtualAlloc(NULL, 0x00200000, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
if (RecompCodeSecondary == NULL)
RecompCodeSecondary = (uint8_t *)AllocateAddressSpace(0x00200004);
RecompCodeSecondary = (uint8_t *)CommitMemory(RecompCode, 0x00200000, MEM_EXECUTE_READWRITE);
if (RecompCodeSecondary == nullptr)
{
DisplayError("Not enough memory for RSP RecompCode Secondary!");
g_Notify->DisplayError("Not enough memory for RSP RecompCode Secondary!");
return false;
}
}
if (JumpTables == NULL)
if (JumpTables == nullptr)
{
JumpTables = (BYTE *)VirtualAlloc(NULL, 0x1000 * MaxMaps, MEM_COMMIT, PAGE_READWRITE);
if (JumpTables == NULL)
JumpTables = (uint8_t *)AllocateAddressSpace(0x1000 * MaxMaps);
JumpTables = (uint8_t *)CommitMemory(RecompCode, 0x1000 * MaxMaps, MEM_READWRITE);
if (JumpTables == nullptr)
{
DisplayError("Not enough memory for jump table!");
g_Notify->DisplayError("Not enough memory for jump table!");
return false;
}
}
@ -55,13 +59,13 @@ int AllocateMemory(void)
void FreeMemory(void)
{
VirtualFree(RecompCode, 0, MEM_RELEASE);
VirtualFree(JumpTable, 0, MEM_RELEASE);
VirtualFree(RecompCodeSecondary, 0, MEM_RELEASE);
FreeAddressSpace(RecompCode, 0x00400004);
FreeAddressSpace(JumpTable, 0x1000 * MaxMaps);
FreeAddressSpace(RecompCodeSecondary, 0x00200004);
RecompCode = NULL;
JumpTables = NULL;
RecompCodeSecondary = NULL;
RecompCode = nullptr;
JumpTables = nullptr;
RecompCodeSecondary = nullptr;
}
void ResetJumpTables(void)
@ -115,7 +119,7 @@ void RSP_LW_IMEM(uint32_t Addr, uint32_t * Value)
{
if ((Addr & 0x3) != 0)
{
DisplayError("Unaligned RSP_LW_IMEM");
g_Notify->DisplayError("Unaligned RSP_LW_IMEM");
}
*Value = *(uint32_t *)(RSPInfo.IMEM + (Addr & 0xFFF));
}

View File

@ -1,3 +1,5 @@
#pragma once
#include <Project64-rsp-core/cpu/RspTypes.h>
int AllocateMemory(void);

View File

@ -1,12 +1,13 @@
#include "RSPDebuggerUI.h"
#include "Profiling.h"
#include "Recompiler CPU.h"
#include <Project64-rsp-core\RSPInfo.h>
#include <Project64-rsp-core\cpu\RSPCpu.h>
#include <Project64-rsp-core\cpu\RSPInstruction.h>
#include <Project64-rsp\RSP Command.h>
#include <Project64-rsp\breakpoint.h>
#include <Project64-rsp\log.h>
#include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/Recompiler/RspProfiling.h>
#include <Project64-rsp-core/Recompiler/RspRecompilerCPU.h>
#include <Project64-rsp-core/Settings/RspSettings.h>
#include <Project64-rsp-core/cpu/RSPCpu.h>
#include <Project64-rsp-core/cpu/RSPInstruction.h>
#include <Project64-rsp-core/cpu/RspLog.h>
#include <Project64-rsp/RSP Command.h>
#include <Project64-rsp/breakpoint.h>
void UpdateRSPRegistersScreen(void);
void RDP_LogLoc(DWORD /*PC*/);

View File

@ -16,18 +16,20 @@
#include <stdint.h>
#include "Debugger/RSPDebuggerUI.h"
#include "Profiling.h"
#include "RSP Command.h"
#include "Recompiler CPU.h"
#include "Rsp.h"
#include "breakpoint.h"
#include "log.h"
#include "memory.h"
#include "resource.h"
#include <Project64-rsp-core/RSPInfo.h>
#include <Project64-rsp-core/Recompiler/RspProfiling.h>
#include <Project64-rsp-core/Recompiler/RspRecompilerCPU.h>
#include <Project64-rsp-core/Settings/RspSettings.h>
#include <Project64-rsp-core/Settings/RspSettingsID.h>
#include <Project64-rsp-core/Version.h>
#include <Project64-rsp-core/cpu/RSPCpu.h>
#include <Project64-rsp-core/cpu/RSPRegisters.h>
#include <Project64-rsp-core/cpu/RspLog.h>
#include <Project64-rsp-core/cpu/RspMemory.h>
#include <Project64-rsp-core/cpu/RspTypes.h>
void ClearAllx86Code(void);
@ -37,51 +39,12 @@ BOOL CALLBACK CompilerDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
HMENU hRSPMenu = NULL;
#endif
bool GraphicsHle = true, AudioHle, ConditionalMove;
bool DebuggingEnabled = false,
Profiling,
IndvidualBlock,
ShowErrors,
BreakOnStart = false,
LogRDP = false,
LogX86Code = false;
DEBUG_INFO DebugInfo;
void * hinstDLL;
std::unique_ptr<RSPDebuggerUI> g_RSPDebuggerUI;
extern uint8_t * pLastSecondary;
enum
{
Set_BreakOnStart,
Set_CPUCore,
Set_LogRDP,
Set_LogX86Code,
Set_Profiling,
Set_IndvidualBlock,
Set_ShowErrors,
// Compiler settings
Set_CheckDest,
Set_Accum,
Set_Mmx,
Set_Mmx2,
Set_Sse,
Set_Sections,
Set_ReOrdering,
Set_GPRConstants,
Set_Flags,
Set_AlignVector,
// Game settings
Set_JumpTableSize,
Set_Mfc0Count,
Set_SemaphoreExit
};
short Set_AudioHle = 0, Set_GraphicsHle = 0;
// DLL info
const char * AppName(void)
{
@ -446,8 +409,8 @@ void ProcessMenuItem(int ID)
IndvidualBlock = true;
}
}
}
break;
}
case ID_SHOWCOMPILERERRORS:
{
uState = GetMenuState(hRSPMenu, ID_SHOWCOMPILERERRORS, MF_BYCOMMAND);
@ -815,36 +778,7 @@ EXPORT void PluginLoaded(void)
Compiler.bGPRConstants = true;
DetectCpuSpecs();
SetModuleName("RSP");
Set_GraphicsHle = FindSystemSettingId("HLE GFX");
Set_AudioHle = FindSystemSettingId("HLE Audio");
RegisterSetting(Set_BreakOnStart, Data_DWORD_General, "Break on Start", NULL, BreakOnStart, NULL);
RegisterSetting(Set_CPUCore, Data_DWORD_General, "CPU Method", NULL, g_CPUCore, NULL);
RegisterSetting(Set_LogRDP, Data_DWORD_General, "Log RDP", NULL, LogRDP, NULL);
RegisterSetting(Set_LogX86Code, Data_DWORD_General, "Log X86 Code", NULL, LogX86Code, NULL);
RegisterSetting(Set_Profiling, Data_DWORD_General, "Profiling", NULL, Profiling, NULL);
RegisterSetting(Set_IndvidualBlock, Data_DWORD_General, "Individual Block", NULL, IndvidualBlock, NULL);
RegisterSetting(Set_ShowErrors, Data_DWORD_General, "Show Errors", NULL, ShowErrors, NULL);
// Compiler settings
RegisterSetting(Set_CheckDest, Data_DWORD_General, "Check Destination Vector", NULL, Compiler.bDest, NULL);
RegisterSetting(Set_Accum, Data_DWORD_General, "Check Destination Accumulator", NULL, Compiler.bAccum, NULL);
RegisterSetting(Set_Mmx, Data_DWORD_General, "Use MMX", NULL, Compiler.mmx, NULL);
RegisterSetting(Set_Mmx2, Data_DWORD_General, "Use MMX2", NULL, Compiler.mmx2, NULL);
RegisterSetting(Set_Sse, Data_DWORD_General, "Use SSE", NULL, Compiler.sse, NULL);
RegisterSetting(Set_Sections, Data_DWORD_General, "Use precompiled sections", NULL, Compiler.bSections, NULL);
RegisterSetting(Set_ReOrdering, Data_DWORD_General, "Reorder opcodes", NULL, Compiler.bReOrdering, NULL);
RegisterSetting(Set_GPRConstants, Data_DWORD_General, "Detect GPR Constants", NULL, Compiler.bGPRConstants, NULL);
RegisterSetting(Set_Flags, Data_DWORD_General, "Check Flag Usage", NULL, Compiler.bFlags, NULL);
RegisterSetting(Set_AlignVector, Data_DWORD_General, "Assume Vector loads align", NULL, Compiler.bAlignVector, NULL);
RegisterSetting(Set_JumpTableSize, Data_DWORD_Game, "JumpTableSize", NULL, 0x800, NULL);
RegisterSetting(Set_Mfc0Count, Data_DWORD_Game, "Mfc0Count", NULL, 0x0, NULL);
RegisterSetting(Set_SemaphoreExit, Data_DWORD_Game, "SemaphoreExit", NULL, 0x0, NULL);
AudioHle = Set_AudioHle != 0 ? GetSystemSetting(Set_AudioHle) != 0 : false;
GraphicsHle = Set_GraphicsHle != 0 ? GetSystemSetting(Set_GraphicsHle) != 0 : true;
InitializeRspSetting();
SetCPU(g_CPUCore);
}

View File

@ -46,38 +46,16 @@
<ClCompile Include="breakpoint.cpp" />
<ClCompile Include="Debugger\RSPDebuggerUI.cpp" />
<ClCompile Include="Debugger\RSPRegistersUI.cpp" />
<ClCompile Include="dma.cpp" />
<ClCompile Include="log.cpp" />
<ClCompile Include="Main.cpp" />
<ClCompile Include="memory.cpp" />
<ClCompile Include="Mmx.cpp" />
<ClCompile Include="Profiling.cpp" />
<ClCompile Include="Recompiler Analysis.cpp" />
<ClCompile Include="Recompiler CPU.cpp" />
<ClCompile Include="Recompiler Ops.cpp" />
<ClCompile Include="Recompiler Sections.cpp" />
<ClCompile Include="RSP Command.cpp" />
<ClCompile Include="Sse.cpp" />
<ClCompile Include="X86.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="breakpoint.h" />
<ClInclude Include="Debugger\RSPDebuggerUI.h" />
<ClInclude Include="Debugger\RSPRegistersUI.h" />
<ClInclude Include="dma.h" />
<ClInclude Include="Interpreter CPU.h" />
<ClInclude Include="Interpreter Ops.h" />
<ClInclude Include="log.h" />
<ClInclude Include="memory.h" />
<ClInclude Include="Profiling.h" />
<ClInclude Include="Recompiler CPU.h" />
<ClInclude Include="Recompiler Ops.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="RSP Command.h" />
<ClInclude Include="RSP Registers.h" />
<ClInclude Include="Rsp.h" />
<ClInclude Include="RspTypes.h" />
<ClInclude Include="X86.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common\Common.vcxproj">

View File

@ -21,51 +21,18 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="RspTypes.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="breakpoint.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="dma.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Interpreter CPU.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Interpreter Ops.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="log.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="memory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Profiling.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Recompiler CPU.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Recompiler Ops.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="RSP Command.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="RSP Registers.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Rsp.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="X86.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Debugger\RSPRegistersUI.h">
<Filter>Header Files\Debugger</Filter>
</ClInclude>
@ -82,50 +49,17 @@
<ClCompile Include="breakpoint.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="dma.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="log.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="memory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Mmx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Profiling.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Recompiler Analysis.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Recompiler CPU.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Recompiler Ops.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Recompiler Sections.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="RSP Command.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Sse.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="X86.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Debugger\RSPRegistersUI.cpp">
<Filter>Source Files\Debugger</Filter>
</ClCompile>
<ClCompile Include="Debugger\RSPDebuggerUI.cpp">
<Filter>Source Files\Debugger</Filter>
</ClCompile>
<ClCompile Include="RSP Command.cpp">
<Filter>Source Files\Debugger</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -11,6 +11,7 @@
#include <Project64-rsp-core/cpu/RSPInstruction.h>
#include <Project64-rsp-core/cpu/RSPOpcode.h>
#include <Project64-rsp-core/cpu/RSPRegisters.h>
#include <Project64-rsp-core/cpu/RspMemory.h>
#include <Project64-rsp-core/cpu/RspTypes.h>
#define RSP_MaxCommandLines 30
@ -910,7 +911,7 @@ void SetRSPCommandToStepping(void)
Stepping_Commands = true;
}
void SetRSPCommandViewto(UINT NewLocation)
void SetRSPCommandViewto(uint32_t NewLocation)
{
unsigned int location;
char Value[20];

View File

@ -1,3 +1,6 @@
#pragma once
#include <stdint.h>
void DumpRSPCode(void);
void DumpRSPData(void);
void Disable_RSP_Commands_Window(void);
@ -6,7 +9,7 @@ void Enter_RSP_Commands_Window(void);
void RefreshRSPCommands(void);
void SetRSPCommandToRunning(void);
void SetRSPCommandToStepping(void);
void SetRSPCommandViewto(unsigned int NewLocation);
void SetRSPCommandViewto(uint32_t NewLocation);
extern bool Stepping_Commands, WaitingForStep;
extern bool InRSPCommandsWindow;

View File

@ -1,16 +1,8 @@
#pragma once
#include <Project64-plugin-spec/Rsp.h>
#include <Project64-rsp-core/cpu/RspTypes.h>
// Profiling
#define Default_ProfilingOn false
#define Default_IndvidualBlock false
#define Default_ShowErrors false
#define Default_AudioHle false
uint32_t AsciiToHex(char * HexValue);
void DisplayError(char * Message, ...);
extern bool DebuggingEnabled, Profiling, IndvidualBlock, ShowErrors, BreakOnStart, LogRDP, LogX86Code;
extern DEBUG_INFO DebugInfo;
extern void * hinstDLL;