From 375349e4f72ce4e4609dc88c6ff8e6a4d69d681c Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Mon, 4 Mar 2024 23:36:23 -0500 Subject: [PATCH] Support font as resource LUS changes (#3993) --- libultraship | 2 +- soh/soh/GbiWrap.cpp | 2 -- soh/soh/OTRGlobals.cpp | 18 ------------------ soh/soh/OTRGlobals.h | 2 -- soh/soh/z_scene_otr.cpp | 11 ----------- 5 files changed, 1 insertion(+), 34 deletions(-) diff --git a/libultraship b/libultraship index be3a87eef..ec01bc798 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit be3a87eefc4b0637adf6fff1a3fa5cc9b8265196 +Subproject commit ec01bc79860c55fe3562dafb4b4cb0aa2ce50a21 diff --git a/soh/soh/GbiWrap.cpp b/soh/soh/GbiWrap.cpp index 46f4c877c..2399051f5 100644 --- a/soh/soh/GbiWrap.cpp +++ b/soh/soh/GbiWrap.cpp @@ -14,8 +14,6 @@ void OTRGetPixelDepthPrepare(float x, float y); uint16_t OTRGetPixelDepth(float x, float y); int32_t OTRGetLastScancode(); void ResourceMgr_LoadDirectory(const char* resName); -void ResourceMgr_LoadFile(const char* resName); -char* ResourceMgr_LoadFileFromDisk(const char* filePath); uint16_t ResourceMgr_LoadTexWidthByName(char* texPath); uint16_t ResourceMgr_LoadTexHeightByName(char* texPath); size_t ResourceGetTexSizeByName(const char* name); diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 38fc5afd7..61f0e2b93 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -1581,10 +1581,6 @@ extern "C" void ResourceMgr_UnloadOriginalWhenAltExists(const char* resName) { } } -extern "C" void ResourceMgr_LoadFile(const char* resName) { - LUS::Context::GetInstance()->GetResourceManager()->LoadResource(resName); -} - std::shared_ptr GetResourceByNameHandlingMQ(const char* path) { std::string Path = path; if (ResourceMgr_IsGameMasterQuest()) { @@ -1606,20 +1602,6 @@ extern "C" char* GetResourceDataByNameHandlingMQ(const char* path) { return (char*)res->GetRawPointer(); } -extern "C" char* ResourceMgr_LoadFileFromDisk(const char* filePath) { - FILE* file = fopen(filePath, "r"); - fseek(file, 0, SEEK_END); - int fSize = ftell(file); - fseek(file, 0, SEEK_SET); - - char* data = (char*)malloc(fSize); - fread(data, 1, fSize, file); - - fclose(file); - - return data; -} - extern "C" uint8_t ResourceMgr_TexIsRaw(const char* texPath) { auto res = std::static_pointer_cast(GetResourceByNameHandlingMQ(texPath)); return res->Flags & TEX_FLAG_LOAD_AS_RAW; diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h index db42341c2..a4af676e0 100644 --- a/soh/soh/OTRGlobals.h +++ b/soh/soh/OTRGlobals.h @@ -95,8 +95,6 @@ uint8_t ResourceMgr_FileExists(const char* resName); uint8_t ResourceMgr_FileAltExists(const char* resName); void ResourceMgr_UnloadOriginalWhenAltExists(const char* resName); char* GetResourceDataByNameHandlingMQ(const char* path); -void ResourceMgr_LoadFile(const char* resName); -char* ResourceMgr_LoadFileFromDisk(const char* filePath); uint8_t ResourceMgr_TexIsRaw(const char* texPath); uint8_t ResourceMgr_ResourceIsBackground(char* texPath); char* ResourceMgr_LoadJPEG(char* data, size_t dataSize); diff --git a/soh/soh/z_scene_otr.cpp b/soh/soh/z_scene_otr.cpp index 3d7889807..0b9ba98f9 100644 --- a/soh/soh/z_scene_otr.cpp +++ b/soh/soh/z_scene_otr.cpp @@ -39,17 +39,6 @@ extern "C" s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId); extern "C" RomFile sNaviMsgFiles[]; s32 OTRScene_ExecuteCommands(PlayState* play, SOH::Scene* scene); -std::shared_ptr ResourceMgr_LoadFile(const char* path) { - std::string Path = path; - if (IsGameMasterQuest()) { - size_t pos = 0; - if ((pos = Path.find("/nonmq/", 0)) != std::string::npos) { - Path.replace(pos, 7, "/mq/"); - } - } - return LUS::Context::GetInstance()->GetResourceManager()->LoadFile(Path.c_str()); -} - // Forward Declaration of function declared in OTRGlobals.cpp std::shared_ptr GetResourceByNameHandlingMQ(const char* path);