From 7bb5b00504fcd5499919771470fac232d40d5247 Mon Sep 17 00:00:00 2001 From: Brandon Wright Date: Sat, 17 Nov 2018 16:12:06 -0600 Subject: [PATCH] GTK+: Patch into S9xCustomDisplayString. Fix issue with overlay on overscanned height. --- gfx.cpp | 7 +++++++ gtk/src/gtk_display.cpp | 36 +++++++++++++++++++++--------------- port.h | 5 ----- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/gfx.cpp b/gfx.cpp index 8d10ee0f..8c924ff2 100644 --- a/gfx.cpp +++ b/gfx.cpp @@ -22,6 +22,7 @@ extern struct SLineMatrixData LineMatrixData[240]; void S9xComputeClipWindows (void); static int font_width = 8, font_height = 9; +void (*S9xCustomDisplayString) (const char *, int, int, bool) = NULL; static void SetupOBJ (void); static void DrawOBJS (int); @@ -1824,6 +1825,12 @@ void S9xDisplayChar (uint16 *s, uint8 c) static void DisplayStringFromBottom (const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap) { + if (S9xCustomDisplayString) + { + S9xCustomDisplayString (string, linesFromBottom, pixelsFromLeft, allowWrap); + return; + } + if (linesFromBottom <= 0) linesFromBottom = 1; diff --git a/gtk/src/gtk_display.cpp b/gtk/src/gtk_display.cpp index 719b5113..aa64a1ae 100644 --- a/gtk/src/gtk_display.cpp +++ b/gtk/src/gtk_display.cpp @@ -1709,20 +1709,6 @@ S9xDisplayGetDriver () return driver; } -void -S9xInitDisplay (int argc, char **argv) -{ - Settings.SupportHiRes = TRUE; - S9xBlit2xSaIFilterInit (); -#ifdef USE_HQ2X - S9xBlitHQ2xFilterInit (); -#endif /* USE_HQ2SX */ - S9xQueryDrivers (); - S9xInitDriver (); - S9xGraphicsInit (); - S9xDisplayReconfigure (); -} - void S9xDisplayClearBuffers () { @@ -1850,7 +1836,7 @@ static void GTKDisplayChar (int x, int y, uint8 c, bool overlap = false) } } -void GTKDisplayStringFromBottom (const char *string, int linesFromBottom, +static void S9xGTKDisplayString (const char *string, int linesFromBottom, int pixelsFromLeft, bool allowWrap) { if (linesFromBottom <= 0) @@ -1867,6 +1853,11 @@ void GTKDisplayStringFromBottom (const char *string, int linesFromBottom, int len = strlen(string); bool overlap = false; + if (IPPU.RenderedScreenHeight % 224 && !gui_config->overscan) + dst_y -= 8; + else if (gui_config->overscan) + dst_y += 8; + for (int i = 0 ; i < len ; i++) { int cindex = string[i] - 32; @@ -1894,3 +1885,18 @@ void GTKDisplayStringFromBottom (const char *string, int linesFromBottom, } } +void +S9xInitDisplay (int argc, char **argv) +{ + Settings.SupportHiRes = TRUE; + S9xBlit2xSaIFilterInit (); +#ifdef USE_HQ2X + S9xBlitHQ2xFilterInit (); +#endif /* USE_HQ2SX */ + S9xQueryDrivers (); + S9xInitDriver (); + S9xGraphicsInit (); + S9xDisplayReconfigure (); + S9xCustomDisplayString = S9xGTKDisplayString; +} + diff --git a/port.h b/port.h index 4e7d4a90..31f368d5 100644 --- a/port.h +++ b/port.h @@ -133,12 +133,7 @@ typedef size_t pint; #ifndef __WIN32__ void _splitpath (const char *, char *, char *, char *, char *); void _makepath (char *, const char *, const char *, const char *, const char *); -#ifdef SNES9X_GTK -void GTKDisplayStringFromBottom(const char *, int, int, bool); -#define S9xDisplayString GTKDisplayStringFromBottom -#else #define S9xDisplayString DisplayStringFromBottom -#endif #else // __WIN32__ #define snprintf _snprintf #define strcasecmp stricmp