| 39 | } |
| 40 | |
| 41 | BOOL OSGetResetButtonState(void) |
| 42 | { |
| 43 | BOOL enabled; |
| 44 | BOOL state; |
| 45 | u32 reg; |
| 46 | OSTime now; |
| 47 | |
| 48 | enabled = OSDisableInterrupts(); |
| 49 | |
| 50 | now = __OSGetSystemTime(); |
| 51 | |
| 52 | reg = __PIRegs[0]; |
| 53 | if (!(reg & 0x00010000)) |
| 54 | { |
| 55 | if (!Down) |
| 56 | { |
| 57 | Down = TRUE; |
| 58 | state = HoldUp ? TRUE : FALSE; |
| 59 | HoldDown = now; |
| 60 | } |
| 61 | else |
| 62 | { |
| 63 | state = (HoldUp || (OSMicrosecondsToTicks(100) < now - HoldDown)) ? TRUE : FALSE; |
| 64 | } |
| 65 | } |
| 66 | else if (Down) |
| 67 | { |
| 68 | Down = FALSE; |
| 69 | state = LastState; |
| 70 | if (state) |
| 71 | { |
| 72 | HoldUp = now; |
| 73 | } |
| 74 | else |
| 75 | { |
| 76 | HoldUp = 0; |
| 77 | } |
| 78 | } |
| 79 | else if (HoldUp && (now - HoldUp < OSMillisecondsToTicks(40))) |
| 80 | { |
| 81 | state = TRUE; |
| 82 | } |
| 83 | else |
| 84 | { |
| 85 | state = FALSE; |
| 86 | HoldUp = 0; |
| 87 | } |
| 88 | |
| 89 | LastState = state; |
| 90 | |
| 91 | if (GameChoice & 0x3f) |
| 92 | { |
| 93 | OSTime fire = (GameChoice & 0x3f) * 60; |
| 94 | fire = __OSStartTime + OSSecondsToTicks(fire); |
| 95 | if (fire < now) |
| 96 | { |
| 97 | now -= fire; |
| 98 | now = OSTicksToSeconds(now) / 2; |
no test coverage detected