daybreak: Add a setting to bypass the firmware version check

Let users turn off the Exosphere compatibility gate from the main menu when installing firmware newer than this Atmosphere build supports.
This commit is contained in:
Niklas080208 committed 2026-10-02 17:20:07 +02:00
1 parent 31d5beb756
commit ec9b500c67
4 files changed
+135 -5

No files matched your search

+94 -2
View File
@@ -49,6 +49,7 @@ namespace dbk {
u32 g_screen_height;
constinit u32 g_supported_version = std::numeric_limits<u32>::max();
constinit bool g_hos_version_check_enabled = true;
std::shared_ptr<Menu> g_current_menu;
bool g_initialized = false;
@@ -153,6 +154,10 @@ namespace dbk {
}
bool IsHosVersionSupported(u32 hos_version) {
if (!g_hos_version_check_enabled) {
return true;
}
return hos_version <= g_supported_version;
}
@@ -536,8 +541,11 @@ namespace dbk {
const float x = g_screen_width / 2.0f - WindowWidth / 2.0f;
const float y = g_screen_height / 2.0f - WindowHeight / 2.0f;
this->AddButton(InstallButtonId, "Installieren", x + HorizontalInset, y + TitleGap, WindowWidth - HorizontalInset * 2, ButtonHeight);
this->AddButton(ExitButtonId, "Beenden", x + HorizontalInset, y + TitleGap + ButtonHeight + VerticalGap, WindowWidth - HorizontalInset * 2, ButtonHeight);
const float button_x = x + HorizontalInset;
const float button_w = WindowWidth - HorizontalInset * 2;
this->AddButton(InstallButtonId, "Installieren", button_x, y + TitleGap, button_w, ButtonHeight);
this->AddButton(SettingsButtonId, "Einstellungen", button_x, y + TitleGap + ButtonHeight + VerticalGap, button_w, ButtonHeight);
this->AddButton(ExitButtonId, "Beenden", button_x, y + TitleGap + (ButtonHeight + VerticalGap) * 2, button_w, ButtonHeight);
this->SetButtonSelected(InstallButtonId, true);
}
@@ -585,6 +593,9 @@ namespace dbk {
return;
}
case SettingsButtonId:
ChangeMenu(std::make_shared<SettingsMenu>(g_current_menu));
return;
case ExitButtonId:
g_exit_requested = true;
return;
@@ -604,6 +615,87 @@ namespace dbk {
this->DrawButtons(vg, ns);
}
SettingsMenu::SettingsMenu(std::shared_ptr<Menu> prev_menu) : Menu(prev_menu) {
const float x = g_screen_width / 2.0f - WindowWidth / 2.0f;
const float y = g_screen_height / 2.0f - WindowHeight / 2.0f;
const float button_x = x + HorizontalInset;
const float button_w = WindowWidth - HorizontalInset * 2.0f;
this->AddButton(VersionCheckButtonId, "Firmware-Prüfung", button_x, y + TitleGap, button_w, ButtonHeight);
this->AddButton(BackButtonId, "Zurück", button_x, y + WindowHeight - BottomInset - ButtonHeight, button_w, ButtonHeight);
this->SetButtonSelected(VersionCheckButtonId, true);
}
void SettingsMenu::Update(u64 ns) {
const u64 k_down = padGetButtonsDown(&g_pad);
if (k_down & HidNpadButton_B) {
ReturnToPreviousMenu();
return;
}
if (const Button *activated_button = this->GetActivatedButton(); activated_button != nullptr) {
switch (activated_button->id) {
case VersionCheckButtonId:
g_hos_version_check_enabled = !g_hos_version_check_enabled;
break;
case BackButtonId:
ReturnToPreviousMenu();
return;
}
}
this->UpdateButtons();
if (const Button *selected_button = this->GetSelectedButton(); k_down && selected_button == nullptr) {
this->SetButtonSelected(VersionCheckButtonId, true);
}
}
void SettingsMenu::Draw(NVGcontext *vg, u64 ns) {
const float x = g_screen_width / 2.0f - WindowWidth / 2.0f;
const float y = g_screen_height / 2.0f - WindowHeight / 2.0f;
DrawWindow(vg, "Einstellungen", x, y, WindowWidth, WindowHeight);
if (const Button *toggle = this->GetButton(VersionCheckButtonId); toggle != nullptr) {
const ButtonStyle style = toggle->selected ? ButtonStyle::StandardSelected : ButtonStyle::Standard;
DrawButton(vg, "", toggle->x, toggle->y, toggle->w, toggle->h, style, ns);
nvgFontSize(vg, 20.0f);
nvgFontFace(vg, "switch-standard");
nvgTextAlign(vg, NVG_ALIGN_LEFT | NVG_ALIGN_MIDDLE);
nvgFillColor(vg, toggle->selected ? nvgRGB(255, 255, 255) : nvgRGB(0, 0, 0));
nvgText(vg, toggle->x + 16.0f, toggle->y + toggle->h * 0.5f, "Firmware-Prüfung", nullptr);
constexpr float ToggleWidth = 64.0f;
constexpr float ToggleHeight = 32.0f;
DrawToggle(vg,
toggle->x + toggle->w - 16.0f - ToggleWidth,
toggle->y + (toggle->h - ToggleHeight) * 0.5f,
ToggleWidth,
ToggleHeight,
g_hos_version_check_enabled,
toggle->selected);
}
char hint[64];
const unsigned major = (g_supported_version >> 24) & 0xff;
const unsigned minor = (g_supported_version >> 16) & 0xff;
const unsigned micro = (g_supported_version >> 8) & 0xff;
if (g_hos_version_check_enabled) {
snprintf(hint, sizeof(hint), "Firmware <= %u.%u.%u", major, minor, micro);
} else {
snprintf(hint, sizeof(hint), "Auch Firmware > %u.%u.%u", major, minor, micro);
}
DrawText(vg, x + HorizontalInset, y + TitleGap + ButtonHeight + VerticalGap + 8.0f, WindowWidth - HorizontalInset * 2.0f, hint);
if (const Button *back = this->GetButton(BackButtonId); back != nullptr) {
const ButtonStyle style = back->selected ? ButtonStyle::StandardSelected : ButtonStyle::Standard;
DrawButton(vg, "Zurück", back->x, back->y, back->w, back->h, style, ns);
}
}
FileMenu::FileMenu(std::shared_ptr<Menu> prev_menu, const char *root) : Menu(prev_menu), m_current_index(0), m_scroll_offset(0), m_touch_start_scroll_offset(0), m_touch_finalize_selection(false) {
Result rc = 0;