XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Sun Nov 18, 2018 2:58 am

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Tatsunoko vs Capcom (Wii)
PostPosted: Tue Jun 09, 2009 3:23 pm 
Offline
VVIP member
VVIP member
User avatar

Joined: Thu Dec 08, 2005 12:26 pm
Posts: 1925
Location: www.ZENHAX.com
Has thanked: 4 times
Have thanks: 644 times














You can make the ads go away by registering

N=10? so basically the data is almost uncompressed :)
other games other than s2?


Top
 Profile  
 
 Post subject: Re: Tatsunoko vs Capcom (Wii)
PostPosted: Tue Jun 09, 2009 3:31 pm 
Offline
Moderator

Joined: Wed Oct 18, 2006 9:48 pm
Posts: 651
Location: Germany
Has thanked: 19 times
Have thanks: 41 times
Oh I meant the number of bits used for encoding.

_________________
Image

Remember: If you don't want to program a tool yourself, hack another one :wink:
__________
http://www.gameformats.de.vu


Top
 Profile  
 
 Post subject: Re: Tatsunoko vs Capcom (Wii)
PostPosted: Tue Jun 09, 2009 3:34 pm 
Offline
VVIP member
VVIP member
User avatar

Joined: Thu Dec 08, 2005 12:26 pm
Posts: 1925
Location: www.ZENHAX.com
Has thanked: 4 times
Have thanks: 644 times
another interesting thing I noticed some months ago about LZSS.
the following is the latest source of Okumura
http://oku.edu.mie-u.ac.jp/~okumura/compression/lzss.c
but even if you change the EI, EJ and P parameter to make them compatible with the classical algorithm it's not compatible at all.


Top
 Profile  
 
 Post subject: Re: Tatsunoko vs Capcom (Wii)
PostPosted: Tue Jun 09, 2009 3:40 pm 
Offline
Moderator

Joined: Wed Oct 18, 2006 9:48 pm
Posts: 651
Location: Germany
Has thanked: 19 times
Have thanks: 41 times
Oh yeah I forgot that one.
There the bit is saved immediately followed by the data. This is the original LZSS.
Grouping 8 (16) bits together to ease reading and writing is more common though.

_________________
Image

Remember: If you don't want to program a tool yourself, hack another one :wink:
__________
http://www.gameformats.de.vu


Top
 Profile  
 
 Post subject: Re: Tatsunoko vs Capcom (Wii)
PostPosted: Tue Jun 09, 2009 3:54 pm 
Offline
VVIP member
VVIP member
User avatar

Joined: Thu Dec 08, 2005 12:26 pm
Posts: 1925
Location: www.ZENHAX.com
Has thanked: 4 times
Have thanks: 644 times
uhmm maybe I'm wrong but I think that the lzss.c version with N, F and THRESHOLD (like http://dev.gameres.com/Program/Other/LZSS.C) is the oldest one, or at least is the most used.


Top
 Profile  
 
 Post subject: Re: Tatsunoko vs Capcom (Wii)
PostPosted: Tue Jun 09, 2009 4:01 pm 
Offline
Moderator

Joined: Wed Oct 18, 2006 9:48 pm
Posts: 651
Location: Germany
Has thanked: 19 times
Have thanks: 41 times
I was refering to the paper ("Data compression via textual substitution")

_________________
Image

Remember: If you don't want to program a tool yourself, hack another one :wink:
__________
http://www.gameformats.de.vu


Top
 Profile  
 
 Post subject: Re: Tatsunoko vs Capcom (Wii)
PostPosted: Wed Jun 10, 2009 2:08 am 
Offline
Moderator
User avatar

Joined: Sun May 18, 2008 3:01 pm
Posts: 2501
Has thanked: 57 times
Have thanks: 1246 times
There is an ida Pro 5.2 plugin to load the game executable for this game would this make it possible to see the compression used in this game if I upload the main exe and the plugin?


Top
 Profile  
 
 Post subject: Re: Tatsunoko vs Capcom (Wii)
PostPosted: Thu Jul 09, 2009 9:26 am 
Offline
beginner

Joined: Thu Jul 09, 2009 7:42 am
Posts: 25
Has thanked: 0 time
Have thanks: 10 times
The .fpk file use PRS compress method(a little change). This is the fpk tool:

Code:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <dirent.h>


typedef unsigned int   u32;
typedef unsigned short u16;
typedef unsigned char  u8;


int endian=1;

