Global Variable: rename _System to g_System

This commit is contained in:
zilmar 2012-11-17 12:07:04 +11:00
parent d09a8adf10
commit 299df0e293
15 changed files with 62 additions and 62 deletions

View File

@ -207,10 +207,10 @@ void CInterpreterCPU::InPermLoop (void) {
//CurrentPercent = 0;
//DisplayFPS();
g_Notify->DisplayError(GS(MSG_PERM_LOOP));
_System->CloseCpu();
g_System->CloseCpu();
} else {
/* check sound playing */
_System->SyncToAudio();
g_System->SyncToAudio();
/* check RSP running */
/* check RDP running */
@ -224,7 +224,7 @@ void CInterpreterCPU::InPermLoop (void) {
void CInterpreterCPU::ExecuteCPU (void )
{
bool & Done = _System->m_EndEmulation;
bool & Done = g_System->m_EndEmulation;
DWORD & PROGRAM_COUNTER = *_PROGRAM_COUNTER;
OPCODE & Opcode = R4300iOp::m_Opcode;
DWORD & JumpToLocation = R4300iOp::m_JumpToLocation;
@ -306,7 +306,7 @@ void CInterpreterCPU::ExecuteCPU (void )
void CInterpreterCPU::ExecuteOps ( int Cycles )
{
bool & Done = _System->m_EndEmulation;
bool & Done = g_System->m_EndEmulation;
DWORD & PROGRAM_COUNTER = *_PROGRAM_COUNTER;
OPCODE & Opcode = R4300iOp::m_Opcode;
DWORD & JumpToLocation = R4300iOp::m_JumpToLocation;

View File

@ -2362,7 +2362,7 @@ void R4300iOp::UnknownOpcode (void)
{
g_Notify->DisplayError("%s: %08X\n%s\n\nStopping Emulation !", GS(MSG_UNHANDLED_OP), (*_PROGRAM_COUNTER),
R4300iOpcodeName(m_Opcode.Hex,(*_PROGRAM_COUNTER)));
_System->m_EndEmulation = true;
g_System->m_EndEmulation = true;
g_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix

View File

@ -31,8 +31,8 @@ void CDMA::PI_DMA_READ (void) {
}
if ( _Reg->PI_CART_ADDR_REG >= 0x08000000 && _Reg->PI_CART_ADDR_REG <= 0x08010000) {
if (_System->m_SaveUsing == SaveChip_Auto) { _System->m_SaveUsing = SaveChip_Sram; }
if (_System->m_SaveUsing == SaveChip_Sram) {
if (g_System->m_SaveUsing == SaveChip_Auto) { g_System->m_SaveUsing = SaveChip_Sram; }
if (g_System->m_SaveUsing == SaveChip_Sram) {
m_Sram.DmaToSram(
_MMU->Rdram() + _Reg->PI_DRAM_ADDR_REG,
_Reg->PI_CART_ADDR_REG - 0x08000000,
@ -43,7 +43,7 @@ void CDMA::PI_DMA_READ (void) {
_Reg->CheckInterrupts();
return;
}
if (_System->m_SaveUsing == SaveChip_FlashRam) {
if (g_System->m_SaveUsing == SaveChip_FlashRam) {
m_FlashRam.DmaToFlashram(
_MMU->Rdram()+_Reg->PI_DRAM_ADDR_REG,
_Reg->PI_CART_ADDR_REG - 0x08000000,
@ -55,7 +55,7 @@ void CDMA::PI_DMA_READ (void) {
return;
}
}
if (_System->m_SaveUsing == SaveChip_FlashRam)
if (g_System->m_SaveUsing == SaveChip_FlashRam)
{
g_Notify->DisplayError("**** FLashRam DMA Read address %X *****",_Reg->PI_CART_ADDR_REG);
_Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY;
@ -85,8 +85,8 @@ void CDMA::PI_DMA_WRITE (void) {
}
if ( _Reg->PI_CART_ADDR_REG >= 0x08000000 && _Reg->PI_CART_ADDR_REG <= 0x08010000) {
if (_System->m_SaveUsing == SaveChip_Auto) { _System->m_SaveUsing = SaveChip_Sram; }
if (_System->m_SaveUsing == SaveChip_Sram) {
if (g_System->m_SaveUsing == SaveChip_Auto) { g_System->m_SaveUsing = SaveChip_Sram; }
if (g_System->m_SaveUsing == SaveChip_Sram) {
m_Sram.DmaFromSram(
_MMU->Rdram()+_Reg->PI_DRAM_ADDR_REG,
_Reg->PI_CART_ADDR_REG - 0x08000000,
@ -97,7 +97,7 @@ void CDMA::PI_DMA_WRITE (void) {
_Reg->CheckInterrupts();
return;
}
if (_System->m_SaveUsing == SaveChip_FlashRam) {
if (g_System->m_SaveUsing == SaveChip_FlashRam) {
m_FlashRam.DmaFromFlashram(
_MMU->Rdram()+_Reg->PI_DRAM_ADDR_REG,
_Reg->PI_CART_ADDR_REG - 0x08000000,
@ -140,9 +140,9 @@ void CDMA::PI_DMA_WRITE (void) {
}
_Reg->PI_CART_ADDR_REG += 0x10000000;
if (!_System->DmaUsed())
if (!g_System->DmaUsed())
{
_System->SetDmaUsed(true);
g_System->SetDmaUsed(true);
OnFirstDMA();
}
if (_Recompiler && _Recompiler->bSMM_PIDMA())

View File

@ -26,11 +26,11 @@ void CEeprom::EepromCommand ( BYTE * Command) {
time_t curtime_time;
struct tm curtime;
if (_System->m_SaveUsing == SaveChip_Auto) { _System->m_SaveUsing = SaveChip_Eeprom_4K; }
if (g_System->m_SaveUsing == SaveChip_Auto) { g_System->m_SaveUsing = SaveChip_Eeprom_4K; }
switch (Command[2]) {
case 0: // check
if (_System->m_SaveUsing != SaveChip_Eeprom_4K && _System->m_SaveUsing != SaveChip_Eeprom_16K) {
if (g_System->m_SaveUsing != SaveChip_Eeprom_4K && g_System->m_SaveUsing != SaveChip_Eeprom_16K) {
Command[1] |= 0x80;
break;
}
@ -40,12 +40,12 @@ void CEeprom::EepromCommand ( BYTE * Command) {
if ((Command[1] & 3) > 0)
Command[3] = 0x00;
if ((Command[1] & 3) > 1)
Command[4] = (_System->m_SaveUsing == SaveChip_Eeprom_4K) ? 0x80 : 0xC0;
Command[4] = (g_System->m_SaveUsing == SaveChip_Eeprom_4K) ? 0x80 : 0xC0;
if ((Command[1] & 3) > 2)
Command[5] = 0x00;
} else {
Command[3] = 0x00;
Command[4] = _System->m_SaveUsing == SaveChip_Eeprom_4K?0x80:0xC0;
Command[4] = g_System->m_SaveUsing == SaveChip_Eeprom_4K?0x80:0xC0;
Command[5] = 0x00;
}
break;

View File

@ -755,14 +755,14 @@ void CMipsMemoryVM::Compile_SW_Const ( DWORD Value, DWORD VAddr ) {
AndConstToVariable((DWORD)~MI_INTR_SP,&_Reg->MI_INTR_REG,"MI_INTR_REG");
AndConstToVariable((DWORD)~MI_INTR_SP,&_Reg->m_RspIntrReg,"m_RspIntrReg");
BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_System,x86_ECX);
MoveConstToX86reg((DWORD)g_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);
MoveConstToX86reg((DWORD)_System,x86_ECX);
MoveConstToX86reg((DWORD)g_System,x86_ECX);
Call_Direct(AddressOf(&CN64System::RunRSP),"CN64System::RunRSP");
AfterCallDirect(m_RegWorkingSet);
}
@ -1862,8 +1862,8 @@ int CMipsMemoryVM::LW_NonMemory ( DWORD PAddr, DWORD * Value ) {
*Value = (*Value << 16) | *Value;
return FALSE;
case 0x08000000:
if (_System->m_SaveUsing == SaveChip_Auto) { _System->m_SaveUsing = SaveChip_FlashRam; }
if (_System->m_SaveUsing != SaveChip_FlashRam) {
if (g_System->m_SaveUsing == SaveChip_Auto) { g_System->m_SaveUsing = SaveChip_FlashRam; }
if (g_System->m_SaveUsing != SaveChip_FlashRam) {
*Value = PAddr & 0xFFFF;
*Value = (*Value << 16) | *Value;
return FALSE;
@ -2104,7 +2104,7 @@ int CMipsMemoryVM::SW_NonMemory ( DWORD PAddr, DWORD Value ) {
// ChangeTimer(RspTimer,0x30000);
//} else {
try {
_System->RunRSP();
g_System->RunRSP();
} catch (...) {
g_Notify->BreakPoint(__FILE__,__LINE__);
}
@ -2142,7 +2142,7 @@ int CMipsMemoryVM::SW_NonMemory ( DWORD PAddr, DWORD Value ) {
if ( ( _Reg->SP_STATUS_REG & SP_STATUS_BROKE ) == 0 )
{
try {
_System->RunRSP();
g_System->RunRSP();
} catch (...) {
g_Notify->BreakPoint(__FILE__,__LINE__);
}
@ -2259,10 +2259,10 @@ int CMipsMemoryVM::SW_NonMemory ( DWORD PAddr, DWORD Value ) {
break;
case 0x04500010:
_Reg->AI_DACRATE_REG = Value;
_Plugins->Audio()->DacrateChanged(_System->m_SystemType);
_Plugins->Audio()->DacrateChanged(g_System->m_SystemType);
if (bFixedAudio())
{
_Audio->SetFrequency(Value,_System->m_SystemType);
_Audio->SetFrequency(Value,g_System->m_SystemType);
}
break;
case 0x04500014: _Reg->AI_BITRATE_REG = Value; break;
@ -2337,8 +2337,8 @@ int CMipsMemoryVM::SW_NonMemory ( DWORD PAddr, DWORD Value ) {
break;
case 0x08000000:
if (PAddr != 0x08010000) { return FALSE; }
if (_System->m_SaveUsing == SaveChip_Auto) { _System->m_SaveUsing = SaveChip_FlashRam; }
if (_System->m_SaveUsing != SaveChip_FlashRam) { return TRUE; }
if (g_System->m_SaveUsing == SaveChip_Auto) { g_System->m_SaveUsing = SaveChip_FlashRam; }
if (g_System->m_SaveUsing != SaveChip_FlashRam) { return TRUE; }
WriteToFlashCommand(Value);
return TRUE;
@ -3904,7 +3904,7 @@ void CMipsMemoryVM::ChangeSpStatus (void)
// ChangeTimer(RspTimer,0x40000);
//} else {
try {
_System->RunRSP();
g_System->RunRSP();
} catch (...) {
g_Notify->BreakPoint(__FILE__,__LINE__);
}

View File

@ -42,7 +42,7 @@ void CSystemEvents::ExecuteEvents ( void )
switch (*iter)
{
case SysEvent_CloseCPU:
_System->m_EndEmulation = true;
g_System->m_EndEmulation = true;
break;
case SysEvent_ResetCPU_Soft:
_SystemTimer->SetTimer(CSystemTimer::SoftResetTimer,0x3000000,false);
@ -52,17 +52,17 @@ void CSystemEvents::ExecuteEvents ( void )
_Plugins->Gfx()->SoftReset();
break;
case SysEvent_ResetCPU_SoftDone:
_System->Reset(true,false);
g_System->Reset(true,false);
break;
case SysEvent_ResetCPU_Hard:
_System->Reset(true,true);
g_System->Reset(true,true);
break;
case SysEvent_Profile_GenerateLogs:
_BaseSystem->m_Profile.GenerateLog();
break;
case SysEvent_Profile_StartStop:
case SysEvent_Profile_ResetLogs:
_System->m_Profile.ResetCounters();
g_System->m_Profile.ResetCounters();
break;
case SysEvent_ExecuteInterrupt:
_Reg->DoIntrException(false);
@ -92,14 +92,14 @@ void CSystemEvents::ExecuteEvents ( void )
_Reg->DoIntrException(false);
break;
case SysEvent_SaveMachineState:
if (!_System->SaveState())
if (!g_System->SaveState())
{
m_Events.push_back(SysEvent_SaveMachineState);
m_bDoSomething = true;
}
break;
case SysEvent_LoadMachineState:
if (_System->LoadState())
if (g_System->LoadState())
{
bLoadedSave = true;
}

View File

@ -175,7 +175,7 @@ void CSystemTimer::TimerDone (void)
break;
case CSystemTimer::SoftResetTimer:
_SystemTimer->StopTimer(CSystemTimer::SoftResetTimer);
_System->ExternalEvent(SysEvent_ResetCPU_SoftDone);
g_System->ExternalEvent(SysEvent_ResetCPU_SoftDone);
break;
case CSystemTimer::SiTimer:
_SystemTimer->StopTimer(CSystemTimer::SiTimer);
@ -192,7 +192,7 @@ void CSystemTimer::TimerDone (void)
case CSystemTimer::ViTimer:
try
{
_System->RefreshScreen();
g_System->RefreshScreen();
}
catch (...)
{
@ -204,7 +204,7 @@ void CSystemTimer::TimerDone (void)
case CSystemTimer::RspTimer:
_SystemTimer->StopTimer(CSystemTimer::RspTimer);
try {
_System->RunRSP();
g_System->RunRSP();
} catch (...) {
g_Notify->BreakPoint(__FILE__,__LINE__);
}

View File

@ -514,14 +514,14 @@ bool CN64System::SetActiveSystem( bool bActive )
{
m_Reg.SetAsCurrentSystem();
if (_System)
if (g_System)
{
_System->m_TestTimer = R4300iOp::m_TestTimer;
_System->m_NextInstruction = R4300iOp::m_NextInstruction;
_System->m_JumpToLocation = R4300iOp::m_JumpToLocation;
g_System->m_TestTimer = R4300iOp::m_TestTimer;
g_System->m_NextInstruction = R4300iOp::m_NextInstruction;
g_System->m_JumpToLocation = R4300iOp::m_JumpToLocation;
}
_System = this;
g_System = this;
if (_BaseSystem == this)
{
_SyncSystem = m_SyncCPU;
@ -556,7 +556,7 @@ bool CN64System::SetActiveSystem( bool bActive )
} else {
if (this == _BaseSystem)
{
_System = NULL;
g_System = NULL;
_SyncSystem = NULL;
_Recompiler = NULL;
_MMU = NULL;

View File

@ -248,7 +248,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
//_System->SyncCPU(_SyncSystem);
//g_System->SyncCPU(_SyncSystem);
ExitCodeBlock();
break;
case CExitInfo::DoSysCall:

View File

@ -339,8 +339,8 @@ void CRecompiler::RecompilerMain_Lookup( void )
if (_SyncSystem)
{
_System->UpdateSyncCPU(_SyncSystem,opsExecuted);
_System->SyncCPU(_SyncSystem);
g_System->UpdateSyncCPU(_SyncSystem,opsExecuted);
g_System->SyncCPU(_SyncSystem);
}
}
}
@ -541,8 +541,8 @@ void CRecompiler::RecompilerMain_Lookup_TLB( void )
if (_SyncSystem)
{
_System->UpdateSyncCPU(_SyncSystem,opsExecuted);
_System->SyncCPU(_SyncSystem);
g_System->UpdateSyncCPU(_SyncSystem,opsExecuted);
g_System->SyncCPU(_SyncSystem);
}
}
}
@ -589,8 +589,8 @@ void CRecompiler::RecompilerMain_Lookup_validate( void )
if (_SyncSystem)
{
_System->UpdateSyncCPU(_SyncSystem,opsExecuted);
_System->SyncCPU(_SyncSystem);
g_System->UpdateSyncCPU(_SyncSystem,opsExecuted);
g_System->SyncCPU(_SyncSystem);
}
}
}
@ -659,8 +659,8 @@ void CRecompiler::RecompilerMain_Lookup_validate_TLB( void )
if (_SyncSystem)
{
_System->UpdateSyncCPU(_SyncSystem,opsExecuted);
_System->SyncCPU(_SyncSystem);
g_System->UpdateSyncCPU(_SyncSystem,opsExecuted);
g_System->SyncCPU(_SyncSystem);
}
}
}

View File

@ -5116,7 +5116,7 @@ void CRecompilerOps::UpdateSyncCPU ( CRegInfo & RegSet, DWORD Cycles )
BeforeCallDirect(RegSet);
PushImm32(stdstr_f("%d",Cycles).c_str(),Cycles);
PushImm32("_SyncSystem",(DWORD)_SyncSystem);
MoveConstToX86reg((DWORD)_System,x86_ECX);
MoveConstToX86reg((DWORD)g_System,x86_ECX);
Call_Direct(AddressOf(&CN64System::UpdateSyncCPU),"CN64System::UpdateSyncCPU");
AfterCallDirect(RegSet);
}

View File

@ -1,6 +1,6 @@
#include "stdafx.h"
CN64System * _System = NULL;
CN64System * g_System = NULL;
CN64System * _BaseSystem = NULL;
CN64System * _SyncSystem = NULL;
CRecompiler * _Recompiler = NULL;

View File

@ -1,7 +1,7 @@
extern CNotification * g_Notify;
extern CSettings * g_Settings;
extern CN64System * _System;
extern CN64System * g_System;
extern CN64System * _BaseSystem;
extern CN64System * _SyncSystem;
extern CRecompiler * _Recompiler;

View File

@ -162,14 +162,14 @@ bool CPlugins::InitiateMainThread( void )
WriteTrace(TraceDebug,"CPlugins::Initiate 6");
WriteTrace(TraceGfxPlugin,"Initiate: Starting");
if (!m_Gfx->Initiate(_System,m_RenderWindow)) { return false; }
if (!m_Gfx->Initiate(g_System,m_RenderWindow)) { return false; }
WriteTrace(TraceGfxPlugin,"Initiate: Done");
WriteTrace(TraceDebug,"CPlugins::Initiate 7");
if (!m_Audio->Initiate(_System,m_RenderWindow)) { return false; }
if (!m_Audio->Initiate(g_System,m_RenderWindow)) { return false; }
WriteTrace(TraceDebug,"CPlugins::Initiate 8");
if (!m_Control->Initiate(_System,m_RenderWindow)) { return false; }
if (!m_Control->Initiate(g_System,m_RenderWindow)) { return false; }
WriteTrace(TraceRSP ,"Initiate: Starting");
if (!m_RSP->Initiate(this,_System)) { return false; }
if (!m_RSP->Initiate(this,g_System)) { return false; }
WriteTrace(TraceRSP,"Initiate: Done");
WriteTrace(TraceDebug,"CPlugins::Initiate 10");

View File

@ -167,7 +167,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD /*FromAccelerator*/, DWORD
char SaveDir[MAX_PATH];
_makepath( SaveDir, drive, dir, NULL, NULL );
g_Settings->SaveString(Directory_LastSave,SaveDir);
_System->SaveState();
g_System->SaveState();
}
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_SaveGame);
}
@ -198,7 +198,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD /*FromAccelerator*/, DWORD
_splitpath( SaveFile, drive, dir, fname, ext );
_makepath( SaveDir, drive, dir, NULL, NULL );
g_Settings->SaveString(Directory_LastSave,SaveDir);
_System->LoadState();
g_System->LoadState();
}
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_LoadGame);
}