diff --git a/vendor/librw/src/dc/rwdc.cpp b/vendor/librw/src/dc/rwdc.cpp index 92a20978..2937365c 100644 --- a/vendor/librw/src/dc/rwdc.cpp +++ b/vendor/librw/src/dc/rwdc.cpp @@ -5779,7 +5779,9 @@ writeNativeSkin(Stream *stream, int32 len, void *object, int32 offset) stream->write8(&skin->numBones, 4); for(int32 i = 0; i < skin->numBones; i++){ - Matrix &m = *reinterpret_cast(&skin->inverseMatrices[i * 16]); + Matrix &m = *reinterpret_cast( + &skin->inverseMatrices[i * 16]); + if(m.flags & MatrixBase::IDENTITY_OLD) m.flags |= MatrixBase::IDENTITY; m.pad0 = 0; @@ -5787,6 +5789,7 @@ writeNativeSkin(Stream *stream, int32 len, void *object, int32 offset) m.atw = 0.0f; m.posw = 1.0f; } + stream->write32(skin->inverseMatrices, skin->numBones*64); return stream; } diff --git a/vendor/librw/src/engine.cpp b/vendor/librw/src/engine.cpp index 3ab07b2d..694e8174 100644 --- a/vendor/librw/src/engine.cpp +++ b/vendor/librw/src/engine.cpp @@ -56,7 +56,6 @@ size_t totalMemoryAllocated; // We align managed memory blocks on a 16 byte boundary #define ALIGN16(x) ((x) + 0xF & ~0xF) -#define ALIGN64(x) ((x) + 0x3F & ~0x3F) void* malloc_managed(size_t sz, uint32 hint) { @@ -66,13 +65,13 @@ malloc_managed(size_t sz, uint32 hint) if(sz == 0) return nil; bool align64 = !!(hint & ID_MATRIX); - origPtr = malloc(sz + sizeof(MemoryBlock) + ((align64)? 63 : 15)); + origPtr = malloc(sz + sizeof(MemoryBlock) + 15); if(origPtr == nil) return nil; totalMemoryAllocated += sz; data = (uint8*)origPtr; data += sizeof(MemoryBlock); - data = (uint8*) ((align64)? ALIGN64((uintptr)data) : ALIGN16((uintptr)data)); + data = (uint8*) ALIGN16((uintptr)data); mem = (MemoryBlock*)(data-sizeof(MemoryBlock)); mem->sz = sz; diff --git a/vendor/librw/src/skin.cpp b/vendor/librw/src/skin.cpp index 286882fc..07315c93 100644 --- a/vendor/librw/src/skin.cpp +++ b/vendor/librw/src/skin.cpp @@ -225,15 +225,6 @@ writeSkin(Stream *stream, int32 len, void *object, int32 offset, int32) if(oldFormat) stream->writeU32(0xdeaddead); - printf("ROFLCOPTER!\n"); fflush(stdout); - Matrix &m = *reinterpret_cast(&skin->inverseMatrices[i * 16]); - if(m.flags & MatrixBase::IDENTITY_OLD) - m.flags |= MatrixBase::IDENTITY; - m.pad0 = 0; - m.upw = 0.0f; - m.atw = 0.0f; - m.posw = 1.0f; - stream->write32(&skin->inverseMatrices[i*16], 64); }