Init the file paths much earlier, as soon as the EXE is started

This allows for the GUI to also access the Cxbx path variable.
This commit is contained in:
Luke Usher 2017-04-21 09:57:01 +01:00
parent 033ff9fa94
commit f5d0b27134
2 changed files with 4 additions and 3 deletions

View File

@ -59,6 +59,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
return 1; return 1;
} }
/* Initialize Cxbx File Paths */
CxbxInitFilePaths();
/*! initialize shared memory */ /*! initialize shared memory */
EmuShared::Init(); EmuShared::Init();

View File

@ -396,8 +396,6 @@ void CxbxKrnlMain(int argc, char* argv[])
RestoreExeImageHeader(); RestoreExeImageHeader();
} }
CxbxInitFilePaths();
CxbxRestoreContiguousMemory(szFilePath_memory_bin); CxbxRestoreContiguousMemory(szFilePath_memory_bin);
CxbxRestorePersistentMemoryRegions(); CxbxRestorePersistentMemoryRegions();
@ -801,7 +799,7 @@ void CxbxInitFilePaths()
// Make sure our data folder exists : // Make sure our data folder exists :
int result = SHCreateDirectoryEx(nullptr, szFolder_CxbxReloadedData, nullptr); int result = SHCreateDirectoryEx(nullptr, szFolder_CxbxReloadedData, nullptr);
if ((result != ERROR_SUCCESS) && (result != ERROR_ALREADY_EXISTS)) if ((result != ERROR_SUCCESS) && (result != ERROR_ALREADY_EXISTS))
CxbxKrnlCleanup("CxbxInitFilePaths : Couldn't create Cxbx-Reloaded AppData folder!"); CxbxKrnlCleanup("CxbxInitFilePaths : Couldn't create Cxbx-Reloaded AppData folder!");
snprintf(szFilePath_LaunchDataPage_bin, MAX_PATH, "%s\\CxbxLaunchDataPage.bin", szFolder_CxbxReloadedData); snprintf(szFilePath_LaunchDataPage_bin, MAX_PATH, "%s\\CxbxLaunchDataPage.bin", szFolder_CxbxReloadedData);
snprintf(szFilePath_EEPROM_bin, MAX_PATH, "%s\\EEPROM.bin", szFolder_CxbxReloadedData); snprintf(szFilePath_EEPROM_bin, MAX_PATH, "%s\\EEPROM.bin", szFolder_CxbxReloadedData);