From ef62270f3c0b499e6c8e0cb9ed58801815c52848 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Sat, 17 Jan 2026 14:12:23 -0600 Subject: [PATCH] Fixed paths to work like on soh --- src/game/ingame_menu.c | 6 +++--- src/port/Engine.cpp | 49 +++++++++++++++++++++--------------------- src/port/Engine.h | 1 + 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c index d55e41e5..adb26edf 100644 --- a/src/game/ingame_menu.c +++ b/src/game/ingame_menu.c @@ -245,7 +245,7 @@ static u8 *alloc_ia8_text_from_i1(u16 *in, s16 width, s16 height) { } void render_generic_char(u8 c) { - void **fontLUT = segmented_to_virtual(main_font_lut); + char **fontLUT = segmented_to_virtual(main_font_lut); char* packedTexture = fontLUT[c]; if (packedTexture == NULL) { @@ -254,9 +254,9 @@ void render_generic_char(u8 c) { gDPPipeSync(gDisplayListHead++); if(ROM_JP) { - gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_8b, 1, VIRTUAL_TO_PHYSICAL(packedTexture)); + gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_8b, 1, (packedTexture)); } else { - gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, VIRTUAL_TO_PHYSICAL(packedTexture)); + gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, (packedTexture)); } gSPDisplayList(gDisplayListHead++, dl_ia_text_tex_settings); diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp index 33e91a20..49199ab4 100644 --- a/src/port/Engine.cpp +++ b/src/port/Engine.cpp @@ -54,6 +54,7 @@ const float imguiScaleOptionToValue[4] = { 0.75f, 1.0f, 1.5f, 2.0f }; const uint32_t defaultImGuiScale = 1; int32_t previousImGuiScaleIndex = -1; float previousImGuiScale = defaultImGuiScale; +const std::string appShortName = "warp"; namespace fs = std::filesystem; @@ -68,7 +69,7 @@ bool prevAltAssets = false; GameEngine* GameEngine::Instance; GameEngine::GameEngine() : dictionary(nullptr) { - this->context = Ship::Context::CreateUninitializedInstance("Ghostship", "sm64", "ghostship.cfg.json"); + this->context = Ship::Context::CreateUninitializedInstance("Ghostship", appShortName, "ghostship.cfg.json"); #ifdef __SWITCH__ Ship::Switch::Init(Ship::PreInitPhase); @@ -76,7 +77,7 @@ GameEngine::GameEngine() : dictionary(nullptr) { #endif std::vector archiveFiles; - const std::string main_path = Ship::Context::GetPathRelativeToAppDirectory("sm64.o2r"); + const std::string main_path = Ship::Context::GetAppDirectoryPath(appShortName) + "/sm64.o2r"; const std::string assets_path = Ship::Context::LocateFileAcrossAppDirs("ghostship.o2r"); #ifdef _WIN32 @@ -104,22 +105,21 @@ GameEngine::GameEngine() : dictionary(nullptr) { archiveFiles.push_back(assets_path); } - if (const std::string patches_path = Ship::Context::GetPathRelativeToAppDirectory("mods"); !patches_path.empty()) { - if (!std::filesystem::exists(patches_path)) { - std::filesystem::create_directories(patches_path); - } + std::string modsPath = Ship::Context::LocateFileAcrossAppDirs("mods", appShortName); + if (!std::filesystem::exists(modsPath)) { + std::filesystem::create_directories(modsPath); + } - if (std::filesystem::is_directory(patches_path)) { - for (const auto& p : std::filesystem::recursive_directory_iterator(patches_path)) { - const auto ext = p.path().extension().string(); - if (StringHelper::IEquals(ext, ".otr") || StringHelper::IEquals(ext, ".o2r")) { - archiveFiles.push_back(p.path().generic_string()); - } + if (std::filesystem::is_directory(modsPath)) { + for (const auto& p : std::filesystem::recursive_directory_iterator(modsPath)) { + const auto ext = p.path().extension().string(); + if (StringHelper::IEquals(ext, ".otr") || StringHelper::IEquals(ext, ".o2r")) { + archiveFiles.push_back(p.path().generic_string()); + } - if (StringHelper::IEquals(ext, ".zip")) { - SPDLOG_WARN("Zip files should be only used for development purposes, not for distribution"); - archiveFiles.push_back(p.path().generic_string()); - } + if (StringHelper::IEquals(ext, ".zip")) { + SPDLOG_WARN("Zip files should be only used for development purposes, not for distribution"); + archiveFiles.push_back(p.path().generic_string()); } } } @@ -154,11 +154,6 @@ GameEngine::GameEngine() : dictionary(nullptr) { auto loader = context->GetResourceManager()->GetResourceLoader(); auto blobFactory = std::make_shared(); - loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, - "Texture", static_cast(Fast::ResourceType::Texture), 0); - loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, - "Texture", static_cast(Fast::ResourceType::Texture), 1); - loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Animation", static_cast(SM64::ResourceType::Anim), 0); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "AudioBank", @@ -171,10 +166,10 @@ GameEngine::GameEngine() : dictionary(nullptr) { static_cast(SM64::ResourceType::SDialog), 0); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Dictionary", static_cast(SM64::ResourceType::Dictionary), 0); -// loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, -// "Texture", static_cast(Fast::ResourceType::Texture), 0); -// loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, -// "Texture", static_cast(Fast::ResourceType::Texture), 1); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, + "Texture", static_cast(Fast::ResourceType::Texture), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, + "Texture", static_cast(Fast::ResourceType::Texture), 1); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Vertex", static_cast(Fast::ResourceType::Vertex), 0); loader->RegisterResourceFactory(std::make_shared(), @@ -574,6 +569,10 @@ void GameEngine::ProcessGfxCommands(Gfx* commands) { last_fps = fps; } +bool GameEngine::IsAltAssetsEnabled() { + return prevAltAssets; +} + extern "C" uint32_t GameEngine_GetInterpolatedFPS() { return GameEngine::GetInterpolationFPS(); } diff --git a/src/port/Engine.h b/src/port/Engine.h index cc9930ae..7fa04a4f 100644 --- a/src/port/Engine.h +++ b/src/port/Engine.h @@ -65,6 +65,7 @@ class GameEngine { static ImFont *CreateFontWithSize(float size, std::string fontPath); static void ScaleImGui(); static void ShowMessage(const char* title, const char* message, SDL_MessageBoxFlags type = SDL_MESSAGEBOX_ERROR); + static bool IsAltAssetsEnabled(); void LoadDictionary(); void LoadPlayerAnims(); static uint32_t GetGameVersion();