Finish hsfload besides cenv

This commit is contained in:
dbalatoni13 2025-04-10 18:33:23 +02:00
parent 319eb2076c
commit 1e51c0f60d
9 changed files with 20 additions and 27 deletions

View file

@ -57,7 +57,7 @@ void Hu3DDrawPreInit(void);
void Hu3DDraw(ModelData *arg0, Mtx arg1, Vec *arg2);
s32 ObjCullCheck(HsfData *arg0, HsfObject *arg1, Mtx arg2);
void Hu3DDrawPost(void);
void MakeDisplayList(s16 arg0, u32 arg1);
void MakeDisplayList(s16 arg0, uintptr_t arg1);
HsfConstData *ObjConstantMake(HsfObject *arg0, u32 arg1);
void mtxTransCat(Mtx arg0, float arg1, float arg2, float arg3);
void mtxRotCat(Mtx arg0, float arg1, float arg2, float arg3);

View file

@ -19,9 +19,9 @@ void *HuMemInit(void *ptr, s32 size);
void HuMemDCFlushAll();
void HuMemDCFlush(HeapID heap);
void *HuMemDirectMalloc(HeapID heap, s32 size);
void *HuMemDirectMallocNum(HeapID heap, s32 size, u32 num);
void *HuMemDirectMallocNum(HeapID heap, s32 size, uintptr_t num);
void HuMemDirectFree(void *ptr);
void HuMemDirectFreeNum(HeapID heap, u32 num);
void HuMemDirectFreeNum(HeapID heap, uintptr_t num);
s32 HuMemUsedMallocSizeGet(HeapID heap);
s32 HuMemUsedMallocBlockGet(HeapID heap);
u32 HuMemHeapSizeGet(HeapID heap);
@ -29,9 +29,9 @@ void *HuMemHeapPtrGet(HeapID heap);
void *HuMemHeapInit(void *ptr, s32 size);
void *HuMemMemoryAlloc(void *heap_ptr, s32 size, uintptr_t retaddr);
void *HuMemMemoryAllocNum(void *heap_ptr, s32 size, u32 num, uintptr_t retaddr);
void *HuMemMemoryAllocNum(void *heap_ptr, s32 size, uintptr_t num, uintptr_t retaddr);
void HuMemMemoryFree(void *ptr, uintptr_t retaddr);
void HuMemMemoryFreeNum(void *heap_ptr, u32 num, uintptr_t retaddr);
void HuMemMemoryFreeNum(void *heap_ptr, uintptr_t num, uintptr_t retaddr);
s32 HuMemUsedMemorySizeGet(void *heap_ptr);
s32 HuMemUsedMemoryBlockGet(void *heap_ptr);
s32 HuMemMemorySizeGet(void *ptr);

View file

@ -566,8 +566,6 @@ void ObjectSetup(void)
AnimData *sprite_data;
s16 i;
titleMdlId[0] = model = Hu3DModelCreateFile(TITLE_CHAR_HSF);
#ifdef __MWERKS__
// TODO PC
Hu3DModelAttrSet(model, HU3D_ATTR_DISPOFF);
Hu3DModelAttrSet(model, HU3D_MOTATTR_LOOP);
titleMdlId[1] = model = Hu3DModelCreateFile(TITLE_CUBE_HSF);
@ -578,7 +576,6 @@ void ObjectSetup(void)
Hu3DModelAttrSet(model, HU3D_MOTATTR_LOOP);
Hu3DModelCameraInfoSet(model, 1);
Hu3DModelLightInfoSet(model, 1);
#endif
#if VERSION_NTSC
bootGrpId = HuSprGrpCreate(4);
#else
@ -640,11 +637,8 @@ void ObjectSetup(void)
s16 choice;
float temp;
repeat:
#ifdef __MWERKS__
// TODO PC
Hu3DModelAttrReset(titleMdlId[0], HU3D_ATTR_DISPOFF);
Hu3DModelAttrReset(titleMdlId[1], HU3D_ATTR_DISPOFF);
#endif
HuSprAttrReset(bootGrpId, 0, HUSPR_ATTR_DISPOFF);
HuSprAttrReset(bootGrpId, 1, HUSPR_ATTR_DISPOFF);
#ifdef __MWERKS__
@ -796,12 +790,9 @@ void ObjectSetup(void)
while (WipeStatGet()) {
HuPrcVSleep();
}
#ifdef __MWERKS__
// TODO PC
Hu3DModelAttrSet(titleMdlId[0], HU3D_ATTR_DISPOFF);
Hu3DModelAttrSet(titleMdlId[1], HU3D_ATTR_DISPOFF);
Hu3DModelAttrSet(titleMdlId[2], HU3D_ATTR_DISPOFF);
#endif
#if VERSION_NTSC
HuSprAttrSet(bootGrpId, 0, HUSPR_ATTR_DISPOFF);
HuSprAttrSet(bootGrpId, 1, HUSPR_ATTR_DISPOFF);

View file

