mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2024-11-28 07:34:15 +01:00
function_patches: make sure variables are static
This commit is contained in:
parent
a8fd0b64ac
commit
f1a33df12d
@ -7,18 +7,18 @@
|
|||||||
#include "../globals.h"
|
#include "../globals.h"
|
||||||
#include "../hooks.h"
|
#include "../hooks.h"
|
||||||
|
|
||||||
uint8_t vpadPressCooldown = 0xFF;
|
static uint8_t sVpadPressCooldown = 0xFF;
|
||||||
bool configMenuOpened = false;
|
static bool sConfigMenuOpened = false;
|
||||||
bool wantsToOpenConfigMenu = false;
|
static bool sWantsToOpenConfigMenu = false;
|
||||||
|
|
||||||
DECL_FUNCTION(void, GX2SwapScanBuffers, void) {
|
DECL_FUNCTION(void, GX2SwapScanBuffers, void) {
|
||||||
real_GX2SwapScanBuffers();
|
real_GX2SwapScanBuffers();
|
||||||
|
|
||||||
if (wantsToOpenConfigMenu && !configMenuOpened) {
|
if (sWantsToOpenConfigMenu && !sConfigMenuOpened) {
|
||||||
configMenuOpened = true;
|
sConfigMenuOpened = true;
|
||||||
ConfigUtils::openConfigMenu();
|
ConfigUtils::openConfigMenu();
|
||||||
configMenuOpened = false;
|
sConfigMenuOpened = false;
|
||||||
wantsToOpenConfigMenu = false;
|
sWantsToOpenConfigMenu = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ DECL_FUNCTION(void, OSReleaseForeground) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DECL_FUNCTION(int32_t, VPADRead, int32_t chan, VPADStatus *buffer, uint32_t buffer_size, int32_t *error) {
|
DECL_FUNCTION(int32_t, VPADRead, int32_t chan, VPADStatus *buffer, uint32_t buffer_size, int32_t *error) {
|
||||||
if (configMenuOpened) {
|
if (sConfigMenuOpened) {
|
||||||
// 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;
|
||||||
@ -77,14 +77,14 @@ DECL_FUNCTION(int32_t, VPADRead, int32_t chan, VPADStatus *buffer, uint32_t buff
|
|||||||
}
|
}
|
||||||
int32_t result = real_VPADRead(chan, buffer, buffer_size, error);
|
int32_t result = real_VPADRead(chan, buffer, buffer_size, error);
|
||||||
|
|
||||||
if (result > 0 && ((buffer[0].hold & 0xFFFFF) == (VPAD_BUTTON_L | VPAD_BUTTON_DOWN | VPAD_BUTTON_MINUS)) && vpadPressCooldown == 0 && !configMenuOpened) {
|
if (result > 0 && ((buffer[0].hold & 0xFFFFF) == (VPAD_BUTTON_L | VPAD_BUTTON_DOWN | VPAD_BUTTON_MINUS)) && sVpadPressCooldown == 0 && !sConfigMenuOpened) {
|
||||||
wantsToOpenConfigMenu = true;
|
sWantsToOpenConfigMenu = true;
|
||||||
vpadPressCooldown = 0x3C;
|
sVpadPressCooldown = 0x3C;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vpadPressCooldown > 0) {
|
if (sVpadPressCooldown > 0) {
|
||||||
vpadPressCooldown--;
|
sVpadPressCooldown--;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -92,21 +92,22 @@ DECL_FUNCTION(int32_t, VPADRead, int32_t chan, VPADStatus *buffer, uint32_t buff
|
|||||||
DECL_FUNCTION(void, WPADRead, WPADChan chan, WPADStatusProController *data) {
|
DECL_FUNCTION(void, WPADRead, WPADChan chan, WPADStatusProController *data) {
|
||||||
real_WPADRead(chan, data);
|
real_WPADRead(chan, data);
|
||||||
|
|
||||||
if (!configMenuOpened && data[0].err == 0) {
|
|
||||||
|
if (!sConfigMenuOpened && data[0].err == 0) {
|
||||||
if (data[0].extensionType != 0xFF) {
|
if (data[0].extensionType != 0xFF) {
|
||||||
if (data[0].extensionType == WPAD_EXT_CORE || data[0].extensionType == WPAD_EXT_NUNCHUK) {
|
if (data[0].extensionType == WPAD_EXT_CORE || data[0].extensionType == WPAD_EXT_NUNCHUK) {
|
||||||
// button data is in the first 2 bytes for wiimotes
|
// button data is in the first 2 bytes for wiimotes
|
||||||
if (((uint16_t *) data)[0] == (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_MINUS)) {
|
if (((uint16_t *) data)[0] == (WPAD_BUTTON_B | WPAD_BUTTON_DOWN | WPAD_BUTTON_MINUS)) {
|
||||||
wantsToOpenConfigMenu = true;
|
sWantsToOpenConfigMenu = true;
|
||||||
}
|
}
|
||||||
} else if (data[0].extensionType == WPAD_EXT_CLASSIC) {
|
} else if (data[0].extensionType == WPAD_EXT_CLASSIC) {
|
||||||
// TODO: figure out the real struct..
|
// TODO: figure out the real struct..
|
||||||
if ((((uint32_t *) data)[10] & 0xFFFF) == (WPAD_CLASSIC_BUTTON_L | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_MINUS)) {
|
if ((((uint32_t *) data)[10] & 0xFFFF) == (WPAD_CLASSIC_BUTTON_L | WPAD_CLASSIC_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_MINUS)) {
|
||||||
wantsToOpenConfigMenu = true;
|
sWantsToOpenConfigMenu = true;
|
||||||
}
|
}
|
||||||
} else if (data[0].extensionType == WPAD_EXT_PRO_CONTROLLER) {
|
} else if (data[0].extensionType == WPAD_EXT_PRO_CONTROLLER) {
|
||||||
if (data[0].buttons == (WPAD_PRO_TRIGGER_L | WPAD_PRO_BUTTON_DOWN | WPAD_PRO_BUTTON_MINUS)) {
|
if (data[0].buttons == (WPAD_PRO_TRIGGER_L | WPAD_PRO_BUTTON_DOWN | WPAD_PRO_BUTTON_MINUS)) {
|
||||||
wantsToOpenConfigMenu = true;
|
sWantsToOpenConfigMenu = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user