Extracting custom container (.DAT) package from disc

Post a topic about yourself to let others know your skills, hobbies, etc.
User avatar
DD-Indeed
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 165
Joined: Jun 07, 2014
I am a: Average DIY-guy
PlayStation Model: SCPH-5502

Post by DD-Indeed » August 16th, 2020, 6:24 pm

Here's one that's done later in the game. Luckily I managed to get some GameShark cheats for it (Infinite Health + Ammo), so that I'm not dying all the time.

https://www.sendspace.com/file/cbhw4x

Yagotzirck
Verified
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 131
Joined: Jul 17, 2013

Post by Yagotzirck » August 16th, 2020, 8:15 pm

@Squaresoft: would you mind sharing the .idb project file so that we can check things in parallel and confront any possible progress?
I'd share mine as well, but you probably discovered all the stuff I did already.

@DD-Indeed: if you happen to have any no$psx savestates in points of the game where different music is played I would be fine with them, since I exclusively use no$psx for live analysis.

User avatar
DD-Indeed
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 165
Joined: Jun 07, 2014
I am a: Average DIY-guy
PlayStation Model: SCPH-5502

Post by DD-Indeed » August 17th, 2020, 2:16 am

Yagotzirck wrote: August 16th, 2020, 8:15 pm

@DD-Indeed: if you happen to have any no$psx savestates in points of the game where different music is played I would be fine with them, since I exclusively use no$psx for live analysis.
Well the trouble is that the game basically plays only 2-3 songs + main theme on boot, unless I progress more into the game. And it's not easy game :D

Btw, when I asked some GameShark cheats for the game on GameHacking.org Discord channel, this one guy who provided those, also found some ways to play different tracks on the main menu, when I talked about this. So there is ways to trigger them in the game, which is okay for me, we can then record them in lossless form without any sound effects etc.

Yagotzirck
Verified
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 131
Joined: Jul 17, 2013

Post by Yagotzirck » August 17th, 2020, 2:52 am

Btw, when I asked some GameShark cheats for the game on GameHacking.org Discord channel, this one guy who provided those, also found some ways to play different tracks on the main menu, when I talked about this.
Hm, did he also explain how to achieve that?
In case he did I don't use Discord so I have no way to check it myself (unless I can check it from browser without making an account).
Also I think it would be better if we manage to extract music as PSF files, both because it would be way smaller and feel "cleaner" than recorded audio, and also because I'm more interested in the technical achievement rather than the music itself :D

User avatar
DD-Indeed
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 165
Joined: Jun 07, 2014
I am a: Average DIY-guy
PlayStation Model: SCPH-5502

Post by DD-Indeed » August 17th, 2020, 3:01 am

Yea sure, if you guys can make that work, it would be brilliant of course! Also, you should then think about developing the tool even further, with some other games as well. :)

I need to ask him about it and paste it over here, so you can read about it.

Yagotzirck
Verified
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 131
Joined: Jul 17, 2013

Post by Yagotzirck » August 17th, 2020, 3:20 am

DD-Indeed wrote: August 17th, 2020, 3:01 am I need to ask him about it and paste it over here, so you can read about it.
That's terrific, thanks!
Also, you should then think about developing the tool even further, with some other games as well
Not sure about which tool you're talking about, but like I said at the beginning of this thread the method used for ripping PSFs isn't a jack-of-all-trades; if the game uses SEQ tracks you could get away with VGMToolbox and a generic driver, otherwise it requires the analysis of the game's executable and then minimizing the exe only to the functions that deal with music (SPU initialization, sending soundbanks to SPU RAM, etc.)
With that said I wouldn't mind repeating the process with some other games in the future (e.g. Driver, Dino Crisis; last I checked I couldn't find any PSFs for those games anywhere, despite their popularity)

User avatar
DD-Indeed
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 165
Joined: Jun 07, 2014
I am a: Average DIY-guy
PlayStation Model: SCPH-5502

Post by DD-Indeed » August 17th, 2020, 3:35 am

Yagotzirck wrote: August 17th, 2020, 3:20 am
DD-Indeed wrote: August 17th, 2020, 3:01 am I need to ask him about it and paste it over here, so you can read about it.
That's terrific, thanks!
Also, you should then think about developing the tool even further, with some other games as well
Not sure about which tool you're talking about, but like I said at the beginning of this thread the method used for ripping PSFs isn't a jack-of-all-trades; if the game uses SEQ tracks you could get away with VGMToolbox and a generic driver, otherwise it requires the analysis of the game's executable and then minimizing the exe only to the functions that deal with music (SPU initialization, sending soundbanks to SPU RAM, etc.)
With that said I wouldn't mind repeating the process with some other games in the future (e.g. Driver, Dino Crisis; last I checked I couldn't find any PSFs for those games anywhere, despite their popularity)
Well with Dino Crisis, it's a Capcom game, made with similar tools that of RE-games, so they originally made the music in MIDI-format I believe, which was then converted to sequence data etc.


Driver 1-2 are also tracker files, but those can be extracted, there is this special tool for it:

https://github.com/TecFox/driver-music-extractor


