diff --git a/Source/Project64-core/N64System/N64Class.cpp b/Source/Project64-core/N64System/N64Class.cpp index 53b9f9a50..59c639c4b 100644 --- a/Source/Project64-core/N64System/N64Class.cpp +++ b/Source/Project64-core/N64System/N64Class.cpp @@ -1734,7 +1734,6 @@ bool CN64System::LoadState(const char * FileName) { port = unzGoToFirstFile(file); } - uint32_t Value; while (port == UNZ_OK) { unz_file_info info; @@ -1924,7 +1923,7 @@ bool CN64System::LoadState(const char * FileName) WriteTrace(TraceN64System, TraceDebug, "8"); m_FPS.Reset(true); WriteTrace(TraceN64System, TraceDebug, "9"); - if (bLogX86Code()) + if (bRecordRecompilerAsm()) { Stop_Recompiler_Log(); Start_Recompiler_Log(); diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.cpp index b80e4ee4f..4bc917a70 100644 --- a/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmRecompilerOps.cpp @@ -4807,7 +4807,7 @@ bool CArmRecompilerOps::SetupRegisterForLoop(CCodeBlock * BlockInfo, const CRegI void CArmRecompilerOps::OutputRegisterState(const CRegInfo & SyncTo, const CRegInfo & CurrentSet) const { - if (!g_bRecompilerLogging) + if (!CDebugSettings::bRecordRecompilerAsm()) { return; } diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.cpp b/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.cpp index 2af9e8a8a..d6cc104df 100644 --- a/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.cpp +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.cpp @@ -767,7 +767,7 @@ CArmOps::ArmReg CArmRegInfo::FreeArmReg(bool TempMapping) void CArmRegInfo::LogRegisterState(void) { - if (!g_bRecompilerLogging) + if (!CDebugSettings::bRecordRecompilerAsm()) { return; } diff --git a/Source/Project64-core/N64System/Recompiler/CodeSection.cpp b/Source/Project64-core/N64System/Recompiler/CodeSection.cpp index 24cf8dcb3..fa550a302 100644 --- a/Source/Project64-core/N64System/Recompiler/CodeSection.cpp +++ b/Source/Project64-core/N64System/Recompiler/CodeSection.cpp @@ -1085,7 +1085,7 @@ bool CCodeSection::IsAllParentLoops(CCodeSection * Parent, bool IgnoreIfCompiled bool CCodeSection::DisplaySectionInformation(uint32_t ID, uint32_t Test) { - if (!g_bRecompilerLogging) + if (!CDebugSettings::bRecordRecompilerAsm()) { return false; } @@ -1109,12 +1109,12 @@ void CCodeSection::DisplaySectionInformation() } CPU_Message("====== Section %d ======", m_SectionID); - CPU_Message("Start PC: %X", m_EnterPC); + CPU_Message("Start PC: 0x%X", m_EnterPC); if (g_System->bLinkBlocks()) { - CPU_Message("End PC: %X", m_EndPC); + CPU_Message("End PC: 0x%X", m_EndPC); } - CPU_Message("CompiledLocation: %X", m_CompiledLocation); + CPU_Message("CompiledLocation: 0x%X", m_CompiledLocation); if (g_System->bLinkBlocks() && !m_ParentSection.empty()) { stdstr ParentList; diff --git a/Source/Project64-core/N64System/Recompiler/RecompilerClass.cpp b/Source/Project64-core/N64System/Recompiler/RecompilerClass.cpp index 546894729..c7fb00be5 100644 --- a/Source/Project64-core/N64System/Recompiler/RecompilerClass.cpp +++ b/Source/Project64-core/N64System/Recompiler/RecompilerClass.cpp @@ -37,7 +37,7 @@ void CRecompiler::Run() { WriteTrace(TraceRecompiler, TraceDebug, "Start"); - if (bLogX86Code()) + if (bRecordRecompilerAsm()) { Start_Recompiler_Log(); } diff --git a/Source/Project64-core/N64System/Recompiler/RecompilerCodeLog.cpp b/Source/Project64-core/N64System/Recompiler/RecompilerCodeLog.cpp index c1e1ed088..b8a46890d 100644 --- a/Source/Project64-core/N64System/Recompiler/RecompilerCodeLog.cpp +++ b/Source/Project64-core/N64System/Recompiler/RecompilerCodeLog.cpp @@ -14,7 +14,6 @@ #include static CLog * g_CPULogFile = NULL; -bool g_bRecompilerLogging = false; void Recompiler_Log_Message(const char * strFormat, ...) { @@ -45,7 +44,6 @@ void Start_Recompiler_Log (void) if (g_CPULogFile->Open(LogFileName)) { g_CPULogFile->SetMaxFileSize(300 * CLog::MB); - g_bRecompilerLogging = true; } else { @@ -57,7 +55,6 @@ void Start_Recompiler_Log (void) void Stop_Recompiler_Log (void) { - g_bRecompilerLogging = false; if (g_CPULogFile != NULL) { delete g_CPULogFile; diff --git a/Source/Project64-core/N64System/Recompiler/RecompilerCodeLog.h b/Source/Project64-core/N64System/Recompiler/RecompilerCodeLog.h index 2864786ef..ccdaf070f 100644 --- a/Source/Project64-core/N64System/Recompiler/RecompilerCodeLog.h +++ b/Source/Project64-core/N64System/Recompiler/RecompilerCodeLog.h @@ -9,15 +9,10 @@ * * ****************************************************************************/ #pragma once +#include -/* vsprintf() needs to have both of these included. */ -#include -#include - -#define CPU_Message(Message,... ) if (g_bRecompilerLogging) { Recompiler_Log_Message(Message,## __VA_ARGS__); } +#define CPU_Message(Message,... ) if (CDebugSettings::bRecordRecompilerAsm()) { Recompiler_Log_Message(Message,## __VA_ARGS__); } void Recompiler_Log_Message (const char * Message, ...); void Start_Recompiler_Log (void); void Stop_Recompiler_Log (void); - -extern bool g_bRecompilerLogging; diff --git a/Source/Project64-core/Settings/DebugSettings.cpp b/Source/Project64-core/Settings/DebugSettings.cpp index a023c8091..99f127feb 100644 --- a/Source/Project64-core/Settings/DebugSettings.cpp +++ b/Source/Project64-core/Settings/DebugSettings.cpp @@ -14,7 +14,7 @@ int CDebugSettings::m_RefCount = 0; bool CDebugSettings::m_bHaveDebugger = false; -bool CDebugSettings::m_bLogX86Code = false; +bool CDebugSettings::m_bRecordRecompilerAsm = false; bool CDebugSettings::m_bShowTLBMisses = false; bool CDebugSettings::m_bShowDivByZero = false; bool CDebugSettings::m_Registered = false; @@ -27,7 +27,7 @@ CDebugSettings::CDebugSettings() { m_Registered = true; g_Settings->RegisterChangeCB(Debugger_Enabled, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); - g_Settings->RegisterChangeCB(Debugger_GenerateLogFiles, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); + g_Settings->RegisterChangeCB(Debugger_RecordRecompilerAsm, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->RegisterChangeCB(Debugger_ShowTLBMisses, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->RegisterChangeCB(Debugger_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->RegisterChangeCB(Debugger_RecordExecutionTimes, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); @@ -42,7 +42,7 @@ CDebugSettings::~CDebugSettings() if (m_RefCount == 0 && g_Settings) { g_Settings->UnregisterChangeCB(Debugger_Enabled, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); - g_Settings->UnregisterChangeCB(Debugger_GenerateLogFiles, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); + g_Settings->UnregisterChangeCB(Debugger_RecordRecompilerAsm, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->UnregisterChangeCB(Debugger_ShowTLBMisses, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->UnregisterChangeCB(Debugger_ShowDivByZero, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); g_Settings->UnregisterChangeCB(Debugger_RecordExecutionTimes, this, (CSettings::SettingChangedFunc)StaticRefreshSettings); @@ -52,7 +52,7 @@ CDebugSettings::~CDebugSettings() void CDebugSettings::RefreshSettings() { m_bHaveDebugger = g_Settings->LoadBool(Debugger_Enabled); - m_bLogX86Code = m_bHaveDebugger && g_Settings->LoadBool(Debugger_GenerateLogFiles); + m_bRecordRecompilerAsm = m_bHaveDebugger && g_Settings->LoadBool(Debugger_RecordRecompilerAsm); m_bShowTLBMisses = m_bHaveDebugger && g_Settings->LoadBool(Debugger_ShowTLBMisses); m_bShowDivByZero = m_bHaveDebugger && g_Settings->LoadBool(Debugger_ShowDivByZero); m_RecordExecutionTimes = g_Settings->LoadBool(Debugger_RecordExecutionTimes); diff --git a/Source/Project64-core/Settings/DebugSettings.h b/Source/Project64-core/Settings/DebugSettings.h index 895c49015..8d472bfee 100644 --- a/Source/Project64-core/Settings/DebugSettings.h +++ b/Source/Project64-core/Settings/DebugSettings.h @@ -19,7 +19,7 @@ public: virtual ~CDebugSettings(); static inline bool bHaveDebugger(void) { return m_bHaveDebugger; } - static inline bool bLogX86Code(void) { return m_bLogX86Code; } + static inline bool bRecordRecompilerAsm(void) { return m_bRecordRecompilerAsm; } static inline bool bShowTLBMisses(void) { return m_bShowTLBMisses; } static inline bool bShowDivByZero(void) { return m_bShowDivByZero; } static inline bool bRecordExecutionTimes(void) { return m_RecordExecutionTimes; } @@ -34,7 +34,7 @@ private: //Settings that can be changed on the fly static bool m_bHaveDebugger; - static bool m_bLogX86Code; + static bool m_bRecordRecompilerAsm; static bool m_bShowTLBMisses; static bool m_bShowDivByZero; static bool m_RecordExecutionTimes; diff --git a/Source/Project64-core/Settings/Settings.h b/Source/Project64-core/Settings/Settings.h index b7342df8e..56b9e5b52 100644 --- a/Source/Project64-core/Settings/Settings.h +++ b/Source/Project64-core/Settings/Settings.h @@ -214,7 +214,7 @@ enum SettingID Debugger_ShowUnhandledMemory, Debugger_ShowPifErrors, Debugger_ShowDivByZero, - Debugger_GenerateLogFiles, + Debugger_RecordRecompilerAsm, Debugger_DisableGameFixes, Debugger_AppLogLevel, Debugger_AppLogFlush, diff --git a/Source/Project64-core/Settings/SettingsClass.cpp b/Source/Project64-core/Settings/SettingsClass.cpp index c2e0d7bd7..fb015d235 100644 --- a/Source/Project64-core/Settings/SettingsClass.cpp +++ b/Source/Project64-core/Settings/SettingsClass.cpp @@ -310,7 +310,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory) AddHandler(Debugger_DebugLanguage, new CSettingTypeApplication("Debugger", "Debug Language", false)); AddHandler(Debugger_ShowDivByZero, new CSettingTypeApplication("Debugger", "Show Div by zero", false)); AddHandler(Debugger_AppLogFlush, new CSettingTypeApplication("Logging", "Log Auto Flush", (uint32_t)false)); - AddHandler(Debugger_GenerateLogFiles, new CSettingTypeApplication("Debugger", "Generate Log Files", false)); + AddHandler(Debugger_RecordRecompilerAsm, new CSettingTypeApplication("Debugger", "Record Recompiler Asm", false)); //Logging AddHandler(Debugger_TraceMD5, new CSettingTypeApplication("Logging", "MD5", (uint32_t)g_ModuleLogLevel[TraceMD5])); diff --git a/Source/Project64/UserInterface/MainMenuClass.cpp b/Source/Project64/UserInterface/MainMenuClass.cpp index 57ef1dbcd..1bf094624 100644 --- a/Source/Project64/UserInterface/MainMenuClass.cpp +++ b/Source/Project64/UserInterface/MainMenuClass.cpp @@ -28,7 +28,7 @@ m_Gui(hMainWindow) m_ChangeSettingList.push_back(Debugger_DebugLanguage); m_ChangeSettingList.push_back(Debugger_ShowRecompMemSize); m_ChangeSettingList.push_back(Debugger_ShowDivByZero); - m_ChangeSettingList.push_back(Debugger_GenerateLogFiles); + m_ChangeSettingList.push_back(Debugger_RecordRecompilerAsm); m_ChangeSettingList.push_back(Debugger_DisableGameFixes); m_ChangeSettingList.push_back(Debugger_TraceMD5); m_ChangeSettingList.push_back(Debugger_TraceSettings); @@ -508,8 +508,8 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI case ID_DEBUG_SHOW_DIV_BY_ZERO: g_Settings->SaveBool(Debugger_ShowDivByZero, !g_Settings->LoadBool(Debugger_ShowDivByZero)); break; - case ID_DEBUG_GENERATE_LOG_FILES: - g_Settings->SaveBool(Debugger_GenerateLogFiles, !g_Settings->LoadBool(Debugger_GenerateLogFiles)); + case ID_DEBUG_RECORD_RECOMPILER_ASM: + g_Settings->SaveBool(Debugger_RecordRecompilerAsm, !g_Settings->LoadBool(Debugger_RecordRecompilerAsm)); break; case ID_DEBUG_DISABLE_GAMEFIX: g_Settings->SaveBool(Debugger_DisableGameFixes, !g_Settings->LoadBool(Debugger_DisableGameFixes)); @@ -1240,8 +1240,8 @@ void CMainMenu::FillOutMenu(HMENU hMenu) } DebugMenu.push_back(Item); DebugMenu.push_back(MENU_ITEM(SPLITER)); - Item.Reset(ID_DEBUG_GENERATE_LOG_FILES, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Generate Log Files"); - if (g_Settings->LoadBool(Debugger_GenerateLogFiles)) + Item.Reset(ID_DEBUG_RECORD_RECOMPILER_ASM, EMPTY_STRING, EMPTY_STDSTR, NULL, L"Record Recompiler Asm"); + if (g_Settings->LoadBool(Debugger_RecordRecompilerAsm)) { Item.SetItemTicked(true); } diff --git a/Source/Project64/UserInterface/MainMenuClass.h b/Source/Project64/UserInterface/MainMenuClass.h index 6d34ae29a..420d8df20 100644 --- a/Source/Project64/UserInterface/MainMenuClass.h +++ b/Source/Project64/UserInterface/MainMenuClass.h @@ -35,7 +35,7 @@ enum MainMenuID //Debugger Menu 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_DIV_BY_ZERO, - ID_DEBUG_GENERATE_LOG_FILES, ID_DEBUG_DISABLE_GAMEFIX, ID_DEBUG_LANGUAGE, + ID_DEBUG_RECORD_RECOMPILER_ASM, ID_DEBUG_DISABLE_GAMEFIX, ID_DEBUG_LANGUAGE, 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,