diff --git a/configure.py b/configure.py index e43964d88..bf3661b96 100644 --- a/configure.py +++ b/configure.py @@ -602,7 +602,7 @@ def MatchingFor(*versions): Object(NonMatching, "SB/Game/zNPCGoalVillager.cpp", extra_cflags=["-sym on"]), Object(Matching, "SB/Game/zNPCGoalSubBoss.cpp", extra_cflags=["-sym on"]), Object(NonMatching, "SB/Core/x/xShadowSimple.cpp"), - Object(NonMatching, "SB/Core/x/xUpdateCull.cpp"), + Object(Matching, "SB/Core/x/xUpdateCull.cpp"), Object(NonMatching, "SB/Game/zDiscoFloor.cpp"), Object(NonMatching, "SB/Game/zNPCTypeBossSandy.cpp"), Object(NonMatching, "SB/Game/zNPCTypeKingJelly.cpp"), @@ -621,7 +621,7 @@ def MatchingFor(*versions): Object(NonMatching, "SB/Core/x/xDecal.cpp", extra_cflags=["-sym on"]), Object(NonMatching, "SB/Core/x/xLaserBolt.cpp", extra_cflags=["-sym on"]), Object(NonMatching, "SB/Game/zCameraTweak.cpp"), - Object(NonMatching, "SB/Core/x/xPtankPool.cpp"), + Object(Matching, "SB/Core/x/xPtankPool.cpp"), Object(Equivalent, "SB/Core/gc/iTRC.cpp"), Object(NonMatching, "SB/Game/zNPCSupplement.cpp"), Object(NonMatching, "SB/Game/zNPCGlyph.cpp", extra_cflags=["-sym on"]), diff --git a/include/rwsdk/rwplcore.h b/include/rwsdk/rwplcore.h index 19c1ca81e..bfa8af8b9 100644 --- a/include/rwsdk/rwplcore.h +++ b/include/rwsdk/rwplcore.h @@ -485,6 +485,7 @@ struct RwStringFunctions }; #define RwMalloc(_s) ((RWSRCGLOBAL(memoryFuncs).rwmalloc)((_s))) +#define RwMallocL(_s, _h, _l) ((RWSRCGLOBAL(memoryFuncs).rwmalloc)((_s), (_h))) #define RwFree(_p) ((RWSRCGLOBAL(memoryFuncs).rwfree)((_p))) #define RwCalloc(_n, _s) ((RWSRCGLOBAL(memoryFuncs).rwcalloc)((_n), (_s))) #define RwRealloc(_p, _s) ((RWSRCGLOBAL(memoryFuncs).rwrealloc)((_p), (_s))) @@ -796,22 +797,22 @@ struct rwGameCube2DVertex RwReal u; RwReal v; - rwGameCube2DVertex& operator=(const rwGameCube2DVertex& rhs) - { - this->x = rhs.x; - this->y = rhs.y; - this->z = rhs.z; + rwGameCube2DVertex& operator=(const rwGameCube2DVertex& rhs) + { + this->x = rhs.x; + this->y = rhs.y; + this->z = rhs.z; - this->emissiveColor.red = rhs.emissiveColor.red; - this->emissiveColor.green = rhs.emissiveColor.green; - this->emissiveColor.blue = rhs.emissiveColor.blue; - this->emissiveColor.alpha = rhs.emissiveColor.alpha; + this->emissiveColor.red = rhs.emissiveColor.red; + this->emissiveColor.green = rhs.emissiveColor.green; + this->emissiveColor.blue = rhs.emissiveColor.blue; + this->emissiveColor.alpha = rhs.emissiveColor.alpha; - this->u = rhs.u; - this->v = rhs.v; + this->u = rhs.u; + this->v = rhs.v; - return *this; - } + return *this; + } }; typedef rwGameCube2DVertex RwIm2DVertex; diff --git a/src/SB/Core/x/xPtankPool.cpp b/src/SB/Core/x/xPtankPool.cpp index c2ea08778..25bea7e49 100644 --- a/src/SB/Core/x/xPtankPool.cpp +++ b/src/SB/Core/x/xPtankPool.cpp @@ -152,22 +152,14 @@ namespace } const F32 f1 = 1.0f; - frame->modelling.at.z = f1; - frame->modelling.up.y = f1; - frame->modelling.right.x = f1; + frame->modelling.right.x = frame->modelling.up.y = frame->modelling.at.z = f1; const F32 f0 = 0.0f; - frame->modelling.up.x = f0; - frame->modelling.right.z = f0; - frame->modelling.right.y = f0; + frame->modelling.right.y = frame->modelling.right.z = frame->modelling.up.x = f0; - frame->modelling.at.y = f0; - frame->modelling.at.x = f0; - frame->modelling.up.z = f0; + frame->modelling.up.z = frame->modelling.at.x = frame->modelling.at.y = f0; - frame->modelling.pos.z = f0; - frame->modelling.pos.y = f0; - frame->modelling.pos.x = f0; + frame->modelling.pos.x = frame->modelling.pos.y = frame->modelling.pos.z = f0; frame->modelling.flags = frame->modelling.flags | rpPTANKDFLAGCNS2DROTATE | rpPTANKDFLAGCOLOR | rpPTANKDFLAGPOSITION; @@ -243,7 +235,29 @@ namespace return 0; } - U32 create_ptanks(group_data& group, unsigned long count) + U32 create_ptanks(group_data& group, u32 count); +} // namespace + +void xPTankPoolSceneEnter() +{ + inited = 1; + init_groups(); + + group_data* it = groups; + group_data* end = groups + MAX_PGT; + while (it != end) + { + F64 f = it->max_size - 0.f; + F32 scaled = F32(f) * 0.25f + 0.5f; + create_ptanks(*it, (U32)scaled); + + it++; + } +} + +namespace +{ + U32 create_ptanks(group_data& group, u32 count) { U32 initial_size = group.size; if (initial_size + count > group.max_size) @@ -275,23 +289,6 @@ namespace } // namespace -void xPTankPoolSceneEnter() -{ - inited = 1; - init_groups(); - - group_data* it = groups; - group_data* end = groups + MAX_PGT; - while (it != end) - { - double f = it->max_size - 0.f; - float scaled = float(f) * 0.25f + 0.5f; - create_ptanks(*it, (unsigned long)scaled); - - it++; - } -} - void xPTankPoolSceneExit() { inited = 0; diff --git a/src/SB/Core/x/xUpdateCull.cpp b/src/SB/Core/x/xUpdateCull.cpp index 4be7befaf..dc086e8c2 100644 --- a/src/SB/Core/x/xUpdateCull.cpp +++ b/src/SB/Core/x/xUpdateCull.cpp @@ -1,12 +1,8 @@ #include "zGlobals.h" #include "xUpdateCull.h" +#include "xGroup.h" -U32 xUpdateCull_AlwaysTrueCB(void* ent, void* cbdata) -{ - return 1; -} - -void xUpdateCull_Swap(xUpdateCullMgr* mgr, U32 a, U32 b) +static void xUpdateCull_Swap(xUpdateCullMgr* mgr, U32 a, U32 b) { xUpdateCullEnt* pMgrAIndex; @@ -17,7 +13,8 @@ void xUpdateCull_Swap(xUpdateCullMgr* mgr, U32 a, U32 b) { pMgrIndex->index = (U16)b; pMgrIndex = pMgrIndex->nextInGroup; - if (pMgrIndex == NULL) break; + if (pMgrIndex == NULL) + break; } while (pMgrIndex != pMgrAIndex); pMgrIndex = pMgrBIndex; @@ -25,20 +22,21 @@ void xUpdateCull_Swap(xUpdateCullMgr* mgr, U32 a, U32 b) { pMgrIndex->index = (U16)a; pMgrIndex = pMgrIndex->nextInGroup; - if (pMgrIndex == NULL) break; + if (pMgrIndex == NULL) + break; } while (pMgrIndex != pMgrBIndex); // Set index and groupIndex together. - S32 uVar6 = *(S32 *)(&mgr->ent[a]); - *(S32 *)(&mgr->ent[a]) = *(S32 *)(&mgr->ent[b]); - *(S32 *)(&mgr->ent[b]) = uVar6; + S32 uVar6 = *(S32*)(&mgr->ent[a]); + *(S32*)(&mgr->ent[a]) = *(S32*)(&mgr->ent[b]); + *(S32*)(&mgr->ent[b]) = uVar6; - uVar6 = *(S32 *)(&mgr->mgr[a]); - *(S32 *)(&mgr->mgr[a]) = *(S32 *)(&mgr->mgr[b]); - *(S32 *)(&mgr->mgr[b]) = uVar6; + uVar6 = *(S32*)(&mgr->mgr[a]); + *(S32*)(&mgr->mgr[a]) = *(S32*)(&mgr->mgr[b]); + *(S32*)(&mgr->mgr[b]) = uVar6; } -void xUpdateCull_MakeActive(xUpdateCullMgr* m, xUpdateCullEnt* e) +static void xUpdateCull_MakeActive(xUpdateCullMgr* m, xUpdateCullEnt* e) { U32 eIndex = e->index; U32 mEntActive = m->entActive; @@ -57,7 +55,7 @@ void xUpdateCull_MakeActive(xUpdateCullMgr* m, xUpdateCullEnt* e) } } -void xUpdateCull_MakeInactive(xUpdateCullMgr* m, xUpdateCullEnt* e) +static void xUpdateCull_MakeInactive(xUpdateCullMgr* m, xUpdateCullEnt* e) { U32 eIndex = e->index; U32 mEntActive = m->entActive; @@ -77,11 +75,262 @@ void xUpdateCull_MakeInactive(xUpdateCullMgr* m, xUpdateCullEnt* e) } } -void xUpdateCull_Reset(xUpdateCullMgr* m) +U32 xUpdateCull_AlwaysTrueCB(void* ent, void* cbdata) { - for (U32 i = m->entActive; i < m->entCount; i++) + return 1; +} + +U32 xUpdateCull_DistanceSquaredCB(void* ent, void* cbdata) +{ + FloatAndVoid fandv; + + if (((xEnt*)ent)->baseFlags & 0x80) { - xUpdateCull_MakeActive(m, m->mgr[i]); + return 1; + } + + xVec3* campos = &xglobals->camera.mat.pos; + + fandv.v = cbdata; + + F32 dist2 = SQR(((xEnt*)ent)->model->Mat->pos.x - campos->x) + + SQR(((xEnt*)ent)->model->Mat->pos.y - campos->y) + + SQR(((xEnt*)ent)->model->Mat->pos.z - campos->z); + return (dist2 < fandv.f); +} + +xUpdateCullMgr* xUpdateCull_Init(void** ent, U32 entCount, xGroup** group, U32 groupCount) +{ + void** tempEnt = NULL; + U32 tempCount = 0; + + if (entCount > 0) + { + tempEnt = (void**)(((((RwGlobals*)RwEngineInstance)->memoryFuncs).rwmalloc)( + (sizeof(void*) * entCount))); + + for (U32 idx = 0; idx < entCount; idx++) + { + if (!(((xEnt*)ent[idx])->baseFlags & 0x80)) + { + tempEnt[tempCount++] = ent[idx]; + } + } + } + ent = tempEnt; + entCount = tempCount; + + U32 i, j, k, gcnt, entsInThisGroup, entsInGroups, nonEmptyGroups; + S32 x; + + entsInGroups = 0; + nonEmptyGroups = 0; + + bool* inGroupArray = (bool*)(((((RwGlobals*)RwEngineInstance)->memoryFuncs).rwmalloc)( + (sizeof(bool) * entCount))); + memset(inGroupArray, 0, sizeof(bool) * entCount); + + for (i = 0; i < groupCount; i++) + { + entsInThisGroup = 0; + gcnt = xGroupGetCount(group[i]); + for (j = 0; j < gcnt; j++) + { + xBase* base = xGroupGetItemPtr(group[i], j); + for (k = 0; k < entCount; k++) + { + if (base == ent[k]) + { + inGroupArray[k] = true; + entsInGroups++; + entsInThisGroup++; + } + } + } + if (entsInThisGroup > 0) + { + nonEmptyGroups++; + } + } + + U32 mgrCount = entsInGroups; + for (i = 0; i < entCount; i++) + { + if (!inGroupArray[i]) + { + mgrCount++; + } + } + + U32 memsize = sizeof(xUpdateCullMgr) + sizeof(void*) * entCount + + sizeof(xUpdateCullEnt*) * entCount + sizeof(xUpdateCullEnt) * mgrCount + + sizeof(xUpdateCullGroup) * nonEmptyGroups; + + xUpdateCullMgr* m = (xUpdateCullMgr*)xMemAlloc(gActiveHeap, memsize, 0); + + m->ent = (void**)(m + 1); + m->mgr = (xUpdateCullEnt**)(m->ent + entCount); + m->mgrList = (xUpdateCullEnt*)(m->mgr + entCount); + m->grpList = (nonEmptyGroups > 0) ? (xUpdateCullGroup*)(m->mgrList + mgrCount) : NULL; + memset(m->mgr, 0, sizeof(xUpdateCullEnt*) * entCount); + m->entCount = entCount; + m->entActive = entCount; + m->mgrCount = mgrCount; + m->mgrCurr = 0; + m->grpCount = nonEmptyGroups; + m->activateCB = NULL; + m->deactivateCB = NULL; + memcpy(m->ent, ent, sizeof(void*) * entCount); + + S32 grpIndex = 0; + S32 mgrIndex = 0; + for (i = 0; i < groupCount; i++) + { + S32 startIndex = mgrIndex; + entsInThisGroup = 0; + gcnt = xGroupGetCount(group[i]); + for (j = 0; j < gcnt; j++) + { + xBase* base = xGroupGetItemPtr(group[i], j); + for (k = 0; k < entCount; k++) + { + if (base == ent[k]) + { + m->mgrList[mgrIndex].index = k; + m->mgrList[mgrIndex].groupIndex = grpIndex; + m->mgrList[mgrIndex].cb = xUpdateCull_AlwaysTrueCB; + m->mgrList[mgrIndex].cbdata = NULL; + m->mgrList[mgrIndex].nextInGroup = NULL; + m->mgr[k] = &m->mgrList[mgrIndex]; + + xUpdateCullEnt** prevPtr = NULL; + for (x = 0; x < mgrIndex; x++) + { + if (k == m->mgrList[x].index) + { + if (!m->mgrList[mgrIndex].nextInGroup) + { + m->mgrList[mgrIndex].nextInGroup = &m->mgrList[x]; + } + prevPtr = &m->mgrList[x].nextInGroup; + } + } + if (prevPtr) + { + *prevPtr = &m->mgrList[mgrIndex]; + } + mgrIndex++; + entsInThisGroup++; + } + } + } + if (entsInThisGroup) + { + m->grpList[grpIndex].active = 1; + m->grpList[grpIndex].startIndex = startIndex; + m->grpList[grpIndex].endIndex = mgrIndex - 1; + m->grpList[grpIndex].groupObject = group[i]; + grpIndex++; + } + } + + for (i = 0; i < entCount; i++) + { + if (!inGroupArray[i]) + { + m->mgrList[mgrIndex].index = i; + m->mgrList[mgrIndex].groupIndex = -1; + m->mgrList[mgrIndex].cb = xUpdateCull_AlwaysTrueCB; + m->mgrList[mgrIndex].cbdata = NULL; + m->mgrList[mgrIndex].nextInGroup = NULL; + m->mgr[i] = &m->mgrList[mgrIndex]; + mgrIndex++; + } + } + + for (i = 0; i < entCount; i++) + { + } + + RwFree(inGroupArray); + if (tempEnt) + { + RwFree(tempEnt); + } + + return m; +} + +void xUpdateCull_Update(xUpdateCullMgr* m, U32 percent_update) +{ + S32 numiters = m->mgrCount * percent_update / 100; + if (numiters <= 0) + { + numiters = 1; + } + + while (numiters > 0) + { + U32 i; + xUpdateCullEnt* cent = &m->mgrList[m->mgrCurr]; + U32 result = cent->cb(m->ent[cent->index], cent->cbdata); + if (cent->groupIndex == -1) + { + if (result == 1) + { + xUpdateCull_MakeActive(m, cent); + } + else + { + xUpdateCull_MakeInactive(m, cent); + } + m->mgrCurr++; + numiters--; + } + else + { + xUpdateCullGroup* grp = &m->grpList[cent->groupIndex]; + if (result == 1) + { + if (!grp->active) + { + grp->active = 1; + for (i = grp->startIndex; i <= grp->endIndex; i++) + { + xUpdateCull_MakeActive(m, &m->mgrList[i]); + } + } + numiters -= grp->endIndex + 1 - m->mgrCurr; + m->mgrCurr = grp->endIndex + 1; + } + else + { + if (m->mgrCurr == grp->endIndex && grp->active) + { + grp->active = 0; + for (i = grp->startIndex; i <= grp->endIndex; i++) + { + cent = &m->mgrList[i]; + for (xUpdateCullEnt* curr = cent->nextInGroup; curr && curr != cent; + curr = curr->nextInGroup) + { + if (m->grpList[curr->groupIndex].active) + { + goto loc_80101E10; + } + } + xUpdateCull_MakeInactive(m, &m->mgrList[i]); + loc_80101E10:; + } + } + m->mgrCurr++; + numiters--; + } + } + if (m->mgrCurr >= m->mgrCount) + { + m->mgrCurr = 0; + } } } @@ -89,10 +338,18 @@ void xUpdateCull_SetCB(xUpdateCullMgr* m, void* entity, xUpdateCullEntCallback c { for (U32 i = 0; i < m->mgrCount; i++) { - if (*(void **)(&m->ent[m->mgrList[i].index]) == entity) + if (*(void**)(&m->ent[m->mgrList[i].index]) == entity) { m->mgrList[i].cb = cb; m->mgrList[i].cbdata = cbdata; } } -} \ No newline at end of file +} + +void xUpdateCull_Reset(xUpdateCullMgr* m) +{ + for (U32 i = m->entActive; i < m->entCount; i++) + { + xUpdateCull_MakeActive(m, m->mgr[i]); + } +} diff --git a/src/SB/Core/x/xUpdateCull.h b/src/SB/Core/x/xUpdateCull.h index 0a1c537cf..c545bb935 100644 --- a/src/SB/Core/x/xUpdateCull.h +++ b/src/SB/Core/x/xUpdateCull.h @@ -54,6 +54,5 @@ xUpdateCullMgr* xUpdateCull_Init(void** ent, U32 entCount, xGroup** group, U32 g void xUpdateCull_Update(xUpdateCullMgr* m, U32 percent_update); void xUpdateCull_SetCB(xUpdateCullMgr* m, void* entity, xUpdateCullEntCallback cb, void* cbdata); void xUpdateCull_Reset(xUpdateCullMgr* m); -void xUpdateCull_MakeActive(xUpdateCullMgr* m, xUpdateCullEnt* e); #endif diff --git a/src/bink/include/bink.h b/src/bink/include/bink.h index cf1a381c6..67582f244 100644 --- a/src/bink/include/bink.h +++ b/src/bink/include/bink.h @@ -308,11 +308,13 @@ typedef struct BINKSUMMARY typedef struct BINKREALTIME { + // TODO: marked these as volatile to get matches in radcb + u32 FrameNum; // Current frame number - u32 FrameRate; // frame rate + volatile u32 FrameRate; // frame rate u32 FrameRateDiv; // frame rate divisor u32 Frames; // frames in this sample period - u32 FramesTime; // time is ms for these frames + volatile u32 FramesTime; // time is ms for these frames u32 FramesVideoDecompTime; // time decompressing these frames u32 FramesAudioDecompTime; // time decompressing these frames u32 FramesReadTime; // time reading these frames @@ -322,6 +324,7 @@ typedef struct BINKREALTIME u32 ReadBufferSize; // size of read buffer u32 ReadBufferUsed; // amount of read buffer currently used u32 FramesDataRate; // data rate for these frames + // last offset it 0x34 } BINKREALTIME; #define BINKMARKER1 'fKIB' diff --git a/src/bink/shared/time/radcb.c b/src/bink/shared/time/radcb.c index 3756d01f2..ecb5c1e71 100644 --- a/src/bink/shared/time/radcb.c +++ b/src/bink/shared/time/radcb.c @@ -1,17 +1,69 @@ #include "binkngc.h" #include -void RADCB_unregister_2_callbacks(BINKIO* io) +// TODO: review the args here and make sure these make some sort of sense. +// Considering there are multiple different structs that these functions could access and still match try to be mindful of which you use +// Using BINKREALTIME seems to make the most sense at this moment + +void RADCB_register_callback(BINKSUMMARY* bnk, BINKSUMMARY* bnkReal, HBINK bnk3, HBINK bnk4) { } +u32 RADCB_unregister_callback(BINKREALTIME* bnk, BINKREALTIME* bnk1, u32 tmp) +{ + int iVar1; + u32 uVar2; + + uVar2 = 0; + if ((((bnk != 0) && (bnk1 != 0)) && (bnk1->FramesAudioDecompTime != 0)) && + bnk1->FramesVideoDecompTime != 0) + { + OSDisableInterrupts(); + if (((remove_cb_from_list(bnk, bnk1) != 0) && (bnk = bnk + -1, (tmp & 1) != 0)) && + (bnk == 0)) + { + uVar2 = 1; + RADCB_free_handler(bnk); + } + OSRestoreInterrupts(); + } + return uVar2; +} + +u32 RADCB_unregister_2_callbacks(BINKIO* io, BINKIO* io2, BINKIO* io3, BINKIO* io4, u32 tmp) +{ + return RADCB_unregister_callback(io, io2, tmp) | RADCB_unregister_callback(io3, io4, tmp) << 1; +} + u32 RADCB_registered_count(BINKIO io) { return io.ThreadTime; } -u32 RADCB_try_to_suspend_handler(BINKIO* io) +u32 RADCB_try_to_suspend_handler(BINKREALTIME* bnk) { + u32 tmpReg; + + if ((bnk != 0)) + { + OSDisableInterrupts(); + if (bnk->FrameNum == 1) + { + bnk->FrameNum = 2; + } + bnk->FrameRate = bnk->FrameRate + 1; + OSRestoreInterrupts(); + tmpReg = 1; + if (bnk->FrameNum == 1) + { + tmpReg = 0; + } + } + else + { + tmpReg = 1; + } + return tmpReg; } void RADCB_suspend_handler(BINKIO* io) @@ -22,31 +74,57 @@ void RADCB_suspend_handler(BINKIO* io) } } -// TODO: -// BINKIO* as the arg probably isnt right -// io->callback_control is definitely wrong -void RADCB_resume_handler(BINKIO* io) +void RADCB_resume_handler(BINKREALTIME* bnk) { - if (io != NULL) + if (bnk != NULL) { OSDisableInterrupts(); - io->callback_control[1] = io->callback_control[1] + -1; - if (io->callback_control[1] == 0) + bnk->FrameRate = bnk->FrameRate + -1; + if (bnk->FrameRate == 0) { - io->ReadHeader = 1; + bnk->FrameNum = 1; } OSRestoreInterrupts(); } } -void RADCB_try_to_suspend_callback(HBINK bnk, HBINK bnk1) +HBINK RADCB_try_to_suspend_callback(HBINK bnk, BINKREALTIME* bnk1) { + u32 tmpReg; + + if ((((bnk != 0) && (bnk1 != 0)) && (bnk1->FramesAudioDecompTime != 0)) && + bnk1->FramesVideoDecompTime != 0) + { + OSDisableInterrupts(); + if (bnk1->Frames == 1) + { + bnk1->Frames = 2; + } + bnk1->FramesTime = bnk1->FramesTime + 1; + OSRestoreInterrupts(); + tmpReg = 1; + if (bnk1->Frames == 1) + { + tmpReg = 0; + } + } + else + { + tmpReg = 1; + } + return tmpReg; } -// (int param_1,int param_2) -void RADCB_suspend_callback(HBINK bnk, HBINK bnk1) +void RADCB_suspend_callback(HBINK bnk, BINKREALTIME* bnk1) { - return; + if ((((bnk != 0) && (bnk1 != 0)) && (bnk1->FramesAudioDecompTime != 0)) && + bnk1->FramesVideoDecompTime != 0) + { + while (RADCB_try_to_suspend_callback(bnk, bnk1) == 0) + { + OSYieldThread(); + } + } } void RADCB_suspend_2_callbacks(BINKIO* io, BINKIO* io2, BINKIO* io3, BINKIO* io4) @@ -55,8 +133,23 @@ void RADCB_suspend_2_callbacks(BINKIO* io, BINKIO* io2, BINKIO* io3, BINKIO* io4 RADCB_suspend_callback(io3, io4); } -void RADCB_resume_callback(HBINK bnk, HBINK bnk1) +// TODO: +// Make sure that this function is correct. +// To get this match I had to mark FramesTime as volatile in the header +void RADCB_resume_callback(HBINK bnk, BINKREALTIME* bnk1) { + if ((((bnk != 0) && (bnk1 != 0)) && (bnk1->FramesAudioDecompTime != 0)) && + bnk1->FramesVideoDecompTime != 0) + { + OSDisableInterrupts(); + bnk1->FramesTime--; + if (bnk1->FramesTime == 0) + { + bnk1->Frames = 1; + } + + OSRestoreInterrupts(); + } } void RADCB_suspend_2_handlers(BINKIO* io, BINKIO* io2)