Refactor ROM save functionality to use structured settings

- Introduced a new SaveSettings struct to encapsulate parameters for the SaveToFile method, improving clarity and maintainability.
- Updated SaveToFile method signature to accept SaveSettings instead of individual parameters.
- Adjusted SaveRom method in EditorManager to utilize the new SaveSettings struct for better parameter management.
- Removed redundant label loading from LoadFromFile when z3_load is true, streamlining the loading process.
This commit is contained in:
scawful
2025-05-13 21:00:53 -04:00
parent 0863b7c606
commit 8d34ebf534
3 changed files with 24 additions and 10 deletions

View File

@@ -57,6 +57,13 @@ static const std::map<zelda3_version, zelda3_version_pointers>
*/
class Rom {
public:
struct SaveSettings {
bool backup = false;
bool save_new = false;
bool z3_save = true;
std::string filename = "";
};
absl::Status LoadFromFile(const std::string& filename, bool z3_load = true);
absl::Status LoadFromData(const std::vector<uint8_t>& data,
bool z3_load = true);
@@ -64,8 +71,7 @@ class Rom {
absl::Status LoadGfxGroups();
absl::Status SaveGfxGroups();
absl::Status SaveToFile(bool backup, bool save_new = false,
std::string filename = "");
absl::Status SaveToFile(const SaveSettings& settings);
absl::Status SavePalette(int index, const std::string& group_name,
gfx::SnesPalette& palette);
absl::Status SaveAllPalettes();