yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::RomLoadOptionsDialog Class Reference

ROM load options and ZSCustomOverworld upgrade dialog. More...

#include <rom_load_options_dialog.h>

Collaboration diagram for yaze::editor::RomLoadOptionsDialog:

Classes

struct  LoadOptions
 

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)
 Open the dialog with just ROM pointer (filename from ROM)
 
bool Show (bool *p_open)
 Show the dialog.
 
void Draw (bool *p_open)
 Draw the dialog (wrapper around Show)
 
const LoadOptionsGetOptions () 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 SetUpgradeCallback (std::function< absl::Status(int version)> callback)
 Set callback for ZSO upgrade.
 
bool ShouldPromptUpgrade () const
 Check if ROM needs upgrade prompt.
 
zelda3::OverworldVersion GetDetectedVersion () const
 Get detected ROM version.
 

Private Member Functions

void DrawVersionInfo ()
 
void DrawUpgradeOptions ()
 
void DrawFeatureFlagPresets ()
 
void DrawFeatureFlagDetails ()
 
void DrawProjectOptions ()
 
void DrawActionButtons ()
 
void ApplyPreset (const std::string &preset_name)
 
void ApplyOptionsToFeatureFlags ()
 

Private Attributes

Romrom_ = nullptr
 
std::string rom_filename_
 
zelda3::OverworldVersion detected_version_ = zelda3::OverworldVersion::kVanilla
 
bool is_open_ = false
 
bool confirmed_ = false
 
bool show_advanced_ = false
 
LoadOptions options_
 
int selected_preset_index_ = 0
 
std::function< void(const LoadOptions &) confirm_callback_ )
 
std::function< absl::Status(int version)> upgrade_callback_
 
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]
 

Detailed Description

ROM load options and ZSCustomOverworld upgrade dialog.

Shown after ROM detection to offer:

  • ZSCustomOverworld version upgrade options
  • Feature flag presets
  • Project creation integration

Flow:

  1. ROM loaded -> Detect version
  2. If vanilla, offer upgrade to v2/v3
  3. Show feature flag presets based on version
  4. Optionally create associated project

Definition at line 32 of file rom_load_options_dialog.h.

Constructor & Destructor Documentation

◆ RomLoadOptionsDialog()

◆ ~RomLoadOptionsDialog()

yaze::editor::RomLoadOptionsDialog::~RomLoadOptionsDialog ( )
default

Member Function Documentation

◆ Open() [1/2]

void yaze::editor::RomLoadOptionsDialog::Open ( Rom * rom,
const std::string & rom_filename )

◆ Open() [2/2]

void yaze::editor::RomLoadOptionsDialog::Open ( Rom * rom)

Open the dialog with just ROM pointer (filename from ROM)

Parameters
romPointer to loaded ROM

Definition at line 36 of file rom_load_options_dialog.cc.

References yaze::Rom::filename(), and Open().

Here is the call graph for this function:

◆ Show()

bool yaze::editor::RomLoadOptionsDialog::Show ( bool * p_open)

Show the dialog.

Parameters
p_openPointer to open state
Returns
True if user confirmed options

Definition at line 94 of file rom_load_options_dialog.cc.

References confirmed_, DrawActionButtons(), DrawFeatureFlagDetails(), DrawFeatureFlagPresets(), DrawProjectOptions(), DrawUpgradeOptions(), DrawVersionInfo(), ICON_MD_SETTINGS, is_open_, and show_advanced_.

Referenced by Draw().

◆ Draw()

void yaze::editor::RomLoadOptionsDialog::Draw ( bool * p_open)

Draw the dialog (wrapper around Show)

Parameters
p_openPointer to open state

Definition at line 42 of file rom_load_options_dialog.cc.

References Show().

Referenced by yaze::editor::EditorManager::Update().

Here is the call graph for this function:

◆ GetOptions()

const LoadOptions & yaze::editor::RomLoadOptionsDialog::GetOptions ( ) const
inline

Get the selected load options.

Definition at line 91 of file rom_load_options_dialog.h.

References options_.

◆ WasConfirmed()

bool yaze::editor::RomLoadOptionsDialog::WasConfirmed ( ) const
inline

Check if dialog resulted in confirmation.

Definition at line 96 of file rom_load_options_dialog.h.

References confirmed_.

◆ ResetConfirmation()

void yaze::editor::RomLoadOptionsDialog::ResetConfirmation ( )
inline

Reset confirmation state.

Definition at line 101 of file rom_load_options_dialog.h.

References confirmed_.

◆ SetConfirmCallback()

void yaze::editor::RomLoadOptionsDialog::SetConfirmCallback ( std::function< void(const LoadOptions &)> callback)
inline

Set callback for when options are confirmed.

Definition at line 106 of file rom_load_options_dialog.h.

References confirm_callback_.

Referenced by yaze::editor::EditorManager::Initialize().

◆ SetUpgradeCallback()

void yaze::editor::RomLoadOptionsDialog::SetUpgradeCallback ( std::function< absl::Status(int version)> callback)
inline

Set callback for ZSO upgrade.

Definition at line 113 of file rom_load_options_dialog.h.

