@@ -2980,6 +2980,19 @@ static U32 tbuffer[1024 + 8];
29802980static U32* buffer32;
29812981volatile 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+
29832996void 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+
33423360void 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
40684142F32 iAnimDuration (void * RawData)
40694143{
4070- return iAnimDurationSKB ((iAnimSKBHeader*)RawData);
4144+ // return iAnimDurationSKB((iAnimSKBHeader*)RawData);
40714145}
40724146
40734147void 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
40784152void iAnimInit ()
40794153{
4080- return ;
40814154}
0 commit comments