1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-11-24 18:42:05 +00:00

sub AMS0.19 support + taking care stratosphere.romfs through the payload

This commit is contained in:
flb 2021-04-13 13:27:38 +02:00
parent 48aa9f5a47
commit 5d436c5b8e
6 changed files with 34 additions and 21 deletions

View file

@ -22,7 +22,7 @@ DATA := data
INCLUDES := include lib/zipper/include /lib/borealis/library/include/borealis/extern/nlohmann
APP_TITLE := All-in-One Switch Updater
APP_AUTHOR := HamletDuFromage
APP_VERSION := 2.4.6
APP_VERSION := 2.4.7
TARGET := $(notdir $(CURDIR))
ROMFS := resources

View file

@ -7,6 +7,6 @@ namespace CurrentCfw {
CFW getCFW();
std::string getAmsInfo();
const extern CFW running_cfw;
extern CFW running_cfw;
}

View file

@ -136,6 +136,9 @@ ChangelogPage::ChangelogPage() : AppletFrame(true, true)
verTitles.push_back("v2.4.6");
changes.push_back("\uE016 Added back support for SXOS. \uE016 Removed dialogue asking to update Hekate if downloading DeepSea.\uE016 Fixed incorrect description in inject payload menu.");
verTitles.push_back("v2.4.7");
changes.push_back("\uE016 Fixed app only working on 0.19 AMS.\uE016 Proper replacement of stratosphere.romfs when updating.");
for(int i = verTitles.size() -1 ; i >= 0; i--){
listItem = new brls::ListItem(verTitles[i]);
change = changes[i];

View file

@ -16,22 +16,32 @@ namespace CurrentCfw {
return running;
}
Result smAtmosphereHasService(bool *out, SmServiceName name) {
Result smAtmosphereHasService(bool *out, SmServiceName name, bool v019) {
u8 tmp = 0;
Result rc = tipcDispatchInOut(smGetServiceSessionTipc(), 65100, name, tmp);
Result rc = v019 ? tipcDispatchInOut(smGetServiceSessionTipc(), 65100, name, tmp) : serviceDispatchInOut(smGetServiceSession(), 65100, name, tmp);
if (R_SUCCEEDED(rc) && out)
*out = tmp;
return rc;
}
bool isPost019() {
u64 version;
if(R_SUCCEEDED(splGetConfig((SplConfigItem) 65000, &version))) {
if(((version >> 56) & ((1 << 8) - 1)) > 0 || ((version >> 48) & ((1 << 8) - 1)) >= 19) {
return true;
}
}
return false;
}
}
CFW getCFW(){
bool res = false;
if(R_SUCCEEDED(smAtmosphereHasService(&res, smEncodeName("rnx")))) {
bool v019 = isPost019(); //AMS v0.19 introduced sm changes, and as such old AMS versions have to be treated differently
if(R_SUCCEEDED(smAtmosphereHasService(&res, smEncodeName("rnx"), v019))) {
if(res)
return CFW::rnx;
smAtmosphereHasService(&res, smEncodeName("tx"));
smAtmosphereHasService(&res, smEncodeName("tx"), v019);
if(res)
return CFW::sxos;
}
@ -43,18 +53,18 @@ namespace CurrentCfw {
}
std::string getAmsInfo() {
u64 version;
std::string res;
if(R_SUCCEEDED(splGetConfig((SplConfigItem) 65000, &version))){
res += std::to_string((version >> 56) & ((1 << 8) - 1)) + "." +
std::to_string((version >> 48) & ((1 << 8) - 1)) + "." +
std::to_string((version >> 40) & ((1 << 8) - 1));
if(R_SUCCEEDED(splGetConfig((SplConfigItem) 65007, &version)))
res += version ? "|E" : "|S";
return res;
}
else
return "Couldn't retrieve AMS version";
u64 version;
std::string res;
if(R_SUCCEEDED(splGetConfig((SplConfigItem) 65000, &version))) {
res += std::to_string((version >> 56) & ((1 << 8) - 1)) + "." +
std::to_string((version >> 48) & ((1 << 8) - 1)) + "." +
std::to_string((version >> 40) & ((1 << 8) - 1));
if(R_SUCCEEDED(splGetConfig((SplConfigItem) 65007, &version)))
res += version ? "|E" : "|S";
return res;
}
else
return "Couldn't retrieve AMS version";
}
}

View file

@ -14,7 +14,7 @@ using namespace i18n::literals;
//TimeServiceType __nx_time_service_type = TimeServiceType_System;
const CFW CurrentCfw::running_cfw = CurrentCfw::getCFW();
CFW CurrentCfw::running_cfw;
int main(int argc, char* argv[])
{
@ -45,6 +45,8 @@ int main(int argc, char* argv[])
splInitialize();
romfsInit();
CurrentCfw::running_cfw = CurrentCfw::getCFW();
fs::createTree(CONFIG_PATH);
brls::Logger::setLogLevel(brls::LogLevel::DEBUG);

View file

@ -241,10 +241,8 @@ std::string readVersion(const char* path){
}
bool isErista() {
splInitialize();
u64 hwType;
Result rc = splGetConfig(SplConfigItem_HardwareType, &hwType);
splExit();
if(R_FAILED(rc))
return true;