News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: How would I extract data from an ISO with only some offsets?  (Read 4946 times)

SysopGrace

  • Jr. Member
  • **
  • Posts: 16
    • View Profile
How would I extract data from an ISO with only some offsets?
« on: November 25, 2016, 05:39:26 pm »
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

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7060
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: How would I extract data from an ISO with only some offsets?
« Reply #1 on: November 25, 2016, 11:35:52 pm »
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

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
Re: How would I extract data from an ISO with only some offsets?
« Reply #2 on: November 26, 2016, 05:33:46 am »
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

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7060
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: How would I extract data from an ISO with only some offsets?
« Reply #3 on: November 26, 2016, 12:00:28 pm »
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

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: How would I extract data from an ISO with only some offsets?
« Reply #4 on: November 26, 2016, 05:06:05 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

  • Jr. Member
  • **
  • Posts: 16
    • View Profile
Re: How would I extract data from an ISO with only some offsets?
« Reply #5 on: November 27, 2016, 11:54:25 am »
@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

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: How would I extract data from an ISO with only some offsets?
« Reply #6 on: November 27, 2016, 04:31:22 pm »
Having similar difficulties. The instructions for extracting are pretty... out of whack, as I don't turn up a 'Track2.iso' either.

elmer

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: How would I extract data from an ISO with only some offsets?
« Reply #7 on: November 27, 2016, 06:42:36 pm »
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 ...

Code: [Select]
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

  • Jr. Member
  • **
  • Posts: 16
    • View Profile
Re: How would I extract data from an ISO with only some offsets?
« Reply #8 on: November 28, 2016, 12:44:58 pm »
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

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
Re: How would I extract data from an ISO with only some offsets?
« Reply #9 on: July 16, 2017, 12:44:33 pm »
See later post.
« Last Edit: February 13, 2018, 05:06:28 pm by maseter »

maseter

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
Re: How would I extract data from an ISO with only some offsets?
« Reply #10 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/
« Last Edit: July 20, 2017, 04:36:18 pm by maseter »

niuus

  • Full Member
  • ***
  • Posts: 174
    • View Profile
Re: How would I extract data from an ISO with only some offsets?
« Reply #11 on: August 08, 2017, 04:08:08 am »
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

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7060
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: How would I extract data from an ISO with only some offsets?
« Reply #12 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.
"My watch says 30 chickens" Google, 2018

Psyklax

  • Hero Member
  • *****
  • Posts: 1109
    • View Profile
    • Psyklax Translations
Re: How would I extract data from an ISO with only some offsets?
« Reply #13 on: August 08, 2017, 03:31:56 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

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
Re: How would I extract data from an ISO with only some offsets?
« Reply #14 on: September 04, 2017, 07:28:57 am »
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

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
Re: How would I extract data from an ISO with only some offsets?
« Reply #15 on: February 13, 2018, 04:41:35 pm »
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/
« Last Edit: February 14, 2018, 12:36:53 pm by maseter »