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

Help Thread: ASM & Disassembly

Status
Not open for further replies.

C me

Creator of Pokemon League Of Legends
  • 681
    Posts
    10
    Years
    • Seen Apr 9, 2021
    Still stuck on the fly thing. In these times I wish I was hacking FireRed :( .

    If no one knows the routine location, I guess I'll make a script with multichoiceboxes and warps.
     

    Joexv

    ManMadeOfGouda joexv.github.io
  • 1,037
    Posts
    11
    Years
    Still stuck on the fly thing. In these times I wish I was hacking FireRed :( .

    If no one knows the routine location, I guess I'll make a script with multichoiceboxes and warps.

    Go to the fly asm offset in Fire Red and copy the bytes there(dont copy any offsets) and then search for thise bytes in emerald, this is a method Touched Senpai taught me. This should give you the offset that calls the fly routine.
     

    C me

    Creator of Pokemon League Of Legends
  • 681
    Posts
    10
    Years
    • Seen Apr 9, 2021
    Go to the fly asm offset in Fire Red and copy the bytes there(dont copy any offsets) and then search for thise bytes in emerald, this is a method Touched Senpai taught me. This should give you the offset that calls the fly routine.

    The routine is at 0x0C4EF8+1. I tried searching for it without the offsets but the when I tested the routines they did nothing (there was one that turned the player upside down, you can walk around but surfing, battling and warping crashes the game). I literally spent about 3 hours doing that. But nothing.
     
  • 417
    Posts
    9
    Years
    • Seen Nov 20, 2016
    The routine is at 0x0C4EF8+1. I tried searching for it without the offsets but the when I tested the routines they did nothing (there was one that turned the player upside down, you can walk around but surfing, battling and warping crashes the game). I literally spent about 3 hours doing that. But nothing.
    Yeah, that won't work so well with pc relative instructions. Here's what you copied:
    Code:
    	push {lr}
    	bl + 0x2EE
    	mov r0, #0x2
    	bl - 0x5024
    	pop {r0}
    	bx r0
    That mov was the only notable non-address related thing that happened with what you copied. If you couldn't find the table, did you try with breakpoints? I would think that the things you knew should have worked.

    So I'd want ldr r1, r0?
    mov r1, r0
     
    Last edited:

    Blah

    Free supporter
  • 1,924
    Posts
    11
    Years
    The routine is at 0x0C4EF8+1. I tried searching for it without the offsets but the when I tested the routines they did nothing (there was one that turned the player upside down, you can walk around but surfing, battling and warping crashes the game). I literally spent about 3 hours doing that. But nothing.

    Uhmm. Just find the HMs names table first. Then find the routines table from there, then find fly's routine, then somewhere there a task should be run for the map.

    In fire red's case, a single register acted as a switch between the normal map and the intractable fly map. I don't recall all the details, but this is how I'd look for it.
     

    C me

    Creator of Pokemon League Of Legends
  • 681
    Posts
    10
    Years
    • Seen Apr 9, 2021
    Uhmm. Just find the HMs names table first. Then find the routines table from there, then find fly's routine, then somewhere there a task should be run for the map.

    In fire red's case, a single register acted as a switch between the normal map and the intractable fly map. I don't recall all the details, but this is how I'd look for it.

    I can't find a HM name's table, only the move names table. What else can I use to add a break? And more importantly how?
     

    Blah

    Free supporter
  • 1,924
    Posts
    11
    Years
    I can't find a HM name's table, only the move names table. What else can I use to add a break? And more importantly how?

    It's rather simple. If you know where the move name's table is, reverse hex pointers to the move names in the table which are HMs (they need to be in order). Then look for it in a hex editor
     

    C me

    Creator of Pokemon League Of Legends
  • 681
    Posts
    10
    Years
    • Seen Apr 9, 2021
    It's rather simple. If you know where the move name's table is, reverse hex pointers to the move names in the table which are HMs (they need to be in order). Then look for it in a hex editor

    I don't know why I thought the strings would be in a table...

    The fly string pointer is at 0x615CC8, what do I do with this number?
     

    Blah

    Free supporter
  • 1,924
    Posts
    11
    Years
    I don't know why I thought the strings would be in a table...

    The fly string pointer is at 0x615CC8, what do I do with this number?

    https://bulbapedia.bulbagarden.net/wiki/HM#Hoenn

    Order the HMs in the order of how the badges let you use them. I.e First Badge is Rock Smash -> then cut.

    Then find the string pointers to these Moves in the order of badge usability. Then look for the small table you created in a hex editor.
     

    C me

    Creator of Pokemon League Of Legends
  • 681
    Posts
    10
    Years
    • Seen Apr 9, 2021
    https://bulbapedia.bulbagarden.net/wiki/HM#Hoenn

    Order the HMs in the order of how the badges let you use them. I.e First Badge is Rock Smash -> then cut.

    Then find the string pointers to these Moves in the order of badge usability. Then look for the small table you created in a hex editor.

    That is the table, it starts at 0x615CA0. Each entry is separated by 71 54 1B 08 until 0x615D0F.
     

    C me

    Creator of Pokemon League Of Legends
  • 681
    Posts
    10
    Years
    • Seen Apr 9, 2021
    bpr*

    He knows what I meant, hopefully :c

    I've only heard of bpr so I would have used it anyway :p

    I've made the break twice and the attached images show you what I got the first and second time. I just used fly from one city to another.
    Spoiler:
     

    Blah

    Free supporter
  • 1,924
    Posts
    11
    Years
    I've only heard of bpr so I would have used it anyway :p

    I've made the break twice and the attached images show you what I got the first and second time. I just used fly from one city to another.
    Spoiler:

    Now you open this in IDA or a disassembler like VBA's and go to this address. Then you analyze and put a break point at the start of the function or after, depending on how things seem to look. I don't have an Emerald ROM, or Emerald IDB, so I can't help further. Take a look at my ASM tutorial on backtracking if you're having further troubles.

    From what I see it might be getting ready to call an string copy function or it may already be in one.
     
  • 534
    Posts
    11
    Years
    • Age 26
    • Seen Jul 24, 2023
    Okaaay, so I've got a few questions about FBI's Routines (Hahaha. Sorry! :P)

    First the Battle Frontier Routines.
    Spoiler:


    And next the HP Modifications per step routines.
    Spoiler:


    Routines by others:

    JPAN's Number Box Input.
    Spoiler:


    Changing Fire Red intro rival sprites/names and texts depending on players gender
    Spoiler:


    Complex Number Picker by DavidJCobb
    Spoiler:


    That's all! Thank you! Sorry for the long post!
     
    Last edited:

    Blah

    Free supporter
  • 1,924
    Posts
    11
    Years
    Okaaay, so I've got a few questions about FBI's Routines (Hahaha. Sorry! :P)

    First the Battle Frontier Routines.
    Spoiler:


    And next the HP Modifications per step routines.
    Spoiler:


    Routines by others:

    JPAN's Number Box Input.
    Spoiler:


    Changing Fire Red intro rival sprites/names and texts depending on players gender
    Spoiler:


    Complex Number Picker by DavidJCobb
    Spoiler:


    That's all! Thank you! Sorry for the long post!

    Hey! For the frontier routine, it's a case which happens when the number is Pokemon on the newly generated team is less than the number of Pokemon you previously battled. To fix this, Callasm to 0x803DA35 right before every battle, OR edit the routine to call it. I recommend editing the routine if you know how.

    For the table, it's just a table of 0xFF terminated strings side by side. Each name is 13 bytes. You specify how many names per sprite you want by changing Tsize here.
    Code:
    Tsize:
    	.word 0x32

    For the rival gender switching routine, you compile the first routine and paste the bytes to overwrite the bytes at 0x131248.
    Then the second longer routine you compile and put at 0x790000.

    For JPAN's routine, I'm too lazy to download his .zip and look, sorry :D

    Looking at Davidjcobb's number picker, JPAN's has got to be better. Half his number picking is done from the script, which is slow. So figure that out and use it. If you want, you can pastebin his source code and link it here, then I can review it for you :)
     
  • 325
    Posts
    10
    Years
    Code:
    .thumb
    start:
     push {r0-r7, lr}
     ldr r0, =(0x20370D0) @x800D, holds the berry number
     ldrh r1, [r0] @r1 now holds the number held in x800D
     ldr r0, =(0x3005541) @may change later because I don't know if this is free
     add r0, r0, r1 @gets the address of the table
     mov r2, r0
     mov r1, r0
     add r2, #0x3
     add r1, #0x2 @r0 is the year pointer, r1 is the month, and r2 is the day
     ldrh r0, r3
     ldrb r1, r4
     ldrb r2, r5
     ldr r6, =(0x300553C)
     ldrh r7, [r6]
     cmp r3, r7
     blo x800D_1
     ldr r6, =(0x300553F)
     ldrb r7, [r6]
     blo x800D_1
     ldr r6, =(0x3005540)
     ldrb r7, [r6]
     blo x800D_1
     ldr r0, =(0x20370D0)
     mov r1, #0x0
     strh r0, [r1] 
     pop {r0-r7}
    x800D_1:
     ldr r6, =(0x300553C)
     ldrh r7, [r6]
     strh r7, [r0]
     ldr r6, =(0x300553C)
     ldrb r7, [r6]
     strb r7, [r1]
     ldr r6, =(0x300553C)
     ldrb r7, [r6]
     strb r7, [r2]
     ldr r0, =(0x20370D0)
     mov r1, #0x1
     strh r0, [r1]
     pop {r0-r7, pc}
    When I try to assemble this(it's a code of my own design), I get an error from the assembler. It tells me that lines 13, 14, and 15 are messed up. The exact error I get is 'invalid offset, value too big (0xFFFFFFFC)', which doesn't make any sense to me.
     
  • 534
    Posts
    11
    Years
    • Age 26
    • Seen Jul 24, 2023
    Hey! For the frontier routine, it's a case which happens when the number is Pokemon on the newly generated team is less than the number of Pokemon you previously battled. To fix this, Callasm to 0x803DA35 right before every battle, OR edit the routine to call it. I recommend editing the routine if you know how.

    For the table, it's just a table of 0xFF terminated strings side by side. Each name is 13 bytes. You specify how many names per sprite you want by changing Tsize here.
    Code:
    Tsize:
        .word 0x32
    For the rival gender switching routine, you compile the first routine and paste the bytes to overwrite the bytes at 0x131248.
    Then the second longer routine you compile and put at 0x790000.

    For JPAN's routine, I'm too lazy to download his .zip and look, sorry :D

    Looking at Davidjcobb's number picker, JPAN's has got to be better. Half his number picking is done from the script, which is slow. So figure that out and use it. If you want, you can pastebin his source code and link it here, then I can review it for you :)

    Oh my gosh. FBI actually responded to my question. I'm at awe. O.O Thank you for the first parts! ^U^

    As for the last part of your reply, I'd guess it was JPAN's source code you wanted me to pastebin right? Well, here it is. https://pastebin.com/dxpEFdWb

    EDIT: Oh. I forgot to ask. In the Frontier Opponent Party Generation Routine, how do I make it so that it generates constant number of Pokemon (let's say, I want it to generate 3 Pokemon the whole time), should I remove the "genAmount" section? And if so, what would I replace it with?

    P.S. The Pokemon can't be generated with random level each right? (Or did I guess wrong?)
     
    Last edited:
    Status
    Not open for further replies.
    Back
    Top