rewording APIs for review remarks

This commit is contained in:
RadWolfie 2020-06-20 03:40:54 -05:00
parent 7f4da40f21
commit 4043ac1b01
18 changed files with 149 additions and 150 deletions

View File

@ -248,7 +248,7 @@ void log_init_popup_msg()
g_disablePopupMessages = vSettings.bFullScreen;
}
MsgDlgRet CxbxMessageBox(const char* msg, const MsgDlgRet ret_default, const UINT uType, const HWND hWnd)
PopupReturn CxbxMessageBox(const char* msg, const PopupReturn ret_default, const UINT uType, const HWND hWnd)
{
// If user is using exclusive fullscreen, we need to refrain all popups.
if (g_disablePopupMessages) {
@ -259,23 +259,23 @@ MsgDlgRet CxbxMessageBox(const char* msg, const MsgDlgRet ret_default, const UIN
switch (ret) {
default:
case IDCANCEL:
return MsgDlgRet::RET_CANCEL;
return PopupReturn::Cancel;
case IDOK:
return MsgDlgRet::RET_OK;
return PopupReturn::Ok;
case IDABORT:
return MsgDlgRet::RET_ABORT;
return PopupReturn::Abort;
case IDRETRY:
return MsgDlgRet::RET_RETRY;
return PopupReturn::Retry;
case IDIGNORE:
return MsgDlgRet::RET_IGNORE;
return PopupReturn::Ignore;
case IDYES:
return MsgDlgRet::RET_YES;
return PopupReturn::Yes;
case IDNO:
return MsgDlgRet::RET_NO;
return PopupReturn::No;
}
}
MsgDlgRet CxbxPopupMessageEx(const void* hwnd, const CXBXR_MODULE cxbxr_module, const LOG_LEVEL level, const MsgDlgIcon icon, const MsgDlgButtons buttons, const MsgDlgRet ret_default, const char *message, ...)
PopupReturn PopupCustomEx(const void* hwnd, const CXBXR_MODULE cxbxr_module, const LOG_LEVEL level, const PopupIcon icon, const PopupButtons buttons, const PopupReturn ret_default, const char *message, ...)
{
char Buffer[1024];
va_list argp;
@ -289,20 +289,20 @@ MsgDlgRet CxbxPopupMessageEx(const void* hwnd, const CXBXR_MODULE cxbxr_module,
}
switch (icon) {
case MsgDlgIcon::Warn: {
case PopupIcon::Warning: {
uType |= MB_ICONWARNING;
break;
}
case MsgDlgIcon::Error: {
case PopupIcon::Error: {
uType |= MB_ICONERROR; // Note : MB_ICONERROR == MB_ICONSTOP == MB_ICONHAND
break;
}
case MsgDlgIcon::Info: {
case PopupIcon::Info: {
uType |= MB_ICONINFORMATION;
break;
}
case MsgDlgIcon::Question:
case MsgDlgIcon::Unknown:
case PopupIcon::Question:
case PopupIcon::Unknown:
default: {
uType |= MB_ICONQUESTION;
break;
@ -311,22 +311,22 @@ MsgDlgRet CxbxPopupMessageEx(const void* hwnd, const CXBXR_MODULE cxbxr_module,
switch (buttons) {
default:
case MsgDlgButtons::OK:
case PopupButtons::Ok:
uType |= MB_OK;
break;
case MsgDlgButtons::OK_CANCEL:
case PopupButtons::OkCancel:
uType |= MB_OKCANCEL;
break;
case MsgDlgButtons::ABORT_RETRY_IGNORE:
case PopupButtons::AbortRetryIgnore:
uType |= MB_RETRYCANCEL;
break;
case MsgDlgButtons::YES_NO_CANCEL:
case PopupButtons::YesNoCancel:
uType |= MB_YESNOCANCEL;
break;
case MsgDlgButtons::YES_NO:
case PopupButtons::YesNo:
uType |= MB_YESNO;
break;
case MsgDlgButtons::RETRY_CANCEL:
case PopupButtons::RetryCancel:
uType |= MB_RETRYCANCEL;
break;
}

View File

@ -137,49 +137,48 @@ void log_generate_active_filter_output(const CXBXR_MODULE cxbxr_module);
// 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 _MsgDlgIcon {
typedef enum class _PopupIcon {
Unknown = 0,
Question,
Info,
Warn,
Warning,
Error
} MsgDlgIcon;
} PopupIcon;
typedef enum class _MsgDlgButtons {
typedef enum class _PopupButtons {
Unknown = 0,
OK,
OK_CANCEL,
ABORT_RETRY_IGNORE,
YES_NO_CANCEL,
YES_NO,
RETRY_CANCEL
} MsgDlgButtons;
Ok,
OkCancel,
AbortRetryIgnore,
YesNoCancel,
YesNo,
RetryCancel
} PopupButtons;
typedef enum class _MsgDlgRet {
RET_Unknown = 0,
RET_OK,
RET_CANCEL,
RET_ABORT,
RET_RETRY,
RET_IGNORE,
RET_YES,
RET_NO
} MsgDlgRet;
typedef enum class _PopupReturn {
Unknown = 0,
Ok,
Cancel,
Abort,
Retry,
Ignore,
Yes,
No
} PopupReturn;
MsgDlgRet CxbxPopupMessageEx(const void* hwnd, const CXBXR_MODULE cxbxr_module, const LOG_LEVEL level, const MsgDlgIcon icon, const MsgDlgButtons buttons, const MsgDlgRet ret_default, const char* message, ...);
PopupReturn PopupCustomEx(const void* hwnd, const CXBXR_MODULE cxbxr_module, const LOG_LEVEL level, const PopupIcon icon, const PopupButtons buttons, const PopupReturn ret_default, const char* message, ...);
#define CxbxPopupMessage(hwnd, level, icon, buttons, ret_default, fmt, ...) CxbxPopupMessageEx(hwnd, LOG_PREFIX, level, icon, buttons, ret_default, fmt, ## __VA_ARGS__)
#define CxbxPopupMsgUnknown(hwnd, level, buttons, ret_default, fmt, ...) CxbxPopupMessage(hwnd, level, MsgDlgIcon::Unknown, buttons, ret_default, fmt, ## __VA_ARGS__)
#define CxbxPopupMsgQuestion(hwnd, level, buttons, ret_default, fmt, ...) CxbxPopupMessage(hwnd, level, MsgDlgIcon::Question, buttons, ret_default, fmt, ## __VA_ARGS__)
#define CxbxPopupMsgQuestionSimple(hwnd, fmt, ...) CxbxPopupMessage(hwnd, LOG_LEVEL::INFO, MsgDlgIcon::Question, MsgDlgButtons::YES_NO_CANCEL, MsgDlgRet::RET_CANCEL, fmt, ## __VA_ARGS__)
#define CxbxPopupMsgInfo(hwnd, buttons, ret_default, fmt, ...) CxbxPopupMessage(hwnd, LOG_LEVEL::INFO, MsgDlgIcon::Info, buttons, ret_default, fmt, ## __VA_ARGS__)
#define CxbxPopupMsgInfoSimple(hwnd, fmt, ...) CxbxPopupMsgInfo(hwnd, MsgDlgButtons::OK, MsgDlgRet::RET_OK, fmt, ## __VA_ARGS__)
#define CxbxPopupMsgWarn(hwnd, buttons, ret_default, fmt, ...) CxbxPopupMessage(hwnd, LOG_LEVEL::WARNING, MsgDlgIcon::Warn, buttons, ret_default, fmt, ## __VA_ARGS__)
#define CxbxPopupMsgWarnSimple(hwnd, fmt, ...) CxbxPopupMsgWarn(hwnd, MsgDlgButtons::OK, MsgDlgRet::RET_OK, fmt, ## __VA_ARGS__)
#define CxbxPopupMsgError(hwnd, buttons, ret_default, fmt, ...) CxbxPopupMessage(hwnd, LOG_LEVEL::ERROR2, MsgDlgIcon::Error, buttons, ret_default, fmt, ## __VA_ARGS__)
#define CxbxPopupMsgErrorSimple(hwnd, fmt, ...) CxbxPopupMsgError(hwnd, MsgDlgButtons::OK, MsgDlgRet::RET_OK, fmt, ## __VA_ARGS__)
#define CxbxPopupMsgFatal(hwnd, buttons, ret_default, fmt, ...) CxbxPopupMessage(hwnd, LOG_LEVEL::FATAL, MsgDlgIcon::Error, buttons, ret_default, fmt, ## __VA_ARGS__)
#define CxbxPopupMsgFatalSimple(hwnd, fmt, ...) CxbxPopupMsgFatal(hwnd, MsgDlgButtons::OK, MsgDlgRet::RET_OK, fmt, ## __VA_ARGS__)
#define PopupCustom(hwnd, level, icon, buttons, ret_default, fmt, ...) PopupCustomEx(hwnd, LOG_PREFIX, level, icon, buttons, ret_default, fmt, ## __VA_ARGS__)
#define PopupQuestionEx(hwnd, level, buttons, ret_default, fmt, ...) PopupCustom(hwnd, level, PopupIcon::Question, buttons, ret_default, fmt, ## __VA_ARGS__)
#define PopupQuestion(hwnd, fmt, ...) PopupQuestionEx(hwnd, LOG_LEVEL::INFO, PopupButtons::YesNoCancel, PopupReturn::Cancel, fmt, ## __VA_ARGS__)
#define PopupInfoEx(hwnd, buttons, ret_default, fmt, ...) PopupCustom(hwnd, LOG_LEVEL::INFO, PopupIcon::Info, buttons, ret_default, fmt, ## __VA_ARGS__)
#define PopupInfo(hwnd, fmt, ...) (void)PopupInfoEx(hwnd, PopupButtons::Ok, PopupReturn::Ok, fmt, ## __VA_ARGS__)
#define PopupWarningEx(hwnd, buttons, ret_default, fmt, ...) PopupCustom(hwnd, LOG_LEVEL::WARNING, PopupIcon::Warning, buttons, ret_default, fmt, ## __VA_ARGS__)
#define PopupWarning(hwnd, fmt, ...) (void)PopupWarningEx(hwnd, PopupButtons::Ok, PopupReturn::Ok, fmt, ## __VA_ARGS__)
#define PopupErrorEx(hwnd, buttons, ret_default, fmt, ...) PopupCustom(hwnd, LOG_LEVEL::ERROR2, PopupIcon::Error, buttons, ret_default, fmt, ## __VA_ARGS__)
#define PopupError(hwnd, fmt, ...) (void)PopupErrorEx(hwnd, PopupButtons::Ok, PopupReturn::Ok, fmt, ## __VA_ARGS__)
#define PopupFatalEx(hwnd, buttons, ret_default, fmt, ...) PopupCustom(hwnd, LOG_LEVEL::FATAL, PopupIcon::Error, buttons, ret_default, fmt, ## __VA_ARGS__)
#define PopupFatal(hwnd, fmt, ...) (void)PopupFatalEx(hwnd, PopupButtons::Ok, PopupReturn::Ok, fmt, ## __VA_ARGS__)
// For LOG_TEST_CASE
extern inline void EmuLogOutputEx(const CXBXR_MODULE cxbxr_module, const LOG_LEVEL level, const char *szWarningMessage, ...);
@ -191,7 +190,7 @@ extern inline void EmuLogOutputEx(const CXBXR_MODULE cxbxr_module, const LOG_LEV
bool logOnly = true; \
if (g_CurrentLogPopupTestCase) { \
LOG_CHECK_ENABLED(LOG_LEVEL::INFO) { \
(void)CxbxPopupMsgInfoSimple(nullptr, "Please report that %s shows the following message:\nLOG_TEST_CASE: %s\nIn %s (%s line %d)", \
PopupInfo(nullptr, "Please report that %s shows the following message:\nLOG_TEST_CASE: %s\nIn %s (%s line %d)", \
CxbxKrnl_Xbe->m_szAsciiTitle, message, __func__, __FILE__, __LINE__); \
logOnly = false; \
} \

View File

@ -223,7 +223,7 @@ bool Settings::Init()
bRet = LoadConfig();
if (!bRet) {
(void)CxbxPopupMsgErrorSimple(nullptr, szSettings_setup_error);
PopupError(nullptr, szSettings_setup_error);
return false;
}
@ -836,13 +836,13 @@ CXBX_DATA Settings::SetupFile(std::string& file_path_out)
setupFile = GenerateExecDirectoryStr();
#else // Only support for Qt compile build.
MsgDlgRet eRet = CxbxPopupMsgQuestionSimple(nullptr, szSettings_save_user_option_message);
PopupReturn eRet = PopupQuestion(nullptr, szSettings_save_user_option_message);
if (eRet == MsgDlgRet::RET_YES) {
if (eRet == PopupReturn::Yes) {
setupFile = GenerateExecDirectoryStr();
data_ret = CXBX_DATA_EXECDIR;
}
else if (eRet == MsgDlgRet::RET_NO) {
else if (eRet == PopupReturn::No) {
setupFile = GenerateUserProfileDirectoryStr();
data_ret = CXBX_DATA_APPDATA;
if (setupFile.size() != 0) {
@ -859,7 +859,7 @@ CXBX_DATA Settings::SetupFile(std::string& file_path_out)
#endif
if (data_ret == CXBX_DATA_INVALID) {
(void)CxbxPopupMsgErrorSimple(nullptr, szSettings_setup_error);
PopupError(nullptr, szSettings_setup_error);
}
else {
setupFile.append(szSettings_settings_file);

View File

@ -111,10 +111,10 @@ InputWindow::~InputWindow()
bool InputWindow::IsProfileSaved()
{
if (m_bHasChanges) {
MsgDlgRet ret = CxbxPopupMsgQuestionSimple(m_hwnd_window, "Current configuration is not saved. Save before closing?");
PopupReturn ret = PopupQuestion(m_hwnd_window, "Current configuration is not saved. Save before closing?");
switch (ret)
{
case MsgDlgRet::RET_YES: {
case PopupReturn::Yes: {
char name[50];
SendMessage(m_hwnd_profile_list, WM_GETTEXT, sizeof(name), reinterpret_cast<LPARAM>(name));
if (SaveProfile(std::string(name))) {
@ -123,11 +123,11 @@ bool InputWindow::IsProfileSaved()
return false;
}
case MsgDlgRet::RET_NO: {
case PopupReturn::No: {
return true;
}
case MsgDlgRet::RET_CANCEL:
case PopupReturn::Cancel:
default: {
return false;
}
@ -345,11 +345,11 @@ void InputWindow::LoadProfile(const std::string& name)
bool InputWindow::SaveProfile(const std::string& name)
{
if (name == std::string()) {
(void)CxbxPopupMsgErrorSimple(m_hwnd_window, "Cannot save. Profile name must not be empty.");
PopupError(m_hwnd_window, "Cannot save. Profile name must not be empty.");
return false;
}
if (m_host_dev == std::string()) {
(void)CxbxPopupMsgErrorSimple(m_hwnd_window, "Cannot save. No input devices detected", "Cxbx-Reloaded");
PopupError(m_hwnd_window, "Cannot save. No input devices detected", "Cxbx-Reloaded");
return false;
}
OverwriteProfile(name);

View File

@ -600,7 +600,7 @@ VOID CxbxInitWindow(bool bFullInit)
if (hRenderWindowThread == NULL) {
char szBuffer[1024] = { 0 };
sprintf(szBuffer, "Creating EmuRenderWindowThread Failed: %08X", GetLastError());
(void)CxbxPopupMsgFatalSimple(nullptr, szBuffer);
PopupFatal(nullptr, szBuffer);
EmuShared::Cleanup();
ExitProcess(0);
}

View File

@ -147,7 +147,7 @@ bool VerifySymbolAddressAgainstXRef(char *SymbolName, xbaddr Address, int XRef)
return true;
}
CxbxPopupMessage(LOG_LEVEL::WARNING, CxbxMsgDlgIcon_Warn,
PopupCustom(LOG_LEVEL::WARNING, CxbxMsgDlgIcon_Warn,
"Verification of %s failed : XREF was 0x%.8X while lookup gave 0x%.8X", SymbolName, XRefAddr, Address);
// test case : Kabuki Warriors (for XREF_D3DTSS_TEXCOORDINDEX)
return false;

View File

@ -1188,7 +1188,7 @@ DWORD WINAPI XTL::EMUPATCH(XLaunchNewImageA)
if (PathFileExists(szDashboardPath))
{
(void)CxbxPopupMsgInfoSimple(nullptr, "The title is rebooting to dashboard");
PopupInfo(nullptr, "The title is rebooting to dashboard");
lpTitlePath = "C:\\xboxdash.xbe";
xboxkrnl::LaunchDataPage->Header.dwLaunchDataType = LDT_FROM_DASHBOARD;
// Other options include LDT_NONE, LDT_FROM_DEBUGGER_CMDLINE and LDT_FROM_UPDATE

View File

@ -613,7 +613,7 @@ XBSYSAPI EXPORTNUM(49) xboxkrnl::VOID DECLSPEC_NORETURN NTAPI xboxkrnl::HalRetur
retryAttempt++;
// Terminate after 5 seconds of failure.
if (retryAttempt >= (5 * (1000 / 100))) {
(void)CxbxPopupMsgErrorSimple(nullptr, "Could not reboot, new emulation process did not take over.");
PopupError(nullptr, "Could not reboot, new emulation process did not take over.");
break;
}
}

View File

@ -243,7 +243,7 @@ XBSYSAPI EXPORTNUM(264) xboxkrnl::VOID NTAPI xboxkrnl::RtlAssert
ss << ")";
(void)CxbxPopupMsgWarnSimple(nullptr, ss.str().c_str());
PopupWarning(nullptr, ss.str().c_str());
}
// ******************************************************************

View File

@ -622,7 +622,7 @@ bool CreateSettings()
{
g_Settings = new Settings();
if (g_Settings == nullptr) {
(void)CxbxPopupMsgErrorSimple(nullptr, szSettings_alloc_error);
PopupError(nullptr, szSettings_alloc_error);
return false;
}
@ -647,11 +647,11 @@ bool HandleFirstLaunch()
bool bElevated = CxbxIsElevated();
if (bElevated && !g_Settings->m_core.allowAdminPrivilege) {
MsgDlgRet ret = CxbxPopupMsgWarn(nullptr, MsgDlgButtons::YES_NO, MsgDlgRet::RET_NO,
PopupReturn ret = PopupWarningEx(nullptr, PopupButtons::YesNo, PopupReturn::No,
"Cxbx-Reloaded has detected that it has been launched with Administrator rights.\n"
"\nThis is dangerous, as a maliciously modified Xbox titles could take control of your system.\n"
"\nAre you sure you want to continue?");
if (ret != MsgDlgRet::RET_YES) {
if (ret != PopupReturn::Yes) {
return false;
}
}
@ -750,9 +750,9 @@ void CxbxKrnlEmulate(unsigned int reserved_systems, blocks_reserved_t blocks_res
}
if (!isReady) {
EmuLog(LOG_LEVEL::WARNING, "GUI process is not ready!");
MsgDlgRet mbRet = CxbxPopupMsgWarn(nullptr, MsgDlgButtons::RETRY_CANCEL, MsgDlgRet::RET_CANCEL,
PopupReturn mbRet = PopupWarningEx(nullptr, PopupButtons::RetryCancel, PopupReturn::Cancel,
"GUI process is not ready, do you wish to retry?");
if (mbRet == MsgDlgRet::RET_RETRY) {
if (mbRet == PopupReturn::Retry) {
continue;
}
CxbxKrnlShutDown();
@ -881,7 +881,7 @@ void CxbxKrnlEmulate(unsigned int reserved_systems, blocks_reserved_t blocks_res
// verify base of code of our executable is 0x00001000
if (ExeNtHeader->OptionalHeader.BaseOfCode != CXBX_BASE_OF_CODE)
{
(void)CxbxPopupMsgFatalSimple(nullptr, "Cxbx-Reloaded executuable requires it's base of code to be 0x00001000");
PopupFatal(nullptr, "Cxbx-Reloaded executuable requires it's base of code to be 0x00001000");
return; // TODO : Halt(0);
}
@ -889,7 +889,7 @@ void CxbxKrnlEmulate(unsigned int reserved_systems, blocks_reserved_t blocks_res
// verify virtual_memory_placeholder is located at 0x00011000
if ((UINT_PTR)(&(virtual_memory_placeholder[0])) != (XBE_IMAGE_BASE + CXBX_BASE_OF_CODE))
{
(void)CxbxPopupMsgFatalSimple(nullptr, "virtual_memory_placeholder is not loaded to base address 0x00011000 (which is a requirement for Xbox emulation)");
PopupFatal(nullptr, "virtual_memory_placeholder is not loaded to base address 0x00011000 (which is a requirement for Xbox emulation)");
return; // TODO : Halt(0);
}
#endif
@ -948,7 +948,7 @@ void CxbxKrnlEmulate(unsigned int reserved_systems, blocks_reserved_t blocks_res
EEPROM = CxbxRestoreEEPROM(szFilePath_EEPROM_bin);
if (EEPROM == nullptr)
{
(void)CxbxPopupMsgFatalSimple(nullptr, "Couldn't init EEPROM!");
PopupFatal(nullptr, "Couldn't init EEPROM!");
return; // TODO : Halt(0);
}
@ -1263,7 +1263,7 @@ __declspec(noreturn) void CxbxKrnlInit
// Initialize time-related variables for the kernel and the timers
CxbxInitPerformanceCounters();
#ifdef _DEBUG
// CxbxPopupMessage(LOG_LEVEL::INFO, "Attach a Debugger");
// PopupCustom(LOG_LEVEL::INFO, "Attach a Debugger");
// Debug child processes using https://marketplace.visualstudio.com/items?itemName=GreggMiskelly.MicrosoftChildProcessDebuggingPowerTool
#endif
@ -1607,7 +1607,7 @@ bool CxbxLockFilePath()
}
if (GetLastError() == ERROR_ALREADY_EXISTS) {
(void)CxbxPopupMsgErrorSimple(nullptr, "Data path directory is currently in used.\nUse different data path directory or stop emulation from another process.");
PopupError(nullptr, "Data path directory is currently in used.\nUse different data path directory or stop emulation from another process.");
CloseHandle(hMapDataHash);
return false;
}
@ -1651,7 +1651,7 @@ __declspec(noreturn) void CxbxKrnlCleanupEx(CXBXR_MODULE cxbxr_module, const cha
vsprintf(szBuffer2, szErrorMessage, argp);
va_end(argp);
(void)CxbxPopupMessageEx(nullptr, cxbxr_module, LOG_LEVEL::FATAL, MsgDlgIcon::Error, MsgDlgButtons::OK, MsgDlgRet::RET_OK, "Received Fatal Message:\n\n* %s\n", szBuffer2); // Will also EmuLogEx
(void)PopupCustomEx(nullptr, cxbxr_module, LOG_LEVEL::FATAL, PopupIcon::Error, PopupButtons::Ok, PopupReturn::Ok, "Received Fatal Message:\n\n* %s\n", szBuffer2); // Will also EmuLogEx
}
EmuLogInit(LOG_LEVEL::INFO, "MAIN: Terminating Process");
@ -1855,11 +1855,11 @@ void CxbxPrintUEMInfo(ULONG ErrorCode)
if (it != UEMErrorTable.end())
{
std::string ErrorMessage = "Fatal error. " + it->second + ". This error screen will persist indefinitely. Stop the emulation to close it.";
(void)CxbxPopupMsgFatalSimple(nullptr, ErrorMessage.c_str());
PopupFatal(nullptr, ErrorMessage.c_str());
}
else
{
(void)CxbxPopupMsgFatalSimple(nullptr, "Unknown fatal error. This error screen will persist indefinitely. Stop the emulation to close it.");
PopupFatal(nullptr, "Unknown fatal error. This error screen will persist indefinitely. Stop the emulation to close it.");
}
}

View File

@ -203,7 +203,7 @@ void EmuExceptionNonBreakpointUnhandledShow(LPEXCEPTION_POINTERS e)
" Press \"Cancel\" to debug.",
e->ExceptionRecord->ExceptionCode, EIPToString(e->ContextRecord->Eip).c_str());
if (CxbxPopupMsgFatal(nullptr, MsgDlgButtons::OK_CANCEL, MsgDlgRet::RET_OK, buffer) == MsgDlgRet::RET_OK)
if (PopupFatalEx(nullptr, PopupButtons::OkCancel, PopupReturn::Ok, buffer) == PopupReturn::Ok)
{
EmuExceptionExitProcess();
}
@ -368,13 +368,13 @@ int ExitException(LPEXCEPTION_POINTERS e)
fflush(stdout);
(void)CxbxPopupMsgFatalSimple(nullptr, "Warning: Could not safely terminate process!");
PopupFatal(nullptr, "Warning: Could not safely terminate process!");
count++;
if(count > 1)
{
(void)CxbxPopupMsgFatalSimple(nullptr, "Warning: Multiple Problems!");
PopupFatal(nullptr, "Warning: Multiple Problems!");
return EXCEPTION_CONTINUE_SEARCH;
}

View File

@ -130,25 +130,25 @@ DWORD WINAPI Emulate(unsigned int reserved_systems, blocks_reserved_t blocks_res
/*! Verify our host executable, cxbxr-ldr.exe, is loaded to base address 0x00010000 */
if (!VerifyBaseAddr()) {
(void)CxbxPopupMsgErrorSimple(nullptr, "cxbx-ldr.exe was not loaded to base address 0x00010000 (which is a requirement for Xbox emulation)");
PopupError(nullptr, "cxbx-ldr.exe was not loaded to base address 0x00010000 (which is a requirement for Xbox emulation)");
return EXIT_FAILURE;
}
LPSTR CommandLine = GetCommandLine();
if (!CommandLine) {
(void)CxbxPopupMsgErrorSimple(nullptr, "Couldn't retrieve command line!");
PopupError(nullptr, "Couldn't retrieve command line!");
return EXIT_FAILURE;
}
int argc = 0;
PCHAR *argv = CommandLineToArgvA(CommandLine, &argc);
if (!argv) {
(void)CxbxPopupMsgErrorSimple(nullptr, "Couldn't parse command line!");
PopupError(nullptr, "Couldn't parse command line!");
return EXIT_FAILURE;
}
if (!cli_config::GenConfig(argv, argc)) {
(void)CxbxPopupMsgErrorSimple(nullptr, "Couldn't convert parsed command line!");
PopupError(nullptr, "Couldn't convert parsed command line!");
LocalFree(argv);
return EXIT_FAILURE;
}
@ -156,24 +156,24 @@ DWORD WINAPI Emulate(unsigned int reserved_systems, blocks_reserved_t blocks_res
/*! verify load argument is included */
if (!cli_config::hasKey("load")) {
(void)CxbxPopupMsgErrorSimple(nullptr, "No /load argument in command line!");
PopupError(nullptr, "No /load argument in command line!");
return EXIT_FAILURE;
}
/*! initialize shared memory */
if (!EmuShared::Init(cli_config::GetSessionID())) {
(void)CxbxPopupMsgErrorSimple(nullptr, "Could not map shared memory!");
PopupError(nullptr, "Could not map shared memory!");
return EXIT_FAILURE;
}
if (!HandleFirstLaunch()) {
(void)CxbxPopupMsgErrorSimple(nullptr, "First launch failed!");
PopupError(nullptr, "First launch failed!");
EmuShared::Cleanup();
return EXIT_FAILURE;
}
if (!reserved_systems) {
(void)CxbxPopupMsgErrorSimple(nullptr, "Unable to preserve any system's memory ranges!");
PopupError(nullptr, "Unable to preserve any system's memory ranges!");
EmuShared::Cleanup();
return EXIT_FAILURE;
}

View File

@ -126,14 +126,14 @@ INT_PTR CALLBACK DlgAudioConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPAR
/*! if changes have been made, check if the user wants to save them */
if(g_bHasChanges)
{
MsgDlgRet ret = CxbxPopupMsgQuestionSimple(hWndDlg, "Do you wish to apply your changes?");
PopupReturn ret = PopupQuestion(hWndDlg, "Do you wish to apply your changes?");
switch(ret)
{
case MsgDlgRet::RET_YES:
case PopupReturn::Yes:
PostMessage(hWndDlg, WM_COMMAND, IDC_AC_ACCEPT, 0);
break;
case MsgDlgRet::RET_NO:
case PopupReturn::No:
PostMessage(hWndDlg, WM_COMMAND, IDC_AC_CANCEL, 0);
break;
}
@ -229,7 +229,7 @@ VOID RefreshAudioAdapter()
if (pGUID == (LPGUID)CB_ERR) {
SendMessage(g_hAudioAdapter, CB_SETCURSEL, 0, 0);
g_Settings->m_audio = g_XBAudio;
(void)CxbxPopupMsgWarnSimple(nullptr, "Your selected audio adapter is invalid,\nreverting to default audio adapter.");
PopupWarning(nullptr, "Your selected audio adapter is invalid,\nreverting to default audio adapter.");
}
}
}

View File

@ -111,7 +111,7 @@ INT_PTR CALLBACK DlgXidControllerConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wPar
case IDC_XID_CLEAR: {
if (HIWORD(wParam) == BN_CLICKED) {
if (CxbxPopupMsgQuestion(hWndDlg, LOG_LEVEL::WARNING, MsgDlgButtons::YES_NO, MsgDlgRet::RET_NO, "Are you sure you want to remove all button bindings?") == MsgDlgRet::RET_YES) {
if (PopupQuestionEx(hWndDlg, LOG_LEVEL::WARNING, PopupButtons::YesNo, PopupReturn::No, "Are you sure you want to remove all button bindings?") == PopupReturn::Yes) {
g_InputWindow->ClearBindings();
}
}

View File

@ -211,7 +211,7 @@ void ShowEepromConfig(HWND hwnd)
EepromFile.close();
}
else {
(void)CxbxPopupMsgWarnSimple(hwnd, "Couldn't open eeprom file!");
PopupWarning(hwnd, "Couldn't open eeprom file!");
return;
}
}
@ -459,7 +459,7 @@ INT_PTR CALLBACK DlgEepromConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPA
EepromFile.close();
}
else {
(void)CxbxPopupMsgWarnSimple(hWndDlg, "Couldn't write eeprom file to disk!");
PopupWarning(hWndDlg, "Couldn't write eeprom file to disk!");
}
}
PostMessage(hWndDlg, WM_COMMAND, IDC_EE_CANCEL, 0);

View File

@ -161,14 +161,14 @@ INT_PTR CALLBACK DlgVideoConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPAR
/*! if changes have been made, check if the user wants to save them */
if(g_bHasChanges)
{
MsgDlgRet ret = CxbxPopupMsgQuestionSimple(hWndDlg, "Do you wish to apply your changes?");
PopupReturn ret = PopupQuestion(hWndDlg, "Do you wish to apply your changes?");
switch(ret)
{
case MsgDlgRet::RET_YES:
case PopupReturn::Yes:
PostMessage(hWndDlg, WM_COMMAND, IDC_VC_ACCEPT, 0);
break;
case MsgDlgRet::RET_NO:
case PopupReturn::No:
PostMessage(hWndDlg, WM_COMMAND, IDC_VC_CANCEL, 0);
break;
}

View File

@ -54,26 +54,26 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// First detect if we are running on WoW64, if not, prevent Cxbx-Reloaded from starting
// Cxbx-Reloaded needs access to high memory, only exposed to WoW64.
if (!VerifyWow64()) {
(void)CxbxPopupMsgErrorSimple(nullptr, "Cxbx-Reloaded can only run under WoW64\nThis means either a 64-bit version of Windows or Wine with a 64-bit prefix");
PopupError(nullptr, "Cxbx-Reloaded can only run under WoW64\nThis means either a 64-bit version of Windows or Wine with a 64-bit prefix");
return EXIT_FAILURE;
}
#ifndef CXBXR_EMU
/*! verify Cxbx.exe is loaded to base address 0x00010000 */
if (!VerifyBaseAddr()) {
(void)CxbxPopupMsgErrorSimple(nullptr, "Cxbx.exe is not loaded to base address 0x00010000 (which is a requirement for Xbox emulation)");
PopupError(nullptr, "Cxbx.exe is not loaded to base address 0x00010000 (which is a requirement for Xbox emulation)");
return EXIT_FAILURE;
}
#endif
if (!cli_config::GenConfig(__argv, __argc)) {
(void)CxbxPopupMsgErrorSimple(nullptr, "Couldn't convert parsed command line!");
PopupError(nullptr, "Couldn't convert parsed command line!");
return EXIT_FAILURE;
}
/*! initialize shared memory */
if (!EmuShared::Init(cli_config::GetSessionID())) {
(void)CxbxPopupMsgErrorSimple(nullptr, "Could not map shared memory!");
PopupError(nullptr, "Could not map shared memory!");
return EXIT_FAILURE;
}
@ -88,7 +88,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
EmuShared::Cleanup();
return EXIT_SUCCESS;
#else
(void)CxbxPopupMsgErrorSimple(nullptr, "Emulation must be launched from cxbxr-ldr.exe!");
PopupError(nullptr, "Emulation must be launched from cxbxr-ldr.exe!");
EmuShared::Cleanup();
return EXIT_FAILURE;
#endif
@ -139,7 +139,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
/*! if an error occurred, notify user */
if(MainWindow->HasError()) {
(void)CxbxPopupMsgErrorSimple(nullptr, MainWindow->GetError().c_str());
PopupError(nullptr, MainWindow->GetError().c_str());
}
delete MainWindow;

View File

@ -647,8 +647,8 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
// ask permission to overwrite if file already exists
if (_access(ofn.lpstrFile, 0) != -1)
{
if (CxbxPopupMsgQuestion(m_hwnd, LOG_LEVEL::WARNING, MsgDlgButtons::YES_NO, MsgDlgRet::RET_NO,
"Overwrite existing file?") != MsgDlgRet::RET_YES)
if (PopupQuestionEx(m_hwnd, LOG_LEVEL::WARNING, PopupButtons::YesNo, PopupReturn::No,
"Overwrite existing file?") != PopupReturn::Yes)
return TRUE;
}
@ -719,14 +719,14 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
}
if (m_Xbe->HasError())
(void)CxbxPopupMsgErrorSimple(m_hwnd, m_Xbe->GetError().c_str());
PopupError(m_hwnd, m_Xbe->GetError().c_str());
else
{
char buffer[255];
sprintf(buffer, "%s's logo bitmap was successfully exported.", m_Xbe->m_szAsciiTitle);
(void)CxbxPopupMsgInfoSimple(m_hwnd, buffer);
PopupInfo(m_hwnd, buffer);
}
}
}
@ -803,7 +803,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
if (bmp_err != 0)
{
(void)CxbxPopupMsgErrorSimple(m_hwnd, bmp_err);
PopupError(m_hwnd, bmp_err);
break;
}
}
@ -812,7 +812,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
if (m_Xbe->HasError())
{
(void)CxbxPopupMsgErrorSimple(m_hwnd, m_Xbe->GetError().c_str());
PopupError(m_hwnd, m_Xbe->GetError().c_str());
if (m_Xbe->HasFatalError())
{
@ -834,7 +834,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
sprintf(buffer, "%s's logo bitmap was successfully updated.", m_Xbe->m_szAsciiTitle);
(void)CxbxPopupMsgInfoSimple(m_hwnd, buffer);
PopupInfo(m_hwnd, buffer);
}
}
}
@ -914,7 +914,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
// ask permission to overwrite if file exists
if (_access(ofn.lpstrFile, 0) != -1)
{
if (CxbxPopupMsgQuestionSimple(m_hwnd, "Overwrite existing file?") != MsgDlgRet::RET_YES)
if (PopupQuestion(m_hwnd, "Overwrite existing file?") != PopupReturn::Yes)
return TRUE;
}
@ -922,7 +922,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
{
std::string Xbe_info = DumpInformation(m_Xbe);
if (m_Xbe->HasError()) {
(void)CxbxPopupMsgErrorSimple(m_hwnd, m_Xbe->GetError().c_str());
PopupError(m_hwnd, m_Xbe->GetError().c_str());
}
else {
std::ofstream Xbe_dump_file(ofn.lpstrFile);
@ -931,10 +931,10 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
Xbe_dump_file.close();
char buffer[255];
sprintf(buffer, "%s's .xbe info was successfully dumped.", m_Xbe->m_szAsciiTitle);
(void)CxbxPopupMsgInfoSimple(m_hwnd, buffer);
PopupInfo(m_hwnd, buffer);
}
else {
(void)CxbxPopupMsgErrorSimple(m_hwnd, "Could not open Xbe text file.");
PopupError(m_hwnd, "Could not open Xbe text file.");
}
}
}
@ -946,7 +946,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
{
std::string Xbe_info = DumpInformation(m_Xbe);
if (m_Xbe->HasError()) {
(void)CxbxPopupMsgErrorSimple(m_hwnd, m_Xbe->GetError().c_str());
PopupError(m_hwnd, m_Xbe->GetError().c_str());
}
else {
std::cout << Xbe_info;
@ -978,7 +978,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
if (m_bIsStarted) {
// We don't allow changing the contents of the eeprom while a game is running, mostly because we lack a "pause emulation"
// function necessary to modify the contents safely (the game itself can modify the eeprom)
(void)CxbxPopupMsgErrorSimple(hwnd, "Cannot modify eeprom file while a title is running");
PopupError(hwnd, "Cannot modify eeprom file while a title is running");
break;
}
ShowEepromConfig(hwnd);
@ -1014,24 +1014,24 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
// -14 is for \\Cxbx-Reloaded string to be include later down below.
size_t szLen = strnlen(szDir, MAX_PATH - 14);
if (szLen == 0) {
(void)CxbxPopupMsgErrorSimple(hwnd, "You've selected an invalid folder... Go back and try again.");
PopupError(hwnd, "You've selected an invalid folder... Go back and try again.");
break;
}
else if (szLen == MAX_PATH - 14) {
(void)CxbxPopupMsgErrorSimple(hwnd, "You've selected a folder path which is too long... Go back and try again.");
PopupError(hwnd, "You've selected a folder path which is too long... Go back and try again.");
break;
}
std::string szDirTemp = std::string(szDir) + std::string("\\Cxbx-Reloaded");
if (szDirTemp.size() > MAX_PATH) {
(void)CxbxPopupMsgErrorSimple(hwnd, "Directory path is too long. Go back and choose a shorter path.");
PopupError(hwnd, "Directory path is too long. Go back and choose a shorter path.");
break;
}
int result = SHCreateDirectoryEx(nullptr, szDirTemp.c_str(), nullptr);
if ((result != ERROR_SUCCESS) && (result != ERROR_ALREADY_EXISTS)) {
(void)CxbxPopupMsgErrorSimple(hwnd, "You don't have write permissions on that directory...");
PopupError(hwnd, "You don't have write permissions on that directory...");
break;
}
@ -1059,7 +1059,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
case ID_CACHE_CLEARHLECACHE_ALL:
{
ClearSymbolCache(g_Settings->GetDataLocation().c_str());
(void)CxbxPopupMsgInfoSimple(m_hwnd, "The entire Symbol Cache has been cleared.");
PopupInfo(m_hwnd, "The entire Symbol Cache has been cleared.");
}
break;
@ -1076,19 +1076,19 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
std::string fullpath = sstream.str();
if (std::filesystem::remove(fullpath)) {
(void)CxbxPopupMsgInfoSimple(m_hwnd, "This title's Symbol Cache entry has been cleared.");
PopupInfo(m_hwnd, "This title's Symbol Cache entry has been cleared.");
}
}
break;
case ID_SETTINGS_INITIALIZE:
{
MsgDlgRet ret = CxbxPopupMsgWarn(m_hwnd, MsgDlgButtons::YES_NO, MsgDlgRet::RET_NO,
PopupReturn ret = PopupWarningEx(m_hwnd, PopupButtons::YesNo, PopupReturn::No,
"Warning: This will reset all Cxbx-Reloaded settings to their default values.\nAre you sure you want to proceed?", "Cxbx-Reloaded");
if (ret == MsgDlgRet::RET_YES) {
if (ret == PopupReturn::Yes) {
InitializeSettings();
(void)CxbxPopupMsgInfoSimple(m_hwnd, "Cxbx-Reloaded has been initialized and will now close.");
PopupInfo(m_hwnd, "Cxbx-Reloaded has been initialized and will now close.");
SendMessage(hwnd, WM_CLOSE, 0, 0);
}
}
@ -1102,7 +1102,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
else {
g_Settings->m_core.KrnlDebugMode = DM_NONE;
}
(void)CxbxPopupMsgInfoSimple(m_hwnd, "This will not take effect until the next time emulation is started.");
PopupInfo(m_hwnd, "This will not take effect until the next time emulation is started.");
RefreshMenus();
@ -1139,7 +1139,7 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
if (GetSaveFileName(&ofn) != FALSE)
{
(void)CxbxPopupMsgInfoSimple(m_hwnd, "This will not take effect until emulation is (re)started.");
PopupInfo(m_hwnd, "This will not take effect until emulation is (re)started.");
strncpy(g_Settings->m_core.szKrnlDebug, ofn.lpstrFile, MAX_PATH - 1);
@ -1270,10 +1270,10 @@ LRESULT CALLBACK WndMain::WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
case ID_HACKS_RUNXBOXTHREADSONALLCORES:
if (g_Settings->m_hacks.UseAllCores == false) {
MsgDlgRet ret = CxbxPopupMsgWarn(hwnd, MsgDlgButtons::YES_NO, MsgDlgRet::RET_NO,
PopupReturn ret = PopupWarningEx(hwnd, PopupButtons::YesNo, PopupReturn::No,
"Activating this hack will make the emulator more likely to crash and/or hang."
"\nPlease do not report issues with games while this hack is active. Are you sure you want to turn it on?");
if (ret != MsgDlgRet::RET_YES) {
if (ret != PopupReturn::Yes) {
break;
}
}
@ -1430,7 +1430,7 @@ void WndMain::LoadLogo()
if(m_Xbe->HasError())
{
(void)CxbxPopupMsgErrorSimple(m_hwnd, m_Xbe->GetError().c_str());
PopupError(m_hwnd, m_Xbe->GetError().c_str());
if (m_Xbe->HasFatalError())
{
@ -1995,7 +1995,7 @@ void WndMain::OpenXbe(const char *x_filename)
RedrawWindow(m_hwnd, nullptr, NULL, RDW_INVALIDATE);
(void)CxbxPopupMsgErrorSimple(m_hwnd, ErrorMessage.c_str());
PopupError(m_hwnd, ErrorMessage.c_str());
UpdateCaption();
@ -2004,11 +2004,11 @@ void WndMain::OpenXbe(const char *x_filename)
if (!g_Settings->m_gui.bIgnoreInvalidXbeSig && !m_Xbe->CheckXbeSignature())
{
MsgDlgRet ret = CxbxPopupMsgWarn(m_hwnd, MsgDlgButtons::YES_NO, MsgDlgRet::RET_NO,
PopupReturn ret = PopupWarningEx(m_hwnd, PopupButtons::YesNo, PopupReturn::No,
"XBE signature check failed!\n"
"\nThis is dangerous, as maliciously modified Xbox titles could take control of your system.\n"
"\nAre you sure you want to continue?");
if (ret != MsgDlgRet::RET_YES)
if (ret != PopupReturn::Yes)
{
delete m_Xbe; m_Xbe = nullptr;
@ -2077,11 +2077,11 @@ void WndMain::CloseXbe()
if(m_bXbeChanged)
{
MsgDlgRet ret = CxbxPopupMsgQuestionSimple(m_hwnd, "Changes have been made, do you wish to save?");
PopupReturn ret = PopupQuestion(m_hwnd, "Changes have been made, do you wish to save?");
if(ret == MsgDlgRet::RET_YES)
if(ret == PopupReturn::Yes)
SaveXbeAs();
else if(ret == MsgDlgRet::RET_CANCEL)
else if(ret == PopupReturn::Cancel)
return;
}
@ -2145,7 +2145,7 @@ void WndMain::SaveXbe(const char *x_filename)
// ask permission to overwrite if the file already exists
if(_access(x_filename, 0) != -1)
{
if(CxbxPopupMsgQuestion(m_hwnd, LOG_LEVEL::INFO, MsgDlgButtons::YES_NO, MsgDlgRet::RET_NO, "Overwrite existing file?") != MsgDlgRet::RET_YES)
if(PopupQuestionEx(m_hwnd, LOG_LEVEL::INFO, PopupButtons::YesNo, PopupReturn::No, "Overwrite existing file?") != PopupReturn::Yes)
return;
}
@ -2154,14 +2154,14 @@ void WndMain::SaveXbe(const char *x_filename)
m_Xbe->Export(x_filename);
if(m_Xbe->HasError())
(void)CxbxPopupMsgErrorSimple(m_hwnd, m_Xbe->GetError().c_str());
PopupError(m_hwnd, m_Xbe->GetError().c_str());
else
{
char buffer[255];
sprintf(buffer, "%s was successfully saved.", m_Xbe->m_szAsciiTitle);
(void)CxbxPopupMsgInfoSimple(m_hwnd, buffer);
PopupInfo(m_hwnd, buffer);
m_bXbeChanged = false;
}
@ -2208,7 +2208,7 @@ void WndMain::StartEmulation(HWND hwndParent, DebuggerState LocalDebuggerState /
g_EmuShared->GetIsEmulating(&isEmulating);
if (isEmulating) {
(void)CxbxPopupMsgErrorSimple(m_hwnd, "A title is currently emulating, please stop emulation before attempting to start again.");
PopupError(m_hwnd, "A title is currently emulating, please stop emulation before attempting to start again.");
return;
}
@ -2273,7 +2273,7 @@ void WndMain::StartEmulation(HWND hwndParent, DebuggerState LocalDebuggerState /
DebuggerMonitorClose();
if (!CxbxExec(true, &m_hDebuggerProc, true)) {
(void)CxbxPopupMsgErrorSimple(m_hwnd, "Failed to start emulation with the debugger.\n\nYou will need to build CxbxDebugger manually.");
PopupError(m_hwnd, "Failed to start emulation with the debugger.\n\nYou will need to build CxbxDebugger manually.");
printf("WndMain: %s debugger shell failed.\n", m_Xbe->m_szAsciiTitle);
}
@ -2286,7 +2286,7 @@ void WndMain::StartEmulation(HWND hwndParent, DebuggerState LocalDebuggerState /
else {
if (!CxbxExec(false, nullptr, false)) {
(void)CxbxPopupMsgErrorSimple(m_hwnd, "Emulation failed.\n\n If this message repeats, the Xbe is not supported.");
PopupError(m_hwnd, "Emulation failed.\n\n If this message repeats, the Xbe is not supported.");
printf("WndMain: %s shell failed.\n", m_Xbe->m_szAsciiTitle);
}