get stuff back to a point where we can build stuff

This commit is contained in:
briaguya 2024-03-03 04:13:02 -05:00
parent 8d9bc42915
commit 490a785d45
6 changed files with 33 additions and 33 deletions

@ -1 +1 @@
Subproject commit aa1091d77c81af6c894e85f9654270632732bf83
Subproject commit da077e8d625a5f8a1fd70179b7f9997667d13285

View File

@ -1037,13 +1037,13 @@ void InitTTSBank() {
break;
}
// auto sceneFile = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->LoadFileRaw("accessibility/texts/scenes" + languageSuffix);
// if (sceneFile != nullptr) {
// sceneMap = nlohmann::json::parse(*sceneFile->Buffer.get(), nullptr, true, true);
// }
auto sceneFile = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->LoadFileRaw("accessibility/texts/scenes" + languageSuffix);
if (sceneFile != nullptr) {
sceneMap = nlohmann::json::parse(*sceneFile->Buffer.get(), nullptr, true, true);
}
// use binaryreader as base for rawjsonfactory
// just pass a shared pointer to initdata in here
sceneMap = LUS::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/scenes" + languageSuffix, initdata);
// sceneMap = LUS::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/scenes" + languageSuffix, initdata);
auto miscFile = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->LoadFileRaw("accessibility/texts/misc" + languageSuffix);
if (miscFile != nullptr) {

View File

@ -14,8 +14,8 @@ 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);
// 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);

View File

@ -1582,9 +1582,9 @@ extern "C" void ResourceMgr_UnloadOriginalWhenAltExists(const char* resName) {
}
}
extern "C" void ResourceMgr_LoadFile(const char* resName) {
LUS::Context::GetInstance()->GetResourceManager()->LoadResource(resName);
}
// extern "C" void ResourceMgr_LoadFile(const char* resName) {
// LUS::Context::GetInstance()->GetResourceManager()->LoadResource(resName);
// }
std::shared_ptr<LUS::IResource> GetResourceByNameHandlingMQ(const char* path) {
std::string Path = path;
@ -1607,19 +1607,19 @@ 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);
// 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);
// char* data = (char*)malloc(fSize);
// fread(data, 1, fSize, file);
fclose(file);
// fclose(file);
return data;
}
// return data;
// }
extern "C" uint8_t ResourceMgr_TexIsRaw(const char* texPath) {
auto res = std::static_pointer_cast<LUS::Texture>(GetResourceByNameHandlingMQ(texPath));

View File

@ -95,8 +95,8 @@ 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);
// 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);

View File

@ -39,16 +39,16 @@ extern "C" s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId);
extern "C" RomFile sNaviMsgFiles[];
s32 OTRScene_ExecuteCommands(PlayState* play, SOH::Scene* scene);
std::shared_ptr<LUS::File> 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());
}
// std::shared_ptr<LUS::File> 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<LUS::IResource> GetResourceByNameHandlingMQ(const char* path);