Author Topic: How to apply patches to a game rom  (Read 8581 times)

0 Members and 1 Guest are viewing this topic.

Offline Kerr Avon

  • Hero Member
  • *****
  • Posts: 1431
  • Karma: +130/-3
    • View Profile
How to apply patches to a game rom
« on: March 08, 2018, 10:12 PM »
Note: This guide is unfinished. As yet it only explains how to use .xdelta patches and the Delta Patcher. I'll add to it to cover the Goldeneye Editor, .ips, .bps, etc later.

This is a guide to applying patches to game roms. Patching roms is easy to do, and is a good skill to have, but like most things, it's probably a little confusing to anyone new to it, so this guide should cover everything needed. If not, then please post your questions below



What are patches, and why do we use them?

Thanks to the skills and hard work of some very talented (and unpaid!) game fans, it's not uncommon for a game to be altered or improved somehow, be it to remove a bug(s) from a game, or to add a new feature, or to add new levels into a game. Language translations are another popular form of game-modding (as it's known), usually to translate a non-English game into English, but translations to other languages exist too. A modded game can be almost identical to the original game, with just a very minor change, or can be almost totally different in any number of ways, depending on the skills and ambitions of the person or people who do the modding.

Modding a game like this is perfectly legal, but since the modded game still contains mostly the same code and contents as the original game, then that game is still copyrighted to whoever owns the copyright (be it Nintendo, Rare, Electronic Arts, etc), and so when someone mods a game then they aren't legally allowed to share that modded game with anyone.

So a legal way around this is to use a patch. A patch is a file that lists the difference between the original game, and the modded game, and so when someone else applies the patch to their own copy of the original game rom, then the game rom's contents (code and data) is altered to make a rom identical to the modded rom that was created originally by the person who did the original modding.





OK, so how do I use a patch?

Patches come in several different  formats, such as .xdelta, .ips, and .bps, and you need to use a specific program to apply a given patch format. Whatever format a patch is in, they all work in the same way, which is when they are applied by the patching program, they alter a clean (i.e. un-alterned) rom to make the alterations/improvements

To apply a patch to a rom, you need three things:

1. The patch itself,

2. A clean copy of the rom that needs to be altered. Usually the type of rom needed will be specified either in a 'read me.txt' text file that comes with the patch, or will be mentioned on the web page where you downloaded the patch from.

3. The patch program. The program you use to apply the patch will depend on the type of patch you wish to apply.

