POP1 Music extraction thread

About PR usage and development, and about the POP format.
poirot
Developer
Developer
Posts: 394
Joined: March 24th, 2003, 8:52 pm
Location: Australia
Contact:

Post by poirot »

byte number 7 is checksum, byte number 8 is 02 allways.

checksum works like that: the sum of all the bytes modulo 256 must be the same (Tammo Jan said this value was 0).

If the sum is not the same value as before, then you must change the checksum character to do that. The two bytes before MThd are header bytes too, so the first is the checksum of the next file and the second is allways 02.
tammojan
Efendi
Efendi
Posts: 17
Joined: March 5th, 2004, 9:14 am
Location: Utrecht, The Netherlands
Contact:

Post by tammojan »

Not 256, but 255 :-)
poirot
Developer
Developer
Posts: 394
Joined: March 24th, 2003, 8:52 pm
Location: Australia
Contact:

Post by poirot »

So...
checksum:=0;
for i:=1 to midiLenght do
begin
checksum:=checksum+ord(array[i]);
end;
checksum:=255-(checksum mod 256);
Guest

Post by Guest »

[quote]You are ignoring the first 8 bytes in the file, they are very important, and the validation is there.

The first 2 bytes are a dword value x
The second 2 bytes are allways 0
The third group of 2 bytes in a dword value y

where x+y=size of the file!!!![/quote]

I haven't seen it anywhere, but I think you all know this already:
x is the offset of the header
y is the length of the header
the header gives information about the filesize and offset of all the midis (and other filetypes) in the file and something else that I don't know yet.

At least, this goes for my PC version of Prince of Persia v1.3 (cheat parameter is improved in this version).

-- Frenkel
poirot
Developer
Developer
Posts: 394
Joined: March 24th, 2003, 8:52 pm
Location: Australia
Contact:

Post by poirot »

I've discovered the whole sound (midi and wave) and graphics .dat file structure.

All Prince of Persia Dat files are indexed, even levels.dat.

I'll make an extractor for all the formats now I know how the index works.

XX XX is the offset of the index. YY YY is 8*a+2, where a is the number of files in the file. in the index there is AA AA that is the number a, the 8 bytes for each file, those bytes are: QQ QQ WW WW 00 00 EE EE, where QQ QQ is the id, WW WW is the file offset and EE EE is the file size. That explains the wasted bytes in PG, the problem with the headers in wave files and the deterministic bytes at the end of levels.dat.
tammojan
Efendi
Efendi
Posts: 17
Joined: March 5th, 2004, 9:14 am
Location: Utrecht, The Netherlands
Contact:

Post by tammojan »

Great!!!
tammojan
Efendi
Efendi
Posts: 17
Joined: March 5th, 2004, 9:14 am
Location: Utrecht, The Netherlands
Contact:

Post by tammojan »

Oh but you have some bits left, since YY=8*a+2, the last three bits don't have any meaning. Could they be for something else, or are they part of the following bytes?
poirot
Developer
Developer
Posts: 394
Joined: March 24th, 2003, 8:52 pm
Location: Australia
Contact:

Post by poirot »

where exactly?
tammojan
Efendi
Efendi
Posts: 17
Joined: March 5th, 2004, 9:14 am
Location: Utrecht, The Netherlands
Contact:

Post by tammojan »

Well, in the file format, I was just responding to your post here, I haven't looked at the bytes myself...
poirot
Developer
Developer
Posts: 394
Joined: March 24th, 2003, 8:52 pm
Location: Australia
Contact:

Post by poirot »

Ohhh sorry I didn't get what you tried to say ;)

well, I need the mail explaining how to crack the digisnd, or the wav specifications digisnd is using, or at least a wav file extracted from the game (so I can see the wav spefications).

[quote]Oh, maybe I should have mentioned this earlier: I got a mail, stating how to crack the "digisnd.dat". It is at least readable as raw data (for example in coolplayer). It shouldn't be too hard to crack this one too [/quote]

Please resend this mail. The extractor goes very good, now it can read any pop1 dat file and determine whatever there is inside. Extracts bitmaps, palettes, midis, raw waves, levels, and lots of things we don't know yet what are they used for (game scripts suggested ChrML, and I hope he is right, but I'm afraid prince.exe was detected as an image file).
tammojan
Efendi
Efendi
Posts: 17
Joined: March 5th, 2004, 9:14 am
Location: Utrecht, The Netherlands
Contact:

Post by tammojan »

I don't know the wav specification, but it should be traceable on the internet. The mail I have only stated that digisnd1.dat could be opened in Goldwave. It then only reads raw audio, which fits. The sound files are 8 bit, mono, unsigned, and 11025 Hz. I hope that helps...
poirot
Developer
Developer
Posts: 394
Joined: March 24th, 2003, 8:52 pm
Location: Australia
Contact:

Post by poirot »

[quote]The sound files are 8 bit, mono, unsigned, and 11025 Hz.[/quote]

that is exactly what I needed
poirot
Developer
Developer
Posts: 394
Joined: March 24th, 2003, 8:52 pm
Location: Australia
Contact:

Post by poirot »

Well, PR (PG & PS) now extracts wav files, in wav format, so you can play prince of persia sounds in winamp! The same with midis.

But the best of all: The resource compiler works!!! My friend Pi (who helped in wav header figuring out) played a melody in his electronic organ and then exported it as midi, after that I compiled a new digisnd2.dat using PR with the new melody. And it worked!!!!

<a href="http://www.cnu.net.ar/~ecalot/princed/d ... 2.dat">See here the new midisnd2.dat we made</a>

[Editado el 9/6/2003 por poirot]
poirot
Developer
Developer
Posts: 394
Joined: March 24th, 2003, 8:52 pm
Location: Australia
Contact:

Post by poirot »

Well... PS is 100% figured out, PR does extract and compress midi and wav, so let's move to the <a href=http://www.cnu.net.ar/modules.php?name= ... &tid=42>PR development & testing thread</a>.

[Editado el 13/6/2003 por poirot]
tommer
Scholar Scribe
Scholar Scribe
Posts: 1
Joined: August 29th, 2003, 9:00 pm

Post by tommer »

[quote]I'm ChrML, only that I couldn't get logged into this forum.
Finally (after 30 min more researching) I got the midi files in MIDISND1.DAT extracted. Actually, it was really simple. Getting them back into the file is not hard either. Just paste it back over the file in a hex editor, and change the filesize DWORD on the top to the new size. Here are all midi files in MIDISND1.DAT:

[url]http:\\www.thps3cu.com\files\MIDISND1.zip[/url]

I'll create an editor for it later. Enjoy these files in the mean time. [/quote]

Actually there are 16 files in midisnd1 so you are missing one in your zip-file. You are missing de file after "Shadow.mff" this is the 8th file in midisnd1.
Post Reply