ROM load options dialog. More...
#include <rom_load_options_dialog.h>

Classes | |
| struct | LoadOptions |
| struct | RememberedChoice |
Public Member Functions | |
| RomLoadOptionsDialog () | |
| ~RomLoadOptionsDialog ()=default | |
| void | Open (Rom *rom, const std::string &rom_filename) |
| Open the dialog after ROM detection. | |
| void | Open (Rom *rom, const std::string &rom_filename, bool suggest_project_creation) |
| void | Open (Rom *rom) |
| Open the dialog with just ROM pointer (filename from ROM) | |
| void | Open (Rom *rom, bool suggest_project_creation) |
| void | OpenForReview (Rom *rom, const core::FeatureFlags::Flags &active, const std::string &preset_name, bool remembered) |
| Reopen the dialog for a ROM that is already loaded. | |
| bool | Show (bool *p_open) |
| Show the dialog. | |
| void | Draw (bool *p_open) |
| Draw the dialog (wrapper around Show) | |
| const LoadOptions & | GetOptions () const |
| Get the selected load options. | |
| bool | WasConfirmed () const |
| Check if dialog resulted in confirmation. | |
| void | ResetConfirmation () |
| Reset confirmation state. | |
| void | SetConfirmCallback (std::function< void(const LoadOptions &)> callback) |
| Set callback for when options are confirmed. | |
| void | SetCancelCallback (std::function< void()> callback) |
| Set callback for Cancel or the title-bar close button. | |
| void | SetApplyGuard (std::function< bool()> guard) |
| void | Close () |
| zelda3::OverworldVersion | GetDetectedVersion () const |
| Get detected ROM version. | |
| const std::string & | rom_filename () const |
| int | zso_version_byte () const |
| bool | reviewing () const |
| bool | OverworldLoadOptionsChanged () const |
Static Public Member Functions | |
| static std::string | EncodeRememberedChoice (const LoadOptions &options, int zso_version_byte) |
| static std::optional< RememberedChoice > | DecodeRememberedChoice (std::string_view encoded) |
| static std::string | RomChoiceKey (const std::string &rom_path) |
| static void | ApplyToFeatureFlags (const LoadOptions &options, core::FeatureFlags::Flags &flags) |
| static LoadOptions | OptionsFromFeatureFlags (const core::FeatureFlags::Flags &flags) |
Private Member Functions | |
| void | DrawVersionInfo () |
| void | DrawOverworldOptions () |
| void | DrawFeatureFlagPresets () |
| void | DrawFeatureFlagDetails () |
| void | DrawProjectOptions () |
| void | DrawActionButtons () |
| void | ApplyPreset (const std::string &preset_name) |
| void | ApplyOptionsToFeatureFlags () |
Private Attributes | |
| Rom * | rom_ = nullptr |
| std::string | rom_filename_ |
| zelda3::OverworldVersion | detected_version_ |
| bool | is_open_ = false |
| bool | confirmed_ = false |
| bool | show_advanced_ = false |
| bool | reviewing_ = false |
| int | zso_version_byte_ = -1 |
| bool | loaded_custom_overworld_ = false |
| bool | loaded_tail_expansion_ = false |
| LoadOptions | options_ |
| int | selected_preset_index_ = 0 |
| std::function< void(const LoadOptions &) | confirm_callback_ ) |
| std::function< void()> | cancel_callback_ |
| std::function< bool()> | apply_guard_ |
| char | project_name_buffer_ [256] = {} |
| char | project_path_buffer_ [512] = {} |
Static Private Attributes | |
| static constexpr int | kNumPresets = 4 |
| static const char * | kPresetNames [kNumPresets] |
| static const char * | kPresetDescriptions [kNumPresets] |
ROM load options dialog.
Shown after an interactive raw ROM open, and from the command palette to review the options a session uses now. It offers:
It never changes the ROM. ZSCustomOverworld ASM is applied from the Overworld toolbar's Upgrade button.
Definition at line 33 of file rom_load_options_dialog.h.
| yaze::editor::RomLoadOptionsDialog::RomLoadOptionsDialog | ( | ) |
Definition at line 67 of file rom_load_options_dialog.cc.
References options_, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_entrances, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_exits, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_items, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_maps, and yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_sprites.
|
default |
| void yaze::editor::RomLoadOptionsDialog::Open | ( | Rom * | rom, |
| const std::string & | rom_filename ) |
Open the dialog after ROM detection.
| rom | Pointer to loaded ROM for version detection |
| rom_filename | Filename for display and project naming |
Definition at line 92 of file rom_load_options_dialog.cc.
References Open(), and rom_filename().
Referenced by yaze::editor::EditorManager::FinishRawRomOpen(), Open(), Open(), Open(), and OpenForReview().

| void yaze::editor::RomLoadOptionsDialog::Open | ( | Rom * | rom, |
| const std::string & | rom_filename, | ||
| bool | suggest_project_creation ) |
Definition at line 96 of file rom_load_options_dialog.cc.
References ApplyPreset(), confirmed_, yaze::editor::RomLoadOptionsDialog::LoadOptions::create_project, detected_version_, yaze::core::FeatureFlags::get(), yaze::zelda3::OverworldVersionHelper::GetAsmVersion(), yaze::zelda3::OverworldVersionHelper::GetVersion(), yaze::Rom::is_loaded(), is_open_, yaze::core::FeatureFlags::Flags::Overworld::kLoadCustomOverworld, kPresetNames, yaze::zelda3::kVanilla, yaze::zelda3::kZSCustomV1, yaze::zelda3::kZSCustomV2, yaze::zelda3::kZSCustomV3, loaded_custom_overworld_, loaded_tail_expansion_, options_, yaze::core::FeatureFlags::Flags::overworld, project_name_buffer_, reviewing_, rom_, rom_filename(), rom_filename_, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_entrances, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_exits, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_items, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_maps, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_sprites, selected_preset_index_, show_advanced_, and zso_version_byte_.
| void yaze::editor::RomLoadOptionsDialog::Open | ( | Rom * | rom | ) |
Open the dialog with just ROM pointer (filename from ROM)
| rom | Pointer to loaded ROM |
Definition at line 76 of file rom_load_options_dialog.cc.
References yaze::Rom::filename(), and Open().

| void yaze::editor::RomLoadOptionsDialog::Open | ( | Rom * | rom, |
| bool | suggest_project_creation ) |
Definition at line 82 of file rom_load_options_dialog.cc.
References yaze::Rom::filename(), and Open().

| void yaze::editor::RomLoadOptionsDialog::OpenForReview | ( | Rom * | rom, |
| const core::FeatureFlags::Flags & | active, | ||
| const std::string & | preset_name, | ||
| bool | remembered ) |
Reopen the dialog for a ROM that is already loaded.
| active | Feature flags the session uses now (what Save writes) |
| preset_name | Remembered preset to select; empty keeps the default |
| remembered | Whether this ROM file has a remembered choice |
Definition at line 164 of file rom_load_options_dialog.cc.
References yaze::editor::RomLoadOptionsDialog::LoadOptions::create_project, yaze::Rom::filename(), yaze::core::FeatureFlags::Flags::Overworld::kEnableSpecialWorldExpansion, yaze::core::FeatureFlags::Flags::Overworld::kLoadCustomOverworld, kNumPresets, kPresetNames, loaded_custom_overworld_, loaded_tail_expansion_, Open(), options_, OptionsFromFeatureFlags(), yaze::core::FeatureFlags::Flags::overworld, yaze::editor::RomLoadOptionsDialog::LoadOptions::remember_for_rom, reviewing_, selected_preset_index_, and show_advanced_.
Referenced by yaze::editor::EditorManager::ShowRomLoadOptions().

| bool yaze::editor::RomLoadOptionsDialog::Show | ( | bool * | p_open | ) |
Show the dialog.
| p_open | Pointer to open state |
Definition at line 192 of file rom_load_options_dialog.cc.
References cancel_callback_, confirmed_, DrawActionButtons(), DrawFeatureFlagDetails(), DrawFeatureFlagPresets(), DrawOverworldOptions(), DrawProjectOptions(), DrawVersionInfo(), yaze::gui::GetInfoColor(), ICON_MD_SETTINGS, is_open_, reviewing_, and show_advanced_.
Referenced by Draw().
| void yaze::editor::RomLoadOptionsDialog::Draw | ( | bool * | p_open | ) |
Draw the dialog (wrapper around Show)
| p_open | Pointer to open state |
Definition at line 88 of file rom_load_options_dialog.cc.
References Show().
Referenced by yaze::editor::EditorManager::DrawInterface().

|
inline |
Get the selected load options.
Definition at line 114 of file rom_load_options_dialog.h.
References options_.
|
inline |
Check if dialog resulted in confirmation.
Definition at line 119 of file rom_load_options_dialog.h.
References confirmed_.
|
inline |
Reset confirmation state.
Definition at line 124 of file rom_load_options_dialog.h.
References confirmed_.
|
inline |
Set callback for when options are confirmed.
Definition at line 129 of file rom_load_options_dialog.h.
References confirm_callback_.
Referenced by yaze::editor::EditorManager::SetupDialogCallbacks().
|
inline |
Set callback for Cancel or the title-bar close button.
Definition at line 136 of file rom_load_options_dialog.h.
References cancel_callback_.
Referenced by yaze::editor::EditorManager::SetupDialogCallbacks().
|
inline |
Definition at line 141 of file rom_load_options_dialog.h.
References apply_guard_.
Referenced by yaze::editor::EditorManager::SetupDialogCallbacks().
|
inline |
Definition at line 144 of file rom_load_options_dialog.h.
References confirmed_, and is_open_.
Referenced by yaze::editor::EditorManager::CloseRomLoadOptions(), and DrawActionButtons().
|
inline |
Get detected ROM version.
Definition at line 152 of file rom_load_options_dialog.h.
References detected_version_.
|
inline |
Definition at line 156 of file rom_load_options_dialog.h.
References rom_filename_.
Referenced by Open(), Open(), and yaze::editor::EditorManager::SetupDialogCallbacks().
|
inline |
Definition at line 158 of file rom_load_options_dialog.h.
References zso_version_byte_.
Referenced by EncodeRememberedChoice(), and yaze::editor::EditorManager::SetupDialogCallbacks().
|
inline |
Definition at line 160 of file rom_load_options_dialog.h.
References reviewing_.
Referenced by yaze::editor::EditorManager::DrawInterface(), and yaze::editor::EditorManager::SetupDialogCallbacks().
| bool yaze::editor::RomLoadOptionsDialog::OverworldLoadOptionsChanged | ( | ) | const |
Definition at line 649 of file rom_load_options_dialog.cc.
References yaze::editor::RomLoadOptionsDialog::LoadOptions::enable_custom_overworld, yaze::editor::RomLoadOptionsDialog::LoadOptions::enable_tail_expansion, loaded_custom_overworld_, loaded_tail_expansion_, and options_.
Referenced by DrawOverworldOptions().
|
static |
Definition at line 563 of file rom_load_options_dialog.cc.
References yaze::editor::RomLoadOptionsDialog::LoadOptions::selected_preset, and zso_version_byte().
Referenced by yaze::editor::EditorManager::SetupDialogCallbacks().

