• 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

jiangzhengwenjzw

now working on katam
181
Posts
11
Years
    • Seen today

    The implementation of ROCK CLIMB in BPRE

    This post will only deal with the "rock climb" selected by the player in the pokemon selection scene, so please do the script on your own if you want to use rock climb by talking to a rock.
    This hack can judge the "playerfacing" and the number of the blocks you will climb.
    1. Firstly we will repoint and expand the RAM location for TMs: (found from Development: More TMs/HMs - The PokéCommunity Forums Credit goes to Taの境界)
    at 0x99E6A:
    Code:
    01 48 00 47 00 00 FF FF FF 08
    FF FF FF 08 is the pointer to ram.asm (thumb mode +1):
    ram.asm:
    Code:
    .text
    .align 2
    .thumb
    .thumb_func
    .global tm_slots_hack
    
    main:
    ldr r0, ram
    str r0, [r1, #0x18]
    mov r0, #0x3B
    strb r0, [r1, #0x1c]
    ldr r0, return
    bx r0
    
    .align
    ram:.word 0x0203c000
    return:.word 0x08099e74+1
    0x203c000 is the free ram location.

    2. Use JPAN's save_block_hack to save properly.
    link: The PokéCommunity Forums - View Single Post - Research: FireRed Pokédex Hacking
    Or use the patch instead: JPAN's Save Block Patch for FR » Romhack.me - ROM Hacking Community

    3. tables and codes
    1)repoint the table at 0x45A76E, replace 0c 00 with the move id of rock climb (swapped), and put 0c 00 after it as the end. (special move table)
    2)repoint the table at 0x45A80C, add the move id (swapped). (TM table)
    3)repoint the table at 0x45A37C and add an pointer to the description text. Please make it short like other texts in this table. (description text pointer table)
    4)repoint the table at 0x45A618 and add [pointer to move name] A5 45 12 08 at the end of the table. (name_table)
    5)copy these data to 0x3D4D6C as item picture and palette data.
    Code:
    C8 1C E9 08 64 1E E9 08
    (in item picture & palette table)
    6)copy these data to 0x3DEBCC as item data. (in item table)
    Code:
    C2 C7 A1 AA FF 00 00 00 00 00 00 00 00 00 5B 01 00 00 00 00 E5 75 48 08 01 00 04 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    Please edit the description pointer to your new description!
    7)edit the table at 0x252BC8 to enable some pokemon to learn the HM. This table is made up with bitfield, which means that you should convert it into binary to see the real data. 1 = learnable 0 = can't learn(TM learnable table)
    For example, data for bulbasaur is "20 07 35 84 08 1E E4 00"
    We divide it into 2 parts: "20 07 35 84" and "08 1E E4 00"
    Then swap them, so we get "84350720" and "00E41E08"
    Convert them into binary: "10000100001101010000011100100000" and "111001000001111000001000"
    get them together in the reversed order:
    "11100100000111100000100010000100001101010000011100100000"
    It's in the order of "HM08, HM07,.........,TM01"
    So if we want bulbusaur to learn HM09 we edit the higher part "111001000001111000001000"
    We change it into "100111001000001111000001000"
    Then we convert it into hexadecimal: "4E41E08"
    swap it to get "08 1E E4 04" and we absolutely use it to replace "08 1E E4 00".
    So you can see that we will always only deal with the higher part, I convert the lower part to just make things clearer

    8)repoint the table at 0x45A788 and add [XX XX XX 08 0D 00 00 00] to the end of it. (function table)
    XX XX XX 08 is the pointer to the following function: (thumb mode +1)
    check.asm: (main ROCK CLIMB function)
    Code:
    .thumb
    .align 2
    push {r4, lr}
    sub sp, sp, #4
    mov r4, sp
    add r4, #2
    mov r0, sp
    mov r1, r4
    ldr r3, =0x0805C4F5
    bl call_via_r3
    mov r0, sp
    mov r1, #0
    ldrsh r0, [r0, r1]
    mov r2, #0
    ldrsh r1, [r4, r2]
    ldr r2, =0x08058F79
    bl call_via_r2
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    cmp r0, #0x80 @behavior_byte
    bne back
    ldr r1, =0x03005024
    ldr r0, =0x081248B1
    str r0, [r1]
    ldr r1, =0x0203B0C4
    ldr r0, =0x08RRRRRR
    str r0, [r1]
    mov r0, #1
    b real_back
    
    back:
    mov r0, #0
    
    real_back:
    add sp, sp, #4
    pop {r4}
    pop {r1}
    bx r1
    
    call_via_r3:
    bx r3
    
    call_via_r2:
    bx r2

    change 0x8RRRRRR to the offset+1 of the following function:(script_run function)
    Code:
    .thumb
    .align 2
    run_scr:
    push {lr}
    ldr r0, =0x0203B0A0
    ldrb r0, [r0, #9]
    ldr r1, =0x020386E0
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    str r0, [r1]
    ldr r0, =0x08SSSSSS
    ldr r1, =0x08069AE5
    bl call_via_r1
    pop {r0}
    bx r0
    
    
    call_via_r1:
    bx r1

    change 0x8SSSSSS to the offset of the following script:(ROCK CLIMB script)
    Code:
    #org @start
    lockall
    doanimation 0x25
    waitstate
    callasm 0x8kkkkkk //offset of code1+1
    compare 0x800c 1
    if1 1 @down
    compare 0x800c 2
    if1 1 @up
    compare 0x800c 3
    if1 1 @left
    goto @right
    
    #org @down
    applymovement 0xff @movedown
    waitmovement 0xff
    callasm 0x8jjjjjj //offset of code2+1
    compare 0x8004 0
    if1 1 @downeventual
    goto @down
    
    #org @up
    applymovement 0xff @moveup
    waitmovement 0xff
    callasm 0x8jjjjjj //offset of code2+1
    compare 0x8004 0
    if1 1 @upeventual
    goto @up
    
    #org @left
    applymovement 0xff @moveleft
    waitmovement 0xff
    callasm 0x8jjjjjj //offset of code2+1
    compare 0x8004 0
    if1 1 @lefteventual
    goto @left
    
    #org @right
    applymovement 0xff @moveright
    waitmovement 0xff
    callasm 0x8jjjjjj //offset of code2+1
    compare 0x8004 0
    if1 1 @righteventual
    goto @right
    
    #org @downeventual
    applymovement 0xff @movedown
    waitmovement 0xff
    releaseall
    end
    
    #org @upeventual
    applymovement 0xff @moveup
    waitmovement 0xff
    releaseall
    end
    
    #org @lefteventual
    applymovement 0xff @moveleft
    waitmovement 0xff
    releaseall
    end
    
    #org @righteventual
    applymovement 0xff @moveright
    waitmovement 0xff
    releaseall
    end
    
    #org @movedown
    #raw 0x1D 0xfe
    
    #org @moveup
    #raw 0x1e 0xfe
    
    #org @moveleft
    #raw 0x1f 0xfe
    
    #org @moveright
    #raw 0x20 0xfe

    change the 0x8kkkkkk & 0x8jjjjjj to the offset+1 of the following routines.

    code1:(get "playerfacing" in var_0x800C)
    Code:
    .thumb
    .align 2
    push {lr}
    ldr r0, =0x0805C6C5
    bl linker
    ldr r1, =0x020370D4
    strh r0, [r1]
    pop {pc}
    
    linker:
    bx r0

    code2:(get the tile behavior byte)
    Code:
    .thumb
    .align 2
    push {r4, lr}
    sub sp, sp, #4
    mov r4, sp
    add r4, #2
    mov r0, sp
    mov r1, r4
    ldr r3, =0x0805C4F5
    bl call_via_r3
    mov r0, sp
    mov r1, #0
    ldrsh r0, [r0, r1]
    mov r2, #0
    ldrsh r1, [r4, r2]
    ldr r2, =0x08058F79
    bl call_via_r2
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    ldr r1, =0x020370C0
    cmp r0, #0x80 @behavior_byte
    bne back
    mov r0, #1
    b realback
    
    back:
    mov r0, #0
    
    realback:
    strh r0, [r1]
    add sp, sp, #4
    pop {r4, pc}
    
    call_via_r2:
    bx r2
    
    
    call_via_r3:
    bx r3

    change the "0x80" in code2 and check.asm to the behavior byte you selected for the "rock climb" tile block.

    4. fix the badge check routine so that it will check the 8th badge for the HM09 you added: (untested)
    place this at 0x12461C:
    Code:
    00 48 00 47 MM MM MM 08
    MM MM MM 08 is the pointer to the following routine: (thumb mode +1)
    Code:
    .thumb
    .align 2
    add r0, r4, #0
    cmp r4, #7
    blt checkbadge
    mov r0, #7
    cmp r4, #0xc
    beq checkbadge
    ldr r1, =0x8124627
    add r1, #0x32
    bx r1
    
    checkbadge:
    mov r1, #0x82
    lsl r1, r1, #0x4
    add r0, r0, r1
    ldr r1, =0x8124627
    bx r1

    5. An example: (Haven't edited the text and name yet)
    1_zpspkko0bn2.gif
    1_zpsdwugkkzw.png


    At last, I have to say that i haven't tried to teach the HM to a pokemon, so if there's any problem, simply follow a reply in Development: More TMs/HMs - The PokéCommunity Forums to delete the animation of learning TMs, but I think there's no problem)

    As you can see, I have done the main part, but I can't ensure there's no glitch in this hack. So please contribute to it! I'm so tired with it so i won't touch it recently...

    Edit: Here is a simple looping script to get all of the TMs and HMs as the cheats for the game won't work:
    Code:
    #org @start
    lock
    faceplayer
    setvar 0x8004 0x121
    goto @snippet2
    
    //---------------
    #org @snippet1
    release
    end
    
    //---------------
    #org @snippet2
    additem 0x8004 0x1
    addvar 0x8004 0x1
    compare 0x8004 0x15C
    if 0x1 goto @snippet1
    goto @snippet2

    Edit2: Source codes and binary files uploaded.

    Edit3: Corrected a slight typo. Codes reuploaded.
    But please pay attention that "8RRRRRR" & "8SSSSSS" are not in the attachment and they're shown as "8CCCCCC" & "8DDDDDD" in the files in the .zip archive so that they can be compiled successfully. If you don't understand, please simply follow the post and neglect the attachment. So is the offsets included in the script file (scr.rbc) because they use the offset in my test ROM XD

    Edit4: added explanation to bitfield.
     
    Last edited:
    325
    Posts
    10
    Years
  • Events that happen daily:



    First of all, this uses the Day/Night System's clock, or you can use ShinyQuagsire's RTC, which I'm fairly sure are one and the same anyway. Either way, you have to have that in the game or this won't work for obvious reasons.


    Insert this into free space.
    Code:
    .thumb
    start:
     push {r0-r7, lr}
     ldr r0, =(0x20370D0)
     ldrh r1, [r0]
     mov r2, #0x4
     mul r1, r1, r2
     ldr r0, =(0x3005546)
     add r0, r0, r1
     mov r1, r0
     mov r2, r0
     add r0, #0x1
     add r1, #0x2
     add r2, #0x3
     ldrh r3, [r0]
     ldrb r4, [r1]
     ldrb r5, [r2]
     ldr r6, =(0x300553C)
     ldrh r7, [r6]
     cmp r3, r7
     bcc x800D_1
     strh r7, [r0]
     ldr r6, =(0x300553F)
     ldrb r7, [r6]
     cmp r4, r7
     bcc x800D_1
     strb r7, [r1]
     ldr r6, =(0x3005540)
     ldrb r7, [r6]
     cmp r5, r7
     bcc x800D_1
     strb r7, [r2]
     ldr r0, =(0x20370D0)
     mov r1, #0x0
     strh r1, [r0]
     pop {r0-r7, pc}
    x800D_1:
     ldr r6, =(0x300553C)
     ldrh r7, [r6]
     strh r7, [r0]
     ldr r6, =(0x300553F)
     ldrb r7, [r6]
     strh r7, [r1]
     ldr r6, =(0x3005540)
     ldrb r7, [r6]
     strb r7, [r2]
     ldr r0, =(0x20370D0)
     mov r1, #0x1
     strh r1, [r0]
     pop {r0-r7, pc}
    This hack uses variable x800D for almost everything. So each event that happens daily is supposed to have a number attached to it using x800D, like so.
    Code:
    #dynamic 0x______
     
    #org @start
    setvar 0x800D 0x_ (set 800D to the table entry.)
    callasm 0x8(offset where you put my the previous ASM +1)
    compare 0x800D 0x0
    if 0x1 goto @1 (if x800D is the value of 0, then the event has already happened today)
    compare 0x800D 0x1
    if 0x1 goto @2 (if x800D is the value of 1, then the event has not happened that day)
    Please credit if you use this, and report any bugs here or by PM/VM, thanks.


    ~EDIT~ It was pointed out to me that this doesn't work over save data outside of save states, that was an oversight. I'll fix it as soon as I can.
     
    Last edited:

    jiangzhengwenjzw

    now working on katam
    181
    Posts
    11
    Years
    • Seen today

    Pre-battle Mugshot Hack in BPEE

    I don't hack Emerald but my friend jirachiwishmaker requested the code, so I will share it.
    This is a port of Jambo51's codes in this thread to Emerald Version
    If you still don't know what it is, please take a look at this picture:
    7-8_zpsiwx42jwk.png

    1. Make these byte changes:
    Code:
    0x147C6A - 00 00 00 00 (disable the palette mixing)
    0xB13FD - 78 (for safety's sake)
    0x5C8F90 - CD 6A 0F 73 51 7B 93 7F D5 7F FF 7F (filling the palette...)
    0x5C8F70 - CD 6A 0F 73 51 7B 93 7F D5 7F FF 7F
    0x5C8F50 - CD 6A 0F 73 51 7B 93 7F D5 7F FF 7F

    2. Insert these 3 ASM codes in free space and change bytes accordingly:
    insert 00 48 00 47 AA AA AA 08 at 0xB0F44, in which AA AA AA 08 is the pointer to the following routine (thumb mode +1)
    Code:
    .thumb
    .align 2
    ldrb r2, [r4, #7]
    cmp r2, #0
    beq normal
    ldr r0, =0x80B0F5D
    bx r0
    
    normal:
    ldrh r2, [r4]
    lsl r0, r2, #2
    add r0, r0, r2
    lsl r0, r0, #3
    add r0, r0, r1
    ldr r1, =0x80B0F4F
    bx r1

    insert 00 48 00 47 BB BB BB 08 at 0xB5E78, BB BB BB 08 = pointer to the following code (thumb mode +1)
    Code:
    .thumb
    .align 2
    cmp r4, #0x47
    beq normal
    cmp r4, #0x48
    beq normal
    ldr r0, =0x2038BCA
    ldrh r0, [r0]
    lsl r5, r0, #2
    add r5, r0, r5
    lsl r0, r5, #3
    ldr r5, =0x806E4C4
    ldr r5, [r5]
    add r0, r0, r5
    ldrb r4, [r0, #3]
    
    normal: 
    add r5, r1, #0
    add r6, r2, #0
    mov r9, r3
    ldr r7, [sp, #0x34]
    ldr r0, =0x80B5E81
    bx r0

    insert 01 49 08 47 00 00 CC CC CC 08 at 0x147C42, CC CC CC 08 = pointer to the following code (thumb mode +1)
    change 0x8FFFFFF to the palette table in your ROM and it can have 255 custom palettes.
    The table's structure is [pointer1][pointer2]........................
    Every pointer will point to a 16-color uncompressed palette (32 bytes)
    Code:
    .thumb
    main:
     ldr r1, ramoffset
     ldrh r1, [r1, #0x0]
     lsl r0, r1, #0x2
     add r0, r0, r1
     lsl r1, r0, #0x3
     ldr r0, trainertable
     ldr r0, [r0, #0x0]
     add r1, r0, r1
     ldrb r1, [r1, #0x1]
     cmp r1, #0x1f
     beq oldway
     cmp r1, #0x26
     beq oldway
     ldr r1, ramoffset
     ldrb r1, [r1, #0x7]
     sub r1, #0x1
     lsl r1, r1, #0x2
     ldr r0, table2
     add r1, r1, r0
     ldr r0, [r1, #0x0]
     b back
    oldway: ldr r1, table
     mov r2, r8
     mov r3, #0x26
     ldrh r0, [r2, r3]
     lsl r0, r0, #0x2
     add r0, r0, r1
     ldr r0, [r0, #0x0]
    back: ldr r1, return
     bx r1
    
    .align 2
    ramoffset: .word 0x02038BCA
    trainertable: .word 0x0806E4C4
    table:  .word 0x085C8FDC
    table2:  .word 0x08FFFFFF
    return:  .word 0x08147C51

    To activate it in a script, you can use this format:
    Code:
    trainerbattle 0(type, you can change it to fit your script) 0x50(your chosen trainer's ID) [b]0x0100[/b] @pointertomsg1 @pointertomsg2
    0x0100 means the first palette in your custom table at 0x8FFFFFF, and 0x0200 means the second, ...... 0xff00 means the 255th palette.

    Some sample palettes in the original game: (If you don't change the tiles and tileset, please build your palette in this format using APE)
    Code:
    D5 18 CE 39 52 4A D6 5A 5A 6B 17 5C 59 64 9B 6C DD 74 1F 7D CD 6A 0F 73 51 7B 93 7F D5 7F FF 7F
    Code:
    D5 18 CE 39 52 4A D6 5A 5A 6B 41 07 A4 13 C6 1B E9 27 EF 3F FC 45 3E 4E 7F 56 BF 5E FF 66 FC 45
    Give credit to Jambo51 (for the routines for BPRE) and jirachiwishmaker (for finding some offsets) if you use this hack. I only adjusted the routines so that it will be compatible with Emerald's RAM structure and fixed a small glitch in Jambo51's code1. So no credit needed for me, if you don't want to make your credit list long.
     
    Last edited:
    27
    Posts
    8
    Years
    • Seen Mar 5, 2022

    Pre-battle Mugshot Hack in BPEE

    I don't hack Emerald but my friend jirachiwishmaker requested the code, so I will share it.
    This is a port of Jambo51's codes in this thread to Emerald Version
    If you still don't know what it is, please take a look at this picture:
    7-8_zpsiwx42jwk.png

    1. Make these byte changes:
    Code:
    0x147C6A - 00 00 00 00 (disable the palette mixing)
    0xB13FD - 78 (for safety's sake)
    0x5C8F90 - CD 6A 0F 73 51 7B 93 7F D5 7F FF 7F (filling the palette...)
    0x5C8F70 - CD 6A 0F 73 51 7B 93 7F D5 7F FF 7F
    0x5C8F50 - CD 6A 0F 73 51 7B 93 7F D5 7F FF 7F

    2. Insert these 3 ASM codes in free space and change bytes accordingly:
    insert 00 48 00 47 AA AA AA 08 at 0xB0F44, in which AA AA AA 08 is the pointer to the following routine (thumb mode +1)
    Code:
    .thumb
    .align 2
    ldrb r2, [r4, #6]
    cmp r2, #0
    beq normal
    ldr r0, =0x80B0F5D
    bx r0
    
    normal:
    ldrh r2, [r4]
    lsl r0, r2, #2
    add r0, r0, r2
    lsl r0, r0, #3
    add r0, r0, r1
    ldr r1, =0x80B0F4F
    bx r1

    insert 00 48 00 47 BB BB BB 08 at 0xB5E78, BB BB BB 08 = pointer to the following code (thumb mode +1)
    Code:
    .thumb
    .align 2
    cmp r4, #0x47
    beq normal
    cmp r4, #0x48
    beq normal
    ldr r0, =0x2038BCA
    ldrh r0, [r0]
    lsl r5, r0, #2
    add r5, r0, r5
    lsl r0, r5, #3
    ldr r5, =0x806E4C4
    ldr r5, [r5]
    add r0, r0, r5
    ldrb r4, [r0, #3]
    
    normal: 
    add r5, r1, #0
    add r6, r2, #0
    mov r9, r3
    ldr r7, [sp, #0x34]
    ldr r0, =0x80B5E81
    bx r0

    insert 01 49 08 47 00 00 CC CC CC 08 at 0x147C42, CC CC CC 08 = pointer to the following code (thumb mode +1)
    change 0x8FFFFFF to the palette table in your ROM and it can have 255 custom palettes.
    The table's structure is [pointer1][pointer2]........................
    Every pointer will point to a 16-color uncompressed palette (32 bytes)
    Code:
    .thumb
    main:
     ldr r1, ramoffset
     ldrh r1, [r1, #0x0]
     lsl r0, r1, #0x2
     add r0, r0, r1
     lsl r1, r0, #0x3
     ldr r0, trainertable
     ldr r0, [r0, #0x0]
     add r1, r0, r1
     ldrb r1, [r1, #0x1]
     cmp r1, #0x1f
     beq oldway
     cmp r1, #0x26
     beq oldway
     ldr r1, ramoffset
     ldrb r1, [r1, #0x6]
     sub r1, #0x1
     lsl r1, r1, #0x2
     ldr r0, table2
     add r1, r1, r0
     ldr r0, [r1, #0x0]
     b back
    oldway: ldr r1, table
     mov r2, r8
     mov r3, #0x26
     ldrh r0, [r2, r3]
     lsl r0, r0, #0x2
     add r0, r0, r1
     ldr r0, [r0, #0x0]
    back: ldr r1, return
     bx r1
    
    .align 2
    ramoffset: .word 0x02038BCA
    trainertable: .word 0x0806E4C4
    table:  .word 0x085C8FDC
    table2:  .word 0x08FFFFFF
    return:  .word 0x08147C51

    To activate it in a script, you can use this format:
    Code:
    trainerbattle 0(type, you can change it to fit your script) 0x50(your chosen trainer's ID) [b]0x0100[/b] @pointertomsg1 @pointertomsg2
    0x0100 means the first palette in your custom table at 0x8FFFFFF, and 0x0200 means the second, ...... 0xff00 means the 255th palette.

    Some sample palettes in the original game: (If you don't change the tiles and tileset, please build your palette in this format using APE)
    Code:
    D5 18 CE 39 52 4A D6 5A 5A 6B 17 5C 59 64 9B 6C DD 74 1F 7D CD 6A 0F 73 51 7B 93 7F D5 7F FF 7F
    Code:
    D5 18 CE 39 52 4A D6 5A 5A 6B 41 07 A4 13 C6 1B E9 27 EF 3F FC 45 3E 4E 7F 56 BF 5E FF 66 FC 45
    Give credit to Jambo51 (for the routines for BPRE) and jirachiwishmaker (for finding some offsets). I only adjusted the routines so that it will be compatible with Emerald's RAM structure and fixed a small glitch in Jambo51's code1. So no credit needed for me, if you don't want to make your credit list long.

    Worship
     
    457
    Posts
    10
    Years
    • Seen Apr 9, 2024

    Pre-battle Mugshot Hack in BPEE


    Still don't get the mugshot. I have inserted the routines and done the byte changes correctly but still the mugshot do not appear. Assuming I have modified the script too.

    EDIT: It works fine when I use 0x0001, 0x0002, and so on. 0x0100, 0x0200, and so on which are standards to be used for mugshots do not activate well unless you have a palette on that 0x100 slot.
     
    Last edited:

    jiangzhengwenjzw

    now working on katam
    181
    Posts
    11
    Years
    • Seen today
    Still don't get the mugshot. I have inserted the routines and done the byte changes correctly but still the mugshot do not appear. Assuming I have modified the script too.

    EDIT: It works fine when I use 0x0001, 0x0002, and so on. 0x0100, 0x0200, and so on which are standards to be used for mugshots do not activate well unless you have a palette on that 0x100 slot.

    Sorry, I've corrected routine 1 & routine 3... Now it should work fine with 0x100, 0x200, ... ,0xff00
     
    Last edited:
    58
    Posts
    8
    Years
    • Seen Jan 7, 2017
    Please look at following words if you want the custom moves!!!
    Firstly to use custom moves you need a routine written by FBI and modified by me which was originally posted here:
    Code:
    0x3EA46 - 01 48 00 47 00 00 XX XX XX 08 //hook
    and XX XX XX 08 points to (+1):
    Code:
    0C B4 1B 48 1B 49 00 F0 21 F8 0C BC 00 28 1E D0 16 4D 00 24 29 1C 09 78 00 29 13 D0 02 21 61 43 49 19 09 88 40 46 14 4B 00 F0 1D F8 01 34 04 2C F0 D1 00 04 49 46 0D 0C 00 9B 10 49 48 45 05 D1 0F 49 08 47 0C 4B 00 F0 0E F8 F2 E7 08 47 40 46 21 1C 00 93 10 B4 08 4C 00 F0 06 F8 10 BC 00 04 49 46 0D 0C 07 4B 18 47 20 47 C0 46 BE 70 03 02 [FF 40 00 00] (Here means var 0x40ff) 69 E5 06 08 B1 E8 03 08 61 EA 03 08 57 EA 03 08 51 EA 03 08

    Custom 'givepokemon'

    No bugs found in this hack.
    Code:
    .thumb
    /*EWRAM:020370B8 var_8000: species      
    EWRAM:020370BA var_8001: level      
    EWRAM:020370BC var_8002: held item      
    EWRAM:020370BE var_8003: attack 1     
    EWRAM:020370C0 var_8004: attack 2      
    EWRAM:020370C2 var_8005: attack 3      
    EWRAM:020370C4 var_8006: attack 4      
    EWRAM:020370C6 var_8007: HP IV      
    EWRAM:020370C8 var_8008: attack IV     
    EWRAM:020370CA var_8009: defence IV      
    EWRAM:020370CC var_800A: speed IV      
    EWRAM:020370CE var_800B: sp. attack IV      
    EWRAM:020370D0 var_800D: sp. defence IV      
    EWRAM:020370D2 var_800F: shiny?
    EWRAM:020370DE var_8014: ball*/
    
    main_func:
    push {r4-r7, lr}
    sub sp, sp, #0x20
    mov r0, #0x64
    ldr r1, .malloc
    bl jump_r1
    mov r8, r0
    ldr r1, .clear
    bl jump_r1
    mov r0, r8
    ldr r1, .clear2
    bl jump_r1
    ldr r1, .random
    bl jump_r1
    mov r4, r0
    ldr r0, .saveblockptr
    ldr r2, [r0]
    add r2, #0xA @OTID_loc
    add r6, r2, #0
    ldrh r1, [r2]
    ldrh r5, [r2, #2]
    eor r5, r1 @TID xor SID
    ldr r3, .var
    ldrh r3, [r3, #0x1A]
    ldr r1, .random
    bl jump_r1
    bl shinycheck
    /*r0 = PID1, r4 = PID2*/
    lsl r0, r0, #0x10
    ldr r2, .var
    add r2, #0x20
    strh r4, [r2]
    orr r0, r4 @PID
    mov r1, #0
    ldr r2, .var
    add r2, #0x1C
    str r0, [r2]
    mov r0, r8
    ldr r3, .setter1
    bl jump_r3
    mov r0, r8
    ldr r3, .setter1
    mov r1, #1
    add r2, r6, #0
    bl jump_r3
    mov r0, r8
    ldr r1, .checksum
    bl jump_r1
    ldr r2, .var
    add r2, #0x1C
    strh r0, [r2]
    mov r0, r8
    mov r1, #9
    ldr r3, .setter1
    bl jump_r3
    mov r0, r8
    ldr r1, .encrypt
    bl jump_r1
    mov r0, sp
    ldr r1, .var
    ldrh r1, [r1]
    ldr r3, .loadname
    bl jump_r3
    mov r0, r8
    mov r1, #2
    mov r2, sp
    ldr r3, .setter1
    bl jump_r3
    ldr r2, .language
    mov r0, r8
    mov r1, #3
    ldr r3, .setter1
    bl jump_r3
    mov r0, r8
    ldr r5, .saveblockptr
    ldr r2, [r5]
    mov r1, #7
    ldr r3, .setter1
    bl jump_r3
    mov r0, r8
    mov r1, #0xb
    ldr r2, .var
    ldr r3, .setter1
    bl jump_r3
    ldr r4, .stat
    ldr r2, .var
    ldrh r1, [r2]
    lsl r0, r1, #3
    sub r0, r0, r1
    lsl r0, r0, #2
    add r0, r0, r4
    ldrb r1, [r0, #0x13] 
    mov r0, #0xCA
    lsl r0, r0, #1
    add r2, r1, #0
    mul r2, r0
    ldr r0, .var
    ldrb r0, [r0, #2]
    lsl r0, r0, #2
    ldr r1, .exp
    add r0, r0, r1
    add r2, r2, r0
    mov r0, r8
    mov r1, #0x19
    ldr r3, .setter1
    bl jump_r3
    ldr r1, .var
    ldrh r0, [r1]
    lsl r2, r0, #3
    sub r2, r2, r0
    lsl r2, r2, #2
    add r4, #0x12
    add r2, r2, r4
    mov r0, r8
    mov r1, #0x20
    ldr r3, .setter1
    bl jump_r3
    ldr r1, .catchlocation
    bl jump_r1
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    mov r1, #0x23
    ldr r2, .var
    add r2, #0x1C
    str r0, [r2]
    mov r0, r8
    ldr r3, .setter1
    bl jump_r3
    mov r0, r8
    mov r1, #0x24
    ldr r2, .var
    add r2, r2, #2
    ldr r3, .setter1
    bl jump_r3
    mov r0, r8
    ldr r2, .version
    mov r1, #0x25
    ldr r3, .setter1
    bl jump_r3
    ldr r2, .var
    add r2, #0x26
    mov r1, #0x26
    mov r0, r8
    ldr r3, .setter1
    bl jump_r3
    ldr r2, [r5]
    add r2, #8
    mov r0, r8
    mov r1, #0x31
    ldr r3, .setter1
    bl jump_r3
    bl iv_encrypt
    ldr r2, .stat
    ldr r3, .var
    ldrh r1, [r3]
    lsl r0, r1, #3
    sub r0, r0, r1
    lsl r0, r0, #2
    add r0, r0, r2
    ldrb r0, [r0, #0x17]
    cmp r0, #0
    beq end
    ldr r2, .var
    add r2, #0x1C
    ldrh r0, [r2, #4]
    mov r1, #1
    and r0, r1
    str r0, [r2]
    mov r0, r8
    mov r1, #0x2E
    ldr r3, .setter1
    bl jump_r3
    
    end:
    mov r0, r8
    ldr r1, .sub_803E9E0
    bl jump_r1
    mov r0, r8
    mov r1, #0x38
    ldr r2, .var
    add r2, r2, #2
    ldr r3, .setter2
    bl jump_r3
    mov r0, r8
    mov r1, #0x40
    ldr r2, .var
    add r2, #0x1C
    mov r3, #0xFF
    str r3, [r2]
    ldr r3, .setter2
    bl jump_r3
    mov r0, r8
    ldr r1, .recalculation
    bl jump_r1
    mov r0, r8
    mov r1, #0xC
    ldr r2, .var
    add r2, #4
    ldr r3, .setter2
    bl jump_r3
    mov r0, r8
    ldr r1, .catch
    bl jump_r1
    lsl r0, r0, #0x18
    lsr r4, r0, #0x18
    ldr r0, .var
    ldrh r0, [r0]
    ldr r1, .convert
    bl jump_r1
    lsl r0, r0, #0x10
    lsr r5, r0, #0x10
    cmp r4, #1
    bgt back
    cmp r4, #0
    blt back
    add r0, r5, #0
    mov r1, #2
    ldr r3, .dexcheck
    bl jump_r3
    add r0, r5, #0
    mov r1, #3
    ldr r3, .dexcheck
    bl jump_r3
    
    back:
    mov r0, r8
    ldr r1, .free
    bl jump_r1
    add r0, r4, #0
    ldr r4, .var
    strh r0, [r4, #0x18]
    add sp, sp, #0x20
    mov r0, #0
    pop {r4-r7, pc}
    
    shinycheck:
    push {lr}
    cmp r3, #0
    beq jump_pc
    ldr r1, .random
    bl jump_r1
    mov r1, #7
    and r0, r1
    eor r0, r5
    eor r0, r4
    
    jump_pc:
    pop {pc}
    
    iv_encrypt:
    push {lr}
    mov r7, #0
    loop_iv:
    ldr r2, .var
    add r2, #0xE
    mov r0, r8
    ldr r3, .setter1
    add r1, r7, #0
    add r1, #0x27
    lsl r6, r7, #1
    add r2, r2, r6
    bl jump_r3
    add r7, r7, #1
    cmp r7, #6
    bne loop_iv
    pop {pc}
    
    jump_r1:
    bx r1
    
    jump_r3:
    bx r3
    
    .align 2
    .malloc: .word 0x08002BB1
    .clear: .word 0x0803D995
    .clear2: .word 0x0803D97D
    .random: .word 0x8044EC9
    .setter1: .word 0x080404D1
    .saveblockptr: .word 0x300500C
    .var: .word 0x020370B8
    .checksum: .word 0x0803E3E9
    .encrypt: .word 0x0803F8F9
    .loadname: .word 0x08040FD1
    .language: .word 0x081E9F11
    .stat: .word 0x08254784
    .exp: .word 0x08253AE4
    .catchlocation: .word 0x08056261
    .version: .word 0x081E9F10
    .sub_803E9E0: .word 0x0803E9E1
    .setter2: .word 0x0804037D
    .recalculation: .word 0x0803E47D
    .catch: .word 0x08040B15
    .convert: .word 0x08043299
    .dexcheck: .word 0x08088E75
    .free: .word 0x08002BC5

    Usage: (script)
    Code:
    lock
    faceplayer
    setvar 0x40ff 0x1 //custom move trigger
    setvar 0x8000 0x19A //species
    setvar 0x8001 0x28 //level
    setvar 0x8002 0x8F //item
    setvar 0x8003 0x1 //moves
    setvar 0x8004 0x2
    setvar 0x8005 0x3
    setvar 0x8006 0x4
    setvar 0x8007 0x1B //IVs
    setvar 0x8008 0x1C
    setvar 0x8009 0x1D
    setvar 0x800A 0x1E
    setvar 0x800B 0x1F
    setvar 0x800D 0x1F
    setvar 0x800F 0x1 //shiny
    setvar 0x8014 0x4 //pokeball
    callasm 0x8LLLLLL //offset of the function + 1
    setvar 0x40ff 0x0 //make it normal
    release
    end

    Custom 'setwildbattle'

    along with a question
    I've also developed a routine which can customize the wild pokemon for firered.
    Insert this piece of code in free space:
    Code:
    .thumb
    /*EWRAM:020370B8 var_8000: species      
    EWRAM:020370BA var_8001: level      
    EWRAM:020370BC var_8002: held item      
    EWRAM:020370BE var_8003: attack 1     
    EWRAM:020370C0 var_8004: attack 2      
    EWRAM:020370C2 var_8005: attack 3      
    EWRAM:020370C4 var_8006: attack 4      
    EWRAM:020370C6 var_8007: HP IV      
    EWRAM:020370C8 var_8008: attack IV     
    EWRAM:020370CA var_8009: defence IV      
    EWRAM:020370CC var_800A: speed IV      
    EWRAM:020370CE var_800B: sp. attack IV      
    EWRAM:020370D0 var_800D: sp. defence IV      
    EWRAM:020370D2 var_800F: shiny?*/
    
    main_func:
    push {r4-r7, lr}
    sub sp, sp, #0x20
    ldr r1, .clear
    bl jump_r1
    ldr r0, .pkmndata
    ldr r1, .clear2
    bl jump_r1
    ldr r1, .random
    bl jump_r1
    mov r4, r0
    ldr r0, .saveblockptr
    ldr r2, [r0]
    add r2, #0xA @OTID_loc
    add r6, r2, #0
    ldrh r1, [r2]
    ldrh r5, [r2, #2]
    eor r5, r1 @TID xor SID
    ldr r3, .var
    ldrh r3, [r3, #0x1A]
    ldr r1, .random
    bl jump_r1
    bl shinycheck
    /*r0 = PID1, r4 = PID2*/
    lsl r0, r0, #0x10
    ldr r2, .var
    add r2, #0x20
    strh r4, [r2]
    orr r0, r4 @PID
    mov r1, #0
    ldr r2, .var
    add r2, #0x1C
    str r0, [r2]
    ldr r0, .pkmndata
    ldr r3, .setter1
    bl jump_r3
    ldr r0, .pkmndata
    ldr r3, .setter1
    mov r1, #1
    add r2, r6, #0
    bl jump_r3
    ldr r0, .pkmndata
    ldr r1, .checksum
    bl jump_r1
    ldr r2, .var
    add r2, #0x1C
    strh r0, [r2]
    ldr r0, .pkmndata
    mov r1, #9
    ldr r3, .setter1
    bl jump_r3
    ldr r0, .pkmndata
    ldr r1, .encrypt
    bl jump_r1
    mov r0, sp
    ldr r1, .var
    ldrh r1, [r1]
    ldr r3, .loadname
    bl jump_r3
    ldr r0, .pkmndata
    mov r1, #2
    mov r2, sp
    ldr r3, .setter1
    bl jump_r3
    ldr r2, .language
    ldr r0, .pkmndata
    mov r1, #3
    ldr r3, .setter1
    bl jump_r3
    ldr r0, .pkmndata
    ldr r5, .saveblockptr
    ldr r2, [r5]
    mov r1, #7
    ldr r3, .setter1
    bl jump_r3
    ldr r0, .pkmndata
    mov r1, #0xb
    ldr r2, .var
    ldr r3, .setter1
    bl jump_r3
    ldr r4, .stat
    ldr r2, .var
    ldrh r1, [r2]
    lsl r0, r1, #3
    sub r0, r0, r1
    lsl r0, r0, #2
    add r0, r0, r4
    ldrb r1, [r0, #0x13] 
    mov r0, #0xCA
    lsl r0, r0, #1
    add r2, r1, #0
    mul r2, r0
    ldr r0, .var
    ldrb r0, [r0, #2]
    lsl r0, r0, #2
    ldr r1, .exp
    add r0, r0, r1
    add r2, r2, r0
    ldr r0, .pkmndata
    mov r1, #0x19
    ldr r3, .setter1
    bl jump_r3
    ldr r1, .var
    ldrh r0, [r1]
    lsl r2, r0, #3
    sub r2, r2, r0
    lsl r2, r2, #2
    add r4, #0x12
    add r2, r2, r4
    ldr r0, .pkmndata
    mov r1, #0x20
    ldr r3, .setter1
    bl jump_r3
    ldr r1, .catchlocation
    bl jump_r1
    lsl r0, r0, #0x18
    lsr r0, r0, #0x18
    mov r1, #0x23
    ldr r2, .var
    add r2, #0x1C
    str r0, [r2]
    ldr r0, .pkmndata
    ldr r3, .setter1
    bl jump_r3
    ldr r0, .pkmndata
    mov r1, #0x24
    ldr r2, .var
    add r2, r2, #2
    ldr r3, .setter1
    bl jump_r3
    ldr r0, .pkmndata
    ldr r2, .version
    mov r1, #0x25
    ldr r3, .setter1
    bl jump_r3
    mov r0, #4
    ldr r2, .var
    add r2, #0x1C
    str r0, [r2]
    mov r1, #0x26
    ldr r0, .pkmndata
    ldr r3, .setter1
    bl jump_r3
    ldr r2, [r5]
    add r2, #8
    ldr r0, .pkmndata
    mov r1, #0x31
    ldr r3, .setter1
    bl jump_r3
    bl iv_encrypt
    ldr r2, .stat
    ldr r3, .var
    ldrh r1, [r3]
    lsl r0, r1, #3
    sub r0, r0, r1
    lsl r0, r0, #2
    add r0, r0, r2
    ldrb r0, [r0, #0x17]
    cmp r0, #0
    beq end
    ldr r2, .var
    add r2, #0x1C
    ldrh r0, [r2, #4]
    mov r1, #1
    and r0, r1
    str r0, [r2]
    ldr r0, .pkmndata
    mov r1, #0x2E
    ldr r3, .setter1
    bl jump_r3
    
    end:
    ldr r0, .pkmndata
    ldr r1, .sub_803E9E0
    bl jump_r1
    ldr r0, .pkmndata
    mov r1, #0x38
    ldr r2, .var
    add r2, r2, #2
    ldr r3, .setter2
    bl jump_r3
    ldr r0, .pkmndata
    mov r1, #0x40
    ldr r2, .var
    add r2, #0x1C
    mov r3, #0xFF
    str r3, [r2]
    ldr r3, .setter2
    bl jump_r3
    ldr r0, .pkmndata
    ldr r1, .recalculation
    bl jump_r1
    ldr r0, .pkmndata
    mov r1, #0xC
    ldr r2, .var
    add r2, #4
    ldr r3, .setter2
    bl jump_r3
    add sp, sp, #0x20
    mov r0, #0
    pop {r4-r7, pc}
    
    shinycheck:
    push {lr}
    cmp r3, #0
    beq jump_pc
    ldr r1, .random
    bl jump_r1
    mov r1, #7
    and r0, r1
    eor r0, r5
    eor r0, r4
    
    jump_pc:
    pop {pc}
    
    iv_encrypt:
    push {lr}
    mov r7, #0
    loop_iv:
    ldr r2, .var
    add r2, #0xE
    ldr r0, .pkmndata
    ldr r3, .setter1
    add r1, r7, #0
    add r1, #0x27
    lsl r6, r7, #1
    add r2, r2, r6
    bl jump_r3
    add r7, r7, #1
    cmp r7, #6
    bne loop_iv
    pop {pc}
    
    jump_r1:
    bx r1
    
    jump_r3:
    bx r3
    
    .align 2
    .clear: .word 0x0803DA35
    .pkmndata: .word 0x0202402C
    .clear2: .word 0x0803D97D
    .random: .word 0x8044EC9
    .setter1: .word 0x080404D1
    .saveblockptr: .word 0x300500C
    .var: .word 0x020370B8
    .checksum: .word 0x0803E3E9
    .encrypt: .word 0x0803F8F9
    .loadname: .word 0x08040FD1
    .language: .word 0x081E9F11
    .stat: .word 0x08254784
    .exp: .word 0x08253AE4
    .catchlocation: .word 0x08056261
    .version: .word 0x081E9F10
    .sub_803E9E0: .word 0x0803E9E1
    .setter2: .word 0x0804037D
    .recalculation: .word 0x0803E47D

    How to use:
    Create a script: (The usage of the variables are listed in the comment of the function written by me)
    Code:
    lock
    faceplayer
    setvar 0x40ff 0x1 //custom move trigger
    setvar 0x8000 0x19A //species
    setvar 0x8001 0x28 //level
    setvar 0x8002 0x8F //item (This won't work, so you can't make the pokemon hold an item because another routine clears it. I don't know the reason and I can only wait for fixing. )
    setvar 0x8003 0x1 //moves
    setvar 0x8004 0x2
    setvar 0x8005 0x3
    setvar 0x8006 0x4
    setvar 0x8007 0x1F //max IVs
    setvar 0x8008 0x1F
    setvar 0x8009 0x1F
    setvar 0x800A 0x1F
    setvar 0x800B 0x1F
    setvar 0x800D 0x1F
    setvar 0x800F 0x1 //shiny
    callasm 0x8MMMMMM //offset of the ASM function +1
    dowildbattle
    setvar 0x40ff 0x0 //make it normal
    release
    //Here you can insert other codes. 
    end

    The item will be cleared by another routine (around 0x44446), so I hope that someone can fix the bug to make the routine more perfect. :)
     
    Last edited:

    Lunos

    Random Uruguayan User
    3,114
    Posts
    15
    Years
  • Pokemon Obedience via Level and Happiness!


    How it works:
    If your Pokemon outlevels the level your badges say you can control, it will disobey you if it's unhappy. The concept was pretty simple sounding, but there was a lot of work that went into it. This should keep some similarities to the anime.
    I should note that if your Pokemon loves you, and you don't have the badge to train it, it will still listen to you :3

    This one is called love.asm

    How to insert:
    Compile and insert into freespace the following code:
    Spoiler:

    Here's a compiled version:
    Code:
    82 24 24 01 00 22 20 1C 15 4E 00 F0 28 F8 01 28 04 D1 01 34 01 32 08 2A 1A D0 F4 E7 0A 20 82 22 12 01 A4 1A 44 43 14 34 28 88 78 43 0D 4E 80 19 38 21 0D 4E 00 F0 13 F8 A0 42 09 DD 28 88 78 43 08 4E 80 19 20 21 08 4E 00 F0 09 F8 7F 28 01 D9 01 20 01 E0 05 48 00 47 00 22 05 49 08 47 30 47 D1 E6 06 08 84 42 02 02 E9 FB 03 08 15 D4 01 08 2B D4 01 08
    Navigate to 0x1D3E0 and insert:
    Code:
     00 48 00 47 XX XX XX 08
    Where XX XX XX is the reverse hex pointer to location you compiled the routine.

    I should mention there was a little bit of this routine which I'm skipping over. Basically it checks if the Pokemon is a Mew or Deoxys. It then checks if the Mew/Deoxys has it's obedience set. I find the need for this non-existent because the obedience is checked by happiness and badges my way. In the end, if you want to keep these two (rather pointless) checks, insert at 0x1D406.

    Sorry for the double post. I want to keep my routines on separate posts to help in formatting the first post's index :x

    Requested here: http://www.pokecommunity.com/showpost.php?p=8510180&postcount=1
    I made a special exception and decided to do it for her here by that I mean no other requests were on the table:)

    Hi, a completely noob in this type of scripts here.
    I just wanted to know how can i properly insert this Script because i obviously don't know how and because there isn't any cheat to make the Pokemons obey xD

    I tried to insert it it like this:
    1) Searched for a Free Offset in FSF, in the amount of bytes typed 256
    2) Went there in HxD and pasted the whole compiled script which you posted ("82 24 24 01 00 22" etc, etc)
    3) Went in HxD to 1D3E0 and then typed the pointer offset from FSF
    4) Saved, tried the ROM and then since the first second there was just a white screen

    Once again, this is the first time i ever try to insert an ASM script in a ROM, so please, try to not kill me xD ..

    EDIT:
    Nvm, reading FBI's guide to insert them, wish me luck.

    EDIT2:
    Okay, so, i copied the whole code into the
    Code:
     tags, pasted it in a Txt file and saved it as "Love.asm" ([COLOR=Gray]replacing the .txt atribute[/COLOR])
    Then, i've dropped the Love.asm to the thumb.bat and there's supposed to be a "Love.bin" file over there, which isn't :/
    I'll try to compile it via CMD just like the tutorial says and see if it works that way, but in my 2nd try it didn't..
    
    EDIT3:
    Okay, trying to compile it via CMD it says:
    "love.asm:0: Warning: end of file not at end of a line: newline inserted
    Assembled successfully"
    So.. i'll take that warning as a false alarm, i'll try to insert it in the ROM, wish me luck.
    
    EDIT4:
    Welp, didn't worked.
    Opened in HxD the file "Love.bin", copied the whole thing, pasted it in an empty offset ([COLOR=Gray]82B31C[/COLOR])
    Then, went to 1D3E0 and typed "00 48 00 47 1C B3 82 08"
    Saved, went to a sign with a simple msgbox, typed the command "callasm 0x82B31D" just before the "end", compiled in XSE, put its offset in the sign's one at A-Map, and when i was about to test, there's just a white screen the whole time :c ...
    I'm obviously doing something wrong, but a clue would be really appreciated u.u
    
    EDIT5:
    Okay, i somehow managed to insert it more correctly, but now, when i'm about to choose an attack, the game freezes ;_; ..
    Is the whole thing compatible with Fire Red? xD
     
    Last edited:

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • Hi, a completely noob in this type of scripts here.
    I just wanted to know how can i properly insert this Script because i obviously don't know how and because there isn't any cheat to make the Pokemons obey xD

    I tried to insert it it like this:
    1) Searched for a Free Offset in FSF, in the amount of bytes typed 256
    2) Went there in HxD and pasted the whole compiled script which you posted ("82 24 24 01 00 22" etc, etc)
    3) Went in HxD to 1D3E0 and then typed the pointer offset from FSF
    4) Saved, tried the ROM and then since the first second there was just a white screen

    Once again, this is the first time i ever try to insert an ASM script in a ROM, so please, try to not kill me xD ..

    EDIT:
    Nvm, reading FBI's guide to insert them, wish me luck.

    EDIT2:
    Okay, so, i copied the whole code into the
    Code:
     tags, pasted it in a Txt file and saved it as "Love.asm" ([COLOR=Gray]replacing the .txt atribute[/COLOR])
    Then, i've dropped the Love.asm to the thumb.bat and there's supposed to be a "Love.bin" file over there, which isn't :/
    I'll try to compile it via CMD just like the tutorial says and see if it works that way, but in my 2nd try it didn't..
    
    EDIT3:
    Okay, trying to compile it via CMD it says:
    "love.asm:0: Warning: end of file not at end of a line: newline inserted
    Assembled successfully"
    So.. i'll take that warning as a false alarm, i'll try to insert it in the ROM, wish me luck.
    
    EDIT4:
    Welp, didn't worked.
    Opened in HxD the file "Love.bin", copied the whole thing, pasted it in an empty offset ([COLOR=Gray]82B31C[/COLOR])
    Then, went to 1D3E0 and typed "00 48 00 47 1C B3 82 08"
    Saved, went to a sign with a simple msgbox, typed the command "callasm 0x82B31D" just before the "end", compiled in XSE, put its offset in the sign's one at A-Map, and when i was about to test, there's just a white screen the whole time :c ...
    I'm obviously doing something wrong, but a clue would be really appreciated u.u
    
    EDIT5:
    Okay, i somehow managed to insert it more correctly, but now, when i'm about to choose an attack, the game freezes ;_; ..
    Is the whole thing compatible with Fire Red? xD[/QUOTE]
    
    Mother of notifications I got from this post, lol. I think this specific routine is working, I've tested it a while ago when I was making it.
    
    You don't use callasm, just use the compiled code snipplet, and paste it into some free space. From there you make a reverse hex pointer and place the hook at 0x1D3E0, then don't touch it, it's automated. If you're still having issues, please open your ROM in VBA -> disassemble -> (tick thumb) and in the goto space put in 0801D3D0. Print screen and paste the result in the ASM help thread or something. I'll assist with specific problems over there.
     
    1
    Posts
    8
    Years
    • Seen Dec 15, 2015

    Events that happen daily:



    First of all, this uses the Day/Night System's clock, or you can use ShinyQuagsire's RTC, which I'm fairly sure are one and the same anyway. Either way, you have to have that in the game or this won't work for obvious reasons.


    Insert this into free space.
    Code:
    .thumb
    start:
     push {r0-r7, lr}
     ldr r0, =(0x20370D0)
     ldrh r1, [r0]
     mov r2, #0x4
     mul r1, r1, r2
     ldr r0, =(0x3005546)
     add r0, r0, r1
     mov r1, r0
     mov r2, r0
     add r0, #0x1
     add r1, #0x2
     add r2, #0x3
     ldrh r3, [r0]
     ldrb r4, [r1]
     ldrb r5, [r2]
     ldr r6, =(0x300553C)
     ldrh r7, [r6]
     cmp r3, r7
     bcc x800D_1
     strh r7, [r0]
     ldr r6, =(0x300553F)
     ldrb r7, [r6]
     cmp r4, r7
     bcc x800D_1
     strb r7, [r1]
     ldr r6, =(0x3005540)
     ldrb r7, [r6]
     cmp r5, r7
     bcc x800D_1
     strb r7, [r2]
     ldr r0, =(0x20370D0)
     mov r1, #0x0
     strh r1, [r0]
     pop {r0-r7, pc}
    x800D_1:
     ldr r6, =(0x300553C)
     ldrh r7, [r6]
     strh r7, [r0]
     ldr r6, =(0x300553F)
     ldrb r7, [r6]
     strh r7, [r1]
     ldr r6, =(0x3005540)
     ldrb r7, [r6]
     strb r7, [r2]
     ldr r0, =(0x20370D0)
     mov r1, #0x1
     strh r1, [r0]
     pop {r0-r7, pc}
    This hack uses variable x800D for almost everything. So each event that happens daily is supposed to have a number attached to it using x800D, like so.
    Code:
    #dynamic 0x______
     
    #org @start
    setvar 0x800D 0x_ (set 800D to the table entry.)
    callasm 0x8(offset where you put my the previous ASM +1)
    compare 0x800D 0x0
    if 0x1 goto @1 (if x800D is the value of 0, then the event has already happened today)
    compare 0x800D 0x1
    if 0x1 goto @2 (if x800D is the value of 1, then the event has not happened that day)
    Please credit if you use this, and report any bugs here or by PM/VM, thanks.

    Hi, I have a problem with this. The timed events are all working fine until I save and reload the game. It seems once you reset the game and continue from your save that the event shows as 'not happened' despite the day being the same as when I first activated the script. I think this is a bug. Is there any workaround?
     
    325
    Posts
    10
    Years
  • Hi, I have a problem with this. The timed events are all working fine until I save and reload the game. It seems once you reset the game and continue from your save that the event shows as 'not happened' despite the day being the same as when I first activated the script. I think this is a bug. Is there any workaround?
    I use savestates because I don't quite trust the save data fixes that other people have provided. Savestates definitely work, but I hadn't tested that with regular saves. It was an error on my part to overlook that other people would use the regular save function. If possible, I'll come up with another routine that'll do the same thing but be incorporated to the regular save data.
     
    3,830
    Posts
    14
    Years
    • Age 27
    • OH
    • Seen Feb 26, 2024

    Reusable TMs in LeafGreen

    First posted by FBI here, these routines prevent the consumption of TMs like in the recent games.

    Prevent Consumption:
    0x124F50: 00 00 00 00
    0x125C58: 00 00 00 00
    0x124E84: 00 00 00 00

    Make it Ungivable:
    0x132690: 00 00 17 E0

    Make it Unsellable:
    0x1328FC: 00 00 00 00

    To remove the quantities showing up in the bag:
    Code:
    .text
    .align 2
    .thumb
    .thumb_func
    
    main:
    	cmp r5, #0x0
    	bne end
    	ldr r3, =(0x8131ED6 +1)
    	bx r3
    
    end:
    	mov r0, r7
    	mov r1, #0x8
    	mov r2, r4
    	ldr r6, =(0x8133588 +1)
    	bl link
    	ldr r3, =(0x8131ED6 +1)
    	bx r3
    
    link:
    	bx r6
    
    .align 2

    At 0x131ECC put:
    00 48 00 47 XX XX XX 08
    Where XX XX XX is the pointer to where you assembled the routine + 1.

    Finally at 0x131E7D change the byte to E0.
     
    Last edited:
    3,830
    Posts
    14
    Years
    • Age 27
    • OH
    • Seen Feb 26, 2024

    Random Natural Number Generator in LeafGreen

    A port of FBI's Natural RNG, this was almost exactly the same. Just needed one offset changed.

    Compile and insert this routine anywhere.
    Code:
    text
    .align 2
    .thumb
    .thumb_func
    
    main:
    	push {r4, lr}
    	ldr r4, =(0x08044EC8 +1)@gen random number
    	bl linker
    	lsl r0, r0, #0x10
    	lsr r0, r0, #0x10
    	ldr r1, =(0x020370B8) @convert to int between 0x0 to [var 0x8000] exclusive
    	ldrh r1, [r1]
    	ldr r4, =(0x081E4660 +1) @ this changed
    	bl linker
    	ldr r1, =(0x020370D0) @store in last result
    	strh r0, [r1]
    	pop {r4, pc}
    
    linker:
    	bx r4
    
    .align 2

    To use it, set variable 0x8000 to the number of results you want, and it will generate a number between 0 and 0xFFFF exclusive. The result will then be placed in variable 0x8000.
     
    534
    Posts
    11
    Years
    • Age 26
    • Seen Jul 24, 2023

    Reusable TMs in LeafGreen

    As part of an effort to encourage LeafGreen hacking, I've decided to begin translating various ASM routines from FireRed to LeafGreen. I decided to start with reusable TMs. First posted by FBI here, these routines prevent the consumption of TMs like in the recent games.

    Prevent Consumption:
    0x124F50: 00 00 00 00
    0x125C58: 00 00 00 00
    0x124E84: 00 00 00 00

    Make it Ungivable:
    0x132690: 00 00 17 E0

    To remove the quantities showing up in the bag:
    Code:
    .text
    .align 2
    .thumb
    .thumb_func
    
    main:
        cmp r5, #0x0
        bne end
        ldr r3, =(0x8131ED6 +1)
        bx r3
    
    end:
        mov r0, r7
        mov r1, #0x8
        mov r2, r4
        ldr r6, =(0x8133588 +1)
        bl link
        ldr r3, =(0x8131ED6 +1)
        bx r3
    
    link:
        bx r6
    
    .align 2
    At 0x131ECC put:
    00 48 00 47 XX XX XX 08
    Where XX XX XX is the pointer to where you assembled the routine + 1.

    Finally at 0x131E7D change the byte to E0.

    Oooh~ This is cool! I remember that I chose LeafGreen above FireRed when I was a kid to be my first GBA game! Oooh~ The feels of nostalgia. T^T But you should have used and ported this one instead. It doesn't require a different routine, just a few byte edits, which I think is more practical. Just sayin'. :P

    I've found a way to make TMs unsellable:
    Code:
    0x132924 - 00 00 00 00
    In addition, the quantity in bag when you buy TMs in the game should be hided, and here is a quick way to remove the box which shows the quantity for all items:
    Code:
    0x9BCC2 - 00 00 00 00
    So here's the full code, no extra routines needed

    Reusable TMs

    Code:
    0x1326BA - 17 E0 //can't hold as item
    0x124F78 - 00 00 00 00 //can't delete
    0x125C80 - 00 00 00 00 //can't delete
    0x124EAC - 00 00 00 00 //can't delete
    0x131EA6 - 2A E0 //fix the graphic
    0x132924 - 00 00 00 00 //can't sell
    0x9BCC2 - 00 00 00 00 //hide the box showing quantity
     

    Touched

    Resident ASMAGICIAN
    625
    Posts
    9
    Years
    • Age 122
    • Seen Feb 1, 2018
    Yeah, Touched! Using Leaf Green instead of Fire Red is very creative! Why do you think Advanced Adventure is my favorite hack ever? That hack was worth the mild annoyance of being forced to go download the other version :P

    So if I change 24 Pokemon, edit a Tilescreen and shuffle a few functions around then label the resulting mess "WaterBlue", I'll win HOTY?
     
    218
    Posts
    10
    Years
    • Seen Nov 12, 2021
    Yeah, Touched! Using Leaf Green instead of Fire Red is very creative! Why do you think Advanced Adventure is my favorite hack ever? That hack was worth the mild annoyance of being forced to go download the other version :P

    I know we're already out-of-topic, sorry for that but :

    What is the point of hacking LG ? It's a waste of time.

    We should put all our effort together by hacking EM or FR to make more progress, there's no point on hacking LG/RUBY/SAPPHIR because they don't bring anything new/better while FR/EM have so much research done.

    Please don't tell me there's nothing to hack in these games anymore. There's plenty of things to do.

    Of course anyone can do whatever he wants, but for the sake of the hacking and the progress, we shouldn't encourage to hack other games than FR and EM
     

    Blah

    Free supporter
    1,924
    Posts
    11
    Years
  • Meh, no one really cares. He just ported the stuff over, which is completely fine in my eyes. Lets let the folks hack what they wanna hack, sure some ROM bases are inferior, but if you don't care then whatever. I mean, all gen 3 ROMs are superior to gen 2 and 1 ROMs interms of coding and implemented features, yet people still hack those.

    EDIT: I lied, early gens have complete disassembly. Sorry folks :D
     
    Last edited:
    Back
    Top