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-18 16:26:57 +00:00
|
|
|
|
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[])
|
|
|
|
{
|
|
|
|
// Rw::Version = 0x31000;
|
|
|
|
// Rw::Build = 0;
|
|
|
|
|
2015-01-07 22:06:44 +00:00
|
|
|
// Rw::Version = 0x33002;
|
|
|
|
|
2015-01-19 12:32:12 +00:00
|
|
|
Rw::RegisterEnvSpecPlugin();
|
2015-01-09 19:17:32 +00:00
|
|
|
Rw::RegisterMatFXPlugin();
|
2015-01-19 12:32:12 +00:00
|
|
|
Rw::RegisterMaterialRightsPlugin();
|
2015-01-09 19:17:32 +00:00
|
|
|
Rw::RegisterAtomicRightsPlugin();
|
2015-01-17 14:15:03 +00:00
|
|
|
Rw::RegisterHAnimPlugin();
|
2015-01-06 22:17:05 +00:00
|
|
|
Rw::RegisterNodeNamePlugin();
|
|
|
|
Rw::RegisterBreakableModelPlugin();
|
|
|
|
Rw::RegisterExtraVertColorPlugin();
|
|
|
|
Rw::Ps2::RegisterADCPlugin();
|
2015-01-07 22:06:44 +00:00
|
|
|
Rw::RegisterSkinPlugin();
|
2015-01-06 22:17:05 +00:00
|
|
|
Rw::RegisterNativeDataPlugin();
|
|
|
|
// Rw::Ps2::RegisterNativeDataPlugin();
|
|
|
|
Rw::RegisterMeshPlugin();
|
2015-01-09 19:17:32 +00:00
|
|
|
|
2014-12-18 16:26:57 +00:00
|
|
|
Rw::Clump *c;
|
|
|
|
|
2014-12-27 22:18:10 +00:00
|
|
|
// ifstream in(argv[1], ios::binary);
|
2014-12-30 16:39:39 +00:00
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
2014-12-27 22:18:10 +00:00
|
|
|
Rw::FindChunk(&in, Rw::ID_CLUMP, NULL, NULL);
|
2015-01-09 19:17:32 +00:00
|
|
|
Rw::DebugFile = argv[1];
|
2014-12-27 22:18:10 +00:00
|
|
|
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-20 13:48:18 +00:00
|
|
|
Rw::Image::setSearchPath("./;/home/aap/gamedata/ps2/gtavc/MODELS/gta3_archive/txd_extracted/");
|
|
|
|
|
2014-12-28 11:06:19 +00:00
|
|
|
// Rw::Image *tga = Rw::readTGA("b.tga");
|
2015-01-20 13:48:18 +00:00
|
|
|
Rw::Image *tga = Rw::readTGA("player.tga");
|
|
|
|
assert(tga != NULL);
|
|
|
|
Rw::writeTGA(tga, "out.tga");
|
2014-12-25 18:37:36 +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);
|
2014-12-30 16:39:39 +00:00
|
|
|
// Rw::StreamFile out;
|
|
|
|
// out.open(argv[2], "wb");
|
|
|
|
data = new Rw::uint8[256*1024];
|
|
|
|
Rw::StreamMemory out;
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|