New patches location, patches version checking, include fixes, string fixes

This commit is contained in:
Huntereb 2019-10-29 21:58:53 -04:00
parent fad4defcd1
commit 89c68ad0a9
14 changed files with 35 additions and 19 deletions

View File

@ -1,4 +1,4 @@
[settings] [settings]
ignoreReqVers=1 ignoreReqVers=1
gayMode=0 gayMode=0
sigPatchesUrl=http://github.com/Joonie86/hekate/releases/download/5.0.0J/Kosmos_patches_10_09_2019.zip sigPatchesUrl=https://github.com/Huntereb/Awoo-Installer/releases/download/SignaturePatches/patches.zip

View File

@ -1,5 +1,4 @@
#pragma once #pragma once
#include <string>
namespace inst::ui { namespace inst::ui {
void setTopInstInfoText(std::string ourText); void setTopInstInfoText(std::string ourText);

View File

@ -1,5 +1,4 @@
#pragma once #pragma once
#include <string>
namespace inst::config { namespace inst::config {
extern const std::string appDir; extern const std::string appDir;

View File

@ -3,7 +3,7 @@
#include <cstring> #include <cstring>
#include <stdexcept> #include <stdexcept>
#include <stdio.h> #include <stdio.h>
#include "debug.h" #include "util/debug.h"
#define ASSERT_OK(rc_out, desc) if (R_FAILED(rc_out)) { char msg[256] = {0}; snprintf(msg, 256-1, "%s:%u: %s. Error code: 0x%08x\n", __func__, __LINE__, desc, rc_out); throw std::runtime_error(msg); } #define ASSERT_OK(rc_out, desc) if (R_FAILED(rc_out)) { char msg[256] = {0}; snprintf(msg, 256-1, "%s:%u: %s. Error code: 0x%08x\n", __func__, __LINE__, desc, rc_out); throw std::runtime_error(msg); }
#define THROW_FORMAT(format, ...) { char error_prefix[512] = {0}; snprintf(error_prefix, 256-1, "%s:%u: ", __func__, __LINE__);\ #define THROW_FORMAT(format, ...) { char error_prefix[512] = {0}; snprintf(error_prefix, 256-1, "%s:%u: ", __func__, __LINE__);\

View File

@ -1,6 +1,3 @@
#include <minizip/unzip.h>
#include <string>
namespace inst::zip { namespace inst::zip {
bool extractFile(const std::string filename, const std::string destination); bool extractFile(const std::string filename, const std::string destination);
} }

View File

@ -1,5 +1,4 @@
#pragma once #pragma once
#include <string>
#include <filesystem> #include <filesystem>
namespace inst::util { namespace inst::util {
@ -10,4 +9,5 @@ namespace inst::util {
bool copyFile(std::string inFile, std::string outFile); bool copyFile(std::string inFile, std::string outFile);
std::string formatUrlString(std::string ourString); std::string formatUrlString(std::string ourString);
std::string shortenString(std::string ourString, int ourLength, bool isFile); std::string shortenString(std::string ourString, int ourLength, bool isFile);
std::string readTextFromFile(std::string ourFile);
} }

View File

@ -1,7 +1,6 @@
#include "switch.h" #include "switch.h"
#include "ui/MainApplication.hpp" #include "ui/MainApplication.hpp"
#include "util.hpp" #include "util/util.hpp"
#include <filesystem>
using namespace pu::ui::render; using namespace pu::ui::render;
int main(int argc, char* argv[]) int main(int argc, char* argv[])

View File

@ -13,7 +13,7 @@
#include "install/http_nsp.hpp" #include "install/http_nsp.hpp"
#include "install/install.hpp" #include "install/install.hpp"
#include "util/error.hpp" #include "util/error.hpp"
#include "netInstall.hpp"
#include "ui/MainApplication.hpp" #include "ui/MainApplication.hpp"
#include "netInstall.hpp" #include "netInstall.hpp"
#include "nspInstall.hpp" #include "nspInstall.hpp"

View File

@ -1,14 +1,15 @@
#include <cstring> #include <cstring>
#include <sstream> #include <sstream>
#include <filesystem> #include <filesystem>
#include "install/install_nsp.hpp" #include "install/install_nsp.hpp"
#include "nx/fs.hpp" #include "nx/fs.hpp"
#include "util/file_util.hpp" #include "util/file_util.hpp"
#include "util/title_util.hpp" #include "util/title_util.hpp"
#include "util/error.hpp" #include "util/error.hpp"
#include "nspInstall.hpp"
#include "ui/MainApplication.hpp" #include "ui/MainApplication.hpp"
#include "nspInstall.hpp"
#include "util/config.hpp" #include "util/config.hpp"
#include "util/util.hpp" #include "util/util.hpp"

View File

@ -2,7 +2,7 @@
#include "util/curl.hpp" #include "util/curl.hpp"
#include "util/util.hpp" #include "util/util.hpp"
#include "util/unzip.hpp" #include "util/unzip.hpp"
#include "config.hpp" #include "util/config.hpp"
namespace inst::ui { namespace inst::ui {
extern MainApplication *mainApp; extern MainApplication *mainApp;
@ -11,7 +11,10 @@ namespace inst::ui {
namespace sig { namespace sig {
void installSigPatches () { void installSigPatches () {
try { try {
int ourResult = inst::ui::mainApp->CreateShowDialog("Install signature patches?", "Signature patches are required for installing and playing NSP contents!", {"Install", "Uninstall", "Cancel"}, true); std::string patchesVersion = inst::util::readTextFromFile("sdmc:/atmosphere/exefs_patches/es_patches/patches.txt");
std::string versionText = "";
if (patchesVersion != "") versionText = "You currently have signature patches installed for HOS version " + patchesVersion;
int ourResult = inst::ui::mainApp->CreateShowDialog("Install signature patches?", "Signature patches are required for installing and playing NSP contents." + versionText, {"Install", "Uninstall", "Cancel"}, true);
if (ourResult == 0) { if (ourResult == 0) {
if (!inst::util::copyFile("sdmc:/bootloader/patches.ini", inst::config::appDir + "/patches.ini.old")) { if (!inst::util::copyFile("sdmc:/bootloader/patches.ini", inst::config::appDir + "/patches.ini.old")) {
if (inst::ui::mainApp->CreateShowDialog("Could not back up old Hekate patches.ini! Install anyway?", "", {"Yes", "No"}, false)) return; if (inst::ui::mainApp->CreateShowDialog("Could not back up old Hekate patches.ini! Install anyway?", "", {"Yes", "No"}, false)) return;
@ -25,7 +28,12 @@ namespace sig {
return; return;
} }
std::filesystem::remove(ourPath); std::filesystem::remove(ourPath);
if (didExtract) inst::ui::mainApp->CreateShowDialog("Install complete!", "Restart your console to apply!", {"OK"}, true); if (didExtract) {
patchesVersion = inst::util::readTextFromFile("sdmc:/atmosphere/exefs_patches/es_patches/patches.txt");
versionText = "";
if (patchesVersion != "") versionText = " Your signature patches have been updated for HOS version " + patchesVersion + "!";
inst::ui::mainApp->CreateShowDialog("Install complete!" + versionText, "Restart your console to apply!", {"OK"}, true);
}
else { else {
inst::ui::mainApp->CreateShowDialog("Could not extract files!", "", {"OK"}, true); inst::ui::mainApp->CreateShowDialog("Could not extract files!", "", {"OK"}, true);
return; return;

View File

@ -105,7 +105,7 @@ namespace inst::ui {
} }
break; break;
case 3: case 3:
inst::ui::mainApp->CreateShowDialog("Thanks to the following people for helping me!\n\n-HookedBehemoth for screen-nx (A great reference!)\n-Adubbz for Tinfoil\n-XorTroll for Plutonium and Goldleaf\n-The kind folks at the AtlasNX Discuck\n-The also kind folks at the RetroNX Discuck\n-namako8982 for the Momiji art\n-TheXzoron for being a baka", "", {"Close"}, true); inst::ui::mainApp->CreateShowDialog("Thanks to the following people for helping me!\n\n- HookedBehemoth for screen-nx and his Plutonium fork\n- Adubbz and other contributors for Tinfoil\n- XorTroll for Plutonium and Goldleaf\n- The kind folks at the AtlasNX Discuck\n- The also kind folks at the RetroNX Discuck\n- namako8982 for the Momiji art\n- TheXzoron for being a baka", "", {"Close"}, true);
break; break;
default: default:
break; break;

View File

@ -1,12 +1,12 @@
#include <filesystem> #include <filesystem>
#include <unistd.h> #include <unistd.h>
#include "util/INIReader.h" #include "util/INIReader.h"
#include "config.hpp" #include "util/config.hpp"
namespace inst::config { namespace inst::config {
const std::string appDir = "sdmc:/switch/Awoo-Installer"; const std::string appDir = "sdmc:/switch/Awoo-Installer";
const std::string configPath = appDir + "/config.ini"; const std::string configPath = appDir + "/config.ini";
std::string sigPatchesUrl = "http://github.com/Joonie86/hekate/releases/download/5.0.0J/Kosmos_patches_10_09_2019.zip"; std::string sigPatchesUrl = "https://github.com/Huntereb/Awoo-Installer/releases/download/SignaturePatches/patches.zip";
bool ignoreReqVers = true; bool ignoreReqVers = true;
bool gayMode = false; bool gayMode = false;

View File

@ -1,4 +1,4 @@
#include "debug.h" #include "util/debug.h"
#include <string.h> #include <string.h>

View File

@ -108,4 +108,17 @@ namespace inst::util {
else return (std::string)ourString.substr(0,ourLength) + "..."; else return (std::string)ourString.substr(0,ourLength) + "...";
} else return ourString; } else return ourString;
} }
std::string readTextFromFile(std::string ourFile) {
if (std::filesystem::exists(ourFile)) {
FILE * file = fopen(ourFile.c_str(), "r");
char line[1024];
fgets(line, 1024, file);
std::string url = line;
fflush(file);
fclose(file);
return url;
}
return "";
}
} }