Remove the exit button when running on the HBL

This commit is contained in:
Maschell 2022-07-26 14:27:31 +02:00
parent 21cb6adaa6
commit 90b6a36add
5 changed files with 30 additions and 5 deletions

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include "common/common.h"
#include "input/Input.h" #include "input/Input.h"
#include "utils/ScreenUtils.h" #include "utils/ScreenUtils.h"
#include "utils/WiiUScreen.h" #include "utils/WiiUScreen.h"
@ -37,8 +38,9 @@ public:
} else if (input->data.buttons_d & Input::BUTTON_RIGHT) { } else if (input->data.buttons_d & Input::BUTTON_RIGHT) {
this->selectedOptionX++; this->selectedOptionX++;
} }
if (this->selectedOptionX < 0) { if (this->selectedOptionX < 0) {
this->selectedOptionX = maxOptionValue; this->selectedOptionX = maxOptionValue - 1;
} else if (this->selectedOptionX >= maxOptionValue) { } else if (this->selectedOptionX >= maxOptionValue) {
this->selectedOptionX = 0; this->selectedOptionX = 0;
} }
@ -55,6 +57,10 @@ public:
} }
virtual void printFooter() { virtual void printFooter() {
if (gRunFromHBL) {
ScreenUtils::printTextOnScreen(CONSOLE_SCREEN_TV, 0, 25, "Press HOME to exit to HBL");
ScreenUtils::printTextOnScreen(CONSOLE_SCREEN_DRC, 0, 15, "Press HOME to exit to HBL");
}
ScreenUtils::printTextOnScreen(CONSOLE_SCREEN_TV, 0, 27, "Created by Maschell, inspired by wudump from FIX94"); ScreenUtils::printTextOnScreen(CONSOLE_SCREEN_TV, 0, 27, "Created by Maschell, inspired by wudump from FIX94");
ScreenUtils::printTextOnScreen(CONSOLE_SCREEN_DRC, 0, 17, "Created by Maschell, inspired by wudump from FIX94"); ScreenUtils::printTextOnScreen(CONSOLE_SCREEN_DRC, 0, 17, "Created by Maschell, inspired by wudump from FIX94");
} }

View File

@ -52,8 +52,10 @@ void MainApplicationState::render() {
WiiUScreen::drawLinef(" [%s] SD ??? NTFS (USB) (not connected)", dumpTarget == TARGET_SD ? "*" : " "); WiiUScreen::drawLinef(" [%s] SD ??? NTFS (USB) (not connected)", dumpTarget == TARGET_SD ? "*" : " ");
} }
WiiUScreen::drawLine(); WiiUScreen::drawLine();
if (!gRunFromHBL) {
WiiUScreen::drawLinef("%s Exit", this->selectedOptionY == 4 ? ">" : " "); WiiUScreen::drawLinef("%s Exit", this->selectedOptionY == 4 ? ">" : " ");
} }
}
printFooter(); printFooter();
WiiUScreen::flipBuffers(); WiiUScreen::flipBuffers();
@ -61,7 +63,8 @@ void MainApplicationState::render() {
ApplicationState::eSubState MainApplicationState::update(Input *input) { ApplicationState::eSubState MainApplicationState::update(Input *input) {
if (this->state == STATE_WELCOME_SCREEN) { if (this->state == STATE_WELCOME_SCREEN) {
proccessMenuNavigationY(input, 5); int optionCount = gRunFromHBL ? 4 : 5;
proccessMenuNavigationY(input, optionCount);
if (selectedOptionY == 3) { if (selectedOptionY == 3) {
if (ntfs_mount_count > 0) { if (ntfs_mount_count > 0) {
proccessMenuNavigationX(input, 2); proccessMenuNavigationX(input, 2);
@ -85,8 +88,10 @@ ApplicationState::eSubState MainApplicationState::update(Input *input) {
} else if (this->selectedOptionY == 3) { } else if (this->selectedOptionY == 3) {
// //
} else { } else {
if (gRunFromHBL) {
SYSLaunchMenu(); SYSLaunchMenu();
} }
}
this->selectedOptionY = 0; this->selectedOptionY = 0;
} }
} else if (this->state == STATE_DO_SUBSTATE) { } else if (this->state == STATE_DO_SUBSTATE) {

View File

@ -4,3 +4,4 @@ int32_t gFSAfd = -1;
ntfs_md *ntfs_mounts = nullptr; ntfs_md *ntfs_mounts = nullptr;
int ntfs_mount_count = 0; int ntfs_mount_count = 0;
BOOL gRunFromHBL = false;

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <cstdint>
#include <ntfs.h> #include <ntfs.h>
#include <wut.h>
extern int32_t gFSAfd; extern int32_t gFSAfd;
@ -11,6 +11,8 @@ extern int32_t gFSAfd;
extern ntfs_md *ntfs_mounts; extern ntfs_md *ntfs_mounts;
extern int ntfs_mount_count; extern int ntfs_mount_count;
extern BOOL gRunFromHBL;
enum eDumpTarget { enum eDumpTarget {
TARGET_SD, TARGET_SD,
TARGET_NTFS TARGET_NTFS

View File

@ -6,6 +6,7 @@
#include <coreinit/debug.h> #include <coreinit/debug.h>
#include <coreinit/energysaver.h> #include <coreinit/energysaver.h>
#include <coreinit/title.h>
#include <input/CombinedInput.h> #include <input/CombinedInput.h>
#include <input/WPADInput.h> #include <input/WPADInput.h>
#include <iosuhax.h> #include <iosuhax.h>
@ -34,6 +35,16 @@ int main(int argc, char **argv) {
initIOSUHax(); initIOSUHax();
uint64_t titleID = OSGetTitleID();
if (titleID == 0x0005000013374842 ||
titleID == 0x000500101004A000 ||
titleID == 0x000500101004A100 ||
titleID == 0x000500101004A200) {
gRunFromHBL = true;
} else {
gRunFromHBL = false;
}
uint32_t isAPDEnabled; uint32_t isAPDEnabled;
IMIsAPDEnabled(&isAPDEnabled); IMIsAPDEnabled(&isAPDEnabled);