From 03714e0ac5c5a47e39e5f6911bbb4080d8e0ce30 Mon Sep 17 00:00:00 2001 From: Thomas Rohloff Date: Thu, 21 Mar 2024 20:33:32 +0100 Subject: [PATCH] Remove HBL support from code. Signed-off-by: Thomas Rohloff --- Dockerfile | 6 ----- include/file.h | 5 ---- include/jailbreak.h | 38 --------------------------- include/romfs.h | 4 --- include/state.h | 4 --- include/updater.h | 3 +-- src/file.c | 61 +------------------------------------------ src/filesystem.c | 7 ----- src/installer.c | 7 ----- src/jailbreak.c | 47 --------------------------------- src/main.c | 47 +++------------------------------ src/menu/updateMenu.c | 2 -- src/state.c | 6 ----- src/updater.c | 30 +-------------------- 14 files changed, 6 insertions(+), 261 deletions(-) delete mode 100644 include/jailbreak.h delete mode 100644 src/jailbreak.c diff --git a/Dockerfile b/Dockerfile index 335d6e5c..d7b7a367 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,12 +20,6 @@ RUN apt-fast -y --no-install-recommends update && \ RUN apt-fast -y install --no-install-recommends autoconf automake libtool openjdk-11-jre-headless && \ apt-fast clean -# Install the requirements to build the homebrew -RUN git clone --recursive https://github.com/yawut/libromfs-wiiu --single-branch && \ - cd libromfs-wiiu && \ - make -j$(nproc) && \ - make install - # Install nghttp2 for HTTP/2 support (WUT don't include this) RUN wget https://github.com/nghttp2/nghttp2/releases/download/v1.60.0/nghttp2-$NGHTTP2_VER.tar.xz && \ mkdir nghttp2 && \ diff --git a/include/file.h b/include/file.h index c2b1e072..131e717c 100644 --- a/include/file.h +++ b/include/file.h @@ -85,12 +85,7 @@ extern "C" const char *translateFSErr(FSError err) __attribute__((__cold__)); size_t getFilesize(const char *path) __attribute__((__hot__)); NUSDEV getDevFromPath(const char *path); -#ifdef NUSSPLI_HBL size_t readFile(const char *path, void **buffer) __attribute__((__hot__)); -#else -size_t readFileNew(const char *path, void **buffer) __attribute__((__hot__)); -#define readFile(path, buffer) readFileNew(path, buffer) -#endif size_t getDirsize(const char *path); TMD *getTmd(const char *dir, bool allowNoIntro); TMD_STATE verifyTmd(const TMD *tmd, size_t size) __attribute__((__hot__)); diff --git a/include/jailbreak.h b/include/jailbreak.h deleted file mode 100644 index 407cdf86..00000000 --- a/include/jailbreak.h +++ /dev/null @@ -1,38 +0,0 @@ -/*************************************************************************** - * This file is part of NUSspli. * - * Copyright (c) 2022 V10lator * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, If not, see . * - ***************************************************************************/ - -#ifdef NUSSPLI_HBL - -#pragma once - -#include - -#include - -#ifdef __cplusplus -extern "C" -{ -#endif - - bool jailbreak(); - -#ifdef __cplusplus -} -#endif - -#endif // ifdef NUSSPLI_HBL diff --git a/include/romfs.h b/include/romfs.h index 81084831..37817b0d 100644 --- a/include/romfs.h +++ b/include/romfs.h @@ -20,8 +20,4 @@ #include -#ifdef NUSSPLI_HBL -#define ROMFS_PATH "romfs:/" -#else #define ROMFS_PATH "/vol/content/" -#endif diff --git a/include/state.h b/include/state.h index 3aa74903..4aeaccd8 100644 --- a/include/state.h +++ b/include/state.h @@ -51,14 +51,10 @@ extern "C" void enableShutdown(); void disableShutdown(); bool isAroma(); -#ifdef NUSSPLI_HBL -#define isChannel() false -#else #ifdef NUSSPLI_LITE #define isChannel() false #else bool isChannel(); -#endif #endif bool AppRunning(bool mainthread) __attribute__((__hot__)); uint32_t homeButtonCallback(void *dummy); diff --git a/include/updater.h b/include/updater.h index f930924b..66874ceb 100644 --- a/include/updater.h +++ b/include/updater.h @@ -30,8 +30,7 @@ extern "C" typedef enum { NUSSPLI_TYPE_AROMA = 0, - NUSSPLI_TYPE_CHANNEL = 1, - NUSSPLI_TYPE_HBL = 2 + NUSSPLI_TYPE_CHANNEL = 1 } NUSSPLI_TYPE; bool updateCheck(); diff --git a/src/file.c b/src/file.c index 908c144d..a8248aa2 100644 --- a/src/file.c +++ b/src/file.c @@ -187,7 +187,7 @@ size_t getFilesize(const char *path) return stat.size; } -size_t readFileNew(const char *path, void **buffer) +size_t readFile(const char *path, void **buffer) { char *toScreen = getToFrameBuffer(); toScreen[0] = '\0'; @@ -230,65 +230,6 @@ size_t readFileNew(const char *path, void **buffer) return 0; } -#ifdef NUSSPLI_HBL -static size_t getFilesizeOld(FILE *fp) -{ - struct stat info; - OSTime t = OSGetTime(); - - if(fstat(fileno(fp), &info) == -1) - return -1; - - t = OSGetTime() - t; - addEntropy(&t, sizeof(OSTime)); - - return (size_t)(info.st_size); -} - -size_t readFile(const char *path, void **buffer) -{ - if(strncmp("romfs:/", path, strlen("romfs:/")) != 0) - return readFileNew(path, buffer); - - char *toScreen = getToFrameBuffer(); - toScreen[0] = '\0'; - FILE *file = fopen(path, "rb"); - if(file != NULL) - { - size_t filesize = getFilesizeOld(file); - if(filesize != -1) - { - *buffer = MEMAllocFromDefaultHeapEx(FS_ALIGN(filesize), 0x40); - if(*buffer != NULL) - { - if(fread(*buffer, filesize, 1, file) == 1) - { - fclose(file); - return filesize; - } - - sprintf(toScreen, "Error reading %s!", path); - MEMFreeToDefaultHeap(*buffer); - } - else - sprintf(toScreen, "Error creating buffer!"); - } - else - sprintf(toScreen, "Error getting filesize for %s!", path); - - fclose(file); - } - else - sprintf(toScreen, "Error opening %s!", path); - - *buffer = NULL; - if(toScreen[0] != '\0') - addToScreenLog(toScreen); - - return 0; -} -#endif - size_t getDirsize(const char *path) { char *newPath = MEMAllocFromDefaultHeapEx(FS_MAX_PATH, 0x40); diff --git a/src/filesystem.c b/src/filesystem.c index e46cc656..63b55202 100644 --- a/src/filesystem.c +++ b/src/filesystem.c @@ -61,9 +61,6 @@ void initFSSpace() bool initFS(bool validCfw) { -#ifdef NUSSPLI_HBL - romfsInit(); -#endif if(FSAInit() == FS_ERROR_OK) { @@ -124,10 +121,6 @@ void deinitFS(bool validCfw) FSADelClient(handle); FSAShutdown(); - -#ifdef NUSSPLI_HBL - romfsExit(); -#endif } FSAClientHandle getFSAClient() diff --git a/src/installer.c b/src/installer.c index f7c93c7b..7aee9974 100644 --- a/src/installer.c +++ b/src/installer.c @@ -199,15 +199,8 @@ bool install(const char *game, bool hasDeps, NUSDEV dev, const char *path, bool case 0xfffbfc17: sprintf(toScreen, "%s \"%s\"" -#ifdef NUSSPLI_HBL - "\n%s" -#endif , localise("Internal error installing"), path -#ifdef NUSSPLI_HBL - , - localise("We're supporting HBL on Tiramisu only!") -#endif ); break; default: diff --git a/src/jailbreak.c b/src/jailbreak.c deleted file mode 100644 index c12f0791..00000000 --- a/src/jailbreak.c +++ /dev/null @@ -1,47 +0,0 @@ -/*************************************************************************** - * This file is part of NUSspli. * - * Copyright (c) 2022 V10lator * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, If not, see . * - ***************************************************************************/ - -#ifdef NUSSPLI_HBL - -#include - -#include - -#include -#include - -#include - -bool jailbreak() -{ - MochaRPXLoadInfo info = { - .target = LOAD_RPX_TARGET_SD_CARD, - .filesize = 0, - .fileoffset = 0, - .path = "wiiu/apps/NUSspli/NUSspli.rpx", - }; - - MochaUtilsStatus ret = Mocha_LaunchRPX(&info); - if(ret == MOCHA_RESULT_SUCCESS) - return true; - - debugPrintf("Mocha_LaunchRPX failed: 0x%08X", ret); - return false; -} - -#endif // ifdef NUSSPLI_HBL diff --git a/src/main.c b/src/main.c index c570f391..b0641ebe 100644 --- a/src/main.c +++ b/src/main.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -77,7 +76,7 @@ static void drawLoadingScreen(const char *toScreenLog, const char *loadingMsg) drawFrame(); } -static void innerMain(const char *cfwError) +static void innerMain() { OSThread *mainThread = OSGetCurrentThread(); OSSetThreadName(mainThread, "NUSspli"); @@ -85,6 +84,7 @@ static void innerMain(const char *cfwError) OSSetThreadStackUsage(mainThread); #endif + const char *cfwError = cfwValid(); if(cfwError == NULL) { addEntropy(&(mainThread->id), sizeof(uint16_t)); @@ -238,30 +238,7 @@ static void innerMain(const char *cfwError) int main() { initState(); - -#ifdef NUSSPLI_HBL - bool jailbreaking; - uint64_t tid = OSGetTitleID(); -#endif - const char *cfwError = cfwValid(); - if(cfwError == NULL) - { -#ifdef NUSSPLI_HBL - jailbreaking = !isAroma() && (tid & 0xFFFFFFFFFFFFF0FF) == 0x000500101004A000; // Mii Maker - if(jailbreaking) - jailbreaking = jailbreak(); - - if(!jailbreaking) -#endif - innerMain(NULL); - } - else - { - innerMain(cfwError); -#ifdef NUSSPLI_HBL - jailbreaking = false; -#endif - } + innerMain(); deinitCfw(); @@ -274,25 +251,7 @@ int main() if(app != APP_STATE_STOPPED) { if(!launchingTitle()) - { -#ifdef NUSSPLI_HBL - if(isAroma()) - SYSLaunchMenu(); - else if(!jailbreaking) - { - if((tid & 0xFFFFFFFFFFFFF0FF) == 0x000500101004E000) // Health & Safety - { - tid &= 0xFFFFFFFFFFFF0FFF; - tid |= 0x000000000000A000; - _SYSLaunchTitleWithStdArgsInNoSplash(tid, NULL); - } - else - SYSRelaunchTitle(0, NULL); - } -#else SYSLaunchMenu(); -#endif - } if(app == APP_STATE_HOME) { diff --git a/src/menu/updateMenu.c b/src/menu/updateMenu.c index 6d888e8a..d54d463e 100644 --- a/src/menu/updateMenu.c +++ b/src/menu/updateMenu.c @@ -69,9 +69,7 @@ bool updateMenu(const char *newVersion, NUSSPLI_TYPE type) { if(update(newVersion, type)) { -#ifndef NUSSPLI_HBL relaunch(); -#endif return true; } else diff --git a/src/state.c b/src/state.c index b28e7752..ec32f1ef 100644 --- a/src/state.c +++ b/src/state.c @@ -39,11 +39,9 @@ volatile APP_STATE app; static bool shutdownEnabled = true; -#ifndef NUSSPLI_HBL #ifndef NUSSPLI_LITE static bool channel; #endif -#endif static bool aroma; static bool apdEnabled; static uint32_t apdDisabledCount = 0; @@ -111,14 +109,12 @@ bool isAroma() return aroma; } -#ifndef NUSSPLI_HBL #ifndef NUSSPLI_LITE bool isChannel() { return channel; } #endif -#endif uint32_t homeButtonCallback(void *dummy) { @@ -148,10 +144,8 @@ void initState() ACPInitialize(); aroma = RPXLoader_InitLibrary() == RPX_LOADER_RESULT_SUCCESS; -#ifndef NUSSPLI_HBL #ifndef NUSSPLI_LITE channel = OSGetTitleID() == 0x0005000010155373; -#endif #endif uint32_t ime; diff --git a/src/updater.c b/src/updater.c index e92c589b..90c44f86 100644 --- a/src/updater.c +++ b/src/updater.c @@ -56,7 +56,6 @@ #define UPDATE_CHECK_URL NAPI_URL "s?t=" #define UPDATE_DOWNLOAD_URL "https://github.com/V10lator/NUSspli/releases/download/v" #define UPDATE_TEMP_FOLDER NUSDIR_SD "NUSspli_temp/" -#define UPDATE_HBL_FOLDER NUSDIR_SD "wiiu/apps/NUSspli" #define UPDATE_AROMA_FOLDER NUSDIR_SD "wiiu/apps/" #ifndef NUSSPLI_LITE @@ -97,14 +96,10 @@ bool updateCheck() return false; const char *updateChkUrl = -#ifdef NUSSPLI_HBL - UPDATE_CHECK_URL "h"; -#else #ifdef NUSSPLI_LITE UPDATE_CHECK_URL "l"; #else !isChannel() && isAroma() ? UPDATE_CHECK_URL "a" : UPDATE_CHECK_URL "c"; -#endif #endif bool ret = false; @@ -131,11 +126,8 @@ bool updateCheck() const char *newVer = json_string_value(json_object_get(json, "v")); ret = newVer != NULL; if(ret) -#ifdef NUSSPLI_HBL - ret = updateMenu(newVer, NUSSPLI_TYPE_HBL); -#else ret = updateMenu(newVer, isAroma() ? NUSSPLI_TYPE_AROMA : NUSSPLI_TYPE_CHANNEL); -#endif + break; case 2: // Type deprecated, update to what the server suggests const char *nv = json_string_value(json_object_get(json, "v")); @@ -430,9 +422,6 @@ bool update(const char *newVersion, NUSSPLI_TYPE type) case NUSSPLI_TYPE_CHANNEL: strcat(path, "-Channel"); break; - case NUSSPLI_TYPE_HBL: - strcat(path, "-HBL"); - break; default: showUpdateError("Internal error!"); goto updateError; @@ -454,14 +443,6 @@ bool update(const char *newVersion, NUSSPLI_TYPE type) bool toUSB = getUSB() != NUSDEV_NONE; // Uninstall currently running type/version -#ifdef NUSSPLI_HBL - err = removeDirectory(UPDATE_HBL_FOLDER); - if(err != FS_ERROR_OK) - { - showUpdateErrorf("%s: %s", localise("Error removing directory"), translateFSErr(err)); - goto updateError; - } -#else if(isChannel()) { MCPTitleListType ownInfo __attribute__((__aligned__(0x40))); @@ -503,7 +484,6 @@ bool update(const char *newVersion, NUSSPLI_TYPE type) goto updateError; } } -#endif // Install new type/version flushIOQueue(); @@ -527,14 +507,6 @@ bool update(const char *newVersion, NUSSPLI_TYPE type) strcpy(path, UPDATE_TEMP_FOLDER "NUSspli/"); install("Update", false, NUSDEV_SD, path, toUSB, true, NULL); break; - case NUSSPLI_TYPE_HBL: - err = moveDirectory(UPDATE_TEMP_FOLDER "NUSspli", UPDATE_HBL_FOLDER); - if(err != FS_ERROR_OK) - { - showUpdateErrorf("%s: %s", localise("Error moving directory"), translateFSErr(err)); - goto updateError; - } - break; } freeRamBuf(rambuf);