Skip to content

Commit c04a4e5

Browse files
authored
Merge pull request bfbbdecomp#27 from LivewireCB/dev7
Corrected quite a few structs and originally wrong functions
2 parents 8cc7cb9 + 9879f02 commit c04a4e5

26 files changed

+941
-437
lines changed

include/types.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
#ifndef BFBB_TYPES_H
2-
#define BFBB_TYPES_H
1+
#ifndef TSSM_TYPES_H
2+
#define TSSM_TYPES_H
33

44
#include "macros.h"
55

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

99
#ifdef GAMECUBE
@@ -86,10 +86,16 @@ typedef wchar_t wint_t;
8686
#define nullptr 0
8787
#define null 0
8888

89+
#ifdef __MWERKS__
90+
#define ALIGNB(a) __attribute__((aligned(a)))
91+
#else
92+
#define ALIGNB(a)
93+
#endif
94+
8995
#ifndef NULL
9096
#define NULL 0
9197
#endif
9298

9399
#define UINT32_MAX 0xffffffff
94100

95-
#endif // !TYPES_H
101+
#endif // !TYPES_H

src/SB/Core/gc/iARAMTmp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void* iARAMTmpInARAMTemp(void*)
1414

1515
void* iARAMTmpFree(void*)
1616
{
17-
return 0; //TO-DO
17+
return;
1818
}
1919

2020
U32 iARAMTmpMalloc(unsigned int)

src/SB/Core/gc/iFile.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ enum IFILE_READSECTOR_STATUS
1414
IFILE_RDSTAT_EXPIRED
1515
};
1616

17+
enum xFileDriveType
18+
{
19+
XFILE_DRIVE_CDVD,
20+
XFILE_DRIVE_CONSOLE_HD
21+
};
22+
1723
#ifdef GAMECUBE
1824
struct tag_iFile
1925
{

src/SB/Core/gc/iWad.cpp

Lines changed: 80 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2980,6 +2980,19 @@ static U32 tbuffer[1024 + 8];
29802980
static U32* buffer32;
29812981
volatile U32 iFileSyncAsyncReadActive;
29822982

2983+
U32 iFileGetSectorSize(xFileDriveType drive)
2984+
{
2985+
// FIXME: Am I dumb? How does this not create jumps in objdiff?
2986+
if (drive != 0)
2987+
{
2988+
return 0;
2989+
}
2990+
else
2991+
{
2992+
return 32;
2993+
}
2994+
}
2995+
29832996
void iFileGetInfo(tag_xFile* file, U32* addr, U32* length)
29842997
{
29852998
if (addr)
@@ -3339,6 +3352,11 @@ void iEnvRender(iEnv* env, bool)
33393352
lastEnv = env;
33403353
}
33413354

3355+
void iEnvSetup(iEnv* env)
3356+
{
3357+
lastEnv = env;
3358+
}
3359+
33423360
void iEnvLightingBasics(iEnv*, xEnvAsset*)
33433361
{
33443362
}
@@ -3367,13 +3385,13 @@ void iEnvFree(iEnv* env)
33673385
}
33683386
}
33693387

3370-
static RpAtomic* SetPipelineCB(RpAtomic* atomic, void* data)
3388+
static void SetPipelineCB(RpAtomic* atomic, void* data)
33713389
{
3372-
if (data)
3390+
if (data == 0)
33733391
{
3374-
return RpAtomicSetPipeline(atomic, (RxPipeline*)data);
3392+
return;
33753393
}
3376-
return 0;
3394+
(atomic->pipeline) = (RxPipeline*)data;
33773395
}
33783396

33793397
// iXF / iDraw
@@ -3730,7 +3748,63 @@ void iCSSoundSetup(xCutscene* csn)
37303748

37313749
// iAsync
37323750

