Files
dusklight/libs/dolphin/src/ax/AXProf.c
T
Luke Street 4df8ccc871 Reorganize library code into libs/ (#3119)
* Reorganize files into libs/{dolphin,JSystem,PowerPC_EABI_Support,revolution,TRK_MINNOW_DOLPHIN}

* Update configure.py and project.py for new libs structure

* Refactor `#include <dolphin/x.h>` -> `<x.h>`

* Remove `__REVOLUTION_SDK__` forwards from dolphin

* Fix dolphin/ references in revolution

* Wrap `#include <dolphin.h>` in `!__REVOLUTION_SDK__`

* Always build TRK against dolphin headers

* Resolve revolution SDK header resolution issues
2026-03-01 14:35:36 -08:00

48 lines
957 B
C

#include <dolphin/dolphin.h>
#include <dolphin/ax.h>
#include "__ax.h"
static AXPROFILE* __AXProfile;
static u32 __AXMaxProfiles;
static u32 __AXCurrentProfile;
static u32 __AXProfileInitialized;
AXPROFILE* __AXGetCurrentProfile(void) {
AXPROFILE* profile;
if (__AXProfileInitialized != 0) {
profile = &__AXProfile[__AXCurrentProfile];
__AXCurrentProfile += 1;
__AXCurrentProfile %= __AXMaxProfiles;
return profile;
}
return 0;
}
void AXInitProfile(AXPROFILE* profile, u32 maxProfiles) {
ASSERTLINE(60, profile);
ASSERTLINE(61, maxProfiles);
__AXProfile = profile;
__AXMaxProfiles = maxProfiles;
__AXCurrentProfile = 0;
__AXProfileInitialized = 1;
}
u32 AXGetProfile(void) {
BOOL old;
u32 n;
old = OSDisableInterrupts();
n = __AXCurrentProfile;
if (n != 0) {
n -= 1;
}
__AXCurrentProfile = 0;
OSRestoreInterrupts(old);
return n;
}