Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions include/types.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef BFBB_TYPES_H
#define BFBB_TYPES_H
#ifndef TSSM_TYPES_H
#define TSSM_TYPES_H

#include "macros.h"

// Note: only include this header inside BFBB-related headers/source code files.
// Note: only include this header inside TSSM-related headers/source code files.
// Don't include this in any RenderWare, system, bink, etc. files

#ifdef GAMECUBE
Expand Down Expand Up @@ -86,10 +86,16 @@ typedef wchar_t wint_t;
#define nullptr 0
#define null 0

#ifdef __MWERKS__
#define ALIGNB(a) __attribute__((aligned(a)))
#else
#define ALIGNB(a)
#endif

#ifndef NULL
#define NULL 0
#endif

#define UINT32_MAX 0xffffffff

#endif // !TYPES_H
#endif // !TYPES_H
2 changes: 1 addition & 1 deletion src/SB/Core/gc/iARAMTmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void* iARAMTmpInARAMTemp(void*)

void* iARAMTmpFree(void*)
{
return 0; //TO-DO
return;
}

U32 iARAMTmpMalloc(unsigned int)
Expand Down
6 changes: 6 additions & 0 deletions src/SB/Core/gc/iFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ enum IFILE_READSECTOR_STATUS
IFILE_RDSTAT_EXPIRED
};

enum xFileDriveType
{
XFILE_DRIVE_CDVD,
XFILE_DRIVE_CONSOLE_HD
};

#ifdef GAMECUBE
struct tag_iFile
{
Expand Down
87 changes: 80 additions & 7 deletions src/SB/Core/gc/iWad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2980,6 +2980,19 @@ static U32 tbuffer[1024 + 8];
static U32* buffer32;
volatile U32 iFileSyncAsyncReadActive;

U32 iFileGetSectorSize(xFileDriveType drive)
{
// FIXME: Am I dumb? How does this not create jumps in objdiff?
if (drive != 0)
{
return 0;
}
else
{
return 32;
}
}

void iFileGetInfo(tag_xFile* file, U32* addr, U32* length)
{
if (addr)
Expand Down Expand Up @@ -3339,6 +3352,11 @@ void iEnvRender(iEnv* env, bool)
lastEnv = env;
}

void iEnvSetup(iEnv* env)
{
lastEnv = env;
}

void iEnvLightingBasics(iEnv*, xEnvAsset*)
{
}
Expand Down Expand Up @@ -3367,13 +3385,13 @@ void iEnvFree(iEnv* env)
}
}

static RpAtomic* SetPipelineCB(RpAtomic* atomic, void* data)
static void SetPipelineCB(RpAtomic* atomic, void* data)
{
if (data)
if (data == 0)
{
return RpAtomicSetPipeline(atomic, (RxPipeline*)data);
return;
}
return 0;
(atomic->pipeline) = (RxPipeline*)data;
}

// iXF / iDraw
Expand Down Expand Up @@ -3730,7 +3748,63 @@ void iCSSoundSetup(xCutscene* csn)

// iAsync

// Easy file, will work on soon
S32 asyncThread;
bool asyncThreadDone = true;
S64 asyncDirtyFrameList;

void iAsyncResume()
{
S32 unk0;

if ((asyncThreadDone == '\0') &&
(unk0 = OSIsThreadSuspended((OSThread*)+0x7fb57520), unk0 != 0))
{
OSResumeThread((OSThread*)+0x7fb57520);
}
}

void iAsyncSuspend()
{
S32 unk0;

if ((asyncThreadDone == '\0') &&
(unk0 = OSIsThreadSuspended((OSThread*)+0x7fb57520), unk0 == 0))
{
OSSuspendThread((OSThread*)+0x7fb57520);
}
}

void iAsyncEndUpdate()
{
OSEnableInterrupts();
}

void iAsyncBeginUpdate()
{
OSDisableInterrupts();
}

void iAsyncTerminate()
{
asyncThreadDone = true;
}

S32 iAsyncIsDone()
{
return asyncThreadDone;
}

void iAsyncStart(void (*func)(void*))
{
// FIXME: Very hacky and not all that close. Relocs need to be fixed.
ThreadParam threadParams;
asyncDirtyFrameList = (S64)&asyncDirtyFrameList;
threadParams.status = (S64)&asyncDirtyFrameList;
asyncThreadDone = 0;
OSCreateThread((OSThread*)-0x7fb57520, (OSThreadStartFunction)func, 0, (void*)0x80442278,
0x2000, 10, 1);
OSResumeThread((OSThread*)-0x7fb57520);
}

// iAnimSKB

Expand Down Expand Up @@ -4067,7 +4141,7 @@ U32 iAnimBoneCount(void* RawData)

F32 iAnimDuration(void* RawData)
{
return iAnimDurationSKB((iAnimSKBHeader*)RawData);
//return iAnimDurationSKB((iAnimSKBHeader*)RawData);
}

void iAnimEval(void* RawData, F32 time, U32 flags, xVec3* tran, xQuat* quat)
Expand All @@ -4077,5 +4151,4 @@ void iAnimEval(void* RawData, F32 time, U32 flags, xVec3* tran, xQuat* quat)

void iAnimInit()
{
return;
}
16 changes: 16 additions & 0 deletions src/SB/Core/gc/iWad.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@
#include <rtslerp.h>
#include <dolphin/os.h>

struct ThreadParam
{
S32 status;
void (*entry)(void*);
void* stack;
S32 stackSize;
void* gpReg;
S32 initPriority;
S32 currentPriority;
U32 attr;
U32 option;
S32 waitType;
S32 waitId;
S32 wakeupCount;
};

void iFuncProfileFuncs(int, int, float);

#endif
18 changes: 2 additions & 16 deletions src/SB/Core/x/xEnt.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct xEntAsset : xBaseAsset
U8 subtype;
U8 pflags;
U8 moreFlags;
U8 pad;
//U8 pad;
//U8 padding[3]; // this padding is added automatically. it should not be here

// Offset: 0x10
Expand Down Expand Up @@ -68,17 +68,10 @@ struct xEntFrame
xRot drot;
xRot rot;

// Offset: 0xBC
xVec3 dpos;

// Offset: 0xC8
xVec3 dvel;

// Offset: 0xD4
xVec3 vel;

// Offset: 0xE0
U32 mode;
xVec3 dpos;
};

struct xEntCollis
Expand Down Expand Up @@ -116,13 +109,6 @@ struct xEnt : xBase
{
struct anim_coll_data
{
U32 flags;
U32 bones;
xMat4x3 old_mat;
xMat4x3 new_mat;
U32 verts_size;
xVec3* verts;
xVec3* normals;
};

xEntAsset* asset;
Expand Down
Loading