Core: More refactoring of the remaining C code

This commit is contained in:
Emmet Young 2012-09-30 16:07:08 +10:00
parent 76ca53f8f2
commit 5c8cad4b5d
15 changed files with 149 additions and 289 deletions

View File

@ -28,203 +28,12 @@ void CC_Core::SetSettings ( )
}
}
void CC_Core::PauseExecution ( void )
{
_BaseSystem->Pause();
}
void CC_Core::RunRsp ( void )
{
try
{
_System->RunRSP();
}
catch (...)
{
char Message[600];
sprintf(Message,"Exception caught\nFile: %s\nLine: %d",__FILE__,__LINE__);
MessageBox(NULL,Message,"Exception",MB_OK);
}
}
void CC_Core::GenerateProfileLog ( void )
{
_BaseSystem->m_Profile.GenerateLog();
}
void CC_Core::ResetTimer ( void )
{
_System->m_Profile.ResetCounters();
}
DWORD CC_Core::StartTimer ( DWORD Address )
{
return _System->m_Profile.StartTimer(Address);
}
DWORD CC_Core::StopTimer ( void )
{
return _System->m_Profile.StopTimer();
}
void PauseExecution ( void )
{
CC_Core::PauseExecution();
}
const char * GetAppName ( void )
{
static stdstr szAppName = _Settings->LoadString(Setting_ApplicationName);
return szAppName.c_str();
}
void GetAutoSaveDir( char * Directory )
{
strcpy(Directory,_Settings->LoadString(Directory_NativeSave).c_str());
}
void GetInstantSaveDir( char * Directory )
{
strcpy(Directory,_Settings->LoadString(Directory_InstantSave).c_str());
}
void SetFpuLocations( void )
{
_Reg->FixFpuLocations();
}
BOOL Limit_FPS ( void )
{
return _Settings->LoadDword(GameRunning_LimitFPS);
}
void RunRsp( void )
{
CC_Core::RunRsp();
}
void SyncSystem (void)
{
_BaseSystem->SyncCPU(_SyncSystem);
}
void ApplyGSButtonCheats ( void )
{
CC_Core::ApplyGSButtonCheats(_BaseSystem);
}
void ChangePluginFunc ( void )
{
_Notify->DisplayMessage(0,MSG_PLUGIN_INIT);
if (_Settings->LoadBool(Plugin_GFX_Changed))
{
_Plugins->Reset(PLUGIN_TYPE_GFX);
}
if (_Settings->LoadBool(Plugin_AUDIO_Changed))
{
_Plugins->Reset(PLUGIN_TYPE_AUDIO);
}
if (_Settings->LoadBool(Plugin_CONT_Changed))
{
_Plugins->Reset(PLUGIN_TYPE_CONTROLLER);
}
if (_Settings->LoadBool(Plugin_RSP_Changed) ||
_Settings->LoadBool(Plugin_AUDIO_Changed) ||
_Settings->LoadBool(Plugin_GFX_Changed))
{
_Plugins->Reset(PLUGIN_TYPE_RSP);
}
_Settings->SaveBool(Plugin_RSP_Changed, false);
_Settings->SaveBool(Plugin_AUDIO_Changed,false);
_Settings->SaveBool(Plugin_GFX_Changed, false);
_Settings->SaveBool(Plugin_CONT_Changed, false);
_Notify->RefreshMenu();
if (!_Plugins->Initiate())
{
_Notify->DisplayMessage(5,MSG_PLUGIN_NOT_INIT);
_BaseSystem->m_EndEmulation = true;
} else {
//CC_Core::SetCurrentSystem(_N64System);
}
_Recompiler->ResetRecompCode();
}
void ChangeFullScreenFunc ( void )
{
_Notify->ChangeFullScreen();
}
BOOL Machine_LoadState ( void )
{
bool Result = CC_Core::LoadState(_System);
//CC_Core::SetCurrentSystem(_N64System);
return Result;
}
void ResetTimer ( void )
{
CC_Core::ResetTimer();
}
void GenerateProfileLog ( void )
{
CC_Core::GenerateProfileLog();
}
DWORD StartTimer ( DWORD Address )
{
return CC_Core::StartTimer(Address);
}
DWORD StopTimer ( void )
{
return CC_Core::StopTimer();
}
BOOL Machine_SaveState ( void )
{
return CC_Core::SaveState(_BaseSystem);
}
void BreakPoint(LPCSTR FileName, int LineNumber )
{
if (_Notify)
{
_Notify->BreakPoint(FileName,LineNumber);
}
}
void CC_Core::ApplyGSButtonCheats (CN64System * System)
{
if (System == NULL)
{
return;
}
if (System->m_Cheats.CheatsSlectionChanged())
{
System->m_Cheats.LoadCheats(false);
}
System->m_Cheats.ApplyGSButton(_MMU);
}
void CC_Core::ApplyCheats (CN64System * System)
{
if (System == NULL)
{
return;
}
if (System->m_Cheats.CheatsSlectionChanged())
{
System->m_Cheats.LoadCheats(false);
}
System->m_Cheats.ApplyCheats(_MMU);
}
void ApplyCheats (void)
{
CC_Core::ApplyCheats(_BaseSystem);
}
void CloseSaveChips ( void )
{
CloseMempak();

View File

@ -10,16 +10,6 @@ class CC_Core
{
public:
static void SetSettings ( );
static void RunRsp (void );
static void ApplyCheats (CN64System * System );
static void ApplyGSButtonCheats (CN64System * System );
static void PauseExecution ( void );
static bool LoadState (CN64System * System ) { return System->LoadState(); }
static bool SaveState (CN64System * System ) { return System->SaveState(); }
static void GenerateProfileLog ( void );
static void ResetTimer ( void );
static DWORD StartTimer ( DWORD Address );
static DWORD StopTimer ( void );
};
#endif
@ -32,31 +22,8 @@ extern "C" {
#include "..\\Types.h"
const char * GetAppName ( void );
void PauseExecution ( void );
void GetAutoSaveDir ( char * Directory );
void GetInstantSaveDir ( char * Directory );
void SetFpuLocations ( void );
BOOL Limit_FPS ( void );
void ChangePluginFunc ( void );
void ApplyGSButtonCheats ( void );
void ChangeFullScreenFunc ( void );
void StartInterpreterCPU ( void );
void SyncSystem ( void );
BOOL Machine_LoadState ( void );
BOOL Machine_SaveState ( void );
void BreakPoint ( LPCSTR FileName, int LineNumber );
void ApplyCheats ( void );
void RunRsp ( void );
void RefreshScreen ( void );
void CloseSaveChips ( void );
//Timer functions
void ResetTimer ( void );
void GenerateProfileLog ( void );
DWORD StartTimer ( DWORD Address );
DWORD StopTimer ( void );
//settings
extern BOOL g_HaveDebugger, g_AudioSignal;
extern DWORD g_RomFileSize, g_CountPerOp;

View File

@ -41,7 +41,7 @@ void LoadMempak (void) {
memcpy(&Mempak[count][0],Initilize,sizeof(Initilize));
}
GetAutoSaveDir(Directory);
strcpy(Directory,_Settings->LoadString(Directory_NativeSave).c_str());
sprintf(File,"%s%s.mpk",Directory,_Settings->LoadString(Game_GameName).c_str());
hMempakFile = CreateFile(File,GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ,NULL,OPEN_ALWAYS,

View File

@ -1248,7 +1248,7 @@ void R4300iOp32::COP0_MT (void) {
case 12: //Status
if ((_CP0[m_Opcode.rd] ^ _GPR[m_Opcode.rt].UW[0]) != 0) {
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
SetFpuLocations();
_Reg->FixFpuLocations();
} else {
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
}

View File

@ -1842,7 +1842,7 @@ void R4300iOp::COP0_MT (void) {
case 12: //Status
if ((_CP0[m_Opcode.rd] ^ _GPR[m_Opcode.rt].UW[0]) != 0) {
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
SetFpuLocations();
_Reg->FixFpuLocations();
} else {
_CP0[m_Opcode.rd] = _GPR[m_Opcode.rt].UW[0];
}

View File

@ -183,9 +183,9 @@ void CDMA::SP_DMA_READ (void) {
return;
}
if ((_Reg->SP_MEM_ADDR_REG & 3) != 0) { BreakPoint(__FILE__,__LINE__); }
if ((_Reg->SP_DRAM_ADDR_REG & 3) != 0) { BreakPoint(__FILE__,__LINE__); }
if (((_Reg->SP_RD_LEN_REG + 1) & 3) != 0) { BreakPoint(__FILE__,__LINE__); }
if ((_Reg->SP_MEM_ADDR_REG & 3) != 0) { _Notify->BreakPoint(__FILE__,__LINE__); }
if ((_Reg->SP_DRAM_ADDR_REG & 3) != 0) { _Notify->BreakPoint(__FILE__,__LINE__); }
if (((_Reg->SP_RD_LEN_REG + 1) & 3) != 0) { _Notify->BreakPoint(__FILE__,__LINE__); }
memcpy( _MMU->Dmem() + (_Reg->SP_MEM_ADDR_REG & 0x1FFF), _MMU->Rdram() + _Reg->SP_DRAM_ADDR_REG,
_Reg->SP_RD_LEN_REG + 1 );
@ -209,9 +209,9 @@ void CDMA::SP_DMA_WRITE (void) {
return;
}
if ((_Reg->SP_MEM_ADDR_REG & 3) != 0) { BreakPoint(__FILE__,__LINE__); }
if ((_Reg->SP_DRAM_ADDR_REG & 3) != 0) { BreakPoint(__FILE__,__LINE__); }
if (((_Reg->SP_WR_LEN_REG + 1) & 3) != 0) { BreakPoint(__FILE__,__LINE__); }
if ((_Reg->SP_MEM_ADDR_REG & 3) != 0) { _Notify->BreakPoint(__FILE__,__LINE__); }
if ((_Reg->SP_DRAM_ADDR_REG & 3) != 0) { _Notify->BreakPoint(__FILE__,__LINE__); }
if (((_Reg->SP_WR_LEN_REG + 1) & 3) != 0) { _Notify->BreakPoint(__FILE__,__LINE__); }
memcpy( _MMU->Rdram() + _Reg->SP_DRAM_ADDR_REG, _MMU->Dmem() + (_Reg->SP_MEM_ADDR_REG & 0x1FFF),
_Reg->SP_WR_LEN_REG + 1);

View File

@ -216,7 +216,7 @@ BOOL CMipsMemoryVM::LW_VAddr ( DWORD VAddr, DWORD & Value )
// if (LookUpMode == FuncFind_ChangeMemory)
// {
// BreakPoint(__FILE__,__LINE__);
// _Notify->BreakPoint(__FILE__,__LINE__);
// if ( (Command.Hex >> 16) == 0x7C7C) {
// Command.Hex = OrigMem[(Command.Hex & 0xFFFF)].OriginalValue;
// }
@ -737,13 +737,15 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) {
AndConstToVariable(~MI_INTR_SP,&_Reg->MI_INTR_REG,"MI_INTR_REG");
AndConstToVariable(~MI_INTR_SP,&_Reg->m_RspIntrReg,"m_RspIntrReg");
BeforeCallDirect(m_RegWorkingSet);
Call_Direct(RunRsp,"RunRsp");
MoveConstToX86reg((DWORD)_System,x86_ECX);
Call_Direct(AddressOf(&CN64System::RunRSP),"CN64System::RunRSP");
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(&CRegisters::CheckInterrupts),"CRegisters::CheckInterrupts");
AfterCallDirect(m_RegWorkingSet);
} else {
BeforeCallDirect(m_RegWorkingSet);
Call_Direct(RunRsp,"RunRsp");
MoveConstToX86reg((DWORD)_System,x86_ECX);
Call_Direct(AddressOf(&CN64System::RunRSP),"CN64System::RunRSP");
AfterCallDirect(m_RegWorkingSet);
}
}
@ -1397,7 +1399,7 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer )
case 6: ReadPos += 1; break;
case 7: ReadPos += 1; break;
default:
BreakPoint(__FILE__,__LINE__);
_Notify->BreakPoint(__FILE__,__LINE__);
}
break;
case 5: ReadPos += 5; break;
@ -1821,7 +1823,7 @@ int CMipsMemoryVM::LW_NonMemory ( DWORD PAddr, DWORD * Value ) {
mov ToSwap,eax
}
* Value = ToSwap;*/
BreakPoint(__FILE__,__LINE__);
_Notify->BreakPoint(__FILE__,__LINE__);
return TRUE;
}
else if (PAddr < 0x1FC00800)
@ -1839,7 +1841,7 @@ int CMipsMemoryVM::LW_NonMemory ( DWORD PAddr, DWORD * Value ) {
* Value = 0;
return FALSE;
}
BreakPoint(__FILE__,__LINE__);
_Notify->BreakPoint(__FILE__,__LINE__);
break;
default:
*Value = PAddr & 0xFFFF;
@ -2048,7 +2050,11 @@ int CMipsMemoryVM::SW_NonMemory ( DWORD PAddr, DWORD Value ) {
//if (*( DWORD *)(DMEM + 0xFC0) == 1) {
// ChangeTimer(RspTimer,0x30000);
//} else {
RunRsp();
try {
_System->RunRSP();
} catch (...) {
_Notify->BreakPoint(__FILE__,__LINE__);
}
//}
break;
case 0x0404001C: _Reg->SP_SEMAPHORE_REG = 0; break;
@ -2082,7 +2088,11 @@ int CMipsMemoryVM::SW_NonMemory ( DWORD PAddr, DWORD Value ) {
{
if ( ( _Reg->SP_STATUS_REG & SP_STATUS_BROKE ) == 0 )
{
RunRsp();
try {
_System->RunRSP();
} catch (...) {
_Notify->BreakPoint(__FILE__,__LINE__);
}
}
}
}
@ -3828,7 +3838,11 @@ void CMipsMemoryVM::ChangeSpStatus (void)
//if (*( DWORD *)(DMEM + 0xFC0) == 1) {
// ChangeTimer(RspTimer,0x40000);
//} else {
RunRsp();
try {
_System->RunRSP();
} catch (...) {
_Notify->BreakPoint(__FILE__,__LINE__);
}
//}
}