|
static |
Definition at line 588 of file rom_load_options_dialog.cc.
References yaze::editor::RomLoadOptionsDialog::RememberedChoice::options, yaze::editor::RomLoadOptionsDialog::LoadOptions::selected_preset, and yaze::editor::RomLoadOptionsDialog::RememberedChoice::zso_version_byte.
Referenced by yaze::editor::anonymous_namespace{editor_manager_project_io.cc}::FindRememberedRomLoadChoice().
|
static |
Definition at line 634 of file rom_load_options_dialog.cc.
Referenced by yaze::editor::EditorManager::AnnounceRememberedRomLoadChoice(), yaze::editor::EditorManager::BindRomLoadOptionsToCurrentSession(), yaze::editor::anonymous_namespace{editor_manager_project_io.cc}::FindRememberedRomLoadChoice(), yaze::editor::EditorManager::RomLoadOptionsOwnerMatchesCurrentSession(), and yaze::editor::EditorManager::SetupDialogCallbacks().
|
static |
Definition at line 533 of file rom_load_options_dialog.cc.
References yaze::editor::RomLoadOptionsDialog::LoadOptions::enable_custom_overworld, yaze::editor::RomLoadOptionsDialog::LoadOptions::enable_tail_expansion, yaze::core::FeatureFlags::Flags::Overworld::kEnableSpecialWorldExpansion, yaze::core::FeatureFlags::Flags::Overworld::kLoadCustomOverworld, yaze::core::FeatureFlags::Flags::kSaveAllPalettes, yaze::core::FeatureFlags::Flags::kSaveDungeonMaps, yaze::core::FeatureFlags::Flags::kSaveGfxGroups, yaze::core::FeatureFlags::Flags::Overworld::kSaveOverworldEntrances, yaze::core::FeatureFlags::Flags::Overworld::kSaveOverworldExits, yaze::core::FeatureFlags::Flags::Overworld::kSaveOverworldItems, yaze::core::FeatureFlags::Flags::Overworld::kSaveOverworldMaps, yaze::core::FeatureFlags::Flags::Overworld::kSaveOverworldSprites, yaze::core::FeatureFlags::Flags::overworld, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_all_palettes, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_dungeon_maps, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_gfx_groups, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_entrances, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_exits, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_items, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_maps, and yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_sprites.
Referenced by ApplyOptionsToFeatureFlags(), yaze::editor::EditorManager::ApplyRememberedRomLoadChoice(), and yaze::editor::EditorManager::SetupDialogCallbacks().
|
static |
Definition at line 547 of file rom_load_options_dialog.cc.
References yaze::editor::RomLoadOptionsDialog::LoadOptions::enable_custom_overworld, yaze::editor::RomLoadOptionsDialog::LoadOptions::enable_tail_expansion, yaze::core::FeatureFlags::Flags::Overworld::kEnableSpecialWorldExpansion, yaze::core::FeatureFlags::Flags::Overworld::kLoadCustomOverworld, yaze::core::FeatureFlags::Flags::kSaveAllPalettes, yaze::core::FeatureFlags::Flags::kSaveDungeonMaps, yaze::core::FeatureFlags::Flags::kSaveGfxGroups, yaze::core::FeatureFlags::Flags::Overworld::kSaveOverworldEntrances, yaze::core::FeatureFlags::Flags::Overworld::kSaveOverworldExits, yaze::core::FeatureFlags::Flags::Overworld::kSaveOverworldItems, yaze::core::FeatureFlags::Flags::Overworld::kSaveOverworldMaps, yaze::core::FeatureFlags::Flags::Overworld::kSaveOverworldSprites, yaze::core::FeatureFlags::Flags::overworld, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_all_palettes, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_dungeon_maps, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_gfx_groups, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_entrances, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_exits, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_items, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_maps, and yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_sprites.
Referenced by OpenForReview().
|
private |
Definition at line 252 of file rom_load_options_dialog.cc.
References yaze::gui::ConvertColorToImVec4(), detected_version_, yaze::gui::ThemeManager::Get(), yaze::gui::ThemeManager::GetCurrentTheme(), yaze::gui::GetInfoColor(), yaze::gui::GetSuccessColor(), yaze::gui::GetTextSecondaryVec4(), yaze::zelda3::OverworldVersionHelper::GetVersionName(), yaze::gui::GetWarningColor(), ICON_MD_INFO, ICON_MD_UPGRADE, ICON_MD_VERIFIED, yaze::zelda3::kVanilla, yaze::zelda3::kZSCustomV1, yaze::zelda3::kZSCustomV2, yaze::zelda3::kZSCustomV3, and rom_filename_.
Referenced by Show().
|
private |
Definition at line 295 of file rom_load_options_dialog.cc.
References yaze::editor::RomLoadOptionsDialog::LoadOptions::enable_custom_overworld, yaze::editor::RomLoadOptionsDialog::LoadOptions::enable_tail_expansion, yaze::gui::GetTextSecondaryVec4(), yaze::gui::GetWarningColor(), ICON_MD_AUTO_FIX_HIGH, ICON_MD_INFO, ICON_MD_WARNING, options_, and OverworldLoadOptionsChanged().
Referenced by Show().

|
private |
Definition at line 333 of file rom_load_options_dialog.cc.
References ApplyPreset(), yaze::gui::GetTextSecondaryVec4(), ICON_MD_TUNE, kNumPresets, kPresetDescriptions, kPresetNames, selected_preset_index_, and show_advanced_.
Referenced by Show().

|
private |
Definition at line 370 of file rom_load_options_dialog.cc.
References ICON_MD_FLAG, options_, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_all_palettes, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_dungeon_maps, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_gfx_groups, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_entrances, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_exits, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_items, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_maps, and yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_sprites.
Referenced by Show().
|
private |
Definition at line 398 of file rom_load_options_dialog.cc.
References yaze::editor::RomLoadOptionsDialog::LoadOptions::create_project, yaze::gui::GetTextSecondaryVec4(), ICON_MD_FOLDER, options_, yaze::editor::RomLoadOptionsDialog::LoadOptions::project_name, and project_name_buffer_.
Referenced by Show().

