Thread: Development: The 4th gen class split in 3rd gen
View Single Post
Old January 6th, 2012 (1:46 AM). Edited January 6th, 2012 by Darthatron.
Darthatron's Avatar
Darthatron Darthatron is offline
  • Silver Tier
Join Date: Jan 2006
Location: Melbourne, Australia
Age: 26
Gender: Male
Nature: Modest
Posts: 1,152
Originally Posted by Jambo51 View Post
The code doesn't work. I set a break on read of the battle data, and the game only ever reads the physical stats - regardless of whether the attack in question is physical or special. In theory, this wouldn't be too hard to fix, but I can't see a way of doing it without a hijack at the moment.

The offending code in BPRE is at 0x3ED6E. It always loads from 0x02023BE6 - the physical attack stat of the Pokémon in question. (Obviously, it can load from other slots as well - point is - it always loads the physical attack stat.)

It is immediately followed by another few load commands which then get the physical defense of the opposing Pokémon.

Obviously - we could hijack this routine in a rather unattractive manner, and force it to recalculate the physical/special byte (as it CAN potentially be overwritten by this point) and then get the correct respective bytes from there.

I'm a bit tired right now, so I hope this makes sense. And I hope it helps explain some of the problems we've been having. Obviously, I haven't checked - but this could be the same on other ROMs like RSE as well - so I'd check carefully if I were you!

Jambo51 out!
It loads both stats, doesn't it? Physical to r7 and Special to r8..?
0803ED6E loc_0803ED6E:                           @ CODE XREF: sub_0803ECEC+6Cj
0803ED6E                 LDRH    R7, [R6,#2]               //Attacker's Attack stat
0803ED70                 LDR     R2, [SP,#0x4C+var_48]
0803ED72                 LDRH    R2, [R2,#4]
0803ED74                 STR     R2, [SP,#0x4C+var_38]
0803ED76                 LDRH    R3, [R6,#8]               //Attacker's Special-Attack stat
0803ED78                 MOV     R8, R3
0803ED7A                 LDR     R0, [SP,#0x4C+var_48]
0803ED7C                 LDRH    R0, [R0,#0xA]
0803ED7E                 STR     R0, [SP,#0x4C+var_34]
It later loads the correct value in to r5.

0803F26E loc_0803F26E:                           @ CODE XREF: sub_0803ECEC+554j
0803F26E                 LSLS    R0, R0, #1
0803F270                 ADDS    R1, R0, R2
0803F272                 LDRB    R1, [R1]
0803F274                 MOVS    R5, R7
0803F276                 MULS    R5, R1
0803F278                 ADDS    R2, #1
0803F27A                 ADDS    R0, R0, R2
0803F27C                 LDRB    R1, [R0]
0803F27E                 MOVS    R0, R5
0803F280                 BL      div_mod
0803F284                 ADDS    R5, R0, #0
0803F3CA loc_0803F3CA:                           @ CODE XREF: sub_0803ECEC+6C2j
0803F3CA                 LSLS    R0, R0, #1
0803F3CC                 ADDS    R1, R0, R2
0803F3CE                 LDRB    R1, [R1]
0803F3D0                 MOV     R5, R8
0803F3D2                 MULS    R5, R1
0803F3D4                 ADDS    R2, #1
0803F3D6                 ADDS    R0, R0, R2
0803F3D8                 LDRB    R1, [R0]
0803F3DA                 MOVS    R0, R5
0803F3DC                 BL      div_mod
0803F3E0                 ADDS    R5, R0, #0
Please correct me if you aren't getting this too. :\
Note: All code relevant to FireRed.

EDIT: Never mind this stuff. We worked out that it's fine.
あなた は しきしゃ です
わたし は ばか です
Reply With Quote