Fix NON_PORTABLE build. Ship::Context needs to be initialized first. (#618)

* Fix NON_PORTABLE build. Ship::Context needs to be initialized before resolving files. Move offending calls inside functions where they are used. Those will always be called after GameEngine() which runs Ship::Context::CreateUninitializedInstance() early.

* Replace hardcoded string mk64.o2r and spaghetti.o2r with variables game_asset_file and engine_asset_file.
This commit is contained in:
Fabien Romano
2026-01-09 19:13:37 +01:00
committed by GitHub
parent e71c422afb
commit aaae77f3bc
3 changed files with 14 additions and 8 deletions
+5 -2
View File
@@ -19,8 +19,6 @@ void DetectOutdatedDependencies();
void SortModsByDependencies();
std::vector<std::tuple<ModMetadata, std::shared_ptr<Ship::Archive>>> Mods = {};
const std::string main_path = Ship::Context::GetPathRelativeToAppDirectory("mk64.o2r");
const std::string assets_path = Ship::Context::LocateFileAcrossAppDirs("spaghetti.o2r");
void InitModsSystem() {
CheckMK64O2RExists();
@@ -65,6 +63,9 @@ void GenerateAssetsMods() {
}
std::vector<std::string> ListMods() {
const std::string main_path = Ship::Context::GetPathRelativeToAppDirectory(game_asset_file);
const std::string assets_path = Ship::Context::LocateFileAcrossAppDirs(engine_asset_file);
std::vector<std::string> archiveFiles;
if (std::filesystem::exists(main_path)) {
archiveFiles.push_back(main_path);
@@ -202,6 +203,8 @@ void AddCoreDependencies() {
}
void CheckMK64O2RExists() {
const std::string main_path = Ship::Context::GetPathRelativeToAppDirectory(game_asset_file);
if (!std::filesystem::exists(main_path)) {
GenerateAssetsMods();
}