From 90b6a36addeb1d4ca3f1a7fa1dce53c3732b1042 Mon Sep 17 00:00:00 2001 From: Maschell Date: Tue, 26 Jul 2022 14:27:31 +0200 Subject: [PATCH] Remove the exit button when running on the HBL --- source/ApplicationState.h | 8 +++++++- source/MainApplicationState.cpp | 11 ++++++++--- source/common/common.cpp | 1 + source/common/common.h | 4 +++- source/main.cpp | 11 +++++++++++ 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/source/ApplicationState.h b/source/ApplicationState.h index 51772db..0a2d4fc 100644 --- a/source/ApplicationState.h +++ b/source/ApplicationState.h @@ -1,5 +1,6 @@ #pragma once +#include "common/common.h" #include "input/Input.h" #include "utils/ScreenUtils.h" #include "utils/WiiUScreen.h" @@ -37,8 +38,9 @@ public: } else if (input->data.buttons_d & Input::BUTTON_RIGHT) { this->selectedOptionX++; } + if (this->selectedOptionX < 0) { - this->selectedOptionX = maxOptionValue; + this->selectedOptionX = maxOptionValue - 1; } else if (this->selectedOptionX >= maxOptionValue) { this->selectedOptionX = 0; } @@ -55,6 +57,10 @@ public: } 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_DRC, 0, 17, "Created by Maschell, inspired by wudump from FIX94"); } diff --git a/source/MainApplicationState.cpp b/source/MainApplicationState.cpp index 58147a9..6033d1a 100644 --- a/source/MainApplicationState.cpp +++ b/source/MainApplicationState.cpp @@ -52,7 +52,9 @@ void MainApplicationState::render() { WiiUScreen::drawLinef(" [%s] SD ??? NTFS (USB) (not connected)", dumpTarget == TARGET_SD ? "*" : " "); } WiiUScreen::drawLine(); - WiiUScreen::drawLinef("%s Exit", this->selectedOptionY == 4 ? ">" : " "); + if (!gRunFromHBL) { + WiiUScreen::drawLinef("%s Exit", this->selectedOptionY == 4 ? ">" : " "); + } } printFooter(); @@ -61,7 +63,8 @@ void MainApplicationState::render() { ApplicationState::eSubState MainApplicationState::update(Input *input) { if (this->state == STATE_WELCOME_SCREEN) { - proccessMenuNavigationY(input, 5); + int optionCount = gRunFromHBL ? 4 : 5; + proccessMenuNavigationY(input, optionCount); if (selectedOptionY == 3) { if (ntfs_mount_count > 0) { proccessMenuNavigationX(input, 2); @@ -85,7 +88,9 @@ ApplicationState::eSubState MainApplicationState::update(Input *input) { } else if (this->selectedOptionY == 3) { // } else { - SYSLaunchMenu(); + if (gRunFromHBL) { + SYSLaunchMenu(); + } } this->selectedOptionY = 0; } diff --git a/source/common/common.cpp b/source/common/common.cpp index d67aefc..190c005 100644 --- a/source/common/common.cpp +++ b/source/common/common.cpp @@ -4,3 +4,4 @@ int32_t gFSAfd = -1; ntfs_md *ntfs_mounts = nullptr; int ntfs_mount_count = 0; +BOOL gRunFromHBL = false; diff --git a/source/common/common.h b/source/common/common.h index 3a06d8e..131de26 100644 --- a/source/common/common.h +++ b/source/common/common.h @@ -1,7 +1,7 @@ #pragma once -#include #include +#include extern int32_t gFSAfd; @@ -11,6 +11,8 @@ extern int32_t gFSAfd; extern ntfs_md *ntfs_mounts; extern int ntfs_mount_count; +extern BOOL gRunFromHBL; + enum eDumpTarget { TARGET_SD, TARGET_NTFS diff --git a/source/main.cpp b/source/main.cpp index 830b1d7..f716cd3 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -34,6 +35,16 @@ int main(int argc, char **argv) { initIOSUHax(); + uint64_t titleID = OSGetTitleID(); + if (titleID == 0x0005000013374842 || + titleID == 0x000500101004A000 || + titleID == 0x000500101004A100 || + titleID == 0x000500101004A200) { + gRunFromHBL = true; + } else { + gRunFromHBL = false; + } + uint32_t isAPDEnabled; IMIsAPDEnabled(&isAPDEnabled);