|
private |
Definition at line 422 of file rom_load_options_dialog.cc.
References apply_guard_, ApplyOptionsToFeatureFlags(), Close(), confirm_callback_, confirmed_, yaze::gui::ConvertColorToImVec4(), yaze::gui::ThemeManager::Get(), yaze::gui::ThemeManager::GetCurrentTheme(), ICON_MD_CHECK, is_open_, kPresetNames, options_, yaze::editor::RomLoadOptionsDialog::LoadOptions::remember_for_rom, reviewing_, yaze::editor::RomLoadOptionsDialog::LoadOptions::selected_preset, and selected_preset_index_.
Referenced by Show().
|
private |
Definition at line 485 of file rom_load_options_dialog.cc.
References yaze::editor::RomLoadOptionsDialog::LoadOptions::enable_custom_overworld, options_, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_all_palettes, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_dungeon_maps, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_gfx_groups, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_entrances, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_exits, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_items, yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_maps, and yaze::editor::RomLoadOptionsDialog::LoadOptions::save_overworld_sprites.
Referenced by DrawFeatureFlagPresets(), and Open().
|
private |
Definition at line 529 of file rom_load_options_dialog.cc.
References ApplyToFeatureFlags(), yaze::core::FeatureFlags::get(), and options_.
Referenced by DrawActionButtons().

|
private |
Definition at line 194 of file rom_load_options_dialog.h.
Referenced by Open().
|
private |
Definition at line 195 of file rom_load_options_dialog.h.
Referenced by DrawVersionInfo(), Open(), and rom_filename().
|
private |
Definition at line 196 of file rom_load_options_dialog.h.
Referenced by DrawVersionInfo(), GetDetectedVersion(), and Open().
|
private |
Definition at line 198 of file rom_load_options_dialog.h.
Referenced by Close(), DrawActionButtons(), Open(), and Show().
|
private |
Definition at line 199 of file rom_load_options_dialog.h.
Referenced by Close(), DrawActionButtons(), Open(), ResetConfirmation(), Show(), and WasConfirmed().
|
private |
Definition at line 200 of file rom_load_options_dialog.h.
Referenced by DrawFeatureFlagPresets(), Open(), OpenForReview(), and Show().
|
private |
Definition at line 201 of file rom_load_options_dialog.h.
Referenced by DrawActionButtons(), Open(), OpenForReview(), reviewing(), and Show().
|
private |
Definition at line 202 of file rom_load_options_dialog.h.
Referenced by Open(), and zso_version_byte().
|
private |
Definition at line 204 of file rom_load_options_dialog.h.
Referenced by Open(), OpenForReview(), and OverworldLoadOptionsChanged().
|
private |
Definition at line 205 of file rom_load_options_dialog.h.
Referenced by Open(), OpenForReview(), and OverworldLoadOptionsChanged().
|
private |
Definition at line 208 of file rom_load_options_dialog.h.
Referenced by ApplyOptionsToFeatureFlags(), ApplyPreset(), DrawActionButtons(), DrawFeatureFlagDetails(), DrawOverworldOptions(), DrawProjectOptions(), GetOptions(), Open(), OpenForReview(), OverworldLoadOptionsChanged(), and RomLoadOptionsDialog().
|
staticconstexprprivate |
Definition at line 211 of file rom_load_options_dialog.h.
Referenced by DrawFeatureFlagPresets(), and OpenForReview().
|
staticprivate |
Definition at line 212 of file rom_load_options_dialog.h.
Referenced by DrawActionButtons(), DrawFeatureFlagPresets(), Open(), and OpenForReview().
|
staticprivate |
Definition at line 213 of file rom_load_options_dialog.h.
Referenced by DrawFeatureFlagPresets().
|
private |
Definition at line 214 of file rom_load_options_dialog.h.
Referenced by DrawActionButtons(), DrawFeatureFlagPresets(), Open(), and OpenForReview().
|
private |
Definition at line 217 of file rom_load_options_dialog.h.
Referenced by DrawActionButtons(), and SetConfirmCallback().
|
private |
Definition at line 218 of file rom_load_options_dialog.h.
Referenced by SetCancelCallback(), and Show().
|
private |
Definition at line 219 of file rom_load_options_dialog.h.
Referenced by DrawActionButtons(), and SetApplyGuard().
|
private |
Definition at line 222 of file rom_load_options_dialog.h.
Referenced by DrawProjectOptions(), and Open().
|
private |
Definition at line 223 of file rom_load_options_dialog.h.