Offtopic: Into Commodore 64 (6502) coding, pixeling or music?
Xentax is looking for new members for the C64 activities!
Just drop us a message at forum@xentax.com and join the Scene Team!
Forum rules: Click here
Coders and would-be coders alike, this is the place to talk about programming.
-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Post
by AlphaTwentyThree » Fri Jun 29, 2012 1:48 am
XEN archive extractor
Found this in an XBLA game. A little bit more elaborate format, but not much.
Code: Select all
# extract *.xen archives
# supported games:
# - Are You Smarter Than A 5th Grader: Make the Mark (XBLA)
#
# (c) 2012-06-29 by AlphaTwentyThree of XeNTaX
endian big
get UNK long
get DATASTART long
get UNK long
get FILES long
get POS_INFO long
math POS_INFO *= 0x1000
get POS_UNK long
get UNK long
get COMP_SIZE long
goto 0x28
get POS_NAMES long
math POS_NAMES *= 0x1000
get FNAME basename
string FNAME += "/"
goto 0x3c
get DEC_SIZE long
if DEC_SIZE != 0 # compressed data
get OFFSET asize
math OFFSET -= COMP_SIZE
putVarChr MEMORY_FILE 0x15f 0 byte # produce bias of 0x160 bytes
append
clog MEMORY_FILE OFFSET COMP_SIZE DEC_SIZE
append
else
get SIZE asize
append
log MEMORY_FILE 0 SIZE
append
endif
goto POS_INFO MEMORY_FILE
for i = 1 <= FILES
get OFFSET long MEMORY_FILE
math OFFSET *= 0x1000
get CRC long MEMORY_FILE
get SIZE long MEMORY_FILE
get NAMEPOS long MEMORY_FILE
math NAMEPOS += POS_NAMES
get UNK long MEMORY_FILE # 0 or 1
get UNK long MEMORY_FILE # multiple of 4 or 0
get ZSIZE long MEMORY_FILE
get ZERO long MEMORY_FILE
savepos MYOFF MEMORY_FILE
goto NAMEPOS MEMORY_FILE
get NAME string MEMORY_FILE
goto MYOFF MEMORY_FILE
if SIZE != 0
set WNAME FNAME
string WNAME += NAME
log WNAME OFFSET SIZE MEMORY_FILE
endif
next i
-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Post
by AlphaTwentyThree » Sun Jul 01, 2012 3:47 pm
XPR2 extractor
Will need to further compare this with the Quake 4 X360 version, maybe there's some identifier and I can join the two scripts.
I guess there are other games that use this format. I'll update the script info at the start as soon as I encounter more so this script can be found when searching for a game inside XeNTaX.
Code: Select all
# extract *.xpr archives
# (note: these are different than the ones from Quake 4 X360)
#
# games that use XPR2 archives:
# Astropop XBLA
# Bejeweled 2 XBLA
# Contra XBLA
#
# (c) 2012-07-01 by AlphaTwentyThree of XeNTaX
IDSTRING "XPR2"
endian big
get FILESIZE long # minus 0xc
get FSIZE asize
math FSIZE -= 0xc
if FSIZE != FILESIZE
print "XPR archive not supported. Please contact me on XeNTaX!"
cleanexit
endif
get ZERO long
get FILES long
for i = 1 <= FILES
getDstring UNK 4
get OFFSET long
math OFFSET += 0xc
get SIZE long
get NAMEPOS long
math NAMEPOS += 0xc
savepos MYOFF
goto NAMEPOS
get NAME string
goto MYOFF
log NAME OFFSET SIZE
next i
Last edited by
AlphaTwentyThree on Sat Jul 07, 2012 11:57 pm, edited 2 times in total.
-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Post
by AlphaTwentyThree » Mon Jul 02, 2012 2:53 am
Backbreaker: Vengeance (XBLA) pkd extractor
Code: Select all
# extract pkd/pkh archive pairs from Backbreaker: Vengeance (XBLA)
# (c) 2012-07-02 by AlphaTwentyThree of XeNTaX
open FDDE pkh 0
open FDDE pkd 1
get FILES long 0
get UNK long 0
for i = 1 <= FILES
get NAMEL long 0
getDstring NAME NAMEL 0
get OFFSET long 0
get SIZE long 0
log NAME OFFSET SIZE 1
next i
-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Post
by AlphaTwentyThree » Mon Jul 02, 2012 6:55 pm
POD archive extractor
Just encountered a POD2 archive and decided to merge the existing scripts I coded for POD archives so far into one single script.

