mirror of
https://github.com/aap/librw.git
synced 2025-12-20 17:39:49 +00:00
implemented ps2 uninstance
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <src/gtaplg.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace rw;
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
@@ -16,7 +17,8 @@ main(int argc, char *argv[])
|
||||
// rw::build = 0;
|
||||
|
||||
// rw::version = 0x32000;
|
||||
// rw::version = 0x33002;
|
||||
rw::version = 0x33002;
|
||||
rw::platform = PLATFORM_D3D8;
|
||||
// rw::version = 0x30200;
|
||||
|
||||
gta::attachPlugins();
|
||||
@@ -26,26 +28,46 @@ main(int argc, char *argv[])
|
||||
// rw::StreamFile in;
|
||||
// in.open(argv[1], "rb");
|
||||
|
||||
FILE *cf = fopen(argv[1], "rb");
|
||||
assert(cf != NULL);
|
||||
fseek(cf, 0, SEEK_END);
|
||||
rw::uint32 len = ftell(cf);
|
||||
fseek(cf, 0, SEEK_SET);
|
||||
rw::uint8 *data = new rw::uint8[len];
|
||||
fread(data, len, 1, cf);
|
||||
fclose(cf);
|
||||
rw::StreamMemory in;
|
||||
in.open(data, len);
|
||||
if(0){
|
||||
FILE *cf = fopen(argv[1], "rb");
|
||||
assert(cf != NULL);
|
||||
fseek(cf, 0, SEEK_END);
|
||||
rw::uint32 len = ftell(cf);
|
||||
fseek(cf, 0, SEEK_SET);
|
||||
rw::uint8 *data = new rw::uint8[len];
|
||||
fread(data, len, 1, cf);
|
||||
fclose(cf);
|
||||
rw::StreamMemory in;
|
||||
in.open(data, len);
|
||||
|
||||
rw::findChunk(&in, rw::ID_CLUMP, NULL, NULL);
|
||||
rw::debugFile = argv[1];
|
||||
c = rw::Clump::streamRead(&in);
|
||||
assert(c != NULL);
|
||||
|
||||
in.close();
|
||||
delete[] data;
|
||||
}else{
|
||||
rw::StreamFile in;
|
||||
if(in.open(argv[1], "rb") == NULL){
|
||||
printf("couldn't open file\n");
|
||||
return 1;
|
||||
}
|
||||
debugFile = argv[1];
|
||||
ChunkHeaderInfo header;
|
||||
readChunkHeaderInfo(&in, &header);
|
||||
if(header.type == ID_UVANIMDICT){
|
||||
UVAnimDictionary *dict = UVAnimDictionary::streamRead(&in);
|
||||
currentUVAnimDictionary = dict;
|
||||
readChunkHeaderInfo(&in, &header);
|
||||
}
|
||||
assert(header.type == ID_CLUMP);
|
||||
c = Clump::streamRead(&in);
|
||||
assert(c != NULL);
|
||||
}
|
||||
|
||||
rw::findChunk(&in, rw::ID_CLUMP, NULL, NULL);
|
||||
rw::debugFile = argv[1];
|
||||
c = rw::Clump::streamRead(&in);
|
||||
assert(c != NULL);
|
||||
|
||||
in.close();
|
||||
delete[] data;
|
||||
|
||||
rw::Image::setSearchPath("./;/home/aap/gamedata/ps2/gtavc/MODELS/gta3_archive/txd_extracted/");
|
||||
// rw::Image::setSearchPath("./;/home/aap/gamedata/ps2/gtavc/MODELS/gta3_archive/txd_extracted/");
|
||||
|
||||
/*
|
||||
// rw::Image *tga = rw::readTGA("b.tga");
|
||||
@@ -54,23 +76,39 @@ main(int argc, char *argv[])
|
||||
rw::writeTGA(tga, "out.tga");
|
||||
*/
|
||||
|
||||
for(int32 i = 0; i < c->numAtomics; i++){
|
||||
Geometry *g = c->atomicList[i]->geometry;
|
||||
for(int32 j = 0; j < g->numMaterials; j++)
|
||||
if(g->materialList[j]->texture)
|
||||
g->materialList[j]->texture->filterAddressing =
|
||||
(g->materialList[j]->texture->filterAddressing&~0xF) | 2;
|
||||
}
|
||||
|
||||
// for(rw::int32 i = 0; i < c->numAtomics; i++)
|
||||
// rw::Gl::Instance(c->atomicList[i]);
|
||||
|
||||
// ofstream out(argv[2], ios::binary);
|
||||
// rw::StreamFile out;
|
||||
// out.open(argv[2], "wb");
|
||||
data = new rw::uint8[1024*1024];
|
||||
rw::StreamMemory out;
|
||||
out.open(data, 0, 1024*1024);
|
||||
c->streamWrite(&out);
|
||||
if(0){
|
||||
uint8 *data = new rw::uint8[1024*1024];
|
||||
rw::StreamMemory out;
|
||||
out.open(data, 0, 1024*1024);
|
||||
|
||||
cf = fopen(argv[2], "wb");
|
||||
assert(cf != NULL);
|
||||
fwrite(data, out.getLength(), 1, cf);
|
||||
fclose(cf);
|
||||
out.close();
|
||||
delete[] data;
|
||||
c->streamWrite(&out);
|
||||
|
||||
FILE *cf = fopen(argv[2], "wb");
|
||||
assert(cf != NULL);
|
||||
fwrite(data, out.getLength(), 1, cf);
|
||||
fclose(cf);
|
||||
out.close();
|
||||
delete[] data;
|
||||
}else{
|
||||
rw::StreamFile out;
|
||||
if(argc > 2)
|
||||
out.open(argv[2], "wb");
|
||||
else
|
||||
out.open("out.dff", "wb");
|
||||
c->streamWrite(&out);
|
||||
out.close();
|
||||
}
|
||||
|
||||
delete c;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user