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

Generates ASM patches for table-based diggable tile lookup. More...

#include <diggable_tiles_patch.h>

Static Public Member Functions

static std::string GeneratePatch (const DiggableTiles &diggable_tiles, const DiggableTilesPatchConfig &config={})
 Generate ASM patch code for the diggable tiles table.
 
static absl::Status ExportPatchFile (const DiggableTiles &diggable_tiles, const std::string &output_path, const DiggableTilesPatchConfig &config={})
 Export ASM patch to a file.
 
static bool DetectZSDiggingHooks (const Rom &rom)
 Detect if ROM has ZSCustomOverworld modifications to digging code.
 
static DiggableTilesPatchConfig GetRecommendedConfig (const Rom &rom)
 Get recommended patch configuration based on ROM analysis.
 

Static Private Member Functions

static std::string GenerateVanillaRoutine (const DiggableTiles &diggable_tiles, const DiggableTilesPatchConfig &config)
 Generate the vanilla-mode lookup routine ASM.
 
static std::string GenerateZSCompatibleRoutine (const DiggableTiles &diggable_tiles, const DiggableTilesPatchConfig &config)
 Generate the ZS-compatible lookup routine ASM.
 
static std::string GenerateDataTable (const DiggableTiles &diggable_tiles, uint32_t table_address)
 Generate the data table section of the patch.
 

Detailed Description

Generates ASM patches for table-based diggable tile lookup.

Replaces the vanilla hardcoded CMP chain at $1BBDF4 with a bitfield table lookup, allowing dynamic configuration of which Map16 tiles are diggable.

Definition at line 41 of file diggable_tiles_patch.h.

Member Function Documentation

◆ GeneratePatch()

std::string yaze::zelda3::DiggableTilesPatch::GeneratePatch ( const DiggableTiles & diggable_tiles,
const DiggableTilesPatchConfig & config = {} )
static

Generate ASM patch code for the diggable tiles table.

Parameters
diggable_tilesThe diggable tiles bitfield data
configPatch configuration (addresses, mode, etc.)
Returns
ASM patch code as a string

Definition at line 28 of file diggable_tiles_patch.cc.

References GenerateVanillaRoutine(), GenerateZSCompatibleRoutine(), and yaze::zelda3::DiggableTilesPatchConfig::use_zs_compatible_mode.

Referenced by yaze::editor::DrawDiggableTilesEditorPopup(), and ExportPatchFile().

Here is the call graph for this function:

◆ ExportPatchFile()

absl::Status yaze::zelda3::DiggableTilesPatch::ExportPatchFile ( const DiggableTiles & diggable_tiles,
const std::string & output_path,
const DiggableTilesPatchConfig & config = {} )
static

Export ASM patch to a file.

Parameters
diggable_tilesThe diggable tiles bitfield data
output_pathPath to write the .asm file
configPatch configuration
Returns
Status of the file write operation

Definition at line 218 of file diggable_tiles_patch.cc.

References GeneratePatch().

Here is the call graph for this function:

◆ DetectZSDiggingHooks()

bool yaze::zelda3::DiggableTilesPatch::DetectZSDiggingHooks ( const Rom & rom)
static

Detect if ROM has ZSCustomOverworld modifications to digging code.

Checks if the bytes at the hook address differ from vanilla expectations.

Parameters
romThe ROM to check
Returns
true if ZS modifications are detected

Definition at line 241 of file diggable_tiles_patch.cc.

References yaze::Rom::data(), yaze::Rom::is_loaded(), and yaze::Rom::size().

Referenced by GetRecommendedConfig().

Here is the call graph for this function:

◆ GetRecommendedConfig()

DiggableTilesPatchConfig yaze::zelda3::DiggableTilesPatch::GetRecommendedConfig ( const Rom & rom)
static

Get recommended patch configuration based on ROM analysis.

Analyzes the ROM to determine if ZS modifications are present and returns an appropriate configuration.

Parameters
romThe ROM to analyze
Returns
Recommended patch configuration

Definition at line 271 of file diggable_tiles_patch.cc.

References DetectZSDiggingHooks(), yaze::zelda3::DiggableTilesPatchConfig::freespace_address, and yaze::zelda3::DiggableTilesPatchConfig::use_zs_compatible_mode.

Here is the call graph for this function:

◆ GenerateVanillaRoutine()

std::string yaze::zelda3::DiggableTilesPatch::GenerateVanillaRoutine ( const DiggableTiles & diggable_tiles,
const DiggableTilesPatchConfig & config )
staticprivate

◆ GenerateZSCompatibleRoutine()

std::string yaze::zelda3::DiggableTilesPatch::GenerateZSCompatibleRoutine ( const DiggableTiles & diggable_tiles,
const DiggableTilesPatchConfig & config )
staticprivate

◆ GenerateDataTable()

std::string yaze::zelda3::DiggableTilesPatch::GenerateDataTable ( const DiggableTiles & diggable_tiles,
uint32_t table_address )
staticprivate

Generate the data table section of the patch.

Definition at line 174 of file diggable_tiles_patch.cc.

References yaze::zelda3::DiggableTiles::GetAllDiggableTileIds(), and yaze::zelda3::DiggableTiles::GetRawData().

Referenced by GenerateVanillaRoutine(), and GenerateZSCompatibleRoutine().

Here is the call graph for this function:

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