mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2024-12-18 17:11:54 +01:00
Add WUPSConfigAPI_Menu_GetStatus()
function. (#89)
* Add `WUPSConfigAPI_Menu_GetStatus()` function. --HG-- branch : menu-status-api-hg * Indentation fix. --HG-- branch : menu-status-api-hg --------- Co-authored-by: Daniel K. O. (dkosmari) <none@none>
This commit is contained in:
parent
1524f0a6a9
commit
5f23142b2d
@ -1,7 +1,7 @@
|
|||||||
FROM ghcr.io/wiiu-env/devkitppc:20241128
|
FROM ghcr.io/wiiu-env/devkitppc:20241128
|
||||||
|
|
||||||
COPY --from=ghcr.io/wiiu-env/wiiumodulesystem:20240424 /artifacts $DEVKITPRO
|
COPY --from=ghcr.io/wiiu-env/wiiumodulesystem:20240424 /artifacts $DEVKITPRO
|
||||||
COPY --from=ghcr.io/wiiu-env/wiiupluginsystem:20240505 /artifacts $DEVKITPRO
|
COPY --from=ghcr.io/wiiu-env/wiiupluginsystem:0.8.2-dev-20241128-1ac579a /artifacts $DEVKITPRO
|
||||||
COPY --from=ghcr.io/wiiu-env/libfunctionpatcher:20230621 /artifacts $DEVKITPRO
|
COPY --from=ghcr.io/wiiu-env/libfunctionpatcher:20230621 /artifacts $DEVKITPRO
|
||||||
COPY --from=ghcr.io/wiiu-env/libmappedmemory:20230621 /artifacts $DEVKITPRO
|
COPY --from=ghcr.io/wiiu-env/libmappedmemory:20230621 /artifacts $DEVKITPRO
|
||||||
COPY --from=ghcr.io/wiiu-env/libwupsbackend:20240425 /artifacts $DEVKITPRO
|
COPY --from=ghcr.io/wiiu-env/libwupsbackend:20240425 /artifacts $DEVKITPRO
|
||||||
|
@ -315,7 +315,18 @@ namespace WUPSConfigAPIBackend {
|
|||||||
return WUPSCONFIG_API_RESULT_SUCCESS;
|
return WUPSCONFIG_API_RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WUPSConfigAPIStatus WUPSConfigAPI_Menu_GetStatus(WUPSConfigAPIMenuStatus *status) {
|
||||||
|
if (status == nullptr) {
|
||||||
|
return WUPSCONFIG_API_RESULT_INVALID_ARGUMENT;
|
||||||
|
}
|
||||||
|
*status = gConfigMenuOpened
|
||||||
|
? WUPSCONFIG_API_MENU_STATUS_OPENED
|
||||||
|
: WUPSCONFIG_API_MENU_STATUS_CLOSED;
|
||||||
|
return WUPSCONFIG_API_RESULT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
WUMS_EXPORT_FUNCTION(WUPSConfigAPI_GetVersion);
|
WUMS_EXPORT_FUNCTION(WUPSConfigAPI_GetVersion);
|
||||||
|
WUMS_EXPORT_FUNCTION(WUPSConfigAPI_Menu_GetStatus);
|
||||||
|
|
||||||
WUMS_EXPORT_FUNCTION_EX(WUPSConfigAPIBackend::InitEx, WUPSConfigAPI_InitEx);
|
WUMS_EXPORT_FUNCTION_EX(WUPSConfigAPIBackend::InitEx, WUPSConfigAPI_InitEx);
|
||||||
WUMS_EXPORT_FUNCTION_EX(WUPSConfigAPIBackend::Category::Create, WUPSConfigAPI_Category_CreateEx);
|
WUMS_EXPORT_FUNCTION_EX(WUPSConfigAPIBackend::Category::Create, WUPSConfigAPI_Category_CreateEx);
|
||||||
|
@ -18,4 +18,5 @@ bool gNotificationModuleLoaded = false;
|
|||||||
|
|
||||||
OSThread *gOnlyAcceptFromThread = nullptr;
|
OSThread *gOnlyAcceptFromThread = nullptr;
|
||||||
|
|
||||||
bool gConfigMenuShouldClose = false;
|
bool gConfigMenuShouldClose = false;
|
||||||
|
bool gConfigMenuOpened = false;
|
||||||
|
@ -34,4 +34,5 @@ extern bool gNotificationModuleLoaded;
|
|||||||
|
|
||||||
extern OSThread *gOnlyAcceptFromThread;
|
extern OSThread *gOnlyAcceptFromThread;
|
||||||
|
|
||||||
extern bool gConfigMenuShouldClose;
|
extern bool gConfigMenuShouldClose;
|
||||||
|
extern bool gConfigMenuOpened;
|
||||||
|
@ -10,16 +10,15 @@
|
|||||||
#include <vpad/input.h>
|
#include <vpad/input.h>
|
||||||
|
|
||||||
static uint8_t sVpadPressCooldown = 0xFF;
|
static uint8_t sVpadPressCooldown = 0xFF;
|
||||||
static bool sConfigMenuOpened = false;
|
|
||||||
static bool sWantsToOpenConfigMenu = false;
|
static bool sWantsToOpenConfigMenu = false;
|
||||||
|
|
||||||
DECL_FUNCTION(void, GX2SwapScanBuffers, void) {
|
DECL_FUNCTION(void, GX2SwapScanBuffers, void) {
|
||||||
real_GX2SwapScanBuffers();
|
real_GX2SwapScanBuffers();
|
||||||
|
|
||||||
if (sWantsToOpenConfigMenu && !sConfigMenuOpened) {
|
if (sWantsToOpenConfigMenu && !gConfigMenuOpened) {
|
||||||
sConfigMenuOpened = true;
|
gConfigMenuOpened = true;
|
||||||
ConfigUtils::openConfigMenu();
|
ConfigUtils::openConfigMenu();
|
||||||
sConfigMenuOpened = false;
|
gConfigMenuOpened = false;
|
||||||
sWantsToOpenConfigMenu = false;
|
sWantsToOpenConfigMenu = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,7 +47,7 @@ static uint32_t lastData0 = 0;
|
|||||||
|
|
||||||
|
|
||||||
DECL_FUNCTION(BOOL, OSSendMessage, OSMessageQueue *queue, OSMessage *message, OSMessageFlags flags) {
|
DECL_FUNCTION(BOOL, OSSendMessage, OSMessageQueue *queue, OSMessage *message, OSMessageFlags flags) {
|
||||||
if (sConfigMenuOpened && queue == OSGetSystemMessageQueue()) {
|
if (gConfigMenuOpened && queue == OSGetSystemMessageQueue()) {
|
||||||
if (message != nullptr) {
|
if (message != nullptr) {
|
||||||
if (message->args[0] == 0xfacebacc) { // Release foreground
|
if (message->args[0] == 0xfacebacc) { // Release foreground
|
||||||
gConfigMenuShouldClose = true;
|
gConfigMenuShouldClose = true;
|
||||||
@ -83,7 +82,7 @@ DECL_FUNCTION(void, OSReleaseForeground) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DECL_FUNCTION(int32_t, VPADRead, int32_t chan, VPADStatus *buffer, uint32_t buffer_size, VPADReadError *error) {
|
DECL_FUNCTION(int32_t, VPADRead, int32_t chan, VPADStatus *buffer, uint32_t buffer_size, VPADReadError *error) {
|
||||||
if (sConfigMenuOpened) {
|
if (gConfigMenuOpened) {
|
||||||
// Ignore reading vpad input only from other threads if the config menu is opened
|
// Ignore reading vpad input only from other threads if the config menu is opened
|
||||||
if (OSGetCurrentThread() != gOnlyAcceptFromThread) {
|
if (OSGetCurrentThread() != gOnlyAcceptFromThread) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -92,7 +91,7 @@ DECL_FUNCTION(int32_t, VPADRead, int32_t chan, VPADStatus *buffer, uint32_t buff
|
|||||||
VPADReadError real_error = VPAD_READ_SUCCESS;
|
VPADReadError real_error = VPAD_READ_SUCCESS;
|
||||||
const int32_t result = real_VPADRead(chan, buffer, buffer_size, &real_error);
|
const int32_t result = real_VPADRead(chan, buffer, buffer_size, &real_error);
|
||||||
|
|
||||||
if (result > 0 && real_error == VPAD_READ_SUCCESS && buffer && ((buffer[0].hold & 0xFFFFF) == (VPAD_BUTTON_L | VPAD_BUTTON_DOWN | VPAD_BUTTON_MINUS)) && sVpadPressCooldown == 0 && !sConfigMenuOpened) {
|
if (result > 0 && real_error == VPAD_READ_SUCCESS && buffer && ((buffer[0].hold & 0xFFFFF) == (VPAD_BUTTON_L | VPAD_BUTTON_DOWN | VPAD_BUTTON_MINUS)) && sVpadPressCooldown == 0 && !gConfigMenuOpened) {
|
||||||
|
|
||||||
sWantsToOpenConfigMenu = true;
|
sWantsToOpenConfigMenu = true;
|
||||||
sVpadPressCooldown = 0x3C;
|
sVpadPressCooldown = 0x3C;
|
||||||
@ -111,8 +110,8 @@ DECL_FUNCTION(int32_t, VPADRead, int32_t chan, VPADStatus *buffer, uint32_t buff
|
|||||||
DECL_FUNCTION(void, WPADRead, WPADChan chan, WPADStatus *data) {
|
DECL_FUNCTION(void, WPADRead, WPADChan chan, WPADStatus *data) {
|
||||||
real_WPADRead(chan, data);
|
real_WPADRead(chan, data);
|
||||||
|
|
||||||
if (!sConfigMenuOpened && data && data[0].error == 0) {
|
if (!gConfigMenuOpened && data && data->error == 0) {
|
||||||
if (const auto extensionType = data[0].extensionType; extensionType != 0xFF) {
|
if (const auto extensionType = data->extensionType; extensionType != 0xFF) {
|
||||||
if (extensionType == WPAD_EXT_CORE || extensionType == WPAD_EXT_NUNCHUK ||
|
if (extensionType == WPAD_EXT_CORE || extensionType == WPAD_EXT_NUNCHUK ||
|
||||||
extensionType == WPAD_EXT_MPLUS || extensionType == WPAD_EXT_MPLUS_NUNCHUK) {
|
extensionType == WPAD_EXT_MPLUS || extensionType == WPAD_EXT_MPLUS_NUNCHUK) {
|
||||||
if (data->buttons == (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_MINUS)) {
|
if (data->buttons == (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_MINUS)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user