PHO - Pokémon Hackers Online
Go Back   PHO - Pokémon Hackers Online > Other Generations Hacking > Other Research

Other Research For research regarding Gen III or other hacks that aren't Gen I/II.

Reply
 
Thread Tools Display Modes
Old 6th March 2013, 01:08 PM   #1
Gamer2020
What does this button do?.....
PHO VIP
 
Gamer2020's Avatar
 
Join Date: Jun 2010
Posts: 85
Gamer2020
Default Emerald Clock Fix!

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.

Code:
.text
.align 2
.thumb
.thumb_func
.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

SOMETHING2:

strb    r1,[r4]
b       Game_Code_and_Return

SOMETHING3:
                             
strb    r1,[r3]

Game_Code_and_Return:

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

SOMETHING4:
                          
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

SOMETHING1:                           

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!
Gamer2020 is offline   Reply With Quote
Likes Elsa, Linkandzelda, diegoisawesome liked this post
Sponsored Links
Old 6th March 2013, 04:33 PM   #2
Jambo51
Glory To Arstotzka
Ex-Staff
 
Jambo51's Avatar
 
Join Date: May 2012
Location: Scotland
Posts: 92
Jambo51
Default

Very nice. I know you've had a lot of bother getting this to work, so it must feel good to have got it done!
__________________
I have nothing interesting to add
Jambo51 is offline   Reply With Quote
Old 7th March 2013, 08:05 PM   #3
Gamer2020
What does this button do?.....
PHO VIP
 
Gamer2020's Avatar
 
Join Date: Jun 2010
Posts: 85
Gamer2020
Default

Quote:
Originally Posted by Jambo51 View Post
Very nice. I know you've had a lot of bother getting this to work, so it must feel good to have got it done!
Yes it does. The main thing slowing me down was forgetting to add 1 to addresses to offsets and such lol.
__________________
Pokemon Game Editor download!
Gamer2020 is offline   Reply With Quote
Old 11th July 2013, 03:01 AM   #4
diegoisawesome
Working on Shining Opal, kinda
Ex-Staff
 
diegoisawesome's Avatar
 
Join Date: Jul 2013
Location: Goldenrod City, Johto
Age: 20
Posts: 67
diegoisawesome
Default

I'll be sure to use this fix if I ever get a flashcart that actually saves properly. It'll be nice to know I can at least play Emerald hacks semi-properly without a true RTC solution.

Last edited by diegoisawesome; 11th July 2013 at 03:28 AM.
diegoisawesome is offline   Reply With Quote
Old 11th July 2013, 04:24 AM   #5
Linkandzelda
RHO つぃちょう
Webmaster
 
Linkandzelda's Avatar
 
Join Date: Apr 2012
Location: United Kingdom
Posts: 303
Linkandzelda Linkandzelda Linkandzelda
Default

It would be great if something like this came out for FireRed. Still, great that you did this for Emerald
__________________





Linkandzelda is offline   Reply With Quote
Old 11th July 2013, 06:13 AM   #6
Pirate Ninja
P l a y t h e f i e l d
 
Pirate Ninja's Avatar
 
Join Date: Jul 2013
Location: The seas
Age: 22
Posts: 50
Pirate Ninja
Default

A very good addition to the list. I always liked all your R/S/E related items, and this is one of them. Possibly we might see a Gamer2020's Emerald Hacked Engine soon!
Pirate Ninja is offline   Reply With Quote
Old 17th March 2014, 06:44 PM   #7
zerokun0102
n00b
 
Join Date: Mar 2014
Posts: 1
zerokun0102
Default

Sorry men but i have no idea what i have to do for patch my pokemon emerald with those codes, i dont know nothing. Can you create a .ips file for patch the rom please? or give me instructions, i dont understand that :l
zerokun0102 is offline   Reply With Quote
Old 11th August 2014, 06:29 AM   #8
Dadadude
n00b
 
Join Date: Aug 2014
Posts: 1
Dadadude
Default

Compile this?... )8|

Are there any resources for me to read in order to get this thing up and running?
Would appreciate the info.
Dadadude is offline   Reply With Quote
Reply

Tags
clock, emerald, fix, [Fix]

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:37 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc. User Alert System provided by Advanced User Tagging (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Pokémon characters and images belong to Pokémon USA, Inc. and Nintendo.
Pokémon Hackers Online (PHO) is in no way affiliated with or endorsed by Nintendo LLC, Creatures, GAMEFREAK inc,
The Pokémon Company, Pokémon USA, Inc., The Pokémon Company International, or Wizards of the Coast.
All forum/site content (unless noted otherwise) and site designs are © 2006-2013 Pokémon Hackers Online (PHO).
Green Charizard Christos TreeckoLv100

"Black 2" by ARTPOP. Kyurem artwork by XOUS.

no new posts