PS1 Viewpoint data extraction

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
qxzq
Posts: 8
Joined: Mon Mar 14, 2022 5:36 am

PS1 Viewpoint data extraction

Post by qxzq »

Hi I am looking for a way to extract the Playstation version of Viewpoint soundtrack from the game.
The game disc has the following structure:

Code: Select all

I:.
|   BUFFER.XXX (33,859 KB)
|   SLUS_000.33 (460 KB)
|   SYSTEM.CNF (1 KB)
|   VIEW.DAT (358,690 KB)
|   VIEW.DIR (1 KB)
|   VPTMENU1.DA (21,221 KB)
|
\---MOVIES
        GAMEOVER.STR (3,701 KB)
        GAMEWON.STR (51,591 KB)
        LEVEL1.STR (3,586 KB)
        LEVEL2.STR (3,586 KB)
        LEVEL3.STR (3,586 KB)
        LEVEL4.STR (3,586 KB)
        LEVEL5.STR (3,586 KB)
        LOGO.STR (34,088 KB)

Ignore the MOVIES directory because it is video.

Based on file size, I suspect BUFFER.XXX, VIEW.DAT, or VPTMENU1.DA may contains soundtrack, but VPTMENU1.DA was the common RIFF format audio which is used in the opening movie and BUFFER.XXX was also a RIFF format but its just 3 minutes of noise.
I thought VIEW.DAT looked similar to the GameMaker archive because of the words FORM and SPRT found in the file, but I could not extract it with yoyogames.bms(As I expected! PS1 Viewpoint was released before the foundation of YoYo Games.)

Any ideas please?

Suspicious files below:
BUFFER.XXX
https://www.mediafire.com/file/3dw534sk ... R.XXX/file
VIEW.DAT
https://www.mediafire.com/file/20koecjo ... W.DAT/file
VIEW.DIR(Offset dictionary of VIEW.DAT?)
https://www.mediafire.com/file/8unt1yrw ... W.DIR/file
rabatini
Posts: 179
Joined: Tue Jan 18, 2022 12:21 am

Re: PS1 Viewpoint data extraction

Post by rabatini »

qxzq wrote:Hi I am looking for a way to extract the Playstation version of Viewpoint soundtrack from the game.
The game disc has the following structure:

Code: Select all

I:.
|   BUFFER.XXX (33,859 KB)
|   SLUS_000.33 (460 KB)
|   SYSTEM.CNF (1 KB)
|   VIEW.DAT (358,690 KB)
|   VIEW.DIR (1 KB)
|   VPTMENU1.DA (21,221 KB)
|
\---MOVIES
        GAMEOVER.STR (3,701 KB)
        GAMEWON.STR (51,591 KB)
        LEVEL1.STR (3,586 KB)
        LEVEL2.STR (3,586 KB)
        LEVEL3.STR (3,586 KB)
        LEVEL4.STR (3,586 KB)
        LEVEL5.STR (3,586 KB)
        LOGO.STR (34,088 KB)

Ignore the MOVIES directory because it is video.

Based on file size, I suspect BUFFER.XXX, VIEW.DAT, or VPTMENU1.DA may contains soundtrack, but VPTMENU1.DA was the common RIFF format audio which is used in the opening movie and BUFFER.XXX was also a RIFF format but its just 3 minutes of noise.
I thought VIEW.DAT looked similar to the GameMaker archive because of the words FORM and SPRT found in the file, but I could not extract it with yoyogames.bms(As I expected! PS1 Viewpoint was released before the foundation of YoYo Games.)

Any ideas please?

Suspicious files below:
BUFFER.XXX
https://www.mediafire.com/file/3dw534sk ... R.XXX/file
VIEW.DAT
https://www.mediafire.com/file/20koecjo ... W.DAT/file
VIEW.DIR(Offset dictionary of VIEW.DAT?)
https://www.mediafire.com/file/8unt1yrw ... W.DIR/file


I can't find any TOC in dir file, not even a filename.
Maybe other guys here can help you

I notice that the file has a lot of SPRT files into it, and always before the magic "SPRT" is the size of it.

So if you want to extract them.

use this script.
It will generally thousand of files.
i dont really know if it will help you in somehow.

Code: Select all

findloc OFFSET string "SPRT" 0 "" 0
math i = 0
do
math offset + 0x0
    goto OFFSET
    get DUMMY long
    findloc NEXT_OFFSET string "SPRT" 0 ""

     if NEXT_OFFSET == ""

        get SIZE asize
    else
        math SIZE = NEXT_OFFSET

    endif
    math SIZE -= OFFSET
   
 
    log "" OFFSET SIZE
    math i += 1
    math OFFSET = NEXT_OFFSET

while NEXT_OFFSET != ""
DKDave
Posts: 136
Joined: Mon Nov 23, 2020 6:01 pm

Re: PS1 Viewpoint data extraction

Post by DKDave »

Just to add to the above, it looks like each 'file' begins with "FORM", then the size in Big Endian (although this size doesn't always work for every FORM segment, so it must signify something else).

Within each FORM segment is a bunch of chunks, same as RIFF files, with each having a chunk name followed by chunk size in Big Endian. Some of the chunks are SPRT, there is also KNCH, VCML and many others. Some of the chunks are sound, some are images.
rabatini
Posts: 179
Joined: Tue Jan 18, 2022 12:21 am

Re: PS1 Viewpoint data extraction

Post by rabatini »

DKDave wrote:Just to add to the above, it looks like each 'file' begins with "FORM", then the size in Big Endian (although this size doesn't always work for every FORM segment, so it must signify something else).

Within each FORM segment is a bunch of chunks, same as RIFF files, with each having a chunk name followed by chunk size in Big Endian. Some of the chunks are SPRT, there is also KNCH, VCML and many others. Some of the chunks are sound, some are images.


It seems, each form founded in the file, is like a "pak inside pak"

Example.

Form with SPR will have a pack with a lot of SPR.

Well.

Maybe an palliative way to extract the files should be make a findloc into form, until someone can make a real good script for it.

Code: Select all

findloc OFFSET string "FORM"
do
    goto OFFSET
    get DUMMY long
    findloc NEXT_OFFSET string "FORM" 0 ""
    if NEXT_OFFSET == ""
        get SIZE asize
    else
        math SIZE = NEXT_OFFSET
    endif
    math SIZE -= OFFSET
 string NAME p "%08x.dat" offset
    log NAME OFFSET SIZE
    math OFFSET = NEXT_OFFSET
while NEXT_OFFSET != ""
qxzq
Posts: 8
Joined: Mon Mar 14, 2022 5:36 am

Re: PS1 Viewpoint data extraction

Post by qxzq »

Thanks for replying!

I threw VIEW.DAT into rabatini's latest script and I got 977 files. I opened them in hex editor but I couldn't understand what these files mean.
By the way, I scanned the split file with PSound and found some sound effects.
So I put the entire VIEW.DAT into PSound and it still detected sound effects. However, no soundtrack data.

For finding clues, I opened the program(SLUS_000.33) in hex editor and I find some filenames at 0x000019E0.
I don't know how these are tied to DAT, but they might be useful.

If you are good at reverse engineering, please use this file. You can decompile with Ghidra.
https://tetracorp.github.io/tokimeki-me ... games.html
SLUS_00033.zip
cic
Posts: 45
Joined: Fri Jan 07, 2022 7:44 pm

Re: PS1 Viewpoint data extraction

Post by cic »

qxzq wrote:Thanks for replying!

I threw VIEW.DAT into rabatini's latest script and I got 977 files. I opened them in hex editor but I couldn't understand what these files mean.
By the way, I scanned the split file with PSound and found some sound effects.
So I put the entire VIEW.DAT into PSound and it still detected sound effects. However, no soundtrack data.

For finding clues, I opened the program(SLUS_000.33) in hex editor and I find some filenames at 0x000019E0.
I don't know how these are tied to DAT, but they might be useful.

If you are good at reverse engineering, please use this file. You can decompile with Ghidra.
https://tetracorp.github.io/tokimeki-me ... games.html
SLUS_00033.zip


SFX Extractor for what?
qxzq
Posts: 8
Joined: Mon Mar 14, 2022 5:36 am

Re: PS1 Viewpoint data extraction

Post by qxzq »

cic wrote:SFX Extractor for what?

In the header of VIEW.DIR, there is a string "VCSVCFBINTXTVHVB�STRST1ST2ST3". These are file extensions. VH and VB are common format for PS1 soundtrack.
In the program, I found another string "runtime\\vabs\\level1.vab".
So I thought soundtrack is stored as VH+VB combo or VAB format.
PSound supports opening VB and VAB format files, I expected that I can extract soundtrack's samples.
rabatini
Posts: 179
Joined: Tue Jan 18, 2022 12:21 am

Re: PS1 Viewpoint data extraction

Post by rabatini »

qxzq wrote:Thanks for replying!

I threw VIEW.DAT into rabatini's latest script and I got 977 files. I opened them in hex editor but I couldn't understand what these files mean.
By the way, I scanned the split file with PSound and found some sound effects.
So I put the entire VIEW.DAT into PSound and it still detected sound effects. However, no soundtrack data.

For finding clues, I opened the program(SLUS_000.33) in hex editor and I find some filenames at 0x000019E0.
I don't know how these are tied to DAT, but they might be useful.

If you are good at reverse engineering, please use this file. You can decompile with Ghidra.
https://tetracorp.github.io/tokimeki-me ... games.html
SLUS_00033.zip


Well.

try my script to extract form

Code: Select all

findloc OFFSET string "FORM"
do
    goto OFFSET
    get DUMMY long
    findloc NEXT_OFFSET string "FORM" 0 ""
    if NEXT_OFFSET == ""
        get SIZE asize
    else
        math SIZE = NEXT_OFFSET
    endif
    math SIZE -= OFFSET

    log "" OFFSET SIZE
    math OFFSET = NEXT_OFFSET
while NEXT_OFFSET != ""


then

use this script to extract the folders

Code: Select all

endian big
idstring "FORM"
get SIZE long
getdstring DUMMY 4
get IFF_SIZE asize
savepos OFFSET
for OFFSET = OFFSET != IFF_SIZE
    getdstring TYPE 4
    get SIZE long
    savepos OFFSET
    string TYPE + /
    log TYPE OFFSET SIZE
    math OFFSET + SIZE
    goto OFFSET
next


the program called ripper6
extract the view.dat in a different way creating a lot of iff files.
you can also try it.

just drop the VIEW.DAT in the executable, waiting for extraction then use the second script. to extract folders/files.

in resume, you can try both ways my script + form/iff script or ripper6 + form/iff script
BloodRaynare
Posts: 367
Joined: Fri Mar 10, 2017 7:23 am

Re: PS1 Viewpoint data extraction

Post by BloodRaynare »

Just to let you know OP that the game's BGM was actually were inside the FORM/IFF files, on the VGML/VGMR chunks (Not all FORM files has that chunk though). I've made a BMS script to extract those chunks into a separate left/right channel VCM files

Code: Select all

endian big

get NAME basename

log MEMORY_FILE 0 0
log MEMORY_FILE2 0 0

append
for i = 0
   FindLoc VCML long 0x56434d4c ""
   if VCML == ""
      break
   endif
   goto VCML
   get ID long
   get ID_SIZE long
   math ID_SIZE + 8
   log MEMORY_FILE VCML ID_SIZE
   FindLoc VCMR long 0x56434d52 ""
   goto VCMR
   get ID long
   get ID_SIZE long
   math ID_SIZE + 8
   log MEMORY_FILE2 VCMR ID_SIZE
next i
append

string NAME_L p "%s_L.VCM" NAME
string NAME_R p "%s_R.VCM" NAME

get VCM_SZ_L asize MEMORY_FILE
get VCM_SZ_R asize MEMORY_FILE2
log NAME_L 0 VCM_SZ_L MEMORY_FILE
log NAME_R 0 VCM_SZ_R MEMORY_FILE2


You'll also need this .txth script to play the files with vgmstream

Code: Select all

codec = PSX
channels = 1
sample_rate = 22050

chunk_count = 1
chunk_start = 0
chunk_header_size = 0x0c
chunk_data_size = @0x04:BE - 0x04
chunk_size = @0x04:BE + 0x08
chunk_endianness = BE
chunk_size_offset = 0x04

num_samples = data_size


Save the text above as ".VCM.txth" then put it on the same directory as the VCM files. Don't forget to enable unknown exts in vgmstream preference if you're using foobar2000.Then, Just drag either one of the vcm files as the vgmstream will automatically play the both L and R files as one stereo audio.
qxzq
Posts: 8
Joined: Mon Mar 14, 2022 5:36 am

Re: PS1 Viewpoint data extraction

Post by qxzq »

BloodRaynare wrote:Just to let you know OP that the game's BGM was actually were inside the FORM/IFF files, on the VGML/VGMR chunks (Not all FORM files has that chunk though). I've made a BMS script to extract those chunks into a separate left/right channel VCM files

Code: Select all

endian big

get NAME basename

log MEMORY_FILE 0 0
log MEMORY_FILE2 0 0

append
for i = 0
   FindLoc VCML long 0x56434d4c ""
   if VCML == ""
      break
   endif
   goto VCML
   get ID long
   get ID_SIZE long
   math ID_SIZE + 8
   log MEMORY_FILE VCML ID_SIZE
   FindLoc VCMR long 0x56434d52 ""
   goto VCMR
   get ID long
   get ID_SIZE long
   math ID_SIZE + 8
   log MEMORY_FILE2 VCMR ID_SIZE
next i
append

string NAME_L p "%s_L.VCM" NAME
string NAME_R p "%s_R.VCM" NAME

get VCM_SZ_L asize MEMORY_FILE
get VCM_SZ_R asize MEMORY_FILE2
log NAME_L 0 VCM_SZ_L MEMORY_FILE
log NAME_R 0 VCM_SZ_R MEMORY_FILE2



Wow, this script worked! However, some files cannot be separated.
I inputted iff files which was generated by Ripper6.
QuickBMS says:

Code: Select all

- select input archives/files, type * for the whole folder and subfolders
- select output folder where extracting files
- open input file <hidden>\Desktop\VIEW\0122.iff
- open script <hidden>\quickbms\view.bms
- set output folder <hidden>\Desktop\VIEW\VCM

  offset   filesize   filename
--------------------------------------

Error: incomplete input file 0: <hidden>\Desktop\VIEW\0122.iff
       Can't read 3308 bytes from offset 01524e6c.
       Anyway don't worry, it's possible that the BMS script has been written
       to exit in this way if it's reached the end of the archive so check it
       or contact its author or verify that all the files have been extracted.
       Please check the following coverage information to know if it's ok.

  coverage file 0   100%!  39930324   22171244   . offset 01524e6c

Last script line before the error or that produced the error:
  24  log MEMORY_FILE2 VCMR ID_SIZE

- OFFSET       0x0152410c
- SIZE         0x00001a4c
  coverage file 0   100%!  39930324   22171244   . offset 01524e6c
  coverage file -1    0%   0          5489120    . offset 0053c1e0
  coverage file -2    0%   0          5482388    . offset 0053a794

Press ENTER or close the window to quit

These files gave this error:
0055.iff
0056.iff
0122.iff

Can you make a fix?
BloodRaynare
Posts: 367
Joined: Fri Mar 10, 2017 7:23 am

Re: PS1 Viewpoint data extraction

Post by BloodRaynare »

qxzq wrote:Wow, this script worked! However, some files cannot be separated.
I inputted iff files which was generated by Ripper6.
QuickBMS says:

Code: Select all

- select input archives/files, type * for the whole folder and subfolders
- select output folder where extracting files
- open input file <hidden>\Desktop\VIEW\0122.iff
- open script <hidden>\quickbms\view.bms
- set output folder <hidden>\Desktop\VIEW\VCM

  offset   filesize   filename
--------------------------------------

Error: incomplete input file 0: <hidden>\Desktop\VIEW\0122.iff
       Can't read 3308 bytes from offset 01524e6c.
       Anyway don't worry, it's possible that the BMS script has been written
       to exit in this way if it's reached the end of the archive so check it
       or contact its author or verify that all the files have been extracted.
       Please check the following coverage information to know if it's ok.

  coverage file 0   100%!  39930324   22171244   . offset 01524e6c

Last script line before the error or that produced the error:
  24  log MEMORY_FILE2 VCMR ID_SIZE

- OFFSET       0x0152410c
- SIZE         0x00001a4c
  coverage file 0   100%!  39930324   22171244   . offset 01524e6c
  coverage file -1    0%   0          5489120    . offset 0053c1e0
  coverage file -2    0%   0          5482388    . offset 0053a794

Press ENTER or close the window to quit

These files gave this error:
0055.iff
0056.iff
0122.iff

Can you make a fix?


I think it was the iff ripper that should be fixed because apparently some iff files were extracted incompletely. The error happens because the actual VGML/VGMR chunk sizes was smaller than the chunk header expects.
qxzq
Posts: 8
Joined: Mon Mar 14, 2022 5:36 am

Re: PS1 Viewpoint data extraction

Post by qxzq »

BloodRaynare wrote:I think it was the iff ripper that should be fixed because apparently some iff files were extracted incompletely. The error happens because the actual VGML/VGMR chunk sizes was smaller than the chunk header expects.

Oh. Fortunately, unconvertable soundtrack is released as single music, so I don't have to rip them from the game. It was credited in end credits. I should have checked it first.

Anyway, I got all soundtrack used in Viewpoint. Thanks everyone!
rabatini
Posts: 179
Joined: Tue Jan 18, 2022 12:21 am

Re: PS1 Viewpoint data extraction

Post by rabatini »

Try to use my findloc script
in this 3 .iff that gives you error.

because my script separate all forms in pak, ripper6, for some reason not.
cic
Posts: 45
Joined: Fri Jan 07, 2022 7:44 pm

Re: PS1 Viewpoint data extraction

Post by cic »

rabatini wrote:Try to use my findloc script
in this 3 .iff that gives you error.

because my script separate all forms in pak, ripper6, for some reason not.


I know your script separate all forms in pak, and ripper six, (idk what the *SPAM*)
qxzq
Posts: 8
Joined: Mon Mar 14, 2022 5:36 am

Re: PS1 Viewpoint data extraction

Post by qxzq »

rabatini wrote:Try to use my findloc script
in this 3 .iff that gives you error.

because my script separate all forms in pak, ripper6, for some reason not.

It worked! I got another soundtrack that Ripper 6 couldn't. Thank you very much.