Branched promotion fix for non-blue units. In vanilla if you try to make a red/green/purple unit promote and their class has branched promotions, the game freezes, and this fixes it. Just save this as a text file and put it in the FEBuilderGBA\config\patch2\FE8U folder and it will appear in the patches menu. In the class selection they will use their blue palette, but once the promotion cutscene starts they will use the correct palette.
Thanks to Contro, Sme, Huichelaar and Vesly for their help.
Branched promotions for non-blue units fix
NAME.en=Branched promotion allegiance restriction
INFO.en=In vanilla, only blue units can have branched promotions. Trying to promote a non-blue unit from a class that has multiple options will crash the game. This patch allows you to enable any unit to promote regardless of allegiance.
AUTHOR=Shuusuke https://discord.com/channels/144670830150811649/179027738454261760/1249620900610052108
TYPE=SWITCH
TAG=#ENGINE
COMBO=Default: Blue units only|BLU|Any unit|FIX
BLU:0xCCEFC=0x3F
FIX:0xCCEFC=0xFF
Growth Getter ASMC. Use this in an event if you want to get a unit’s growth rates. Requires the skill system and takes into account things like Afa’s Drops, Blossom and other modifiers. If you made modifications to the skill system and changes the address of these functions, you need to update this code with the new addresses.
Set slot 1 to the unit (can be their ID, or 0xFFFF if it’s the active unit, or 0xFFFE if it’s at slotB coordinates, or 0xFFFD to use slot2 ID)
Set slot 3 to the growth you want to check: HP=0, Str=1, Skl=2, Spd=3, Luk=4, Def=5, Res=6, Mag=7
Thanks to Sme and Vesly for their help.
Growth getter ASMC
.align 4
.macro blh to, reg=r3
ldr \reg, =\to
mov lr, \reg
.short 0xf800
.endm
.thumb
.equ MemorySlot0, 0x30004B8 @FE8U
.equ GetUnitByEventParameter, 0x800bc50
.equ Get_Hp_Growth, 0x08B80414
.equ Get_Str_Growth, 0x08B80434
.equ Get_Skl_Growth, 0x08B8048C
.equ Get_Spd_Growth, 0x08B804AC
.equ Get_Luk_Growth, 0x08B80514
.equ Get_Def_Growth, 0x08B804CC
.equ Get_Res_Growth, 0x08B804F0
.equ Get_Mag_Growth, 0x08B80454
@slot 1 = unit
@slot 3 = growth to read HP=0,Str=1,Skl=2,Spd=3,Luk=4,Def=5,Res=6,Mag=7
push {lr}
@Read from memory slot 1
ldr r3,=MemorySlot0
ldr r0, [r3 , #0x4 * 1] @Slot1
blh GetUnitByEventParameter
@Read from memory slot 3
ldr r3,=MemorySlot0
ldr r1, [r3 , #0x4 * 3] @Slot3
cmp r1,#0x07
bgt Nothing
blt NotMag
blh Get_Mag_Growth
b End
NotMag:
cmp r1,#0x06
bne NotRes
blh Get_Res_Growth
b End
NotRes:
cmp r1,#0x05
bne NotDef
blh Get_Def_Growth
b End
NotDef:
cmp r1,#0x04
bne NotLuk
blh Get_Luk_Growth
b End
NotLuk:
cmp r1,#0x03
bne NotSpd
blh Get_Spd_Growth
b End
NotSpd:
cmp r1,#0x02
bne NotSkl
blh Get_Skl_Growth
b End
NotSkl:
cmp r1,#0x01
bne NotStr
blh Get_Str_Growth
b End
NotStr:
cmp r1,#0x00
bne NotHP
blh Get_Hp_Growth
b End
NotHP: @dummy
cmp r1,r1
beq Nothing
blh Get_Hp_Growth
b End
Nothing:
mov r1,#0x00 @invalid growth returns 0
End: @growth is in r1
@Write to memory slot C
ldr r3,=MemorySlot0
mov r2,#0x0C
lsl r2,#2
str r1,[r3,r2]
POP {r0}
BX r0
.ltorg
.align 4
