Global Variable: Rename _BaseSystem to g_BaseSystem

This commit is contained in:
zilmar 2012-11-17 12:09:19 +11:00
parent 299df0e293
commit c3df4cf49d
14 changed files with 108 additions and 108 deletions

View File

@ -54,7 +54,7 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/,
openfilename.lpstrInitialDir = Directory;
openfilename.nMaxFile = MAX_PATH;
openfilename.Flags = OFN_HIDEREADONLY;
_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
if (GetOpenFileName (&openfilename))
{
char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
@ -65,7 +65,7 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/,
}
SetDlgItemText(IDC_FILENAME,FileName);
}
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
}
break;
case IDOK:
@ -97,14 +97,14 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/,
::EnableWindow(GetDlgItem(IDC_FORMAT),FALSE);
::EnableWindow(GetDlgItem(IDOK),FALSE);
::EnableWindow(GetDlgItem(IDCANCEL),FALSE);
_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_DumpMemory);
if (!DumpMemory(FileName,Format,StartPC,EndPC,DumpPC))
{
//enable buttons
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
return false;
}
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_DumpMemory);
}
EndDialog(0);
break;

View File

@ -501,7 +501,7 @@ void CPifRam::ReadControllerCommand (int Control, BYTE * Command) {
if (Command[0] != 1) { g_Notify->DisplayError("What am I meant to do with this Controller Command"); }
if (Command[1] != 4) { g_Notify->DisplayError("What am I meant to do with this Controller Command"); }
}
*(DWORD *)&Command[3] = _BaseSystem->GetButtons(Control);
*(DWORD *)&Command[3] = g_BaseSystem->GetButtons(Control);
}
break;
case 0x02: //read from controller pack

View File

@ -58,7 +58,7 @@ void CSystemEvents::ExecuteEvents ( void )
g_System->Reset(true,true);
break;
case SysEvent_Profile_GenerateLogs:
_BaseSystem->m_Profile.GenerateLog();
g_BaseSystem->m_Profile.GenerateLog();
break;
case SysEvent_Profile_StartStop:
case SysEvent_Profile_ResetLogs:
@ -111,11 +111,11 @@ void CSystemEvents::ExecuteEvents ( void )
g_Notify->ChangeFullScreen();
break;
case SysEvent_GSButtonPressed:
if (_BaseSystem == NULL)
if (g_BaseSystem == NULL)
return;
if (_BaseSystem->m_Cheats.CheatsSlectionChanged())
_BaseSystem->m_Cheats.LoadCheats(false);
_BaseSystem->m_Cheats.ApplyGSButton(_MMU);
if (g_BaseSystem->m_Cheats.CheatsSlectionChanged())
g_BaseSystem->m_Cheats.LoadCheats(false);
g_BaseSystem->m_Cheats.ApplyGSButton(_MMU);
break;
case SysEvent_PauseCPU_FromMenu:
if (!g_Settings->LoadBool(GameRunning_CPU_Paused))
@ -181,7 +181,7 @@ void CSystemEvents::ExecuteEvents ( void )
if (bPause)
{
_BaseSystem->Pause();
g_BaseSystem->Pause();
}
}
@ -214,7 +214,7 @@ void CSystemEvents::ChangePluginFunc ( void )
if (!_Plugins->Initiate())
{
g_Notify->DisplayMessage(5,MSG_PLUGIN_NOT_INIT);
_BaseSystem->m_EndEmulation = true;
g_BaseSystem->m_EndEmulation = true;
}
_Recompiler->ResetRecompCode();
}

View File

