mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Allow alternate labels for patch names
This commit is contained in:
parent
31c3c94d64
commit
f33a041930
43
Makefile
43
Makefile
@ -1,27 +1,28 @@
|
|||||||
roms := pokecrystal.gbc \
|
roms := \
|
||||||
pokecrystal11.gbc \
|
pokecrystal.gbc \
|
||||||
pokecrystal_au.gbc \
|
pokecrystal11.gbc \
|
||||||
pokecrystal_debug.gbc \
|
pokecrystal_au.gbc \
|
||||||
pokecrystal11_debug.gbc
|
pokecrystal_debug.gbc \
|
||||||
|
pokecrystal11_debug.gbc
|
||||||
patches := pokecrystal11.patch
|
patches := pokecrystal11.patch
|
||||||
|
|
||||||
rom_obj := \
|
rom_obj := \
|
||||||
audio.o \
|
audio.o \
|
||||||
home.o \
|
home.o \
|
||||||
main.o \
|
main.o \
|
||||||
wram.o \
|
wram.o \
|
||||||
data/text/common.o \
|
data/text/common.o \
|
||||||
data/maps/map_data.o \
|
data/maps/map_data.o \
|
||||||
data/pokemon/dex_entries.o \
|
data/pokemon/dex_entries.o \
|
||||||
data/pokemon/egg_moves.o \
|
data/pokemon/egg_moves.o \
|
||||||
data/pokemon/evos_attacks.o \
|
data/pokemon/evos_attacks.o \
|
||||||
engine/movie/credits.o \
|
engine/movie/credits.o \
|
||||||
engine/overworld/events.o \
|
engine/overworld/events.o \
|
||||||
gfx/misc.o \
|
gfx/misc.o \
|
||||||
gfx/pics.o \
|
gfx/pics.o \
|
||||||
gfx/sprites.o \
|
gfx/sprites.o \
|
||||||
gfx/tilesets.o \
|
gfx/tilesets.o \
|
||||||
lib/mobile/main.o
|
lib/mobile/main.o
|
||||||
|
|
||||||
pokecrystal_obj := $(rom_obj:.o=.o)
|
pokecrystal_obj := $(rom_obj:.o=.o)
|
||||||
pokecrystal11_obj := $(rom_obj:.o=11.o)
|
pokecrystal11_obj := $(rom_obj:.o=11.o)
|
||||||
|
@ -46,11 +46,11 @@ tools/make_patch pokecrystal11_vc.sym vc/pokecrystal11.constants.sym pokecrystal
|
|||||||
|
|
||||||
## Patch types
|
## Patch types
|
||||||
|
|
||||||
**Hooks** do not directly modify the ROM; they just identify locations within the ROM code. When the emulated code execution reaches a hook, the emulator performs an emulation function. For example, the `BiographySave_ret` hook is located after the code to add a new Hall of Fame entry, and causes the emulator to edit the save file to enable the GS Ball event.
|
**Hooks** do not directly modify the ROM; they just identify locations within the ROM code. When the emulated code execution reaches a hook, the emulator performs an emulation function. For example, the `Enable_GS_Ball_mobile_event` hook is located after the code to add a new Hall of Fame entry, and causes the emulator to edit the save file to enable the GS Ball event.
|
||||||
|
|
||||||
Hooks are defined with the `vc_hook` macro, which defines a label starting with "`.VC_`" for the patch template file to use.
|
Hooks are defined with the `vc_hook` macro, which defines a label starting with "`.VC_`" for the patch template file to use.
|
||||||
|
|
||||||
**Patches** directly modify the contents of the ROM. This is done before emulation begins. For example, the `print forbid 1` patch modifies an "`and A_BUTTON`" instruction to "`and 0`", so pressing A will not print Unown on the Game Boy Printer.
|
**Patches** directly modify the contents of the ROM. This is done before emulation begins. For example, the `print_forbid_1` patch modifies an "`and A_BUTTON`" instruction to "`and 0`", so pressing A will not print Unown on the Game Boy Printer.
|
||||||
|
|
||||||
Patches are defined with the `vc_patch` and `vc_patch_end` macros; `vc_patch` defines a label starting with "`.VC_`", `vc_patch_end` defines a corresponding label with "`_End`" appended. Between these two macros, the code or data is conditionally different depending on whether or not a patch file is being built.
|
Patches are defined with the `vc_patch` and `vc_patch_end` macros; `vc_patch` defines a label starting with "`.VC_`", `vc_patch_end` defines a corresponding label with "`_End`" appended. Between these two macros, the code or data is conditionally different depending on whether or not a patch file is being built.
|
||||||
|
|
||||||
@ -63,7 +63,9 @@ The sole purpose of creating `pokecrystal11_vc.gbc` and `pokecrystal11_vc.sym` i
|
|||||||
|
|
||||||
**Patch names** are contained in "`[`" brackets "`]`". They are output as-is, without interpreting commands.
|
**Patch names** are contained in "`[`" brackets "`]`". They are output as-is, without interpreting commands.
|
||||||
|
|
||||||
Patch names also set the **current patch label**. This is the label starting with "`.VC_`" followed by the patch name, with any invalid characters (not letters "`A-Z`", digits "`0-9`", underscore "`_`", at sign "`@`", or hash "`#`") converted to underscores "`_`". These labels are conditionally defined only when building the patch file with the `vc_hook` and `vc_patch` macros. For example, the patch name "`[fight begin]`" corresponds to the patch label "`.VC_fight_begin`", generated by the "`vc_hook fight_begin`" macro.
|
Patch names also set the **current patch label**. This is the label starting with "`.VC_`" followed by the patch name, with any invalid characters (not letters "`A-Z`", digits "`0-9`", or underscore "`_`") converted to underscores "`_`". These labels are conditionally defined only when building the patch file with the `vc_hook` and `vc_patch` macros. For example, the patch name "`[fight begin]`" corresponds to the patch label "`.VC_fight_begin`", generated by the "`vc_hook fight_begin`" macro.
|
||||||
|
|
||||||
|
Patch names may designate an alternate for the label with an at-sign "`@`". This allows the label in the assembly source to have a more descriptive name, while still reproducing the original `.patch` file. For example, the patch name "`[BiographySave_ret@Enable_GS_Ball_mobile_event]`" corresponds to the label "`.VC_Enable_GS_Ball_mobile_event`" but is output as "`[BiographySave_ret]`".
|
||||||
|
|
||||||
**Commands** are contained in "`{`" braces "`}`". They are not output themselves, but may produce their own output when interpreted.
|
**Commands** are contained in "`{`" braces "`}`". They are not output themselves, but may produce their own output when interpreted.
|
||||||
|
|
||||||
|
@ -58,20 +58,14 @@ BattleAnimRunScript:
|
|||||||
farcall CheckBattleScene
|
farcall CheckBattleScene
|
||||||
jr c, .disabled
|
jr c, .disabled
|
||||||
|
|
||||||
vc_hook FPA_001_Begin
|
vc_hook Reduce_move_anim_flashing
|
||||||
vc_hook FPA_002_Begin
|
|
||||||
vc_hook FPA_003_Begin
|
|
||||||
vc_hook FPA_004_Begin
|
|
||||||
vc_hook FPA_005_Begin
|
|
||||||
vc_hook FPA_006_Begin
|
|
||||||
vc_hook FPA_007_Begin
|
|
||||||
call BattleAnimClearHud
|
call BattleAnimClearHud
|
||||||
call RunBattleAnimScript
|
call RunBattleAnimScript
|
||||||
|
|
||||||
call BattleAnimAssignPals
|
call BattleAnimAssignPals
|
||||||
call BattleAnimRequestPals
|
call BattleAnimRequestPals
|
||||||
|
|
||||||
vc_hook FPA_001_End
|
vc_hook Stop_reducing_move_anim_flashing
|
||||||
xor a
|
xor a
|
||||||
ldh [hSCX], a
|
ldh [hSCX], a
|
||||||
ldh [hSCY], a
|
ldh [hSCY], a
|
||||||
|
@ -165,7 +165,7 @@ AddHallOfFameEntry:
|
|||||||
; to MOBILE_EVENT_OBJECT_GS_BALL ($b), which enables you to get the GS Ball, take it to Kurt, and
|
; to MOBILE_EVENT_OBJECT_GS_BALL ($b), which enables you to get the GS Ball, take it to Kurt, and
|
||||||
; encounter Celebi. It assumes that sMobileEventIndex and sMobileEventIndexBackup are at their
|
; encounter Celebi. It assumes that sMobileEventIndex and sMobileEventIndexBackup are at their
|
||||||
; original addresses.
|
; original addresses.
|
||||||
vc_hook BiographySave_ret
|
vc_hook Enable_GS_Ball_mobile_event
|
||||||
vc_assert BANK(sMobileEventIndex) == $1 && sMobileEventIndex == $be3c, \
|
vc_assert BANK(sMobileEventIndex) == $1 && sMobileEventIndex == $be3c, \
|
||||||
"sMobileEventIndex is no longer located at 01:be3c."
|
"sMobileEventIndex is no longer located at 01:be3c."
|
||||||
vc_assert BANK(sMobileEventIndexBackup) == $1 && sMobileEventIndexBackup == $be44, \
|
vc_assert BANK(sMobileEventIndexBackup) == $1 && sMobileEventIndexBackup == $be44, \
|
||||||
|
@ -344,16 +344,26 @@ struct Buffer *process_template(const char *template_filename, const char *patch
|
|||||||
case '[':
|
case '[':
|
||||||
// "[...]" is a patch label; buffer its contents
|
// "[...]" is a patch label; buffer its contents
|
||||||
putc(c, output);
|
putc(c, output);
|
||||||
|
bool alternate = false;
|
||||||
buffer->size = 0;
|
buffer->size = 0;
|
||||||
for (c = getc(input); c != EOF; c = getc(input)) {
|
for (c = getc(input); c != EOF; c = getc(input)) {
|
||||||
putc(c, output);
|
if (!alternate && c == '@') {
|
||||||
if (c == ']') {
|
// "@" designates an alternate name for the ".VC_" label
|
||||||
|
alternate = true;
|
||||||
|
buffer->size = 0;
|
||||||
|
} else if (c == ']') {
|
||||||
|
putc(c, output);
|
||||||
break;
|
break;
|
||||||
} else if (!isalnum(c) && c != '_' && c != '@' && c != '#') {
|
} else {
|
||||||
// Convert non-identifier characters to underscores
|
if (!alternate) {
|
||||||
c = '_';
|
putc(c, output);
|
||||||
|
if (!isalnum(c) && c != '_') {
|
||||||
|
// Convert non-identifier characters to underscores
|
||||||
|
c = '_';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buffer_append(buffer, &c);
|
||||||
}
|
}
|
||||||
buffer_append(buffer, &c);
|
|
||||||
}
|
}
|
||||||
buffer_append(buffer, &(char []){'\0'});
|
buffer_append(buffer, &(char []){'\0'});
|
||||||
// The current patch should have a corresponding ".VC_" label
|
// The current patch should have a corresponding ".VC_" label
|
||||||
|
@ -235,7 +235,7 @@ Address = {HEx @}
|
|||||||
Fixcode={db SCREEN_HEIGHT_PX}
|
Fixcode={db SCREEN_HEIGHT_PX}
|
||||||
|
|
||||||
;12 1b 0b 79 b0 find next C9
|
;12 1b 0b 79 b0 find next C9
|
||||||
[BiographySave_ret]
|
[BiographySave_ret@Enable_GS_Ball_mobile_event]
|
||||||
Mode = 2
|
Mode = 2
|
||||||
Address = {HEX @}
|
Address = {HEX @}
|
||||||
Type = 60
|
Type = 60
|
||||||
@ -425,7 +425,7 @@ Type = 103
|
|||||||
;Dark0 = 10 ;0~10 (for Normal Mode)
|
;Dark0 = 10 ;0~10 (for Normal Mode)
|
||||||
;012532
|
;012532
|
||||||
;
|
;
|
||||||
[FPA 001 Begin]
|
[FPA 001 Begin@Reduce_move_anim_flashing]
|
||||||
Mode = 3
|
Mode = 3
|
||||||
Type = 0
|
Type = 0
|
||||||
Address = {hex @}
|
Address = {hex @}
|
||||||
@ -459,7 +459,7 @@ ConditionValueC = {dws_ FISSURE }
|
|||||||
;s e l d e s c
|
;s e l d e s c
|
||||||
;
|
;
|
||||||
|
|
||||||
[FPA 002 Begin]
|
[FPA 002 Begin@Reduce_move_anim_flashing]
|
||||||
Mode = 3
|
Mode = 3
|
||||||
Type = 0
|
Type = 0
|
||||||
Address = {hex @}
|
Address = {hex @}
|
||||||
@ -475,7 +475,7 @@ ConditionValueC = {dws_ SELFDESTRUCT}
|
|||||||
|
|
||||||
; lightening
|
; lightening
|
||||||
; -------------- Mem Write: pc32 = 0x35d09 addr = 0xcfb6 value = 0x57
|
; -------------- Mem Write: pc32 = 0x35d09 addr = 0xcfb6 value = 0x57
|
||||||
[FPA 003 Begin]
|
[FPA 003 Begin@Reduce_move_anim_flashing]
|
||||||
Mode = 3
|
Mode = 3
|
||||||
Type = 0
|
Type = 0
|
||||||
Address = {hex @}
|
Address = {hex @}
|
||||||
@ -493,7 +493,7 @@ ConditionValueC = {dws_ THUNDER }
|
|||||||
|
|
||||||
;ji wa lei 011800
|
;ji wa lei 011800
|
||||||
|
|
||||||
[FPA 004 Begin]
|
[FPA 004 Begin@Reduce_move_anim_flashing]
|
||||||
Mode = 3
|
Mode = 3
|
||||||
Type = 0
|
Type = 0
|
||||||
Address = {hex @}
|
Address = {hex @}
|
||||||
@ -516,7 +516,7 @@ ConditionValueC = {dws_ FLASH }
|
|||||||
; include 2 pieces of animationl.
|
; include 2 pieces of animationl.
|
||||||
;ji ba lu 011607
|
;ji ba lu 011607
|
||||||
|
|
||||||
[FPA 005 Begin]
|
[FPA 005 Begin@Reduce_move_anim_flashing]
|
||||||
Mode = 3
|
Mode = 3
|
||||||
Type = 0
|
Type = 0
|
||||||
Address = {hex @}
|
Address = {hex @}
|
||||||
@ -538,7 +538,7 @@ ConditionValueC = {dws_ EXPLOSION}
|
|||||||
;skill name 6 : ..............Mem Write: pc32 = 0x30db addr = 0xcf8c value = 0xc2
|
;skill name 6 : ..............Mem Write: pc32 = 0x30db addr = 0xcf8c value = 0xc2
|
||||||
; da yi ba ha ku ci 011441
|
; da yi ba ha ku ci 011441
|
||||||
|
|
||||||
[FPA 006 Begin]
|
[FPA 006 Begin@Reduce_move_anim_flashing]
|
||||||
Mode = 3
|
Mode = 3
|
||||||
Type = 0
|
Type = 0
|
||||||
Address = {hex @}
|
Address = {hex @}
|
||||||
@ -561,7 +561,7 @@ ConditionValueC = {dws_ HORN_DRILL}
|
|||||||
;skill name 6 : ..............Mem Write: pc32 = 0x30db addr = 0xcf8c value = 0x50
|
;skill name 6 : ..............Mem Write: pc32 = 0x30db addr = 0xcf8c value = 0x50
|
||||||
; 011251
|
; 011251
|
||||||
;
|
;
|
||||||
[FPA 007 Begin]
|
[FPA 007 Begin@Reduce_move_anim_flashing]
|
||||||
Mode = 3
|
Mode = 3
|
||||||
Type = 0
|
Type = 0
|
||||||
Address = {hex @}
|
Address = {hex @}
|
||||||
@ -618,7 +618,7 @@ ConditionValueC = {dws_ PRESENT anim_1gfx_command}
|
|||||||
|
|
||||||
;exit point
|
;exit point
|
||||||
|
|
||||||
[FPA 001 End]
|
[FPA 001 End@Stop_reducing_move_anim_flashing]
|
||||||
Mode = 3
|
Mode = 3
|
||||||
Type = 1
|
Type = 1
|
||||||
Address = {hex @}
|
Address = {hex @}
|
||||||
|
Loading…
Reference in New Issue
Block a user