The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > ROM Hacking > Research & Development
Sign Up Rules/FAQ Live Battle Blogs Mark Forums Read

Notices

Research & Development Got a well-founded knack with ROM hacking? Love reverse-engineering the Pokémon games? Or perhaps you love your assembly language. This is the spot for polling and gathering your ideas, and then implementing them! Share your hypothesis, get ideas from others, and collaborate to create!
Research & Development programs in this forum are subject to moderator approval before they are displayed.


Reply
 
Thread Tools
  #1    
Old August 20th, 2013, 08:09 PM
DoesntKnowHowToPlay's Avatar
DoesntKnowHowToPlay
some loser
 
Join Date: Jan 2012
I see a lot of talk about how to make hacks "difficult". The typical solutions are to:

-give trainers teams full of legendaries
-make the level curve absurdly steep
-inflate the base stats of everything
-give the AI illegal moves and custom attacks with absurd BP
-make every dungeon a flash maze where you can't use flash

Because I hate everyone who plays romhacks for fun am a nice person, I've decided to release a bit of code that gives us another option- letting trainer pokemon have custom EVs. Normally, trainer pokemon have 0 EVs in every stat outside of the RSE Battle Tower/Frontier.

First you will need to insert this ASM:

Fire Red:
Spoiler:
Code:
#EV spread table format
#Each spread is 16 bytes
#0x0 = Nature
#0x4 = IVs (from 0-31, not 0-255, used for all IVs)
# (if you want hidden powers, recall the ai can't handle -- bp moves)
#0x5 = HP EVs
#0x6 = Atk EVs
#0x7 = Def EVs
#0x8 = Speed EVs
#0x9 = SAtk EVs
#0xA = SDef EVs
#0xB = Pokeball
#last four bytes are filler

.align 2
.thumb
.thumb_func

.org 0x115f6
mov r0, r1
mov r6, r0
b 0x11604

.org 0x1162c
ldr r0, .Method_Addr
bx r0

.Method_Addr: .word 0x08F90001

.org 0x3dc70
b 0x3dcd0


.org 0xF90000

LoadItem:
add r5, #0x6
add r0, r4, #0x0
mov r1, #0xc
add r2, r5, #0x0
bl Insert_Element

LoadHPEV:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x5
mov r1, #0x1A
mov r0, r4
bl Insert_Element

LoadAtkEV:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x6
mov r1, #0x1B
mov r0, r4
bl Insert_Element

LoadDefEV:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x7
mov r1, #0x1C
mov r0, r4
bl Insert_Element

LoadSpeedEV:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x8
mov r1, #0x1D
mov r0, r4
bl Insert_Element

LoadSAtkEV:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x9
mov r1, #0x1E
mov r0, r4
bl Insert_Element

LoadSDefEV:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0xA
mov r1, #0x1F
mov r0, r4
bl Insert_Element

LoadBall:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0xB
mov r1, #0x26
mov r0, r4
bl Insert_Element