@ -169,28 +169,28 @@ bool CN64System::EmulationStarting ( HANDLE hThread, DWORD ThreadId )
{
bool bRes = true;
if (_BaseSystem)
if (g_BaseSystem)
{
WriteTrace(TraceDebug,"CN64System::stLoadFileImage: Destroying old N64 system");
delete _BaseSystem;
_BaseSystem = NULL;
delete g_BaseSystem;
g_BaseSystem = NULL;
}
WriteTrace(TraceDebug,"CN64System::stLoadFileImage: Hide Rom Browser");
g_Notify->HideRomBrowser();
WriteTrace(TraceDebug,"CN64System::stLoadFileImage: Creating N64 system");
_BaseSystem = new CN64System(_Plugins,false);
g_BaseSystem = new CN64System(_Plugins,false);
WriteTrace(TraceDebug,"CN64System::stLoadFileImage: Setting N64 system as active");
if (_BaseSystem->SetActiveSystem(true))
if (g_BaseSystem->SetActiveSystem(true))
{
_BaseSystem->m_CPU_Handle = hThread;
_BaseSystem->m_CPU_ThreadID = ThreadId;
g_BaseSystem->m_CPU_Handle = hThread;
g_BaseSystem->m_CPU_ThreadID = ThreadId;
WriteTrace(TraceDebug,"CN64System::stLoadFileImage: Setting up N64 system done");
g_Settings->SaveBool(GameRunning_LoadingInProgress,false);
g_Notify->RefreshMenu();
try
{
WriteTrace(TraceDebug,"CN64System::stLoadFileImage: Game set to auto start, starting");
_BaseSystem->StartEmulation2(false);
g_BaseSystem->StartEmulation2(false);
WriteTrace(TraceDebug,"CN64System::stLoadFileImage: Game Done");
}
catch (...)
@ -200,8 +200,8 @@ bool CN64System::EmulationStarting ( HANDLE hThread, DWORD ThreadId )
sprintf(Message,"CN64System::LoadFileImage - Exception caught\nFile: %s\nLine: %d",__FILE__,__LINE__);
MessageBox(NULL,Message,"Exception",MB_OK);
}
_BaseSystem->m_CPU_Handle = NULL;
_BaseSystem->m_CPU_ThreadID = 0;
g_BaseSystem->m_CPU_Handle = NULL;
g_BaseSystem->m_CPU_ThreadID = 0;
} else {
WriteTrace(TraceError,"CN64System::stLoadFileImage: SetActiveSystem failed");
g_Notify->DisplayError("Failed to Initialize N64 System");
@ -210,10 +210,10 @@ bool CN64System::EmulationStarting ( HANDLE hThread, DWORD ThreadId )
bRes = false;
}
if (_BaseSystem)
if (g_BaseSystem)
{
delete _BaseSystem;
_BaseSystem = NULL;
delete g_BaseSystem;
g_BaseSystem = NULL;
}
return bRes;
}
@ -522,7 +522,7 @@ bool CN64System::SetActiveSystem( bool bActive )
}
g_System = this;
if (_BaseSystem == this)
if (g_BaseSystem == this)
{
_SyncSystem = m_SyncCPU;
}
@ -554,7 +554,7 @@ bool CN64System::SetActiveSystem( bool bActive )
bInitPlugin = true;
}
} else {
if (this == _BaseSystem)
if (this == g_BaseSystem)
{
g_System = NULL;
_SyncSystem = NULL;
@ -1721,11 +1721,11 @@ void CN64System::RefreshScreen ( void ) {
}
if ((m_Reg.STATUS_REGISTER & STATUS_IE) != 0 )
{
if (_BaseSystem == NULL)
if (g_BaseSystem == NULL)
return;
if (_BaseSystem->m_Cheats.CheatsSlectionChanged())
_BaseSystem->m_Cheats.LoadCheats(false);
_BaseSystem->m_Cheats.ApplyCheats(_MMU);
if (g_BaseSystem->m_Cheats.CheatsSlectionChanged())
g_BaseSystem->m_Cheats.LoadCheats(false);
g_BaseSystem->m_Cheats.ApplyCheats(_MMU);
}
// if (bProfiling) { m_Profile.StartTimer(ProfilingAddr != Timer_None ? ProfilingAddr : Timer_R4300); }
}

View File

@ -150,7 +150,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
}
if (_SyncSystem)
{
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
#ifdef LinkBlocks
@ -245,7 +245,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
MoveConstToX86reg((DWORD)_SystemEvents,x86_ECX);
Call_Direct(AddressOf(&CSystemEvents::ExecuteEvents),"CSystemEvents::ExecuteEvents");
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
//g_System->SyncCPU(_SyncSystem);
@ -258,7 +258,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(&CRegisters::DoSysCallException), "CRegisters::DoSysCallException");
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
ExitCodeBlock();
@ -272,7 +272,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(&CRegisters::DoCopUnusableException), "CRegisters::DoCopUnusableException");
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
ExitCodeBlock();
@ -285,7 +285,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
X86BreakPoint(__FILE__,__LINE__);
}
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
X86BreakPoint(__FILE__,__LINE__);
@ -301,7 +301,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
MoveConstToX86reg((DWORD)_Reg,x86_ECX);
Call_Direct(AddressOf(&CRegisters::DoTLBReadMiss),"CRegisters::DoTLBReadMiss");
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
ExitCodeBlock();
@ -316,7 +316,7 @@ void CCodeSection::CompileExit ( DWORD JumpPC, DWORD TargetPC, CRegInfo &ExitReg
MoveConstToVariable(0,&_RegHI->UW[0],"_RegHI->UW[0]");
MoveConstToVariable(0,&_RegLO->UW[0],"_RegLO->UW[0]");
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
ExitCodeBlock();
@ -388,7 +388,7 @@ void CCodeSection::GenerateSectionLinkage (void)
UpdateCounters(m_RegWorkingSet,false,true);
// WriteBackRegisters(Section);
// if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
// MoveConstToVariable(DELAY_SLOT,&m_NextInstruction,"m_NextInstruction");
@ -484,7 +484,7 @@ void CCodeSection::GenerateSectionLinkage (void)
MoveConstToVariable(JumpInfo[i]->TargetPC,_PROGRAM_COUNTER,"PROGRAM_COUNTER");
UpdateCounters(JumpInfo[i]->RegSet,false, true);
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
@ -938,7 +938,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
UpdateCounters(m_RegWorkingSet,false,true);
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
}*/
@ -951,7 +951,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
UpdateCounters(m_RegWorkingSet,false,true);
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
}*/
@ -969,7 +969,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) {
BeforeCallDirect(m_RegWorkingSet);
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystemPC), "CN64System::SyncSystemPC");
AfterCallDirect(m_RegWorkingSet);
}
@ -986,7 +986,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
UpdateCounters(m_RegWorkingSet,false,true);
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
}*/
@ -1001,7 +1001,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
UpdateCounters(m_RegWorkingSet,false,true);
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
}*/
@ -1011,7 +1011,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test )
UpdateCounters(m_RegWorkingSet,false,true);
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
}*/

