The PokéCommunity Forums  

Go Back   The PokéCommunity Forums > Fan Games > Binary ROM Hacking
Reload this Page Other A few questions

Notices
For all updates, view the main page.

Binary ROM Hacking Need a helping hand or just want to talk about binary ROM hacks? Get comments and answers to any ROM Hacking-related problems, questions or thoughts you have here.

Ad Content
Reply
 
Thread Tools
  #1   Link to this post, but load the entire thread.  
Old November 17th, 2014 (4:15 AM).
Red John's Avatar
Red John Red John is offline
Progressing Assembly hacker
 
Join Date: May 2014
Location: Where ever there is peace and darkness
Gender: Male
Nature: Lonely
Posts: 137
I have a few questions here, 1) if r1 has ff, will it have 0000ff or just ff? 2) is it possible to turn hex into ASM? 3) what is the difference between blank data(00) and unused data(ff) in emerald? 4) how to use the behaviour byte hack with jpan hacked engine? 5) whenever i try to apply walking script, item script and behaviour byte with the hacked routine applier in hacked engine, it gives me an unhandled exceptions error, how come?
__________________
Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old November 17th, 2014 (12:19 PM).
Joexv's Avatar
Joexv Joexv is offline
ManMadeOfGouda
joexv.github.io
 
Join Date: Oct 2012
Location: Oregon
Age: 25
Gender: Male
Nature: Sassy
Posts: 1,035
Quote:
Originally Posted by Knight of Duty View Post
I have a few questions here, 1) if r1 has ff, will it have 0000ff or just ff? 2) is it possible to turn hex into ASM? 3) what is the difference between blank data(00) and unused data(ff) in emerald? 4) how to use the behaviour byte hack with jpan hacked engine? 5) whenever i try to apply walking script, item script and behaviour byte with the hacked routine applier in hacked engine, it gives me an unhandled exceptions error, how come?
1) Not sure what you men by that.
2) Yes you need a dissasembler ide pro is a good one from what ive been told.
3) also dont quite understand that one, Emerald uses 00 for free space where as pretty much everything else uses ff
4)The documentation that comes with the hack has instructions on that.
Spoiler:
Behavior Bytes

Next up we have a change in the Behavior bytes. What are behavior bytes? Well, basically it’s what tells the tile how to behave itself. Some are used to force a specific movement when on it (like the arrow tiles at Team Rocket’s base), others are used to allow a certain event to exist on it (warp bytes such as doors, holes and stairs) and some are used to allow interaction when colliding against it. The ones we’re dealing here with are the ones that run small scripts. First, an overview of what they really are:

The game doesn’t make a distinction between these bytes. In fact, some receive more than one or two functions. The game divides the interpretations of those bytes in two routines
– The walking-onto routine, that checks if the byte has something to do when you walk into it, as in standing on it
– The Pad routine, that checks what keys are currently pressed, and checks the byte you’re facing.

The main difference between these two is that the first one only activates when you walk onto that tile. If the movement permissions don’t allow you to step on the tile (like 1 on Advance map), the routine exits without making any checks. If the permission is one that doesn’t let you enter the tile you are walking into, or you are pressing A (or L in special cases), it is allowed in the pad-check routine.
These routines are mutually exclusive, and the first to execute is the walking one. If you manage to get in on the next tile, this is the function that fetches the Script (green S) and checks if it should be executed. It’s also here that the game places things like footprints, cracking floors, reflection, etc. As this function has priority over the previous one, if a signpost (byte 84, that allows you to activate it with the D-pad) is not set to 0x1 or the like, and has a Signpost event and a Script event, the Script event will be executed.
The second function activates to check if a person event exists in front of it. If not, it will start to check if pressing the D-pad has any effects on the affected tile. Bytes 0x84, 0x91 and 0x92 are affected, allowing you to run a small script if you walk into them but can’t cross over. After confirming the key pressed affects the tile, it checks if a Signpost was placed there, and if so, will end itself and return the address. If there isn’t a script you placed there it will check for a byte script. If that byte doesn’t have a script to call, check if the movement permission is 4 and the byte is one of the water bytes (0x11, 0x13, 0x14, 0x15). If so, calls the appropriated script, such as the surf or waterfall scripts. In the end, if it still found nothing, it exits with the null pointer.
So, some events have precedence over others. Here:

Person Warp Script Signpost Tiles Water Tiles






That is why certain byte tiles like the TV or the bookshelves sometimes have scripts over it, to replace the byte script, that is only executed second to last in this scale. Some non-script bytes, however, still execute even against this rule (like reflection, which is always on).
But, as I said before, there are no byte types, only simple, 8 bit, bytes for the game. That is why bytes such as 0x14 (pond reflection) is both a surf-able tile as well as a reflection one. The only rule is that, whatever they do, there is only one script associated with them, and as many ASM functions as the heart desires. That happens because of the very strict coding that checks for each of the options. The code to make it, not counting the function calls, has a total of 1014 bytes. Now, we would like it to be expansible, and to change all scripts that could be run with each byte. And the simple and very effective way to do it is with a table.

The new structure: a 256 pointer table that allow assigning a script to any byte, regardless of what they had in the past. Even though I wouldn’t recommend it, it is even possible to create and place a script in the surf-able slots, but doing so would disable the laod_water_scripts algorithm that, in its ASM, checks for movement permission 4 before returning the address.

The table rests at 0x1a3000, right after the end of the palette table reserved space. There are no different bytes separating the two, so you should only see 0s on that address. This code makes easy for you to create your very own Headbutt and honey trees, as well as new move-crossable events such as Rock Climb.

5)You should try using the patch instead of the tool unless you are using premade scripts in the game, but with the tool you may not be entering the needed information correctly.
__________________
New living flesh vessel who dis?
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old November 17th, 2014 (5:26 PM).
Red John's Avatar
Red John Red John is offline
Progressing Assembly hacker
 
Join Date: May 2014
Location: Where ever there is peace and darkness
Gender: Male
Nature: Lonely
Posts: 137
Ok, thank you joexv but number 3) i wanted to ask is that when i open emerald in a hex editor, i see more ffs than 00s. Is it safe to take those ffs as free space?
__________________
Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old November 18th, 2014 (5:42 AM).
daniilS's Avatar
daniilS daniilS is offline
busy trying to do stuff not done yet
 
Join Date: Aug 2013
Age: 23
Gender: Male
Posts: 409
If r1 is ff, it's actually 000000ff. Also, the most popular disassembler is called IDA PRO, but VBA has a built-in disassembler itself.
__________________
Reply With Quote
  #5   Link to this post, but load the entire thread.  
Old November 18th, 2014 (3:53 PM).
Red John's Avatar
Red John Red John is offline
Progressing Assembly hacker
 
Join Date: May 2014
Location: Where ever there is peace and darkness
Gender: Male
Nature: Lonely
Posts: 137
Quote:
Originally Posted by daniilS View Post
If r1 is ff, it's actually 000000ff. Also, the most popular disassembler is called IDA PRO, but VBA has a built-in disassembler itself.
This means that it still is a 32 bit word right?
__________________
Reply With Quote
  #6   Link to this post, but load the entire thread.  
Old November 18th, 2014 (3:59 PM).
daniilS's Avatar
daniilS daniilS is offline
busy trying to do stuff not done yet
 
Join Date: Aug 2013
Age: 23
Gender: Male
Posts: 409
A register is 32 bits, so any data it holds automatically is 32 bits too.
__________________
Reply With Quote
  #7   Link to this post, but load the entire thread.  
Old November 18th, 2014 (9:58 PM).
HidoranBlaze's Avatar
HidoranBlaze HidoranBlaze is offline
 
Join Date: Apr 2013
Age: 26
Gender: Male
Posts: 252
Quote:
Originally Posted by joexv View Post
3) also dont quite understand that one, Emerald uses 00 for free space where as pretty much everything else uses ff
Correction: Emerald uses both 00 and FF for free space. I say both because there are a few areas filled with 00 bytes that are safe to convert to FF bytes. There's a tutorial floating around somewhere in PHO for that.
Anyway, the main thing I want to emphasize is that Emerald uses FF bytes for free space. Using 00 bytes indiscriminately will just lead to sound corruption. (which is why people think Emerald is unstable, when it's actually not)
Reply With Quote
  #8   Link to this post, but load the entire thread.  
Old November 19th, 2014 (3:34 AM).
Red John's Avatar
Red John Red John is offline
Progressing Assembly hacker
 
Join Date: May 2014
Location: Where ever there is peace and darkness
Gender: Male
Nature: Lonely
Posts: 137
Quote:
Originally Posted by HidoranBlaze View Post
Correction: Emerald uses both 00 and FF for free space. I say both because there are a few areas filled with 00 bytes that are safe to convert to FF bytes. There's a tutorial floating around somewhere in PHO for that.
Anyway, the main thing I want to emphasize is that Emerald uses FF bytes for free space. Using 00 bytes indiscriminately will just lead to sound corruption. (which is why people think Emerald is unstable, when it's actually not)
Thanks, i am better of using ffs.
__________________
Reply With Quote
  #9   Link to this post, but load the entire thread.  
Old November 19th, 2014 (9:25 AM).
Joexv's Avatar
Joexv Joexv is offline
ManMadeOfGouda
joexv.github.io
 
Join Date: Oct 2012
Location: Oregon
Age: 25
Gender: Male
Nature: Sassy
Posts: 1,035
Quote:
Originally Posted by HidoranBlaze View Post
Correction: Emerald uses both 00 and FF for free space. I say both because there are a few areas filled with 00 bytes that are safe to convert to FF bytes. There's a tutorial floating around somewhere in PHO for that.
Anyway, the main thing I want to emphasize is that Emerald uses FF bytes for free space. Using 00 bytes indiscriminately will just lead to sound corruption. (which is why people think Emerald is unstable, when it's actually not)
Oh wow, ive been doing it all wrong... No wonder my stuff always ends up weird.
Yea so Knight of Duty listen to these guys cause I guess I have no idea what Im doing. My life has been a lie.
__________________
New living flesh vessel who dis?
Reply With Quote
Reply

Quick Reply

Join the conversation!

Create an account to post a reply in this thread, participate in other discussions, and more!

Create a PokéCommunity Account
Ad Content

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 -8. The time now is 9:08 AM.