u32 BE32(u32 data)
{
   if(endian)
      return ( (data<<24) | ((data<<8)&0x00ff0000) |
            ((data>>8)&0x0000ff00) | (data>>24) );
   else
      return data;
}

int blen;
int fbuf;

/* PRS get bit form lsb to msb, FPK get it form msb to lsb */
int get_bits(int n, char *sbuf, int *sptr)
{
   int retv;

   retv = 0;
   while(n){
      retv <<= 1;
      if(blen==0){
         fbuf = sbuf[*sptr];
         //if(*sptr<256)
            //{ printf("[%02x] ", fbuf&0xff); fflush(0); }
         (*sptr)++;
         blen = 8;
      }

      if(fbuf&0x80)
         retv |= 1;

      fbuf <<= 1;
      blen --;
      n --;
   }

   return retv;
}

int uncomp(char *dbuf, int dlen, char *sbuf, int slen)
{
   int sptr;
   int dptr;
   int i, flag, len, pos;

   blen = 0;

   sptr = 0;
   dptr = 0;
   while(sptr<slen){
      flag = get_bits(1, sbuf, &sptr);
      if(flag==1){
         //if(sptr<256)
            //{ printf("%02x ", (u8)sbuf[sptr]); fflush(0); }
         if(dptr<dlen)
            dbuf[dptr++] = sbuf[sptr++];
      }else{
         flag = get_bits(1, sbuf, &sptr);
         if(flag==0){
            len = get_bits(2, sbuf, &sptr)+2;
            pos = sbuf[sptr++]|0xffffff00;
         }else{
            pos = (sbuf[sptr++]<<8)|0xffff0000;
            pos |= sbuf[sptr++]&0xff;
            len = pos&0x07;
            pos >>= 3;
            if(len==0){
               len = (sbuf[sptr++]&0xff)+1;
            }else{
               len += 2;
            }
         }
         //if(sptr<256)
            //{ printf("<%08x(%08x): %08x %d> \n", dptr, dlen, pos, len); fflush(0); }
         pos += dptr;
         for(i=0; i<len; i++){
            if(dptr<dlen)
               dbuf[dptr++] = dbuf[pos++];
         }
      }
   }

   return dptr;
}


void mkdir_p(char *dname)
{
   char name[256];
   char *p, *cp;

   strcpy(name, dname);

   cp = name;
   while(1){
      p = strchr(cp, '/');
      if(p==NULL)
         p = strchr(cp, '\\');
      if(p==NULL)
         break;

      *p = 0;
      //mkdir(name, 0777);
      mkdir(name);
      *p = '/';
      cp = p+1;
   };
}

int process_file(char *infname)
{
   FILE *fp, *outfp;
   char *fname, *dptr, *buf, *dbuf;
   int i, fcnt, flen, dlen, offset;
   char dname[256], tname[256], *p;

   p = strchr(infname, '.');
   if(p==NULL)
      return -1;
   if(strcmp(p+1, "fpk"))
      return -1;

   printf("process file %s ...\n", infname);

   /* Open fpk file */
   fp = fopen(infname, "rb");
   if(fp==NULL){
      printf("Can't open %s!\n", infname);
      return -1;
   }

   /* Make directory */
   strcpy(dname, infname);
   p = strchr(dname, '.');
   if(p)
      *p = '_';
   //mkdir(dname, 0777);
   mkdir(dname);

   fseek(fp, 0, SEEK_END);
   flen = ftell(fp);
   fseek(fp, 0, SEEK_SET);

   buf = (char*)malloc(flen);
   fread(buf, flen, 1, fp);
   fclose(fp);

   if(*(short*)(buf+0)==0){
      endian = 1;
   }else{
      endian = 0;
   }

   fcnt = BE32(*(int*)(buf+4));
   for(i=0; i<fcnt; i++){
      dptr = buf+0x10+i*0x30;
      fname = dptr;
      flen = BE32(*(int*)(dptr+0x28));
      offset = BE32(*(int*)(dptr+0x24));
      dlen = BE32(*(int*)(dptr+0x2c));
      printf("offset: %08x flen: %08x length: %08x file: %s\n", offset, flen, dlen, fname);

      dbuf = malloc(dlen+256);
      uncomp(dbuf, dlen, buf+offset, flen);


      sprintf(tname, "%s/%s", dname, fname);
      mkdir_p(tname);

      outfp = fopen(tname, "wb");
      if(outfp==NULL){
         printf("Can't open output file %s !\n", tname);
      }else{
         fwrite(dbuf, dlen, 1, outfp);
         fclose(outfp);
      }
      free(dbuf);
   }

   free(buf);
   return 0;
}

