Some x64 improvements
This commit is contained in:
parent
dfc51f4912
commit
9e062adfa4
9 changed files with 135 additions and 116 deletions
|
|
@ -1842,7 +1842,9 @@ static s32 LoadTexture(ModelData *arg0, HsfBitmap *arg1, HsfAttribute *arg2, s16
|
|||
GXLoadTexObj(&sp1C, arg3);
|
||||
#ifdef TARGET_PC
|
||||
GXDestroyTexObj(&sp1C);
|
||||
GXDestroyTlutObj(&sp10);
|
||||
if (arg1->dataFmt == 9 || arg1->dataFmt == 10 || arg1->dataFmt == 11) {
|
||||
GXDestroyTlutObj(&sp10);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -2579,6 +2581,9 @@ static void MDFaceDraw(HsfObject *arg0, HsfFace *arg1) {
|
|||
GXTexCoord1x16(arg1->indices[1][3]);
|
||||
}
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
GXEnd();
|
||||
#endif
|
||||
faceCnt = faceNumBuf[drawCnt] / 3;
|
||||
break;
|
||||
case 3:
|
||||
|
|
@ -2649,6 +2654,9 @@ static void MDFaceDraw(HsfObject *arg0, HsfFace *arg1) {
|
|||
GXTexCoord1x16(arg1->indices[1][3]);
|
||||
}
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
GXEnd();
|
||||
#endif
|
||||
faceCnt = faceNumBuf[drawCnt] / 4;
|
||||
break;
|
||||
case 4:
|
||||
|
|
@ -2720,6 +2728,9 @@ static void MDFaceDraw(HsfObject *arg0, HsfFace *arg1) {
|
|||
GXTexCoord1x16(var_r24[3]);
|
||||
}
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
GXEnd();
|
||||
#endif
|
||||
faceCnt = arg1->strip.count + 1;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,11 @@
|
|||
#include "game/hsfdraw.h"
|
||||
#include "game/hsfman.h"
|
||||
#include "game/object.h"
|
||||
#include <game/sprite.h>
|
||||
#include "game/pad.h"
|
||||
#include "game/printfunc.h"
|
||||
|
||||
|
||||
#define OM_OVL_HIS_MAX 16
|
||||
#define OM_MAX_GROUPS 10
|
||||
|
||||
|
|
|
|||
|
|
@ -109,47 +109,47 @@ template <typename B, typename T> T *offset_ptr(B &base, T *ptr, void *extra)
|
|||
return reinterpret_cast<T *>(reinterpret_cast<uintptr_t>(&base) + reinterpret_cast<uintptr_t>(ptr) + reinterpret_cast<uintptr_t>(extra));
|
||||
}
|
||||
|
||||
template <typename B, typename T> static inline void bswap(B &base, T &data);
|
||||
template <typename B, typename P> void bswap(B &base, P *&ptr)
|
||||
{
|
||||
ptr = bswap32(ptr);
|
||||
}
|
||||
template <typename B, typename T> void bswap(B &base, T *&ptr, s32 count)
|
||||
{
|
||||
ptr = bswap32(ptr);
|
||||
if (ptr == nullptr) {
|
||||
return;
|
||||
}
|
||||
T *objBase = offset_ptr(base, ptr);
|
||||
for (s32 i = 0; i < count; ++i) {
|
||||
if (sVisitedPtrs.contains(objBase)) {
|
||||
continue;
|
||||
}
|
||||
sVisitedPtrs.insert(objBase);
|
||||
bswap(base, *objBase);
|
||||
++objBase;
|
||||
}
|
||||
}
|
||||
template <typename B, typename T> void bswap_list(B &base, T **&ptr)
|
||||
{
|
||||
ptr = bswap32(ptr);
|
||||
if (ptr == nullptr) {
|
||||
return;
|
||||
}
|
||||
T **objBase = offset_ptr(base, ptr);
|
||||
while (*objBase != nullptr) {
|
||||
bswap(base, *objBase, 1);
|
||||
++objBase;
|
||||
}
|
||||
}
|
||||
template <typename B, typename T> void bswap_list(B &base, T *(&ptr)[])
|
||||
{
|
||||
T **objBase = ptr;
|
||||
while (*objBase != nullptr) {
|
||||
bswap(base, *objBase, 1);
|
||||
++objBase;
|
||||
}
|
||||
}
|
||||
// template <typename B, typename T> static inline void bswap(B &base, T &data);
|
||||
// template <typename B, typename P> void bswap(B &base, P *&ptr)
|
||||
// {
|
||||
// ptr = bswap32(ptr);
|
||||
// }
|
||||
// template <typename B, typename T> void bswap(B &base, T *&ptr, s32 count)
|
||||
// {
|
||||
// ptr = bswap32(ptr);
|
||||
// if (ptr == nullptr) {
|
||||
// return;
|
||||
// }
|
||||
// T *objBase = offset_ptr(base, ptr);
|
||||
// for (s32 i = 0; i < count; ++i) {
|
||||
// if (sVisitedPtrs.contains(objBase)) {
|
||||
// continue;
|
||||
// }
|
||||
// sVisitedPtrs.insert(objBase);
|
||||
// bswap(base, *objBase);
|
||||
// ++objBase;
|
||||
// }
|
||||
// }
|
||||
// template <typename B, typename T> void bswap_list(B &base, T **&ptr)
|
||||
// {
|
||||
// ptr = bswap32(ptr);
|
||||
// if (ptr == nullptr) {
|
||||
// return;
|
||||
// }
|
||||
// T **objBase = offset_ptr(base, ptr);
|
||||
// while (*objBase != nullptr) {
|
||||
// bswap(base, *objBase, 1);
|
||||
// ++objBase;
|
||||
// }
|
||||
// }
|
||||
// template <typename B, typename T> void bswap_list(B &base, T *(&ptr)[])
|
||||
// {
|
||||
// T **objBase = ptr;
|
||||
// while (*objBase != nullptr) {
|
||||
// bswap(base, *objBase, 1);
|
||||
// ++objBase;
|
||||
// }
|
||||
// }
|
||||
template <typename B, typename T> void bswap_flat(B &base, T *start, s32 count)
|
||||
{
|
||||
T *objBase = start;
|
||||
|
|
@ -228,9 +228,9 @@ template <typename B> void bswap(B &base, AnimData32b &obj, AnimData &dest)
|
|||
dest.patNum = obj.patNum;
|
||||
dest.bmpNum = obj.bmpNum;
|
||||
dest.useNum = obj.useNum;
|
||||
dest.bank = reinterpret_cast<AnimBankData *>(obj.bank);
|
||||
dest.pat = reinterpret_cast<AnimPatData *>(obj.pat);
|
||||
dest.bmp = reinterpret_cast<AnimBmpData *>(obj.bmp);
|
||||
dest.bank = reinterpret_cast<AnimBankData *>(static_cast<uintptr_t>(obj.bank));
|
||||
dest.pat = reinterpret_cast<AnimPatData *>(static_cast<uintptr_t>(obj.pat));
|
||||
dest.bmp = reinterpret_cast<AnimBmpData *>(static_cast<uintptr_t>(obj.bmp));
|
||||
}
|
||||
|
||||
template <typename B> void bswap(B &base, AnimBankData32b &obj, AnimBankData &dest)
|
||||
|
|
@ -241,7 +241,7 @@ template <typename B> void bswap(B &base, AnimBankData32b &obj, AnimBankData &de
|
|||
|
||||
dest.timeNum = obj.timeNum;
|
||||
dest.unk = obj.unk;
|
||||
dest.frame = reinterpret_cast<AnimFrameData *>(obj.frame);
|
||||
dest.frame = reinterpret_cast<AnimFrameData *>(static_cast<uintptr_t>(obj.frame));
|
||||
}
|
||||
|
||||
template <typename B> void bswap(B &base, AnimPatData32b &obj, AnimPatData &dest)
|
||||
|
|
@ -258,7 +258,7 @@ template <typename B> void bswap(B &base, AnimPatData32b &obj, AnimPatData &dest
|
|||
dest.centerY = obj.centerY;
|
||||
dest.sizeX = obj.sizeX;
|
||||
dest.sizeY = obj.sizeY;
|
||||
dest.layer = reinterpret_cast<AnimLayerData *>(obj.layer);
|
||||
dest.layer = reinterpret_cast<AnimLayerData *>(static_cast<uintptr_t>(obj.layer));
|
||||
}
|
||||
|
||||
template <typename B> void bswap(B &base, AnimBmpData32b &obj, AnimBmpData &dest)
|
||||
|
|
@ -278,8 +278,8 @@ template <typename B> void bswap(B &base, AnimBmpData32b &obj, AnimBmpData &dest
|
|||
dest.sizeX = obj.sizeX;
|
||||
dest.sizeY = obj.sizeY;
|
||||
dest.dataSize = obj.dataSize;
|
||||
dest.palData = reinterpret_cast<void *>(obj.palData);
|
||||
dest.data = reinterpret_cast<void *>(obj.data);
|
||||
dest.palData = reinterpret_cast<void *>(static_cast<uintptr_t>(obj.palData));
|
||||
dest.data = reinterpret_cast<void *>(static_cast<uintptr_t>(obj.data));
|
||||
}
|
||||
|
||||
template <typename B> void bswap(B &base, AnimFrameData &obj)
|
||||
|
|
@ -349,10 +349,10 @@ template <typename B> void bswap(B &base, HsfCluster32b &obj, HsfCluster &dest)
|
|||
bswap(base, obj.vertexCnt);
|
||||
bswap(base, obj.vertex);
|
||||
|
||||
dest.name[0] = reinterpret_cast<char *>(obj.name[0]);
|
||||
dest.name[1] = reinterpret_cast<char *>(obj.name[1]);
|
||||
dest.name[0] = reinterpret_cast<char *>(static_cast<uintptr_t>(obj.name[0]));
|
||||
dest.name[1] = reinterpret_cast<char *>(static_cast<uintptr_t>(obj.name[1]));
|
||||
|
||||
dest.targetName = reinterpret_cast<char *>(obj.targetName);
|
||||
dest.targetName = reinterpret_cast<char *>(static_cast<uintptr_t>(obj.targetName));
|
||||
dest.index = obj.index;
|
||||
std::copy(std::begin(obj.weight), std::end(obj.weight), dest.weight);
|
||||
|
||||
|
|
@ -360,7 +360,7 @@ template <typename B> void bswap(B &base, HsfCluster32b &obj, HsfCluster &dest)
|
|||
dest.unk95 = obj.unk95;
|
||||
dest.type = obj.type;
|
||||
dest.vertexCnt = obj.vertexCnt;
|
||||
dest.vertex = reinterpret_cast<HsfBuffer **>(obj.vertex);
|
||||
dest.vertex = reinterpret_cast<HsfBuffer **>(static_cast<uintptr_t>(obj.vertex));
|
||||
}
|
||||
|
||||
template <typename B> void bswap(B &base, HsfAttribute32b &obj, HsfAttribute &dest)
|
||||
|
|
@ -380,8 +380,8 @@ template <typename B> void bswap(B &base, HsfAttribute32b &obj, HsfAttribute &de
|
|||
bswap(base, obj.flag);
|
||||
bswap(base, obj.bitmap);
|
||||
|
||||
dest.name = reinterpret_cast<char *>(obj.name);
|
||||
dest.unk04 = reinterpret_cast<struct hsfdraw_struct_01 *>(obj.unk04);
|
||||
dest.name = reinterpret_cast<char *>(static_cast<uintptr_t>(obj.name));
|
||||
dest.unk04 = reinterpret_cast<struct hsfdraw_struct_01 *>(static_cast<uintptr_t>(obj.unk04));
|
||||
std::copy(std::begin(obj.unk8), std::end(obj.unk8), dest.unk8);
|
||||
dest.unk0C = obj.unk0C;
|
||||
std::copy(std::begin(obj.unk10), std::end(obj.unk10), dest.unk10);
|
||||
|
|
@ -399,7 +399,7 @@ template <typename B> void bswap(B &base, HsfAttribute32b &obj, HsfAttribute &de
|
|||
std::copy(std::begin(obj.unk6C), std::end(obj.unk6C), dest.unk6C);
|
||||
dest.unk78 = obj.unk78;
|
||||
dest.flag = obj.flag;
|
||||
dest.bitmap = reinterpret_cast<HsfBitmap *>(obj.bitmap);
|
||||
dest.bitmap = reinterpret_cast<HsfBitmap *>(static_cast<uintptr_t>(obj.bitmap));
|
||||
}
|
||||
|
||||
template <typename B> void bswap(B &base, HsfMaterial32b &obj, HsfMaterial &dest)
|
||||
|
|
@ -416,7 +416,7 @@ template <typename B> void bswap(B &base, HsfMaterial32b &obj, HsfMaterial &dest
|
|||
bswap(base, obj.numAttrs);
|
||||
bswap(base, obj.attrs);
|
||||
|
||||
dest.name = reinterpret_cast<char *>(obj.name);
|
||||
dest.name = reinterpret_cast<char *>(static_cast<uintptr_t>(obj.name));
|
||||
std::copy(std::begin(obj.unk4), std::end(obj.unk4), dest.unk4);
|
||||
dest.pass = obj.pass;
|
||||
dest.vtxMode = obj.vtxMode;
|
||||
|
|
@ -431,7 +431,7 @@ template <typename B> void bswap(B &base, HsfMaterial32b &obj, HsfMaterial &dest
|
|||
dest.unk2C = obj.unk2C;
|
||||
dest.flags = obj.flags;
|
||||
dest.numAttrs = obj.numAttrs;
|
||||
dest.attrs = reinterpret_cast<s32 *>(obj.attrs);
|
||||
dest.attrs = reinterpret_cast<s32 *>(static_cast<uintptr_t>(obj.attrs));
|
||||
}
|
||||
|
||||
template <typename B> void bswap(B &base, HsfScene &obj)
|
||||
|
|
@ -449,9 +449,9 @@ template <typename B> void bswap(B &base, HsfBuffer32b &obj, HsfBuffer &dest)
|
|||
bswap(base, obj.count);
|
||||
bswap(base, obj.data);
|
||||
|
||||
dest.name = reinterpret_cast<char *>(obj.name);
|
||||
dest.name = reinterpret_cast<char *>(static_cast<uintptr_t>(obj.name));
|
||||
dest.count = obj.count;
|
||||
dest.data = reinterpret_cast<void *>(obj.data);
|
||||
dest.data = reinterpret_cast<void *>(static_cast<uintptr_t>(obj.data));
|
||||
}
|
||||
|
||||
template <typename B> void bswap(B &base, HsfMatrix &obj)
|
||||
|
|
@ -459,7 +459,7 @@ template <typename B> void bswap(B &base, HsfMatrix &obj)
|
|||
bswap(base, obj.base_idx);
|
||||
bswap(base, obj.count);
|
||||
|
||||
obj.data = (Mtx *)((uintptr_t)&obj + sizeof(0xC)); // hardcoded for 64 bit support
|
||||
obj.data = reinterpret_cast<Mtx *>(reinterpret_cast<uintptr_t>(&obj) + 0xC); // hardcoded for 64 bit support
|
||||
for (s32 i = 0; i < obj.count; i++) {
|
||||
for (s32 j = 0; j < 3; j++) {
|
||||
bswap_flat(base, obj.data[i][j], 4);
|
||||
|
|
@ -474,10 +474,10 @@ template <typename B> void bswap(B &base, HsfPalette32b &obj, HsfPalette &dest)
|
|||
bswap(base, obj.palSize);
|
||||
bswap(base, obj.data);
|
||||
|
||||
dest.name = reinterpret_cast<char *>(obj.name);
|
||||
dest.name = reinterpret_cast<char *>(static_cast<uintptr_t>(obj.name));
|
||||
dest.unk = obj.unk;
|
||||
dest.palSize = obj.palSize;
|
||||
dest.data = reinterpret_cast<u16 *>(obj.data);
|
||||
dest.data = reinterpret_cast<u16 *>(static_cast<uintptr_t>(obj.data));
|
||||
}
|
||||
|
||||
template <typename B> void bswap(B &base, HsfPart32b &obj, HsfPart &dest)
|
||||
|
|
@ -486,9 +486,9 @@ template <typename B> void bswap(B &base, HsfPart32b &obj, HsfPart &dest)
|
|||
bswap(base, obj.count);
|
||||
bswap(base, obj.vertex);
|
||||
|
||||
dest.name = reinterpret_cast<char *>(obj.name);
|
||||
dest.name = reinterpret_cast<char *>(static_cast<uintptr_t>(obj.name));
|
||||
dest.count = obj.count;
|
||||
dest.vertex = reinterpret_cast<u16 *>(obj.vertex);
|
||||
dest.vertex = reinterpret_cast<u16 *>(static_cast<uintptr_t>(obj.vertex));
|
||||
}
|
||||
|
||||
template <typename B> void bswap(B &base, HsfBitmap32b &obj, HsfBitmap &dest)
|
||||
|
|
@ -502,7 +502,7 @@ template <typename B> void bswap(B &base, HsfBitmap32b &obj, HsfBitmap &dest)
|
|||
bswap(base, obj.unk);
|
||||
bswap(base, obj.data);
|
||||
|
||||
dest.name = reinterpret_cast<char *>(obj.name);
|
||||
dest.name = reinterpret_cast<char *>(static_cast<uintptr_t>(obj.name));
|
||||
dest.maxLod = obj.maxLod;
|
||||
dest.dataFmt = obj.dataFmt;
|
||||
dest.pixSize = obj.pixSize;
|
||||
|
|
@ -510,9 +510,9 @@ template <typename B> void bswap(B &base, HsfBitmap32b &obj, HsfBitmap &dest)
|
|||
dest.sizeY = obj.sizeY;
|
||||
dest.palSize = obj.palSize;
|
||||
dest.tint = obj.tint;
|
||||
dest.palData = reinterpret_cast<void *>(obj.palData);
|
||||
dest.palData = reinterpret_cast<void *>(static_cast<uintptr_t>(obj.palData));
|
||||
dest.unk = obj.unk;
|
||||
dest.data = reinterpret_cast<void *>(obj.data);
|
||||
dest.data = reinterpret_cast<void *>(static_cast<uintptr_t>(obj.data));
|
||||
}
|
||||
|
||||
template <typename B> void bswap(B &base, HsfMapAttr32b &obj, HsfMapAttr &dest)
|
||||
|
|
@ -527,7 +527,7 @@ template <typename B> void bswap(B &base, HsfMapAttr32b &obj, HsfMapAttr &dest)
|
|||
dest.minX = obj.minX;
|
||||
dest.minZ = obj.minZ;
|
||||
dest.maxX = obj.maxZ;
|
||||
dest.data = reinterpret_cast<u16 *>(obj.data);
|
||||
dest.data = reinterpret_cast<u16 *>(static_cast<uintptr_t>(obj.data));
|
||||
dest.dataLen = obj.dataLen;
|
||||
}
|
||||
|
||||
|
|
@ -543,7 +543,7 @@ template <typename B> void bswap(B &base, HsfSkeleton32b &obj, HsfSkeleton &dest
|
|||
bswap(base, obj.name);
|
||||
bswap(base, obj.transform);
|
||||
|
||||
dest.name = reinterpret_cast<char *>(obj.name);
|
||||
dest.name = reinterpret_cast<char *>(static_cast<uintptr_t>(obj.name));
|
||||
dest.transform = obj.transform;
|
||||
}
|
||||
|
||||
|
|
@ -552,8 +552,8 @@ template <typename B> void bswap(B &base, HsfShape32b &obj, HsfShape &dest)
|
|||
bswap(base, obj.name);
|
||||
bswap(base, obj.vertex);
|
||||
|
||||
dest.name = reinterpret_cast<char *>(obj.name);
|
||||
dest.vertex = reinterpret_cast<HsfBuffer **>(obj.vertex);
|
||||
dest.name = reinterpret_cast<char *>(static_cast<uintptr_t>(obj.name));
|
||||
dest.vertex = reinterpret_cast<HsfBuffer **>(static_cast<uintptr_t>(obj.vertex));
|
||||
}
|
||||
|
||||
template <typename B> void bswap(B &base, HsfCenvSingle &obj)
|
||||
|
|
@ -577,10 +577,10 @@ template <typename B> void bswap(B &base, HsfCenv32b &obj, HsfCenv &dest)
|
|||
bswap(base, obj.vtxCount);
|
||||
bswap(base, obj.copyCount);
|
||||
|
||||
dest.name = reinterpret_cast<char *>(obj.name);
|
||||
dest.singleData = reinterpret_cast<HsfCenvSingle *>(obj.singleData);
|
||||
dest.dualData = reinterpret_cast<HsfCenvDual *>(obj.dualData);
|
||||
dest.multiData = reinterpret_cast<HsfCenvMulti *>(obj.multiData);
|
||||
dest.name = reinterpret_cast<char *>(static_cast<uintptr_t>(obj.name));
|
||||
dest.singleData = reinterpret_cast<HsfCenvSingle *>(static_cast<uintptr_t>(obj.singleData));
|
||||
dest.dualData = reinterpret_cast<HsfCenvDual *>(static_cast<uintptr_t>(obj.dualData));
|
||||
dest.multiData = reinterpret_cast<HsfCenvMulti *>(static_cast<uintptr_t>(obj.multiData));
|
||||
dest.singleCount = obj.singleCount;
|
||||
dest.dualCount = obj.dualCount;
|
||||
dest.multiCount = obj.multiCount;
|
||||
|
|
@ -610,29 +610,29 @@ template <typename B> void bswap(B &base, HsfObjectData32b &obj, HsfObjectData &
|
|||
bswap(base, obj.cenv);
|
||||
bswap_flat(base, obj.file, sizeof(obj.file) / sizeof(u32));
|
||||
|
||||
dest.parent = reinterpret_cast<struct hsf_object *>(obj.parent);
|
||||
dest.parent = reinterpret_cast<struct hsf_object *>(static_cast<uintptr_t>(obj.parent));
|
||||
dest.childrenCount = obj.childrenCount;
|
||||
dest.children = reinterpret_cast<struct hsf_object **>(obj.children);
|
||||
dest.children = reinterpret_cast<struct hsf_object **>(static_cast<uintptr_t>(obj.children));
|
||||
dest.base = obj.base;
|
||||
dest.curr = obj.curr;
|
||||
dest.face = reinterpret_cast<HsfBuffer *>(obj.face);
|
||||
dest.vertex = reinterpret_cast<HsfBuffer *>(obj.vertex);
|
||||
dest.normal = reinterpret_cast<HsfBuffer *>(obj.normal);
|
||||
dest.color = reinterpret_cast<HsfBuffer *>(obj.color);
|
||||
dest.st = reinterpret_cast<HsfBuffer *>(obj.st);
|
||||
dest.material = reinterpret_cast<HsfMaterial *>(obj.material);
|
||||
dest.attribute = reinterpret_cast<HsfAttribute *>(obj.attribute);
|
||||
dest.face = reinterpret_cast<HsfBuffer *>(static_cast<uintptr_t>(obj.face));
|
||||
dest.vertex = reinterpret_cast<HsfBuffer *>(static_cast<uintptr_t>(obj.vertex));
|
||||
dest.normal = reinterpret_cast<HsfBuffer *>(static_cast<uintptr_t>(obj.normal));
|
||||
dest.color = reinterpret_cast<HsfBuffer *>(static_cast<uintptr_t>(obj.color));
|
||||
dest.st = reinterpret_cast<HsfBuffer *>(static_cast<uintptr_t>(obj.st));
|
||||
dest.material = reinterpret_cast<HsfMaterial *>(static_cast<uintptr_t>(obj.material));
|
||||
dest.attribute = reinterpret_cast<HsfAttribute *>(static_cast<uintptr_t>(obj.attribute));
|
||||
std::copy(std::begin(obj.unk120), std::end(obj.unk120), dest.unk120);
|
||||
dest.shapeType = obj.shapeType;
|
||||
dest.unk123 = obj.unk123;
|
||||
dest.vertexShapeCnt = obj.vertexShapeCnt;
|
||||
dest.vertexShape = reinterpret_cast<HsfBuffer **>(obj.vertexShape);
|
||||
dest.vertexShape = reinterpret_cast<HsfBuffer **>(static_cast<uintptr_t>(obj.vertexShape));
|
||||
dest.clusterCnt = obj.clusterCnt;
|
||||
dest.cluster = reinterpret_cast<HsfCluster **>(obj.cluster);
|
||||
dest.cluster = reinterpret_cast<HsfCluster **>(static_cast<uintptr_t>(obj.cluster));
|
||||
dest.cenvCnt = obj.cenvCnt;
|
||||
dest.cenv = reinterpret_cast<HsfCenv *>(obj.cenv);
|
||||
dest.file[0] = reinterpret_cast<void *>(obj.file[0]);
|
||||
dest.file[1] = reinterpret_cast<void *>(obj.file[1]);
|
||||
dest.cenv = reinterpret_cast<HsfCenv *>(static_cast<uintptr_t>(obj.cenv));
|
||||
dest.file[0] = reinterpret_cast<void *>(static_cast<uintptr_t>(obj.file[0]));
|
||||
dest.file[1] = reinterpret_cast<void *>(static_cast<uintptr_t>(obj.file[1]));
|
||||
|
||||
switch (type) {
|
||||
case HSF_OBJ_MESH:
|
||||
|
|
@ -649,7 +649,7 @@ template <typename B> void bswap(B &base, HsfObjectData32b &obj, HsfObjectData &
|
|||
case HSF_OBJ_REPLICA:
|
||||
bswap(base, obj.replica);
|
||||
|
||||
dest.replica = obj.replica;
|
||||
dest.replica = reinterpret_cast<struct hsf_object *>(static_cast<uintptr_t>(obj.replica));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -663,9 +663,9 @@ template <typename B> void bswap(B &base, HsfObject32b &obj, HsfObject &dest)
|
|||
bswap(base, obj.constData);
|
||||
bswap(base, obj.flags);
|
||||
|
||||
dest.name = reinterpret_cast<char *>(obj.name);
|
||||
dest.name = reinterpret_cast<char *>(static_cast<uintptr_t>(obj.name));
|
||||
dest.type = obj.type;
|
||||
dest.constData = reinterpret_cast<void *>(obj.constData);
|
||||
dest.constData = reinterpret_cast<void *>(static_cast<uintptr_t>(obj.constData));
|
||||
dest.flags = obj.flags;
|
||||
|
||||
bswap(base, obj.data, dest.data, obj.type);
|
||||
|
|
@ -677,7 +677,7 @@ template <typename B> void bswap(B &base, HsfBitmapKey32b &obj, HsfBitmapKey &de
|
|||
bswap(base, obj.data);
|
||||
|
||||
dest.time = obj.time;
|
||||
dest.data = reinterpret_cast<HsfBitmap *>(obj.data);
|
||||
dest.data = reinterpret_cast<HsfBitmap *>(static_cast<uintptr_t>(obj.data));
|
||||
}
|
||||
|
||||
template <typename B> void bswap(B &base, HsfTrack32b &obj, HsfTrack &dest)
|
||||
|
|
@ -686,17 +686,23 @@ template <typename B> void bswap(B &base, HsfTrack32b &obj, HsfTrack &dest)
|
|||
bswap(base, obj.start);
|
||||
bswap(base, obj.curveType);
|
||||
bswap(base, obj.numKeyframes);
|
||||
bswap(base, obj.data); // this byteswaps "value" too
|
||||
|
||||
dest.type = obj.type;
|
||||
dest.start = obj.start;
|
||||
dest.curveType = obj.curveType;
|
||||
dest.numKeyframes = obj.numKeyframes;
|
||||
dest.data = reinterpret_cast<void *>(obj.data); // this correctly sets "value" too
|
||||
|
||||
if (obj.type = HSF_TRACK_CLUSTER_WEIGHT) {
|
||||
if (obj.curveType == HSF_CURVE_CONST) {
|
||||
bswap(base, obj.value);
|
||||
dest.value = obj.value;
|
||||
}
|
||||
else {
|
||||
bswap(base, obj.data);
|
||||
dest.data = reinterpret_cast<void *>(static_cast<uintptr_t>(obj.data));
|
||||
}
|
||||
|
||||
if (obj.type == HSF_TRACK_CLUSTER_WEIGHT) {
|
||||
bswap(base, obj.unk04);
|
||||
|
||||
dest.unk04 = obj.unk04;
|
||||
}
|
||||
else {
|
||||
|
|
@ -715,9 +721,9 @@ template <typename B> void bswap(B &base, HsfMotion32b &obj, HsfMotion &dest)
|
|||
bswap(base, obj.track);
|
||||
bswap(base, obj.len);
|
||||
|
||||
dest.name = reinterpret_cast<char *>(obj.name);
|
||||
dest.name = reinterpret_cast<char *>(static_cast<uintptr_t>(obj.name));
|
||||
dest.numTracks = obj.numTracks;
|
||||
dest.track = reinterpret_cast<HsfTrack *>(obj.track);
|
||||
dest.track = reinterpret_cast<HsfTrack *>(static_cast<uintptr_t>(obj.track));
|
||||
dest.len = obj.len;
|
||||
}
|
||||
|
||||
|
|
@ -737,7 +743,7 @@ template <typename B> void bswap(B &base, HsfFace32b &obj, HsfFace &dest)
|
|||
bswap_flat(base, obj.strip.indices[0], 3 * 4);
|
||||
|
||||
dest.strip.count = obj.strip.count;
|
||||
dest.strip.data = reinterpret_cast<s16 *>(obj.strip.data);
|
||||
dest.strip.data = reinterpret_cast<s16 *>(static_cast<uintptr_t>(obj.strip.data));
|
||||
std::copy(&obj.strip.indices[0][0], &obj.strip.indices[0][0] + 3 * 4, &dest.strip.indices[0][0]);
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -629,7 +629,7 @@ void GXSetTexCoordScaleManually(GXTexCoordID coord, u8 enable, u16 ss, u16 ts)
|
|||
|
||||
void GXResetWriteGatherPipe(void)
|
||||
{
|
||||
puts("GXResetWriteGatherPipe is a stub");
|
||||
// puts("GXResetWriteGatherPipe is a stub");
|
||||
}
|
||||
|
||||
void ARQInit(void) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue