Thread: Research: FireRed Pokédex Hacking
View Single Post
  #28    
Old May 5th, 2011 (01:13 AM).
Gamer2020's Avatar
Gamer2020
This love is a sickness...
 
Join Date: Jun 2008
Location: Distant Land
Gender: Male
Nature: Bold
Send a message via Skype™ to Gamer2020
Quote originally posted by Jambo51:
Yeah, that was the first thing I did because I figured that the rest of it wouldn't work without that first.

@Full Metal
I'm still ironing out some bugs related to the hack, but when I make it bug free, I'll release the information.
I'm relatively happy to allow people to use it once it's bug free!
Quote originally posted by Jambo51:
Using the following routine, I was able to repoint and extend the seen and caught flags for Pokémon to a free RAM location. The new routine has support for 656 caught flags, and 656 seen flags (as close to 649 as I could get using the 8 bits to a byte system, obviously aiming for the gen 5 total here!). Bear in mind however, that the routine is only limited by how much free space you allocate it. If we were to use a full save block to store caught and seen flags (which is possible using JPAN's save block hack!), we would be limited to a maximum of 10,240 pokémon. This is clearly more than enough XD.

The routine actually simplifies on the original greatly and as such, it's more open to bugs and oddities. Instead of having 3 separate sets of caught and seen flags, I reduced it to 1 longer set, pointed to a different RAM location. The only issue I have with the routine is that the new block of ram is NOT saved when saving the game.

Code:
.text
.align 2
.thumb
.thumb_func
.global seencaughtflagsrepoint
main:
 add r3, r0, #0x0
 add r5, r1, #0x0
 lsl r2, r2, #0x18
 sub r0, r3, #0x1
 lsl r0, r0, #0x10
 lsr r3, r0, #0x10
 lsr r4, r0, #0x13
 mov r0, #0x7
 and r3, r0
 mov r0, #0x80
 lsl r0, r0, #0x11
 lsl r0, r3
 lsr r6, r0, #0x18
 mov r0, #0x0
 mov r12, r0
 cmp r5, #0x1
 beq caughtcheck
 cmp r5, #0x2
 beq setseen
 cmp r5, #0x3
 beq setcaught
 cmp r5, #0x0
 beq seencheck
 b end
seencheck: ldr r0, newblock
there: add r0, r0, r4
 ldrb r1, [r0, #0x0]
 and r1, r6
 cmp r1, #0x0
 beq end
 mov r0, #0x1
 mov r12, r0
 b end
caughtcheck: ldr r0, newblock
 add r0, #0x52
 b there
setseen: ldr r1, newblock
there2: add r1, r1, r4
 ldrb r2, [r1, #0x0]
 add r0, r6, #0x0
 orr r0, r2
 strb r0, [r1, #0x0]
 b end
setcaught: ldr r1, newblock
 add r1, #0x52
 b there2
end: mov r0, r12
 pop {r4-r7}
 pop {r1}
 bx r1
.align
newblock: .word 0x0203E400
This routine could theoretically be inserted directly over the original routine as it is smaller than it. If you wish to do so, paste my routine into the rom starting at 0x104AB2. However, it is substantially safer to insert it with a ldr bx combo. Up to you I guess. If you want to use a ldr bx combo, use Register 3.

As you can see, it sets up the new caught/seen flags at 0x0203E400 (seen) and 0x0203E452 (caught). That's 82 (0x52) bytes for each set, which equates to 656 caught and seen flags.

It uses a total of 164 bytes to safely store all the relevant bits. This is (again) actually smaller than what the original rom uses just to store 416 bits worth of flags. However, because all the data isn't concurrent, we can't use that for our new data.

The routine is pretty much self explanatory, and isn't complicated to the point of being unintelligible. This solves our first BIG problem related to the expansion of the Pokédex. Now if I could just get the block to save using jpan's hack, i'd be sorted.
Oh is that what that is? I really didn't notice that as I scrolled down. I'll take a better look at it tomorrow when I wake up. I want to compare it to the original routine and stuff.
I'm actually working on doing this to Emerald for my hack. I already have been able to add more Pokemon but the seen/caught is everybody's biggest problem I think.
__________________
Pokemon Game Editor Download!
Pokemon TCG Assistant!
Fun Fact: Even though PGE isn't posted on PC anymore it still has the same number of downloads per day.
Accept no imitations!
Reply With Quote