View File

@ -59,11 +59,11 @@ void CSystemEvents::ExecuteEvents ( void )
_System->Reset(true,true);
break;
case SysEvent_Profile_GenerateLogs:
GenerateProfileLog();
_BaseSystem->m_Profile.GenerateLog();
break;
case SysEvent_Profile_StartStop:
case SysEvent_Profile_ResetLogs:
ResetTimer();
_System->m_Profile.ResetCounters();
break;
case SysEvent_ExecuteInterrupt:
_Reg->DoIntrException(false);
@ -93,14 +93,14 @@ void CSystemEvents::ExecuteEvents ( void )
_Reg->DoIntrException(false);
break;
case SysEvent_SaveMachineState:
if (!Machine_SaveState())
if (!_System->SaveState())
{
m_Events.push_back(SysEvent_SaveMachineState);
m_bDoSomething = true;
}
break;
case SysEvent_LoadMachineState:
if (Machine_LoadState())
if (_System->LoadState())
{
bLoadedSave = true;
}
@ -109,10 +109,14 @@ void CSystemEvents::ExecuteEvents ( void )
ChangePluginFunc();
break;
case SysEvent_ChangingFullScreen:
ChangeFullScreenFunc();
_Notify->ChangeFullScreen();
break;
case SysEvent_GSButtonPressed:
ApplyGSButtonCheats();
if (_BaseSystem == NULL)
return;
if (_BaseSystem->m_Cheats.CheatsSlectionChanged())
_BaseSystem->m_Cheats.LoadCheats(false);
_BaseSystem->m_Cheats.ApplyGSButton(_MMU);
break;
case SysEvent_PauseCPU_FromMenu:
if (!_Settings->LoadBool(GameRunning_CPU_Paused))
@ -178,7 +182,7 @@ void CSystemEvents::ExecuteEvents ( void )
if (bPause)
{
PauseExecution();
_BaseSystem->Pause();
}
}

