Research & Development Got a well-founded knack with ROM hacking? Love reverse-engineering the Pokémon games? Or perhaps you love your assembly language. This is the spot for polling and gathering your ideas, and then implementing them! Share your hypothesis, get ideas from others, and collaborate to create!

#1
January 31st, 2010 (7:12 AM). Edited February 3rd, 2010 by HackMew.
 HackMew Mewtwo Strikes Back Join Date: Jun 2006 Posts: 1,314

# Brief Intro

I'm gonna deliberately quote Bulbapedia here:
[jq]The Running Shoes were introduced in Ruby and Sapphire, and used in all Generation III and Generation IV games. They are typically received shortly after the beginning of the game, and allow the player to run instead of walk, by holding the B button and pressing the D-pad in any direction. The speed at which players can run is about twice as that of walking, yet slower than any of the bicycles. In Generation IV, the player can use Running Shoes inside of all structures instead of being limited to certain buildings in past games.[/jq]To be honest, I always disliked the fact you could not run indoors. Eventually, Game Freak realized that too someday.
Now we will fix the annoying issue, letting the player use Running Shoes everywhere, through a simple byte change!

# Description

The game does some checks when pressing the B button. Below, part of the routine involved, disassembled from FireRed US v1.0:

Code:
```080bd490  7e41 ldrb r1, [r0, #0x19]
080bd492  2002 mov r0, #0x2
080bd494  4008 and r0, r1
080bd496  2800 cmp r0, #0x0
080bd498  d006 beq \$080bd4a8```
I'll explain briefly what happens. First of all, the "Show name on entering" byte is loaded into r1 and r0 is set to 0x2. Then r0 is ANDed with r1. Here are the possible results:

Code:
```0x2 AND 0x0 = 0x0
0x2 AND 0x1 = 0x0
0x2 AND 0x2 = 0x2
0x2 AND 0x3 = 0x2
0x2 AND 0x4 = 0x0
0x2 AND 0x5 = 0x0
0x2 AND 0x6 = 0x2
0x2 AND 0x7 = 0x2
0x2 AND 0x8 = 0x0
0x2 AND 0x9 = 0x0
0x2 AND 0xA = 0x2
0x2 AND 0xB = 0x2
0x2 AND 0xC = 0x0
0x2 AND 0xD = 0x0
0x2 AND 0xE = 0x2
0x2 AND 0xF = 0x2```
As you can see, a specific pattern is repeating itself. Going on with the routine, we can see r0 is compared with 0x0. If equal, no Running Shoes :(

Now, if we could change the "and r0, r1" instruction with a "and r0, r0" one, what would happen?
The register r0 is set to 0x2 the instruction before, so it would always be 0x2 AND 0x2 = 0x2. And since 0x2 is not 0x0, we can run anytime.
Regardless of the map header settings :)

That's for FR/LG. In Emerald, things are pretty similar, here's the routine from Emerald US v1.0:

Code:
```0811a1e4  7e81 ldrb r1, [r0, #0x1a]
0811a1e6  2004 mov r0, #0x4
0811a1e8  4008 and r0, r1
0811a1ea  2800 cmp r0, #0x0
0811a1ec  d006 beq \$0811a1fc```
Nothing much to say, really. The main difference is that r0 is set to 0x4 instead of 0x2, which means different patterns.
Not that we really care about that, since we already know all we need to do is to replace the "and r0, r1" instruction there.

In Ruby and Sapphire, things are quite different instead:

Code:
```080e5dfc  4802 ldr r0, [\$080e5e08] (=\$0202e828)
080e5dfe  7dc0 ldrb r0, [r0, #0x17]
080e5e00  2808 cmp r0, #0x8
080e5e02  d103 bne \$080e5e0c```
The above code, extracted from Ruby US v1.0 will load the "Map Type" byte into r0 at first. Then it's compared with 0x8, which means indoors.
When being not equal, you can run. Otherwhise you cannot, indeed. Now, if we change the "cmp r0, #0x8" with "cmp r0, #0x0", we are always allowed to run.
In fact, no map in the game use the value 0x0.

Whatever game you're using, in hex that means replacing 08 with 00. Offsets are below.

# The Offsets

• FireRed US v1.0

Code:
`0xBD494`
• LeafGreen US v1.0

Code:
`0xBD468`
• Ruby US v1.0

Code:
`0xE5E00`
• Sapphire US v1.0

Code:
`0xE5E00`
• Emerald US v1.0

Code:
`0x11A1E8`

You are not allowed to copy, modify or distribute it without permission.
__________________

#2
January 31st, 2010 (1:23 PM). Edited January 31st, 2010 by hashtag.
 hashtag Join Date: Nov 2008 Location: Salisbury, England Age: 22 Gender: Male Nature: Sassy Posts: 9,517
Good research, Andrea. I was trying to find a way to enable this without touching the Map Header options. I just implemented this into my hack; well done!
__________________
#3
January 31st, 2010 (2:09 PM).
 BlitŻ guahh my dog is so cute Join Date: Feb 2009 Location: Bay Area, Califronia. Age: 22 Gender: Male Nature: Jolly Posts: 472
Hmm, this is something that is great . Now I don't havev to change things from indoor to outside to make it work. ^-^ I hope nothing bad will become of my rom though, just in case. >.<

Your research greatly benefits us all. x3
__________________
#4
January 31st, 2010 (2:23 PM).
 NarutoActor The rocks cry out to me Join Date: Jan 2009 Location: Brooklyn/Marlboro Age: 23 Gender: Female Nature: Bashful Posts: 1,979
Will this mess with the Day & Night System, as in it will be sunny indors? or dose this byte change only change the fact that you can run?
__________________
~There are those people who understand hex, F the rest
#5
January 31st, 2010 (2:24 PM).
 HackChu I need a haircut... Join Date: Jan 2007 Location: Bankrupt Amerika Age: 24 Gender: Male Nature: Modest Posts: 673
Thanks I was wanting to know how to do this recently, I just hope it doesn't mess anything up.
__________________

My 'learning how to combine battle scripts' thread:

SoulSilver FC:1162 1864 5409
Name: Ethan

Black FC: 2666 1354 4379
Name: Ashton

White 2 FC: 1120 8065 3049
Name: Nate

3DS Friend Code: 1349-4646-2412
#6
January 31st, 2010 (2:28 PM).
 HackMew Mewtwo Strikes Back Join Date: Jun 2006 Posts: 1,314
To clear it up: this doesn't mess anything up. Obviously. It will simply enable Running Shoes anywhere. Heck, I've used it in Oro Sole too.
__________________
#7
January 31st, 2010 (2:28 PM). Edited January 31st, 2010 by hashtag.
 hashtag Join Date: Nov 2008 Location: Salisbury, England Age: 22 Gender: Male Nature: Sassy Posts: 9,517
Quote:
 Originally Posted by NarutoActor Will this mess with the Day & Night System, as in it will be sunny indors? or dose this byte change only change the fact that you can run?
It only changes the running; not the weather. :D

