GoGoJJTech
(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
- 2,475
- Posts
- 12
- Years
- Age 26
- Earth
- Seen Dec 9, 2016
HP Regeneration per step
Intro:
Basically a routine to regenerate a Pokemon's HP every step. In this routine it's set to 3 per step. You may want to modify the exact amount to a percentage or something (see the commented line).
How to insert:
First compile and insert the following routine into free space.
Spoiler:
Code:.text .align 2 .thumb .thumb_func main: push {r0-r7} ldr r0, =(0x2024284) mov r6, #0x0 ldr r7, =(0x2024029) ldrb r7, [r7] loop: cmp r6, r7 beq end mov r1, #0x64 mul r1, r1, r6 add r0, r0, r1 mov r5, r0 mov r1, #0x39 ldr r3, =(0x803FBE8 +1) bl linker mov r4, r0 cmp r4, #0x0 beq next mov r0, r5 mov r1, #0x3A ldr r3, =(0x803FBE8 +1) bl linker add r6, r6, #0x1 cmp r4, r0 beq loop addOn: add r4, r4, #0x3 @amount to add per step. Here it's 3 cmp r4, r0 ble cont mov r4, r0 cont: mov r0, r5 mov r1, #0x39 ldr r2, =(0x20370D0) strh r4, [r2] ldr r3, =(0x804037C) bl linker b loop next: add r6, r6, #0x1 b loop end: pop {r0-r7} lsl r0, r0, #0x18 lsr r0, r0, #0x18 cmp r0, #0x1 beq brancher mov r0, r5 ldr r1, =(0x806D600 +1) bx r1 brancher: ldr r0, =(0x806D650 +1) bx r0 linker: bx r3 .align 2
Now in a hex editor navigate to 0x6D5F6. There you will need to insert the following byte changes:
Where XX XX XX is the pointer to where you inserted the above routine +1.Code:01 4A 10 47 00 00 XX XX XX 08
Usage:
There isn't any usage. It's automatically done. You can change the amount generated by reading the line in the code which I've commented.
For Emerald (Changes in Red):
Spoiler:
Code:
.text
.align 2
.thumb
.thumb_func
main:
push {r0-r7}
[COLOR="Red"]ldr r0, =(0x20244EC) @Party Pokémon[/COLOR]
mov r6, #0x0
[COLOR="red"]ldr r7, =(0x20244E9) @Party Quantity[/COLOR]
ldrb r7, [r7]
loop:
cmp r6, r7
beq end
mov r1, #0x64
mul r1, r1, r6
add r0, r0, r1
mov r5, r0
mov r1, #0x39
[COLOR="red"]ldr r3, =(0x806A518 +1) @Pokemon Get Attribute[/COLOR]
bl linker
mov r4, r0
cmp r4, #0x0
beq next
mov r0, r5
mov r1, #0x3A
[COLOR="red"]ldr r3, =(0x806A518 +1) @Pokemon Get Attribute[/COLOR]
bl linker
add r6, r6, #0x1
cmp r4, r0
beq loop
addOn:
add r4, r4, #0x3 @amount to add per step. Here it's 3
cmp r4, r0
ble cont
mov r4, r0
cont:
mov r0, r5
mov r1, #0x39
[COLOR="Red"]ldr r2, =(0x20375F0) @Var 0x800D (Lastresult)[/COLOR]
strh r4, [r2]
[COLOR="red"]ldr r3, =(0x806ACAC) @Pokemon Set Attribute[/COLOR]
bl linker
b loop
next:
add r6, r6, #0x1
b loop
end:
pop {r0-r7}
lsl r0, r0, #0x18
lsr r0, r0, #0x18
cmp r0, #0x1
beq brancher
mov r0, r5
[COLOR="red"]ldr r1, =(0x809C8F4 +1)[/COLOR]
bx r1
brancher:
[COLOR="red"]ldr r0, =(0x809C92E +1) @This may actually fail the routine, needs testing[/COLOR]
bx r0
linker:
bx r3
.align 2
Insert at 0x9C8EA.