Compare commits

...

9 Commits

Author SHA1 Message Date
405bed7291 Version bump to 1.0.2
All checks were successful
Build / Build (push) Successful in 23s
2026-07-21 13:52:23 +02:00
3a2fb4fb2e Migrate legacy ram_config.ini into config.ini on extras post-copy.
Port [Ram] from ram_config.ini when present, preserve existing HekateAms settings, then remove the legacy file.
2026-07-21 13:50:33 +02:00
eb18bf8c72 Preserve Checkpoint across update installs.
All checks were successful
Build / Build (push) Successful in 13s
Skip deleting sd:/switch/checkpoint so user saves under saves/ are not wiped.
2026-07-17 21:37:20 +02:00
05926f7828 Show Install/Update completion based on detected mode.
All checks were successful
Build / Build (push) Successful in 14s
Drop the version header from the final summary and label the result as Update or Installation.
2026-07-17 13:43:00 +02:00
7b85d428a8 Add missing pack apps to update-mode deletion lists.
Include Benchmark-Toolbox, Furmark-NX, and other switch apps from the current OmniNX pack so updates replace them cleanly.
2026-07-17 13:42:42 +02:00
dce83bc3be Update FatFs NORTC fixed timestamp to 2026-07-17. 2026-07-17 13:42:24 +02:00
a26531c702 Add extras post-copy flow for RAM and Hekate-Pro selection.
All checks were successful
Build / Build (push) Successful in 14s
Copy sd:/extras from the pack, prompt for RAM and Hekate/AMS choices, persist them in config.ini, apply Pro/8GB payloads, then remove extras/. Use safe config.ini I/O and Joy-Con input clearing between menus.
2026-07-16 10:01:42 +02:00
c0741beda3 Preserve CyberFoil across clean install backup/restore.
All checks were successful
Build / Build (push) Successful in 13s
Back up cyberfoil.nro, config.json, and remotes/ when sd:/switch/CyberFoil exists, then restore them after the wipe.
2026-06-14 17:31:46 +02:00
d6ec345cce only check UHS on clean install
All checks were successful
Build / Build (push) Successful in 12s
2026-06-07 23:16:04 +02:00
13 changed files with 810 additions and 411 deletions

View File

@@ -8,7 +8,7 @@ Optional file to **skip parts of the install** for testing (e.g. run only deleti
sd:/config/omninx/debug.ini sd:/config/omninx/debug.ini
``` ```
Create the folder `sd:/config/omninx/` on the SD card if it does not exist. Same parent directory as `manifest.ini` and `ram_config.ini`. Create the folder `sd:/config/omninx/` on the SD card if it does not exist. Same parent directory as `manifest.ini` and `config.ini`.
## Format ## Format
@@ -87,4 +87,4 @@ skip_update_horizon_oc=1
## Implementation ## Implementation
- Parsed in `install.c`: `install_debug_load()`, `perform_installation()`. - Parsed in `install.c`: `install_debug_load()`, `perform_installation()`.
- Uses the same INI parser as `ram_config.ini` (`ini_parse` from BDK). - Uses the same INI parser as `config.ini` (`ini_parse` from BDK).

View File

@@ -1 +1 @@
1.0.0 1.0.2

View File

@@ -721,6 +721,12 @@ void jc_deinit()
clock_disable_uart(UART_C); clock_disable_uart(UART_C);
} }
/* Drop current button state without power-cycling the Joy-Cons. */
void jc_clear_input(void)
{
jc_gamepad.buttons = 0;
}
static void jc_init_conn(joycon_ctxt_t *jc) static void jc_init_conn(joycon_ctxt_t *jc)
{ {
if (((u32)get_tmr_ms() - jc->last_received_time) > 1000) if (((u32)get_tmr_ms() - jc->last_received_time) > 1000)

View File

@@ -92,6 +92,7 @@ typedef struct _jc_gamepad_rpt_t
void jc_power_supply(u8 uart, bool enable); void jc_power_supply(u8 uart, bool enable);
void jc_init_hw(); void jc_init_hw();
void jc_deinit(); void jc_deinit();
void jc_clear_input(void);
jc_gamepad_rpt_t *joycon_poll(); jc_gamepad_rpt_t *joycon_poll();
jc_gamepad_rpt_t *jc_get_bt_pairing_info(bool *is_l_hos, bool *is_r_hos); jc_gamepad_rpt_t *jc_get_bt_pairing_info(bool *is_l_hos, bool *is_r_hos);

View File

@@ -40,6 +40,35 @@ int backup_user_data(void) {
} }
} }
// Backup CyberFoil (nro, config, remotes) if installed
if (path_exists(CYBERFOIL_DIR)) {
res = f_mkdir(TEMP_BACKUP_CYBERFOIL);
if (res != FR_OK && res != FR_EXIST) {
return res;
}
if (path_exists(CYBERFOIL_NRO)) {
res = file_copy(CYBERFOIL_NRO, TEMP_BACKUP_CYBERFOIL_NRO);
if (res != FR_OK) {
return res;
}
}
if (path_exists(CYBERFOIL_CONFIG)) {
res = file_copy(CYBERFOIL_CONFIG, TEMP_BACKUP_CYBERFOIL_CONFIG);
if (res != FR_OK) {
return res;
}
}
if (path_exists(CYBERFOIL_REMOTES)) {
res = folder_copy(CYBERFOIL_REMOTES, TEMP_BACKUP_CYBERFOIL);
if (res != FR_OK) {
return res;
}
}
}
return FR_OK; return FR_OK;
} }
@@ -73,6 +102,35 @@ int restore_user_data(void) {
} }
} }
// Restore CyberFoil if backed up
if (path_exists(TEMP_BACKUP_CYBERFOIL)) {
res = f_mkdir(CYBERFOIL_DIR);
if (res != FR_OK && res != FR_EXIST) {
return res;
}
if (path_exists(TEMP_BACKUP_CYBERFOIL_NRO)) {
res = file_copy(TEMP_BACKUP_CYBERFOIL_NRO, CYBERFOIL_NRO);
if (res != FR_OK) {
return res;
}
}
if (path_exists(TEMP_BACKUP_CYBERFOIL_CONFIG)) {
res = file_copy(TEMP_BACKUP_CYBERFOIL_CONFIG, CYBERFOIL_CONFIG);
if (res != FR_OK) {
return res;
}
}
if (path_exists(TEMP_BACKUP_CYBERFOIL_REMOTES)) {
res = folder_copy(TEMP_BACKUP_CYBERFOIL_REMOTES, CYBERFOIL_DIR);
if (res != FR_OK) {
return res;
}
}
}
return FR_OK; return FR_OK;
} }