3733-
// Easy file, will work on soon
3751+
S32 asyncThread;
3752+
bool asyncThreadDone = true;
3753+
S64 asyncDirtyFrameList;
3754+
3755+
void iAsyncResume()
3756+
{
3757+
S32 unk0;
3758+
3759+
if ((asyncThreadDone == '\0') &&
3760+
(unk0 = OSIsThreadSuspended((OSThread*)+0x7fb57520), unk0 != 0))
3761+
{
3762+
OSResumeThread((OSThread*)+0x7fb57520);
3763+
}
3764+
}
3765+
3766+
void iAsyncSuspend()
3767+
{
3768+
S32 unk0;
3769+
3770+
if ((asyncThreadDone == '\0') &&
3771+
(unk0 = OSIsThreadSuspended((OSThread*)+0x7fb57520), unk0 == 0))
3772+
{
3773+
OSSuspendThread((OSThread*)+0x7fb57520);
3774+
}
3775+
}
3776+
3777+
void iAsyncEndUpdate()
3778+
{
3779+
OSEnableInterrupts();
3780+
}
3781+
3782+
void iAsyncBeginUpdate()
3783+
{
3784+
OSDisableInterrupts();
3785+
}
3786+
3787+
void iAsyncTerminate()
3788+
{
3789+
asyncThreadDone = true;
3790+
}
3791+
3792+
S32 iAsyncIsDone()
3793+
{
3794+
return asyncThreadDone;
3795+
}
3796+
3797+
void iAsyncStart(void (*func)(void*))
3798+
{
3799+
// FIXME: Very hacky and not all that close. Relocs need to be fixed.
3800+
ThreadParam threadParams;
3801+
asyncDirtyFrameList = (S64)&asyncDirtyFrameList;
3802+
threadParams.status = (S64)&asyncDirtyFrameList;
3803+
asyncThreadDone = 0;
3804+
OSCreateThread((OSThread*)-0x7fb57520, (OSThreadStartFunction)func, 0, (void*)0x80442278,
3805+
0x2000, 10, 1);
3806+
OSResumeThread((OSThread*)-0x7fb57520);
3807+
}
37343808

37353809
// iAnimSKB
37363810

@@ -4067,7 +4141,7 @@ U32 iAnimBoneCount(void* RawData)
40674141

40684142
F32 iAnimDuration(void* RawData)
40694143
{
4070-
return iAnimDurationSKB((iAnimSKBHeader*)RawData);
4144+
//return iAnimDurationSKB((iAnimSKBHeader*)RawData);
40714145
}
40724146

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

40784152
void iAnimInit()
40794153
{
4080-
return;
40814154
}

src/SB/Core/gc/iWad.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@
4444
#include <rtslerp.h>
4545
#include <dolphin/os.h>
4646

47+
struct ThreadParam
48+
{
49+
S32 status;
50+
void (*entry)(void*);
51+
void* stack;
52+
S32 stackSize;
53+
void* gpReg;
54+
S32 initPriority;
55+
S32 currentPriority;
56+
U32 attr;
57+
U32 option;
58+
S32 waitType;
59+
S32 waitId;
60+
S32 wakeupCount;
61+
};
62+
4763
void iFuncProfileFuncs(int, int, float);
4864

4965
#endif

src/SB/Core/x/xEnt.h

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct xEntAsset : xBaseAsset
2121
U8 subtype;
2222
U8 pflags;
2323
U8 moreFlags;
24-
U8 pad;
24+
//U8 pad;
2525
//U8 padding[3]; // this padding is added automatically. it should not be here
2626

2727
// Offset: 0x10
@@ -68,17 +68,10 @@ struct xEntFrame
6868
xRot drot;
6969
xRot rot;
7070

71-
// Offset: 0xBC
72-
xVec3 dpos;
73-
74-
// Offset: 0xC8
7571
xVec3 dvel;
76-
77-
// Offset: 0xD4
7872
xVec3 vel;
79-
80-
// Offset: 0xE0
8173
U32 mode;
74+
xVec3 dpos;
8275
};
8376

8477
struct xEntCollis
@@ -116,13 +109,6 @@ struct xEnt : xBase
116109
{
117110
struct anim_coll_data
118111
{
119-
U32 flags;
120-
U32 bones;
121-
xMat4x3 old_mat;
122-
xMat4x3 new_mat;
123-
U32 verts_size;
124-
xVec3* verts;
125-
xVec3* normals;
126112
};
127113

128114
xEntAsset* asset;

0 commit comments

Comments
 (0)