From 6c954c690cae0029b3ed35c27e04eb9e46ae2e14 Mon Sep 17 00:00:00 2001 From: zilmar Date: Sat, 17 Nov 2012 12:18:00 +1100 Subject: [PATCH] Global Variable: Rename _MMU to g_MMU --- .../Project64/N64 System/C Core/Logging.cpp | 34 ++++----- Source/Project64/N64 System/Cheat Class.cpp | 72 +++++++++---------- Source/Project64/N64 System/Cheat Class.h | 6 +- .../Debugger/Debugger - Memory Dump.cpp | 10 +-- .../Debugger/Debugger - Memory Dump.h | 2 +- .../Debugger/Debugger - Memory Search.cpp | 12 ++-- .../Debugger/Debugger - View Memory.cpp | 12 ++-- .../N64 System/Debugger/Debugger.cpp | 6 +- .../Interpreter/Interpreter CPU.cpp | 12 ++-- .../Interpreter/Interpreter Ops 32.cpp | 18 ++--- .../Interpreter/Interpreter Ops.cpp | 58 +++++++-------- Source/Project64/N64 System/Mips/Dma.cpp | 32 ++++----- Source/Project64/N64 System/Mips/FlashRam.cpp | 4 +- .../N64 System/Mips/Memory Virtual Mem.cpp | 6 +- .../N64 System/Mips/OpCode Class.cpp | 4 +- Source/Project64/N64 System/Mips/Pif Ram.cpp | 6 +- .../N64 System/Mips/System Events.cpp | 2 +- Source/Project64/N64 System/N64 Class.cpp | 38 +++++----- .../N64 System/Recompiler/Code Block.cpp | 4 +- .../N64 System/Recompiler/Code Section.cpp | 54 +++++++------- .../Recompiler/Function Map Class.cpp | 4 +- .../N64 System/Recompiler/Loop Analysis.cpp | 2 +- .../Recompiler/Recompiler Class.cpp | 26 +++---- .../N64 System/Recompiler/Recompiler Ops.cpp | 32 ++++----- .../N64 System/Recompiler/X86ops.cpp | 44 ++++++------ .../Project64/N64 System/System Globals.cpp | 4 +- Source/Project64/N64 System/System Globals.h | 4 +- Source/Project64/Plugins/Audio Plugin.cpp | 6 +- Source/Project64/Plugins/GFX plugin.cpp | 6 +- Source/Project64/Plugins/RSP Plugin.cpp | 6 +- 30 files changed, 263 insertions(+), 263 deletions(-) diff --git a/Source/Project64/N64 System/C Core/Logging.cpp b/Source/Project64/N64 System/C Core/Logging.cpp index 57b609954..35a913747 100644 --- a/Source/Project64/N64 System/C Core/Logging.cpp +++ b/Source/Project64/N64 System/C Core/Logging.cpp @@ -188,10 +188,10 @@ void Log_LW (DWORD PC, DWORD VAddr) { } DWORD Value; - if ( VAddr >= 0xA0000000 && VAddr < (0xA0000000 + _MMU->RdramSize())) { return; } + if ( VAddr >= 0xA0000000 && VAddr < (0xA0000000 + g_MMU->RdramSize())) { return; } if ( VAddr >= 0xA3F00000 && VAddr <= 0xA3F00024) { if (!LogOptions.LogRDRamRegisters) { return; } - _MMU->LW_VAddr(VAddr,Value); + g_MMU->LW_VAddr(VAddr,Value); switch (VAddr) { case 0xA3F00000: LogMessage("%08X: read from RDRAM_CONFIG_REG/RDRAM_DEVICE_TYPE_REG (%08X)",PC, Value); return; @@ -210,7 +210,7 @@ void Log_LW (DWORD PC, DWORD VAddr) { if ( VAddr >= 0xA4000000 && VAddr <= 0xA4001FFC ) { return; } if ( VAddr >= 0xA4040000 && VAddr <= 0xA404001C ) { if (!LogOptions.LogSPRegisters) { return; } - _MMU->LW_VAddr(VAddr,Value); + g_MMU->LW_VAddr(VAddr,Value); switch (VAddr) { case 0xA4040000: LogMessage("%08X: read from SP_MEM_ADDR_REG (%08X)",PC, Value); break; @@ -226,13 +226,13 @@ void Log_LW (DWORD PC, DWORD VAddr) { } if ( VAddr == 0xA4080000) { if (!LogOptions.LogSPRegisters) { return; } - _MMU->LW_VAddr(VAddr,Value); + g_MMU->LW_VAddr(VAddr,Value); LogMessage("%08X: read from SP_PC (%08X)",PC, Value); return; } if (VAddr >= 0xA4100000 && VAddr <= 0xA410001C) { if (!LogOptions.LogDPCRegisters) { return; } - _MMU->LW_VAddr(VAddr,Value); + g_MMU->LW_VAddr(VAddr,Value); switch (VAddr) { case 0xA4100000: LogMessage("%08X: read from DPC_START_REG (%08X)",PC, Value); return; @@ -247,7 +247,7 @@ void Log_LW (DWORD PC, DWORD VAddr) { } if (VAddr >= 0xA4300000 && VAddr <= 0xA430000C) { if (!LogOptions.LogMIPSInterface) { return; } - _MMU->LW_VAddr(VAddr,Value); + g_MMU->LW_VAddr(VAddr,Value); switch (VAddr) { case 0xA4300000: LogMessage("%08X: read from MI_INIT_MODE_REG/MI_MODE_REG (%08X)",PC, Value); return; @@ -258,7 +258,7 @@ void Log_LW (DWORD PC, DWORD VAddr) { } if (VAddr >= 0xA4400000 && VAddr <= 0xA4400034) { if (!LogOptions.LogVideoInterface) { return; } - _MMU->LW_VAddr(VAddr,Value); + g_MMU->LW_VAddr(VAddr,Value); switch (VAddr) { case 0xA4400000: LogMessage("%08X: read from VI_STATUS_REG/VI_CONTROL_REG (%08X)",PC, Value); return; @@ -279,7 +279,7 @@ void Log_LW (DWORD PC, DWORD VAddr) { } if (VAddr >= 0xA4500000 && VAddr <= 0xA4500014) { if (!LogOptions.LogAudioInterface) { return; } - _MMU->LW_VAddr(VAddr,Value); + g_MMU->LW_VAddr(VAddr,Value); switch (VAddr) { case 0xA4500000: LogMessage("%08X: read from AI_DRAM_ADDR_REG (%08X)",PC, Value); return; @@ -292,7 +292,7 @@ void Log_LW (DWORD PC, DWORD VAddr) { } if (VAddr >= 0xA4600000 && VAddr <= 0xA4600030) { if (!LogOptions.LogPerInterface) { return; } - _MMU->LW_VAddr(VAddr,Value); + g_MMU->LW_VAddr(VAddr,Value); switch (VAddr) { case 0xA4600000: LogMessage("%08X: read from PI_DRAM_ADDR_REG (%08X)",PC, Value); return; @@ -312,7 +312,7 @@ void Log_LW (DWORD PC, DWORD VAddr) { } if (VAddr >= 0xA4700000 && VAddr <= 0xA470001C) { if (!LogOptions.LogRDRAMInterface) { return; } - _MMU->LW_VAddr(VAddr,Value); + g_MMU->LW_VAddr(VAddr,Value); switch (VAddr) { case 0xA4700000: LogMessage("%08X: read from RI_MODE_REG (%08X)",PC, Value); return; @@ -327,32 +327,32 @@ void Log_LW (DWORD PC, DWORD VAddr) { } if ( VAddr == 0xA4800000) { if (!LogOptions.LogSerialInterface) { return; } - _MMU->LW_VAddr(VAddr,Value); + g_MMU->LW_VAddr(VAddr,Value); LogMessage("%08X: read from SI_DRAM_ADDR_REG (%08X)",PC, Value); return; } if ( VAddr == 0xA4800004) { if (!LogOptions.LogSerialInterface) { return; } - _MMU->LW_VAddr(VAddr,Value); + g_MMU->LW_VAddr(VAddr,Value); LogMessage("%08X: read from SI_PIF_ADDR_RD64B_REG (%08X)",PC, Value); return; } if ( VAddr == 0xA4800010) { if (!LogOptions.LogSerialInterface) { return; } - _MMU->LW_VAddr(VAddr,Value); + g_MMU->LW_VAddr(VAddr,Value); LogMessage("%08X: read from SI_PIF_ADDR_WR64B_REG (%08X)",PC, Value); return; } if ( VAddr == 0xA4800018) { if (!LogOptions.LogSerialInterface) { return; } - _MMU->LW_VAddr(VAddr,Value); + g_MMU->LW_VAddr(VAddr,Value); LogMessage("%08X: read from SI_STATUS_REG (%08X)",PC, Value); return; } if ( VAddr >= 0xBFC00000 && VAddr <= 0xBFC007C0 ) { return; } if ( VAddr >= 0xBFC007C0 && VAddr <= 0xBFC007FC ) { if (!LogOptions.LogPRDirectMemLoads) { return; } - _MMU->LW_VAddr(VAddr,Value); + g_MMU->LW_VAddr(VAddr,Value); LogMessage("%08X: read word from Pif Ram at 0x%X (%08X)",PC,VAddr - 0xBFC007C0, Value); return; } @@ -360,7 +360,7 @@ void Log_LW (DWORD PC, DWORD VAddr) { if ( VAddr >= 0xB0000000 && VAddr < 0xB0000040) { if (!LogOptions.LogRomHeader) { return; } - _MMU->LW_VAddr(VAddr,Value); + g_MMU->LW_VAddr(VAddr,Value); switch (VAddr) { case 0xB0000004: LogMessage("%08X: read from Rom Clock Rate (%08X)",PC, Value); break; case 0xB0000008: LogMessage("%08X: read from Rom Boot address offset (%08X)",PC, Value); break; @@ -409,7 +409,7 @@ void Log_SW (DWORD PC, DWORD VAddr, DWORD Value) { VAddr = PAddr + 0xA0000000; } - if ( VAddr >= 0xA0000000 && VAddr < (0xA0000000 + _MMU->RdramSize())) { return; } + if ( VAddr >= 0xA0000000 && VAddr < (0xA0000000 + g_MMU->RdramSize())) { return; } if ( VAddr >= 0xA3F00000 && VAddr <= 0xA3F00024) { if (!LogOptions.LogRDRamRegisters) { return; } switch (VAddr) { diff --git a/Source/Project64/N64 System/Cheat Class.cpp b/Source/Project64/N64 System/Cheat Class.cpp index b5fdc8efd..3e1aa3ebe 100644 --- a/Source/Project64/N64 System/Cheat Class.cpp +++ b/Source/Project64/N64 System/Cheat Class.cpp @@ -163,19 +163,19 @@ WORD ConvertXP64Value (WORD Value) { return tmpValue; } -void CCheats::ApplyCheats(CMipsMemory * _MMU) +void CCheats::ApplyCheats(CMipsMemory * g_MMU) { for (size_t CurrentCheat = 0; CurrentCheat < m_Codes.size(); CurrentCheat ++) { const CODES & CodeEntry = m_Codes[CurrentCheat]; for (size_t CurrentEntry = 0; CurrentEntry < CodeEntry.size();) { - CurrentEntry += ApplyCheatEntry(_MMU, CodeEntry,CurrentEntry,TRUE); + CurrentEntry += ApplyCheatEntry(g_MMU, CodeEntry,CurrentEntry,TRUE); } } } -void CCheats::ApplyGSButton (CMipsMemory * _MMU) +void CCheats::ApplyGSButton (CMipsMemory * g_MMU) { DWORD Address; for (size_t CurrentCheat = 0; CurrentCheat < m_Codes.size(); CurrentCheat ++) @@ -187,20 +187,20 @@ void CCheats::ApplyGSButton (CMipsMemory * _MMU) switch (Code.Command & 0xFF000000) { case 0x88000000: Address = 0x80000000 | (Code.Command & 0xFFFFFF); - _MMU->SB_VAddr(Address,(BYTE)Code.Value); + g_MMU->SB_VAddr(Address,(BYTE)Code.Value); break; case 0x89000000: Address = 0x80000000 | (Code.Command & 0xFFFFFF); - _MMU->SH_VAddr(Address,Code.Value); + g_MMU->SH_VAddr(Address,Code.Value); break; // Xplorer64 case 0xA8000000: Address = 0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF); - _MMU->SB_VAddr(Address,(BYTE)ConvertXP64Value(Code.Value)); + g_MMU->SB_VAddr(Address,(BYTE)ConvertXP64Value(Code.Value)); break; case 0xA9000000: Address = 0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF); - _MMU->SH_VAddr(Address,ConvertXP64Value(Code.Value)); + g_MMU->SH_VAddr(Address,ConvertXP64Value(Code.Value)); break; } } @@ -286,7 +286,7 @@ bool CCheats::IsValid16BitCode (LPCSTR CheatString) const return true; } -int CCheats::ApplyCheatEntry (CMipsMemory * _MMU, const CODES & CodeEntry, int CurrentEntry, BOOL Execute ) +int CCheats::ApplyCheatEntry (CMipsMemory * g_MMU, const CODES & CodeEntry, int CurrentEntry, BOOL Execute ) { if (CurrentEntry < 0 || CurrentEntry >= (int)CodeEntry.size()) { @@ -318,7 +318,7 @@ int CCheats::ApplyCheatEntry (CMipsMemory * _MMU, const CODES & CodeEntry, int C Address = 0x80000000 | (NextCodeEntry.Command & 0xFFFFFF); wMemory = NextCodeEntry.Value; for (i=0; iSB_VAddr(Address,(BYTE)wMemory); + g_MMU->SB_VAddr(Address,(BYTE)wMemory); Address += offset; wMemory += (WORD)incr; } @@ -328,7 +328,7 @@ int CCheats::ApplyCheatEntry (CMipsMemory * _MMU, const CODES & CodeEntry, int C Address = 0x80000000 | (NextCodeEntry.Command & 0xFFFFFF); wMemory = NextCodeEntry.Value; for (i=0; iSH_VAddr(Address,wMemory); + g_MMU->SH_VAddr(Address,wMemory); Address += offset; wMemory += (WORD)incr; } @@ -339,90 +339,90 @@ int CCheats::ApplyCheatEntry (CMipsMemory * _MMU, const CODES & CodeEntry, int C break; case 0x80000000: Address = 0x80000000 | (Code.Command & 0xFFFFFF); - if (Execute) { _MMU->SB_VAddr(Address,(BYTE)Code.Value); } + if (Execute) { g_MMU->SB_VAddr(Address,(BYTE)Code.Value); } break; case 0x81000000: Address = 0x80000000 | (Code.Command & 0xFFFFFF); - if (Execute) { _MMU->SH_VAddr(Address,Code.Value); } + if (Execute) { g_MMU->SH_VAddr(Address,Code.Value); } break; case 0xA0000000: Address = 0xA0000000 | (Code.Command & 0xFFFFFF); - if (Execute) { _MMU->SB_VAddr(Address,(BYTE)Code.Value); } + if (Execute) { g_MMU->SB_VAddr(Address,(BYTE)Code.Value); } break; case 0xA1000000: Address = 0xA0000000 | (Code.Command & 0xFFFFFF); - if (Execute) { _MMU->SH_VAddr(Address,Code.Value); } + if (Execute) { g_MMU->SH_VAddr(Address,Code.Value); } break; case 0xD0000000: // Added by Witten (witten@pj64cheats.net) Address = 0x80000000 | (Code.Command & 0xFFFFFF); - _MMU->LB_VAddr(Address,bMemory); + g_MMU->LB_VAddr(Address,bMemory); if (bMemory != Code.Value) { Execute = FALSE; } - return ApplyCheatEntry(_MMU,CodeEntry,CurrentEntry + 1,Execute) + 1; + return ApplyCheatEntry(g_MMU,CodeEntry,CurrentEntry + 1,Execute) + 1; case 0xD1000000: // Added by Witten (witten@pj64cheats.net) Address = 0x80000000 | (Code.Command & 0xFFFFFF); - _MMU->LH_VAddr(Address,wMemory); + g_MMU->LH_VAddr(Address,wMemory); if (wMemory != Code.Value) { Execute = FALSE; } - return ApplyCheatEntry(_MMU,CodeEntry,CurrentEntry + 1,Execute) + 1; + return ApplyCheatEntry(g_MMU,CodeEntry,CurrentEntry + 1,Execute) + 1; case 0xD2000000: // Added by Witten (witten@pj64cheats.net) Address = 0x80000000 | (Code.Command & 0xFFFFFF); - _MMU->LB_VAddr(Address,bMemory); + g_MMU->LB_VAddr(Address,bMemory); if (bMemory == Code.Value) { Execute = FALSE; } - return ApplyCheatEntry(_MMU,CodeEntry,CurrentEntry + 1,Execute) + 1; + return ApplyCheatEntry(g_MMU,CodeEntry,CurrentEntry + 1,Execute) + 1; case 0xD3000000: // Added by Witten (witten@pj64cheats.net) Address = 0x80000000 | (Code.Command & 0xFFFFFF); - _MMU->LH_VAddr(Address,wMemory); + g_MMU->LH_VAddr(Address,wMemory); if (wMemory == Code.Value) { Execute = FALSE; } - return ApplyCheatEntry(_MMU,CodeEntry,CurrentEntry + 1,Execute) + 1; + return ApplyCheatEntry(g_MMU,CodeEntry,CurrentEntry + 1,Execute) + 1; // Xplorer64 (Author: Witten) case 0x30000000: case 0x82000000: case 0x84000000: Address = 0x80000000 | (Code.Command & 0xFFFFFF); - if (Execute) { _MMU->SB_VAddr(Address,(BYTE)Code.Value); } + if (Execute) { g_MMU->SB_VAddr(Address,(BYTE)Code.Value); } break; case 0x31000000: case 0x83000000: case 0x85000000: Address = 0x80000000 | (Code.Command & 0xFFFFFF); - if (Execute) { _MMU->SH_VAddr(Address,Code.Value); } + if (Execute) { g_MMU->SH_VAddr(Address,Code.Value); } break; case 0xE8000000: Address = 0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF); - if (Execute) { _MMU->SB_VAddr(Address,(BYTE)ConvertXP64Value(Code.Value)); } + if (Execute) { g_MMU->SB_VAddr(Address,(BYTE)ConvertXP64Value(Code.Value)); } break; case 0xE9000000: Address = 0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF); - if (Execute) { _MMU->SH_VAddr(Address,ConvertXP64Value(Code.Value)); } + if (Execute) { g_MMU->SH_VAddr(Address,ConvertXP64Value(Code.Value)); } break; case 0xC8000000: Address = 0xA0000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF); - if (Execute) { _MMU->SB_VAddr(Address,(BYTE)Code.Value); } + if (Execute) { g_MMU->SB_VAddr(Address,(BYTE)Code.Value); } break; case 0xC9000000: Address = 0xA0000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF); - if (Execute) { _MMU->SH_VAddr(Address,ConvertXP64Value(Code.Value)); } + if (Execute) { g_MMU->SH_VAddr(Address,ConvertXP64Value(Code.Value)); } break; case 0xB8000000: Address = 0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF); - _MMU->LB_VAddr(Address,bMemory); + g_MMU->LB_VAddr(Address,bMemory); if (bMemory != ConvertXP64Value(Code.Value)) { Execute = FALSE; } - return ApplyCheatEntry(_MMU,CodeEntry,CurrentEntry + 1,Execute) + 1; + return ApplyCheatEntry(g_MMU,CodeEntry,CurrentEntry + 1,Execute) + 1; case 0xB9000000: Address = 0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF); - _MMU->LH_VAddr(Address,wMemory); + g_MMU->LH_VAddr(Address,wMemory); if (wMemory != ConvertXP64Value(Code.Value)) { Execute = FALSE; } - return ApplyCheatEntry(_MMU,CodeEntry,CurrentEntry + 1,Execute) + 1; + return ApplyCheatEntry(g_MMU,CodeEntry,CurrentEntry + 1,Execute) + 1; case 0xBA000000: Address = 0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF); - _MMU->LB_VAddr(Address,bMemory); + g_MMU->LB_VAddr(Address,bMemory); if (bMemory == ConvertXP64Value(Code.Value)) { Execute = FALSE; } - return ApplyCheatEntry(_MMU,CodeEntry,CurrentEntry + 1,Execute) + 1; + return ApplyCheatEntry(g_MMU,CodeEntry,CurrentEntry + 1,Execute) + 1; case 0xBB000000: Address = 0x80000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF); - _MMU->LH_VAddr(Address,wMemory); + g_MMU->LH_VAddr(Address,wMemory); if (wMemory == ConvertXP64Value(Code.Value)) { Execute = FALSE; } - return ApplyCheatEntry(_MMU,CodeEntry,CurrentEntry + 1,Execute) + 1; + return ApplyCheatEntry(g_MMU,CodeEntry,CurrentEntry + 1,Execute) + 1; case 0: return MaxGSEntries; break; } return 1; diff --git a/Source/Project64/N64 System/Cheat Class.h b/Source/Project64/N64 System/Cheat Class.h index f928f4f35..5deaad7ca 100644 --- a/Source/Project64/N64 System/Cheat Class.h +++ b/Source/Project64/N64 System/Cheat Class.h @@ -45,7 +45,7 @@ class CCheats { void CheckParentStatus ( WND_HANDLE hParent ); static stdstr ReadCodeString ( WND_HANDLE hDlg, bool &validcodes, bool &validoption, bool &nooptions, int &codeformat ); static stdstr ReadOptionsString( WND_HANDLE hDlg, bool &validcodes, bool &validoptions, bool &nooptions, int &codeformat ); - int ApplyCheatEntry (CMipsMemory * _MMU,const CODES & CodeEntry, int CurrentEntry, BOOL Execute ); + int ApplyCheatEntry (CMipsMemory * g_MMU,const CODES & CodeEntry, int CurrentEntry, BOOL Execute ); void RecordCheatValues ( WND_HANDLE hDlg ); bool CheatChanged ( WND_HANDLE hDlg ); bool IsValid16BitCode ( LPCSTR CheatString ) const; @@ -70,8 +70,8 @@ public: ~CCheats ( void ); bool IsCheatMessage ( MSG * msg ); - void ApplyCheats ( CMipsMemory * _MMU ); - void ApplyGSButton ( CMipsMemory * _MMU ); + void ApplyCheats ( CMipsMemory * g_MMU ); + void ApplyGSButton ( CMipsMemory * g_MMU ); void LoadCheats ( bool DisableSelected ); void SelectCheats ( WND_HANDLE hParent, bool BlockExecution ); inline bool CheatsSlectionChanged ( void ) const { return m_CheatSelectionChanged; } diff --git a/Source/Project64/N64 System/Debugger/Debugger - Memory Dump.cpp b/Source/Project64/N64 System/Debugger/Debugger - Memory Dump.cpp index 2f29d4ac9..4bd479153 100644 --- a/Source/Project64/N64 System/Debugger/Debugger - Memory Dump.cpp +++ b/Source/Project64/N64 System/Debugger/Debugger - Memory Dump.cpp @@ -119,7 +119,7 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, //DWORD CDumpMemory::m_StartAddress = 0x80000000; //DWORD CDumpMemory::m_EndAddress = 0x803FFFF0; //CDumpMemory::CDumpMemory(CMipsMemory * MMU) : -// m_Window(NULL), _MMU(MMU) +// m_Window(NULL), g_MMU(MMU) //{ //} //CDumpMemory::~CDumpMemory() @@ -261,7 +261,7 @@ LRESULT CDumpMemory::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, // } // if (SendDlgItemMessage((HWND)hDlg,IDC_USE_ALT_PC,BM_GETSTATE, 0,0) != BST_CHECKED) // { -// DumpPC = _this->_MMU->SystemRegisters()->PROGRAM_COUNTER; +// DumpPC = _this->g_MMU->SystemRegisters()->PROGRAM_COUNTER; // } // //disable buttons // EnableWindow(GetDlgItem((HWND)hDlg,IDC_E_START_ADDR),FALSE); @@ -324,7 +324,7 @@ bool CDumpMemory::DumpMemory ( LPCSTR FileName,DumpFormat Format, DWORD StartPC, } // //CDumpMemory::CDumpMemory(CMipsMemory * MMU) : -// m_Window(NULL), _MMU(MMU) +// m_Window(NULL), g_MMU(MMU) //{ //} // @@ -486,7 +486,7 @@ bool CDumpMemory::DumpMemory ( LPCSTR FileName,DumpFormat Format, DWORD StartPC, // // if (SendDlgItemMessage((HWND)hDlg,IDC_USE_ALT_PC,BM_GETSTATE, 0,0) != BST_CHECKED) // { -// DumpPC = _this->_MMU->SystemRegisters()->PROGRAM_COUNTER; +// DumpPC = _this->g_MMU->SystemRegisters()->PROGRAM_COUNTER; // } // //disable buttons // EnableWindow(GetDlgItem((HWND)hDlg,IDC_E_START_ADDR),FALSE); @@ -528,7 +528,7 @@ bool CDumpMemory::DumpMemory ( LPCSTR FileName,DumpFormat Format, DWORD StartPC, // return false; // } // -// for (COpcode OpCode(_MMU,StartPC); OpCode.PC() < EndPC; OpCode.Next()) +// for (COpcode OpCode(g_MMU,StartPC); OpCode.PC() < EndPC; OpCode.Next()) // { // LogFile.Log("%X: %s",OpCode.PC(),OpCode.Name().c_str()); // } diff --git a/Source/Project64/N64 System/Debugger/Debugger - Memory Dump.h b/Source/Project64/N64 System/Debugger/Debugger - Memory Dump.h index 94c78ae08..3bf7f7abd 100644 --- a/Source/Project64/N64 System/Debugger/Debugger - Memory Dump.h +++ b/Source/Project64/N64 System/Debugger/Debugger - Memory Dump.h @@ -32,7 +32,7 @@ public: // { // DisassemblyWithPC // }; -// CMipsMemory * _MMU; +// CMipsMemory * g_MMU; // WND_HANDLE m_Window; // WORD SelStart, SelStop; // static DWORD m_StartAddress; diff --git a/Source/Project64/N64 System/Debugger/Debugger - Memory Search.cpp b/Source/Project64/N64 System/Debugger/Debugger - Memory Search.cpp index 64dd6ee78..d35556c65 100644 --- a/Source/Project64/N64 System/Debugger/Debugger - Memory Search.cpp +++ b/Source/Project64/N64 System/Debugger/Debugger - Memory Search.cpp @@ -70,7 +70,7 @@ LRESULT CDebugMemorySearch::OnClicked(WORD /*wNotifyCode*/, WORD wID, HWND hWndC break; case IDC_BTN_RDRAM: m_PAddrStart.SetValue(0,true,true); - m_SearchLen.SetValue(_MMU->RdramSize(),true,true); + m_SearchLen.SetValue(g_MMU->RdramSize(),true,true); break; case IDC_BTN_ROM: m_PAddrStart.SetValue(0x10000000,true,true); @@ -249,7 +249,7 @@ void CDebugMemorySearch::SearchForValue( void ) m_SearchResults.DeleteAllItems(); DWORD ItemsAdded = 0; - /*while (_MMU->SearchForValue(Value,Size,StartAddress,Len)) + /*while (g_MMU->SearchForValue(Value,Size,StartAddress,Len)) { SearchResultItem Result; Result.PAddr = StartAddress; @@ -285,7 +285,7 @@ void CDebugMemorySearch::SearchForValue( void ) SearchResultItem & Result = m_SearchResult[ItemId]; DWORD NewValue; - /*_MMU->LoadPhysical32(Result.PAddr,NewValue,Size,false); + /*g_MMU->LoadPhysical32(Result.PAddr,NewValue,Size,false); if (Value == NewValue) { @@ -310,7 +310,7 @@ void CDebugMemorySearch::SearchForUnknown() if (Option == CMipsMemory::SearchChangeState_Reset) { m_SearchResults.DeleteAllItems(); - //_MMU->SearchSetBaseForChanges(); + //g_MMU->SearchSetBaseForChanges(); FixUnknownOptions(false); ::ShowWindow(GetDlgItem(IDC_RESET_BUTTON),SW_SHOW); ::EnableWindow(GetDlgItem(IDC_UNKNOWN_ALIGN),true ); @@ -349,7 +349,7 @@ void CDebugMemorySearch::SearchForUnknown() m_SearchResults.DeleteAllItems(); DWORD ItemsAdded = 0, OldValue, NewValue; - while (_MMU->SearchForChanges(Option,Size,StartAddress,Len,OldValue,NewValue)) + while (g_MMU->SearchForChanges(Option,Size,StartAddress,Len,OldValue,NewValue)) { SearchResultItem Result; Result.PAddr = StartAddress; @@ -388,7 +388,7 @@ void CDebugMemorySearch::SearchForUnknown() bool UpdateResult = false; DWORD NewValue; - _MMU->LoadPhysical32(Result.PAddr,NewValue,Size,false); + g_MMU->LoadPhysical32(Result.PAddr,NewValue,Size,false); switch (Option) { case CMipsMemory::SearchChangeState_Changed: diff --git a/Source/Project64/N64 System/Debugger/Debugger - View Memory.cpp b/Source/Project64/N64 System/Debugger/Debugger - View Memory.cpp index 764db7616..2e1a41eef 100644 --- a/Source/Project64/N64 System/Debugger/Debugger - View Memory.cpp +++ b/Source/Project64/N64 System/Debugger/Debugger - View Memory.cpp @@ -171,12 +171,12 @@ LRESULT CDebugMemoryView::OnMemoryModified ( LPNMHDR lpNMHDR ) //sb if ( m_DataVAddrr ) { - if (!_MMU->SB_VAddr(m_DataStartLoc+ Pos,(BYTE)Value)) + if (!g_MMU->SB_VAddr(m_DataStartLoc+ Pos,(BYTE)Value)) { WriteTraceF(TraceError,"CDebugMemoryView::OnMemoryModified - failed to store at %X",m_DataStartLoc + Pos); } } else { - /*if (!_MMU->SD_VAddr(m_DataStartLoc+ Pos,Value,_8Bit)) + /*if (!g_MMU->SD_VAddr(m_DataStartLoc+ Pos,Value,_8Bit)) { WriteTraceF(TraceError,"CDebugMemoryView::OnMemoryModified - failed to store at %X",m_DataStartLoc + Pos); }*/ @@ -358,12 +358,12 @@ void CDebugMemoryView::RefreshMemory ( bool ResetCompare ) if ( m_DataVAddrr ) { - if (!_MMU->LW_VAddr(m_DataStartLoc & ~3, word.UW)) + if (!g_MMU->LW_VAddr(m_DataStartLoc & ~3, word.UW)) { ValidData = false; } } else { - /*if (!_MMU->LoadPhysical32(m_DataStartLoc & ~3, word.UW, _32Bit,false)) + /*if (!g_MMU->LoadPhysical32(m_DataStartLoc & ~3, word.UW, _32Bit,false)) { ValidData = false; }*/ @@ -393,12 +393,12 @@ void CDebugMemoryView::RefreshMemory ( bool ResetCompare ) if ( m_DataVAddrr ) { - if (!_MMU->LW_VAddr(Pos, word.UW)) + if (!g_MMU->LW_VAddr(Pos, word.UW)) { ValidData = false; } } else { - /*if (!_MMU->LoadPhysical32(Pos, word.UW, _32Bit,false)) + /*if (!g_MMU->LoadPhysical32(Pos, word.UW, _32Bit,false)) { ValidData = false; }*/ diff --git a/Source/Project64/N64 System/Debugger/Debugger.cpp b/Source/Project64/N64 System/Debugger/Debugger.cpp index c29a678d2..77cc4b210 100644 --- a/Source/Project64/N64 System/Debugger/Debugger.cpp +++ b/Source/Project64/N64 System/Debugger/Debugger.cpp @@ -46,7 +46,7 @@ void CDebugger::Debug_Reset ( void ) void CDebugger::Debug_ShowMemoryDump() { - if (_MMU == NULL) + if (g_MMU == NULL) { return; } @@ -62,7 +62,7 @@ void CDebugger::Debug_ShowMemoryDump() void CDebugger::Debug_ShowMemoryWindow ( void ) { - if (_MMU == NULL) + if (g_MMU == NULL) { return; } @@ -87,7 +87,7 @@ void CDebugger::Debug_ShowMemoryLocation ( DWORD Address, bool VAddr ) void CDebugger::Debug_ShowTLBWindow (void) { - if (_MMU == NULL) + if (g_MMU == NULL) { return; } diff --git a/Source/Project64/N64 System/Interpreter/Interpreter CPU.cpp b/Source/Project64/N64 System/Interpreter/Interpreter CPU.cpp index 541adc9bd..c56944287 100644 --- a/Source/Project64/N64 System/Interpreter/Interpreter CPU.cpp +++ b/Source/Project64/N64 System/Interpreter/Interpreter CPU.cpp @@ -11,7 +11,7 @@ void ExecuteInterpreterOps (DWORD /*Cycles*/) bool DelaySlotEffectsCompare (DWORD PC, DWORD Reg1, DWORD Reg2) { OPCODE Command; - if (!_MMU->LW_VAddr(PC + 4, Command.Hex)) { + if (!g_MMU->LW_VAddr(PC + 4, Command.Hex)) { //g_Notify->DisplayError("Failed to load word 2"); //ExitThread(0); return TRUE; @@ -236,7 +236,7 @@ void CInterpreterCPU::ExecuteCPU (void ) { while(!Done) { - if (_MMU->LW_VAddr(PROGRAM_COUNTER, Opcode.Hex)) + if (g_MMU->LW_VAddr(PROGRAM_COUNTER, Opcode.Hex)) { /*if (PROGRAM_COUNTER > 0x80000300 && PROGRAM_COUNTER< 0x80380000) { @@ -297,7 +297,7 @@ void CInterpreterCPU::ExecuteCPU (void ) R4300iOp::m_NextInstruction = NORMAL; } } - } __except( _MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) { + } __except( g_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) { g_Notify->DisplayError(GS(MSG_UNKNOWN_MEM_ACTION)); ExitThread(0); } @@ -323,7 +323,7 @@ void CInterpreterCPU::ExecuteOps ( int Cycles ) return; } - if (_MMU->LW_VAddr(PROGRAM_COUNTER, Opcode.Hex)) + if (g_MMU->LW_VAddr(PROGRAM_COUNTER, Opcode.Hex)) { /*if (PROGRAM_COUNTER > 0x80000300 && PROGRAM_COUNTER< 0x80380000) { @@ -344,7 +344,7 @@ void CInterpreterCPU::ExecuteOps ( int Cycles ) *_NextTimer -= m_CountPerOp; /*static DWORD TestAddress = 0x80077B0C, TestValue = 0, CurrentValue = 0; - if (_MMU->LW_VAddr(TestAddress, TestValue)) + if (g_MMU->LW_VAddr(TestAddress, TestValue)) { if (TestValue != CurrentValue) { @@ -403,7 +403,7 @@ void CInterpreterCPU::ExecuteOps ( int Cycles ) R4300iOp::m_NextInstruction = NORMAL; } } - } __except( _MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) { + } __except( g_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) { g_Notify->DisplayError(GS(MSG_UNKNOWN_MEM_ACTION)); ExitThread(0); } diff --git a/Source/Project64/N64 System/Interpreter/Interpreter Ops 32.cpp b/Source/Project64/N64 System/Interpreter/Interpreter Ops 32.cpp index f15fa868d..5cb105243 100644 --- a/Source/Project64/N64 System/Interpreter/Interpreter Ops 32.cpp +++ b/Source/Project64/N64 System/Interpreter/Interpreter Ops 32.cpp @@ -831,7 +831,7 @@ void R4300iOp32::BGTZL (void) { void R4300iOp32::LB (void) { DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; if (m_Opcode.rt == 0) { return; } - if (!_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) { + if (!g_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) { if (bShowTLBMisses()) { #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("LB TLB: %X",Address); @@ -846,7 +846,7 @@ void R4300iOp32::LB (void) { void R4300iOp32::LH (void) { DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; if ((Address & 1) != 0) { ADDRESS_ERROR_EXCEPTION(Address,TRUE); } - if (!_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) { + if (!g_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) { if (bShowTLBMisses()) { g_Notify->DisplayError("LH TLB: %X",Address); } @@ -862,7 +862,7 @@ void R4300iOp32::LWL (void) { Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; Offset = Address & 3; - if (!_MMU->LW_VAddr((Address & ~3),Value)) + if (!g_MMU->LW_VAddr((Address & ~3),Value)) { g_Notify->BreakPoint(__FILE__,__LINE__); if (bShowTLBMisses()) @@ -889,7 +889,7 @@ void R4300iOp32::LW (void) { if (m_Opcode.rt == 0) { return; } - if (!_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { + if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { if (bShowTLBMisses()) { g_Notify->DisplayError("LW TLB: %X",Address); } @@ -901,7 +901,7 @@ void R4300iOp32::LW (void) { void R4300iOp32::LBU (void) { DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if (!_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) { + if (!g_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) { if (bShowTLBMisses()) { g_Notify->DisplayError("LBU TLB: %X",Address); } @@ -914,7 +914,7 @@ void R4300iOp32::LBU (void) { void R4300iOp32::LHU (void) { DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; if ((Address & 1) != 0) { ADDRESS_ERROR_EXCEPTION(Address,TRUE); } - if (!_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) { + if (!g_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) { if (bShowTLBMisses()) { g_Notify->DisplayError("LHU TLB: %X",Address); } @@ -930,7 +930,7 @@ void R4300iOp32::LWR (void) { Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; Offset = Address & 3; - if (!_MMU->LW_VAddr((Address & ~3),Value)) + if (!g_MMU->LW_VAddr((Address & ~3),Value)) { g_Notify->BreakPoint(__FILE__,__LINE__); if (bShowTLBMisses()) @@ -949,7 +949,7 @@ void R4300iOp32::LWU (void) { if ((Address & 3) != 0) { ADDRESS_ERROR_EXCEPTION(Address,TRUE); } if (m_Opcode.rt == 0) { return; } - if (!_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { + if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { if (bShowTLBMisses()) { g_Notify->DisplayError("LWU TLB: %X",Address); } @@ -966,7 +966,7 @@ void R4300iOp32::LL (void) { if (m_Opcode.rt == 0) { return; } - if (!_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { + if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { if (bShowTLBMisses()) { g_Notify->DisplayError("LL TLB: %X",Address); } diff --git a/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp b/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp index 3a29bc1eb..2221fe8b1 100644 --- a/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp +++ b/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp @@ -956,7 +956,7 @@ void R4300iOp::LDL (void) { Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; Offset = Address & 7; - if (!_MMU->LD_VAddr((Address & ~7),Value)) + if (!g_MMU->LD_VAddr((Address & ~7),Value)) { g_Notify->BreakPoint(__FILE__,__LINE__); if (bShowTLBMisses()) @@ -982,7 +982,7 @@ void R4300iOp::LDR (void) { Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; Offset = Address & 7; - if (!_MMU->LD_VAddr((Address & ~7),Value)) + if (!g_MMU->LD_VAddr((Address & ~7),Value)) { g_Notify->BreakPoint(__FILE__,__LINE__); if (bShowTLBMisses()) @@ -1000,7 +1000,7 @@ void R4300iOp::LDR (void) { void R4300iOp::LB (void) { DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; if (m_Opcode.rt == 0) { return; } - if (!_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) { + if (!g_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) { if (bShowTLBMisses()) { #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("LB TLB: %X",Address); @@ -1015,7 +1015,7 @@ void R4300iOp::LB (void) { void R4300iOp::LH (void) { DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; if ((Address & 1) != 0) { ADDRESS_ERROR_EXCEPTION(Address,TRUE); } - if (!_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) { + if (!g_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) { if (bShowTLBMisses()) { g_Notify->DisplayError("LH TLB: %X",Address); } @@ -1031,7 +1031,7 @@ void R4300iOp::LWL (void) { Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; Offset = Address & 3; - if (!_MMU->LW_VAddr((Address & ~3),Value)) + if (!g_MMU->LW_VAddr((Address & ~3),Value)) { g_Notify->BreakPoint(__FILE__,__LINE__); if (bShowTLBMisses()) @@ -1058,7 +1058,7 @@ void R4300iOp::LW (void) { if (m_Opcode.rt == 0) { return; } - if (!_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { + if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { if (bShowTLBMisses()) { g_Notify->DisplayError("LW TLB: %X",Address); } @@ -1070,7 +1070,7 @@ void R4300iOp::LW (void) { void R4300iOp::LBU (void) { DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if (!_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) { + if (!g_MMU->LB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) { if (bShowTLBMisses()) { g_Notify->DisplayError("LBU TLB: %X",Address); } @@ -1083,7 +1083,7 @@ void R4300iOp::LBU (void) { void R4300iOp::LHU (void) { DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; if ((Address & 1) != 0) { ADDRESS_ERROR_EXCEPTION(Address,TRUE); } - if (!_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) { + if (!g_MMU->LH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) { if (bShowTLBMisses()) { g_Notify->DisplayError("LHU TLB: %X",Address); } @@ -1099,7 +1099,7 @@ void R4300iOp::LWR (void) { Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; Offset = Address & 3; - if (!_MMU->LW_VAddr((Address & ~3),Value)) + if (!g_MMU->LW_VAddr((Address & ~3),Value)) { g_Notify->BreakPoint(__FILE__,__LINE__); if (bShowTLBMisses()) @@ -1118,7 +1118,7 @@ void R4300iOp::LWU (void) { if ((Address & 3) != 0) { ADDRESS_ERROR_EXCEPTION(Address,TRUE); } if (m_Opcode.rt == 0) { return; } - if (!_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { + if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { if (bShowTLBMisses()) { g_Notify->DisplayError("LWU TLB: %X",Address); } @@ -1130,7 +1130,7 @@ void R4300iOp::LWU (void) { void R4300iOp::SB (void) { DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; - if (!_MMU->SB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) { + if (!g_MMU->SB_VAddr(Address,_GPR[m_Opcode.rt].UB[0])) { g_Notify->BreakPoint(__FILE__,__LINE__); #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("SB TLB: %X",Address); @@ -1141,7 +1141,7 @@ void R4300iOp::SB (void) { void R4300iOp::SH (void) { DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; if ((Address & 1) != 0) { ADDRESS_ERROR_EXCEPTION(Address,FALSE); } - if (!_MMU->SH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) { + if (!g_MMU->SH_VAddr(Address,_GPR[m_Opcode.rt].UHW[0])) { g_Notify->BreakPoint(__FILE__,__LINE__); #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("SH TLB: %X",Address); @@ -1155,7 +1155,7 @@ void R4300iOp::SWL (void) { Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; Offset = Address & 3; - if (!_MMU->LW_VAddr((Address & ~3),Value)) { + if (!g_MMU->LW_VAddr((Address & ~3),Value)) { #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("SWL TLB: %X",Address); #endif @@ -1166,7 +1166,7 @@ void R4300iOp::SWL (void) { Value &= SWL_MASK[Offset]; Value += _GPR[m_Opcode.rt].UW[0] >> SWL_SHIFT[Offset]; - if (!_MMU->SW_VAddr((Address & ~0x03),Value)) { + if (!g_MMU->SW_VAddr((Address & ~0x03),Value)) { #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("SWL TLB: %X",Address); #endif @@ -1184,7 +1184,7 @@ void R4300iOp::SW (void) { Log_SW((*_PROGRAM_COUNTER),Address,_GPR[m_Opcode.rt].UW[0]); } #endif - if (!_MMU->SW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) + if (!g_MMU->SW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { g_Notify->BreakPoint(__FILE__,__LINE__); if (bShowTLBMisses()) @@ -1211,7 +1211,7 @@ void R4300iOp::SDL (void) { Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; Offset = Address & 7; - if (!_MMU->LD_VAddr((Address & ~7),Value)) { + if (!g_MMU->LD_VAddr((Address & ~7),Value)) { g_Notify->BreakPoint(__FILE__,__LINE__); #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("SDL TLB: %X",Address); @@ -1222,7 +1222,7 @@ void R4300iOp::SDL (void) { Value &= SDL_MASK[Offset]; Value += _GPR[m_Opcode.rt].UDW >> SDL_SHIFT[Offset]; - if (!_MMU->SD_VAddr((Address & ~7),Value)) { + if (!g_MMU->SD_VAddr((Address & ~7),Value)) { g_Notify->BreakPoint(__FILE__,__LINE__); #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("SDL TLB: %X",Address); @@ -1248,7 +1248,7 @@ void R4300iOp::SDR (void) { Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; Offset = Address & 7; - if (!_MMU->LD_VAddr((Address & ~7),Value)) { + if (!g_MMU->LD_VAddr((Address & ~7),Value)) { g_Notify->BreakPoint(__FILE__,__LINE__); #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("SDL TLB: %X",Address); @@ -1259,7 +1259,7 @@ void R4300iOp::SDR (void) { Value &= SDR_MASK[Offset]; Value += _GPR[m_Opcode.rt].UDW << SDR_SHIFT[Offset]; - if (!_MMU->SD_VAddr((Address & ~7),Value)) { + if (!g_MMU->SD_VAddr((Address & ~7),Value)) { g_Notify->BreakPoint(__FILE__,__LINE__); #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("SDL TLB: %X",Address); @@ -1273,7 +1273,7 @@ void R4300iOp::SWR (void) { Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; Offset = Address & 3; - if (!_MMU->LW_VAddr((Address & ~3),Value)) { + if (!g_MMU->LW_VAddr((Address & ~3),Value)) { g_Notify->BreakPoint(__FILE__,__LINE__); #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("SWL TLB: %X",Address); @@ -1284,7 +1284,7 @@ void R4300iOp::SWR (void) { Value &= SWR_MASK[Offset]; Value += _GPR[m_Opcode.rt].UW[0] << SWR_SHIFT[Offset]; - if (!_MMU->SW_VAddr((Address & ~0x03),Value)) { + if (!g_MMU->SW_VAddr((Address & ~0x03),Value)) { g_Notify->BreakPoint(__FILE__,__LINE__); #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("SWL TLB: %X",Address); @@ -1306,7 +1306,7 @@ void R4300iOp::LL (void) { if (m_Opcode.rt == 0) { return; } - if (!_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { + if (!g_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { if (bShowTLBMisses()) { g_Notify->DisplayError("LL TLB: %X",Address); } @@ -1321,7 +1321,7 @@ void R4300iOp::LWC1 (void) { DWORD Address = _GPR[m_Opcode.base].UW[0] + (DWORD)((short)m_Opcode.offset); TEST_COP1_USABLE_EXCEPTION if ((Address & 3) != 0) { ADDRESS_ERROR_EXCEPTION(Address,TRUE); } - if (!_MMU->LW_VAddr(Address,*(DWORD *)_FPR_S[m_Opcode.ft])) { + if (!g_MMU->LW_VAddr(Address,*(DWORD *)_FPR_S[m_Opcode.ft])) { if (bShowTLBMisses()) { g_Notify->DisplayError("LWC1 TLB: %X",Address); } @@ -1336,7 +1336,7 @@ void R4300iOp::SC (void) { Log_SW((*_PROGRAM_COUNTER),Address,_GPR[m_Opcode.rt].UW[0]); #endif if ((*_LLBit) == 1) { - if (!_MMU->SW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) + if (!g_MMU->SW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { g_Notify->BreakPoint(__FILE__,__LINE__); if (bShowTLBMisses()) @@ -1351,7 +1351,7 @@ void R4300iOp::SC (void) { void R4300iOp::LD (void) { DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; if ((Address & 7) != 0) { ADDRESS_ERROR_EXCEPTION(Address,TRUE); } - if (!_MMU->LD_VAddr(Address,_GPR[m_Opcode.rt].UDW)) { + if (!g_MMU->LD_VAddr(Address,_GPR[m_Opcode.rt].UDW)) { g_Notify->BreakPoint(__FILE__,__LINE__); #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("LD TLB: %X",Address); @@ -1370,7 +1370,7 @@ void R4300iOp::LDC1 (void) { TEST_COP1_USABLE_EXCEPTION if ((Address & 7) != 0) { ADDRESS_ERROR_EXCEPTION(Address,TRUE); } - if (!_MMU->LD_VAddr(Address,*(unsigned __int64 *)_FPR_D[m_Opcode.ft])) { + if (!g_MMU->LD_VAddr(Address,*(unsigned __int64 *)_FPR_D[m_Opcode.ft])) { g_Notify->BreakPoint(__FILE__,__LINE__); #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("LD TLB: %X",Address); @@ -1383,7 +1383,7 @@ void R4300iOp::SWC1 (void) { TEST_COP1_USABLE_EXCEPTION if ((Address & 3) != 0) { ADDRESS_ERROR_EXCEPTION(Address,FALSE); } - if (!_MMU->SW_VAddr(Address,*(DWORD *)_FPR_S[m_Opcode.ft])) { + if (!g_MMU->SW_VAddr(Address,*(DWORD *)_FPR_S[m_Opcode.ft])) { g_Notify->BreakPoint(__FILE__,__LINE__); #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("SWC1 TLB: %X",Address); @@ -1396,7 +1396,7 @@ void R4300iOp::SDC1 (void) { TEST_COP1_USABLE_EXCEPTION if ((Address & 7) != 0) { ADDRESS_ERROR_EXCEPTION(Address,FALSE); } - if (!_MMU->SD_VAddr(Address,*(__int64 *)_FPR_D[m_Opcode.ft])) { + if (!g_MMU->SD_VAddr(Address,*(__int64 *)_FPR_D[m_Opcode.ft])) { g_Notify->BreakPoint(__FILE__,__LINE__); #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("SDC1 TLB: %X",Address); @@ -1407,7 +1407,7 @@ void R4300iOp::SDC1 (void) { void R4300iOp::SD (void) { DWORD Address = _GPR[m_Opcode.base].UW[0] + (short)m_Opcode.offset; if ((Address & 7) != 0) { ADDRESS_ERROR_EXCEPTION(Address,FALSE); } - if (!_MMU->SD_VAddr(Address,_GPR[m_Opcode.rt].UDW)) { + if (!g_MMU->SD_VAddr(Address,_GPR[m_Opcode.rt].UDW)) { g_Notify->BreakPoint(__FILE__,__LINE__); #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("SD TLB: %X",Address); diff --git a/Source/Project64/N64 System/Mips/Dma.cpp b/Source/Project64/N64 System/Mips/Dma.cpp index 4d275e8c0..7f726cfee 100644 --- a/Source/Project64/N64 System/Mips/Dma.cpp +++ b/Source/Project64/N64 System/Mips/Dma.cpp @@ -8,11 +8,11 @@ CDMA::CDMA(CFlashram & FlashRam, CSram & Sram) : void CDMA::OnFirstDMA (void) { switch (_Rom->CicChipID()) { - case 1: *(DWORD *)&((_MMU->Rdram())[0x318]) = _MMU->RdramSize(); break; - case 2: *(DWORD *)&((_MMU->Rdram())[0x318]) = _MMU->RdramSize(); break; - case 3: *(DWORD *)&((_MMU->Rdram())[0x318]) = _MMU->RdramSize(); break; - case 5: *(DWORD *)&((_MMU->Rdram())[0x3F0]) = _MMU->RdramSize(); break; - case 6: *(DWORD *)&((_MMU->Rdram())[0x318]) = _MMU->RdramSize(); break; + case 1: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break; + case 2: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break; + case 3: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break; + case 5: *(DWORD *)&((g_MMU->Rdram())[0x3F0]) = g_MMU->RdramSize(); break; + case 6: *(DWORD *)&((g_MMU->Rdram())[0x318]) = g_MMU->RdramSize(); break; default: g_Notify->DisplayError("Unhandled CicChip(%d) in first DMA",_Rom->CicChipID()); } } @@ -20,7 +20,7 @@ void CDMA::OnFirstDMA (void) { void CDMA::PI_DMA_READ (void) { // PI_STATUS_REG |= PI_STATUS_DMA_BUSY; - if ( _Reg->PI_DRAM_ADDR_REG + _Reg->PI_RD_LEN_REG + 1 > _MMU->RdramSize()) { + if ( _Reg->PI_DRAM_ADDR_REG + _Reg->PI_RD_LEN_REG + 1 > g_MMU->RdramSize()) { #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("PI_DMA_READ not in Memory"); #endif @@ -34,7 +34,7 @@ void CDMA::PI_DMA_READ (void) { 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, + g_MMU->Rdram() + _Reg->PI_DRAM_ADDR_REG, _Reg->PI_CART_ADDR_REG - 0x08000000, _Reg->PI_RD_LEN_REG + 1 ); @@ -45,7 +45,7 @@ void CDMA::PI_DMA_READ (void) { } if (g_System->m_SaveUsing == SaveChip_FlashRam) { m_FlashRam.DmaToFlashram( - _MMU->Rdram()+_Reg->PI_DRAM_ADDR_REG, + g_MMU->Rdram()+_Reg->PI_DRAM_ADDR_REG, _Reg->PI_CART_ADDR_REG - 0x08000000, _Reg->PI_WR_LEN_REG + 1 ); @@ -75,7 +75,7 @@ void CDMA::PI_DMA_READ (void) { void CDMA::PI_DMA_WRITE (void) { _Reg->PI_STATUS_REG |= PI_STATUS_DMA_BUSY; - if ( _Reg->PI_DRAM_ADDR_REG + _Reg->PI_WR_LEN_REG + 1 > _MMU->RdramSize()) + if ( _Reg->PI_DRAM_ADDR_REG + _Reg->PI_WR_LEN_REG + 1 > g_MMU->RdramSize()) { if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { g_Notify->DisplayError("PI_DMA_WRITE not in Memory"); } _Reg->PI_STATUS_REG &= ~PI_STATUS_DMA_BUSY; @@ -88,7 +88,7 @@ void CDMA::PI_DMA_WRITE (void) { 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, + g_MMU->Rdram()+_Reg->PI_DRAM_ADDR_REG, _Reg->PI_CART_ADDR_REG - 0x08000000, _Reg->PI_WR_LEN_REG + 1 ); @@ -99,7 +99,7 @@ void CDMA::PI_DMA_WRITE (void) { } if (g_System->m_SaveUsing == SaveChip_FlashRam) { m_FlashRam.DmaFromFlashram( - _MMU->Rdram()+_Reg->PI_DRAM_ADDR_REG, + g_MMU->Rdram()+_Reg->PI_DRAM_ADDR_REG, _Reg->PI_CART_ADDR_REG - 0x08000000, _Reg->PI_WR_LEN_REG + 1 ); @@ -122,7 +122,7 @@ void CDMA::PI_DMA_WRITE (void) { #endif #endif BYTE * ROM = _Rom->GetRomAddress(); - BYTE * RDRAM = _MMU->Rdram(); + BYTE * RDRAM = g_MMU->Rdram(); _Reg->PI_CART_ADDR_REG -= 0x10000000; if (_Reg->PI_CART_ADDR_REG + _Reg->PI_WR_LEN_REG + 1 < _Rom->GetRomSize()) { for (i = 0; i < _Reg->PI_WR_LEN_REG + 1; i ++) { @@ -167,7 +167,7 @@ void CDMA::PI_DMA_WRITE (void) { void CDMA::SP_DMA_READ (void) { _Reg->SP_DRAM_ADDR_REG &= 0x1FFFFFFF; - if (_Reg->SP_DRAM_ADDR_REG > _MMU->RdramSize()) { + if (_Reg->SP_DRAM_ADDR_REG > g_MMU->RdramSize()) { #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("SP DMA\nSP_DRAM_ADDR_REG not in RDRam space"); #endif @@ -187,7 +187,7 @@ void CDMA::SP_DMA_READ (void) { if ((_Reg->SP_DRAM_ADDR_REG & 3) != 0) { g_Notify->BreakPoint(__FILE__,__LINE__); } if (((_Reg->SP_RD_LEN_REG + 1) & 3) != 0) { g_Notify->BreakPoint(__FILE__,__LINE__); } - memcpy( _MMU->Dmem() + (_Reg->SP_MEM_ADDR_REG & 0x1FFF), _MMU->Rdram() + _Reg->SP_DRAM_ADDR_REG, + memcpy( g_MMU->Dmem() + (_Reg->SP_MEM_ADDR_REG & 0x1FFF), g_MMU->Rdram() + _Reg->SP_DRAM_ADDR_REG, _Reg->SP_RD_LEN_REG + 1 ); _Reg->SP_DMA_BUSY_REG = 0; @@ -195,7 +195,7 @@ void CDMA::SP_DMA_READ (void) { } void CDMA::SP_DMA_WRITE (void) { - if (_Reg->SP_DRAM_ADDR_REG > _MMU->RdramSize()) { + if (_Reg->SP_DRAM_ADDR_REG > g_MMU->RdramSize()) { #ifndef EXTERNAL_RELEASE g_Notify->DisplayError("SP DMA WRITE\nSP_DRAM_ADDR_REG not in RDRam space"); #endif @@ -213,7 +213,7 @@ void CDMA::SP_DMA_WRITE (void) { if ((_Reg->SP_DRAM_ADDR_REG & 3) != 0) { g_Notify->BreakPoint(__FILE__,__LINE__); } if (((_Reg->SP_WR_LEN_REG + 1) & 3) != 0) { g_Notify->BreakPoint(__FILE__,__LINE__); } - memcpy( _MMU->Rdram() + _Reg->SP_DRAM_ADDR_REG, _MMU->Dmem() + (_Reg->SP_MEM_ADDR_REG & 0x1FFF), + memcpy( g_MMU->Rdram() + _Reg->SP_DRAM_ADDR_REG, g_MMU->Dmem() + (_Reg->SP_MEM_ADDR_REG & 0x1FFF), _Reg->SP_WR_LEN_REG + 1); _Reg->SP_DMA_BUSY_REG = 0; diff --git a/Source/Project64/N64 System/Mips/FlashRam.cpp b/Source/Project64/N64 System/Mips/FlashRam.cpp index ac171d177..4cb9997b2 100644 --- a/Source/Project64/N64 System/Mips/FlashRam.cpp +++ b/Source/Project64/N64 System/Mips/FlashRam.cpp @@ -72,7 +72,7 @@ void CFlashram::DmaFromFlashram ( BYTE * dest, int StartOffset, int len) break; #ifndef EXTERNAL_RELEASE default: - g_Notify->DisplayError("DmaFromFlashram Start: %X, Offset: %X len: %X",dest - _MMU->Rdram(),StartOffset,len); + g_Notify->DisplayError("DmaFromFlashram Start: %X, Offset: %X len: %X",dest - g_MMU->Rdram(),StartOffset,len); #endif } } @@ -84,7 +84,7 @@ void CFlashram::DmaToFlashram(BYTE * Source, int StartOffset, int len) { break; #ifndef EXTERNAL_RELEASE default: - g_Notify->DisplayError("DmaToFlashram Start: %X, Offset: %X len: %X",Source - _MMU->Rdram(),StartOffset,len); + g_Notify->DisplayError("DmaToFlashram Start: %X, Offset: %X len: %X",Source - g_MMU->Rdram(),StartOffset,len); #endif } } diff --git a/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp b/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp index 4f8f940ed..6be86318e 100644 --- a/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp +++ b/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp @@ -1345,7 +1345,7 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer ) //convert the pointer since we are not having win32 stuctures in headers LPEXCEPTION_POINTERS lpEP = (LPEXCEPTION_POINTERS)lpExceptionPointer; - DWORD MemAddress = (char *)lpEP->ExceptionRecord->ExceptionInformation[1] - (char *)_MMU->Rdram(); + DWORD MemAddress = (char *)lpEP->ExceptionRecord->ExceptionInformation[1] - (char *)g_MMU->Rdram(); if ((int)(MemAddress) < 0 || MemAddress > 0x1FFFFFFF) { // if (bHaveDebugger()) { g_Notify->BreakPoint(__FILE__,__LINE__); } @@ -1884,7 +1884,7 @@ int CMipsMemoryVM::LW_NonMemory ( DWORD PAddr, DWORD * Value ) { } else if (PAddr < 0x1FC00800) { - BYTE * PIF_Ram = _MMU->PifRam(); + BYTE * PIF_Ram = g_MMU->PifRam(); DWORD ToSwap = *(DWORD *)(&PIF_Ram[PAddr - 0x1FC007C0]); _asm { mov eax,ToSwap @@ -2983,7 +2983,7 @@ void CMipsMemoryVM::Compile_LD (void) if (bFastSP() && Opcode.rt == 29) { ResetX86Protection(); - _MMU->ResetMemoryStack(); + g_MMU->ResetMemoryStack(); } } diff --git a/Source/Project64/N64 System/Mips/OpCode Class.cpp b/Source/Project64/N64 System/Mips/OpCode Class.cpp index 3b18b28a2..ab0905648 100644 --- a/Source/Project64/N64 System/Mips/OpCode Class.cpp +++ b/Source/Project64/N64 System/Mips/OpCode Class.cpp @@ -87,7 +87,7 @@ bool COpcode::Next (void) { g_Notify->BreakPoint(__FILE__,__LINE__); } - if (!_MMU->LW_VAddr(m_opcode.VirtualAddress,m_opcode.Hex)) { + if (!g_MMU->LW_VAddr(m_opcode.VirtualAddress,m_opcode.Hex)) { return false; } return true; @@ -95,7 +95,7 @@ bool COpcode::Next (void) { void COpcode::SetJump ( DWORD Target, bool Delay ) { if (Target == PC()) { - if (_MMU->ValidVaddr(Target + OpCode_Size)) { + if (g_MMU->ValidVaddr(Target + OpCode_Size)) { if (HasDelaySlot() && !DelaySlotEffectsJump()) { m_InPermLoop = PermLoop_Jump; m_FlagSet = true; diff --git a/Source/Project64/N64 System/Mips/Pif Ram.cpp b/Source/Project64/N64 System/Mips/Pif Ram.cpp index 861fcb48e..35b734615 100644 --- a/Source/Project64/N64 System/Mips/Pif Ram.cpp +++ b/Source/Project64/N64 System/Mips/Pif Ram.cpp @@ -204,7 +204,7 @@ void CPifRam::PifRamWrite (void) { void CPifRam::SI_DMA_READ (void) { BYTE * PifRamPos = m_PifRam; - BYTE * RDRAM = _MMU->Rdram(); + BYTE * RDRAM = g_MMU->Rdram(); DWORD & SI_DRAM_ADDR_REG = _Reg->SI_DRAM_ADDR_REG; if ((int)SI_DRAM_ADDR_REG > (int)RdramSize()) @@ -309,7 +309,7 @@ void CPifRam::SI_DMA_WRITE (void) } SI_DRAM_ADDR_REG &= 0xFFFFFFF8; - BYTE * RDRAM = _MMU->Rdram(); + BYTE * RDRAM = g_MMU->Rdram(); if ((int)SI_DRAM_ADDR_REG < 0) { int count, RdramPos; @@ -523,7 +523,7 @@ void CPifRam::ReadControllerCommand (int Control, BYTE * Command) { void CPifRam::LogControllerPakData (char * Description) { - BYTE * PIF_Ram = _MMU->PifRam(); + BYTE * PIF_Ram = g_MMU->PifRam(); #if (!defined(EXTERNAL_RELEASE)) int count, count2; diff --git a/Source/Project64/N64 System/Mips/System Events.cpp b/Source/Project64/N64 System/Mips/System Events.cpp index f8bb6eca4..96b08aecf 100644 --- a/Source/Project64/N64 System/Mips/System Events.cpp +++ b/Source/Project64/N64 System/Mips/System Events.cpp @@ -115,7 +115,7 @@ void CSystemEvents::ExecuteEvents ( void ) return; if (g_BaseSystem->m_Cheats.CheatsSlectionChanged()) g_BaseSystem->m_Cheats.LoadCheats(false); - g_BaseSystem->m_Cheats.ApplyGSButton(_MMU); + g_BaseSystem->m_Cheats.ApplyGSButton(g_MMU); break; case SysEvent_PauseCPU_FromMenu: if (!g_Settings->LoadBool(GameRunning_CPU_Paused)) diff --git a/Source/Project64/N64 System/N64 Class.cpp b/Source/Project64/N64 System/N64 Class.cpp index 678b1914d..2a2666949 100644 --- a/Source/Project64/N64 System/N64 Class.cpp +++ b/Source/Project64/N64 System/N64 Class.cpp @@ -335,7 +335,7 @@ void CN64System::StartEmulation ( bool NewThread ) __try { StartEmulation2(NewThread); - } __except( _MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) { + } __except( g_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) { char Message[600]; sprintf(Message,"Exception caught\nFile: %s\nLine: %d",__FILE__,__LINE__); MessageBox(NULL,Message,"Exception",MB_OK); @@ -527,7 +527,7 @@ bool CN64System::SetActiveSystem( bool bActive ) g_SyncSystem = m_SyncCPU; } g_Recompiler = m_Recomp; - _MMU = &m_MMU_VM; + g_MMU = &m_MMU_VM; _TLB = &m_TLB; _Reg = &m_Reg; _Audio = &m_Audio; @@ -559,7 +559,7 @@ bool CN64System::SetActiveSystem( bool bActive ) g_System = NULL; g_SyncSystem = NULL; g_Recompiler = NULL; - _MMU = NULL; + g_MMU = NULL; _TLB = NULL; _Reg = NULL; _Audio = NULL; @@ -1133,7 +1133,7 @@ void CN64System::DumpSyncErrors (CN64System * SecondCPU) { for (count = -10; count < 10; count++) { DWORD OpcodeValue, Addr = m_Reg.m_PROGRAM_COUNTER + (count << 2); - if (_MMU->LW_VAddr(Addr,OpcodeValue)) + if (g_MMU->LW_VAddr(Addr,OpcodeValue)) { Error.LogF("%X: %s\r\n",Addr,R4300iOpcodeName(OpcodeValue,Addr)); } @@ -1144,7 +1144,7 @@ void CN64System::DumpSyncErrors (CN64System * SecondCPU) { for (count = 0; count < 50; count++) { DWORD OpcodeValue, Addr = m_LastSuccessSyncPC[0] + (count << 2); - if (_MMU->LW_VAddr(Addr,OpcodeValue)) + if (g_MMU->LW_VAddr(Addr,OpcodeValue)) { Error.LogF("%X: %s\r\n",Addr,R4300iOpcodeName(OpcodeValue,Addr)); } @@ -1233,10 +1233,10 @@ bool CN64System::SaveState(void) zipWriteInFileInZip(file,m_Reg.m_RDRAM_Interface,sizeof(DWORD)*8); zipWriteInFileInZip(file,m_Reg.m_SerialInterface,sizeof(DWORD)*4); zipWriteInFileInZip(file,(void *const)&_TLB->TlbEntry(0),sizeof(CTLB::TLB_ENTRY)*32); - zipWriteInFileInZip(file,_MMU->PifRam(),0x40); - zipWriteInFileInZip(file,_MMU->Rdram(),RdramSize); - zipWriteInFileInZip(file,_MMU->Dmem(),0x1000); - zipWriteInFileInZip(file,_MMU->Imem(),0x1000); + zipWriteInFileInZip(file,g_MMU->PifRam(),0x40); + zipWriteInFileInZip(file,g_MMU->Rdram(),RdramSize); + zipWriteInFileInZip(file,g_MMU->Dmem(),0x1000); + zipWriteInFileInZip(file,g_MMU->Imem(),0x1000); zipCloseFileInZip(file); zipOpenNewFileInZip(file,ExtraInfoFileName.c_str(),NULL,NULL,0,NULL,0,NULL,Z_DEFLATED,Z_DEFAULT_COMPRESSION); @@ -1277,10 +1277,10 @@ bool CN64System::SaveState(void) WriteFile( hSaveFile,m_Reg.m_RDRAM_Interface,sizeof(DWORD)*8,&dwWritten,NULL); WriteFile( hSaveFile,m_Reg.m_SerialInterface,sizeof(DWORD)*4,&dwWritten,NULL); WriteFile( hSaveFile,&_TLB->TlbEntry(0),sizeof(CTLB::TLB_ENTRY)*32,&dwWritten,NULL); - WriteFile( hSaveFile,_MMU->PifRam(),0x40,&dwWritten,NULL); - WriteFile( hSaveFile,_MMU->Rdram(),RdramSize,&dwWritten,NULL); - WriteFile( hSaveFile,_MMU->Dmem(),0x1000,&dwWritten,NULL); - WriteFile( hSaveFile,_MMU->Imem(),0x1000,&dwWritten,NULL); + WriteFile( hSaveFile,g_MMU->PifRam(),0x40,&dwWritten,NULL); + WriteFile( hSaveFile,g_MMU->Rdram(),RdramSize,&dwWritten,NULL); + WriteFile( hSaveFile,g_MMU->Dmem(),0x1000,&dwWritten,NULL); + WriteFile( hSaveFile,g_MMU->Imem(),0x1000,&dwWritten,NULL); CloseHandle(hSaveFile); } @@ -1392,8 +1392,8 @@ bool CN64System::LoadState(LPCSTR FileName) { } Reset(false,true); - _MMU->UnProtectMemory(0x80000000,0x80000000 + g_Settings->LoadDword(Game_RDRamSize) - 4); - _MMU->UnProtectMemory(0xA4000000,0xA4001FFC); + g_MMU->UnProtectMemory(0x80000000,0x80000000 + g_Settings->LoadDword(Game_RDRamSize) - 4); + g_MMU->UnProtectMemory(0xA4000000,0xA4001FFC); g_Settings->SaveDword(Game_RDRamSize,SaveRDRAMSize); unzReadCurrentFile(file,&NextVITimer,sizeof(NextVITimer)); unzReadCurrentFile(file,&m_Reg.m_PROGRAM_COUNTER,sizeof(m_Reg.m_PROGRAM_COUNTER)); @@ -1535,7 +1535,7 @@ void CN64System::RunRSP ( void ) { WriteTraceF(TraceRSP, "RunRSP: SP Status %X",m_Reg.SP_STATUS_REG); if ( ( m_Reg.SP_STATUS_REG & SP_STATUS_HALT ) == 0) { if ( ( m_Reg.SP_STATUS_REG & SP_STATUS_BROKE ) == 0 ) { - DWORD Task; _MMU->LW_VAddr(0xA4000FC0,Task); + DWORD Task; g_MMU->LW_VAddr(0xA4000FC0,Task); SPECIAL_TIMERS CPU_UsageAddr = Timer_None/*, ProfileAddr = Timer_None*/; if (Task == 1 && (m_Reg.DPC_STATUS_REG & DPC_STATUS_FREEZE) != 0) @@ -1580,7 +1580,7 @@ void CN64System::RunRSP ( void ) { WriteTrace(TraceRSP, "RunRSP: do cycles - starting"); _Plugins->RSP()->DoRspCycles(100); WriteTrace(TraceRSP, "RunRSP: do cycles - Done"); - } __except( _MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) { + } __except( g_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) { WriteTrace(TraceError, "RunRSP: exception generated"); g_Notify->FatalError("Unknown memory action\n\nEmulation stop"); } @@ -1690,7 +1690,7 @@ void CN64System::RefreshScreen ( void ) { WriteTrace(TraceGfxPlugin,"UpdateScreen: Starting"); _Plugins->Gfx()->UpdateScreen(); WriteTrace(TraceGfxPlugin,"UpdateScreen: Done"); - } __except (_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation())) { + } __except (g_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation())) { WriteTrace(TraceGfxPlugin,"UpdateScreen: Exception caught"); WriteTrace(TraceError,"Exception caught in UpdateScreen"); } @@ -1725,7 +1725,7 @@ void CN64System::RefreshScreen ( void ) { return; if (g_BaseSystem->m_Cheats.CheatsSlectionChanged()) g_BaseSystem->m_Cheats.LoadCheats(false); - g_BaseSystem->m_Cheats.ApplyCheats(_MMU); + g_BaseSystem->m_Cheats.ApplyCheats(g_MMU); } // if (bProfiling) { m_Profile.StartTimer(ProfilingAddr != Timer_None ? ProfilingAddr : Timer_R4300); } } diff --git a/Source/Project64/N64 System/Recompiler/Code Block.cpp b/Source/Project64/N64 System/Recompiler/Code Block.cpp index 8ea6902ad..c6b60d947 100644 --- a/Source/Project64/N64 System/Recompiler/Code Block.cpp +++ b/Source/Project64/N64 System/Recompiler/Code Block.cpp @@ -348,7 +348,7 @@ bool CCodeBlock::AnalyzeInstruction ( DWORD PC, DWORD & TargetPC, DWORD & Contin PermLoop = false; OPCODE Command; - if (!_MMU->LW_VAddr(PC, Command.Hex)) { + if (!g_MMU->LW_VAddr(PC, Command.Hex)) { g_Notify->BreakPoint(__FILE__,__LINE__); return false; } @@ -652,7 +652,7 @@ bool CCodeBlock::Compile() DWORD PAddr; _TransVaddr->TranslateVaddr(VAddrFirst(),PAddr); - MD5(_MMU->Rdram() + PAddr,(VAddrLast() - VAddrFirst()) + 4).get_digest(m_Hash); + MD5(g_MMU->Rdram() + PAddr,(VAddrLast() - VAddrFirst()) + 4).get_digest(m_Hash); return true; } diff --git a/Source/Project64/N64 System/Recompiler/Code Section.cpp b/Source/Project64/N64 System/Recompiler/Code Section.cpp index f042429b6..d8f00e671 100644 --- a/Source/Project64/N64 System/Recompiler/Code Section.cpp +++ b/Source/Project64/N64 System/Recompiler/Code Section.cpp @@ -7,7 +7,7 @@ bool DelaySlotEffectsCompare ( DWORD PC, DWORD Reg1, DWORD Reg2 ); int DelaySlotEffectsJump (DWORD JumpPC) { OPCODE Command; - if (!_MMU->LW_VAddr(JumpPC, Command.Hex)) { return TRUE; } + if (!g_MMU->LW_VAddr(JumpPC, Command.Hex)) { return TRUE; } switch (Command.op) { case R4300i_SPECIAL: @@ -47,7 +47,7 @@ int DelaySlotEffectsJump (DWORD JumpPC) { int EffectDelaySlot; OPCODE NewCommand; - if (!_MMU->LW_VAddr(JumpPC + 4, NewCommand.Hex)) { return TRUE; } + if (!g_MMU->LW_VAddr(JumpPC + 4, NewCommand.Hex)) { return TRUE; } EffectDelaySlot = FALSE; if (NewCommand.op == R4300i_CP1) { @@ -912,12 +912,12 @@ bool CCodeSection::GenerateX86Code ( DWORD Test ) do { __try { - if (!_MMU->LW_VAddr(m_CompilePC,m_Opcode.Hex)) + if (!g_MMU->LW_VAddr(m_CompilePC,m_Opcode.Hex)) { g_Notify->DisplayError(GS(MSG_FAIL_LOAD_WORD)); ExitThread(0); } - } __except( _MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) { + } __except( g_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) { g_Notify->DisplayError(GS(MSG_UNKNOWN_MEM_ACTION)); ExitThread(0); } @@ -1236,32 +1236,32 @@ bool CCodeSection::GenerateX86Code ( DWORD Test ) case R4300i_BGTZL:Compile_BranchLikely(BGTZ_Compare,false); break; case R4300i_BLEZL:Compile_BranchLikely(BLEZ_Compare,false); break; case R4300i_DADDIU: DADDIU(); break; - case R4300i_LDL: _MMU->Compile_LDL(); break; - case R4300i_LDR: _MMU->Compile_LDR(); break; - case R4300i_LB: _MMU->Compile_LB(); break; - case R4300i_LH: _MMU->Compile_LH(); break; - case R4300i_LWL: _MMU->Compile_LWL(); break; - case R4300i_LW: _MMU->Compile_LW(); break; - case R4300i_LBU: _MMU->Compile_LBU(); break; - case R4300i_LHU: _MMU->Compile_LHU(); break; - case R4300i_LWR: _MMU->Compile_LWR(); break; - case R4300i_LWU: _MMU->Compile_LWU(); break; //added by Witten - case R4300i_SB: _MMU->Compile_SB(); break; - case R4300i_SH: _MMU->Compile_SH(); break; - case R4300i_SWL: _MMU->Compile_SWL(); break; - case R4300i_SW: _MMU->Compile_SW(); break; - case R4300i_SWR: _MMU->Compile_SWR(); break; - case R4300i_SDL: _MMU->Compile_SDL(); break; - case R4300i_SDR: _MMU->Compile_SDR(); break; + case R4300i_LDL: g_MMU->Compile_LDL(); break; + case R4300i_LDR: g_MMU->Compile_LDR(); break; + case R4300i_LB: g_MMU->Compile_LB(); break; + case R4300i_LH: g_MMU->Compile_LH(); break; + case R4300i_LWL: g_MMU->Compile_LWL(); break; + case R4300i_LW: g_MMU->Compile_LW(); break; + case R4300i_LBU: g_MMU->Compile_LBU(); break; + case R4300i_LHU: g_MMU->Compile_LHU(); break; + case R4300i_LWR: g_MMU->Compile_LWR(); break; + case R4300i_LWU: g_MMU->Compile_LWU(); break; //added by Witten + case R4300i_SB: g_MMU->Compile_SB(); break; + case R4300i_SH: g_MMU->Compile_SH(); break; + case R4300i_SWL: g_MMU->Compile_SWL(); break; + case R4300i_SW: g_MMU->Compile_SW(); break; + case R4300i_SWR: g_MMU->Compile_SWR(); break; + case R4300i_SDL: g_MMU->Compile_SDL(); break; + case R4300i_SDR: g_MMU->Compile_SDR(); break; case R4300i_CACHE: CACHE(); break; case R4300i_LL: LL(); break; - case R4300i_LWC1: _MMU->Compile_LWC1(); break; - case R4300i_LDC1: _MMU->Compile_LDC1(); break; + case R4300i_LWC1: g_MMU->Compile_LWC1(); break; + case R4300i_LDC1: g_MMU->Compile_LDC1(); break; case R4300i_SC: SC(); break; - case R4300i_LD: _MMU->Compile_LD(); break; - case R4300i_SWC1: _MMU->Compile_SWC1(); break; - case R4300i_SDC1: _MMU->Compile_SDC1(); break; - case R4300i_SD: _MMU->Compile_SD(); break; + case R4300i_LD: g_MMU->Compile_LD(); break; + case R4300i_SWC1: g_MMU->Compile_SWC1(); break; + case R4300i_SDC1: g_MMU->Compile_SDC1(); break; + case R4300i_SD: g_MMU->Compile_SD(); break; default: UnknownOpcode(); break; } diff --git a/Source/Project64/N64 System/Recompiler/Function Map Class.cpp b/Source/Project64/N64 System/Recompiler/Function Map Class.cpp index d234e3b26..81ccf8f8d 100644 --- a/Source/Project64/N64 System/Recompiler/Function Map Class.cpp +++ b/Source/Project64/N64 System/Recompiler/Function Map Class.cpp @@ -28,13 +28,13 @@ bool CFunctionMap::AllocateMemory() } if (g_Recompiler->LookUpMode() == FuncFind_PhysicalLookup) { - m_JumpTable = new PCCompiledFunc[_MMU->RdramSize() >> 2]; + m_JumpTable = new PCCompiledFunc[g_MMU->RdramSize() >> 2]; if (m_JumpTable == NULL) { WriteTrace(TraceError,"CFunctionMap::AllocateMemory: failed to allocate jump table"); g_Notify->FatalError(MSG_MEM_ALLOC_ERROR); return false; } - memset(m_JumpTable,0,(_MMU->RdramSize() >> 2) * sizeof(PCCompiledFunc)); + memset(m_JumpTable,0,(g_MMU->RdramSize() >> 2) * sizeof(PCCompiledFunc)); } return true; } diff --git a/Source/Project64/N64 System/Recompiler/Loop Analysis.cpp b/Source/Project64/N64 System/Recompiler/Loop Analysis.cpp index 7e964cf9b..fba03539f 100644 --- a/Source/Project64/N64 System/Recompiler/Loop Analysis.cpp +++ b/Source/Project64/N64 System/Recompiler/Loop Analysis.cpp @@ -155,7 +155,7 @@ bool LoopAnalysis::CheckLoopRegisterUsage( CCodeSection * Section) CPU_Message("ContinueSectionPC = %08X",ContinueSectionPC); do { - if (!_MMU->LW_VAddr(m_PC, m_Command.Hex)) + if (!g_MMU->LW_VAddr(m_PC, m_Command.Hex)) { g_Notify->BreakPoint(__FILE__,__LINE__); return false; diff --git a/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp b/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp index 1ae7394ba..19de84757 100644 --- a/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp +++ b/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp @@ -70,7 +70,7 @@ void CRecompiler::Run() } } } - __except( _MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) + __except( g_MMU->MemoryFilter( GetExceptionCode(), GetExceptionInformation()) ) { g_Notify->DisplayError(MSG_UNKNOWN_MEM_ACTION); } @@ -123,7 +123,7 @@ void CRecompiler::RecompilerMain_VirtualTable ( void ) if (bSMM_Protect()) { WriteTraceF(TraceError,"Create Table (%X): Index = %d",table, PC >> 0xC); - _MMU->ProtectMemory(PC & ~0xFFF,PC | 0xFFF); + g_MMU->ProtectMemory(PC & ~0xFFF,PC | 0xFFF); } } @@ -230,11 +230,11 @@ void CRecompiler::RecompilerMain_VirtualTable_validate ( void ) /* while(!m_EndEmulation) { - if (!_MMU->ValidVaddr(PROGRAM_COUNTER)) + if (!g_MMU->ValidVaddr(PROGRAM_COUNTER)) { DoTLBMiss(NextInstruction == DELAY_SLOT,PROGRAM_COUNTER); NextInstruction = NORMAL; - if (!_MMU->ValidVaddr(PROGRAM_COUNTER)) + if (!g_MMU->ValidVaddr(PROGRAM_COUNTER)) { g_Notify->DisplayError("Failed to translate PC to a PAddr: %X\n\nEmulation stopped",PROGRAM_COUNTER); return; @@ -323,7 +323,7 @@ void CRecompiler::RecompilerMain_Lookup( void ) } if (bSMM_Protect()) { - _MMU->ProtectMemory(PROGRAM_COUNTER & ~0xFFF,PROGRAM_COUNTER | 0xFFF); + g_MMU->ProtectMemory(PROGRAM_COUNTER & ~0xFFF,PROGRAM_COUNTER | 0xFFF); } JumpTable()[PhysicalAddr >> 2] = info; } @@ -525,7 +525,7 @@ void CRecompiler::RecompilerMain_Lookup_TLB( void ) } if (bSMM_Protect()) { - _MMU->ProtectMemory(PROGRAM_COUNTER & ~0xFFF,PROGRAM_COUNTER | 0xFFF); + g_MMU->ProtectMemory(PROGRAM_COUNTER & ~0xFFF,PROGRAM_COUNTER | 0xFFF); } JumpTable()[PhysicalAddr >> 2] = info; } @@ -565,7 +565,7 @@ void CRecompiler::RecompilerMain_Lookup_validate( void ) } if (bSMM_Protect()) { - _MMU->ProtectMemory(PROGRAM_COUNTER & ~0xFFF,PROGRAM_COUNTER | 0xFFF); + g_MMU->ProtectMemory(PROGRAM_COUNTER & ~0xFFF,PROGRAM_COUNTER | 0xFFF); } JumpTable()[PhysicalAddr >> 2] = info; } else { @@ -625,7 +625,7 @@ void CRecompiler::RecompilerMain_Lookup_validate_TLB( void ) } if (bSMM_Protect()) { - _MMU->ProtectMemory(PROGRAM_COUNTER & ~0xFFF,PROGRAM_COUNTER | 0xFFF); + g_MMU->ProtectMemory(PROGRAM_COUNTER & ~0xFFF,PROGRAM_COUNTER | 0xFFF); } JumpTable()[PhysicalAddr >> 2] = info; } else { @@ -850,7 +850,7 @@ CCompiledFunc * CRecompiler::CompilerCode ( void ) if (_TransVaddr->TranslateVaddr(Func->MinPC(),PAddr)) { MD5Digest Hash; - MD5(_MMU->Rdram() + PAddr,(Func->MaxPC() - Func->MinPC())+ 4).get_digest(Hash); + MD5(g_MMU->Rdram() + PAddr,(Func->MaxPC() - Func->MinPC())+ 4).get_digest(Hash); if (memcmp(Hash.digest,Func->Hash().digest,sizeof(Hash.digest)) == 0) { return Func; @@ -919,7 +919,7 @@ void CRecompiler::ClearRecompCode_Phys(DWORD Address, int length, REMOVE_REASON memset((BYTE *)JumpTable() + Address,0,ClearLen); if (bSMM_Protect()) { - _MMU->UnProtectMemory(Address + 0x80000000,Address + 0x80000004); + g_MMU->UnProtectMemory(Address + 0x80000000,Address + 0x80000004); } } else{ WriteTraceF(TraceRecompiler,"Ignoring reset of Jump Table, Addr: %X len: %d",Address,((length + 3) & ~3)); @@ -949,7 +949,7 @@ void CRecompiler::ClearRecompCode_Virt(DWORD Address, int length,REMOVE_REASON R WriteTraceF(TraceError,"Delete Table (%X): Index = %d",table, AddressIndex); delete table; table = NULL; - _MMU->UnProtectMemory(Address,Address + length); + g_MMU->UnProtectMemory(Address,Address + length); } if (DataLeft > 0) @@ -979,7 +979,7 @@ void CRecompiler::ResetMemoryStackPos( void ) m_MemoryStack = NULL; return; } - if (_MMU == NULL || _Reg == NULL) + if (g_MMU == NULL || _Reg == NULL) { g_Notify->BreakPoint(__FILE__,__LINE__); } @@ -987,5 +987,5 @@ void CRecompiler::ResetMemoryStackPos( void ) { g_Notify->BreakPoint(__FILE__,__LINE__); } - m_MemoryStack = (DWORD)(_MMU->Rdram() + (_Reg->m_GPR[29].UW[0] & 0x1FFFFFFF)); + m_MemoryStack = (DWORD)(g_MMU->Rdram() + (_Reg->m_GPR[29].UW[0] & 0x1FFFFFFF)); } diff --git a/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp b/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp index 41969d43c..bad99c239 100644 --- a/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp +++ b/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp @@ -53,7 +53,7 @@ void CRecompilerOps::Compile_Branch (CRecompilerOps::BranchFunction CompareFunc, { OPCODE Command; - if (!_MMU->LW_VAddr(m_CompilePC + 4, Command.Hex)) { + if (!g_MMU->LW_VAddr(m_CompilePC + 4, Command.Hex)) { g_Notify->DisplayError(GS(MSG_FAIL_LOAD_WORD)); ExitThread(0); } @@ -1387,7 +1387,7 @@ void CRecompilerOps::ADDI (void) { } if (bFastSP() && m_Opcode.rt == 29 && m_Opcode.rs != 29) { ResetX86Protection(); - _MMU->ResetMemoryStack(); + g_MMU->ResetMemoryStack(); } } @@ -1415,7 +1415,7 @@ void CRecompilerOps::ADDIU (void) { if (bFastSP() && m_Opcode.rt == 29 && m_Opcode.rs != 29) { ResetX86Protection(); - _MMU->ResetMemoryStack(); + g_MMU->ResetMemoryStack(); } } @@ -1617,7 +1617,7 @@ void CRecompilerOps::ORI (void) { if (bFastSP() && m_Opcode.rt == 29 && m_Opcode.rs != 29) { ResetX86Protection(); - _MMU->ResetMemoryStack(); + g_MMU->ResetMemoryStack(); } } @@ -1652,9 +1652,9 @@ void CRecompilerOps::LUI (void) { _TransVaddr->TranslateVaddr(((short)m_Opcode.offset << 16), Address); if (Reg < 0) { - MoveConstToVariable((DWORD)(Address + _MMU->Rdram()), &(g_Recompiler->MemoryStackPos()), "MemoryStack"); + MoveConstToVariable((DWORD)(Address + g_MMU->Rdram()), &(g_Recompiler->MemoryStackPos()), "MemoryStack"); } else { - MoveConstToX86reg((DWORD)(Address + _MMU->Rdram()), Reg); + MoveConstToX86reg((DWORD)(Address + g_MMU->Rdram()), Reg); } } @@ -1732,7 +1732,7 @@ void CRecompilerOps::LL (void) { if (IsConst(m_Opcode.base)) { DWORD Address = GetMipsRegLo(m_Opcode.base) + (short)m_Opcode.offset; Map_GPR_32bit(m_Opcode.rt,TRUE,-1); - _MMU->Compile_LW(m_Section, GetMipsRegLo(m_Opcode.rt),Address); + g_MMU->Compile_LW(m_Section, GetMipsRegLo(m_Opcode.rt),Address); MoveConstToVariable(1,_LLBit,"LLBit"); g_Notify->BreakPoint(__FILE__,__LINE__); @@ -1771,7 +1771,7 @@ void CRecompilerOps::LL (void) { MoveConstToVariable(1,_LLBit,"LLBit"); MoveX86regToVariable(TempReg1,_LLAddr,"LLAddr"); AddX86regToVariable(TempReg2,_LLAddr,"LLAddr"); - SubConstFromVariable((DWORD)_MMU->Rdram(),_LLAddr,"LLAddr"); + SubConstFromVariable((DWORD)g_MMU->Rdram(),_LLAddr,"LLAddr"); } else { if (IsMapped(m_Opcode.base)) { ProtectGPR(m_Opcode.base); @@ -1807,11 +1807,11 @@ void CRecompilerOps::SC (void){ DWORD Address = GetMipsRegLo(m_Opcode.base) + (short)m_Opcode.offset; if (IsConst(m_Opcode.rt)) { - _MMU->Compile_SW_Const(GetMipsRegLo(m_Opcode.rt), Address); + g_MMU->Compile_SW_Const(GetMipsRegLo(m_Opcode.rt), Address); } else if (IsMapped(m_Opcode.rt)) { - _MMU->Compile_SW_Register(m_Section,GetMipsRegLo(m_Opcode.rt), Address); + g_MMU->Compile_SW_Register(m_Section,GetMipsRegLo(m_Opcode.rt), Address); } else { - _MMU->Compile_SW_Register(m_Section,Map_TempReg(x86_Any,m_Opcode.rt,FALSE), Address); + g_MMU->Compile_SW_Register(m_Section,Map_TempReg(x86_Any,m_Opcode.rt,FALSE), Address); } CPU_Message(" LLBitNotSet:"); *((DWORD *)(Jump))=(BYTE)(m_RecompPos - Jump - 4); @@ -2616,7 +2616,7 @@ void CRecompilerOps::SPECIAL_ADD (void) { } if (bFastSP() && m_Opcode.rd == 29) { - _MMU->ResetMemoryStack(); + g_MMU->ResetMemoryStack(); } } @@ -2645,7 +2645,7 @@ void CRecompilerOps::SPECIAL_ADDU (void) { } if (bFastSP() && m_Opcode.rd == 29) { - _MMU->ResetMemoryStack(); + g_MMU->ResetMemoryStack(); } } @@ -2676,7 +2676,7 @@ void CRecompilerOps::SPECIAL_SUB (void) { } if (bFastSP() && m_Opcode.rd == 29) { - _MMU->ResetMemoryStack(); + g_MMU->ResetMemoryStack(); } } @@ -2708,7 +2708,7 @@ void CRecompilerOps::SPECIAL_SUBU (void) { if (bFastSP() && m_Opcode.rd == 29) { - _MMU->ResetMemoryStack(); + g_MMU->ResetMemoryStack(); } } @@ -2964,7 +2964,7 @@ void CRecompilerOps::SPECIAL_OR (void) { } if (bFastSP() && m_Opcode.rd == 29) { ResetX86Protection(); - _MMU->ResetMemoryStack(); + g_MMU->ResetMemoryStack(); } } diff --git a/Source/Project64/N64 System/Recompiler/X86ops.cpp b/Source/Project64/N64 System/Recompiler/X86ops.cpp index 8a530a4e0..d95ea7457 100644 --- a/Source/Project64/N64 System/Recompiler/X86ops.cpp +++ b/Source/Project64/N64 System/Recompiler/X86ops.cpp @@ -660,7 +660,7 @@ void CX86Ops::MoveConstByteToN64Mem(BYTE Const, x86Reg AddrReg) { default: g_Notify->BreakPoint(__FILE__,__LINE__); } - PUTDST32(m_RecompPos,_MMU->Rdram()); + PUTDST32(m_RecompPos,g_MMU->Rdram()); PUTDST8(m_RecompPos,Const); } @@ -686,7 +686,7 @@ void CX86Ops::MoveConstHalfToN64Mem(WORD Const, x86Reg AddrReg) { default: g_Notify->BreakPoint(__FILE__,__LINE__); } - PUTDST32(m_RecompPos,_MMU->Rdram()); + PUTDST32(m_RecompPos,g_MMU->Rdram()); PUTDST16(m_RecompPos,Const); } @@ -765,7 +765,7 @@ void CX86Ops::MoveConstToN64Mem(DWORD Const, x86Reg AddrReg) { default: g_Notify->BreakPoint(__FILE__,__LINE__); } - PUTDST32(m_RecompPos,_MMU->Rdram()); + PUTDST32(m_RecompPos,g_MMU->Rdram()); PUTDST32(m_RecompPos,Const); } @@ -783,7 +783,7 @@ void CX86Ops::MoveConstToN64MemDisp (DWORD Const, x86Reg AddrReg, BYTE Disp) { default: g_Notify->BreakPoint(__FILE__,__LINE__); } - PUTDST32(m_RecompPos,_MMU->Rdram() + Disp); + PUTDST32(m_RecompPos,g_MMU->Rdram() + Disp); PUTDST32(m_RecompPos,Const); } @@ -908,7 +908,7 @@ void CX86Ops::MoveN64MemDispToX86reg(x86Reg reg, x86Reg AddrReg, BYTE Disp) { case x86_EBP: x86Command += 0xA800; break; } PUTDST16(m_RecompPos,x86Command); - PUTDST32(m_RecompPos,_MMU->Rdram() + Disp); + PUTDST32(m_RecompPos,g_MMU->Rdram() + Disp); } void CX86Ops::MoveN64MemToX86reg(x86Reg reg, x86Reg AddrReg) { @@ -939,7 +939,7 @@ void CX86Ops::MoveN64MemToX86reg(x86Reg reg, x86Reg AddrReg) { case x86_EBP: x86Command += 0xA800; break; } PUTDST16(m_RecompPos,x86Command); - PUTDST32(m_RecompPos,_MMU->Rdram()); + PUTDST32(m_RecompPos,g_MMU->Rdram()); } void CX86Ops::MoveN64MemToX86regByte(x86Reg reg, x86Reg AddrReg) { @@ -971,7 +971,7 @@ void CX86Ops::MoveN64MemToX86regByte(x86Reg reg, x86Reg AddrReg) { break; } PUTDST16(m_RecompPos,x86Command); - PUTDST32(m_RecompPos,_MMU->Rdram()); + PUTDST32(m_RecompPos,g_MMU->Rdram()); } void CX86Ops::MoveN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg) { @@ -1003,7 +1003,7 @@ void CX86Ops::MoveN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg) { case x86_EBP: x86Command += 0xA800; break; } PUTDST16(m_RecompPos,x86Command); - PUTDST32(m_RecompPos,_MMU->Rdram()); + PUTDST32(m_RecompPos,g_MMU->Rdram()); } void CX86Ops::MoveSxByteX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, x86Reg reg) { @@ -1127,7 +1127,7 @@ void CX86Ops::MoveSxN64MemToX86regByte(x86Reg reg, x86Reg AddrReg) { } PUTDST8(m_RecompPos,0x0f); PUTDST16(m_RecompPos,x86Command); - PUTDST32(m_RecompPos,_MMU->Rdram()); + PUTDST32(m_RecompPos,g_MMU->Rdram()); } void CX86Ops::MoveSxN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg) { @@ -1160,7 +1160,7 @@ void CX86Ops::MoveSxN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg) { PUTDST8(m_RecompPos, 0x0f); PUTDST16(m_RecompPos,x86Command); - PUTDST32(m_RecompPos,_MMU->Rdram()); + PUTDST32(m_RecompPos,g_MMU->Rdram()); } void CX86Ops::MoveSxVariableToX86regByte(void *Variable, const char * VariableName, x86Reg reg) { @@ -1317,7 +1317,7 @@ void CX86Ops::MoveX86regByteToN64Mem(x86Reg reg, x86Reg AddrReg) { g_Notify->BreakPoint(__FILE__,__LINE__); } PUTDST16(m_RecompPos,x86Command); - PUTDST32(m_RecompPos,_MMU->Rdram()); + PUTDST32(m_RecompPos,g_MMU->Rdram()); } void CX86Ops::MoveX86regByteToVariable(x86Reg reg, void * Variable, const char * VariableName) { @@ -1408,7 +1408,7 @@ void CX86Ops::MoveX86regHalfToN64Mem(x86Reg reg, x86Reg AddrReg) { g_Notify->BreakPoint(__FILE__,__LINE__); } PUTDST16(m_RecompPos,x86Command); - PUTDST32(m_RecompPos,_MMU->Rdram()); + PUTDST32(m_RecompPos,g_MMU->Rdram()); } void CX86Ops::MoveX86regHalfToVariable(x86Reg reg, void * Variable, const char * VariableName) { @@ -1687,7 +1687,7 @@ void CX86Ops::MoveX86regToN64Mem(x86Reg reg, x86Reg AddrReg) { g_Notify->BreakPoint(__FILE__,__LINE__); } PUTDST16(m_RecompPos,x86Command); - PUTDST32(m_RecompPos,_MMU->Rdram()); + PUTDST32(m_RecompPos,g_MMU->Rdram()); } void CX86Ops::MoveX86regToN64MemDisp(x86Reg reg, x86Reg AddrReg, BYTE Disp) { @@ -1719,7 +1719,7 @@ void CX86Ops::MoveX86regToN64MemDisp(x86Reg reg, x86Reg AddrReg, BYTE Disp) { g_Notify->BreakPoint(__FILE__,__LINE__); } PUTDST16(m_RecompPos,x86Command); - PUTDST32(m_RecompPos,_MMU->Rdram()+Disp); + PUTDST32(m_RecompPos,g_MMU->Rdram()+Disp); } void CX86Ops::MoveX86regToVariable(x86Reg reg, void * Variable, const char * VariableName) { @@ -1944,7 +1944,7 @@ void CX86Ops::MoveZxHalfX86regPointerToX86reg(x86Reg AddrReg1, x86Reg AddrReg2, void CX86Ops::MoveZxN64MemToX86regByte(x86Reg reg, x86Reg AddrReg) { WORD x86Command = 0; - CPU_Message(" movzx %s, byte ptr [%s+_MMU->Rdram()]",x86_Name(reg),x86_Name(AddrReg)); + CPU_Message(" movzx %s, byte ptr [%s+g_MMU->Rdram()]",x86_Name(reg),x86_Name(AddrReg)); switch (AddrReg) { case x86_EAX: x86Command = 0x00B6; break; case x86_EBX: x86Command = 0x03B6; break; @@ -1972,13 +1972,13 @@ void CX86Ops::MoveZxN64MemToX86regByte(x86Reg reg, x86Reg AddrReg) { } PUTDST8(m_RecompPos,0x0f); PUTDST16(m_RecompPos,x86Command); - PUTDST32(m_RecompPos,_MMU->Rdram()); + PUTDST32(m_RecompPos,g_MMU->Rdram()); } void CX86Ops::MoveZxN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg) { WORD x86Command = 0; - CPU_Message(" movzx %s, word ptr [%s+_MMU->Rdram()]",x86_Name(reg),x86_Name(AddrReg)); + CPU_Message(" movzx %s, word ptr [%s+g_MMU->Rdram()]",x86_Name(reg),x86_Name(AddrReg)); switch (AddrReg) { case x86_EAX: x86Command = 0x00B7; break; @@ -2007,7 +2007,7 @@ void CX86Ops::MoveZxN64MemToX86regHalf(x86Reg reg, x86Reg AddrReg) { PUTDST8(m_RecompPos, 0x0f); PUTDST16(m_RecompPos,x86Command); - PUTDST32(m_RecompPos,_MMU->Rdram()); + PUTDST32(m_RecompPos,g_MMU->Rdram()); } void CX86Ops::MoveZxVariableToX86regByte(void *Variable, const char * VariableName, x86Reg reg) { @@ -3226,7 +3226,7 @@ void CX86Ops::fpuLoadDwordFromN64Mem(int * StackPos,x86Reg x86reg) { default: g_Notify->BreakPoint(__FILE__,__LINE__); } - PUTDST32(m_RecompPos,_MMU->Rdram()); + PUTDST32(m_RecompPos,g_MMU->Rdram()); } void CX86Ops::fpuLoadInt32bFromN64Mem(int * StackPos,x86Reg x86reg) { @@ -3243,7 +3243,7 @@ void CX86Ops::fpuLoadInt32bFromN64Mem(int * StackPos,x86Reg x86reg) { default: g_Notify->BreakPoint(__FILE__,__LINE__); } - PUTDST32(m_RecompPos,_MMU->Rdram()); + PUTDST32(m_RecompPos,g_MMU->Rdram()); } void CX86Ops::fpuLoadIntegerDword(int * StackPos,void *Variable, const char * VariableName) { @@ -3329,7 +3329,7 @@ void CX86Ops::fpuLoadQwordFromN64Mem(int * StackPos,x86Reg x86reg) { default: g_Notify->BreakPoint(__FILE__,__LINE__); } - PUTDST32(m_RecompPos,_MMU->Rdram()); + PUTDST32(m_RecompPos,g_MMU->Rdram()); } void CX86Ops::fpuLoadReg(int * StackPos,x86FpuValues Reg) { @@ -3491,7 +3491,7 @@ void CX86Ops::fpuStoreDwordToN64Mem(int * StackPos,x86Reg x86reg, BOOL Pop) { default: g_Notify->BreakPoint(__FILE__,__LINE__); } - PUTDST32(m_RecompPos,_MMU->Rdram()); + PUTDST32(m_RecompPos,g_MMU->Rdram()); } void CX86Ops::fpuStoreIntegerDword(int * StackPos,void *Variable, const char * VariableName, BOOL pop) { diff --git a/Source/Project64/N64 System/System Globals.cpp b/Source/Project64/N64 System/System Globals.cpp index 5fd9b6fc5..d8306b9b0 100644 --- a/Source/Project64/N64 System/System Globals.cpp +++ b/Source/Project64/N64 System/System Globals.cpp @@ -4,9 +4,9 @@ CN64System * g_System = NULL; CN64System * g_BaseSystem = NULL; CN64System * g_SyncSystem = NULL; CRecompiler * g_Recompiler = NULL; -CMipsMemory * _MMU = NULL; //Memory of the n64 +CMipsMemory * g_MMU = NULL; //Memory of the n64 CTLB * _TLB = NULL; //TLB Unit -CRegisters * _Reg = NULL; //Current Register Set attacted to the _MMU +CRegisters * _Reg = NULL; //Current Register Set attacted to the g_MMU CNotification * g_Notify = NULL; CPlugins * _Plugins = NULL; CN64Rom * _Rom = NULL; //The current rom that this system is executing.. it can only execute one file at the time diff --git a/Source/Project64/N64 System/System Globals.h b/Source/Project64/N64 System/System Globals.h index 744d599e8..ff8cd06f6 100644 --- a/Source/Project64/N64 System/System Globals.h +++ b/Source/Project64/N64 System/System Globals.h @@ -5,9 +5,9 @@ extern CN64System * g_System; extern CN64System * g_BaseSystem; extern CN64System * g_SyncSystem; extern CRecompiler * g_Recompiler; -extern CMipsMemory * _MMU; //Memory of the n64 +extern CMipsMemory * g_MMU; //Memory of the n64 extern CTLB * _TLB; //TLB Unit -extern CRegisters * _Reg; //Current Register Set attacted to the _MMU +extern CRegisters * _Reg; //Current Register Set attacted to the g_MMU extern CPlugins * _Plugins; extern CN64Rom * _Rom; //The current rom that this system is executing.. it can only execute one file at the time extern CAudio * _Audio; diff --git a/Source/Project64/Plugins/Audio Plugin.cpp b/Source/Project64/Plugins/Audio Plugin.cpp index 6dcc3dfdc..72fa39277 100644 --- a/Source/Project64/Plugins/Audio Plugin.cpp +++ b/Source/Project64/Plugins/Audio Plugin.cpp @@ -185,9 +185,9 @@ bool CAudioPlugin::Initiate ( CN64System * System, CMainGui * RenderWindow ) { Info.hinst = GetModuleHandle(NULL); Info.MemoryBswaped = TRUE; Info.HEADER = _Rom->GetRomAddress(); - Info.RDRAM = _MMU->Rdram(); - Info.DMEM = _MMU->Dmem(); - Info.IMEM = _MMU->Imem(); + Info.RDRAM = g_MMU->Rdram(); + Info.DMEM = g_MMU->Dmem(); + Info.IMEM = g_MMU->Imem(); Info.MI__INTR_REG = &_Reg->m_AudioIntrReg; Info.AI__DRAM_ADDR_REG = &_Reg->AI_DRAM_ADDR_REG; Info.AI__LEN_REG = &_Reg->AI_LEN_REG; diff --git a/Source/Project64/Plugins/GFX plugin.cpp b/Source/Project64/Plugins/GFX plugin.cpp index 4df6a4949..96e802104 100644 --- a/Source/Project64/Plugins/GFX plugin.cpp +++ b/Source/Project64/Plugins/GFX plugin.cpp @@ -251,9 +251,9 @@ bool CGfxPlugin::Initiate ( CN64System * System, CMainGui * RenderWindow ) { Info.hWnd = (HWND)RenderWindow->m_hMainWindow; Info.hStatusBar = (HWND)RenderWindow->m_hStatusWnd; Info.HEADER = _Rom->GetRomAddress(); - Info.RDRAM = _MMU->Rdram(); - Info.DMEM = _MMU->Dmem(); - Info.IMEM = _MMU->Imem(); + Info.RDRAM = g_MMU->Rdram(); + Info.DMEM = g_MMU->Dmem(); + Info.IMEM = g_MMU->Imem(); Info.MI__INTR_REG = &_Reg->m_GfxIntrReg; Info.DPC__START_REG = &_Reg->DPC_START_REG; Info.DPC__END_REG = &_Reg->DPC_END_REG; diff --git a/Source/Project64/Plugins/RSP Plugin.cpp b/Source/Project64/Plugins/RSP Plugin.cpp index 142503b69..53d09564a 100644 --- a/Source/Project64/Plugins/RSP Plugin.cpp +++ b/Source/Project64/Plugins/RSP Plugin.cpp @@ -235,9 +235,9 @@ bool CRSP_Plugin::Initiate ( CPlugins * Plugins, CN64System * System ) Info.ProcessAlist = Plugins->Audio()->ProcessAList; Info.hInst = GetModuleHandle(NULL);; - Info.RDRAM = _MMU->Rdram(); - Info.DMEM = _MMU->Dmem(); - Info.IMEM = _MMU->Imem(); + Info.RDRAM = g_MMU->Rdram(); + Info.DMEM = g_MMU->Dmem(); + Info.IMEM = g_MMU->Imem(); Info.MemoryBswaped = FALSE; Info.MI__INTR_REG = &_Reg->m_RspIntrReg;