View File

@@ -11,13 +11,23 @@
#define DBI_CONFIG_PATH "sd:/switch/DBI/dbi.config" #define DBI_CONFIG_PATH "sd:/switch/DBI/dbi.config"
#define TEMP_BACKUP_DBI_CONFIG TEMP_BACKUP_PATH "/dbi.config" #define TEMP_BACKUP_DBI_CONFIG TEMP_BACKUP_PATH "/dbi.config"
/** CyberFoil homebrew; preserved across clean install (nro, config, remotes only). */
#define CYBERFOIL_DIR "sd:/switch/CyberFoil"
#define CYBERFOIL_NRO CYBERFOIL_DIR "/cyberfoil.nro"
#define CYBERFOIL_CONFIG CYBERFOIL_DIR "/config.json"
#define CYBERFOIL_REMOTES CYBERFOIL_DIR "/remotes"
#define TEMP_BACKUP_CYBERFOIL TEMP_BACKUP_PATH "/CyberFoil"
#define TEMP_BACKUP_CYBERFOIL_NRO TEMP_BACKUP_CYBERFOIL "/cyberfoil.nro"
#define TEMP_BACKUP_CYBERFOIL_CONFIG TEMP_BACKUP_CYBERFOIL "/config.json"
#define TEMP_BACKUP_CYBERFOIL_REMOTES TEMP_BACKUP_CYBERFOIL "/remotes"
/** Live HorizonOC settings (Overclock tool). */ /** Live HorizonOC settings (Overclock tool). */
#define HORIZON_OC_CONFIG_PATH "sd:/config/horizon-oc/config.ini" #define HORIZON_OC_CONFIG_PATH "sd:/config/horizon-oc/config.ini"
/** Scratch dir during OC-variant update only; removed after successful restore. */ /** Scratch dir during OC-variant update only; removed after successful restore. */
#define HORIZON_OC_UPDATE_BACKUP_DIR "sd:/.omninx_oc_update" #define HORIZON_OC_UPDATE_BACKUP_DIR "sd:/.omninx_oc_update"
#define HORIZON_OC_UPDATE_BACKUP_INI HORIZON_OC_UPDATE_BACKUP_DIR "/config.ini" #define HORIZON_OC_UPDATE_BACKUP_INI HORIZON_OC_UPDATE_BACKUP_DIR "/config.ini"
// Backup user data (DBI dbi.config, prod.keys) before clean install // Backup user data (CyberFoil, DBI dbi.config, prod.keys) before clean install
int backup_user_data(void); int backup_user_data(void);
// Restore user data after clean install // Restore user data after clean install

View File

@@ -2,7 +2,7 @@
* OmniNX Installer - Deletion Lists for Clean Install Mode * OmniNX Installer - Deletion Lists for Clean Install Mode
* Deletion policy aligned with NiklasCFW pack clean install (TegraExplorer script): * Deletion policy aligned with NiklasCFW pack clean install (TegraExplorer script):
* full sd:/atmosphere, bootloader/config subsets, sd:/switch, root + misc, then * full sd:/atmosphere, bootloader/config subsets, sd:/switch, root + misc, then
* post-restore paths (e.g. tinfoil db). DBI/prod.keys backup is in backup.c. * post-restore paths (e.g. tinfoil db). CyberFoil/DBI/prod.keys backup is in backup.c.
*/ */
#pragma once #pragma once

View File

