Globalize VPADStatus input for No HOME

This commit is contained in:
team-orangeBlue 2024-11-30 19:29:11 +03:00
parent 2fcf05c06e
commit 86c949d1fc
3 changed files with 20 additions and 7 deletions

View File

@ -1,4 +1,5 @@
#include "ProcUI.hpp" #include "ProcUI.hpp"
#include "main.hpp"
#include <coreinit/foreground.h> #include <coreinit/foreground.h>
#include <coreinit/title.h> #include <coreinit/title.h>
#include <proc_ui/procui.h> #include <proc_ui/procui.h>
@ -34,11 +35,9 @@ uint32_t SaveCallback(void* context)
uint32_t HomeButtonDeniedCallback(void* context) uint32_t HomeButtonDeniedCallback(void* context)
{ {
if (!isHomeButtonMenuEnabled) { if (!isHomeButtonMenuEnabled) {
VPADStatus vpadStatus;
UpdatePads(vpadStatus);
nn::erreula::HomeNixSignArg noHOME; nn::erreula::HomeNixSignArg noHOME;
noHOME.unknown0x00 = 1; noHOME.unknown0x00 = 1;
if (vpadStatus.trigger & 0x2) {AppearHomeNixSign(noHOME);} // have you pushed HOME? if (globalVPADStatus.trigger & 0x2) {AppearHomeNixSign(noHOME);} // have you pushed HOME?
} else { } else {
if (isLegacyLoader) { if (isLegacyLoader) {
ProcUI::StopRunning(); ProcUI::StopRunning();

View File

@ -7,6 +7,8 @@
#include <padscore/kpad.h> #include <padscore/kpad.h>
#include <sndcore2/core.h> #include <sndcore2/core.h>
VPADStatus globalVPADStatus;
namespace 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<Screen> mainScreen = std::make_unique<MainScreen>(); std::unique_ptr<Screen> mainScreen = std::make_unique<MainScreen>();
while (ProcUI::IsRunning()) { while (ProcUI::IsRunning()) {
VPADStatus input{}; VPADRead(VPAD_CHAN_0, &globalVPADStatus, 1, nullptr);
VPADRead(VPAD_CHAN_0, &input, 1, nullptr); UpdatePads(&globalVPADStatus);
UpdatePads(&input);
if (!mainScreen->Update(input)) { if (!mainScreen->Update(globalVPADStatus)) {
ProcUI::StopRunning(); ProcUI::StopRunning();
} }

12
source/main.hpp Normal file
View File

@ -0,0 +1,12 @@
#include <vpad/input.h>
#include <padscore/kpad.h>
// main.hpp
#ifndef MAIN_HPP
#define MAIN_HPP
void UpdatePads(VPADStatus* vpadStatus); // Declare your function here
extern VPADStatus globalVPADStatus;
#endif // MAIN_HPP