From 190b78549e0fa1a801786e73d914185e1fbca2a6 Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Mon, 11 Sep 2023 17:38:31 -0700 Subject: Non libultra Boot Cleanup (#1370) * reorganize * math64 * rcp_utils * osSyncPrintfUnused * comment spacing --- src/boot/O2/padsetup.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/boot/O2/padsetup.c (limited to 'src/boot/O2/padsetup.c') diff --git a/src/boot/O2/padsetup.c b/src/boot/O2/padsetup.c new file mode 100644 index 000000000..9cef6f196 --- /dev/null +++ b/src/boot/O2/padsetup.c @@ -0,0 +1,34 @@ +#include "global.h" + +s32 PadSetup_Init(OSMesgQueue* mq, u8* outMask, OSContStatus* status) { + s32 ret; + s32 i; + + *outMask = 0xFF; + ret = osContInit(mq, outMask, status); + if (ret != 0) { + return ret; + } + if (*outMask == 0xFF) { + if (osContStartQuery(mq) != 0) { + return 1; + } + osRecvMesg(mq, NULL, OS_MESG_BLOCK); + osContGetQuery(status); + + *outMask = 0; + + for (i = 0; i < MAXCONTROLLERS; i++) { + switch (status[i].errno) { + case 0: + if (status[i].type == CONT_TYPE_NORMAL) { + *outMask |= 1 << i; + } + break; + default: + break; + } + } + } + return 0; +} -- cgit v1.2.3