Compare commits
18 Commits
d1fc24dae8
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| dce11538d1 | |||
| 21f8e0e38a | |||
| 0ad2c63123 | |||
| 6780936d2d | |||
| 82639a7a86 | |||
| bff8bc1910 | |||
| c9bcb29f50 | |||
| dc97677e72 | |||
| 4535c4508f | |||
| 726ef77194 | |||
| 13c35400a1 | |||
| f71b6ab629 | |||
| 9b559eb7e6 | |||
| d3735d17ee | |||
| db7d83304f | |||
| 113542f7fb | |||
| 72a2083d76 | |||
| 3f6bbc0752 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -20,3 +20,6 @@ Thumbs.db
|
|||||||
# Version file is tracked, ignore local edits
|
# Version file is tracked, ignore local edits
|
||||||
# VERSION
|
# VERSION
|
||||||
|
|
||||||
|
# Vendored TegraExplorer tree
|
||||||
|
source/TegraExplorer/
|
||||||
|
|
||||||
|
|||||||
90
DEBUG_INI.md
Normal file
90
DEBUG_INI.md
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
# Debug configuration (`debug.ini`)
|
||||||
|
|
||||||
|
Optional file to **skip parts of the install** for testing (e.g. run only deletion and inspect the SD card). If the file is **missing**, the installer ignores debug entirely and runs the full flow.
|
||||||
|
|
||||||
|
## Location
|
||||||
|
|
||||||
|
```
|
||||||
|
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`.
|
||||||
|
|
||||||
|
## Format
|
||||||
|
|
||||||
|
- Section name must be exactly **`[Debug]`** (case-sensitive in the parser).
|
||||||
|
- One key per line: `name=value`.
|
||||||
|
- **Enabling a skip:** set the value so it **starts** with one of: `1`, `t`, `T`, `y`, `Y`
|
||||||
|
Examples: `1`, `true`, `yes`, `True` — all enable that skip.
|
||||||
|
- **Disabling:** `0`, `false`, `no`, or omit the key.
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
### Clean install mode (`INSTALL_MODE_CLEAN`)
|
||||||
|
|
||||||
|
| Key | What is skipped |
|
||||||
|
|-----|-----------------|
|
||||||
|
| `skip_clean_backup` | Step 1 — backup of `sd:/switch/DBI/dbi.config`, `sd:/switch/prod.keys` to `sd:/temp_backup` |
|
||||||
|
| `skip_clean_wipe` | Step 2 — all cleanup from `deletion_lists_clean.h` (deletion / wipe) |
|
||||||
|
| `skip_clean_restore` | Step 3 — restore from `sd:/temp_backup` and post-restore paths (e.g. delete `sd:/switch/tinfoil/db`) |
|
||||||
|
| `skip_clean_install` | Step 4 — copy files from the OmniNX staging folder to the SD root |
|
||||||
|
| `skip_clean_staging_cleanup` | After install: do not remove the staging directory or other variant staging folders |
|
||||||
|
|
||||||
|
### Update mode (`INSTALL_MODE_UPDATE`)
|
||||||
|
|
||||||
|
| Key | What is skipped |
|
||||||
|
|-----|-----------------|
|
||||||
|
| `skip_update_cleanup` | Step 1 — selective deletion from `deletion_lists_update.h` |
|
||||||
|
| `skip_update_install` | Step 2 — copy from staging to SD |
|
||||||
|
| `skip_update_staging_cleanup` | End: do not remove staging / other variant folders |
|
||||||
|
| `skip_update_horizon_oc` | **OC variant only:** HorizonOC config backup before update, restore and cleanup after (entire HorizonOC update side path) |
|
||||||
|
|
||||||
|
### Both modes
|
||||||
|
|
||||||
|
| Key | What is skipped |
|
||||||
|
|-----|-----------------|
|
||||||
|
| `skip_hekate_8gb_post_copy` | After a successful copy: the optional `hekate_8GB` / RAM menu and related file moves (see `install_hekate_8gb_post_copy` in `install.c`) |
|
||||||
|
|
||||||
|
## Behaviour
|
||||||
|
|
||||||
|
- On startup, if `debug.ini` exists and parses successfully, the payload prints a **DEBUG-MODUS** banner listing which skips are active.
|
||||||
|
- If the file is absent, unreadable, or has no `[Debug]` section, **no** skips apply — behaviour matches a release install.
|
||||||
|
- Skipping steps can leave the SD in an inconsistent state; this is **for developers/testers only**.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Wipe only (test deletion, no backup/restore/copy)
|
||||||
|
|
||||||
|
Inspect leftovers after the clean-install wipe, without backing up, restoring, installing, or cleaning staging:
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[Debug]
|
||||||
|
skip_clean_backup=1
|
||||||
|
skip_clean_restore=1
|
||||||
|
skip_clean_install=1
|
||||||
|
skip_clean_staging_cleanup=1
|
||||||
|
skip_hekate_8gb_post_copy=1
|
||||||
|
```
|
||||||
|
|
||||||
|
Do **not** set `skip_clean_wipe` (leave unset or `0`).
|
||||||
|
|
||||||
|
### Update: deletion only
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[Debug]
|
||||||
|
skip_update_install=1
|
||||||
|
skip_update_staging_cleanup=1
|
||||||
|
skip_hekate_8gb_post_copy=1
|
||||||
|
```
|
||||||
|
|
||||||
|
### OC update without touching HorizonOC backup/restore
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[Debug]
|
||||||
|
skip_update_horizon_oc=1
|
||||||
|
```
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
- Parsed in `install.c`: `install_debug_load()`, `perform_installation()`.
|
||||||
|
- Uses the same INI parser as `ram_config.ini` (`ini_parse` from BDK).
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
This document provides a detailed, step-by-step breakdown of everything that is checked and done during the OmniNX installation/update process.
|
This document provides a detailed, step-by-step breakdown of everything that is checked and done during the OmniNX installation/update process.
|
||||||
|
|
||||||
|
For **optional debug step skips** (`sd:/config/omninx/debug.ini`), see **[DEBUG_INI.md](DEBUG_INI.md)**.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
The OmniNX Installer Payload operates in two modes:
|
The OmniNX Installer Payload operates in two modes:
|
||||||
@@ -305,17 +307,12 @@ channel_pack={variant} # Same as current_pack
|
|||||||
#### 32. Create Backup Directory
|
#### 32. Create Backup Directory
|
||||||
- Creates `sd:/temp_backup/` directory
|
- Creates `sd:/temp_backup/` directory
|
||||||
|
|
||||||
#### 33. Backup DBI
|
#### 33. Backup DBI settings
|
||||||
- **Source**: `sd:/switch/DBI/`
|
- **Source**: `sd:/switch/DBI/dbi.config` (file only, not the whole `DBI` tree)
|
||||||
- **Destination**: `sd:/temp_backup/DBI/`
|
- **Destination**: `sd:/temp_backup/dbi.config`
|
||||||
- Only if source exists
|
- Only if the source file exists
|
||||||
|
|
||||||
#### 34. Backup Tinfoil
|
#### 34. Backup prod.keys
|
||||||
- **Source**: `sd:/switch/tinfoil/`
|
|
||||||
- **Destination**: `sd:/temp_backup/tinfoil/`
|
|
||||||
- Only if source exists
|
|
||||||
|
|
||||||
#### 35. Backup prod.keys
|
|
||||||
- **Source**: `sd:/switch/prod.keys`
|
- **Source**: `sd:/switch/prod.keys`
|
||||||
- **Destination**: `sd:/temp_backup/prod.keys`
|
- **Destination**: `sd:/temp_backup/prod.keys`
|
||||||
- Only if source exists
|
- Only if source exists
|
||||||
@@ -325,22 +322,22 @@ channel_pack={variant} # Same as current_pack
|
|||||||
### Step 2: Wipe Directories
|
### Step 2: Wipe Directories
|
||||||
**Location**: `install.c:543-602`
|
**Location**: `install.c:543-602`
|
||||||
|
|
||||||
#### 36. Delete Entire Directories
|
#### 35. Delete Entire Directories
|
||||||
Recursively deletes (if they exist):
|
Recursively deletes (if they exist):
|
||||||
- `sd:/atmosphere/` (entire directory tree)
|
- `sd:/atmosphere/` (entire directory tree)
|
||||||
- `sd:/bootloader/` (entire directory tree)
|
- `sd:/bootloader/` (entire directory tree)
|
||||||
- `sd:/config/` (entire directory tree)
|
- `sd:/config/` (entire directory tree)
|
||||||
- `sd:/switch/` (entire directory tree)
|
- `sd:/switch/` (entire directory tree)
|
||||||
|
|
||||||
#### 37. Delete Root Files
|
#### 36. Delete Root Files
|
||||||
- Uses same deletion list as update mode (Step 19)
|
- Uses same deletion list as update mode (Step 19)
|
||||||
- Deletes `boot.dat`, `boot.ini`, `exosphere.ini`, etc.
|
- Deletes `boot.dat`, `boot.ini`, `exosphere.ini`, etc.
|
||||||
|
|
||||||
#### 38. Delete Miscellaneous Items
|
#### 37. Delete Miscellaneous Items
|
||||||
- Uses same deletion lists as update mode (Steps 20-21)
|
- Uses same deletion lists as update mode (Steps 20-21)
|
||||||
- Deletes `argon/`, `games/`, `SaltySD/`, etc.
|
- Deletes `argon/`, `games/`, `SaltySD/`, etc.
|
||||||
|
|
||||||
#### 39. Recreate Switch Directory
|
#### 38. Recreate Switch Directory
|
||||||
- Creates empty `sd:/switch/` directory for restoration
|
- Creates empty `sd:/switch/` directory for restoration
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -348,27 +345,17 @@ Recursively deletes (if they exist):
|
|||||||
### Step 3: Restore User Data
|
### Step 3: Restore User Data
|
||||||
**Location**: `backup.c:55-95`
|
**Location**: `backup.c:55-95`
|
||||||
|
|
||||||
#### 40. Restore DBI
|
#### 39. Restore DBI settings
|
||||||
- **Source**: `sd:/temp_backup/DBI/`
|
- **Source**: `sd:/temp_backup/dbi.config`
|
||||||
- **Destination**: `sd:/switch/DBI/`
|
- **Destination**: `sd:/switch/DBI/dbi.config` (creates `sd:/switch/DBI/` if needed)
|
||||||
- **Cleanup**: After restoration, deletes old DBI NRO files:
|
- No longer copies the full `DBI` folder; old `.nro` cleanup is unnecessary
|
||||||
- `sd:/switch/DBI/DBI_810_EN.nro`
|
|
||||||
- `sd:/switch/DBI/DBI_810_DE.nro`
|
|
||||||
- `sd:/switch/DBI/DBI_845_EN.nro`
|
|
||||||
- `sd:/switch/DBI/DBI_845_DE.nro`
|
|
||||||
- `sd:/switch/DBI/DBI.nro`
|
|
||||||
|
|
||||||
#### 41. Restore Tinfoil
|
#### 40. Restore prod.keys
|
||||||
- **Source**: `sd:/temp_backup/tinfoil/`
|
|
||||||
- **Destination**: `sd:/switch/tinfoil/`
|
|
||||||
- **Cleanup**: After restoration, deletes `sd:/switch/tinfoil/tinfoil.nro`
|
|
||||||
|
|
||||||
#### 42. Restore prod.keys
|
|
||||||
- **Source**: `sd:/temp_backup/prod.keys`
|
- **Source**: `sd:/temp_backup/prod.keys`
|
||||||
- **Destination**: `sd:/switch/prod.keys`
|
- **Destination**: `sd:/switch/prod.keys`
|
||||||
|
|
||||||
#### 43. Cleanup Backup Directory
|
#### 41. Cleanup Backup Directory
|
||||||
**Location**: `backup.c:98-103`
|
**Location**: `backup.c` (`cleanup_backup`)
|
||||||
- Deletes `sd:/temp_backup/` directory after restoration
|
- Deletes `sd:/temp_backup/` directory after restoration
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
3
Makefile
3
Makefile
@@ -31,6 +31,9 @@ OBJS += $(patsubst $(BDKDIR)/%.S, $(BUILDDIR)/$(TARGET)/%.o, \
|
|||||||
$(patsubst $(BDKDIR)/%.c, $(BUILDDIR)/$(TARGET)/%.o, \
|
$(patsubst $(BDKDIR)/%.c, $(BUILDDIR)/$(TARGET)/%.o, \
|
||||||
$(call rwildcard, $(BDKDIR), *.S *.c)))
|
$(call rwildcard, $(BDKDIR), *.S *.c)))
|
||||||
|
|
||||||
|
# Optional vendored tree under source/TegraExplorer/ is not part of this payload build.
|
||||||
|
OBJS := $(filter-out $(BUILDDIR)/$(TARGET)/TegraExplorer/%,$(OBJS))
|
||||||
|
|
||||||
GFX_INC := '"../$(SOURCEDIR)/gfx.h"'
|
GFX_INC := '"../$(SOURCEDIR)/gfx.h"'
|
||||||
FFCFG_INC := '"../$(SOURCEDIR)/libs/fatfs/ffconf.h"'
|
FFCFG_INC := '"../$(SOURCEDIR)/libs/fatfs/ffconf.h"'
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Based on [HATS-Installer-Payload](https://github.com/sthetix/HATS-Installer-Payl
|
|||||||
- **Automatic Variant Detection**: Detects which OmniNX pack variant is present (Standard/Light/OC)
|
- **Automatic Variant Detection**: Detects which OmniNX pack variant is present (Standard/Light/OC)
|
||||||
- **Smart Installation Modes**:
|
- **Smart Installation Modes**:
|
||||||
- **Update Mode**: Selective deletion when OmniNX is already installed
|
- **Update Mode**: Selective deletion when OmniNX is already installed
|
||||||
- **Clean Install**: Full wipe with backup/restore of user data (DBI, Tinfoil, prod.keys)
|
- **Clean Install**: Full wipe with backup/restore of user data (DBI `dbi.config`, prod.keys)
|
||||||
- **Version Detection**: Detects installed OmniNX version via marker files (`1.0.0s`, `1.0.0l`, `1.0.0oc`)
|
- **Version Detection**: Detects installed OmniNX version via marker files (`1.0.0s`, `1.0.0l`, `1.0.0oc`)
|
||||||
- **Progress Display**: Visual status messages during installation
|
- **Progress Display**: Visual status messages during installation
|
||||||
- **Error Handling**: Detailed error reporting on screen
|
- **Error Handling**: Detailed error reporting on screen
|
||||||
@@ -22,6 +22,7 @@ Based on [HATS-Installer-Payload](https://github.com/sthetix/HATS-Installer-Payl
|
|||||||
|
|
||||||
For detailed information about the installation process, see:
|
For detailed information about the installation process, see:
|
||||||
- **[INSTALLATION_PROCESS.md](INSTALLATION_PROCESS.md)** - Complete step-by-step breakdown of everything checked and done during installation/update
|
- **[INSTALLATION_PROCESS.md](INSTALLATION_PROCESS.md)** - Complete step-by-step breakdown of everything checked and done during installation/update
|
||||||
|
- **[DEBUG_INI.md](DEBUG_INI.md)** - Optional `sd:/config/omninx/debug.ini` parameters to skip install steps (for testing)
|
||||||
|
|
||||||
## Installation Modes
|
## Installation Modes
|
||||||
|
|
||||||
@@ -35,8 +36,7 @@ For detailed information about the installation process, see:
|
|||||||
- Detected when no version marker files are found
|
- Detected when no version marker files are found
|
||||||
- Performs full wipe of `/atmosphere`, `/bootloader`, `/config`, and `/switch`
|
- Performs full wipe of `/atmosphere`, `/bootloader`, `/config`, and `/switch`
|
||||||
- **Backs up and restores**:
|
- **Backs up and restores**:
|
||||||
- `sd:/switch/DBI` → preserved
|
- `sd:/switch/DBI/dbi.config` → preserved (not the whole `DBI` folder)
|
||||||
- `sd:/switch/tinfoil` → preserved
|
|
||||||
- `sd:/switch/prod.keys` → preserved
|
- `sd:/switch/prod.keys` → preserved
|
||||||
- Fresh installation of all CFW components
|
- Fresh installation of all CFW components
|
||||||
|
|
||||||
|
|||||||
@@ -24,17 +24,9 @@ int backup_user_data(void) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Backup DBI if it exists
|
// Backup DBI settings file only (not .nro installers)
|
||||||
if (path_exists("sd:/switch/DBI")) {
|
if (path_exists(DBI_CONFIG_PATH)) {
|
||||||
res = folder_copy("sd:/switch/DBI", TEMP_BACKUP_PATH);
|
res = file_copy(DBI_CONFIG_PATH, TEMP_BACKUP_DBI_CONFIG);
|
||||||
if (res != FR_OK) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Backup Tinfoil if it exists
|
|
||||||
if (path_exists("sd:/switch/tinfoil")) {
|
|
||||||
res = folder_copy("sd:/switch/tinfoil", TEMP_BACKUP_PATH);
|
|
||||||
if (res != FR_OK) {
|
if (res != FR_OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -61,25 +53,15 @@ int restore_user_data(void) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore DBI if backup exists
|
// Restore DBI settings if backed up
|
||||||
if (path_exists("sd:/temp_backup/DBI")) {
|
if (path_exists(TEMP_BACKUP_DBI_CONFIG)) {
|
||||||
res = folder_copy("sd:/temp_backup/DBI", "sd:/switch");
|
res = f_mkdir("sd:/switch/DBI");
|
||||||
if (res == FR_OK) {
|
if (res != FR_OK && res != FR_EXIST) {
|
||||||
// Delete old DBI .nro files
|
return res;
|
||||||
f_unlink("sd:/switch/DBI/DBI_810_EN.nro");
|
|
||||||
f_unlink("sd:/switch/DBI/DBI_810_DE.nro");
|
|
||||||
f_unlink("sd:/switch/DBI/DBI_845_EN.nro");
|
|
||||||
f_unlink("sd:/switch/DBI/DBI_845_DE.nro");
|
|
||||||
f_unlink("sd:/switch/DBI/DBI.nro");
|
|
||||||
}
|
}
|
||||||
}
|
res = file_copy(TEMP_BACKUP_DBI_CONFIG, DBI_CONFIG_PATH);
|
||||||
|
if (res != FR_OK) {
|
||||||
// Restore Tinfoil if backup exists
|
return res;
|
||||||
if (path_exists("sd:/temp_backup/tinfoil")) {
|
|
||||||
res = folder_copy("sd:/temp_backup/tinfoil", "sd:/switch");
|
|
||||||
if (res == FR_OK) {
|
|
||||||
// Delete old tinfoil.nro
|
|
||||||
f_unlink("sd:/switch/tinfoil/tinfoil.nro");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,3 +83,34 @@ int cleanup_backup(void) {
|
|||||||
}
|
}
|
||||||
return FR_OK;
|
return FR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int backup_horizon_oc_config_for_oc_update(void) {
|
||||||
|
if (!path_exists(HORIZON_OC_CONFIG_PATH))
|
||||||
|
return FR_OK;
|
||||||
|
|
||||||
|
int res = f_mkdir(HORIZON_OC_UPDATE_BACKUP_DIR);
|
||||||
|
if (res != FR_OK && res != FR_EXIST)
|
||||||
|
return res;
|
||||||
|
|
||||||
|
return file_copy(HORIZON_OC_CONFIG_PATH, HORIZON_OC_UPDATE_BACKUP_INI);
|
||||||
|
}
|
||||||
|
|
||||||
|
int restore_horizon_oc_config_after_oc_update(void) {
|
||||||
|
if (!path_exists(HORIZON_OC_UPDATE_BACKUP_INI))
|
||||||
|
return FR_OK;
|
||||||
|
|
||||||
|
int res = f_mkdir("sd:/config");
|
||||||
|
if (res != FR_OK && res != FR_EXIST)
|
||||||
|
return res;
|
||||||
|
res = f_mkdir("sd:/config/horizon-oc");
|
||||||
|
if (res != FR_OK && res != FR_EXIST)
|
||||||
|
return res;
|
||||||
|
|
||||||
|
return file_copy(HORIZON_OC_UPDATE_BACKUP_INI, HORIZON_OC_CONFIG_PATH);
|
||||||
|
}
|
||||||
|
|
||||||
|
int cleanup_horizon_oc_update_backup(void) {
|
||||||
|
if (!path_exists(HORIZON_OC_UPDATE_BACKUP_DIR))
|
||||||
|
return FR_OK;
|
||||||
|
return folder_delete(HORIZON_OC_UPDATE_BACKUP_DIR);
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,8 +7,17 @@
|
|||||||
#include <utils/types.h>
|
#include <utils/types.h>
|
||||||
|
|
||||||
#define TEMP_BACKUP_PATH "sd:/temp_backup"
|
#define TEMP_BACKUP_PATH "sd:/temp_backup"
|
||||||
|
/** DBI settings; preserved across clean install (not whole DBI folder). */
|
||||||
|
#define DBI_CONFIG_PATH "sd:/switch/DBI/dbi.config"
|
||||||
|
#define TEMP_BACKUP_DBI_CONFIG TEMP_BACKUP_PATH "/dbi.config"
|
||||||
|
|
||||||
// Backup user data (DBI, Tinfoil, prod.keys) before clean install
|
/** Live HorizonOC settings (Overclock tool). */
|
||||||
|
#define HORIZON_OC_CONFIG_PATH "sd:/config/horizon-oc/config.ini"
|
||||||
|
/** 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_INI HORIZON_OC_UPDATE_BACKUP_DIR "/config.ini"
|
||||||
|
|
||||||
|
// Backup user data (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
|
||||||
@@ -16,3 +25,10 @@ int restore_user_data(void);
|
|||||||
|
|
||||||
// Clean up temporary backup directory
|
// Clean up temporary backup directory
|
||||||
int cleanup_backup(void);
|
int cleanup_backup(void);
|
||||||
|
|
||||||
|
// HorizonOC: backup config.ini before OC pack update (update mode only); no-op if missing
|
||||||
|
int backup_horizon_oc_config_for_oc_update(void);
|
||||||
|
// Restore after file copy; no-op if no backup from this run
|
||||||
|
int restore_horizon_oc_config_after_oc_update(void);
|
||||||
|
// Delete sd:/.omninx_oc_update after successful restore
|
||||||
|
int cleanup_horizon_oc_update_backup(void);
|
||||||
|
|||||||
@@ -1,86 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
* OmniNX Installer - Deletion Lists for Clean Install Mode
|
* OmniNX Installer - Deletion Lists for Clean Install Mode
|
||||||
* Selective deletion when no OmniNX install was found.
|
* Deletion policy aligned with NiklasCFW pack clean install (TegraExplorer script):
|
||||||
* Only listed paths are removed; does not wipe whole card or user configs.
|
* 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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// Atmosphere subdirectories to delete
|
// Entire atmosphere/ tree (NiklasCFW: deldir("sd:/atmosphere"))
|
||||||
static const char* clean_atmosphere_dirs_to_delete[] = {
|
static const char* clean_atmosphere_dirs_to_delete[] = {
|
||||||
"sd:/atmosphere/config",
|
"sd:/atmosphere",
|
||||||
"sd:/atmosphere/crash_reports",
|
|
||||||
"sd:/atmosphere/erpt_reports",
|
|
||||||
"sd:/atmosphere/exefs_patches/CrunchPatch",
|
|
||||||
"sd:/atmosphere/exefs_patches/Crunchyroll Patch 1.10.0",
|
|
||||||
"sd:/atmosphere/exefs_patches/bluetooth_patches",
|
|
||||||
"sd:/atmosphere/exefs_patches/bootlogo",
|
|
||||||
"sd:/atmosphere/exefs_patches/btm_patches",
|
|
||||||
"sd:/atmosphere/exefs_patches/es_patches",
|
|
||||||
"sd:/atmosphere/exefs_patches/hid_patches",
|
|
||||||
"sd:/atmosphere/exefs_patches/logo1",
|
|
||||||
"sd:/atmosphere/exefs_patches/nfim_ctest",
|
|
||||||
"sd:/atmosphere/exefs_patches/nim_ctest",
|
|
||||||
"sd:/atmosphere/exefs_patches/nvnflinger_cmu",
|
|
||||||
"sd:/atmosphere/extrazz",
|
|
||||||
"sd:/atmosphere/fatal_errors",
|
|
||||||
"sd:/atmosphere/fatal_reports",
|
|
||||||
"sd:/atmosphere/flags",
|
|
||||||
"sd:/atmosphere/hbl_html",
|
|
||||||
"sd:/atmosphere/hosts",
|
|
||||||
"sd:/atmosphere/kips",
|
|
||||||
"sd:/atmosphere/kip1",
|
|
||||||
"sd:/atmosphere/kip_patches",
|
|
||||||
"sd:/atmosphere/logs",
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
// Atmosphere contents directories (title IDs; only under atmosphere/contents/)
|
|
||||||
static const char* clean_atmosphere_contents_dirs_to_delete[] = {
|
static const char* clean_atmosphere_contents_dirs_to_delete[] = {
|
||||||
"sd:/atmosphere/contents/0000000000534C56",
|
|
||||||
"sd:/atmosphere/contents/00FF0000B378D640",
|
|
||||||
"sd:/atmosphere/contents/00FF0000636C6BFF",
|
|
||||||
"sd:/atmosphere/contents/00FF0000A53BB665",
|
|
||||||
"sd:/atmosphere/contents/0100000000000008",
|
|
||||||
"sd:/atmosphere/contents/010000000000000D",
|
|
||||||
"sd:/atmosphere/contents/010000000000002B",
|
|
||||||
"sd:/atmosphere/contents/0100000000000032",
|
|
||||||
"sd:/atmosphere/contents/0100000000000034",
|
|
||||||
"sd:/atmosphere/contents/0100000000000036",
|
|
||||||
"sd:/atmosphere/contents/0100000000000037",
|
|
||||||
"sd:/atmosphere/contents/010000000000003C",
|
|
||||||
"sd:/atmosphere/contents/0100000000000042",
|
|
||||||
"sd:/atmosphere/contents/0100000000000895",
|
|
||||||
"sd:/atmosphere/contents/0100000000000F12",
|
|
||||||
"sd:/atmosphere/contents/0100000000001000",
|
|
||||||
"sd:/atmosphere/contents/0100000000001007",
|
|
||||||
"sd:/atmosphere/contents/0100000000001013",
|
|
||||||
"sd:/atmosphere/contents/010000000000DA7A",
|
|
||||||
"sd:/atmosphere/contents/010000000000bd00",
|
|
||||||
"sd:/atmosphere/contents/01006a800016e000",
|
|
||||||
"sd:/atmosphere/contents/01009D901BC56000",
|
|
||||||
"sd:/atmosphere/contents/0100A3900C3E2000",
|
|
||||||
"sd:/atmosphere/contents/0100F43008C44000",
|
|
||||||
"sd:/atmosphere/contents/050000BADDAD0000",
|
|
||||||
"sd:/atmosphere/contents/4200000000000000",
|
|
||||||
"sd:/atmosphere/contents/420000000000000B",
|
|
||||||
"sd:/atmosphere/contents/420000000000000E",
|
|
||||||
"sd:/atmosphere/contents/4200000000000010",
|
|
||||||
"sd:/atmosphere/contents/4200000000000FFF",
|
|
||||||
"sd:/atmosphere/contents/420000000007E51A",
|
|
||||||
"sd:/atmosphere/contents/420000000007E51B",
|
|
||||||
"sd:/atmosphere/contents/690000000000000D",
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
// Atmosphere files to delete
|
|
||||||
static const char* clean_atmosphere_files_to_delete[] = {
|
static const char* clean_atmosphere_files_to_delete[] = {
|
||||||
"sd:/atmosphere/config/exosphere.ini",
|
|
||||||
"sd:/atmosphere/config/stratosphere.ini",
|
|
||||||
"sd:/atmosphere/hbl.nsp",
|
|
||||||
"sd:/atmosphere/package3",
|
|
||||||
"sd:/atmosphere/reboot_payload.bin",
|
|
||||||
"sd:/atmosphere/stratosphere.romfs",
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -101,7 +38,6 @@ static const char* clean_bootloader_files_to_delete[] = {
|
|||||||
"sd:/bootloader/ArgonNX.bin",
|
"sd:/bootloader/ArgonNX.bin",
|
||||||
"sd:/bootloader/bootlogo.bmp",
|
"sd:/bootloader/bootlogo.bmp",
|
||||||
"sd:/bootloader/hekate_ipl.ini",
|
"sd:/bootloader/hekate_ipl.ini",
|
||||||
"sd:/bootloader/nyx.ini",
|
|
||||||
"sd:/bootloader/patches.ini",
|
"sd:/bootloader/patches.ini",
|
||||||
"sd:/bootloader/update.bin",
|
"sd:/bootloader/update.bin",
|
||||||
"sd:/bootloader/ini/EmuMMC ohne Mods.ini",
|
"sd:/bootloader/ini/EmuMMC ohne Mods.ini",
|
||||||
@@ -114,7 +50,6 @@ static const char* clean_config_dirs_to_delete[] = {
|
|||||||
"sd:/config/blue_pack_updater",
|
"sd:/config/blue_pack_updater",
|
||||||
"sd:/config/kefir-updater",
|
"sd:/config/kefir-updater",
|
||||||
"sd:/config/nx-hbmenu",
|
"sd:/config/nx-hbmenu",
|
||||||
"sd:/config/quickntp",
|
|
||||||
"sd:/config/sys-con",
|
"sd:/config/sys-con",
|
||||||
"sd:/config/sys-patch",
|
"sd:/config/sys-patch",
|
||||||
"sd:/config/uberhand",
|
"sd:/config/uberhand",
|
||||||
@@ -122,118 +57,13 @@ static const char* clean_config_dirs_to_delete[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
// Switch directories to delete
|
// Entire switch/ tree (clean install recreates sd:/switch after wipe)
|
||||||
static const char* clean_switch_dirs_to_delete[] = {
|
static const char* clean_switch_dirs_to_delete[] = {
|
||||||
"sd:/switch/.overlays",
|
"sd:/switch",
|
||||||
"sd:/switch/.packages",
|
|
||||||
"sd:/switch/90DNS_tester",
|
|
||||||
"sd:/switch/aio-switch-updater",
|
|
||||||
"sd:/switch/amsPLUS-downloader",
|
|
||||||
"sd:/switch/appstore",
|
|
||||||
"sd:/switch/AtmoXL-Titel-Installer",
|
|
||||||
"sd:/switch/breeze",
|
|
||||||
"sd:/switch/checkpoint",
|
|
||||||
"sd:/switch/cheats-updater",
|
|
||||||
"sd:/switch/chiaki",
|
|
||||||
"sd:/switch/ChoiDujourNX",
|
|
||||||
"sd:/switch/crash_ams",
|
|
||||||
"sd:/switch/Daybreak",
|
|
||||||
"sd:/switch/DNS_mitm Tester",
|
|
||||||
"sd:/switch/EdiZon",
|
|
||||||
"sd:/switch/Fizeau",
|
|
||||||
"sd:/switch/FTPD",
|
|
||||||
"sd:/switch/fw-downloader",
|
|
||||||
"sd:/switch/gamecard_installer",
|
|
||||||
"sd:/switch/Goldleaf",
|
|
||||||
"sd:/switch/haze",
|
|
||||||
"sd:/switch/JKSV",
|
|
||||||
"sd:/switch/kefir-updater",
|
|
||||||
"sd:/switch/ldnmitm_config",
|
|
||||||
"sd:/switch/Linkalho",
|
|
||||||
"sd:/switch/Moonlight-Switch",
|
|
||||||
"sd:/switch/Neumann",
|
|
||||||
"sd:/switch/NX-Activity-Log",
|
|
||||||
"sd:/switch/NX-Save-Sync",
|
|
||||||
"sd:/switch/NX-Shell",
|
|
||||||
"sd:/switch/NX-Update-Checker ",
|
|
||||||
"sd:/switch/NXGallery",
|
|
||||||
"sd:/switch/NXRemoteLauncher",
|
|
||||||
"sd:/switch/NXThemesInstaller",
|
|
||||||
"sd:/switch/nxdumptool",
|
|
||||||
"sd:/switch/nxmtp",
|
|
||||||
"sd:/switch/Payload_launcher",
|
|
||||||
"sd:/switch/Reboot",
|
|
||||||
"sd:/switch/reboot_to_argonNX",
|
|
||||||
"sd:/switch/reboot_to_hekate",
|
|
||||||
"sd:/switch/Shutdown_System",
|
|
||||||
"sd:/switch/SimpleModDownloader",
|
|
||||||
"sd:/switch/SimpleModManager",
|
|
||||||
"sd:/switch/sphaira",
|
|
||||||
"sd:/switch/studious-pancake",
|
|
||||||
"sd:/switch/Switch-Time",
|
|
||||||
"sd:/switch/SwitchIdent",
|
|
||||||
"sd:/switch/Switch_themes_Installer",
|
|
||||||
"sd:/switch/Switchfin",
|
|
||||||
"sd:/switch/Sys-Clk Manager",
|
|
||||||
"sd:/switch/Sys-Con",
|
|
||||||
"sd:/switch/sys-clk-manager",
|
|
||||||
"sd:/switch/themezer-nx",
|
|
||||||
"sd:/switch/themezernx",
|
|
||||||
"sd:/switch/tinwoo",
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
// Switch files (NRO) to delete
|
|
||||||
static const char* clean_switch_files_to_delete[] = {
|
static const char* clean_switch_files_to_delete[] = {
|
||||||
"sd:/switch/90DNS_tester/90DNS_tester.nro",
|
|
||||||
"sd:/switch/breeze.nro",
|
|
||||||
"sd:/switch/cheats-updater.nro",
|
|
||||||
"sd:/switch/chiaki.nro",
|
|
||||||
"sd:/switch/ChoiDujourNX.nro",
|
|
||||||
"sd:/switch/daybreak.nro",
|
|
||||||
"sd:/switch/DBI.nro",
|
|
||||||
"sd:/switch/DBI/DBI.nro",
|
|
||||||
"sd:/switch/DBI/DBI_810_DE.nro",
|
|
||||||
"sd:/switch/DBI/DBI_810_EN.nro",
|
|
||||||
"sd:/switch/DBI/DBI_845_DE.nro",
|
|
||||||
"sd:/switch/DBI/DBI_845_EN.nro",
|
|
||||||
"sd:/switch/DBI/DBI_849_DE.nro",
|
|
||||||
"sd:/switch/DBI/DBI_849_EN.nro",
|
|
||||||
"sd:/switch/DBI_810_DE/DBI_810.nro",
|
|
||||||
"sd:/switch/DBI_810_DE/DBI_810_DE.nro",
|
|
||||||
"sd:/switch/DBI_810_EN/DBI_810_EN.nro",
|
|
||||||
"sd:/switch/DBI_RU/DBI_RU.nro",
|
|
||||||
"sd:/switch/DBI/DBI_EN.nro",
|
|
||||||
"sd:/switch/DBI_DE/DBI_DE.nro",
|
|
||||||
"sd:/switch/DNS_mitm Tester.nro",
|
|
||||||
"sd:/switch/EdiZon.nro",
|
|
||||||
"sd:/switch/Fizeau.nro",
|
|
||||||
"sd:/switch/Goldleaf.nro",
|
|
||||||
"sd:/switch/haze.nro",
|
|
||||||
"sd:/switch/JKSV.nro",
|
|
||||||
"sd:/switch/ldnmitm_config.nro",
|
|
||||||
"sd:/switch/linkalho.nro",
|
|
||||||
"sd:/switch/Moonlight-Switch.nro",
|
|
||||||
"sd:/switch/Neumann.nro",
|
|
||||||
"sd:/switch/NX-Shell.nro",
|
|
||||||
"sd:/switch/NXGallery.nro",
|
|
||||||
"sd:/switch/NXThemesInstaller.nro",
|
|
||||||
"sd:/switch/nxdumptool.nro",
|
|
||||||
"sd:/switch/nxtc.bin",
|
|
||||||
"sd:/switch/reboot_to_payload.nro",
|
|
||||||
"sd:/switch/SimpleModDownloader.nro",
|
|
||||||
"sd:/switch/SimpleModManager.nro",
|
|
||||||
"sd:/switch/sphaira.nro",
|
|
||||||
"sd:/switch/SwitchIdent.nro",
|
|
||||||
"sd:/switch/Switch_themes_Installer/NXThemesInstaller.nro",
|
|
||||||
"sd:/switch/Switchfin.nro",
|
|
||||||
"sd:/switch/Sys-Clk Manager/sys-clk-manager.nro",
|
|
||||||
"sd:/switch/Sys-Con.nro",
|
|
||||||
"sd:/switch/sys-clk-manager.nro",
|
|
||||||
"sd:/switch/tinfoil.nro",
|
|
||||||
"sd:/switch/tinfoil/tinfoil.nro",
|
|
||||||
"sd:/switch/tinwoo.nro",
|
|
||||||
"sd:/switch/tinwoo/tinwoo.nro",
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -261,8 +91,10 @@ static const char* clean_misc_dirs_to_delete[] = {
|
|||||||
"sd:/NSPs (Tools)",
|
"sd:/NSPs (Tools)",
|
||||||
"sd:/Patched Apps",
|
"sd:/Patched Apps",
|
||||||
"sd:/SaltySD/flags",
|
"sd:/SaltySD/flags",
|
||||||
|
"sd:/SaltySD/patches",
|
||||||
"sd:/scripts",
|
"sd:/scripts",
|
||||||
"sd:/switch/tinfoil/db",
|
"sd:/TegraExplorer",
|
||||||
|
"sd:/themes/systemData",
|
||||||
"sd:/tools",
|
"sd:/tools",
|
||||||
"sd:/warmboot_mariko",
|
"sd:/warmboot_mariko",
|
||||||
NULL
|
NULL
|
||||||
@@ -281,15 +113,20 @@ static const char* clean_misc_files_to_delete[] = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// After DBI/prod.keys restore (NiklasCFW: deldir("sd:/switch/tinfoil/db"))
|
||||||
|
static const char* clean_post_restore_dirs_to_delete[] = {
|
||||||
|
"sd:/switch/tinfoil/db",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
// Old version marker files to delete (clean install only)
|
// Old version marker files to delete (clean install only)
|
||||||
static const char* old_version_files_to_delete[] = {
|
static const char* old_version_files_to_delete[] = {
|
||||||
"sd:/1.0.0l",
|
|
||||||
"sd:/1.0.0s",
|
|
||||||
"sd:/1.0.0oc",
|
|
||||||
"sd:/1.4.0-pre",
|
"sd:/1.4.0-pre",
|
||||||
"sd:/1.4.0-pre-c",
|
"sd:/1.4.0-pre-c",
|
||||||
"sd:/1.4.0-pre-d",
|
"sd:/1.4.0-pre-d",
|
||||||
"sd:/1.4.1",
|
"sd:/1.4.1",
|
||||||
"sd:/1.5.0",
|
"sd:/1.5.0",
|
||||||
|
"sd:/1.6.0",
|
||||||
|
"sd:/1.6.1",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ static const char* atmosphere_files_to_delete[] = {
|
|||||||
"sd:/atmosphere/package3",
|
"sd:/atmosphere/package3",
|
||||||
"sd:/atmosphere/reboot_payload.bin",
|
"sd:/atmosphere/reboot_payload.bin",
|
||||||
"sd:/atmosphere/stratosphere.romfs",
|
"sd:/atmosphere/stratosphere.romfs",
|
||||||
|
"sd:/atmosphere/kips/loader.kip",
|
||||||
|
"sd:/atmosphere/kips/hoc.kip",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -261,6 +263,7 @@ static const char* misc_dirs_to_delete[] = {
|
|||||||
"sd:/SaltySD/flags",
|
"sd:/SaltySD/flags",
|
||||||
"sd:/scripts",
|
"sd:/scripts",
|
||||||
"sd:/switch/tinfoil/db",
|
"sd:/switch/tinfoil/db",
|
||||||
|
"sd:/themes/systemData",
|
||||||
"sd:/tools",
|
"sd:/tools",
|
||||||
"sd:/warmboot_mariko",
|
"sd:/warmboot_mariko",
|
||||||
NULL
|
NULL
|
||||||
|
|||||||
476
source/install.c
476
source/install.c
@@ -3,14 +3,21 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "install.h"
|
#include "install.h"
|
||||||
#include "dram_fuse.h"
|
#include "backup.h"
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
|
#include "screenshot.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "gfx.h"
|
#include "gfx.h"
|
||||||
#include <libs/fatfs/ff.h>
|
#include <libs/fatfs/ff.h>
|
||||||
|
#include <input/joycon.h>
|
||||||
|
#include <mem/heap.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <utils/btn.h>
|
||||||
|
#include <utils/ini.h>
|
||||||
|
#include <utils/list.h>
|
||||||
#include <utils/sprintf.h>
|
#include <utils/sprintf.h>
|
||||||
|
#include <utils/util.h>
|
||||||
|
|
||||||
#define GROUPED_DELETE_MAX_ENTRIES 512
|
#define GROUPED_DELETE_MAX_ENTRIES 512
|
||||||
|
|
||||||
@@ -33,10 +40,25 @@
|
|||||||
#define COLOR_ORANGE 0xFF00A5FF
|
#define COLOR_ORANGE 0xFF00A5FF
|
||||||
#define COLOR_RED 0xFFFF0000
|
#define COLOR_RED 0xFFFF0000
|
||||||
|
|
||||||
|
static inline bool cancel_combo_pressed(u8 btn)
|
||||||
|
{
|
||||||
|
return (btn & (BTN_VOL_UP | BTN_VOL_DOWN)) == (BTN_VOL_UP | BTN_VOL_DOWN);
|
||||||
|
}
|
||||||
|
|
||||||
void install_set_color(u32 color) {
|
void install_set_color(u32 color) {
|
||||||
gfx_con_setcol(color, gfx_con.fillbg, gfx_con.bgcol);
|
gfx_con_setcol(color, gfx_con.fillbg, gfx_con.bgcol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Same top bar as main.c print_header() (without full screen clear). */
|
||||||
|
static void install_print_main_header(void)
|
||||||
|
{
|
||||||
|
install_set_color(COLOR_CYAN);
|
||||||
|
gfx_printf("===================================\n");
|
||||||
|
gfx_printf(" OmniNX Installer Payload v%s\n", VERSION);
|
||||||
|
gfx_printf("===================================\n\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
// Check if we need to clear screen (when getting close to bottom)
|
// Check if we need to clear screen (when getting close to bottom)
|
||||||
void install_check_and_clear_screen_if_needed(void) {
|
void install_check_and_clear_screen_if_needed(void) {
|
||||||
// In the gfx system:
|
// In the gfx system:
|
||||||
@@ -51,13 +73,7 @@ void install_check_and_clear_screen_if_needed(void) {
|
|||||||
// Clear screen and reset position
|
// Clear screen and reset position
|
||||||
gfx_clear_grey(0x1B);
|
gfx_clear_grey(0x1B);
|
||||||
gfx_con_setpos(0, 0);
|
gfx_con_setpos(0, 0);
|
||||||
|
install_print_main_header();
|
||||||
// Reprint same header as initial launch
|
|
||||||
install_set_color(COLOR_CYAN);
|
|
||||||
gfx_printf("===================================\n");
|
|
||||||
gfx_printf(" OmniNX Installer Payload v%s\n", VERSION);
|
|
||||||
gfx_printf("===================================\n\n");
|
|
||||||
install_set_color(COLOR_WHITE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -622,6 +638,9 @@ int delete_path_list(const char* paths[], const char* description) {
|
|||||||
#define HEKATE_8GB_SRC "sd:/bootloader/hekate_8gb.bin"
|
#define HEKATE_8GB_SRC "sd:/bootloader/hekate_8gb.bin"
|
||||||
#define PAYLOAD_BIN_DST "sd:/payload.bin"
|
#define PAYLOAD_BIN_DST "sd:/payload.bin"
|
||||||
#define UPDATE_BIN_DST "sd:/bootloader/update.bin"
|
#define UPDATE_BIN_DST "sd:/bootloader/update.bin"
|
||||||
|
#define RAM_CONFIG_PATH "sd:/config/omninx/ram_config.ini"
|
||||||
|
|
||||||
|
enum { RAM_READ_OK = 0, RAM_READ_NEED_MENU = 1 };
|
||||||
|
|
||||||
static void unlink_ignore_err(const char *path)
|
static void unlink_ignore_err(const char *path)
|
||||||
{
|
{
|
||||||
@@ -633,105 +652,500 @@ static void unlink_ignore_err(const char *path)
|
|||||||
f_unlink(path);
|
f_unlink(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* After pack copy: if >4 GiB fuse RAM, install 8GB Hekate to payload.bin + bootloader/update.bin; always remove hekate_8gb.bin when done or if not used. */
|
static void ram_config_ensure_parent_dirs(void)
|
||||||
|
{
|
||||||
|
f_mkdir("sd:/config");
|
||||||
|
f_mkdir("sd:/config/omninx");
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ram_config_write(bool use_8gb)
|
||||||
|
{
|
||||||
|
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_kv_t, kv, &sec->kvs, link) {
|
||||||
|
if (kv->key) free(kv->key);
|
||||||
|
if (kv->val) free(kv->val);
|
||||||
|
}
|
||||||
|
if (sec->name) free(sec->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Valid [Ram] 8gb=0|1 → silent; missing file or invalid → menu. */
|
||||||
|
static int read_ram_config_silent(const char *path, bool *use_8gb)
|
||||||
|
{
|
||||||
|
if (!install_path_exists(path))
|
||||||
|
return RAM_READ_NEED_MENU;
|
||||||
|
|
||||||
|
link_t sections;
|
||||||
|
list_init(§ions);
|
||||||
|
|
||||||
|
if (ini_parse(§ions, (char *)path, false) != 1) {
|
||||||
|
ram_config_free_sections(§ions);
|
||||||
|
return RAM_READ_NEED_MENU;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
bool eight = false;
|
||||||
|
LIST_FOREACH_ENTRY(ini_sec_t, sec, §ions, 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ram_config_free_sections(§ions);
|
||||||
|
|
||||||
|
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). */
|
||||||
|
static bool install_ram_config_menu(bool *use_8gb)
|
||||||
|
{
|
||||||
|
jc_init_hw();
|
||||||
|
while (btn_read() & BTN_POWER)
|
||||||
|
msleep(50);
|
||||||
|
|
||||||
|
int selected = 0;
|
||||||
|
int prev_selected = 0;
|
||||||
|
bool confirmed = false;
|
||||||
|
const int n = 2;
|
||||||
|
const char *labels[2] = {
|
||||||
|
"4GB Konsole (Standard)",
|
||||||
|
"8GB Konsole",
|
||||||
|
};
|
||||||
|
|
||||||
|
gfx_clear_grey(0x1B);
|
||||||
|
gfx_con_setpos(0, 0);
|
||||||
|
install_print_main_header();
|
||||||
|
|
||||||
|
install_set_color(COLOR_YELLOW);
|
||||||
|
gfx_printf("Hekate Payload Auswahl:\n\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
gfx_printf("Wenn du einen 8GB RAM-Umbau hast, waehle 8GB Konsole aus.\n");
|
||||||
|
gfx_printf("Alle anderen waehlen 4GB Konsole aus.\n\n");
|
||||||
|
install_set_color(COLOR_RED);
|
||||||
|
gfx_printf("Warnung: Solltest du keinen RAM-Umbau haben, waehle auf keinen\n");
|
||||||
|
gfx_printf("Fall 8GB aus, da du sonst Boot Probleme bekommst!!!\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 (menu_aborted) {
|
||||||
|
gfx_printf("\n");
|
||||||
|
install_set_color(COLOR_YELLOW);
|
||||||
|
gfx_printf("Abgebrochen. Starte Hekate...\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
msleep(500);
|
||||||
|
installer_launch_hekate_payload();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
*use_8gb = (selected == 1);
|
||||||
|
ram_config_write(*use_8gb);
|
||||||
|
|
||||||
|
gfx_clear_grey(0x1B);
|
||||||
|
gfx_con_setpos(0, 0);
|
||||||
|
install_print_main_header();
|
||||||
|
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 void install_hekate_8gb_post_copy(void)
|
static void install_hekate_8gb_post_copy(void)
|
||||||
{
|
{
|
||||||
if (!install_path_exists(HEKATE_8GB_SRC))
|
if (!install_path_exists(HEKATE_8GB_SRC))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int mib = dram_capacity_mib_from_fuse();
|
bool use_8gb;
|
||||||
if (mib > 4096) {
|
if (read_ram_config_silent(RAM_CONFIG_PATH, &use_8gb) != RAM_READ_OK) {
|
||||||
install_set_color(COLOR_CYAN);
|
if (!install_ram_config_menu(&use_8gb))
|
||||||
gfx_printf("\nMehr als 4 GB RAM erkannt (Fuse). Die 8-GB-Hekate-Variante wird verwendet.\n");
|
return;
|
||||||
gfx_printf("Kopiere nach payload.bin und bootloader/update.bin...\n");
|
}
|
||||||
install_set_color(COLOR_WHITE);
|
|
||||||
|
|
||||||
|
if (use_8gb) {
|
||||||
int r1 = file_copy(HEKATE_8GB_SRC, PAYLOAD_BIN_DST);
|
int r1 = file_copy(HEKATE_8GB_SRC, PAYLOAD_BIN_DST);
|
||||||
int r2 = file_copy(HEKATE_8GB_SRC, UPDATE_BIN_DST);
|
int r2 = file_copy(HEKATE_8GB_SRC, UPDATE_BIN_DST);
|
||||||
if (r1 == FR_OK && r2 == FR_OK) {
|
if (r1 == FR_OK && r2 == FR_OK)
|
||||||
install_set_color(COLOR_GREEN);
|
|
||||||
gfx_printf(" [OK] Hekate 8 GB installiert.\n");
|
|
||||||
install_set_color(COLOR_WHITE);
|
|
||||||
unlink_ignore_err(HEKATE_8GB_SRC);
|
unlink_ignore_err(HEKATE_8GB_SRC);
|
||||||
} else {
|
} else {
|
||||||
|
unlink_ignore_err(HEKATE_8GB_SRC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define INSTALL_DEBUG_INI "sd:/config/omninx/debug.ini"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
bool active;
|
||||||
|
bool skip_clean_backup;
|
||||||
|
bool skip_clean_wipe;
|
||||||
|
bool skip_clean_restore;
|
||||||
|
bool skip_clean_install;
|
||||||
|
bool skip_clean_staging_cleanup;
|
||||||
|
bool skip_update_cleanup;
|
||||||
|
bool skip_update_install;
|
||||||
|
bool skip_update_staging_cleanup;
|
||||||
|
bool skip_update_horizon_oc;
|
||||||
|
bool skip_hekate_8gb_post_copy;
|
||||||
|
} install_debug_opts_t;
|
||||||
|
|
||||||
|
static bool install_ini_truth(const char *val)
|
||||||
|
{
|
||||||
|
if (!val || !val[0])
|
||||||
|
return false;
|
||||||
|
char c = val[0];
|
||||||
|
return c == '1' || c == 't' || c == 'T' || c == 'y' || c == 'Y';
|
||||||
|
}
|
||||||
|
|
||||||
|
static void install_debug_load(install_debug_opts_t *d)
|
||||||
|
{
|
||||||
|
memset(d, 0, sizeof(*d));
|
||||||
|
if (!install_path_exists(INSTALL_DEBUG_INI))
|
||||||
|
return;
|
||||||
|
|
||||||
|
link_t sections;
|
||||||
|
list_init(§ions);
|
||||||
|
if (ini_parse(§ions, (char *)INSTALL_DEBUG_INI, false) != 1) {
|
||||||
|
ram_config_free_sections(§ions);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LIST_FOREACH_ENTRY(ini_sec_t, sec, §ions, link) {
|
||||||
|
if (!sec->name || strcmp(sec->name, "Debug") != 0)
|
||||||
|
continue;
|
||||||
|
LIST_FOREACH_ENTRY(ini_kv_t, kv, &sec->kvs, link) {
|
||||||
|
if (!kv->key || !kv->val)
|
||||||
|
continue;
|
||||||
|
if (strcmp(kv->key, "skip_clean_backup") == 0)
|
||||||
|
d->skip_clean_backup = install_ini_truth(kv->val);
|
||||||
|
else if (strcmp(kv->key, "skip_clean_wipe") == 0)
|
||||||
|
d->skip_clean_wipe = install_ini_truth(kv->val);
|
||||||
|
else if (strcmp(kv->key, "skip_clean_restore") == 0)
|
||||||
|
d->skip_clean_restore = install_ini_truth(kv->val);
|
||||||
|
else if (strcmp(kv->key, "skip_clean_install") == 0)
|
||||||
|
d->skip_clean_install = install_ini_truth(kv->val);
|
||||||
|
else if (strcmp(kv->key, "skip_clean_staging_cleanup") == 0)
|
||||||
|
d->skip_clean_staging_cleanup = install_ini_truth(kv->val);
|
||||||
|
else if (strcmp(kv->key, "skip_update_cleanup") == 0)
|
||||||
|
d->skip_update_cleanup = install_ini_truth(kv->val);
|
||||||
|
else if (strcmp(kv->key, "skip_update_install") == 0)
|
||||||
|
d->skip_update_install = install_ini_truth(kv->val);
|
||||||
|
else if (strcmp(kv->key, "skip_update_staging_cleanup") == 0)
|
||||||
|
d->skip_update_staging_cleanup = install_ini_truth(kv->val);
|
||||||
|
else if (strcmp(kv->key, "skip_update_horizon_oc") == 0)
|
||||||
|
d->skip_update_horizon_oc = install_ini_truth(kv->val);
|
||||||
|
else if (strcmp(kv->key, "skip_hekate_8gb_post_copy") == 0)
|
||||||
|
d->skip_hekate_8gb_post_copy = install_ini_truth(kv->val);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ram_config_free_sections(§ions);
|
||||||
|
|
||||||
|
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_update_install || d->skip_update_staging_cleanup || d->skip_update_horizon_oc
|
||||||
|
|| d->skip_hekate_8gb_post_copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void install_debug_print_banner(const install_debug_opts_t *d)
|
||||||
|
{
|
||||||
|
if (!d->active)
|
||||||
|
return;
|
||||||
|
install_set_color(COLOR_RED);
|
||||||
|
gfx_printf("*** DEBUG-MODUS: %s ***\n", INSTALL_DEBUG_INI);
|
||||||
install_set_color(COLOR_ORANGE);
|
install_set_color(COLOR_ORANGE);
|
||||||
gfx_printf(" [WARN] Kopie fehlgeschlagen (payload: %d, update: %d). hekate_8gb.bin bleibt.\n", r1, r2);
|
if (d->skip_clean_backup)
|
||||||
|
gfx_printf(" ueberspringe: Clean Schritt 1 (Backup)\n");
|
||||||
|
if (d->skip_clean_wipe)
|
||||||
|
gfx_printf(" ueberspringe: Clean Schritt 2 (Bereinigung)\n");
|
||||||
|
if (d->skip_clean_restore)
|
||||||
|
gfx_printf(" ueberspringe: Clean Schritt 3 (Restore)\n");
|
||||||
|
if (d->skip_clean_install)
|
||||||
|
gfx_printf(" ueberspringe: Clean Schritt 4 (Kopieren)\n");
|
||||||
|
if (d->skip_clean_staging_cleanup)
|
||||||
|
gfx_printf(" ueberspringe: Clean Staging-Aufraeumen\n");
|
||||||
|
if (d->skip_update_cleanup)
|
||||||
|
gfx_printf(" ueberspringe: Update Schritt 1 (Bereinigung)\n");
|
||||||
|
if (d->skip_update_install)
|
||||||
|
gfx_printf(" ueberspringe: Update Schritt 2 (Kopieren)\n");
|
||||||
|
if (d->skip_update_staging_cleanup)
|
||||||
|
gfx_printf(" ueberspringe: Update Staging-Aufraeumen\n");
|
||||||
|
if (d->skip_update_horizon_oc)
|
||||||
|
gfx_printf(" ueberspringe: HorizonOC Update (Backup/Restore)\n");
|
||||||
|
if (d->skip_hekate_8gb_post_copy)
|
||||||
|
gfx_printf(" ueberspringe: hekate 8GB RAM Auswahl / Post-Copy\n");
|
||||||
install_set_color(COLOR_WHITE);
|
install_set_color(COLOR_WHITE);
|
||||||
}
|
gfx_printf("\n");
|
||||||
} else {
|
|
||||||
unlink_ignore_err(HEKATE_8GB_SRC);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main installation function
|
// Main installation function
|
||||||
int perform_installation(omninx_variant_t pack_variant, install_mode_t mode) {
|
int perform_installation(omninx_variant_t pack_variant, install_mode_t mode) {
|
||||||
int res;
|
int res;
|
||||||
|
install_debug_opts_t dbg;
|
||||||
|
install_debug_load(&dbg);
|
||||||
|
install_debug_print_banner(&dbg);
|
||||||
|
|
||||||
if (mode == INSTALL_MODE_UPDATE) {
|
if (mode == INSTALL_MODE_UPDATE) {
|
||||||
// Update mode: selective cleanup then install
|
if (pack_variant == VARIANT_OC && !dbg.skip_update_horizon_oc) {
|
||||||
|
bool had_horizon_cfg = install_path_exists(HORIZON_OC_CONFIG_PATH);
|
||||||
|
install_set_color(COLOR_YELLOW);
|
||||||
|
gfx_printf("HorizonOC: Sichere config.ini...\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
res = backup_horizon_oc_config_for_oc_update();
|
||||||
|
if (res != FR_OK)
|
||||||
|
return res;
|
||||||
|
if (had_horizon_cfg) {
|
||||||
|
install_set_color(COLOR_GREEN);
|
||||||
|
gfx_printf(" [OK] Bestehende config.ini gesichert.\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
}
|
||||||
|
} else if (pack_variant == VARIANT_OC && dbg.skip_update_horizon_oc) {
|
||||||
|
install_set_color(COLOR_ORANGE);
|
||||||
|
gfx_printf("[DEBUG] HorizonOC Backup uebersprungen.\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dbg.skip_update_cleanup) {
|
||||||
install_set_color(COLOR_YELLOW);
|
install_set_color(COLOR_YELLOW);
|
||||||
gfx_printf("Schritt 1: Bereinigung...\n");
|
gfx_printf("Schritt 1: Bereinigung...\n");
|
||||||
install_set_color(COLOR_WHITE);
|
install_set_color(COLOR_WHITE);
|
||||||
res = update_mode_cleanup(pack_variant);
|
res = update_mode_cleanup(pack_variant);
|
||||||
if (res != FR_OK) return res;
|
if (res != FR_OK) return res;
|
||||||
|
} else {
|
||||||
|
install_set_color(COLOR_ORANGE);
|
||||||
|
gfx_printf("[DEBUG] Schritt 1 (Bereinigung) uebersprungen.\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
install_check_and_clear_screen_if_needed();
|
install_check_and_clear_screen_if_needed();
|
||||||
gfx_printf("\n");
|
gfx_printf("\n");
|
||||||
|
|
||||||
|
if (!dbg.skip_update_install) {
|
||||||
install_set_color(COLOR_YELLOW);
|
install_set_color(COLOR_YELLOW);
|
||||||
gfx_printf("Schritt 2: Dateien kopieren...\n");
|
gfx_printf("Schritt 2: Dateien kopieren...\n");
|
||||||
install_set_color(COLOR_WHITE);
|
install_set_color(COLOR_WHITE);
|
||||||
res = update_mode_install(pack_variant);
|
res = update_mode_install(pack_variant);
|
||||||
if (res != FR_OK) return res;
|
if (res != FR_OK) return res;
|
||||||
|
} else {
|
||||||
|
install_set_color(COLOR_ORANGE);
|
||||||
|
gfx_printf("[DEBUG] Schritt 2 (Kopieren) uebersprungen.\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dbg.skip_hekate_8gb_post_copy)
|
||||||
install_hekate_8gb_post_copy();
|
install_hekate_8gb_post_copy();
|
||||||
|
else {
|
||||||
|
install_set_color(COLOR_ORANGE);
|
||||||
|
gfx_printf("[DEBUG] hekate 8GB Post-Copy uebersprungen.\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pack_variant == VARIANT_OC && !dbg.skip_update_horizon_oc) {
|
||||||
|
bool had_horizon_bak = install_path_exists(HORIZON_OC_UPDATE_BACKUP_INI);
|
||||||
|
install_check_and_clear_screen_if_needed();
|
||||||
|
install_set_color(COLOR_YELLOW);
|
||||||
|
gfx_printf("HorizonOC: Stelle config.ini wieder her...\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
res = restore_horizon_oc_config_after_oc_update();
|
||||||
|
if (res != FR_OK)
|
||||||
|
return res;
|
||||||
|
install_set_color(COLOR_GREEN);
|
||||||
|
if (had_horizon_bak)
|
||||||
|
gfx_printf(" [OK] Deine HorizonOC-Einstellungen wurden wiederhergestellt.\n");
|
||||||
|
else
|
||||||
|
gfx_printf(" [OK] Keine fruehere config.ini — Standard aus dem Paket bleibt.\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
res = cleanup_horizon_oc_update_backup();
|
||||||
|
if (res != FR_OK)
|
||||||
|
return res;
|
||||||
|
} else if (pack_variant == VARIANT_OC && dbg.skip_update_horizon_oc) {
|
||||||
|
install_set_color(COLOR_ORANGE);
|
||||||
|
gfx_printf("[DEBUG] HorizonOC Restore uebersprungen.\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
install_check_and_clear_screen_if_needed();
|
install_check_and_clear_screen_if_needed();
|
||||||
// Remove staging directory (installed pack)
|
if (!dbg.skip_update_staging_cleanup) {
|
||||||
res = cleanup_staging_directory(pack_variant);
|
res = cleanup_staging_directory(pack_variant);
|
||||||
if (res != FR_OK) return res;
|
if (res != FR_OK) return res;
|
||||||
// Remove other detected install directories (Standard/Light/OC) that were on SD
|
|
||||||
res = cleanup_other_staging_directories(pack_variant);
|
res = cleanup_other_staging_directories(pack_variant);
|
||||||
return res;
|
return res;
|
||||||
} else {
|
}
|
||||||
// Clean mode: backup, wipe, restore, install
|
install_set_color(COLOR_ORANGE);
|
||||||
|
gfx_printf("[DEBUG] Staging-Aufraeumen uebersprungen.\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
return FR_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dbg.skip_clean_backup) {
|
||||||
install_set_color(COLOR_YELLOW);
|
install_set_color(COLOR_YELLOW);
|
||||||
gfx_printf("Schritt 1: Sichere Benutzerdaten...\n");
|
gfx_printf("Schritt 1: Sichere Benutzerdaten...\n");
|
||||||
install_set_color(COLOR_WHITE);
|
install_set_color(COLOR_WHITE);
|
||||||
res = clean_mode_backup();
|
res = clean_mode_backup();
|
||||||
if (res != FR_OK) return res;
|
if (res != FR_OK) return res;
|
||||||
|
} else {
|
||||||
|
install_set_color(COLOR_ORANGE);
|
||||||
|
gfx_printf("[DEBUG] Schritt 1 (Backup) uebersprungen.\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
install_check_and_clear_screen_if_needed();
|
install_check_and_clear_screen_if_needed();
|
||||||
gfx_printf("\n");
|
gfx_printf("\n");
|
||||||
|
|
||||||
|
if (!dbg.skip_clean_wipe) {
|
||||||
install_set_color(COLOR_YELLOW);
|
install_set_color(COLOR_YELLOW);
|
||||||
gfx_printf("Schritt 2: Bereinige alte Installation...\n");
|
gfx_printf("Schritt 2: Bereinige alte Installation...\n");
|
||||||
install_set_color(COLOR_WHITE);
|
install_set_color(COLOR_WHITE);
|
||||||
res = clean_mode_wipe();
|
res = clean_mode_wipe();
|
||||||
if (res != FR_OK) return res;
|
if (res != FR_OK) return res;
|
||||||
|
} else {
|
||||||
|
install_set_color(COLOR_ORANGE);
|
||||||
|
gfx_printf("[DEBUG] Schritt 2 (Bereinigung) uebersprungen.\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
install_check_and_clear_screen_if_needed();
|
install_check_and_clear_screen_if_needed();
|
||||||
gfx_printf("\n");
|
gfx_printf("\n");
|
||||||
|
|
||||||
|
if (!dbg.skip_clean_restore) {
|
||||||
install_set_color(COLOR_YELLOW);
|
install_set_color(COLOR_YELLOW);
|
||||||
gfx_printf("Schritt 3: Stelle Benutzerdaten wieder her...\n");
|
gfx_printf("Schritt 3: Stelle Benutzerdaten wieder her...\n");
|
||||||
install_set_color(COLOR_WHITE);
|
install_set_color(COLOR_WHITE);
|
||||||
res = clean_mode_restore();
|
res = clean_mode_restore();
|
||||||
if (res != FR_OK) return res;
|
if (res != FR_OK) return res;
|
||||||
|
} else {
|
||||||
|
install_set_color(COLOR_ORANGE);
|
||||||
|
gfx_printf("[DEBUG] Schritt 3 (Restore) uebersprungen.\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
install_check_and_clear_screen_if_needed();
|
install_check_and_clear_screen_if_needed();
|
||||||
gfx_printf("\n");
|
gfx_printf("\n");
|
||||||
|
|
||||||
|
if (!dbg.skip_clean_install) {
|
||||||
install_set_color(COLOR_YELLOW);
|
install_set_color(COLOR_YELLOW);
|
||||||
gfx_printf("Schritt 4: Dateien kopieren...\n");
|
gfx_printf("Schritt 4: Dateien kopieren...\n");
|
||||||
install_set_color(COLOR_WHITE);
|
install_set_color(COLOR_WHITE);
|
||||||
res = clean_mode_install(pack_variant);
|
res = clean_mode_install(pack_variant);
|
||||||
if (res != FR_OK) return res;
|
if (res != FR_OK) return res;
|
||||||
|
} else {
|
||||||
|
install_set_color(COLOR_ORANGE);
|
||||||
|
gfx_printf("[DEBUG] Schritt 4 (Kopieren) uebersprungen.\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dbg.skip_hekate_8gb_post_copy)
|
||||||
install_hekate_8gb_post_copy();
|
install_hekate_8gb_post_copy();
|
||||||
|
else {
|
||||||
|
install_set_color(COLOR_ORANGE);
|
||||||
|
gfx_printf("[DEBUG] hekate 8GB Post-Copy uebersprungen.\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
}
|
||||||
|
|
||||||
install_check_and_clear_screen_if_needed();
|
install_check_and_clear_screen_if_needed();
|
||||||
// Remove staging directory (installed pack)
|
if (!dbg.skip_clean_staging_cleanup) {
|
||||||
res = cleanup_staging_directory(pack_variant);
|
res = cleanup_staging_directory(pack_variant);
|
||||||
if (res != FR_OK) return res;
|
if (res != FR_OK) return res;
|
||||||
// Remove other detected install directories (Standard/Light/OC) that were on SD
|
|
||||||
res = cleanup_other_staging_directories(pack_variant);
|
res = cleanup_other_staging_directories(pack_variant);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
install_set_color(COLOR_ORANGE);
|
||||||
|
gfx_printf("[DEBUG] Staging-Aufraeumen uebersprungen.\n");
|
||||||
|
install_set_color(COLOR_WHITE);
|
||||||
|
return FR_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ typedef enum {
|
|||||||
INSTALL_MODE_CLEAN // No OmniNX - selective deletion from clean list
|
INSTALL_MODE_CLEAN // No OmniNX - selective deletion from clean list
|
||||||
} install_mode_t;
|
} install_mode_t;
|
||||||
|
|
||||||
// Main installation function
|
// If a sub-menu aborts to Hekate / update.bin (does not return if launch succeeds)
|
||||||
|
void installer_launch_hekate_payload(void);
|
||||||
|
|
||||||
|
// Main installation function (optional debug: see DEBUG_INI.md in repo root)
|
||||||
int perform_installation(omninx_variant_t pack_variant, install_mode_t mode);
|
int perform_installation(omninx_variant_t pack_variant, install_mode_t mode);
|
||||||
|
|
||||||
// Update mode operations (install_update.c)
|
// Update mode operations (install_update.c)
|
||||||
|
|||||||
@@ -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, Tinfoil, prod.keys\n");
|
gfx_printf(" Sichere: 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,13 +95,14 @@ 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, Tinfoil, prod.keys\n");
|
gfx_printf(" Stelle wieder her: 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) {
|
||||||
set_color(COLOR_GREEN);
|
set_color(COLOR_GREEN);
|
||||||
gfx_printf(" [OK] Wiederherstellung abgeschlossen\n");
|
gfx_printf(" [OK] Wiederherstellung abgeschlossen\n");
|
||||||
set_color(COLOR_WHITE);
|
set_color(COLOR_WHITE);
|
||||||
|
delete_path_list(clean_post_restore_dirs_to_delete, "switch/ (nach Restore)");
|
||||||
}
|
}
|
||||||
cleanup_backup();
|
cleanup_backup();
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
@@ -116,6 +116,12 @@ static void print_header(void) {
|
|||||||
set_color(COLOR_WHITE);
|
set_color(COLOR_WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Console Vol+ and Vol- together (exit / cancel where documented) */
|
||||||
|
static inline bool cancel_combo_pressed(u8 btn)
|
||||||
|
{
|
||||||
|
return (btn & (BTN_VOL_UP | BTN_VOL_DOWN)) == (BTN_VOL_UP | BTN_VOL_DOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void reloc_patcher(u32 payload_dst, u32 payload_src, u32 payload_size) {
|
void reloc_patcher(u32 payload_dst, u32 payload_src, u32 payload_size) {
|
||||||
memcpy((u8 *)payload_src, (u8 *)IPL_LOAD_ADDR, PATCHED_RELOC_SZ);
|
memcpy((u8 *)payload_src, (u8 *)IPL_LOAD_ADDR, PATCHED_RELOC_SZ);
|
||||||
@@ -183,6 +189,12 @@ static int file_exists(const char *path) {
|
|||||||
return (f_stat(path, &fno) == FR_OK);
|
return (f_stat(path, &fno) == FR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void installer_launch_hekate_payload(void) {
|
||||||
|
if (file_exists(PAYLOAD_PATH))
|
||||||
|
launch_payload(PAYLOAD_PATH);
|
||||||
|
power_set_state(POWER_OFF_REBOOT);
|
||||||
|
}
|
||||||
|
|
||||||
extern void pivot_stack(u32 stack_top);
|
extern void pivot_stack(u32 stack_top);
|
||||||
|
|
||||||
void ipl_main(void) {
|
void ipl_main(void) {
|
||||||
@@ -244,11 +256,13 @@ void ipl_main(void) {
|
|||||||
set_color(COLOR_GREEN);
|
set_color(COLOR_GREEN);
|
||||||
gfx_printf("Druecke A-Taste (rechter Joy-Con) oder Power-Taste,\n");
|
gfx_printf("Druecke A-Taste (rechter Joy-Con) oder Power-Taste,\n");
|
||||||
gfx_printf("um Hekate zu starten...\n");
|
gfx_printf("um Hekate zu starten...\n");
|
||||||
|
gfx_printf("Oder Vol+ und Vol- (Konsole) gleichzeitig.\n");
|
||||||
set_color(COLOR_WHITE);
|
set_color(COLOR_WHITE);
|
||||||
} else {
|
} else {
|
||||||
set_color(COLOR_GREEN);
|
set_color(COLOR_GREEN);
|
||||||
gfx_printf("Druecke A-Taste (rechter Joy-Con) oder Power-Taste,\n");
|
gfx_printf("Druecke A-Taste (rechter Joy-Con) oder Power-Taste,\n");
|
||||||
gfx_printf("um den Neustart zu starten...\n");
|
gfx_printf("um den Neustart zu starten...\n");
|
||||||
|
gfx_printf("Oder Vol+ und Vol- (Konsole) gleichzeitig.\n");
|
||||||
set_color(COLOR_WHITE);
|
set_color(COLOR_WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,6 +289,10 @@ void ipl_main(void) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (cancel_combo_pressed(btn_state)) {
|
||||||
|
button_pressed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
msleep(50); // Small delay to avoid busy-waiting
|
msleep(50); // Small delay to avoid busy-waiting
|
||||||
}
|
}
|
||||||
@@ -329,12 +347,14 @@ void ipl_main(void) {
|
|||||||
gfx_printf("\n");
|
gfx_printf("\n");
|
||||||
set_color(COLOR_CYAN);
|
set_color(COLOR_CYAN);
|
||||||
gfx_printf("D-Pad / Vol+/-: Auswahl | A oder Power: Bestaetigen\n");
|
gfx_printf("D-Pad / Vol+/-: Auswahl | A oder Power: Bestaetigen\n");
|
||||||
|
gfx_printf("Vol+ und Vol- gleichzeitig: Abbrechen (Hekate)\n");
|
||||||
set_color(COLOR_WHITE);
|
set_color(COLOR_WHITE);
|
||||||
|
|
||||||
// Edge detection: only move on press (not while held)
|
// Edge detection: only move on press (not while held)
|
||||||
bool prev_up = false, prev_down = false;
|
bool prev_up = false, prev_down = false;
|
||||||
|
bool menu_aborted = false;
|
||||||
|
|
||||||
while (!confirmed) {
|
while (!confirmed && !menu_aborted) {
|
||||||
// On selection change: redraw only the two affected lines (no full clear)
|
// On selection change: redraw only the two affected lines (no full clear)
|
||||||
if (selected != prev_selected) {
|
if (selected != prev_selected) {
|
||||||
gfx_con_setpos(menu_x, menu_variant_start_y + (u32)prev_selected * 16);
|
gfx_con_setpos(menu_x, menu_variant_start_y + (u32)prev_selected * 16);
|
||||||
@@ -353,6 +373,11 @@ void ipl_main(void) {
|
|||||||
if (jc && jc->cap)
|
if (jc && jc->cap)
|
||||||
take_screenshot();
|
take_screenshot();
|
||||||
|
|
||||||
|
if (cancel_combo_pressed(btn)) {
|
||||||
|
menu_aborted = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// D-pad or Vol+ / Vol- for selection (Vol+ = up, Vol- = down)
|
// D-pad or Vol+ / Vol- for selection (Vol+ = up, Vol- = down)
|
||||||
bool cur_up = false, cur_down = false;
|
bool cur_up = false, cur_down = false;
|
||||||
if (jc) {
|
if (jc) {
|
||||||
@@ -378,6 +403,20 @@ void ipl_main(void) {
|
|||||||
msleep(50);
|
msleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (menu_aborted) {
|
||||||
|
gfx_printf("\n");
|
||||||
|
set_color(COLOR_YELLOW);
|
||||||
|
gfx_printf("Abgebrochen. Starte Hekate...\n");
|
||||||
|
set_color(COLOR_WHITE);
|
||||||
|
msleep(500);
|
||||||
|
if (file_exists(PAYLOAD_PATH)) {
|
||||||
|
launch_payload(PAYLOAD_PATH);
|
||||||
|
} else {
|
||||||
|
power_set_state(POWER_OFF_REBOOT);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pack_variant = variants_present[selected];
|
pack_variant = variants_present[selected];
|
||||||
gfx_clear_grey(0x1B);
|
gfx_clear_grey(0x1B);
|
||||||
print_header();
|
print_header();
|
||||||
@@ -403,21 +442,22 @@ void ipl_main(void) {
|
|||||||
gfx_printf("mit angeschlossenem Ladegeraet durchgefuehrt werden.\n\n");
|
gfx_printf("mit angeschlossenem Ladegeraet durchgefuehrt werden.\n\n");
|
||||||
set_color(COLOR_YELLOW);
|
set_color(COLOR_YELLOW);
|
||||||
gfx_printf("Stecke das Ladegeraet an und warte...\n");
|
gfx_printf("Stecke das Ladegeraet an und warte...\n");
|
||||||
gfx_printf("Oder druecke + und - zum Abbrechen.\n");
|
gfx_printf("Oder Vol+ und Vol- (Konsole) zum Abbrechen.\n");
|
||||||
set_color(COLOR_WHITE);
|
set_color(COLOR_WHITE);
|
||||||
jc_init_hw();
|
jc_init_hw();
|
||||||
while (btn_read() & BTN_POWER) { msleep(50); }
|
while (btn_read() & BTN_POWER) { msleep(50); }
|
||||||
bool user_cancelled = false;
|
bool user_cancelled = false;
|
||||||
while (batt_pct < BATT_LOW_THRESHOLD && !bq24193_charger_connected() && !user_cancelled) {
|
while (batt_pct < BATT_LOW_THRESHOLD && !bq24193_charger_connected() && !user_cancelled) {
|
||||||
|
u8 pbtn = btn_read();
|
||||||
jc_gamepad_rpt_t *jc = joycon_poll();
|
jc_gamepad_rpt_t *jc = joycon_poll();
|
||||||
if (jc) {
|
if (jc) {
|
||||||
if (jc->cap)
|
if (jc->cap)
|
||||||
take_screenshot();
|
take_screenshot();
|
||||||
if (jc->plus && jc->minus) {
|
}
|
||||||
|
if (cancel_combo_pressed(pbtn)) {
|
||||||
user_cancelled = true;
|
user_cancelled = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (max17050_get_property(MAX17050_RepSOC, &batt_raw) == 0) {
|
if (max17050_get_property(MAX17050_RepSOC, &batt_raw) == 0) {
|
||||||
batt_pct = batt_raw >> 8;
|
batt_pct = batt_raw >> 8;
|
||||||
}
|
}
|
||||||
@@ -473,10 +513,13 @@ void ipl_main(void) {
|
|||||||
gfx_printf("Empfohlene Karten: Samsung EVO Plus, EVO Select und PRO Plus.\n\n");
|
gfx_printf("Empfohlene Karten: Samsung EVO Plus, EVO Select und PRO Plus.\n\n");
|
||||||
set_color(COLOR_GREEN);
|
set_color(COLOR_GREEN);
|
||||||
gfx_printf("Druecke A (oder Power), um trotzdem fortzufahren.\n");
|
gfx_printf("Druecke A (oder Power), um trotzdem fortzufahren.\n");
|
||||||
|
set_color(COLOR_CYAN);
|
||||||
|
gfx_printf("Vol+ und Vol- (Konsole) gleichzeitig: Abbrechen -> Hekate.\n");
|
||||||
set_color(COLOR_WHITE);
|
set_color(COLOR_WHITE);
|
||||||
while (btn_read() & BTN_POWER) { msleep(50); }
|
while (btn_read() & BTN_POWER) { msleep(50); }
|
||||||
bool acknowledged = false;
|
bool acknowledged = false;
|
||||||
while (!acknowledged) {
|
bool uhs_aborted = false;
|
||||||
|
while (!acknowledged && !uhs_aborted) {
|
||||||
u8 btn_state = btn_read();
|
u8 btn_state = btn_read();
|
||||||
if (btn_state & BTN_POWER) acknowledged = true;
|
if (btn_state & BTN_POWER) acknowledged = true;
|
||||||
jc_gamepad_rpt_t *jc = joycon_poll();
|
jc_gamepad_rpt_t *jc = joycon_poll();
|
||||||
@@ -485,8 +528,22 @@ void ipl_main(void) {
|
|||||||
take_screenshot();
|
take_screenshot();
|
||||||
if (jc->a) acknowledged = true;
|
if (jc->a) acknowledged = true;
|
||||||
}
|
}
|
||||||
|
if (cancel_combo_pressed(btn_state)) {
|
||||||
|
uhs_aborted = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
msleep(50);
|
msleep(50);
|
||||||
}
|
}
|
||||||
|
if (uhs_aborted) {
|
||||||
|
gfx_printf("\nAbgebrochen. Starte Hekate...\n");
|
||||||
|
msleep(500);
|
||||||
|
if (file_exists(PAYLOAD_PATH)) {
|
||||||
|
launch_payload(PAYLOAD_PATH);
|
||||||
|
} else {
|
||||||
|
power_set_state(POWER_OFF_REBOOT);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Wait for A and Power to be released so the same press doesn't start the install
|
// Wait for A and Power to be released so the same press doesn't start the install
|
||||||
while (btn_read() & BTN_POWER) { msleep(50); }
|
while (btn_read() & BTN_POWER) { msleep(50); }
|
||||||
bool released = false;
|
bool released = false;
|
||||||
@@ -526,7 +583,7 @@ void ipl_main(void) {
|
|||||||
gfx_printf("um die Installation zu starten...\n");
|
gfx_printf("um die Installation zu starten...\n");
|
||||||
set_color(COLOR_WHITE);
|
set_color(COLOR_WHITE);
|
||||||
set_color(COLOR_CYAN);
|
set_color(COLOR_CYAN);
|
||||||
gfx_printf("Druecke + und - gleichzeitig zum Abbrechen (zurueck zu Hekate).\n");
|
gfx_printf("Vol+ und Vol- (Konsole) gleichzeitig: Abbrechen -> Hekate.\n");
|
||||||
set_color(COLOR_WHITE);
|
set_color(COLOR_WHITE);
|
||||||
|
|
||||||
// Wait for A/Power to start, or +/- to cancel
|
// Wait for A/Power to start, or +/- to cancel
|
||||||
@@ -555,12 +612,11 @@ void ipl_main(void) {
|
|||||||
button_pressed = true;
|
button_pressed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// + and - simultaneously = cancel, return to hekate
|
}
|
||||||
if (jc->plus && jc->minus) {
|
if (cancel_combo_pressed(btn_state)) {
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
msleep(50); // Small delay to avoid busy-waiting
|
msleep(50); // Small delay to avoid busy-waiting
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user