mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2024-11-25 02:52:05 +00:00
changed bid retrieval method for cheatslips
This commit is contained in:
parent
6ea098386d
commit
743109c7b3
3 changed files with 16 additions and 22 deletions
|
@ -38,6 +38,7 @@ constexpr const char CHEATS_URL_CONTENTS[] ="https://github.com/HamletDuFromage/
|
|||
constexpr const char CHEATS_URL_VERSION[] = "https://github.com/HamletDuFromage/switch-cheats-db/releases/download/v1.0/VERSION";
|
||||
constexpr const char LOOKUP_TABLE_URL[] = "https://raw.githubusercontent.com/HamletDuFromage/switch-cheats-db/master/versions.json";
|
||||
constexpr const char LOOKUP_TABLE_CBOR[] = "https://github.com/HamletDuFromage/switch-cheats-db/raw/master/versions.cbor";
|
||||
constexpr const char VERSIONS_DIRECTORY[] = "https://raw.githubusercontent.com/HamletDuFromage/switch-cheats-db/master/versions/";
|
||||
constexpr const char CHEATSLIPS_CHEATS_URL[] ="https://www.cheatslips.com/api/v1/cheats/";
|
||||
constexpr const char CHEATSLIPS_TOKEN_URL[] ="https://www.cheatslips.com/api/v1/token";
|
||||
constexpr const char TOKEN_PATH[] = "/config/aio-switch-updater/token.json";
|
||||
|
|
|
@ -125,7 +125,10 @@ ChangelogPage::ChangelogPage() : AppletFrame(true, true)
|
|||
changes.push_back("\uE016 Added option to manually change language.\n\uE016 Fixed broken strings.\n\uE016 Few visual tweaks.");
|
||||
|
||||
verTitles.push_back("v2.4.3");
|
||||
changes.push_back("\uE016 Added way to select system default in language selection.\n\uE016 Display local IP in internet settings.\uE016 Added Polish localisation (thanks to https://github.com/teddy74eva)\n\uE016 Updated Traditional Chinese localisation (thanks to https://github.com/qazrfv1234)\n\uE016 Minor code changes");
|
||||
changes.push_back("\uE016 Added way to select system default in language selection.\n\uE016 Display local IP in internet settings.\n\uE016 Added Polish localisation (thanks to https://github.com/teddy74eva).\n\uE016 Updated Traditional Chinese localisation (thanks to https://github.com/qazrfv1234).\n\uE016 Minor code changes.");
|
||||
|
||||
verTitles.push_back("v2.4.4");
|
||||
changes.push_back("\uE016 Significantly reduced time to retrieve build IDs.\n\uE016 Updated Polish localisation (thanks to https://github.com/teddy74eva).");
|
||||
|
||||
for(int i = verTitles.size() -1 ; i >= 0; i--){
|
||||
listItem = new brls::ListItem(verTitles[i]);
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
#include "fs.hpp"
|
||||
#include "current_cfw.hpp"
|
||||
|
||||
//#include <iostream>
|
||||
|
||||
namespace i18n = brls::i18n;
|
||||
using namespace i18n::literals;
|
||||
using json = nlohmann::json;
|
||||
|
@ -171,29 +169,21 @@ std::string DownloadCheatsPage::GetBuilIDFromFile(uint64_t tid) {
|
|||
NsApplicationContentMetaStatus *MetaSatus = new NsApplicationContentMetaStatus[100U];
|
||||
s32 out;
|
||||
nsListApplicationContentMetaStatus(tid, 0, MetaSatus, 100, &out);
|
||||
u32 version = 0;
|
||||
for(int i = 0; i < out ; i++){
|
||||
if(version < MetaSatus[i].version) version = MetaSatus[i].version;
|
||||
u32 v = 0;
|
||||
for(int i = 0; i < out ; i++) {
|
||||
if(v < MetaSatus[i].version) v = MetaSatus[i].version;
|
||||
}
|
||||
|
||||
this->setFooterText("Game version: v" + std::to_string(version / 0x10000));
|
||||
this->setFooterText("Game version: v" + std::to_string(v / 0x10000));
|
||||
std::string version = std::to_string(v);
|
||||
|
||||
json lookupTable;
|
||||
try {
|
||||
lookupTable = json::parse(std::string(json::from_cbor(download::downloadFile(LOOKUP_TABLE_CBOR))));
|
||||
}
|
||||
catch (json::parse_error& e)
|
||||
{
|
||||
//std::cout << "message: " << e.what() << '\n' << "exception id: " << e.id << '\n' << "byte position of error: " << e.byte << std::endl;
|
||||
}
|
||||
std::string versions_str = download::downloadPage(std::string(VERSIONS_DIRECTORY + util::formatApplicationId(tid) + ".json").c_str());
|
||||
json versions;
|
||||
if (json::accept(versions_str)) versions = json::parse(versions_str);
|
||||
else versions = json::object();
|
||||
|
||||
std::string tidstr = util::formatApplicationId(tid);
|
||||
std::string versionstr = std::to_string(version);
|
||||
if(lookupTable.find(tidstr) != lookupTable.end()) {
|
||||
json buildIDs = lookupTable[tidstr];
|
||||
if(buildIDs.find(versionstr) != buildIDs.end()) {
|
||||
return buildIDs[versionstr];
|
||||
}
|
||||
if(versions.find(version) != versions.end()) {
|
||||
return versions[version];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue