Add Show Local Time option. (#848)

Adds the option 'Show Local Time" under Game Settings, Video when playing a game.
This commit is contained in:
bladeoner 2019-05-16 02:54:54 +02:00 committed by dborth
parent 2dfce39f63
commit 8447bdf94c
4 changed files with 29 additions and 3 deletions

View File

@ -3249,6 +3249,7 @@ static int MenuSettingsVideo()
sprintf(options.name[i++], "Crosshair"); sprintf(options.name[i++], "Crosshair");
sprintf(options.name[i++], "Video Mode"); sprintf(options.name[i++], "Video Mode");
sprintf(options.name[i++], "Show Framerate"); sprintf(options.name[i++], "Show Framerate");
sprintf(options.name[i++], "Show Local Time");
sprintf(options.name[i++], "SuperFX Overclock"); sprintf(options.name[i++], "SuperFX Overclock");
options.length = i; options.length = i;
@ -3342,6 +3343,10 @@ static int MenuSettingsVideo()
Settings.DisplayFrameRate ^= 1; Settings.DisplayFrameRate ^= 1;
break; break;
case 8: case 8:
Settings.AutoDisplayMessages ^= 1;
Settings.DisplayTime ^= 1;
break;
case 9:
GCSettings.sfxOverclock++; GCSettings.sfxOverclock++;
if (GCSettings.sfxOverclock > 2) { if (GCSettings.sfxOverclock > 2) {
GCSettings.sfxOverclock = 0; GCSettings.sfxOverclock = 0;
@ -3401,14 +3406,15 @@ static int MenuSettingsVideo()
sprintf (options.value[6], "PAL (60Hz)"); break; sprintf (options.value[6], "PAL (60Hz)"); break;
} }
sprintf (options.value[7], "%s", Settings.DisplayFrameRate ? "On" : "Off"); sprintf (options.value[7], "%s", Settings.DisplayFrameRate ? "On" : "Off");
sprintf (options.value[8], "%s", Settings.DisplayTime ? "On" : "Off");
switch(GCSettings.sfxOverclock) switch(GCSettings.sfxOverclock)
{ {
case 0: case 0:
sprintf (options.value[8], "Default"); break; sprintf (options.value[9], "Default"); break;
case 1: case 1:
sprintf (options.value[8], "40 Mhz"); break; sprintf (options.value[9], "40 Mhz"); break;
case 2: case 2:
sprintf (options.value[8], "60 Mhz"); break; sprintf (options.value[9], "60 Mhz"); break;
} }
optionBrowser.TriggerUpdate(); optionBrowser.TriggerUpdate();
} }

View File

@ -517,6 +517,7 @@ DefaultSettings ()
Settings.DisplayFrameRate = false; Settings.DisplayFrameRate = false;
Settings.AutoDisplayMessages = 0; Settings.AutoDisplayMessages = 0;
Settings.InitialInfoStringTimeout = 200; // # frames to display messages for Settings.InitialInfoStringTimeout = 200; // # frames to display messages for
Settings.DisplayTime = false;
// Frame timings in 50hz and 60hz cpu mode // Frame timings in 50hz and 60hz cpu mode
Settings.FrameTimePAL = 20000; Settings.FrameTimePAL = 20000;

View File

@ -26,6 +26,7 @@ void (*S9xCustomDisplayString) (const char *, int, int, bool, int) = NULL;
static void SetupOBJ (void); static void SetupOBJ (void);
static void DrawOBJS (int); static void DrawOBJS (int);
static void DisplayTime (void);
static void DisplayFrameRate (void); static void DisplayFrameRate (void);
static void DisplayPressedKeys (void); static void DisplayPressedKeys (void);
static void DisplayWatchedAddresses (void); static void DisplayWatchedAddresses (void);
@ -1838,6 +1839,20 @@ static void S9xDisplayStringType (const char *string, int linesFromBottom, int p
S9xDisplayString (string, linesFromBottom, pixelsFromLeft, allowWrap); 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) static void DisplayFrameRate (void)
{ {
char string[10]; char string[10];
@ -2031,6 +2046,9 @@ static void DisplayWatchedAddresses (void)
void S9xDisplayMessages (uint16 *screen, int ppl, int width, int height, int scale) void S9xDisplayMessages (uint16 *screen, int ppl, int width, int height, int scale)
{ {
if (Settings.DisplayTime)
DisplayTime();
if (Settings.DisplayFrameRate) if (Settings.DisplayFrameRate)
DisplayFrameRate(); DisplayFrameRate();

View File

@ -243,6 +243,7 @@ struct SSettings
uint8 BG_Forced; uint8 BG_Forced;
bool8 DisableGraphicWindows; bool8 DisableGraphicWindows;
bool8 DisplayTime;
bool8 DisplayFrameRate; bool8 DisplayFrameRate;
bool8 DisplayWatchedAddresses; bool8 DisplayWatchedAddresses;
bool8 DisplayPressedKeys; bool8 DisplayPressedKeys;