mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2024-11-09 20:11:48 +00:00
get the buildid of a running game
This commit is contained in:
parent
7baa9e1350
commit
3f879a57ff
4 changed files with 59 additions and 4 deletions
|
@ -16,8 +16,24 @@ class DownloadCheatsPage : public brls::AppletFrame
|
|||
public:
|
||||
DownloadCheatsPage(uint64_t tid);
|
||||
std::string GetBuilID(uint64_t tid);
|
||||
std::string GetBuilIDFromFile(uint64_t tid);
|
||||
std::string GetCheatsTitle(nlohmann::json cheat);
|
||||
void WriteCheats(uint64_t tid, std::string bid, std::string cheatContent);
|
||||
void DeleteCheats(uint64_t tid, std::string bid);
|
||||
void ShowCheatsContent(nlohmann::ordered_json titles);
|
||||
|
||||
typedef struct {
|
||||
u64 base;
|
||||
u64 size;
|
||||
} DmntMemoryRegionExtents;
|
||||
|
||||
typedef struct {
|
||||
u64 process_id;
|
||||
u64 title_id;
|
||||
DmntMemoryRegionExtents main_nso_extents;
|
||||
DmntMemoryRegionExtents heap_extents;
|
||||
DmntMemoryRegionExtents alias_extents;
|
||||
DmntMemoryRegionExtents address_space_extents;
|
||||
u8 main_nso_build_id[0x20];
|
||||
} DmntCheatProcessMetadata;
|
||||
};
|
|
@ -71,6 +71,7 @@
|
|||
"v2_1_0_text": "\uE016 Switched to a better way to get links.",
|
||||
"v2_1_1_text": "\uE016 Added a friendly reminder to reboot for new sigpatches to apply.\n\uE016 Changed the cheatslips cheatsheet view.",
|
||||
"v2_1_2_text": "\uE016 Fixed wronge hekate link.",
|
||||
"v2_2_0_text": "\uE016 For cheatslips.com, the build ID of a running game will now be fetched, allowing you to access cheatsheets even if the build ID isn't listed in the versions database.",
|
||||
"Ok_button": "Ok",
|
||||
|
||||
"cheats_page.cpp":"",
|
||||
|
@ -95,6 +96,7 @@
|
|||
"wrong_cheatslips_id": "Couldn't retrieve token, make sure you enter you login properly",
|
||||
"see_more": "See more",
|
||||
"download_cheats": "Download cheats and go back",
|
||||
"bid_not_found": "Couldn't obtain build ID. Try launching aio-switch-updater in applet mode while the game is running.",
|
||||
|
||||
"choice_page.cpp":"",
|
||||
"choice_yes":"Yes",
|
||||
|
|
|
@ -94,6 +94,11 @@ ChangelogPage::ChangelogPage() : AppletFrame(true, true)
|
|||
verTitles.push_back("v2.1.2");
|
||||
changes.push_back("menus/v2_1_2_text"_i18n );
|
||||
|
||||
verTitles.push_back("v2.2.0");
|
||||
changes.push_back("menus/v2_2_0_text"_i18n );
|
||||
|
||||
|
||||
|
||||
int nbVersions = verTitles.size();
|
||||
items.reserve(nbVersions);
|
||||
for(int i = nbVersions -1 ; i >= 0; i--){
|
||||
|
|
|
@ -14,7 +14,12 @@ DownloadCheatsPage::DownloadCheatsPage(uint64_t tid) : AppletFrame(true, true)
|
|||
{
|
||||
this->setTitle("menus/cheat_menu"_i18n );
|
||||
|
||||
std::string bid = GetBuilID(tid);
|
||||
std::string bid = "";
|
||||
if(running_cfw == ams)
|
||||
bid = GetBuilID(tid);
|
||||
if(bid == "")
|
||||
bid = GetBuilIDFromFile(tid);
|
||||
|
||||
list = new brls::List();
|
||||
label = new brls::Label(
|
||||
brls::LabelStyle::DESCRIPTION,
|
||||
|
@ -43,7 +48,16 @@ DownloadCheatsPage::DownloadCheatsPage(uint64_t tid) : AppletFrame(true, true)
|
|||
list->addView(new brls::ListItemGroupSpacing(true));
|
||||
}
|
||||
|
||||
list->registerAction("menus/download_cheats"_i18n , brls::Key::B, [this, bid, tid] {
|
||||
else {
|
||||
label = new brls::Label(
|
||||
brls::LabelStyle::REGULAR,
|
||||
"menus/bid_not_found"_i18n,
|
||||
true
|
||||
);
|
||||
list->addView(label);
|
||||
}
|
||||
|
||||
list->registerAction((bid != "") ? "menus/download_cheats"_i18n : "brls/hints/back"_i18n, brls::Key::B, [this, bid, tid] {
|
||||
std::vector<int> ids;
|
||||
for(auto& e : toggles){
|
||||
if(e.first->getToggleState()){
|
||||
|
@ -111,11 +125,29 @@ DownloadCheatsPage::DownloadCheatsPage(uint64_t tid) : AppletFrame(true, true)
|
|||
dialog->open();
|
||||
});
|
||||
list->addView(del);
|
||||
|
||||
this->setContentView(list);
|
||||
}
|
||||
|
||||
std::string DownloadCheatsPage::GetBuilID(uint64_t tid) {
|
||||
static Service g_dmntchtSrv;
|
||||
DmntCheatProcessMetadata metadata;
|
||||
smGetService(&g_dmntchtSrv, "dmnt:cht");
|
||||
serviceDispatch(&g_dmntchtSrv, 65003);
|
||||
serviceDispatchOut(&g_dmntchtSrv, 65002, metadata);
|
||||
serviceClose(&g_dmntchtSrv);
|
||||
if(metadata.title_id == tid){
|
||||
u8 buildID[0x20];
|
||||
memcpy(buildID, metadata.main_nso_build_id, 0x20);
|
||||
std::stringstream ss;
|
||||
for (u8 i = 0; i < 8; i++)
|
||||
ss << std::uppercase << std::hex << std::setfill('0') << std::setw(2) << (u16)buildID[i];
|
||||
return ss.str();
|
||||
}
|
||||
else{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string DownloadCheatsPage::GetBuilIDFromFile(uint64_t tid) {
|
||||
NsApplicationContentMetaStatus *MetaSatus = new NsApplicationContentMetaStatus[100U];
|
||||
s32 out;
|
||||
nsListApplicationContentMetaStatus(tid, 0, MetaSatus, 100, &out);
|
||||
|
|
Loading…
Reference in a new issue