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 void Open(Rom* rom, const std::string& rom_filename,
69 bool suggest_project_creation);
70
75 void Open(Rom* rom);
76 void Open(Rom* rom, bool suggest_project_creation);
77
83 bool Show(bool* p_open);
84
89 void Draw(bool* p_open);
90
94 const LoadOptions& GetOptions() const { return options_; }
95
99 bool WasConfirmed() const { return confirmed_; }
100
104 void ResetConfirmation() { confirmed_ = false; }
105
109 void SetConfirmCallback(std::function<void(const LoadOptions&)> callback) {
110 confirm_callback_ = callback;
111 }
112
116 void SetUpgradeCallback(std::function<absl::Status(int version)> callback) {
117 upgrade_callback_ = callback;
118 }
119
123 bool ShouldPromptUpgrade() const;
124
131
132 private:
133 void DrawVersionInfo();
134 void DrawUpgradeOptions();
137 void DrawProjectOptions();
138 void DrawActionButtons();
139
140 void ApplyPreset(const std::string& preset_name);
142
143 // State
144 Rom* rom_ = nullptr;
145 std::string rom_filename_;
148 bool is_open_ = false;
149 bool confirmed_ = false;
150 bool show_advanced_ = false;
151
152 // Options
154
155 // Available presets
156 static constexpr int kNumPresets = 4;
157 static const char* kPresetNames[kNumPresets];
158 static const char* kPresetDescriptions[kNumPresets];
160
161 // Callbacks
162 std::function<void(const LoadOptions&)> confirm_callback_;
163 std::function<absl::Status(int version)> upgrade_callback_;
164
165 // UI state
166 char project_name_buffer_[256] = {};
167 char project_path_buffer_[512] = {};
168};
169
170} // namespace editor
171} // namespace yaze
172
173#endif // YAZE_APP_EDITOR_UI_ROM_LOAD_OPTIONS_DIALOG_H_
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:28
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