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. | |
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.
|
static |
Generate ASM patch code for the diggable tiles table.
| diggable_tiles | The diggable tiles bitfield data |
| config | Patch configuration (addresses, mode, etc.) |
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().

|
static |
Export ASM patch to a file.
| diggable_tiles | The diggable tiles bitfield data |
| output_path | Path to write the .asm file |
| config | Patch configuration |
Definition at line 218 of file diggable_tiles_patch.cc.
References GeneratePatch().

|
static |
Detect if ROM has ZSCustomOverworld modifications to digging code.
Checks if the bytes at the hook address differ from vanilla expectations.
| rom | The ROM to check |
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().

|
static |
Get recommended patch configuration based on ROM analysis.
Analyzes the ROM to determine if ZS modifications are present and returns an appropriate configuration.
| rom | The ROM to analyze |
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.

|
staticprivate |
Generate the vanilla-mode lookup routine ASM.
Definition at line 53 of file diggable_tiles_patch.cc.
References yaze::zelda3::DiggableTilesPatchConfig::diggable_handler, yaze::zelda3::DiggableTilesPatchConfig::exit_address, yaze::zelda3::DiggableTilesPatchConfig::freespace_address, GenerateDataTable(), yaze::zelda3::DiggableTilesPatchConfig::hook_address, and yaze::zelda3::DiggableTilesPatchConfig::table_address.
Referenced by GeneratePatch().

|
staticprivate |
Generate the ZS-compatible lookup routine ASM.
Definition at line 122 of file diggable_tiles_patch.cc.
References yaze::zelda3::DiggableTilesPatchConfig::diggable_handler, yaze::zelda3::DiggableTilesPatchConfig::exit_address, yaze::zelda3::DiggableTilesPatchConfig::freespace_address, GenerateDataTable(), and yaze::zelda3::DiggableTilesPatchConfig::table_address.
Referenced by GeneratePatch().

|
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().
