2014-12-18 16:26:57 +00:00
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <cstring>
|
2014-12-25 18:37:36 +00:00
|
|
|
#include <cassert>
|
2014-12-27 22:18:10 +00:00
|
|
|
#include <new>
|
2014-12-18 16:26:57 +00:00
|
|
|
|
|
|
|
#include "rw.h"
|
2015-01-06 22:17:05 +00:00
|
|
|
#include "src/gtaplg.h"
|
2014-12-18 16:26:57 +00:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
2015-01-25 21:27:03 +00:00
|
|
|
// rw::version = 0x31000;
|
|
|
|
// rw::build = 0;
|
|
|
|
|
|
|
|
// rw::version = 0x33002;
|
|
|
|
|
|
|
|
gta::registerEnvSpecPlugin();
|
|
|
|
rw::registerMatFXPlugin();
|
|
|
|
rw::registerMaterialRightsPlugin();
|
|
|
|
rw::registerAtomicRightsPlugin();
|
|
|
|
rw::registerHAnimPlugin();
|
|
|
|
gta::registerNodeNamePlugin();
|
2015-08-15 22:22:51 +01:00
|
|
|
// gta::registerBreakableModelPlugin();
|
2015-01-25 21:27:03 +00:00
|
|
|
gta::registerExtraVertColorPlugin();
|
|
|
|
rw::ps2::registerADCPlugin();
|
2015-08-01 22:03:10 +01:00
|
|
|
rw::ps2::registerPDSPlugin();
|
2015-01-25 21:27:03 +00:00
|
|
|
rw::registerSkinPlugin();
|
2015-08-15 22:22:51 +01:00
|
|
|
rw::xbox::registerVertexFormatPlugin();
|
2015-01-25 21:27:03 +00:00
|
|
|
rw::registerNativeDataPlugin();
|
|
|
|
// rw::ps2::registerNativeDataPlugin();
|
|
|
|
rw::registerMeshPlugin();
|
2015-08-03 17:30:10 +01:00
|
|
|
rw::Atomic::init();
|
2015-01-25 21:27:03 +00:00
|
|
|
|
|
|
|
rw::Clump *c;
|
2014-12-18 16:26:57 +00:00
|
|
|
|
2015-01-25 21:27:03 +00:00
|
|
|
// rw::StreamFile in;
|
2014-12-30 16:39:39 +00:00
|
|
|
// in.open(argv[1], "rb");
|
|
|
|
|
|
|
|
FILE *cf = fopen(argv[1], "rb");
|
|
|
|
assert(cf != NULL);
|
|
|
|
fseek(cf, 0, SEEK_END);
|
2015-01-25 21:27:03 +00:00
|
|
|
rw::uint32 len = ftell(cf);
|
2014-12-30 16:39:39 +00:00
|
|
|
fseek(cf, 0, SEEK_SET);
|
2015-01-25 21:27:03 +00:00
|
|
|
rw::uint8 *data = new rw::uint8[len];
|
2014-12-30 16:39:39 +00:00
|
|
|
fread(data, len, 1, cf);
|
|
|
|
fclose(cf);
|
2015-01-25 21:27:03 +00:00
|
|
|
rw::StreamMemory in;
|
2014-12-30 16:39:39 +00:00
|
|
|
in.open(data, len);
|
|
|
|
|
2015-01-25 21:27:03 +00:00
|
|
|
rw::findChunk(&in, rw::ID_CLUMP, NULL, NULL);
|
|
|
|
rw::debugFile = argv[1];
|
|
|
|
c = rw::Clump::streamRead(&in);
|
2014-12-25 18:37:36 +00:00
|
|
|
assert(c != NULL);
|
2014-12-30 16:39:39 +00:00
|
|
|
|
2014-12-18 16:26:57 +00:00
|
|
|
in.close();
|
2014-12-30 16:39:39 +00:00
|
|
|
delete[] data;
|
2014-12-18 16:26:57 +00:00
|
|
|
|
2015-01-25 21:27:03 +00:00
|
|
|
rw::Image::setSearchPath("./;/home/aap/gamedata/ps2/gtavc/MODELS/gta3_archive/txd_extracted/");
|
2015-01-20 13:48:18 +00:00
|
|
|
|
2015-06-17 20:51:33 +01:00
|
|
|
/*
|
2015-01-25 21:27:03 +00:00
|
|
|
// rw::Image *tga = rw::readTGA("b.tga");
|
|
|
|
rw::Image *tga = rw::readTGA("player.tga");
|
2015-01-20 13:48:18 +00:00
|
|
|
assert(tga != NULL);
|
2015-01-25 21:27:03 +00:00
|
|
|
rw::writeTGA(tga, "out.tga");
|
2015-06-17 20:51:33 +01:00
|
|
|
*/
|
2014-12-25 18:37:36 +00:00
|
|
|
|
2015-01-25 21:27:03 +00:00
|
|
|
// for(rw::int32 i = 0; i < c->numAtomics; i++)
|
|
|
|
// rw::Gl::Instance(c->atomicList[i]);
|
2014-12-25 10:14:36 +00:00
|
|
|
|
2014-12-27 22:18:10 +00:00
|
|
|
// ofstream out(argv[2], ios::binary);
|
2015-01-25 21:27:03 +00:00
|
|
|
// rw::StreamFile out;
|
2014-12-30 16:39:39 +00:00
|
|
|
// out.open(argv[2], "wb");
|
2015-01-25 21:27:03 +00:00
|
|
|
data = new rw::uint8[256*1024];
|
|
|
|
rw::StreamMemory out;
|
2014-12-30 16:39:39 +00:00
|
|
|
out.open(data, 0, 256*1024);
|
2014-12-27 22:18:10 +00:00
|
|
|
c->streamWrite(&out);
|
2014-12-30 16:39:39 +00:00
|
|
|
|
|
|
|
cf = fopen(argv[2], "wb");
|
|
|
|
assert(cf != NULL);
|
|
|
|
fwrite(data, out.getLength(), 1, cf);
|
|
|
|
fclose(cf);
|
2014-12-18 16:26:57 +00:00
|
|
|
out.close();
|
2014-12-30 16:39:39 +00:00
|
|
|
delete[] data;
|
2014-12-18 16:26:57 +00:00
|
|
|
|
|
|
|
delete c;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|