Skip to content

Commit

Permalink
Turn the GamePad screen on before shutting the GamePad off
Browse files Browse the repository at this point in the history
  • Loading branch information
Brawl345 committed Sep 10, 2022
1 parent ce58d8a commit b0a3009
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
WUPS_PLUGIN_NAME("Padcon");
WUPS_PLUGIN_DESCRIPTION("Turns the gamepad screen on/off or shuts the GamePad "
"off when pressing ZL + ZR + L + R + Plus/Minus.");
WUPS_PLUGIN_VERSION("v1.2-Mod");
WUPS_PLUGIN_VERSION("v1.2.1-Mod");
WUPS_PLUGIN_AUTHOR("Maschell, Brawl");
WUPS_PLUGIN_LICENSE("GPL");
WUPS_PLUGIN_LICENSE("GPLv3");

uint8_t cooldown = 0;

Expand All @@ -20,10 +20,10 @@ DECL_FUNCTION(int32_t, VPADRead, VPADChan chan, VPADStatus *buffer,
cooldown = 60; // 1 second cooldown

uint32_t hold = buffer[0].hold;
VPADLcdMode lcdMode;

if (hold == (VPAD_BUTTON_ZL | VPAD_BUTTON_ZR | VPAD_BUTTON_L |
VPAD_BUTTON_R | VPAD_BUTTON_PLUS)) {
VPADLcdMode lcdMode;
VPADGetLcdMode(VPAD_CHAN_0, &lcdMode);

if (lcdMode == VPAD_LCD_ON) {
Expand All @@ -33,7 +33,17 @@ DECL_FUNCTION(int32_t, VPADRead, VPADChan chan, VPADStatus *buffer,
}
} else if (hold == (VPAD_BUTTON_ZL | VPAD_BUTTON_ZR | VPAD_BUTTON_L |
VPAD_BUTTON_R | VPAD_BUTTON_MINUS)) {
CCRSysDRCShutdown();
VPADGetLcdMode(VPAD_CHAN_0, &lcdMode);

int32_t ret = 0;

if (lcdMode == VPAD_LCD_OFF) {
ret = VPADSetLcdMode(VPAD_CHAN_0, VPAD_LCD_ON);
}

if (ret == 0) {
CCRSysDRCShutdown();
}
}
}
}
Expand Down

0 comments on commit b0a3009

Please sign in to comment.