mirror of
https://github.com/aap/librw.git
synced 2025-12-18 16:39:51 +00:00
Some fixes for PS2.
This commit is contained in:
@@ -149,7 +149,6 @@ Clump::streamRead(Stream *stream)
|
||||
uint32 length, version;
|
||||
int32 buf[3];
|
||||
Clump *clump;
|
||||
printf("- before chunk: %X\n", stream->tell());
|
||||
assert(FindChunk(stream, ID_STRUCT, &length, &version));
|
||||
clump = new Clump;
|
||||
stream->read(buf, length);
|
||||
@@ -161,14 +160,12 @@ printf("- before chunk: %X\n", stream->tell());
|
||||
clump->numCameras = buf[2];
|
||||
}
|
||||
|
||||
printf("- frame list: %X\n", stream->tell());
|
||||
// Frame list
|
||||
Frame **frameList;
|
||||
int32 numFrames;
|
||||
clump->frameListStreamRead(stream, &frameList, &numFrames);
|
||||
clump->parent = (void*)frameList[0];
|
||||
|
||||
printf("- geometry list: %X\n", stream->tell());
|
||||
// Geometry list
|
||||
int32 numGeometries = 0;
|
||||
assert(FindChunk(stream, ID_GEOMETRYLIST, NULL, NULL));
|
||||
@@ -182,7 +179,6 @@ printf("- geometry list: %X\n", stream->tell());
|
||||
geometryList[i] = Geometry::streamRead(stream);
|
||||
}
|
||||
|
||||
printf("- atomics: %X\n", stream->tell());
|
||||
// Atomics
|
||||
if(clump->numAtomics)
|
||||
clump->atomicList = new Atomic*[clump->numAtomics];
|
||||
|
||||
@@ -270,6 +270,17 @@ registerNativeDataPlugin(void)
|
||||
(StreamGetSize)getSizeNativeData);
|
||||
}
|
||||
|
||||
void
|
||||
registerNativeDataPS2Plugin(void)
|
||||
{
|
||||
Geometry::registerPlugin(0, ID_NATIVEDATA,
|
||||
NULL, DestroyNativeDataPS2, NULL);
|
||||
Geometry::registerPluginStream(ID_NATIVEDATA,
|
||||
(StreamRead)ReadNativeDataPS2,
|
||||
(StreamWrite)WriteNativeDataPS2,
|
||||
(StreamGetSize)GetSizeNativeDataPS2);
|
||||
}
|
||||
|
||||
// Breakable Model
|
||||
|
||||
// TODO: put this in a header
|
||||
@@ -290,6 +301,13 @@ struct Breakable
|
||||
float32 (*surfaceProps)[3];
|
||||
};
|
||||
|
||||
static void*
|
||||
createBreakableModel(void *object, int32 offset, int32)
|
||||
{
|
||||
*PLUGINOFFSET(uint8*, object, offset) = 0;
|
||||
return object;
|
||||
}
|
||||
|
||||
static void*
|
||||
destroyBreakableModel(void *object, int32 offset, int32)
|
||||
{
|
||||
@@ -371,7 +389,8 @@ getSizeBreakableModel(void *object, int32 offset, int32)
|
||||
void
|
||||
registerBreakableModelPlugin(void)
|
||||
{
|
||||
Geometry::registerPlugin(sizeof(Breakable*), ID_BREAKABLE, NULL,
|
||||
Geometry::registerPlugin(sizeof(Breakable*), ID_BREAKABLE,
|
||||
createBreakableModel,
|
||||
destroyBreakableModel, NULL);
|
||||
Geometry::registerPluginStream(ID_BREAKABLE,
|
||||
(StreamRead)readBreakableModel,
|
||||
|
||||
@@ -129,13 +129,14 @@ StreamFile::close(void)
|
||||
uint32
|
||||
StreamFile::write(const void *data, uint32 length)
|
||||
{
|
||||
//printf("write %d bytes @ %x\n", length, this->tell());
|
||||
return fwrite(data, length, 1, this->file);
|
||||
}
|
||||
|
||||
uint32
|
||||
StreamFile::read(void *data, uint32 length)
|
||||
{
|
||||
printf("read %d bytes @ %x\n", length, this->tell());
|
||||
//printf("read %d bytes @ %x\n", length, this->tell());
|
||||
return fread(data, length, 1, this->file);
|
||||
}
|
||||
|
||||
@@ -164,6 +165,7 @@ WriteChunkHeader(Stream *s, int32 type, int32 size)
|
||||
int32 type, size;
|
||||
uint32 id;
|
||||
} buf = { type, size, LibraryIDPack(Version, Build) };
|
||||
//printf("- write chunk %x @ %x\n", buf.type, s->tell());
|
||||
s->write(&buf, 12);
|
||||
return true;
|
||||
}
|
||||
@@ -198,6 +200,7 @@ FindChunk(Stream *s, uint32 type, uint32 *length, uint32 *version)
|
||||
*length = header.length;
|
||||
if(version)
|
||||
*version = header.version;
|
||||
//printf("- chunk %x @ %x\n", header.type, s->tell()-12);
|
||||
return true;
|
||||
}
|
||||
s->seek(header.length);
|
||||
|
||||
@@ -230,4 +230,5 @@ private:
|
||||
void registerNodeNamePlugin(void);
|
||||
void registerMeshPlugin(void);
|
||||
void registerNativeDataPlugin(void);
|
||||
void registerNativeDataPS2Plugin(void);
|
||||
void registerBreakableModelPlugin(void);
|
||||
|
||||
Reference in New Issue
Block a user