diff --git a/source/menu.cpp b/source/menu.cpp index 5de728f..5141da2 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -3249,6 +3249,7 @@ static int MenuSettingsVideo() sprintf(options.name[i++], "Crosshair"); sprintf(options.name[i++], "Video Mode"); sprintf(options.name[i++], "Show Framerate"); + sprintf(options.name[i++], "Show Local Time"); sprintf(options.name[i++], "SuperFX Overclock"); options.length = i; @@ -3342,6 +3343,10 @@ static int MenuSettingsVideo() Settings.DisplayFrameRate ^= 1; break; case 8: + Settings.AutoDisplayMessages ^= 1; + Settings.DisplayTime ^= 1; + break; + case 9: GCSettings.sfxOverclock++; if (GCSettings.sfxOverclock > 2) { GCSettings.sfxOverclock = 0; @@ -3401,14 +3406,15 @@ static int MenuSettingsVideo() sprintf (options.value[6], "PAL (60Hz)"); break; } sprintf (options.value[7], "%s", Settings.DisplayFrameRate ? "On" : "Off"); + sprintf (options.value[8], "%s", Settings.DisplayTime ? "On" : "Off"); switch(GCSettings.sfxOverclock) { case 0: - sprintf (options.value[8], "Default"); break; + sprintf (options.value[9], "Default"); break; case 1: - sprintf (options.value[8], "40 Mhz"); break; + sprintf (options.value[9], "40 Mhz"); break; case 2: - sprintf (options.value[8], "60 Mhz"); break; + sprintf (options.value[9], "60 Mhz"); break; } optionBrowser.TriggerUpdate(); } diff --git a/source/preferences.cpp b/source/preferences.cpp index dca1cdb..0ea2764 100644 --- a/source/preferences.cpp +++ b/source/preferences.cpp @@ -517,6 +517,7 @@ DefaultSettings () Settings.DisplayFrameRate = false; Settings.AutoDisplayMessages = 0; Settings.InitialInfoStringTimeout = 200; // # frames to display messages for + Settings.DisplayTime = false; // Frame timings in 50hz and 60hz cpu mode Settings.FrameTimePAL = 20000; diff --git a/source/snes9x/gfx.cpp b/source/snes9x/gfx.cpp index 548843e..5e4a163 100644 --- a/source/snes9x/gfx.cpp +++ b/source/snes9x/gfx.cpp @@ -26,6 +26,7 @@ void (*S9xCustomDisplayString) (const char *, int, int, bool, int) = NULL; static void SetupOBJ (void); static void DrawOBJS (int); +static void DisplayTime (void); static void DisplayFrameRate (void); static void DisplayPressedKeys (void); static void DisplayWatchedAddresses (void); @@ -1838,6 +1839,20 @@ static void S9xDisplayStringType (const char *string, int linesFromBottom, int p S9xDisplayString (string, linesFromBottom, pixelsFromLeft, allowWrap); } +static void DisplayTime (void) +{ + char string[10]; + + time_t rawtime; + struct tm *timeinfo; + + time (&rawtime); + timeinfo = localtime(&rawtime); + + sprintf(string, "%02u:%02u", timeinfo->tm_hour, timeinfo->tm_min); + S9xDisplayString(string, 0, 0, false); +} + static void DisplayFrameRate (void) { char string[10]; @@ -2031,6 +2046,9 @@ static void DisplayWatchedAddresses (void) void S9xDisplayMessages (uint16 *screen, int ppl, int width, int height, int scale) { + if (Settings.DisplayTime) + DisplayTime(); + if (Settings.DisplayFrameRate) DisplayFrameRate(); diff --git a/source/snes9x/snes9x.h b/source/snes9x/snes9x.h index f05930f..bd252a6 100644 --- a/source/snes9x/snes9x.h +++ b/source/snes9x/snes9x.h @@ -243,6 +243,7 @@ struct SSettings uint8 BG_Forced; bool8 DisableGraphicWindows; + bool8 DisplayTime; bool8 DisplayFrameRate; bool8 DisplayWatchedAddresses; bool8 DisplayPressedKeys;