mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2024-12-29 10:56:01 +00:00
Added a way to see current cheat update and available app updates
This commit is contained in:
parent
244fd1c8c4
commit
dc43c0cf6b
9 changed files with 50 additions and 18 deletions
|
@ -27,6 +27,7 @@
|
||||||
#define CHEATS_FILENAME "/config/aio-switch-updater/cheats.zip"
|
#define CHEATS_FILENAME "/config/aio-switch-updater/cheats.zip"
|
||||||
#define CHEATS_EXCLUDE "/config/aio-switch-updater/exclude.txt"
|
#define CHEATS_EXCLUDE "/config/aio-switch-updater/exclude.txt"
|
||||||
#define UPDATED_TITLES_PATH "/config/aio-switch-updater/updated.dat"
|
#define UPDATED_TITLES_PATH "/config/aio-switch-updater/updated.dat"
|
||||||
|
#define CHEATS_VERSION "/config/aio-switch-updater/cheats_version.dat"
|
||||||
#define AMS_CONTENTS "/atmosphere/contents/"
|
#define AMS_CONTENTS "/atmosphere/contents/"
|
||||||
#define REINX_CONTENTS "/ReiNX/contents/"
|
#define REINX_CONTENTS "/ReiNX/contents/"
|
||||||
#define SXOS_TITLES "/sxos/titles/"
|
#define SXOS_TITLES "/sxos/titles/"
|
||||||
|
|
|
@ -23,6 +23,6 @@ class ToolsTab : public brls::List
|
||||||
brls::StagedAppletFrame* stagedFrame;
|
brls::StagedAppletFrame* stagedFrame;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ToolsTab();
|
ToolsTab(std::string tag);
|
||||||
|
|
||||||
};
|
};
|
|
@ -40,4 +40,6 @@ void shut_down(bool reboot = false);
|
||||||
int showDialogBox(std::string text, std::string opt);
|
int showDialogBox(std::string text, std::string opt);
|
||||||
int showDialogBox(std::string text, std::string opt1, std::string opt2);
|
int showDialogBox(std::string text, std::string opt1, std::string opt2);
|
||||||
std::string getLatestTag(const char *url);
|
std::string getLatestTag(const char *url);
|
||||||
Result CopyFile(const char src_path[FS_MAX_PATH], const char dest_path[FS_MAX_PATH]);
|
Result CopyFile(const char src_path[FS_MAX_PATH], const char dest_path[FS_MAX_PATH]);
|
||||||
|
void saveVersion(std::string version, const char* path);
|
||||||
|
std::string readVersion(const char* path);
|
|
@ -31,6 +31,10 @@ ChangelogPage::ChangelogPage() : AppletFrame(true, true)
|
||||||
verTitles.push_back("v1.1.2");
|
verTitles.push_back("v1.1.2");
|
||||||
changes.push_back("\uE016 Added GUI to disable cheat updates for specific titles.");
|
changes.push_back("\uE016 Added GUI to disable cheat updates for specific titles.");
|
||||||
|
|
||||||
|
verTitles.push_back("v1.1.3");
|
||||||
|
changes.push_back("\uE016 Now displays the latest installed cheat version.\n"\
|
||||||
|
"\uE016 Now warns if in the app title if a new update is available.");
|
||||||
|
|
||||||
int nbVersions = verTitles.size();
|
int nbVersions = verTitles.size();
|
||||||
items.reserve(nbVersions);
|
items.reserve(nbVersions);
|
||||||
for(int i = nbVersions -1 ; i >= 0; i--){
|
for(int i = nbVersions -1 ; i >= 0; i--){
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#include "extract.hpp"
|
#include "extract.hpp"
|
||||||
|
#include "utils.hpp"
|
||||||
|
#include "download.hpp"
|
||||||
|
|
||||||
void extract(const char * filename, const char* workingPath, int overwriteInis){
|
void extract(const char * filename, const char* workingPath, int overwriteInis){
|
||||||
ProgressEvent::instance().reset();
|
ProgressEvent::instance().reset();
|
||||||
|
@ -269,6 +271,7 @@ void extractCheats(const char * zipPath, std::vector<Title> titles, CFW cfw, boo
|
||||||
}
|
}
|
||||||
unzipper.close();
|
unzipper.close();
|
||||||
writeTitlesToFile(extractedTitles, UPDATED_TITLES_PATH);
|
writeTitlesToFile(extractedTitles, UPDATED_TITLES_PATH);
|
||||||
|
saveVersion(fetchTitle(CHEATS_RELEASE_URL), CHEATS_VERSION);
|
||||||
ProgressEvent::instance().setStep(ProgressEvent::instance().getMax());
|
ProgressEvent::instance().setStep(ProgressEvent::instance().getMax());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,13 @@ ListDownloadTab::ListDownloadTab(archiveType type) :
|
||||||
"Once downloaded, it will be extracted in '/firmware'. You can then install the update through Daybreak or ChoiDuJour.\n"\
|
"Once downloaded, it will be extracted in '/firmware'. You can then install the update through Daybreak or ChoiDuJour.\n"\
|
||||||
"\uE016 Current FW: "
|
"\uE016 Current FW: "
|
||||||
);
|
);
|
||||||
SetSysFirmwareVersion ver;
|
|
||||||
if (R_SUCCEEDED(setsysGetFirmwareVersion(&ver))) firmwareText += ver.display_version;
|
std::string currentCheatsVer =
|
||||||
else firmwareText += "not found";
|
"\uE016 This will download a daily updated archive of cheat codes from 'gbatemp.net'. "\
|
||||||
|
"Cheat codes for games you don't have installed won't be extracted to your SD card. "\
|
||||||
|
"You can turn off cheat updated in 'Tools->Cheat menu'.\n"\
|
||||||
|
"\uE016 Current cheats version: ";
|
||||||
|
|
||||||
this->description = new brls::Label(brls::LabelStyle::DESCRIPTION, "", true);
|
this->description = new brls::Label(brls::LabelStyle::DESCRIPTION, "", true);
|
||||||
switch(type){
|
switch(type){
|
||||||
case sigpatches:
|
case sigpatches:
|
||||||
|
@ -25,6 +29,9 @@ ListDownloadTab::ListDownloadTab(archiveType type) :
|
||||||
case fw:
|
case fw:
|
||||||
links = fetchLinks(FIRMWARE_URL);
|
links = fetchLinks(FIRMWARE_URL);
|
||||||
operation += "firmware";
|
operation += "firmware";
|
||||||
|
SetSysFirmwareVersion ver;
|
||||||
|
if (R_SUCCEEDED(setsysGetFirmwareVersion(&ver))) firmwareText += ver.display_version;
|
||||||
|
else firmwareText += "not found";
|
||||||
this->description->setText(firmwareText);
|
this->description->setText(firmwareText);
|
||||||
break;
|
break;
|
||||||
case app:
|
case app:
|
||||||
|
@ -56,11 +63,8 @@ ListDownloadTab::ListDownloadTab(archiveType type) :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
operation += "cheats";
|
operation += "cheats";
|
||||||
this->description->setText(
|
currentCheatsVer += readVersion(CHEATS_VERSION);
|
||||||
"\uE016 This will download a daily updated archive of cheat codes from 'gbatemp.net'. "\
|
this->description->setText(currentCheatsVer);
|
||||||
"Cheat codes for games you don't have installed won't be extracted to your SD card. "\
|
|
||||||
"You can turn off cheat updated in 'Tools->Cheat menu'."
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* std::get<0>(links).push_back("Test");
|
/* std::get<0>(links).push_back("Test");
|
||||||
|
|
|
@ -2,10 +2,11 @@
|
||||||
|
|
||||||
MainFrame::MainFrame() : TabFrame()
|
MainFrame::MainFrame() : TabFrame()
|
||||||
{
|
{
|
||||||
|
std::string tag = getLatestTag(TAGS_INFO);
|
||||||
//this->setIcon(new Logo(LogoStyle::HEADER));
|
if(!tag.empty() && tag != APP_VERSION)
|
||||||
brls::Logger::debug("MainFrame");
|
setTitle(std::string(APP_TITLE) + " - New app update available");
|
||||||
setTitle(std::string(APP_TITLE) + " v" + std::string(APP_VERSION));
|
else
|
||||||
|
setTitle(std::string(APP_TITLE) + " v" + std::string(APP_VERSION));
|
||||||
this->addTab("About", new AboutTab());
|
this->addTab("About", new AboutTab());
|
||||||
|
|
||||||
this->addSeparator();
|
this->addSeparator();
|
||||||
|
@ -18,5 +19,5 @@ MainFrame::MainFrame() : TabFrame()
|
||||||
|
|
||||||
this->addSeparator();
|
this->addSeparator();
|
||||||
|
|
||||||
this->addTab("Tools", new ToolsTab());
|
this->addTab("Tools", new ToolsTab(tag));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "tools_tab.hpp"
|
#include "tools_tab.hpp"
|
||||||
|
|
||||||
ToolsTab::ToolsTab() : brls::List()
|
ToolsTab::ToolsTab(std::string tag) : brls::List()
|
||||||
{
|
{
|
||||||
cheats = new brls::ListItem("Cheats menu");
|
cheats = new brls::ListItem("Cheats menu");
|
||||||
cheats->getClickEvent()->subscribe([&](brls::View* view){
|
cheats->getClickEvent()->subscribe([&](brls::View* view){
|
||||||
|
@ -26,7 +26,6 @@ ToolsTab::ToolsTab() : brls::List()
|
||||||
});
|
});
|
||||||
this->addView(rebootPayload);
|
this->addView(rebootPayload);
|
||||||
|
|
||||||
std::string tag = getLatestTag(TAGS_INFO);
|
|
||||||
if(!tag.empty() && tag != APP_VERSION){
|
if(!tag.empty() && tag != APP_VERSION){
|
||||||
updateApp = new brls::ListItem("Update the app (v" + tag +")");
|
updateApp = new brls::ListItem("Update the app (v" + tag +")");
|
||||||
std::string text("Downloading:\nAIO-switch-updater\n\nFrom:\n" + std::string(APP_URL));
|
std::string text("Downloading:\nAIO-switch-updater\n\nFrom:\n" + std::string(APP_URL));
|
||||||
|
|
|
@ -327,4 +327,22 @@ Result CopyFile(const char src_path[FS_MAX_PATH], const char dest_path[FS_MAX_PA
|
||||||
fsFileClose(&src_handle);
|
fsFileClose(&src_handle);
|
||||||
fsFileClose(&dest_handle);
|
fsFileClose(&dest_handle);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void saveVersion(std::string version, const char* path){
|
||||||
|
std::fstream newVersion;
|
||||||
|
newVersion.open(path, std::fstream::out | std::fstream::trunc);
|
||||||
|
newVersion << version << std::endl;
|
||||||
|
newVersion.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string readVersion(const char* path){
|
||||||
|
std::fstream versionFile;
|
||||||
|
std::string version = "0";
|
||||||
|
if(std::filesystem::exists(path)){
|
||||||
|
versionFile.open(path, std::fstream::in);
|
||||||
|
versionFile >> version;
|
||||||
|
versionFile.close();
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue