mirror of
https://github.com/wiiu-env/AutobootModule.git
synced 2024-11-01 01:25:05 +01:00
Another attempt to make quick starting (aborting) more reliable
This commit is contained in:
parent
77afefaccb
commit
0ce39e61be
@ -1,13 +1,10 @@
|
|||||||
#include <malloc.h>
|
#include "QuickStartUtils.h"
|
||||||
|
|
||||||
#include "BootUtils.h"
|
#include "BootUtils.h"
|
||||||
#include "MenuUtils.h"
|
#include "MenuUtils.h"
|
||||||
#include "QuickStartUtils.h"
|
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
|
||||||
#include <coreinit/exit.h>
|
#include <coreinit/exit.h>
|
||||||
#include <coreinit/foreground.h>
|
#include <coreinit/foreground.h>
|
||||||
#include <coreinit/launch.h>
|
|
||||||
#include <coreinit/memdefaultheap.h>
|
#include <coreinit/memdefaultheap.h>
|
||||||
#include <coreinit/thread.h>
|
#include <coreinit/thread.h>
|
||||||
#include <nn/acp/title.h>
|
#include <nn/acp/title.h>
|
||||||
@ -118,11 +115,12 @@ private:
|
|||||||
class QuickStartAutoAbort {
|
class QuickStartAutoAbort {
|
||||||
public:
|
public:
|
||||||
QuickStartAutoAbort() {
|
QuickStartAutoAbort() {
|
||||||
OSCreateAlarm(&mAlarm);
|
OSCreateAlarm(&mDRCConnectedAlarm);
|
||||||
OSSetPeriodicAlarm(&mDRCConnectedAlarm,
|
OSSetPeriodicAlarm(&mDRCConnectedAlarm,
|
||||||
OSSecondsToTicks(10),
|
OSGetTime() + OSSecondsToTicks(10),
|
||||||
OSSecondsToTicks(1),
|
OSSecondsToTicks(1),
|
||||||
&AbortOnDRCDisconnect);
|
&AbortOnDRCDisconnect);
|
||||||
|
OSCreateAlarm(&mAlarm);
|
||||||
OSSetAlarm(&mAlarm, OSSecondsToTicks(120), AbortQuickStartTitle);
|
OSSetAlarm(&mAlarm, OSSecondsToTicks(120), AbortQuickStartTitle);
|
||||||
mDRCConnected = IsDRCConnected();
|
mDRCConnected = IsDRCConnected();
|
||||||
}
|
}
|
||||||
@ -130,6 +128,9 @@ public:
|
|||||||
OSCancelAlarm(&mDRCConnectedAlarm);
|
OSCancelAlarm(&mDRCConnectedAlarm);
|
||||||
OSCancelAlarm(&mAlarm);
|
OSCancelAlarm(&mAlarm);
|
||||||
|
|
||||||
|
OSWaitAlarm(&mDRCConnectedAlarm);
|
||||||
|
OSWaitAlarm(&mAlarm);
|
||||||
|
|
||||||
// Reconnect the DRC if it was connected at launch but then disconnected;
|
// Reconnect the DRC if it was connected at launch but then disconnected;
|
||||||
if (mDRCConnected && !IsDRCConnected()) {
|
if (mDRCConnected && !IsDRCConnected()) {
|
||||||
DEBUG_FUNCTION_LINE("Wake up GamePad");
|
DEBUG_FUNCTION_LINE("Wake up GamePad");
|
||||||
@ -140,12 +141,14 @@ public:
|
|||||||
|
|
||||||
static bool IsDRCConnected() {
|
static bool IsDRCConnected() {
|
||||||
CCRCDCDrcState state = {};
|
CCRCDCDrcState state = {};
|
||||||
CCRCDCSysGetDrcState(CCR_CDC_DESTINATION_DRC0, &state);
|
if (CCRCDCSysGetDrcState(CCR_CDC_DESTINATION_DRC0, &state) != 0) {
|
||||||
return state.state != 0;
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AbortQuickStartTitle(OSAlarm *alarm, OSContext *) {
|
static void AbortQuickStartTitle(OSAlarm *alarm, OSContext *) {
|
||||||
DEBUG_FUNCTION_LINE("Selecting a title takes too long, lets abort the quick start menu");
|
DEBUG_FUNCTION_LINE_INFO("GamePad was disconnected, lets abort the quick start menu");
|
||||||
CCRSysCaffeineBootCheckAbort();
|
CCRSysCaffeineBootCheckAbort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user