- 249
- Posts
- 12
- Years
- Seen Jun 17, 2024
Good morning!
These days i saw an update of an Italian hack, where there was a very interesting feature, that is the loading the image of items when they added to the bag.
Since it seemed like a nice thing to implement in our ROMs, today i'll explain how to do that!
# 1 - Hook and Routine asm
FIRE RED:
EMERALD:
Next we compile the following routine in a free offset within the rom:
.equ GAMECODE_BPRE, 0
.equ GAMECODE_BPEE, 1
.equ GAMECODE_AXVE, 2
.equ GAMECODE, 0
.THUMB
.ALIGN 2
CMP R4, #1
BNE END
MOV R0, R5
MOV R1, #3
BL BOX
PUSH {R0-R7}
LDR R0, .SCRIPT
LDR R0, [R0]
LDR R1, .SCRIPT1
LDR R2, .SCRIPT2
CMP R0, R1
BEQ LOAD
CMP R0, R2
BNE END_
LOAD:
LDR R0, .8007
LDRH R0, [R0]
LSL R0, R0, #3
LDR R5, .TABLE
ADD R5, R0
LDR R0, [R5]
LDR R1, .TILE
SWI 0x12
MOV R2, R1
LDR R0, [R5, #4]
LDR R1, .PAL
SWI 0x12
MOV R0, #0x7F
LSL R0, R0, #8
ADD R0, #0xFF
STRH R0, [R1, #0x1E]
MOV R0, R2
MOV R6, #0x12
LSL R6, R6, #5
MOV R5, #0
LOOP_:
LDRB R1, [R0, R5]
LDRB R2, [R0, R5]
MOV R3, #0x0F
MOV R4, #0xF0
AND R1, R3
AND R2, R4
CMP R1, #0
BNE LAST
MOV R1, #0x0F
LAST:
LSR R3, R2, #4
CMP R3, #0
BNE CONTROL
MOV R2, #0xF0
CONTROL:
ORR R2, R1
ADD R5, #1
CMP R5, #2
BNE BYTE
LSL R2, R2, #8
ORR R7, R2
STRH R7, [R0]
ADD R0, #2
MOV R5, #0
B COUNTER
BYTE:
MOV R7, R2
COUNTER:
SUB R6, #1
BPL LOOP_
MOV R1, #0xD
LSL R1, R1, #12
ADD R1, R1, #1
MOV R2, #2
MOV R3, #2
LDR R0, .RAW
LOOP:
STRH R1, [R0]
ADD R0, #2
ADD R1, #1
SUB R2, #1
BPL LOOP
MOV R2, #2
ADD R0, #0x3A
SUB R3, #1
BPL LOOP
END_:
POP {R0-R7}
END:
POP {R4, R5}
POP {R0}
BX R0
BOX:
PUSH {R0}
LDR R0, .BOX
MOV R10, R0
POP {R0}
BX R10
.ALIGN 2
.if GAMECODE==0
.BOX: .word 0x08003F20+1
.RAW: .word 0x02001C6E
.PAL: .word 0x02037798
.SCRIPT: .word 0x03000EC4
.SCRIPT1: .word 0x081A6816
.SCRIPT2: .word 0x081A6820
.8007: .word 0x020370C0
.TABLE: .word 0x083D4294
.TILE: .word 0x06008020
.elseif GAMECODE==1
.BOX: .word 0x08003658+1
.RAW: .word 0x02001C70
.PAL: .word 0x02037CB4
.SCRIPT: .word 0x03000E54
.SCRIPT1: .word 0x08271C62
.SCRIPT2: .word 0x08271C85
.8007: .word 0x020375E0
.TABLE: .word 0x08614410
.TILE: .word 0x06008020
.else
.fail 0
.endif
In the asm routine, there is a red istruction:
Important notes:
- it's not compatible with Jpan's Hacked Engine, for now
- The routine works only with the type message 1 (MSG_FIND) of the giveitem:
#2 - Final Result:
These days i saw an update of an Italian hack, where there was a very interesting feature, that is the loading the image of items when they added to the bag.
Since it seemed like a nice thing to implement in our ROMs, today i'll explain how to do that!
# 1 - Hook and Routine asm
Spoiler:
FIRE RED:
Spoiler:
Let's get to the offset 080F6F08 and overwrite bytes with 00480047XXXXXX08Instead of XX the offset of asm routine will be inserted in little endian.
EMERALD:
Spoiler:
Let's get to the offset 081973E8 and overwrite bytes with 00480047XXXXXX08Instead of XX the offset of asm routine will be inserted in little endian.
Next, go to the offset 08099738 and overwrite the bytes present with 00 00.
Next, go to the offset 08099738 and overwrite the bytes present with 00 00.
Next we compile the following routine in a free offset within the rom:
Spoiler:
.equ GAMECODE_BPRE, 0
.equ GAMECODE_BPEE, 1
.equ GAMECODE_AXVE, 2
.equ GAMECODE, 0
.THUMB
.ALIGN 2
CMP R4, #1
BNE END
MOV R0, R5
MOV R1, #3
BL BOX
PUSH {R0-R7}
LDR R0, .SCRIPT
LDR R0, [R0]
LDR R1, .SCRIPT1
LDR R2, .SCRIPT2
CMP R0, R1
BEQ LOAD
CMP R0, R2
BNE END_
LOAD:
LDR R0, .8007
LDRH R0, [R0]
LSL R0, R0, #3
LDR R5, .TABLE
ADD R5, R0
LDR R0, [R5]
LDR R1, .TILE
SWI 0x12
MOV R2, R1
LDR R0, [R5, #4]
LDR R1, .PAL
SWI 0x12
MOV R0, #0x7F
LSL R0, R0, #8
ADD R0, #0xFF
STRH R0, [R1, #0x1E]
MOV R0, R2
MOV R6, #0x12
LSL R6, R6, #5
MOV R5, #0
LOOP_:
LDRB R1, [R0, R5]
LDRB R2, [R0, R5]
MOV R3, #0x0F
MOV R4, #0xF0
AND R1, R3
AND R2, R4
CMP R1, #0
BNE LAST
MOV R1, #0x0F
LAST:
LSR R3, R2, #4
CMP R3, #0
BNE CONTROL
MOV R2, #0xF0
CONTROL:
ORR R2, R1
ADD R5, #1
CMP R5, #2
BNE BYTE
LSL R2, R2, #8
ORR R7, R2
STRH R7, [R0]
ADD R0, #2
MOV R5, #0
B COUNTER
BYTE:
MOV R7, R2
COUNTER:
SUB R6, #1
BPL LOOP_
MOV R1, #0xD
LSL R1, R1, #12
ADD R1, R1, #1
MOV R2, #2
MOV R3, #2
LDR R0, .RAW
LOOP:
STRH R1, [R0]
ADD R0, #2
ADD R1, #1
SUB R2, #1
BPL LOOP
MOV R2, #2
ADD R0, #0x3A
SUB R3, #1
BPL LOOP
END_:
POP {R0-R7}
END:
POP {R4, R5}
POP {R0}
BX R0
BOX:
PUSH {R0}
LDR R0, .BOX
MOV R10, R0
POP {R0}
BX R10
.ALIGN 2
.if GAMECODE==0
.BOX: .word 0x08003F20+1
.RAW: .word 0x02001C6E
.PAL: .word 0x02037798
.SCRIPT: .word 0x03000EC4
.SCRIPT1: .word 0x081A6816
.SCRIPT2: .word 0x081A6820
.8007: .word 0x020370C0
.TABLE: .word 0x083D4294
.TILE: .word 0x06008020
.elseif GAMECODE==1
.BOX: .word 0x08003658+1
.RAW: .word 0x02001C70
.PAL: .word 0x02037CB4
.SCRIPT: .word 0x03000E54
.SCRIPT1: .word 0x08271C62
.SCRIPT2: .word 0x08271C85
.8007: .word 0x020375E0
.TABLE: .word 0x08614410
.TILE: .word 0x06008020
.else
.fail 0
.endif
In the asm routine, there is a red istruction:
Put 1 if you want the routine will be compiled for emerald, otherwise leave 0 if you want the routine works on red fire..equ GAMECODE, 0
Important notes:
- it's not compatible with Jpan's Hacked Engine, for now
- The routine works only with the type message 1 (MSG_FIND) of the giveitem:
giveitem 0xIndex 1 1
#2 - Final Result:
![[PokeCommunity.com] [FR/EM]Show item image when it added to the bag [PokeCommunity.com] [FR/EM]Show item image when it added to the bag](https://i.imgur.com/9qQLLYC.png)
Last edited: