-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to enable/disable sensorbar
- Loading branch information
Showing
9 changed files
with
277 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,61 @@ | ||
DRC Sensorbar | ||
=============== | ||
# DRC Sensorbar | ||
|
||
This plugin for the [WiiUPluginSystem](https://github.com/wiiu-env/WiiUPluginSystem) enables the sensor bar of the | ||
GamePad (DRC) permanently. | ||
|
||
## Limitations | ||
* The sensor bar is turned off when opening the HOME menu or when the GamePad is disconnected. It gets re-enabled when the HOME menu is closed/the GamePad is connected again. This is a system limitation and expected behaviour | ||
* Does not work in applets like the web browser - this is a limitation of the Plugin System | ||
* While using, remember that the cursor is not always shown on the GamePad - you should maybe use this together with | ||
|
||
- The sensor bar is turned off when opening the HOME menu or when the GamePad is disconnected. It gets re-enabled when the HOME menu is closed/the GamePad is connected again. This is a system limitation and expected behaviour | ||
- Does not work in applets like the web browser - this is a limitation of the Plugin System | ||
- While using, remember that the cursor is not always shown on the GamePad - you should maybe use this together with | ||
another plugin, that can swap the screens (depending on the game/app) | ||
|
||
## Installation | ||
|
||
1. Install Aroma | ||
2. Check the Releases page and download the [latest non-preview version](https://github.com/WiiDatabase/DRC-Sensorbar/releases/latest) of this plugin | ||
3. Extract it to "SD://wiiu/environments/aroma/plugins" | ||
3. Extract it to "`SD://wiiu/environments/aroma/plugins`" | ||
4. Done! | ||
5. You can disable the plugin via the WUPS Config Menu ("L" + "D-Pad Down" + "Minus") | ||
|
||
## Building | ||
|
||
For building you need: | ||
|
||
- [wups](https://github.com/wiiu-env/WiiUPluginSystem) | ||
- [wut](https://github.com/devkitPro/wut) | ||
- [wups](https://github.com/Maschell/WiiUPluginSystem) | ||
- [wut](https://github.com/devkitpro/wut) | ||
|
||
Install them (in this order) according to their README's. Don't forget the dependencies of the libs itself. | ||
|
||
Then you should be able to compile via `make` (with no logging) or `make DEBUG=1` (with logging). | ||
|
||
## Buildflags | ||
|
||
### Logging | ||
|
||
Building via `make` only logs errors (via OSReport). To enable logging via the [LoggingModule](https://github.com/wiiu-env/LoggingModule) set `DEBUG` to `1` or `VERBOSE`. | ||
|
||
`make` Logs errors only (via OSReport). | ||
`make DEBUG=1` Enables information and error logging via [LoggingModule](https://github.com/wiiu-env/LoggingModule). | ||
`make DEBUG=VERBOSE` Enables verbose information and error logging via [LoggingModule](https://github.com/wiiu-env/LoggingModule). | ||
|
||
If the [LoggingModule](https://github.com/wiiu-env/LoggingModule) is not present, it'll fallback to UDP (Port 4405) and [CafeOS](https://github.com/wiiu-env/USBSerialLoggingModule) logging. | ||
|
||
## Building using the Dockerfile | ||
|
||
It's possible to use a docker image for building. This way you don't need anything installed on your host system. | ||
|
||
``` | ||
# Build docker image (only needed once) | ||
docker build . -t drc-sensorbar-builder | ||
# make | ||
docker run -it --rm -v ${PWD}:/project drc-sensorbar-builder make DEBUG=1 | ||
# make clean | ||
docker run -it --rm -v ${PWD}:/project drc-sensorbar-builder make clean | ||
``` | ||
|
||
## Format the code via docker | ||
|
||
`docker run --rm -v ${PWD}:/src ghcr.io/wiiu-env/clang-format:13.0.0-2 -r ./src -i` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,89 @@ | ||
#include "main.h" | ||
#include "utils/logger.h" | ||
#include <vpad/input.h> | ||
#include <wups.h> | ||
#include <wups/config/WUPSConfigItemBoolean.h> | ||
|
||
WUPS_PLUGIN_NAME("DRC-Sensorbar"); | ||
WUPS_PLUGIN_DESCRIPTION( | ||
"Enables the sensorbar of the Wii U GamePad permanently."); | ||
WUPS_PLUGIN_VERSION("v2.0"); | ||
"Enables the sensorbar of the Wii U GamePad permanently."); | ||
WUPS_PLUGIN_VERSION(VERSION_FULL); | ||
WUPS_PLUGIN_AUTHOR("WiiDatabase.de"); | ||
WUPS_PLUGIN_LICENSE("MIT"); | ||
WUPS_USE_STORAGE("drc_sensorbar"); | ||
|
||
ON_APPLICATION_START() { VPADSetSensorBar(VPAD_CHAN_0, true); } | ||
#define CONFIG_ID_SENSORBAR_ENABLED "enabled" | ||
bool enabled = true; | ||
|
||
|
||
INITIALIZE_PLUGIN() { | ||
initLogging(); | ||
DEBUG_FUNCTION_LINE("INITIALIZE_PLUGIN of example_plugin!"); | ||
|
||
WUPSStorageError storageRes = WUPS_OpenStorage(); | ||
if (storageRes != WUPS_STORAGE_ERROR_SUCCESS) { | ||
DEBUG_FUNCTION_LINE("Failed to open storage %s (%d)", WUPS_GetStorageStatusStr(storageRes), storageRes); | ||
} else { | ||
if ((storageRes = WUPS_GetBool(nullptr, CONFIG_ID_SENSORBAR_ENABLED, &enabled)) == WUPS_STORAGE_ERROR_NOT_FOUND) { | ||
if (WUPS_StoreBool(nullptr, CONFIG_ID_SENSORBAR_ENABLED, enabled) != WUPS_STORAGE_ERROR_SUCCESS) { | ||
DEBUG_FUNCTION_LINE("Failed to store bool"); | ||
} | ||
} else if (storageRes != WUPS_STORAGE_ERROR_SUCCESS) { | ||
DEBUG_FUNCTION_LINE("Failed to get bool %s (%d)", WUPS_GetStorageStatusStr(storageRes), storageRes); | ||
} | ||
|
||
if (WUPS_CloseStorage() != WUPS_STORAGE_ERROR_SUCCESS) { | ||
DEBUG_FUNCTION_LINE("Failed to close storage"); | ||
} | ||
} | ||
deinitLogging(); | ||
} | ||
|
||
WUPS_CONFIG_CLOSED() { | ||
// Save all changes | ||
if (WUPS_CloseStorage() != WUPS_STORAGE_ERROR_SUCCESS) { | ||
DEBUG_FUNCTION_LINE_ERR("Failed to close storage"); | ||
} | ||
} | ||
|
||
ON_APPLICATION_START() { | ||
initLogging(); | ||
if (enabled) { | ||
VPADSetSensorBar(VPAD_CHAN_0, true); | ||
} | ||
} | ||
|
||
ON_APPLICATION_ENDS() { | ||
deinitLogging(); | ||
} | ||
|
||
void enabledChanged(ConfigItemBoolean *item, bool newValue) { | ||
DEBUG_FUNCTION_LINE_INFO("New value in enabledChanged: %d", newValue); | ||
enabled = newValue; | ||
WUPS_StoreInt(nullptr, CONFIG_ID_SENSORBAR_ENABLED, enabled); | ||
|
||
if (enabled) { | ||
VPADSetSensorBar(VPAD_CHAN_0, true); | ||
} else { | ||
VPADSetSensorBar(VPAD_CHAN_0, false); | ||
} | ||
} | ||
|
||
WUPS_GET_CONFIG() { | ||
if (WUPS_OpenStorage() != WUPS_STORAGE_ERROR_SUCCESS) { | ||
DEBUG_FUNCTION_LINE("Failed to open storage"); | ||
return 0; | ||
} | ||
|
||
WUPSConfigHandle config; | ||
WUPSConfig_CreateHandled(&config, "DRC-Sensorbar"); | ||
|
||
WUPSConfigCategoryHandle cat; | ||
WUPSConfig_AddCategoryByNameHandled(config, "Settings", &cat); | ||
|
||
WUPSConfigItemBoolean_AddToCategoryHandled( | ||
config, cat, CONFIG_ID_SENSORBAR_ENABLED, "Enable GamePad Sensorbar", enabled, | ||
&enabledChanged); | ||
|
||
return config; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#pragma once | ||
|
||
#include "version.h" | ||
|
||
#define VERSION "v2.1" | ||
#define VERSION_FULL VERSION VERSION_EXTRA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifdef DEBUG | ||
#include <stdint.h> | ||
#include <whb/log_cafe.h> | ||
#include <whb/log_module.h> | ||
#include <whb/log_udp.h> | ||
|
||
uint32_t moduleLogInit = false; | ||
uint32_t cafeLogInit = false; | ||
uint32_t udpLogInit = false; | ||
#endif // DEBUG | ||
|
||
void initLogging() { | ||
#ifdef DEBUG | ||
if (!(moduleLogInit = WHBLogModuleInit())) { | ||
cafeLogInit = WHBLogCafeInit(); | ||
udpLogInit = WHBLogUdpInit(); | ||
} | ||
#endif // DEBUG | ||
} | ||
|
||
void deinitLogging() { | ||
#ifdef DEBUG | ||
if (moduleLogInit) { | ||
WHBLogModuleDeinit(); | ||
moduleLogInit = false; | ||
} | ||
if (cafeLogInit) { | ||
WHBLogCafeDeinit(); | ||
cafeLogInit = false; | ||
} | ||
if (udpLogInit) { | ||
WHBLogUdpDeinit(); | ||
udpLogInit = false; | ||
} | ||
#endif // DEBUG | ||
} |
Oops, something went wrong.