XeNTaX
http://forum.xentax.com/

Cars THQ For Pc
http://forum.xentax.com/viewtopic.php?f=15&t=2135
Page 1 of 1

Author:  amira [ Sun Oct 08, 2006 5:28 am ]
Post subject:  Cars THQ For Pc

I need to unpak/pak .pak archives from The Cars THQ For Pc
Audio.PAK
Global.PAK
Act.PAK
http://www.carsvideogame.com/

Author:  Mr.Mouse [ Sun Oct 08, 2006 7:53 am ]
Post subject: 

Please provide us with examples of those pak archives or a direct link to a demo.

Author:  amira [ Sun Oct 08, 2006 4:03 pm ]
Post subject:  Re: Cars THQ For Pc

amira wrote:
I need to unpak/pak .pak archives from The Cars THQ For Pc
misc.PAK
res.PAK
Audio.PAK
Global.PAK
Act.PAK
http://www.carsvideogame.com/

http://amirachat.ifrance.com/misc.PAK
http://amirachat.ifrance.com/res.PAK

Author:  szevvy [ Sun Oct 08, 2006 4:21 pm ]
Post subject: 

Code:
   unsigned32 fileCount

   fileCount lots of (
      char filename[100]
      unsigned32 offset_from_end_of_header
      #actual offset is (fileCount * 108) + 4 + offset_from_end_of_header
      unsigned32 size
   )


Sadly, I don't know BMS but I'm sure someone here can convert it over.

Author:  Mr.Mouse [ Sun Oct 08, 2006 6:35 pm ]
Post subject: 

Code:
# The Cars THG .RES format MexScript
# By Mr.Mouse (thanks Szevvy)
# The format is very simple.
# ------------
# // Header
# UINT32 Number of resources
# // For each resource
# byte[100] Resource name (null-terminated, but 100 bytes reserved)
# unint32 Relative offset (minus the size of the info table + header)
# unint32 Size
# ------------
ImpType Standard ;
Get FNum Long 0 ;
# Calculate offset of file data (RO)
Set RO Long 108 ;
Math RO *= FNum ;
Math RO += 4 ;
For T = 1 To FNum ;
GetDString FN 100 0 ;
Get FO Long 0 ;
Get FS Long 0 ;
Log FN RO FS 0 0 ;
Math RO += FS ;
Next T ;


http://wiki.xentax.com/index.php/The_Cars_THQ_RES

The script will extract files from the res archives only. Start up MexCom 4.3 and use the wiki for source of scripts. Then open those res files !

If it works, don't forget to VOTE for it in the Supported Games list! It's now an unofficial script, when it gets 5 votes it will become official.

Author:  szevvy [ Mon Oct 09, 2006 2:51 pm ]
Post subject: 

I hate to be a pest, and I'm grateful you guys credit people who help out - but it's spelt 'szevvy' :D

Author:  Mr.Mouse [ Mon Oct 09, 2006 2:54 pm ]
Post subject: 

szevvy wrote:
I hate to be a pest, and I'm grateful you guys credit people who help out - but it's spelt 'szevvy' :D


Sorry, must have been blind, or drunk , or both ! Fixed !

Author:  amira [ Mon Oct 09, 2006 7:29 pm ]
Post subject: 

Mr.Mouse wrote:
Code:
# The Cars THG .PAK format MexScript
# By Mr.Mouse (thanks Szevvy)
# The format is very simple.
# ------------
# // Header
# UINT32 Number of resources
# // For each resource
# byte[100] Resource name (null-terminated, but 100 bytes reserved)
# unint32 Relative offset (minus the size of the info table + header)
# unint32 Size
# ------------
ImpType Standard ;
Get FNum Long 0 ;
# Calculate offset of file data (RO)
Set RO Long 108 ;
Math RO *= FNum ;
Math RO += 4 ;
For T = 1 To FNum ;
GetDString FN 100 0 ;
Get FO Long 0 ;
Get FS Long 0 ;
Log FN RO FS 0 0 ;
Math RO += FS ;
Next T ;


http://wiki.xentax.com/index.php/The_Cars_THQ_PAK

The script will extract files from the res archives only. Start up MexCom 4.3 and use the wiki for source of scripts. Then open those res files !

If it works, don't forget to VOTE for it in the Supported Games list! It's now an unofficial script, when it gets 5 votes it will become official.


