blob: 53073df994ffd4f6e2f31aa3be01410b966aefbf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#ifdef BBPLAYER
#include "ultra64.h"
u32 __osBbLastRCount;
u32 __osBbRCountWraps;
u32 __osBbLastVCount;
u32 __osBbVCountWraps;
u32 osGetCount(void) {
u32 count;
u32 mask = __osDisableInt();
__asm__("mfc0 %0, $%1" : "=r"(count) : "i"(C0_COUNT));
if (count < __osBbLastRCount) {
__osBbRCountWraps++;
}
__osBbLastRCount = count;
count = (((u64)__osBbRCountWraps << 32) | count) * 125ull / 192ull;
if (count < __osBbLastVCount) {
__osBbVCountWraps++;
}
__osBbLastVCount = count;
__osRestoreInt(mask);
return count;
}
#endif
|