mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-12-01 00:40:51 +00:00
parent
eae3cfbe94
commit
613e268609
@ -3,9 +3,10 @@
|
||||
typedef struct {
|
||||
u16 rootCounter;
|
||||
s16 unk2;
|
||||
s32 mode;
|
||||
s32 target;
|
||||
s32 padding;
|
||||
s16 mode;
|
||||
s16 : 16;
|
||||
s16 target;
|
||||
s32 : 32;
|
||||
} Counter;
|
||||
|
||||
// https://psx-spx.consoledev.net/timers/
|
||||
@ -14,7 +15,34 @@ extern volatile s32* D_8002D3B4; // _interrupt_status_register
|
||||
extern volatile Counter* D_8002D3B8; // _counters
|
||||
extern volatile s32 D_8002D3BC[4]; // _interrupt_status_masks
|
||||
|
||||
INCLUDE_ASM("main/nonmatchings/psxsdk/libapi/counter", SetRCnt);
|
||||
s32 SetRCnt(s32 spec, s16 target, s32 flags) {
|
||||
s32 i = spec & 0xFFFF;
|
||||
s32 final_mode = 0x48;
|
||||
if (i >= 3) {
|
||||
return 0;
|
||||
}
|
||||
D_8002D3B8[i].mode = 0;
|
||||
D_8002D3B8[i].target = target;
|
||||
|
||||
if (i < 2u) {
|
||||
if (flags & 0x10) {
|
||||
final_mode = 0x49;
|
||||
}
|
||||
if (!(flags & 1)) {
|
||||
final_mode |= 0x100;
|
||||
}
|
||||
} else if (i == 2u) { // nb: `else` is redundant here
|
||||
if (!(flags & 1)) {
|
||||
final_mode = 0x248;
|
||||
}
|
||||
}
|
||||
if ((flags & 0x1000) != 0) {
|
||||
final_mode |= 0x10;
|
||||
}
|
||||
|
||||
D_8002D3B8[i].mode = final_mode;
|
||||
return 1;
|
||||
}
|
||||
|
||||
long GetRCnt(long spec) {
|
||||
s32 i = spec & 0xFFFF;
|
||||
|
Loading…
Reference in New Issue
Block a user