View File

@ -203,14 +203,18 @@ void CSystemTimer::TimerDone (void)
break;
case CSystemTimer::RspTimer:
_SystemTimer->StopTimer(CSystemTimer::RspTimer);
RunRsp();
try {
_System->RunRSP();
} catch (...) {
_Notify->BreakPoint(__FILE__,__LINE__);
}
break;
case CSystemTimer::AiTimer:
_SystemTimer->StopTimer(CSystemTimer::AiTimer);
_Audio->TimerDone();
break;
default:
BreakPoint(__FILE__,__LINE__);
_Notify->BreakPoint(__FILE__,__LINE__);
}
//CheckTimer();
/*if (Profiling) {

View File

@ -964,6 +964,11 @@ void CN64System::SyncCPU (CN64System * const SecondCPU) {
// }
}
void CN64System::SyncSystem()
{
SyncCPU(_SyncSystem);
}
void CN64System::DumpSyncErrors (CN64System * SecondCPU) {
int count;
@ -1555,7 +1560,6 @@ void CN64System::RunRSP ( void ) {
MI_INTR_REG &= ~(MI_INTR_MASK_SP | MI_INTR_MASK_DP);
SP_STATUS_REG &= ~SP_STATUS_SIG2;
}*/
if (bShowCPUPer()) { m_CPU_Usage.StartTimer(CPU_UsageAddr); }
//if (bProfiling) { m_Profile.StartTimer(ProfileAddr); }
@ -1682,7 +1686,14 @@ void CN64System::RefreshScreen ( void ) {
m_CPU_Usage.ShowCPU_Usage();
m_CPU_Usage.StartTimer(CPU_UsageAddr != Timer_None ? CPU_UsageAddr : Timer_R4300 );
}
if ((m_Reg.STATUS_REGISTER & STATUS_IE) != 0 ) { ApplyCheats(); }
if ((m_Reg.STATUS_REGISTER & STATUS_IE) != 0 )
{
if (_BaseSystem == NULL)
return;
if (_BaseSystem->m_Cheats.CheatsSlectionChanged())
_BaseSystem->m_Cheats.LoadCheats(false);
_BaseSystem->m_Cheats.ApplyCheats(_MMU);
}
// if (bProfiling) { m_Profile.StartTimer(ProfilingAddr != Timer_None ? ProfilingAddr : Timer_R4300); }
}

