1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-15 04:14:34 +00:00

More documentation for padmgr.c (#1336)

* More documentation for padmgr.c

* Update comments

* Further suggested changes

* Suggested changes

* LOG_SEVERITY_INFO -> LOG_SEVERITY_CRITICAL

* Adjust PadMgr_RequestPadData comment

* Avoid array notation for args, adjust comment, rename the FaultMgr padInput field to inputs to better reflect it's an array
This commit is contained in:
Tharo 2022-09-03 01:52:13 +01:00 committed by GitHub
parent c0cf83a814
commit 6b77ddba5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 481 additions and 338 deletions

View file

@ -352,18 +352,25 @@ void Fault_Sleep(u32 msec) {
Fault_SleepImpl(msec);
}
void PadMgr_RequestPadData(Input* input, s32 mode);
#ifndef AVOID_UB
void PadMgr_RequestPadData(Input* inputs, s32 gameRequest);
#endif
void Fault_PadCallback(Input* input) {
void Fault_PadCallback(Input* inputs) {
//! @bug This function is not called correctly, it is missing a leading PadMgr* argument. This
//! renders the crash screen unusable.
//! In Majora's Mask, PadMgr functions were changed to not require this argument, and this was
//! likely just not addressed when backporting.
PadMgr_RequestPadData(input, 0);
#ifndef AVOID_UB
PadMgr_RequestPadData(inputs, false);
#else
// Guarantee crashing behavior: false -> NULL, previous value in a2 is more often non-zero than zero
PadMgr_RequestPadData((PadMgr*)inputs, NULL, true);
#endif
}
void Fault_UpdatePadImpl(void) {
sFaultInstance->padCallback(&sFaultInstance->padInput);
sFaultInstance->padCallback(sFaultInstance->inputs);
}
/**
@ -376,7 +383,7 @@ void Fault_UpdatePadImpl(void) {
* DPad-Left continues and returns false
*/
u32 Fault_WaitForInputImpl(void) {
Input* input = &sFaultInstance->padInput;
Input* input = &sFaultInstance->inputs[0];
s32 count = 600;
u32 pressedBtn;
@ -651,7 +658,7 @@ void Fault_Wait5Seconds(void) {
* (L & R & Z) + DPad-Up + C-Down + C-Up + DPad-Down + DPad-Left + C-Left + C-Right + DPad-Right + (B & A & START)
*/
void Fault_WaitForButtonCombo(void) {
Input* input = &sFaultInstance->padInput;
Input* input = &sFaultInstance->inputs[0];
s32 state;
u32 s1;
u32 s2;
@ -853,7 +860,7 @@ void Fault_DrawMemDumpContents(const char* title, uintptr_t addr, u32 arg2) {
* @param cRightJump Unused parameter, pressing C-Right jumps to this address
*/
void Fault_DrawMemDump(uintptr_t pc, uintptr_t sp, uintptr_t cLeftJump, uintptr_t cRightJump) {
Input* input = &sFaultInstance->padInput;
Input* input = &sFaultInstance->inputs[0];
uintptr_t addr = pc;
s32 scrollCountdown;
u32 off;