void doInterface()
{
FILE *fp = fopen( "interface.axp", "rb" );
if( fp == NULL )
return;
int nCount = 0;
fseek( fp, 0, SEEK_END );
int nSize = ftell( fp );
fseek( fp, 0x012ee230, 0 );
int msize = nSize - 0x012ee230;
char *pData = new char[msize];
fread( pData, 1, msize, fp );
std::string mfile = pData;
int star = 1;
int off = mfile.find("\n",star);
std::string temp = mfile.substr(star,off-star);
int mfnum = atoi(temp.c_str());
fileinfo *mfulelist = new fileinfo[mfnum];
mkdir("Interface");
FILE *fout = fopen("Interface\\Interface.txt","wb");
for(int i=0; i<mfnum;i++)
{
star = off+1;
off = mfile.find("\n",star);
temp = mfile.substr(star,off-star);
int off1 = temp.find("|",0);
int off2 = temp.find("|",off1+1);
mfulelist.name = temp.substr(0,off1);
std::string fsize = temp.substr(off1+1,off2-off1-1);
mfulelist.size = ((((((
do16bit(fsize[0])*16+
do16bit(fsize[1]))*16+
do16bit(fsize[2]))*16+
do16bit(fsize[3]))*16+
do16bit(fsize[4]))*16+
do16bit(fsize[5]))*16+
do16bit(fsize[6]))*16+
do16bit(fsize[7]);
if(i==0)
{
mfulelist.off = 0x00160028;
}
else
{
mfulelist.off = mfulelist[i-1].off + mfulelist[i-1].size;
while(1)
{
if(mfulelist.off%8 == 0)
{
fseek( fp,mfulelist.off , 0 );
fread( pData, 1, 8, fp );
if(!(pData[0] == '\0'&&pData[1] == '\0'&&pData[2] == '\0'&&pData[3] == '\0'
&&pData[4] == '\0'&&pData[5] == '\0'&&pData[6] == '\0'&&pData[7] == '\0'))
{
break;
}
}
++mfulelist.off;
}
}
char *nfilestr = new char[256];
sprintf(nfilestr,"%d\t%s\t%d\n",i,temp.c_str(),mfulelist.off);
std::string mfilestr = nfilestr;
fwrite((void*)mfilestr.c_str(),1,mfilestr.size(),fout);
}
fclose(fout);
for(int i=0; i<mfnum;i++)
{
fseek( fp, mfulelist.off, 0 );
char *filedata = new char[mfulelist.size];
fread( filedata, 1, mfulelist.size, fp );
if(i == 654)
{
}
int mbdir = 0;
while(1)
{
mbdir = mfulelist.name.find("/",mbdir+1);
if(mbdir>0)
{
std::string mdir = mfulelist.name.substr(0,mbdir);
mkdir((std::string("Interface\\")+mdir).c_str());
}
else
{
break;
}
}
FILE *fout = fopen((std::string("Interface\\")+mfulelist.name).c_str(),"wb");
fwrite((const void*)filedata,1,mfulelist.size,fout);
fclose(fout);
}
fclose(fp);
}
void doSound()
{
FILE *fp = fopen( "sound.axp", "rb" );
if( fp == NULL )
return;
int nCount = 0;
fseek( fp, 0, SEEK_END );
int nSize = ftell( fp );
fseek( fp, 0x07ce2930, 0 );
int msize = nSize - 0x07ce2930;
char *pData = new char[msize];
fread( pData, 1, msize, fp );
std::string mfile = pData;
int star = 1;
int off = mfile.find("\n",star);
std::string temp = mfile.substr(star,off-star);
int mfnum = atoi(temp.c_str());
fileinfo *mfulelist = new fileinfo[mfnum];
mkdir("Sound");
FILE *fout = fopen("Sound\\Sound.txt","wb");
for(int i=0; i<mfnum;i++)
{
star = off+1;
off = mfile.find("\n",star);
temp = mfile.substr(star,off-star);
int off1 = temp.find("|",0);
int off2 = temp.find("|",off1+1);
mfulelist.name = temp.substr(0,off1);
std::string fsize = temp.substr(off1+1,off2-off1-1);
mfulelist.size = ((((((
do16bit(fsize[0])*16+
do16bit(fsize[1]))*16+
do16bit(fsize[2]))*16+
do16bit(fsize[3]))*16+
do16bit(fsize[4]))*16+
do16bit(fsize[5]))*16+
do16bit(fsize[6]))*16+
do16bit(fsize[7]);
if(i==0)
{
mfulelist.off = 0x00160028;
}
else
{
mfulelist.off = mfulelist[i-1].off + mfulelist[i-1].size;
while(1)
{
if(mfulelist.off%8 == 0)
{
fseek( fp,mfulelist.off , 0 );
fread( pData, 1, 8, fp );
if(!(pData[0] == '\0'&&pData[1] == '\0'&&pData[2] == '\0'&&pData[3] == '\0'
&&pData[4] == '\0'&&pData[5] == '\0'&&pData[6] == '\0'&&pData[7] == '\0'))
{
break;
}
}
++mfulelist.off;
}
}
char *nfilestr = new char[256];
sprintf(nfilestr,"%d\t%s\t%d\n",i,temp.c_str(),mfulelist.off);
std::string mfilestr = nfilestr;
fwrite((void*)mfilestr.c_str(),1,mfilestr.size(),fout);
}
fclose(fout);
for(int i=0; i<mfnum;i++)
{
fseek( fp, mfulelist.off, 0 );
char *filedata = new char[mfulelist.size];
fread( filedata, 1, mfulelist.size, fp );
if(i == 654)
{
}
int mbdir = 0;
while(1)
{
mbdir = mfulelist.name.find("/",mbdir+1);
if(mbdir>0)
{
std::string mdir = mfulelist.name.substr(0,mbdir);
mkdir((std::string("Sound\\")+mdir).c_str());
}
else
{
break;
}
}
FILE *fout = fopen((std::string("Sound\\")+mfulelist.name).c_str(),"wb");
fwrite((const void*)filedata,1,mfulelist.size,fout);
fclose(fout);
}
fclose(fp);
}
void doScene()
{
FILE *fp = fopen( "scene.axp", "rb" );
if( fp == NULL )
{
return;
}
int nCount = 0;
fseek( fp, 0, SEEK_END );
int nSize = ftell( fp );
fseek( fp, 0x159b8b30, 0 );
int msize = nSize - 0x159b8b30;
char *pData = new char[msize];
fread( pData, 1, msize, fp );
std::string mfile = pData;
int star = 1;
int off = mfile.find("\n",star);
std::string temp = mfile.substr(star,off-star);
int mfnum = atoi(temp.c_str());
fileinfo *mfulelist = new fileinfo[mfnum];
mkdir("Scene");
FILE *fout = fopen("Scene\\Scene.txt","wb");
for(int i=0; i<mfnum;i++)
{
star = off+1;
off = mfile.find("\n",star);
temp = mfile.substr(star,off-star);
int off1 = temp.find("|",0);
int off2 = temp.find("|",off1+1);
mfulelist.name = temp.substr(0,off1);
std::string fsize = temp.substr(off1+1,off2-off1-1);
mfulelist.size = ((((((
do16bit(fsize[0])*16+
do16bit(fsize[1]))*16+
do16bit(fsize[2]))*16+
do16bit(fsize[3]))*16+
do16bit(fsize[4]))*16+
do16bit(fsize[5]))*16+
do16bit(fsize[6]))*16+
do16bit(fsize[7]);
if(i==0)
{
mfulelist.off = 0x00160028;
}
else
{
mfulelist.off = mfulelist[i-1].off + mfulelist[i-1].size;
while(1)
{
if(mfulelist.off%8 == 0)
{
fseek( fp,mfulelist.off , 0 );
fread( pData, 1, 8, fp );
if(!(pData[0] == '\0'&&pData[1] == '\0'&&pData[2] == '\0'&&pData[3] == '\0'
&&pData[4] == '\0'&&pData[5] == '\0'&&pData[6] == '\0'&&pData[7] == '\0'))
{
break;
}
}
++mfulelist.off;
}
}
char *nfilestr = new char[256];
sprintf(nfilestr,"%d\t%s\t%d\n",i,temp.c_str(),mfulelist.off);
std::string mfilestr = nfilestr;
fwrite((void*)mfilestr.c_str(),1,mfilestr.size(),fout);
}
fclose(fout);
for(int i=0; i<mfnum;i++)
{
fseek( fp, mfulelist.off, 0 );
char *filedata = new char[mfulelist.size];
fread( filedata, 1, mfulelist.size, fp );
if(i == 654)
{
}
int mbdir = 0;
while(1)
{
mbdir = mfulelist.name.find("/",mbdir+1);
if(mbdir>0)
{
std::string mdir = mfulelist.name.substr(0,mbdir);
mkdir((std::string("Scene\\")+mdir).c_str());
}
else
{
break;
}
}
FILE *fout = fopen((std::string("Scene\\")+mfulelist.name).c_str(),"wb");
fwrite((const void*)filedata,1,mfulelist.size,fout);
fclose(fout);
}
fclose(fp);
}
int main()
{
domaterial();
domodel();
doBrushes();
doEffect();
doInterface();
doSound();
doScene();
}