Display RTC on OSD

This commit is contained in:
Chris Burgener 2016-07-19 20:23:25 -04:00
parent e21cc8937b
commit 0ef1ee7a83
11 changed files with 41 additions and 1 deletions

View File

@ -286,6 +286,7 @@ void SConfig::SaveMovieSettings(IniFile& ini)
movie->Set("DumpFrames", m_DumpFrames);
movie->Set("DumpFramesSilent", m_DumpFramesSilent);
movie->Set("ShowInputDisplay", m_ShowInputDisplay);
movie->Set("ShowRTC", m_ShowRTC);
}
void SConfig::SaveDSPSettings(IniFile& ini)
@ -564,6 +565,7 @@ void SConfig::LoadMovieSettings(IniFile& ini)
movie->Get("DumpFrames", &m_DumpFrames, false);
movie->Get("DumpFramesSilent", &m_DumpFramesSilent, false);
movie->Get("ShowInputDisplay", &m_ShowInputDisplay, false);
movie->Get("ShowRTC", &m_ShowRTC, false);
}
void SConfig::LoadDSPSettings(IniFile& ini)

View File

@ -255,6 +255,7 @@ struct SConfig : NonCopyable
bool m_PauseMovie;
bool m_ShowLag;
bool m_ShowFrameCount;
bool m_ShowRTC;
std::string m_strMovieAuthor;
unsigned int m_FrameSkip;
bool m_DumpFrames;

View File

@ -32,6 +32,8 @@ static const char iplverPAL[0x100] = "(C) 1999-2001 Nintendo. All rights reserv
static const char iplverNTSC[0x100] = "(C) 1999-2001 Nintendo. All rights reserved."
"(C) 1999 ArtX Inc. All rights reserved.";
static constexpr u32 cJanuary2000 = 0x386D4380; // Seconds between 1.1.1970 and 1.1.2000
// bootrom descrambler reversed by segher
// Copyright 2008 Segher Boessenkool <segher@kernel.crashing.org>
void CEXIIPL::Descrambler(u8* data, u32 size)
@ -405,7 +407,6 @@ void CEXIIPL::TransferByte(u8& _uByte)
u32 CEXIIPL::GetGCTime()
{
u64 ltime = 0;
static const u32 cJanuary2000 = 0x386D4380; // Seconds between 1.1.1970 and 1.1.2000
if (Movie::IsMovieActive())
{
@ -446,3 +447,8 @@ u32 CEXIIPL::GetGCTime()
return ((u32)ltime - cJanuary2000 - Bias);
#endif
}
u32 CEXIIPL::GetGCTimeJan1970()
{
return GetGCTime() + cJanuary2000;
}

View File

@ -21,6 +21,7 @@ public:
void DoState(PointerWrap& p) override;
static u32 GetGCTime();
static u32 GetGCTimeJan1970();
static u64 NetPlay_GetGCTime();
static void Descrambler(u8* data, u32 size);

View File

@ -178,6 +178,18 @@ std::string GetInputDisplay()
return input_display;
}
// NOTE: GPU Thread
std::string GetRTCDisplay()
{
time_t current_time = CEXIIPL::GetGCTimeJan1970();
tm* gm_time = gmtime(&current_time);
char buffer[256];
strftime(buffer, sizeof(buffer), "Date/Time: %c", gm_time);
std::stringstream format_time;
format_time << buffer;
return format_time.str();
}
// NOTE: GPU Thread
void FrameUpdate()
{

View File

@ -179,6 +179,7 @@ void CheckWiimoteStatus(int wiimote, u8* data, const struct WiimoteEmu::ReportFe
int ext, const wiimote_key key);
std::string GetInputDisplay();
std::string GetRTCDisplay();
// Done this way to avoid mixing of core and gui code
typedef void (*GCManipFunction)(GCPadStatus*, int);

View File

@ -255,6 +255,7 @@ EVT_MENU(IDM_TOGGLE_PAUSE_MOVIE, CFrame::OnTogglePauseMovie)
EVT_MENU(IDM_SHOW_LAG, CFrame::OnShowLag)
EVT_MENU(IDM_SHOW_FRAME_COUNT, CFrame::OnShowFrameCount)
EVT_MENU(IDM_SHOW_INPUT_DISPLAY, CFrame::OnShowInputDisplay)
EVT_MENU(IDM_SHOW_RTC_DISPLAY, CFrame::OnShowRTCDisplay)
EVT_MENU(IDM_FRAMESTEP, CFrame::OnFrameStep)
EVT_MENU(IDM_SCREENSHOT, CFrame::OnScreenshot)
EVT_MENU(IDM_TOGGLE_DUMP_FRAMES, CFrame::OnToggleDumpFrames)

View File

@ -265,6 +265,7 @@ private:
void OnShowLag(wxCommandEvent& event);
void OnShowFrameCount(wxCommandEvent& event);
void OnShowInputDisplay(wxCommandEvent& event);
void OnShowRTCDisplay(wxCommandEvent& event);
void OnChangeDisc(wxCommandEvent& event);
void OnScreenshot(wxCommandEvent& event);
void OnActive(wxActivateEvent& event);

View File

@ -206,6 +206,8 @@ wxMenuBar* CFrame::CreateMenu()
movieMenu->Check(IDM_RECORD_READ_ONLY, true);
movieMenu->AppendCheckItem(IDM_SHOW_INPUT_DISPLAY, _("Show Input Display"));
movieMenu->Check(IDM_SHOW_INPUT_DISPLAY, SConfig::GetInstance().m_ShowInputDisplay);
movieMenu->AppendCheckItem(IDM_SHOW_RTC_DISPLAY, _("Show System Clock"));
movieMenu->Check(IDM_SHOW_RTC_DISPLAY, SConfig::GetInstance().m_ShowRTC);
movieMenu->AppendSeparator();
movieMenu->AppendCheckItem(IDM_TOGGLE_DUMP_FRAMES, _("Dump Frames"));
movieMenu->Check(IDM_TOGGLE_DUMP_FRAMES, SConfig::GetInstance().m_DumpFrames);
@ -757,6 +759,12 @@ void CFrame::OnShowInputDisplay(wxCommandEvent& WXUNUSED(event))
SConfig::GetInstance().SaveSettings();
}
void CFrame::OnShowRTCDisplay(wxCommandEvent& WXUNUSED(event))
{
SConfig::GetInstance().m_ShowRTC = !SConfig::GetInstance().m_ShowRTC;
SConfig::GetInstance().SaveSettings();
}
void CFrame::OnFrameStep(wxCommandEvent& event)
{
bool wasPaused = (Core::GetState() == Core::CORE_PAUSE);

View File

@ -98,6 +98,7 @@ enum
IDM_SHOW_LAG,
IDM_SHOW_FRAME_COUNT,
IDM_SHOW_INPUT_DISPLAY,
IDM_SHOW_RTC_DISPLAY,
IDM_FRAMESTEP,
IDM_SCREENSHOT,
IDM_TOGGLE_DUMP_FRAMES,

View File

@ -333,6 +333,12 @@ void Renderer::DrawDebugText()
final_yellow += "\n";
}
if (SConfig::GetInstance().m_ShowRTC)
{
final_cyan += Movie::GetRTCDisplay();
final_yellow += "\n";
}
// OSD Menu messages
if (OSDChoice > 0)
{