Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions EngineHacks/ExternalHacks/StatusExpansion/AssembleLynEvent.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@echo off

SET startDir="C:\devkitPro\devkitARM\bin\"
SET as="%startDir%arm-none-eabi-as"
SET LYN="C:\devkitPro\lyn.exe"

@rem Assemble into an elf
%as% -g -mcpu=arm7tdmi -mthumb-interwork %1 -o "%~n1.elf"

if exist "Definitions.s" (

@rem Assemble definitions into a .elf if exists
%as% -g -mcpu=arm7tdmi -mthumb-interwork "Definitions.s" -o "Definitions.elf"

@rem Assebmle into a .lyn.event with definitions
%LYN% "%~n1.elf" "Definitions.elf" > "%~n1.lyn.event"

echo y | del "%~dp0Definitions.elf"
) else (
@rem Assemble into a .lyn.event
%LYN% "%~n1.elf" > "%~n1.lyn.event"
)

echo y | del "%~n1.elf"

pause
14 changes: 14 additions & 0 deletions EngineHacks/ExternalHacks/StatusExpansion/Enfeeble/Enfeeble.event
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#define EnfeebleStatusID 0x0E //last valid status ID

// SetStatusName(EnfeebleStatusID,EnfeebleStatusName)
// SetStatusDesc(EnfeebleStatusID,EnfeebleStatusDesc)
SetStatusBlinkyIconFunc(EnfeebleStatusID,BlinkyIconFuncSilenceIcon)

#include "Enfeeble.lyn.event"

ALIGN 4
EnfeebleStatusIDLink:
BYTE EnfeebleStatusID

// Add `EnfeebleStatDebuff` to stat getters for stats you want enfeeble to debuff
// Define EnfeebleName and EnfeebleDesc (only used on stat screen)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ALIGN 4
PUSH
ORG CURRENTOFFSET+$1;EnfeebleStatDebuff:
POP
SHORT $B5F0 $1C05 $1C0C $4E08 $7836 $1C20 $3030 $7800 $211F $4001 $42B1 $D101 $940 $1A2D $1C28 $1C21 $BCF0 $BC04 $4710
BYTE $0 $0
POIN EnfeebleStatusIDLink
37 changes: 37 additions & 0 deletions EngineHacks/ExternalHacks/StatusExpansion/Enfeeble/Enfeeble.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.thumb
.align


.global EnfeebleStatDebuff
.type EnfeebleStatDebuff, %function


EnfeebleStatDebuff:
push {r4-r7,r14}
mov r5, r0 @stat
mov r4, r1 @unit
ldr r6,=EnfeebleStatusIDLink
ldrb r6,[r6]

mov r0,r4
add r0,#0x30
ldrb r0,[r0]
mov r1,#0x1F
and r1,r0
cmp r1,r6
bne EndEnfeebled

lsr r0,r0,#5
sub r5,r0


EndEnfeebled:
mov r0,r5
mov r1,r4
pop {r4-r7}
pop {r2}
bx r2


.ltorg
.align
18 changes: 18 additions & 0 deletions EngineHacks/ExternalHacks/StatusExpansion/Freeze/EventFreeze.event
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef EVENT_FREEZE
#define EVENT_FREEZE

// Freeze all enemies ASMC.
// Hack by circleseverywhere

#ifdef _FE8_

ALIGN 4
FreezeAllASMC:
#incbin "asm/freezeall.dmp"
WORD FreezeStatusID

#else // _FE8_
ERROR Freeze All ASMC hack is for FE8
#endif // _FE8_

#endif // EVENT_FREEZE
67 changes: 67 additions & 0 deletions EngineHacks/ExternalHacks/StatusExpansion/Freeze/Freeze.event
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#define FreezeStatusID 0xF

// SetStatusName(FreezeStatusID,FreezeStatusName)
// SetStatusDesc(FreezeStatusID,FreezeStatusDesc)
SetStatusBlinkyIconFunc(FreezeStatusID,BlinkyIconFuncSleepIcon)

//Define text IDs for name and desc
//put the following in the mov getter in place of what's normally there for freeze
// prNullifyIfFreeze:
// rIfUnitHasStatus(FreezeStatusID)
// rConstant(0)

// Freeze status.
// Hack by CrazyColorz5

#ifdef _FE8_

{

// TODO: make the sleep staff inflict freeze

PUSH
//ORG 0x276F8 //sick displays sleep map anim
//WORD 0x80277A8

// ORG 0x178EA //2 turns = 1 player phase
// BYTE 0x20

//ORG 0x8C3D8
// WORD 0x808C3F0 //HP area display

ORG $18d50
// jumpToHack(FreezeEffect) //I think the move getters are good enough

ORG $188e4
jumpToHack(FreezeDecrease)

ORG $18878
jumpToHack(FreezeDecrease2)
POP

ALIGN 4
// FreezeEffect:
// #incbin "ASM/freeze.dmp"
// POIN FreezeMovement

ALIGN 4
// FreezeMovement:
// #incbin "ASM/freezemovement.dmp"

ALIGN 4
FreezeDecrease:
#incbin "asm/freeze_decrease.dmp"
WORD FreezeStatusID

ALIGN 4
FreezeDecrease2:
#incbin "asm/freeze_decrease_2.dmp"
WORD FreezeStatusID

}

#else // _FE8_
ERROR Freeze hack is for FE8
#endif // _FE8_


Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@echo off

SET startDir=C:\devkitPro\devkitARM\bin\

