Thread: Development: Emerald Clock Fix!
View Single Post
Old March 6th, 2013 (10:26 AM).
Gamer2020's Avatar
Gamer2020 Gamer2020 is offline
Accept no Imitations!
Join Date: Jun 2008
Location: Distant Land
Gender: Male
Nature: Bold
Posts: 846
Send a message via Skype™ to Gamer2020

Hi everyone. Today I bring you a clock fix for Emerald (BPEE). You may remember that there was an rtc patch made for R/S that allowed the clock to be based on playtime. A patch like this was never made for Emerald. I took the one for Ruby, disassembled it, and made it work for Emerald. Keep in mind that while this does work it has not been fully tested.

Memory address 0x0200F024 may not be safe. It is the same one used in the Ruby routine. This can be changed without affecting functionality.

Just assemble the code below and follow the included instructions.

.align 2
.global emeraldclockfix

/*At 80005e6 write 01B400480047xxxxxxxx01BC with xxxxxxxx being the offset for this routine. To disable the error code text write C046C046 at 0802FB06 Offset 0200F024 may not be safe in emerald but this can be changed to anything desired. This code seems to work but is not fully tested. Use at your own risk.*/ main:

push {r0-r7} ldr r0,.PLAYER_DATA ldr r0, [r0] add r0,r0, #0x11 str r0,[sp] ldr r4,.PLAYER_DATA ldr r4, [r4] add r4,r4, #0x9A add r3,r4,#0x1 ldr r7,.SUM_BUFF ldrb r5,[r7] ldrb r0,[r0] add r2,r7,#0x1 cmp r5,r0 beq Game_Code_and_Return strb r0,[r7] ldrb r0,[r2] add r6,r0,#0x1 lsl r0,r6,#0x18 lsr r0,r0,#0x18 strb r0,[r2] cmp r0,#0x3B ble Game_Code_and_Return mov r6,#0x0 strb r6,[r2] ldrb r6,[r3] sub r6,#0x1 lsl r1,r6,#0x18 lsr r1,r1,#0x18 cmp r1,#0xFF bne SOMETHING3 mov r6,#0x3B strb r6,[r3] ldrb r6,[r4] sub r6,#0x1 and r1,r6 cmp r1,#0xFF bne SOMETHING2 mov r1,#0x17 bl SOMETHING4


strb r1,[r4] b Game_Code_and_Return


strb r1,[r3]


pop {r0-r7} ldr r0,.SUM_GAME_OFF ldrh r1,[r0] ldr r2,.SUM_VAL mov r0,r2 mov r3,r0 eor r3,r1 ldr r0,.RETURN_OFFSET bx r0


push {r0-r2} ldr r0,.PLAYER_DATA ldr r0, [r0] add r0,r0, #0x98 ldrh r1,[r0] sub r1,#0x1 ldr r2,=.SUM_VAL2 cmp r1,r2 blt SOMETHING1 ldr r1,.SUM_VAL3


strh r1,[r0] pop {r0-r2} mov r15,r14

.align 2

.PLAYER_DATA: .word 0x03005D90 .SUM_BUFF: .word 0x0200F024 .SUM_GAME_OFF: .word 0x04000130 .RETURN_OFFSET: .word 0x080005F1 .SUM_VAL2: .hword 0x8000 .hword 0x0000 .SUM_VAL3: .hword 0xFFFF .hword 0x0000 .SUM_VAL: .hword 0x3FF

If you feel that this can be optimized in any way then please post on here and let me know.


Pokemon Game Editor Download!
Accept no imitations!
Reply With Quote