StartNatureLoop:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
ldrb r5, [r2, #0x0]
cmp r5, #0x0
beq LoadIVs
ldr r0, [r4, #0x0]
ldr r1, [r4, #0x4]
eor r1, r0, r1
str r1, [r4, #0x4]

NatureLoop:
ldr r0, [r4, #0x0]
add r0, r0, #0x18
str r0, [r4, #0x0]
mov r1, #0x19
bl Mod
cmp r0, r5
bne NatureLoop

EndNatureLoop:
ldr r0, [r4, #0x0]
ldr r1, [r4, #0x4]
eor r1, r0, r1
str r1, [r4, #0x4]

LoadIVs:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
ldrb r6, [r2, #0x4]
push {r6}

StartIVLoop:
mov r5, #0x27

IVLoop:
mov r0, r4
mov r1, r5
mov r2, sp
bl Insert_Element
add r5, r5, #0x1
cmp r5, #0x2D
bne IVLoop

End:
pop {r6}
bl Recalculate_Stats
ldr r1, .Return_Addr
bx r1

Insert_Element:
ldr r3, .Insert_Addr
bx r3

Recalculate_Stats:
mov r0, r4
ldr r1, .Recalc_Addr
bx r1

Mod:
ldr r3, .Mod_Addr
bx r3

.align 2
.Return_Addr: .word 0x08011639
.EV_Table: .word 0x08F00000
.Insert_Addr: .word 0x0804037d
.Recalc_Addr: .word 0x0803e47d
.Mod_Addr: .word 0x081e4685


Emerald:
Spoiler:
Code:
#EV spread table format
#Each spread is 16 bytes
#0x0 = Nature
#0x4 = IVs (from 0-31, not 0-255, used for all IVs)
# (if you want hidden powers, recall the ai can't handle -- bp moves)
#0x5 = HP EVs
#0x6 = Atk EVs
#0x7 = Def EVs
#0x8 = Speed EVs
#0x9 = SAtk EVs
#0xA = SDef EVs
#0xB = Pokeball
#last four bytes are filler

.align 2
.thumb
.thumb_func

.org 0x38936
mov r0, r1
mov r6, r0
b 0x38944

.org 0x3896c
ldr r0, .Method_Addr
bx r0

.Method_Addr: .word 0x08F90001

.org 0x67d68
b 0x67dc8

.org 0xF90000

LoadItem:
add r5, #0x6
add r0, r4, #0x0
mov r1, #0xc
add r2, r5, #0x0
bl Insert_Element

LoadHPEV:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x5
mov r1, #0x1A
mov r0, r4
bl Insert_Element

LoadAtkEV:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x6
mov r1, #0x1B
mov r0, r4
bl Insert_Element

LoadDefEV:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x7
mov r1, #0x1C
mov r0, r4
bl Insert_Element

LoadSpeedEV:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x8
mov r1, #0x1D
mov r0, r4
bl Insert_Element

LoadSAtkEV:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x9
mov r1, #0x1E
mov r0, r4
bl Insert_Element

LoadSDefEV:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0xA
mov r1, #0x1F
mov r0, r4
bl Insert_Element

LoadBall:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0xB
mov r1, #0x26
mov r0, r4
bl Insert_Element

StartNatureLoop:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
ldrb r5, [r2, #0x0]
cmp r5, #0x0
beq LoadIVs
ldr r0, [r4, #0x0]
ldr r1, [r4, #0x4]
eor r1, r0, r1
str r1, [r4, #0x4]

NatureLoop:
ldr r0, [r4, #0x0]
add r0, r0, #0x18
str r0, [r4, #0x0]
mov r1, #0x19
bl Mod
cmp r0, r5
bne NatureLoop

EndNatureLoop:
ldr r0, [r4, #0x0]
ldr r1, [r4, #0x4]
eor r1, r0, r1
str r1, [r4, #0x4]

LoadIVs:
lsl r0, r6, #0x4
ldr r2, .EV_Table
add r2, r0
ldrb r6, [r2, #0x4]
push {r6}

StartIVLoop:
mov r5, #0x27

IVLoop:
mov r0, r4
mov r1, r5
mov r2, sp
bl Insert_Element
add r5, r5, #0x1
cmp r5, #0x2D
bne IVLoop

End:
pop {r6}
bl Recalculate_Stats
ldr r1, .Return_Addr
bx r1

Insert_Element:
ldr r3, .Insert_Addr
bx r3

Recalculate_Stats:
mov r0, r4
ldr r1, .Recalc_Addr
bx r1

Mod:
ldr r3, .Mod_Addr
bx r3

.align 2
.Return_Addr: .word 0x08038979
.EV_Table: .word 0x08EF0000
.Insert_Addr: .word 0x0806acad
.Recalc_Addr: .word 0x08068d0d
.Mod_Addr: .word 0x082e7be1


The bulk of this code is at xF90000- that part doesn't have to go there, it can be moved to wherever you have free space. Just make sure you change Method_Addr to whatever you change the offset to + 1.

You will also need to find x1000 bytes of space, and change the .EV_Table variable in the method to point to it (I used xF00000). This is where the spreads will go. The method gives you 256 spreads to use- this is not full control, but it is more than you are likely to need (the Emerald Battle Frontier only uses around 36 IIRC). The EV Spread table format is:

- Nature
- 3 unused bytes
- HP EV
- Attack EV
- Defense EV
- Speed EV
- Special Attack EV
- Special Defense EV
- What pokeball the mon comes out in
- 4 more unused bytes (I may update the method later to do something with these)

To assign an EV spread to a trainer's pokemon, set the value that was formerly their IVs to which slot in the table you want that pokemon to use. If you are using A-Trainer, this value is erroneously marked as AI Value. Note that the method only works for trainers with custom movesets and items- if they use default movesets or items, it will only affect IVs. It will still work if you manually give the trainer the moves it would have by default or explicitly define their mons as being empty-handed though.

This hack now allows custom natures. The natures are enumerated like so:
x0 - Arbitrary
x1 - Lonely (+Atk, -Def)
x2 - Brave (+Atk, -Speed)
x3 - Adamant (+Atk, -SpAtk)
x4 - Naughty (+Atk, -SpDef)
x5 - Bold (+Def, -Atk)
x6 - Docile (Neutral)
x7 - Relaxed (+Def, -Speed)
x8 - Impish (+Def, -SpAtk)
x9 - Lax (+Def, -SpDef)
xA - Timid (+Speed, -Atk)
xB - Hasty (+Speed, -Def)
xC - Serious (Neutral)
xD - Jolly (+Speed, -SpAtk)
xE - Naive (+Speed, -SpDef)
xF - Modest (+SpAtk, -Atk)
x10 - Mild (+SpAtk, -Def)
x11 - Quiet (+SpAtk, -Speed)
x12 - Bashful (Neutral)
x13 - Rash (+SpAtk, -SpDef)
x14 - Calm (+SpDef, -Atk)
x15 - Gentle (+SpDef, -Def)
x16 - Sassy (+SpDef, -Speed)
x17 - Careful (+SpDef, -SpAtk)
x18 - Quirky (Neutral)

Hardy is unavailable due to the way the method works, but that doesn't really matter since it's neutral. Higher values will crash the game. If 0 is used, the method does not touch nature, so it will be determined semi-randomly like normally.

It is worth nothing that this method allows you to give trainer pokemon more than 510 EVs if you are feeling exceptionally rude.
__________________

Yet Another Fire Red Hack

Physical/Special Split

Last edited by DoesntKnowHowToPlay; August 26th, 2013 at 08:55 AM.
Reply With Quote
  #2    
Old August 21st, 2013, 10:08 AM
Aruaruu
 
Join Date: Sep 2011
Gender: Male
So is this correct in how it is formatted? For a second EV spread I would repeat the filler bytes on both sides?

Spoiler:


I also don't understand on how to select the specific spread you want.

Quote:
To assign an EV spread to a trainer's pokemon, set the value that was formerly their IVs to which slot in the table you want that pokemon to use. If you are using A-Trainer, this value is erroneously marked as AI Value.
How do I find the slot that corresponds to the EV spread in the image above?
Reply With Quote
  #3    
Old August 21st, 2013, 10:29 AM
DoesntKnowHowToPlay's Avatar
DoesntKnowHowToPlay
some loser
 
Join Date: Jan 2012
That is correct for a 31 IV mon with 1530 EVs in a Master Ball. If that's the first entry in the EV table, you would make a pokemon use that spread by setting its IV value (AI Value in A-Trainer) to 0.
__________________

Yet Another Fire Red Hack

Physical/Special Split
Reply With Quote
  #4    
Old August 21st, 2013, 10:43 AM
Aruaruu
 
Join Date: Sep 2011
Gender: Male
Quote:
Originally Posted by DoesntKnowHowToPlay View Post
That is correct for a 31 IV mon with 1530 EVs in a Master Ball. If that's the first entry in the EV table, you would make a pokemon use that spread by setting its IV value (AI Value in A-Trainer) to 0.
Ah. So it was simple. Thank you.

EDIT:
Another problem. I assembled it and changed the things you said to change for Emerald and this was the result when I was going to insert it.

Spoiler:


^ Do I just copy the highlighted part or have I done something wrong that caused all those 0s

and this is what it looked like before assembling it. Not sure if I messed something up or what.

Spoiler:
Quote:
#EV spread table format
#Each spread is 16 bytes
#first four bytes are filler
#0x4 = IVs (from 0-31, not 0-255, used for all IVs)
# (if you want hidden powers, recall the ai can't handle -- bp moves)
#0x5 = HP EVs
#0x6 = Atk EVs
#0x7 = Def EVs
#0x8 = Speed EVs
#0x9 = SAtk EVs
#0xA = SDef EVs
#0xB = Pokeball
#last four bytes are filler

.align 2
.thumb
.thumb_func

.org 0x38936
mov r0, r1
lsl r1, r1, #0x0
lsl r1, r1, #0x0
lsl r1, r1, #0x0
lsl r1, r1, #0x0

.org 0x67d68
lsl r1, r1, #0x0
lsl r1, r1, #0x0
ldr r1, .Method_Addr
bx r1

.Method_Addr: .word 0x081E9F69

.org 0x1E9F68

LoadHPEV:
mov r0, sp
ldrb r0, [r0, #0x11]
lsl r0, r0, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x5
mov r1, #0x1A
mov r0, r7
bl Insert_Element

LoadAtkEV:
mov r0, sp
ldrb r0, [r0, #0x11]
lsl r0, r0, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x6
mov r1, #0x1B
mov r0, r7
bl Insert_Element

LoadDefEV:
mov r0, sp
ldrb r0, [r0, #0x11]
lsl r0, r0, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x7
mov r1, #0x1C
mov r0, r7
bl Insert_Element

LoadSpeedEV:
mov r0, sp
ldrb r0, [r0, #0x11]
lsl r0, r0, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x8
mov r1, #0x1D
mov r0, r7
bl Insert_Element

LoadSAtkEV:
mov r0, sp
ldrb r0, [r0, #0x11]
lsl r0, r0, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x9
mov r1, #0x1E
mov r0, r7
bl Insert_Element

LoadSDefEV:
mov r0, sp
ldrb r0, [r0, #0x11]
lsl r0, r0, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0xA
mov r1, #0x1F
mov r0, r7
bl Insert_Element

LoadBall:
mov r0, sp
ldrb r0, [r0, #0x11]
lsl r0, r0, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0xB
mov r1, #0x26
mov r0, r7
bl Insert_Element

LoadIVs:
mov r1, sp
ldrb r0, [r1, #0x11]
lsl r0, r0, #0x4
ldr r2, .EV_Table
add r2, r0
ldrb r2, [r2, #0x4]
strb r2, [r1, #0x11]

HPIV:
add r0, r7, #0x0
mov r1, #0x27
mov r2, sp
add r2, #0x11
bl Insert_Element

AtkIV:
add r0, r7, #0x0
mov r1, #0x28
mov r2, sp
add r2, #0x11
bl Insert_Element

End:
ldr r1, .Return_Addr
bx r1

Insert_Element:
ldr r3, .Insert_Addr
bx r3


.align 2
.Return_Addr: .word 0x08067d83
.EV_Table: .word 0x08e42710
.Insert_Addr: .word 0x0806ad9c


I ask this because I went ahead and tried it out on the first rematch for roxanne, it didn't seem to work. I set the AI value to 0 since it was the very first spread as well.

Last edited by Aruaruu; August 22nd, 2013 at 04:10 AM.
Reply With Quote
  #5    
Old August 22nd, 2013, 10:04 AM
DoesntKnowHowToPlay's Avatar
DoesntKnowHowToPlay
some loser
 
Join Date: Jan 2012
Any ASM compiled for a specific offset will produce a bunch of 00s before that offset in the binary. Since the method is in three parts, you'll need to go to each of them and put them where they belong. Also, you will want to move the method proper since x1E9F68 isn't free space in Emerald.
__________________

Yet Another Fire Red Hack

Physical/Special Split
Reply With Quote
  #6    
Old August 22nd, 2013, 10:44 AM
pawell6's Avatar
pawell6
The truthseeker
 
Join Date: Feb 2010
Location: Poland
Age: 26
Gender: Male
Quote:
Originally Posted by DoesntKnowHowToPlay View Post
Any ASM compiled for a specific offset will produce a bunch of 00s before that offset in the binary. Since the method is in three parts, you'll need to go to each of them and put them where they belong. Also, you will want to move the method proper since x1E9F68 isn't free space in Emerald.
So that means I have to go offsets 0x115f6, 0x3dc70, 0x1E9F68 in a rom and replace them with data from assembled bin file, even if those offsets aren't FF? I'm just asking, cause I don't want to ruin something in rom accidently.
__________________
Most of new moves is done. Fixing timing of some animations and updating learnsets in progress.
Reply With Quote
  #7    
Old August 22nd, 2013, 11:07 AM
Aruaruu
 
Join Date: Sep 2011
Gender: Male
Quote:
Originally Posted by DoesntKnowHowToPlay View Post
Since the method is in three parts, you'll need to go to each of them and put them where they belong.
I think I am lost.
By parts you mean the offsets in the asm code?
I have a feeling you mean these three...
Spoiler:
0x38936
0x67d68
0x1E9F68


I am not sure what you mean by "put them where they belong" either.


Quote:
Originally Posted by DoesntKnowHowToPlay View Post
Also, you will want to move the method proper since x1E9F68 isn't free space in Emerald.
The image was from the assembled asm, not the rom. I probably should have noted that Dx.
Reply With Quote
  #8    
Old August 22nd, 2013, 03:08 PM
DoesntKnowHowToPlay's Avatar
DoesntKnowHowToPlay
some loser
 
Join Date: Jan 2012
Quote:
So that means I have to go offsets 0x115f6, 0x3dc70, 0x1E9F68 in a rom and replace them with data from assembled bin file, even if those offsets aren't FF? I'm just asking, cause I don't want to ruin something in rom accidently.
Mostly correct. The code at x115F6 alters the read of the IV value, so that it preserves the entire byte before stowing it in RAM (normally the game reduces it to 0-31 first), and thus should be replacing whatever is there. The code at x3DC70 is the jump to the main method, and thus should replace the data that's there. The stuff at x1E9F68 is not just a tweak of the game's code, but the actual new stuff itself, so you should put it in free space. As it happens the offset x1E9F68 has enough free space to hold the method (although it doesn't look like it immediately), but you could freely put it in FF space. On an Emerald ROM, you will need to change that to be somewhere in FF space or you will corrupt whatever it is that resides there.


Quote:
I think I am lost.
By parts you mean the offsets in the asm code?
I have a feeling you mean these three...
What you need to do is go to those offsets in the .bin file, and copy what you see there into the ROM at the same offset you found it in the .bin. You also need to change x1E9F68 to be somewhere in free space before you compile- likewise you will need to change the pointer used by the jump to it to be (wherever you put the method) + 1.
__________________

Yet Another Fire Red Hack

Physical/Special Split
Reply With Quote
  #9    
Old August 23rd, 2013, 02:23 AM
Aruaruu
 
Join Date: Sep 2011
Gender: Male
Okay I will just list the steps I have been taking and you point out what is wrong and what to do with them.

1. I copy the ASM in the first post into a new notepad document.

2. I changed the .EV_Table variable from 0x08F00000 to 0x08E42710 (so that is the location of the spreads.)

3. I change the offsets in the method to what you put down. (0x115f6 -> x38936, 0x3dc70 -> x67d68, 0x3dc8b -> 0x67d83, x404d0 -> x6ad9c) (404d0 isn't in the method. It says "404d1." typo?)

4. You replied with the following.
Quote:
What you need to do is go to those offsets in the .bin file, and copy what you see there into the ROM at the same offset you found it in the .bin. You also need to change x1E9F68 to be somewhere in free space before you compile- likewise you will need to change the pointer used by the jump to it to be (wherever you put the method) + 1.
So by that you mean I change the x1E9F68 in the asm to something like xFFFDF0 for example?(This is where I'll put the method)
Is the "pointer used by the jump" the 0x081E9F69 just above the x1E9F68? It looks like it is since it is 9 instead of 8 and you said +1 to it. Then I would replace the 0x081E9F69 with 0x08FFFDF1?
...and then I would go to the the offsets 0x38936, 0x67d68 and 0x1E9F68(which is now 0xFFFDF0) in the compiled .bin file and copy whatever data is there, go to those offsets in the ROM and overwrite them with the data from each offset in the .bin?

I did all of this to test it out and the game restarts when initiating the battle with the first Roxanne rematch. It did not do that before.
Reply With Quote
  #10    
Old August 23rd, 2013, 07:12 AM
DoesntKnowHowToPlay's Avatar
DoesntKnowHowToPlay
some loser
 
Join Date: Jan 2012
Quote:
(404d0 isn't in the method. It says "404d1." typo?)
Yeah, you want to change that to x6AD9D. My bad, was looking at older versions of the code when doing that.

Quote:
So by that you mean I change the x1E9F68 in the asm to something like xFFFDF0 for example?(This is where I'll put the method)
Is the "pointer used by the jump" the 0x081E9F69 just above the x1E9F68? It looks like it is since it is 9 instead of 8 and you said +1 to it. Then I would replace the 0x081E9F69 with 0x08FFFDF1?
...and then I would go to the the offsets 0x38936, 0x67d68 and 0x1E9F68(which is now 0xFFFDF0) in the compiled .bin file and copy whatever data is there, go to those offsets in the ROM and overwrite them with the data from each offset in the .bin?
This looks pretty much correct, although if you didn't fix the x404d1 -> x6ad9d I would expect the game to crash.
__________________

Yet Another Fire Red Hack

Physical/Special Split
Reply With Quote
  #11    
Old August 23rd, 2013, 08:37 AM
Aruaruu
 
Join Date: Sep 2011
Gender: Male
I fixed that part that was a typo and it is still restarting when I start the roxanne battle.

I got some images of what I am copying from the assembled .bin. Am I not copying everything or something?

Spoiler:


Spoiler:


Spoiler:


and here is the asm before compiling.

Spoiler:
Code:
#EV spread table format
#Each spread is 16 bytes
#first four bytes are filler
#0x4 = IVs (from 0-31, not 0-255, used for all IVs)
# (if you want hidden powers, recall the ai can't handle -- bp moves)
#0x5 = HP EVs
#0x6 = Atk EVs
#0x7 = Def EVs
#0x8 = Speed EVs
#0x9 = SAtk EVs
#0xA = SDef EVs
#0xB = Pokeball
#last four bytes are filler

.align 2
.thumb
.thumb_func

.org 0x38936
mov r0, r1
lsl r1, r1, #0x0
lsl r1, r1, #0x0
lsl r1, r1, #0x0
lsl r1, r1, #0x0

.org 0x67d68
lsl r1, r1, #0x0
lsl r1, r1, #0x0
ldr r1, .Method_Addr
bx r1

.Method_Addr: .word 0x08FFFDF1

.org 0xFFFDF0

LoadHPEV:
mov r0, sp
ldrb r0, [r0, #0x11]
lsl r0, r0, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x5
mov r1, #0x1A
mov r0, r7
bl Insert_Element

LoadAtkEV:
mov r0, sp
ldrb r0, [r0, #0x11]
lsl r0, r0, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x6
mov r1, #0x1B
mov r0, r7
bl Insert_Element

LoadDefEV:
mov r0, sp
ldrb r0, [r0, #0x11]
lsl r0, r0, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x7
mov r1, #0x1C
mov r0, r7
bl Insert_Element

LoadSpeedEV:
mov r0, sp
ldrb r0, [r0, #0x11]
lsl r0, r0, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x8
mov r1, #0x1D
mov r0, r7
bl Insert_Element

LoadSAtkEV:
mov r0, sp
ldrb r0, [r0, #0x11]
lsl r0, r0, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0x9
mov r1, #0x1E
mov r0, r7
bl Insert_Element

LoadSDefEV:
mov r0, sp
ldrb r0, [r0, #0x11]
lsl r0, r0, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0xA
mov r1, #0x1F
mov r0, r7
bl Insert_Element

LoadBall:
mov r0, sp
ldrb r0, [r0, #0x11]
lsl r0, r0, #0x4
ldr r2, .EV_Table
add r2, r0
add r2, #0xB
mov r1, #0x26
mov r0, r7
bl Insert_Element

LoadIVs:
mov r1, sp
ldrb r0, [r1, #0x11]
lsl r0, r0, #0x4
ldr r2, .EV_Table
add r2, r0
ldrb r2, [r2, #0x4]
strb r2, [r1, #0x11]

HPIV:
add r0, r7, #0x0
mov r1, #0x27
mov r2, sp
add r2, #0x11
bl Insert_Element

AtkIV:
add r0, r7, #0x0
mov r1, #0x28
mov r2, sp
add r2, #0x11
bl Insert_Element

End:
ldr r1, .Return_Addr
bx r1

Insert_Element:
ldr r3, .Insert_Addr
bx r3


.align 2
.Return_Addr: .word 0x08067d83
.EV_Table: .word 0x08E42710
.Insert_Addr: .word 0x0806AD9D


Thanks for bearing with me.
Reply With Quote
  #12    
Old August 23rd, 2013, 10:00 AM
DoesntKnowHowToPlay's Avatar
DoesntKnowHowToPlay
some loser
 
Join Date: Jan 2012
THUMB commands are two bytes each- make sure in the first case that you also grab the 00 byte at the end.
__________________

Yet Another Fire Red Hack

Physical/Special Split
Reply With Quote
  #13    
Old August 23rd, 2013, 10:43 AM
DoesntKnowHowToPlay's Avatar
DoesntKnowHowToPlay
some loser
 
Join Date: Jan 2012
Neither of those is what I meant. The only byte you're missing is the 00 at the end of the first image- that is the second part of the last lsl r1, r1, #0x0 command. If it isn't changed, the last command becomes 09 FE (blh $0c12), which predictably crashes the game, instead of 09 00 (lsl r1, r1, #0x0), which is a no-op.
__________________

Yet Another Fire Red Hack

Physical/Special Split
Reply With Quote
  #14    
Old August 23rd, 2013, 10:52 AM
Aruaruu
 
Join Date: Sep 2011
Gender: Male
Quote:
Originally Posted by DoesntKnowHowToPlay View Post
Neither of those is what I meant. The only byte you're missing is the 00 at the end of the first image- that is the second part of the last lsl r1, r1, #0x0 command. If it isn't changed, the last command becomes 09 FE (blh $0c12), which predictably crashes the game, instead of 09 00 (lsl r1, r1, #0x0), which is a no-op.
It is working now. Thank you very much for helping me. :D
Reply With Quote
  #15    
Old August 23rd, 2013, 04:28 PM
SBird
 
Join Date: Aug 2009
Gender: Male
First things first: This is awesome! Great work
But I still dare to ask if it's possible to also change the nature of a pokémon(like hardy lonely, ...) because this can bring an enormous strategic improvement. Otherwise the trainer(or gym leader in most cases, normal pokémon won't get much in terms of EVs I suppose) just ends up with having many points in offence while losing 10% of it due to the nature of the pokémon. I'm not familiar with the routines you edited and came up with, so I'm probably not able to do this myself.

But nevertheless this is a great routine and I'm looking forward to using it soon.

~SBird
Reply With Quote
  #16    
Old August 24th, 2013, 01:18 AM
Aruaruu
 
Join Date: Sep 2011
Gender: Male
So about the 33rd slot. Do I just leave it how it was (Full of FFs) or do I need to change something?

This is the 33rd slot here? (first EV spread is at the top)

Spoiler:
Reply With Quote
  #17    
Old August 24th, 2013, 01:53 AM
pawell6's Avatar
pawell6
The truthseeker
 
Join Date: Feb 2010
Location: Poland
Age: 26
Gender: Male
Quote:
Originally Posted by Aruaruu View Post
So about the 33rd slot. Do I just leave it how it was (Full of FFs) or do I need to change something?

This is the 33rd slot here? (first EV spread is at the top)

Spoiler:
If there are only FF's all pokemons found in the wild will have 31 IV and 255 EV in all stat. You should make six 00's for ev. Using that method IV are no longer random.

The same thing happens when you receive pokemon from npc - ev and iv are from 33rd slot.
__________________
Most of new moves is done. Fixing timing of some animations and updating learnsets in progress.
Reply With Quote
  #18    
Old August 24th, 2013, 03:26 AM
pawell6's Avatar
pawell6
The truthseeker
 
Join Date: Feb 2010
Location: Poland
Age: 26
Gender: Male
There is something weird with table. When I try to type next spreads (0x00,0x01,0x02,0x03, ....) nothing change until 0x09 comes in (then the second spread seems to work). The third spread shows when I type 0x12 (18 in dec) and so on. This limitates number of possible spreads. Has anyone experienced similar issues?
__________________
Most of new moves is done. Fixing timing of some animations and updating learnsets in progress.
Reply With Quote
  #19    
Old August 24th, 2013, 04:18 AM
Aruaruu
 
Join Date: Sep 2011
Gender: Male
Quote:
Originally Posted by pawell6 View Post
There is something weird with table. When I try to type next spreads (0x00,0x01,0x02,0x03, ....) nothing change until 0x09 comes in (then the second spread seems to work). The third spread shows when I type 0x12 (18 in dec) and so on. This limitates number of possible spreads. Has anyone experienced similar issues?
Not sure what you mean exactly...Would you be able to get screenshots of whatever is happening?
Reply With Quote
  #20    
Old August 24th, 2013, 07:20 AM
DoesntKnowHowToPlay's Avatar
DoesntKnowHowToPlay
some loser
 
Join Date: Jan 2012
I've revised the code and updated the OP with it. This fixed wild/gift pokemon no longer having randomized IVs- there is also no risk of them getting EVs or custom balls if you forget to sanitize the 33rd entry in the table.

With regards to natures- I would very much like to do this, but I've run into complications. The main issue is that the personality value, which determines nature, is also used to encrypt other parts of the mon's data- if it gets changed, the rest of the struct has to be re-ordered. I intend to keep looking into it (I'll probably have to inject the method somewhere earlier in the code), but it'll take a bit.

Quote:
There is something weird with table. When I try to type next spreads (0x00,0x01,0x02,0x03, ....) nothing change until 0x09 comes in (then the second spread seems to work). The third spread shows when I type 0x12 (18 in dec) and so on. This limitates number of possible spreads. Has anyone experienced similar issues?
Please elaborate- I'm not sure exactly what's going on here.
__________________

Yet Another Fire Red Hack

Physical/Special Split
Reply With Quote
  #21    
Old August 24th, 2013, 07:41 AM
Aruaruu
 
Join Date: Sep 2011
Gender: Male
Quote:
Originally Posted by DoesntKnowHowToPlay View Post
I've revised the code and updated the OP with it. This fixed wild/gift pokemon no longer having randomized IVs- there is also no risk of them getting EVs or custom balls if you forget to sanitize the 33rd entry in the table.
Oh. So then I can just leave it filled with FF then?
Reply With Quote
  #22    
Old August 24th, 2013, 07:47 AM
DoesntKnowHowToPlay's Avatar
DoesntKnowHowToPlay
some loser
 
Join Date: Jan 2012
Yes- with the new method, that will work.
__________________

Yet Another Fire Red Hack

Physical/Special Split
Reply With Quote
  #23    
Old August 24th, 2013, 08:47 AM
pawell6's Avatar
pawell6
The truthseeker
 
Join Date: Feb 2010
Location: Poland
Age: 26
Gender: Male
I made a screenshot. In the offset 0xEFFF90 is trainer data and 0xF00000, 0xF10000, and so on are spreads from table. Red 00 are number of spread from table. When I change red 00 to 01 spread from offset 0xF10000 doesn't load and the spread from 0xF00000 is loaded instead (ofcourse I tested it after saving in a hex editor and noticed that opponent's pokeball doesn't change from masterball to ultraball).
As I stated before, the spread from 0xF10000 load only if red 00 is changed to 09. So spreads are loaded in such way:
0x00 -> offset 0xF00000
0x09 -> offset 0xF10000
0x12 -> offset 0xF20000
0x1B -> offset 0xF30000
instead of
0x00 -> offset 0xF00000
0x01 -> offset 0xF10000
0x02 -> offset 0xF20000
0x03 -> offset 0xF30000
Attached Images
File Type: png scr.PNG‎ (7.4 KB, 23 views) (Save to Dropbox)
__________________
Most of new moves is done. Fixing timing of some animations and updating learnsets in progress.
Reply With Quote
  #24    
Old August 24th, 2013, 11:01 AM
DoesntKnowHowToPlay's Avatar
DoesntKnowHowToPlay
some loser
 
Join Date: Jan 2012
Make sure you're inserting *all* of the asm- not all of it will be at the end of the binary. In FR, you'll also need to go 0x115f6 and 0x3dc70. It sounds like you didn't grab all of the first block, which makes the game load the entire byte of IV data instead of reducing it to a 0-31 range.
__________________

Yet Another Fire Red Hack

Physical/Special Split
Reply With Quote
  #25    
Old August 24th, 2013, 12:03 PM
pawell6's Avatar
pawell6
The truthseeker
 
Join Date: Feb 2010
Location: Poland
Age: 26
Gender: Male
I checked several times, in 0x115f6 I inserted 08 1C 00 00 00 00 00 00 00 00, in 0x3dc70 I inserted 00 00 00 00 00 49 08 47 01 00 F1 08 and in 0xF10000 I insterted
Quote:
68 46 40 7C 20 28 5A D0 68 46 40 7C 00 01 30 4A 12 18 05 32 1A 21 38 1C 00 F0 53 F8 68 46 40 7C 00 01 2B 4A 12 18 06 32 1B 21 38 1C 00 F0 49 F8 68 46 40 7C 00 01 26 4A 12 18 07 32 1C 21 38 1C 00 F0 3F F8 68 46 40 7C 00 01 21 4A 12 18 08 32 1D 21 38 1C 00 F0 35 F8 68 46 40 7C 00 01 1C 4A 12 18 09 32 1E 21 38 1C 00 F0 2B F8 68 46 40 7C 00 01 17 4A 12 18 0A 32 1F 21 38 1C 00 F0 21 F8 68 46 40 7C 00 01 12 4A 12 18 0B 32 26 21 38 1C 00 F0 17 F8 69 46 48 7C 00 01 0D 4A 12 18 12 79 4A 74 38 1C 27 21 6A 46 11 32 00 F0 0A F8 38 1C 28 21 6A 46 11 32 00 F0 04 F8 03 49 08 47 03 49 08 47 04 4B 18 47 C0 46 8B DC 03 08 D1 DC 03 08 00 00 F0 08 D1 04 04 08
and it's the same: instead of 255 available spreads I "only" have 29
__________________
Most of new moves is done. Fixing timing of some animations and updating learnsets in progress.
Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Minimum Characters Per Post: 25



All times are UTC -8. The time now is 01:49 PM.


Style by Nymphadora, artwork by Sa-Dui.
Like our Facebook Page Follow us on Twitter © 2002 - 2014 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2014 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.