If anyone has a POD1 or POD4 sample, please PM me.
Code: Select all
# POD extractor
# supported games:
# Blair Witch Vol.I - Vol.III (PC) v2
# BloodRayne (PS2) v3
# Country Dance All-Stars (X360, 2012) v5
# Kinect Star Wars (X360, 2012) v5
# Toy Story Mania (X360, 2012) v5
# The Walking Dead: Survival Instinct (2013) v5
#
# (c) 2012-11-05 by AlphaTwentyThree of XeNTaX
idstring "POD"
getDstring VER 1
if VER == "1"
print "POD version not supported yet! Please contact me via PM!"
cleanexit
elif VER == "4"
print "POD version not supported yet! Please contact me via PM!"
cleanexit
endif
goto 0x58
get FILES long
if VER == "2"
set HEADER 0x60
else
goto 0x108
get HEADER long
endif
set NAMEBIAS FILES
if VER == "5"
math NAMEBIAS *= 0x1c
else
math NAMEBIAS *= 0x14
endif
math NAMEBIAS += HEADER
goto HEADER
for i = 1 <= FILES
get NAMEPOS long
math NAMEPOS += NAMEBIAS
get SIZE long
get OFFSET long
if VER == "5"
get ZSIZE long
get ZERO long
else
set ZSIZE SIZE
endif
get UNK long
get UNK long
savepos MYOFF
goto NAMEPOS
get NAME string
if SIZE == ZSIZE
log NAME OFFSET SIZE
else
clog NAME OFFSET SIZE ZSIZE
endif
goto MYOFF
next i
Last edited by
AlphaTwentyThree on Sun Sep 08, 2013 9:02 pm, edited 2 times in total.
-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Post
by AlphaTwentyThree » Tue Jul 03, 2012 3:37 am
Ace Combat Zero: The Belkan War (PS2) - npsf to ss2 converter
Split the BGM.PAC with my generic splitter ("NPSF") and convert them with this script to ss2 afterwards (playable with Winamp & vgmstream). Luckily, NPSF files contain song names.
Code: Select all
# convert Ace Combat Zero: The Belkan War (PS2) npsf to ss2
# (c) 2012-07-03 by AlphaTwentyThree of XeNTaX
include "func_header_SS2.bms"
idstring "NPSF"
goto 0x10
get INTERLEAVE long
get UNK long
get FREQ long
set CH 2
goto 0x34
getCT NAME string 0x2e
string NAME += ".ss2"
set OFFSET 0x800
get SIZE asize
math SIZE -= OFFSET
callfunction SS2 1
-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Post
by AlphaTwentyThree » Wed Jul 04, 2012 1:31 pm
SDF to SS2 converter
Request from mauzerX.

Needs
func_header_SS2.bms in the same folder.
Don't forget to run the files through my 0x10 bytes reinterleaver before playing!
Code: Select all
# convert *.sfd files to playable *.ss2 files
#
# supported games:
# - Doomsday Racers (PS2)
# - Obliterate (PS2)
# - X-Treme Quads (PS2)
#
# (c) 2012-07-04 by AlphaTwentyThree of XeNTaX
include "func_header_SS2.bms"
idstring "SDF"
goto 8
get SIZE long
get FREQ long
get CH long
get INTERLEAVE long
set OFFSET 0x18
set NAME ""
callfunction SS2 1
Last edited by
AlphaTwentyThree on Wed Jul 04, 2012 3:32 pm, edited 1 time in total.
-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Post
by AlphaTwentyThree » Wed Jul 04, 2012 3:31 pm
Beyond Good & Evil HD (XBLA) - bf extractor
Extracts the main archive. Careful, more than 8000 files in this archive.
Code: Select all
# extract the Sally_PC_POLISH.bf from Beyond Good & Evil HD (XBLA)
# (c) 2012-07-04 by AlphaTwentyThree of XeNTaX
idstring "BIG"
goto 0x8
get FILES long
set OFF_INFO 0x15abc
goto 0x44
for i = 1 <= FILES
get OFFSET long
math OFFSET += 4
get UNK short
get UNK short
savepos MYOFF
goto OFF_INFO
get UNK byte # always 0xfc
get SIZE threebyte
math SIZE *= 0x100
get ID1 long
get ID2 long
get CAT short # category
get ZERO short
get UNK long
getDstring NAME 0x40
get UNK long
savepos OFF_INFO
goto MYOFF
log NAME OFFSET SIZE
next i
-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Post
by AlphaTwentyThree » Wed Jul 04, 2012 11:42 pm
Just updated the PCM wave header adder because it had an error. You can now also change codecs, but beware: sometimes it won't work. Stay with PCM to be safe.

