diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp index 2f8c52759..97f09bd74 100644 --- a/soh/soh/SaveManager.cpp +++ b/soh/soh/SaveManager.cpp @@ -885,6 +885,15 @@ void SaveManager::AddPostFunction(const std::string& name, PostFunc func) { postHandlers[name] = func; } +// Returns -1 if section name not found +int SaveManager::GetSaveSectionID(std::string& sectionName) { + if (sectionRegistry.contains(sectionName)) { + return sectionRegistry.find(sectionName)->second; + } else { + return -1; + } +} + void SaveManager::CreateDefaultGlobal() { gSaveContext.audioSetting = 0; gSaveContext.zTargetSetting = 0; diff --git a/soh/soh/SaveManager.h b/soh/soh/SaveManager.h index 56c3692ba..e4c11b838 100644 --- a/soh/soh/SaveManager.h +++ b/soh/soh/SaveManager.h @@ -65,6 +65,7 @@ public: void InitFile(bool isDebug); void SaveFile(int fileNum); void SaveSection(int fileNum, int sectionID); + int GetSaveSectionID(std::string& name); void SaveGlobal(); void LoadFile(int fileNum); bool SaveFile_Exist(int fileNum); @@ -162,7 +163,7 @@ public: int sectionIndex = SECTION_ID_MAX; std::map coreSectionIDsByName; std::map sectionSaveHandlers; - std::set sectionRegistry; + std::map sectionRegistry; std::map postHandlers;