WipeOut Pure wad dump

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
GoatSucker
Posts: 6
Joined: Sun May 08, 2005 1:49 am

WipeOut Pure wad dump

Post by GoatSucker »

Hi All. I'm new to the PSPDev community, but I've been taking a look at the WipeOut Pure wad files, and hoepfully my observations may be of use.

All the WipeOut Pure data is held in .wad files, which are just a bunch of files concatenated without any compression / encryption (much like the original Doom .wad files of old!).
There are a few main .wad files containing the tracks, graphics and music, and a seperate .wad file for each of the ships.
What is interesting is that a lot of the data files are XML, which makes understanding them very easy. The ship .wad files each contain 3 other files, the first of which is an XML file containing the ship profile for each league.
The other two files also appear to be archive files, containing vector / texture data for the ship.
Each of the files in the .wad doesn't have a filename, but does have a 32-bit id. At first I thought this is a CRC, but it seems likely that it is instead a filename hash, kind of like a 32 bit MD5.

Anyway, the interesting things that might come out of this:
1. Since WipeOut Pure allows additional ships to be loaded from the memory card, it is possible that the other data files could be loaded also. That would open up scope for custom music (the existing ones are just ac3 files, as far as I can tell), custom textures and even custom tracks.

2. There is already an additional ship/track/theme downloadable data file available for the Japanese version, which has an encrypted .wad file. Since it is likely that the downloadable .wad and internal .wad files are the same format, it could be a way to work out how the downloadable .wad has been encrypted.

I'm happy to post the source to the dump tool if it's not against the rules of the forum. I won't provide dumps of any of the .wad files though, so don't ask!

Cheers,
GoatSucker
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

While we don't usually focus on modifying games here, its new enough in the PSP's life that this is interesting. Feel free to post the source to the tool.
GoatSucker
Posts: 6
Joined: Sun May 08, 2005 1:49 am

Post by GoatSucker »

Ok. Code is attached. BTW, I can confirm that the 32-bit id is a filename hash. There are several data files that appear in more than one .wad file with the same hash, which leads to the idea that any file could be patched from the memory stick.
It should be easy to understand the .wad file structure from the code below.

I'd be interested in any links that may help with being able to decrypt the downloadable .wad files, as this may help with being able to decrypt general memory stick files.

Anyway, enjoy.

Code: Select all

// wpdump.cpp
//

#include "stdafx.h"
#include <stdlib.h>

struct fileInfo
	&#123;
	int name;
	int start;
	int length;
	int length2;
	&#125;;


void DumpFile&#40;char* aFile&#41; &#123;
	printf&#40;"Dumping&#58;"&#41;;
	printf&#40;aFile&#41;;
	printf&#40;"\n"&#41;;

	FILE* f = fopen&#40;aFile, "r+b"&#41;;
	if &#40;f == NULL&#41; &#123;
		printf&#40;"Cannot open file\n"&#41;;
		return;
		&#125;

	int value;
	fread&#40;&value, 4, 1, f&#41;;
	printf&#40;"Version = %d\n", value&#41;;
	int files;
	fread&#40;&files, 4, 1, f&#41;;
	printf&#40;"Files = %d\n", files&#41;;

	fileInfo* fiArray = &#40;fileInfo*&#41;malloc&#40;files * sizeof fileInfo&#41;;

	fileInfo* fiPtr = fiArray;

	for &#40;int i=0; i<files; i++&#41;
		&#123;
		fread&#40;&&#40;fiPtr->name&#41;, 4, 1, f&#41;;
		fread&#40;&&#40;fiPtr->start&#41;, 4, 1, f&#41;;
		fread&#40;&&#40;fiPtr->length&#41;, 4, 1, f&#41;;
		fread&#40;&&#40;fiPtr->length2&#41;, 4, 1, f&#41;;
		fiPtr++;
		&#125;

	fiPtr = fiArray;

	for &#40;int j=0; j<files; j++&#41;
		&#123;
		printf&#40;"%03d / %03d  &#58; 0x%x  &#58;  Size&#58; %d  ", j+1, files, fiPtr->name, fiPtr->length&#41;;

		fseek&#40;f, fiPtr->start, SEEK_SET&#41;;
		char* buffer = &#40;char*&#41;malloc&#40;fiPtr->length&#41;;
		fread&#40;buffer, fiPtr->length, 1, f&#41;;
		int isXml = 0;
		if &#40;fiPtr->length > 5&#41;
			&#123;
			if &#40;buffer&#91;0&#93; == '<' && buffer&#91;1&#93; == '?' && buffer&#91;2&#93; == 'x' && buffer&#91;3&#93; == 'm' && buffer&#91;4&#93; == 'l'&#41; 
				&#123;
				isXml = 1;
				&#125;
			&#125;

		char name&#91;256&#93;;
		if &#40;isXml&#41; &#123;
			sprintf&#40;name,"%03d.%x.xml", j+1, fiPtr->name&#41;;
			&#125;
		else &#123;
			sprintf&#40;name,"%03d.%x.dat", j+1, fiPtr->name&#41;;
			&#125;
		printf&#40;"Writing&#58;"&#41;;
		printf&#40;name&#41;;
		printf&#40;"\n"&#41;;


		FILE* out = fopen&#40;name, "w+b"&#41;;
		if &#40;out&#41;
			&#123;
			fwrite&#40;buffer, fiPtr->length, 1, out&#41;;
			fclose&#40;out&#41;;
			&#125;

		delete buffer;

		fiPtr++;
		&#125;

	delete fiArray;

	fclose&#40;f&#41;;
	&#125;

