ft2-clone

Fasttracker 2 clone
Log | Files | Refs | README | LICENSE

commit 7d116f5046059d1dfb3811be767b183327b858a8
parent 432258c62513760560900ac82ccbc5ac04f7393c
Author: Olav Sørensen <olav.sorensen@live.no>
Date:   Tue,  9 Apr 2024 19:30:58 +0200

showErrorMsgBox() fix for Windows XP

Diffstat:
Msrc/ft2_video.c | 12++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/ft2_video.c b/src/ft2_video.c @@ -255,16 +255,20 @@ void flipFrame(void) void showErrorMsgBox(const char *fmt, ...) { - char strBuf[256]; + char strBuf[512+1]; va_list args; // format the text string va_start(args, fmt); - vsnprintf(strBuf, sizeof (strBuf), fmt, args); + vsnprintf(strBuf, sizeof (strBuf)-1, fmt, args); va_end(args); - // window can be NULL here, no problem... - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", strBuf, video.window); + // SDL message boxes can be very buggy on Windows XP, use MessageBoxA() instead +#ifdef _WIN32 + MessageBoxA(NULL, strBuf, "Error", MB_OK | MB_ICONERROR); +#else + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", strBuf, NULL); +#endif } static void updateRenderSizeVars(void)