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

Tech and Homebrew => Turbo/PCE Game/Tool Development => Topic started by: sunteam_paul on April 23, 2013, 06:47:24 AM

Title: Hacking a HuCARD game to play audio from the CD unit?
Post by: sunteam_paul on April 23, 2013, 06:47:24 AM
Would it be possible to hack a HuCARD game so that whenever chip music should begin, the game instead plays a specified track from the CD drive instead?
So, for example, you could have the OutRun arcade soundtrack in the CD drive and have the game play those tracks instead of the chip music?

I had the idea while watching this: - although I adore the PCE music, this is also a fantastic arrangement and It would be amazing to be able to play the PCE to these tracks.
Title: Re: Hacking a HuCARD game to play audio from the CD unit?
Post by: Arkhan on April 23, 2013, 07:14:34 AM
Well, you probably COULD do it.   It would probably be a pain in the ass to locate the required calls though.   It would also be different for each game I'd imagine since each game uses a different sound engine.   Some games would be similar (Bonk/Air Zonk/Hudson crap), I'd bet.



I know with Squirrel at least, you could set a game up to trigger CD calls instead of card calls and have it start launching CD music at you.  


EDIT: You'd also need to have the CD-ROM bios jammed into the hacked ROM somehow so that the things required to make the calls are there.    This makes things considerably more pain in the ass. 

Title: Re: Hacking a HuCARD game to play audio from the CD unit?
Post by: sunteam_paul on April 23, 2013, 07:27:48 AM
Damn, I guess my dreams of playing Power Drift to the SST live arrangement are unlikely to come true.
Title: Re: Hacking a HuCARD game to play audio from the CD unit?
Post by: Arkhan on April 23, 2013, 07:30:57 AM
Damn, I guess my dreams of playing Power Drift to the SST live arrangement are unlikely to come true.

Yeah, it'd be a bit more effort than its worth considering you can just put the CD in a stereo nearby and turn the volume up. 

:)
Title: Re: Hacking a HuCARD game to play audio from the CD unit?
Post by: sunteam_paul on April 23, 2013, 07:36:40 AM
Perhaps we should just replace CD tracks with Chiptunes instead. Fancy remaking the Gate of Thunder OST in MML? :D
Title: Re: Hacking a HuCARD game to play audio from the CD unit?
Post by: Arkhan on April 23, 2013, 07:42:20 AM
Perhaps we should just replace CD tracks with Chiptunes instead. Fancy remaking the Gate of Thunder OST in MML? :D

looool.

No.

Maybe like one song, or two.  but all of them? NOoooooope.

Atlantean would never get done.
Title: Re: Hacking a HuCARD game to play audio from the CD unit?
Post by: sunteam_paul on April 23, 2013, 07:56:32 AM
OK, how about you just whistle the tracks and put them on the CD instead.
Title: Re: Hacking a HuCARD game to play audio from the CD unit?
Post by: BigusSchmuck on April 23, 2013, 07:58:56 AM
Wasn't there a game that this was going to happen? Pity I can't remember what it was, but I do remember reading about it waaaaaay back in the day...
Title: Re: Hacking a HuCARD game to play audio from the CD unit?
Post by: Arkhan on April 23, 2013, 08:01:26 AM
Wasn't there a game that this was going to happen? Pity I can't remember what it was, but I do remember reading about it waaaaaay back in the day...


Insanity?

... i dunno
Title: Re: Hacking a HuCARD game to play audio from the CD unit?
Post by: Black Tiger on April 24, 2013, 07:25:36 AM
Wasn't there a game that this was going to happen? Pity I can't remember what it was, but I do remember reading about it waaaaaay back in the day...


SFII'CE. The little known tricks thread has a code to make it work with the released version.

I haven't tried it, but if that trick is legit, then maybe hacking SFII' to find out how it controls the CD player might make it easier to hack HuCards to play CD music.
Title: Re: Hacking a HuCARD game to play audio from the CD unit?
Post by: Arkhan on April 24, 2013, 07:36:59 AM
Wasn't there a game that this was going to happen? Pity I can't remember what it was, but I do remember reading about it waaaaaay back in the day...


SFII'CE. The little known tricks thread has a code to make it work with the released version.

I haven't tried it, but if that trick is legit, then maybe hacking SFII' to find out how it controls the CD player might make it easier to hack HuCards to play CD music.

