From 50c7b966e299f8bc098d8709f7a2ddf9b0b85e27 Mon Sep 17 00:00:00 2001 From: gocha Date: Sat, 3 Apr 2010 15:18:57 +0000 Subject: [PATCH] Add RTC display for movie recording, and small modifications. --- desmume/src/GPU_osd.cpp | 12 ++++++++++++ desmume/src/GPU_osd.h | 1 + desmume/src/NDSSystem.h | 3 ++- desmume/src/rtc.cpp | 7 +++++-- desmume/src/windows/main.cpp | 8 ++++++++ desmume/src/windows/replay.cpp | 17 ++++++++++++++++- desmume/src/windows/resource.h | 3 ++- desmume/src/windows/resources.rc | Bin 911544 -> 911720 bytes 8 files changed, 46 insertions(+), 5 deletions(-) diff --git a/desmume/src/GPU_osd.cpp b/desmume/src/GPU_osd.cpp index 167dc531b..ca3147ea9 100644 --- a/desmume/src/GPU_osd.cpp +++ b/desmume/src/GPU_osd.cpp @@ -164,6 +164,11 @@ void HudStruct::reset() Microphone.xsize=20; Microphone.ysize=10; + RTCDisplay.x=0; + RTCDisplay.y=105; + RTCDisplay.xsize=220; + RTCDisplay.ysize=10; + SavestateSlots.x = 8; SavestateSlots.y = 160; SavestateSlots.xsize = 240; @@ -558,6 +563,13 @@ void DrawHUD() } #endif + if (CommonSettings.hud.ShowRTC) + { + struct tm *tm = rtcGetTime(); + const char *wday[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; + osd->addFixed(Hud.RTCDisplay.x, Hud.RTCDisplay.y, "%04d-%02d-%02d %s %02d:%02d:%02d", 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday, wday[tm->tm_wday%7], tm->tm_hour, tm->tm_min, tm->tm_sec); + } + DrawStateSlots(); } diff --git a/desmume/src/GPU_osd.h b/desmume/src/GPU_osd.h index 4303bb754..999973bc0 100644 --- a/desmume/src/GPU_osd.h +++ b/desmume/src/GPU_osd.h @@ -70,6 +70,7 @@ public: HudCoordinates GraphicalInputDisplay; HudCoordinates LagFrameCounter; HudCoordinates Microphone; + HudCoordinates RTCDisplay; HudCoordinates Dummy; HudCoordinates &hud(int i) { return ((HudCoordinates*)this)[i]; } diff --git a/desmume/src/NDSSystem.h b/desmume/src/NDSSystem.h index 25381f484..99ea871b7 100644 --- a/desmume/src/NDSSystem.h +++ b/desmume/src/NDSSystem.h @@ -572,8 +572,9 @@ extern struct TCommonSettings { , FrameCounterDisplay(false) , ShowLagFrameCounter(false) , ShowMicrophone(false) + , ShowRTC(false) {} - bool ShowInputDisplay, ShowGraphicalInputDisplay, FpsDisplay, FrameCounterDisplay, ShowLagFrameCounter, ShowMicrophone; + bool ShowInputDisplay, ShowGraphicalInputDisplay, FpsDisplay, FrameCounterDisplay, ShowLagFrameCounter, ShowMicrophone, ShowRTC; } hud; } CommonSettings; diff --git a/desmume/src/rtc.cpp b/desmume/src/rtc.cpp index 11fc44c7a..a72b8ac2b 100644 --- a/desmume/src/rtc.cpp +++ b/desmume/src/rtc.cpp @@ -114,10 +114,11 @@ bool moviemode=false; struct tm* rtcGetTime(void) { + struct tm *tm = NULL; if(movieMode == MOVIEMODE_INACTIVE) { time_t timer; time(&timer); - return localtime(&timer); + tm = localtime(&timer); } else { //now, you might think it is silly to go through all these conniptions @@ -140,8 +141,10 @@ struct tm* rtcGetTime(void) t.tm_sec += totalseconds; // then, normalize it timer = gmmktime(&t); - return gmtime(&timer); + tm = gmtime(&timer); } + tm->tm_year = 100 + (tm->tm_year % 100); // 20XX + return tm; } static void rtcRecv() diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index 0a3cdfe19..e57716e8a 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -2378,6 +2378,7 @@ int _main() CommonSettings.hud.ShowGraphicalInputDisplay = GetPrivateProfileBool("Display","Display Graphical Input", false, IniName); CommonSettings.hud.ShowLagFrameCounter = GetPrivateProfileBool("Display","Display Lag Counter", false, IniName); CommonSettings.hud.ShowMicrophone = GetPrivateProfileBool("Display","Display Microphone", false, IniName); + CommonSettings.hud.ShowRTC = GetPrivateProfileBool("Display","Display RTC", false, IniName); CommonSettings.micMode = (TCommonSettings::MicMode)GetPrivateProfileInt("MicSettings", "MicMode", (int)TCommonSettings::InternalNoise, IniName); GetPrivateProfileString("MicSettings", "MicSampleFile", "micsample.raw", MicSampleName, MAX_PATH, IniName); @@ -3690,6 +3691,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM MainWindow->checkMenu(ID_VIEW_DISPLAYGRAPHICALINPUT,CommonSettings.hud.ShowGraphicalInputDisplay); MainWindow->checkMenu(ID_VIEW_DISPLAYLAG,CommonSettings.hud.ShowLagFrameCounter); MainWindow->checkMenu(ID_VIEW_DISPLAYMICROPHONE,CommonSettings.hud.ShowMicrophone); + MainWindow->checkMenu(ID_VIEW_DISPLAYRTC,CommonSettings.hud.ShowRTC); MainWindow->checkMenu(ID_VIEW_HUDEDITOR, HudEditorMode); MainWindow->checkMenu(IDC_FRAMELIMIT, FrameLimit); @@ -4979,6 +4981,12 @@ DOKEYDOWN: osd->clear(); return 0; + case ID_VIEW_DISPLAYRTC: + CommonSettings.hud.ShowRTC ^= true; + WritePrivateProfileBool("Display", "Display RTC", CommonSettings.hud.ShowRTC, IniName); + osd->clear(); + return 0; + case ID_VIEW_HUDEDITOR: HudEditorMode ^= true; osd->clear(); diff --git a/desmume/src/windows/replay.cpp b/desmume/src/windows/replay.cpp index 805e3dd5f..1d5a1f65a 100644 --- a/desmume/src/windows/replay.cpp +++ b/desmume/src/windows/replay.cpp @@ -259,7 +259,7 @@ static INT_PTR CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, time_t timer = FCEUI_MovieGetRTCDefault(); struct tm *t = gmtime(&timer); - ZeroMemory(&systime, sizeof(systime)); + ZeroMemory(&systime, sizeof(SYSTEMTIME)); systime.wYear = t->tm_year + 1900; systime.wMonth = t->tm_mon + 1; systime.wDay = t->tm_mday; @@ -270,6 +270,21 @@ static INT_PTR CALLBACK RecordDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, systime.wMilliseconds = 0; DateTime_SetSystemtime(GetDlgItem(hwndDlg, IDC_DTP_DATE), GDT_VALID, &systime); DateTime_SetSystemtime(GetDlgItem(hwndDlg, IDC_DTP_TIME), GDT_VALID, &systime); + + SYSTEMTIME rtcMin; + SYSTEMTIME rtcMax; + ZeroMemory(&rtcMin, sizeof(SYSTEMTIME)); + ZeroMemory(&rtcMax, sizeof(SYSTEMTIME)); + rtcMin.wYear = 2000; + rtcMin.wMonth = 1; + rtcMin.wDay = 1; + rtcMin.wDayOfWeek = 6; + rtcMax.wYear = 2099; + rtcMax.wMonth = 12; + rtcMax.wDay = 31; + rtcMax.wDayOfWeek = 4; + DateTime_SetRange(GetDlgItem(hwndDlg, IDC_DTP_DATE), GDTR_MIN, &rtcMin); + DateTime_SetRange(GetDlgItem(hwndDlg, IDC_DTP_DATE), GDTR_MAX, &rtcMax); return false; } diff --git a/desmume/src/windows/resource.h b/desmume/src/windows/resource.h index e903a4459..19eb69be8 100644 --- a/desmume/src/windows/resource.h +++ b/desmume/src/windows/resource.h @@ -811,6 +811,7 @@ #define ID_VIEWLAYERS_MAINOBJ 40075 #define IDM_MOBJ 40076 #define IDM_SOBJ 40077 +#define ID_VIEW_DISPLAYRTC 40078 #define IDC_LABEL_UP 50000 #define IDC_LABEL_RIGHT 50001 #define IDC_LABEL_LEFT 50002 @@ -909,7 +910,7 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 121 -#define _APS_NEXT_COMMAND_VALUE 40078 +#define _APS_NEXT_COMMAND_VALUE 40079 #define _APS_NEXT_CONTROL_VALUE 1029 #define _APS_NEXT_SYMED_VALUE 101 #endif diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index 2b4c87b82c2bea7c8306ab60ccfb2fba563845ab..a3326b061d8db1972cfd970e8ee1910d7923a9be 100644 GIT binary patch delta 137 zcmdmS(fq|F^M)427N!>F7M2#)Eo`U6r#Eyn7fe6E$jmjhj@bmko7_>1;5kgcpv0Wj zt{}y>T|tWd+S}<9&T$E_1~G&%I8T3Q&ZIs4!Z|J}7@vdHc>1jiTp8^N92`K*3B+7L P%nigm+Y>l=BOU+%h>kC0 delta 86 zcmaEH$$ZB}^M)427N!>F7M2#)Eo`U6Hy0GGW11eYjGJY;LI=0fWQS6>=?(rIEbSc9 lY}+}c+4