GTK+: Patch into S9xCustomDisplayString.

Fix issue with overlay on overscanned height.
This commit is contained in:
Brandon Wright 2018-11-17 16:12:06 -06:00
parent 95c6baebd3
commit 7bb5b00504
3 changed files with 28 additions and 20 deletions

View File

@ -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;

View File

@ -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;
}

5
port.h
View File

@ -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