Ha! Nice. I've been wondering if that's possible, but never tested it. Though I assumed you'd have to shave off space elsewhere. I'm also thinking, why couldn't the same thing be done in the middle of the ISO? I'm just curious. I don't see why we couldn't add whatever files we want this way (or programmatically) between any two files. I'm not actually sure how this differs from Sham Rock's method, since I haven't read all of his notes or tried it myself. So I don't know what he changed besides adding the files (excluding the extra code to handle/point-to the additions). e.g. I don't know exactly what he did with the toc file or if it's even necessary. But I read somewhere else that it's only a list of what files to include in the ISO when it's built. I could be wrong, but I'm thinking it probably doesn't even contain file offsets, and GCR just adds the files one-after-another. Which is why GCR is able to rebuild an ISO without the toc. I guess we don't ever need to do anything with that file.
Anyway, even if for nothing else, just think of what you could do with 10mb of space for ASM code! Or we could use some of the space to make more of the textures in the game higher res.
You definitely need the table of contents. It’s what tells the game where file offset starts are within the ISO.
Aside from Sham Rock’s custom file loading code, all he figured out how to do is tell GCR to make it’s own TOC instead of using the TOC in a root folder that you load up. But no one knew how to do this, so it’s a huge discovery. By telling it to make its own, it then constructs the custom TOC based on every file that is within the root folder, meaning you can add your own files.
So during my lunch break, I got curious and took a look at the TOC. It’s just a series of pointers and then a string table at the bottom. The string table contains the names of every file within the ISO. Then a block of 0xC in length at the top corresponds to each string (or basically…file).
0x00 = string offset (in the string table or list of file names)
0x04 = offset in the ISO (if you open the entire ISO up in a hex editor)
0x08 = length of the file
This is how the game differentiates “files” within it’s chunk of data. So I know you were interested in overwriting files within an ISO – all you would need to do is parse the TOC and find the start of the offset for each filename. Then just copy and paste the contents of a new file at this location. Simple.
Side idea as I’m writing this: Ah! So this is probably how ISO “scrubbers” work. It takes the offsets of each file in the ISO, deletes the space in between them, then scrunches all their data together. Then just adjusts the pointer in the TOC for each file name to the new location!
And now the ISO rebuilding process makes sense as well.
So I first had to test what the limiting factor is with the “default” ISO size of 1.35gb. Is it just GCR? I opened up the ISO in a hex editor, copied the entire thing, then pasted it at the end of the file, doubling it’s size. So I had a Melee ISO 2.7gb in size. Booted it up in Dolphin and it worked just fine. Okay….good news.
“GCR won’t let me go over the size limit, but what if I just manually did it.” So then I took the contents of an HPS file and pasted it at the end of a regular ISO. Then I went into the location of the TOC within the huge ISO file and changed the “offset within the ISO file” to the very end. Changed the “file size” as well. Booted it up, and it played the custom music!
Since I booted a 2.7gb ISO, I assume I could just change pointers in the TOC location to point to anywhere in that entire location. So who knows how big we could go….
If we start extending the ISO size past the default limits, I believe this breaks GCR. This is where you and Cell may come in handy…hehe.
Other info:
ISO.hdr is the first info in the ISO file.
0x0424 = offset of the TOC.dat within the ISO
0x0428 = size of TOC
0x042c = maximum size of TOC (usually the same as the size)
the TOC is called the FST in the "
Yet Another Gamecube Documentation" site.
I really need to test it on console though…my gut feeling tells me Dios Mios has an ISO limit too which would suck…but we’ll see. The flexibility of Dolphin might just be getting my hopes up. So much to research and test.