Maybe you could take a look at that, as Driver 1-2's music was also made with tracker software, FastTracker 2 I believe. Maybe you could use that program for research purposes etc :D

User avatar
Squaresoft74
Verified
/// PSXDEV | ELITE ///
/// PSXDEV | ELITE ///
Posts: 303
Joined: Jan 07, 2016
PlayStation Model: SCPH-7502
Location: France
Contact:

Post by Squaresoft74 » August 17th, 2020, 3:39 am

Yagotzirck wrote: August 16th, 2020, 8:15 pm @Squaresoft: would you mind sharing the .idb project file so that we can check things in parallel and confront any possible progress?
I'd share mine as well, but you probably discovered all the stuff I did already.
I don't really have much things in it atm as i mainly keep notes in a txt file.
Certainly not the best way to do i guess but i'm more tinkering with assembly than anything else. :lol:

As for the GameShark code you can try this:
800B5558 000E // in bold is $a1 value
800B555A 2403

800B5560 00D1 // in bold is $a0 value
800B5562 2404

This will patch this part of code from sub_800B54A0

Code: Select all

800B5558: li    $v1, 0x000E
800B555C: beq   $v0, $v1, 0x800B556C
800B5560: li    $a0, 0x00D1
Use the following values:

Code: Select all

 | FileID | BGM ID |
 | $a0=C3 | $a1=00 |
 | $a0=C4 | $a1=01 | 
 | $a0=C5 | $a1=02 | 
 | $a0=C6 | $a1=03 | 
 | $a0=C7 | $a1=04 | 
 | $a0=C8 | $a1=05 | 
 | $a0=C9 | $a1=06 | 
 | $a0=CA | $a1=07 | 
 | $a0=CB | $a1=08 | 
 | $a0=CC | $a1=09 | 
 | $a0=CD | $a1=0A | 
 | $a0=CE | $a1=0B | 
 | $a0=CF | $a1=0C | 
 | $a0=D0 | $a1=0D | 
 | $a0=D1 | $a1=0E | 
Those that might sound wrong might be because they're not using 0008.VAB
DD-Indeed wrote: August 17th, 2020, 3:35 am Well with Dino Crisis, it's a Capcom game, made with similar tools that of RE-games, so they originally made the music in MIDI-format I believe, which was then converted to sequence data etc.
I did rip Dino Crisis 1 to PSF. ;)
If you want the set i can share it, maybe using PM as i'm not sure if it can be posted here.

User avatar
DD-Indeed
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 165
Joined: Jun 07, 2014
I am a: Average DIY-guy
PlayStation Model: SCPH-5502

Post by DD-Indeed » August 17th, 2020, 3:47 am

Squaresoft74 wrote: August 17th, 2020, 3:39 am
DD-Indeed wrote: August 17th, 2020, 3:35 am Well with Dino Crisis, it's a Capcom game, made with similar tools that of RE-games, so they originally made the music in MIDI-format I believe, which was then converted to sequence data etc.
I did rip Dino Crisis 1 to PSF. ;)
If you want the set i can share it, maybe using PM as i'm not sure if it can be posted here.
Oh yes definitely! I haven't been able to do that myself yet, there's couple tracks I would love to make some MIDI-remixes of :D

User avatar
Squaresoft74
Verified
/// PSXDEV | ELITE ///
/// PSXDEV | ELITE ///
Posts: 303
Joined: Jan 07, 2016
PlayStation Model: SCPH-7502
Location: France
Contact:

Post by Squaresoft74 » August 17th, 2020, 4:10 am

PM sent. ;)
Note that Dino Crisis uses some custom sequence / sound bank format that i'm not sure any available tool can convert to midi.

Yagotzirck
Verified
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 131
Joined: Jul 17, 2013

Post by Yagotzirck » August 17th, 2020, 4:21 am

@DD-Indeed: that tool takes it a step further and instead of creating PSF files converts ADPCM samples to pcm, then proceeds to insert them inside the .xm files to make them playable from pc... good stuff, thanks for the link :)
We could recruit the guy to do the same thing with Martian Gothic, haha.

@Squaresoft: oh ok, I guess we'll stick with textual info then.
Have you already found the playback function?
If not I might give it a try as well, not sure if it gets polled inside the game loop or if it's associated to some kind of interrupt callback (VSync/root counters)... I guess we gotta figure it out.
Oh also, I would like DC's PSF as well if you don't mind :D

User avatar
DD-Indeed
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 165
Joined: Jun 07, 2014
I am a: Average DIY-guy
PlayStation Model: SCPH-5502

Post by DD-Indeed » August 17th, 2020, 4:36 am

Yagotzirck wrote: August 17th, 2020, 4:21 am @DD-Indeed: that tool takes it a step further and instead of creating PSF files converts ADPCM samples to pcm, then proceeds to insert them inside the .xm files to make them playable from pc... good stuff, thanks for the link :)
We could recruit the guy to do the same thing with Martian Gothic, haha.

Might be a long shot but I guess you could throw him a PM, if we could find him haha :D It doesn't hurt afterall.


Oh hey, here's the thing what the guy said on Discord:

I didn't change any music. But I did find possible counter for the player. Yesterday I was able to manipulate sound as well.
If you want to find such things you can look for values constantly increasing or decreasing. Music players usually have in game counters.
You can look on the PC version or on PS1 on the disc for track orders of music
If you are in room 00 for example track 05 hungry zombie might be playing or room 07 track 03 humpty dumpty etc.
I have found music codes before and those are the 3 methods. Look for counter, track number, or audio options.



Edit: Now one another guy discovered that there is actually leftover mini-debug viewer within the game, that might help too.

User avatar
Squaresoft74
Verified
/// PSXDEV | ELITE ///
/// PSXDEV | ELITE ///
Posts: 303
Joined: Jan 07, 2016
PlayStation Model: SCPH-7502
Location: France
Contact:

Post by Squaresoft74 » August 17th, 2020, 10:38 am

@Yagotzirck
I think i got the playback function isolated already, possibly sub_800DEF04.
But my current problem is to get the XM loading stuff to work at all, so i can't verify the above atm.
Still investigating why it currently fails.
Oh and i sent you a PM with the DC rip link. ;)

@DD-Indeed
Unlocking a debug menu if there is one at all would be handy, sometimes they also have some bgm/sfx test features.
Also thanks for the other save file. :)

User avatar
DD-Indeed
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 165
Joined: Jun 07, 2014
I am a: Average DIY-guy
PlayStation Model: SCPH-5502

Post by DD-Indeed » August 17th, 2020, 7:56 pm

This is what I figured out from this SPU I/O map:

MG SPU Debug.jpg

This may help you :D
You do not have the required permissions to view the files attached to this post.

User avatar
DD-Indeed
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 165
Joined: Jun 07, 2014
I am a: Average DIY-guy
PlayStation Model: SCPH-5502

Post by DD-Indeed » August 18th, 2020, 4:41 am

There's someone at the Discord channel who knows all about debug stuff, hopefully he finds something, that I can pass on to you.

Yagotzirck
Verified
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 131
Joined: Jul 17, 2013

Post by Yagotzirck » August 18th, 2020, 9:24 am

DD-Indeed wrote: August 17th, 2020, 7:56 pm This is what I figured out from this SPU I/O map:


MG SPU Debug.jpg


This may help you :D
The part about the 2nd column being related to notes makes sense since that's the column indicating pitches/frequencies and sound addresses inside SPU RAM, but can you elaborate a bit more about the high to low frequency pattern?

User avatar
DD-Indeed
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 165
Joined: Jun 07, 2014
I am a: Average DIY-guy
PlayStation Model: SCPH-5502

Post by DD-Indeed » August 18th, 2020, 6:05 pm

The first column is all about the actual sound volume and what frequencies the output sound has. If you go into the audio menu and put the music volume slider into zero, that whole first column goes to zero and stops changing.

Yagotzirck
Verified
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 131
Joined: Jul 17, 2013

Post by Yagotzirck » August 18th, 2020, 7:45 pm

Yeah, but the 1st column is only about the volume, it's in no way related to frequency :D
http://hitmen.c02.at/files/docs/psx/spu.txt
(xx = $c0 + voice number)
-------------------------------------------------------------
$1f801xx0 Volume Left
$1f801xx2 Volume Right

Volume mode:
bit |0f|0e|0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00|
desc.| 0| S| VV |

VV $0000-$3fff Voice volume.
S 0 Phase Normal
1 Inverted

Sweep mode:
bit |0f|0e|0d|0c|0b 0a 09 08 07|06 05 04 03 02 01 00|
desc.| 1|Sl|Dr|Ph| |VV |

VV $0000-$007f Voice volume.
Sl 0 Lineair slope
1 Exponential slope
Dr 0 Increase
1 Decrease
Ph 0 Normal phase
1 Inverted phase

In sweep mode, the current volume increases to its maximum value,
or decreases to its mimimum value, according to mode. Choose
phase equal to the the phase of the current volume.
The note frequency for each channel is given only by the base frequency of the sample being played in that channel and the pitch at which it's being played (as far as I know, at least).

User avatar
DD-Indeed
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 165
Joined: Jun 07, 2014
I am a: Average DIY-guy
PlayStation Model: SCPH-5502

Post by DD-Indeed » August 18th, 2020, 10:55 pm

Btw, this could also lead into channel volume adjustments ? So that we could adjust each instrument separately ?

Yagotzirck
Verified
Extreme PSXDEV User
Extreme PSXDEV User
Posts: 131
Joined: Jul 17, 2013

Post by Yagotzirck » August 19th, 2020, 1:12 am

Probably, though at this point I'm thinking about taking the same approach used by the guy who made the music extractor for Driver and trying to create .xm files playable from pc rather than .PSFs, if you also want to do edits/remixes it should be the way to go.
I don't know how much feasible it would be compared to trying to rip .PSFs, but I can't tell until I give it a try :)

Anyway apologies if I haven't made much progress as of late, I'm dealing with other stuff at the moment and when evening comes I'm too burned out to deal with MIPS assembly :D

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests