• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[ASM & Hex] [FR] EV Mechanics

534
Posts
11
Years
    • Age 26
    • Seen Jul 24, 2023
    Well, I was bored and started reading up on Bulbapedia and stumbled upon the article of Super Training through the random article link.

    Anyways, to the main point. I read that only Deoxys' stats were recalculated every battle which I thought to be a solution for the problem in raising the EVs of level 100 Pokémon.

    All threads/posts I found here at the community that could be related to the topic was the capping of EVs to 252, the EV reducing berries, and other posts that might ask the same idea I am asking now.

    So, I am sorry if this was already done and I couldn't find the right terms to search for it but, can we make it so that EVs can still change even after reaching level 100? Like for example, making every Pokémon recalculate their stats after every battle, make items that act like vitamins but increase stats further than it could, or possibly a C-coded Super Training?

    Happy hacking! {XD}

    Oh and I am sorry if my post doesn't really make sense. It might be due to the facts that English is not my primary language, I don't really read much about new games and features, and I don't really read much on R&D too. Sorry. :)
     

    Deokishisu

    Mr. Magius
    990
    Posts
    18
    Years
  • I actually remember that someone did this years ago, but when I was looking for it a few months back I couldn't find the post. I'll look around again.

    EDIT: After exhausting my Googlefu, I'm not able to find that post. I KNOW that someone did it (someone who used to be active but isn't around anymore and knew some ASM), but it was a very long time ago and I can't get my keywords to pull it up.
     
    Last edited:
    534
    Posts
    11
    Years
    • Age 26
    • Seen Jul 24, 2023
    I actually remember that someone did this years ago, but when I was looking for it a few months back I couldn't find the post. I'll look around again.

    EDIT: After exhausting my Googlefu, I'm not able to find that post. I KNOW that someone did it (someone who used to be active but isn't around anymore and knew some ASM), but it was a very long time ago and I can't get my keywords to pull it up.
    Well, what was it actually about? Is it the modification of stats through decrypting and re-encrypting of Pokémon? Because that idea struck me just now. {XD}

    EDIT: Looks like I haven't searched enough because I found this just now. http://www.pokecommunity.com/showpost.php?p=8708973&postcount=15
     

    Deokishisu

    Mr. Magius
    990
    Posts
    18
    Years
  • Well, what was it actually about? Is it the modification of stats through decrypting and re-encrypting of Pokémon? Because that idea struck me just now. {XD}

    EDIT: Looks like I haven't searched enough because I found this just now. http://www.pokecommunity.com/showpost.php?p=8708973&postcount=15

    That's not the post that I'm referring to. In Gen 3, Deoxys is the only one that recalculates its stats after every battle. This person made it so that the Deoxys check passed for every Pokemon and everyone's stats got recalculated after battle, which would make the box trick obsolete and allow level 100 Pokemon to gain EVs and have them applied to their stats after battle. The changes they did were automatic after battle and didn't need to be called separately.

    I did another search with different terms and still can't pull up the post. It was so many years ago that I can't remember the exact wording of the post, so I can't just search a remembered sentence in quotes and get to it like I normally do when searching for past posts.
     
    534
    Posts
    11
    Years
    • Age 26
    • Seen Jul 24, 2023
    That's not the post that I'm referring to. In Gen 3, Deoxys is the only one that recalculates its stats after every battle. This person made it so that the Deoxys check passed for every Pokemon and everyone's stats got recalculated after battle, which would make the box trick obsolete and allow level 100 Pokemon to gain EVs and have them applied to their stats after battle. The changes they did were automatic after battle and didn't need to be called separately.

    I did another search with different terms and still can't pull up the post. It was so many years ago that I can't remember the exact wording of the post, so I can't just search a remembered sentence in quotes and get to it like I normally do when searching for past posts.
    Oh. Well, was it made here or in another forum? :(
     
    232
    Posts
    13
    Years
    • Seen Sep 10, 2019
    sorry for the bump, I am currently searching for this too :(
    edit: looks like the recalculation of deoxys only occurs in FR/LG/EM, where Deoxys changes forme upon capture. It wouldn't happen in R/S I believe.
    the routine offset is at 0x08044674 (get_pokemon_data_3).

    Code:
    @ =============== S U B    R O U T    I N E =======================================
    
    
    get_pokemon_data_3:            @ CODE XREF: pokemon_getattr+C8p
                        @ pokemon_getattr+DAp ...
            PUSH    {R4-R6,LR}
            ADD    R5, R0,    #0
            ADD    R6, R1,    #0
            LDR    R0, off_804469C
            LDR    R0, [R0]
            MOV    R1, #0x20 @ ' '
            AND    R0, R1
            CMP    R0, #0
            BNE    loc_8044698
            ADD    R0, R5,    #0
            MOV    R1, #0xB
            MOV    R2, #0
            BL    pokemon_getattr
            MOV    R1, #0xCD @ '?'
            LSL    R1, R1,    #1
            CMP    R0, R1
            BEQ    loc_80446A0
    
    loc_8044698:                @ CODE XREF: get_pokemon_data_3+10j
            MOV    R0, #0
            B    loc_80446FE
    @ ---------------------------------------------------------------------------
    .align 2
    off_804469C:    .long 0x2022B4C        @ DATA XREF: get_pokemon_data_3+6r
    @ ---------------------------------------------------------------------------
    
    loc_80446A0:                @ CODE XREF: get_pokemon_data_3+22j
            ADD    R1, R6,    #0
            ADD    R1, #0x27 @ '''
            ADD    R0, R5,    #0
            MOV    R2, #0
            BL    pokemon_getattr
            ADD    R4, R0,    #0
            ADD    R1, R6,    #0
            ADD    R1, #0x1A
            ADD    R0, R5,    #0
            MOV    R2, #0
            BL    pokemon_getattr
            LDR    R2, off_8044704
            LSL    R1, R6,    #1
            ADD    R1, R1,    R2
            LDRH    R1, [R1]
            LSL    R1, R1,    #1
            ADD    R1, R1,    R4
            CMP    R0, #0
            BGE    loc_80446CC
            ADD    R0, #3
    
    loc_80446CC:                @ CODE XREF: get_pokemon_data_3+54j
            ASR    R0, R0,    #2
            ADD    R0, R1,    R0
            ADD    R1, R5,    #0
            ADD    R1, #0x54 @ 'T'
            LDRB    R1, [R1]
            MUL    R0, R1
            MOV    R1, #0x64 @ 'd'
            BL    __divsi3
            ADD    R0, #5
            LSL    R0, R0,    #0x10
            LSR    R4, R0,    #0x10
            ADD    R0, R5,    #0
            BL    pokemon_id_mod_25_aka_nature
            LSL    R0, R0,    #0x18
            LSR    R0, R0,    #0x18
            LSL    R2, R6,    #0x18
            LSR    R2, R2,    #0x18
            ADD    R1, R4,    #0
            BL    nature_stat_mod
            LSL    R0, R0,    #0x10
            LSR    R4, R0,    #0x10
            ADD    R0, R4,    #0
    
    loc_80446FE:                @ CODE XREF: get_pokemon_data_3+26j
            POP    {R4-R6}
            POP    {R1}
            BX    R1
    @ End of function get_pokemon_data_3
    
    @ ---------------------------------------------------------------------------
    .align 2
    off_8044704:    .long unk_825E026    @ DATA XREF: get_pokemon_data_3+46r
     
    Last edited:
    325
    Posts
    10
    Years
  • sorry for the bump, I am currently searching for this too :(
    edit: looks like the recalculation of deoxys only occurs in FR/LG/EM, where Deoxys changes forme upon capture. It wouldn't happen in R/S I believe.
    the routine offset is at 0x08044674 (get_pokemon_data_3).

    Code:
    @ =============== S U B    R O U T    I N E =======================================
    
    
    get_pokemon_data_3:            @ CODE XREF: pokemon_getattr+C8p
                        @ pokemon_getattr+DAp ...
            PUSH    {R4-R6,LR}
            ADD    R5, R0,    #0
            ADD    R6, R1,    #0
            LDR    R0, off_804469C
            LDR    R0, [R0]
            MOV    R1, #0x20 @ ' '
            AND    R0, R1
            CMP    R0, #0
            BNE    loc_8044698
            ADD    R0, R5,    #0
            MOV    R1, #0xB
            MOV    R2, #0
            BL    pokemon_getattr
            MOV    R1, #0xCD @ '?'
            LSL    R1, R1,    #1
            CMP    R0, R1
            BEQ    loc_80446A0
    
    loc_8044698:                @ CODE XREF: get_pokemon_data_3+10j
            MOV    R0, #0
            B    loc_80446FE
    @ ---------------------------------------------------------------------------
    .align 2
    off_804469C:    .long 0x2022B4C        @ DATA XREF: get_pokemon_data_3+6r
    @ ---------------------------------------------------------------------------
    
    loc_80446A0:                @ CODE XREF: get_pokemon_data_3+22j
            ADD    R1, R6,    #0
            ADD    R1, #0x27 @ '''
            ADD    R0, R5,    #0
            MOV    R2, #0
            BL    pokemon_getattr
            ADD    R4, R0,    #0
            ADD    R1, R6,    #0
            ADD    R1, #0x1A
            ADD    R0, R5,    #0
            MOV    R2, #0
            BL    pokemon_getattr
            LDR    R2, off_8044704
            LSL    R1, R6,    #1
            ADD    R1, R1,    R2
            LDRH    R1, [R1]
            LSL    R1, R1,    #1
            ADD    R1, R1,    R4
            CMP    R0, #0
            BGE    loc_80446CC
            ADD    R0, #3
    
    loc_80446CC:                @ CODE XREF: get_pokemon_data_3+54j
            ASR    R0, R0,    #2
            ADD    R0, R1,    R0
            ADD    R1, R5,    #0
            ADD    R1, #0x54 @ 'T'
            LDRB    R1, [R1]
            MUL    R0, R1
            MOV    R1, #0x64 @ 'd'
            BL    __divsi3
            ADD    R0, #5
            LSL    R0, R0,    #0x10
            LSR    R4, R0,    #0x10
            ADD    R0, R5,    #0
            BL    pokemon_id_mod_25_aka_nature
            LSL    R0, R0,    #0x18
            LSR    R0, R0,    #0x18
            LSL    R2, R6,    #0x18
            LSR    R2, R2,    #0x18
            ADD    R1, R4,    #0
            BL    nature_stat_mod
            LSL    R0, R0,    #0x10
            LSR    R4, R0,    #0x10
            ADD    R0, R4,    #0
    
    loc_80446FE:                @ CODE XREF: get_pokemon_data_3+26j
            POP    {R4-R6}
            POP    {R1}
            BX    R1
    @ End of function get_pokemon_data_3
    
    @ ---------------------------------------------------------------------------
    .align 2
    off_8044704:    .long unk_825E026    @ DATA XREF: get_pokemon_data_3+46r

    I believe writing 08 1C at 0x44692 would make the check always go through, therefore it would always be calculated. Oops forgot the battle type. C0 46 at 0x44684 will nop out the battle type check.
     
    Last edited:
    232
    Posts
    13
    Years
    • Seen Sep 10, 2019
    I believe writing 08 1C at 0x44692 would make the check always go through, therefore it would always be calculated. Oops forgot the battle type. C0 46 at 0x44684 will nop out the battle type check.

    The thing is, that routine uses off_8044704 which contains DEOXYS' attack forme stats. So if one got rid of the check, every pokemon will have its stats.
     
    325
    Posts
    10
    Years
  • The thing is, that routine uses off_8044704 which contains DEOXYS' attack forme stats. So if one got rid of the check, every pokemon will have its stats.

    I didn't see that. That sounds hilarious actually.

    You could change the push/pop to use r7, then use mov r7, r2 where it loads off_8044704, and have r7 be the location of the pokemon base stats. I wanna try it, but I don't have much time lately. If I were you, I'd overwrite all the checks with the thing that gets r7 and leave most of the rest if you can.

    -edit- remember to leave a check for deoxys unless you want to leave it at normal form all the time.

    -edit- wtf i'm so bored and i don't have time to test because i now have to go but i wrote this, test pls

    Code:
    .thumb
    
    .macro get_attr
    	bl 0x03FBE8
    .endm
    
    .macro load_deoxys_species
    	mov r1, #0xCD
    	lsl r1, #1
    .endm
    
    .org 0x044674
    main:
    	push {r4-r7, lr}
    	mov r5, r0 @pokemon struct
    	mov r6, r1 @which stat to update
    	mov r1, #0xB @species, also r0 is still the same so it's ok
    	mov r2, #0
    	get_attr
    	load_deoxys_species
    	cmp r0, r1
    	beq load_atk
    	mov r1, #0x1C @size_of(pokemon_base)
    	mul r0, r1 @size doesn't look like a word
    	ldr r1, pokemon_base
    	add r0, r1
    	mov r7, r0 @r7 is the correct pokemon base.
    	b 0x0446A0 @end
    load_atk:
    	ldr r0, deoxys_atk_base
    	mov r7, r0
    	b 0x0446A0 @end
    
    .align 2
    pokemon_base: .word 0x08254784
    
    .org 0x0446BA
    	mov r2, r7
    
    .org 0x0446FE
    	pop {r4-r7} @you can change this to pop {r4-r7, pc}
    		@that gives you 6 free bytes to work with if you
    		@decompile the entire routine
    
    .org 0x044704
    deoxys_atk_base:
     
    Last edited:
    232
    Posts
    13
    Years
    • Seen Sep 10, 2019
    I didn't see that. That sounds hilarious actually.

    You could change the push/pop to use r7, then use mov r7, r2 where it loads off_8044704, and have r7 be the location of the pokemon base stats. I wanna try it, but I don't have much time lately. If I were you, I'd overwrite all the checks with the thing that gets r7 and leave most of the rest if you can.

    -edit- remember to leave a check for deoxys unless you want to leave it at normal form all the time.

    -edit- wtf i'm so bored and i don't have time to test because i now have to go but i wrote this, test pls

    Code:
    .thumb
    
    .macro get_attr
        bl 0x03FBE8
    .endm
    
    .macro load_deoxys_species
        mov r1, #0xCD
        lsl r1, #1
    .endm
    
    .org 0x044674
    main:
        push {r4-r7, lr}
        mov r5, r0 @pokemon struct
        mov r6, r1 @which stat to update
        mov r1, #0xB @species, also r0 is still the same so it's ok
        mov r2, #0
        get_attr
        load_deoxys_species
        cmp r0, r1
        beq load_atk
        mov r1, #0x1C @size_of(pokemon_base)
        mul r0, r1 @size doesn't look like a word
        ldr r1, pokemon_base
        add r0, r1
        mov r7, r0 @r7 is the correct pokemon base.
        b 0x0446A0 @end
    load_atk:
        ldr r0, deoxys_atk_base
        mov r7, r0
        b 0x0446A0 @end
    
    .align 2
    pokemon_base: .word 0x08254784
    
    .org 0x0446BA
        mov r2, r7
    
    .org 0x0446FE
        pop {r4-r7} @you can change this to pop {r4-r7, pc}
            @that gives you 6 free bytes to work with if you
            @decompile the entire routine
    
    .org 0x044704
    deoxys_atk_base:

    all i get is a bunch of 00s when I compile it. am i supposed to compile that just once?
     
    325
    Posts
    10
    Years
  • all i get is a bunch of 00s when I compile it. am i supposed to compile that just once?

    Open it in a hex editor and go to offset 0x044674. That's what the .org is for, to make sure it's in the right place. Assembling it without the .orgs will cause massive bugs and crash the game for sure.
     
    232
    Posts
    13
    Years
    • Seen Sep 10, 2019
    Open it in a hex editor and go to offset 0x044674. That's what the .org is for, to make sure it's in the right place. Assembling it without the .orgs will cause massive bugs and crash the game for sure.

    Oh okay I finally got it. It still messes up the other pokemon's stats though. My dragonite has 634 speed now!!

    edit: I think the pokemon base table structure has to look like the one at 44704 (stored as half-words), otherwise the stats will look messed up. Meaning one would probably have to create an entire new table that includes each pokemon's stats in half-words lol.
     
    Last edited:
    325
    Posts
    10
    Years
  • Oh okay I finally got it. It still messes up the other pokemon's stats though. My dragonite has 634 speed now!!

    edit: I think the pokemon base table structure has to look like the one at 44704 (stored as half-words), otherwise the stats will look messed up. Meaning one would probably have to create an entire new table that includes each pokemon's stats in half-words lol.

    why wouldn't you want a dragonite with 634 speed tho

    all kidding aside, i should probably fix that. that will require rewriting the entire routine which is probably better because there's ways to save space in there anyway. you should also give it a shot as i have incredibly little time lately.

    -edit- or maybe my routine has a small bug in it somewhere or something idfk. also this routine kind of relies on you not expanding your pokedex, so that may play a part.

    -edit- why make an entirely new structure for all the pokemon when you could just change the one stat table right
    i haven't tested it but this should work. now it loads a byte like it should so you don't get massively op pokemon all the time. this also makes the .bin much larger but w/e it's ok.

    Code:
    .thumb
    @0000 0000 1100 1101
    @0000 0001 1001 1010 0x19A
    
    .macro get_attr
    	bl 0x03FBE8
    .endm
    
    .macro load_deoxys_species
    	mov r1, #0xCD
    	lsl r1, #1
    .endm
    
    .org 0x044674
    main:
    	push {r4-r7, lr}
    	mov r5, r0 @pokemon struct
    	mov r6, r1 @which stat to update
    	mov r1, #0xB @species, also r0 is still the same so it's ok
    	mov r2, #0
    	get_attr
    	load_deoxys_species
    	cmp r0, r1
    	beq load_atk
    	mov r1, #0x1C @size_of(pokemon_base)
    	mul r0, r1 @multiply to get the right base
    	ldr r1, pokemon_base
    	add r0, r1
    	mov r7, r0 @r7 is the correct pokemon base.
    	b 0x0446A0 @end
    load_atk:
    	ldr r0, deoxys_atk_base
    	mov r7, r0
    	b 0x0446A0 @end
    
    .align 2
    pokemon_base: .word 0x08254784
    
    .org 0x0446BA
    	mov r2, r7
    	lsl r1, r6, #1
    	add r1, r2
    	ldrb r1, [r1]
    
    .org 0x0446FE
    	pop {r4-r7} @you can change this to pop {r4-r7, pc}
    		@that gives you 6 free bytes to work with if you
    		@decompile the entire routine
    
    .org 0x044704
    deoxys_atk_base: .word deoxys_atk_stats + 0x08000000
    
    .org 0x25E026
    deoxys_atk_stats:
    .byte 0x32, 0xB4, 0x14, 0x96, 0xB4, 0x14

    that last edit was to make it easier to change the deoxys form in the future along with this feature.
     
    Last edited:
    Back
    Top