• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

How to Change the Start Map with a Hex Editor (FireRed only)

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
This tutorial is for FireRed hackers who use JPAN's Hacked Engine and have had the unfortunate experience of opening SMCA to get this error:

SMCA_zps0c3a56b4.png

(I'll type it too, so hopefully searching the error in Google will find this page)
Run-time error '380':

Invalid property value​


I will explain what caused this error in a little bit, but first, let's do what SMCA can do with a Hex editor. I personally recommend HxD for this.

So, here are your offsets:
(These are taken from the source code of SMCA, except for the y-coordinate, which I had to find myself, only later realizing JPAN had documented it in his notes for the first Hacked Engine release.)


Bank = 0x054A04
Level = 0x054A06
X-coordinate = 0x054A08
Y-coordinate = 0x054A00

And, here they are in HxD (on a copy of FireRed with the Hacked Engine of course):
HxDSMCA_zpsba0982b0.png



So, it is as simple as changing those bytes to match what you want the starting players location to be. Remember, everything is in Hex.


Now, you will notice I did not tell you how to change the player facing. In a standard, unhacked FireRed, the location for the player facing is 0x168CCB and here is a key:

down= 01
up= 02
left= 03
right= 04

Now, let's go to that offset in the hacked copy of FireRed:

Capture_zpsfe5680e1.png



As you can see, this location has been removed by JPAN. It was a map script and in his hacked engine, all scripts are removed. This is what caused the error in SMCA. It was looking for either a 01, 02, 03, or 04 at offset 0x168CCB, but instead got an FF.

Thanks to DrFuji, we now know how to add this feature back in.

Here is the script we are going to use:
Code:
#Dynamic 0x800000
#org @start
spriteface 0xFF 0x(refer to above key for direction)
setvar 0x4056 0x1
end


Now, just insert this script into the Map Script section of the Header of your start map in Advance Map:

Settings-
Type:04
Flag:4056
Value:0000
Script Offset 2: @start (from the script)

Credits:
JPAN
HackMew
DrFuji
 
Last edited:

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
Nice!
great tut this can help all hackers who used this engine.

Also i dont know the offset for the player facing,
so my idea is to search for the string in hxd and find the pointer to it
 

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
Nice!
great tut this can help all hackers who used this engine.

Also i dont know the offset for the player facing,
so my idea is to search for the string in hxd and find the pointer to it

I already tried that, my best bet is it is part of an ASM routine that loads offset by adding a certain amount to an earlier offset. But, i just had an idea! Set a breapoint on the read of the playerfacing location in a clean rom. Let me give this a try.....
 

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
You can copy the old playerfacing and paste it in a free space, then point everything to there.
can that work?
 

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
Hmm, so taking the old one doesn't work, and searching for the new one doesn't work,
seems like it all must be stored in the ram, or something crazy like that.
maybe the whole thing was just recreated, like a whole new way of calling the beginning.
Maybe creating your own kind, and in a clean rom, find all offsets that point to the one in the clean rom.
Then in the hacked rom, go to those pointers and point to the new address where you made yours.
all this is nuts man!
 

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
Hmm, so taking the old one doesn't work, and searching for the new one doesn't work,
seems like it all must be stored in the ram, or something crazy like that.
maybe the whole thing was just recreated, like a whole new way of calling the beginning.
Maybe creating your own kind, and in a clean rom, find all offsets that point to the one in the clean rom.
Then in the hacked rom, go to those pointers and point to the new address where you made yours.
all this is nuts man!

It is. I found the routine in the origional rom that calls the player facing information. When I open this routine in JPAN's, there is no routine, it is just junk.
 
50
Posts
11
Years
  • Seen Jan 4, 2021
Hey, this is great! Only one problem though, I tried this on an unhacked FireRed but the when I try to change the way the player is facing, he always ends up facing down no matter what I do. Do you know why this is?
 

DrFuji

[I]Heiki Hecchara‌‌[/I]
1,691
Posts
14
Years
If someone does know the location of the player facing, please let me know so I can add it to this tutorial.

Actually, JPAN's engine removes that part completely, you can see this because the player faces up at the beginning of a regular FR ROM whereas they face down in a patched version. The reason behind this is because the direction the player faces is determined by a level script in the player's room which is only activated when they first enter/ spawn there. But since all scripts are cleared in the patch it was replaced with 0xFF bytes, leading to the error encountered.

Anyway, this is a pretty helpful/ simple tutorial to get around the problems associated with SMCA and its even better now that people will be able to know at a glance how to change that elusive Y-coordinate :P
 
50
Posts
11
Years
  • Seen Jan 4, 2021
Actually, JPAN's engine removes that part completely, you can see this because the player faces up at the beginning of a regular FR ROM whereas they face down in a patched version. The reason behind this is because the direction the player faces is determined by a level script in the player's room which is only activated when they first enter/ spawn there. But since all scripts are cleared in the patch it was replaced with 0xFF bytes, leading to the error encountered.

Anyway, this is a pretty helpful/ simple tutorial to get around the problems associated with SMCA and its even better now that people will be able to know at a glance how to change that elusive Y-coordinate :P

So, I decided to check this out and found that the level script type for the way the player is facing is a "Validates Values... [4]". Is it possible that I could have this level script and a level script of the "[2] Validates Values" at the same time so the player is facing a certain way and have another level script activate at the same time?
 

karatekid552

What happens if I push it?....
1,771
Posts
11
Years
Actually, JPAN's engine removes that part completely, you can see this because the player faces up at the beginning of a regular FR ROM whereas they face down in a patched version. The reason behind this is because the direction the player faces is determined by a level script in the player's room which is only activated when they first enter/ spawn there. But since all scripts are cleared in the patch it was replaced with 0xFF bytes, leading to the error encountered.

Anyway, this is a pretty helpful/ simple tutorial to get around the problems associated with SMCA and its even better now that people will be able to know at a glance how to change that elusive Y-coordinate :P

Thank you DrFuji, but I have a question, why was it so elusive? It was so close to the other data, i found it rather quickly. Why wasn't it included in SMCA?

The player facing makes sense. It's just a sprite behave command. Hmmm, i guess I'll add that to the tutorial. Thanks for letting me know!
 

GoGoJJTech

(☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
2,475
Posts
11
Years
Nice find Dr Fuji you really saved a bunch of hackers from this mess
 
19
Posts
9
Years
How do I tell what the level and the bank is? Using SMCA, that is. I haven't found any good tutorials on using it.
 

klingt

Living Poetry
13
Posts
9
Years
  • Age 37
  • Seen Jan 15, 2015
#org 0x054A06/0x054A04
setbyte 0x2 or to whatever level/bank
end
What I used to change the level in front of the spriteface script
 

Lance32497

LanceKoijer of Pokemon_Addicts
792
Posts
9
Years
sorry if Im asking yah this, I aint using JPAN hacked engine and I'm having problem in SMCA, it doesnt have Y coordinate and I cant find the right X value in my desired position...
Is there a way to edit the Y position using Hex editor?
 
3,830
Posts
13
Years
  • Age 26
  • OH
  • Seen Feb 26, 2024
sorry if Im asking yah this, I aint using JPAN hacked engine and I'm having problem in SMCA, it doesnt have Y coordinate and I cant find the right X value in my desired position...
Is there a way to edit the Y position using Hex editor?

This tutorial literally gives you the offsets you need to edit the map, as well as the X and Y coordinates. JPAN's engine doesn't change them.
 
Back
Top