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

Helper for ROM version detection and feature gating. More...

#include <overworld_version_helper.h>

Static Public Member Functions

static OverworldVersion GetVersion (const Rom &rom)
 Detect ROM version from ASM marker byte.
 
static uint8_t GetAsmVersion (const Rom &rom)
 Get raw ASM version byte from ROM.
 
static bool SupportsAreaEnum (OverworldVersion version)
 Check if ROM supports area enum system (v3+ only)
 
static bool SupportsExpandedSpace (OverworldVersion version)
 Check if ROM uses expanded ROM space for overworld data.
 
static bool SupportsCustomBGColors (OverworldVersion version)
 Check if ROM supports custom background colors per area (v2+)
 
static bool SupportsCustomTileGFX (OverworldVersion version)
 Check if ROM supports custom tile GFX groups (v3+)
 
static bool SupportsAnimatedGFX (OverworldVersion version)
 Check if ROM supports animated GFX selection (v3+)
 
static bool SupportsSubscreenOverlay (OverworldVersion version)
 Check if ROM supports subscreen overlays (v3+)
 
static const char * GetVersionName (OverworldVersion version)
 Get human-readable version name for display/logging.
 

Detailed Description

Helper for ROM version detection and feature gating.

Provides consistent version checking across the codebase to replace scattered inline checks like:

if (asm_version >= 3 && asm_version != 0xFF) { ... }

With semantic helpers:

static OverworldVersion GetVersion(const Rom &rom)
Detect ROM version from ASM marker byte.
static bool SupportsAreaEnum(OverworldVersion version)
Check if ROM supports area enum system (v3+ only)

USAGE EXAMPLES:

// Check if ROM supports custom background colors
auto version = OverworldVersionHelper::GetVersion(*rom_);
// Enable BG color editing UI
DrawBGColorEditor(current_map);
}
// Log version for debugging
LOG_DEBUG("ROM Version: %s", GetVersionName(version));
// Conditional feature loading
if (SupportsAreaEnum(version)) {
AssignMapSizes(overworld_maps_); // v3 area enum system
} else {
FetchLargeMaps(); // Legacy parent system
}
static bool SupportsCustomBGColors(OverworldVersion version)
Check if ROM supports custom background colors per area (v2+)
static const char * GetVersionName(OverworldVersion version)
Get human-readable version name for display/logging.
#define LOG_DEBUG(category, format,...)
Definition log.h:103

FEATURE MATRIX:

Feature Vanilla v1 v2 v3
Expanded Pointers No Yes Yes Yes
Custom BG Colors No No Yes Yes
Main Palette Select No No Yes Yes
Area Size Enum No No No Yes
Wide/Tall Areas No No No Yes
Custom Tile GFX No No No Yes
Animated GFX No No No Yes
Subscreen Overlays No No No Yes
Mosaic Effect No No No Yes

Definition at line 140 of file overworld_version_helper.h.

Member Function Documentation

◆ GetVersion()

static OverworldVersion yaze::zelda3::OverworldVersionHelper::GetVersion ( const Rom & rom)
inlinestatic

Detect ROM version from ASM marker byte.

Parameters
romROM to check
Returns
Detected overworld version enum

Reads the version marker at OverworldCustomASMHasBeenApplied (0x140145). Returns kVanilla for unpatched ROMs (marker = 0xFF or 0x00).

Definition at line 154 of file overworld_version_helper.h.

References yaze::Rom::data(), yaze::zelda3::kVanilla, yaze::zelda3::kZSCustomV1, yaze::zelda3::kZSCustomV2, yaze::zelda3::kZSCustomV3, yaze::zelda3::OverworldCustomASMHasBeenApplied, and yaze::Rom::size().

