m →Extracting the ROM From the WAD: add downgrade link |
|||
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
For using the | For using the Randomizer you need to have a backup copy of Ocarina of Time on your computer. This guide will demonstrate how to do this. | ||
== Wii Virtual Console == | == Wii Virtual Console == | ||
Line 5: | Line 5: | ||
=== What You Will Need === | === What You Will Need === | ||
* [[Wii Virtual Console#Softmodding Your Wii|A Softmodded Wii]] or [[Wii Virtual Console#Softmodding Your Wii U's Virtual Wii Mode|A | * [[Wii Virtual Console#Softmodding Your Wii|A Softmodded Wii]] or [[Wii Virtual Console#Softmodding Your Wii U's Virtual Wii Mode|A Softmodded vWii]] | ||
* A Dump of your Ocarina of Time Virtual Console Channel ([https://wii.guide/dump-wads.html Wii Guide has a page on doing this]) | * A Dump of your Ocarina of Time Virtual Console Channel ([https://wii.guide/dump-wads.html Wii Guide has a page on doing this]) | ||
* gzinject | * gzinject | ||
Line 18: | Line 18: | ||
'''macOS''': Currently you have to build from source. Setting up a build environment is out of scope for this guide, but once you have it set up you should be able to [https://github.com/krimtonz/gzinject/archive/refs/tags/0.3.1.zip download the source code] then [https://github.com/krimtonz/gzinject/blob/master/BUILDING.md follow the BUILDING file on GitHub] | '''macOS''': Currently you have to build from source. Setting up a build environment is out of scope for this guide, but once you have it set up you should be able to [https://github.com/krimtonz/gzinject/archive/refs/tags/0.3.1.zip download the source code] then [https://github.com/krimtonz/gzinject/blob/master/BUILDING.md follow the BUILDING file on GitHub] | ||
=== Extracting the ROM From the WAD === | |||
Once you have a version of gzinject that runs, you'll need to find yourself the Wii common key or figure out a way to generate one. It is the same file you will need to make a WAD on the online generator as well. The file should be placed in the same folder as gzinject and called <samp>common-key.bin</samp>. Once you have that in place, gzinject should be ready for use. | Once you have a version of gzinject that runs, you'll need to find yourself the Wii common key or figure out a way to generate one. It is the same file you will need to make a WAD on the online generator as well. The file should be placed in the same folder as gzinject and called <samp>common-key.bin</samp>. Once you have that in place, gzinject should be ready for use. | ||
To extract all of the data from your dumped WAD, open a terminal and type <samp><kbd>gzinject -a extract -w </kbd></samp>. Don't forget the space at the end. Next drag your dumped WAD onto the terminal. This should put the path to the WAD at the end. If there is not a space between the "w" and the path, use the arrow keys to go back and add the space. If so, press <samp><kbd>Enter</kbd></samp> and gzinject should now extract the WAD to a folder called <samp>wadextract</samp>. | To extract all of the data from your dumped WAD, open a terminal and type <samp><kbd>gzinject -a extract -w </kbd></samp>. Don't forget the space at the end. Next drag your dumped WAD onto the terminal. This should put the path to the WAD at the end. If there is not a space between the "w" and the path, use the arrow keys to go back and add the space. If so, press <samp><kbd>Enter</kbd></samp> and gzinject should now extract the WAD to a folder called <samp>wadextract</samp>. | ||
If it does not make sure that you have the <samp>common-key.bin</samp> file in the right place, and that you typed the command in the terminal correctly, including the space. | If it does not make sure that you have the <samp>common-key.bin</samp> file in the right place, and that you typed the command in the terminal correctly, including the space. | ||
Now if you open the <samp>wadextract</samp> folder there should be another folder inside called <samp>content5</samp> and inside of that folder is a bunch of files, but the one you are looking for is called <samp>rom</samp>. This is an Ocarina of Time 1.2 ROM that you can run in an emulator. If you want to use it for the Randomizer you will have to downgrade it to 1.0. | Now if you open the <samp>wadextract</samp> folder there should be another folder inside called <samp>content5</samp> and inside of that folder is a bunch of files, but the one you are looking for is called <samp>rom</samp>. This is an Ocarina of Time 1.2 ROM that you can run in an emulator. If you want to use it for the Randomizer you will have to [https://oot.flagrama.com/ downgrade it to 1.0]. | ||
== Gamecube == | |||
Another way to to make a backup of Ocarina of Time is by ripping a Gamecube disc to an ISO using a Wii and then extracting the ROM using Dolphin. | |||
=== What You Will Need === | |||
* [[Wii Virtual Console#Softmodding Your Wii|A Softmodded Wii]] or [[Wii Virtual Console#Softmodding Your Wii U's Virtual Wii Mode|A Softmodded vWii]] | |||
* A Dump of your Ocarina of Time / Master Quest disc or Zelda Collector's Edition disc ([https://wiki.dolphin-emu.org/index.php?title=Ripping_Games Dolphin's wiki has a guide on doing this.]) | |||
* The [[Dolphin]] Emulator | |||
* A Hex Editor and/or Binary File Manipulation Software | |||
=== Extract File From Disc === | |||
First, in Dolphin you will need to have the ISO backup of your GameCube disc in the list of games in the main window. If you need to add the path the files are located in, go to <samp><kbd>Options</kbd>→<kbd>Configuration</kbd>→<kbd>Paths</kbd></samp> and click the <samp>Add...</samp> button. Next navigate to the folder with your ISO file in it and click <samp>Open</samp>. | |||
With the backup in the game list, right-click the game and click on <samp><kbd>Properties</kbd></samp> then click on the <samp>Filesystem</samp> tab. You may need to click the arrows on the right of the tabs list to find it. | |||
For a Ocarina of Time / Master Quest ISO, you will want to look for the <samp>zlj_f.tgc</samp> file for the US copy, if other copies do not have this file, you want the large 500MB+ size file. For Collector's Edition you want to open the <samp>tgc</samp> folder and select the <samp>zelda_ENG_090903.tgc</samp> file for the US copy, if other copies do not have this file, you want the large 480MB file. Right-click the file and click <samp>Extract File...</samp> and extract it to a folder. | |||
=== Create ROM File From Extracted File === | |||
For this part you will want a hex editor for finding where the ROM is in the file we extracted. | |||
For '''Windows''': [https://mh-nexus.de/en/hxd/ HxD] is recommended. It will also be able to copy the data you find to make a ROM file. | |||
For '''macOS''': [https://hexfiend.com/ Hex Fiend] looks like a good choice. | |||
For '''Linux''': Any graphical hex editor should work, or if you're experienced with <samp>hexdump</samp> that should also work. | |||
First lets locate the ROM file in the extracted file using a hex editor. Open up the file in a hex editor, then open a find dialog. Hex Fiend has this located at the top of the window. Other software should be able to bring up one by pressing <samp><kbd>Ctrl</kbd>+<kbd>F</kbd></samp> or on macOS <samp><kbd>Command ⌘</kbd>+<kbd>F</kbd></samp>. Make sure it is in <samp>Hex</samp> mode, or you are typing in the <samp>Hex</samp> side of the window. Type <code>80 37 12 40</code> and try to search for that string. This is the "magic" header for a N64 ROM and all N64 ROMs start with these bytes. | |||
Your hex editor should have a place on the window where it displays an "Offset" value somewhere in the window. Make sure you have the 8 or 0 in <code>80</code> selected and then write down this value. It is usually a hex value which means that it uses the numbers 0-9 and the letters A-F. Use [https://www.rapidtables.com/convert/number/hex-to-decimal.html this Hex to Decimal] converter to convert the hex number to a normal decimal number. We will use this in the next section, but the next part is OS specific. | |||
=== Windows === | |||
Now that you have the decimal value of where the ROM is located, press <samp><kbd>Control</kbd>+<kbd>E</kbd></samp> to open the <samp>Select block</samp> dialog. Make sure that the radio button next to the <samp>dec</samp> option is selected. In the <samp>Start-offset</samp> text box paste or type the decimal value of where the ROM is. Next click the radio button next to <samp>Length</samp> and type in that text box <samp><kbd>33554432</kbd></samp>. Next click <samp>OK</samp> and the ROM file will now be selected. | |||
Copy the ROM file's bytes with <samp><kbd>Ctrl</kbd>+<kbd>C</kbd></samp>, open a new file by pressing <samp><kbd>Ctrl</kbd>+<kbd>N</kbd></samp>. Next press <samp><kbd>Ctrl</kbd>+<kbd>S</kbd></samp> to save the file. Save it with a name you will remember such as <samp>Ocarina of Time.z64</samp> or similar. | |||
=== Linux and macOS === | |||
Now that you have the decimal value of where the ROM is located, open a terminal. Type <samp><kbd>cd</kbd></samp> and press space, then drag the folder you want to save the ROM in into the terminal such as your Downloads folder then press <samp><kbd>Enter</kbd></samp>. | |||
We will be using <samp>dd</samp> to extract the relevant bytes from the file we extracted. Type <samp><kbd>dd skip=</kbd></samp> and paste the decimal value of where the ROM is located, then press space and continue the command with <samp><kbd>count=33554432 if=</kbd></samp> then drag the file you extracted using Dolphin into the terminal to put it's path here. Press space again then continue the command with <samp><kbd>of=OcarinaOfTime.z64 bs=1</kbd></samp> and press <samp><kbd>Enter</kbd></samp>. This will create a file called | |||
<samp>OcarinaOfTime.z64</samp> in the folder you chose earlier. | |||
== Nintendo 64 == | |||
You can also dump directly from your own N64 carts too. There are many different methods to do so, but not all of them have been tested so it's not realistic to support all of them. | |||
=== JoeyN64 Cart Flasher === | |||
'''Supports: Windows''' | |||
Known working with but unsupported: Linux (Issues with updating firmware and writing files back to cart) | |||
[https://bennvenn.myshopify.com/products/joeyn64-cart-flasher Store Page] | |||
The JoeyN64 Cart Flasher by BennVenn focuses more on rewriting bootleg carts, but can also be used for dumping real carts as well. Generally it is pretty easy to use, however it may try to overdump Ocarina of Time ROMs if it uses a different ROM chip than expected internally. In that case you'll need to play with a hex editor to get a working ROM for randomizer. You'll also need a USB wire to plug into your computer on one end, and a USB-C plug on the other that does data transfer to plug into the device. | |||
====Usage==== | |||
Using the JoeyN64 itself is easy. You just place the game cart into the cartridge connector, ensure that the label is facing away from the N64 controller port. Then plug the USB cable into your computer, then into the JoeyN64. It should show up like a USB drive would in This PC. Open it up and you should see a <samp>DEBUG</samp> or <samp>DEBUG.TXT</samp> file. Opening that file should open it in notepad or an equivalent text editor. Ensure that the line near the end of the file says <samp>Checksums OK!</samp> and not <samp>Checksums Bad!</samp>. If it says the checksums are bad, unplug the JoeyN64 and try reseating the cartridge. If it continues to happen, try cleaning the contacts on the cartridge with some isopropyl alcohol and a cotton swab, wait for it to dry, and try the JoeyN64 again. Once the checksums are good there should be a <samp>THE_LEGE.Z64</samp> file next to the debug text file. You can copy that to your computer. You can also backup your save file <samp>THE_LEGE.SRA</samp> here too. | |||
You may notice that the file you copied is 64MB. This is due to hardware in the cartridge behaving differently than expected by the firmware. [[#Create ROM File From Extracted File|You'll need to cut out the excess data using a hex editor or disk dumper like for the Gamecube method]]. Just in this case you will be starting at location 0 for Windows, or skipping 0 bytes for macOS and Linux. | |||
Once you have a 32MB file, you can use the [https://oot.flagrama.com downgrader site] to verify or downgrade your ROM to be used for the randomizer. If it is a 1.0 ROM already, you can get started using the randomizer. If it detects as a downgradable/convertable ROM you can do so to get a 1.0 ROM to use. If the site cannot detect your ROM, try again with a fresh dump copied from your cart to your PC. | |||
====Updating Firmware==== | |||
Go to [https://bennvenn.myshopify.com/products/joeyn64-cart-flasher#firmware-updates Firmware updates] and download the newest firmware version. It should be near the top of the list. Open the downloaded zip file and copy the <samp>MODE.TXT</samp> file from the zip to the JoeyN64, then wait for it to disconnect then reconnect. Next copy the <samp>FIRMWARE.JR</samp> file and paste it in the JoeyN64. It should disconnect and then reconnect and the <samp>DEBUG.TXT</samp> file should display the new version in the top line. |
Latest revision as of 23:18, 11 November 2023
For using the Randomizer you need to have a backup copy of Ocarina of Time on your computer. This guide will demonstrate how to do this.
Wii Virtual Console
The easiest method of backing up a copy of Ocarina of Time is by creating a WAD of the version installed on your Wii and then extracting that WAD using gzinject and finding the file called rom inside of the extracted contents.
What You Will Need
- A Softmodded Wii or A Softmodded vWii
- A Dump of your Ocarina of Time Virtual Console Channel (Wii Guide has a page on doing this)
- gzinject
Getting and Setting Up gzinject
gzinject is an application by Krim/Krimtonz originally for putting the OoT Practice ROM in a WAD, but now has a variety of uses.
Windows: Download then extract the zip file. To run it, open the folder with gzinject in it, then click in the address bar and type cmd and press Enter. In the terminal that shows up you should be able to type gzinject and press Enter and see a bunch of information on how to use gzinject. If you do, move on to the next step.
Linux: Try using the WSL build of gzinject. It doesn't link to many libraries so should work without recompiling. If not, download the source code and then follow the BUILDING file on GitHub.
macOS: Currently you have to build from source. Setting up a build environment is out of scope for this guide, but once you have it set up you should be able to download the source code then follow the BUILDING file on GitHub
Extracting the ROM From the WAD
Once you have a version of gzinject that runs, you'll need to find yourself the Wii common key or figure out a way to generate one. It is the same file you will need to make a WAD on the online generator as well. The file should be placed in the same folder as gzinject and called common-key.bin. Once you have that in place, gzinject should be ready for use.
To extract all of the data from your dumped WAD, open a terminal and type gzinject -a extract -w . Don't forget the space at the end. Next drag your dumped WAD onto the terminal. This should put the path to the WAD at the end. If there is not a space between the "w" and the path, use the arrow keys to go back and add the space. If so, press Enter and gzinject should now extract the WAD to a folder called wadextract.
If it does not make sure that you have the common-key.bin file in the right place, and that you typed the command in the terminal correctly, including the space.
Now if you open the wadextract folder there should be another folder inside called content5 and inside of that folder is a bunch of files, but the one you are looking for is called rom. This is an Ocarina of Time 1.2 ROM that you can run in an emulator. If you want to use it for the Randomizer you will have to downgrade it to 1.0.
Gamecube
Another way to to make a backup of Ocarina of Time is by ripping a Gamecube disc to an ISO using a Wii and then extracting the ROM using Dolphin.
What You Will Need
- A Softmodded Wii or A Softmodded vWii
- A Dump of your Ocarina of Time / Master Quest disc or Zelda Collector's Edition disc (Dolphin's wiki has a guide on doing this.)
- The Dolphin Emulator
- A Hex Editor and/or Binary File Manipulation Software
Extract File From Disc
First, in Dolphin you will need to have the ISO backup of your GameCube disc in the list of games in the main window. If you need to add the path the files are located in, go to Options→Configuration→Paths and click the Add... button. Next navigate to the folder with your ISO file in it and click Open.
With the backup in the game list, right-click the game and click on Properties then click on the Filesystem tab. You may need to click the arrows on the right of the tabs list to find it.
For a Ocarina of Time / Master Quest ISO, you will want to look for the zlj_f.tgc file for the US copy, if other copies do not have this file, you want the large 500MB+ size file. For Collector's Edition you want to open the tgc folder and select the zelda_ENG_090903.tgc file for the US copy, if other copies do not have this file, you want the large 480MB file. Right-click the file and click Extract File... and extract it to a folder.
Create ROM File From Extracted File
For this part you will want a hex editor for finding where the ROM is in the file we extracted.
For Windows: HxD is recommended. It will also be able to copy the data you find to make a ROM file. For macOS: Hex Fiend looks like a good choice. For Linux: Any graphical hex editor should work, or if you're experienced with hexdump that should also work.
First lets locate the ROM file in the extracted file using a hex editor. Open up the file in a hex editor, then open a find dialog. Hex Fiend has this located at the top of the window. Other software should be able to bring up one by pressing Ctrl+F or on macOS Command ⌘+F. Make sure it is in Hex mode, or you are typing in the Hex side of the window. Type 80 37 12 40
and try to search for that string. This is the "magic" header for a N64 ROM and all N64 ROMs start with these bytes.
Your hex editor should have a place on the window where it displays an "Offset" value somewhere in the window. Make sure you have the 8 or 0 in 80
selected and then write down this value. It is usually a hex value which means that it uses the numbers 0-9 and the letters A-F. Use this Hex to Decimal converter to convert the hex number to a normal decimal number. We will use this in the next section, but the next part is OS specific.
Windows
Now that you have the decimal value of where the ROM is located, press Control+E to open the Select block dialog. Make sure that the radio button next to the dec option is selected. In the Start-offset text box paste or type the decimal value of where the ROM is. Next click the radio button next to Length and type in that text box 33554432. Next click OK and the ROM file will now be selected.
Copy the ROM file's bytes with Ctrl+C, open a new file by pressing Ctrl+N. Next press Ctrl+S to save the file. Save it with a name you will remember such as Ocarina of Time.z64 or similar.
Linux and macOS
Now that you have the decimal value of where the ROM is located, open a terminal. Type cd and press space, then drag the folder you want to save the ROM in into the terminal such as your Downloads folder then press Enter.
We will be using dd to extract the relevant bytes from the file we extracted. Type dd skip= and paste the decimal value of where the ROM is located, then press space and continue the command with count=33554432 if= then drag the file you extracted using Dolphin into the terminal to put it's path here. Press space again then continue the command with of=OcarinaOfTime.z64 bs=1 and press Enter. This will create a file called OcarinaOfTime.z64 in the folder you chose earlier.
Nintendo 64
You can also dump directly from your own N64 carts too. There are many different methods to do so, but not all of them have been tested so it's not realistic to support all of them.
JoeyN64 Cart Flasher
Supports: Windows Known working with but unsupported: Linux (Issues with updating firmware and writing files back to cart)
The JoeyN64 Cart Flasher by BennVenn focuses more on rewriting bootleg carts, but can also be used for dumping real carts as well. Generally it is pretty easy to use, however it may try to overdump Ocarina of Time ROMs if it uses a different ROM chip than expected internally. In that case you'll need to play with a hex editor to get a working ROM for randomizer. You'll also need a USB wire to plug into your computer on one end, and a USB-C plug on the other that does data transfer to plug into the device.
Usage
Using the JoeyN64 itself is easy. You just place the game cart into the cartridge connector, ensure that the label is facing away from the N64 controller port. Then plug the USB cable into your computer, then into the JoeyN64. It should show up like a USB drive would in This PC. Open it up and you should see a DEBUG or DEBUG.TXT file. Opening that file should open it in notepad or an equivalent text editor. Ensure that the line near the end of the file says Checksums OK! and not Checksums Bad!. If it says the checksums are bad, unplug the JoeyN64 and try reseating the cartridge. If it continues to happen, try cleaning the contacts on the cartridge with some isopropyl alcohol and a cotton swab, wait for it to dry, and try the JoeyN64 again. Once the checksums are good there should be a THE_LEGE.Z64 file next to the debug text file. You can copy that to your computer. You can also backup your save file THE_LEGE.SRA here too.
You may notice that the file you copied is 64MB. This is due to hardware in the cartridge behaving differently than expected by the firmware. You'll need to cut out the excess data using a hex editor or disk dumper like for the Gamecube method. Just in this case you will be starting at location 0 for Windows, or skipping 0 bytes for macOS and Linux.
Once you have a 32MB file, you can use the downgrader site to verify or downgrade your ROM to be used for the randomizer. If it is a 1.0 ROM already, you can get started using the randomizer. If it detects as a downgradable/convertable ROM you can do so to get a 1.0 ROM to use. If the site cannot detect your ROM, try again with a fresh dump copied from your cart to your PC.
Updating Firmware
Go to Firmware updates and download the newest firmware version. It should be near the top of the list. Open the downloaded zip file and copy the MODE.TXT file from the zip to the JoeyN64, then wait for it to disconnect then reconnect. Next copy the FIRMWARE.JR file and paste it in the JoeyN64. It should disconnect and then reconnect and the DEBUG.TXT file should display the new version in the top line.