@@ -134,17 +134,19 @@ static const char* switch_dirs_to_delete[] = {
"sd:/switch/amsPLUS-downloader", "sd:/switch/amsPLUS-downloader",
"sd:/switch/appstore", "sd:/switch/appstore",
"sd:/switch/AtmoXL-Titel-Installer", "sd:/switch/AtmoXL-Titel-Installer",
"sd:/switch/Benchmark-Toolbox",
"sd:/switch/breeze", "sd:/switch/breeze",
"sd:/switch/checkpoint",
"sd:/switch/cheats-updater", "sd:/switch/cheats-updater",
"sd:/switch/chiaki", "sd:/switch/chiaki",
"sd:/switch/ChoiDujourNX", "sd:/switch/ChoiDujourNX",
"sd:/switch/crash_ams", "sd:/switch/crash_ams",
"sd:/switch/Daybreak", "sd:/switch/Daybreak",
"sd:/switch/DNS-Block_Tester",
"sd:/switch/DNS_mitm Tester", "sd:/switch/DNS_mitm Tester",
"sd:/switch/EdiZon", "sd:/switch/EdiZon",
"sd:/switch/Fizeau", "sd:/switch/Fizeau",
"sd:/switch/FTPD", "sd:/switch/FTPD",
"sd:/switch/Furmark-NX",
"sd:/switch/fw-downloader", "sd:/switch/fw-downloader",
"sd:/switch/gamecard_installer", "sd:/switch/gamecard_installer",
"sd:/switch/Goldleaf", "sd:/switch/Goldleaf",
@@ -169,6 +171,7 @@ static const char* switch_dirs_to_delete[] = {
"sd:/switch/reboot_to_argonNX", "sd:/switch/reboot_to_argonNX",
"sd:/switch/reboot_to_hekate", "sd:/switch/reboot_to_hekate",
"sd:/switch/Shutdown_System", "sd:/switch/Shutdown_System",
"sd:/switch/SimpleModAlchemist",
"sd:/switch/SimpleModDownloader", "sd:/switch/SimpleModDownloader",
"sd:/switch/SimpleModManager", "sd:/switch/SimpleModManager",
"sd:/switch/sphaira", "sd:/switch/sphaira",
@@ -176,18 +179,22 @@ static const char* switch_dirs_to_delete[] = {
"sd:/switch/Switch-Time", "sd:/switch/Switch-Time",
"sd:/switch/SwitchIdent", "sd:/switch/SwitchIdent",
"sd:/switch/Switch_themes_Installer", "sd:/switch/Switch_themes_Installer",
"sd:/switch/swr-ini-tool",
"sd:/switch/Sys-Clk Manager", "sd:/switch/Sys-Clk Manager",
"sd:/switch/Sys-Con", "sd:/switch/Sys-Con",
"sd:/switch/sys-clk-manager", "sd:/switch/sys-clk-manager",
"sd:/switch/themezer-nx", "sd:/switch/themezer-nx",
"sd:/switch/ThemezerNX",
"sd:/switch/themezernx", "sd:/switch/themezernx",
"sd:/switch/tinwoo", "sd:/switch/tinwoo",
"sd:/switch/Ultrahand-Reload",
NULL NULL
}; };
// Switch files (NRO) to delete // Switch files (NRO) to delete
static const char* switch_files_to_delete[] = { static const char* switch_files_to_delete[] = {
"sd:/switch/90DNS_tester/90DNS_tester.nro", "sd:/switch/90DNS_tester/90DNS_tester.nro",
"sd:/switch/Benchmark-Toolbox/Benchmark-Toolbox.nro",
"sd:/switch/breeze.nro", "sd:/switch/breeze.nro",
"sd:/switch/cheats-updater.nro", "sd:/switch/cheats-updater.nro",
"sd:/switch/chiaki.nro", "sd:/switch/chiaki.nro",
@@ -207,9 +214,11 @@ static const char* switch_files_to_delete[] = {
"sd:/switch/DBI_RU/DBI_RU.nro", "sd:/switch/DBI_RU/DBI_RU.nro",
"sd:/switch/DBI/DBI_EN.nro", "sd:/switch/DBI/DBI_EN.nro",
"sd:/switch/DBI_DE/DBI_DE.nro", "sd:/switch/DBI_DE/DBI_DE.nro",
"sd:/switch/DNS-Block_Tester/dns_tester.nro",
"sd:/switch/DNS_mitm Tester.nro", "sd:/switch/DNS_mitm Tester.nro",
"sd:/switch/EdiZon.nro", "sd:/switch/EdiZon.nro",
"sd:/switch/Fizeau.nro", "sd:/switch/Fizeau.nro",
"sd:/switch/Furmark-NX/Furmark-NX.nro",
"sd:/switch/Goldleaf.nro", "sd:/switch/Goldleaf.nro",
"sd:/switch/haze.nro", "sd:/switch/haze.nro",
"sd:/switch/JKSV.nro", "sd:/switch/JKSV.nro",
@@ -223,6 +232,7 @@ static const char* switch_files_to_delete[] = {
"sd:/switch/nxdumptool.nro", "sd:/switch/nxdumptool.nro",
"sd:/switch/nxtc.bin", "sd:/switch/nxtc.bin",
"sd:/switch/reboot_to_payload.nro", "sd:/switch/reboot_to_payload.nro",
"sd:/switch/SimpleModAlchemist/Simple_Mod_Alchemist.nro",
"sd:/switch/SimpleModDownloader.nro", "sd:/switch/SimpleModDownloader.nro",
"sd:/switch/SimpleModManager.nro", "sd:/switch/SimpleModManager.nro",
"sd:/switch/sphaira.nro", "sd:/switch/sphaira.nro",
@@ -232,10 +242,12 @@ static const char* switch_files_to_delete[] = {
"sd:/switch/Sys-Clk Manager/sys-clk-manager.nro", "sd:/switch/Sys-Clk Manager/sys-clk-manager.nro",
"sd:/switch/Sys-Con.nro", "sd:/switch/Sys-Con.nro",
"sd:/switch/sys-clk-manager.nro", "sd:/switch/sys-clk-manager.nro",
"sd:/switch/ThemezerNX/themezer-nx.nro",
"sd:/switch/tinfoil.nro", "sd:/switch/tinfoil.nro",
"sd:/switch/tinfoil/tinfoil.nro", "sd:/switch/tinfoil/tinfoil.nro",
"sd:/switch/tinwoo.nro", "sd:/switch/tinwoo.nro",
"sd:/switch/tinwoo/tinwoo.nro", "sd:/switch/tinwoo/tinwoo.nro",
"sd:/switch/Ultrahand-Reload/Ultrahand-Reload.nro",
NULL NULL
}; };

View File

@@ -23,11 +23,6 @@
static bool install_path_blocked_by_user_preserve(const char *path); static bool install_path_blocked_by_user_preserve(const char *path);
#ifndef VERSION
#define VERSION "1.0.0"
#endif
// Color definitions (some already defined in types.h, but we override for consistency) // Color definitions (some already defined in types.h, but we override for consistency)
#undef COLOR_CYAN #undef COLOR_CYAN
#undef COLOR_WHITE #undef COLOR_WHITE
@@ -637,12 +632,19 @@ int delete_path_list(const char* paths[], const char* description) {
return (failed == 0) ? FR_OK : FR_DISK_ERR; return (failed == 0) ? FR_OK : FR_DISK_ERR;
} }
#define HEKATE_8GB_SRC "sd:/bootloader/hekate_8gb.bin" #define EXTRAS_DIR "sd:/extras"
#define PAYLOAD_BIN_DST "sd:/payload.bin" #define HEKATE_8GB_SRC EXTRAS_DIR "/hekate_8gb.bin"
#define UPDATE_BIN_DST "sd:/bootloader/update.bin" #define HEKATE_PRO_8GB_SRC EXTRAS_DIR "/hekate-pro_8gb.bin"
#define RAM_CONFIG_PATH "sd:/config/omninx/ram_config.ini" #define HEKATE_AMS_PRO_SRC EXTRAS_DIR "/hekate-ams-pro"
#define PAYLOAD_BIN_DST "sd:/payload.bin"
#define UPDATE_BIN_DST "sd:/bootloader/update.bin"
#define INSTALL_CONFIG_INI "sd:/config/omninx/config.ini"
#define INSTALL_CONFIG_INI_LEGACY "sd:/config/omninx/ram_config.ini"
enum { RAM_READ_OK = 0, RAM_READ_NEED_MENU = 1 }; enum {
INSTALL_CONFIG_OK = 0,
INSTALL_CONFIG_NEED_MENU = 1,
};
static void unlink_ignore_err(const char *path) static void unlink_ignore_err(const char *path)
{ {
@@ -654,30 +656,13 @@ static void unlink_ignore_err(const char *path)
f_unlink(path); f_unlink(path);
} }
static void ram_config_ensure_parent_dirs(void) static void install_config_ensure_parent_dirs(void)
{ {
f_mkdir("sd:/config"); f_mkdir("sd:/config");
f_mkdir("sd:/config/omninx"); f_mkdir("sd:/config/omninx");
} }
static int ram_config_write(bool use_8gb) static void install_ini_free_sections(link_t *sections)
{
ram_config_ensure_parent_dirs();
FIL f;
if (f_open(&f, RAM_CONFIG_PATH, FA_WRITE | FA_CREATE_ALWAYS) != FR_OK)
return FR_DISK_ERR;
static const char sec[] = "[Ram]\n";
static const char line0[] = "8gb=0\n";
static const char line1[] = "8gb=1\n";
UINT bw;
f_write(&f, sec, sizeof(sec) - 1, &bw);
f_write(&f, use_8gb ? line1 : line0, sizeof(line0) - 1, &bw);
f_close(&f);
return FR_OK;
}
static void ram_config_free_sections(link_t *sections)
{ {
LIST_FOREACH_ENTRY(ini_sec_t, sec, sections, link) { LIST_FOREACH_ENTRY(ini_sec_t, sec, sections, link) {
LIST_FOREACH_ENTRY(ini_kv_t, kv, &sec->kvs, link) { LIST_FOREACH_ENTRY(ini_kv_t, kv, &sec->kvs, link) {
@@ -688,6 +673,124 @@ static void ram_config_free_sections(link_t *sections)
} }
} }
static bool install_config_read_key_bool(const char *path, const char *section, const char *key, bool *out)
{
FIL f;
if (f_open(&f, path, FA_READ) != FR_OK)
return false;
char line[96];
bool in_section = false;
bool found = false;
while (f_gets(line, sizeof(line), &f)) {
size_t n = strlen(line);
while (n > 0 && (line[n - 1] == '\n' || line[n - 1] == '\r'))
line[--n] = '\0';
if (n == 0)
continue;
if (line[0] == '[') {
in_section = false;
char *end = strchr(line, ']');
if (!end)
continue;
*end = '\0';
if (!strcmp(line + 1, section))
in_section = true;
continue;
}
if (!in_section)
continue;
char *eq = strchr(line, '=');
if (!eq)
continue;
*eq = '\0';
if (strcmp(line, key) != 0)
continue;
const char *val = eq + 1;
if (!strcmp(val, "0")) {
*out = false;
found = true;
} else if (!strcmp(val, "1")) {
*out = true;
found = true;
}
break;
}
f_close(&f);
return found;
}
/* Valid [Ram] 8gb=0|1 in config.ini → silent; else menu. */
static int install_config_read_ram(bool *use_8gb)
{
if (!install_path_exists(INSTALL_CONFIG_INI))
return INSTALL_CONFIG_NEED_MENU;
if (install_config_read_key_bool(INSTALL_CONFIG_INI, "Ram", "8gb", use_8gb))
return INSTALL_CONFIG_OK;
return INSTALL_CONFIG_NEED_MENU;
}
/* Valid [HekateAms] pro=0|1 in config.ini → silent; else menu. */
static int install_config_read_hekate_ams(bool *use_pro)
{
if (!install_path_exists(INSTALL_CONFIG_INI))
return INSTALL_CONFIG_NEED_MENU;
if (install_config_read_key_bool(INSTALL_CONFIG_INI, "HekateAms", "pro", use_pro))
return INSTALL_CONFIG_OK;
return INSTALL_CONFIG_NEED_MENU;
}
static int install_config_write_extras(bool need_ram, bool use_8gb, bool need_hekate_ams, bool use_pro)
{
install_config_ensure_parent_dirs();
FIL f;
if (f_open(&f, INSTALL_CONFIG_INI, FA_WRITE | FA_CREATE_ALWAYS) != FR_OK)
return FR_DISK_ERR;
char line[32];
UINT bw;
if (need_ram) {
f_write(&f, "[Ram]\n", 6, &bw);
s_printf(line, "8gb=%d\n\n", use_8gb ? 1 : 0);
f_write(&f, line, (UINT)strlen(line), &bw);
}
if (need_hekate_ams) {
f_write(&f, "[HekateAms]\n", 12, &bw);
s_printf(line, "pro=%d\n", use_pro ? 1 : 0);
f_write(&f, line, (UINT)strlen(line), &bw);
}
f_close(&f);
return FR_OK;
}
/* If legacy ram_config.ini exists: port [Ram] into config.ini, then remove legacy. */
static void install_config_migrate_legacy_ram(void)
{
if (!install_path_exists(INSTALL_CONFIG_INI_LEGACY))
return;
bool use_8gb = false;
bool have_ram = install_config_read_key_bool(INSTALL_CONFIG_INI_LEGACY, "Ram", "8gb", &use_8gb);
if (have_ram) {
bool use_pro = false;
bool have_pro = install_path_exists(INSTALL_CONFIG_INI) &&
install_config_read_key_bool(INSTALL_CONFIG_INI, "HekateAms", "pro", &use_pro);
install_config_write_extras(true, use_8gb, have_pro, use_pro);
}
unlink_ignore_err(INSTALL_CONFIG_INI_LEGACY);
}
#define INSTALL_PRESERVE_INI "sd:/config/omninx/preserve.ini" #define INSTALL_PRESERVE_INI "sd:/config/omninx/preserve.ini"
#define INSTALL_PRESERVE_MAX 96 #define INSTALL_PRESERVE_MAX 96
#define INSTALL_PRESERVE_PATH_BYTES 224 #define INSTALL_PRESERVE_PATH_BYTES 224
@@ -776,7 +879,7 @@ void install_preserve_update_cleanup_begin(void)
link_t sections; link_t sections;
list_init(&sections); list_init(&sections);
if (ini_parse(&sections, (char *)INSTALL_PRESERVE_INI, false) != 1) { if (ini_parse(&sections, (char *)INSTALL_PRESERVE_INI, false) != 1) {
ram_config_free_sections(&sections); install_ini_free_sections(&sections);
free(g_preserve_block); free(g_preserve_block);
g_preserve_block = NULL; g_preserve_block = NULL;
return; return;
@@ -817,7 +920,7 @@ void install_preserve_update_cleanup_begin(void)
} }
break; break;
} }
ram_config_free_sections(&sections); install_ini_free_sections(&sections);
if (g_preserve_count == 0) { if (g_preserve_count == 0) {
free(g_preserve_block); free(g_preserve_block);
@@ -841,46 +944,21 @@ void install_preserve_update_cleanup_end(void)
g_preserve_update_active = false; g_preserve_update_active = false;
} }
/* Valid [Ram] 8gb=0|1 → silent; missing file or invalid → menu. */ /* Clear Joy-Con input and wait briefly so a held A press cannot leak into the next menu. */
static int read_ram_config_silent(const char *path, bool *use_8gb) static void install_joycon_reconnect(void)
{ {
if (!install_path_exists(path)) jc_clear_input();
return RAM_READ_NEED_MENU;
link_t sections; /* Wait until A/Power are actually released (no full power cycle). */
list_init(&sections); while (1) {
jc_gamepad_rpt_t *jc = joycon_poll();
if (ini_parse(&sections, (char *)path, false) != 1) { if ((!jc || !jc->a) && !(btn_read() & BTN_POWER))
ram_config_free_sections(&sections);
return RAM_READ_NEED_MENU;
}
bool found = false;
bool eight = false;
LIST_FOREACH_ENTRY(ini_sec_t, sec, &sections, link) {
if (sec->name && !strcmp(sec->name, "Ram")) {
LIST_FOREACH_ENTRY(ini_kv_t, kv, &sec->kvs, link) {
if (kv->key && kv->val && !strcmp(kv->key, "8gb")) {
if (!strcmp(kv->val, "0")) {
found = true;
eight = false;
} else if (!strcmp(kv->val, "1")) {
found = true;
eight = true;
}
break;
}
}
break; break;
} jc_clear_input();
msleep(20);
} }
ram_config_free_sections(&sections); msleep(100);
if (!found)
return RAM_READ_NEED_MENU;
*use_8gb = eight;
return RAM_READ_OK;
} }
/* Same navigation as main.c multi-variant menu; returns false if user aborts (payload/reboot). */ /* Same navigation as main.c multi-variant menu; returns false if user aborts (payload/reboot). */
@@ -993,7 +1071,6 @@ static bool install_ram_config_menu(bool *use_8gb)
} }
*use_8gb = (selected == 1); *use_8gb = (selected == 1);
ram_config_write(*use_8gb);
gfx_clear_grey(0x1B); gfx_clear_grey(0x1B);
gfx_con_setpos(0, 0); gfx_con_setpos(0, 0);
@@ -1001,25 +1078,267 @@ static bool install_ram_config_menu(bool *use_8gb)
return true; return true;
} }
/* After pack copy: use ram_config.ini [Ram] 8gb=0|1 if present; else menu, write file, then apply. No fuse autodetect. */ static bool install_hekate_ams_menu(bool *use_pro)
static void install_hekate_8gb_post_copy(void)
{ {
if (!install_path_exists(HEKATE_8GB_SRC)) jc_init_hw();
return; while (btn_read() & BTN_POWER)
msleep(50);
bool use_8gb; int selected = 0;
if (read_ram_config_silent(RAM_CONFIG_PATH, &use_8gb) != RAM_READ_OK) { int prev_selected = 0;
if (!install_ram_config_menu(&use_8gb)) bool confirmed = false;
return; const int n = 2;
const char *labels[2] = {
"Hekate / Atmosphere (Standard)",
"Hekate-Pro / Atmosphere-Pro",
};
gfx_clear_grey(0x1B);
gfx_con_setpos(0, 0);
install_print_main_header();
install_set_color(COLOR_YELLOW);
gfx_printf("Hekate / Atmosphere Auswahl:\n\n");
install_set_color(COLOR_RED);
gfx_printf("Waehle Hekate / Atmosphere (Standard) sofern du nicht weisst, was du tust.\n\n");
install_set_color(COLOR_WHITE);
u32 menu_x, menu_y;
gfx_con_getpos(&menu_x, &menu_y);
for (int i = 0; i < n; i++) {
if (i == selected) {
install_set_color(COLOR_GREEN);
gfx_printf(" > %s\n", labels[i]);
install_set_color(COLOR_WHITE);
} else {
gfx_printf(" %s\n", labels[i]);
}
}
gfx_printf("\n");
install_set_color(COLOR_CYAN);
gfx_printf("D-Pad / Vol+/-: Auswahl | A oder Power: Bestaetigen\n");
gfx_printf("Vol+ und Vol- gleichzeitig: Abbrechen (Hekate)\n");
install_set_color(COLOR_WHITE);
bool prev_up = false, prev_down = false;
bool menu_aborted = false;
while (!confirmed && !menu_aborted) {
if (selected != prev_selected) {
gfx_con_setpos(menu_x, menu_y + (u32)prev_selected * 16);
install_set_color(COLOR_WHITE);
gfx_printf(" %s\n", labels[prev_selected]);
gfx_con_setpos(menu_x, menu_y + (u32)selected * 16);
install_set_color(COLOR_GREEN);
gfx_printf(" > %s\n", labels[selected]);
install_set_color(COLOR_WHITE);
prev_selected = selected;
}
jc_gamepad_rpt_t *jc = joycon_poll();
u8 btn = btn_read();
if (jc && jc->cap)
take_screenshot();
if (cancel_combo_pressed(btn)) {
menu_aborted = true;
break;
}
bool cur_up = false, cur_down = false;
if (jc) {
cur_up = (jc->up != 0) && !jc->down;
cur_down = (jc->down != 0) && !jc->up;
}
if (btn & BTN_VOL_UP)
cur_up = true;
if (btn & BTN_VOL_DOWN)
cur_down = true;
if (cur_up && !prev_up)
selected = (selected - 1 + n) % n;
else if (cur_down && !prev_down)
selected = (selected + 1) % n;
else if (jc && jc->a)
confirmed = true;
prev_up = cur_up;
prev_down = cur_down;
if (btn & BTN_POWER)
confirmed = true;
msleep(50);
} }
if (use_8gb) { if (menu_aborted) {
int r1 = file_copy(HEKATE_8GB_SRC, PAYLOAD_BIN_DST); gfx_printf("\n");
int r2 = file_copy(HEKATE_8GB_SRC, UPDATE_BIN_DST); install_set_color(COLOR_YELLOW);
if (r1 == FR_OK && r2 == FR_OK) gfx_printf("Abgebrochen. Starte Hekate...\n");
unlink_ignore_err(HEKATE_8GB_SRC); install_set_color(COLOR_WHITE);
} else { msleep(500);
installer_launch_hekate_payload();
return false;
}
*use_pro = (selected == 1);
gfx_clear_grey(0x1B);
gfx_con_setpos(0, 0);
install_print_main_header();
return true;
}
static bool install_extras_ram_available(void)
{
return install_path_exists(HEKATE_8GB_SRC) || install_path_exists(HEKATE_PRO_8GB_SRC);
}
static bool install_extras_hekate_ams_pro_available(void)
{
FILINFO fno;
if (f_stat(HEKATE_AMS_PRO_SRC, &fno) != FR_OK)
return false;
return (fno.fattrib & AM_DIR) != 0;
}
static bool install_extras_post_copy_needed(void)
{
return install_extras_ram_available() || install_extras_hekate_ams_pro_available();
}
static int install_apply_hekate_ams_pro(void)
{
DIR dir;
FILINFO fno;
int res = f_opendir(&dir, HEKATE_AMS_PRO_SRC);
if (res != FR_OK)
return res;
while (1) {
res = f_readdir(&dir, &fno);
if (res != FR_OK)
break;
if (fno.fname[0] == 0)
break;
if (fno.fname[0] == '.')
continue;
char src[256];
s_printf(src, "%s/%s", HEKATE_AMS_PRO_SRC, fno.fname);
if (fno.fattrib & AM_DIR)
res = folder_copy(src, "sd:/");
else {
char dst[256];
s_printf(dst, "sd:/%s", fno.fname);
res = file_copy(src, dst);
}
if (res != FR_OK)
break;
}
f_closedir(&dir);
return res;
}
static void install_apply_8gb_payload(bool use_8gb, bool use_pro)
{
if (!use_8gb) {
unlink_ignore_err(HEKATE_8GB_SRC); unlink_ignore_err(HEKATE_8GB_SRC);
unlink_ignore_err(HEKATE_PRO_8GB_SRC);
return;
}
const char *src = use_pro ? HEKATE_PRO_8GB_SRC : HEKATE_8GB_SRC;
if (!install_path_exists(src))
return;
file_copy(src, PAYLOAD_BIN_DST);
file_copy(src, UPDATE_BIN_DST);
unlink_ignore_err(HEKATE_8GB_SRC);
unlink_ignore_err(HEKATE_PRO_8GB_SRC);
}
/* After pack copy: RAM + Hekate/AMS menus from extras; choices stored in config.ini. */
static void install_extras_post_copy(void)
{
install_config_migrate_legacy_ram();
if (!install_extras_post_copy_needed())
return;
bool need_ram = install_extras_ram_available();
bool need_hekate_ams = install_extras_hekate_ams_pro_available();
bool use_8gb = false;
bool use_pro = false;
if (need_ram) {
if (install_config_read_ram(&use_8gb) != INSTALL_CONFIG_OK) {
if (!install_ram_config_menu(&use_8gb))
return;
if (need_hekate_ams)
install_joycon_reconnect();
}
}
if (need_hekate_ams) {
if (install_config_read_hekate_ams(&use_pro) != INSTALL_CONFIG_OK) {
if (!install_hekate_ams_menu(&use_pro))
return;
}
}
install_set_color(COLOR_YELLOW);
gfx_printf("Extras: Speichere Auswahl in config.ini...\n");
install_set_color(COLOR_WHITE);
install_config_write_extras(need_ram, use_8gb, need_hekate_ams, use_pro);
if (use_pro && need_hekate_ams) {
install_set_color(COLOR_CYAN);
gfx_printf("Extras: Installiere Hekate-Pro / Atmosphere-Pro...\n");
install_set_color(COLOR_WHITE);
int res = install_apply_hekate_ams_pro();
if (res != FR_OK) {
install_set_color(COLOR_ORANGE);
gfx_printf(" [WARN] Hekate-Pro Installation fehlgeschlagen (err=%d)\n", res);
install_set_color(COLOR_WHITE);
} else {
install_set_color(COLOR_GREEN);
gfx_printf(" [OK] Hekate-Pro / Atmosphere-Pro installiert\n");
install_set_color(COLOR_WHITE);
}
} else if (need_hekate_ams) {
install_set_color(COLOR_GREEN);
gfx_printf("Extras: Standard Hekate / Atmosphere beibehalten\n");
install_set_color(COLOR_WHITE);
}
if (need_ram) {
install_set_color(COLOR_CYAN);
gfx_printf("Extras: Wende RAM-Einstellung an...\n");
install_set_color(COLOR_WHITE);
install_apply_8gb_payload(use_8gb, use_pro);
install_set_color(COLOR_GREEN);
gfx_printf(" [OK] RAM-Einstellung angewendet\n");
install_set_color(COLOR_WHITE);
}
if (install_path_exists(EXTRAS_DIR)) {
install_set_color(COLOR_CYAN);
gfx_printf("Extras: Entferne extras/\n");
install_set_color(COLOR_WHITE);
int res = folder_delete(EXTRAS_DIR);
if (res == FR_OK) {
install_set_color(COLOR_GREEN);
gfx_printf(" [OK] extras/ entfernt\n");
install_set_color(COLOR_WHITE);
} else {
install_set_color(COLOR_ORANGE);
gfx_printf(" [WARN] extras/ konnte nicht entfernt werden (err=%d)\n", res);
install_set_color(COLOR_WHITE);
}
} }
} }
@@ -1048,7 +1367,7 @@ static void install_debug_load(install_debug_opts_t *d)
link_t sections; link_t sections;
list_init(&sections); list_init(&sections);
if (ini_parse(&sections, (char *)INSTALL_DEBUG_INI, false) != 1) { if (ini_parse(&sections, (char *)INSTALL_DEBUG_INI, false) != 1) {
ram_config_free_sections(&sections); install_ini_free_sections(&sections);
return; return;
} }
@@ -1081,7 +1400,7 @@ static void install_debug_load(install_debug_opts_t *d)
} }
break; break;
} }
ram_config_free_sections(&sections); install_ini_free_sections(&sections);
d->active = d->skip_clean_backup || d->skip_clean_wipe || d->skip_clean_restore d->active = d->skip_clean_backup || d->skip_clean_wipe || d->skip_clean_restore
|| d->skip_clean_install || d->skip_clean_staging_cleanup || d->skip_update_cleanup || d->skip_clean_install || d->skip_clean_staging_cleanup || d->skip_update_cleanup
@@ -1115,7 +1434,7 @@ static void install_debug_print_banner(const install_debug_opts_t *d)
if (d->skip_update_horizon_oc) if (d->skip_update_horizon_oc)
gfx_printf(" ueberspringe: HorizonOC Update (Backup/Restore)\n"); gfx_printf(" ueberspringe: HorizonOC Update (Backup/Restore)\n");
if (d->skip_hekate_8gb_post_copy) if (d->skip_hekate_8gb_post_copy)
gfx_printf(" ueberspringe: hekate 8GB RAM Auswahl / Post-Copy\n"); gfx_printf(" ueberspringe: extras RAM / Hekate-Auswahl / Post-Copy\n");
install_set_color(COLOR_WHITE); install_set_color(COLOR_WHITE);
gfx_printf("\n"); gfx_printf("\n");
} }
@@ -1175,10 +1494,10 @@ int perform_installation(omninx_variant_t pack_variant, install_mode_t mode) {
} }
if (!dbg.skip_hekate_8gb_post_copy) if (!dbg.skip_hekate_8gb_post_copy)
install_hekate_8gb_post_copy(); install_extras_post_copy();
else { else {
install_set_color(COLOR_ORANGE); install_set_color(COLOR_ORANGE);
gfx_printf("[DEBUG] hekate 8GB Post-Copy uebersprungen.\n"); gfx_printf("[DEBUG] extras Post-Copy uebersprungen.\n");
install_set_color(COLOR_WHITE); install_set_color(COLOR_WHITE);
} }
@@ -1277,10 +1596,10 @@ int perform_installation(omninx_variant_t pack_variant, install_mode_t mode) {
} }
if (!dbg.skip_hekate_8gb_post_copy) if (!dbg.skip_hekate_8gb_post_copy)
install_hekate_8gb_post_copy(); install_extras_post_copy();
else { else {
install_set_color(COLOR_ORANGE); install_set_color(COLOR_ORANGE);
gfx_printf("[DEBUG] hekate 8GB Post-Copy uebersprungen.\n"); gfx_printf("[DEBUG] extras Post-Copy uebersprungen.\n");
install_set_color(COLOR_WHITE); install_set_color(COLOR_WHITE);
} }