int main&#40;int argc, char* argv&#91;&#93;&#41;
&#123;
	printf&#40;"WPDUMP &#91;GoatSucker&#93;\n"&#41;;
	if &#40;argc != 2&#41; &#123;
		printf&#40;"No file specified\n"&#41;;
		return 0;
		&#125;
	DumpFile&#40;argv&#91;1&#93;&#41;;
	return 0;
&#125;

annerajb
Posts: 40
Joined: Thu Mar 31, 2005 6:16 am

Post by annerajb »

wad files can be extracted using dragon unpacker. google it
Herman
Posts: 13
Joined: Tue Apr 05, 2005 4:15 pm
Location: Montreal, Canada

Post by Herman »

Dragon Unpacker doesn't work with these wad files. I also compared them to wad files from old Wipeout games and they're not the same type.
ale275
Posts: 10
Joined: Tue Dec 28, 2004 4:54 am

Post by ale275 »

anyone tried to (DO SOMETHING NAUGHTY) and see waht happens??
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

ale275: READ THE RULES!
annerajb
Posts: 40
Joined: Thu Mar 31, 2005 6:16 am

Post by annerajb »

use the hyper creator and click or file extensions inside the wad files appear png files and at3 files
ale275
Posts: 10
Joined: Tue Dec 28, 2004 4:54 am

Post by ale275 »

sorry ooPo :( i didn't wnat ot break rules :(
kagaku
Posts: 2
Joined: Mon May 09, 2005 1:39 am

Post by kagaku »

You mentioned that the music files are in AC3 format, any chance of a tool to extract them? :)
GoatSucker
Posts: 6
Joined: Sun May 08, 2005 1:49 am

Post by GoatSucker »

kagaku - The tool I posted will automatically extract all the files from the given .wad. It doesn't rename the files to ac3 yet, but that should be an easy mod.
annerajb
Posts: 40
Joined: Thu Mar 31, 2005 6:16 am

Post by annerajb »

dragon unpacker hypercreator does extract them
kagaku
Posts: 2
Joined: Mon May 09, 2005 1:39 am

Post by kagaku »

GoatSucker wrote:kagaku - The tool I posted will automatically extract all the files from the given .wad. It doesn't rename the files to ac3 yet, but that should be an easy mod.
How do I compile it? I ran it through gcc, but it spit out an error.

Code: Select all

kagaku@tomiko psp $ make wpdump
g++     wpdump.cpp   -o wpdump
wpdump.cpp&#58;4&#58;20&#58; stdafx.h&#58; No such file or directory
wpdump.cpp&#58; In function `void DumpFile&#40;char*&#41;'&#58;
wpdump.cpp&#58;17&#58; error&#58; `printf' undeclared &#40;first use this function&#41;
wpdump.cpp&#58;17&#58; error&#58; &#40;Each undeclared identifier is reported only once for
   each function it appears in.&#41;
wpdump.cpp&#58;21&#58; error&#58; `FILE' undeclared &#40;first use this function&#41;
wpdump.cpp&#58;21&#58; error&#58; `f' undeclared &#40;first use this function&#41;
wpdump.cpp&#58;21&#58; error&#58; `fopen' undeclared &#40;first use this function&#41;
wpdump.cpp&#58;28&#58; error&#58; `fread' undeclared &#40;first use this function&#41;
wpdump.cpp&#58;34&#58; error&#58; parse error before `&#41;' token
wpdump.cpp&#58;53&#58; error&#58; `SEEK_SET' undeclared &#40;first use this function&#41;
wpdump.cpp&#58;53&#58; error&#58; `fseek' undeclared &#40;first use this function&#41;
wpdump.cpp&#58;67&#58; error&#58; `sprintf' undeclared &#40;first use this function&#41;
wpdump.cpp&#58;77&#58; error&#58; `out' undeclared &#40;first use this function&#41;
wpdump.cpp&#58;80&#58; error&#58; `fwrite' undeclared &#40;first use this function&#41;
wpdump.cpp&#58;81&#58; error&#58; `fclose' undeclared &#40;first use this function&#41;
wpdump.cpp&#58; In function `int main&#40;int, char**&#41;'&#58;
wpdump.cpp&#58;96&#58; error&#58; `printf' undeclared &#40;first use this function&#41;
wpdump.cpp&#58;103&#58;2&#58; warning&#58; no newline at end of file
make&#58; *** &#91;wpdump&#93; Error 1
kagaku@tomiko psp $
imk
Posts: 8
Joined: Sat Apr 16, 2005 2:13 pm

Post by imk »

kagaku wrote:How do I compile it? I ran it through gcc, but it spit out an error.
wpdump.cpp:4:20: stdafx.h: No such file or directory <-- you're missing stdafx.h
Orion_
Posts: 69
Joined: Thu Jan 27, 2005 8:47 am

Post by Orion_ »

stdafx is a windows header
replace stdafx with stdio for FILE things
allthatinny
Posts: 24
Joined: Fri May 06, 2005 5:59 pm

Post by allthatinny »

if you guys looking for a wad dumper i found one at psphacks.net here is the link http://www.psphacks.net/forums/viewtopic.php?t=757
GoatSucker
Posts: 6
Joined: Sun May 08, 2005 1:49 am

Post by GoatSucker »

Sorry - should have said the code was for MSDev, but it should work on gcc by changing the header to stdio.h. Haven't verified that myself, though.
Didn't know about the existing tools, but thanks for pointing them out.
Now I just need a tool to make new encrypted wad's for the memory stick - any pointers?
pixel
Posts: 791
Joined: Fri Jan 30, 2004 11:43 pm

Post by pixel »

Orion_ wrote:stdafx is a windows header
replace stdafx with stdio for FILE things
Wrong.... it's an automatic .h file generated by msvc for the project...
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
ale275
Posts: 10
Joined: Tue Dec 28, 2004 4:54 am

Post by ale275 »

if is needed i can attach wad_dump.exe complied by me under windows
Awhite
Posts: 55
Joined: Wed Feb 23, 2005 3:21 am

Post by Awhite »

That could be good, btw i used the extractor program and it extracted some .wav files at about 2.5mbs each. I renamed them into .ac3 but they won't work...any ideas?
Ioannis KarAvas
Herman
Posts: 13
Joined: Tue Apr 05, 2005 4:15 pm
Location: Montreal, Canada

Post by Herman »

I've been looking at them. Their codec type is 0xFFFF, which means it's something specific to Wipeout Pure, but the rest of the header seems to match the AT3 files that go along with saved games and whatnot. I tried patching the codec type to 0xFEFF (atrac3plus, same as the AT3 files) and then copying it over one of the SND0.AT3 files from a saved game, but it didn't work.
CKemu
Posts: 1
Joined: Mon May 09, 2005 7:42 am

Post by CKemu »

They may have the 'RIFF WAVEfmt' header, but the actual header info is completely weird.

Bits per sample is 0, so it won't render, and it has 34 bytes extra after the header.

Normally fffe means it is uncompressed, just has more than 2 channels or more than 16bits per sample, but in this case this means something else. - or thats what I am led to understand.

On a side note 'all' the 383KB files (146 in total) are *.TGA and can be openned in photoshop or any other 'art' application, some really nice images in that lot to :D

Image
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

This thread is slowing turning into game hacking rather than homebrew code development...

Please steer back on topic.
GoatSucker
Posts: 6
Joined: Sun May 08, 2005 1:49 am

Post by GoatSucker »

Ok - trying to steer this back, I've noticed that some of the files in the data.wad file are ELF binaries.
This leads to a couple of things that could help homebrew:

1. If a way can be found to patch .wad files from the memory stick (and this is certainly possible to an extent with the already available download - albeit in an encrypted form) then maybe the ELF files could be patched to run homebrew code instead. That is assuming that the ELF files in the data.wad are actually used, and not there by mistake.

2. The ELF files appear to be very similar to the .prx files, except they are unencrypted. There are lots of plaintext comments about MPEG, HTTP and crypto stuff. There loads of crypto stuff referenced in 197.dc55e1dd.elf, produced by the code below.

Anyway, hope this might be useful to someone. I've attached the latest code below. Note that the sysp, vex and sblk files are just attempts to name the files based on the contents - the contents are still unknown.


Code: Select all

// wpdump.cpp
//

#include "stdafx.h"
#include <stdlib.h>
#include <string.h>

struct fileInfo
	&#123;
	int name;
	int start;
	int length;
	int length2;
	&#125;;


int isFileType&#40;char* aBuffer, char* aID&#41;
	&#123;
	int length = strlen&#40;aID&#41;;
	int cnt = 0;
	for &#40;int i=0; i<length; i++&#41; &#123;
		if &#40;aBuffer&#91;i&#93; == aID&#91;i&#93;&#41; &#123;
			cnt++;
			&#125;
		&#125;
	if &#40;cnt == length&#41; &#123;
		return 1;
		&#125;
	return 0;
	&#125;


void DumpFile&#40;char* aFile&#41; &#123;
	printf&#40;"Dumping&#58;"&#41;;
	printf&#40;aFile&#41;;
	printf&#40;"\n"&#41;;

	FILE* f = fopen&#40;aFile, "r+b"&#41;;
	if &#40;f == NULL&#41; &#123;
		printf&#40;"Cannot open file\n"&#41;;
		return;
		&#125;

	int value;
	fread&#40;&value, 4, 1, f&#41;;
	printf&#40;"Version = %d\n", value&#41;;
	int files;
	fread&#40;&files, 4, 1, f&#41;;
	printf&#40;"Files = %d\n", files&#41;;

	fileInfo* fiArray = &#40;fileInfo*&#41;malloc&#40;files * sizeof fileInfo&#41;;

	fileInfo* fiPtr = fiArray;

	for &#40;int i=0; i<files; i++&#41;
		&#123;
		fread&#40;&&#40;fiPtr->name&#41;, 4, 1, f&#41;;
		fread&#40;&&#40;fiPtr->start&#41;, 4, 1, f&#41;;
		fread&#40;&&#40;fiPtr->length&#41;, 4, 1, f&#41;;
		fread&#40;&&#40;fiPtr->length2&#41;, 4, 1, f&#41;;
		fiPtr++;
		&#125;

	fiPtr = fiArray;

	for &#40;int j=0; j<files; j++&#41;
		&#123;
		printf&#40;"%03d / %03d  &#58; 0x%x  &#58;  Size&#58; %d  ", j+1, files, fiPtr->name, fiPtr->length&#41;;

		fseek&#40;f, fiPtr->start, SEEK_SET&#41;;
		char* buffer = &#40;char*&#41;malloc&#40;fiPtr->length&#41;;
		fread&#40;buffer, fiPtr->length, 1, f&#41;;

		char ext&#91;16&#93;;
		if &#40;isFileType&#40;buffer, "<?xml"&#41;&#41; &#123;
			strcpy&#40;ext, "xml"&#41;;
			&#125;
		else if &#40;isFileType&#40;buffer+2, "<?xml"&#41;&#41; &#123;
			strcpy&#40;ext, "xml"&#41;;
			&#125;
		else if &#40;isFileType&#40;buffer+fiPtr->length-18, "TRUEVISION"&#41;&#41; &#123;
			strcpy&#40;ext, "tga"&#41;;
			&#125;
		else if &#40;isFileType&#40;buffer, "PSMF"&#41;&#41; &#123;
			strcpy&#40;ext, "pmf"&#41;;
			&#125;
		else if &#40;isFileType&#40;buffer, "RIFF"&#41;&#41; &#123;
			strcpy&#40;ext, "ac3"&#41;;
			&#125;
		else if &#40;isFileType&#40;buffer, "SYSP"&#41;&#41; &#123;
			strcpy&#40;ext, "sysp"&#41;;
			&#125;
		else if &#40;isFileType&#40;buffer+1, "ELF"&#41;&#41; &#123;
			strcpy&#40;ext, "elf"&#41;;
			&#125;
		else if &#40;isFileType&#40;buffer+12, "VEXX"&#41;&#41; &#123;
			strcpy&#40;ext, "vex"&#41;;
			&#125;
		else if &#40;isFileType&#40;buffer+24, "SBlk"&#41;&#41; &#123;
			strcpy&#40;ext, "sblk"&#41;;
			&#125;
		else &#123;
			strcpy&#40;ext, "dat"&#41;;
			&#125;


		char name&#91;256&#93;;
		sprintf&#40;name,"%03d.%x.%s", j+1, fiPtr->name, ext&#41;;

		printf&#40;"Writing&#58;"&#41;;
		printf&#40;name&#41;;
		printf&#40;"\n"&#41;;


		FILE* out = fopen&#40;name, "w+b"&#41;;
		if &#40;out&#41;
			&#123;
			fwrite&#40;buffer, fiPtr->length, 1, out&#41;;
			fclose&#40;out&#41;;
			&#125;

		delete buffer;

		fiPtr++;
		&#125;

	delete fiArray;

	fclose&#40;f&#41;;
	&#125;

int main&#40;int argc, char* argv&#91;&#93;&#41;
&#123;
	printf&#40;"WPDUMP &#91;GoatSucker&#93;\n"&#41;;
	if &#40;argc != 2&#41; &#123;
		printf&#40;"No file specified\n"&#41;;
		return 0;
		&#125;
	DumpFile&#40;argv&#91;1&#93;&#41;;
	return 0;
&#125;
Herman
Posts: 13
Joined: Tue Apr 05, 2005 4:15 pm
Location: Montreal, Canada

Post by Herman »

The audio files seem to be AT3 (atrack3plus) files, not AC3.
annerajb
Posts: 40
Joined: Thu Mar 31, 2005 6:16 am

Post by annerajb »

sorry for that
GoatSucker
Posts: 6
Joined: Sun May 08, 2005 1:49 am

Post by GoatSucker »

Herman - Yes, I knew they were Atrac3 files. I thought the file extension for these was AC3, but I guess AT3 is correct. Doesn't matter, as they can't be used as is.
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

Just doing a simple `strings' on the ELF files show that they are the same modules found in the PRX directory.

My guess is that their wad building tool included their entire tree, and that the PRXs in the Data.wad are never touched. I'm a bit surprised that the source isn't in there too :P.
Vampire
Posts: 138
Joined: Tue Apr 12, 2005 8:16 am

Post by Vampire »

mrbrown wrote:Just doing a simple `strings' on the ELF files show that they are the same modules found in the PRX directory.
but there are two SceHttp_Library modules in Data.wad:
one is exactly the same as the libhttp_rfc.prx from the PRX directory
and the other is a diffrent, smaller one
urchin
Posts: 121
Joined: Thu Jun 02, 2005 5:41 pm

Post by urchin »

Probably of no help at all, but I attended a lecture at GDCE by the lead programmer of wipeout pure...

He said that the the downloads were encrypted and I also remember that the "vexx" file you mentioned is the file that contains the track data. He demonstrated designing a simple track in Maya, exporting it using their custom plugin and then running it on a PSP emulator on his laptop.
Post Reply