yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
rom_load_options_dialog.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_UI_ROM_LOAD_OPTIONS_DIALOG_H_
2#define YAZE_APP_EDITOR_UI_ROM_LOAD_OPTIONS_DIALOG_H_
3
4#include <functional>
5#include <string>
6
7#include "absl/status/status.h"
8#include "core/features.h"
9#include "imgui/imgui.h"
11
12namespace yaze {
13
14class Rom;
15
16namespace editor {
17
33 public:
34 struct LoadOptions {
35 // ZSCustomOverworld options
36 bool upgrade_to_zscustom = false;
37 int target_zso_version = 3; // 2 or 3
38 bool enable_tail_expansion = false; // Special world tail (0xA0-0xBF)
39
40 // Feature flags to apply
46 bool save_dungeon_maps = false;
47 bool save_all_palettes = false;
48 bool save_gfx_groups = false;
49
50 // Project integration
51 bool create_project = false;
52 std::string project_name;
53 std::string project_path;
54
55 // Preset name if selected
56 std::string selected_preset;
57 };
58
61
67 void Open(Rom* rom, const std::string& rom_filename);
68
73 void Open(Rom* rom);
74
80 bool Show(bool* p_open);
81
86 void Draw(bool* p_open);
87
91 const LoadOptions& GetOptions() const { return options_; }
92
96 bool WasConfirmed() const { return confirmed_; }
97
101 void ResetConfirmation() { confirmed_ = false; }
102
106 void SetConfirmCallback(std::function<void(const LoadOptions&)> callback) {
107 confirm_callback_ = callback;
108 }
109
113 void SetUpgradeCallback(std::function<absl::Status(int version)> callback) {
114 upgrade_callback_ = callback;
115 }
116
120 bool ShouldPromptUpgrade() const;
121
126
127 private:
128 void DrawVersionInfo();
129 void DrawUpgradeOptions();
132 void DrawProjectOptions();
133 void DrawActionButtons();
134
135 void ApplyPreset(const std::string& preset_name);
137
138 // State
139 Rom* rom_ = nullptr;
140 std::string rom_filename_;
142 bool is_open_ = false;
143 bool confirmed_ = false;
144 bool show_advanced_ = false;
145
146 // Options
148
149 // Available presets
150 static constexpr int kNumPresets = 4;
151 static const char* kPresetNames[kNumPresets];
152 static const char* kPresetDescriptions[kNumPresets];
154
155 // Callbacks
156 std::function<void(const LoadOptions&)> confirm_callback_;
157 std::function<absl::Status(int version)> upgrade_callback_;
158
159 // UI state
160 char project_name_buffer_[256] = {};
161 char project_path_buffer_[512] = {};
162};
163
164} // namespace editor
165} // namespace yaze
166
167#endif // YAZE_APP_EDITOR_UI_ROM_LOAD_OPTIONS_DIALOG_H_
168
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:24
ROM load options and ZSCustomOverworld upgrade dialog.
std::function< void(const LoadOptions &) confirm_callback_)
void ApplyPreset(const std::string &preset_name)
const LoadOptions & GetOptions() const
Get the selected load options.
void Open(Rom *rom, const std::string &rom_filename)
Open the dialog after ROM detection.
static const char * kPresetNames[kNumPresets]
std::function< absl::Status(int version)> upgrade_callback_
bool Show(bool *p_open)
Show the dialog.
void ResetConfirmation()
Reset confirmation state.
void SetConfirmCallback(std::function< void(const LoadOptions &)> callback)
Set callback for when options are confirmed.
zelda3::OverworldVersion GetDetectedVersion() const
Get detected ROM version.
static const char * kPresetDescriptions[kNumPresets]
bool WasConfirmed() const
Check if dialog resulted in confirmation.
bool ShouldPromptUpgrade() const
Check if ROM needs upgrade prompt.
void SetUpgradeCallback(std::function< absl::Status(int version)> callback)
Set callback for ZSO upgrade.
void Draw(bool *p_open)
Draw the dialog (wrapper around Show)
OverworldVersion
ROM version detection for overworld features.
@ kVanilla
0xFF in ROM, no ZScream ASM applied