Skip to content

Commit

Permalink
Remove the exit button when running on the HBL
Browse files Browse the repository at this point in the history
  • Loading branch information
Maschell committed Jul 26, 2022
1 parent 21cb6ad commit 90b6a36
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
8 changes: 7 additions & 1 deletion source/ApplicationState.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "common/common.h"
#include "input/Input.h"
#include "utils/ScreenUtils.h"
#include "utils/WiiUScreen.h"
Expand Down Expand Up @@ -37,8 +38,9 @@ class ApplicationState {
} 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;
}
Expand All @@ -55,6 +57,10 @@ class ApplicationState {
}

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");
}
Expand Down
11 changes: 8 additions & 3 deletions source/MainApplicationState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand All @@ -85,7 +88,9 @@ ApplicationState::eSubState MainApplicationState::update(Input *input) {
} else if (this->selectedOptionY == 3) {
//
} else {
SYSLaunchMenu();
if (gRunFromHBL) {
SYSLaunchMenu();
}
}
this->selectedOptionY = 0;
}
Expand Down
1 change: 1 addition & 0 deletions source/common/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ int32_t gFSAfd = -1;

ntfs_md *ntfs_mounts = nullptr;
int ntfs_mount_count = 0;
BOOL gRunFromHBL = false;
4 changes: 3 additions & 1 deletion source/common/common.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <cstdint>
#include <ntfs.h>
#include <wut.h>

extern int32_t gFSAfd;

Expand All @@ -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
Expand Down
11 changes: 11 additions & 0 deletions source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <coreinit/debug.h>
#include <coreinit/energysaver.h>
#include <coreinit/title.h>
#include <input/CombinedInput.h>
#include <input/WPADInput.h>
#include <iosuhax.h>
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 90b6a36

Please sign in to comment.