The PokéCommunity Forums Fan Games ROM Hacking Help Research & Development
Development ASM Resource Thread

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

Reply
 
Thread Tools
  #1401    
Old July 20th, 2018 (7:53 PM). Edited July 20th, 2018 by UltimaSoul.
UltimaSoul UltimaSoul is offline
     
    Join Date: May 2018
    Posts: 37
    Quote:
    Originally Posted by tkim View Post
    [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
            ldrh r0, [r4]
            cmp r0, #0xAC
            bne _08070918
            mov r0, sp
            add r1, r5, #0
            bl sub_82706FC
    _08070918:
            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.
    Reply With Quote
      #1402    
    Old July 20th, 2018 (9:34 PM). Edited July 20th, 2018 by dearman4.
    dearman4's Avatar
    dearman4 dearman4 is offline
       
      Join Date: Nov 2017
      Location: Michigan
      Age: 26
      Gender: Male
      Posts: 81
      Quote:
      Originally Posted by jiangzhengwenjzw View Post
      Misc:

      A EV-IV Display Screen


      RENEWAL:
      Spoiler:
      The new version is here (no difference, but codes will be automatically inserted into the ROM):
      FIRERED:
      https://github.com/jiangzhengwenjz/EV-IV-Screen
      EMERALD:
      https://github.com/jiangzhengwenjz/EV-IV-Screen-EM
      Read Readme.md to know how to compile.

      Quick Preview:

      OLD CONTENT:
      Spoiler:
      Quick Preview:

      Download:
      https://github.com/jiangzhengwenjz/EV-IV-Screen/tree/c1b303e17788f21e1a663204f9db59ffdcfc2a2d
      Usage:
      1. Make sure that you have Devkitarm and GNU make/cygwin installed.
      2. Download this repo and create a new folder called "build".
      3. Assign the free space you want to use in linker.lsc.
      4. Open your cmd prompt and type in make. Then press enter.
      5. Now main.bin should be generated. Paste it to the offset specified in step3.
      6. Write a script to test (You should callasm to the offset of insertion + 0x79).
      Code:
      Example:
      lock
      faceplayer
      callasm 0x8800079 //I inserted the code at 0x8800000 
      msgbox 0x8FD0013 0x2 //"It's nice, huh?"
      releaseall
      end
      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?
      Reply With Quote
        #1403    
      Old August 10th, 2018 (10:06 AM).
      Petuuuhhh's Avatar
      Petuuuhhh Petuuuhhh is offline
       
      Join Date: Apr 2017
      Location: Georgia
      Age: 25
      Gender: Male
      Posts: 536
      If anybody knows a routine for the Focus Sash in FireRed, I'd like to insert it into my ROM hack.
      Reply With Quote
        #1404    
      Old August 19th, 2018 (8:27 AM).
      Super Versekr Dark Super Versekr Dark is offline
         
        Join Date: Jan 2017
        Gender: Male
        Posts: 20
        Excuse me, can you put Ruby's routines here?
        Reply With Quote
          #1405    
        Old August 19th, 2018 (4:09 PM).
        BrittneySpearsMom BrittneySpearsMom is offline
        bets haker 2018!!!!1
           
          Join Date: Jul 2017
          Gender: Male
          Posts: 7
          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.
          __________________
          I'm learning how to sprite and hack from the ground up.

          Visit my Pixel Art thread and my attempts (and failures) at learning GBA style spriting.
          Reply With Quote
            #1406    
          Old August 23rd, 2018 (2:13 PM).
          Skeli-'s Avatar
          Skeli- Skeli- is offline
          Lord of the Rings
             
            Join Date: Apr 2014
            Location: Canada
            Age: 19
            Gender: Male
            Nature: Adamant
            Posts: 191
            The bag expansion for Fire Red has been completely revamped and should work now:
            https://www.pokecommunity.com/showthread.php?p=9743323#9743323
            __________________
            Pokemon Unbound

            Reply With Quote
              #1407    
            Old August 25th, 2018 (5:30 PM). Edited August 28th, 2018 by tkim.
            tkim tkim is offline
               
              Join Date: May 2011
              Posts: 221
              Quote:
              Originally Posted by Pokemon_XY View Post

              Time Box triggered along with the Start Menu


              Preview: (Click to see the GIF animation)
              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:
              byte changes:
              Code:
              0x6F09C - 00 48 00 47 XX+1 XX XX 08
              change all the 0x8750000 in the routine to the insert offset of the routine. 
              change all the 0x8750001 in the routine to the insert offset + 1 of the routine.
              routine:
              Code:
              .thumb
              bl box_func
              ldr r1, =0x20370FF
              ldrb r0, [r1]
              add r0, #1
              strb r0, [r1]
              mov r0, #0
              add sp, sp, #0xC
              pop {r4, pc}
              .ltorg
              
              box_func:
              push {r4, lr}
              ldr r4, =0x2037101
              ldr r0, =(0x8750000 + rbox_config)
              ldr r3, =0x8003ce5
              bl call_r3
              strb r0, [r4]
              ldr r3, =0x8003fa1
              bl call_r3
              ldrb r0, [r4]
              mov r1, #0
              ldr r3, =0x80F6F1D
              bl call_r3
              bl print_string
              ldr r0, =(0x8750001 + print_string)
              mov r1, #2
              ldr r3, =0x807741D
              bl call_r3
              ldr r1, =0x20370C0
              strh r0, [r1]
              pop {r4, pc}
              .ltorg
              
              print_string:
              push {r4-r7, lr}
              sub sp, sp, #0xC
              ldr r0, =0x2021cd0
              add r7, r0, #0
              ldr r1, =0x300553c
              ldrb r5, [r1, #7] @minute
              ldrb r6, [r1, #8] @second
              ldrb r1, [r1, #6] @hour
              mov r2, #1
              mov r3, #2
              ldr r4, =0x8008E79
              bl call_r4
              bl go_padding
              ldr r0, =0x2021CF0
              add r7, r0, #0
              add r1, r5, #0
              mov r2, #1
              mov r3, #2
              ldr r4, =0x8008e79
              bl call_r4
              bl go_padding
              ldr r0, =0x2021d04
              add r7, r0, #0
              add r1, r6, #0
              mov r2, #1
              mov r3, #2
              ldr r4, =0x8008e79
              bl call_r4
              bl go_padding
              ldr r5, =0x2021D18
              ldr r1, =(0x8750000 + string)
              add r0, r5, #0
              ldr r3, =0x8008FCD
              bl call_r3
              ldr r0, =0x2037101
              ldrb r0, [r0]
              mov r1, #3
              str r1, [sp]
              mov r1, #0xff
              str r1, [sp, #4]
              mov r1, #0
              str r1, [sp, #8]
              mov r1, #2
              add r2, r5, #0
              mov r3, #4
              ldr r4, =0x8002C49
              bl call_r4
              ldr r0, =0x2037101
              ldrb r0, [r0]
              mov r1, #2
              ldr r3, =0x8003F21
              bl call_r3
              add sp, sp, #0xC
              pop {r4-r7, pc}
              .ltorg
              
              go_padding:
              push {lr}
              ldrb r0, [r7]
              cmp r0, #0
              bne back
              mov r0, #0xa1
              strb r0, [r7]
              back:
              pop {pc}
              
              call_r3:
              bx r3
              
              call_r4:
              bx r4
              
              .align 2
              rbox_config:
              .byte 0x0 @bg_id
              .byte 0x1 @x
              .byte 0x1 @y
              .byte 0xa @width
              .byte 0x2 @height
              .byte 0xf
              .hword 0x8 @tileset_ofs
              .word 0x8419f76 @pixels
              
              .align 2
              string: 
              .byte 0xce, 0xdd, 0xe1, 0xd9, 0xf0, 0xfd, 0x2, 0xf0, 0xfd, 0x3, 0xf0, 0xfd, 0x4, 0xff

              Routine II:
              Spoiler:
              byte changes:
              Code:
              0x6EF1E - 00 00 00 49 08 47 YY+1 YY YY 08
              routine:
              Code:
              .thumb
              cmp r0, #1
              beq safari
              ldr r0, =0x20370C0
              ldrh r0, [r0]
              ldr r3, =0x8077509
              bl call_r3
              
              safari:
              ldr r4, =0x02037101
              ldrb r0, [r4]
              mov r1, #0
              ldr r3, =0x806ef29
              
              call_r3:
              bx r3

              Routine III:
              Spoiler:
              byte changes:
              Code:
              0x6f4e8 - 00 48 00 47 ZZ+1 ZZ ZZ 08
              routine:
              Code:
              .thumb
              push {lr}
              ldr r0, =0x20370c0
              ldrh r0, [r0]
              ldr r3, =0x8077509
              bl call_r3
              ldr r1, =0x20370F0
              ldr r0, =0x806f5a5
              str r0, [r1]
              mov r0, #0
              pop {pc}
              call_r3:
              bx r3
              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:
              Code:
              @ 0x6F09C - 00 48 00 47 XX+1 XX XX 08
              @ change all the 0x8950000 in the routine to the insert offset of the routine. 
              @ change all the 0x8950001 in the routine to the insert offset + 1 of the routine.
              Code:
              .thumb
              mov r0, #0x80
              lsl r0, r0, #4
              bl flag_check
              lsl r0, r0, #0x18
              lsr r0, r0, #0x18
              cmp r0, #0x1
              beq safari
              bl box_func
              
              safari:
              ldr r1, =0x20370FF
              ldrb r0, [r1]
              add r0, #1
              strb r0, [r1]
              mov r0, #0
              add sp, sp, #0xC
              pop {r4, pc}
              .ltorg
              
              box_func:
              push {r4, lr}
              ldr r4, =0x2037101
              ldr r0, =(0x8950000 + rbox_config)
              ldr r3, =0x8003ce5
              bl call_r3
              strb r0, [r4]
              ldr r3, =0x8003fa1
              bl call_r3
              ldrb r0, [r4]
              mov r1, #0
              ldr r3, =0x80F6F1D
              bl call_r3
              bl print_string
              ldr r0, =(0x8950001 + print_string)
              mov r1, #2
              ldr r3, =0x807741D
              bl call_r3
              ldr r1, =0x20370C0
              strh r0, [r1]
              pop {r4, pc}
              .ltorg
              
              print_string:
              push {r4-r7, lr}
              sub sp, sp, #0xC
              ldr r0, =0x2021cd0
              add r7, r0, #0
              ldr r1, =0x300553c
              ldrb r5, [r1, #7] @minute
              ldrb r1, [r1, #6] @hour
              mov r2, #1
              mov r3, #2
              ldr r4, =0x8008E79
              bl call_r4
              bl go_padding
              ldr r0, =0x2021CF0
              add r7, r0, #0
              add r1, r5, #0
              mov r2, #1
              mov r3, #2
              ldr r4, =0x8008e79
              bl call_r4
              bl go_padding
              ldr r5, =0x2021D18
              ldr r1, =(0x8950000 + string)
              add r0, r5, #0
              ldr r3, =0x8008FCD
              bl call_r3
              ldr r0, =0x2037101
              ldrb r0, [r0]
              mov r1, #3
              str r1, [sp]
              mov r1, #0xff
              str r1, [sp, #4]
              mov r1, #0
              str r1, [sp, #8]
              mov r1, #2
              add r2, r5, #0
              mov r3, #4
              ldr r4, =0x8002C49
              bl call_r4
              ldr r0, =0x2037101
              ldrb r0, [r0]
              mov r1, #2
              ldr r3, =0x8003F21
              bl call_r3
              add sp, sp, #0xC
              pop {r4-r7, pc}
              .ltorg
              
              go_padding:
              push {lr}
              ldrb r0, [r7]
              cmp r0, #0
              bne back
              mov r0, #0xa1
              strb r0, [r7]
              back:
              pop {pc}
              
              call_r3:
              bx r3
              
              call_r4:
              bx r4
              
              flag_check:
              ldr r1, =0x0806E6D1
              bx r1
              
              .align 2
              rbox_config:
              .byte 0x0 @bg_id
              .byte 0x1 @x
              .byte 0x1 @y
              .byte 0x5 @width
              .byte 0x2 @height
              .byte 0xf
              .hword 0x8 @tileset_ofs
              .word 0x8419f76 @pixels
              
              .align 2
              string: 
              .byte 0xfd, 0x2, 0xf0, 0xfd, 0x3, 0xff


              12-hour format (use instead of 'Routine I'):
              Spoiler:
              Code:
              @ 0x6F09C - 00 48 00 47 XX+1 XX XX 08
              @ change all the 0x8950000 in the routine to the insert offset of the routine. 
              @ change all the 0x8950001 in the routine to the insert offset + 1 of the routine.
              Code:
              .thumb
              mov r0, #0x80
              lsl r0, r0, #4
              bl flag_check
              lsl r0, r0, #0x18
              lsr r0, r0, #0x18
              cmp r0, #0x1
              beq safari
              bl box_func
              
              safari:
              ldr r1, =0x20370FF
              ldrb r0, [r1]
              add r0, #1
              strb r0, [r1]
              mov r0, #0
              add sp, sp, #0xC
              pop {r4, pc}
              .ltorg
              
              box_func:
              push {r4, lr}
              ldr r4, =0x2037101
              ldr r0, =(0x8950000 + rbox_config)
              ldr r3, =0x8003ce5
              bl call_r3
              strb r0, [r4]
              ldr r3, =0x8003fa1
              bl call_r3
              ldrb r0, [r4]
              mov r1, #0
              ldr r3, =0x80F6F1D
              bl call_r3
              bl print_string
              ldr r0, =(0x8950001 + print_string)
              mov r1, #2
              ldr r3, =0x807741D
              bl call_r3
              ldr r1, =0x20370C0
              strh r0, [r1]
              pop {r4, pc}
              .ltorg
              
              print_string:
              push {r4-r7, lr}
              sub sp, sp, #0xC
              ldr r0, =0x2021cd0
              add r7, r0, #0
              ldr r1, =0x300553c
              ldrb r5, [r1, #7] @minute
              ldrb r6, [r1, #6] @hour
              add r1, r6, #0
              cmp r1, #0xC
              bhi usat
              cmp r1, #0x0
              beq zero
              
              continue:
              mov r2, #1
              mov r3, #2
              ldr r4, =0x8008E79
              bl call_r4
              bl go_padding
              ldr r0, =0x2021CF0
              add r7, r0, #0
              add r1, r5, #0
              mov r2, #1
              mov r3, #2
              ldr r4, =0x8008e79
              bl call_r4
              bl go_padding
              ldr r5, =0x2021D18
              cmp r6, #0xB
              bhi night
              ldr r1, =(0x8950000 + day)
              
              goon:
              add r0, r5, #0
              ldr r3, =0x8008FCD
              bl call_r3
              ldr r0, =0x2037101
              ldrb r0, [r0]
              mov r1, #3
              str r1, [sp]
              mov r1, #0xff
              str r1, [sp, #4]
              mov r1, #0
              str r1, [sp, #8]
              mov r1, #2
              add r2, r5, #0
              mov r3, #4
              ldr r4, =0x8002C49
              bl call_r4
              ldr r0, =0x2037101
              ldrb r0, [r0]
              mov r1, #2
              ldr r3, =0x8003F21
              bl call_r3
              add sp, sp, #0xC
              pop {r4-r7, pc}
              .ltorg
              
              go_padding:
              push {lr}
              ldrb r0, [r7]
              cmp r0, #0
              bne back
              mov r0, #0xa1
              strb r0, [r7]
              back:
              pop {pc}
              
              call_r3:
              bx r3
              
              call_r4:
              bx r4
              
              flag_check:
              ldr r1, =0x0806E6D1
              bx r1
              
              usat:
              sub r1, r1, #0xC
              b continue
              
              zero:
              add r1, r1, #0xc
              b continue
              
              night:
              ldr r1, =(0x8950000 + nite)
              b goon
              
              .align 2
              rbox_config:
              .byte 0x0 @bg_id
              .byte 0x1 @x
              .byte 0x1 @y
              .byte 0x7 @width
              .byte 0x2 @height
              .byte 0xf
              .hword 0x8 @tileset_ofs
              .word 0x8419f76 @pixels
              
              .align 2
              day: 
              .byte 0xfd, 0x2, 0xf0, 0xfd, 0x3, 0x0, 0xBB, 0xc7, 0xff
              nite:
              .byte 0xfd, 0x2, 0xf0, 0xfd, 0x3, 0x0, 0xCA, 0xc7, 0xff
              Reply With Quote
                #1408    
              Old September 2nd, 2018 (7:49 PM). Edited September 8th, 2018 by AkameTheBulbasaur.
              AkameTheBulbasaur's Avatar
              AkameTheBulbasaur AkameTheBulbasaur is offline
              Akame Marukawa of Iyotono
                 
                Join Date: May 2013
                Location: A place :D
                Age: 21
                Gender: Male
                Nature: Gentle
                Posts: 351
                Metronome Battles

                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:
                .text
                .align 2
                .thumb
                .thumb_func

                Main:
                push {r4-r5, lr}

                ClearItems:
                ldr r4, .RAMStart
                mov r0, #0x0
                Loop:
                strh r0, [r4]
                add r4, r4, #0x2
                ldr r5, .RAMEnd
                cmp r4, r5
                bgt Return
                b Loop

                Return:
                pop {r4-r5, pc}

                .align 2
                .RAMStart: .word 0x0202664A
                .RAMEnd: .word 0x02026678


                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:
                .text
                .align 2
                .thumb
                .thumb_func

                Main:
                push {r4-r7, lr}
                mov r4, #0x0 /*Party Slot*/
                mov r5, #0x0 /*Slot Counter*/
                mov r6, #0x0 /*Move Counter*/
                mov r7, #0x0 /*Var Counter*/

                GetMoveLoop:
                ldr r0, .FirstPoke
                mov r1, #0x64
                mul r1, r4
                add r0, r0, r1
                push {r0}
                mov r1, #0xB
                mov r2, #0x0
                bl Decrypt
                mov r1, r0
                pop {r0}
                cmp r1, #0x0
                beq End
                mov r1, #0xD
                add r1, r1, r6
                mov r2, #0x0
                bl Decrypt
                ldr r1, .VarStart
                add r1, r1, r7
                strh r0, [r1]

                LoopCheck:
                add r5, r5, #0x1
                cmp r5, #0x4
                beq CheckSlot
                add r7, r7, #0x2
                add r6, r6, #0x1
                b GetMoveLoop

                CheckSlot:
                cmp r4, #0x5
                beq End
                add r4, r4, #0x1
                mov r6, #0x0
                mov r5, #0x0
                add r7, r7, #0x2
                b GetMoveLoop

                End:
                pop {r4-r7, pc}

                Decrypt:
                ldr r3, .Decrypt
                bx r3

                .align 2
                .VarStart: .word 0x0202664A
                .FirstPoke: .word 0x02024284
                .Decrypt: .word 0x0803FBE9


                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:
                .text
                .align 2
                .thumb
                .thumb_func

                Main:
                push {r4-r7, lr}
                mov r4, #0x0 /*Party Slot*/
                mov r5, #0x0 /*Slot Counter*/
                mov r6, #0x0 /*Move Counter*/
                mov r7, #0x0 /*Var Counter*/

                GetMoveLoop:
                ldr r0, .FirstPoke
                mov r1, #0x64
                mul r1, r4
                add r0, r0, r1
                push {r0}
                mov r1, #0xB
                mov r2, #0x0
                bl Decrypt
                mov r1, r0
                pop {r0}
                cmp r1, #0x0
                beq End
                mov r1, #0xD
                add r1, r1, r6
                mov r2, #0x76
                push {r2}
                mov r2, sp
                bl Encrypt
                pop {r2}

                LoopCheck:
                add r5, r5, #0x1
                cmp r5, #0x4
                beq CheckSlot
                add r7, r7, #0x2
                add r6, r6, #0x1
                b GetMoveLoop

                CheckSlot:
                cmp r4, #0x5
                beq End
                add r4, r4, #0x1
                mov r6, #0x0
                mov r5, #0x0
                add r7, r7, #0x2
                b GetMoveLoop

                End:
                pop {r4-r7, pc}

                Encrypt:
                ldr r3, .Encrypt
                bx r3

                Decrypt:
                ldr r3, .Decrypt
                bx r3

                .align 2
                .Encrypt: .word 0x0804037D
                .VarStart: .word 0x0202664A
                .FirstPoke: .word 0x02024284
                .Decrypt: .word 0x0803FBE9


                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:
                .text
                .align 2
                .thumb
                .thumb_func

                Main:
                push {r4-r7, lr}
                mov r4, #0x0 /*Party Slot*/
                mov r5, #0x0 /*Slot Counter*/
                mov r6, #0x0 /*Move Counter*/
                mov r7, #0x0 /*Var Counter*/

                GetMoveLoop:
                ldr r0, .FirstPoke
                mov r1, #0x64
                mul r1, r4
                add r0, r0, r1
                push {r0}
                mov r1, #0xB
                mov r2, #0x0
                bl Decrypt
                mov r1, r0
                pop {r0}
                cmp r1, #0x0
                beq End
                mov r1, #0xD
                add r1, r1, r6
                ldr r2, .VarStart
                add r2, r2, r7
                ldrh r2, [r2]
                push {r2}
                mov r2, sp
                bl Encrypt
                pop {r2}

                LoopCheck:
                add r5, r5, #0x1
                cmp r5, #0x4
                beq CheckSlot
                add r7, r7, #0x2
                add r6, r6, #0x1
                b GetMoveLoop

                CheckSlot:
                cmp r4, #0x5
                beq End
                add r4, r4, #0x1
                mov r6, #0x0
                mov r5, #0x0
                add r7, r7, #0x2
                b GetMoveLoop

                End:
                pop {r4-r7, pc}

                Encrypt:
                ldr r3, .Encrypt
                bx r3

                Decrypt:
                ldr r3, .Decrypt
                bx r3

                .align 2
                .Encrypt: .word 0x0804037D
                .VarStart: .word 0x0202664A
                .FirstPoke: .word 0x02024284
                .Decrypt: .word 0x0803FBE9


                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:
                #dyn 0x740000
                #org @Start
                compare SOME VAR 0xFF
                if true jump @RestoreMoves
                release
                end

                #org @RestoreMoves
                callasm OFFSET OF R4
                callasm OFFSET OF R1
                release
                end


                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:
                #dyn 0x740000
                #org @Start
                lock
                faceplayer
                message @Hello
                callstd MSG_YESNO
                compare LASTRESULT YES
                if true jump @StoreMoves
                message @Bye
                release
                end

                #org @StoreMoves
                callasm 0x8DB1E3D
                callasm 0x8DB2C01
                jump @SetHealingPlace

                #org @SetHealingPlace
                sethealingplace 0x1
                setvar 0x405A 0x0C01
                setvar 0x405B 0x6
                setvar 0x405C 0x8
                setvar 0x8004 0x1
                setvar 0x4053 0x100
                setvar 0x40F7 0x8
                jump @ReplaceMoves

                #org @ReplaceMoves
                callasm 0x8DB47D9
                special HEAL_POKEMON
                setvar 0x40A8 0xFF
                jump @StartBattle

                #org @StartBattle
                message @LetsGo
                callstd MSG_SIGN
                countpokemon
                compare LASTRESULT 0x1
                if true jump @OneMon
                compare LASTRESULT 0x2
                if true jump @TwoMon
                compare LASTRESULT 0x3
                if true jump @ThreeMon
                compare LASTRESULT 0x4
                if true jump @FourMon
                compare LASTRESULT 0x5
                if true jump @FiveMon
                trainerbattle 0x3 0x1C1 0x0 @Defeat
                jump @AfterBattle

                #org @FiveMon
                trainerbattle 0x3 0x1C2 0x0 @Defeat
                jump @AfterBattle

                #org @FourMon
                trainerbattle 0x3 0x1C3 0x0 @Defeat
                jump @AfterBattle

                #org @ThreeMon
                trainerbattle 0x3 0x1C4 0x0 @Defeat
                jump @AfterBattle

                #org @TwoMon
                trainerbattle 0x3 0x1C5 0x0 @Defeat
                jump @AfterBattle

                #org @OneMon
                trainerbattle 0x3 0x1C6 0x0 @Defeat
                jump @AfterBattle

                #org @AfterBattle
                setflag 0x25C
                settrainerflag 0x1C1
                settrainerflag 0x1C2
                settrainerflag 0x1C3
                settrainerflag 0x1C4
                settrainerflag 0x1C5
                settrainerflag 0x1C6
                message @Fun
                callstd MSG_SIGN
                jump @PutMovesBack

                #org @PutMovesBack
                callasm 0x8DB629D
                callasm 0x8DB1E3D
                special HEAL_POKEMON
                setvar 0x40A8 0x0
                release
                end

                #org @Hello
                = Anna Marukawa: Wanna see a trick?\pI can temporarily change any\nPokemon's attacks to be anything\lat all!\pWell, not exactly. I can only\nchange them to Metronome.\pBut Metronome can be any attack,\nso there!\pAnyway, my idea is we can have a\nbattle where the only move either\lof us can use is Metronome!\pWouldn't that be fun? Want to try\nit out?

                #org @Bye
                = Oh, okay.\nMaybe another time then!

                #org @Defeat
                = Wow! That was great!

                #org @LetsGo
                = Okay!\pI changed all the moves and healed\nyour team.\pTo the Battle Dimension we go!

                #org @Fun
                = Wow! Wow!\pThat was so much fun!\pHere, let's give your Pokemon\ntheir real moves back.\pCome over soon so we can do that\nagain!
                __________________
                "The human sacrificed himself, to save the Pokemon. I pitted them against each other, but not until they set aside their differences did I see the true power they all share deep inside. I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are." -Mewtwo
                Reply With Quote
                  #1409    
                Old September 11th, 2018 (12:47 PM). Edited 4 Weeks Ago by Koople.
                Koople's Avatar
                Koople Koople is offline
                   
                  Join Date: Nov 2016
                  Nature: Relaxed
                  Posts: 75
                  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.
                  Reply With Quote
                    #1410    
                  Old September 13th, 2018 (6:47 AM).
                  Delta231's Avatar
                  Delta231 Delta231 is online now
                  A noob
                     
                    Join Date: May 2016
                    Location: India
                    Gender: Male
                    Nature: Bold
                    Posts: 577
                    Quote:
                    Originally Posted by Koople View Post
                    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
                    Here is a slightly outdated example GIF (it is just missing the item images in the box), but it gets the point across.

                    Enjoy! And please let me know of any bugs.
                    Nice work but you may wanna remove .exe and dll files as not everyone uses Windows.
                    __________________
                    HGSS OWs in FR Style
                    Fire Red NSE Bookmarks


                    A supporter of


                    Reply With Quote
                      #1411    
                    Old September 13th, 2018 (6:49 AM).
                    Delta231's Avatar
                    Delta231 Delta231 is online now
                    A noob
                       
                      Join Date: May 2016
                      Location: India
                      Gender: Male
                      Nature: Bold
                      Posts: 577
                      Quote:
                      Originally Posted by Super Versekr Dark View Post
                      Excuse me, can you put Ruby's routines here?
                      Yes, you are allowed to put routines for Ruby as well.
                      __________________
                      HGSS OWs in FR Style
                      Fire Red NSE Bookmarks


                      A supporter of


                      Reply With Quote
                        #1412    
                      Old September 16th, 2018 (6:19 AM).
                      Squeetz's Avatar
                      Squeetz Squeetz is offline
                      Music hacker
                       
                      Join Date: Jun 2013
                      Location: Norway
                      Age: 21
                      Gender: Male
                      Nature: Quiet
                      Posts: 237
                      [FR] Multi-directional jump tiles
                      This is an expanded-upon version of Invert's routine on the Wahack forums (https://wahackforo.com/t-40642/fr-asm-salto-en-cualquier-direccion) So credit goes to them for the original.
                      Made this for the purpose of creating a multiple-height jumping puzzle which was something Invert's routine was lacking, so thought I might as well share it.

                      Code:
                      .thumb
                      
                      .global AnyDirectionJumptile
                      .equ rom, 0x08000001
                      .equ offset, 0xXXXXXX
                      
                      /*
                      Behavior bytes:
                      0x7F = able to jump in any direction over tile (only on height 0x0 & 0x10)
                      0x7E = able to jump up and down over tile
                      0x7D = able to jump left and right over tile
                      */
                      
                      @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                      hooks:
                      .org 0x59AF6
                      	cmp r0, #0x7D
                      	beq 0x59B02
                      
                      .org 0x59B0A
                      	cmp r0, #0x7D
                      	beq 0x59B16
                      
                      .org 0x59B1E
                      	cmp r0, #0x7E
                      	beq 0x59B2A
                      
                      .org 0x59B32
                      	cmp r0, #0x7E
                      	beq 0x59B3E
                      
                      .org 0x6812C
                      	bx r2
                      	
                      .org 0x68144
                      	.word main + rom
                      
                      @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                      	
                      .org offset
                      main:
                      	cmp r0, #0x7F	@behavior byte
                      	beq CheckJump
                      	ldr r2, =(0x083A705C)
                      	lsl r1, r4, #0x2
                      	ldr r3, =(0x0806812E|1)
                      	bx r3
                      	
                      CheckJump:
                      	bl CanPlayerJump
                      	cmp r0, #0x0
                      	beq CantJump
                      CanJump:
                      	ldr r0, =(0x08068148|1)
                      	bx r0
                      	
                      CantJump:
                      	ldr r0, =(0x0806813E|1)
                      	bx r0
                      	
                      CanPlayerJump:
                      	ldr r1, npc_states
                      	ldrb r0, [r1, #0xB]		@player height
                      	mov r1, #0xF
                      	and r0, r1			@lower 4 bits are height
                      	cmp r0, #0x4			@movement permission 0x10
                      	beq TheyCan
                      	cmp r0, #0x0			@movement permission 0x0
                      	beq TheyCan
                      TheyCant:
                      	mov r0, #0x0
                      	bx lr
                      	
                      TheyCan:
                      	mov r0, #0x1
                      	bx lr
                      	
                      .align 2
                      	npc_states:		.word 0x02036E38
                      __________________
                      Reply With Quote
                        #1413    
                      Old September 17th, 2018 (10:58 AM).
                      Koople's Avatar
                      Koople Koople is offline
                         
                        Join Date: Nov 2016
                        Nature: Relaxed
                        Posts: 75
                        Evolution Moves [FR]

                        Adds the feature of learning moves when you evolve, regardless of the level. Currently, only compatable if you have expanded your moves above 511 (jambo learnsets). May make it compatable with old learnsets if there is a desire.

                        Here is the repository. Update config.ini with your learnset table location and a free ram address byte (does not need to be in the save block hack. Example free space starts at 0203e000 if you've removed the help system, I believe)

                        I've only done prelimenary testing, so there may be bugs.
                        Reply With Quote
                          #1414    
                        Old October 6th, 2018 (5:28 AM). Edited October 7th, 2018 by hjk321.
                        hjk321's Avatar
                        hjk321 hjk321 is offline
                           
                          Join Date: Sep 2017
                          Posts: 186
                          Quote:
                          Originally Posted by Koople View Post
                          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
                          Here is a slightly outdated example GIF (it is just missing the item images in the box), but it gets the point across.

                          Enjoy! And please let me know of any bugs.
                          Hello,

                          I'm having a hard time understanding an aspect of your system, mainly the flags. So if you have 256 quests (the max, still kinda a small number), does that mean you need 512 flags? Consecutive flags, at that? So quest #1 would be flag 0x200, and that would go all the 0x2FF, leaving me with literally no other safe flags for the entire game, or to complete the other 256 flags eaten by the routine? Looks like I might have to dabble in expanding safe flags, unless I'm missing something obvious here.

                          Edit: Couldn't I just set the "flag" offsets to some unused RAM? Probably not, since it wouldn't be covered by the save block. And how do I convert the flag number to a RAM location?

                          Thanks, hjk321

                          Nice routine though!
                          __________________
                          Sorry guys, I mod the Goldsrc engine now, it doesn't have so many technical limitations...
                          Reply With Quote
                            #1415    
                          Old October 7th, 2018 (10:32 AM).
                          Koople's Avatar
                          Koople Koople is offline
                             
                            Join Date: Nov 2016
                            Nature: Relaxed
                            Posts: 75
                            Quote:
                            Originally Posted by hjk321 View Post
                            Hello,

                            I'm having a hard time understanding an aspect of your system, mainly the flags. So if you have 256 quests (the max, still kinda a small number), does that mean you need 512 flags? Consecutive flags, at that? So quest #1 would be flag 0x200, and that would go all the 0x2FF, leaving me with literally no other safe flags for the entire game, or to complete the other 256 flags eaten by the routine? Looks like I might have to dabble in expanding safe flags, unless I'm missing something obvious here.

                            Edit: Couldn't I just set the "flag" offsets to some unused RAM? Probably not, since it wouldn't be covered by the save block. And how do I convert the flag number to a RAM location?

                            Thanks, hjk321

                            Nice routine though!
                            I kept the instructions somewhat vague to allow different users to utilize the system the way they like, though you're right that I could have been a bit more verbose.

                            The system is set up so that you will need two flags for each quest: one to 'activate' the quest, which just means you have unlocked it and the quest name will show up in the menu and you can activate it and whatnot. The second will indicate that the quest is completed, in which case the 'Done' text will appear next to the quest name.

                            It is currently written so that the activation flags (to show the quest names) are in order, and the completion flags are also in order, but can start from a different initial flag. This was done to prevent the use of two separate tables, but can easily be changed.

                            256 quests seems like a pretty high number of quests for a rom hack though. And that is not necessarily the limit, the active quest ram can easily be expanded to a halfword value.

                            I would recommend expanding the safe number of flags with JPANs save block hack; this way you can unlock thousands more safe flags and this system won't be as limiting.

                            I'm not entirely sure why you would want to use RAM instead of flags; that would end up just taking up much more space unless you edit the routine to check for specific bits in the ram, which is then the same functionality as a flag.

                            I hope this helps.
                            Reply With Quote
                              #1416    
                            Old October 8th, 2018 (11:38 AM). Edited October 8th, 2018 by hjk321.
                            hjk321's Avatar
                            hjk321 hjk321 is offline
                               
                              Join Date: Sep 2017
                              Posts: 186
                              Quote:
                              Originally Posted by Koople View Post
                              It is currently written so that the activation flags (to show the quest names) are in order, and the completion flags are also in order, but can start from a different initial flag. This was done to prevent the use of two separate tables, but can easily be changed.
                              I hope this helps.
                              Literally everything about your routine is great... except every quest is ???????? whether the flags are set or not! in the defs file I've tried RAM pointers (0x0203C001) I've tried repointed flag numbers (0x909) and I've tried raw flag numbers (0x2109) and no matter what the quests do not show up!

                              As an experiment I have 15 quests and I set some flags At the index. Index starts at 0203C001, have also tried 0x909 and 0x2109 in defs.asm. Here is proof I have flags set in that area...

                              and yet all 15 quests are unshowable. What am I doing wrong?

                              I only made minor edits to some text variables, as well as linking to external tables rather than making a table in the actual asm. I didn't edit anything significant.
                              __________________
                              Sorry guys, I mod the Goldsrc engine now, it doesn't have so many technical limitations...
                              Reply With Quote
                                #1417    
                              Old October 9th, 2018 (8:40 AM).
                              Koople's Avatar
                              Koople Koople is offline
                                 
                                Join Date: Nov 2016
                                Nature: Relaxed
                                Posts: 75
                                Quote:
                                Originally Posted by hjk321 View Post
                                Literally everything about your routine is great... except every quest is ???????? whether the flags are set or not! in the defs file I've tried RAM pointers (0x0203C001) I've tried repointed flag numbers (0x909) and I've tried raw flag numbers (0x2109) and no matter what the quests do not show up!

                                As an experiment I have 15 quests and I set some flags At the index. Index starts at 0203C001, have also tried 0x909 and 0x2109 in defs.asm. Here is proof I have flags set in that area...

                                and yet all 15 quests are unshowable. What am I doing wrong?

                                I only made minor edits to some text variables, as well as linking to external tables rather than making a table in the actual asm. I didn't edit anything significant.
                                Can you share your code so I can better understand what you are trying to do? Let's do this via discord or personal message to keep this thread clean. :)
                                Reply With Quote
                                  #1418    
                                Old 4 Weeks Ago (4:59 AM). Edited 4 Weeks Ago by Banjo-Fella.
                                Banjo-Fella's Avatar
                                Banjo-Fella Banjo-Fella is offline
                                   
                                  Join Date: Aug 2008
                                  Posts: 1
                                  Hi ASMaties! I'm new to hacking and I'm not sure how to go about this… would it be okay if I requested some help modifying the way EV-increasing items (HP Up, Protein, Iron, etc.) work in Emerald?

                                  The default behaviour adds +10 EVs, but it has no effect when the EV is >=100. I want to remove that restriction so you can keep using EV items and max out an EV at 252, allowing players to EV train quickly and painlessly.

                                  Any help would be much appreciated!
                                  Reply With Quote
                                    #1419    
                                  Old 4 Weeks Ago (8:38 AM).
                                  ghoulslash's Avatar
                                  ghoulslash ghoulslash is offline
                                     
                                    Join Date: Mar 2016
                                    Gender: Male
                                    Posts: 99
                                    Quote:
                                    Originally Posted by Koople View Post
                                    Evolution Moves [FR]
                                    I found a bug in this code where a pokemon learning a move from any other way would be asked to learn moves it already knows and will be asked to learn a move even when their movesets are not full.

                                    I rewrote the moveset loop by just calling a custom function rather than editing the main learn_move function at 0803ea88, and it appears to work fine.

                                    Spoiler:

                                    Code:
                                    .text
                                    .align 2
                                    .thumb
                                    .thumb_func
                                    .global LearnMove_Evolution
                                    /*
                                    insert 00 48 00 47 (xx+1) xx xx 08 at cedd4
                                    */
                                    
                                    Main:
                                    	ldrb r1, [r5, #0x10]
                                    	mov r0, r9
                                    	bl MoveChecks
                                    	ldr r6, =(0x080ceddc +1)
                                    	bx r6
                                    	
                                    MoveChecks:
                                    	push {r4-r7, lr}
                                    	mov r7, r10
                                    	mov r6, r9
                                    	mov r5, r8
                                    	push {r5-r7}
                                    	sub sp, #0x4
                                    	mov r8, r0		@ r8 = start of poke data (02024284 + 64*ind)
                                    	lsl r4, r1, #0x18
                                    	lsr r4, r4, #0x18
                                    	mov r0, #0x0
                                    	str r0, [sp]
                                    	mov r0, r8
                                    	mov r1, #0xb
                                    	mov r2, #0x0
                                    	bl GetAttr
                                    	lsl r0, r0, #0x10
                                    	lsr r0, r0, #0x10
                                    	mov r9, r0		@ r9 = species
                                    	mov r0, r8
                                    	mov r1, #0x38
                                    	mov r2, #0x0
                                    	bl GetAttr
                                    	lsl r0, r0, #0x10
                                    	lsr r0, r0, #0x10
                                    	mov r10, r0		@ r10 = poke level
                                    	ldr r0, =(0x0000ffff)
                                    	mov r12, r0
                                    	cmp r4, #0x0
                                    	beq GetLearnset
                                    	mov r1, sp
                                    	ldrb r1, [r1]
                                    	ldr r4, =(0x02024028)
                                    	strb r1, [r4]
                                    	
                                    GetLearnset:
                                    	ldr r3, .MovesetTable
                                    	mov r1, r9
                                    	lsl r4, r1, #0x2
                                    	add r5, r4, r3
                                    	ldr r5, [r5]	@ species learnset offset start
                                    	ldr r6, =(0x02024028)
                                    	mov r4, r10
                                    
                                    LearnsetLoop:
                                    	ldrb r0, [r6]
                                    	lsl r1, r0, #0x1
                                    	add r0, r0, r1
                                    	add r3, r0, r5
                                    	ldrb r1, [r3, #0x2]
                                    	cmp r1, #0xFF
                                    	beq EndofLearnset
                                    	cmp r1, #0x0
                                    	bne CompareLevels
                                    	
                                    CheckEvolved:
                                    	ldr r0, .EvolveFlag
                                    	ldrb r0, [r0]
                                    	cmp r0, #0x0
                                    	bne LearnMove	@ pokemon has evolved & found evo move
                                    	
                                    CompareLevels:
                                    	ldrb r0, [r6]
                                    	add r0, #0x1
                                    	strb r0, [r6]	@ pos += 1
                                    	cmp r1, r4
                                    	bne LearnsetLoop
                                    	
                                    LearnMove:
                                    	ldrb r0, [r6]
                                    	add r0, #0x1
                                    	strb r0, [r6]	@ pos += 1
                                    	ldrb r0, [r3, #0x1]
                                    	lsl r0, r0, #0x8
                                    	ldrb r1, [r3]
                                    	orr r0, r1
                                    	ldr r2, =(0x02024022)
                                    	strh r0, [r2]
                                    	mov r0, r8	@ poke data struct in ram
                                    	ldrh r1, [r2]	@ move to learn
                                    	bl MovesetPad
                                    	lsl r0, r0, #0x10
                                    	lsr r0, r0, #0x10
                                    	str r0, [sp]
                                    	
                                    EndofLearnset:	
                                    	ldr r0, [sp]
                                    	add sp, #0x4
                                    	pop {r3-r5}
                                    	mov r8, r3
                                    	mov r9, r4
                                    	mov r10, r5
                                    	pop {r4-r7}
                                    	pop {r1}
                                    	bx r1
                                    
                                    GetAttr:
                                    	ldr r3, =(0x0803fbe8 +1)
                                    	bx r3
                                    	
                                    MovesetPad:
                                    	ldr r2, =(0x0803e89c +1)
                                    	bx r2
                                    
                                    .align 2
                                    .EvolveFlag:	.word 0x02xxxxxx   @ from the config.ini
                                    .MovesetTable:	.word 0x0825d7b4


                                    If you implemented the original routines, be sure to replace the bytes at 3eaa4.
                                    __________________
                                    TM/HM Expansion
                                    Critical Capture
                                    Reply With Quote
                                      #1420    
                                    Old 4 Weeks Ago (10:12 PM).
                                    Skeli-'s Avatar
                                    Skeli- Skeli- is offline
                                    Lord of the Rings
                                       
                                      Join Date: Apr 2014
                                      Location: Canada
                                      Age: 19
                                      Gender: Male
                                      Nature: Adamant
                                      Posts: 191
                                      Only Buy 1 TM From Shops [FR]

                                      If you've decided to make your TMs reusable in Fire Red, this routine will remove the option to buy more than one of each from shops. Credits to azurile13 for the first part (Main) of the code.The only thing that needs changing is the line ".equ offset".
                                      Code:
                                      .thumb
                                      .global AlreadyOwnTM
                                      
                                      .equ rom, 0x8000000
                                      .equ offset, 0x893960 @CHANGE THIS LINE
                                      
                                      .org 0x9BC3C, 0xFF
                                      	ldr r1, .Pointer1
                                      	bx r1
                                      .Pointer1: .word Main + rom + 1
                                      
                                      .org 0x9BC7C, 0xFF
                                      	ldr r0, .Pointer2
                                      	bx r0
                                      .Pointer2: .word OnlyBuyOne + rom + 1
                                      
                                      .org 0x9BEBC, 0xFF
                                      	ldr r1, .Pointer3
                                      	bx r1
                                      .Pointer3: .word AddItem + rom + 1
                                      
                                      @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                                      
                                      .org offset, 0xFF
                                      Main:
                                      	lsr r4, r0, #0x10
                                      	mov r0, r4
                                      	ldr r2, .GetItemPocket
                                      	bl Jump
                                      	cmp r0, #0x4
                                      	bne Return
                                      	mov r0, r4
                                      	mov r1, #0x1
                                      	ldr r2, .CheckItem
                                      	bl Jump
                                      	cmp r0, #0x0
                                      	bne AlreadyOwn
                                      
                                      Return:
                                      	mov r0, r4
                                      	ldr r1, =0x809BC45
                                      	bx r1
                                      
                                      AlreadyOwn:
                                      	ldr r1, .AlreadyHaveTMString
                                      	ldr r2, =0x809BC67
                                      	bx r2
                                      
                                      @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                                      
                                      OnlyBuyOne:
                                      	ldr r1, .FCodeBuffer2
                                      	mov r0, r4
                                      	ldr r2, .ItemID_Copy_Name
                                      	bl Jump
                                      	mov r0, r4
                                      	ldr r2, .GetItemPocket
                                      	bl Jump
                                      	cmp r0, #0x4
                                      	bne Return2
                                      
                                      GetPrice:
                                      	mov r0, r4
                                      	ldr r2, .GetMarketPrice
                                      	bl Jump
                                      	mov r1, r0
                                      	ldr r0, .FCodeBuffer2
                                      	add r0, #0x20
                                      	mov r2, #0x3
                                      	mov r3, #0x8
                                      	bl Hex2Dec
                                      	ldr r1, .NewYouWantString
                                      	ldr r2, =0x809BE91
                                      	ldr r3, =0x809BC89
                                      	bx r3
                                      
                                      Return2:
                                      	ldr r1, =0x809BC85
                                      	bx r1
                                      
                                      Hex2Dec:
                                      	ldr r4, =0x8008E79
                                      	bx r4
                                      
                                      @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                                      
                                      AddItem:
                                      	ldr r2, .GetItemPocket
                                      	bl Jump
                                      	cmp r0, #0x4
                                      	bne Return3
                                      	mov r0, #0x1
                                      	strh r1, [r4, #0x2]
                                      
                                      Return3:
                                      	ldrh r0, [r4, #0xA]
                                      	ldrh r1, [r4, #0x2]
                                      	ldr r2, .Bag_Add_Item
                                      	bl Jump
                                      	lsl r0, #0x18
                                      	ldr r2, =0x809BEC5
                                      Jump:
                                      	bx r2
                                      
                                      .align 2
                                      .FCodeBuffer2: .word 0x2021CD0
                                      .GetItemPocket: .word 0x809A9D9
                                      .CheckItem: .word 0x8099F41
                                      .ItemID_Copy_Name: .word 0x8099E91
                                      .GetMarketPrice: .word 0x809A901
                                      .Bag_Add_Item: .word 0x809A085
                                      .AlreadyHaveTMString: .word STRING1 + rom
                                      .NewYouWantString: .word STRING2 + rom
                                      
                                      STRING1: .byte 0xD3, 0xE3, 0xE9, 0x00, 0xD5, 0xE0, 0xE6, 0xD9, 0xD5, 0xD8, 0xED, 0x00, 0xE3, 0xEB, 0xE2, 0x00, 0xE8, 0xDC, 0xD5, 0xE8, 0x00, 0xCE, 0xC7, 0xAD, 0xFC, 0x09, 0xFF
                                      STRING2: .byte 0xFD, 0x02, 0xB8, 0xFE, 0xCE, 0xDC, 0xD5, 0xE8, 0x00, 0xEB, 0xDD, 0xE0, 0xE0, 0x00, 0xD6, 0xD9, 0x00, 0xB7, 0xFD, 0x03, 0xAD, 0x00, 0xC9, 0xDF, 0xD5, 0xED, 0xAC, 0xFF
                                      __________________
                                      Pokemon Unbound

                                      Reply With Quote
                                        #1421    
                                      Old 3 Weeks Ago (7:49 AM). Edited 3 Weeks Ago by pokemontutorialTV.
                                      pokemontutorialTV's Avatar
                                      pokemontutorialTV pokemontutorialTV is offline
                                         
                                        Join Date: Feb 2014
                                        Location: Germany, Kaiserslautern
                                        Gender: Male
                                        Nature: Calm
                                        Posts: 77
                                        If I use the above routine, the price isnt calculated for non-TM shops correctly anymore. Do I something wrong?
                                        Ok, I know know your routine does some mistakes with the registers. If you want a working soulution, also shorter than this, DM me.
                                        __________________
                                        Making Youtube Videos about Pokémon.
                                        _______________________________________________
                                        Pokémon Zoisit:

                                        _______________________________________________
                                        My Youtube Channel with over 1000 videos to Pokémon: http://www.youtube.com/user/pokemontutorialTV
                                        Reply With Quote
                                          #1422    
                                        Old 2 Weeks Ago (6:52 PM).
                                        Lunos's Avatar
                                        Lunos Lunos is offline
                                        Random Uruguayan User
                                           
                                          Join Date: Oct 2008
                                          Location: Montevideo (Uruguay)
                                          Gender: Male
                                          Nature: Lonely
                                          Posts: 1,655
                                          Quote:
                                          Originally Posted by pokemontutorialTV View Post
                                          If I use the above routine, the price isnt calculated for non-TM shops correctly anymore. Do I something wrong?
                                          Ok, I know know your routine does some mistakes with the registers. If you want a working soulution, also shorter than this, DM me.
                                          Consider just sharing it here directly for everyone's benefit. Thank you.
                                          __________________
                                          Reply With Quote
                                            #1423    
                                          Old 1 Week Ago (2:42 PM).
                                          ghoulslash's Avatar
                                          ghoulslash ghoulslash is offline
                                             
                                            Join Date: Mar 2016
                                            Gender: Male
                                            Posts: 99
                                            [FR] Fully Flag-Dependent Start Menu

                                            It's nothing fancy, but this code expands on FBI's routine to swap between start menus, shown here. It also keeps the safari zone start menu intact.

                                            Every single start menu option (except Exit) is flag-dependent, so you can add or remove start menu options with simple flag setting/clearing.

                                            Spoiler:

                                            Code:
                                            .text
                                            .align 2
                                            .thumb
                                            .thumb_func
                                            .global start_menu
                                            /*
                                            insert 00 48 00 47 (xx+1) xx xx 08 at 6ed5c
                                            
                                            */
                                            
                                            .equ offset, 0x08xxxxxx		@ insert location
                                            
                                            /* change these */
                                            .equ DEX_FLAG, 0x250
                                            .equ POKE_FLAG, 0x251
                                            .equ BAG_FLAG, 0x252
                                            .equ PLAYER_FLAG, 0x253
                                            .equ SAVE_FLAG, 0x254
                                            .equ OPT_FLAG, 0x255
                                            .equ EXIT_FLAG, 0x0   @ currently unused, so at least 1 option is shown
                                            
                                            Main:
                                            	bl check_safari_zone
                                            	cmp r0, #0x1
                                            	bne regular_menu
                                            	ldr r0, =(0x0806ed86 +1)
                                            	bx r0
                                            	
                                            regular_menu:
                                            	push {r4-r5}
                                            	mov r1, #0x0
                                            	ldr r4, =(offset+table)
                                            	
                                            loop:
                                            	lsl r0, r1, #0x2
                                            	add r0, r0, r4
                                            	mov r5, r0
                                            	cmp r1, #0x6
                                            	beq add_option	@ auto-add last option (exit)	
                                            	ldrh r0, [r5]	@ flag to check
                                            	push {r1}
                                            	bl check_flag
                                            	pop {r1}
                                            	cmp r0, #0x1
                                            	bne loop_incr
                                            	
                                            add_option:
                                            	ldrb r0, [r5, #0x2]		@ menu index
                                            	lsl r0, r0, #0x18
                                            	lsr r0, r0, #0x18
                                            	push {r1}
                                            	bl add_opt
                                            	pop {r1}
                                            	
                                            loop_incr:
                                            	cmp r1, #0x6	@ num opts
                                            	beq exit
                                            	add r1, #0x1
                                            	b loop
                                            	
                                            exit:
                                            	pop {r4-r5}
                                            	pop {r0}
                                            	bx r0
                                            	
                                            .align 2
                                            table:
                                            .hword DEX_FLAG
                                            .byte 0
                                            .byte 0
                                            .hword POKE_FLAG
                                            .byte 1
                                            .byte 0
                                            .hword BAG_FLAG
                                            .byte 2
                                            .byte 0
                                            .hword PLAYER_FLAG
                                            .byte 3
                                            .byte 0
                                            .hword SAVE_FLAG
                                            .byte 4
                                            .byte 0
                                            .hword OPT_FLAG
                                            .byte 5
                                            .byte 0
                                            .hword EXIT_FLAG
                                            .byte 6
                                            .byte 0
                                            	
                                            	
                                            check_flag:
                                            	ldr r2, =(0x0806e6d0 +1)
                                            	bx r2
                                            	
                                            add_opt:
                                            	ldr r2, =(0x0806ed94 +1)
                                            	bx r2
                                            
                                            check_safari_zone:
                                            	ldr r0, =(0x080a0e90 +1)
                                            	bx r0


                                            for example, with the current definitions, setting flags 0x251, 0x253 would make the start menu be composed of only "Pokemon","[player]", and "Exit".
                                            __________________
                                            TM/HM Expansion
                                            Critical Capture
                                            Reply With Quote
                                              #1424    
                                            Old 5 Days Ago (8:07 AM).
                                            Petuuuhhh's Avatar
                                            Petuuuhhh Petuuuhhh is offline
                                             
                                            Join Date: Apr 2017
                                            Location: Georgia
                                            Age: 25
                                            Gender: Male
                                            Posts: 536
                                            Quote:
                                            Originally Posted by Skeli- View Post
                                            Expanding the Bag Entirely [FR]

                                            -Big Edit: The routines have been completely rewritten from scratch to work properly now.

                                            This has been done in bits and pieces over the years (I believe it's actually been done completely for Emerald), so I decided to rewrite the bag storage routine for Fire Red.

                                            Pre-Requisites
                                            • JPAN's Save Block Recycle
                                              Spoiler:
                                              Code:
                                              .thumb
                                              .global JPAN_Save_Block_Recycle
                                              .equ rom, 0x8000000
                                              .equ offset, 0xA00000 @YOUR INSERT OFFSET HERE
                                              
                                              .org 0xD991E, 0xFF
                                              	bx r7
                                              
                                              .org 0xD995C, 0xFF
                                              .word Recycle_2 + rom + 1
                                              
                                              .org 0xD9EDC, 0xFF
                                              	ldr r0, .Pointer1
                                              	bx r0
                                              .align 2
                                              .Pointer1: .word Recycle_1 + rom + 1
                                              
                                              .org 0x3FEC9A, 0xFF
                                              .byte 0xF0, 0x0F, 0xF0, 0x0F, 0xF0, 0x0F, 0xE0, 0x1F, 0xF0, 0x0F, 0xD0, 0x2F, 0x98, 0xD, 0x0, 0x0, 0xF0, 0x0F, 0xF0, 0xF, 0xF0, 0xF, 0xE0, 0x1F, 0xF0, 0xF, 0xD0, 0x2F, 0xF0, 0xF, 0xC0, 0x3F, 0xF0, 0xF, 0xB0, 0x4F, 0xF0, 0xF, 0xA0, 0x5F, 0xF0, 0xF, 0x90, 0x6F, 0xF0, 0xF, 0x80, 0x7F, 0x50, 0x4
                                              
                                              .org offset, 0xFF
                                              Recycle_1:
                                              	ldr r1, [r4]
                                              	mov r3, #0xFF
                                              	lsl r3, #0x4
                                              	add r3, r1
                                              	ldrh r0, [r3, #0x4]
                                              	cmp r0, #0x0
                                              	beq Size1
                                              	cmp r0, #0x4
                                              	beq Size2
                                              	cmp r0, #0xD
                                              	beq Size3
                                              
                                              BigLoop:
                                              	cmp r5, #0xD
                                              	ble Return
                                              	mov r0, #0x1
                                              	pop {r3}
                                              	mov r8, r3
                                              	pop {r4-r7,pc}
                                              
                                              Size1:
                                              	mov r1, #0xCC
                                              	ldr r2, .Loc1
                                              	b SmallLoop
                                              
                                              Size2:
                                              	mov r1, #0x96
                                              	lsl r1, #0x2
                                              	ldr r2, .Loc2
                                              	b SmallLoop
                                              
                                              Size3:
                                              	mov r1, #0xBA
                                              	lsl r1, #0x4
                                              	ldr r2, .Loc3
                                              
                                              SmallLoop:
                                              	sub r3, #0x4
                                              	ldr r0, [r3]
                                              	str r0, [r2]
                                              	sub r2, #0x4
                                              	sub r1, #0x4
                                              	cmp r1, #0x0
                                              	bne SmallLoop
                                              	b BigLoop
                                              
                                              .align 2
                                              .Loc1: .word 0x203C1C8
                                              .Loc2: .word 0x203C420
                                              .Loc3: .word 0x203CFC0
                                              
                                              Return:
                                              	ldr r0, .Return
                                              	bx r0
                                              
                                              .align 2
                                              .Return: .word 0x80D9E71
                                              .word 0xFFFFFFFF
                                              
                                              Recycle_2:
                                              	mov r7, #0xFF
                                              	lsl r7, #0x4
                                              	add r7, r1, r7
                                              	strh r0, [r7, #0x6]
                                              	ldrh r6, [r7, #0x4]
                                              	cmp r6, #0x0
                                              	beq Size1_2
                                              	cmp r6, #0x4
                                              	beq Size2_2
                                              	cmp r6, #0xD
                                              	beq Size3_2
                                              	lsl r0, #0x0
                                              
                                              Return_2:
                                              	ldr r0, .Return2
                                              	bx r0
                                              
                                              .align 2
                                              .Return2: .word 0x80D9923
                                              
                                              Size1_2:
                                              	mov r3, #0xCC
                                              	ldr r2, .Loc1_2
                                              	b SmallLoop_2
                                              
                                              Size2_2:
                                              	mov r3, #0x96
                                              	lsl r3, #0x2
                                              	ldr r2, .Loc2_2
                                              	b SmallLoop_2
                                              
                                              Size3_2:
                                              	mov r3, #0xBA
                                              	lsl r3, #0x4
                                              	ldr r2, .Loc3_2
                                              
                                              SmallLoop_2:
                                              	sub r7, #0x4
                                              	ldr r0, [r2]
                                              	str r0, [r7]
                                              	sub r2, #0x4
                                              	sub r3, #0x4
                                              	cmp r3, #0x0
                                              	bne SmallLoop_2
                                              	b Return_2
                                              
                                              .align 2
                                              .Loc1_2: .word 0x203C1C8
                                              .Loc2_2: .word 0x203C420
                                              .Loc3_2: .word 0x203CFC0
                                              Insertion Instructions:
                                              1. Change the .equ offset, 0xA00000 to the offset where you plan on inserting the routine.
                                              2. Compile the asm file.
                                              3. Open the .bin file and copy all the data from 0xD991E, 0xD995C, 0xD9EDC 0x3FEC9A, and your insert offset to those same offsets in your rom.
                                            • An updated Conversion attack routine:
                                              Spoiler:

                                              In the following routine, change the location of your attack data at the top if necessary (if you haven't added new moves to your game it probably isn't). Assemble the routine, copy the data from the .bin file, and then do a paste-write at 0x28604 in your rom.

                                              Or if you don't understand ASM, copy and paste the compiled version to 0x28604 in your rom:
                                              Code:
                                              F0 B5 1B 4F 18 48 19 49 09 78 58 22 51 43 40 18 03 1C 44 7D 85 7D 00 88 12 49 0C 22 50 43 09 18 08 78 A0 42 10 D0 A8 42 0E D0 58 75 98 75 04 1C 10 48 FD 21 01 70 03 21 41 70 84 70 FF 21 C1 70 39 68 05 31 39 60 F0 BD 3A 68 51 78 90 78 00 02 01 43 D0 78 00 04 01 43 10 79 00 06 01 43 39 60 F0 BD C0 46 06 0C 25 08 F0 3B 02 02 6B 3D 02 02 74 3D 02 02 B8 2A 02 02
                                              (This compiled version assumes you haven't added any new moves)

                                              Routine:
                                              Code:
                                              .thumb
                                              .global atk90_changetypestoenemyattacktype
                                              
                                              .equ Attack_Data, 0x250C04 @0x900000 for Mr. DS
                                              .equ rom, 0x8000000
                                              
                                              @Conversion: Insert at 0x28604
                                              CheckMove:
                                              	push {r4-r7, lr}
                                              	ldr r7, .ScriptLoc
                                              	ldr r0, .BattleData
                                              	ldr r1, .UserBank
                                              	ldrb r1, [r1]
                                              	mov r2, #0x58
                                              	mul r1, r2
                                              	add r0, r1
                                              	mov r3, r0
                                              	ldrb r4, [r0, #0x15] @first type
                                              	ldrb r5, [r0, #0x16] @second type
                                              	ldrh r0, [r0] @First Move
                                              
                                              GetMoveType:
                                              	ldr r1, .MoveData
                                              	mov r2, #0xC
                                              	mul r0, r2
                                              	add r1, r0
                                              	ldrb r0, [r1]
                                              
                                              CheckTypeMatch:
                                              	cmp r0, r4
                                              	beq Failed
                                              	cmp r0, r5
                                              	beq Failed
                                              
                                              Store:
                                              	strb r0, [r3, #0x15]
                                              	strb r0, [r3, #0x16]
                                              
                                              Return:
                                              	mov r4, r0
                                              	ldr r0, =0x2022AB8
                                              	mov r1, #0xFD
                                              	strb r1, [r0]
                                              	mov r1, #0x3
                                              	strb r1, [r0, #0x1]
                                              	strb r4, [r0, #0x2]
                                              	mov r1, #0xFF
                                              	strb r1, [r0, #0x3]
                                              	ldr r1, [r7]
                                              	add r1, #0x5
                                              	str r1, [r7]
                                              	pop {r4-r7, pc}
                                              
                                              Failed:
                                              	ldr r2, [r7]
                                              	ldrb r1, [r2,#1]
                                              	ldrb r0, [r2,#2]
                                              	lsl r0, #8
                                              	orr r1, r0
                                              	ldrb r0, [r2,#3]
                                              	lsl r0, #0x10
                                              	orr r1, R0
                                              	ldrb r0, [r2,#4]
                                              	lsl r0, #0x18
                                              	orr r1, r0
                                              	str r1, [r7]
                                              	pop {r4-r7, pc}
                                              
                                              .align 2
                                              .MoveData: .word Attack_Data + 0x2  + rom
                                              .BattleData: .word 0x2023BE4 + 0xC
                                              .UserBank: .word 0x2023D6B
                                              .ScriptLoc: .word 0x2023D74


                                              Why Conversion?
                                              Spoiler:
                                              Some of the space from the old Conversion routine is used for the bag expansion. To free up this space, Conversion was rewritten to match its Gen 6+ effect.

                                            The Code
                                            Spoiler:
                                            Code:
                                            @Bag Cursor: 203AD0A
                                            .equ Total_Item_Amount, 700 @Change to largest item index number
                                            
                                            .equ Regular_Item_Num, 200 @Change to number of items in main bag pocket divided by 2
                                            .equ Key_Item_Num, 30 @Change to number of items in key item pocket divided by 2
                                            .equ Poke_Ball_Num, 14 @Change to number of items in Poke Ball pocket divided by 2
                                            .equ TM_Num, 128 @Change to number of TMs + HMs
                                            .equ Berry_Num, 67 @Change to number of berries
                                            
                                            .equ TM_Ram, 0x202583C @Change to your TM Case RAM address
                                            .equ Berry_Ram, 0x2025A3C @Change to your Berry Pouch RAM address
                                            .equ Key_Item_Ram, 0x203C7D0 @Change to your Key Item pocket RAM address
                                            .equ Poke_Ball_Ram, 0x203C8C0 @Change to your main Poke Ball Pocket RAM address
                                            .equ Item_Ram, 0x203C930 @Change to your main bag pocket RAM address
                                            
                                            .equ Free_Ram, 0x203D850 @Don't change unless you don't like this free ram
                                            .equ offset, 0x8B3030 @Change to Free Space Offset
                                            
                                            .equ largest_pocket_size, Regular_Item_Num * 2
                                            .equ largest_pocket_size_plus_one, largest_pocket_size + 1
                                            .equ strings_size, largest_pocket_size_plus_one * 19
                                            
                                            .equ rom, 0x8000000
                                            
                                            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@HelperRoutine
                                            
                                            .org 0x28760, 0xFF
                                            GetItemAmount:
                                            	push {r1,lr}
                                            	ldr r0, .CurrentPocket
                                            	ldrb r0, [r0]
                                            	lsl r0, #0x1
                                            	ldr r1, .ItemStorage
                                            	add r0, r1
                                            	ldrh r0, [r0]
                                            	pop {r1,pc}
                                            
                                            .align 2
                                            .CurrentPocket: .word 0x203AD02
                                            .ItemStorage: .word Free_Ram
                                            
                                            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Bag Decryption and DMA Negation
                                            .org 0x4C064, 0xFF
                                            mov r1, #0x0
                                            
                                            .org 0x4C13C, 0xFF
                                            mov r4, #0x0
                                            
                                            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Routines Related to Obtaining Items
                                            
                                            .org 0x99DFC, 0xFF
                                            ldrh r0, [r0, #0x4]
                                            
                                            .org 0x99E1A, 0xFF
                                            ldrh r4, [r4, #0x4]
                                            
                                            .org 0x99E44, 0xFF
                                            ldr r1, .BagPocket0
                                            
                                            @Regular items
                                            ldr r0, ram_FREE_item
                                            str r0, [r1]
                                            mov r0, #Regular_Item_Num
                                            lsl r0, #0x1 @400 regular items
                                            strh r0, [r1, #0x4]
                                            
                                            @Key items
                                            ldr r0, ram_FREE_keyitem
                                            str r0, [r1, #0x8]
                                            mov r0, #(Key_Item_Num * 2) @60 key items
                                            strh r0, [r1, #0xC]
                                            
                                            @Poke balls
                                            ldr r0, ball_ram
                                            str r0, [r1, #0x10]
                                            mov r0, #(Poke_Ball_Num * 2) @28 balls
                                            strh r0, [r1, #0x14]
                                            
                                            @Tms
                                            ldr r0, tm_ram
                                            str r0, [r1, #0x18]
                                            mov r0, #TM_Num @128 TMs
                                            strh r0, [r1, #0x1C]
                                            
                                            @Berries
                                            ldr r0, berry_ram
                                            str r0, [r1, #0x20]
                                            add r1, #0x24
                                            mov r0, #Berry_Num @67 berries
                                            strh r0, [r1]
                                            bx lr
                                            
                                            .align 2
                                            .BagPocket0:		.word 0x203988C
                                            tm_ram:			.word TM_Ram
                                            berry_ram:		.word Berry_Ram
                                            ram_FREE_keyitem:	.word Key_Item_Ram
                                            ball_ram:		.word Poke_Ball_Ram
                                            ram_FREE_item:		.word Item_Ram
                                            
                                            .org 0x99ED8, 0xFF
                                            ldrh r1, [r0, #0x4]
                                            
                                            .org 0x99EEA, 0xFF
                                            lsl r0, r2, #0x10
                                            lsr r0, r0, #0x10
                                            
                                            .org 0x99F16, 0xFF
                                            ldrh r1, [r0, #0x4]
                                            
                                            .org 0x99F32, 0xFF
                                            lsl r0, r0, #0x10
                                            lsl r2, r0, #0x10
                                            
                                            .org 0x99F6E, 0xFF
                                            ldrh r1, [r0, #0x4]
                                            
                                            .org 0x99F9A, 0xFF
                                            lsl r0, r0, #0x10
                                            lsr r2, r0, #0x10
                                            ldrh r0, [r3, #0x4]
                                            
                                            .org 0x9A02A, 0xFF
                                            ldrh r1, [r0, #0x4]
                                            
                                            .org 0x9A05E, 0xFF
                                            lsl r0, r0, #0x10
                                            lsr r2, r0, #0x10
                                            ldrh r0, [r3, #0x4]
                                            
                                            .org 0x9A06E, 0xFF
                                            lsl r0, r0, #0x10
                                            lsr r0, r0, #0x10
                                            
                                            .org 0x9A0B6, 0xFF
                                            ldrh r1, [r0, #0x4]
                                            
                                            .org 0x9A0EA, 0xFF
                                            lsl r0, r0, #0x10
                                            lsr r2, r0, #0x10
                                            ldrh r0, [r5, #0x4]
                                            
                                            .org 0x9A110, 0xFF
                                            lsl r0, r0, #0x10
                                            lsr r1, r0, #0x10
                                            
                                            .org 0x9A14C, 0xFF
                                            lsl r0, r0, #0x10
                                            lsr r1, r0, #0x10
                                            
                                            .org 0x9A186, 0xFF
                                            lsl r0, r0, #0x10
                                            lsr r2, r0, #0x10
                                            
                                            .org 0x9A204, 0xFF
                                            ldrh r1, [r0, #0x4]
                                            
                                            .org 0x9A24E, 0xFF
                                            lsl r0, r0, #0x10
                                            lsr r2, r0, #0x10
                                            ldrh r0, [r6, #0x4]
                                            
                                            .org 0x9A2E8, 0xFF
                                            ldrh r1, [r1, #0x4]
                                            
                                            .org 0x9A58E, 0xFF @Shifting Items Up
                                            lsl r1, #0x10
                                            lsr r1, #0x10
                                            
                                            .org 0x09A8A4, 0xFF
                                            	lsl r0, #0x10
                                            	lsr r0, #0x10
                                            	ldr r1, .ItemLimit
                                            	cmp r1, r0
                                            	bge Return
                                            	mov r0, #0x0
                                            Return:
                                            	bx lr
                                            
                                            .align 2
                                            .ItemLimit: .word Total_Item_Amount
                                            
                                            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Routines Related to Viewing Items in Bag
                                            
                                            Bag_Allocate_Stuff: @Credits to azurile13
                                            .org 0x1083F4, 0xFF
                                            	push {r4,lr}
                                            	ldr r4, .AllocationPointer
                                            	ldr r0, .LargestSize
                                            	lsl r0, #0x3
                                            	bl 0x2B9C @malloc
                                            	str r0, [r4]
                                            	cmp r0, #0x0
                                            	beq No
                                            	ldr r0, .strings_size
                                            	bl 0x2B9C @malloc
                                            	str r0, [r4, #0x4]
                                            	cmp r0, #0x0
                                            	beq No
                                            	mov r0, #0x1
                                            	b End
                                            
                                            No:
                                            	mov r0, #0x0
                                            
                                            End:
                                            	pop {r4,pc}
                                            
                                            .align 2
                                            .LargestSize: .word largest_pocket_size_plus_one
                                            .AllocationPointer: .word 0x0203AD18
                                            .strings_size: .word strings_size
                                            
                                            .org 0x108440, 0xFF
                                            bl 0x28760 @GetItemAmount
                                            b 0x10844A
                                            
                                            .org 0x10847E, 0xFF @Shop is dis one
                                            bl 0x28760 @GetItemAmount
                                            b 0x108488
                                            
                                            .org 0x1084C2, 0xFF
                                            bl 0x28760 @GetItemAmount
                                            b 0x1084CA
                                            
                                            .org 0x1085D8, 0xFF
                                            push {r1}
                                            bl 0x28760 @GetItemAmount
                                            pop {r1}
                                            cmp r0, r5
                                            
                                            .org 0x108698, 0xFF
                                            ldr r5, .Thing
                                            ldrh r1, [r5, #0x6]
                                            push {r1}
                                            bl 0x28760 @GetItemAmount
                                            pop {r1}
                                            .hword 0x0
                                            cmp r0, r4
                                            
                                            .org 0x10871C, 0xFF
                                            .Thing: .word 0x203ACFC
                                            
                                            .org 0x10881E, 0xFF
                                            ldr r1, .Thing2
                                            ldrh r1, [r1, #0x6]
                                            push {r1}
                                            bl 0x28760 @GetItemAmount
                                            pop {r1}
                                            .hword 0x0
                                            cmp r2, r0
                                            
                                            .org 0x108850, 0xFF
                                            .Thing2: .word 0x203ACFC
                                            
                                            .org 0x108894, 0xFF
                                            push {r1}
                                            bl 0x28760 @GetItemAmount
                                            pop {r1}
                                            add r1, #0xD
                                            
                                            .org 0x108A1C, 0xFF @Up Cursor Bug 1
                                            ldr r1, .OpenBagBugFix1Pointer
                                            bx r1
                                            .align 2
                                            .OpenBagBugFix1Pointer: .word OpenBagBugFix1 + rom + 1
                                            
                                            .org 0x108A40, 0xFF @Up Cursor Bug 2
                                            ldr r0, .OpenBagBugFix2Pointer
                                            bx r0
                                            .align 2
                                            .OpenBagBugFix2Pointer: .word OpenBagBugFix2 + rom + 1
                                            .hword 0x0
                                            
                                            .org 0x108AC0, 0xFF @Up Cursor Bug 3
                                            ldr r0, .OpenBagBugFix3Pointer
                                            bx r0
                                            .align 2
                                            .OpenBagBugFix3Pointer: .word OpenBagBugFix3 + rom + 1
                                            
                                            .org 0x108DC8, 0xFF
                                            ldr r1, .StoreItemPointer
                                            bx r1
                                            .align 2
                                            .StoreItemPointer: .word StoreItem + rom + 1
                                            
                                            ldr r0, .Bag_Pocket_0_2
                                            add r4, r1, r0
                                            ldr r0, [r4]
                                            ldrh r1, [r4, #0x4]
                                            
                                            .org 0x108DEA, 0xFF
                                            ldrh r0, [r4, #0x4]
                                            
                                            .org 0x108E0A, 0xFF
                                            ldrh r0, [r4, #0x4]
                                            
                                            .org 0x108E20, 0xFF
                                            ldr r0, .GetSmallestItemAmountPointer
                                            bx r0
                                            .align 2
                                            .GetSmallestItemAmountPointer: .word GetSmallestItemAmount + rom + 1
                                            
                                            .org 0x108E3C, 0xFF
                                            .Bag_Pocket_0_2: .word 0x203988C
                                            
                                            .org 0x108E4C, 0xFF
                                            pop {r4-r6,pc}
                                            
                                            .org 0x108FB6, 0xFF
                                            ldrh r5, [r5, #0x6]
                                            push {r1}
                                            bl 0x28760 @GetItemAmount
                                            pop {r1}
                                            .hword 0x0
                                            cmp r1, r0
                                            
                                            .org 0x10904A, 0xFF
                                            ldrh r1, [r5, #0x6]
                                            push {r1}
                                            bl 0x28760 @GetItemAmount
                                            pop {r1}
                                            .hword 0x0
                                            cmp r4, r0
                                            
                                            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Remove Help System
                                            .org 0x13B8C2, 0xFF
                                            b 0x13B900
                                            
                                            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@New Routine
                                            
                                            .org offset, 0xFF
                                            StoreItem:
                                            	push {r4-r6,lr}
                                            	lsl r0, r0, #0x18
                                            	lsr r5, r0, #0x18
                                            	mov r4, #0x0
                                            
                                            GetItemInBagCount:
                                            	mov r6, #0x0
                                            	lsl r0, r4, #0x3
                                            	ldr r1, .Table
                                            	add r0, r1
                                            	ldrh r3, [r0, #0x4]
                                            	lsl r3, #0x1
                                            	ldr r0, [r0]
                                            	mov r1, #0x0
                                            
                                            Loop:
                                            	cmp r1, r3
                                            	beq StoreAmount
                                            	ldrh r2, [r0]
                                            	cmp r2, #0x0
                                            	beq CheckNextItemJustInCase
                                            	add r0, #0x4
                                            	add r1, #0x1
                                            	b Loop
                                            
                                            CheckNextItemJustInCase:
                                            	ldrh r2, [r0, #0x4]
                                            	cmp r2, #0x0
                                            	beq StoreAmount
                                            	add r0, #0x4
                                            	add r1, #0x1
                                            	mov r6, #0x1
                                            	b Loop	
                                            
                                            StoreAmount:
                                            	cmp r6, #0x0
                                            	beq NotShopSkip
                                            	sub r1, #0x1
                                            NotShopSkip:
                                            	ldr r0, .ItemStorage2
                                            	lsl r2, r4, #0x1
                                            	add r0, r2
                                            	strh r1, [r0]
                                            	add r4, #0x1
                                            	cmp r4, #0x3
                                            	beq ReturnToThing
                                            	b GetItemInBagCount
                                            
                                            ReturnToThing:
                                            	lsl r1, r5, #0x3
                                            	ldr r0, =0x8108DD1
                                            	bx r0
                                            
                                            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                                            
                                            GetSmallestItemAmount:
                                            	push {r1}
                                            	ldr r0, .ItemStorage2
                                            	lsl r1, r5, #0x1
                                            	add r0, r1
                                            	pop {r1}
                                            	ldrh r0, [r0]
                                            	ldr r3, =0x8108E29
                                            	bx r3
                                            
                                            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                                            
                                            OpenBagBugFix1:
                                            	push {r0}
                                            	lsl r0, r4, #0x1
                                            	ldr r1, .ItemStorage2
                                            	add r1, r0
                                            	ldrh r1, [r1]
                                            	pop {r0}
                                            	add r0, r1, #0x1
                                            	cmp r2, r0
                                            	ldr r0, =0x8108A27
                                            	bx r0
                                            
                                            OpenBagBugFix2:
                                            	lsl r3, r4, #0x1
                                            	ldr r0, .ItemStorage2
                                            	add r0, r3
                                            	ldrh r0, [r0]
                                            	add r3, r0, #0x1
                                            	ldr r4, =0x8108A4D
                                            	bx r4
                                            
                                            OpenBagBugFix3:
                                            	lsl r1, r6, #0x1
                                            	ldr r0, .ItemStorage2
                                            	add r0, r1
                                            	ldrh r0, [r0]
                                            	add r0, #0x1
                                            	ldr r1, =0x8108AC9
                                            	bx r1
                                            
                                            @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
                                            
                                            .align 2
                                            .ItemStorage2: .word Free_Ram
                                            .Table: .word TABLE + rom
                                            
                                            TABLE:
                                            .word Item_Ram
                                            .hword Regular_Item_Num, 0x0
                                            
                                            .word Key_Item_Ram
                                            .hword Key_Item_Num, 0x0
                                            
                                            .word Poke_Ball_Ram
                                            .hword Poke_Ball_Num, 0x0
                                            The above code is written in such a way that if you were to insert it as is, you would have support for:
                                            • 400 Regular Items
                                            • 60 Key Items
                                            • 28 Poke Balls
                                            • 128 TMs/HMs
                                            • 67 Berries

                                            Obviously if you don't need this many items, you're free to change the ram locations and item amounts by modifying the lines at the top of the routine.

                                            Insertion Instructions:
                                            1. Customize to your liking
                                            2. Assemble the routine
                                            3. Copy the output file and fill this copy with FFs
                                            4. Create a patch using your blank (filled with FFs) file as the unmodified file, and the output file as the modified file
                                            5. Patch your rom

                                            This has been confirmed to work with a vanilla Fire Red. However, I can't guarantee it will work with all roms in progress.


                                            Credits
                                            Potions go into the Key Item slot when I use this? What am I doing wrong?
                                            Reply With Quote
                                              #1425    
                                            Old 4 Days Ago (1:00 PM). Edited 4 Days Ago by Skeli-.
                                            Skeli-'s Avatar
                                            Skeli- Skeli- is offline
                                            Lord of the Rings
                                               
                                              Join Date: Apr 2014
                                              Location: Canada
                                              Age: 19
                                              Gender: Male
                                              Nature: Adamant
                                              Posts: 191
                                              Quote:
                                              Originally Posted by Petuuuhhh View Post
                                              Potions go into the Key Item slot when I use this? What am I doing wrong?
                                              You need to delete your save file and start a new game. Or, implement this routine by Sagiri, and then you can just start a new game normally. If you used the saveblock routine from this post and you do implement Sagiri's routine, make sure that you change the first line in constants.s (from Sagiri's routine) to
                                              Code:
                                              .definelabel jpan_block, 0x0203C100
                                              as that is where I started the saveblock in JPAN's routine.
                                              __________________
                                              Pokemon Unbound

                                              Reply With Quote
                                              Reply

                                              Quick Reply

                                              Join the conversation!

                                              Create an account to post a reply in this thread, participate in other discussions, and more!

                                              Create a PokéCommunity Account
                                              Thread Tools

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

                                              BB code is On
                                              Smilies are On
                                              [IMG] code is On
                                              HTML code is Off

                                              Forum Jump


                                              All times are GMT -8. The time now is 4:09 AM.