@ -89,7 +89,7 @@ static u16 faceCnt;
static u16 *faceNumBuf;
static s32 DLTotalNum;
static u32 totalSize;
static u32 mallocNo;
static uintptr_t mallocNo;
static s32 curModelID;
static s16 polySize;
static s32 PGFinishF;
@ -2367,7 +2367,7 @@ static void ObjDraw(HsfDrawObject *arg0) {
}
}
void MakeDisplayList(s16 arg0, u32 arg1) {
void MakeDisplayList(s16 arg0, uintptr_t arg1) {
HsfData *temp_r31;
ModelData *var_r30;

View file

@ -138,7 +138,9 @@ static void FileLoad(void *data)
byteswap_hsfheader(&head);
NSymIndex = HuMemDirectMallocNum(HEAP_DATA, sizeof(void*) * head.symbol.count, MEMORY_DEFAULT_NUM);
for (i = 0; i < head.symbol.count; i++) {
byteswap_u32(&((void **)((uintptr_t)fileptr + head.symbol.ofs))[i]);
u32 *file_symbol_real = (u32 *)((uintptr_t)fileptr + head.symbol.ofs);
byteswap_u32(&file_symbol_real[i]);
NSymIndex[i] = (void *)file_symbol_real[i];
}
StringTable = (char *)((uintptr_t)fileptr+head.string.ofs);
ClusterTop = HuMemDirectMallocNum(HEAP_DATA, sizeof(HsfCluster) * head.cluster.count, MEMORY_DEFAULT_NUM);

View file

@ -43,7 +43,7 @@ s32 shadowModelDrawF;
s16 Hu3DProjectionNum;
s16 Hu3DCameraNo;
s16 Hu3DCameraBit;
u32 Hu3DMallocNo;
uintptr_t Hu3DMallocNo;
s16 Hu3DPauseF;
u16 Hu3DCameraExistF;
static u16 NoSyncF;
@ -350,7 +350,7 @@ s16 Hu3DModelCreate(void *arg0) {
return -1;
}
var_r31->hsfData = LoadHSF(arg0);
var_r31->unk_48 = Hu3DMallocNo = (u32)var_r31->hsfData;
var_r31->unk_48 = Hu3DMallocNo = (uintptr_t)var_r31->hsfData;
var_r31->attr = HU3D_ATTR_NONE;
var_r31->motion_attr = HU3D_ATTR_NONE;
var_r31->unk_02 = 0;

View file

@ -59,7 +59,7 @@ void *HuMemDirectMalloc(HeapID heap, s32 size)
return HuMemMemoryAlloc(HeapTbl[heap], size, retaddr);
}
void *HuMemDirectMallocNum(HeapID heap, s32 size, u32 num)
void *HuMemDirectMallocNum(HeapID heap, s32 size, uintptr_t num)
{
#ifdef TARGET_PC
u32 retaddr = 0;
@ -86,7 +86,7 @@ void HuMemDirectFree(void *ptr)
HuMemMemoryFree(ptr, retaddr);
}
void HuMemDirectFreeNum(HeapID heap, u32 num)
void HuMemDirectFreeNum(HeapID heap, uintptr_t num)
{
#ifdef TARGET_PC
u32 retaddr = 0;

View file

@ -12,11 +12,11 @@ struct memory_block {
u8 flag;
struct memory_block *prev;
struct memory_block *next;
u32 num;
uintptr_t num;
uintptr_t retaddr;
};
static void *HuMemMemoryAlloc2(void *heap_ptr, s32 size, u32 num, uintptr_t retaddr);
static void *HuMemMemoryAlloc2(void *heap_ptr, s32 size, uintptr_t num, uintptr_t retaddr);
void *HuMemHeapInit(void *ptr, s32 size)
{
@ -31,7 +31,7 @@ void *HuMemHeapInit(void *ptr, s32 size)
return block;
}
void *HuMemMemoryAllocNum(void *heap_ptr, s32 size, u32 num, uintptr_t retaddr)
void *HuMemMemoryAllocNum(void *heap_ptr, s32 size, uintptr_t num, uintptr_t retaddr)
{
return HuMemMemoryAlloc2(heap_ptr, size, num, retaddr);
}
@ -41,7 +41,7 @@ void *HuMemMemoryAlloc(void *heap_ptr, s32 size, uintptr_t retaddr)
return HuMemMemoryAlloc2(heap_ptr, size, -256, retaddr);
}
static void *HuMemMemoryAlloc2(void *heap_ptr, s32 size, u32 num, uintptr_t retaddr)
static void *HuMemMemoryAlloc2(void *heap_ptr, s32 size, uintptr_t num, uintptr_t retaddr)
{
s32 alloc_size = MEM_ALLOC_SIZE(size);
struct memory_block *block = heap_ptr;
@ -76,7 +76,7 @@ static void *HuMemMemoryAlloc2(void *heap_ptr, s32 size, u32 num, uintptr_t reta
return NULL;
}
void HuMemMemoryFreeNum(void *heap_ptr, u32 num, uintptr_t retaddr)
void HuMemMemoryFreeNum(void *heap_ptr, uintptr_t num, uintptr_t retaddr)
{
struct memory_block *block = heap_ptr;
do {

View file

@ -603,7 +603,7 @@ GXDrawSyncCallback GXSetDrawSyncCallback(GXDrawSyncCallback cb)
void PPCSync(void)
{
puts("PPCSync is a stub");
//puts("PPCSync is a stub");
}
void GXUnknownu16(const u16 x)