News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

### Author Topic: Hex Editing and FFHackster  (Read 2659 times)

#### Orochi Kusanagi

• Jr. Member
• Posts: 87
##### Hex Editing and FFHackster
« on: October 03, 2018, 07:44:24 pm »
Would doing any of the stuff listed here https://gamefaqs.gamespot.com/boards/522595-final-fantasy/45575058 interfere with using FFHackster? I'm just now trying my hand at learning this stuff, and I haven't really found any answers to that.

#### Disch

• Hero Member
• Posts: 2814
• NES Junkie
##### Re: Hex Editing and FFHackster
« Reply #1 on: October 04, 2018, 12:03:05 am »

I wouldn't rely on it.  The quick and dirty and reasonably safe way to do this is to use FFHackster on an unedited ROM, then make a COPY of that ROM to apply those other patches to.

Do not trust FFHackster to handle a ROM with external changes.  It might work just fine if you're careful, but it's asking for trouble -- and Hackster will have no hesitation about clobbering things it doesn't know anything about.

The much, much longer answer that is really more about how people should be approaching ROM hacking in general

If this is just a quick hack that you are slapping together in a few days/weeks, then you can probably avoid this and stick to my short answer.  But if this is a serious long-term project, I highly recommend considering my advice below:

I cannot overstate this enough.... you NEED a build environment.  Each individual change that you want to make should be separated as much as possible (or as much as is reasonable) and stored in separate files.  Preferably human readable text files that allow for comments so you can know wtf that change does 3 weeks down the road.  Though in some cases you'll probably be stuck with IPS patches.

Then you need a build script that you can run, which takes ALL of those changes, applies them to a fresh, untouched ROM (in an order that you can configure and customize) -- and generates your final hacked ROM.

This provides numerous benefits:

• VERSION CONTROL.  You can throw your project up on git. You'll never lose progress, you'll be able to make branches to experiment with new things without worrying about trashing all the work you've done, etc.  All that great version control stuff that is criminially absent from most approaches to retro rom hacking
• You can cherry pick/remove individual changes if they cause a problem down the road merely by deleting (or commenting out or disabling) an individual file, rather than going back into your hacked ROM and "undoing" the hack
• ROM/Project destroying conflicts can't happen anymore because there's no ROM to destroy.
• Other conflicts can still happen but they can be minimized by isoliting individual changes.  Which makes conflicts much easier to find and fix.
• This makes it MUCH easier to work in a group.  Seriously, trying to have multiple people editing the exact same version of a ROM is a nightmare.  But having people contributing changes to a git repo is done millions of times a day without problems.
• I can go on all day with reasons.  Seriously... this is the way to do it

You probably should never be saving your changes directly to the ROM.  That makes them very hard to track, and makes it very easy to forget what you've done, and it makes it really hard to rewind to an earlier version if when something goes wrong.  And... frankly... it makes things harder to edit.  Editing a binary is much harder than editing a text file.

Unfortunately.... I made FFHackster like 20 years ago when "in-place" editing was kind of the norm.  But you can jump through some hoops to work around it.

• As mentioned in the short answer, Hackster should only touch its own copy of the ROM.
• Make some kind of script/shortcut to generate an IPS from the ROM Hackster is modifying
• Run that script after you save changes in Hackster
• Add a line in your build script (the one that actually will produce your hacked ROM file) to apply that IPS to the target ROM.  This should probably be the first change it applies, and you should layer other changes on top of it

You can probably even merge those last three steps to create an IPS, and apply it in the build script.  Or -- I guess skip the IPS entirely and just apply your changes to the Hackster-modified ROM (after copying it somewhere else, of course).

This adds an extra step of having to run a script after you save changes in Hackster, but that's as easy as two clicks of a mouse, or two key taps on a keyboard once you get things set up right.

FWIW -- I've kicked around the idea of making such a build tool that would allow people to approach retro ROM hacking more like modern software development but I don't really have much free time these days so I'll probably never get around to it.

#### Orochi Kusanagi

• Jr. Member
• Posts: 87
##### Re: Hex Editing and FFHackster
« Reply #2 on: October 04, 2018, 01:30:02 am »
Thanks for the very thorough response!

I had zero knowledge about hex editing and couldn't even do sprite editing just last week, but I've had a dream for quite some time (and I think I posted about this in the hack idea topic a while back) and I decided to make it a reality and learn this stuff.

This is likely going to be a very long term project just for the simple fact that I'm going in with zero programming knowledge, but I already understand the concept of the DTE table and playing around with the hex editor (I was so proud when I figured out how to change the intro text in FF1).

The script building to help manage changes is a great idea, but one I don't even understand how to implement at the moment.

Would it be unrealistic to go this route? Use FFHackster to edit whatever it can do naturally, and then start editing the hex to implement all of those bug fixes/updates while making many separate copies in case something breaks?

#### Disch

• Hero Member
• Posts: 2814
• NES Junkie
##### Re: Hex Editing and FFHackster
« Reply #3 on: October 04, 2018, 12:44:17 pm »
Yeah I realize my suggestion is a lot to bite off.  Which is probably why not many people do it.  Sigh.  Maybe one of these days I'll get around to making that program.

Anyway...

Quote
Would it be unrealistic to go this route? Use FFHackster to edit whatever it can do naturally, and then start editing the hex to implement all of those bug fixes/updates while making many separate copies in case something breaks?

That would probably be fine, but would be a lot of work.

If you want a VERY simple build script, you really only need to learn how to do two things:

1)  Copy a file via a command line
2)  Apply an IPS patch via a command line

I'm sure there's a patcher somewhere that has a CMD interface.  LIPS might, but I'm not sure, I'm too lazy to check.

Your build script would just be a batch file that does the copy, then applies all the patches.  You're not really writing any code, just a few commands to automate.

Example:

Code: [Select]
copy /B hackster_rom.nes  my_hack.nesips patch1.ips my_hack.nesips patch2.ips my_hack.nes
...etc.

The first line does a [binary] file copy, taking the file hackster is messing with and copying it to a new ROM, and then the remaining lines are applying individual patches to that ROM in whatever order you want (so these might be the hacks from that gamefaqs page, but in IPS form).  Put this in a text file with a normal text editor like notepad or notepad++, then change the extension to .bat so you can run it... and then just double-click it when you want to do a new "build".

Note, of course, that you'll probably want to change the filenames in this file.  Also, the lines for applying an IPS will probably look different depending on what patcher you're using.  Like I said I'm too lazy to find one that has a commandline interface, or what the actual command would look like, but it's probably something very similar to what I have there.

#### abw

• Hero Member
• Posts: 581
##### Re: Hex Editing and FFHackster
« Reply #4 on: October 04, 2018, 05:16:08 pm »
+1 to everything Disch said. You can get away with quick-and-dirty for tiny projects, but the bigger your project gets, the more important project management becomes.

I'm sure there's a patcher somewhere that has a CMD interface.  LIPS might, but I'm not sure, I'm too lazy to check.
I've been using liteips for this, and the commands are exactly as predicted:
Code: [Select]
\path\to\liteips.exe patch1.ips my_hack.nes

#### Orochi Kusanagi

• Jr. Member
• Posts: 87
##### Re: Hex Editing and FFHackster
« Reply #5 on: October 04, 2018, 07:42:52 pm »
Thank you very much, both of you! This should make things a lot easier.

In a few weeks when I actually have a bit more worked on, I plan on making a thread in the projects section for this. This has been one hell of a learning experience so far.