The Code:
Code:
.text
.align 2
.thumb
.thumb_func
.global rivalnamingingame
main:
push {r0-r4,lr}
ldr r0, place
str r0, [sp, #0x4]
ldr r1, ramlocation
ldr r1, [r1, #0x0]
ldr r0, standard
add r1, r1, r0
mov r0, #0x4
mov r2, #0x0
mov r3, #0x0
bl place2
ldr r1, ramlocation
ldr r1, [r1, #0x0]
ldr r0, standard
add r1, r1, r0
ldrb r0, [r1, #0x0]
cmp r0, #0xFF
beq failsafe
cmp r0, #0x0
beq failsafe
return: pop {r0-r4}
pop {pc}
place2: ldr r4, actualroutine
bx r4
failsafe: ldr r0, rivalname
loop: ldrb r2, [r0, #0x0]
strb r2, [r1, #0x0]
cmp r2, #0xFF
beq return
add r0, #0x1
add r1, #0x1
b loop
.align
place: .word 0x080568E1
ramlocation: .word 0x03005008
standard: .word 0x00003A4C
actualroutine: .word 0x0809D955
rivalname: .word 0x08FFFFFF
Where to insert: Anywhere! This routine is called from a script in the game, and as such, doesn't need to be carefully linked into existing routines. All you need to do is remember the rule of THUMB, add 1 to the offset when calling it!
Explanation: It's what it says on the tin, it lets you name your rival from the in game overworld, allowing for Silver like naming, or indeed, any other possibility you can come up with. The rivalname: .word 0x08FFFFFF is for if the player leaves the name box blank. It will fill it with a standard name instead. This standard name is up to you to create. Simply compile a name with XSE, and point that pointer to it.
You also need to put this routine in the game, or else it won't be able to load past the intro without naming the rival. All it does is temporarily write a holding name to the rival buffer so that the game doesn't crash.
Code:
.text
.align 2
.thumb
.thumb_func
.global rivalnamingskip
main:
ldr r1, [r6, #0x0]
ldr r0, number
mov r8, r0
add r1, r8
push {r1}
ldr r0, rivalname
loop: ldrb r2, [r0, #0x0]
cmp r2, #0xFF
beq end
strb r2, [r1, #0x0]
add r0, #0x1
add r1, #0x1
b loop
end: strb r2, [r1, #0x0]
pop {r1}
mov r0, sp
ldr r3, return
bx r3
.align
number: .word 0x00003A4C
rivalname: .word 0x08FFFFFF
return: .word 0x08054A75
Where to insert: Navigate to 0x54A6A, and change the following bytes to this:
01 49 08 47 00 00 XX XX XX 08.
Where the XX's stand for the pointer to the new routine plus 1.
Explanation: It simply writes a placeholder name into the [rival] buffer so the game doesn't crash. Obviously, you shouldn't be using the [rival] buffer until the player has named the rival, so it shouldn't be a problem.
To make this work, navigate to 0x103690, and change the pointer there to 0x1307D1.