Author Topic: TurboRip v1.41: The PC Engine/TG-16 CDROM ISO/WAV/CUE Ripper [10/15/2016]!  (Read 14660 times)

NightWolve

  • Hero Member
  • *****
  • Posts: 5277
Re: TurboRip v1.40: The PC Engine/TG-16 CDROM ISO/WAV/CUE Ripper [8/19/2015]!
« Reply #60 on: November 07, 2015, 04:33:20 AM »
Some time ago, I was emailed a question asking me for help to rip Arkhan's Insanity game so that it could be shared on ROM sites. Said individual noticed that it wasn't available and he wanted to be the first to get to upload it. I politely declined and informed him that it's my friend Arkhan's homebrew game and I won't help as I doubt he sold out of his pressed CDs.

Well, turns out that unbeknownst to Arkhan and Oldman, they actually accomplished a form of copy protection by unintentionally creating a large postgap of unburned sectors at the end of the first data track!

According to Yellow book rules, in designing the layout of a mixed mode CD, you're supposed to specify a 2 second postgap when transitioning from a data track to an audio track. There have been 2 ways to reflect this and you've seen it all the time:

Quote
FILE "02 Akumajou Dracula X - Chi no Rondo (J).iso" BINARY
  TRACK 02 MODE1/2048
    PREGAP 00:03:00
    INDEX 01 00:00:00
FILE "03 Akumajou Dracula X - Chi no Rondo (J).wav" WAVE
  TRACK 03 AUDIO
    PREGAP 00:02:00
    INDEX 01 00:00:00
Or, like this:
Quote
FILE "02 Akumajou Dracula X - Chi no Rondo (J).iso" BINARY
  TRACK 02 MODE1/2048
    PREGAP 00:03:00
    INDEX 01 00:00:00
    POSTGAP 00:02:00
FILE "03 Akumajou Dracula X - Chi no Rondo (J).wav" WAVE
  TRACK 03 AUDIO
    INDEX 01 00:00:00
The second way is technically more proper, but it's mostly done the first way. Burning software seems to correct the first way while burning the CD-R and treat it as a postgap anyway which will be reflected as 2 seconds of skipped/unburned sectors.

Now, TurboRip subtracts this 2 seconds off by default, but because they specified a much bigger postgap for Insanity, the true final sector is unknown, and TurboRip continues to read into the unburned postgap area resulting in a Layered-Error uncorrectable error, meaning, either the area of the CD was really scratched up and can't be read, or as I later realized, it's totally unburned, so naturally there is no correct EDC/ECC data to speak of resulting in total erroring out and failure.

Alcohol 52% also fails to continue reading after encountering this, so in effect, a basic copy-protection was created by inadvertently specifying a larger than standard postgap transition area. 

Long story short, I contacted Arkhan about the matter and offered to block any ripping attempts for Pyramid Plunder and Insanity. I've added the blocks, just have to write a message in the form of please respect our homebrew guys and buy the game until it sells out, then redirect to their website. Pyramid Plunder does need the block as it's just a 2 meg data track and it easily is ripped by TurboRip or any other program. But anyhow, it was interesting how Insanity actually already achieved a decent copy protection.

« Last Edit: May 06, 2018, 03:02:36 PM by NightWolve »

elmer

  • Hero Member
  • *****
  • Posts: 2153
Re: TurboRip v1.40: The PC Engine/TG-16 CDROM ISO/WAV/CUE Ripper [8/19/2015]!
« Reply #61 on: November 07, 2015, 04:48:48 AM »
Haha ... that's an interesting little copy-protection "trick", I'd be curious to know if it was deliberate.

Would the PCE's CD drive be able to find any subsequent audio tracks OK after a gap like that?

NightWolve

  • Hero Member
  • *****
  • Posts: 5277
Re: TurboRip v1.40: The PC Engine/TG-16 CDROM ISO/WAV/CUE Ripper [8/19/2015]!
« Reply #62 on: November 07, 2015, 04:58:03 AM »
Nope, I was talking to OldMan about it, it was just something that inadvertently happened given how they wrote their CUE file! Totally unintentional!

At first, I was unsure, so I asked them if they did something on purpose because I was wondering if I got a badly pressed CD or something! Arkhan sent me 2 copies of their games rather than giving me the TOCs so I could block them in TurboRip, so while doing that, I encountered this issue. This is why some random dude contacted me asking me for help all along, his ripping attempt was getting blocked by encountering that LEC error! Heh.

