mirror of
https://github.com/wiiu-env/AutobootModule.git
synced 2024-11-22 02:49:16 +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 "MenuUtils.h"
|
||||
#include "QuickStartUtils.h"
|
||||
#include "logger.h"
|
||||
|
||||
#include <coreinit/exit.h>
|
||||
#include <coreinit/foreground.h>
|
||||
#include <coreinit/launch.h>
|
||||
#include <coreinit/memdefaultheap.h>
|
||||
#include <coreinit/thread.h>
|
||||
#include <nn/acp/title.h>
|
||||
@ -118,11 +115,12 @@ private:
|
||||
class QuickStartAutoAbort {
|
||||
public:
|
||||
QuickStartAutoAbort() {
|
||||
OSCreateAlarm(&mAlarm);
|
||||
OSCreateAlarm(&mDRCConnectedAlarm);
|
||||
OSSetPeriodicAlarm(&mDRCConnectedAlarm,
|
||||
OSSecondsToTicks(10),
|
||||
OSGetTime() + OSSecondsToTicks(10),
|
||||
OSSecondsToTicks(1),
|
||||
&AbortOnDRCDisconnect);
|
||||
OSCreateAlarm(&mAlarm);
|
||||
OSSetAlarm(&mAlarm, OSSecondsToTicks(120), AbortQuickStartTitle);
|
||||
mDRCConnected = IsDRCConnected();
|
||||
}
|
||||
@ -130,6 +128,9 @@ public:
|
||||
OSCancelAlarm(&mDRCConnectedAlarm);
|
||||
OSCancelAlarm(&mAlarm);
|
||||
|
||||
OSWaitAlarm(&mDRCConnectedAlarm);
|
||||
OSWaitAlarm(&mAlarm);
|
||||
|
||||
// Reconnect the DRC if it was connected at launch but then disconnected;
|
||||
if (mDRCConnected && !IsDRCConnected()) {
|
||||
DEBUG_FUNCTION_LINE("Wake up GamePad");
|
||||
@ -140,12 +141,14 @@ public:
|
||||
|
||||
static bool IsDRCConnected() {
|
||||
CCRCDCDrcState state = {};
|
||||
CCRCDCSysGetDrcState(CCR_CDC_DESTINATION_DRC0, &state);
|
||||
return state.state != 0;
|
||||
if (CCRCDCSysGetDrcState(CCR_CDC_DESTINATION_DRC0, &state) != 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user