Shiny Quagsire

I'm Still Alive, Elsewhere

Age 21
Male
Hoenn Safari Zone
Seen 5 Days Ago
Posted April 17th, 2017
700 posts
10.5 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:
normal:
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:
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:
[MinLV][MaxLV][Species][Species]
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.