The game works fine since it boots the first data track it finds and the game code points to proper LBA offsets when it comes time to play redbook audio tracks. So yeah, it works!

You're right to question this though, messing around like that could create trouble! For example, when it comes to Ys IV, if you don't burn 3 seconds of postgap after the final audio track if you exclude the final data track, that final audio track won't get played properly! I used to exclude the final duplicate backup data track (track #32) and didn't know a postgap was somehow needed and that resulted in the final boss music not getting played properly on real NEC hardware! It was not an error you could catch with emulators! That's what you get with tinkering!
« Last Edit: November 07, 2015, 05:09:41 AM by NightWolve »

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: TurboRip v1.40: The PC Engine/TG-16 CDROM ISO/WAV/CUE Ripper [8/19/2015]!
« Reply #63 on: November 07, 2015, 10:02:31 AM »
If a PCE CD game uses CDPLAY with the track argument, instead of start and end LBA sectors, you need an end track for it to work. This is why some games wouldn't play the audio last track, since the end track didn't exist for that request (cue needs to be fixed). I did this for the Megaman CD audio routines (used the first data track as the last track as well). It doesn't matter if the last track is audio or not - just that it exists.

 Pre-gaps and post-gaps (less so) need to be exact for games that use LBA sector mode for music play routine. The alignment will be off otherwise.   

 There's something else people should be aware of; the data track repeated as the last data track. There is a function/setup in the bios that holds the LBA offset of a redundant track - in case the primary track is have issues with data reads. The game can theoretically use the alt LBA offset to read from the redundant track instead. Whether any game actually does this or not, I don't know. But the software is there and setup for it (for those games that use that layout). Good to know of you're hacking games.

NightWolve

  • Hero Member
  • *****
  • Posts: 5277
Re: TurboRip v1.40: The PC Engine/TG-16 CDROM ISO/WAV/CUE Ripper [8/19/2015]!
« Reply #64 on: November 07, 2015, 10:31:36 AM »
If a PCE CD game uses CDPLAY with the track argument, instead of start and end LBA sectors, you need an end track for it to work. This is why some games wouldn't play the audio last track, since the end track didn't exist for that request (cue needs to be fixed). I did this for the Megaman CD audio routines (used the first data track as the last track as well). It doesn't matter if the last track is audio or not - just that it exists.