edit: beaten :(
__________________
#8
January 31st, 2010 (2:32 PM).
 HackChu I need a haircut... Join Date: Jan 2007 Location: Bankrupt Amerika Age: 24 Gender: Male Nature: Modest Posts: 673
Well I can't find the offset used above in my hex editor.

__________________

My 'learning how to combine battle scripts' thread:

SoulSilver FC:1162 1864 5409
Name: Ethan

Black FC: 2666 1354 4379
Name: Ashton

White 2 FC: 1120 8065 3049
Name: Nate

3DS Friend Code: 1349-4646-2412
#9
January 31st, 2010 (2:34 PM).
 hashtag Join Date: Nov 2008 Location: Salisbury, England Age: 22 Gender: Male Nature: Sassy Posts: 9,517
Quote:
 Originally Posted by tyson Well I can't find the offset used above in my hex editor. 0xBD494It says string not found.:(
Search BD494 on it's own in your editor.
__________________
#10
January 31st, 2010 (2:36 PM).
 Omega Zero Is back... Join Date: Dec 2009 Location: I'm always living aren't I? Age: 19 Gender: Male Nature: Relaxed Posts: 445
WoW really useful i just used it right now :3
__________________
#11
January 31st, 2010 (2:48 PM). Edited January 31st, 2010 by HackMew.
 HackMew Mewtwo Strikes Back Join Date: Jun 2006 Posts: 1,314
Quote:
 Originally Posted by tyson Well I can't find the offset used above in my hex editor. 0xBD494It says string not found.:(
Am I wrong (no, I'm not) or I didn't use the word "search" at all? You just need to go to that offset in your ROM using a hex editor.
Assuming you know how to use one. For further details, just read the first post.
__________________
#12
January 31st, 2010 (3:17 PM).
 Omega Zero Is back... Join Date: Dec 2009 Location: I'm always living aren't I? Age: 19 Gender: Male Nature: Relaxed Posts: 445
the reason it said string not found cause you probally pressed Ctrl+F press Ctrl+G then try it
__________________
#13
January 31st, 2010 (3:29 PM).
 giradialkia I mean... Join Date: Apr 2009 Location: Ireland Age: 23 Gender: Male Nature: Timid Posts: 1,562
Forgive my misunderstanding, but is this not possible by just changing the "Show Map Name" setting? I previously wanted to do this for my hack, which is based on Emerald. All I had to do is change the petting from "Do not show name" to "05 ???" and That enabled the running shoes while indoors, in any building. And in FireRed it's "02 ???". Although from the amount of 0x2's I see in the first post, that's probably what you were saying. Though... Are you saying that once this code is implemented, you'll be able to run everywhere, regardless of the Show Name setting? Because if that's what you were saying... That is cool. Sorry, for not understanding properly.
__________________

I'm working on an album of Pokémon-inspired music. Check out the Soundcloud link if you're interested!

This is my Soundcloud | | This is my bandcamp
#14
January 31st, 2010 (3:53 PM).
 HackMew Mewtwo Strikes Back Join Date: Jun 2006 Posts: 1,314
Quote:
 Originally Posted by giradialkia Are you saying that once this code is implemented, you'll be able to run everywhere, regardless of the Show Name setting? Because if that's what you were saying... That is cool. Sorry, for not understanding properly:(.
That's exactly what it was designed for.
__________________
#15
January 31st, 2010 (5:59 PM).
 liuyanghejerry Join Date: Jan 2008 Location: China,Xi'an Nature: Calm Posts: 219
This is very interesting.
But this inspire me that why don't we try to reuse select,R,L?
In FR,RL goes to a helpless help and in RSE, it's totally no use...
Maybe we could create codes like what B and select does,and make R,L new use in OW.
Maybe press R to fish?
__________________
#16
January 31st, 2010 (6:18 PM).
 HackChu I need a haircut... Join Date: Jan 2007 Location: Bankrupt Amerika Age: 24 Gender: Male Nature: Modest Posts: 673
Quote:
 Originally Posted by liuyanghejerry This is very interesting. But this inspire me that why don't we try to reuse select,R,L? In FR,RL goes to a helpless help and in RSE, it's totally no use... Maybe we could create codes like what B and select does,and make R,L new use in OW. Maybe press R to fish?
Well for one it requires ASM of course and for two...this isn't related to the topic of the thread so please refrain from switching it up.
__________________

My 'learning how to combine battle scripts' thread:

SoulSilver FC:1162 1864 5409
Name: Ethan

Black FC: 2666 1354 4379
Name: Ashton

White 2 FC: 1120 8065 3049
Name: Nate

3DS Friend Code: 1349-4646-2412
#17
January 31st, 2010 (8:43 PM).
 ZodiacDaGreat Working on a Mobile System Join Date: Feb 2007 Location: South Pacific Age: 24 Gender: Male Nature: Relaxed Posts: 429
Quote:
 Originally Posted by liuyanghejerry This is very interesting. But this inspire me that why don't we try to reuse select,R,L? In FR,RL goes to a helpless help and in RSE, it's totally no use... Maybe we could create codes like what B and select does,and make R,L new use in OW. Maybe press R to fish?
I think he wants to extend the routine to add in extra stuff for keypresses.

For people interested in having the Running Shoes hack on Ruby, you're in for some good news I've come up with my own hack for Ruby since I don't think the same way works, AFAIK. Anyways, let's get down to business.. My hack revolves around Map Type byte. There are a lot of routines reading that and one of them checks if the Map type is indoors, if it is then you 'Can't Run' otherwise you can.

Code:
```080e5dfc  4802 ldr r0, [\$080e5e08] (=\$0202e828) @ Map Type Flag is stored here
080e5dfe  7dc0 ldrb r0, [r0, #0x17]
080e5e00  2808 cmp r0, #0x8 @ Indoor Map Type
080e5e02  d103 bne \$080e5e0c
080e5e04  2001 mov r0, #0x1
080e5e06  e002 b \$080e5e0e```
What we are gonna do is change that 08 to 00, since no Map uses 00 anyway as far as it matters just change it to any other value that doesn't involve Maps that you can run on. So, to apply this hack simply put 00 at 0xE5E00.

Enjoy!
__________________
#18
January 31st, 2010 (11:17 PM).
 Tropical Sunlight The Faltine Join Date: Mar 2008 Location: Slovenia Age: 20 Gender: Male Posts: 3,572
Awesome, just did this in Turquoise! Thanks, HackMew!
#19
February 1st, 2010 (12:52 AM). Edited February 1st, 2010 by HackMew.
 HackMew Mewtwo Strikes Back Join Date: Jun 2006 Posts: 1,314
>> TO ALL: First post updated! Now includes Ruby, Sapphire and Emerald too :D

Quote:
 Originally Posted by liuyanghejerry This is very interesting. But this inspire me that why don't we try to reuse select,R,L? In FR,RL goes to a helpless help and in RSE, it's totally no use... Maybe we could create codes like what B and select does,and make R,L new use in OW. Maybe press R to fish?
Well, not really. You can use L/R to scroll in the bag or in the Pokémon stat screens. Even on R/S/E. But yeah, those buttons are not used a lot I guess. Anyway, this is kinda offtopic here, sorry.

Quote:
 Originally Posted by ZodiacDaGreat For people interested in having the Running Shoes hack on Ruby, you're in for some good news ^^ I've come up with my own hack for Ruby since I don't think the same way works, AFAIK.
You know, I was going to post the R/S/E stuff later, but thanks nonetheless.

Quote:
 Originally Posted by H2O Turquoise Awesome, just did this in Turquoise! Thanks, HackMew!
You're welcome. Even if I didn't say explicitly, a tiny bit of credit is always appreciated.
__________________
#20
February 1st, 2010 (2:29 AM).
 Flandre Scarlet Free your mind. Join Date: Feb 2008 Location: Australia Age: 21 Gender: Male Nature: Adamant Posts: 355
Hahaha, I was just about to ask for an Emerald version But it looks like its already done. Thank you so much HackMew! Works perfectly!
#21
February 12th, 2010 (10:19 AM).
 simdu68 asleep all summer zzZZ Join Date: Feb 2010 Location: France Age: 22 Gender: Male Nature: Calm Posts: 221
sorry but i'm so bad in scripting that i don't understand '

well in fact the first part i understand but not the second with the offsets...........

edit:
in fact i have another question, is it possible to change it also with the bicycle to be able to drive with the bike in the houses? that would also be great
#22
February 12th, 2010 (11:29 AM).
 Sagiri Join Date: Mar 2007 Age: 22 Posts: 723
Quote:
 Originally Posted by simdu68 sorry but i'm so bad in scripting that i don't understand -_-' well in fact the first part i understand but not the second with the offsets........... edit: in fact i have another question, is it possible to change it also with the bicycle to be able to drive with the bike in the houses? that would also be great^^
You open a hex editor, go to the specified offset and change the 08 found there with 00.

Biking anywhere is theoretically possible, but not with this.
#23
February 12th, 2010 (11:41 AM).
 simdu68 asleep all summer zzZZ Join Date: Feb 2010 Location: France Age: 22 Gender: Male Nature: Calm Posts: 221
ah ok
i haven't got hex editor i'm making scripts with something alse, probably worse

thanx :D
#24
February 12th, 2010 (11:46 AM).
 Muffin™ Knows your age Join Date: Dec 2009 Location: sucking balls Age: 6 Gender: Male Nature: Calm Posts: 429
Thanks so much HackMew! I always love your tutorials!!!
__________________
>>>/v/
#25
February 12th, 2010 (12:02 PM).
 simdu68 asleep all summer zzZZ Join Date: Feb 2010 Location: France Age: 22 Gender: Male Nature: Calm Posts: 221
i just now read a scripting tutorial, now i understand your tutorial also

in fact i just didn't know this scripting language....... but hex editor is much better than my old programm