PDA

View Full Version : Help editing/building Sega CD ISO



Azathoth
02-13-2012, 03:06 AM
Hi all;

Forgive my ignorance on the subject, the extent of my knowledge and experience with this is limited to working with PSX ISO's 15+ years ago.

What I'm trying to do is either take a folder of files and build and license an ISO from it, or take an existing ISO and be able to add/edit/rename files within it and have it still work.

I've tried using MagicISO to rename a few files in an existing ISO but it always results in an image that isn't recognized or won't boot.

I would be content to have an ISO that's just bootable on emulator if need be.

ThugsRook
02-13-2012, 06:42 AM
doesnt exist, move along.


(actually it does exist, but the guy refuses to publicly release it.)

tomaitheous
02-13-2012, 08:50 AM
SegaCD ISOs have special/specific data at the very start of the ISO (first sector, not sure if it's longer than a single sector). My guess is that MagicISO or whatever tool you're using, is stripping this out when you're modifying exiting SegaCD ISOs. Do you have any PC coding experience?

bgvanbur
02-13-2012, 10:36 AM
if you can run perl scripts, my scdtools can help (http://sourceforge.net/projects/scdtools/). It has scdupdatebinfile script can take an ISO, an ISO offset, and a binary file and replace the bytes at the ISO offset with the binary file (this allows editing files). You can get the ISO offsets of files by using the isoinfo tool. Also, you my scdmake script can use a source ISO to place files (with the same name) at the same places and new files where there is empty space but would require some work since it wasn't particularily desired for this workflow (this allows adding files). I used scdmake in this manner for a simple Sonic CD hack I did. If the file renaming keeps the same number of characters, you can modify them with a hex editor (and if the filenames are different lengths you would need to know the ISO file format in addition to change the file name length).

Azathoth
02-13-2012, 04:01 PM
Shame there isn't a licensing tool out there like there is for most systems.


If the file renaming keeps the same number of characters, you can modify them with a hex editor (and if the filenames are different lengths you would need to know the ISO file format in addition to change the file name length).

This right here is exactly what I'm wanting to do. I just need to swap the names of two files on the CD that already exist; for example they may be FILENAME1.BIN and FILENAME2.BIN. In some instances they are the same exact size, others not, but the filename is always the same amount of characters.

I've got some hex editing experience, although I've never used it in this manner. How would I go about that?

bgvanbur
02-13-2012, 05:05 PM
Thinking about it a little more, hex editing the ISO probably won't work except in the simplest cases. The extent tables (the place the file system stores all the file information like size, name, etc) requires the files be in alphabetical order. Since you want to swap the file names around, they will no longer be alphabetical. Basically you need swap the extent table entries except the filenames (which would require knowledge of the extent table entry format to determine the beginning and end of the extent table entry).

Also note, just because the file system reports the files with different names, that does not mean the change will be apparent to the Sega CD. The Sega CD could read the extent tables and find the file using the file name, or the Sega CD could use a specific ISO byte offset. So how the Sega CD treats these files is dependent on how the code for the Sega CD game set up the file retrieval aspect.

Chilly Willy
02-13-2012, 06:09 PM
The problem is that every CD is/may be different. The boot code on the CD is written specifically for each game - there's no standard boot from SEGA. You can either hardcode where the boot loads from the CD, or it could look for file. I think most games are hardcoded - they just start loading whatever is at a specific block using a hardcoded length and assume that's the executable the boot code needs to run. So if you changed the CD any (moved file around), you would also need to change the boot code for where the executable moved to. So there's no simple tool that will help you with this - you need to start by disassembling the boot code to see how/where it loads the executable, make your changes, then change the boot code to reflect the changes you made.

Azathoth
02-13-2012, 09:07 PM
Also note, just because the file system reports the files with different names, that does not mean the change will be apparent to the Sega CD.

This is exactly what happened with one of my attempts, even though the image booted properly it didn't reflect any of the changes I had made at all. I guess this little project is going to be a lot harder than I thought.

Stupid questions; how exactly does Datel's Pro CDX work, and why is there such a varying degree of success with it?

What are homebrew programmers using to build their images, such as some of the available games or utilities like the Megacart program that can build a working CD image?