Glory To Arstotzka

Seen January 28th, 2018
Posted December 6th, 2015
732 posts
10.4 Years
Yeah, I meant that. Anyways, I improved the code so that it is backward compatible with original game data. At the beginning, add this before pushing r0:
mov r1, r0
 ldrb r1, [r1, #0x3]
 cmp r1, #0x8
 bne normal

//Add the following lines after back:
add r0, r4, r0
ldrh r0, [r0, #0x2]
ldr r3, Back
 bx r3
What this does is it checks for an 08 3 bytes after r0, which would be where your day pointer is. If not, it uses the pokemon table as normal data, like the game normally would. The byte that is actually checked is the flipped byte of the pokemon's species. Luckily, no pokemon goes over the number 2,048, so the check works. Another check you could add is to, instead of loading another pokemon data table, check the byte loaded into r0 after this instruction:
ldrh r0, [r0, #0x2]
This loads the pokemon's data, and once loaded, it can be checked. So let's say we wanted a pidgey to turn into a hoothoot. You could add this to next:
ldr r0, [r0, #0x0]
 add r0, r4, r0
 ldrh r0, [r0, #0x2]
ldr r3, hour
 ldrb r3, [r0, #0x0]
 cmp r3, #0x15          /*9PM - Change it if you want*/
 bge hoothoot
b back
hoothoot: cmp r0, #0x10 /*Is it pidgey?*/
bne back /*If not, return to normal*?
mov r0, #0xA3 /*Change pokemon to hoothoot*/
b back
Also, It's pretty tedious to hex edit pokemon, so I'm going to create a tool sometime. It's not too hard in fact, since it's such a simple format:
edit: I've also added backward support for the levels. Simply add this before pushing r0 at the beginning:
 ldrb r2, [r2, #0x3]
 cmp r2, #0x8
 bne nextnormal
Add nextnormal to the second line in next:

next: ldr r0, [r0, #0x0]        /*Loads the word stored at the location pointed to in R0, the pointer to the wild data*/
 nextnormal:add r0, r4, r0                    /*Adds the number of bytes from the start of the table that the wild Pokémon slot the game has selected is*/
 add r4, r0, #0x0                /*Adds the contents of R0 into R4*/
 ldrb r0, [r4, #0x1]             /*Loads the upper level limit for the Pokémon if they're stored systematically*/

This essentially does the same thing as before. It checks if the pointer exists, and if not, it treats the table data as the normal pokemon data.
Thanks man! I'll add these improvements in when I get home from work. I can't believe i didn't put these checks in myself XD. I don't pretend to br a great ASM hacker, i'm still learning most of it.
Hey guys, please check out my recreations of the gen 1 and 2 music on my custom engine at my SoundCloud! - Here!