made switching platforms a little nicer

This commit is contained in:
aap 2015-12-17 22:15:59 +01:00
parent 32dfcf0fd2
commit 66e67d5aff
3 changed files with 55 additions and 3 deletions

View File

@ -16,6 +16,40 @@
using namespace std;
namespace rw {
int32
findPlatform(Clump *c)
{
for(int32 i = 0; i < c->numAtomics; i++){
Geometry *g = c->atomicList[i]->geometry;
if(g->instData)
return g->instData->platform;
}
return 0;
}
void
switchPipes(Clump *c, int32 platform)
{
for(int32 i = 0; i < c->numAtomics; i++){
Atomic *a = c->atomicList[i];
if(a->pipeline && a->pipeline->platform != platform){
uint32 plgid = a->pipeline->pluginID;
switch(plgid){
case ID_SKIN:
a->pipeline = skinGlobals.pipelines[platform];
break;
case ID_MATFX:
a->pipeline = matFXGlobals.pipelines[platform];
break;
}
}
}
}
}
namespace gta {
void
@ -579,6 +613,7 @@ static void
readPipeline(Stream *stream, int32, void *object, int32 offset, int32)
{
*PLUGINOFFSET(uint32, object, offset) = stream->readU32();
printf("%x\n", *PLUGINOFFSET(uint32, object, offset));
}
static void

View File

@ -1,3 +1,8 @@
namespace rw {
int32 findPlatform(Clump *c);
void switchPipes(Clump *c, int32 platform);
};
namespace gta {
using namespace rw;

View File

@ -15,12 +15,13 @@ main(int argc, char *argv[])
{
gta::attachPlugins();
rw::version = 0x34003;
rw::version = 0;
// rw::version = 0x34003;
// rw::version = 0x33002;
rw::platform = rw::PLATFORM_PS2;
// rw::platform = rw::PLATFORM_PS2;
// rw::platform = rw::PLATFORM_OGL;
// rw::platform = rw::PLATFORM_XBOX;
// rw::platform = rw::PLATFORM_D3D8;
rw::platform = rw::PLATFORM_D3D8;
// rw::platform = rw::PLATFORM_D3D9;
int uninstance = 0;
@ -74,6 +75,12 @@ main(int argc, char *argv[])
}
*/
int32 platform = findPlatform(c);
if(platform){
rw::platform = platform;
switchPipes(c, platform);
}
for(int32 i = 0; i < c->numAtomics; i++){
Atomic *a = c->atomicList[i];
ObjPipeline *p = a->getPipeline();
@ -83,6 +90,11 @@ main(int argc, char *argv[])
p->instance(a);
}
if(rw::version == 0){
rw::version = header.version;
rw::build = header.build;
}
if(uninstance)
rw::platform = rw::PLATFORM_D3D8;