Hi is code is correct for all file except file wav problem no sound (audio.PAK)
thanks
http://amirachat.ifrance.com/FRE_7Shi1.wav
http://amirachat.ifrance.com/FRE_7Shi2.wav
http://amirachat.ifrance.com/FRE_7Shi3.wav
http://amirachat.ifrance.com/FRE_7Sidle1.wav
http://amirachat.ifrance.com/FRE_7Sidle2.wav
http://amirachat.ifrance.com/FRE_7Sidle3.wav

Author:  Savage [ Mon Oct 09, 2006 9:18 pm ]
Post subject: 

This game have a "special" wav

Author:  Eradicon [ Thu Feb 10, 2011 6:30 pm ]
Post subject:  Re: Cars THQ For Pc

So how can I extract the .pak files?

Author:  hcs [ Sat Feb 25, 2017 2:43 pm ]
Post subject:  Re: Cars THQ For Pc

It's IMA/DVI ADPCM, nibble interleave. Here's a quick (but slow) Python 2.x decoder. Run as
python cars.py input.wav output.wav

Code:
#!/usr/bin/python

from io import open
from sys import argv
from struct import unpack, pack
from math import floor

IMA_Scale = \
[
    7, 8, 9, 10, 11, 12, 13, 14,
    16, 17, 19, 21, 23, 25, 28, 31,
    34, 37, 41, 45, 50, 55, 60, 66,
    73, 80, 88, 97, 107, 118, 130, 143,
    157, 173, 190, 209, 230, 253, 279, 307,
    337, 371, 408, 449, 494, 544, 598, 658,
    724, 796, 876, 963, 1060, 1166, 1282, 1411,
    1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024,
    3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484,
    7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899,
    15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794,
    32767
]

IMA_Step = \
[
    -1, -1, -1, -1, 2, 4, 6, 8,
    -1, -1, -1, -1, 2, 4, 6, 8
]

infile = open(argv[1], "rb")
outfile = open(argv[2], "wb")

def read32(): return unpack("<I",infile.read(4))[0]
def read16(): return unpack("<H",infile.read(2))[0]
def write32(x): outfile.write(pack("<I",x))
def write16(x): outfile.write(pack("<H",x))

riff_head = infile.read(4)
if riff_head != "RIFF":
    raise Exception, "expected RIFF"
file_len = read32()
wavefmt = infile.read(8)
if wavefmt != "WAVEfmt ":
    raise Exception, "expected WAVE fmt"
header_len = read32()
if header_len != 0x14:
    raise Exception, "expected head len 0x14"
codec = read16()
if codec != 2:
    raise Exception, "expected codec 2"
channels = read16()
if channels != 2:
    raise Exception, "expected stereo"
sample_rate = read32()
byte_rate = read32()
sample_size = read16()
if sample_size != 4:
    raise Exception, "expected 4 bit samples"
block_size = read16()
if block_size != 16:
    raise Exception, "expected block size 16"
unk = read32()
if unk != 0x40*0x10000:
    raise Exception, "expecting 00 00 40 00"

data_head = infile.read(4)
if data_head != "data":
    raise Exception, "expected data chunk"
data_len = read32()

data = infile.read(data_len)
payload_size = len(data)
if payload_size != data_len:
    raise Exception, "didn't read all the data?"
sample_count = payload_size
infile.close()

# write RIFF header
outfile.write("RIFF")
write32(payload_size*4+0x24)  # total size
outfile.write("WAVEfmt ")

write32(0x10)   # fmt chunk size
write16(0x1)   # pcm codec id
write16(channels)
write32(sample_rate)
write32(sample_rate*channels*2)
write16(2*channels)  # block align
write16(16)  # bits per sample

outfile.write("data")
write32(payload_size*4)

hist = [0,0]
idx = [0,0]

def decodeima(n,c):
    global idx, hist
    stepsize = IMA_Scale[idx[c]]

    delta = stepsize >> 3
    if (n&1): delta += stepsize >> 2
    if (n&2): delta += stepsize >> 1
    if (n&4): delta += stepsize
    if (n&8):
        newsample = max(-32768, hist[c] - delta)
    else:
        newsample = min(32767, hist[c] + delta)

    idx[c] = max(0, min(88, idx[c] + IMA_Step[n]))

    return newsample

for c in data:
    b = ord(c)
    hist[0] = decodeima(b / 16, 0)
    hist[1] = decodeima(b & 0xF, 1)

    outfile.write(pack("<hh", hist[0], hist[1]))



edit:
Oops, I didn't realize how old this thread was when I posted, I was pointed here recently by someone looking to decode the WAVs used in this game. Hope it is still useful to someone!

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/