Thread: Development: Uncatchable Pokemon
View Single Post
Old July 14th, 2011 (12:19 PM).
JPAN JPAN is offline
pokemon rom researcher
Join Date: Dec 2008
Posts: 104
Originally Posted by metapod23 View Post
I tried it out, but haven't gotten it to work. Here's the code I'm using:
.align 2
Catch_me_not:     ldr r0, =00007015
                bl    LoadVariable
                cmp r0, #0x01
                bne return_to_normal
                ldrb r0, [r0]
                cmp r0, #0x1
                bne return_to_normal
                ldr r1, battleFlags
                ldr r1, [r1]
                ldr r0, afterGhostAddr
                bx r0
return_to_normal:    ldr r1, battleFlags
                    ldr r1, [r1]
                    ldr r0, ghostCheckAddr
                    bx r0
battleFlags:    .word 0x02022b4c
afterGhostAddr: .word 0x0802d461
ghostCheckAddr:    .word 0x0802d457
LoadVariable:    ldr r1, ld_Var_addr
                bx r1
ld_Var_addr:    .word 0x0806e569
All the underlined code is what's throwing the code off. The value returned by the variable loader is the value to compare right after. After that, loading from R0 would be loading from address 1, a BIOS address. That address value (if even loaded) will most likely not be 1, so the second check fails.
That second check is used only on the "address reading" version of the code. Clean it off, and it should work.
Here are the links for my work

Currently working on:
Battle Script Documentation
Another large project
Reply With Quote