From 3b36b56c4b51c0f68b6c697dd8f52b8db9f4626e Mon Sep 17 00:00:00 2001
From: Inori <superstellar.mocha@gmail.com>
Date: Fri, 9 Aug 2019 08:14:02 -0400
Subject: [PATCH] Use SDL for Win32API.SetWindowText

---
 binding/miniffi-binding.cpp | 1 +
 src/fake-api.cpp            | 7 +++++++
 src/fake-api.h              | 3 +++
 3 files changed, 11 insertions(+)

diff --git a/binding/miniffi-binding.cpp b/binding/miniffi-binding.cpp
index 138629c4..a2d320c4 100644
--- a/binding/miniffi-binding.cpp
+++ b/binding/miniffi-binding.cpp
@@ -48,6 +48,7 @@ MiniFFI_GetFunctionHandle(void *lib, const char *func)
     CAPTURE(GetCursorPos);
     CAPTURE(ScreenToClient);
     CAPTURE(SetWindowPos);
+    CAPTURE(SetWindowTextA);
     CAPTURE(GetWindowRect);
     CAPTURE(RegisterHotKey);
 #endif
diff --git a/src/fake-api.cpp b/src/fake-api.cpp
index 86e73df3..6cdfdf47 100644
--- a/src/fake-api.cpp
+++ b/src/fake-api.cpp
@@ -115,6 +115,13 @@ MKXP_SetWindowPos(HWND hWnd,
     return true;
 }
 
+BOOL __stdcall
+MKXP_SetWindowTextA(HWND hWnd, LPCSTR lpString)
+{
+    SDL_SetWindowTitle(shState->sdlWindow(), (const char*)lpString);
+    return true;
+}
+
 
 // Games that use this to resize the window won't center
 // themselves, but it's better than having the window sent
diff --git a/src/fake-api.h b/src/fake-api.h
index a9c79575..6278785f 100644
--- a/src/fake-api.h
+++ b/src/fake-api.h
@@ -63,6 +63,9 @@ MKXP_SetWindowPos(HWND hWnd,
                   int cy,
                   UINT uFlags);
 
+BOOL __stdcall
+MKXP_SetWindowTextA(HWND hWnd, LPCSTR lpString);
+
 BOOL __stdcall
 MKXP_GetWindowRect(HWND hWnd, LPRECT lpRect);