References upgrade_callback_.

◆ ShouldPromptUpgrade()

bool yaze::editor::RomLoadOptionsDialog::ShouldPromptUpgrade ( ) const

Check if ROM needs upgrade prompt.

Definition at line 443 of file rom_load_options_dialog.cc.

References detected_version_, and yaze::zelda3::kVanilla.

◆ GetDetectedVersion()

zelda3::OverworldVersion yaze::editor::RomLoadOptionsDialog::GetDetectedVersion ( ) const
inline

Get detected ROM version.

Definition at line 125 of file rom_load_options_dialog.h.

References detected_version_.

◆ DrawVersionInfo()

◆ DrawUpgradeOptions()

◆ DrawFeatureFlagPresets()

void yaze::editor::RomLoadOptionsDialog::DrawFeatureFlagPresets ( )
private

Definition at line 244 of file rom_load_options_dialog.cc.

References ApplyPreset(), ICON_MD_TUNE, kNumPresets, kPresetDescriptions, kPresetNames, selected_preset_index_, and show_advanced_.

Referenced by Show().

Here is the call graph for this function:

◆ DrawFeatureFlagDetails()

◆ DrawProjectOptions()

void yaze::editor::RomLoadOptionsDialog::DrawProjectOptions ( )
private

◆ DrawActionButtons()

◆ ApplyPreset()

◆ ApplyOptionsToFeatureFlags()

Member Data Documentation

◆ rom_

Rom* yaze::editor::RomLoadOptionsDialog::rom_ = nullptr
private

Definition at line 139 of file rom_load_options_dialog.h.

Referenced by Open().

◆ rom_filename_

std::string yaze::editor::RomLoadOptionsDialog::rom_filename_
private

Definition at line 140 of file rom_load_options_dialog.h.

Referenced by DrawVersionInfo(), and Open().

◆ detected_version_

zelda3::OverworldVersion yaze::editor::RomLoadOptionsDialog::detected_version_ = zelda3::OverworldVersion::kVanilla
private

◆ is_open_

bool yaze::editor::RomLoadOptionsDialog::is_open_ = false
private

Definition at line 142 of file rom_load_options_dialog.h.

Referenced by DrawActionButtons(), Open(), and Show().

◆ confirmed_

bool yaze::editor::RomLoadOptionsDialog::confirmed_ = false
private

◆ show_advanced_

bool yaze::editor::RomLoadOptionsDialog::show_advanced_ = false
private

Definition at line 144 of file rom_load_options_dialog.h.

Referenced by DrawFeatureFlagPresets(), and Show().

◆ options_

◆ kNumPresets

constexpr int yaze::editor::RomLoadOptionsDialog::kNumPresets = 4
staticconstexprprivate

Definition at line 150 of file rom_load_options_dialog.h.

Referenced by DrawFeatureFlagPresets().

◆ kPresetNames

const char * yaze::editor::RomLoadOptionsDialog::kPresetNames
staticprivate
Initial value:
= {
"Vanilla ROM Hack",
"ZSCustomOverworld v2",
"ZSCustomOverworld v3 (Recommended)",
"Randomizer Compatible"
}

Definition at line 151 of file rom_load_options_dialog.h.

Referenced by DrawActionButtons(), DrawFeatureFlagPresets(), and Open().

◆ kPresetDescriptions

const char * yaze::editor::RomLoadOptionsDialog::kPresetDescriptions
staticprivate
Initial value:
= {
"Standard ROM editing without custom ASM. Limited to vanilla features.",
"Basic overworld expansion: custom BG colors, main palettes, parent system.",
"Full overworld expansion: wide/tall areas, animated GFX, overlays, all features.",
"Compatible with ALttP Randomizer. Minimal custom features."
}

Definition at line 152 of file rom_load_options_dialog.h.

Referenced by DrawFeatureFlagPresets().

◆ selected_preset_index_

int yaze::editor::RomLoadOptionsDialog::selected_preset_index_ = 0
private

Definition at line 153 of file rom_load_options_dialog.h.

Referenced by DrawActionButtons(), DrawFeatureFlagPresets(), and Open().

◆ confirm_callback_

std::function<void(const LoadOptions&) yaze::editor::RomLoadOptionsDialog::confirm_callback_)
private

Definition at line 156 of file rom_load_options_dialog.h.

Referenced by DrawActionButtons(), and SetConfirmCallback().

◆ upgrade_callback_

std::function<absl::Status(int version)> yaze::editor::RomLoadOptionsDialog::upgrade_callback_
private

Definition at line 157 of file rom_load_options_dialog.h.

Referenced by DrawActionButtons(), and SetUpgradeCallback().

◆ project_name_buffer_

char yaze::editor::RomLoadOptionsDialog::project_name_buffer_[256] = {}
private

Definition at line 160 of file rom_load_options_dialog.h.

Referenced by DrawProjectOptions(), and Open().

◆ project_path_buffer_

char yaze::editor::RomLoadOptionsDialog::project_path_buffer_[512] = {}
private

Definition at line 161 of file rom_load_options_dialog.h.


The documentation for this class was generated from the following files: