fix hbmenu not being updated due to faulty string compare, bump version 0.10.1 -> 0.10.2
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
set(sphaira_VERSION 0.10.1)
|
set(sphaira_VERSION 0.10.2)
|
||||||
|
|
||||||
project(sphaira
|
project(sphaira
|
||||||
VERSION ${sphaira_VERSION}
|
VERSION ${sphaira_VERSION}
|
||||||
|
|||||||
@@ -127,6 +127,10 @@ public:
|
|||||||
void ScanThemes(const std::string& path);
|
void ScanThemes(const std::string& path);
|
||||||
void ScanThemeEntries();
|
void ScanThemeEntries();
|
||||||
|
|
||||||
|
// helper that converts 1.2.3 to a u32 used for comparisons.
|
||||||
|
static auto GetVersionFromString(const char* str) -> u32;
|
||||||
|
static auto IsVersionNewer(const char* current, const char* new_version) -> u32;
|
||||||
|
|
||||||
static auto IsApplication() -> bool {
|
static auto IsApplication() -> bool {
|
||||||
const auto type = appletGetAppletType();
|
const auto type = appletGetAppletType();
|
||||||
return type == AppletType_Application || type == AppletType_SystemApplication;
|
return type == AppletType_Application || type == AppletType_SystemApplication;
|
||||||
|
|||||||
@@ -719,7 +719,7 @@ void App::SetReplaceHbmenuEnable(bool enable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc) && !std::strcmp(sphaira_nacp.lang[0].name, "sphaira")) {
|
if (R_SUCCEEDED(rc) && !std::strcmp(sphaira_nacp.lang[0].name, "sphaira")) {
|
||||||
if (std::strcmp(sphaira_nacp.display_version, hbmenu_nacp.display_version) < 0) {
|
if (IsVersionNewer(sphaira_nacp.display_version, hbmenu_nacp.display_version)) {
|
||||||
if (R_FAILED(rc = fs.copy_entire_file(sphaira_path, "/hbmenu.nro"))) {
|
if (R_FAILED(rc = fs.copy_entire_file(sphaira_path, "/hbmenu.nro"))) {
|
||||||
log_write("failed to copy entire file: %s 0x%X module: %u desc: %u\n", sphaira_path.s, rc, R_MODULE(rc), R_DESCRIPTION(rc));
|
log_write("failed to copy entire file: %s 0x%X module: %u desc: %u\n", sphaira_path.s, rc, R_MODULE(rc), R_DESCRIPTION(rc));
|
||||||
} else {
|
} else {
|
||||||
@@ -1744,7 +1744,7 @@ App::~App() {
|
|||||||
|
|
||||||
// found sphaira, now lets get compare version
|
// found sphaira, now lets get compare version
|
||||||
if (R_SUCCEEDED(rc) && !std::strcmp(sphaira_nacp.lang[0].name, "sphaira")) {
|
if (R_SUCCEEDED(rc) && !std::strcmp(sphaira_nacp.lang[0].name, "sphaira")) {
|
||||||
if (std::strcmp(hbmenu_nacp.display_version, sphaira_nacp.display_version) < 0) {
|
if (IsVersionNewer(hbmenu_nacp.display_version, sphaira_nacp.display_version)) {
|
||||||
if (R_FAILED(rc = fs.copy_entire_file(GetExePath(), sphaira_path))) {
|
if (R_FAILED(rc = fs.copy_entire_file(GetExePath(), sphaira_path))) {
|
||||||
log_write("failed to copy entire file: %s 0x%X module: %u desc: %u\n", sphaira_path.s, rc, R_MODULE(rc), R_DESCRIPTION(rc));
|
log_write("failed to copy entire file: %s 0x%X module: %u desc: %u\n", sphaira_path.s, rc, R_MODULE(rc), R_DESCRIPTION(rc));
|
||||||
} else {
|
} else {
|
||||||
@@ -1782,6 +1782,16 @@ App::~App() {
|
|||||||
ini_putl("paths", "timestamp", timestamp, App::CONFIG_PATH);
|
ini_putl("paths", "timestamp", timestamp, App::CONFIG_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto App::GetVersionFromString(const char* str) -> u32 {
|
||||||
|
u32 major{}, minor{}, macro{};
|
||||||
|
std::sscanf(str, "%u.%u.%u", &major, &minor, ¯o);
|
||||||
|
return MAKEHOSVERSION(major, minor, macro);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto App::IsVersionNewer(const char* current, const char* new_version) -> u32 {
|
||||||
|
return GetVersionFromString(current) < GetVersionFromString(new_version);
|
||||||
|
}
|
||||||
|
|
||||||
void App::createFramebufferResources() {
|
void App::createFramebufferResources() {
|
||||||
this->swapchain = nullptr;
|
this->swapchain = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ MainMenu::MainMenu() {
|
|||||||
|
|
||||||
const auto version = yyjson_get_str(tag_key);
|
const auto version = yyjson_get_str(tag_key);
|
||||||
R_UNLESS(version, false);
|
R_UNLESS(version, false);
|
||||||
if (!std::strcmp(APP_VERSION, version)) {
|
if (!App::IsVersionNewer(APP_VERSION, version)) {
|
||||||
m_update_state = UpdateState::None;
|
m_update_state = UpdateState::None;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user