View File

@@ -34,7 +34,7 @@
// Clean mode: Backup user data // Clean mode: Backup user data
int clean_mode_backup(void) { int clean_mode_backup(void) {
set_color(COLOR_CYAN); set_color(COLOR_CYAN);
gfx_printf(" Sichere: DBI (dbi.config), prod.keys\n"); gfx_printf(" Sichere: CyberFoil, DBI (dbi.config), prod.keys\n");
set_color(COLOR_WHITE); set_color(COLOR_WHITE);
int res = backup_user_data(); int res = backup_user_data();
if (res == FR_OK) { if (res == FR_OK) {
@@ -95,7 +95,7 @@ int clean_mode_wipe(void) {
// Clean mode: Restore user data // Clean mode: Restore user data
int clean_mode_restore(void) { int clean_mode_restore(void) {
set_color(COLOR_CYAN); set_color(COLOR_CYAN);
gfx_printf(" Stelle wieder her: DBI (dbi.config), prod.keys\n"); gfx_printf(" Stelle wieder her: CyberFoil, DBI (dbi.config), prod.keys\n");
set_color(COLOR_WHITE); set_color(COLOR_WHITE);
int res = restore_user_data(); int res = restore_user_data();
if (res == FR_OK) { if (res == FR_OK) {

View File

@@ -12,10 +12,6 @@
#include <string.h> #include <string.h>
#include <utils/sprintf.h> #include <utils/sprintf.h>
#ifndef VERSION
#define VERSION "1.0.0"
#endif
#undef COLOR_CYAN #undef COLOR_CYAN
#undef COLOR_WHITE #undef COLOR_WHITE
#undef COLOR_GREEN #undef COLOR_GREEN
@@ -123,6 +119,10 @@ int update_mode_install(omninx_variant_t variant) {
if (res != FR_OK && res != FR_NO_FILE) return res; if (res != FR_OK && res != FR_NO_FILE) return res;
} }
s_printf(src_path, "%s/extras", staging);
res = folder_copy_with_progress_v2(src_path, "sd:/", "extras/");
if (res != FR_OK && res != FR_NO_FILE) return res;
set_color(COLOR_CYAN); set_color(COLOR_CYAN);
gfx_printf(" Kopiere Root-Dateien...\n"); gfx_printf(" Kopiere Root-Dateien...\n");
set_color(COLOR_WHITE); set_color(COLOR_WHITE);

View File

@@ -243,9 +243,9 @@
#define FF_FS_NORTC 1 #define FF_FS_NORTC 1
#define FF_NORTC_MON 1 #define FF_NORTC_MON 7
#define FF_NORTC_MDAY 1 #define FF_NORTC_MDAY 17
#define FF_NORTC_YEAR 2020 #define FF_NORTC_YEAR 2026
/* The option FF_FS_NORTC switches timestamp function. If the system does not have /* The option FF_FS_NORTC switches timestamp function. If the system does not have
/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable / any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable
/ the timestamp function. Every object modified by FatFs will have a fixed timestamp / the timestamp function. Every object modified by FatFs will have a fixed timestamp

View File

@@ -6,10 +6,6 @@
* Based on TegraExplorer/hekate by CTCaer, naehrwert, shchmue * Based on TegraExplorer/hekate by CTCaer, naehrwert, shchmue
*/ */
#ifndef VERSION
#define VERSION "1.0.0"
#endif
#include <string.h> #include <string.h>
#include <display/di.h> #include <display/di.h>
@@ -480,7 +476,8 @@ void ipl_main(void) {
gfx_con_setpos(0, 0); gfx_con_setpos(0, 0);
print_header(); print_header();
// UHS class check: recommend U2 / V30 / A2 for emuMMC (speed and reliability) // UHS class check: recommend U2 / V30 / A2 for emuMMC (clean install only)
if (mode == INSTALL_MODE_CLEAN) {
#define UHS_U2_MIN 2 #define UHS_U2_MIN 2
#define UHS_V30_MIN 30 #define UHS_V30_MIN 30
#define UHS_A2_MIN 2 #define UHS_A2_MIN 2
@@ -557,6 +554,7 @@ void ipl_main(void) {
gfx_con_setpos(0, 0); gfx_con_setpos(0, 0);
print_header(); print_header();
} }
}
// Show information // Show information
set_color(COLOR_CYAN); set_color(COLOR_CYAN);
@@ -659,25 +657,20 @@ void ipl_main(void) {
gfx_con_setpos(0, 0); gfx_con_setpos(0, 0);
// Summary // Summary
set_color(COLOR_CYAN); const char *op_name = (mode == INSTALL_MODE_UPDATE) ? " Update" : " Installation";
gfx_printf("========================================\n");
gfx_printf(" OmniNX Installer Payload v%s\n", VERSION);
gfx_printf("========================================\n\n");
set_color(COLOR_WHITE);
if (result == FR_OK && total_errors == 0) { if (result == FR_OK && total_errors == 0) {
set_color(COLOR_GREEN); set_color(COLOR_GREEN);
gfx_printf("========================================\n"); gfx_printf("=======================================\n");
gfx_printf(" Installation abgeschlossen!\n"); gfx_printf(" %s abgeschlossen!\n", op_name);
gfx_printf("========================================\n"); gfx_printf("=======================================\n");
} else { } else {
set_color(COLOR_RED); set_color(COLOR_RED);
gfx_printf("========================================\n"); gfx_printf("=======================================\n");
gfx_printf(" Installation beendet\n"); gfx_printf(" %s beendet\n", op_name);
if (total_errors > 0) { if (total_errors > 0) {
gfx_printf(" %d Fehler\n", total_errors); gfx_printf(" %d Fehler\n", total_errors);
} }
gfx_printf("========================================\n"); gfx_printf("=======================================\n");
} }
set_color(COLOR_WHITE); set_color(COLOR_WHITE);