diff --git a/source/ProcUI.cpp b/source/ProcUI.cpp index 5067fc4..bb9f6c6 100644 --- a/source/ProcUI.cpp +++ b/source/ProcUI.cpp @@ -1,4 +1,5 @@ #include "ProcUI.hpp" +#include "main.hpp" #include #include #include @@ -34,11 +35,9 @@ uint32_t SaveCallback(void* context) uint32_t HomeButtonDeniedCallback(void* context) { if (!isHomeButtonMenuEnabled) { - VPADStatus vpadStatus; - UpdatePads(vpadStatus); nn::erreula::HomeNixSignArg noHOME; noHOME.unknown0x00 = 1; - if (vpadStatus.trigger & 0x2) {AppearHomeNixSign(noHOME);} // have you pushed HOME? + if (globalVPADStatus.trigger & 0x2) {AppearHomeNixSign(noHOME);} // have you pushed HOME? } else { if (isLegacyLoader) { ProcUI::StopRunning(); diff --git a/source/main.cpp b/source/main.cpp index f1f054d..f7600dc 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -7,6 +7,8 @@ #include #include +VPADStatus globalVPADStatus; + namespace { @@ -115,6 +117,7 @@ void UpdatePads(VPADStatus* status) } } } + globalVPADStatus = *status; } } @@ -134,11 +137,10 @@ int main(int argc, char const* argv[]) std::unique_ptr mainScreen = std::make_unique(); while (ProcUI::IsRunning()) { - VPADStatus input{}; - VPADRead(VPAD_CHAN_0, &input, 1, nullptr); - UpdatePads(&input); + VPADRead(VPAD_CHAN_0, &globalVPADStatus, 1, nullptr); + UpdatePads(&globalVPADStatus); - if (!mainScreen->Update(input)) { + if (!mainScreen->Update(globalVPADStatus)) { ProcUI::StopRunning(); } diff --git a/source/main.hpp b/source/main.hpp new file mode 100644 index 0000000..9ae6f34 --- /dev/null +++ b/source/main.hpp @@ -0,0 +1,12 @@ +#include +#include + +// main.hpp +#ifndef MAIN_HPP +#define MAIN_HPP + +void UpdatePads(VPADStatus* vpadStatus); // Declare your function here +extern VPADStatus globalVPADStatus; + +#endif // MAIN_HPP +