Ah, I see. So CDPLAY, the dynamic track play method (since it'll fetch the start LBA from the TOC), needs an ending marker, which yeah, you get by using the start of the next track and subtract off pregap sector markings if need be.

Interesting thing, I did solve the problem with the last audio track by adding a POSTGAP 03:00 to the CUE file when I used to share Ys IV images without the backup tracks to compress them better. That also served as a solution somehow instead of putting data track #32 back with its 03:00 PREGAP command.

Nowadays though, I wouldn't do that, there was a smarter way. Just copy a translated/patched data track #2 to data track #32, and then resize it to what the original size is, case closed. I still get a more compressed archive of one data track and all its audio tracks. And when the batch file unpacks all the APE zipped waves, it will copy the data track to track #32 and resize it proper.

If you think about it, it ought to work properly without an extra track, it should be smart enough to use the Leadout LBA for the final track. Think about audio CDs. It plays them correctly on the other hand. I guess CD player code does advanced analysis on the TOC but that doesn't happen with general game code or something.

Quote
the data track repeated as the last data track. There is a function/setup in the bios that holds the LBA offset of a redundant track - in case the primary track is have issues with data reads. The game can theoretically use the alt LBA offset to read from the redundant track instead. Whether any game actually does this or not, I don't know. But the software is there and setup for it (for those games that use that layout). Good to know of you're hacking games.

Yeah, I learned that long ago from David Michel who assured me it's a backup track and the design is there to read sectors from it if the first data track #2 starts to encounter read errors.

It's a fine idea I guess, but not really needed if discs are properly maintained. I suppose if you have the space, it doesn't hurt.

Incidentally, they ran out of space for Ys IV and fully maxed out the CD! Every last byte that you can burn back then was used up! Most of the ADPCM voice-acting is clipped out when it comes to track #32, so it really wouldn't do any good if track #2 went bad and the system switched to using track #32 throughout the rest of the game. I would presume it'd eventually crash when it came time to play the voice-acting, or you just won't hear anything when it tries.



EDIT: HomeBrew Block added. If a user tries to rip "Pyramid Plunder" or "Insanity" by Arkhan's/OldMan's Aetherbyte Studios, the attempt is aborted and a browser is opened to their website (http://www.aetherbyte.com/). This is just a minor courtesy until their pressed CDs sell out. Somebody asked me for help to try to pirate this and I declined; let the CDs sell out first out of courtesy before wanting to make your friends happy by uploading it to them or to ROM sites...

« Last Edit: May 06, 2018, 02:52:22 PM by NightWolve »

Necromancer

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 21366
Re: TurboRip v1.40: The PC Engine/TG-16 CDROM ISO/WAV/CUE Ripper [8/19/2015]!
« Reply #65 on: November 09, 2015, 04:43:47 AM »
Any flags for Implode, Meteor Blaster DX, Hypernova Blast, Mysterious Song, and Revival Chase too?
U.S. Collection: 97% complete    155/159 titles

NightWolve

  • Hero Member
  • *****
  • Posts: 5277
Re: TurboRip v1.40: The PC Engine/TG-16 CDROM ISO/WAV/CUE Ripper [8/19/2015]!
« Reply #66 on: November 09, 2015, 02:04:57 PM »
Funny you mentioned that. I was chatting with Bernie the other day, and he pointed out that Implode and Meteor Blaster DX were in Squaresoft74's TOC database already, what TurboRip relies on for the titling magic. Since I got the block going for Arkhan's games now, I can do it for BT's on those.

However, the rest of the games you mentioned, I don't have TOCs for. Somebody would have to ask Old Rover or somebody with an original copy of the game to get them to me if they want/care for such a block.

If you run "TurboRip /cue /1" with the CD in your first drive, it'll just dump a TOC and CUE then exit. That'd be one way to get it to me. It's also printed in the DOS emulated window, so if you know how to mark text/copy it, that's another way.

Bernie

  • Hero Member
  • *****
  • Posts: 4271
    • Facebook URL
Re: TurboRip v1.40: The PC Engine/TG-16 CDROM ISO/WAV/CUE Ripper [8/19/2015]!
« Reply #67 on: November 10, 2015, 12:26:00 AM »
I'll do it tonight for mysterious song


Sent from my iPhone using your mama

ccovell

  • Hero Member
  • *****
  • Posts: 2245
Re: TurboRip v1.40: The PC Engine/TG-16 CDROM ISO/WAV/CUE Ripper [8/19/2015]!
« Reply #68 on: November 21, 2015, 12:02:40 PM »
Hi, I just downloaded v 1.40 (Aug 24) and it aborts ("Progress 100% LBA: 013229 to 013255 / Read Error: Unknown read failure") after track 2 on Road Spirits (the first disc I tried), where the old version of TurboRip (1.00) I was using rips the whole disc just fine.

I'm using a WinXP Toshiba laptop with built-in DVD/CD-R drive.

NightWolve

  • Hero Member
  • *****
  • Posts: 5277
Re: TurboRip v1.40: The PC Engine/TG-16 CDROM ISO/WAV/CUE Ripper [8/19/2015]!
« Reply #69 on: November 21, 2015, 01:11:39 PM »
Hi Chris, thanks for the feedback.

Try this copy, the next release candidate, which fixed many problems, johnnykonami's Windows 7 total failure and crashing on tbone's Windows 10 machine.

http://www.ysutopia.net/software/TurboRipTest.zip

Hopefully the error trapping improvements show something more with your CD if it still fails.

ccovell

  • Hero Member
  • *****
  • Posts: 2245
Re: TurboRip v1.40: The PC Engine/TG-16 CDROM ISO/WAV/CUE Ripper [8/19/2015]!
« Reply #70 on: November 21, 2015, 06:48:08 PM »
Hopefully the error trapping improvements show something more with your CD if it still fails.

It did!  It did!  It changed the failure text from white to red.   :-\

NightWolve

  • Hero Member
  • *****
  • Posts: 5277
Re: TurboRip v1.40: The PC Engine/TG-16 CDROM ISO/WAV/CUE Ripper [8/19/2015]!
« Reply #71 on: November 22, 2015, 02:23:08 AM »
Hah! Yeah, figured if I'm still gonna be stuck as a command-line app, might as well use all possible features and bloody red text for errors was a nice touch I thought that was available all along. :mrgreen:

Well, that sucks... I do know what the problem is though since it's happening right at the end of the data track 2: the 2 second pregap transition area is right there for audio track 3 and determining the true final sector of any track on a CD is a problem because of this concept of gaps/index 0 and varying behavior among drives...

If the CD format was designed proper, the TOC would also tell you the true end LBA, not just the start, or the LBA of the next track - 1 would always work which is what you use now but also have to take gaps into consideration which normally will be added if transitioning to different track types (data to audio and vice versa).

So anyway, when you read a few sectors near that gap area between track 2 and 3 on a PCE CD, some drives error out 1 sector away or 3 sectors away from where these 2 or 3 second areas begin... It actually varies, so I predict this and zero out those sectors before writing them to disk in the data track 2 file. This is how I ensure the track file sizes are universal. Right now the prediction is at 5 or 7 sectors, but I guess in your case I'd have to increase that value to trap the error, zero out the sectors and continue instead of giving up. Old version of TurboRip you say works maybe had a bigger value.

The other basic problem is I need to implement "Abort, Retry, Ignore" so you could manually ignore your way out of a few unreadable sectors at the end of a data track that would be zero anyway instead of TurboRip trying to automatically do it... It's on my To-Do list, but I never got around to it.

Brings up another idea, the /track command. Another workaround to this is you'd use /track=3, then /track=4 to rip the CD the rest of the way each time. But I should implement support for greater than '>' so a user could do "/track>2" as a parameter to rip the remainder of the tracks. Ah, the fun of figuring out textual input commands for cmd apps when they should just be a GUI. :)

Well, I'm tied up for all of this week and on, but maybe I'll try to compile another version with that constant increased for you to test with next weekend I hope. Maybe 9 sectors is the right amount to be willing to subtract off if read errors are encountered at the end of a track with a gap complication. There's some rule in Redbook/Yellowbook docs about at least 9 out of every 10 sectors need to be encoded with indexing in the Q subchannel data, so my choice of 5 was too low.
« Last Edit: November 22, 2015, 03:56:28 AM by NightWolve »

Punch

  • Hero Member
  • *****
  • Posts: 3278
Re: TurboRip v1.40: The PC Engine/TG-16 CDROM ISO/WAV/CUE Ripper [8/19/2015]!
« Reply #72 on: November 23, 2015, 12:52:37 PM »


I understand why you did that but I'm someone who likes to have backups of his games available. Not everyone is going to upload homebrew to the internet just because they can dump their discs. I should have done this sooner ](*,)

NightWolve

  • Hero Member
  • *****
  • Posts: 5277
Re: TurboRip v1.40: The PC Engine/TG-16 CDROM ISO/WAV/CUE Ripper [8/19/2015]!
« Reply #73 on: November 23, 2015, 01:24:45 PM »
Like I said, it was just a courtesy on their behalf. I'm aware 100% would not upload their rip, but a % will or have and this is simply a polite message asking them to show mercy to our homebrew guys, if you will, let them know CDs are still for sale, etc. Of course it's technically a futile gesture, but why not until their CDs fully sell out.

BTW, if you look back further in this thread, TurboRip was going to fail anyway because of the larger-than-usual pregap OldMan assigned in the CD layout. All TurboRip versions will fail, ImgBurn crashes on track analysis and Alcohol raises errors too.



I need to implement Q-subchannel analysis to detect the true end LBA for data track 2, a smart track mode analysis in other words to be able to skip those gap sectors and reflect the size in the CUE file... It's somewhat complicated, but I got a long way to go before I could rip a CD like Insanity... So, long story short, there was already an unintended copy protection. ;)
« Last Edit: May 06, 2018, 02:29:24 PM by NightWolve »

TheOldMan

  • Hero Member
  • *****
  • Posts: 958
Re: TurboRip v1.40: The PC Engine/TG-16 CDROM ISO/WAV/CUE Ripper [8/19/2015]!
« Reply #74 on: November 23, 2015, 01:29:11 PM »
Quote
All versions will fail, ImgBurn crashes on track analysis and Alcohol raises errors too.

Yeah, but he used clone cd (I recognized the ccd format) and uploaded it anyway.

I almost downloaded it to see if it worked. Trying to use ccd images was a pain, iirc. Though maybe you could extract the tracks from it.... :\