diff --git a/include/constants.hpp b/include/constants.hpp
index 5582094..919094c 100644
--- a/include/constants.hpp
+++ b/include/constants.hpp
@@ -27,6 +27,7 @@
#define CHEATS_FILENAME "/config/aio-switch-updater/cheats.zip"
#define CHEATS_EXCLUDE "/config/aio-switch-updater/exclude.txt"
#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 REINX_CONTENTS "/ReiNX/contents/"
#define SXOS_TITLES "/sxos/titles/"
diff --git a/include/tools_tab.hpp b/include/tools_tab.hpp
index 0ad1d2a..e9764e2 100644
--- a/include/tools_tab.hpp
+++ b/include/tools_tab.hpp
@@ -23,6 +23,6 @@ class ToolsTab : public brls::List
brls::StagedAppletFrame* stagedFrame;
public:
- ToolsTab();
+ ToolsTab(std::string tag);
};
\ No newline at end of file
diff --git a/include/utils.hpp b/include/utils.hpp
index 5b2e835..d71c219 100644
--- a/include/utils.hpp
+++ b/include/utils.hpp
@@ -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 opt1, std::string opt2);
std::string getLatestTag(const char *url);
-Result CopyFile(const char src_path[FS_MAX_PATH], const char dest_path[FS_MAX_PATH]);
\ No newline at end of file
+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);
\ No newline at end of file
diff --git a/source/changelog_page.cpp b/source/changelog_page.cpp
index 92885bd..b28d0cb 100644
--- a/source/changelog_page.cpp
+++ b/source/changelog_page.cpp
@@ -31,6 +31,10 @@ ChangelogPage::ChangelogPage() : AppletFrame(true, true)
verTitles.push_back("v1.1.2");
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();
items.reserve(nbVersions);
for(int i = nbVersions -1 ; i >= 0; i--){
diff --git a/source/extract.cpp b/source/extract.cpp
index f79c1db..fc2bef9 100644
--- a/source/extract.cpp
+++ b/source/extract.cpp
@@ -1,4 +1,6 @@
#include "extract.hpp"
+#include "utils.hpp"
+#include "download.hpp"
void extract(const char * filename, const char* workingPath, int overwriteInis){
ProgressEvent::instance().reset();
@@ -269,6 +271,7 @@ void extractCheats(const char * zipPath, std::vector
titles, CFW cfw, boo
}
unzipper.close();
writeTitlesToFile(extractedTitles, UPDATED_TITLES_PATH);
+ saveVersion(fetchTitle(CHEATS_RELEASE_URL), CHEATS_VERSION);
ProgressEvent::instance().setStep(ProgressEvent::instance().getMax());
}
diff --git a/source/list_download_tab.cpp b/source/list_download_tab.cpp
index 54f5b8b..99a6a99 100644
--- a/source/list_download_tab.cpp
+++ b/source/list_download_tab.cpp
@@ -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"\
"\uE016 Current FW: "
);
- SetSysFirmwareVersion ver;
- if (R_SUCCEEDED(setsysGetFirmwareVersion(&ver))) firmwareText += ver.display_version;
- else firmwareText += "not found";
+
+ std::string currentCheatsVer =
+ "\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);
switch(type){
case sigpatches:
@@ -25,6 +29,9 @@ ListDownloadTab::ListDownloadTab(archiveType type) :
case fw:
links = fetchLinks(FIRMWARE_URL);
operation += "firmware";
+ SetSysFirmwareVersion ver;
+ if (R_SUCCEEDED(setsysGetFirmwareVersion(&ver))) firmwareText += ver.display_version;
+ else firmwareText += "not found";
this->description->setText(firmwareText);
break;
case app:
@@ -56,11 +63,8 @@ ListDownloadTab::ListDownloadTab(archiveType type) :
}
}
operation += "cheats";
- this->description->setText(
- "\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'."
- );
+ currentCheatsVer += readVersion(CHEATS_VERSION);
+ this->description->setText(currentCheatsVer);
break;
}
/* std::get<0>(links).push_back("Test");
diff --git a/source/main_frame.cpp b/source/main_frame.cpp
index 071678c..4c1a162 100644
--- a/source/main_frame.cpp
+++ b/source/main_frame.cpp
@@ -2,10 +2,11 @@
MainFrame::MainFrame() : TabFrame()
{
-
- //this->setIcon(new Logo(LogoStyle::HEADER));
- brls::Logger::debug("MainFrame");
- setTitle(std::string(APP_TITLE) + " v" + std::string(APP_VERSION));
+ std::string tag = getLatestTag(TAGS_INFO);
+ if(!tag.empty() && tag != APP_VERSION)
+ setTitle(std::string(APP_TITLE) + " - New app update available");
+ else
+ setTitle(std::string(APP_TITLE) + " v" + std::string(APP_VERSION));
this->addTab("About", new AboutTab());
this->addSeparator();
@@ -18,5 +19,5 @@ MainFrame::MainFrame() : TabFrame()
this->addSeparator();
- this->addTab("Tools", new ToolsTab());
+ this->addTab("Tools", new ToolsTab(tag));
}
diff --git a/source/tools_tab.cpp b/source/tools_tab.cpp
index b520abe..b6260e0 100644
--- a/source/tools_tab.cpp
+++ b/source/tools_tab.cpp
@@ -1,6 +1,6 @@
#include "tools_tab.hpp"
-ToolsTab::ToolsTab() : brls::List()
+ToolsTab::ToolsTab(std::string tag) : brls::List()
{
cheats = new brls::ListItem("Cheats menu");
cheats->getClickEvent()->subscribe([&](brls::View* view){
@@ -26,7 +26,6 @@ ToolsTab::ToolsTab() : brls::List()
});
this->addView(rebootPayload);
- std::string tag = getLatestTag(TAGS_INFO);
if(!tag.empty() && tag != APP_VERSION){
updateApp = new brls::ListItem("Update the app (v" + tag +")");
std::string text("Downloading:\nAIO-switch-updater\n\nFrom:\n" + std::string(APP_URL));
diff --git a/source/utils.cpp b/source/utils.cpp
index 8b78590..2a685b9 100644
--- a/source/utils.cpp
+++ b/source/utils.cpp
@@ -327,4 +327,22 @@ Result CopyFile(const char src_path[FS_MAX_PATH], const char dest_path[FS_MAX_PA
fsFileClose(&src_handle);
fsFileClose(&dest_handle);
return 0;
-}
\ No newline at end of file
+}
+
+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;
+}