For .xdelta files there are two programs you can use. These are Delta Patcher (http://www.romhacking.net/utilities/704/) and the Goldeneye Setup Editor (http://www.goldeneyevault.com/viewfile.php?id=37). I'll provide an example for using both of these programs to apply a patch.

These examples will all be for Windows, using Windows based patching programs, as I don't know any other operatins system, sorry.




Example 1 - Applying an .xdelta patch using the program Delta Patcher.

We'll use the game Last Legion UX as an example. The steps to follow are:

1. Create a folder to contains the files that you'll be using. C:\N64 is as good as any.

2. Download the patch into your folder (which is C:\N64 or whatever you chose). The patch for Last Legion UX is available from:

http://www.romhacking.net/translations/2868/

It should now look something like this:






3. If the patch file comes as an archive file (such as a .zip, or .rar, or .7z) then un-archive the contents into the C:\N64 folder. Then for clarity's sake, delete the archive file (just to avoid confusion, but you can leave it if you prefer), but of course keep the patch file (the .xdelta file) and the text file (if any text file came in the archive).

It should now look something like this:





4. Download the patcher program to the same folder, or if you already have it, then put it in the folder. The patcher program is called Delta Patcher, and is available from:

http://www.romhacking.net/utilities/704/


5. If the Delta Patcher is in an archive (.zip, or .rar, or.7z, etc) then un-archive it into your folder, so the .exe file and any others are in there. You can then of course delete the archive file, if you like. I recommend using 7zip (http://www.7-zip.org/download.html) as it's fast and free.

It should now look something like this:





6. Download the game rom. Often you're told exactly what rom to get, even down to the exact file name (it can be 'Super Mario 64 [!] (U).Z64', or 'Perfect Dark (U) (V1.1) [!].Z64', etc). It's important to get the right region too, as most games come in two or three regions (NTSC (U), PAL (E), and JAP (J)), plus a few games have a second or third official release that fixes some bugs, so you always have to be careful to find the right rom. Usually you want the NTSC (U) version of a rom, as most hacks are made for the NTSC version of a game.

The Last Legion UX English patch's readme.txt file doesn't say to get any specific version of the game, but in this case it's not needed, as since it's a patch to convert the Japanese game to English, then obviously you need the Japanese version of the game. And indeed, since the game is only available in Japanese, then there is only one version of the rom, so download the game Last Legion UX, or get a copy of it from a friend.

I can't tell you where to download it, as that's illegal. But google makes it easy to find anything, and when you download it, then virus check it (as you should virus check EVERYTHING you ever download - I recommend using the free version of Avast! Antivirus). And don't download the file if it's a .exe file, as that WILL be infected with something bad.

When you've downloaded the rom file, then if it's an archive then copy it's contents into the C:\N64 folder. Delete the archive if you like.

It should now look something like this (The red, green, and blue lines and words were later added by me):






7. Now we have all three things needed to apply the patch (the patch, the patcher program, and the un-altered game rom), so we can now apply the patch to the rom. To do this, run the program DeltaPatcher.exe

It should now look something like this:





Click on the yellow folder where it says 'Original File' and locate and select the game rom (in this case, 'Last Legion UX (Japan).n64').

Click on the yellow folder where it says 'Original File' and locate and select the patch file (in this case 'Last Legion UX (USA).xdelta')

It should now look something like this:





Now click 'Apply Patch', and after a moment Delta Patcher will either announce success or failure. If it's successful, then congratulations, you now have a patched and working game rom.

If however you receive an error message, then it might be one of several things. The most likely is that the rom you downloaded is the wrong-endian. For some reason, N64 game roms are available in two types, big-endian and little-endian (also known as byteswapped and unbyteswapped). I can never remember which is which, and I don't know why the byteswapped format exists, but basically a game rom can be in either format, and if it's in the wrong format then the patcher program can't use that rom.

It's not a real problem, though, because it's very easily fixed.

So, if the above attempt at patching failed, or you just want to change the byte-swapped status of a game rom for whatever reason, then do the following:



8. To alter the byteswapped (otherwise known as 'endian') status of a game rom, you need a program called Tool64 v1.11, available from:

https://www.zophar.net/utilities/n64aud/tool-n64.html

Download it and unarchive it into your C:\N64 folder. Delete the archive if you like.

It should now look something like this:





9. Run tool64.exe.

From Tool64's drop down menu, select FILE, then Open (the same as you do with other Windows programs), then select C:\N64 and click OK.

You will now see the game rom (in this case Last Legion UX) listed in Tool64. And the display will show whether or not the rom is byte-swapped.

It should now look something like this:





And of course we want to change it from being byte-swapped to being not byte-swapped (also known as altering it's Endian format), or vice versa, since the patcher program we've just tried couldn't use the game rom. So highlight the game rom in Tool 64, by clicking on it once, so it's highlighted.

It should now look something like this:





Then click the right pointing arrow to convert the rom to big-endian.






The game rom will now be converted, and will now be able to be patched, so exit Tool64, and try to patch the game rom now, by going to step 7 again in this list.

If step seven fails again, then try to download the game rom from a different site, in case the one you downloaded was corrupt.

Offline Dia-Betic

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: How to apply patches to a game rom
« Reply #1 on: March 14, 2018, 08:03 PM »
Thank you sir!

Offline FeverDrive

  • Hero Member
  • *****
  • Posts: 1240
  • Karma: +53/-0
  • Blast Processing™ inside
    • View Profile
Re: How to apply patches to a game rom
« Reply #2 on: March 15, 2018, 03:55 AM »
Wonderful work Kerr, thank you very much  :D
We must embrace pain and burn it as fuel for our journey.

Offline brid_ger

  • Newbie
  • *
  • Posts: 1
  • Karma: +1/-0
    • View Profile
Re: How to apply patches to a game rom
« Reply #3 on: February 10, 2019, 05:29 AM »
THANK YOU SO MUCH FOR THIS! I literally created an account on here to thank you for this!

Offline Junninx

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
    • View Profile
Re: How to apply patches to a game rom
« Reply #4 on: January 09, 2020, 04:29 PM »
 How can I check crc32 sha-1 md5 and these type of things we usually are told to do in some patches?

Offline supersign

  • Full Member
  • ***
  • Posts: 174
  • Karma: +15/-0
    • View Profile
Re: How to apply patches to a game rom
« Reply #5 on: January 09, 2020, 05:09 PM »
How can I check crc32 sha-1 md5 and these type of things we usually are told to do in some patches?
Are you on Windows or macOS?

Also, Kerr, you might wanna check with photobucket as they doing that blur thing again.
« Last Edit: January 10, 2020, 01:53 PM by supersign »

Offline Kerr Avon

  • Hero Member
  • *****
  • Posts: 1431
  • Karma: +130/-3
    • View Profile
Re: How to apply patches to a game rom
« Reply #6 on: January 09, 2020, 08:52 PM »
How can I check crc32 sha-1 md5 and these type of things we usually are told to do in some patches?

To be honest, I've never checked the checksum of anything I've downloaded or patched., so I personally don't know how to. I've almost never had problems when patching something, as any decent patcher tells you if there's a problem, even if the error message doesn't tell you the cause of the problem.

When there has been a problem, it's always either down to my using the wrong game rom (for example, a few N64 games come in version 1.0 and version 1.1, sometimes there's even a v1.2, such as the NTSC versions of Banjo Kazzoie, and Perfect Dark), which is down to my not reading the text file that comes with the patch, or the game rom I was using was in the wrong byte order format. I describe how to fix this from point seven onwards in the first post of this thread.

Offline supersign

  • Full Member
  • ***
  • Posts: 174
  • Karma: +15/-0
    • View Profile
Re: How to apply patches to a game rom
« Reply #7 on: January 09, 2020, 09:31 PM »
With Windows XP to 10, usually you can right click on a file and you should see 'CRC SHA' on the context menu and select CRC-32 and it shows you the hash number. And then compare the hash at this checksum database.

Offline FeverDrive

  • Hero Member
  • *****
  • Posts: 1240
  • Karma: +53/-0
  • Blast Processing™ inside
    • View Profile
Re: How to apply patches to a game rom
« Reply #8 on: January 11, 2020, 11:06 PM »
With Windows XP to 10, usually you can right click on a file and you should see 'CRC SHA' on the context menu and select CRC-32 and it shows you the hash number. And then compare the hash at this checksum database.
Yep, but this isn't a native windows feature, you have to install 7-zip first.

In my case I use a little program called Hashcalc from Slavasoft and if I want something more complete I use HashMyFiles from Nirsoft.
We must embrace pain and burn it as fuel for our journey.

Offline supersign

  • Full Member
  • ***
  • Posts: 174
  • Karma: +15/-0
    • View Profile
Re: How to apply patches to a game rom
« Reply #9 on: January 16, 2020, 12:08 PM »
I forget that 7-zip did that. Whoopsie.