Altering the Dead Motion patch

I want to change the Dead Motion patch so it checks for a specific item instead of specific chapter. I edited the editor to it asks for an item and I modified my .S files to look like this

@Call 08053D58 {J}
@Call 08053068 {U}

.thumb
.macro blh to, reg=r3
ldr \reg, =\to
mov lr, \reg
.short 0xf800
.endm

bl GetMotion
cmp r0, #0x1
beq Flush_And_EfxDeadPika
cmp r0, #0x2
beq Nothing
cmp r0, #0x3
beq Flush_Only
b Normal_EfxDeadPika

@何もしない
Nothing:
mov r0, r5
bl SetNothing
b Exit

@画面フラッシュ
Flush_Only:
mov r1, r5
ldr r0, Proc_CustomDeadMotion_Flush_Only
bl RunCustomProcs
b Exit

@画面フラッシュした後で点滅して消去
Flush_And_EfxDeadPika:
mov r1, r5
ldr r0, Proc_CustomDeadMotion_Flush_And_Pika
bl RunCustomProcs
b Exit

@点滅して消去
Normal_EfxDeadPika:
ldr r0, [r5, #0x5c]
ldr@blhr1, [r5, #0x60@StartEfxDeadPika
@blh 0x08053e10 @StartEfxDeadPika {J}
@StartEfxDeadPikalh 0x@b8053120 @StartEfxDeadPika {U}
@b@ldrExit

@復帰
Exit:
@ldr r3, =0x08053D60|1 @{J}
ldr r3, =0x08053070|1 @{U}
bx r3

RunCustomProcs:
push {r4,r5,lr}
ldr r4, [r1, #0@blh5c]
ldr r5, [r@NewBlocking6C, #0x60]
@blh 0x08002c30 @NewBlocking6C @NewBlocking6C {J}
blh 0x08002CE0 @NewBlocking6C {U}
str r4, [r0, #0x5c]
str r5, [r0, #0x60]
mov r1, #0x0
strh r1, [r0, #0x2c]
strh r1, [r0, #0x2e]
pop {r4,r5}
pop {r1}
bx r1

SetNothing:
push {r4,r5,lr}
mov r1, #0x0
strh r1, [r0, #0x2e]

mov r1, #0x1e-1
strh r1,[r0@ldr#0x2c]

pop {r4,r5@BattleUnit
pop {r1}
bx r1

GetMotion:
push {lr,r4}@BattleUnit@ldr r4,=0x0203a568 @BattleUnit gBattleTarget {J}
ldr r4,=0x0203A56C @BattleUnit gBattleTar@ldret {U}
ldrb r0, [r@BattleUnit, #0xb]
cmp r0, #0x80
bge GetMotion_Fi@BattleUnitd @敵のみ

@ldr r4,=0x0203a4e8 @BattleUnit gBattleActor {J}
ldr r4,=0x0203A4EC @BattleUnit gBattleActor {U}
ldrb r0, [r4, #0xb]
cmp r0, #0x80
bge GetMotion_Find @敵のみ
b GetMotion_NotFound

GetMotion_Find:
ldr r3, DeadMotionTable
sub r3, #0x4
GetMotion_Loop:
add r3, #0x4
ldr r0, [r3]
cmp r0, #0x0
beq GetMotion_NotFound

GetMotion_CheckUnit:
ldrb r0, [r3,#0x0]
cmp r0, #0x0
beq GetMotion_CheckClass

ldr r1, [r4,#0x0]
ldrb r1, [r1,#0x4]
cmp r0, r1
bne GetMotion_Loop

GetMotion_CheckClass:
ldrb r0, [r3,#0x1]
cmp r0, #0x0
beq GetMotion_CheckMap

ldr r1, [r4,#0x4]
ldrb r1, [r1,#0x4]
cmp r0, r1
bne GetMotion_Loop

GetMotion_CheckItem:
ldrb r0, [r3,#0x2]
cmp r0, #0x0
beq GetMotion_Found

mov r2, #0x1e

GetMotion_ItemLoop:
cmp r2, #0x26
bgt GetMotion_Loop

ldrb r1, [r4,r2]
cmp r0, r1
beq GetMotion_Found

add r2, #0x2
b GetMotion_ItemLoop

GetMotion_Found:
ldrb r0, [r3,#0x3]
b GetMotion_Exit

GetMotion_NotFound:
mov r0, #0x0

GetMotion_Exit:
pop {r4}
pop {r1}
bx r1

.ltorg
EALiterals:
.set DeadMotionTable, EALiterals + 0
.set Proc_CustomDeadMotion_Flush_And_Pika, EALiterals + 4
.set Proc_CustomDeadMotion_Flush_Only, EALiterals + 8

but the game is still expecting a map where it asks for an item. I think maybe because the .dmp files still need to be updated? But I’m not sure I have the assembler to do that.

You are correct about the dmp, and the file you need to update it is “arm-none-eabi-as.exe”. It can be found as part of installing devkitPro (obviously, pick the GBA tools options when doing so). Instructions for this can be found at https://devkitpro.org/wiki/Getting_Started

Once you get the .exe, you need it in the same folder as the .s, then open the command line and run “arm-none-eabi-as.exe INPUT.s”. This yields INPUT.out, but unfortunately the “dmp” part you need is actually inside of that file. I think??? there’s a way to get it out easier, but you can always hex editor it and then save that. Sorry, it’s been a while since I’ve actually done this.

Had some trouble converting the .o files into .dmp files, but managed it in the end. Thanks a bunch.