How would I extract data from an ISO with only some offsets?

Started by SysopGrace, November 25, 2016, 05:39:26 PM

Previous topic - Next topic

SysopGrace

My question is in regards to the following hack for the TuroGrafx-CD game "Human Sports Festival"
http://www.romhacking.net/hacks/3174/

It is to extra a rom file (.pce?) from the ISO of this game. I would then apply a different patch to translate the game to English but I am stuck on how to actually extract this data. The readme for this does provide me with a pair of offsets, a range, of data to be extracted from the iso file itself.

"from offset 0x1e1000 to 0x221000 in Track02.iso"

KingMike

I would use a hex editor with copy+paste functions (I think ROMhacking-centered hex editors usually don't have them due to how easy it is to corrupt ROMs if those operations are not used very carefully).
Open the ISO in a hex editor, scroll to the first address, highlight a few bytes. Scroll to the end of the required address range. Hold Shift and highlight the last few bytes. Hopefully that will highlight everything in between. Click Copy. Choose the new file option. (my hex editor requires me to highlight the one byte it automatically creates for the next file, in order to overwrite. Click Paste.
Save.

(if you want to know what hex editor I use, it's an ancient freeware version of a now not-free editor. I'm sure someone knows a modern free hex editor.)
"My watch says 30 chickens" Google, 2018

dACE

Sounds like you want to use turboRip: http://www.ysutopia.net/index.php?ind=downloads&op=entry_view&iden=8

That will extract a PCE-ISO into the game file (ISO) and the music tracks (WAV).

Use the same application to assemble the files when you patched the ISO.

Good Luck.

/dACE

KingMike

He probably needs to extract data WITHIN the ISO track.
Don't know how that changes the offset needed to extract from.
"My watch says 30 chickens" Google, 2018

elmer

Quote from: SysopGrace on November 25, 2016, 05:39:26 PM
I would then apply a different patch to translate the game to English but I am stuck on how to actually extract this data.

Yeah, I found myself needing to do this kind of thing a lot while hacking CD games.

If you're running a linux-based system, or have cygwin or msys2, then you can do this with the "dd" command and the right parameters.

For Windows, I eventually found Neil Corlett's "Command Line Pack", and his "subfile" utility, and that's what I've been using.

His website has been offline for a couple of years, but it's available on archive.org.

The binaries aren't there, but the source code is, if you can compile it yourself.

https://web.archive.org/web/20140328111145/http://www.neillcorlett.com/

SysopGrace

@KingMike/dACE/elmer - Thanks a ton everyone. I haven't gotten this working yet but I have tried a bunch of things.
You can also find those "cmdtools" here: https://github.com/RDCH106/ECM/releases - i do use Mac but I also noticed that the links for the windows .zip file wasn't working on the archive.org page (the mac ones were, oddly) so you can grab them from github instead

My issue at this time will be extracting that data "track2.iso" from the larger image.

I have a few images from the internet that all run 100% perfectly fine in an emulator but they aren't broken out into data/audio files, they are just CUE/BIN, CUE/ISO and also CCD/IMG

Unfortunately all of my software also thinks that these are audio format images (2352), also known as Mode 2 discs. Apparently they are expecting Mode 1 (2048) disc images. I need a way now to break out the "data track2.iso" from the other audio tracks and then work with that one. Otherwise the offsets that I have will not correspond appropriately.

I will also reach out to the individual who submitted that hack, MooZ, on his own site's forum to see if he can help me out with this as well.

As a side note: this game actually is quite nice, its the "ladies" version of the great tennis game on the PCE.


Addendum: I can certainly obtain a copy of this game for a very reasonable price from Japan as well. I will be over there later this winter and I know this game is not expensive at all.

Digitsie

Having similar difficulties. The instructions for extracting are pretty... out of whack, as I don't turn up a 'Track2.iso' either.

elmer

Quote from: SysopGrace on November 27, 2016, 11:54:25 AM
My issue at this time will be extracting that data "track2.iso" from the larger image.

I have a few images from the internet that all run 100% perfectly fine in an emulator but they aren't broken out into data/audio files, they are just CUE/BIN, CUE/ISO and also CCD/IMG

A PCE CD is mixed audio and data sectors, so CUE/BIN is the natural format for that.

Hackers usually split that big BIN file out into the individual files for the audio (2353 byte-per-sector) and data (2048 byte-per-sector) tracks.

The 2nd track on a PCE CD is usually the data track for the game, thus the "track2.iso" in Mooz's instructions.

Now ... you can either mount the CUE/BIN image on a virtual CD-ROM drive, and then use NightWolve's TurboRIP to rip it all into separate tracks, or you can use something like BinChunker (aka bchunk), which will just read the CUE/BIN files and do the same thing (but it can get confused more easily).

You can find the BinChunker source at http://he.fi/bchunk/

It's also included in a number of linux distributions.

FYI, I found and fixed a bug in it when I was compiling a Windows version from that source ... but hopefully the linux guys already fixed their versions.

Here's the basic patch ...


diff -Naur bchunk-1.2.0/bchunk.c bchunk-1.2.0-msys2/bchunk.c
--- bchunk-1.2.0/bchunk.c 2004-06-29 21:42:34.000000000 +0100
+++ bchunk-1.2.0-msys2/bchunk.c 2015-07-02 17:35:51.323496400 +0100
@@ -289,7 +293,7 @@
exit(4);
}

- reallen = (track->stopsect - track->startsect + 1) * track->bsize;
+ reallen = (track->stopsect - track->startsect) * track->bsize;
if (verbose) {
printf("\n mmc sectors %ld->%ld (%ld)", track->startsect, track->stopsect, track->stopsect - track->startsect + 1);
printf("\n mmc bytes %ld->%ld (%ld)", track->start, track->stop, track->stop - track->start + 1);
@@ -332,7 +336,7 @@
sz = track->start;
sect = track->startsect;
fl = 0;
- while ((sect <= track->stopsect) && (fread(buf, SECTLEN, 1, bf) > 0)) {
+ while ((sect < track->stopsect) && (fread(buf, SECTLEN, 1, bf) > 0)) {
if (track->audio) {
if (swabaudio) {
/* swap low and high bytes */


SysopGrace

Thats it! I remember using bchunk on a *BSD long ago and recalling how AMAZING it was. I using that to rip out the contents of the BIN/CUE. got that track2.iso file and used a hex editor (Hex Fiend, Mac OS X, http://ridiculousfish.com/hexfiend/ ) to just delete everything outside of the desired range and BOOM, its working!!!! Thank you so much elmer!

maseter

See later post.

maseter

I also created a standard ips & bps patch to make things easier, it should turn:

Final Match Tennis (Japan).pce (CRC: 560d2305) into Final Match Tennis Ladies English

Get it while it's fresh: http://www.romhacking.net/hacks/3575/

niuus

Quote from: maseter on July 16, 2017, 01:02:52 PM
I also created a standard ips & bps patch to make things easier, it should turn:

Final Match Tennis (Japan).pce (CRC: 560d2305) into Final Match Tennis Ladies English

Get it while it's fresh: http://www.romhacking.net/hacks/3575/
Hack does not exist anymore. Any mirror available? Thanks!

KingMike

I'm assuming it was removed since the contents of the patch was technically Human's creation. But I'm not positive on that.
"My watch says 30 chickens" Google, 2018

Psyklax

Quote from: KingMike on August 08, 2017, 12:25:20 PM
I'm assuming it was removed since the contents of the patch was technically Human's creation. But I'm not positive on that.

That sounds logical enough to me. Although technically by that logic some hacks like mine which restores certain graphics from the Japanese version into the US version would fall foul of that rule, since nothing in the patch was technically my creation. It's a fine line, I suppose. But like I always say, change enough bytes in your IPS patch and you can change Super Mario World into Super Mario Kart. Technically. :)

maseter

Any idea on how to re-submit this then, so that it is compliant?

It's rather unique, hence i thought it would be allowed as it was.

maseter

Just fyi, one more time, for posterity!  :)

If your image is in the iso/cue format, you need to convert it into separate tracks:

You can do this using a program called TurboRip
the PC Engine/TG-16 CD-ROM ISO/WAV/CUE Ripper:
https://firedrop.com/32d6e03189e1c336

And to extract the rom from the data track (track 2),
you need subfile.exe from the ECM Command-Line Pack:
https://github.com/RDCH106/ECM/releases/

To now extract "Formation Soccer Human Cup '92" from "Human Sports Festival", do this:

subfile.exe track2.iso 0x221000 262144 soccer.pce
then apply: https://www.romhacking.net/hacks/3181/

And to extract "Final Match Tennis Ladies" do:
subfile.exe track2.iso 0x1e1000 262144 tennis.pce

And apply, in this order the following patches (or it will glitch):

1. Final Match Tennis Ladies.pce.ips
http://www.romhacking.net/hacks/3174/
2. Final Match Tennis Ladies (J)-tm_v1.0.ips (enables training mode)
http://www.romhacking.net/hacks/3297/
3. Final Match Tennis Ladies (J)-translation_v1.0.ips (English translation)
http://www.romhacking.net/translations/2801/

Special T

This is probably an easy question, I'm sure I'm doing something wrong so hopefully someone can point it out and give me some guidance.

I'm trying to following the instructions on this page to extract Final Match Tennis Ladies from the Human Sports Festival CD. There are two related patches (here & here) which indicate the extracted rom should have the following hashes but I can't seem to get a match and after extracting the rom, none of them seem to work in an emulator.

Final Match Tennis Ladies (Japan).pce
CRC32: 5d3e96f1
MD5: cf8f2dfcd7ad6696917709abacd105b7
SHA1: 4548d5599469962a4610d80b03893a77e1f8f995
SHA256: 8f362f77fb9d346be39c169ab3a59a3c7c783a2bbacddcec29fec17ae985e172

I included the steps I tried along with the hash values of the resulting files.

Here are all the files if anyone wants to check them - link

Step 1: get three different dumps of Human Sports Festival
- 23x bin / 1x cue
- 1x iso / 1x cue
- 1x ccd / 1x cue / 1x img / 1x sub

Step 2: convert all those images to iso/wav with TurboRip
- All three images produced an identical track 2
  > File Name: 02 Human Sports Festival (J).iso
  > CRC32: D799C523
  > MD5: 0F3A1BC2DD683EE561091556C0AC7C1E
  > SHA-1: 8F4F6D1EE6BB14ACA1FA9CD194827F38DA94C8E7

Step 3: Extract the Final Match Tennis Ladies rom
- Rename "02 Human Sports Festival (J).iso" to "track2.iso"
- put track2.iso in folder with subfile.exe
- run command line with the following line of text "subfile.exe track2.iso 0×1e1000 262144 tennis.pce"
- this produces the following file
  > File Name: tennis.pce
  > CRC32: 6B0FAA23
  > MD5: D5451F3368CD5EE60C64636D112BA102
  > SHA-1: 02B8DD63C5F19F049CA40A910EBB3605C431E859

Step 4: Apply this patch to convert it to a playable Japanese rom
- Patch - https://www.romhacking.net/hacks/3174/
- New hash values are listed below
  > CRC32: CB695E54
  > MD5: CD9766E232FD1E99A8162DCF3A93D071
  > SHA-1: 18FBF53583087234114C6C63B8960D07775D9EC8

Step 5: Apply this patch to convert it to enable training mode
- Patch - https://www.romhacking.net/hacks/3297/
- New hash values are listed below
  > CRC32: 1B6C08D6
  > MD5: BAB0C67402ED8A985355528868CD2323
  > SHA-1: E8BE5BF8022714EFC9BA4330E64B36E477D2F3BD

Step 6: Apply this patch to convert the text from Japanese to English
- Patch - https://www.romhacking.net/translations/2801/
- New hash values are listed below
  > CRC32: 8EE32678
  > MD5: F5A25E91811492440781BD0620700924
  > SHA-1: 633BD97FF69EB11B65061A6163EC0CE3637C2C5A

knight0fdragon

you are using the wrong x my friend.

subfile.exe track2.iso 0x1e1000 262144 tennis.pce

not

subfile.exe track2.iso 0×1e1000 262144 tennis.pce


First one gets me CRC-32 of  CA3D7F9B

Second one gets me 6B0FAA23 (same as yours)

Special T

Thank you for the quick response and for identifying the issue.

I submitted a request to fix the description on the Formation Soccer Human Cup '92 & on the Final Match Tennis Ladies patch since it looks like both had the incorrect "x" listed.