PCEngineFans.com - The PC Engine and TurboGrafx-16 Community Forum

Tech and Homebrew => Turbo/PCE Game/Tool Development => Topic started by: wolfman on July 07, 2014, 10:26:42 PM

Title: Reading Data from PCE CDs
Post by: wolfman on July 07, 2014, 10:26:42 PM
Is it possible to access the data stored on a game CD? I am curious in how certain games are structured in content, also I wanted to peek into its data. Is it possible to decompile them?

I know this is a very basic question, but I haven“t found an answer so far on my search...
Title: Re: Reading Data from PCE CDs
Post by: NightWolve on July 08, 2014, 12:21:03 AM
There is no file system when it comes to the data track of a NEC PCE/TG-16 game. The data track of a game starts with boot code and more code mixed with graphic data, adpcm data if used, etc. You have to disassemble at the first offset, follow the code as it boots the game and learn it to determine what's what over time. You would externally mark offsets as game code, text blocks, graphic data (tiles/fonts/etc), adpcm data, etc. Just like hacking a ROM file for a NES game, same thing, it's one binary of executable Assembly code mixed with graphic/script/audio data.
Title: Re: Reading Data from PCE CDs
Post by: wolfman on July 08, 2014, 12:49:15 AM
There is no file system when it comes to the data track of a NEC PCE/TG-16 game. The data track of a game starts with boot code and more code mixed with graphic data, adpcm data if used, etc. You have to disassemble at the first offset, follow the code as it boots the game and learn it to determine what's what over time. You would externally mark offsets as game code, text blocks, graphic data (tiles/fonts/etc), adpcm data, etc. Just like hacking a ROM file for a NES game, same thing, it's one binary of executable Assembly code mixed with graphic/script/audio data.

Oh my.
Title: Re: Reading Data from PCE CDs
Post by: wolfman on July 09, 2014, 05:55:20 AM
There is no file system when it comes to the data track of a NEC PCE/TG-16 game. The data track of a game starts with boot code and more code mixed with graphic data, adpcm data if used, etc. You have to disassemble at the first offset, follow the code as it boots the game and learn it to determine what's what over time. You would externally mark offsets as game code, text blocks, graphic data (tiles/fonts/etc), adpcm data, etc. Just like hacking a ROM file for a NES game, same thing, it's one binary of executable Assembly code mixed with graphic/script/audio data.

Is there an example of someone who successfully attempted that? I would love to peek into it...
Title: Re: Reading Data from PCE CDs
Post by: Necromancer on July 09, 2014, 06:37:49 AM
That's what had to be done for the various translation patches, no?
Title: Re: Reading Data from PCE CDs
Post by: wolfman on July 09, 2014, 06:51:44 AM
Yes, but is possible to see the laid out data in its original form - graphics, source code, video files, etc?
Title: Re: Reading Data from PCE CDs
Post by: megatron-uk on July 09, 2014, 07:12:37 AM
No. Because by the time it has been written to the cd, there are no original 'files' left. Think of it as a big ROM image.
Title: Re: Reading Data from PCE CDs
Post by: wolfman on July 09, 2014, 08:16:07 AM
No. Because by the time it has been written to the cd, there are no original 'files' left. Think of it as a big ROM image.

So none of those who did a translation of a PCECD have a completely decoded ROM?
Title: Re: Reading Data from PCE CDs
Post by: ClodBuster on July 09, 2014, 09:34:01 AM
Turborip is as far as you can go ripping PCE CDs without digging into reverse engineering.
Title: Re: Reading Data from PCE CDs
Post by: SuperPlay on July 10, 2014, 06:33:07 AM
Ccovel did a post over at the Magic Engine Forums back in 2006 relating to CD images that you may find interesting:

http://forums.magicengine.com/en/viewtopic.php?t=1755&postdays=0&postorder=asc&start=0


The tools he refers to are:

YY-CHR:  http://wiki.nesdev.com/w/index.php/YY-CHR

and

Tile Layer Pro: http://www.romhacking.net/utilities/108/

I never did get around to having a play with these, however after re-reading the thread I think I may have somthing on this weekends to do list ;-)
Title: Re: Reading Data from PCE CDs
Post by: wolfman on August 08, 2014, 12:15:28 PM
Ccovel did a post over at the Magic Engine Forums back in 2006 relating to CD images that you may find interesting:

http://forums.magicengine.com/en/viewtopic.php?t=1755&postdays=0&postorder=asc&start=0


The tools he refers to are:

YY-CHR:  http://wiki.nesdev.com/w/index.php/YY-CHR

and

