Skip to content

Commit

Permalink
Add button combo to shut the GamePad off
Browse files Browse the repository at this point in the history
Currently, wut needs to be compiled from source to build this.
  • Loading branch information
Brawl345 committed Sep 10, 2022
1 parent 367cbd0 commit ce58d8a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Padcon Plugin for the Wii U Plugin System

This plugin for the Wii U Plugin System turns the Wii U GamePad screen off, but keeps it on as a controller. Modified version of the [Padcon plugin](https://github.com/Maschell/WUPSPluginPlayground/tree/master/padcon) by Maschell. I just cleaned it up and changed the button combination.
This plugin for the Wii U Plugin System turns the Wii U GamePad screen off, but keeps it on as a controller. Alternatively, it can also be turned off completely. Modified version of the [Padcon plugin](https://github.com/Maschell/WUPSPluginPlayground/tree/master/padcon) by Maschell.

## Installation

Expand All @@ -11,7 +11,7 @@ This plugin for the Wii U Plugin System turns the Wii U GamePad screen off, but

## Usage

While the plugin is active, press `ZL` + `ZR` + `L` + `R` + `PLUS` together to turn off the screen. The GamePad will still be usable as a controller.
While the plugin is active, press `ZL` + `ZR` + `L` + `R` + `PLUS` together to turn off the screen. The GamePad will still be usable as a controller. Press `ZL` + `ZR` + `L` + `R` + `MINUS` together to shut the GamePad off completely. You can turn it on again via the POWER button.

## Building

Expand Down
32 changes: 20 additions & 12 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#include <nn/ccr/sys.h>
#include <vpad/input.h>
#include <wups.h>

WUPS_PLUGIN_NAME("Padcon");
WUPS_PLUGIN_DESCRIPTION(
"Turns the gamepad screen on/off when ZL + ZR + L + R + Plus.");
WUPS_PLUGIN_VERSION("v1.1-Mod");
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_AUTHOR("Maschell, Brawl");
WUPS_PLUGIN_LICENSE("GPL");

Expand All @@ -15,17 +16,24 @@ DECL_FUNCTION(int32_t, VPADRead, VPADChan chan, VPADStatus *buffer,
int32_t result = real_VPADRead(chan, buffer, buffer_size, error);

if (result > 0 && *error == VPAD_READ_SUCCESS) {
if (buffer[0].hold == (VPAD_BUTTON_ZL | VPAD_BUTTON_ZR | VPAD_BUTTON_L |
VPAD_BUTTON_R | VPAD_BUTTON_PLUS) &&
cooldown == 0) {
if (cooldown == 0) {
cooldown = 60; // 1 second cooldown
VPADLcdMode lcdMode;
VPADGetLcdMode(VPAD_CHAN_0, &lcdMode);

if (lcdMode == VPAD_LCD_ON) {
VPADSetLcdMode(VPAD_CHAN_0, VPAD_LCD_OFF);
} else {
VPADSetLcdMode(VPAD_CHAN_0, VPAD_LCD_ON);
uint32_t hold = buffer[0].hold;

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) {
VPADSetLcdMode(VPAD_CHAN_0, VPAD_LCD_OFF);
} else {
VPADSetLcdMode(VPAD_CHAN_0, VPAD_LCD_ON);
}
} else if (hold == (VPAD_BUTTON_ZL | VPAD_BUTTON_ZR | VPAD_BUTTON_L |
VPAD_BUTTON_R | VPAD_BUTTON_MINUS)) {
CCRSysDRCShutdown();
}
}
}
Expand Down

0 comments on commit ce58d8a

Please sign in to comment.