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 "main.hpp"
#include <coreinit/foreground.h>
#include <coreinit/title.h>
#include <proc_ui/procui.h>
@ -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();

View File

@ -7,6 +7,8 @@
#include <padscore/kpad.h>
#include <sndcore2/core.h>
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<Screen> mainScreen = std::make_unique<MainScreen>();
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();
}

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