-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Post
by AlphaTwentyThree » Wed Jul 04, 2012 11:43 pm
XNB to WAV
Be sure you have the newest func_header_PCM.bms (
viewtopic.php?f=13&t=4450&p=71565#p71565)
Code: Select all
# converts Microsoft XNA Framework *.xnb files to *.wav if included
# (c) 2012-10-14 by AlphaTwentyThree of XeNTaX
include "func_header_PCM.bms"
idstring "XNBw"
goto 0x47
get CODEC short
get CH short
get FREQ long
get UNK long
get BLOCKALIGN short
get BITS short
get JUMP short
savepos MYOFF
math MYOFF += JUMP
goto MYOFF
get SIZE long
savepos OFFSET
set NAME ""
callfunction PCM 1
Last edited by
AlphaTwentyThree on Sun Oct 14, 2012 7:37 pm, edited 1 time in total.
-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Post
by AlphaTwentyThree » Thu Jul 05, 2012 1:20 am
Breach xsp/spd extractor
I first thought that some ID sorting was referring to the names so I hazzled around to get it right - only to realize that it's something game-internal and apparently not needed for extraction.

Works for PC and XBLA version. The archives are the same except for the extension.
Code: Select all
# extract *.xsp/*.spd sound archives from Breach (XBLA)
# (c) 2012-07-05 by AlphaTwentyThree of XeNTaX
open FDDE spd 0
idstring "SPDv1.04" 0
open FDDE xsp 1 EXIST
if EXIST == 0
open FDDE psp 1 EXIST
if EXIST == 0
cleanexit
endif
endif
endian big
get SIZE_HEADER long 0
get ZERO long 0
get FILES long 0
get OFF_INFO long 0
set OFF_IDS FILES # sorting of info above (game-internal)
math OFF_IDS *= 0x38
math OFF_IDS += OFF_INFO
set OFF_NAMEPOS FILES # pointer to file name
math OFF_NAMEPOS *= 4
math OFF_NAMEPOS += OFF_IDS
set OFFBIAS_NAMES FILES
math OFFBIAS_NAMES *= 4
math OFFBIAS_NAMES += OFF_NAMEPOS
goto 0 1
endian little
get DUMMY long 1 # FILES again
for i = 1 <= FILES
get OFFSET long 1
savepos MYOFF 1
if i < FILES
get SIZE long 1
goto MYOFF 1
else
get SIZE asize 1
endif
math SIZE -= OFFSET
goto OFFBIAS_NAMES 0
get NAME string 0
string NAME += ".wav"
savepos OFFBIAS_NAMES 0
log NAME OFFSET SIZE 1
next i
-
Researchman
- mega-veteran

- Posts: 314
- Joined: Fri Jun 11, 2010 12:08 pm
- Has thanked: 78 times
- Been thanked: 21 times
Post
by Researchman » Sat Jul 07, 2012 6:24 am
Try use Beyond Good & Evil HD (XBLA) - bf extractor on TMNT.bf(ABE header). I think archive format is similar, but need fix something in script for work:

-
AlphaTwentyThree
- double-veteran

- Posts: 984
- Joined: Mon Aug 24, 2009 10:55 pm
- Has thanked: 75 times
- Been thanked: 626 times
Post
by AlphaTwentyThree » Sat Jul 07, 2012 4:25 pm
The general problem with this format is that I couldn't find a way to calculate the OFF_INFO and had to manually set it to 0x15abc just for this one archive. So it won't work for any other .bf file.
-
evin
- ultra-veteran

- Posts: 336
- Joined: Sat Aug 05, 2006 2:04 pm
- Location: Hungary
- Has thanked: 1 time
- Been thanked: 141 times
-
Contact:
Post
by evin » Sat Jul 07, 2012 7:34 pm