Fixed many bugs (#586)
* Fixed some includes * Fix allocation bugs * More fixes and trying to get 3D rendering done * Fixed many bugs
This commit is contained in:
parent
59c19c8046
commit
b05b70d6b7
26 changed files with 167 additions and 96 deletions
|
|
@ -158,6 +158,10 @@ if (MSVC)
|
|||
set_source_files_properties(extern/longjmp_win64/longjmp_win64.asm PROPERTIES LANGUAGE ASM_MASM)
|
||||
endif ()
|
||||
target_link_options(dol PRIVATE "/DEF:${CMAKE_SOURCE_DIR}/dol.def")
|
||||
target_compile_options(dol PRIVATE "/Zi")
|
||||
target_compile_options(dol PRIVATE "/Ob0")
|
||||
target_compile_options(dol PRIVATE "/Od")
|
||||
target_compile_options(dol PRIVATE "/RTC1")
|
||||
else ()
|
||||
# target_compile_options(dol PRIVATE "-fvisibility=hidden")
|
||||
# target_link_options(dol PRIVATE "LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/dol.map")
|
||||
|
|
@ -187,6 +191,10 @@ foreach (dir ${REL_DIRS})
|
|||
target_include_directories(${dir} PRIVATE include build/GMPE01_00/include)
|
||||
if (MSVC)
|
||||
set_target_properties(${dir} PROPERTIES LINK_FLAGS "/EXPORT:ObjectSetup")
|
||||
target_compile_options(${dir} PRIVATE "/Zi")
|
||||
target_compile_options(${dir} PRIVATE "/Ob0")
|
||||
target_compile_options(${dir} PRIVATE "/Od")
|
||||
target_compile_options(${dir} PRIVATE "/RTC1")
|
||||
elseif (NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
|
||||
target_compile_options(${dir} PRIVATE "-fvisibility=hidden")
|
||||
target_link_options(${dir} PRIVATE "LINKER:--version-script=${CMAKE_CURRENT_SOURCE_DIR}/rel.map")
|
||||
|
|
|
|||
2
extern/aurora
vendored
2
extern/aurora
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit 357ecba0ae00246332447823fddd83b8da89357f
|
||||
Subproject commit cd349a9d85600c01b54c430afa9a1f794695d048
|
||||
|
|
@ -20,7 +20,7 @@ typedef void (*ARCallback)(void);
|
|||
|
||||
ARCallback ARRegisterDMACallback(ARCallback callback);
|
||||
u32 ARGetDMAStatus(void);
|
||||
void ARStartDMA(u32 type, u32 mainmem_addr, u32 aram_addr, u32 length);
|
||||
void ARStartDMA(u32 type, uintptr_t mainmem_addr, u32 aram_addr, u32 length);
|
||||
u32 ARInit(u32* stack_index_addr, u32 num_entries);
|
||||
u32 ARGetBaseAddress(void);
|
||||
BOOL ARCheckInit(void);
|
||||
|
|
|
|||
|
|
@ -7,8 +7,15 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef AURORA
|
||||
#define GXCALLDISPLAYLISTLE GXCallDisplayListLE
|
||||
#else
|
||||
#define GXCALLDISPLAYLISTLE GXCallDisplayList
|
||||
#endif
|
||||
|
||||
void GXBeginDisplayList(void* list, u32 size);
|
||||
u32 GXEndDisplayList(void);
|
||||
void GXCallDisplayListLE(const void* list, u32 nbytes);
|
||||
void GXCallDisplayList(const void* list, u32 nbytes);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -78,6 +78,13 @@ typedef struct anim_data {
|
|||
/* 0x08 */ AnimBankData *bank;
|
||||
/* 0x0C */ AnimPatData *pat;
|
||||
/* 0x10 */ AnimBmpData *bmp;
|
||||
#ifdef TARGET_PC
|
||||
u32 valid;
|
||||
#endif
|
||||
} AnimData; //sizeof 0x14
|
||||
|
||||
#ifdef TARGET_PC
|
||||
#define ANIM_DATA_ALLOCATION_VALID 0xD3D3D3D3
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@
|
|||
typedef struct model_data ModelData;
|
||||
typedef struct particle_data ParticleData;
|
||||
|
||||
#ifdef TARGET_PC
|
||||
typedef void (*ParticleDLCallFunc)(ParticleData *particle);
|
||||
#endif
|
||||
|
||||
typedef void (*ParticleHook)(ModelData *model, ParticleData *particle, Mtx matrix);
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -45,11 +49,11 @@ struct particle_data {
|
|||
/* 0x34 */ u32 unk_34;
|
||||
/* 0x38 */ s32 unk_38;
|
||||
/* 0x3C */ u32 unk_3C;
|
||||
/* 0x40 */ s32 unk_40;
|
||||
/* 0x40 */ s32 unk_40; // dlSize
|
||||
/* 0x44 */ AnimData *unk_44;
|
||||
/* 0x48 */ HsfanimStruct01 *unk_48;
|
||||
/* 0x4C */ Vec *unk_4C;
|
||||
/* 0x50 */ void *unk_50;
|
||||
/* 0x50 */ void *unk_50; // dlPtr
|
||||
/* 0x54 */ ParticleHook unk_54;
|
||||
}; // Size 0x58
|
||||
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@ s32 msmSysDelGroupAll(void);
|
|||
s32 msmSysGetSampSize(BOOL baseGrp);
|
||||
s32 msmSysDelGroupBase(s32 grpNum);
|
||||
s32 msmSysSetAux(s32 auxA, s32 auxB);
|
||||
void msmSysRegularProc(void);
|
||||
|
||||
s32 msmSeSetParam(int seNo, MSM_SEPARAM *param);
|
||||
int msmSePlay(int seId, MSM_SEPARAM *param);
|
||||
|
|
|
|||
|
|
@ -546,8 +546,6 @@ void ObjectSetup(void)
|
|||
s16 sprite;
|
||||
AnimData *sprite_data;
|
||||
s16 i;
|
||||
#ifdef __MWERKS__
|
||||
// TODO PC
|
||||
titleMdlId[0] = model = Hu3DModelCreateFile(TITLE_CHAR_HSF);
|
||||
Hu3DModelAttrSet(model, HU3D_ATTR_DISPOFF);
|
||||
Hu3DModelAttrSet(model, HU3D_MOTATTR_LOOP);
|
||||
|
|
@ -559,7 +557,6 @@ void ObjectSetup(void)
|
|||
Hu3DModelAttrSet(model, HU3D_MOTATTR_LOOP);
|
||||
Hu3DModelCameraInfoSet(model, 1);
|
||||
Hu3DModelLightInfoSet(model, 1);
|
||||
#endif
|
||||
#if VERSION_NTSC
|
||||
bootGrpId = HuSprGrpCreate(4);
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -1901,7 +1901,7 @@ void fn_1_806C(ModelData *arg0, Mtx arg1)
|
|||
temp_r29 = &temp_r31->unk2C[temp_r31->unk28->unk38[0]];
|
||||
fn_1_7D60(temp_r29->unk80, temp_r29, 0);
|
||||
lbl_1_bss_2C = 1;
|
||||
HuSprTexLoad(*hiliteAnim, 0, lbl_1_bss_2C, GX_CLAMP, GX_CLAMP, GX_LINEAR);
|
||||
HuSprTexLoad(hiliteAnim[0], 0, lbl_1_bss_2C, GX_CLAMP, GX_CLAMP, GX_LINEAR);
|
||||
fn_1_8470(temp_r31->unk28, temp_r29);
|
||||
}
|
||||
GXSetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "game/armem.h"
|
||||
#include "game/chrman.h"
|
||||
#include "game/hsfdraw.h"
|
||||
#include "game/hsfex.h"
|
||||
#include "game/hsfman.h"
|
||||
#include "game/hsfmotion.h"
|
||||
#include "game/minigame_seq.h"
|
||||
|
|
@ -15,6 +16,11 @@
|
|||
#include "game/window.h"
|
||||
#include "game/wipe.h"
|
||||
|
||||
#ifndef __MWERKS__
|
||||
extern s32 rand8(void);
|
||||
#include "game/audio.h"
|
||||
#endif
|
||||
|
||||
typedef struct MentDllUnkBssE4Struct {
|
||||
/* 0x00 */ s32 unk_00;
|
||||
/* 0x04 */ s32 unk_04;
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@ s16 lbl_1_bss_80;
|
|||
|
||||
void fn_1_3668(void);
|
||||
|
||||
// Scratch is at https://decomp.me/scratch/iirXp
|
||||
// Register allocation issues at line 180 with load of 1.0 double constant
|
||||
s32 fn_1_2490(void)
|
||||
{
|
||||
float sp10[2];
|
||||
|
|
|
|||
|
|
@ -337,7 +337,12 @@ void *HuDataReadNum(s32 data_num, s32 num)
|
|||
}
|
||||
read_stat = &ReadDataStat[status];
|
||||
GetFileInfo(read_stat, data_num & 0xFFFF);
|
||||
#ifdef TARGET_PC
|
||||
// TODO PC why is the allocation invalid if we use HEAP_SYSTEM?
|
||||
buf = HuMemDirectMallocNum(HEAP_DATA, DATA_EFF_SIZE(read_stat->raw_len), num);
|
||||
#else
|
||||
buf = HuMemDirectMallocNum(HEAP_SYSTEM, DATA_EFF_SIZE(read_stat->raw_len), num);
|
||||
#endif
|
||||
if(buf) {
|
||||
HuDecodeData(read_stat->file, buf, read_stat->raw_len, read_stat->comp_type);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@
|
|||
#include "string.h"
|
||||
#include "version.h"
|
||||
|
||||
#ifndef __MWERKS__
|
||||
#include "game/pad.h"
|
||||
#endif
|
||||
|
||||
SHARED_SYM s16 GwLanguage = 1;
|
||||
SHARED_SYM s16 GwLanguageSave = -1;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@
|
|||
#include "ext_math.h"
|
||||
#include "string.h"
|
||||
|
||||
#ifndef __MWERKS__
|
||||
#include "game/frand.h"
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ s16 unk00;
|
||||
/* 0x02 */ s16 unk02;
|
||||
|
|
@ -824,13 +828,13 @@ static void particleFunc(ModelData *arg0, Mtx arg1) {
|
|||
}
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_INDEX16);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_RGBA6, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
GXSETARRAY(GX_VA_POS, temp_r31->unk_4C, temp_r31->unk_30 * 4 * sizeof(Vec), sizeof(Vec));
|
||||
GXSetVtxDesc(GX_VA_CLR0, GX_INDEX16);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
||||
GXSETARRAY(GX_VA_CLR0, &temp_r31->unk_48->unk40, temp_r31->unk_30 * sizeof(GXColor), 0x44);
|
||||
GXSetVtxDesc(GX_VA_TEX0, GX_INDEX16);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_RGBA6, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
||||
GXSETARRAY(GX_VA_TEX0, baseST, sizeof(baseST), 8);
|
||||
GXCallDisplayList(temp_r31->unk_50, temp_r31->unk_40);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,6 @@ static u16 *faceNumBuf;
|
|||
static s32 DLTotalNum;
|
||||
static u32 totalSize;
|
||||
static uintptr_t mallocNo;
|
||||
static uintptr_t mallocNo;
|
||||
static s32 curModelID;
|
||||
static s16 polySize;
|
||||
static s32 PGFinishF;
|
||||
|
|
@ -189,10 +188,6 @@ static void objCall(ModelData *arg0, HsfObject *arg1)
|
|||
|
||||
static void objMesh(ModelData *arg0, HsfObject *arg1)
|
||||
{
|
||||
#ifdef TARGET_PC
|
||||
// TODO PC
|
||||
return;
|
||||
#endif
|
||||
HsfDrawObject *temp_r29;
|
||||
HsfConstData *temp_r25;
|
||||
HsfTransform *var_r30;
|
||||
|
|
@ -753,11 +748,11 @@ static void FaceDraw(HsfDrawObject *arg0, HsfFace *arg1)
|
|||
SetTevStageTex(arg0, temp_r30);
|
||||
}
|
||||
sp28 = (u8 *)DLBufStartP + DrawData[drawCnt].dlOfs;
|
||||
GXCallDisplayList(sp28, DrawData[drawCnt].dlSize);
|
||||
GXCALLDISPLAYLISTLE(sp28, DrawData[drawCnt].dlSize);
|
||||
}
|
||||
else {
|
||||
sp28 = (u8 *)DLBufStartP + DrawData[drawCnt].dlOfs;
|
||||
GXCallDisplayList(sp28, DrawData[drawCnt].dlSize);
|
||||
GXCALLDISPLAYLISTLE(sp28, DrawData[drawCnt].dlSize);
|
||||
}
|
||||
drawCnt++;
|
||||
}
|
||||
|
|
@ -1778,7 +1773,7 @@ static void FaceDrawShadow(HsfDrawObject *arg0, HsfFace *arg1)
|
|||
else {
|
||||
GXSetVtxDesc(GX_VA_NRM, GX_INDEX16);
|
||||
if (temp_r28->hsfData->cenvCnt == 0) {
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_NRM, GX_NRM_XYZ, GX_RGB8, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_NRM, GX_NRM_XYZ, GX_S8, 0);
|
||||
GXSETARRAY(GX_VA_NRM, temp_r31->data.normal->data, temp_r31->data.vertex->count * 3, 3);
|
||||
}
|
||||
else {
|
||||
|
|
@ -1807,7 +1802,7 @@ static void FaceDrawShadow(HsfDrawObject *arg0, HsfFace *arg1)
|
|||
GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE);
|
||||
GXSetChanCtrl(GX_COLOR1A1, GX_FALSE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE);
|
||||
var_r26 = (u8 *)DLBufStartP + DrawData[drawCnt].dlOfs;
|
||||
GXCallDisplayList(var_r26, DrawData[drawCnt].dlSize);
|
||||
// GXCALLDISPLAYLISTLE(var_r26, DrawData[drawCnt].dlSize);
|
||||
}
|
||||
else {
|
||||
if (!(temp_r27->flags & 0x400)) {
|
||||
|
|
@ -1815,7 +1810,7 @@ static void FaceDrawShadow(HsfDrawObject *arg0, HsfFace *arg1)
|
|||
return;
|
||||
}
|
||||
var_r26 = (u8 *)DLBufStartP + DrawData[drawCnt].dlOfs;
|
||||
GXCallDisplayList(var_r26, DrawData[drawCnt].dlSize);
|
||||
// GXCALLDISPLAYLISTLE(var_r26, DrawData[drawCnt].dlSize);
|
||||
}
|
||||
drawCnt++;
|
||||
}
|
||||
|
|
@ -2514,12 +2509,9 @@ void MakeDisplayList(s16 arg0, uintptr_t arg1)
|
|||
var_r30 = &Hu3DData[arg0];
|
||||
curModelID = arg0;
|
||||
mallocNo = arg1;
|
||||
#ifdef __MWERKS__
|
||||
// TODO PC
|
||||
faceNumBuf = HuMemDirectMallocNum(HEAP_DATA, 0x800 * sizeof(u16), mallocNo);
|
||||
MDObjCall(temp_r31, temp_r31->root);
|
||||
HuMemDirectFree(faceNumBuf);
|
||||
#endif
|
||||
if (var_r30->attr & HU3D_ATTR_SHADOW) {
|
||||
Hu3DShadowCamBit++;
|
||||
}
|
||||
|
|
@ -2629,7 +2621,7 @@ static void MDFaceDraw(HsfObject *arg0, HsfFace *arg1)
|
|||
if (temp_r30 != materialBak || polyTypeBak != (arg1->type & 7) || (arg1->type & 7) == 4) {
|
||||
polyTypeBak = arg1->type & 7;
|
||||
materialBak = temp_r30;
|
||||
DrawData[drawCnt].dlOfs = (u32)DLBufP - (u32)DLBufStartP;
|
||||
DrawData[drawCnt].dlOfs = (uintptr_t)DLBufP - (uintptr_t)DLBufStartP;
|
||||
GXBeginDisplayList(DLBufP, 0x20000);
|
||||
GXResetWriteGatherPipe();
|
||||
if (temp_r30->numAttrs == 0) {
|
||||
|
|
@ -2729,9 +2721,6 @@ static void MDFaceDraw(HsfObject *arg0, HsfFace *arg1)
|
|||
GXTexCoord1x16(arg1->indices[1][3]);
|
||||
}
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
GXEnd();
|
||||
#endif
|
||||
faceCnt = faceNumBuf[drawCnt] / 3;
|
||||
break;
|
||||
case 3:
|
||||
|
|
@ -2806,9 +2795,6 @@ static void MDFaceDraw(HsfObject *arg0, HsfFace *arg1)
|
|||
GXTexCoord1x16(arg1->indices[1][3]);
|
||||
}
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
GXEnd();
|
||||
#endif
|
||||
faceCnt = faceNumBuf[drawCnt] / 4;
|
||||
break;
|
||||
case 4:
|
||||
|
|
@ -2884,9 +2870,6 @@ static void MDFaceDraw(HsfObject *arg0, HsfFace *arg1)
|
|||
GXTexCoord1x16(var_r24[3]);
|
||||
}
|
||||
}
|
||||
#ifdef TARGET_PC
|
||||
GXEnd();
|
||||
#endif
|
||||
faceCnt = arg1->strip.count + 1;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@
|
|||
#include "game/hsfman.h"
|
||||
#include "game/hsfmotion.h"
|
||||
#include "game/disp.h"
|
||||
#include "game/process.h"
|
||||
|
||||
#include "ext_math.h"
|
||||
|
||||
|
||||
#define DISP_HALF_W (HU_DISP_WIDTH/2.0f)
|
||||
#define DISP_HALF_H (HU_DISP_HEIGHT/2.0f)
|
||||
|
||||
|
|
|
|||
|
|
@ -962,6 +962,7 @@ static void CenvLoad(void)
|
|||
dual_new = dual_file = cenv_new[i].dualData;
|
||||
for(j=0; j<cenv_new[i].dualCount; j++) {
|
||||
#ifdef TARGET_PC
|
||||
s32 k;
|
||||
byteswap_hsfcenv_dual(&dual_data_real[j], &dual_new[j]);
|
||||
#endif
|
||||
dual_new[j].target1 = dual_file[j].target1;
|
||||
|
|
@ -969,12 +970,15 @@ static void CenvLoad(void)
|
|||
dual_new[j].weightCnt = dual_file[j].weightCnt;
|
||||
dual_new[j].weight = (HsfCenvDualWeight *)((uintptr_t)weight_base + (uintptr_t)dual_file[j].weight);
|
||||
#ifdef TARGET_PC
|
||||
byteswap_hsfcenv_dual_weight(dual_new[j].weight);
|
||||
for (k = 0; k < dual_new[j].weightCnt; k++) {
|
||||
byteswap_hsfcenv_dual_weight(&dual_new[j].weight[k]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
multi_new = multi_file = cenv_new[i].multiData;
|
||||
for(j=0; j<cenv_new[i].multiCount; j++) {
|
||||
#ifdef TARGET_PC
|
||||
s32 k;
|
||||
byteswap_hsfcenv_multi(&multi_data_real[j], &multi_new[j]);
|
||||
#endif
|
||||
multi_new[j].weightCnt = multi_file[j].weightCnt;
|
||||
|
|
@ -984,7 +988,9 @@ static void CenvLoad(void)
|
|||
multi_new[j].normalCnt = multi_file[j].normalCnt;
|
||||
multi_new[j].weight = (HsfCenvMultiWeight *)((uintptr_t)weight_base + (uintptr_t)multi_file[j].weight);
|
||||
#ifdef TARGET_PC
|
||||
byteswap_hsfcenv_multi_weight(dual_new[j].weight);
|
||||
for (k = 0; k < multi_new[j].weightCnt; k++) {
|
||||
byteswap_hsfcenv_multi_weight(&multi_new[j].weight[k]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
dual_new = dual_file = cenv_new[i].dualData;
|
||||
|
|
@ -1896,17 +1902,22 @@ static char *GetMotionString(u16 *str_ofs)
|
|||
void KillHSF(HsfData *data)
|
||||
{
|
||||
s32 i, j;
|
||||
HuMemDirectFree(data->attribute);
|
||||
HuMemDirectFree(data->bitmap);
|
||||
HuMemDirectFree(data->cenv);
|
||||
HuMemDirectFree(data->skeleton);
|
||||
for (i = 0; i < data->faceCnt; i++) {
|
||||
HuMemDirectFree(data->face[i].data);
|
||||
if (data->attributeCnt)
|
||||
HuMemDirectFree(data->attribute);
|
||||
if (data->bitmapCnt)
|
||||
HuMemDirectFree(data->bitmap);
|
||||
if (data->skeletonCnt)
|
||||
HuMemDirectFree(data->skeleton);
|
||||
if (data->faceCnt) {
|
||||
for (i = 0; i < data->faceCnt; i++) {
|
||||
HuMemDirectFree(data->face[i].data);
|
||||
}
|
||||
HuMemDirectFree(data->face);
|
||||
}
|
||||
HuMemDirectFree(data->face);
|
||||
HuMemDirectFree(data->material);
|
||||
for (i = 0; i < data->motionCnt; i++) {
|
||||
HsfMotion *motion = &data->motion[i];
|
||||
if (data->materialCnt)
|
||||
HuMemDirectFree(data->material);
|
||||
if (data->motionCnt) {
|
||||
HsfMotion *motion = data->motion;
|
||||
for (j = 0; j < motion->numTracks; j++) {
|
||||
HsfTrack *track = motion->track;
|
||||
if (track->type == HSF_TRACK_ATTRIBUTE && track->curveType == HSF_CURVE_BITMAP) {
|
||||
|
|
@ -1915,24 +1926,36 @@ void KillHSF(HsfData *data)
|
|||
}
|
||||
}
|
||||
HuMemDirectFree(motion->track);
|
||||
HuMemDirectFree(data->motion);
|
||||
}
|
||||
HuMemDirectFree(data->motion);
|
||||
HuMemDirectFree(data->normal);
|
||||
HuMemDirectFree(data->object);
|
||||
HuMemDirectFree(data->matrix);
|
||||
HuMemDirectFree(data->palette);
|
||||
HuMemDirectFree(data->st);
|
||||
HuMemDirectFree(data->vertex);
|
||||
for (i = 0; i < data->cenvCnt; i++) {
|
||||
HsfCenv *cenv = &data->cenv[i];
|
||||
HuMemDirectFree(cenv->dualData);
|
||||
HuMemDirectFree(cenv->multiData);
|
||||
if (data->normalCnt)
|
||||
HuMemDirectFree(data->normal);
|
||||
if (data->objectCnt)
|
||||
HuMemDirectFree(data->object);
|
||||
if (data->matrixCnt)
|
||||
HuMemDirectFree(data->matrix);
|
||||
if (data->paletteCnt)
|
||||
HuMemDirectFree(data->palette);
|
||||
if (data->stCnt)
|
||||
HuMemDirectFree(data->st);
|
||||
if (data->vertexCnt)
|
||||
HuMemDirectFree(data->vertex);
|
||||
if (data->cenvCnt) {
|
||||
for (i = 0; i < data->cenvCnt; i++) {
|
||||
HsfCenv *cenv = &data->cenv[i];
|
||||
HuMemDirectFree(cenv->dualData);
|
||||
HuMemDirectFree(cenv->multiData);
|
||||
}
|
||||
HuMemDirectFree(data->cenv);
|
||||
}
|
||||
HuMemDirectFree(data->cenv);
|
||||
HuMemDirectFree(data->cluster);
|
||||
HuMemDirectFree(data->part);
|
||||
HuMemDirectFree(data->shape);
|
||||
HuMemDirectFree(data->mapAttr);
|
||||
if (data->clusterCnt)
|
||||
HuMemDirectFree(data->cluster);
|
||||
if (data->partCnt)
|
||||
HuMemDirectFree(data->part);
|
||||
if (data->shapeCnt)
|
||||
HuMemDirectFree(data->shape);
|
||||
if (data->mapAttrCnt)
|
||||
HuMemDirectFree(data->mapAttr);
|
||||
HuMemDirectFree(data->symbol);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -293,10 +293,13 @@ void Hu3DAllKill(void) {
|
|||
Hu3DCameraAllKill();
|
||||
Hu3DLightAllKill();
|
||||
Hu3DAnimAllKill();
|
||||
#if __MWERKS__
|
||||
// this causes anim to be reallocated, so we lose the old allocation
|
||||
if(reflectAnim[0] != (AnimData *)refMapData0) {
|
||||
HuMemDirectFree(reflectAnim[0]);
|
||||
}
|
||||
reflectAnim[0] = HuSprAnimRead(refMapData0);
|
||||
#endif
|
||||
if(Hu3DShadowData.unk_04) {
|
||||
HuMemDirectFree(Hu3DShadowData.unk_04);
|
||||
Hu3DShadowCamBit = 0;
|
||||
|
|
@ -2030,10 +2033,13 @@ void Hu3DShadowExec(void) {
|
|||
GXSetChanCtrl(GX_COLOR0A0, 0, GX_SRC_REG, GX_SRC_REG, 0, GX_DF_CLAMP, GX_AF_NONE);
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
|
||||
GXColor3u8(0, 0, 0);
|
||||
GXColor3u8(1, 0, 0);
|
||||
GXColor3u8(1, 1, 0);
|
||||
GXColor3u8(0, 1, 0);
|
||||
GXPosition3u8(0, 0, 0);
|
||||
GXPosition3u8(1, 0, 0);
|
||||
GXPosition3u8(1, 1, 0);
|
||||
GXPosition3u8(0, 1, 0);
|
||||
#ifdef TARGET_PC
|
||||
GXEnd();
|
||||
#endif
|
||||
}
|
||||
|
||||
s16 Hu3DProjectionCreate(void *arg0, f32 arg8, f32 arg9, f32 argA) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include "game/armem.h"
|
||||
#include "game/audio.h"
|
||||
#include "game/disp.h"
|
||||
#include "game/gamework_data.h"
|
||||
#include "game/hsfman.h"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "game/objsub.h"
|
||||
#include "game/data.h"
|
||||
#include "game/gamework_data.h"
|
||||
#include "game/hsfman.h"
|
||||
#include "game/object.h"
|
||||
#include "game/pad.h"
|
||||
#include "game/window.h"
|
||||
|
|
|
|||
|
|
@ -5,12 +5,14 @@
|
|||
#include "game/flag.h"
|
||||
#include "game/gamework_data.h"
|
||||
#include "game/pad.h"
|
||||
#include "game/process.h"
|
||||
#include "game/sprite.h"
|
||||
#include "game/window.h"
|
||||
|
||||
#include "stddef.h"
|
||||
#include "string.h"
|
||||
|
||||
|
||||
#if VERSION_ENG
|
||||
#define SAVE_WRITE_BEGIN _SetFlag(FLAG_ID_MAKE(3, 0));
|
||||
#define SAVE_WRITE_END _ClearFlag(FLAG_ID_MAKE(3, 0));
|
||||
|
|
|
|||
|
|
@ -218,19 +218,25 @@ AnimData *HuSprAnimRead(void *data)
|
|||
AnimBankData *bank;
|
||||
AnimPatData *pat;
|
||||
|
||||
AnimData *anim = data;
|
||||
#ifdef TARGET_PC
|
||||
AnimData *anim = HuMemDirectMallocNum(HEAP_DATA, sizeof(AnimData), MEMORY_DEFAULT_NUM);
|
||||
s16 j;
|
||||
if (anim->valid == ANIM_DATA_ALLOCATION_VALID) {
|
||||
anim->useNum++;
|
||||
return anim;
|
||||
}
|
||||
anim = HuMemDirectMalloc(HEAP_DATA, sizeof(AnimData));
|
||||
byteswap_animdata(data, anim);
|
||||
anim->valid = ANIM_DATA_ALLOCATION_VALID;
|
||||
#else
|
||||
AnimData *anim = (AnimData *)data;
|
||||
#endif
|
||||
if((uintptr_t)anim->bank & ~0xFFFF) {
|
||||
anim->useNum++;
|
||||
return anim;
|
||||
}
|
||||
#endif
|
||||
bank = (void *)((uintptr_t)anim->bank+(uintptr_t)data);
|
||||
#ifdef TARGET_PC
|
||||
bank = HuMemDirectMallocNum(HEAP_DATA, anim->bankNum * sizeof(AnimBankData), MEMORY_DEFAULT_NUM);
|
||||
bank = HuMemDirectMalloc(HEAP_DATA, anim->bankNum * sizeof(AnimBankData));
|
||||
for(i=0; i<anim->bankNum; i++) {
|
||||
byteswap_animbankdata(&((AnimBankData32b*)((uintptr_t)anim->bank+(uintptr_t)data))[i], &bank[i]);
|
||||
}
|
||||
|
|
@ -238,7 +244,7 @@ AnimData *HuSprAnimRead(void *data)
|
|||
anim->bank = bank;
|
||||
pat = (void *)((uintptr_t)anim->pat+(uintptr_t)data);
|
||||
#ifdef TARGET_PC
|
||||
pat = HuMemDirectMallocNum(HEAP_DATA, anim->patNum * sizeof(AnimPatData), MEMORY_DEFAULT_NUM);
|
||||
pat = HuMemDirectMalloc(HEAP_DATA, anim->patNum * sizeof(AnimPatData));
|
||||
for(i=0; i<anim->patNum; i++) {
|
||||
byteswap_animpatdata(&((AnimPatData32b*)((uintptr_t)anim->pat+(uintptr_t)data))[i], &pat[i]);
|
||||
}
|
||||
|
|
@ -246,7 +252,7 @@ AnimData *HuSprAnimRead(void *data)
|
|||
anim->pat = pat;
|
||||
bmp = (void *)((uintptr_t)anim->bmp+(uintptr_t)data);
|
||||
#ifdef TARGET_PC
|
||||
bmp = HuMemDirectMallocNum(HEAP_DATA, anim->bmpNum * sizeof(AnimBmpData), MEMORY_DEFAULT_NUM);
|
||||
bmp = HuMemDirectMalloc(HEAP_DATA, anim->bmpNum * sizeof(AnimBmpData));
|
||||
for(i=0; i<anim->bmpNum; i++) {
|
||||
byteswap_animbmpdata(&((AnimBmpData32b*)((uintptr_t)anim->bmp+(uintptr_t)data))[i], &bmp[i]);
|
||||
}
|
||||
|
|
@ -261,7 +267,9 @@ AnimData *HuSprAnimRead(void *data)
|
|||
for(i=0; i<anim->patNum; i++, pat++) {
|
||||
pat->layer = (AnimLayerData *)((uintptr_t)pat->layer+(uintptr_t)data);
|
||||
#ifdef TARGET_PC
|
||||
byteswap_animlayerdata(pat->layer);
|
||||
for (j = 0; j < pat->layerNum; j++) {
|
||||
byteswap_animlayerdata(&pat->layer[j]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
for(i=0; i<anim->bmpNum; i++, bmp++) {
|
||||
|
|
@ -649,6 +657,15 @@ AnimData *HuSprAnimMake(s16 sizeX, s16 sizeY, s16 dataFmt)
|
|||
AnimBankData *bank;
|
||||
AnimData *new_anim;
|
||||
|
||||
#ifdef TARGET_PC
|
||||
// as these are allocated in HuSprAnimRead, we need to do so here too so we don't get issues when freeing
|
||||
anim = HuMemDirectMalloc(HEAP_DATA, sizeof(AnimData));
|
||||
anim->bank = bank = HuMemDirectMalloc(HEAP_DATA, sizeof(AnimBankData));
|
||||
bank->frame = frame = HuMemDirectMalloc(HEAP_DATA, sizeof(AnimFrameData));
|
||||
anim->pat = pat = HuMemDirectMalloc(HEAP_DATA, sizeof(AnimPatData));
|
||||
pat->layer = layer = HuMemDirectMalloc(HEAP_DATA, sizeof(AnimLayerData));
|
||||
anim->bmp = bmp = HuMemDirectMalloc(HEAP_DATA, sizeof(AnimBmpData));
|
||||
#else
|
||||
anim = new_anim = HuMemDirectMalloc(HEAP_DATA, sizeof(AnimData)+sizeof(AnimBankData)+sizeof(AnimFrameData)
|
||||
+sizeof(AnimPatData)+sizeof(AnimLayerData)+sizeof(AnimBmpData));
|
||||
|
||||
|
|
@ -662,6 +679,7 @@ AnimData *HuSprAnimMake(s16 sizeX, s16 sizeY, s16 dataFmt)
|
|||
pat->layer = layer;
|
||||
bmp = temp = ((char *)temp+sizeof(AnimLayerData));
|
||||
anim->bmp = bmp;
|
||||
#endif
|
||||
anim->useNum = 0;
|
||||
anim->bankNum = 1;
|
||||
anim->patNum = 1;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ u32 ARGetSize()
|
|||
return sizeof(ARAM);
|
||||
}
|
||||
|
||||
void ARStartDMA(u32 type, u32 mainmem_addr, u32 aram_addr, u32 length)
|
||||
void ARStartDMA(u32 type, uintptr_t mainmem_addr, u32 aram_addr, u32 length)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ s32 HuAudSeqMidiCtrlGet(s32 musNo, s8 channel, s8 ctrl) {
|
|||
|
||||
s32 HuAudSStreamPlay(s16 streamId) {
|
||||
MSM_STREAMPARAM param;
|
||||
s32 result;
|
||||
s32 result = 0;
|
||||
|
||||
if (musicOffF != 0 || omSysExitReq != 0) {
|
||||
return 0;
|
||||
|
|
@ -502,12 +502,12 @@ void HuAudSndCommonGrpSet(s16 grpId, s32 groupCheck) {
|
|||
// while ((msmMusGetNumPlay(1) != 0 || msmSeGetNumPlay(1) != 0)
|
||||
// && OSTicksToMilliseconds(OSGetTick() - osTick) < 500);
|
||||
OSReport("CommonGrpSet %d\n", grpId);
|
||||
if (groupCheck != 0) {
|
||||
// err = msmSysDelGroupBase(0);
|
||||
if (err < 0) {
|
||||
OSReport("Del Group Error %d\n", err);
|
||||
}
|
||||
}
|
||||
// if (groupCheck != 0) {
|
||||
// // err = msmSysDelGroupBase(0);
|
||||
// if (err < 0) {
|
||||
// OSReport("Del Group Error %d\n", err);
|
||||
// }
|
||||
// }
|
||||
// buf = HuMemDirectMalloc(HEAP_DATA, msmSysGetSampSize(grpId));
|
||||
// msmSysLoadGroupBase(grpId, buf);
|
||||
// HuMemDirectFree(buf);
|
||||
|
|
|
|||
|
|
@ -570,10 +570,13 @@ template <typename B> void bswap(B &base, HsfCenvMulti32b &obj, HsfCenvMulti &de
|
|||
bswap(base, obj.posCnt);
|
||||
bswap(base, obj.normal);
|
||||
bswap(base, obj.normalCnt);
|
||||
bswap(base, obj.weight);
|
||||
|
||||
dest.weightCnt = obj.weightCnt;
|
||||
dest.pos = obj.pos;
|
||||
dest.posCnt = obj.posCnt;
|
||||
dest.normal = obj.normal;
|
||||
dest.normalCnt = obj.normalCnt;
|
||||
dest.weight = reinterpret_cast<HsfCenvMultiWeight *>(static_cast<uintptr_t>(obj.weight));
|
||||
}
|
||||
|
||||
|
|
@ -695,13 +698,13 @@ template <typename B> void bswap(B &base, HsfBitmapKey32b &obj, HsfBitmapKey &de
|
|||
|
||||
template <typename B> void bswap(B &base, HsfTrack32b &obj, HsfTrack &dest)
|
||||
{
|
||||
bswap(base, obj.type);
|
||||
bswap(base, obj.start);
|
||||
bswap(base, obj.target);
|
||||
bswap(base, obj.curveType);
|
||||
bswap(base, obj.numKeyframes);
|
||||
|
||||
dest.type = obj.type;
|
||||
dest.start = obj.start;
|
||||
dest.target = obj.target;
|
||||
dest.curveType = obj.curveType;
|
||||
dest.numKeyframes = obj.numKeyframes;
|
||||
|
||||
|
|
|
|||
|
|
@ -624,18 +624,14 @@ void GXUnknownu16(const u16 x)
|
|||
|
||||
void GXWaitDrawDone(void)
|
||||
{
|
||||
puts("GXWaitDrawDone is a stub");
|
||||
// puts("GXWaitDrawDone is a stub");
|
||||
}
|
||||
|
||||
void GXSetTevIndTile(GXTevStageID tev_stage, GXIndTexStageID ind_stage, u16 tilesize_s, u16 tilesize_t, u16 tilespacing_s, u16 tilespacing_t,
|
||||
GXIndTexFormat format, GXIndTexMtxID matrix_sel, GXIndTexBiasSel bias_sel, GXIndTexAlphaSel alpha_sel)
|
||||
{
|
||||
puts("GXSetTevIndTile is a stub");
|
||||
}
|
||||
|
||||
void GXSetTexCoordScaleManually(GXTexCoordID coord, u8 enable, u16 ss, u16 ts)
|
||||
{
|
||||
puts("GXSetTexCoordScaleManually is a stub");
|
||||
// TODO
|
||||
// puts("GXSetTevIndTile is a stub");
|
||||
}
|
||||
|
||||
void GXResetWriteGatherPipe(void)
|
||||
|
|
@ -680,11 +676,6 @@ void GXGetViewportv(f32 *vp)
|
|||
// TODO
|
||||
}
|
||||
|
||||
void GXSetZTexture(GXZTexOp op, GXTexFmt fmt, u32 bias)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// Hudson
|
||||
void HuDvdErrDispInit(GXRenderModeObj *rmode, void *xfb1, void *xfb2) { }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue