suppress popups while in exclusive fullscreen mode

This commit is contained in:
RadWolfie 2020-06-10 00:18:06 -05:00
parent c0f2d60a3f
commit 77d469ddb5
4 changed files with 24 additions and 4 deletions

View File

@ -103,6 +103,7 @@ const char* g_EnumModules2String[to_underlying(CXBXR_MODULE::MAX)] = {
};
std::atomic_int g_CurrentLogLevel = to_underlying(LOG_LEVEL::INFO);
std::atomic_bool g_CurrentLogPopupTestcase = true;
static bool g_bFullScreen = false;
const char log_debug[] = "DEBUG: ";
const char log_info[] = "INFO : ";
@ -230,10 +231,21 @@ void log_generate_active_filter_output(const CXBXR_MODULE cxbxr_module)
}
}
std::cout << std::flush;
}
// Use kernel managed environment
void log_init_popup_msg()
{
Settings::s_video vSettings;
g_EmuShared->GetVideoSettings(&vSettings);
g_bFullScreen = vSettings.bFullScreen;
}
int CxbxMessageBox(const char* msg, UINT uType, HWND hWnd)
int CxbxMessageBox(const char* msg, UINT uType, HWND hWnd, int default_return)
{
if (g_bFullScreen) {
return default_return;
}
return MessageBox(hWnd, msg, /*lpCaption=*/TEXT("Cxbx-Reloaded"), uType);
}

View File

@ -130,7 +130,12 @@ extern inline void log_sync_config();
void log_set_config(int LogLevel, unsigned int* LoggedModules, bool LogPopupTestcase);
void log_generate_active_filter_output(const CXBXR_MODULE cxbxr_module);
void log_generate_active_filter_output(const CXBXR_MODULE cxbxr_module);
// Use emulation environment to manage popup messages
// If log_init_popup_msg is not called at earliest point of emulation.
// Then users will have a chance of popup message appear during start of emulation in full screen.
void log_init_popup_msg();
typedef enum class _CxbxMsgDlgIcon {
Info = 0,
@ -139,7 +144,7 @@ typedef enum class _CxbxMsgDlgIcon {
Unknown
} CxbxMsgDlgIcon;
int CxbxMessageBox(const char* msg, UINT uType = MB_OK, HWND hWnd = NULL);
int CxbxMessageBox(const char* msg, UINT uType = MB_OK, HWND hWnd = NULL, int default_return = IDCANCEL);
void CxbxShowError(const char* msg, HWND hWnd = NULL);

View File

@ -686,6 +686,9 @@ void CxbxKrnlEmulate(unsigned int reserved_systems, blocks_reserved_t blocks_res
//g_EmuShared->SetIsReady(true);
}
/* Initialize popup message management from kernel side. */
log_init_popup_msg();
/* Initialize Cxbx File Paths */
CxbxInitFilePaths();

View File

@ -201,7 +201,7 @@ void EmuExceptionNonBreakpointUnhandledShow(LPEXCEPTION_POINTERS e)
" Press \"Cancel\" to debug.",
e->ExceptionRecord->ExceptionCode, EIPToString(e->ContextRecord->Eip).c_str());
if (CxbxMessageBox(buffer, MB_ICONSTOP | MB_OKCANCEL, g_hEmuWindow) == IDOK)
if (CxbxMessageBox(buffer, MB_ICONSTOP | MB_OKCANCEL, g_hEmuWindow, IDOK) == IDOK)
{
EmuExceptionExitProcess();
}