[Project64] Add logging for system event
This commit is contained in:
parent
54f1f385e7
commit
67f2a445ae
|
@ -13,6 +13,53 @@
|
|||
#include <Project64-core/N64System/SystemGlobals.h>
|
||||
#include <Project64-core/N64System/N64Class.h>
|
||||
|
||||
const char * SystemEventName(SystemEvent event)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case SysEvent_ExecuteInterrupt: return "SysEvent_ExecuteInterrupt";
|
||||
case SysEvent_GSButtonPressed: return "SysEvent_GSButtonPressed";
|
||||
case SysEvent_ResetCPU_Soft: return "SysEvent_ResetCPU_Soft";
|
||||
case SysEvent_ResetCPU_SoftDone: return "SysEvent_ResetCPU_SoftDone";
|
||||
case SysEvent_ResetCPU_Hard: return "SysEvent_ResetCPU_Hard";
|
||||
case SysEvent_CloseCPU: return "SysEvent_CloseCPU";
|
||||
case SysEvent_PauseCPU_FromMenu: return "SysEvent_PauseCPU_FromMenu";
|
||||
case SysEvent_PauseCPU_AppLostActive: return "SysEvent_PauseCPU_AppLostActive";
|
||||
case SysEvent_PauseCPU_AppLostActiveDelay: return "SysEvent_PauseCPU_AppLostActiveDelay";
|
||||
case SysEvent_PauseCPU_AppLostFocus: return "SysEvent_PauseCPU_AppLostFocus";
|
||||
case SysEvent_PauseCPU_SaveGame: return "SysEvent_PauseCPU_SaveGame";
|
||||
case SysEvent_PauseCPU_LoadGame: return "SysEvent_PauseCPU_LoadGame";
|
||||
case SysEvent_PauseCPU_DumpMemory: return "SysEvent_PauseCPU_DumpMemory";
|
||||
case SysEvent_PauseCPU_SearchMemory: return "SysEvent_PauseCPU_SearchMemory";
|
||||
case SysEvent_PauseCPU_Settings: return "SysEvent_PauseCPU_Settings";
|
||||
case SysEvent_PauseCPU_Cheats: return "SysEvent_PauseCPU_Cheats";
|
||||
case SysEvent_ResumeCPU_FromMenu: return "SysEvent_ResumeCPU_FromMenu";
|
||||
case SysEvent_ResumeCPU_AppGainedActive: return "SysEvent_ResumeCPU_AppGainedActive";
|
||||
case SysEvent_ResumeCPU_AppGainedFocus: return "SysEvent_ResumeCPU_AppGainedFocus";
|
||||
case SysEvent_ResumeCPU_SaveGame: return "SysEvent_ResumeCPU_SaveGame";
|
||||
case SysEvent_ResumeCPU_LoadGame: return "SysEvent_ResumeCPU_LoadGame";
|
||||
case SysEvent_ResumeCPU_DumpMemory: return "SysEvent_ResumeCPU_DumpMemory";
|
||||
case SysEvent_ResumeCPU_SearchMemory: return "SysEvent_ResumeCPU_SearchMemory";
|
||||
case SysEvent_ResumeCPU_Settings: return "SysEvent_ResumeCPU_Settings";
|
||||
case SysEvent_ResumeCPU_Cheats: return "SysEvent_ResumeCPU_Cheats";
|
||||
case SysEvent_ChangingFullScreen: return "SysEvent_ChangingFullScreen";
|
||||
case SysEvent_ChangePlugins: return "SysEvent_ChangePlugins";
|
||||
case SysEvent_SaveMachineState: return "SysEvent_SaveMachineState";
|
||||
case SysEvent_LoadMachineState: return "SysEvent_LoadMachineState";
|
||||
case SysEvent_Interrupt_SP: return "SysEvent_Interrupt_SP";
|
||||
case SysEvent_Interrupt_SI: return "SysEvent_Interrupt_SI";
|
||||
case SysEvent_Interrupt_AI: return "SysEvent_Interrupt_AI";
|
||||
case SysEvent_Interrupt_VI: return "SysEvent_Interrupt_VI";
|
||||
case SysEvent_Interrupt_PI: return "SysEvent_Interrupt_PI";
|
||||
case SysEvent_Interrupt_DP: return "SysEvent_Interrupt_DP";
|
||||
case SysEvent_ResetFunctionTimes: return "SysEvent_ResetFunctionTimes";
|
||||
case SysEvent_DumpFunctionTimes: return "SysEvent_DumpFunctionTimes";
|
||||
}
|
||||
static char unknown[100];
|
||||
sprintf(unknown, "unknown(%d)", event);
|
||||
return unknown;
|
||||
}
|
||||
|
||||
CSystemEvents::CSystemEvents(CN64System * System, CPlugins * Plugins) :
|
||||
m_System(System),
|
||||
m_Plugins(Plugins),
|
||||
|
|
|
@ -53,6 +53,8 @@ enum SystemEvent
|
|||
SysEvent_DumpFunctionTimes,
|
||||
};
|
||||
|
||||
const char * SystemEventName(SystemEvent event);
|
||||
|
||||
class CN64System;
|
||||
class CPlugins;
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ CN64System::CN64System(CPlugins * Plugins, bool SavesReadOnly, bool SyncSystem)
|
|||
m_Recomp = new CRecompiler(m_MMU_VM, m_Reg, m_EndEmulation);
|
||||
}
|
||||
}
|
||||
|
||||
WriteTrace(TraceN64System, TraceDebug, "Done");
|
||||
}
|
||||
|
||||
|
@ -131,11 +132,14 @@ CN64System::~CN64System()
|
|||
|
||||
void CN64System::ExternalEvent(SystemEvent action)
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "action: %s", SystemEventName(action));
|
||||
|
||||
if (action == SysEvent_LoadMachineState &&
|
||||
!g_Settings->LoadBool(GameRunning_CPU_Running) &&
|
||||
g_BaseSystem != NULL &&
|
||||
g_BaseSystem->LoadState())
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "ignore event, manualy loaded save");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -144,6 +148,7 @@ void CN64System::ExternalEvent(SystemEvent action)
|
|||
g_BaseSystem != NULL &&
|
||||
g_BaseSystem->SaveState())
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "ignore event, manualy saved event");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1582,6 +1587,7 @@ bool CN64System::SaveState()
|
|||
}
|
||||
else
|
||||
{
|
||||
WriteTrace(TraceN64System, TraceDebug, "SaveFile: %s", (const char *)SaveFile);
|
||||
ExtraInfo.Delete();
|
||||
SaveFile.Delete();
|
||||
CFile hSaveFile(SaveFile, CFileBase::modeWrite | CFileBase::modeCreate);
|
||||
|
@ -1907,27 +1913,21 @@ bool CN64System::LoadState(const char * FileName)
|
|||
m_Reg.RANDOM_REGISTER += 32 - m_Reg.WIRED_REGISTER;
|
||||
}
|
||||
//Fix up timer
|
||||
WriteTrace(TraceN64System, TraceDebug, "2");
|
||||
m_SystemTimer.SetTimer(CSystemTimer::CompareTimer, m_Reg.COMPARE_REGISTER - m_Reg.COUNT_REGISTER, false);
|
||||
m_SystemTimer.SetTimer(CSystemTimer::ViTimer, NextVITimer, false);
|
||||
m_Reg.FixFpuLocations();
|
||||
WriteTrace(TraceN64System, TraceDebug, "5");
|
||||
m_TLB.Reset(false);
|
||||
WriteTrace(TraceN64System, TraceDebug, "6");
|
||||
if (m_Recomp)
|
||||
{
|
||||
m_Recomp->ResetFunctionTimes();
|
||||
}
|
||||
m_CPU_Usage.ResetTimers();
|
||||
WriteTrace(TraceN64System, TraceDebug, "8");
|
||||
m_FPS.Reset(true);
|
||||
WriteTrace(TraceN64System, TraceDebug, "9");
|
||||
if (bRecordRecompilerAsm())
|
||||
{
|
||||
Stop_Recompiler_Log();
|
||||
Start_Recompiler_Log();
|
||||
}
|
||||
WriteTrace(TraceN64System, TraceDebug, "Done");
|
||||
|
||||
#ifdef TEST_SP_TRACKING
|
||||
m_CurrentSP = GPR[29].UW[0];
|
||||
|
@ -1948,7 +1948,6 @@ bool CN64System::LoadState(const char * FileName)
|
|||
SyncCPU(m_SyncCPU);
|
||||
}
|
||||
}
|
||||
WriteTrace(TraceN64System, TraceDebug, "13");
|
||||
std::string LoadMsg = g_Lang->GetString(MSG_LOADED_STATE);
|
||||
g_Notify->DisplayMessage(5, stdstr_f("%s %s", LoadMsg.c_str(), stdstr(SaveFile.GetNameExtension()).c_str()).c_str());
|
||||
WriteTrace(TraceN64System, TraceDebug, "Done");
|
||||
|
|
Loading…
Reference in New Issue