////////////////////////////////////////////////////////////////////////////

int process_dir(char *dname)
{
   DIR *pdir;
   struct dirent *d;
   struct stat statbuf;
   char fname[256];
   int i, ndir;

   /* process file */
   memset(&statbuf, 0, sizeof(statbuf));
   stat(dname, &statbuf);
   if((statbuf.st_mode&S_IFMT) != S_IFDIR){
      return process_file(dname);
   }

   /* open directory */
   pdir = opendir(dname);
   if(pdir==NULL){
      printf("Can't open directory <%s>\n", dname);
      return -1;
   }

   /* get number of files in dircetory */
   ndir = 0;
   while((d=readdir(pdir))){
      ndir++;
   }
   d = malloc(sizeof(struct dirent)*ndir);

   /* read dirent first */
   rewinddir(pdir);
   for(i=0; i<ndir; i++){
      memcpy(&d[i], readdir(pdir), sizeof(struct dirent));
   }

   /* process each files */
   printf("Enter directory <%s> ...\n", dname);
   for(i=0; i<ndir; i++){
      if( d[i].d_name[0]=='.' &&( d[i].d_name[1] =='\0' || (d[i].d_name[1] == '.' && d[i].d_name[2] == '\0') ))
         continue;

      if(dname[0]=='.'){
         sprintf(fname, "%s", d[i].d_name);
      }else{
         sprintf(fname, "%s/%s", dname, d[i].d_name);
      }
      process_dir(fname);
   }
   printf("Leave directory <%s> ...\n", dname);

   free(d);
   closedir(pdir);
   return 0;
}

int main(int argc, char *argv[])
{
   if(argc==1){
      return process_dir(".");
   }else{
      return process_dir(argv[1]);
   }
}


Top
 Profile  
 
 Post subject: Re: Tatsunoko vs Capcom (Wii)
PostPosted: Thu Jul 09, 2009 11:02 am 
Offline
Moderator
User avatar

Joined: Sun May 18, 2008 3:01 pm
Posts: 2501
Has thanked: 57 times
Have thanks: 1246 times
THANK YOU SO MUCH :)
here is a compiled exe for everyone.


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.



Top
 Profile  
 
 Post subject: Re: Tatsunoko vs Capcom (Wii)
PostPosted: Thu Jul 09, 2009 1:33 pm 
Offline
Site Admin
User avatar

Joined: Wed Jan 15, 2003 6:45 pm
Posts: 4025
Location: Dungeons of Doom
Has thanked: 417 times
Have thanks: 564 times
Don't you just love this forum ? :D Another mystery solved. 8) Thanks all!


Top
 Profile  
 
 Post subject: Re: Tatsunoko vs Capcom (Wii)
PostPosted: Thu Jul 16, 2009 1:18 am 
Offline
Moderator
User avatar

Joined: Sun May 18, 2008 3:01 pm
Posts: 2501
Has thanked: 57 times
Have thanks: 1246 times
I found this crashing on some archives for some reason I was wondering if someone could help with this problem. Here are some archives it crashes on.
also is it possible for the program to offer an option to skip a file if it has trouble instead of closing down?
http://www.MegaShare.com/1257504
Thanks in advance to anyone who can help :)


Top
 Profile  
 
 Post subject: Re: Tatsunoko vs Capcom (Wii)
PostPosted: Fri Sep 11, 2009 6:44 pm 
Offline
veteran

Joined: Wed Sep 02, 2009 1:52 pm
Posts: 86
Has thanked: 30 times
Have thanks: 1 time
Same here, also crashes on MHG 0000.fpk :scaredy:


Top
 Profile  
 
 Post subject: Re: Tatsunoko vs Capcom (Wii)
PostPosted: Wed Jan 06, 2010 11:58 am 
Offline
beginner

Joined: Fri Sep 28, 2007 11:52 pm
Posts: 25
Has thanked: 7 times
Have thanks: 1 time
Sorry for the bump but I am wondering if someone can repost the compressed and uncompressed files of TvC again since the old links expired...

Thanks


Top
 Profile  
 
 Post subject: Re: Tatsunoko vs Capcom (Wii)
PostPosted: Wed Apr 20, 2011 2:52 pm 
Offline
ultra-n00b

Joined: Fri Jun 04, 2010 2:04 am
Posts: 3
Has thanked: 0 time
Have thanks: 0 time
Late bump. How would I compile the compressor to exe (or, does anyone have the original exe)?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 4 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group