mirror of https://github.com/aap/librw.git
implemented R* pipeline plugin, 2dfx and collision as placehoders, uvanim (no interpolation yet)
This commit is contained in:
parent
fed5ea7c9a
commit
c7fa3b3b8c
17
TODO
17
TODO
|
@ -3,7 +3,7 @@ BUGS:
|
|||
|
||||
Clump & related:
|
||||
- make pointer arrays into lists
|
||||
- work on ref counts, destruction, copying etc.
|
||||
- !!! work on ref counts, destruction, copying etc.
|
||||
- define and use types:
|
||||
sphere
|
||||
matrix
|
||||
|
@ -14,33 +14,30 @@ Clump & related:
|
|||
texcoord
|
||||
- implement plugins:
|
||||
Clump
|
||||
R* Collision 0x253F2FA
|
||||
Animation (old III dffs)
|
||||
Frame
|
||||
Animation (old III dffs)
|
||||
Atomic
|
||||
((Particles)) 0x118
|
||||
R* Pipeline 0x253F2F3
|
||||
Skin (old III dffs)
|
||||
Geometry
|
||||
((Morph)) 0x105
|
||||
R* 2dfx 0x253F2F8
|
||||
Material
|
||||
UV Anim 0x135
|
||||
Texture
|
||||
(Sky Mipmap Val) 0x110
|
||||
|
||||
UV Anim Dict
|
||||
- only stubs:
|
||||
R* 2dfx 0x253F2F8
|
||||
R* Collision 0x253F2FA
|
||||
|
||||
Texture Dictionary
|
||||
|
||||
.anm/.ska
|
||||
|
||||
- properly implement Skin plugin
|
||||
- anim interpolation (only stubs right now)
|
||||
|
||||
- PDS Pipelines
|
||||
- Pipelines (PDS, Xbox, PC)
|
||||
|
||||
- ADC
|
||||
|
||||
- uninstance geometry (PS2, Xbox; OpenGL done)
|
||||
- uninstance geometry (PS2)
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@
|
|||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\anim.cpp" />
|
||||
<ClCompile Include="src\clump.cpp" />
|
||||
<ClCompile Include="src\d3d.cpp" />
|
||||
<ClCompile Include="src\d3d8.cpp" />
|
||||
|
|
266
src/gtaplg.cpp
266
src/gtaplg.cpp
|
@ -9,12 +9,40 @@
|
|||
#include "rwplugin.h"
|
||||
#include "rwpipeline.h"
|
||||
#include "rwobjects.h"
|
||||
#include "rwps2.h"
|
||||
#include "rwxbox.h"
|
||||
#include "gtaplg.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace gta {
|
||||
|
||||
void
|
||||
attachPlugins(void)
|
||||
{
|
||||
rw::ps2::registerPDSPlugin();
|
||||
rw::registerMeshPlugin();
|
||||
rw::registerNativeDataPlugin();
|
||||
rw::registerAtomicRightsPlugin();
|
||||
rw::registerMaterialRightsPlugin();
|
||||
rw::xbox::registerVertexFormatPlugin();
|
||||
rw::registerSkinPlugin();
|
||||
rw::registerHAnimPlugin();
|
||||
gta::registerNodeNamePlugin();
|
||||
rw::registerMatFXPlugin();
|
||||
rw::registerUVAnimPlugin();
|
||||
rw::ps2::registerADCPlugin();
|
||||
gta::registerExtraNormalsPlugin();
|
||||
gta::registerExtraVertColorPlugin();
|
||||
gta::registerEnvSpecPlugin();
|
||||
gta::registerBreakableModelPlugin();
|
||||
gta::registerCollisionPlugin();
|
||||
gta::register2dEffectPlugin();
|
||||
gta::registerPipelinePlugin();
|
||||
|
||||
rw::Atomic::init();
|
||||
}
|
||||
|
||||
//
|
||||
// Frame
|
||||
//
|
||||
|
@ -66,7 +94,7 @@ getSizeNodeName(void *object, int32 offset, int32)
|
|||
{
|
||||
char *name = PLUGINOFFSET(char, object, offset);
|
||||
int32 len = strlen(name);
|
||||
return len > 0 ? len : -1;
|
||||
return len > 0 ? len : 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -243,7 +271,7 @@ getSizeExtraNormals(void *object, int32 offset, int32)
|
|||
Geometry *geo = (Geometry*)object;
|
||||
if(*PLUGINOFFSET(float*, object, offset))
|
||||
return geo->numVertices*3*4;
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -300,7 +328,6 @@ readExtraVertColors(Stream *stream, int32, void *object, int32 offset, int32)
|
|||
colordata->dayColors = new uint8[geometry->numVertices*4];
|
||||
colordata->balance = 1.0f;
|
||||
stream->read(colordata->nightColors, geometry->numVertices*4);
|
||||
printf("extra colors\n");
|
||||
if(geometry->colors)
|
||||
memcpy(colordata->dayColors, geometry->colors,
|
||||
geometry->numVertices*4);
|
||||
|
@ -326,7 +353,7 @@ getSizeExtraVertColors(void *object, int32 offset, int32)
|
|||
Geometry *geometry = (Geometry*)object;
|
||||
if(colordata->nightColors)
|
||||
return 4 + geometry->numVertices*4;
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -420,7 +447,7 @@ static int32
|
|||
getSizeEnvMat(void *object, int32 offset, int32)
|
||||
{
|
||||
EnvMat *env = *PLUGINOFFSET(EnvMat*, object, offset);
|
||||
return env ? (int)sizeof(EnvStream) : -1;
|
||||
return env ? (int)sizeof(EnvStream) : 0;
|
||||
}
|
||||
|
||||
// Specular mat
|
||||
|
@ -490,19 +517,12 @@ static int32
|
|||
getSizeSpecMat(void *object, int32 offset, int32)
|
||||
{
|
||||
SpecMat *spec = *PLUGINOFFSET(SpecMat*, object, offset);
|
||||
return spec ? (int)sizeof(SpecStream) : -1;
|
||||
return spec ? (int)sizeof(SpecStream) : 0;
|
||||
}
|
||||
|
||||
void
|
||||
registerEnvSpecPlugin(void)
|
||||
{
|
||||
specMatOffset = Material::registerPlugin(sizeof(SpecMat*), ID_SPECMAT,
|
||||
createSpecMat,
|
||||
destroySpecMat,
|
||||
copySpecMat);
|
||||
Material::registerPluginStream(ID_SPECMAT, readSpecMat,
|
||||
writeSpecMat,
|
||||
getSizeSpecMat);
|
||||
envMatOffset = Material::registerPlugin(sizeof(EnvMat*), ID_ENVMAT,
|
||||
createEnvMat,
|
||||
destroyEnvMat,
|
||||
|
@ -510,6 +530,226 @@ registerEnvSpecPlugin(void)
|
|||
Material::registerPluginStream(ID_ENVMAT, readEnvMat,
|
||||
writeEnvMat,
|
||||
getSizeEnvMat);
|
||||
specMatOffset = Material::registerPlugin(sizeof(SpecMat*), ID_SPECMAT,
|
||||
createSpecMat,
|
||||
destroySpecMat,
|
||||
copySpecMat);
|
||||
Material::registerPluginStream(ID_SPECMAT, readSpecMat,
|
||||
writeSpecMat,
|
||||
getSizeSpecMat);
|
||||
}
|
||||
|
||||
// Pipeline
|
||||
|
||||
int32 pipelineOffset;
|
||||
|
||||
static void*
|
||||
createPipeline(void *object, int32 offset, int32)
|
||||
{
|
||||
*PLUGINOFFSET(uint32, object, offset) = 0;
|
||||
return object;
|
||||
}
|
||||
|
||||
static void*
|
||||
copyPipeline(void *dst, void *src, int32 offset, int32)
|
||||
{
|
||||
*PLUGINOFFSET(uint32, dst, offset) = *PLUGINOFFSET(uint32, src, offset);
|
||||
return dst;
|
||||
}
|
||||
|
||||
static void
|
||||
readPipeline(Stream *stream, int32, void *object, int32 offset, int32)
|
||||
{
|
||||
*PLUGINOFFSET(uint32, object, offset) = stream->readU32();
|
||||
}
|
||||
|
||||
static void
|
||||
writePipeline(Stream *stream, int32, void *object, int32 offset, int32)
|
||||
{
|
||||
stream->writeU32(*PLUGINOFFSET(uint32, object, offset));
|
||||
}
|
||||
|
||||
static int32
|
||||
getSizePipeline(void *object, int32 offset, int32)
|
||||
{
|
||||
if(*PLUGINOFFSET(uint32, object, offset))
|
||||
return 4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
registerPipelinePlugin(void)
|
||||
{
|
||||
pipelineOffset = Atomic::registerPlugin(sizeof(uint32), ID_PIPELINE,
|
||||
createPipeline,
|
||||
NULL,
|
||||
copyPipeline);
|
||||
Atomic::registerPluginStream(ID_PIPELINE, readPipeline,
|
||||
writePipeline, getSizePipeline);
|
||||
}
|
||||
|
||||
uint32
|
||||
getPipelineID(Atomic *atomic)
|
||||
{
|
||||
return *PLUGINOFFSET(uint32, atomic, pipelineOffset);
|
||||
}
|
||||
|
||||
void
|
||||
setPipelineID(Atomic *atomic, uint32 id)
|
||||
{
|
||||
*PLUGINOFFSET(uint32, atomic, pipelineOffset) = id;
|
||||
}
|
||||
|
||||
// 2dEffect
|
||||
|
||||
struct SizedData
|
||||
{
|
||||
uint32 size;
|
||||
uint8 *data;
|
||||
};
|
||||
|
||||
int32 twodEffectOffset;
|
||||
|
||||
static void*
|
||||
create2dEffect(void *object, int32 offset, int32)
|
||||
{
|
||||
SizedData *data;
|
||||
data = PLUGINOFFSET(SizedData, object, offset);
|
||||
data->size = 0;
|
||||
data->data = NULL;
|
||||
return object;
|
||||
}
|
||||
|
||||
static void*
|
||||
destroy2dEffect(void *object, int32 offset, int32)
|
||||
{
|
||||
SizedData *data;
|
||||
data = PLUGINOFFSET(SizedData, object, offset);
|
||||
delete[] data->data;
|
||||
data->data = NULL;
|
||||
data->size = 0;
|
||||
return object;
|
||||
}
|
||||
|
||||
static void*
|
||||
copy2dEffect(void *dst, void *src, int32 offset, int32)
|
||||
{
|
||||
SizedData *srcdata, *dstdata;
|
||||
dstdata = PLUGINOFFSET(SizedData, dst, offset);
|
||||
srcdata = PLUGINOFFSET(SizedData, src, offset);
|
||||
dstdata->size = srcdata->size;
|
||||
if(dstdata->size != 0){
|
||||
dstdata->data = new uint8[dstdata->size];
|
||||
memcpy(dstdata->data, srcdata->data, dstdata->size);
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
static void
|
||||
read2dEffect(Stream *stream, int32 size, void *object, int32 offset, int32)
|
||||
{
|
||||
SizedData *data = PLUGINOFFSET(SizedData, object, offset);
|
||||
data->size = size;
|
||||
data->data = new uint8[data->size];
|
||||
stream->read(data->data, data->size);
|
||||
}
|
||||
|
||||
static void
|
||||
write2dEffect(Stream *stream, int32, void *object, int32 offset, int32)
|
||||
{
|
||||
SizedData *data = PLUGINOFFSET(SizedData, object, offset);
|
||||
stream->write(data->data, data->size);
|
||||
}
|
||||
|
||||
static int32
|
||||
getSize2dEffect(void *object, int32 offset, int32)
|
||||
{
|
||||
SizedData *data = PLUGINOFFSET(SizedData, object, offset);
|
||||
return data->size;
|
||||
}
|
||||
|
||||
void
|
||||
register2dEffectPlugin(void)
|
||||
{
|
||||
twodEffectOffset = Geometry::registerPlugin(sizeof(SizedData), ID_2DEFFECT,
|
||||
create2dEffect,
|
||||
destroy2dEffect,
|
||||
copy2dEffect);
|
||||
Geometry::registerPluginStream(ID_2DEFFECT, read2dEffect,
|
||||
write2dEffect, getSize2dEffect);
|
||||
}
|
||||
|
||||
// Collision
|
||||
|
||||
int32 collisionOffset;
|
||||
|
||||
static void*
|
||||
createCollision(void *object, int32 offset, int32)
|
||||
{
|
||||
SizedData *data;
|
||||
data = PLUGINOFFSET(SizedData, object, offset);
|
||||
data->size = 0;
|
||||
data->data = NULL;
|
||||
return object;
|
||||
}
|
||||
|
||||
static void*
|
||||
destroyCollision(void *object, int32 offset, int32)
|
||||
{
|
||||
SizedData *data;
|
||||
data = PLUGINOFFSET(SizedData, object, offset);
|
||||
delete[] data->data;
|
||||
data->data = NULL;
|
||||
data->size = 0;
|
||||
return object;
|
||||
}
|
||||
|
||||
static void*
|
||||
copyCollision(void *dst, void *src, int32 offset, int32)
|
||||
{
|
||||
SizedData *srcdata, *dstdata;
|
||||
dstdata = PLUGINOFFSET(SizedData, dst, offset);
|
||||
srcdata = PLUGINOFFSET(SizedData, src, offset);
|
||||
dstdata->size = srcdata->size;
|
||||
if(dstdata->size != 0){
|
||||
dstdata->data = new uint8[dstdata->size];
|
||||
memcpy(dstdata->data, srcdata->data, dstdata->size);
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
static void
|
||||
readCollision(Stream *stream, int32 size, void *object, int32 offset, int32)
|
||||
{
|
||||
SizedData *data = PLUGINOFFSET(SizedData, object, offset);
|
||||
data->size = size;
|
||||
data->data = new uint8[data->size];
|
||||
stream->read(data->data, data->size);
|
||||
}
|
||||
|
||||
static void
|
||||
writeCollision(Stream *stream, int32, void *object, int32 offset, int32)
|
||||
{
|
||||
SizedData *data = PLUGINOFFSET(SizedData, object, offset);
|
||||
stream->write(data->data, data->size);
|
||||
}
|
||||
|
||||
static int32
|
||||
getSizeCollision(void *object, int32 offset, int32)
|
||||
{
|
||||
SizedData *data = PLUGINOFFSET(SizedData, object, offset);
|
||||
return data->size;
|
||||
}
|
||||
|
||||
void
|
||||
registerCollisionPlugin(void)
|
||||
{
|
||||
collisionOffset = Clump::registerPlugin(sizeof(SizedData), ID_COLLISION,
|
||||
createCollision,
|
||||
destroyCollision,
|
||||
copyCollision);
|
||||
Clump::registerPluginStream(ID_COLLISION, readCollision,
|
||||
writeCollision, getSizeCollision);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
37
src/gtaplg.h
37
src/gtaplg.h
|
@ -4,13 +4,18 @@ using namespace rw;
|
|||
enum
|
||||
{
|
||||
ID_EXTRANORMALS = 0x253f2f2,
|
||||
ID_PIPELINE = 0x253f2f3,
|
||||
ID_SPECMAT = 0x253f2f6,
|
||||
ID_2DEFFECT = 0x253f2f8, // geometry
|
||||
ID_EXTRAVERTCOLORS = 0x253f2f9,
|
||||
ID_COLLISION = 0x253f2fa, // clump
|
||||
ID_ENVMAT = 0x253f2fc,
|
||||
ID_BREAKABLE = 0x253f2fd,
|
||||
ID_NODENAME = 0x253f2fe
|
||||
};
|
||||
|
||||
void attachPlugins(void);
|
||||
|
||||
// Node name
|
||||
|
||||
extern int32 nodeNameOffset;
|
||||
|
@ -79,4 +84,36 @@ extern int32 specMatOffset;
|
|||
|
||||
void registerEnvSpecPlugin(void);
|
||||
|
||||
// Pipeline
|
||||
|
||||
// 0x53F2009A CCustomCarEnvMapPipeline
|
||||
//
|
||||
// PC & Mobile:
|
||||
// 0x53F20098 CCustomBuildingDNPipeline
|
||||
// 0x53F2009C CCustomBuildingPipeline
|
||||
//
|
||||
// Xbox
|
||||
// 0x53F2009E building !N !EN
|
||||
// 0x53F20096 building N !EN
|
||||
// 0x53F200A0 building !N EN (also env) non-DN custom instanceCB!
|
||||
// 0x53F200A2 building N EN (also env) DN custom instanceCB!
|
||||
|
||||
extern int32 pipelineOffset;
|
||||
|
||||
void registerPipelinePlugin(void);
|
||||
uint32 getPipelineID(Atomic *atomic);
|
||||
void setPipelineID(Atomic *atomic, uint32 id);
|
||||
|
||||
// 2dEffect
|
||||
|
||||
extern int32 twodEffectOffset;
|
||||
|
||||
void register2dEffectPlugin(void);
|
||||
|
||||
// Collision
|
||||
|
||||
extern int32 collisionOffset;
|
||||
|
||||
void registerCollisionPlugin(void);
|
||||
|
||||
}
|
||||
|
|
|
@ -123,11 +123,11 @@ static int32
|
|||
getSizeHAnim(void *object, int32 offset, int32)
|
||||
{
|
||||
HAnimData *hanim = PLUGINOFFSET(HAnimData, object, offset);
|
||||
if(version >= 0x34000 && hanim->id == -1 && hanim->hierarchy == NULL)
|
||||
// TODO: version correct?
|
||||
if(version >= 0x35000 && hanim->id == -1 && hanim->hierarchy == NULL)
|
||||
return -1;
|
||||
if(hanim->hierarchy)
|
||||
return 12 + 8 + hanim->hierarchy->numNodes*12;
|
||||
// TODO: version correct?
|
||||
return 12;
|
||||
}
|
||||
|
||||
|
@ -712,8 +712,7 @@ getSizeAtomicMatFX(void *object, int32 offset, int32)
|
|||
{
|
||||
int32 flag = *PLUGINOFFSET(int32, object, offset);
|
||||
// TODO: not sure which version
|
||||
return flag && rw::version < 0x35000 ? 4 : -1;
|
||||
return 4;
|
||||
return flag || rw::version < 0x35000 ? 4 : -1;
|
||||
}
|
||||
|
||||
// Material
|
||||
|
|
13
src/rwbase.h
13
src/rwbase.h
|
@ -133,11 +133,16 @@ enum PluginID
|
|||
ID_RIGHTTORENDER = 0x1F,
|
||||
ID_UVANIMDICT = 0x2B,
|
||||
|
||||
// Toolkit
|
||||
ID_SKYMIPMAP = 0x110,
|
||||
ID_SKIN = 0x116,
|
||||
ID_HANIMPLUGIN = 0x11E,
|
||||
ID_MATFX = 0x120,
|
||||
ID_PDS = 0x131,
|
||||
ID_ADC = 0x134,
|
||||
ID_UVANIMATION = 0x135,
|
||||
|
||||
// World
|
||||
ID_MESH = 0x50E,
|
||||
ID_NATIVEDATA = 0x510,
|
||||
ID_VERTEXFMT = 0x511,
|
||||
|
@ -148,6 +153,14 @@ extern int build;
|
|||
extern int platform;
|
||||
extern char *debugFile;
|
||||
|
||||
// 0x04000000 3.1
|
||||
// 0x08000000 3.2
|
||||
// 0x0C000000 3.3
|
||||
// 0x10000000 3.4
|
||||
// 0x14000000 3.5
|
||||
// 0x18000000 3.6
|
||||
// 0x1C000000 3.7
|
||||
|
||||
inline uint32
|
||||
libraryIDPack(int version, int build)
|
||||
{
|
||||
|
|
|
@ -409,6 +409,74 @@ struct TexDictionary
|
|||
Texture *find(const char *name);
|
||||
};
|
||||
|
||||
struct Animation;
|
||||
|
||||
struct AnimInterpolatorInfo
|
||||
{
|
||||
int32 id;
|
||||
int32 keyFrameSize;
|
||||
int32 customDataSize;
|
||||
void (*streamRead)(Stream *stream, Animation *anim);
|
||||
void (*streamWrite)(Stream *stream, Animation *anim);
|
||||
uint32 (*streamGetSize)(Animation *anim);
|
||||
};
|
||||
|
||||
void registerAnimInterpolatorInfo(AnimInterpolatorInfo *interpInfo);
|
||||
|
||||
struct Animation
|
||||
{
|
||||
AnimInterpolatorInfo *interpInfo;
|
||||
int32 numFrames;
|
||||
int32 flags;
|
||||
float duration;
|
||||
void *keyframes;
|
||||
void *customData;
|
||||
|
||||
Animation(AnimInterpolatorInfo*, int32 numFrames, int32 flags, float duration);
|
||||
static Animation *streamRead(Stream *stream);
|
||||
bool streamWrite(Stream *stream);
|
||||
uint32 streamGetSize(void);
|
||||
};
|
||||
|
||||
struct AnimInterpolator
|
||||
{
|
||||
// only a stub right now
|
||||
Animation *anim;
|
||||
|
||||
AnimInterpolator(Animation *anim);
|
||||
};
|
||||
|
||||
extern TexDictionary *currentTexDictionary;
|
||||
|
||||
struct UVAnimKeyFrame
|
||||
{
|
||||
UVAnimKeyFrame *prev;
|
||||
float time;
|
||||
float uv[6];
|
||||
};
|
||||
|
||||
struct UVAnimCustomData
|
||||
{
|
||||
char name[32];
|
||||
int32 nodeToUVChannel[8];
|
||||
// RW has a refcount
|
||||
};
|
||||
|
||||
struct UVAnimDictionary
|
||||
{
|
||||
int32 numAnims;
|
||||
Animation **anims;
|
||||
|
||||
static UVAnimDictionary *streamRead(Stream *stream);
|
||||
bool streamWrite(Stream *stream);
|
||||
uint32 streamGetSize(void);
|
||||
Animation *find(const char *name);
|
||||
};
|
||||
|
||||
extern UVAnimDictionary *currentUVAnimDictionary;
|
||||
|
||||
extern int32 uvAnimOffset;
|
||||
|
||||
void registerUVAnimPlugin(void);
|
||||
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ PluginBase<T>::streamReadPlugins(Stream *stream)
|
|||
readChunkHeaderInfo(stream, &header);
|
||||
length -= 12;
|
||||
for(Plugin *p = this->s_plugins; p; p = p->next)
|
||||
if(p->id == header.type){
|
||||
if(p->id == header.type && p->read){
|
||||
p->read(stream, header.length,
|
||||
(void*)this, p->offset, p->size);
|
||||
goto cont;
|
||||
|
@ -111,7 +111,7 @@ PluginBase<T>::streamWritePlugins(Stream *stream)
|
|||
writeChunkHeader(stream, ID_EXTENSION, size);
|
||||
for(Plugin *p = this->s_plugins; p; p = p->next){
|
||||
if(p->getSize == NULL ||
|
||||
(size = p->getSize(this, p->offset, p->size)) < 0)
|
||||
(size = p->getSize(this, p->offset, p->size)) <= 0)
|
||||
continue;
|
||||
writeChunkHeader(stream, p->id, size);
|
||||
p->write(stream, size, this, p->offset, p->size);
|
||||
|
@ -125,7 +125,7 @@ PluginBase<T>::streamGetPluginSize(void)
|
|||
int32 plgsize;
|
||||
for(Plugin *p = this->s_plugins; p; p = p->next)
|
||||
if(p->getSize &&
|
||||
(plgsize = p->getSize(this, p->offset, p->size)) >= 0)
|
||||
(plgsize = p->getSize(this, p->offset, p->size)) > 0)
|
||||
size += 12 + plgsize;
|
||||
return size;
|
||||
}
|
||||
|
@ -160,8 +160,11 @@ PluginBase<T>::registerPlugin(int32 size, uint32 id,
|
|||
p->getSize = NULL;
|
||||
p->rightsCallback = NULL;
|
||||
|
||||
p->next = s_plugins;
|
||||
s_plugins = p;
|
||||
Plugin **next;
|
||||
for(next = &s_plugins; *next; next = &(*next)->next)
|
||||
;
|
||||
*next = p;
|
||||
p->next = NULL;
|
||||
return p->offset;
|
||||
}
|
||||
|
||||
|
|
|
@ -215,28 +215,13 @@ void (*renderCB)(rw::Atomic*) = NULL;
|
|||
void
|
||||
initrw(void)
|
||||
{
|
||||
gta::attachPlugins();
|
||||
|
||||
rw::currentTexDictionary = new rw::TexDictionary;
|
||||
rw::Image::setSearchPath("D:\\rockstargames\\ps2\\gta3\\MODELS\\gta3_archive\\txd_extracted\\;"
|
||||
"D:\\rockstargames\\ps2\\gtavc\\MODELS\\gta3_archive\\txd_extracted\\;"
|
||||
"D:\\rockstargames\\ps2\\gtasa\\models\\gta3_archive\\txd_extracted\\");
|
||||
|
||||
gta::registerEnvSpecPlugin();
|
||||
rw::registerMatFXPlugin();
|
||||
rw::registerMaterialRightsPlugin();
|
||||
rw::registerAtomicRightsPlugin();
|
||||
rw::registerHAnimPlugin();
|
||||
gta::registerNodeNamePlugin();
|
||||
gta::registerExtraNormalsPlugin();
|
||||
gta::registerBreakableModelPlugin();
|
||||
gta::registerExtraVertColorPlugin();
|
||||
rw::ps2::registerADCPlugin();
|
||||
rw::ps2::registerPDSPlugin();
|
||||
rw::registerSkinPlugin();
|
||||
rw::xbox::registerVertexFormatPlugin();
|
||||
rw::registerNativeDataPlugin();
|
||||
rw::registerMeshPlugin();
|
||||
rw::Atomic::init();
|
||||
|
||||
rw::d3d::registerNativeRaster();
|
||||
|
||||
rw::platform = rw::PLATFORM_D3D9;
|
||||
|
@ -247,10 +232,12 @@ initrw(void)
|
|||
// char *filename = "D:\\rockstargames\\pc\\gtavc\\models\\gta3_archive\\od_newscafe_dy.dff";
|
||||
// char *filename = "D:\\rockstargames\\pc\\gtasa\\models\\gta3_archive\\admiral.dff";
|
||||
// char *filename = "D:\\rockstargames\\pc\\gtasa\\models\\gta3_archive\\lae2_roads89.dff";
|
||||
char *filename = "D:\\rockstargames\\pc\\gtasa\\models\\gta3_archive\\casinoblock41_nt.dff";
|
||||
// char *filename = "D:\\rockstargames\\pc\\gtasa\\models\\cutscene_archive\\csremington92.dff";
|
||||
// char *filename = "C:\\gtasa\\test\\hanger.dff";
|
||||
// char *filename = "C:\\Users\\aap\\Desktop\\tmp\\out.dff";
|
||||
// char *filename = "out2.dff";
|
||||
char *filename = "C:\\Users\\aap\\src\\librw\\tools\\insttest\\out.dff";
|
||||
// char *filename = "C:\\Users\\aap\\src\\librw\\tools\\insttest\\out.dff";
|
||||
rw::StreamFile in;
|
||||
if(in.open(filename, "rb") == NULL){
|
||||
MessageBox(0, "couldn't open file\n", 0, 0);
|
||||
|
@ -270,10 +257,10 @@ initrw(void)
|
|||
else if(rw::platform == rw::PLATFORM_D3D9)
|
||||
renderCB = rw::d3d9::drawAtomic;
|
||||
|
||||
// rw::StreamFile out;
|
||||
// out.open("out.dff", "wb");
|
||||
// clump->streamWrite(&out);
|
||||
// out.close();
|
||||
rw::StreamFile out;
|
||||
out.open("out.dff", "wb");
|
||||
clump->streamWrite(&out);
|
||||
out.close();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -308,10 +295,10 @@ Setup()
|
|||
|
||||
camera = new Camera;
|
||||
camera->setAspectRatio(640.0f/480.0f);
|
||||
camera->setNearFar(0.1f, 250.0f);
|
||||
camera->setNearFar(0.1f, 450.0f);
|
||||
camera->setTarget(Vec3(0.0f, 0.0f, 0.0f));
|
||||
// camera->setPosition(Vec3(0.0f, 5.0f, 0.0f));
|
||||
camera->setPosition(Vec3(0.0f, -5.0f, 0.0f));
|
||||
camera->setPosition(Vec3(0.0f, -70.0f, 0.0f));
|
||||
// camera->setPosition(Vec3(0.0f, -1.0f, 3.0f));
|
||||
|
||||
return true;
|
||||
|
|
|
@ -19,23 +19,7 @@ main(int argc, char *argv[])
|
|||
// rw::version = 0x33002;
|
||||
// rw::version = 0x30200;
|
||||
|
||||
gta::registerEnvSpecPlugin();
|
||||
rw::registerMatFXPlugin();
|
||||
rw::registerMaterialRightsPlugin();
|
||||
rw::registerAtomicRightsPlugin();
|
||||
rw::registerHAnimPlugin();
|
||||
gta::registerNodeNamePlugin();
|
||||
gta::registerExtraNormalsPlugin();
|
||||
gta::registerBreakableModelPlugin();
|
||||
gta::registerExtraVertColorPlugin();
|
||||
rw::ps2::registerADCPlugin();
|
||||
rw::ps2::registerPDSPlugin();
|
||||
rw::registerSkinPlugin();
|
||||
rw::xbox::registerVertexFormatPlugin();
|
||||
rw::registerNativeDataPlugin();
|
||||
// rw::ps2::registerNativeDataPlugin();
|
||||
rw::registerMeshPlugin();
|
||||
rw::Atomic::init();
|
||||
gta::attachPlugins();
|
||||
|
||||
rw::Clump *c;
|
||||
|
||||
|
|
|
@ -189,6 +189,8 @@ init(void)
|
|||
// camera->setPosition(Vec3(0.0f, 5.0f, 0.0f));
|
||||
camera->setPosition(Vec3(0.0f, -1.0f, 3.0f));
|
||||
|
||||
gta::attachPlugins();
|
||||
|
||||
rw::currentTexDictionary = new rw::TexDictionary;
|
||||
// rw::Image::setSearchPath("/home/aap/gamedata/ps2/gtasa/models/gta3_archive/txd_extracted/");
|
||||
// rw::Image::setSearchPath("/home/aap/gamedata/ps2/gtavc/MODELS/gta3_archive/txd_extracted/");
|
||||
|
@ -196,24 +198,6 @@ init(void)
|
|||
"/home/aap/gamedata/ps2/gta3/MODELS/gta3_archive/txd_extracted/;//home/aap/gamedata/ps2/gtavc/MODELS/gta3_archive/txd_extracted/;/home/aap/gamedata/ps2/gtasa/models/gta3_archive/txd_extracted/");
|
||||
//"D:\\rockstargames\\ps2\\gtavc\\MODELS\\gta3_archive\\txd_extracted\\;D:\\rockstargames\\ps2\\gtasa\\models\\gta3_archive\\txd_extracted\\");
|
||||
|
||||
rw::gl::registerNativeRaster();
|
||||
gta::registerEnvSpecPlugin();
|
||||
rw::registerMatFXPlugin();
|
||||
rw::registerMaterialRightsPlugin();
|
||||
rw::registerAtomicRightsPlugin();
|
||||
rw::registerHAnimPlugin();
|
||||
gta::registerNodeNamePlugin();
|
||||
gta::registerBreakableModelPlugin();
|
||||
gta::registerExtraVertColorPlugin();
|
||||
rw::ps2::registerADCPlugin();
|
||||
rw::ps2::registerPDSPlugin();
|
||||
rw::registerSkinPlugin();
|
||||
rw::xbox::registerVertexFormatPlugin();
|
||||
rw::registerNativeDataPlugin();
|
||||
// rw::ps2::registerNativeDataPlugin();
|
||||
rw::registerMeshPlugin();
|
||||
rw::Atomic::init();
|
||||
|
||||
printf("platform: %d\n", rw::platform);
|
||||
|
||||
rw::StreamFile in;
|
||||
|
|
|
@ -13,21 +13,7 @@ using namespace rw;
|
|||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
gta::registerEnvSpecPlugin();
|
||||
rw::registerMatFXPlugin();
|
||||
rw::registerMaterialRightsPlugin();
|
||||
rw::registerAtomicRightsPlugin();
|
||||
rw::registerHAnimPlugin();
|
||||
gta::registerNodeNamePlugin();
|
||||
gta::registerBreakableModelPlugin();
|
||||
gta::registerExtraVertColorPlugin();
|
||||
rw::ps2::registerADCPlugin();
|
||||
rw::ps2::registerPDSPlugin();
|
||||
rw::registerSkinPlugin();
|
||||
rw::xbox::registerVertexFormatPlugin();
|
||||
rw::registerNativeDataPlugin();
|
||||
rw::registerMeshPlugin();
|
||||
rw::Atomic::init();
|
||||
gta::attachPlugins();
|
||||
|
||||
// rw::version = 0x33002;
|
||||
// rw::platform = rw::PLATFORM_PS2;
|
||||
|
@ -59,7 +45,15 @@ main(int argc, char *argv[])
|
|||
assert(data != NULL);
|
||||
StreamMemory in;
|
||||
in.open(data, len);
|
||||
findChunk(&in, ID_CLUMP, NULL, NULL);
|
||||
|
||||
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);
|
||||
debugFile = argv[arg];
|
||||
c = Clump::streamRead(&in);
|
||||
assert(c != NULL);
|
||||
|
@ -91,6 +85,8 @@ main(int argc, char *argv[])
|
|||
data = new rw::uint8[1024*1024];
|
||||
rw::StreamMemory out;
|
||||
out.open(data, 0, 1024*1024);
|
||||
if(currentUVAnimDictionary)
|
||||
currentUVAnimDictionary->streamWrite(&out);
|
||||
c->streamWrite(&out);
|
||||
|
||||
FILE *cf = fopen("out.dff", "wb");
|
||||
|
|
|
@ -227,22 +227,7 @@ main()
|
|||
|
||||
gsInit();
|
||||
|
||||
gta::registerEnvSpecPlugin();
|
||||
rw::registerMatFXPlugin();
|
||||
rw::registerMaterialRightsPlugin();
|
||||
rw::registerAtomicRightsPlugin();
|
||||
rw::registerHAnimPlugin();
|
||||
gta::registerNodeNamePlugin();
|
||||
gta::registerBreakableModelPlugin();
|
||||
gta::registerExtraVertColorPlugin();
|
||||
rw::ps2::registerADCPlugin();
|
||||
rw::ps2::registerPDSPlugin();
|
||||
rw::registerSkinPlugin();
|
||||
rw::xbox::registerVertexFormatPlugin();
|
||||
rw::registerNativeDataPlugin();
|
||||
// rw::ps2::registerNativeDataPlugin();
|
||||
rw::registerMeshPlugin();
|
||||
rw::Atomic::init();
|
||||
gta::attachPlugins();
|
||||
|
||||
defpipe = rw::ps2::makeDefaultPipeline();
|
||||
|
||||
|
|
Loading…
Reference in New Issue