I'm not an expert on the whole thing but I'd bet SFII can manage something like that because of the ROM size.  Maybe there is enough spare space to fit the CD BIOS related stuff in.

f*cking around with something smaller might result in alot of headache while trying to jam what is required into the ROM.
Title: Re: Hacking a HuCARD game to play audio from the CD unit?
Post by: SignOfZeta on April 24, 2013, 08:11:31 AM
Wasn't there a game that this was going to happen? Pity I can't remember what it was, but I do remember reading about it waaaaaay back in the day...




SFII'CE. The little known tricks thread has a code to make it work with the released version.

I haven't tried it, but if that trick is legit, then maybe hacking SFII' to find out how it controls the CD player might make it easier to hack HuCards to play CD music.


...what? I've never heard of this. It doesn't seem like a trick this big would remain "little known" for long.
Title: Re: Hacking a HuCARD game to play audio from the CD unit?
Post by: ElSeven on April 24, 2013, 09:05:02 AM
i believe this is the post:

http://www.pcenginefx.com/forums/index.php?topic=13610.msg277464#msg277464

this trick will mute the normal bgm on SF2 so that you can play CD music with the normal sfx.  it might not be what you are expecting though, as the cd music just plays over everything with no regard to different menus or stages.

i rediscovered this trick when digging though the turbo list archives one night.  maybe there is a second part to this trick to trigger certain cd tracks for different stages? idk.
Title: Re: Hacking a HuCARD game to play audio from the CD unit?
Post by: Bonknuts on April 24, 2013, 09:16:33 AM
Well, you probably COULD do it.   It would probably be a pain in the ass to locate the required calls though.   It would also be different for each game I'd imagine since each game uses a different sound engine.   Some games would be similar (Bonk/Air Zonk/Hudson crap), I'd bet.



I know with Squirrel at least, you could set a game up to trigger CD calls instead of card calls and have it start launching CD music at you.  


EDIT: You'd also need to have the CD-ROM bios jammed into the hacked ROM somehow so that the things required to make the calls are there.    This makes things considerably more pain in the ass.  




Charles Macdonald did some of his own CD routines that were outside the BIOS card. He wrote them himself. The byte string you feed the CD port is very scsi-ish and is already known (emulator authors have to emulate this, so it's known). There's also the Game Express card, in which they wrote all their own routines. That's only 32k, IIRC. Probably much less than that, if you just wanted to extract just the CDDA handle code/bios calls.
Quote
Would it be possible to hack a HuCARD game so that whenever chip music should begin, the game instead plays a specified track from the CD drive instead?
So, for example, you could have the OutRun arcade soundtrack in the CD drive and have the game play those tracks instead of the chip music?

I had the idea while watching this: http://youtu.be/jepMLq9wWx4 - although I adore the PCE music, this is also a fantastic arrangement and It would be amazing to be able to play the PCE to these tracks.


 Trapping the music routine to spy and see what song is being requested, is probably the easier thing to do. I've done this with Megman, Castlevania, Air Zonk and a few others. Matter of fact, if there's an HES file of the rom, then you can very easily see where the song track numbers are setup and hack from there - because of how only the music play is ripped and only a limited amount of ram is used for it, then trace this in the original rom. You just need to hook a piece of code that gets called first, on track select/play or command, that spies the track request. If the track request is a song (usually from a specific range of values of that byte), then you jump to an alt set of code that executes CDDA routines. Of course, that's where it gets more complicated. And yeah, it's game dependent.
Title: Re: Hacking a HuCARD game to play audio from the CD unit?
Post by: Arkhan on April 24, 2013, 09:50:51 AM
Charles Macdonald did some of his own CD routines that were outside the BIOS card. He wrote them himself. The byte string you feed the CD port is very scsi-ish and is already known (emulator authors have to emulate this, so it's known). There's also the Game Express card, in which they wrote all their own routines. That's only 32k, IIRC. Probably much less than that, if you just wanted to extract just the CDDA handle code/bios calls.
Yeah.  It's not alot of stuff, but you still need to jam the stuff in somewhere that doesn't muck things up.


Quote
then you jump to an alt set of code that executes CDDA routines. Of course, that's where it gets more complicated. And yeah, it's game dependent.


Yeah,  I don't think it'd all be worth it really.