From 24cd976235efedbb8ea36215965b316afe3c918d Mon Sep 17 00:00:00 2001 From: "fix94.1" Date: Mon, 30 Jan 2012 16:55:27 +0000 Subject: [PATCH] -changed wiimote init code again to hopefully fix the init problem for everyone --- source/loader/sys.c | 21 +++++++++++++++------ source/main.cpp | 5 +++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/source/loader/sys.c b/source/loader/sys.c index 571f0809..734986af 100644 --- a/source/loader/sys.c +++ b/source/loader/sys.c @@ -23,14 +23,23 @@ static bool return_to_priiloader = false; static bool return_to_disable = false; static bool return_to_bootmii = false; + +void __Wpad_PowerCallback(s32 chan) +{ + /* Poweroff console */ + shutdown = 1; +} + void Open_Inputs(void) { - if(WPAD_GetStatus() != WPAD_STATE_ENABLED && WPAD_GetStatus() != WPAD_STATE_ENABLING) - { - WPAD_Init(); - PAD_Init(); - WPAD_SetDataFormat(WPAD_CHAN_ALL, WPAD_FMT_BTNS_ACC_IR); - } + /* Initialize Wiimote subsystem */ + PAD_Init(); + WPAD_Init(); + + /* Set POWER button callback */ + WPAD_SetPowerButtonCallback(__Wpad_PowerCallback); + + WPAD_SetDataFormat(WPAD_CHAN_ALL, WPAD_FMT_BTNS_ACC_IR); } void Close_Inputs(void) diff --git a/source/main.cpp b/source/main.cpp index c367c7f2..d7437b7b 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -89,12 +89,13 @@ int main(int argc, char **argv) } if(!deviceAvailable) Sys_Exit(); - Open_Inputs(); // xFede: Initialize WPAD/PAD here, otherwise you could have a sync-delay on startup - bool dipOK = Disc_Init() >= 0; CMenu menu(vid); menu.init(); + + Open_Inputs(); //we should init inputs as last point + mainMenu = &menu; if (!iosOK) {