Refactor ROM data handling and improve file saving logic

- Removed redundant copy operation in SaveAllGraphicsData.
- Updated SaveToFile to truncate existing content instead of appending, ensuring a clean write.
- Simplified error handling for file operations.
- Introduced dirty flag management in Write methods to track unsaved changes.
- Added getter and setter for dirty state in the Rom class.
This commit is contained in:
scawful
2025-09-13 11:16:47 -04:00
parent 339741fe35
commit 9d1845f997
2 changed files with 19 additions and 15 deletions

View File

@@ -171,6 +171,8 @@ class Rom {
}
bool is_loaded() const { return !rom_data_.empty(); }
bool dirty() const { return dirty_; }
void ClearDirty() { dirty_ = false; }
auto title() const { return title_; }
auto size() const { return size_; }
auto data() const { return rom_data_.data(); }
@@ -227,6 +229,9 @@ class Rom {
// Version of the game
zelda3_version version_ = zelda3_version::US;
// True if there are unsaved changes
bool dirty_ = false;
};
/**