Users browsing this thread: 1 Guest(s)
Question about the IPS format

#1
Posts: 48
Threads: 7
Thanks Received: 0
Thanks Given: 0
Joined: Dec 2017
Reputation: 0
Status
None
Hello,

I'm been interested in hacking SNES games for many years but only now did I finally caved in my desires and seriously started to tiptoe into the wonderful world of the 65816 processor. Only problem is that I'm using Linux. I just created a very small hack that basically centers the characters' full name in the end credits and change Shadow's name to Clyde Arrowny. Using the extra space freed by the removal of the letter "w", I also was able to create pointers for everybody's last name, because reasons! Smile

BUT I can't create an IPS patch out of it. I tried Sure, I could:

x. Setup a Windows VM and use the tools that are already available.
x. Fix whatever is my dependancy problem with EWingIPSPatcher (a patcher made for Linux that doesn't work for me for some reason).

But I want to take the unnecessary complicated route and create my own tool. In order to do that, I have one simple question: how does the IPS format work exactly? I get the impression that this is a set of commands saying (put value X in address Y), but I wasn't able to find documentation on how the IPS file itself is created. Thanks for any information you can provide.

I also have an unrealted question, where in the code of Final Fantasy are the text functions located? How about the end game character name display?
  Find
Quote  

#2
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 158
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
Hello and welcome! I doubt I could answer your first question just because I'm not experienced with Linux... Sad I mean, I know how to make a IPS patch easily enough with a program such as Lunar IPS or SNEStuff, but I suspect your question is more than that, so hopefully another can shed light on that.

As for text functions, which ones? The end game character name display, check here:
https://www.ff6hacking.com/forums/thread...ding+names
and here on the wiki for a permanent link to the breakdown chart Madsiur put together:
https://www.ff6hacking.com/wiki/lib/exe/..._names.zip


We are born, live, die and then do the same thing over again.
Quote  

#3
Posts: 127
Threads: 8
Thanks Received: 21
Thanks Given: 12
Joined: Jan 2012
Reputation: 13
Status
None
I have this short doc for the IPS file format. The format is pretty simple and similar to what you imagined:

Code:
             -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
                    The IPS File Format
             -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

               A quick and easy file format
              description for one of the most
               widely used non-binary formats
                       in emulation.

                     Written by Neil_

                          --FAQ--

o Who will benefit from this document?

- The following people will benefit from this tech doc:
    o Programmers wishing to code an IPS patcher or
       add IPS patching ability to their programs.
    o Masochists who absolutely must know what they've
       been using all these years

o What is required knowledge for reading this document?

- Not much. It's a pretty straight forward topic.

o Why did you write this FAQ for a straight forward topic?

- I was wasting time waiting for my brother to get off
   the Internet on the downstairs computer so I could
   log on, and the amount of boredom overtook me.
   
                         --Intro--

 The IPS file format is probably the most widely used format
in   emulation.  It's  a  very  handy  tool  and  basically
revolutionized  the  way translation  and graphics hacks of
commercial ROM images were distributed. Up until the time of
it's  adoption  by ROM  Hackers, Hacks had been distributed
with  the entire ROM image zipped up in a ZIP archive. This
proved to be a major waste of space as most hacks changed no
more  than 5%  of the entire ROM image. That meant that the
Hacker ended up distributing a file that contained 95% more
data  than  it  needed  to.  Why, in  a  world  of  limited
bandwidth,  make  users download  more than they absolutely
have  to? Here's where the IPS file format comes in. An IPS
file  contains only  a list of the bytes that were changed,
and  what  they were  changed to. For  the first time, hack
archives that had been 3 megs suddenly became 22k. Suddenly
ROM  hack  and translation  fans could save themselves from
downloading  3 megs  every time a new version came out, and
just download another 30k or so patch. How was this amazing
feat of size reduction accomplished?

                  --The IPS File Format--


The first 5 bytes of the IPS format are the letters
'PATCH' in ASCII format. This allows a program reading
the file to verify that it is indeed an IPS patch.

The next three bytes are the place in the destination file
(the file to be patched) where a change is to be made.

The two bytes following that are the length of the amount
of data to be changed.

The next string of bytes are the replacement bytes, which
go on for how ever many bytes were specified in the previous
two bytes.

If the two bytes specifying the length of the patch are
zeroes, then there is a section of code being replaced
by a single character, say FF. In this case, the next byte
gives the number of bytes to be replaced, and the byte after
that is the data that will be filled in that area.

Once the end of the patching length given is reached, you'll
either reach the end of the patch file or another two bytes
giving you the location of the next place in the destination
file to be changed. In that case, you go through these steps
again.

                          --End--

That should just about cover it all... If I missed
something, just drop me a line.

-Neil_

Neil@parodius.com
3459
I think I got this doc from RHDN but I can't find it there anymore... so here it is Smile

The address and chunk size are stored big endian if I remember correctly.

The single byte filler is also known as RLE compression: https://en.wikipedia.org/wiki/Run-length_encoding


and welcome to the forum!
  Find
Quote  

#4
Posts: 48
Threads: 7
Thanks Received: 0
Thanks Given: 0
Joined: Dec 2017
Reputation: 0
Status
None
Thank you, Gi Nattak! Yes, I am aware of Madsiur's document as I used it to build a spreadsheet and start messing around with the values.

Unfortunately, Lunar IPS and SNEStuff do not work on Linux. But, good news, I was able to find this link: IPS (binary patch format)

In fact, the IPS format is incredibly simple. So mush so that I just created the IPS file manually by copy-pasting the values from my spreadsheet.

Basically, an IPS patch is composed of:

1. An header of 5 bytes: 50 41 54 43 48 (PATCH).
2. A 3-byte offset (big-endian) where information (payload) in the soon-to-be patched file will change.
3. A 2-byte length of the payload.
4. The payload itself
5. Rinse and repeat step 2 to 4.
6. An EOF value (45 4F 46)

And also RLE compressions like m06 said, which I don't understand for the moment.

I just came back from my D&D night. I will post my IPS tomorrow.
  Find
Quote  

#5
Posts: 175
Threads: 11
Thanks Received: 10
Thanks Given: 8
Joined: May 2013
Reputation: 13
Status
Well-Fed
There's also Floating IPS/Flips (https://github.com/Alcaro/Flips), which runs command line and has a GTK+ gui for Linux. I haven't actually tested it yet, but it's *supposed* to run.


Current Project: FF6: Tensei | Discord ID: TristanGrayse
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite