forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

WipeOut Pure wad dump

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
GoatSucker



Joined: 08 May 2005
Posts: 6

PostPosted: Sun May 08, 2005 3:17 am    Post subject: WipeOut Pure wad dump Reply with quote

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
Back to top
View user's profile Send private message
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Sun May 08, 2005 3:47 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Visit poster's website
GoatSucker



Joined: 08 May 2005
Posts: 6

PostPosted: Sun May 08, 2005 6:46 am    Post subject: Reply with quote

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:

// wpdump.cpp
//

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

struct fileInfo
   {
   int name;
   int start;
   int length;
   int length2;
   };


void DumpFile(char* aFile) {
   printf("Dumping:");
   printf(aFile);
   printf("\n");

   FILE* f = fopen(aFile, "r+b");
   if (f == NULL) {
      printf("Cannot open file\n");
      return;
      }

   int value;
   fread(&value, 4, 1, f);
   printf("Version = %d\n", value);
   int files;
   fread(&files, 4, 1, f);
   printf("Files = %d\n", files);

   fileInfo* fiArray = (fileInfo*)malloc(files * sizeof fileInfo);

   fileInfo* fiPtr = fiArray;

   for (int i=0; i<files; i++)
      {
      fread(&(fiPtr->name), 4, 1, f);
      fread(&(fiPtr->start), 4, 1, f);
      fread(&(fiPtr->length), 4, 1, f);
      fread(&(fiPtr->length2), 4, 1, f);
      fiPtr++;
      }

   fiPtr = fiArray;

   for (int j=0; j<files; j++)
      {
      printf("%03d / %03d  : 0x%x  :  Size: %d  ", j+1, files, fiPtr->name, fiPtr->length);

      fseek(f, fiPtr->start, SEEK_SET);
      char* buffer = (char*)malloc(fiPtr->length);
      fread(buffer, fiPtr->length, 1, f);
      int isXml = 0;
      if (fiPtr->length > 5)
         {
         if (buffer[0] == '<' && buffer[1] == '?' && buffer[2] == 'x' && buffer[3] == 'm' && buffer[4] == 'l')
            {
            isXml = 1;
            }
         }

      char name[256];
      if (isXml) {
         sprintf(name,"%03d.%x.xml", j+1, fiPtr->name);
         }
      else {
         sprintf(name,"%03d.%x.dat", j+1, fiPtr->name);
         }
      printf("Writing:");
      printf(name);
      printf("\n");


      FILE* out = fopen(name, "w+b");
      if (out)
         {
         fwrite(buffer, fiPtr->length, 1, out);
         fclose(out);
         }

      delete buffer;

      fiPtr++;
      }

   delete fiArray;

   fclose(f);
   }

int main(int argc, char* argv[])
{
   printf("WPDUMP [GoatSucker]\n");
   if (argc != 2) {
      printf("No file specified\n");
      return 0;
      }
   DumpFile(argv[1]);
   return 0;
}

Back to top
View user's profile Send private message
annerajb



Joined: 31 Mar 2005
Posts: 40

PostPosted: Sun May 08, 2005 10:25 am    Post subject: Reply with quote

wad files can be extracted using dragon unpacker. google it
Back to top
View user's profile Send private message MSN Messenger
Herman



Joined: 05 Apr 2005
Posts: 13
Location: Montreal, Canada

PostPosted: Sun May 08, 2005 12:16 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
ale275



Joined: 28 Dec 2004
Posts: 10

PostPosted: Sun May 08, 2005 6:14 pm    Post subject: Reply with quote

anyone tried to (DO SOMETHING NAUGHTY) and see waht happens??
Back to top
View user's profile Send private message
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Sun May 08, 2005 6:18 pm    Post subject: Reply with quote

ale275: READ THE RULES!
Back to top
View user's profile Send private message Visit poster's website
annerajb



Joined: 31 Mar 2005
Posts: 40

PostPosted: Sun May 08, 2005 8:30 pm    Post subject: Reply with quote

use the hyper creator and click or file extensions inside the wad files appear png files and at3 files
Back to top
View user's profile Send private message MSN Messenger
ale275



Joined: 28 Dec 2004
Posts: 10

PostPosted: Sun May 08, 2005 8:42 pm    Post subject: Reply with quote

sorry ooPo :( i didn't wnat ot break rules :(
Back to top
View user's profile Send private message
kagaku



Joined: 09 May 2005
Posts: 2

PostPosted: Mon May 09, 2005 1:42 am    Post subject: Reply with quote

You mentioned that the music files are in AC3 format, any chance of a tool to extract them? :)
Back to top
View user's profile Send private message
GoatSucker



Joined: 08 May 2005
Posts: 6

PostPosted: Mon May 09, 2005 2:01 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
annerajb



Joined: 31 Mar 2005
Posts: 40

PostPosted: Mon May 09, 2005 3:13 am    Post subject: Reply with quote

dragon unpacker hypercreator does extract them
Back to top
View user's profile Send private message MSN Messenger
kagaku



Joined: 09 May 2005
Posts: 2

PostPosted: Mon May 09, 2005 6:42 am    Post subject: Reply with quote

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:
kagaku@tomiko psp $ make wpdump
g++     wpdump.cpp   -o wpdump
wpdump.cpp:4:20: stdafx.h: No such file or directory
wpdump.cpp: In function `void DumpFile(char*)':
wpdump.cpp:17: error: `printf' undeclared (first use this function)
wpdump.cpp:17: error: (Each undeclared identifier is reported only once for
   each function it appears in.)
