feat: add initial hook parameter with default val
* untested
This commit is contained in:
@@ -76,7 +76,8 @@ absl::Status Script::ApplyPatchToROM(ROM &rom) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
absl::Status Script::GenerateMosaicChangeAssembly(
|
absl::Status Script::GenerateMosaicChangeAssembly(
|
||||||
ROM &rom, char mosaic_tiles[core::kNumOverworldMaps], int routine_offset) {
|
ROM &rom, char mosaic_tiles[core::kNumOverworldMaps], int routine_offset,
|
||||||
|
int hook_offset) {
|
||||||
std::fstream file("assets/asm/mosaic_change.asm",
|
std::fstream file("assets/asm/mosaic_change.asm",
|
||||||
std::ios::out | std::ios::in);
|
std::ios::out | std::ios::in);
|
||||||
if (!file.is_open()) {
|
if (!file.is_open()) {
|
||||||
@@ -89,9 +90,19 @@ absl::Status Script::GenerateMosaicChangeAssembly(
|
|||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
auto assembly_string = assembly.str();
|
auto assembly_string = assembly.str();
|
||||||
if (!string_replace(assembly_string, "<HOOK>", kMosaicChangeOffset)) {
|
|
||||||
return absl::InternalError(
|
if (!hook_offset) {
|
||||||
"Mosaic template did not have proper `<HOOK>` to replace.");
|
// TODO: TESTME
|
||||||
|
if (!string_replace(assembly_string, "<HOOK>",
|
||||||
|
absl::StrFormat("$%06x", hook_offset))) {
|
||||||
|
return absl::InternalError(
|
||||||
|
"Mosaic template did not have proper `<HOOK>` to replace.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!string_replace(assembly_string, "<HOOK>", kMosaicChangeOffset)) {
|
||||||
|
return absl::InternalError(
|
||||||
|
"Mosaic template did not have proper `<HOOK>` to replace.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string_replace(
|
if (!string_replace(
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ class Script {
|
|||||||
Script() { asar_init_with_dll_path("assets/libasar.dll"); }
|
Script() { asar_init_with_dll_path("assets/libasar.dll"); }
|
||||||
|
|
||||||
absl::Status GenerateMosaicChangeAssembly(
|
absl::Status GenerateMosaicChangeAssembly(
|
||||||
ROM& rom, char mosaic_tiles[core::kNumOverworldMaps], int routine_offset);
|
ROM& rom, char mosaic_tiles[core::kNumOverworldMaps], int routine_offset,
|
||||||
|
int hook_offset = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
absl::Status ApplyPatchToROM(ROM& rom);
|
absl::Status ApplyPatchToROM(ROM& rom);
|
||||||
|
|||||||
Reference in New Issue
Block a user