READ THE RULES: Click here

Follow us on Facebook: https://www.facebook.com/xentax/ :)

Tatsunoko vs Capcom (Wii)

The Original Forum. Game archives, full of resources. How to open them? Get help here.
User avatar
aluigi
VVIP member
VVIP member
Posts: 1917
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 644 times
Contact:

Re: Tatsunoko vs Capcom (Wii)

Post by aluigi » Tue Jun 09, 2009 3:23 pm

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

Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 40 times
Contact:

Re: Tatsunoko vs Capcom (Wii)

Post by Rheini » Tue Jun 09, 2009 3:31 pm

Oh I meant the number of bits used for encoding.

User avatar
aluigi
VVIP member
VVIP member
Posts: 1917
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 644 times
Contact:

Re: Tatsunoko vs Capcom (Wii)

Post by aluigi » Tue Jun 09, 2009 3:34 pm

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.

Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 40 times
Contact:

Re: Tatsunoko vs Capcom (Wii)

Post by Rheini » Tue Jun 09, 2009 3:40 pm

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.

User avatar
aluigi
VVIP member
VVIP member
Posts: 1917
Joined: Thu Dec 08, 2005 12:26 pm
Location: www.ZENHAX.com
Has thanked: 4 times
Been thanked: 644 times
Contact:

Re: Tatsunoko vs Capcom (Wii)

Post by aluigi » Tue Jun 09, 2009 3:54 pm

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.

Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 40 times
Contact:

Re: Tatsunoko vs Capcom (Wii)

Post by Rheini » Tue Jun 09, 2009 4:01 pm

I was refering to the paper ("Data compression via textual substitution")

User avatar
chrrox
Moderator
Posts: 2552
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1286 times

Re: Tatsunoko vs Capcom (Wii)

Post by chrrox » Wed Jun 10, 2009 2:08 am

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?

tpu
beginner
Posts: 25
Joined: Thu Jul 09, 2009 7:42 am
Been thanked: 10 times

Re: Tatsunoko vs Capcom (Wii)

Post by tpu » Thu Jul 09, 2009 9:26 am

The .fpk file use PRS compress method(a little change). This is the fpk tool:

Code: Select all


#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]);
	}
}

User avatar
chrrox
Moderator
Posts: 2552
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1286 times

Re: Tatsunoko vs Capcom (Wii)

Post by chrrox » Thu Jul 09, 2009 11:02 am

THANK YOU SO MUCH :)
here is a compiled exe for everyone.
You do not have the required permissions to view the files attached to this post.

User avatar
Mr.Mouse
Site Admin
Posts: 4041
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 412 times
Been thanked: 561 times
Contact:

Re: Tatsunoko vs Capcom (Wii)

Post by Mr.Mouse » Thu Jul 09, 2009 1:33 pm

Don't you just love this forum ? :D Another mystery solved. 8) Thanks all!

User avatar
chrrox
Moderator
Posts: 2552
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1286 times

Re: Tatsunoko vs Capcom (Wii)

Post by chrrox » Thu Jul 16, 2009 1:18 am

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 :)

eycaramba
veteran
Posts: 86
Joined: Wed Sep 02, 2009 1:52 pm
Has thanked: 30 times
Been thanked: 1 time

Re: Tatsunoko vs Capcom (Wii)

Post by eycaramba » Fri Sep 11, 2009 6:44 pm

Same here, also crashes on MHG 0000.fpk :scaredy:

simple
beginner
Posts: 25
Joined: Fri Sep 28, 2007 11:52 pm
Has thanked: 7 times

Re: Tatsunoko vs Capcom (Wii)

Post by simple » Wed Jan 06, 2010 11:58 am

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

fconb2
ultra-n00b
Posts: 3
Joined: Fri Jun 04, 2010 2:04 am

Re: Tatsunoko vs Capcom (Wii)

Post by fconb2 » Wed Apr 20, 2011 2:52 pm

Late bump. How would I compile the compressor to exe (or, does anyone have the original exe)?

Post Reply