Added install finished messages

This commit is contained in:
Huntereb 2019-11-03 15:02:15 -05:00
parent 6f5226e9d2
commit 48905e08ec
3 changed files with 13 additions and 4 deletions

View File

@ -33,5 +33,6 @@ namespace inst::ui {
}
namespace nspInstStuff {
std::string finishedMessage();
void installNspFromFile(std::vector<std::filesystem::path> ourNspList, int whereToInstall);
}

View File

@ -150,10 +150,11 @@ namespace netInstStuff{
// Send 1 byte ack to close the server
u8 ack = 0;
tin::network::WaitSendNetworkData(m_clientSocket, &ack, sizeof(u8));
inst::ui::setInstBarPerc(100);
if(nspInstalled) {
if (ourUrlList.size() > 1) inst::ui::mainApp->CreateShowDialog("Selected files installed!", "", {"OK"}, true);
else inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(inst::util::formatUrlString(ourUrlList[0]), 64, true) + " installed!", "", {"OK"}, true);
if (ourUrlList.size() > 1) inst::ui::mainApp->CreateShowDialog("Selected files installed!", nspInstStuff::finishedMessage(), {"OK"}, true);
else inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(inst::util::formatUrlString(ourUrlList[0]), 64, true) + " installed!", nspInstStuff::finishedMessage(), {"OK"}, true);
}
printf("Done");

View File

@ -23,6 +23,7 @@ SOFTWARE.
#include <cstring>
#include <sstream>
#include <filesystem>
#include <ctime>
#include "install/install_nsp.hpp"
#include "nx/fs.hpp"
@ -72,6 +73,12 @@ namespace inst::ui {
namespace nspInstStuff {
std::string finishedMessage() {
std::vector<std::string> finishMessages = {"Enjoy your \"legal backups\"!", "I'm sure after you give the game a try you'll have tons of fun actually buying it!", "You buy gamu right? Nintendo-san thanka-you for your purchase!", "Bypassing DRM is great, isn't it?", "You probably saved like six trees by not buying the game! All that plastic goes somewhere!"};
srand(time(NULL));
return(finishMessages[rand() % finishMessages.size()]);
}
void installNspFromFile(std::vector<std::filesystem::path> ourNspList, int whereToInstall)
{
appletLockExit();
@ -125,13 +132,13 @@ namespace nspInstStuff {
if(nspInstalled) {
if (ourNspList.size() > 1) {
if(inst::ui::mainApp->CreateShowDialog("Selected files installed! Delete them from the SD card?", "", {"No","Yes"}, false) == 1) {
if(inst::ui::mainApp->CreateShowDialog("Selected files installed! Delete them from the SD card?", nspInstStuff::finishedMessage(), {"No","Yes"}, false) == 1) {
for (long unsigned int i = 0; i < ourNspList.size(); i++) {
std::filesystem::remove(ourNspList[i]);
}
}
} else {
if(inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourNspList[0].string().erase(0, 6), 64, true) + " installed! Delete it from the SD card?", "", {"No","Yes"}, false) == 1) std::filesystem::remove(ourNspList[0]);
if(inst::ui::mainApp->CreateShowDialog(inst::util::shortenString(ourNspList[0].string().erase(0, 6), 64, true) + " installed! Delete it from the SD card?", nspInstStuff::finishedMessage(), {"No","Yes"}, false) == 1) std::filesystem::remove(ourNspList[0]);
}
}