mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Provide a parent HWND to assert messageboxes (assert no longer appears below..)
This commit is contained in:
parent
6aef6e2926
commit
c906cee1ed
3 changed files with 12 additions and 1 deletions
|
@ -31,6 +31,7 @@
|
|||
#include <android/log.h>
|
||||
#elif PPSSPP_PLATFORM(WINDOWS)
|
||||
#include "CommonWindows.h"
|
||||
static HWND g_dialogParent;
|
||||
#endif
|
||||
|
||||
#define LOG_BUF_SIZE 2048
|
||||
|
@ -44,6 +45,14 @@ static bool g_exitOnAssert;
|
|||
static AssertNoCallbackFunc g_assertCancelCallback = 0;
|
||||
static void *g_assertCancelCallbackUserData = 0;
|
||||
|
||||
|
||||
|
||||
void SetAssertDialogParent(void *handle) {
|
||||
#if PPSSPP_PLATFORM(WINDOWS)
|
||||
g_dialogParent = (HWND)handle;
|
||||
#endif
|
||||
}
|
||||
|
||||
void SetExtraAssertInfo(const char *info) {
|
||||
std::lock_guard<std::mutex> guard(g_extraAssertInfoMutex);
|
||||
g_extraAssertInfo = info ? info : "menu";
|
||||
|
@ -106,7 +115,7 @@ bool HandleAssert(const char *function, const char *file, int line, const char *
|
|||
OutputDebugStringA(formatted);
|
||||
printf("%s\n", formatted);
|
||||
std::wstring wcaption = ConvertUTF8ToWString(std::string(caption) + " " + (threadName ? threadName : "(unknown thread)"));
|
||||
switch (MessageBox(0, ConvertUTF8ToWString(text).c_str(), wcaption.c_str(), msgBoxStyle)) {
|
||||
switch (MessageBox(g_dialogParent, ConvertUTF8ToWString(text).c_str(), wcaption.c_str(), msgBoxStyle)) {
|
||||
case IDYES:
|
||||
return true;
|
||||
case IDNO:
|
||||
|
|
|
@ -138,6 +138,7 @@ typedef void (*AssertNoCallbackFunc)(const char *message, void *userdata);
|
|||
void SetAssertCancelCallback(AssertNoCallbackFunc callback, void *userdata);
|
||||
void SetCleanExitOnAssert();
|
||||
void BreakIntoPSPDebugger(const char *reason = "(userbreak)");
|
||||
void SetAssertDialogParent(void *handle); // HWND on windows. Ignored on other platforms.
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
// Tricky macro to get the basename, that also works if *built* on Win32.
|
||||
|
|
|
@ -861,6 +861,7 @@ namespace MainWindow
|
|||
if (g_darkModeSupported) {
|
||||
SendMessageW(hWnd, WM_THEMECHANGED, 0, 0);
|
||||
}
|
||||
SetAssertDialogParent(hWnd);
|
||||
break;
|
||||
|
||||
case WM_USER_RUN_CALLBACK:
|
||||
|
|
Loading…
Add table
Reference in a new issue