wpdump.cpp:21: error: `FILE' undeclared (first use this function)
wpdump.cpp:21: error: `f' undeclared (first use this function)
wpdump.cpp:21: error: `fopen' undeclared (first use this function)
wpdump.cpp:28: error: `fread' undeclared (first use this function)
wpdump.cpp:34: error: parse error before `)' token
wpdump.cpp:53: error: `SEEK_SET' undeclared (first use this function)
wpdump.cpp:53: error: `fseek' undeclared (first use this function)
wpdump.cpp:67: error: `sprintf' undeclared (first use this function)
wpdump.cpp:77: error: `out' undeclared (first use this function)
wpdump.cpp:80: error: `fwrite' undeclared (first use this function)
wpdump.cpp:81: error: `fclose' undeclared (first use this function)
wpdump.cpp: In function `int main(int, char**)':
wpdump.cpp:96: error: `printf' undeclared (first use this function)
wpdump.cpp:103:2: warning: no newline at end of file
make: *** [wpdump] Error 1
kagaku@tomiko psp $
Back to top
View user's profile Send private message
imk



Joined: 16 Apr 2005
Posts: 8

PostPosted: Mon May 09, 2005 8:42 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Orion_



Joined: 27 Jan 2005
Posts: 69

PostPosted: Mon May 09, 2005 8:49 am    Post subject: Reply with quote

stdafx is a windows header
replace stdafx with stdio for FILE things
Back to top
View user's profile Send private message
allthatinny



Joined: 06 May 2005
Posts: 24

PostPosted: Mon May 09, 2005 8:56 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
GoatSucker



Joined: 08 May 2005
Posts: 6

PostPosted: Mon May 09, 2005 9:42 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
pixel



Joined: 30 Jan 2004
Posts: 791

PostPosted: Mon May 09, 2005 10:17 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
ale275



Joined: 28 Dec 2004
Posts: 10

PostPosted: Tue May 10, 2005 12:11 am    Post subject: Reply with quote

if is needed i can attach wad_dump.exe complied by me under windows
Back to top
View user's profile Send private message
Awhite



Joined: 23 Feb 2005
Posts: 55

PostPosted: Tue May 10, 2005 1:31 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Herman



Joined: 05 Apr 2005
Posts: 13
Location: Montreal, Canada

PostPosted: Tue May 10, 2005 1:37 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
CKemu



Joined: 09 May 2005
Posts: 1

PostPosted: Tue May 10, 2005 1:42 am    Post subject: Reply with quote

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

Back to top
View user's profile Send private message
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Tue May 10, 2005 1:59 am    Post subject: Reply with quote

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

Please steer back on topic.
Back to top
View user's profile Send private message Visit poster's website
GoatSucker



Joined: 08 May 2005
Posts: 6

PostPosted: Tue May 10, 2005 5:10 am    Post subject: Reply with quote

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:
// wpdump.cpp
//

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

struct fileInfo
   {
   int name;
   int start;
   int length;
   int length2;
   };


int isFileType(char* aBuffer, char* aID)
   {
   int length = strlen(aID);
   int cnt = 0;
   for (int i=0; i<length; i++) {
      if (aBuffer[i] == aID[i]) {
         cnt++;
         }
      }
   if (cnt == length) {
      return 1;
      }
   return 0;
   }


void DumpFile(char* aFile) {
   printf("Dumping:");
   printf(aFile);
   printf("\n");

   FILE* f = fopen(aFile, "r+b");
   if (f == NULL) {
      printf("Cannot open file\n");
      return;
      }

   int value;
   fread(&value, 4, 1, f);
   printf("Version = %d\n", value);
   int files;
   fread(&files, 4, 1, f);
   printf("Files = %d\n", files);

   fileInfo* fiArray = (fileInfo*)malloc(files * sizeof fileInfo);

   fileInfo* fiPtr = fiArray;

   for (int i=0; i<files; i++)
      {
      fread(&(fiPtr->name), 4, 1, f);
      fread(&(fiPtr->start), 4, 1, f);
      fread(&(fiPtr->length), 4, 1, f);
      fread(&(fiPtr->length2), 4, 1, f);
      fiPtr++;
      }

   fiPtr = fiArray;

   for (int j=0; j<files; j++)
      {
      printf("%03d / %03d  : 0x%x  :  Size: %d  ", j+1, files, fiPtr->name, fiPtr->length);

      fseek(f, fiPtr->start, SEEK_SET);
      char* buffer = (char*)malloc(fiPtr->length);
      fread(buffer, fiPtr->length, 1, f);

      char ext[16];
      if (isFileType(buffer, "<?xml")) {
         strcpy(ext, "xml");
         }
      else if (isFileType(buffer+2, "<?xml")) {
         strcpy(ext, "xml");
         }
      else if (isFileType(buffer+fiPtr->length-18, "TRUEVISION")) {
         strcpy(ext, "tga");
         }
      else if (isFileType(buffer, "PSMF")) {
         strcpy(ext, "pmf");
         }
      else if (isFileType(buffer, "RIFF")) {
         strcpy(ext, "ac3");
         }
      else if (isFileType(buffer, "SYSP")) {
         strcpy(ext, "sysp");
         }
      else if (isFileType(buffer+1, "ELF")) {
         strcpy(ext, "elf");
         }
      else if (isFileType(buffer+12, "VEXX")) {
         strcpy(ext, "vex");
         }
      else if (isFileType(buffer+24, "SBlk")) {
         strcpy(ext, "sblk");
         }
      else {
         strcpy(ext, "dat");
         }


      char name[256];
      sprintf(name,"%03d.%x.%s", j+1, fiPtr->name, ext);

      printf("Writing:");
      printf(name);
      printf("\n");


      FILE* out = fopen(name, "w+b");
      if (out)
         {
         fwrite(buffer, fiPtr->length, 1, out);
         fclose(out);
         }

      delete buffer;

      fiPtr++;
      }

   delete fiArray;

   fclose(f);
   }

int main(int argc, char* argv[])
{
   printf("WPDUMP [GoatSucker]\n");
   if (argc != 2) {
      printf("No file specified\n");
      return 0;
      }
   DumpFile(argv[1]);
   return 0;
}
Back to top
View user's profile Send private message
Herman



Joined: 05 Apr 2005
Posts: 13
Location: Montreal, Canada

PostPosted: Tue May 10, 2005 5:41 am    Post subject: Reply with quote

The audio files seem to be AT3 (atrack3plus) files, not AC3.
Back to top
View user's profile Send private message
annerajb



Joined: 31 Mar 2005
Posts: 40

PostPosted: Tue May 10, 2005 6:52 am    Post subject: Reply with quote

sorry for that
Back to top
View user's profile Send private message MSN Messenger
GoatSucker



Joined: 08 May 2005
Posts: 6

PostPosted: Tue May 10, 2005 7:41 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Tue May 24, 2005 4:50 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Vampire



Joined: 12 Apr 2005
Posts: 138

PostPosted: Tue May 24, 2005 7:23 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
urchin



Joined: 02 Jun 2005
Posts: 121

PostPosted: Thu Sep 08, 2005 11:29 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group