View File

@ -5059,7 +5059,7 @@ void CRecompilerOps::UnknownOpcode (void) {
UpdateCounters(m_RegWorkingSet,false,true);
MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - CountPerOp());
@ -5167,7 +5167,7 @@ void CRecompilerOps::CompileSystemCheck (DWORD TargetPC, const CRegInfo & RegSet
MoveConstToX86reg((DWORD)_SystemEvents,x86_ECX);
Call_Direct(AddressOf(&CSystemEvents::ExecuteEvents),"CSystemEvents::ExecuteEvents");
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
ExitCodeBlock();
@ -5182,7 +5182,7 @@ void CRecompilerOps::OverflowDelaySlot (BOOL TestTimer)
UpdateCounters(m_RegWorkingSet,false,true);
MoveConstToVariable(CompilePC() + 4,_PROGRAM_COUNTER,"PROGRAM_COUNTER");
if (_SyncSystem) {
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
MoveConstToVariable(JUMP,&R4300iOp::m_NextInstruction,"R4300iOp::m_NextInstruction");
@ -5202,7 +5202,7 @@ void CRecompilerOps::OverflowDelaySlot (BOOL TestTimer)
if (_SyncSystem)
{
UpdateSyncCPU(m_RegWorkingSet,CountPerOp());
MoveConstToX86reg((DWORD)_BaseSystem,x86_ECX);
MoveConstToX86reg((DWORD)g_BaseSystem,x86_ECX);
Call_Direct(AddressOf(&CN64System::SyncSystem), "CN64System::SyncSystem");
}
ExitCodeBlock();

View File

@ -1,7 +1,7 @@
#include "stdafx.h"
CN64System * g_System = NULL;
CN64System * _BaseSystem = NULL;
CN64System * g_BaseSystem = NULL;
CN64System * _SyncSystem = NULL;
CRecompiler * _Recompiler = NULL;
CMipsMemory * _MMU = NULL; //Memory of the n64

View File

@ -2,7 +2,7 @@ extern CNotification * g_Notify;
extern CSettings * g_Settings;
extern CN64System * g_System;
extern CN64System * _BaseSystem;
extern CN64System * g_BaseSystem;
extern CN64System * _SyncSystem;
extern CRecompiler * _Recompiler;
extern CMipsMemory * _MMU; //Memory of the n64

View File

@ -44,7 +44,7 @@ void CPlugins::PluginChanged ( CPlugins * _this )
{
if (g_Settings->LoadBool(GameRunning_CPU_Running) != 0)
{
if (_BaseSystem) { _BaseSystem->ExternalEvent(SysEvent_ChangePlugins); }
if (g_BaseSystem) { g_BaseSystem->ExternalEvent(SysEvent_ChangePlugins); }
} else {
_this->Reset();
g_Notify->RefreshMenu();

View File

@ -298,7 +298,7 @@ int CMainGui::ProcessAllMessages (void) {
MSG msg;
while (GetMessage(&msg,NULL,0,0)) {
if (_BaseSystem && _BaseSystem->IsDialogMsg(&msg))
if (g_BaseSystem && g_BaseSystem->IsDialogMsg(&msg))
{
continue;
}
@ -522,7 +522,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
}
}
}
if (CGuiSettings::bCPURunning() && _BaseSystem) {
if (CGuiSettings::bCPURunning() && g_BaseSystem) {
if (_Plugins->Gfx() && _Plugins->Gfx()->MoveScreen) {
WriteTrace(TraceGfxPlugin,"MoveScreen: Starting");
_Plugins->Gfx()->MoveScreen((int)(short) LOWORD(lParam), (int)(short) HIWORD(lParam));
@ -615,7 +615,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
if (_this->m_bMainWindow && bCPURunning())
{
if (_BaseSystem)
if (g_BaseSystem)
{
if (_Plugins && _Plugins->Control()->WM_KeyUp) {
_Plugins->Control()->WM_KeyUp(wParam, lParam);
@ -630,7 +630,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
if (_this->m_bMainWindow && bCPURunning())
{
if (_BaseSystem)
if (g_BaseSystem)
{
if (_Plugins && _Plugins->Control()->WM_KeyDown)
{
@ -651,9 +651,9 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
if (_this->m_bMainWindow && bCPURunning() && bAutoSleep())
{
if (_BaseSystem)
if (g_BaseSystem)
{
_BaseSystem->ExternalEvent( SysEvent_ResumeCPU_AppGainedFocus );
g_BaseSystem->ExternalEvent( SysEvent_ResumeCPU_AppGainedFocus );
}
}
}
@ -668,9 +668,9 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
if (_this->m_bMainWindow && bCPURunning() && bAutoSleep())
{
if (_BaseSystem)
if (g_BaseSystem)
{
_BaseSystem->ExternalEvent( SysEvent_PauseCPU_AppLostFocus );
g_BaseSystem->ExternalEvent( SysEvent_PauseCPU_AppLostFocus );
}
}
}
@ -688,7 +688,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
if (!fActive && g_Settings->LoadBool(UserInterface_InFullScreen))
{
g_Notify->WindowMode();
if (bAutoSleep() && _BaseSystem)
if (bAutoSleep() && g_BaseSystem)
{
//System->ExternalEvent(PauseCPU_AppLostActiveDelayed );
}
@ -696,9 +696,9 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
}
if (bAutoSleep() || fActive)
{
if (_BaseSystem)
if (g_BaseSystem)
{
_BaseSystem->ExternalEvent(fActive ? SysEvent_ResumeCPU_AppGainedActive : SysEvent_PauseCPU_AppLostActive );
g_BaseSystem->ExternalEvent(fActive ? SysEvent_ResumeCPU_AppGainedActive : SysEvent_PauseCPU_AppLostActive );
}
}
}
@ -730,7 +730,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
if (_this == NULL) { break; }
switch (LOWORD(wParam)) {
case ID_POPUPMENU_PLAYGAME: _BaseSystem->RunFileImage(_this->CurrentedSelectedRom()); break;
case ID_POPUPMENU_PLAYGAME: g_BaseSystem->RunFileImage(_this->CurrentedSelectedRom()); break;
case ID_POPUPMENU_ROMDIRECTORY: _this->SelectRomDir(); break;
case ID_POPUPMENU_REFRESHROMLIST: _this->RefreshRomBrowser(); break;
case ID_POPUPMENU_ROMINFORMATION:
@ -840,7 +840,7 @@ DWORD CALLBACK CMainGui::MainGui_Proc (WND_HANDLE hWnd, DWORD uMsg, DWORD wParam
{
if (uMsg == _this->m_InvalidExeMsg)
{
_BaseSystem->CloseCpu();
g_BaseSystem->CloseCpu();
MessageBox((HWND)hWnd,GS(MSG_INVALID_EXE),GS(MSG_INVALID_EXE_TITLE),MB_OK|MB_ICONERROR);
PostQuitMessage(0);
}

View File

@ -64,24 +64,24 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD /*FromAccelerator*/, DWORD
switch (MenuID) {
case ID_FILE_OPEN_ROM:
{
stdstr File = _BaseSystem->ChooseFileToOpen(hWnd);
stdstr File = g_BaseSystem->ChooseFileToOpen(hWnd);
if (File.length() > 0) {
_BaseSystem->RunFileImage(File.c_str());
g_BaseSystem->RunFileImage(File.c_str());
}
}
break;
case ID_FILE_ROM_INFO:
{
_BaseSystem->DisplayRomInfo(hWnd);
g_BaseSystem->DisplayRomInfo(hWnd);
}
break;
case ID_FILE_STARTEMULATION:
_Gui->SaveWindowLoc();
_BaseSystem->StartEmulation(true);
g_BaseSystem->StartEmulation(true);
break;
case ID_FILE_ENDEMULATION:
WriteTrace(TraceDebug,"ID_FILE_ENDEMULATION");
_BaseSystem->CloseCpu();
g_BaseSystem->CloseCpu();
_Gui->SaveWindowLoc();
break;
case ID_FILE_ROMDIRECTORY:
@ -95,20 +95,20 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD /*FromAccelerator*/, DWORD
case ID_FILE_EXIT: DestroyWindow((HWND)hWnd); break;
case ID_SYSTEM_RESET_SOFT:
WriteTrace(TraceDebug,"ID_SYSTEM_RESET_SOFT");
_BaseSystem->ExternalEvent(SysEvent_ResetCPU_Soft);
g_BaseSystem->ExternalEvent(SysEvent_ResetCPU_Soft);
break;
case ID_SYSTEM_RESET_HARD:
WriteTrace(TraceDebug,"ID_SYSTEM_RESET_HARD");
_BaseSystem->ExternalEvent(SysEvent_ResetCPU_Hard);
g_BaseSystem->ExternalEvent(SysEvent_ResetCPU_Hard);
break;
case ID_SYSTEM_PAUSE:
_Gui->SaveWindowLoc();
WriteTrace(TraceDebug,"ID_SYSTEM_PAUSE");
if (g_Settings->LoadBool(GameRunning_CPU_Paused))
{
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_FromMenu);
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_FromMenu);
} else {
_BaseSystem->ExternalEvent(SysEvent_PauseCPU_FromMenu);
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_FromMenu);
}
WriteTrace(TraceDebug,"ID_SYSTEM_PAUSE 1");
break;
@ -127,7 +127,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD /*FromAccelerator*/, DWORD
break;
case ID_SYSTEM_SAVE:
WriteTrace(TraceDebug,"ID_SYSTEM_SAVE");
_BaseSystem->ExternalEvent(SysEvent_SaveMachineState);
g_BaseSystem->ExternalEvent(SysEvent_SaveMachineState);
break;
case ID_SYSTEM_SAVEAS:
{
@ -148,7 +148,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD /*FromAccelerator*/, DWORD
openfilename.nMaxFile = MAX_PATH;
openfilename.Flags = OFN_HIDEREADONLY;
_BaseSystem->ExternalEvent(SysEvent_PauseCPU_SaveGame);
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_SaveGame);
if (GetSaveFileName (&openfilename))
{
@ -169,10 +169,10 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD /*FromAccelerator*/, DWORD
g_Settings->SaveString(Directory_LastSave,SaveDir);
g_System->SaveState();
}
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_SaveGame);
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_SaveGame);
}
break;
case ID_SYSTEM_RESTORE: WriteTrace(TraceDebug,"ID_SYSTEM_RESTORE"); _BaseSystem->ExternalEvent(SysEvent_LoadMachineState); break;
case ID_SYSTEM_RESTORE: WriteTrace(TraceDebug,"ID_SYSTEM_RESTORE"); g_BaseSystem->ExternalEvent(SysEvent_LoadMachineState); break;
case ID_SYSTEM_LOAD:
{
char Directory[255], SaveFile[255];
@ -191,7 +191,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD /*FromAccelerator*/, DWORD
openfilename.nMaxFile = MAX_PATH;
openfilename.Flags = OFN_HIDEREADONLY;
_BaseSystem->ExternalEvent(SysEvent_PauseCPU_LoadGame);
g_BaseSystem->ExternalEvent(SysEvent_PauseCPU_LoadGame);
if (GetOpenFileName (&openfilename)) {
g_Settings->SaveString(GameRunning_InstantSaveFile,SaveFile);
char SaveDir[MAX_PATH], drive[_MAX_DRIVE] ,dir[_MAX_DIR], fname[_MAX_FNAME],ext[_MAX_EXT];
@ -200,16 +200,16 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD /*FromAccelerator*/, DWORD
g_Settings->SaveString(Directory_LastSave,SaveDir);
g_System->LoadState();
}
_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_LoadGame);
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_LoadGame);
}
break;
case ID_SYSTEM_CHEAT:
{
_BaseSystem->SelectCheats(hWnd);
g_BaseSystem->SelectCheats(hWnd);
}
break;
case ID_SYSTEM_GSBUTTON:
_BaseSystem->ExternalEvent(SysEvent_GSButtonPressed);
g_BaseSystem->ExternalEvent(SysEvent_GSButtonPressed);
break;
case ID_OPTIONS_DISPLAY_FR:
g_Settings->SaveBool(UserInterface_DisplayFrameRate,!g_Settings->LoadBool(UserInterface_DisplayFrameRate));
@ -228,13 +228,13 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD /*FromAccelerator*/, DWORD
}
break;
case ID_OPTIONS_INCREASE_SPEED:
_BaseSystem->IncreaseSpeed();
g_BaseSystem->IncreaseSpeed();
break;
case ID_OPTIONS_DECREASE_SPEED:
_BaseSystem->DecreaeSpeed();
g_BaseSystem->DecreaeSpeed();
break;
case ID_OPTIONS_FULLSCREEN:
_BaseSystem->ExternalEvent(SysEvent_ChangingFullScreen);
g_BaseSystem->ExternalEvent(SysEvent_ChangingFullScreen);
break;
case ID_OPTIONS_FULLSCREEN2:
if (g_Settings->LoadBool(UserInterface_InFullScreen))
@ -308,10 +308,10 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD /*FromAccelerator*/, DWORD
break;
case ID_PROFILE_PROFILE:
g_Settings->SaveBool(Debugger_ProfileCode,!g_Settings->LoadBool(Debugger_ProfileCode));
_BaseSystem->ExternalEvent(SysEvent_Profile_StartStop);
g_BaseSystem->ExternalEvent(SysEvent_Profile_StartStop);
break;
case ID_PROFILE_RESETCOUNTER: _BaseSystem->ExternalEvent(SysEvent_Profile_ResetLogs); break;
case ID_PROFILE_GENERATELOG: _BaseSystem->ExternalEvent(SysEvent_Profile_GenerateLogs); break;
case ID_PROFILE_RESETCOUNTER: g_BaseSystem->ExternalEvent(SysEvent_Profile_ResetLogs); break;
case ID_PROFILE_GENERATELOG: g_BaseSystem->ExternalEvent(SysEvent_Profile_GenerateLogs); break;
case ID_DEBUG_SHOW_TLB_MISSES:
g_Settings->SaveBool(Debugger_ShowTLBMisses,!g_Settings->LoadBool(Debugger_ShowTLBMisses));
break;
@ -449,17 +449,17 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD /*FromAccelerator*/, DWORD
g_Settings->SaveBool(Debugger_GenerateDebugLog,!g_Settings->LoadBool(Debugger_GenerateDebugLog));
break;
case ID_DEBUGGER_DUMPMEMORY:
_BaseSystem->Debug_ShowMemoryDump();
g_BaseSystem->Debug_ShowMemoryDump();
break;
case ID_DEBUGGER_SEARCHMEMORY: _BaseSystem->Debug_ShowMemorySearch(); break;
case ID_DEBUGGER_MEMORY: _BaseSystem->Debug_ShowMemoryWindow(); break;
case ID_DEBUGGER_TLBENTRIES: _BaseSystem->Debug_ShowTLBWindow(); break;
case ID_DEBUGGER_INTERRUPT_SP: _BaseSystem->ExternalEvent(SysEvent_Interrupt_SP); break;
case ID_DEBUGGER_INTERRUPT_SI: _BaseSystem->ExternalEvent(SysEvent_Interrupt_SI); break;
case ID_DEBUGGER_INTERRUPT_AI: _BaseSystem->ExternalEvent(SysEvent_Interrupt_AI); break;
case ID_DEBUGGER_INTERRUPT_VI: _BaseSystem->ExternalEvent(SysEvent_Interrupt_VI); break;
case ID_DEBUGGER_INTERRUPT_PI: _BaseSystem->ExternalEvent(SysEvent_Interrupt_PI); break;
case ID_DEBUGGER_INTERRUPT_DP: _BaseSystem->ExternalEvent(SysEvent_Interrupt_DP); break;
case ID_DEBUGGER_SEARCHMEMORY: g_BaseSystem->Debug_ShowMemorySearch(); break;
case ID_DEBUGGER_MEMORY: g_BaseSystem->Debug_ShowMemoryWindow(); break;
case ID_DEBUGGER_TLBENTRIES: g_BaseSystem->Debug_ShowTLBWindow(); break;
case ID_DEBUGGER_INTERRUPT_SP: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_SP); break;
case ID_DEBUGGER_INTERRUPT_SI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_SI); break;
case ID_DEBUGGER_INTERRUPT_AI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_AI); break;
case ID_DEBUGGER_INTERRUPT_VI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_VI); break;
case ID_DEBUGGER_INTERRUPT_PI: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_PI); break;
case ID_DEBUGGER_INTERRUPT_DP: g_BaseSystem->ExternalEvent(SysEvent_Interrupt_DP); break;
case ID_CURRENT_SAVE_DEFAULT:
Notify().DisplayMessage(3,"Save Slot (%s) selected",GetSaveSlotString(MenuID - ID_CURRENT_SAVE_DEFAULT).c_str());
g_Settings->SaveDword(Game_CurrentSaveState,(DWORD)(MenuID - ID_CURRENT_SAVE_DEFAULT));
@ -517,7 +517,7 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD /*FromAccelerator*/, DWORD
if (g_Settings->LoadStringIndex(File_RecentGameFileIndex,MenuID - ID_RECENT_ROM_START,FileName) &&
FileName.length() > 0)
{
_BaseSystem->RunFileImage(FileName.c_str());
g_BaseSystem->RunFileImage(FileName.c_str());
}
}
if (MenuID >= ID_RECENT_DIR_START && MenuID < ID_RECENT_DIR_END) {

View File

@ -281,10 +281,10 @@ void CNotification::BreakPoint ( const char * File, const int LineNumber )
{
DebugBreak();
} else {
_BaseSystem->CloseCpu();
g_BaseSystem->CloseCpu();
}
} else {
DisplayError("Fatal Error: Stopping emulation");
_BaseSystem->CloseCpu();
g_BaseSystem->CloseCpu();
}
}

View File

@ -1337,7 +1337,7 @@ void CRomBrowser::RomList_OpenRom(DWORD /*pnmh*/) {
if (!pRomInfo) { return; }
m_StopRefresh = true;
_BaseSystem->RunFileImage(pRomInfo->szFullFileName);
g_BaseSystem->RunFileImage(pRomInfo->szFullFileName);
}
void CRomBrowser::RomList_PopupMenu(DWORD /*pnmh*/)

View File

@ -318,11 +318,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lps
MainWindow.ProcessAllMessages();
WriteTrace(TraceDebug,"WinMain - Message Loop Finished");
if (_BaseSystem)
if (g_BaseSystem)
{
_BaseSystem->CloseCpu();
delete _BaseSystem;
_BaseSystem = NULL;
g_BaseSystem->CloseCpu();
delete g_BaseSystem;
g_BaseSystem = NULL;
}
WriteTrace(TraceDebug,"WinMain - System Closed");