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 {
void initApp ();
void deinitApp ();
void initInstallServices();
void deinitInstallServices();
std::vector<std::filesystem::path> getDirectoryFiles(const std::string & dir, const std::vector<std::string> & extensions);
bool removeDirectory(std::string dir);
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)
{
inst::util::initInstallServices();
appletLockExit();
inst::ui::loadInstallScreen();
bool nspInstalled = true;
@ -160,6 +161,7 @@ namespace netInstStuff{
printf("Done");
appletUnlockExit();
inst::ui::loadMainMenu();
inst::util::deinitInstallServices();
return;
}

View File

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

View File

@ -11,6 +11,7 @@ namespace inst::ui {
namespace sig {
void installSigPatches () {
bpcInitialize();
try {
std::string patchesVersion = inst::util::readTextFromFile("sdmc:/atmosphere/exefs_patches/es_patches/patches.txt");
std::string versionText = "";
@ -61,5 +62,6 @@ namespace sig {
fprintf(stdout, "%s", e.what());
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__
nxlinkStdio();
#endif
plInitialize();
setInitialize();
ncmInitialize();
nsInitialize();
nsextInitialize();
esInitialize();
nifmInitialize();
splCryptoInitialize();
splInitialize();
bpcInitialize();
}
void deinitApp () {
socketExit();
plExit();
setExit();
}
void initInstallServices() {
ncmInitialize();
nsInitialize();
nsextInitialize();
esInitialize();
splCryptoInitialize();
splInitialize();
}
void deinitInstallServices() {
ncmExit();
nsExit();
nsextExit();
esExit();
nifmExit();
splCryptoExit();
splExit();
bpcExit();
}
std::vector<std::filesystem::path> getDirectoryFiles(const std::string & dir, const std::vector<std::string> & extensions) {