add new per-game settings to the PJ64 RSP

mfc0 exit count and semaphore exit
This commit is contained in:
purplemarshmallow 2016-03-20 17:12:13 +01:00
parent fbcf54f306
commit ca3eacab27
5 changed files with 18 additions and 7 deletions

View File

@ -57,6 +57,7 @@ void BuildInterpreterCPU(void);
void BuildRecompilerCPU(void);
extern HANDLE hMutex;
DWORD Mfc0Count, SemaphoreExit = 0;
void SetCPU(DWORD core)
{

View File

@ -41,3 +41,5 @@ extern OPCODE RSPOpC;
void SetCPU(DWORD core);
void Build_RSP (void);
extern DWORD Mfc0Count, SemaphoreExit;

View File

@ -310,7 +310,7 @@ void RSP_Cop0_MF (void) {
case 4:
RSP_MfStatusCount += 1;
RSP_GPR[RSPOpC.rt].UW = *RSPInfo.SP_STATUS_REG;
if (RSP_MfStatusCount > 10)
if (Mfc0Count != 0 && RSP_MfStatusCount > Mfc0Count)
{
RSP_Running = FALSE;
}
@ -324,7 +324,8 @@ void RSP_Cop0_MF (void) {
} else {
RSP_GPR[RSPOpC.rt].W = *RSPInfo.SP_SEMAPHORE_REG;
*RSPInfo.SP_SEMAPHORE_REG = 1;
RSP_Running = FALSE;
if (SemaphoreExit != 0)
RSP_Running = FALSE;
}
break;
case 8: RSP_GPR[RSPOpC.rt].UW = *RSPInfo.DPC_START_REG ; break;

View File

@ -81,7 +81,7 @@ enum {
Set_ReOrdering, Set_GPRConstants, Set_Flags, Set_AlignVector,
//Game Settings
Set_JumpTableSize
Set_JumpTableSize, Set_Mfc0Count, Set_SemaphoreExit
};
short Set_AudioHle = 0, Set_GraphicsHle = 0;
@ -544,6 +544,8 @@ __declspec(dllexport) void RomOpen (void)
EnableDebugging(true);
}
JumpTableSize = GetSetting(Set_JumpTableSize);
Mfc0Count = GetSetting(Set_Mfc0Count);
SemaphoreExit = GetSetting(Set_SemaphoreExit);
}
/******************************************************************
@ -787,6 +789,8 @@ __declspec(dllexport) void PluginLoaded (void)
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) : false;
GraphicsHle = Set_GraphicsHle != 0 ? GetSystemSetting(Set_GraphicsHle) : true;

View File

@ -1681,9 +1681,11 @@ void Compile_Cop0_MF ( void ) {
case 4:
MoveVariableToX86reg(&RSP_MfStatusCount, "RSP_MfStatusCount", x86_ECX);
MoveVariableToX86reg(RSPInfo.SP_STATUS_REG, "SP_STATUS_REG", x86_EAX);
CompConstToX86reg(x86_ECX, 10);
JbLabel8("label", 10);
MoveConstToVariable(0, &RSP_Running, "RSP_Running");
if (Mfc0Count != 0) {
CompConstToX86reg(x86_ECX, Mfc0Count);
JbLabel8("label", Mfc0Count);
MoveConstToVariable(0, &RSP_Running, "RSP_Running");
}
IncX86reg(x86_ECX);
MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].UW, GPR_Name(RSPOpC.rt));
MoveX86regToVariable(x86_ECX, &RSP_MfStatusCount, "RSP_MfStatusCount");
@ -1705,7 +1707,8 @@ void Compile_Cop0_MF ( void ) {
MoveConstToVariable(0, &RSP_GPR[RSPOpC.rt].W, GPR_Name(RSPOpC.rt));
} else {
MoveVariableToX86reg(RSPInfo.SP_SEMAPHORE_REG, "SP_SEMAPHORE_REG", x86_EAX);
MoveConstToVariable(0, &RSP_Running, "RSP_Running");
if (SemaphoreExit != 0)
MoveConstToVariable(0, &RSP_Running, "RSP_Running");
MoveConstToVariable(1, RSPInfo.SP_SEMAPHORE_REG, "SP_SEMAPHORE_REG");
MoveX86regToVariable(x86_EAX, &RSP_GPR[RSPOpC.rt].W, GPR_Name(RSPOpC.rt));
if (NextInstruction == NORMAL)