Registrarse

[Rutina] [ASM] Quick Fix on Day/Night Item Held Evolution Routine

jiangzhengwenjz

Usuario mítico
This can be called a 'tiny' hack, which is requested by a friend of mine.
Usage is listed in the comment.

The routines are for FR, but can be easily ported to EM which is an obvious fact.

You should change the values in .set to make it work.

Day Item Held Evolution Routine:
Código:
.thumb
#For Firered, include it in the evolution method table

.set Time, 0x3005542
.set EvoExit, 0x8043111
.set Evolve, 0x804310D
.set Decrypter, 0x803FBE9

ldr r0, =Time
ldrb r0, [r0]
cmp r0, #0x15
bge exit
cmp r0, #6
blt exit

DecryptItem:
add r1, r6, r7
lsl r1, r1, #0x3
add r1, r2, r1
add r1, r1, r3
push {r1-r4}
ldrh r4, [r1, #0x2]
mov r0, r8
mov r1, #0xc
ldr r3, =Decrypter
bl bx_r3
cmp r0, r4
bne exit2
pop {r1-r4}
ldr r0, =Evolve
bx r0

exit2:
pop {r1-r4}

exit:
ldr r0, =EvoExit
bx r0

bx_r3:
bx r3
.ltorg
Night Item Held Evolution Routine:
Código:
.thumb
#For Firered, include it in the evolution method table

.set Time, 0x3005542
.set EvoExit, 0x8043111
.set Evolve, 0x804310D
.set Decrypter, 0x803FBE9

ldr r0, =Time
ldrb r0, [r0]
cmp r0, #0x15
bge DecryptItem
cmp r0, #6
bge exit

DecryptItem:
add r1, r6, r7
lsl r1, r1, #0x3
add r1, r2, r1
add r1, r1, r3
push {r1-r4}
ldrh r4, [r1, #0x2]
mov r0, r8
mov r1, #0xc
ldr r3, =Decrypter
bl bx_r3
cmp r0, r4
bne exit2
pop {r1-r4}
ldr r0, =Evolve
bx r0

exit2:
pop {r1-r4}

exit:
ldr r0, =EvoExit
bx r0

bx_r3:
bx r3
.ltorg
To fix the item deletion issue:
Código:
#Firered: put 00 48 00 47 XX+1 XX XX 08 at 0x80CED68

.set IndexOfDayHeldItem, 0x10
.set IndexOfNightHeldItem, 0x11

.set Encrypt, 0x804037D
.set Decrypt, 0x803FBE9
.set BackAddr, 0x80CED71
.set EvoTable, 0x8259754

.thumb
mov r0, r9
mov r1, #0xb
ldr r3, =Decrypt
bl bx_r3
ldr r1, =EvoTable
mov r2, #40
mul r0, r2
add r0, r1, r0
ldrh r0, [r0]
cmp r0, #IndexOfDayHeldItem
beq ItemReduction
cmp r0, #IndexOfNightHeldItem
bne back

ItemReduction:
mov r0, r9
mov r1, #0xc
mov r2, #0
str r2, [sp]
mov r2, sp
ldr r3, =Encrypt
bl bx_r3

back:
mov r0, r9
mov r1, #0xB
mov r2, r4
add r2, #0xC
ldr r3, =Encrypt
bl bx_r3
mov r0, r9
ldr r3, =BackAddr

bx_r3:
bx r3
.ltorg
Some may ask how to make it support evolution table with 8 evolution method, and I can tell you that you should just do these steps: (Not tested)
1. Change the add r1, r6, r7 in the first 2 routines to lsl r1, r6, #1.
2. Change the offset of the evolution table to yours in routine 3.
3. Change #40 to #64 in routine 3.

Another thing is that you should implement interdpth's RTC routine, which is also available in the tool DNS made by Prime Dialga. Make sure that the evolution method is the first evolution method of that pokemon in your evolution table as well.
 
Última edición:
Arriba