Loader : Deduplicate code via new CreateSettings()
This commit is contained in:
parent
890a5ffd2f
commit
170b971a8e
|
@ -872,13 +872,8 @@ void ImportLibraries(XbeImportEntry *pImportDirectory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HandleFirstLaunch()
|
bool CreateSettings()
|
||||||
{
|
{
|
||||||
bool bFirstLaunch;
|
|
||||||
g_EmuShared->GetIsFirstLaunch(&bFirstLaunch);
|
|
||||||
|
|
||||||
/* check if process is launch with elevated access then prompt for continue on or not. */
|
|
||||||
if (!bFirstLaunch) {
|
|
||||||
g_Settings = new Settings();
|
g_Settings = new Settings();
|
||||||
if (g_Settings == nullptr) {
|
if (g_Settings == nullptr) {
|
||||||
MessageBox(nullptr, szSettings_alloc_error, "Cxbx-Reloaded", MB_OK);
|
MessageBox(nullptr, szSettings_alloc_error, "Cxbx-Reloaded", MB_OK);
|
||||||
|
@ -890,6 +885,19 @@ bool HandleFirstLaunch()
|
||||||
}
|
}
|
||||||
|
|
||||||
log_get_settings();
|
log_get_settings();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HandleFirstLaunch()
|
||||||
|
{
|
||||||
|
bool bFirstLaunch;
|
||||||
|
g_EmuShared->GetIsFirstLaunch(&bFirstLaunch);
|
||||||
|
|
||||||
|
/* check if process is launch with elevated access then prompt for continue on or not. */
|
||||||
|
if (!bFirstLaunch) {
|
||||||
|
if (!CreateSettings()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool bElevated = CxbxIsElevated();
|
bool bElevated = CxbxIsElevated();
|
||||||
if (bElevated && !g_Settings->m_core.allowAdminPrivilege) {
|
if (bElevated && !g_Settings->m_core.allowAdminPrivilege) {
|
||||||
|
|
|
@ -224,6 +224,8 @@ bool CxbxKrnlVerifyVersion(const char *szVersion);
|
||||||
|
|
||||||
extern bool g_bIsDebugKernel;
|
extern bool g_bIsDebugKernel;
|
||||||
|
|
||||||
|
bool CreateSettings();
|
||||||
|
|
||||||
bool HandleFirstLaunch();
|
bool HandleFirstLaunch();
|
||||||
|
|
||||||
/*! Cxbx Kernel Entry Point */
|
/*! Cxbx Kernel Entry Point */
|
||||||
|
|
|
@ -99,19 +99,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||||
|
|
||||||
// If 2nd GUI executable is launched, load settings file for GUI for editable support.
|
// If 2nd GUI executable is launched, load settings file for GUI for editable support.
|
||||||
if (g_Settings == nullptr) {
|
if (g_Settings == nullptr) {
|
||||||
g_Settings = new Settings();
|
if (!CreateSettings()) {
|
||||||
if (g_Settings == nullptr) {
|
|
||||||
MessageBox(nullptr, szSettings_alloc_error, "Cxbx-Reloaded", MB_OK);
|
|
||||||
EmuShared::Cleanup();
|
EmuShared::Cleanup();
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_Settings->Init()) {
|
|
||||||
EmuShared::Cleanup();
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
log_get_settings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Possible optional output for GUI
|
// Possible optional output for GUI
|
||||||
|
|
Loading…
Reference in New Issue