add save gfx groups
This commit is contained in:
@@ -42,6 +42,9 @@ class ExperimentFlags {
|
||||
// Flag to enable the saving of all palettes to the Rom.
|
||||
bool kSaveAllPalettes = false;
|
||||
|
||||
// Flag to enable the saving of gfx groups to the rom.
|
||||
bool kSaveGfxGroups = false;
|
||||
|
||||
// Flag to enable the change queue, which could have any anonymous
|
||||
// save routine for the Rom. In practice, just the overworld tilemap
|
||||
// and tile32 save.
|
||||
|
||||
@@ -400,8 +400,7 @@ void MasterEditor::DrawFileMenu() {
|
||||
Checkbox("Log Instructions to Debugger",
|
||||
&mutable_flags()->kLogInstructions);
|
||||
Checkbox("Save All Palettes", &mutable_flags()->kSaveAllPalettes);
|
||||
Checkbox("Save With Change Queue",
|
||||
&mutable_flags()->kSaveWithChangeQueue);
|
||||
Checkbox("Save Gfx Groups", &mutable_flags()->kSaveGfxGroups);
|
||||
Checkbox("Use New ImGui Input", &mutable_flags()->kUseNewImGuiInput);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
@@ -596,6 +595,7 @@ void MasterEditor::DrawHelpMenu() {
|
||||
|
||||
ImGui::Text("Graphics");
|
||||
ImGui::BulletText("View Decompressed Graphics Sheets");
|
||||
ImGui::BulletText("View/Update Graphics Groups");
|
||||
|
||||
ImGui::Text("Palettes");
|
||||
ImGui::BulletText("View Palette Groups");
|
||||
@@ -604,8 +604,6 @@ void MasterEditor::DrawHelpMenu() {
|
||||
ImGui::BulletText("All Listed Overworld Features");
|
||||
ImGui::BulletText("Hex Editor Changes");
|
||||
|
||||
|
||||
|
||||
if (ImGui::Button("Close", gui::kDefaultModalSize)) {
|
||||
open_supported_features = false;
|
||||
ImGui::CloseCurrentPopup();
|
||||
|
||||
@@ -65,6 +65,7 @@ class MasterEditor : public SharedRom,
|
||||
void Shutdown() { overworld_editor_.Shutdown(); }
|
||||
|
||||
auto emulator() -> emu::Emulator& { return emulator_; }
|
||||
auto quit() { return quit_; }
|
||||
|
||||
private:
|
||||
void DrawFileDialog();
|
||||
@@ -81,6 +82,7 @@ class MasterEditor : public SharedRom,
|
||||
void LoadRom();
|
||||
void SaveRom();
|
||||
|
||||
bool quit_ = false;
|
||||
bool about_ = false;
|
||||
bool rom_info_ = false;
|
||||
bool backup_rom_ = false;
|
||||
|
||||
@@ -257,6 +257,10 @@ absl::Status Rom::SaveToFile(bool backup, bool save_new, std::string filename) {
|
||||
RETURN_IF_ERROR(SaveAllPalettes());
|
||||
}
|
||||
|
||||
if (flags()->kSaveGfxGroups) {
|
||||
SaveGroupsToRom();
|
||||
}
|
||||
|
||||
if (save_new) {
|
||||
// Create a file of the same name and append the date between the filename
|
||||
// and file extension
|
||||
@@ -335,6 +339,39 @@ absl::Status Rom::SaveAllPalettes() {
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
void Rom::SaveGroupsToRom() {
|
||||
int gfxPointer =
|
||||
(rom_data_[kGfxGroupsPointer + 1] << 8) + rom_data_[kGfxGroupsPointer];
|
||||
gfxPointer = core::SnesToPc(gfxPointer);
|
||||
|
||||
for (int i = 0; i < 37; i++) {
|
||||
for (int j = 0; j < 8; j++) {
|
||||
rom_data_[gfxPointer + (i * 8) + j] = main_blockset_ids[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 82; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
rom_data_[core::entrance_gfx_group + (i * 4) + j] =
|
||||
room_blockset_ids[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 144; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
rom_data_[version_constants().kSpriteBlocksetPointer + (i * 4) + j] =
|
||||
spriteset_ids[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 72; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
rom_data_[version_constants().kDungeonPalettesGroups + (i * 4) + j] =
|
||||
paletteset_ids[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<Rom> SharedRom::shared_rom_ = nullptr;
|
||||
|
||||
} // namespace app
|
||||
|
||||
@@ -570,40 +570,7 @@ class Rom : public core::ExperimentFlags {
|
||||
}
|
||||
}
|
||||
|
||||
bool SaveGroupsToRom() {
|
||||
int gfxPointer =
|
||||
(rom_data_[kGfxGroupsPointer + 1] << 8) + rom_data_[kGfxGroupsPointer];
|
||||
gfxPointer = core::SnesToPc(gfxPointer);
|
||||
|
||||
for (int i = 0; i < 37; i++) {
|
||||
for (int j = 0; j < 8; j++) {
|
||||
rom_data_[gfxPointer + (i * 8) + j] = main_blockset_ids[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 82; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
rom_data_[core::entrance_gfx_group + (i * 4) + j] =
|
||||
room_blockset_ids[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 144; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
rom_data_[version_constants().kSpriteBlocksetPointer + (i * 4) + j] =
|
||||
spriteset_ids[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 72; i++) {
|
||||
for (int j = 0; j < 4; j++) {
|
||||
rom_data_[version_constants().kDungeonPalettesGroups + (i * 4) + j] =
|
||||
paletteset_ids[i][j];
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
void SaveGroupsToRom();
|
||||
|
||||
auto resource_label() { return &resource_label_manager_; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user