Skip to content

Commit

Permalink
OnlineCTR 60fps crashing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Niko committed Jul 11, 2024
1 parent 33c0814 commit 8ede8b0
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 60 deletions.
39 changes: 39 additions & 0 deletions decompile/General/AltMods/Mods4.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,45 @@ void RunVehicleThread(VehicleFuncPtr func, struct Thread* thread, struct Driver*
func(thread, driver);
if (restore) { sdata->gGT->gameMode1 |= END_OF_RACE; }
}

void RunVehicleSet13(struct Thread* dThread, struct Driver* dOnline)
{
if(dThread->funcThTick != 0)
return;

// This only works because we have NO collision
// and therefore NO bounce physics, update P1
// first, then update other drivers later

// We can still "eventually" have mask-weapon
// collision, but no "bounce" physics with this logic

for(int iVar11 = 0; iVar11 < 13; iVar11++)
{
int pcVar5 = dOnline->funcPtrs[iVar11];

if(pcVar5 == 0)
continue;

RunVehicleThread(pcVar5, dThread, dOnline);

#ifdef USE_60FPS
#ifndef REBUILD_PS1
// if this function just ran
if(pcVar5 == VehFrameProc_Driving)
{
// only if jumping animation,
// otherwise wheelie gets bugged
if(dOnline->instSelf->animIndex == 3)
{
dOnline->matrixIndex =
dOnline->matrixIndex >> 1;
}
}
#endif
#endif
}
}
#endif

#ifdef USE_ONLINE
Expand Down
58 changes: 2 additions & 56 deletions decompile/General/MAIN/MainFrame_GameLogic.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,36 +244,7 @@ void DECOMP_MainFrame_GameLogic(struct GameTracker* gGT, struct GamepadSystem* g

DECOMP_VehPickupItem_ShootOnCirclePress(dOnline);

// This only works because we have NO collision
// and therefore NO bounce physics, update P1
// first, then update other drivers later

if(dThread->funcThTick == 0)
for(iVar11 = 0; iVar11 < 13; iVar11++)
{
pcVar5 = dOnline->funcPtrs[iVar11];

if(pcVar5 != 0)
{
RunVehicleThread(pcVar5, dThread, dOnline);

#ifdef USE_60FPS
#ifndef REBUILD_PS1
// if this function just ran
if(pcVar5 == VehFrameProc_Driving)
{
// only if jumping animation,
// otherwise wheelie gets bugged
if(psVar9->instSelf->animIndex == 3)
{
psVar9->matrixIndex =
psVar9->matrixIndex >> 1;
}
}
#endif
#endif
}
}
RunVehicleSet13(dThread, dOnline);

octr->sleepControl = 1;
octr->desiredFPS = FPS_DOUBLE(30);
Expand All @@ -290,32 +261,7 @@ void DECOMP_MainFrame_GameLogic(struct GameTracker* gGT, struct GamepadSystem* g

struct Thread* dThread = dOnline->instSelf->thread;

if(dThread->funcThTick == 0)
for(iVar11 = 0; iVar11 < 13; iVar11++)
{
pcVar5 = dOnline->funcPtrs[iVar11];

if(pcVar5 != 0)
{
RunVehicleThread(pcVar5, dThread, dOnline);

#ifdef USE_60FPS
#ifndef REBUILD_PS1
// if this function just ran
if(pcVar5 == VehFrameProc_Driving)
{
// only if jumping animation,
// otherwise wheelie gets bugged
if(psVar9->instSelf->animIndex == 3)
{
psVar9->matrixIndex =
psVar9->matrixIndex >> 1;
}
}
#endif
#endif
}
}
RunVehicleSet13(dThread, dOnline);
}
}

Expand Down
7 changes: 3 additions & 4 deletions decompile/General/MAIN/MainFrame_RenderFrame.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,14 @@ void DECOMP_MainFrame_RenderFrame(struct GameTracker* gGT, struct GamepadSystem*
{
DECOMP_DotLights(gGT);

#ifndef USE_ONLINE
if((gGT->renderFlags & 0x8000) != 0)
{
WindowBoxLines(gGT);

#ifndef USE_ONLINE
WindowDivsionLines(gGT);
#endif
}

#endif
}

#ifndef REBUILD_PS1
Expand Down Expand Up @@ -1507,6 +1506,7 @@ void MultiplayerWumpaHUD(struct GameTracker* gGT)
#endif
}

#ifndef USE_ONLINE
void WindowBoxLines(struct GameTracker* gGT)
{
int i;
Expand Down Expand Up @@ -1534,7 +1534,6 @@ void WindowBoxLines(struct GameTracker* gGT)
}
}

#ifndef USE_ONLINE
void WindowDivsionLines(struct GameTracker* gGT)
{
POLY_F4* p;
Expand Down

0 comments on commit 8ede8b0

Please sign in to comment.