View File

@ -29,6 +29,9 @@ public:
CN64System ( CPlugins * Plugins, bool SavesReadOnly );
virtual ~CN64System ( void );
CProfiling m_Profile;
CCheats m_Cheats;
//Methods
static bool CN64System::RunFileImage ( const char * FileLoc );
@ -45,6 +48,11 @@ public:
void Reset ( bool bInitReg, bool ClearMenory );
bool m_EndEmulation;
void Pause ( void );
void RunRSP ( void );
bool SaveState ( void );
bool LoadState ( LPCSTR FileName );
bool LoadState ( void );
// inline CPlugins * Plugins ( void ) const { return m_Plugins; }
inline bool DmaUsed ( void ) const { return m_DMAUsed; }
inline void SetDmaUsed ( bool DMAUsed) { m_DMAUsed = DMAUsed; }
@ -57,7 +65,7 @@ public:
//For Sync CPU
void UpdateSyncCPU ( CN64System * const SecondCPU, DWORD const Cycles );
void SyncCPU ( CN64System * const SecondCPU );
void SyncSystem ( void );
private:
//Make sure plugins can directly access this information
friend CGfxPlugin;
@ -77,10 +85,6 @@ private:
void ExecuteCPU ( void );
void RefreshScreen ( void );
bool InternalEvent ( void );
void RunRSP ( void );
bool SaveState ( void );
bool LoadState ( LPCSTR FileName );
bool LoadState ( void );
void DumpSyncErrors ( CN64System * SecondCPU );
void StartEmulation2 ( bool NewThread );
bool SetActiveSystem ( bool bActive = true );
@ -99,7 +103,6 @@ private:
//Mark information saying that the CPU has stoped
void CpuStopped ( void );
void Pause ( void );
//Function in CMipsMemory_CallBack
virtual bool WriteToProtectedMemory (DWORD Address, int length);
@ -114,9 +117,8 @@ private:
CMipsMemoryVM m_MMU_VM; //Memory of the n64
CTLB m_TLB;
CRegisters m_Reg;
CCheats m_Cheats;
CFramePerSecond m_FPS;
CProfiling m_CPU_Usage, m_Profile; //used to track the cpu usage
CProfiling m_CPU_Usage; //used to track the cpu usage
CRecompiler * m_Recomp;
CAudio m_Audio;
CSpeedLimitor m_Limitor;

View File

@ -151,14 +151,15 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
}
if (_SyncSystem)
{
Call_Direct(SyncSystem, "SyncSystem");
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
#ifdef LinkBlocks
if (bSMM_ValidFunc == false)
{
if (LookUpMode() == FuncFind_ChangeMemory)
{
BreakPoint(__FILE__,__LINE__);
_Notify->BreakPoint(__FILE__,__LINE__);
// BYTE * Jump, * Jump2;
// if (TargetPC >= 0x80000000 && TargetPC < 0xC0000000) {
// DWORD pAddr = TargetPC & 0x1FFFFFFF;
@ -244,7 +245,11 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
case CExitInfo::DoCPU_Action:
MoveConstToX86reg((DWORD)_SystemEvents,x86_ECX);
Call_Direct(AddressOf(&CSystemEvents::ExecuteEvents),"CSystemEvents::ExecuteEvents");
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
//_System->SyncCPU(_SyncSystem);
ExitCodeBlock();
break;
case CExitInfo::DoSysCall:
@ -253,7 +258,10 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
PushImm32(bDelay ? "true" : "false", bDelay);
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(&CRegisters::DoSysCallException), "CRegisters::DoSysCallException");
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
ExitCodeBlock();
}
break;
@ -264,7 +272,10 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
PushImm32(bDelay ? "true" : "false", bDelay);
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(&CRegisters::DoCopUnusableException), "CRegisters::DoCopUnusableException");
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
ExitCodeBlock();
}
break;
@ -274,7 +285,10 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
if (m_NextInstruction == JUMP || m_NextInstruction == DELAY_SLOT) {
X86BreakPoint(__FILE__,__LINE__);
}
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
X86BreakPoint(__FILE__,__LINE__);
MoveVariableToX86reg(this,"this",x86_ECX);
Call_Direct(AddressOf(ResetRecompCode), "ResetRecompCode");
@ -287,7 +301,10 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
PushImm32(m_NextInstruction == JUMP || m_NextInstruction == DELAY_SLOT);
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(&CRegisters::DoTLBReadMiss),"CRegisters::DoTLBReadMiss");
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
ExitCodeBlock();
break;
default:
@ -355,7 +372,10 @@ void CCodeSection::GenerateSectionLinkage (void)
m_RegWorkingSet.WriteBackRegisters();
UpdateCounters(m_RegWorkingSet,false,true);
// WriteBackRegisters(Section);
// if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
// if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
// MoveConstToVariable(DELAY_SLOT,&m_NextInstruction,"m_NextInstruction");
PushImm32(stdstr_f("0x%08X",CompilePC() + 4).c_str(),CompilePC() + 4);
@ -446,7 +466,10 @@ void CCodeSection::GenerateSectionLinkage (void)
CPU_Message("PermLoop *** 1");
MoveConstToVariable(JumpInfo[i]->TargetPC,_PROGRAM_COUNTER,"PROGRAM_COUNTER");
UpdateCounters(JumpInfo[i]->RegSet,false, true);
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
//JumpInfo[i]->RegSet.BlockCycleCount() -= CountPerOp();
Call_Direct(InPermLoop,"InPermLoop");
@ -533,7 +556,7 @@ void CCodeSection::GenerateSectionLinkage (void)
}
if (JumpInfo[i]->TargetPC != TargetSection[i]->m_EnterPC) {
_Notify->DisplayError("I need to add more code in GenerateSectionLinkage cause this is going to cause an exception");
BreakPoint(__FILE__,__LINE__);
_Notify->BreakPoint(__FILE__,__LINE__);
}
if (TargetSection[i]->m_CompiledLocation == NULL)
{
@ -942,7 +965,10 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
m_RegWorkingSet.WriteBackRegisters();
UpdateCounters(m_RegWorkingSet,false,true);
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
}*/
/*if ((m_CompilePC == 0x8031C0E4 || m_CompilePC == 0x8031C118 ||
@ -952,7 +978,10 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
m_RegWorkingSet.WriteBackRegisters();
UpdateCounters(m_RegWorkingSet,false,true);
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
}*/
/*if ((m_CompilePC == 0x80263900) && m_NextInstruction == NORMAL)
@ -965,7 +994,10 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
m_RegWorkingSet.WriteBackRegisters();
UpdateCounters(m_RegWorkingSet,false,true);
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
}*/
/*if ((m_CompilePC == 0x80324E14) && m_NextInstruction == NORMAL)
{
@ -977,14 +1009,20 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
m_RegWorkingSet.WriteBackRegisters();
UpdateCounters(m_RegWorkingSet,false,true);
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
}*/
/*if (m_CompilePC >= 0x80324E00 && m_CompilePC <= 0x80324E18 && m_NextInstruction == NORMAL)
{
m_RegWorkingSet.WriteBackRegisters();
UpdateCounters(m_RegWorkingSet,false,true);
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
}*/
/* if (m_CompilePC == 0x803245CC && m_NextInstruction == NORMAL)
{

View File

@ -4111,7 +4111,9 @@ void CRecompilerOps::COP0_MT (void) {
JeLabel8("FpuFlagFine",0);
Jump = m_RecompPos - 1;
BeforeCallDirect(m_RegWorkingSet);
Call_Direct(SetFpuLocations,"SetFpuLocations");
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(&CRegisters::FixFpuLocations),"CRegisters::FixFpuLocations");
AfterCallDirect(m_RegWorkingSet);
SetJump8(Jump,m_RecompPos);
@ -5073,8 +5075,10 @@ void CRecompilerOps::UnknownOpcode (void) {
m_RegWorkingSet.WriteBackRegisters();
UpdateCounters(m_RegWorkingSet,false,true);
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - CountPerOp());
MoveConstToVariable(m_Opcode.Hex, &R4300iOp::m_Opcode.Hex, "R4300iOp::m_Opcode.Hex");
@ -5177,7 +5181,10 @@ void CRecompilerOps::CompileSystemCheck (DWORD TargetPC, CRegInfo RegSet)
RegSet.WriteBackRegisters();
MoveConstToX86reg((DWORD)_SystemEvents,x86_ECX);
Call_Direct(AddressOf(&CSystemEvents::ExecuteEvents),"CSystemEvents::ExecuteEvents");
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
ExitCodeBlock();
CPU_Message("");
CPU_Message(" $Continue_From_Interrupt_Test:");
@ -5189,7 +5196,10 @@ void CRecompilerOps::OverflowDelaySlot (BOOL TestTimer)
m_RegWorkingSet.WriteBackRegisters();
UpdateCounters(m_RegWorkingSet,false,true);
MoveConstToVariable(CompilePC() + 4,_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); }
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
MoveConstToVariable(JUMP,&R4300iOp::m_NextInstruction,"R4300iOp::m_NextInstruction");
if (TestTimer)
{
@ -5207,7 +5217,8 @@ void CRecompilerOps::OverflowDelaySlot (BOOL TestTimer)
if (_SyncSystem)
{
UpdateSyncCPU(m_RegWorkingSet,CountPerOp());
Call_Direct(SyncSystem, "SyncSystem");
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
ExitCodeBlock();
m_NextInstruction = END_BLOCK;

View File

@ -426,7 +426,7 @@ CRegInfo::x86Reg CRegInfo::Map_MemoryStack ( x86Reg Reg, bool bMapRegister, bool
if (Reg == x86_Unknown)
{
_Notify->DisplayError("Map_MemoryStack\n\nOut of registers");
BreakPoint(__FILE__,__LINE__);
_Notify->BreakPoint(__FILE__,__LINE__);
}
SetX86Mapped(Reg,CRegInfo::Stack_Mapped);
CPU_Message(" regcache: allocate %s as Memory Stack",x86_Name(Reg));
@ -473,7 +473,7 @@ void CRegInfo::Map_GPR_32bit (int MipsReg, BOOL SignValue, int MipsRegToLoad)
if (Reg < 0) {
#ifndef EXTERNAL_RELEASE
_Notify->DisplayError("Map_GPR_32bit\n\nOut of registers");
BreakPoint(__FILE__,__LINE__);
_Notify->BreakPoint(__FILE__,__LINE__);
#endif
return;
}
@ -1122,7 +1122,7 @@ void CRegInfo::WriteBackRegisters ()
#ifndef EXTERNAL_RELEASE
default:
_Notify->DisplayError("Unknown State: %d\nin WriteBackRegisters",MipsRegState(count));
BreakPoint(__FILE__,__LINE__);
_Notify->BreakPoint(__FILE__,__LINE__);
#endif
}
}

View File

@ -475,12 +475,12 @@ void CX86Ops::JmpIndirectReg( x86Reg reg ) {
case x86_ESP:
PUTDST8(m_RecompPos,0xff);
PUTDST16(m_RecompPos,0x2434);
/* BreakPoint(__FILE__,__LINE__); */
/* _Notify->BreakPoint(__FILE__,__LINE__); */
break;
case x86_EBP:
PUTDST8(m_RecompPos,0xff);
PUTDST16(m_RecompPos,0x0065);
/* BreakPoint(__FILE__,__LINE__); */
/* _Notify->BreakPoint(__FILE__,__LINE__); */
break;
}
}