• 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.

Code: ASM Resource Thread

Lunos

Random Uruguayan User
3,114
Posts
15
Years
  • I made a mistake in that post. Assemble the new routine, goto the offset in the routine, and copy what's there in the .bin file to that offset in your rom.

    So, what I have to put in 0x1083F4 now is basically:
    10 B5 08 4C F1 20 A0 30 C0 00 FA F6 CD FB 20 60 00 28 06 D0 04 48 FA F6 C7 FB 60 60 00 28 00 D0 01 20 10 BD 18 AD 03 02 E3 11 00 00
    ^ That is the routine that you just gave to me right here.

    Then I go to 0x99E44 and Ctrl+B this:
    10 49 0C 48 08 60 96 20 40 00 88 80 08 48 88 60 3C 20 08 73 08 48 08 61 1B 20 08 75 07 48 88 61 80 20 08 77 06 48 08 62 24 31 43 20 08 70 70 47 C0 59 02 02 D0 C6 03 02 3C 58 02 02 D0 C4 03 02 B0 58 02 02 8C 98 03 02
    As you explained in this post.

    And then it should be working?
    Because it's not. The Items pocket of my bag is still capping at 44 items.


    EDIT: Alright, we were able to solve the issue on Discord.

    The procedure is simple and I'm gonna leave it right here in order to avoid any kind of confusion:
    1) Compile the routine that Skeli posted right here and Ctrl+B it in 0x1083F4.
    2) Compile this ASM Routine that he wrote and Ctrl+B it in 0x99E44.
    3) Save and test, but make sure to start a new savefile. Old savefiles will not work.
    And that's it.

    Here's a quick video showing it in action.
     
    Last edited:
    53
    Posts
    5
    Years
    • Seen Mar 9, 2022
    Hey everyone. I have another ASM hack to provide.

    This ASM hack is one for infinite use of the Elemental Hyper Beam tutor and I've made it so that all of the final starter evolutions have access to their respective ultimate moves just like in newer games as well. It isn't like the other tutors where you can just clear or never set a particular flag just by looking at the flags in the script and it also uses two routines to check for compatibility.

    Routine 1:
    Code:
    .thumb
    .align
    
    .equ PKMN_VENUSAUR, 0x3
    .equ PKMN_CHARIZARD, 0x6
    .equ PKMN_BLASTOISE, 0x9
    .equ PKMN_MEGANIUM, 0x9A
    .equ PKMN_TYPHLOSION, 0x9D
    .equ PKMN_FERALIGATR, 0xA0
    .equ PKMN_SCEPTILE, 0x117
    .equ PKMN_BLAZIKEN, 0x11A
    .equ PKMN_SWAMPERT, 0x11D
    .equ MyLoc, 0x720360 @insert your location here
    .equ RomAreaOffset,	0x8000000
    
    
    .org 0x120BF2, 0xFF
    ldr r1, Hook
    bx r1
    .align 2
    Hook: .word RomAreaOffset+move_tutor_hook+1
    
    .org MyLoc, 0xFF
    move_tutor_hook:
    cmp r2, #0x10
    beq fire_starter_check_hook
    cmp r2, #0x10
    bgt watercheck
    cmp r2, #0xF
    beq grass_starter_check_hook
    ldr r1, GeneralMoveTutorCheck
    bx r1
    
    
    .align 2
    .pool
    
    .align 2
    
    watercheck:
    cmp r2, #0x11
    beq water_starter_check_hook
    ldr r1, GeneralMoveTutorCheck
    bx r1
    
    
    .align 2
    .pool
    
    .align 2
    
    grass_starter_check_hook:
    cmp r0, #PKMN_VENUSAUR
    beq successlink
    cmp r0, #PKMN_MEGANIUM
    beq successlink
    ldr r1, =PKMN_SCEPTILE
    cmp r0, r1
    beq successlink
    b faillink
    
    
    .align 2
    .pool
    
    .align 2
    
    fire_starter_check_hook:
    cmp r0, #PKMN_CHARIZARD
    beq successlink
    cmp r0, #PKMN_TYPHLOSION
    beq successlink
    ldr r1, =PKMN_BLAZIKEN
    cmp r0, r1
    beq successlink
    b faillink
    
    
    .align 2
    .pool
    
    .align 2
    
    water_starter_check_hook:
    cmp r0, #PKMN_BLASTOISE
    beq successlink
    cmp r0, #PKMN_FERALIGATR
    beq successlink
    ldr r1, =PKMN_SWAMPERT
    cmp r0, r1
    beq successlink
    b faillink
    
    
    .align 2
    .pool
    
    .align 2
    
    successlink:
    ldr r0, success
    bx r0
    
    
    .align 2
    .pool
    
    .align 2
    
    faillink:
    ldr r0, fail
    bx r0
    
    
    .align 2
    .pool
    
    .align 2
    
    success: .word 0x8120C34 + 1
    fail: .word 0x8120C2A + 1
    GeneralMoveTutorCheck: .word 0x8120C18 + 1

    Routine 1 is for hooking the compatibility check when teaching the move in the party screen.

    Routine 2:
    Code:
    .thumb
    .align
    
    .equ PKMN_VENUSAUR, 0
    .equ PKMN_CHARIZARD, 2
    .equ PKMN_BLASTOISE, 4
    .equ PKMN_MEGANIUM, 6
    .equ PKMN_TYPHLOSION, 8
    .equ PKMN_FERALIGATR, 10
    .equ PKMN_SCEPTILE, 12
    .equ PKMN_BLAZIKEN, 14
    .equ PKMN_SWAMPERT, 16
    .equ MyLoc, 0x7203C8 @insert your location here
    .equ RomAreaOffset,	0x8000000
    .equ move_names, 0x8901800 @change if using a repointed move name table
    						   @by default this is for MrDollSteak's rombase
    
    .org 0x0CCBC8, 0xFF
    add r0, r4, #2
    
    .org 0x0CCBCE, 0xFF
    cmp r4, #16
    
    .org 0x0CCBE2, 0xFF
    ldrh r1, [r1]
    
    .org 0x0CCBEA, 0xFF
    cmp r4, #18
    
    .org 0x0CCC00, 0xFF
    ldr r1, Hook
    bx r1
    .align 2
    Hook: .word RomAreaOffset+get_right_move_hook+1
    
    .org 0x0CCC1C, 0xFF
    .long RomAreaOffset+Table
    
    .org 0x0CCC28, 0xFF       @comment out if using vanilla move table
    .long move_names+0x112A   @comment out if using vanilla move table
    
    .org 0x0CCC50, 0xFF		  @comment out if using vanilla move table
    .long move_names+0xF97	  @comment out if using vanilla move table
    
    .org 0x0CCC84, 0xFF		  @comment out if using vanilla move table
    .long move_names+0xFA4	  @comment out if using vanilla move table
    
    .org MyLoc, 0xFF
    get_right_move_hook:
    cmp r0, #0xFF
    bne exit_loop_linker
    cmp r7, #PKMN_VENUSAUR
    beq frenzy_plant
    cmp r7, #PKMN_CHARIZARD
    beq blast_burn
    cmp r7, #PKMN_BLASTOISE
    beq hydro_cannon
    cmp r7, #PKMN_MEGANIUM
    beq frenzy_plant
    cmp r7, #PKMN_TYPHLOSION
    beq blast_burn
    cmp r7, #PKMN_FERALIGATR
    beq hydro_cannon
    cmp r7, #PKMN_SCEPTILE
    beq frenzy_plant
    cmp r7, #PKMN_BLAZIKEN
    beq blast_burn
    cmp r7, #PKMN_SWAMPERT
    beq hydro_cannon
    b exit_loop_linker
    
    .align 2
    .pool
    
    .align 2
    
    frenzy_plant:
    ldr r0, frenzy_plant_buffer
    bx r0
    
    .align 2
    .pool
    
    .align 2
    
    blast_burn:
    ldr r0, blast_burn_buffer
    bx r0
    
    .align 2
    .pool
    
    .align 2
    
    hydro_cannon:
    ldr r0, hydro_cannon_buffer
    bx r0
    
    .align 2
    .pool
    
    .align 2
    
    exit_loop_linker:
    ldr r0, exit_loop
    bx r0
    
    .align 2
    .pool
    
    .align 2
    
    frenzy_plant_buffer: .word 0x80CCC08 + 1
    blast_burn_buffer: .word 0x80CCC38 + 1
    hydro_cannon_buffer: .word 0x80CCC5C + 1
    exit_loop: .word 0x80CCC7A + 1
    
    .org MyLoc + 0x4C
    Table:
    VENUSAUR: .hword 0x3
    CHARIZARD: .hword 0x6
    BLASTOISE: .hword 0x9
    MEGANIUM: .hword 0x9A
    TYPHLOSION: .hword 0x9D
    FERALIGATR: .hword 0xA0
    SCEPTILE: .hword 0x117
    BLAZIKEN: .hword 0x11A
    SWAMPERT: .hword 0x11D

    Routine 2 is for hooking the routine run when special2 0x800D/LASTRESULT 0x1A3 is called. This checks the Pokémon in the first party for being eligible by species and having max happiness. Then it sets the appropriate move to be taught into the [buffer2] which is then used in the dialogue when the tutor recognizes that your Pokémon can be taught.

    And this is the edited script for the old lady tutor:
    Code:
    //---------------
    #org 0x1C4DEC
    special 0x187
    compare LASTRESULT 0x2
    if 0x1 goto 0x81A7AE0
    special 0x188
    lock
    faceplayer
    clearflag 0x2DE
    clearflag 0x2DF
    clearflag 0x2E0
    bufferfirstpokemon 0x0
    msgbox 0x81A46C6 MSG_KEEPOPEN //"I perfected the ultimate move of\n..."
    special2 LASTRESULT 0x1A3
    compare LASTRESULT 0x0
    if 0x1 goto 0x81C4F26
    copyvar 0x8009 0x8005
    compare PLAYERFACING 0x2
    if 0x1 call 0x81C4EF0
    compare PLAYERFACING 0x1
    if 0x1 call 0x81C4EFB
    compare PLAYERFACING 0x4
    if 0x1 call 0x81C4F06
    compare PLAYERFACING 0x3
    if 0x1 call 0x81C4F11
    msgbox 0x81A4751 MSG_YESNO //"Oh! This is the one!\nThis is the ..."
    compare LASTRESULT 0x0
    if 0x1 goto 0x81C4F1C
    call 0x81C4F37
    compare LASTRESULT 0x0
    if 0x1 goto 0x81C4F1C
    msgbox 0x81A4814 MSG_KEEPOPEN //"You will allow it?\pThen, let me c..."
    closeonkeypress
    fadescreen 0x1
    goto 0x81C4EDA
    
    //---------------
    #org 0x1A7AE0
    release
    end
    
    //---------------
    #org 0x1C4F26
    msgbox 0x81A4737 MSG_KEEPOPEN //"[.]No[.]\nI was just mistaken."
    release
    end
    
    //---------------
    #org 0x1C4EF0
    applymovement 0x1 0x81C4F4C
    waitmovement 0x0
    return
    
    //---------------
    #org 0x1C4EFB
    applymovement 0x1 0x81C4F4E
    waitmovement 0x0
    return
    
    //---------------
    #org 0x1C4F06
    applymovement 0x1 0x81C4F50
    waitmovement 0x0
    return
    
    //---------------
    #org 0x1C4F11
    applymovement 0x1 0x81C4F52
    waitmovement 0x0
    return
    
    //---------------
    #org 0x1C4F1C
    msgbox 0x81A47E5 MSG_KEEPOPEN //"Gaah! You reject it?\nNo, I won't ..."
    release
    end
    
    //---------------
    #org 0x1C4F37
    textcolor 0x3
    special 0x171
    signmsg
    msgbox 0x81A644F MSG_YESNO //"Do you want to teach this move to\..."
    normalmsg
    call 0x81A6675
    return
    
    //---------------
    #org 0x1C4EDA
    call 0x81C4F30
    compare LASTRESULT 0x0
    if 0x1 goto 0x81C4F1C
    goto 0x81C4EAB
    
    //---------------
    #org 0x1A6675
    copyvar 0x8012 0x8013
    return
    
    //---------------
    #org 0x1C4F30
    special 0x18D
    waitstate
    lock
    faceplayer
    return
    
    //---------------
    #org 0x1C4EAB
    copyvar 0x8005 0x8009
    special2 LASTRESULT 0x1A4
    compare LASTRESULT 0x1
    if 0x1 goto 0x81C4ECD
    msgbox 0x81A4865 MSG_KEEPOPEN //"Gasp, gasp, gasp[.]\pI didn't thin..."
    release
    end
    
    //---------------
    #org 0x1C4ECD
    msgbox 0x81A48F3 MSG_KEEPOPEN //"Gasp, gasp, gasp[.]\pI have no reg..."
    setflag 0x2E1
    release
    end
    
    
    //---------
    // Strings
    //---------
    #org 0x1A46C6
    = I perfected the ultimate move of\nits type[.]\pBut will no one take it for\nfuture use?\p[.]Hm? Hmmm!\pY-you[.]\nTh-that [buffer1][.]
    
    #org 0x1A4751
    = Oh! This is the one!\nThis is the Pokémon!\pThis [buffer1] is worthy of\nlearning my ultimate move!\pWill you allow it?\pWill you allow your [buffer1] to\nlearn my [buffer2]?
    
    #org 0x1A4814
    = You will allow it?\pThen, let me confer my ultimate\n[buffer2] on your [buffer1].\pGgggrah-awooo!
    
    #org 0x1A4737
    = [.]No[.]\nI was just mistaken.
    
    #org 0x1A47E5
    = Gaah! You reject it?\nNo, I won't be dissuaded!
    
    #org 0x1A644F
    = Do you want to teach this move to\nyour Pokémon?
    
    #org 0x1A4865
    = Gasp, gasp, gasp[.]\pI didn't think I could teach that\nmove while I still lived[.]
    
    #org 0x1A48F3
    = Gasp, gasp, gasp[.]\pI have no regrets now.\nI've passed on everything I know.\pNow I can live out my life knowing\nmy work is done.
    
    
    //-----------
    // Movements
    //-----------
    #org 0x1C4F4C
    #raw 0x52 //Jump in Place (Facing Down)
    #raw 0xFE //End of Movements
    
    #org 0x1C4F4E
    #raw 0x53 //Jump in Place (Facing Up)
    #raw 0xFE //End of Movements
    
    #org 0x1C4F50
    #raw 0x54 //Jump in Place (Facing Left)
    #raw 0xFE //End of Movements
    
    #org 0x1C4F52
    #raw 0x55 //Jump in Place (Facing Right)
    #raw 0xFE //End of Movements

    This can be copy-pasted directly into the same location as the old script and it won't overwrite extra data.

    Do note the #org 0x1A644F = Do you want to teach this move to\nyour Pokémon? is actually used by other move tutors as well. It replaces the message that tells you it can only be taught once, which doesn't make sense if you've made the tutors infinite use.

    You can also change the move table name offset if you are using a custom one, but if you're just using the normal one then comment out the identified routines before compiling.

    Also this clears the flags at 0x2DE, 0x2DF, and 0x2E0 which are set by special2 0x800D/LASTRESULT 0x1A4 after teaching each of the moves once allowing for infinite tutoring! This also doesn't set flag 0x2 which prevented you from teaching another move unless you exited the house and came back in again.

    If there are any problems, questions, or improvements don't hesitate to reply to this message or PM me.
     
    Last edited:

    BluRose

    blu rass
    811
    Posts
    10
    Years
  • Unrelated: Could someone port this routine to Emerald, please?
    It's basically FBI's EV/IV Checker, but it uses the Vars 8000-8005 instead of 8005-800A.
    He wrote it in a matter of minutes at some point inside the Discord server and I had it saved ever since, but I'd really like to have a version that works with Pokémon Emerald too.
    Thanks :)
    sorry for getting this to you late, mate
    i just needed to sit down and do it

    Spoiler:
     

    Lunos

    Random Uruguayan User
    3,114
    Posts
    15
    Years
  • sorry for getting this to you late, mate
    i just needed to sit down and do it

    Spoiler:
    It seems to be working beautifully, thanks Blu! <3
    kxx_HVw_U.gif
     
    Last edited:
    232
    Posts
    12
    Years
    • Seen Sep 10, 2019

    [FR] EV-reducing Berries

    Spoiler:
    Spoiler:


    Spherical Ice' EV-Reducing Berries for FireRed should seriously be indexed in the main thread.
     
    Last edited:
    650
    Posts
    6
    Years
  • Toggling Capturability of Pokemon


    So it's quite likely that maybe you want a Pokemon to be uncapturable, and at the same time you don't want to diminish it's catch rate to 0 in your Pokemon editor. Or perhaps you used the "capture trainer Pokemon" hack and you don't want it to work for all trainers. No problem, this is the hack for you :P

    Basically it checks if variable 0x8000 is 0x1 or not. If it's 0x1, then any Pokemon you encounter (trainer or wild, via script or natural encounter) will become uncapturable even with the master ball. Simply set 0x8000 back to normal for the original game mechanics.
    Note: If you use this hack, to say make it so the player can only capture a certain trainer's Pokemon, you will need to set 0x8000 right before the encounter, and unset it after (which is quite simple)
    Note2: This hack won't let you capture trainer Pokemon, you need to have the capture trainer Pokemon hack from last time to create that effect.

    How to insert:

    First compile the following ASM code and insert into free space:
    Spoiler:


    Here is a compiled version:
    Code:
    05 48 01 68 03 4A 12 78 01 2A 01 D0 03 48 00 47 03 48 00 47 B8 70 03 02 4C 2B 02 02 91 D4 02 08 61 D4 02 08

    Now navigate to 0x2D452 and insert the following:
    Code:
    01 48 00 47 00 00 XX XX XX 08
    Where XX XX XX is the reverse hex pointer to where you inserted the above routine. That's it :)
    EDIT: Add one to the pointer.

    Here's a pesky Rattata:
    JpL4im1.png

    (Yes, the Pokeball animation is still there, this was taken after it.)

    I tried this in Emerald and it didn't work, I added in the pointer as +1 of the offset of the compiled code and tried setting the variable in a static encounter script and by walking through a script event and neither worked, does this just not work in Emerald? If so, is there another way of doing this that I can try?
     
    Last edited:

    Lance Koijer 2.0

    Lance Koijer
    105
    Posts
    6
    Years
  • I tried this in Emerald and it didn't work, I added in the pointer as +1 of the offset of the compiled code and tried setting the variable in a static encounter script and by walking through a script event and neither worked, does this just not work in Emerald? If so, is there another way of doing this that I can try?

    The code will not work in Emerald because it is an ASM for FireRed only, as far as I know.
     
    41
    Posts
    7
    Years
    • Seen Dec 16, 2018
    Do you know of anything comparable to this that works for emerald?

    TOGGLING CAPTURABILITY OF POKEMON: EM

    Basically, it is a port of FBI's Toggling Capturability Routine available only on Fire Red to Emerald. This port makes a certain Pokemon uncapturable by just setting var 8000 to 0x1. This only works on Emerald .

    How to insert:

    First compile the following ASM code and insert into free space:
    Spoiler:


    Here is a compiled version:
    Code:
    05 48 01 68 03 4A 12 78 01 2A 01 D0 03 48 00 47 03 48 00 47 D8 75 03 02 EC 2F 02 02 5D 63 05 08 2B 63 05 08

    Now navigate to 0x5631E and insert the following:

    Code:
    01 48 00 47 00 00 XX XX XX 08

    Where XX+1 XX XX is the reverse hex pointer to where you inserted the above routine. That's it :)

    NOTE: This only prints the text "The TRAINER blocked the ball! Don't be a Thief!". I suggest changing this to "The ball is Blocked! This Pokemon cannot be caught!"


    Optional:
    Insert the following in free-space location in your ROM:

    AAAAAA:
    Code:
    CE DC D9 00 BC BB C6 C6 00 DD E7 00 D6 E0 E3 D7 DF D9 D8 AB FF

    BBBBBB:
    Code:
    CE DC DD E7 00 CA E3 DF D9 E1 E3 E2 00 D7 D5 E2 E2 E3 E8 00 D6 D9 00 D7 D5 E9 DB DC E8 AB FF

    In 0x5CC64C, insert the reverse pointer of AAAAAA (do not add 1)
    In 0x5CC650, insert the reverse pointer of BBBBBB (do not add 1)


    NOTE: This will replace the "The TRAINER blocked the BALL" and "Don't be a thief!" strings.

    37132326_1767827489951966_8381321768370962432_n.png
    37565425_1767827499951965_3780329454006435840_n.png



    All credits goes to FBI.
     
    Last edited:
    650
    Posts
    6
    Years
  • TOGGLING CAPTURABILITY OF POKEMON: EM

    Basically, it is a port of FBI's Toggling Capturability Routine available only on Fire Red to Emerald. This port makes a certain Pokemon uncapturable by just setting var 8000 to 0x1. This only works on Emerald .

    How to insert:

    First compile the following ASM code and insert into free space:
    Spoiler:


    Here is a compiled version:
    Code:
    05 48 01 68 03 4A 12 78 01 2A 01 D0 03 48 00 47 03 48 00 47 D8 75 03 02 EC 2F 02 02 5D 63 05 08 2B 63 05 08

    Now navigate to 0x5631E and insert the following:

    Code:
    01 48 00 47 00 00 XX XX XX 08

    Where XX+1 XX XX is the reverse hex pointer to where you inserted the above routine. That's it :)

    NOTE: This only prints the text "The TRAINER blocked the ball! Don't be a Thief!". I suggest changing this to "The ball is Blocked! This Pokemon cannot be caught!"

    All credits goes to FBI.

    Thanks a million! Will try it out when I get home :)
    And sorry if this is a dumb question, but how do I change the message when the pokeball is blocked?
     
    Last edited:
    41
    Posts
    7
    Years
    • Seen Dec 16, 2018
    Thanks a million! Will try it out when I get home :)
    And sorry if this is a dumb question, but how do I change the message when the pokeball is blocked?

    Insert the following in free-space location in your ROM:

    AAAAAA:
    Code:
    CE DC D9 00 BC BB C6 C6 00 DD E7 00 D6 E0 E3 D7 DF D9 D8 AB FF

    BBBBBB:
    Code:
    CE DC DD E7 00 CA E3 DF D9 E1 E3 E2 00 D7 D5 E2 E2 E3 E8 00 D6 D9 00 D7 D5 E9 DB DC E8 AB FF

    In 0x5CC64C, insert the reverse pointer of AAAAAA (do not add 1)
    In 0x5CC650, insert the reverse pointer of BBBBBB (do not add 1)


    NOTE: This will replace the "The TRAINER blocked the BALL" and "Don't be a thief!" strings.
    Welp, that's fine for me. The previous strings are kind of not friendly lol

    37132326_1767827489951966_8381321768370962432_n.png
    37565425_1767827499951965_3780329454006435840_n.png
     
    53
    Posts
    5
    Years
    • Seen Mar 9, 2022
    [FR] Volt Tackle port from EM:

    If you have free space from 0x270670-0x270741 (0xD2 bytes), use the IPS patch I provide here. ...It's a long story, so I will expand on this when I get the time. Fully working, I promise. You're gonna love it.

    edit: A bit of explanation now: I took a look at an Emerald disassembly and found the routine that calls to check if the egg at the Day-Care is a pichu and if either of the parents are holding a Light Ball. I ported that exact routine into FR, but I had to make a copy of the routine at sub_80460D4 as to include the pichu check. Then I had to make special 0xB8 call the new routine instead of sub_80460D4. Since I had made a copy of the routine I also had to make sure the new routine used all the same offsets as before, and therefore I placed the routine at 0x270670, which I happened to have free space. I wanted to place the routine at something like 0x760000 or higher, but the old offsets wouldn't work any more. Down below are the uncompiled stuff:

    This routine (located at 0x270670 in my patch) is a copy of the routine at 0x0460D4 but now includes the pichu egg check (in orange):
    Code:
    sub_80460D4:                @ CODE XREF: sp0B8_daycare+Cp
    
    var_18        = -0x18
    var_14        = -0x14
    
            PUSH    {R4-R6,LR}
            SUB    SP, SP,    #0x6C
            ADD    R5, R0,    #0
            ADD    R6, SP,    #0x7C+var_18
            ADD    R1, R6,    #0
            BL    sub_8046000
            ADD    R4, SP,    #0x7C+var_14
            STRH    R0, [R4]
            ADD    R0, R4,    #0
            ADD    R1, R5,    #0
            BL    incense_effects
            LDRH    R1, [R4]
            MOV    R0, SP
            ADD    R2, R5,    #0
            BL    sub_8046208
            MOV    R0, SP
            ADD    R1, R5,    #0
            BL    sub_8045AC0
            LDRB    R0, [R6,#1]
            MOV    R2, #0x8C @ '?'
            ADD    R1, R0,    #0
            MUL    R1, R2
            ADD    R1, R5,    R1
            LDRB    R0, [R6]
            MUL    R2, R0
            ADD    R2, R5,    R2
            MOV    R0, SP
            BL    daycare_build_child_moveset
    [COLOR=DarkOrange]        ldrh r0, [r4]
            cmp r0, #0xAC
            bne _08070918
            mov r0, sp
            add r1, r5, #0
            bl sub_82706FC
    _08070918:[/COLOR]
            MOV    R2, SP
            ADD    R2, #0x6A @ 'j'
            MOV    R0, #1
            STRB    R0, [R2]
            MOV    R0, SP
            MOV    R1, #0x2D @ '-'
            BL    pokemon_setattr
            LDR    R0, off_804614C
            MOV    R1, #0xFA @ '?'
            LSL    R1, R1,    #1
            ADD    R0, R0,    R1
            MOV    R1, SP
            MOV    R2, #0x64 @ 'd'
            BL    memcpy
            BL    party_compaction
            BL    party_count_pokemon
            ADD    R0, R5,    #0
            BL    sub_8045F70
            ADD    SP, SP,    #0x6C
            POP    {R4-R6}
            POP    {R0}
            BX    R0
    @ End of function sub_80460D4
    
    @ ---------------------------------------------------------------------------
    .align 2
    off_804614C:    .long 0x2024284        @ DATA XREF: sub_80460D4+52r
    This routine (located at 0x2706FC in my patch) handles the volt tackle inheriting:
    Code:
    sub_80707A4:
        push {r4-r6,lr}
        add r5, r0, #0
        add r4, r1, #0
        add r0, r4, #0
        mov r1, #0xC
        bl pokemon_getattr_encrypted
        add r6, r0, #0
        add r4, #0x8C
        add r0, r4, #0
        mov r1, #0xC
        bl pokemon_getattr_encrypted
        cmp r6, #0xCA
        beq _080707C6
        cmp r0, #0xCA
        bne _080707E2
    
    _080707C6:
        mov r4, #0xAC
        lsl r4, r4, #0x1
        add r0, r5, #0
        add r1, r4, #0
        bl pokemon_moveset_pad_
        lsl r0, r0, #0x10
        ldr r1, =(0xffff0000)
        cmp r0, r1
        bne _080707E2
        add r0, r5, #0
        add r1, r4, #0
        bl sub_803EB94
    
    _080707E2:
        pop {r4-r6}
        pop {r0}
        bx r0
    This last one makes sure the old offsets work correctly from the new offsets:
    Code:
    .text
    .align 2
    .thumb
    .thumb_func
    
    .org 0x0462B8
    bl 0x270670
    
    .org 0x27067A
    bl 0x046000
    
    .org 0x270686
    bl 0x045FA0
    
    .org 0x270690
    bl 0x046208
    
    .org 0x270698
    bl 0x045AC0
    
    .org 0x2706AE
    bl 0x045CD0
    
    .org 0x2706BC
    bl 0x2706FC
    
    .org 0x2706CC
    bl 0x04037C
    
    .org 0x2706DC
    bl 0x1E5E78
    
    .org 0x2706E0
    bl 0x0937DC
    
    .org 0x2706E4
    bl 0x040C3C
    
    .org 0x2706EA
    bl 0x045F70
    
    .org 0x270706
    bl 0x03FD44
    
    .org 0x270712
    bl 0x03FD44
    
    .org 0x270726
    bl 0x03E89C
    
    .org 0x270736
    bl 0x03EB94
    If anybody has a better way of porting this, please post it here.
    edit2: I could probably just use bx r3?

    I improved this ASM so you only need to assemble it once and also it works in any free space occupied.

    Just replace the offset at MyLoc with your desired free space and then copy paste the assembled code to 0x0462B0 and MyLoc as appropriate.

    Code:
    .thumb
    .align
    
    .equ MyLoc, 0x720000 @insert your location here
    .equ RomAreaOffset,	0x8000000	
    
    .org 0x0462B0, 0xFF
    ldr  r3, clean_hook
    bx  r3
    .align 2
    clean_hook: .word RomAreaOffset+hook_handle+1
    
    .org MyLoc, 0xFF
    hook_handle:
    ldr r0, [r0]
    mov r1, #0xBE
    lsl r1, r1, #6
    add r0, r0, r1
    bl  sub_80460D4
    ldr r3, return
    bx  r3
    
    .align 2
    .pool
    
    .align 2
    
    sub_80460D4:  		
    		PUSH    {R4-R6,LR}
            SUB    SP, SP,    #0x6C
            ADD    R5, R0,    #0
            ADD    R6, SP,    #0x64
            ADD    R1, R6,    #0
            ldr    r3, sub_8046000
    		bl     call_external_function
            ADD    R4, SP,    #0x68
            STRH    R0, [R4]
            ADD    R0, R4,    #0
            ADD    R1, R5,    #0
    		ldr   r3, incense_effects
            bl    call_external_function
            LDRH    R1, [R4]
            MOV    R0, SP
            ADD    R2, R5,    #0
            ldr   r3, sub_8046208
    		bl    call_external_function
            MOV    R0, SP
            ADD    R1, R5,    #0
    		ldr   r3, sub_8045AC0
            bl   call_external_function
            LDRB    R0, [R6,#1]
            MOV    R2, #0x8C @ '?'
            ADD    R1, R0,    #0
            MUL    R1, R2
            ADD    R1, R5,    R1
            LDRB    R0, [R6]
            MUL    R2, R0
            ADD    R2, R5,    R2
            MOV    R0, SP
            ldr   r3, daycare_build_child_moveset
    		bl    call_external_function
            ldrh r0, [r4]
            cmp r0, #0xAC
            bne _08070918
            mov r0, sp
            add r1, r5, #0
            bl sub_80707A4
    		
    _08070918:
            MOV    R2, SP
            ADD    R2, #0x6A @ 'j'
            MOV    R0, #1
            STRB    R0, [R2]
            MOV    R0, SP
            MOV    R1, #0x2D @ '-'
            ldr    r3, pokemon_setattr
    		bl    call_external_function
            LDR    R0, off_804614C
            MOV    R1, #0xFA @ '?'
            LSL    R1, R1,    #1
            ADD    R0, R0,    R1
            MOV    R1, SP
            MOV    R2, #0x64 @ 'd'
            ldr   r3, memcpy
    		bl   call_external_function
            ldr   r3, party_compaction
    		bl   call_external_function
            ldr   r3, party_count_pokemon
    		bl   call_external_function
            ADD    R0, R5,    #0
            ldr    r3, sub_8045F70
    		bl    call_external_function
            ADD    SP, SP,    #0x6C
            POP    {R4-R6}
            POP    {R0}
            BX    R0
    		
    .align 2
    .pool
    
    .align 2
    		
    sub_80707A4:
        push {r4-r6,lr}
        add r5, r0, #0
        add r4, r1, #0
        add r0, r4, #0
        mov r1, #0xC
        ldr r3, pokemon_getattr_encrypted
    	bl call_external_function
        add r6, r0, #0
        add r4, #0x8C
        add r0, r4, #0
        mov r1, #0xC
        ldr r3, pokemon_getattr_encrypted
    	bl call_external_function
        cmp r6, #0xCA
        beq _080707C6
        cmp r0, #0xCA
        bne _080707E2
    
    _080707C6:
        mov r4, #0xAC
        lsl r4, r4, #0x1
        add r0, r5, #0
        add r1, r4, #0
    	ldr r3, pokemon_moveset_pad_
        bl call_external_function
        lsl r0, r0, #0x10
        ldr r1, =(0xffff0000)
        cmp r0, r1
        bne _080707E2
        add r0, r5, #0
        add r1, r4, #0
        ldr r0, sub_803EB94
    	bl call_external_function_r0
    
    _080707E2:
        pop {r4-r6}
        pop {r0}
        bx r0
    	
    .align 2
    .pool
    
    .align 2
    
    call_external_function:
    bx r3
    
    .align 2
    
    call_external_function_r0:
    bx r0
    
    .align 2	
    return: .word 0x80462BC + 1
    sub_8046000: .word 0x8046000 + 1
    incense_effects: .word 0x8045FA0 + 1
    sub_8046208: .word 0x8046208 + 1
    sub_8045AC0: .word 0x8045AC0 + 1
    daycare_build_child_moveset: .word 0x8045CD0 + 1
    pokemon_setattr: .word 0x804037C + 1
    memcpy: .word 0x81E5E78 + 1
    party_compaction: .word 0x80937DC + 1
    party_count_pokemon: .word 0x8040C3C + 1
    sub_8045F70: .word 0x8045F70 + 1
    off_804614C: .word 0x2024284
    pokemon_getattr_encrypted: .word 0x0803FD44 + 1
    pokemon_moveset_pad_: .word 0x0803E89C + 1
    sub_803EB94: .word 0x0803EB94 + 1

    Feel free to reply with questions or suggestions for improvements.
     
    Last edited:
    650
    Posts
    6
    Years
  • Misc:

    A EV-IV Display Screen

    RENEWAL:
    Spoiler:

    OLD CONTENT:
    Spoiler:

    SO I have tried to install Devkit and any time I try the make command, I get errors and the program crashes, I would love to use this but without the ability to get the code for it inserted into the ROM I can't use it, does anyone have the compiled hex code for this?
     
    Last edited:

    BrittneySpearsMom

    bets haker 2018!!!!1
    6
    Posts
    6
    Years
    • Seen Mar 22, 2021
    Forgive me for not contributing, but I had to ask.

    At the risk of being totally unhelpful to the thread: does anyone know of working routines for attack boosting Gems (Normal Gem, Flying Gem, etc., etc.) for either FireRed or Emerald? I've seen a certain Japanese hack of FireRed has gotten them to work and it looks like Pokemon Clover either has implemented them already or is planning to offer them eventually.
     
    232
    Posts
    12
    Years
    • Seen Sep 10, 2019

    Time Box triggered along with the Start Menu

    Preview: (Click to see the GIF animation)
    View attachment 77173
    The routines are only for FR. I haven't found any bugs in it. However, the CPU will run much more instructions so that it will be a bit (really?) slower when you open the 'pokemon', 'bag'..... menus.
    1) Insert the RTC routine via the tool 'DNS'.
    2) Insert these routines and do the byte changes:
    Routine I:
    Spoiler:
    Routine II:
    Spoiler:
    Routine III:
    Spoiler:

    I've modified 'Routine I' of Pokemon_XY's Time Box to exclude displaying seconds, which in turn decreases the lag when viewing the Start Menu. I've also fixed a bug in his routine where the Time Box would display when the step-counter is displayed while in the Safari Zone. Provided down below is a 24-hour format and a 12-hour format. Choose one of them instead of Pokemon_XY's 'Routine I' if you wish.

    24-hour format (use instead of 'Routine I'):
    Spoiler:

    12-hour format (use instead of 'Routine I'):
    Spoiler:
     
    Last edited:

    AkameTheBulbasaur

    Akame Marukawa of Iyotono
    409
    Posts
    10
    Years
  • Dream_Metronome_Sprite.png
    Metronome Battles
    Dream_Metronome_Sprite.png

    This involves four routines and a bunch of scripting.

    Notes Before We Begin
    • You will need 25 vars that you will not use for anything else. I used vars 0x408F through 0x40A8, and the routines posted below reflect that. If you wish to change them, you'll need to figure out the RAM addresses for those vars on your own.
    • 24 of those vars are for the moves of your party. 1 is set when the Metronome Battle starts for reasons I will get into later.
    • These vars need to be permanent vars (so not 0x8000 whatever) because they need to be accessed even if the game is turned off and on.

    Routine 1: Clear RAM

    What this does is clear out (sets to zero) all the vars which will contain the moves. This just make sure that you have a blank slate for the next routine.
    Spoiler:


    Routine 2: Store Party's Moves

    This routine takes all the moves of your Party Pokemon and stores them one at a time in the vars I mentioned before. If the Pokemon doesn't have a move in that slot, it will just set the var to zero by default.
    Spoiler:


    Routine 3: Replace Moves With Metronome

    This routine is fairly self-explanatory. It replaces all of your Pokemon's move with four of Metronome. Note that this does not change the PP, so the PP of Metronome will still be the same as whatever move it replaced. This is easily fixed during the scripting (which will come soon).
    Spoiler:


    Routine 4: Restore Party's Moves

    This last routine takes the moves in the vars and gives them back to the Pokemon they originally belonged to.
    Spoiler:


    Putting it all Together

    I will assume that the initiator of the Metronome battle will be a person event or something like that.

    In your script, you will want to call the first three routines in order. Then script the battle, and then afterwards call the fourth routine and then the first again.

    Syntax:
    callasm OFFSET OF R1
    callasm OFFSET OF R2
    callasm OFFSET OF R3
    special HEAL_POKEMON 'This fixes the PP issue from before
    setvar SOME VAR 0xFF'
    trainerbattle 0x3 0xNUM 0x0 @DefeatMsg
    callasm OFFSET OF R4
    callasm OFFSET OF R1
    special HEAL_POKEMON
    setvar SOME VAR 0x0


    Let's explain a few things. You'll want to use specifically "trainerbattle" type 3. This makes the script continue after you defeat the trainer, which we want so that you can get your original moves back after you win.

    But what about if you lose? This is what the SOME VAR is about. Before you start the battle, you'll want to set whichever var you chose to something not zero. I picked 0xFF just because.
    If you win, this var gets set back to zero. But if you lose then the var is still the non-zero value.

    So you will need to include this map script at every possible healing location the player could get sent back to.

    Spoiler:


    This checks if you initiated but did not complete the Metronome Battle (via the var) and if you that is true then it replaces your moves. If you lost the battle then it will do this during the normal White Out script.

    What I recommend is using JPAN's SetHealingPlace hack to set the healing place to be the map where you find the NPC who starts the battle. That way you only need to have this map script on that specific map instead of having to put it everywhere.

    Another important thing you will probably need is the routine to disable experience gain with a flag! I forgot where it was, but I believe it's in this thread. You need this to prevent your Pokémon leveling up and learning a new move.

    This would not only ruin the Metronome battle, but they wouldn't even keep the move after the battle was over and everything got replaced back.

    Example Script

    Here I will just include the script I used in my game, just to get an idea of how the scripting part is supposed to go down.

    Spoiler:
     
    Last edited:
    88
    Posts
    7
    Years
    • Seen Jan 16, 2020
    Side Quest Menu [FR]

    This hack converts the PC item storage menu into a side quest menu, or task list, etc.

    Here is the repository, the compilation instructions are included in the readme. You will need to define your own parameters/ram in src/headers/defs.asm and create your own tables of string pointers for all of the quest names, descriptions, item images, and quest details. I kept the item image part to allow hackers to include items that might be symbolic of their quest, eg. a scroll or key or pokeball.

    To use in a script (XSE)
    Code:
    writebytetooffset 0x1 <your questflag ram in src/headers/defs.asm>
    fadescreen 0x1
    callasm 0x80EBCD9
    waitstate

    Enjoy! And please let me know of any bugs.
     
    Last edited:
    Back
    Top