Make services only load when needed, remove unused services

This commit is contained in:
Huntereb 2019-11-03 16:16:52 -05:00
parent 251aba21a3
commit cd3e4ba7b7
5 changed files with 20 additions and 14 deletions

View file

@ -4,6 +4,8 @@
namespace inst::util { namespace inst::util {
void initApp (); void initApp ();
void deinitApp (); void deinitApp ();
void initInstallServices();
void deinitInstallServices();
std::vector<std::filesystem::path> getDirectoryFiles(const std::string & dir, const std::vector<std::string> & extensions); std::vector<std::filesystem::path> getDirectoryFiles(const std::string & dir, const std::vector<std::string> & extensions);
bool removeDirectory(std::string dir); bool removeDirectory(std::string dir);
bool copyFile(std::string inFile, std::string outFile); bool copyFile(std::string inFile, std::string outFile);

View file

@ -114,6 +114,7 @@ namespace netInstStuff{
void installNspLan(std::vector<std::string> ourUrlList, int ourStorage) void installNspLan(std::vector<std::string> ourUrlList, int ourStorage)
{ {
inst::util::initInstallServices();
appletLockExit(); appletLockExit();
inst::ui::loadInstallScreen(); inst::ui::loadInstallScreen();
bool nspInstalled = true; bool nspInstalled = true;
@ -160,6 +161,7 @@ namespace netInstStuff{
printf("Done"); printf("Done");
appletUnlockExit(); appletUnlockExit();
inst::ui::loadMainMenu(); inst::ui::loadMainMenu();
inst::util::deinitInstallServices();
return; return;
} }

View file

@ -81,6 +81,7 @@ namespace nspInstStuff {
void installNspFromFile(std::vector<std::filesystem::path> ourNspList, int whereToInstall) void installNspFromFile(std::vector<std::filesystem::path> ourNspList, int whereToInstall)
{ {
inst::util::initInstallServices();
appletLockExit(); appletLockExit();
inst::ui::loadInstallScreen(); inst::ui::loadInstallScreen();
bool nspInstalled = true; bool nspInstalled = true;
@ -145,6 +146,7 @@ namespace nspInstStuff {
printf("Done"); printf("Done");
appletUnlockExit(); appletUnlockExit();
inst::ui::loadMainMenu(); inst::ui::loadMainMenu();
inst::util::deinitInstallServices();
return; return;
} }
} }

View file

@ -11,6 +11,7 @@ namespace inst::ui {
namespace sig { namespace sig {
void installSigPatches () { void installSigPatches () {
bpcInitialize();
try { try {
std::string patchesVersion = inst::util::readTextFromFile("sdmc:/atmosphere/exefs_patches/es_patches/patches.txt"); std::string patchesVersion = inst::util::readTextFromFile("sdmc:/atmosphere/exefs_patches/es_patches/patches.txt");
std::string versionText = ""; std::string versionText = "";
@ -61,5 +62,6 @@ namespace sig {
fprintf(stdout, "%s", e.what()); fprintf(stdout, "%s", e.what());
inst::ui::mainApp->CreateShowDialog("Failed to install Signature Patches!", (std::string)e.what(), {"OK"}, true); inst::ui::mainApp->CreateShowDialog("Failed to install Signature Patches!", (std::string)e.what(), {"OK"}, true);
} }
bpcExit();
} }
} }

View file

@ -21,30 +21,28 @@ namespace inst::util {
#ifdef __DEBUG__ #ifdef __DEBUG__
nxlinkStdio(); nxlinkStdio();
#endif #endif
plInitialize();
setInitialize();
ncmInitialize();
nsInitialize();
nsextInitialize();
esInitialize();
nifmInitialize();
splCryptoInitialize();
splInitialize();
bpcInitialize();
} }
void deinitApp () { void deinitApp () {
socketExit(); socketExit();
plExit(); }
setExit();
void initInstallServices() {
ncmInitialize();
nsInitialize();
nsextInitialize();
esInitialize();
splCryptoInitialize();
splInitialize();
}
void deinitInstallServices() {
ncmExit(); ncmExit();
nsExit(); nsExit();
nsextExit(); nsextExit();
esExit(); esExit();
nifmExit();
splCryptoExit(); splCryptoExit();
splExit(); splExit();
bpcExit();
} }
std::vector<std::filesystem::path> getDirectoryFiles(const std::string & dir, const std::vector<std::string> & extensions) { std::vector<std::filesystem::path> getDirectoryFiles(const std::string & dir, const std::vector<std::string> & extensions) {