Tile Layer Pro: http://www.romhacking.net/utilities/108/

I never did get around to having a play with these, however after re-reading the thread I think I may have somthing on this weekends to do list ;-)


Hey, thanks for the info. Will have a look at this!
Title: Re: Reading Data from PCE CDs
Post by: NightWolve on August 08, 2014, 03:33:51 PM
Oh yeah, forgot to respond to this.

That's what had to be done for the various translation patches, no?

Yeah, partly, but never the whole thing, only the bare minimum of what was necessary. In the case of Ys IV, that was limited to tracking down the text decompression code (Neill Corlett), and a few other limited cases like the print routine (David Shadoff and a little help by me).

No. Because by the time it has been written to the cd, there are no original 'files' left. Think of it as a big ROM image.

So none of those who did a translation of a PCECD have a completely decoded ROM?

Correct, like megatron said. Think of data track 2 as one big NES ROM file... and it's pretty close to that actually since the HuC6280 is very close to the NES CPU (a 6502 type) which means the Assembly language is pretty similar. So, if you learned to hack NES games, with a little more knowledge, that would more easily lend itself to PCE.

There's no need to completely disassemble it, I mean, it depends on how far you need to go after all... If you wanna hack the game, change sprites around and/or gameplay, then yeah, you would need to go very far to fully understand everything, but I and anybody else when it came to fan translations only ever went as far as was needed, the bare minimum.
Title: Re: Reading Data from PCE CDs
Post by: NightWolve on August 09, 2014, 10:46:20 PM
I uploaded Neill Corlett's old disassembly work for Ys IV to give you an idea of the grunt work that we're talking about here. It's unfinished because he discovered the decompression code and ultimately that's mainly what was needed, and he quit the project because of other interests (like the PS2 sound format stuff he started), leaving me with everything to carry on (and I did, with others like David Shadoff). Anyway, here you go:
 
http://www.ysutopia.net/downloads/ys4/ys4_dis.html

Find "Boot loader" on that page which puts you at the physical offset of 0x0000 in a rip of Ys IV data track 2 when looking at it in a hex editor. You can see him trying to break things down, disassemble code when encountered, etc. He manually traced like this, eventually found the decompression code and converted it from this HuC6280/6502 Assembly that you see to "C". You get the idea and your question is now fully answered.
Title: Re: Reading Data from PCE CDs
Post by: BigusSchmuck on August 10, 2014, 04:14:53 AM
Quote
Correct, like megatron said. Think of data track 2 as one big NES ROM file... and it's pretty close to that actually since the HuC6280 is very close to the NES CPU (a 6502 type) which means the Assembly language is pretty similar. So, if you learned to hack NES games, with a little more knowledge, that would more easily lend itself to PCE.
This is why I never understood why we haven't seen a bunch of PCE hacks/translations. Our little engine that could needs more loving!
Title: Re: Reading Data from PCE CDs
Post by: NightWolve on August 10, 2014, 04:31:27 AM
Yeah, that's partly why I got into fan translations for the system, I saw that all the attention was focused at NES/SNES. As such, I would get to be "the first" to do something noteworthy, e.g. the first CD RPG fan translation with "Xak III: The Eternal Recurrence." Ys IV came afterwards. It's still a neglected system compared to the others, but yeah, I wanted to be one of the first people to make a dent towards changing that.
Title: Re: Reading Data from PCE CDs
Post by: Bonknuts on August 10, 2014, 05:15:41 PM
Hacking hucard games = easy. Hacking CD games = not so much. Even if you're comfortable with nes 65x, and jump into the PCE - there's a whole new slew of problems that CD games introduce. Granted, going from CD->SCD allows you to avoid all these problems. But there isn't an option to allow SCD->'something newer'. There are no custom hucards out there that support more ram than SCD, sadly. If someone were to make these - then problem solved (emulation and real hardware). Else, it's a huge pain finding adequate free space in CDRAM for hooks/hack code - let alone making sure it's always free or in the right spot (Ys IV also had this problem. Spriggan Mark 2 has this issue too; I have two sets of hacks to resolve this). I.e. - you need more ram than what the games thinks is there, and therefore doesn't use. And no, Arcade Card does not fit the bill (no regular added ram to the cpu logical range).

 That one French guy made those turbo boards recently, could easily be adapted to support a new SCD card. 256k or 512k of sram for CD ram (rom: bank 00-3f. ram: bank 40-7f).
Title: Re: Reading Data from PCE CDs
Post by: wolfman on August 13, 2014, 12:14:19 PM
You get the idea and your question is now fully answered.

Yep. I am speechless  :shock: