mirror of https://github.com/zeldaret/tp.git
88 lines
2.3 KiB
C
88 lines
2.3 KiB
C
//
|
|
// Generated By: dol2asm
|
|
// Translation Unit: OSResetSW
|
|
//
|
|
|
|
#include "dolphin/os/OSResetSW.h"
|
|
#include "dol2asm.h"
|
|
#include "dolphin/os/OS.h"
|
|
|
|
u8 GameChoice : (OS_BASE_CACHED | 0x30E3);
|
|
|
|
vu32 __PIRegs[12] : 0xCC003000;
|
|
|
|
void __OSResetSWInterruptHandler(OSInterrupt interrupt, OSContext* context);
|
|
|
|
//
|
|
// External References:
|
|
//
|
|
|
|
void __div2i();
|
|
|
|
//
|
|
// Declarations:
|
|
//
|
|
|
|
/* ############################################################################################## */
|
|
/* 804516A0-804516A4 000BA0 0004+00 1/1 0/0 0/0 .sbss ResetCallback */
|
|
static OSResetCallback ResetCallback;
|
|
|
|
/* 804516A4-804516A8 000BA4 0004+00 2/2 0/0 0/0 .sbss Down */
|
|
static BOOL Down;
|
|
|
|
/* 804516A8-804516B0 000BA8 0004+04 2/2 0/0 0/0 .sbss LastState */
|
|
static BOOL LastState;
|
|
|
|
/* 804516B0-804516B4 000BB0 0004+00 1/1 0/0 0/0 .sbss HoldUp */
|
|
static OSTime HoldUp;
|
|
|
|
/* 804516B8-804516BC 000BB8 0004+00 2/2 0/0 0/0 .sbss HoldDown */
|
|
static OSTime HoldDown;
|
|
|
|
/* 8033FAE4-8033FBD8 33A424 00F4+00 0/0 1/1 0/0 .text __OSResetSWInterruptHandler */
|
|
#ifdef NONMATCHING
|
|
void __OSResetSWInterruptHandler(OSInterrupt interrupt, OSContext* context) {
|
|
OSResetCallback callback;
|
|
|
|
HoldDown = __OSGetSystemTime();
|
|
while (__OSGetSystemTime() - HoldDown < OSMicrosecondsToTicks(100) &&
|
|
!(__PIRegs[0] & 0x00010000)) {
|
|
;
|
|
}
|
|
if (!(__PIRegs[0] & 0x00010000)) {
|
|
LastState = Down = TRUE;
|
|
__OSMaskInterrupts(OS_INTERRUPTMASK_PI_RSW);
|
|
if (ResetCallback) {
|
|
callback = ResetCallback;
|
|
ResetCallback = NULL;
|
|
callback();
|
|
}
|
|
}
|
|
__PIRegs[0] = 2;
|
|
}
|
|
#else
|
|
#pragma push
|
|
#pragma optimization_level 0
|
|
#pragma optimizewithasm off
|
|
asm void __OSResetSWInterruptHandler(OSInterrupt interrupt, OSContext* context) {
|
|
nofralloc
|
|
#include "asm/dolphin/os/OSResetSW/__OSResetSWInterruptHandler.s"
|
|
}
|
|
#pragma pop
|
|
#endif
|
|
|
|
/* 8033FBD8-8033FE70 33A518 0298+00 1/1 0/0 0/0 .text OSGetResetButtonState */
|
|
#pragma push
|
|
#pragma optimization_level 0
|
|
#pragma optimizewithasm off
|
|
static asm BOOL OSGetResetButtonState(void) {
|
|
nofralloc
|
|
#include "asm/dolphin/os/OSResetSW/OSGetResetButtonState.s"
|
|
}
|
|
#pragma pop
|
|
|
|
/* 8033FE70-8033FE90 33A7B0 0020+00 0/0 1/1 0/0 .text OSGetResetSwitchState */
|
|
BOOL OSGetResetSwitchState(void) {
|
|
return OSGetResetButtonState();
|
|
}
|