Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Niko committed Feb 16, 2025
1 parent 674c3a3 commit 63fa227
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
13 changes: 8 additions & 5 deletions decompile/General/AltMods/Mods9.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ struct ProfilerSection* ptrOpenSect=0;

static int numSectionsUsed = 0;

int GetTime()
int Debug_GetPreciseTime()
{
// placeholder
return 0;
int sysClock =
GetRCnt(0xf2000001) +
sdata->rcntTotalUnits;

return sysClock;
}

void DebugProfiler_Init()
Expand Down Expand Up @@ -100,7 +103,7 @@ void DebugProfiler_SectionStart(char* name, char r, char g, char b)

ptrOpenSect->flagsVDT = 0;

ptrOpenSect->timeStart = GetTime();
ptrOpenSect->timeStart = Debug_GetPreciseTime();
}

void DebugProfiler_SectionRestart(int time)
Expand All @@ -116,7 +119,7 @@ void DebugProfiler_SectionEnd()
if(ptrOpenSect == 0)
return;

ptrOpenSect->timeEnd = GetTime();
ptrOpenSect->timeEnd = Debug_GetPreciseTime();
ptrOpenSect = 0;

numSectionsUsed++;
Expand Down
10 changes: 10 additions & 0 deletions decompile/General/Timer/Timer_2_GetTime_Total.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <common.h>

int DECOMP_Timer_GetTime_Total()
{
int sysClock =
GetRCnt(0xf2000001) +
sdata->rcntTotalUnits;

return (sysClock * 1000) / 0x147e;
}
2 changes: 1 addition & 1 deletion decompile/buildList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ common, exe, TakeCupProgress_Activate, 0x0, General/TakeCupProgress
// ====================================================================================================================
common, exe, Timer_Init, 0x0, General/Timer/Timer_0_Init.c
common, exe, Timer_Destroy, 0x0, General/Timer/Timer_1_Destroy.c
//common, exe, Timer_GetTime_Total, 0x0, General/Timer/Timer_2_GetTime_Total.c //TODO
common, exe, Timer_GetTime_Total, 0x0, General/Timer/Timer_2_GetTime_Total.c
//common, exe, Timer_GetTime_Elapsed, 0x0, General/Timer/Timer_3_GetTime_Elapsed.c //TODO

// ====================================================================================================================
Expand Down
10 changes: 1 addition & 9 deletions ghidra/Timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,9 @@ int FUN_8004b3a4(void)
// time past since vsync
lVar1 = GetRCnt(0xf2000001);

// if less than 100 units past,
// which is less than 0.006 seconds
// This does nothing
if (lVar1 < 100)
{
// update, cause vsyncCallback
// already changed it since setting
// iVar2 the first time

// Check assembly, make sure
// this actually updates, try
// Redhotbr's "volatile" idea
iVar2 = DAT_8008d988;
}

Expand Down

0 comments on commit 63fa227

Please sign in to comment.