Referenced by yaze::zelda3::Overworld::AssembleMap16Tiles(), yaze::zelda3::Overworld::AssembleMap32Tiles(), yaze::zelda3::OverworldMap::BuildMapWithCache(), yaze::editor::OverworldEditor::CheckForCurrentMap(), yaze::zelda3::Overworld::ConfigureMultiAreaMap(), yaze::editor::OverworldToolbar::Draw(), yaze::editor::MapPropertiesSystem::DrawCanvasToolbar(), yaze::editor::OverworldSidebar::DrawConfiguration(), yaze::editor::MapPropertiesSystem::DrawCustomBackgroundColorEditor(), yaze::editor::MapPropertiesSystem::DrawCustomFeaturesTab(), yaze::editor::MapPropertiesSystem::DrawGraphicsPopup(), yaze::editor::OverworldSidebar::DrawGraphicsSettings(), yaze::editor::MapPropertiesSystem::DrawMapPropertiesPanel(), yaze::editor::MapPropertiesSystem::DrawMosaicControls(), yaze::editor::MapPropertiesSystem::DrawOverlayControls(), yaze::editor::MapPropertiesSystem::DrawOverlayEditor(), yaze::editor::OverworldSidebar::DrawPaletteSettings(), yaze::editor::MapPropertiesSystem::DrawPalettesPopup(), yaze::editor::MapPropertiesSystem::DrawTileGraphicsTab(), yaze::gui::FlagsMenu::DrawZSCustomOverworldFlags(), yaze::zelda3::Overworld::EnsureMapBuilt(), yaze::zelda3::Overworld::InvalidateSiblingMapCaches(), yaze::zelda3::Overworld::Load(), yaze::zelda3::OverworldMap::LoadAreaGraphics(), yaze::zelda3::OverworldMap::LoadAreaInfo(), yaze::zelda3::LoadItems(), yaze::zelda3::OverworldMap::LoadOverlay(), yaze::zelda3::OverworldMap::LoadPalette(), yaze::zelda3::Overworld::LoadSprites(), yaze::editor::RomLoadOptionsDialog::Open(), yaze::zelda3::OverworldMap::OverworldMap(), yaze::editor::OverworldEditor::RefreshChildMapOnDemand(), yaze::editor::OverworldEditor::RefreshMapPalette(), yaze::editor::OverworldEditor::RefreshMapProperties(), yaze::zelda3::Overworld::SaveAreaSpecificBGColors(), yaze::zelda3::Overworld::SaveCustomOverworldASM(), yaze::zelda3::Overworld::SaveDiggableTiles(), yaze::zelda3::Overworld::SaveLargeMaps(), yaze::editor::MapPropertiesSystem::SetupCanvasContextMenu(), and yaze::zelda3::OverworldMap::SetupCustomTileset().

Here is the call graph for this function:

◆ GetAsmVersion()

static uint8_t yaze::zelda3::OverworldVersionHelper::GetAsmVersion ( const Rom & rom)
inlinestatic

Get raw ASM version byte from ROM.

Parameters
romROM to check
Returns
Raw version byte (0x01, 0x02, 0x03, or 0xFF for vanilla)

Definition at line 184 of file overworld_version_helper.h.

References yaze::Rom::data(), and yaze::zelda3::OverworldCustomASMHasBeenApplied.

Referenced by yaze::zelda3::OverworldMap::OverworldMap().

Here is the call graph for this function:

◆ SupportsAreaEnum()

static bool yaze::zelda3::OverworldVersionHelper::SupportsAreaEnum ( OverworldVersion version)
inlinestatic

Check if ROM supports area enum system (v3+ only)

Parameters
versionDetected ROM version
Returns
true if v3+

The area enum system (v3+) replaces the simple large_map_ boolean with an AreaSizeEnum that supports:

  • SmallArea (1x1): Standard single screen
  • LargeArea (2x2): Four screens (classic Link to the Past large areas)
  • WideArea (2x1): Two horizontal screens (v3 only)
  • TallArea (1x2): Two vertical screens (v3 only)

Vanilla/v1/v2 ROMs use the legacy parent system with only large_map_ flag. When this returns false, use FetchLargeMaps() instead of AssignMapSizes().

Definition at line 207 of file overworld_version_helper.h.

References yaze::zelda3::kZSCustomV3.

Referenced by yaze::zelda3::Overworld::AssembleMap16Tiles(), yaze::zelda3::Overworld::AssembleMap32Tiles(), yaze::editor::OverworldEditor::CheckForCurrentMap(), yaze::zelda3::Overworld::ConfigureMultiAreaMap(), yaze::editor::OverworldToolbar::Draw(), yaze::editor::MapPropertiesSystem::DrawCanvasToolbar(), yaze::editor::OverworldSidebar::DrawConfiguration(), yaze::editor::MapPropertiesSystem::DrawCustomFeaturesTab(), yaze::editor::MapPropertiesSystem::DrawOverlayControls(), yaze::zelda3::Overworld::InvalidateSiblingMapCaches(), yaze::zelda3::Overworld::Load(), yaze::zelda3::LoadItems(), yaze::zelda3::OverworldMap::LoadPalette(), yaze::zelda3::Overworld::LoadSprites(), yaze::editor::OverworldEditor::RefreshChildMapOnDemand(), yaze::editor::OverworldEditor::RefreshMapPalette(), yaze::editor::OverworldEditor::RefreshMapProperties(), yaze::zelda3::Overworld::SaveCustomOverworldASM(), yaze::zelda3::Overworld::SaveDiggableTiles(), yaze::zelda3::Overworld::SaveLargeMaps(), yaze::editor::MapPropertiesSystem::SetupCanvasContextMenu(), and yaze::zelda3::OverworldMap::SetupCustomTileset().

◆ SupportsExpandedSpace()

static bool yaze::zelda3::OverworldVersionHelper::SupportsExpandedSpace ( OverworldVersion version)
inlinestatic

Check if ROM uses expanded ROM space for overworld data.

Parameters
versionDetected ROM version
Returns
true if v1+

v1+ ROMs use expanded pointers to store data beyond vanilla limits:

  • Map data overflow: 0x130000+
  • Sprite data: 0x141438+
  • Message IDs: 0x1417F8+
  • Parent IDs: 0x140998+

Vanilla ROMs store all data within original game space.

Definition at line 224 of file overworld_version_helper.h.

References yaze::zelda3::kVanilla.

Referenced by yaze::zelda3::Overworld::ConfigureMultiAreaMap(), yaze::editor::MapPropertiesSystem::DrawGraphicsPopup(), yaze::editor::OverworldSidebar::DrawGraphicsSettings(), and yaze::editor::MapPropertiesSystem::DrawTileGraphicsTab().

◆ SupportsCustomBGColors()

static bool yaze::zelda3::OverworldVersionHelper::SupportsCustomBGColors ( OverworldVersion version)
inlinestatic

Check if ROM supports custom background colors per area (v2+)

Parameters
versionDetected ROM version
Returns
true if v2+

v2+ enables per-area background color customization stored at:

  • Color data: OverworldCustomAreaSpecificBGPalette (0x140000)
  • Enable flag: OverworldCustomAreaSpecificBGEnabled (0x140140)

When supported, each overworld area can have a unique BG color.

Definition at line 239 of file overworld_version_helper.h.

References yaze::zelda3::kZSCustomV2, and yaze::zelda3::kZSCustomV3.

Referenced by yaze::editor::OverworldSidebar::DrawConfiguration(), yaze::editor::MapPropertiesSystem::DrawCustomBackgroundColorEditor(), yaze::editor::MapPropertiesSystem::DrawCustomFeaturesTab(), yaze::editor::MapPropertiesSystem::DrawMosaicControls(), yaze::editor::OverworldSidebar::DrawPaletteSettings(), yaze::editor::MapPropertiesSystem::DrawPalettesPopup(), yaze::gui::FlagsMenu::DrawZSCustomOverworldFlags(), yaze::zelda3::OverworldMap::LoadPalette(), yaze::zelda3::Overworld::SaveAreaSpecificBGColors(), and yaze::zelda3::Overworld::SaveCustomOverworldASM().

◆ SupportsCustomTileGFX()

static bool yaze::zelda3::OverworldVersionHelper::SupportsCustomTileGFX ( OverworldVersion version)
inlinestatic

Check if ROM supports custom tile GFX groups (v3+)

Parameters
versionDetected ROM version
Returns
true if v3+

v3 enables per-area tile graphics group customization stored at:

  • Group data: OverworldCustomTileGFXGroupArray (0x140480)
  • Enable flag: OverworldCustomTileGFXGroupEnabled (0x140148)

Each area can use a different set of 8 graphics sheets.

Definition at line 255 of file overworld_version_helper.h.

References yaze::zelda3::kZSCustomV3.

Referenced by yaze::zelda3::OverworldMap::LoadAreaGraphics().

◆ SupportsAnimatedGFX()

static bool yaze::zelda3::OverworldVersionHelper::SupportsAnimatedGFX ( OverworldVersion version)
inlinestatic

Check if ROM supports animated GFX selection (v3+)

Parameters
versionDetected ROM version
Returns
true if v3+

v3 enables per-area animated graphics customization stored at:

  • Anim data: OverworldCustomAnimatedGFXArray (0x1402A0)
  • Enable flag: OverworldCustomAnimatedGFXEnabled (0x140143)

Controls which animated tile set (waterfalls, flowers, etc.) to use.

Definition at line 270 of file overworld_version_helper.h.

References yaze::zelda3::kZSCustomV3.

Referenced by yaze::editor::MapPropertiesSystem::DrawCustomFeaturesTab(), yaze::editor::MapPropertiesSystem::DrawGraphicsPopup(), and yaze::editor::OverworldSidebar::DrawGraphicsSettings().

◆ SupportsSubscreenOverlay()

static bool yaze::zelda3::OverworldVersionHelper::SupportsSubscreenOverlay ( OverworldVersion version)
inlinestatic

Check if ROM supports subscreen overlays (v3+)

Parameters
versionDetected ROM version
Returns
true if v3+

v3 enables per-area subscreen overlay customization stored at:

  • Overlay data: OverworldCustomSubscreenOverlayArray (0x140340)
  • Enable flag: OverworldCustomSubscreenOverlayEnabled (0x140144)

Overlays provide additional visual layers (rain, fog, etc.).

Definition at line 285 of file overworld_version_helper.h.

References yaze::zelda3::kZSCustomV3.

◆ GetVersionName()

static const char * yaze::zelda3::OverworldVersionHelper::GetVersionName ( OverworldVersion version)
inlinestatic

Get human-readable version name for display/logging.

Parameters
versionDetected ROM version
Returns
Version name string (e.g., "ZSCustomOverworld v3")

Definition at line 298 of file overworld_version_helper.h.

References yaze::zelda3::kVanilla, yaze::zelda3::kZSCustomV1, yaze::zelda3::kZSCustomV2, and yaze::zelda3::kZSCustomV3.

Referenced by yaze::zelda3::Overworld::ConfigureMultiAreaMap(), yaze::editor::MapPropertiesSystem::DrawOverlayControls(), yaze::editor::RomLoadOptionsDialog::DrawUpgradeOptions(), and yaze::editor::RomLoadOptionsDialog::DrawVersionInfo().


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