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

[ASM & Hex✓] Delete PokéBall routine

352
Posts
7
Years
    • Seen Mar 10, 2022
    This is the routine to delete the last item used before a successful catch (the PokéBall), but if I'm on the Safari Zone and I'm fishing, the last item used is the Rod, then it disappears, I want someone to fix this routine to check if the item is a PokéBall to delete or make a flag check to enable and disable this routine, then I will enable the flag when the player enters on the Safari Zone then disable when it leaves. The flag check must be inversed, when I use the "setflag" it will be DISABLED, then when I use the "clearflag" it will be ENABLED again.
    That is the routine:
    Spoiler:
     
    Last edited:

    BluRose

    blu rass
    811
    Posts
    10
    Years
  • Spoiler:
    Spoiler:
    boldfaced is added

    if i remember right, 9A1D8 is actually the general item deleting routine, so skipping the deleting should be fine~
    if it doesn't work, then holler at me
     
    237
    Posts
    7
    Years
  • Spoiler:
    boldfaced is added

    if i remember right, 9A1D8 is actually the general item deleting routine, so skipping the deleting should be fine~
    if it doesn't work, then holler at me
    Hi BluRose, I put the additions you posted above into the Emerald variant of this script you posted a while back since I was having the same problem. While it does work well (doesn't remove the Bikes anymore, etc.), if you catch a Pokémon in the Safari Zone when using a fishing rod, it causes the game to hang indefinitely either after the Pokémon has been nicknamed or as soon as nicknaming is declined. Here is the exact ASM script that was used (basically a copy-paste of what you made before, but with the new changes here):
    Code:
    .text
    .align 2
    .thumb
    
    @ FE3AA - 00 21
    @ 56818 - 00 48 00 47 XX+1 XX XX 08
    
    main:
    	bl deleteball
    	mov r9, r4
    	mov r10, r5		@ added because emerald
    	pop {r4-r7}
    	pop {r0}
    	bx r0
    
    deleteball:
    	ldr r0, var_800E	@ last_used_item_maybe
    	ldrh r0, [r0]
    	mov r1, #0xC		@ premier ball index - last poké ball listed
    	cmp r0, r1
    	bgt end
    	mov r1, #1
    	ldr r2, =(0x80D6AA5)
    	bx r2
    	
    .align 2
    var_800E: .word 0x0203CE7C
     
    Last edited:

    BluRose

    blu rass
    811
    Posts
    10
    Years
  • Hi BluRose, I put the additions you posted above into the Emerald variant of this script you posted a while back since I was having the same problem. While it does work well (doesn't remove the Bikes anymore, etc.), if you catch a Pokémon in the Safari Zone when using a fishing rod, it causes the game to hang indefinitely either after the Pokémon has been nicknamed or as soon as nicknaming is declined. Here is the exact ASM script that was used (basically a copy-paste of what you made before, but with the new changes here):
    Code:
    .text
    .align 2
    .thumb
    
    @ FE3AA - 00 21
    @ 56818 - 00 48 00 47 XX+1 XX XX 08
    
    main:
    	bl deleteball
    	mov r9, r4
    	mov r10, r5		@ added because emerald
    	pop {r4-r7}
    	pop {r0}
    	bx r0
    
    deleteball:
    	ldr r0, var_800E	@ last_used_item_maybe
    	ldrh r0, [r0]
    	mov r1, #0xC		@ premier ball index - last poké ball listed
    	cmp r0, r1
    	bgt end
    	mov r1, #1
    	ldr r2, =(0x80D6AA5)
    	bx r2
    	
    .align 2
    var_800E: .word 0x0203CE7C
    Spoiler:
    how the heck did you even get it to compile without defining end tho

    EDIT: ye what it's probably doing is jumping to a random address because the item is recognized but end is not defined
     
    237
    Posts
    7
    Years
  • how the heck did you even get it to compile without defining end tho

    EDIT: ye what it's probably doing is jumping to a random address because the item is recognized but end is not defined
    Oh ok haha, thanks.
    To compile it, I just drag/dropped it onto HackMew's 'thumb.bat' file (with as.exe and objcopy.exe in the same folder), and it didn't give any errors. Of course the ROM didn't like it though.
     
    352
    Posts
    7
    Years
    • Seen Mar 10, 2022
    Spoiler:
    boldfaced is added

    if i remember right, 9A1D8 is actually the general item deleting routine, so skipping the deleting should be fine~
    if it doesn't work, then holler at me

    It worked perfectly, I have expanded balls, but if I place the last number of my PokéBalls at mov r1, #0xC it works fine because the last PokéBall I have is placed before the index number of the 3 Rods, it can be dangerous because I can find another problem but for now it's all I want, if I find another issue I will tell you, but I think it was finally solved. Thank you so much.
     

    Phantom Phoenix

    Lost on the road of life
    167
    Posts
    8
    Years
    • Age 27
    • ???
    • Seen Jul 1, 2020
    It worked perfectly, I have expanded balls, but if I place the last number of my PokéBalls at mov r1, #0xC it works fine because the last PokéBall I have is placed before the index number of the 3 Rods, it can be dangerous because I can find another problem but for now it's all I want, if I find another issue I will tell you, but I think it was finally solved. Thank you so much.

    or you can use table .
    Code:
    .text
    .align 2
    .thumb
    main:
    bl deleteball
    end:
    mov r9, r4
    pop {r4-r7}
    pop {r0}
    bx r0
    deleteball:
    ldr r0, var_800E
    ldrh r0, [r0]
    mov r2, #0x0
    mov r3, #0x0
    loop:
    ldr r1, tablestart
    lsl r3, r2, #0x1
    add r1, r1, r3
    ldrb r1, [r1]
    cmp r1, #0xff
    beq end
    cmp r1, r0
    beq cont
    add r2, #0x1
    b loop
    cont:
    mov r1, #1
    ldr r2, =(0x809A1D9)
    bx r2
    .align 2
    var_800E: .word 0x0203AD30
    tablestart: .word 0x08XXXXXX
    where tablestart is the offset of a table of all balls index in this format:
    Code:
     ballindex 00 ballindex1 00 ballindex16 00 ....... ff00
    for example: my balls are 1,2,3 and 5th index only. Then, my table will look like this:
    Code:
     0100 0200 0300 0500 ff00
    NOTE: ff00 is end of the table.
    And I haven't tested the code.
     
    352
    Posts
    7
    Years
    • Seen Mar 10, 2022
    or you can use table .
    Code:
    .text
    .align 2
    .thumb
    main:
    bl deleteball
    end:
    mov r9, r4
    pop {r4-r7}
    pop {r0}
    bx r0
    deleteball:
    ldr r0, var_800E
    ldrh r0, [r0]
    mov r2, #0x0
    mov r3, #0x0
    loop:
    ldr r1, tablestart
    lsl r3, r2, #0x1
    add r1, r1, r3
    ldrb r1, [r1]
    cmp r1, #0xff
    beq end
    cmp r1, r0
    beq cont
    add r2, #0x1
    b loop
    cont:
    mov r1, #1
    ldr r2, =(0x809A1D9)
    bx r2
    .align 2
    var_800E: .word 0x0203AD30
    tablestart: .word 0x08XXXXXX
    where tablestart is the offset of a table of all balls index in this format:
    Code:
     ballindex 00 ballindex1 00 ballindex16 00 ....... ff00
    for example: my balls are 1,2,3 and 5th index only. Then, my table will look like this:
    Code:
     0100 0200 0300 0500 ff00
    NOTE: ff00 is end of the table.
    And I haven't tested the code.



    Awesome, I will test it when I get a chance. ^^

    EDIT: Haven't worked, if I don't place anything on the table or if I place only one ball (02 00 FF 00) all balls become reusable, it's not deleting the Rod, I think the line cmp r1, #0xff is working like the BluRose's routine.
     
    Last edited:

    Phantom Phoenix

    Lost on the road of life
    167
    Posts
    8
    Years
    • Age 27
    • ???
    • Seen Jul 1, 2020
    Awesome, I will test it when I get a chance. ^^

    EDIT: Haven't worked, if I don't place anything on the table or if I place only one ball (02 00 FF 00) all balls become reusable, it's not deleting the Rod, I think the line cmp r1, #0xff is working like the BluRose's routine.
    Hmm... show your table.
     
    352
    Posts
    7
    Years
    • Seen Mar 10, 2022
    Hmm... show your table.

    My table is that I posted: 02 00 FF 00, because I have to test it one by one to check if it works fine. I've tested with:
    02 00 FF 00
    01 00 02 00 03 00 FF 00
    and without the table, don't have any difference.
     
    Back
    Top