diff --git a/Source/Project64/N64 System/C Core/C Core Interface.cpp b/Source/Project64/N64 System/C Core/C Core Interface.cpp index 22d536a15..b121f0486 100644 --- a/Source/Project64/N64 System/C Core/C Core Interface.cpp +++ b/Source/Project64/N64 System/C Core/C Core Interface.cpp @@ -4,15 +4,10 @@ #include "Logging.h" //settings -BOOL g_ShowCPUPer = false, g_ShowTLBMisses = false, - g_HaveDebugger = false, g_AudioSignal = false, - g_UseLinking = false, - g_LogX86Code = false; +BOOL g_HaveDebugger = false, g_AudioSignal = false; DWORD g_RomFileSize = 0, g_CountPerOp = 2, g_ViRefreshRate = 1500; enum CPU_TYPE g_CPU_Type; enum SAVE_CHIP_TYPE g_SaveUsing; -enum FUNC_LOOKUP_METHOD g_LookUpMode; -char g_RomName [300]; //Plugins DWORD * _AudioIntrReg = NULL; @@ -25,17 +20,11 @@ void CC_Core::SetSettings ( ) if (_Settings) { g_HaveDebugger = _Settings->LoadBool(Debugger_Enabled); - g_ShowCPUPer = _Settings->LoadBool(UserInterface_ShowCPUPer); - g_ShowTLBMisses = false; g_CPU_Type = (CPU_TYPE)_Settings->LoadDword(Game_CpuType); g_SaveUsing = (SAVE_CHIP_TYPE)_Settings->LoadDword(Game_SaveChip); g_AudioSignal = _Settings->LoadBool(Game_RspAudioSignal); g_CountPerOp = _Settings->LoadDword(Game_CounterFactor); - g_LogX86Code = _Settings->LoadBool(Debugger_GenerateLogFiles); - g_LookUpMode = (FUNC_LOOKUP_METHOD)_Settings->LoadDword(Game_FuncLookupMode); - g_UseLinking = _Settings->LoadBool(Game_BlockLinking); g_ViRefreshRate = _Settings->LoadDword(Game_ViRefreshRate); - strcpy(g_RomName, _Settings->LoadString(Game_GameName).c_str()); } } @@ -264,15 +253,6 @@ void ApplyCheats (void) CC_Core::ApplyCheats(_BaseSystem); } -void ResetX86Logs ( void ) -{ - if (g_LogX86Code) - { - Stop_x86_Log(); - Start_x86_Log(); - } -} - void CloseSaveChips ( void ) { CloseMempak(); diff --git a/Source/Project64/N64 System/C Core/C Core Interface.h b/Source/Project64/N64 System/C Core/C Core Interface.h index c87d526c7..fa100dd5c 100644 --- a/Source/Project64/N64 System/C Core/C Core Interface.h +++ b/Source/Project64/N64 System/C Core/C Core Interface.h @@ -52,7 +52,6 @@ void BreakPoint ( LPCSTR FileName, int LineNumber ); void ApplyCheats ( void ); void RunRsp ( void ); void RefreshScreen ( void ); -void ResetX86Logs ( void ); void CloseSaveChips ( void ); //Timer functions @@ -62,17 +61,12 @@ DWORD StartTimer ( DWORD Address ); DWORD StopTimer ( void ); //settings -extern BOOL g_ShowCPUPer, g_ShowTLBMisses, - g_HaveDebugger, g_AudioSignal, - g_UseLinking, g_LogX86Code; +extern BOOL g_HaveDebugger, g_AudioSignal; extern DWORD g_RomFileSize, g_CountPerOp; extern enum CPU_TYPE g_CPU_Type; extern enum SAVE_CHIP_TYPE g_SaveUsing; -extern enum FUNC_LOOKUP_METHOD g_LookUpMode; -extern char g_RomName [300]; //Plugins -extern DWORD * g_AudioIntrReg; extern enum SystemType g_SystemType; #ifdef __cplusplus diff --git a/Source/Project64/N64 System/C Core/Mempak.cpp b/Source/Project64/N64 System/C Core/Mempak.cpp index f6a3a7ad3..9ec0aee73 100644 --- a/Source/Project64/N64 System/C Core/Mempak.cpp +++ b/Source/Project64/N64 System/C Core/Mempak.cpp @@ -42,7 +42,7 @@ void LoadMempak (void) { } GetAutoSaveDir(Directory); - sprintf(File,"%s%s.mpk",Directory,g_RomName); + sprintf(File,"%s%s.mpk",Directory,_Settings->LoadString(Game_GameName).c_str()); hMempakFile = CreateFile(File,GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ,NULL,OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL); diff --git a/Source/Project64/N64 System/Interpreter/Interpreter Ops 32.cpp b/Source/Project64/N64 System/Interpreter/Interpreter Ops 32.cpp index 103aac6b5..e0d9dba0d 100644 --- a/Source/Project64/N64 System/Interpreter/Interpreter Ops 32.cpp +++ b/Source/Project64/N64 System/Interpreter/Interpreter Ops 32.cpp @@ -833,7 +833,7 @@ 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_ShowTLBMisses) { + if (bShowTLBMisses()) { #ifndef EXTERNAL_RELEASE DisplayError("LB TLB: %X",Address); #endif @@ -848,7 +848,7 @@ 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_ShowTLBMisses) { + if (bShowTLBMisses()) { DisplayError("LH TLB: %X",Address); } TLB_READ_EXCEPTION(Address); @@ -865,7 +865,7 @@ void R4300iOp32::LWL (void) { if (!_MMU->LW_VAddr((Address & ~3),Value)) { - if (g_ShowTLBMisses) + if (bShowTLBMisses()) { DisplayError("LWL TLB: %X",Address); } @@ -890,7 +890,7 @@ void R4300iOp32::LW (void) { if (m_Opcode.rt == 0) { return; } if (!_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { - if (g_ShowTLBMisses) { + if (bShowTLBMisses()) { DisplayError("LW TLB: %X",Address); } TLB_READ_EXCEPTION(Address); @@ -902,7 +902,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_ShowTLBMisses) { + if (bShowTLBMisses()) { DisplayError("LBU TLB: %X",Address); } TLB_READ_EXCEPTION(Address); @@ -915,7 +915,7 @@ 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_ShowTLBMisses) { + if (bShowTLBMisses()) { DisplayError("LHU TLB: %X",Address); } TLB_READ_EXCEPTION(Address); @@ -932,7 +932,7 @@ void R4300iOp32::LWR (void) { if (!_MMU->LW_VAddr((Address & ~3),Value)) { - if (g_ShowTLBMisses) + if (bShowTLBMisses()) { DisplayError("LWR TLB: %X",Address); } @@ -949,7 +949,7 @@ void R4300iOp32::LWU (void) { if (m_Opcode.rt == 0) { return; } if (!_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { - if (g_ShowTLBMisses) { + if (bShowTLBMisses()) { DisplayError("LWU TLB: %X",Address); } TLB_READ_EXCEPTION(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_ShowTLBMisses) { + if (bShowTLBMisses()) { DisplayError("LL TLB: %X",Address); } TLB_READ_EXCEPTION(Address); diff --git a/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp b/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp index f646a5443..9b22f48ea 100644 --- a/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp +++ b/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp @@ -958,7 +958,7 @@ void R4300iOp::LDL (void) { if (!_MMU->LD_VAddr((Address & ~7),Value)) { - if (g_ShowTLBMisses) + if (bShowTLBMisses()) { DisplayError("LDL TLB: %X",Address); } @@ -983,7 +983,7 @@ void R4300iOp::LDR (void) { if (!_MMU->LD_VAddr((Address & ~7),Value)) { - if (g_ShowTLBMisses) + if (bShowTLBMisses()) { DisplayError("LDR TLB: %X",Address); } @@ -999,7 +999,7 @@ 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_ShowTLBMisses) { + if (bShowTLBMisses()) { #ifndef EXTERNAL_RELEASE DisplayError("LB TLB: %X",Address); #endif @@ -1014,7 +1014,7 @@ 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_ShowTLBMisses) { + if (bShowTLBMisses()) { DisplayError("LH TLB: %X",Address); } TLB_READ_EXCEPTION(Address); @@ -1031,7 +1031,7 @@ void R4300iOp::LWL (void) { if (!_MMU->LW_VAddr((Address & ~3),Value)) { - if (g_ShowTLBMisses) + if (bShowTLBMisses()) { DisplayError("LWL TLB: %X",Address); } @@ -1056,7 +1056,7 @@ void R4300iOp::LW (void) { if (m_Opcode.rt == 0) { return; } if (!_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { - if (g_ShowTLBMisses) { + if (bShowTLBMisses()) { DisplayError("LW TLB: %X",Address); } TLB_READ_EXCEPTION(Address); @@ -1068,7 +1068,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_ShowTLBMisses) { + if (bShowTLBMisses()) { DisplayError("LBU TLB: %X",Address); } TLB_READ_EXCEPTION(Address); @@ -1081,7 +1081,7 @@ 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_ShowTLBMisses) { + if (bShowTLBMisses()) { DisplayError("LHU TLB: %X",Address); } TLB_READ_EXCEPTION(Address); @@ -1098,7 +1098,7 @@ void R4300iOp::LWR (void) { if (!_MMU->LW_VAddr((Address & ~3),Value)) { - if (g_ShowTLBMisses) + if (bShowTLBMisses()) { DisplayError("LWR TLB: %X",Address); } @@ -1115,7 +1115,7 @@ void R4300iOp::LWU (void) { if (m_Opcode.rt == 0) { return; } if (!_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { - if (g_ShowTLBMisses) { + if (bShowTLBMisses()) { DisplayError("LWU TLB: %X",Address); } TLB_READ_EXCEPTION(Address); @@ -1178,7 +1178,7 @@ void R4300iOp::SW (void) { #endif if (!_MMU->SW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { - if (g_ShowTLBMisses) + if (bShowTLBMisses()) { DisplayError("SW TLB: %X",Address); } @@ -1292,7 +1292,7 @@ void R4300iOp::LL (void) { if (m_Opcode.rt == 0) { return; } if (!_MMU->LW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { - if (g_ShowTLBMisses) { + if (bShowTLBMisses()) { DisplayError("LL TLB: %X",Address); } TLB_READ_EXCEPTION(Address); @@ -1307,7 +1307,7 @@ void R4300iOp::LWC1 (void) { 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_ShowTLBMisses) { + if (bShowTLBMisses()) { DisplayError("LWC1 TLB: %X",Address); } TLB_READ_EXCEPTION(Address); @@ -1323,7 +1323,7 @@ void R4300iOp::SC (void) { if ((*_LLBit) == 1) { if (!_MMU->SW_VAddr(Address,_GPR[m_Opcode.rt].UW[0])) { - if (g_ShowTLBMisses) + if (bShowTLBMisses()) { DisplayError("SC TLB: %X",Address); } diff --git a/Source/Project64/N64 System/Interpreter/Interpreter Ops.h b/Source/Project64/N64 System/Interpreter/Interpreter Ops.h index 7cc485d94..33d6a800e 100644 --- a/Source/Project64/N64 System/Interpreter/Interpreter Ops.h +++ b/Source/Project64/N64 System/Interpreter/Interpreter Ops.h @@ -1,4 +1,5 @@ class R4300iOp : + protected CDebugSettings, protected CGameSettings, protected CSystemRegisters { diff --git a/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp b/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp index 053941f56..20e0abb08 100644 --- a/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp +++ b/Source/Project64/N64 System/Mips/Memory Virtual Mem.cpp @@ -417,9 +417,9 @@ void CMipsMemoryVM::Compile_LW (x86Reg Reg, DWORD VAddr ) { case 0x04400000: switch (PAddr) { case 0x04400010: - m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_CountPerOp) ; + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - CountPerOp()) ; UpdateCounters(m_RegWorkingSet,false, true); - m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_CountPerOp) ; + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + CountPerOp()) ; BeforeCallDirect(m_RegWorkingSet); MoveConstToX86reg((DWORD)this,x86_ECX); Call_Direct(AddressOf(&CMipsMemoryVM::UpdateHalfLine),"CMipsMemoryVM::UpdateHalfLine"); @@ -436,9 +436,9 @@ void CMipsMemoryVM::Compile_LW (x86Reg Reg, DWORD VAddr ) { case 0x04500004: if (bFixedAudio()) { - m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_CountPerOp) ; + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - CountPerOp()) ; UpdateCounters(m_RegWorkingSet,false, true); - m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_CountPerOp) ; + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + CountPerOp()) ; BeforeCallDirect(m_RegWorkingSet); MoveConstToX86reg((DWORD)_Audio,x86_ECX); Call_Direct(AddressOf(&CAudio::GetLength),"CAudio::GetLength"); @@ -1128,9 +1128,9 @@ void CMipsMemoryVM::Compile_SW_Register (x86Reg Reg, DWORD VAddr ) switch (PAddr) { case 0x04500000: MoveX86regToVariable(Reg,&_Reg->AI_DRAM_ADDR_REG,"AI_DRAM_ADDR_REG"); break; case 0x04500004: - m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_CountPerOp) ; + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - CountPerOp()) ; UpdateCounters(m_RegWorkingSet,false, true); - m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_CountPerOp) ; + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + CountPerOp()) ; MoveX86regToVariable(Reg,&_Reg->AI_LEN_REG,"AI_LEN_REG"); BeforeCallDirect(m_RegWorkingSet); if (bFixedAudio()) @@ -1300,6 +1300,7 @@ int CMipsMemoryVM::MemoryFilter( DWORD dwExptCode, void * lpExceptionPointer ) { if (dwExptCode != EXCEPTION_ACCESS_VIOLATION) { + return EXCEPTION_EXECUTE_HANDLER; } @@ -2295,7 +2296,7 @@ void CMipsMemoryVM::UpdateHalfLine (void) m_HalfLine = 0; return; } - m_HalfLine = (DWORD)(*_NextTimer / g_ViRefreshRate); + m_HalfLine = (DWORD)(*_NextTimer / ViRefreshRate()); m_HalfLine &= ~1; } diff --git a/Source/Project64/N64 System/Mips/System Events.h b/Source/Project64/N64 System/Mips/System Events.h index afc6ec459..88f781b10 100644 --- a/Source/Project64/N64 System/Mips/System Events.h +++ b/Source/Project64/N64 System/Mips/System Events.h @@ -33,7 +33,6 @@ enum SystemEvent { SysEvent_Profile_StartStop, SysEvent_Profile_ResetLogs, SysEvent_Profile_GenerateLogs, - SysEvent_CPUUsageTimerChanged, }; class CSystemEvents diff --git a/Source/Project64/N64 System/Mips/System Timing.cpp b/Source/Project64/N64 System/Mips/System Timing.cpp index efcab4617..8bfe5dc68 100644 --- a/Source/Project64/N64 System/Mips/System Timing.cpp +++ b/Source/Project64/N64 System/Mips/System Timing.cpp @@ -145,7 +145,7 @@ void CSystemTimer::UpdateTimers ( void ) { m_LastUpdate = m_NextTimer; _Reg->COUNT_REGISTER += TimeTaken; - _Reg->RANDOM_REGISTER -= TimeTaken / g_CountPerOp; + _Reg->RANDOM_REGISTER -= TimeTaken / CountPerOp(); while ((int)_Reg->RANDOM_REGISTER < (int)_Reg->WIRED_REGISTER) { _Reg->RANDOM_REGISTER += 32 - _Reg->WIRED_REGISTER; diff --git a/Source/Project64/N64 System/Mips/System Timing.h b/Source/Project64/N64 System/Mips/System Timing.h index 0e2c40ad8..aef75a7fd 100644 --- a/Source/Project64/N64 System/Mips/System Timing.h +++ b/Source/Project64/N64 System/Mips/System Timing.h @@ -2,7 +2,8 @@ class CC_Core; -class CSystemTimer +class CSystemTimer : + protected CGameSettings { public: enum TimerType { diff --git a/Source/Project64/N64 System/N64 Class.cpp b/Source/Project64/N64 System/N64 Class.cpp index 865e85b26..0cce35824 100644 --- a/Source/Project64/N64 System/N64 Class.cpp +++ b/Source/Project64/N64 System/N64 Class.cpp @@ -139,9 +139,6 @@ void CN64System::ExternalEvent ( SystemEvent action ) SetEvent(m_hPauseEvent); } break; - case SysEvent_CPUUsageTimerChanged: - g_ShowCPUPer = _Settings->LoadDword(UserInterface_ShowCPUPer); - break; default: WriteTraceF(TraceError,"CN64System::ExternalEvent - Unknown event %d",action); _Notify->BreakPoint(__FILE__,__LINE__); @@ -1461,7 +1458,11 @@ bool CN64System::LoadState(LPCSTR FileName) { WriteTrace(TraceDebug,"CN64System::LoadState 8"); m_FPS.Reset(true); WriteTrace(TraceDebug,"CN64System::LoadState 9"); - ResetX86Logs(); + if (bLogX86Code()) + { + Stop_x86_Log(); + Start_x86_Log(); + } WriteTrace(TraceDebug,"CN64System::LoadState 12"); #ifdef TEST_SP_TRACKING diff --git a/Source/Project64/N64 System/N64 Class.h b/Source/Project64/N64 System/N64 Class.h index 1773b4d24..19b7f41b6 100644 --- a/Source/Project64/N64 System/N64 Class.h +++ b/Source/Project64/N64 System/N64 Class.h @@ -21,6 +21,8 @@ class CN64System : private CTLB_CB, private CSystemEvents, protected CN64SystemSettings, + protected CGameSettings, + protected CDebugSettings, public CDebugger { public: diff --git a/Source/Project64/N64 System/Recompiler/Code Section.cpp b/Source/Project64/N64 System/Recompiler/Code Section.cpp index 28620e87f..5ad6cf125 100644 --- a/Source/Project64/N64 System/Recompiler/Code Section.cpp +++ b/Source/Project64/N64 System/Recompiler/Code Section.cpp @@ -451,9 +451,9 @@ void CCodeSection::GenerateSectionLinkage (void) UpdateCounters(JumpInfo[i]->RegSet,false, true); if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); } - //JumpInfo[i]->RegSet.BlockCycleCount() -= g_CountPerOp; + //JumpInfo[i]->RegSet.BlockCycleCount() -= CountPerOp(); Call_Direct(InPermLoop,"InPermLoop"); - //JumpInfo[i]->RegSet.BlockCycleCount() += g_CountPerOp; + //JumpInfo[i]->RegSet.BlockCycleCount() += CountPerOp(); UpdateCounters(JumpInfo[i]->RegSet,true,true); CPU_Message("CompileSystemCheck 4"); CompileSystemCheck(-1,JumpInfo[i]->RegSet); @@ -1002,7 +1002,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test ) m_RegWorkingSet.UnMap_AllFPRs(); }*/ - m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_CountPerOp); + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + CountPerOp()); m_RegWorkingSet.ResetX86Protection(); switch (m_Opcode.op) { @@ -1266,7 +1266,7 @@ bool CCodeSection::GenerateX86Code ( DWORD Test ) break; case DELAY_SLOT: m_NextInstruction = DELAY_SLOT_DONE; - m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_CountPerOp); + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - CountPerOp()); m_CompilePC -= 4; break; } diff --git a/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp b/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp index af72f1595..0fdbd911e 100644 --- a/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp +++ b/Source/Project64/N64 System/Recompiler/Recompiler Class.cpp @@ -16,7 +16,7 @@ CRecompiler::~CRecompiler() void CRecompiler::Run() { CoInitialize(NULL); - if (g_LogX86Code) + if (bLogX86Code()) { Start_x86_Log(); } diff --git a/Source/Project64/N64 System/Recompiler/Recompiler Class.h b/Source/Project64/N64 System/Recompiler/Recompiler Class.h index 9bc063b46..17e4c6339 100644 --- a/Source/Project64/N64 System/Recompiler/Recompiler Class.h +++ b/Source/Project64/N64 System/Recompiler/Recompiler Class.h @@ -1,4 +1,5 @@ class CRecompiler : + protected CDebugSettings, public CRecompilerSettings, protected CGameSettings, public CFunctionMap, diff --git a/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp b/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp index d10ff6a6f..af295b2ce 100644 --- a/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp +++ b/Source/Project64/N64 System/Recompiler/Recompiler Ops.cpp @@ -4015,9 +4015,9 @@ void CRecompilerOps::COP0_MF(void) { switch (m_Opcode.rd) { case 9: //Count - m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_CountPerOp) ; + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - CountPerOp()) ; UpdateCounters(m_RegWorkingSet,false, true); - m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_CountPerOp) ; + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + CountPerOp()) ; BeforeCallDirect(m_RegWorkingSet); MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX); Call_Direct(AddressOf(&CSystemTimer::UpdateTimers), "CSystemTimer::UpdateTimers"); @@ -4059,9 +4059,9 @@ void CRecompilerOps::COP0_MT (void) { } break; case 11: //Compare - m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_CountPerOp) ; + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - CountPerOp()) ; UpdateCounters(m_RegWorkingSet,false, true); - m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_CountPerOp) ; + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + CountPerOp()) ; BeforeCallDirect(m_RegWorkingSet); MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX); Call_Direct(AddressOf(&CSystemTimer::UpdateTimers), "CSystemTimer::UpdateTimers"); @@ -4080,9 +4080,9 @@ void CRecompilerOps::COP0_MT (void) { AfterCallDirect(m_RegWorkingSet); break; case 9: //Count - m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_CountPerOp) ; + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - CountPerOp()) ; UpdateCounters(m_RegWorkingSet,false, true); - m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + g_CountPerOp) ; + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() + CountPerOp()) ; BeforeCallDirect(m_RegWorkingSet); MoveConstToX86reg((DWORD)_SystemTimer,x86_ECX); Call_Direct(AddressOf(&CSystemTimer::UpdateTimers), "CSystemTimer::UpdateTimers"); @@ -5080,7 +5080,7 @@ void CRecompilerOps::UnknownOpcode (void) { MoveConstToVariable(m_CompilePC,&_Reg->m_PROGRAM_COUNTER,"PROGRAM_COUNTER"); if (_SyncSystem) { Call_Direct(SyncSystem, "SyncSystem"); } - m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - g_CountPerOp); + m_RegWorkingSet.SetBlockCycleCount(m_RegWorkingSet.GetBlockCycleCount() - CountPerOp()); MoveConstToVariable(m_Opcode.Hex, &R4300iOp::m_Opcode.Hex, "R4300iOp::m_Opcode.Hex"); Call_Direct(R4300iOp::UnknownOpcode, "R4300iOp::UnknownOpcode"); @@ -5211,7 +5211,7 @@ void CRecompilerOps::OverflowDelaySlot (BOOL TestTimer) if (_SyncSystem) { - UpdateSyncCPU(m_RegWorkingSet,g_CountPerOp); + UpdateSyncCPU(m_RegWorkingSet,CountPerOp()); Call_Direct(SyncSystem, "SyncSystem"); } ExitCodeBlock(); diff --git a/Source/Project64/Plugins/Plugin Class.cpp b/Source/Project64/Plugins/Plugin Class.cpp index e19bcb974..f74f8535c 100644 --- a/Source/Project64/Plugins/Plugin Class.cpp +++ b/Source/Project64/Plugins/Plugin Class.cpp @@ -57,7 +57,7 @@ void CPlugins::CreatePlugins( void ) { Reset(PLUGIN_TYPE_RSP); Reset(PLUGIN_TYPE_CONTROLLER); - if (_Settings->LoadBool(Debugger_Enabled)) + if (bHaveDebugger()) { _Notify->RefreshMenu(); } @@ -209,7 +209,7 @@ void CPlugins::Reset ( PLUGIN_TYPE Type ) if (m_RSP->EnableDebugging) { WriteTrace(TraceRSP,"EnableDebugging: starting"); - m_RSP->EnableDebugging(_Settings->LoadDword(Debugger_Enabled)); + m_RSP->EnableDebugging(bHaveDebugger()); WriteTrace(TraceRSP,"EnableDebugging: done"); } break; diff --git a/Source/Project64/Plugins/Plugin Class.h b/Source/Project64/Plugins/Plugin Class.h index 6f427a8a8..60480d380 100644 --- a/Source/Project64/Plugins/Plugin Class.h +++ b/Source/Project64/Plugins/Plugin Class.h @@ -67,7 +67,9 @@ class CSettings; class CMainGui; class CGfxPlugin; class CAudioPlugin; class CRSP_Plugin; class CControl_Plugin; -class CPlugins { +class CPlugins : + private CDebugSettings +{ //Common Classes CMainGui * _RenderWindow; CMainGui * _DummyWindow; diff --git a/Source/Project64/Project64.vcproj b/Source/Project64/Project64.vcproj index 203b543e1..e89440238 100644 --- a/Source/Project64/Project64.vcproj +++ b/Source/Project64/Project64.vcproj @@ -196,10 +196,6 @@ Name="Source Files" Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" > - - @@ -239,10 +235,18 @@ + + + + @@ -952,6 +956,10 @@ + + diff --git a/Source/Project64/Settings.h b/Source/Project64/Settings.h index 2e596e564..553d68a6a 100644 --- a/Source/Project64/Settings.h +++ b/Source/Project64/Settings.h @@ -189,6 +189,7 @@ enum SettingID { //Debugger Debugger_Enabled, + Debugger_ShowTLBMisses, Debugger_ShowUnhandledMemory, Debugger_ShowPifErrors, Debugger_ShowCheckOpUsageErrors, @@ -247,6 +248,7 @@ enum SettingID { #include "Support.h" #include "./Settings/Settings Class.h" +#include "./Settings/Debug Settings.h" #include "./Settings/Game Settings.h" #include "./Settings/Recompiler Settings.h" #include "./Settings/N64System Settings.h" diff --git a/Source/Project64/Settings/Debug Settings.cpp b/Source/Project64/Settings/Debug Settings.cpp new file mode 100644 index 000000000..b6e694841 --- /dev/null +++ b/Source/Project64/Settings/Debug Settings.cpp @@ -0,0 +1,38 @@ +#include "stdafx.h" + +int CDebugSettings::m_RefCount = 0; + +bool CDebugSettings::m_bHaveDebugger = false; +bool CDebugSettings::m_bLogX86Code = false; +bool CDebugSettings::m_bShowTLBMisses = false; + +CDebugSettings::CDebugSettings() +{ + m_RefCount += 1; + if (m_RefCount == 1) + { + _Settings->RegisterChangeCB(Debugger_Enabled,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Debugger_GenerateLogFiles,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Debugger_ShowTLBMisses,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + + RefreshSettings(); + } +} + +CDebugSettings::~CDebugSettings() +{ + m_RefCount -= 1; + if (m_RefCount == 0) + { + _Settings->UnregisterChangeCB(Debugger_Enabled,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Debugger_GenerateLogFiles,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Debugger_ShowTLBMisses,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + } +} + +void CDebugSettings::RefreshSettings() +{ + m_bHaveDebugger = _Settings->LoadBool(Debugger_Enabled); + m_bLogX86Code = _Settings->LoadBool(Debugger_GenerateLogFiles); + m_bShowTLBMisses = _Settings->LoadBool(Debugger_ShowTLBMisses); +} diff --git a/Source/Project64/Settings/Debug Settings.h b/Source/Project64/Settings/Debug Settings.h new file mode 100644 index 000000000..74ccabe6d --- /dev/null +++ b/Source/Project64/Settings/Debug Settings.h @@ -0,0 +1,27 @@ +#include + +class CDebugSettings +{ +public: + CDebugSettings(); + virtual ~CDebugSettings(); + + static inline bool bHaveDebugger ( void ) { return m_bHaveDebugger; } + static inline bool bLogX86Code ( void ) { return m_bLogX86Code; } + static inline bool bShowTLBMisses ( void ) { return m_bShowTLBMisses; } + +private: + static void StaticRefreshSettings (CDebugSettings * _this) + { + _this->RefreshSettings(); + } + + void RefreshSettings ( void ); + + //Settings that can be changed on the fly + static bool m_bHaveDebugger; + static bool m_bLogX86Code; + static bool m_bShowTLBMisses; + + static int m_RefCount; +}; \ No newline at end of file diff --git a/Source/Project64/Settings/Game Settings.cpp b/Source/Project64/Settings/Game Settings.cpp index f8c8b7abb..a0e907653 100644 --- a/Source/Project64/Settings/Game Settings.cpp +++ b/Source/Project64/Settings/Game Settings.cpp @@ -2,7 +2,9 @@ int CGameSettings::m_RefCount = 0; -bool CGameSettings::m_bUseTlb; +bool CGameSettings::m_bUseTlb; +DWORD CGameSettings::m_CountPerOp = 2; +DWORD CGameSettings::m_ViRefreshRate = 1500; CGameSettings::CGameSettings() { @@ -10,6 +12,8 @@ CGameSettings::CGameSettings() if (m_RefCount == 1) { _Settings->RegisterChangeCB(Game_UseTlb,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Game_ViRefreshRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->RegisterChangeCB(Game_CounterFactor,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); RefreshSettings(); } @@ -21,10 +25,14 @@ CGameSettings::~CGameSettings() if (m_RefCount == 0) { _Settings->UnregisterChangeCB(Game_UseTlb,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Game_ViRefreshRate,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); + _Settings->UnregisterChangeCB(Game_CounterFactor,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); } } void CGameSettings::RefreshSettings() { m_bUseTlb = _Settings->LoadBool(Game_UseTlb); + m_ViRefreshRate = _Settings->LoadDword(Game_ViRefreshRate); + m_CountPerOp = _Settings->LoadDword(Game_CounterFactor); } diff --git a/Source/Project64/Settings/Game Settings.h b/Source/Project64/Settings/Game Settings.h index 7e577ee42..999529b5d 100644 --- a/Source/Project64/Settings/Game Settings.h +++ b/Source/Project64/Settings/Game Settings.h @@ -7,6 +7,8 @@ public: virtual ~CGameSettings(); static inline bool bUseTlb ( void ) { return m_bUseTlb; } + inline static DWORD CountPerOp ( void ) { return m_CountPerOp; } + inline static DWORD ViRefreshRate ( void ) { return m_ViRefreshRate; } private: static void StaticRefreshSettings (CGameSettings * _this) @@ -16,9 +18,10 @@ private: void RefreshSettings ( void ); - //Settings that can be changed on the fly static bool m_bUseTlb; + static DWORD m_CountPerOp; + static DWORD m_ViRefreshRate; static int m_RefCount; }; \ No newline at end of file diff --git a/Source/Project64/Settings/N64System Settings.cpp b/Source/Project64/Settings/N64System Settings.cpp index 14bedf6ce..c3a46b3df 100644 --- a/Source/Project64/Settings/N64System Settings.cpp +++ b/Source/Project64/Settings/N64System Settings.cpp @@ -12,8 +12,6 @@ bool CN64SystemSettings::m_bSyncToAudio; bool CN64SystemSettings::m_bDisplayFrameRate; bool CN64SystemSettings::m_bFastSP; bool CN64SystemSettings::m_b32Bit; -DWORD CN64SystemSettings::m_ViRefreshRate; - CN64SystemSettings::CN64SystemSettings() { @@ -33,7 +31,6 @@ CN64SystemSettings::CN64SystemSettings() _Settings->RegisterChangeCB(Game_SyncViaAudio,NULL,RefreshSettings); _Settings->RegisterChangeCB(Game_32Bit,NULL,RefreshSettings); _Settings->RegisterChangeCB(Game_FastSP,NULL,RefreshSettings); - _Settings->RegisterChangeCB(Game_ViRefreshRate,NULL,RefreshSettings); RefreshSettings(NULL); } } @@ -56,7 +53,6 @@ CN64SystemSettings::~CN64SystemSettings() _Settings->UnregisterChangeCB(Game_SyncViaAudio,NULL,RefreshSettings); _Settings->UnregisterChangeCB(Game_32Bit,NULL,RefreshSettings); _Settings->UnregisterChangeCB(Game_FastSP,NULL,RefreshSettings); - _Settings->UnregisterChangeCB(Game_ViRefreshRate,NULL,RefreshSettings); } } @@ -74,5 +70,4 @@ void CN64SystemSettings::RefreshSettings(void *) m_bSyncToAudio = m_bFixedAudio ? _Settings->LoadBool(Game_SyncViaAudio) : false; m_b32Bit = _Settings->LoadBool(Game_32Bit); m_bFastSP = _Settings->LoadBool(Game_FastSP); - m_ViRefreshRate = _Settings->LoadDword(Game_ViRefreshRate); } diff --git a/Source/Project64/Settings/N64System Settings.h b/Source/Project64/Settings/N64System Settings.h index 2f8373858..977689794 100644 --- a/Source/Project64/Settings/N64System Settings.h +++ b/Source/Project64/Settings/N64System Settings.h @@ -16,7 +16,6 @@ protected: inline static bool bSyncToAudio ( void ) { return m_bSyncToAudio; } inline static bool b32BitCore ( void ) { return m_b32Bit; } inline static bool bFastSP ( void ) { return m_bFastSP; } - inline static DWORD ViRefreshRate ( void ) { return m_ViRefreshRate; } private: static void RefreshSettings ( void * ); @@ -31,7 +30,6 @@ private: static bool m_bDisplayFrameRate; static bool m_bFastSP; static bool m_b32Bit; - static DWORD m_ViRefreshRate; static int m_RefCount; diff --git a/Source/Project64/Settings/Recompiler Settings.cpp b/Source/Project64/Settings/Recompiler Settings.cpp index d98100690..cf44416e1 100644 --- a/Source/Project64/Settings/Recompiler Settings.cpp +++ b/Source/Project64/Settings/Recompiler Settings.cpp @@ -15,7 +15,6 @@ bool CRecompilerSettings::m_b32Bit; bool CRecompilerSettings::m_RegCaching; bool CRecompilerSettings::m_bLinkBlocks; DWORD CRecompilerSettings::m_RdramSize; -DWORD CRecompilerSettings::m_CountPerOp; DWORD CRecompilerSettings::m_LookUpMode; //FUNC_LOOKUP_METHOD CRecompilerSettings::CRecompilerSettings() @@ -31,7 +30,6 @@ CRecompilerSettings::CRecompilerSettings() _Settings->RegisterChangeCB(Game_RegCache,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->RegisterChangeCB(Game_BlockLinking,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->RegisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); - _Settings->RegisterChangeCB(Game_CounterFactor,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->RegisterChangeCB(Game_FuncLookupMode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->RegisterChangeCB(Debugger_ShowRecompMemSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->RegisterChangeCB(Debugger_ProfileCode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); @@ -56,7 +54,6 @@ CRecompilerSettings::~CRecompilerSettings() _Settings->UnregisterChangeCB(Game_RegCache,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->UnregisterChangeCB(Game_BlockLinking,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->UnregisterChangeCB(Game_RDRamSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); - _Settings->UnregisterChangeCB(Game_CounterFactor,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->UnregisterChangeCB(Game_FuncLookupMode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->UnregisterChangeCB(Debugger_ShowRecompMemSize,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); _Settings->UnregisterChangeCB(Debugger_ProfileCode,this,(CSettings::SettingChangedFunc)StaticRefreshSettings); @@ -82,6 +79,5 @@ void CRecompilerSettings::RefreshSettings() m_RegCaching = _Settings->LoadBool(Game_RegCache); m_bLinkBlocks = _Settings->LoadBool(Game_BlockLinking); m_RdramSize = _Settings->LoadDword(Game_RDRamSize); - m_CountPerOp = _Settings->LoadDword(Game_CounterFactor); m_LookUpMode = _Settings->LoadDword(Game_FuncLookupMode); } diff --git a/Source/Project64/Settings/Recompiler Settings.h b/Source/Project64/Settings/Recompiler Settings.h index 1ffcad508..edc31fb68 100644 --- a/Source/Project64/Settings/Recompiler Settings.h +++ b/Source/Project64/Settings/Recompiler Settings.h @@ -1,6 +1,6 @@ #include -class CRecompilerSettings +class CRecompilerSettings { public: CRecompilerSettings(); @@ -20,7 +20,6 @@ public: // static bool bFastSP ( void ) { return m_bFastSP; } // static bool b32BitCore ( void ) { return m_b32Bit; } static DWORD RdramSize ( void ) { return m_RdramSize; } - static DWORD CountPerOp ( void ) { return m_CountPerOp; } static FUNC_LOOKUP_METHOD LookUpMode ( void ) { return (FUNC_LOOKUP_METHOD)m_LookUpMode; } private: @@ -47,7 +46,6 @@ private: static bool m_RegCaching; static bool m_bLinkBlocks; static DWORD m_RdramSize; - static DWORD m_CountPerOp; static DWORD m_LookUpMode; //FUNC_LOOKUP_METHOD static int m_RefCount; diff --git a/Source/Project64/Settings/Settings Class.cpp b/Source/Project64/Settings/Settings Class.cpp index 919ba47da..e124ae69f 100644 --- a/Source/Project64/Settings/Settings Class.cpp +++ b/Source/Project64/Settings/Settings Class.cpp @@ -248,6 +248,7 @@ void CSettings::AddHowToHandleSetting () AddHandler(File_RecentGameFileIndex, new CSettingTypeApplicationIndex("Recent File","Recent Rom",Default_None)); AddHandler(Debugger_Enabled, new CSettingTypeApplication("Debugger","Debugger",false)); + AddHandler(Debugger_ShowTLBMisses, new CSettingTypeApplication("Debugger","Show TLB Misses",false)); AddHandler(Debugger_ShowUnhandledMemory, new CSettingTypeApplication("Debugger","Show Unhandled Memory",false)); AddHandler(Debugger_ShowPifErrors, new CSettingTypeApplication("Debugger","Show Pif Errors",false)); AddHandler(Debugger_DisableGameFixes, new CSettingTypeApplication("Debugger","Disable Game Fixes",false)); diff --git a/Source/Project64/User Interface/Main Menu Class.cpp b/Source/Project64/User Interface/Main Menu Class.cpp index 55e135f1e..8e3b70669 100644 --- a/Source/Project64/User Interface/Main Menu Class.cpp +++ b/Source/Project64/User Interface/Main Menu Class.cpp @@ -16,6 +16,7 @@ CMainMenu::CMainMenu ( CMainGui * hMainWindow ): m_ChangeSettingList.push_back(UserInterface_AlwaysOnTop); m_ChangeSettingList.push_back(UserInterface_ShowCPUPer); m_ChangeSettingList.push_back(Debugger_ProfileCode); + m_ChangeSettingList.push_back(Debugger_ShowTLBMisses); m_ChangeSettingList.push_back(Debugger_ShowUnhandledMemory); m_ChangeSettingList.push_back(Debugger_ShowPifErrors); m_ChangeSettingList.push_back(Debugger_ShowDListAListCount); @@ -303,7 +304,6 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men } else { _Settings->SaveBool(UserInterface_ShowCPUPer,true); } - _BaseSystem->ExternalEvent(SysEvent_CPUUsageTimerChanged); break; case ID_OPTIONS_SETTINGS: { @@ -317,6 +317,9 @@ bool CMainMenu::ProcessMessage(WND_HANDLE hWnd, DWORD FromAccelerator, DWORD Men break; case ID_PROFILE_RESETCOUNTER: _BaseSystem->ExternalEvent(SysEvent_Profile_ResetLogs); break; case ID_PROFILE_GENERATELOG: _BaseSystem->ExternalEvent(SysEvent_Profile_GenerateLogs); break; + case ID_DEBUG_SHOW_TLB_MISSES: + _Settings->SaveBool(Debugger_ShowTLBMisses,!_Settings->LoadBool(Debugger_ShowTLBMisses)); + break; case ID_DEBUG_SHOW_UNHANDLED_MEM: _Settings->SaveBool(Debugger_ShowUnhandledMemory,!_Settings->LoadBool(Debugger_ShowUnhandledMemory)); break; @@ -918,7 +921,7 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { /* Profile Menu ****************/ MenuItemList DebugProfileMenu; - if (_Settings->LoadDword(Debugger_Enabled)) + if (bHaveDebugger()) { Item.Reset(ID_PROFILE_PROFILE,EMPTY_STRING,EMPTY_STDSTR,NULL,"Profile Code" ); if (_Settings->LoadBool(Debugger_ProfileCode)) { Item.ItemTicked = true; } @@ -939,7 +942,7 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { MenuItemList DebugR4300Menu; MenuItemList DebugMemoryMenu; MenuItemList DebugInterrupt; - if (_Settings->LoadDword(Debugger_Enabled)) { + if (bHaveDebugger()) { /* Debug - Interrupt *******************/ Item.Reset(ID_DEBUGGER_INTERRUPT_SP,EMPTY_STRING,EMPTY_STDSTR,NULL,"SP Interrupt" ); @@ -1079,6 +1082,10 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { Item.Reset(SUB_MENU, EMPTY_STRING,EMPTY_STDSTR, &DebugLoggingMenu,"Logging"); DebugMenu.push_back(Item); DebugMenu.push_back(MENU_ITEM(SPLITER)); + Item.Reset(ID_DEBUG_SHOW_TLB_MISSES,EMPTY_STRING,EMPTY_STDSTR,NULL,"Show TLB Misses" ); + if (_Settings->LoadBool(Debugger_ShowTLBMisses)) { + Item.ItemTicked = true; + } Item.Reset(ID_DEBUG_SHOW_UNHANDLED_MEM,EMPTY_STRING,EMPTY_STDSTR,NULL,"Show Unhandled Memory Actions" ); if (_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { Item.ItemTicked = true; @@ -1150,7 +1157,7 @@ void CMainMenu::FillOutMenu ( MENU_HANDLE hMenu ) { if (RomLoading) { Item.ItemEnabled = false; } MainTitleMenu.push_back(Item); if (!inBasicMode) { - if (_Settings->LoadBool(Debugger_Enabled)) { + if (bHaveDebugger()) { Item.Reset(SUB_MENU, MENU_DEBUGGER, EMPTY_STDSTR, &DebugMenu); if (RomLoading) { Item.ItemEnabled = false; } MainTitleMenu.push_back(Item); diff --git a/Source/Project64/User Interface/Main Menu Class.h b/Source/Project64/User Interface/Main Menu Class.h index 9f14478b2..0562af8e5 100644 --- a/Source/Project64/User Interface/Main Menu Class.h +++ b/Source/Project64/User Interface/Main Menu Class.h @@ -29,9 +29,9 @@ enum MainMenuID { ID_OPTIONS_DECREASE_SPEED, //Debugger Menu - ID_DEBUG_SHOW_UNHANDLED_MEM, ID_DEBUG_SHOW_PIF_ERRORS, ID_DEBUG_SHOW_DLIST_COUNT, - ID_DEBUG_SHOW_RECOMP_MEM_SIZE,ID_DEBUG_SHOW_CHECK_OPUSAGE, ID_DEBUG_GENERATE_LOG_FILES, - ID_DEBUG_DISABLE_GAMEFIX, + ID_DEBUG_SHOW_TLB_MISSES, ID_DEBUG_SHOW_UNHANDLED_MEM, ID_DEBUG_SHOW_PIF_ERRORS, + ID_DEBUG_SHOW_DLIST_COUNT, ID_DEBUG_SHOW_RECOMP_MEM_SIZE,ID_DEBUG_SHOW_CHECK_OPUSAGE, + ID_DEBUG_GENERATE_LOG_FILES, ID_DEBUG_DISABLE_GAMEFIX, ID_DEBUGGER_LOGOPTIONS, ID_DEBUGGER_GENERATELOG, ID_DEBUGGER_DUMPMEMORY, ID_DEBUGGER_SEARCHMEMORY, ID_DEBUGGER_TLBENTRIES, ID_DEBUGGER_BREAKPOINTS, ID_DEBUGGER_MEMORY, ID_DEBUGGER_R4300REGISTERS, ID_DEBUGGER_INTERRUPT_SP, ID_DEBUGGER_INTERRUPT_SI, ID_DEBUGGER_INTERRUPT_AI, ID_DEBUGGER_INTERRUPT_VI, @@ -49,7 +49,9 @@ enum MainMenuID { ID_HELP_CONTENTS, ID_HELP_GAMEFAQ, ID_HELP_SUPPORTFORUM, ID_HELP_HOMEPAGE, ID_HELP_ABOUTSETTINGFILES, ID_HELP_ABOUT, }; -class CMainMenu:public CBaseMenu +class CMainMenu : + public CBaseMenu, + private CDebugSettings { typedef std::list SettingList; diff --git a/Source/Project64/User Interface/Notification Class.cpp b/Source/Project64/User Interface/Notification Class.cpp index 0da9c9fb6..1e37eb566 100644 --- a/Source/Project64/User Interface/Notification Class.cpp +++ b/Source/Project64/User Interface/Notification Class.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include -CNotification & Notify ( void ) +CNotification & Notify ( void ) { static CNotification _Notify; return _Notify;