@rem Assemble into an elf
SET as="%startDir%arm-none-eabi-as"
%as% -g -mcpu=arm7tdmi -mthumb-interwork %1 -o "%~n1.elf"

@rem Print symbol table
SET readelf="%startDir%arm-none-eabi-readelf"
%readelf% -s "%~n1.elf" > "%~n1.symbols.log"

@rem Extract raw assembly binary (text section) from elf
SET objcopy="%startDir%arm-none-eabi-objcopy"
%objcopy% -S "%~n1.elf" -O binary "%~n1.dmp"

echo y | del "%~n1.elf"

echo y | del "%~n1.symbols.log"
pause
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@80188e4 decreases status, jumptohack from there
@prevents decrease on enemy phase
.thumb

ldrb r3, [r1] @status
mov r0, #0x1F
and r0, r3
ldr r2,FreezeStatusID
cmp r0, r2
bne Normal

@if freeze, only reduce on player phase
ldr r2, =0x202bcff @current phase
cmp r2, #0x0 @if player phase, reduce as usual
beq Normal
@otherwise do nothing.
ldr r2, =0x801891c|1
bx r2

Normal:
mov r0, r12
and r0, r3
cmp r0, #0
ldr r2, =0x80188ec|1 @go back
bx r2

.ltorg
.align

FreezeStatusID:
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
@hook at 8018878 with jumptohack
.thumb

cmp r6, #0x1 @if it's the first player unit
bne NotFirst
push {r0-r3}
bl ReduceEnemyFreeze
pop {r0-r3}
NotFirst:
ldr r4, =0x8018881 @return position, r4 is immediately clobbered so it's fine
ldr r1, =0x859a5d0
mov r0, #0xff
and r0, r6
lsl r0, #2
bx r4


ReduceEnemyFreeze:
push {r4-r6, lr} @loop through all enemies and reduce their freeze status only
mov r4, #0x81 @first enemy
ldr r5, =0x859a5d0 @pointers to ram
EnemyLoop:
lsl r0, r4, #2
ldr r6, [r5,r0]
mov r0, #0x30
add r0, r6 @status
ldrb r1, [r0]
mov r2, #0x1F
and r2, r1 @type of status in r2
ldr r3,FreezeStatusID
cmp r2, #0x9
bne NextEnemy
@it has freeze, so reduce it
lsr r3, r1, #4 @turns remaining in r3
sub r3, #1
lsl r3, #4
orr r2,r3
strb r2, [r0]
cmp r3, #0
bne NextEnemy

ldr r0, =0x804f8bc
mov lr, r0

mov r0, #0x10
ldsb r0, [r6,r0]
mov r1, #0x11
ldsb r1, [r6,r1]
mov r2, #0xB
ldsb r2, [r6,r2]
mov r3, #0
.short 0xf800
NextEnemy:
add r4, #1
cmp r4, #0xC1
blt EnemyLoop
pop {r4-r6}
pop {r0}
bx r0

.ltorg
.align


FreezeStatusID:
Binary file not shown.
27 changes: 27 additions & 0 deletions EngineHacks/ExternalHacks/StatusExpansion/Freeze/asm/freezeall.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.thumb
@freeze all enemies

push {r4-r6,lr}
mov r4, #0x81 @first enemy
ldr r5, =0x8019430 @get ram from dplynum
mov r6, #0x30 @status byte
NextEnemy:
mov r0, r4
mov lr, r5
.short 0xf800
@r0 is now ram
ldr r2,FreezeStatusID
mov r1,#0x2 @1-turn duration
orr r1,r2
strb r1, [r0, r6]
add r4, #1
cmp r4, #0xC0
blt NextEnemy
pop {r4-r6}
pop {r0}
bx r0

.ltorg
.align

FreezeStatusID:
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.thumb
@replaces 8018d50 (use jumpToHack there)
@0x8 bytes)

mov r0, #0x30
ldrb r0, [r2,r0] @status
mov r1, #0xF
and r0, r1
cmp r0, #0x9
bne NotFrozen
ldr r0, FrozenMovementTable
b MoveFound

NotFrozen:
ldr r0, [r2, #0xC]
mov r1, #0x80
lsl r1, #4 @bit 0x800 'in ballista'
and r0, r1
cmp r0, #0
beq NotBallista
ldr r0, =0x880bc18 @ballista movement

MoveFound:
ldr r1, =0x8018d8a+1 @return with movement found
bx r1
NotBallista:
ldr r1, =0x8018d64+1 @return for normal
bx r1

.ltorg
FrozenMovementTable:
@POIN table of 0xFF 104 times
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@echo off

SET startDir="C:\devkitPro\devkitARM\bin\"
SET as="%startDir%arm-none-eabi-as"
SET LYN="C:\devkitPro\lyn.exe"

@rem Assemble into an elf
%as% -g -mcpu=arm7tdmi -mthumb-interwork %1 -o "%~n1.elf"

if exist "Definitions.s" (

@rem Assemble definitions into a .elf if exists
%as% -g -mcpu=arm7tdmi -mthumb-interwork "Definitions.s" -o "Definitions.elf"

@rem Assebmle into a .lyn.event with definitions
%LYN% "%~n1.elf" "Definitions.elf" > "%~n1.lyn.event"

echo y | del "%~dp0Definitions.elf"
) else (
@rem Assemble into a .lyn.event
%LYN% "%~n1.elf" > "%~n1.lyn.event"
)

echo y | del "%~n1.elf"

pause
Loading