The PokéCommunity Forums  

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

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 July 17th, 2014 (5:39 PM).
destinedjagold's Avatar
destinedjagold destinedjagold is offline
You can contact me in PC's discord server...
 
Join Date: May 2007
Age: 32
Gender: Male
Nature: Careful
Posts: 8,579
Elow~
I've been reading that little tutorial that miksy91 has given me about reading the changes an IPS patch will do to a ROM. It's pretty helpful, yet I'm confused about something... =/

So basically, the instructions go like this...
Spoiler:
1. Open the .ips file with a hex editor.
2. Proceed to offset 0x5, since the first 5 bytes are just the word PATCH in ASCII.
3. The bytes on offsets 0x5 to 0x7 are the offset to which the data will write the new data to the ROM.
4. After offset 0x7, there are two bytes (offsets 0x8 to 0x9) that will tell us how many bytes the patch will write to the ROM.
5. After offset 0x9 is the data.


Is it safe to assume that after the "data" on number 5 is another offset where the data will once again be written? If that's the case, then I'm really confused about something...

Spoiler:


How in blazes will I know where to start searching next if the number of data that was given is zero? ~_~
Or am I probably doing it wrong? o_O

Any help would be appreciated~
__________________

Reply With Quote
  #2   Link to this post, but load the entire thread.  
Old July 17th, 2014 (6:12 PM).
esperance's Avatar
esperance esperance is offline
 
Join Date: Mar 2010
Location: OH
Age: 26
Gender: Male
Nature: Relaxed
Posts: 3,830
You've got it basically right.

There are two ways data is stored in an IPS patch.

The usual:
[offset - 3 bytes] [data length - 2 bytes] [data - n bytes]

And the RLE way:
[offset - 3 bytes] [00 00] [rle length - 2 bytes] [data - 1 byte]

You got the first part right, but the second part is an RLE packet. ;)

Also, remember that all numbers are stored big-endian in an IPS patch.
__________________
What are you so afraid of?
Reply With Quote
  #3   Link to this post, but load the entire thread.  
Old July 17th, 2014 (6:53 PM).
Shiny Quagsire's Avatar
Shiny Quagsire Shiny Quagsire is offline
I'm Still Alive, Elsewhere
 
Join Date: May 2009
Location: Hoenn Safari Zone
Age: 25
Gender: Male
Nature: Jolly
Posts: 697
If you need a good document describing the format, I'd recomment this one. It lays it out quite well. Although in my opinion the format really needs to be expanded so that the offset size is a 32 bit word instead of a 24 bit one so that extended ROMs can be supported.
__________________



Reply With Quote
  #4   Link to this post, but load the entire thread.  
Old July 17th, 2014 (9:04 PM).
destinedjagold's Avatar
destinedjagold destinedjagold is offline
You can contact me in PC's discord server...
 
Join Date: May 2007
Age: 32
Gender: Male
Nature: Careful
Posts: 8,579
Quote:
Originally Posted by Shiny Quagsire View Post
If you need a good document describing the format, I'd recomment this one. It lays it out quite well. Although in my opinion the format really needs to be expanded so that the offset size is a 32 bit word instead of a 24 bit one so that extended ROMs can be supported.
403 Forbidden on File: 139 =/

Quote:
Originally Posted by itari View Post
You've got it basically right.

There are two ways data is stored in an IPS patch.

The usual:
[offset - 3 bytes] [data length - 2 bytes] [data - n bytes]

And the RLE way:
[offset - 3 bytes] [00 00] [rle length - 2 bytes] [data - 1 byte]

You got the first part right, but the second part is an RLE packet. ;)

Also, remember that all numbers are stored big-endian in an IPS patch.
I've never heard of the RLE way... So, from my screenshot, [13 BA C8] is the offset, some random [00 00], and the [01] meaning the number of bytes of the data to be written, and then [3A] which is the data.
...And after that? [00 6B 0A] is the new offset?
__________________

Reply With Quote
  #5   Link to this post, but load the entire thread.  
Old July 17th, 2014 (9:12 PM).
esperance's Avatar
esperance esperance is offline
 
Join Date: Mar 2010
Location: OH
Age: 26
Gender: Male
Nature: Relaxed
Posts: 3,830
Yes, based on the data, [13 BA C8] is the offset, then [00 00] which means use RLE method, followed by [01 3A] which is the RLE length, and [00] is the data to copy.

So, this means copy the byte 00 0x13A (314) times to the ROM starting at 0x13BAC8.

The next offset will be [6B 0A 00], etc.
__________________
What are you so afraid of?
Reply With Quote
  #6   Link to this post, but load the entire thread.  
Old July 17th, 2014 (9:22 PM).
destinedjagold's Avatar
destinedjagold destinedjagold is offline
You can contact me in PC's discord server...
 
Join Date: May 2007
Age: 32
Gender: Male
Nature: Careful
Posts: 8,579
Quote:
Originally Posted by itari View Post
Yes, based on the data, [13 BA C8] is the offset, then [00 00] which means use RLE method, followed by [01 3A] which is the RLE length, and [00] is the data to copy.

So, this means copy the byte 00 0x13A (314) times to the ROM starting at 0x13BAC8.

The next offset will be [6B 0A 00], etc.
So that's how it works!
Thanks :D

Now I can finally study which offsets a patch will make changes, to see if they'll overwrite some offset I've already used. ^^
__________________

Reply With Quote
  #7   Link to this post, but load the entire thread.  
Old July 18th, 2014 (4:10 PM).
Shiny Quagsire's Avatar
Shiny Quagsire Shiny Quagsire is offline
I'm Still Alive, Elsewhere
 
Join Date: May 2009
Location: Hoenn Safari Zone
Age: 25
Gender: Male
Nature: Jolly
Posts: 697
Quote:
Originally Posted by destinedjagold View Post
403 Forbidden on File: 139 =/
Try this link if you still want it: http://www.romhacking.net/documents/139/
__________________



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:11 AM.