mkarthick98
Tensai
- 44
- Posts
- 10
- Years
- India
- Seen Nov 9, 2016
Could you write an ASM script to name the hero in the overworld? I want to use this, since I intend to skip the intro, while still allowing the user to name themselves.
Could you write an ASM script to name the hero in the overworld? I want to use this, since I intend to skip the intro, while still allowing the user to name themselves.
0x6F09C - 00 48 00 47 XX+1 XX XX 08
change all the 0x8750000 in the routine to the insert offset of the routine.
change all the 0x8750001 in the routine to the insert offset + 1 of the routine.
.thumb
bl box_func
ldr r1, =0x20370FF
ldrb r0, [r1]
add r0, #1
strb r0, [r1]
mov r0, #0
add sp, sp, #0xC
pop {r4, pc}
.ltorg
box_func:
push {r4, lr}
ldr r4, =0x2037101
ldr r0, =(0x8750000 + rbox_config)
ldr r3, =0x8003ce5
bl call_r3
strb r0, [r4]
ldr r3, =0x8003fa1
bl call_r3
ldrb r0, [r4]
mov r1, #0
ldr r3, =0x80F6F1D
bl call_r3
bl print_string
ldr r0, =(0x8750001 + print_string)
mov r1, #2
ldr r3, =0x807741D
bl call_r3
ldr r1, =0x20370C0
strh r0, [r1]
pop {r4, pc}
.ltorg
print_string:
push {r4-r7, lr}
sub sp, sp, #0xC
ldr r0, =0x2021cd0
add r7, r0, #0
ldr r1, =0x300553c
ldrb r5, [r1, #7] @minute
ldrb r6, [r1, #8] @second
ldrb r1, [r1, #6] @hour
mov r2, #1
mov r3, #2
ldr r4, =0x8008E79
bl call_r4
bl go_padding
ldr r0, =0x2021CF0
add r7, r0, #0
add r1, r5, #0
mov r2, #1
mov r3, #2
ldr r4, =0x8008e79
bl call_r4
bl go_padding
ldr r0, =0x2021d04
add r7, r0, #0
add r1, r6, #0
mov r2, #1
mov r3, #2
ldr r4, =0x8008e79
bl call_r4
bl go_padding
ldr r5, =0x2021D18
ldr r1, =(0x8750000 + string)
add r0, r5, #0
ldr r3, =0x8008FCD
bl call_r3
ldr r0, =0x2037101
ldrb r0, [r0]
mov r1, #3
str r1, [sp]
mov r1, #0xff
str r1, [sp, #4]
mov r1, #0
str r1, [sp, #8]
mov r1, #2
add r2, r5, #0
mov r3, #4
ldr r4, =0x8002C49
bl call_r4
ldr r0, =0x2037101
ldrb r0, [r0]
mov r1, #2
ldr r3, =0x8003F21
bl call_r3
add sp, sp, #0xC
pop {r4-r7, pc}
.ltorg
go_padding:
push {lr}
ldrb r0, [r7]
cmp r0, #0
bne back
mov r0, #0xa1
strb r0, [r7]
back:
pop {pc}
call_r3:
bx r3
call_r4:
bx r4
.align 2
rbox_config:
.byte 0x0 @bg_id
.byte 0x1 @x
.byte 0x1 @y
.byte 0xa @width
.byte 0x2 @height
.byte 0xf
.hword 0x8 @tileset_ofs
.word 0x8419f76 @pixels
.align 2
string:
.byte 0xce, 0xdd, 0xe1, 0xd9, 0xf0, 0xfd, 0x2, 0xf0, 0xfd, 0x3, 0xf0, 0xfd, 0x4, 0xff
0x6EF1E - 00 00 00 49 08 47 YY+1 YY YY 08
.thumb
cmp r0, #1
beq safari
ldr r0, =0x20370C0
ldrh r0, [r0]
ldr r3, =0x8077509
bl call_r3
safari:
ldr r4, =0x02037101
ldrb r0, [r4]
mov r1, #0
ldr r3, =0x806ef29
call_r3:
bx r3
0x6f4e8 - 00 48 00 47 ZZ+1 ZZ ZZ 08
.thumb
push {lr}
ldr r0, =0x20370c0
ldrh r0, [r0]
ldr r3, =0x8077509
bl call_r3
ldr r1, =0x20370F0
ldr r0, =0x806f5a5
str r0, [r1]
mov r0, #0
pop {pc}
call_r3:
bx r3
Time Box triggered along with the Start Menu
Preview: (Click to see the GIF animation)
View attachment 77173
The routines are only for FR. I haven't found any bugs in it. However, the CPU will run much more instructions so that it will be a bit (really?) slower when you open the 'pokemon', 'bag'..... menus.
1) Insert the RTC routine via the tool 'DNS'.
2) Insert these routines and do the byte changes:
Routine I:
Routine II:Spoiler:byte changes:
routine:Code:0x6F09C - 00 48 00 47 XX+1 XX XX 08 change all the 0x8750000 in the routine to the insert offset of the routine. change all the 0x8750001 in the routine to the insert offset + 1 of the routine.
Code:.thumb bl box_func ldr r1, =0x20370FF ldrb r0, [r1] add r0, #1 strb r0, [r1] mov r0, #0 add sp, sp, #0xC pop {r4, pc} .ltorg box_func: push {r4, lr} ldr r4, =0x2037101 ldr r0, =(0x8750000 + rbox_config) ldr r3, =0x8003ce5 bl call_r3 strb r0, [r4] ldr r3, =0x8003fa1 bl call_r3 ldrb r0, [r4] mov r1, #0 ldr r3, =0x80F6F1D bl call_r3 bl print_string ldr r0, =(0x8750001 + update_func) mov r1, #2 ldr r3, =0x807741D bl call_r3 ldr r1, =0x20370C0 strh r0, [r1] pop {r4, pc} .ltorg update_func: push {lr} bl print_string pop {pc} print_string: push {r4-r7, lr} sub sp, sp, #0xC ldr r0, =0x2021cd0 add r7, r0, #0 ldr r1, =0x300553c ldrb r5, [r1, #7] @minute ldrb r6, [r1, #8] @second ldrb r1, [r1, #6] @hour mov r2, #1 mov r3, #2 ldr r4, =0x8008E79 bl call_r4 bl go_padding ldr r0, =0x2021CF0 add r7, r0, #0 add r1, r5, #0 mov r2, #1 mov r3, #2 ldr r4, =0x8008e79 bl call_r4 bl go_padding ldr r0, =0x2021d04 add r7, r0, #0 add r1, r6, #0 mov r2, #1 mov r3, #2 ldr r4, =0x8008e79 bl call_r4 bl go_padding ldr r5, =0x2021D18 ldr r1, =(0x8750000 + string) add r0, r5, #0 ldr r3, =0x8008FCD bl call_r3 ldr r0, =0x2037101 ldrb r0, [r0] mov r1, #3 str r1, [sp] mov r1, #0xff str r1, [sp, #4] mov r1, #0 str r1, [sp, #8] mov r1, #2 add r2, r5, #0 mov r3, #4 ldr r4, =0x8002C49 bl call_r4 ldr r0, =0x2037101 ldrb r0, [r0] mov r1, #2 ldr r3, =0x8003F21 bl call_r3 add sp, sp, #0xC pop {r4-r7, pc} .ltorg go_padding: push {lr} ldrb r0, [r7] cmp r0, #0 bne back mov r0, #0xa1 strb r0, [r7] back: pop {pc} call_r3: bx r3 call_r4: bx r4 .align 2 rbox_config: .byte 0x0 @bg_id .byte 0x1 @x .byte 0x1 @y .byte 0xa @width .byte 0x2 @height .byte 0xf .hword 0x8 @tileset_ofs .word 0x8419f76 @pixels .align 2 string: .byte 0xce, 0xdd, 0xe1, 0xd9, 0xf0, 0xfd, 0x2, 0xf0, 0xfd, 0x3, 0xf0, 0xfd, 0x4, 0xff
Routine III:Spoiler:byte changes:
routine:Code:0x6EF1E - 00 00 00 49 08 47 YY+1 YY YY 08
Code:.thumb cmp r0, #1 beq safari ldr r0, =0x20370C0 ldrh r0, [r0] ldr r3, =0x8077509 bl call_r3 safari: ldr r4, =0x02037101 ldrb r0, [r4] mov r1, #0 ldr r3, =0x806ef29 call_r3: bx r3
Spoiler:byte changes:
routine:Code:0x6EF1E - 00 00 00 49 08 47 YY+1 YY YY 08
Code:.thumb push {lr} ldr r0, =0x20370c0 ldrh r0, [r0] ldr r3, =0x8077509 bl call_r3 ldr r1, =0x20370F0 ldr r0, =0x806f5a5 str r0, [r1] mov r0, #0 pop {pc} call_r3: bx r3
Seems cool, but I suggest you to change something. Why don't you link this functionality to an unused button such as R (remember we can use these two buttons if properly configured)?
Also it would be very interesting to have the option to display this "clock-box" anytime we want via scripting. I'm not sure but by a quick look, it seems to me that the one that displays it is the second one, isn't it??
You should explain, almost briefly, how do this work, anyway, awesome system :D
First Side Routine Rewrite
A rewrite of the pokemon turn order comparison routine during battles. It does not add any new features but decomposes the routine into a routine with 3 sub-modules which makes it easier to add new speed altering abilities and items (hooking in the original one required to make dual checks).
The rewrite also avoids redundant calculations. For example, if move priorities do not match then no need to calculate and compare effective speeds of the banked mons.
One of the sub-module returns the effective speed of the banked mon so it can readily used for accurate base power calculation of Gyro Ball and Electro Ball.
Spoiler:
.text
.align 2
.thumb
.thumb_func
.global bc_firstside_rewrite_hack
.org 0x14cD8
@MIf the modifed routine crosses x150A8 a hook will be required.
@Current Length: x220 bytes. Ends at x14f08
Main:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
add sp, #-0x4
lsl r0, r0, #0x18
lsr r0, r0, #0x18 @Bank1
mov r9, r0
lsl r1, r1, #0x18
lsr r1, r1, #0x18
mov r10, r1 @Bank2
mov r0, #0x0
str r0, [sp, #0x0]
TurnModeCheck:
cmp r2, #0x0
bne SpeedCheck
CheckPriority:
mov r0, r9
bl LoadSelectionPriority
lsl r0, r0, #0x18
asr r3, r0, #0x18
mov r8, r3
mov r0, r10
bl LoadSelectionPriority
lsl r0, r0, #0x18
asr r4, r0, #0x18
mov r3, r8
cmp r3, r4
beq SpeedCheck
cmp r3, r4
bge Exit @First Bank Wins
mov r2, #0x1 @Second Bank Wins
str r2, [sp, #0x0]
b Exit
SpeedCheck:
mov r0, r9
bl BracketAlteration
mov r8, r0
mov r0, r10
bl BracketAlteration
mov r4, r0
mov r3, r8
cmp r3, r4
beq LoadBankSpeeds
cmp r3, r4
bge Exit @First Bank Wins
mov r2, #0x1 @Second Bank Wins
str r2, [sp, #0x0]
b Exit
LoadBankSpeeds:
mov r0, r9
bl GetSpeed
mov r8, r0
mov r0, r10
bl GetSpeed
mov r4, r0
mov r3, r8
cmp r3, r4
bne NoTie
bl 0x44EC8
mov r1, #0x1
and r0, r1
cmp r0, #0x0
bne Exit
mov r2, #0x2 @Speed Tied
str r2, [sp, #0x0]
b Exit
NoTie:
cmp r3, r4 @This can be Reversed for Trick Room
bcs Exit @First Bank Wins
mov r2, #0x1 @Second Bank Wins
str r2, [sp, #0x0]
Exit:
ldr r0, [sp, #0x0]
add sp, #0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.align 2
LoadSelectionPriority:
mov r3, r0
LoadMenuChoice:
ldr r0, .MenuChoice
add r1, r3, r0
mov r0, #0x0
ldrb r1, [r1]
cmp r1, #0x0
bne Exit2
FightOptionChosen:
ldr r0, .ProtectStruct
lsl r1, r3, #0x4
add r1, r1, r0
ldrb r0, [r1]
lsl r0, r0, #0x1D
cmp r0, #0x0
bge LoadMoveIndex
Struggle:
mov r4, #0xA5
b LoadPriority
LoadMoveIndex:
ldr r0, .DP08_Pointer
ldr r0, [r0, #0x0]
add r0, r3
add r0, #0x80
ldrb r0, [r0] @Moveset Slot No. Chosen
lsl r0, r0, #0x1
mov r1, #0x58
mul r1, r3
add r0, r0, r1
ldr r1, .BattleStruct
add r0, r0, r1
ldrh r4, [r0, #0xC]
LoadPriority:
ldr r2, .MoveData
lsl r0, r4, #0x1
add r0, r0, r4
lsl r0, r0, #0x2
add r0, r0, r2
ldrb r0, [r0, #0x7]
@Gale Wings And Prankster can be added here easily
Exit2:
bx lr
.align 2
.MenuChoice: .word 0x02023D7C
.ProtectStruct: .word 0x02023E8C
.DP08_Pointer: .word 0x02023FE8
.BattleStruct: .word 0x02023Be4
.MoveData: .word 0x08250c04
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.align 2
BracketAlteration: @Return 1 if Quick Claw activates, otherwise 0. Can be called in the
use of Quick Claw Message Battle Script
push {lr}
mov r7, #0x0
mov r3, r0
mov r1, #0x58
ldr r0, .BattleStruct2
mul r1, r3
add r4, r0, r1
CheckItem:
ldrh r0, [r4, #0x2e]
cmp r0, #0xAF
bne LoadItemEffect
EnigmaBerry:
ldr r1, .EnigmaRamArea
lsl r0, r3, #0x3
sub r0, r0, r3
lsl r0, r0, #0x2
add r0, r0, r1
ldrb r6, [r0, #0x7]
ldrb r5, [r0, #0x1A]
b QuickClawCheck
LoadItemEffect:
bl 0x09A924
lsl r0, r0, #0x18
lsr r6, r0, #0x18
ldrh r0, [r4, #0x2e]
bl 0x09A948
lsl r0, r0, #0x18
lsr r5, r0, #0x18
QuickClawCheck: @Can be expanded to include Custap Berry, Lagging Tail, Stall
cmp r6, #0x1A
bne Exit3
LoadActivationChance:
ldr r0, .RandomNoLoc
ldrh r4, [r0]
lsl r0, r5, #0x10
sub r0, r0, r5
mov r1, #0x64
bl 0x1E4018
cmp r4, r0
bge Exit3
mov r7, #0x1
Exit3:
mov r0, r7
PopRegister:
pop {r1}
bx r1
.align 2
.BattleStruct2: .word 0x2023Be4
.RandomNoLoc: .word 0x2023E80
.EnigmaRamArea: .word 0x2023F54
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.align 2
@The speed BL that can be used for Gyro Ball and Electro Ball.
@All speed abilities will go here
GetSpeed:
push {lr}
add sp, #-0x4
mov r7, r0
mov r5, #0x58
ldr r6, .BattleStruct3
mul r5, r7
add r6, r5, r6
mov r5, #0x1
str r0, [sp, #0x0]
CloudNineCheck:
mov r0, #0x13
mov r1, #0x0
mov r2, #0xD
mov r3, #0x0
bl 0x019F18
lsl r0, r0, #0x18
cmp r0, #0x0
bne CheckStat
AirLockCheck:
mov r0, #0x0
str r0, [sp, #0x0]
mov r0, #0x13
mov r1, #0x0
mov r2, #0x4D
mov r3, #0x0
bl 0x019F18
lsl r0, r0, #0x18
cmp r0, #0x0
bne CheckStat
LoadWeather:
ldr r4, .WeatherFlags
ldrh r4, [r4]
mov r2, r6 r2 wasn't safe after calling ability_something
add r2, #0x20
ldrb r2, [r2]
CheckRain:
mov r0, #0x7
and r0, r4
cmp r0, #0x0
beq CheckSunlight
cmp r2, #0x21
beq WeatherBoost
CheckSunlight:
mov r0, #0x60
and r0, r4
cmp r0, #0x0
beq CheckStat
cmp r2, #0x22
bne CheckStat
WeatherBoost:
mov r5, #0x2
CheckStat:
MultiplySpeedAccToStat:
ldrh r3, [r6, #0x6]
mul r5, r3 @Speed
ldr r2, .StatFactors
ldrb r1, [r6, #0x1B]
lsl r1, r1, #0x1
add r2, r1, r2
ldrb r0, [r2]
mul r0, r5
ldrb r1, [r2, #0x1]
bl 0x1E4018
mov r4, r0 @Speed
CheckItem2:
ldrh r0, [r6, #0x2e]
cmp r0, #0xAF
bne LoadItemEffect2
EnigmaBerry2:
ldr r1, .EnigmaRamArea2
lsl r0, r7, #0x3
sub r0, r0, r3
lsl r0, r0, #0x2
add r0, r0, r1
ldrb r0, [r0, #0x7]
b MachoCheck
LoadItemEffect2:
bl 0x09a924
lsl r0, r0, #0x18
lsr r0, r0, #0x18
MachoCheck:
cmp r0, #0x18
bne ParalysisCheck
lsr r4, r4, #0x1
ParalysisCheck:
ldr r0, [r6, #0x4C]
mov r1, #0x40
and r0, r1
cmp r0, #0x0
beq Exit4
lsr r4, r4, #0x2
Exit4:
mov r0, r4
add sp, #0x4
pop {r1}
bx r1
.align 2
.BattleStruct3: .word 0x2023Be4
.WeatherFlags: .word 0x2023F1c
.StatFactors: .word 0x825DEAD
.EnigmaRamArea2: .word 0x2023F54
.text
.align 2
.thumb
.thumb_func
.global bc_firstside_rewrite_hack
.org 0x3CF10, 0xFF
@MIf the modifed routine crosses x3D2E6 a hook will be required.
@Current Length: x220 bytes.
Main:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
add sp, #-0x4
lsl r0, r0, #0x18
lsr r0, r0, #0x18 @Bank1
mov r9, r0
lsl r1, r1, #0x18
lsr r1, r1, #0x18
mov r10, r1 @Bank2
mov r0, #0x0
str r0, [sp, #0x0]
TurnModeCheck:
cmp r2, #0x0
bne SpeedCheck
CheckPriority:
mov r0, r9
bl LoadSelectionPriority
lsl r0, r0, #0x18
asr r3, r0, #0x18
mov r8, r3
mov r0, r10
bl LoadSelectionPriority
lsl r0, r0, #0x18
asr r4, r0, #0x18
mov r3, r8
cmp r3, r4
beq SpeedCheck
cmp r3, r4
bge Exit @First Bank Wins
mov r2, #0x1 @Second Bank Wins
str r2, [sp, #0x0]
b Exit
SpeedCheck:
mov r0, r9
bl BracketAlteration
mov r8, r0
mov r0, r10
bl BracketAlteration
mov r4, r0
mov r3, r8
cmp r3, r4
beq LoadBankSpeeds
cmp r3, r4
bge Exit @First Bank Wins
mov r2, #0x1 @Second Bank Wins
str r2, [sp, #0x0]
b Exit
LoadBankSpeeds:
mov r0, r9
bl GetSpeed
mov r8, r0
mov r0, r10
bl GetSpeed
mov r4, r0
mov r3, r8
cmp r3, r4
bne NoTie
bl 0x6F5CC @ Emerald
mov r1, #0x1
and r0, r1
cmp r0, #0x0
bne Exit
mov r2, #0x2 @Speed Tied
str r2, [sp, #0x0]
b Exit
NoTie:
cmp r3, r4 @This can be Reversed for Trick Room
bcs Exit @First Bank Wins
mov r2, #0x1 @Second Bank Wins
str r2, [sp, #0x0]
Exit:
ldr r0, [sp, #0x0]
add sp, #0x4
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.align 2
LoadSelectionPriority:
mov r3, r0
LoadMenuChoice:
ldr r0, .MenuChoice
add r1, r3, r0
mov r0, #0x0
ldrb r1, [r1]
cmp r1, #0x0
bne Exit2
FightOptionChosen:
ldr r0, .ProtectStruct
lsl r1, r3, #0x4
add r1, r1, r0
ldrb r0, [r1]
lsl r0, r0, #0x1D
cmp r0, #0x0
bge LoadMoveIndex
Struggle:
mov r4, #0xA5
b LoadPriority
LoadMoveIndex:
ldr r0, .DP08_Pointer
ldr r0, [r0, #0x0]
add r0, r3
add r0, #0x80
ldrb r0, [r0] @Moveset Slot No. Chosen
lsl r0, r0, #0x1
mov r1, #0x58
mul r1, r3
add r0, r0, r1
ldr r1, .BattleStruct
add r0, r0, r1
ldrh r4, [r0, #0xC]
LoadPriority:
ldr r2, .MoveData
lsl r0, r4, #0x1
add r0, r0, r4
lsl r0, r0, #0x2
add r0, r0, r2
ldrb r0, [r0, #0x7]
@Gale Wings And Prankster can be added here easily
Exit2:
bx lr
.align 2
.MenuChoice: .word 0x0202421C @ Emerald
.ProtectStruct: .word 0x0202433C @ Emerald
.DP08_Pointer: .word 0x0202449C @ Emerald
.BattleStruct: .word 0x02024084 @ Emerald
.MoveData: .word 0x831C898 @ Emerald
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.align 2
BracketAlteration: @Return 1 if Quick Claw activates, otherwise 0. Can be called in the
@use of Quick Claw Message Battle Script
push {lr}
mov r7, #0x0
mov r3, r0
mov r1, #0x58
ldr r0, .BattleStruct2
mul r1, r3
add r4, r0, r1
CheckItem:
ldrh r0, [r4, #0x2e]
cmp r0, #0xAF
bne LoadItemEffect
EnigmaBerry:
ldr r1, .EnigmaRamArea
lsl r0, r3, #0x3
sub r0, r0, r3
lsl r0, r0, #0x2
add r0, r0, r1
ldrb r6, [r0, #0x7]
ldrb r5, [r0, #0x1A]
b QuickClawCheck
LoadItemEffect:
bl 0x0D74DC @ Emerald
lsl r0, r0, #0x18
lsr r6, r0, #0x18
ldrh r0, [r4, #0x2e]
bl 0x0D7500 @ Emerald
lsl r0, r0, #0x18
lsr r5, r0, #0x18
QuickClawCheck: @Can be expanded to include Custap Berry, Lagging Tail, Stall
cmp r6, #0x1A
bne Exit3
LoadActivationChance:
ldr r0, .RandomNoLoc
ldrh r4, [r0]
lsl r0, r5, #0x10
sub r0, r0, r5
mov r1, #0x64
bl 0x2E7540 @ Emerald
cmp r4, r0
bge Exit3
mov r7, #0x1
Exit3:
mov r0, r7
PopRegister:
pop {r1}
bx r1
.align 2
.BattleStruct2: .word 0x2024084 @ Emerald
.RandomNoLoc: .word 0x2024330 @ Emerald
.EnigmaRamArea: .word 0x2024404 @ Emerald
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
.align 2
@The speed BL that can be used for Gyro Ball and Electro Ball.
@All speed abilities will go here
GetSpeed:
push {lr}
add sp, #-0x4
mov r7, r0
mov r5, #0x58
ldr r6, .BattleStruct3
mul r5, r7
add r6, r5, r6
mov r5, #0x1
str r0, [sp, #0x0]
CloudNineCheck:
mov r0, #0x13
mov r1, #0x0
mov r2, #0xD
mov r3, #0x0
bl 0x42828 @ Emerald ability_something
lsl r0, r0, #0x18
cmp r0, #0x0
bne CheckStat
AirLockCheck:
mov r0, #0x0
str r0, [sp, #0x0]
mov r0, #0x13
mov r1, #0x0
mov r2, #0x4D
mov r3, #0x0
bl 0x42828 @ Emerald ability_something
lsl r0, r0, #0x18
cmp r0, #0x0
bne CheckStat
LoadWeather:
ldr r4, .WeatherFlags
ldrh r4, [r4]
[B]mov r2, r6[/B] @ r2 wasn't safe after calling ability_something
add r2, #0x20
ldrb r2, [r2]
CheckRain:
mov r0, #0x7
and r0, r4
cmp r0, #0x0
beq CheckSunlight
cmp r2, #0x21
beq WeatherBoost
CheckSunlight:
mov r0, #0x60
and r0, r4
cmp r0, #0x0
beq CheckStat
cmp r2, #0x22
bne CheckStat
WeatherBoost:
mov r5, #0x2
CheckStat:
MultiplySpeedAccToStat:
ldrh r3, [r6, #0x6]
mul r5, r3 @Speed
ldr r2, .StatFactors
ldrb r1, [r6, #0x1B]
lsl r1, r1, #0x1
add r2, r1, r2
ldrb r0, [r2]
mul r0, r5
ldrb r1, [r2, #0x1]
bl 0x2E7540 @ Emerald
mov r4, r0 @Speed
CheckItem2:
ldrh r0, [r6, #0x2e]
cmp r0, #0xAF
bne LoadItemEffect2
EnigmaBerry2:
ldr r1, .EnigmaRamArea2
lsl r0, r7, #0x3
sub r0, r0, r3
lsl r0, r0, #0x2
add r0, r0, r1
ldrb r0, [r0, #0x7]
b MachoCheck
LoadItemEffect2:
bl 0x0D74DC @ Emerald
lsl r0, r0, #0x18
lsr r0, r0, #0x18
MachoCheck:
cmp r0, #0x18
bne ParalysisCheck
lsr r4, r4, #0x1
ParalysisCheck:
ldr r0, [r6, #0x4C]
mov r1, #0x40
and r0, r1
cmp r0, #0x0
beq Exit4
lsr r4, r4, #0x2
Exit4:
mov r0, r4
add sp, #0x4
pop {r1}
bx r1
.align 2
.BattleStruct3: .word 0x2024084 @ Emerald
.WeatherFlags: .word 0x20243CC @ Emerald
.StatFactors: .word 0x8329D2E @ Emerald
.EnigmaRamArea2: .word 0x2024404 @ Emerald
Found a bug, when the player is down to 2 Pokemon and one dies in battle, you cannot exit the "choose your next Pokemon" menu. As a sorta fix for anyone who wants it, right afterBattle Modes addon: Delete fainted Pokemon
For those hackers who like minigames, this routine will delete Pokemon who have fainted in battle. There's a few things that need to happen for this effect to occur.
1) Pokemon who die in battle must be deleted
2) Eggs are spared
3) Pokemon who die outside of battle must be deleted (Poison or another similar effect)
However, if you put this in turn basis, you will NEED to make another routine to delete the Player's party if he/she loses the match. This is because the turn counter isn't reached on the last turn the player loses :x
If you're lazy like me you can just put this routine in as a battle by move addon and cover the whiteout case. Which is actually fine. It's rather fast, because it deletes the Pokemon as they die, so the worse case scenario is unforeseeable. And if a Pokemon dies it will only need to loop 5 times only doing operations on one of the 5 loops. If you're curious looping a maximum of 21 times is the worst case scenario (all 6 of your Pokemon die in 1 turn i.e never, and even if that did happen it'd be done in less .25 seconds). So it's fine to put in the battle by move section without expecting the game to lag.
How to insert:
Insert as addon to battle modes battle by move.
You will notice that near the start of the routine there is some commented out code (denoted by a prefix "@" symbol). That's for a flag check. Change [flag/4] = your flag/4 in hex if you want to toggle by flag. Of course the normal battle mode toggle flag should be used as well.
Spoiler:
Code:.text .align 2 .thumb .thumb_func main: push {r0-r5, lr} @mov r0, #0x[flag/4] @lsl r0, r0, #0x2 @ldr r3, =(0x806E6D0 +1) @bl linker @cmp r0, #0x0 @beq end ldr r0, =(0x2023E8A) ldrb r0, [r0] cmp r0, #0x0 beq realEnd mov r5, #0x0 loop: ldr r0, =(0x2024029) ldrb r4, [r0] cmp r5, r4 beq end ldr r0, =(0x2024284) mov r1, #0x64 mul r1, r1, r5 @slot add r0, r0, r1 @address mov r1, #0x39 @C_HP ldr r3, =(0x803FBE8 +1) bl linker cmp r0, #0x0 beq adjustSlots skip: add r5, r5, #0x1 b loop adjustSlots: cmp r5, #0x5 bge writeLastZero mov r2, #0x5 sub r2, r2, r5 mov r0, #0x64 mul r2, r2, r0 @size mov r1, r5 mul r1, r1, r0 ldr r0, =(0x2024284) add r0, r0, r1 @dest mov r1, #0x64 add r1, r0, r1 @src ldr r3, =(0x8040B08 +1) bl linker writeLastZero: ldr r0, =(0x2024478) mov r1, #0x0 mov r2, #0x64 ldr r3, =(0x81E5ED8 +1) bl linker correctCounters: ldr r0, =(0x2024029) ldrb r1, [r0] sub r1, r1, #0x1 strb r1, [r0] next: mov r5, #0x0 b loop end: ldr r0, =(0x2024029) ldrb r0, [r0] cmp r0, #0x0 bne realEnd mov r0, #0x5E lsl r0, r0, #0x4 ldr r3, =(0x806E6A8 +1) bl linker b realEnd linker: bx r3 realEnd: pop {r0-r5, pc} .align 2
Usage:
If you opted to use a flag, set it to allow further battles to delete Pokemon as they faint. If you didn't just sit back and let the unicorns inside the game do the rest.
loop:
ldr r0, =(0x2024029)
ldrb r4, [r0]
cmp r5, r4
beq end
cmp r4, #0x1
beq end
loop:
ldr r0, =(0x2024029)
ldrb r4, [r0]
cmp r5, r4
beq end
cmp r4, #0x1
beq end
Wild double battles
I had inserted all the routines in my hack and I'm kind of glad that it doesn't crash the game or make any unwanted errors, well my problem is even though I set the percentage value of double wild pokemon appearance to 64, which is 100%, nothing happens. The grass ID is the default, 0xD, and all are fine.
Do you have any idea why setting it to 64 doesn't create a 100% double wild pokemon appearance?
You should have at least 2 Pokemon in your team lol
If it still doesn't work, see VM.
*facepalm*
as you can see in the video, I only have 2 Pokemon in my party but when 1 of my pokemon faints, it asks to use another pokemon
oh-oh... That's really a glitch never occurred in my mind TAT However, I'm quite busy these days for exam so I can only promise that I will see the problem in the winter vacation in February.
OK, I haven't taken a look at those "switch" points.When you press no, instead of letting your one pokemon as your last, you'll run into the battle,
WADAFAK, I've never encountered with those bugs, sorry.also, there are instances that your pokemon's name will be changed to an undescribable weird letters,
sometimes, the hb gets translated to number rather than HP bar image itself,
That's meant to imitate the Gen V feature, in which you can't throw a ball when there're 2 pokemon on the field. It also prevent many bugs from occurring.anyway, it's still a good feature and thanks for sharing it, I do really hope that it will be possible to throw a ball in a 2v2 battle
I'm sorry for those terrible bugs. As I've said, the system is not yet complete and I've only fixed some of the existing bugs and I think its main purpose is to provide some information for other hackers. If the rest bugs can't be fixed recently, I will take a look at them in Feb approximately.
OK, I haven't taken a look at those "switch" points.
WADAFAK, I've never encountered with those bugs, sorry.
That's meant to imitate the Gen V feature, in which you can't throw a ball when there're 2 pokemon on the field. It also prevent many bugs from occurring.
I'm sorry for those terrible bugs. As I've said, the system is not yet complete and I've only fixed some of the existing bugs and I think its main purpose is to provide some information for other hackers. If the rest bugs can't be fixed recently, I will take a look at them in Feb approximately.
[list][B]Toggling Runaway[/B][/list]
[list][B]Special Shiny Pokemon box![/B][/list]
[list][B]Wild Pokemon Custom Moves[/B]
•The reason why it needs to be edited because there are times that var 8000 is used in an event plus the wild battle thing, it automatically sets pokemon move whatever value is stored in that var. It would be good if it can be toggleabe by flag or var.[/list]
[list][B]Get Pokèmon type[/B]
•There should be a var that determines if the type you want to check is the 1st type and the 2nd type.[/list]