Skip to content

Commit 63ce649

Browse files
committed
Add Atmosphere settings manager and release checker
- System settings screen (R button) for toggling verified system_settings.ini overrides (DNS MITM, telemetry, cheats, debug mode, bluetooth DB). All settings sourced from Atmosphere's settings_sd_kvs.cpp -- safe for sysnand online play. - Release checker screen (X from settings) fetches latest Atmosphere release from GitHub on a background thread, shows current vs latest version, and displays scrollable release notes. - Updated build to link libcurl, jansson, mbedtls for HTTPS/JSON. - Updated CI workflow to install new dependencies. - Bump version to 1.0.1.
1 parent 27b9032 commit 63ce649

11 files changed

Lines changed: 974 additions & 21 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ jobs:
1818
- name: Checkout
1919
uses: actions/checkout@v4
2020

21+
- name: Install dependencies
22+
run: |
23+
dkp-pacman -Sy --noconfirm switch-curl switch-jansson switch-mbedtls switch-zlib
24+
2125
- name: Build
2226
run: make
2327

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ROMFS := romfs
1818

1919
APP_TITLE := AetherBlock
2020
APP_AUTHOR := HeXbyt3
21-
APP_VERSION := 1.0.0
21+
APP_VERSION := 1.0.1
2222

2323
#---------------------------------------------------------------------------------
2424
ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE
@@ -27,13 +27,14 @@ CFLAGS := -g -Wall -Wextra -Wno-unused-parameter -O2 -ffunction-sections \
2727
$(ARCH) $(DEFINES)
2828

2929
CFLAGS += $(INCLUDE) -D__SWITCH__ \
30-
$(shell $(DEVKITPRO)/portlibs/switch/bin/aarch64-none-elf-pkg-config --cflags SDL2_ttf)
30+
$(shell $(DEVKITPRO)/portlibs/switch/bin/aarch64-none-elf-pkg-config --cflags SDL2_ttf libcurl jansson)
3131

3232
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
3333
ASFLAGS := -g $(ARCH)
3434
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
3535

36-
LIBS := $(shell $(DEVKITPRO)/portlibs/switch/bin/aarch64-none-elf-pkg-config --libs SDL2_ttf) -lnx
36+
LIBS := $(shell $(DEVKITPRO)/portlibs/switch/bin/aarch64-none-elf-pkg-config --libs SDL2_ttf) \
37+
-lcurl -ljansson -lmbedtls -lmbedx509 -lmbedcrypto -lz -lnx
3738

3839
#---------------------------------------------------------------------------------
3940
LIBDIRS := $(PORTLIBS) $(LIBNX)

README.md

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,27 @@
3737

3838
## Features
3939

40-
- Changes take effect immediately via Atmosphere's IPC reload (no reboot)
40+
### DNS Hosts Manager
41+
- Toggle Nintendo server blocks on/off with changes applied immediately (no reboot)
4142
- Entries grouped by category: Telemetry, System Updates, Game Content, eShop
42-
- Color-coded status indicators (red/green)
43-
- Atomic file writes (tmp + rename) to prevent corruption
44-
- Auto-detects which hosts file to use (emummc > sysmmc > default)
45-
- Confirmation dialog if you try to quit with unsaved changes
46-
- Quick-apply profiles: block all, allow game updates, telemetry only, allow all
43+
- Quick-apply profiles: Block All, Allow Game Updates, Telemetry Only, Allow All
4744
- Built-in connectivity test that TCP pings each host on port 443
48-
- Toast notifications for save/reload/error feedback
49-
- Scrollbar, alternating row colors, rounded UI elements
45+
- Auto-detects which hosts file to use (emummc > sysmmc > default)
46+
- Atomic file writes to prevent corruption
47+
48+
### Atmosphere Settings Manager
49+
- Toggle verified `system_settings.ini` overrides from a UI (reboot required to apply)
50+
- All settings sourced from Atmosphere's `settings_sd_kvs.cpp` -- nothing unverified
51+
- Categories: Network (DNS MITM controls), Telemetry (error uploads), Homebrew (cheats, debug mode, bluetooth DB)
52+
- Preserves existing comments and manual edits in your INI file
53+
- Safe for sysnand online play -- all overrides are local only
54+
55+
### Atmosphere Release Checker
56+
- Fetches the latest Atmosphere release from GitHub in a background thread
57+
- Shows your current firmware and Atmosphere versions side by side
58+
- Compares against the latest release and tells you if an update is available
59+
- Extracts supported firmware version from release notes
60+
- Scrollable release notes viewer
5061

5162
## Controls
5263

@@ -58,9 +69,14 @@
5869
| X | Open profiles menu |
5970
| Y | Save & reload DNS |
6071
| L | Run server connectivity test |
72+
| R | Atmosphere settings |
6173
| - | Seed default Nintendo entries |
6274
| + | Quit (with unsaved changes check) |
6375

76+
**Settings Screen:** A Toggle | Y Save | X Release Checker | B Back
77+
78+
**Release Checker:** A Refresh | B Back | Up/Down scroll notes
79+
6480
## Installation
6581

6682
1. Download `AetherBlock.nro` from the [latest release](https://github.com/hexbyt3/AetherBlock/releases/latest)
@@ -69,26 +85,27 @@
6985

7086
## Building
7187

72-
Requires [devkitPro](https://devkitpro.org/) with `switch-dev`, `switch-sdl2`, `switch-sdl2_ttf`, and `switch-freetype`.
88+
Requires [devkitPro](https://devkitpro.org/) with the following packages:
7389

7490
```bash
75-
(dkp-)pacman -S switch-dev switch-sdl2 switch-sdl2_ttf switch-freetype
91+
(dkp-)pacman -S switch-dev switch-sdl2 switch-sdl2_ttf switch-freetype switch-curl switch-jansson switch-mbedtls switch-zlib
7692
make
7793
```
7894

7995
## How It Works
8096

81-
AetherBlock reads and modifies Atmosphere's hosts file at `/atmosphere/hosts/default.txt`. Entries prefixed with `;` are disabled. Active entries redirect hostnames to `127.0.0.1`.
97+
**DNS Hosts:** Reads and modifies Atmosphere's hosts file at `/atmosphere/hosts/default.txt`. Entries prefixed with `;` are disabled. After saving, it calls Atmosphere's IPC command 65000 on `sfdnsres` to reload the hosts file in memory -- no reboot needed.
8298

83-
After saving, it calls Atmosphere's IPC command 65000 on `sfdnsres` to reload the hosts file in memory.
99+
**System Settings:** Reads and modifies `/atmosphere/config/system_settings.ini`. Atmosphere parses this file at boot and overrides the corresponding system settings via its set:sys mitm service. Changes here require a reboot to take effect.
84100

85-
The connectivity test does non-blocking TCP connects on port 443, one host per frame so the UI stays responsive.
101+
**Release Checker:** Hits the GitHub API (`/repos/Atmosphere-NX/Atmosphere/releases/latest`) on a background thread and parses the JSON response with jansson. Reads local Atmosphere version via `splGetConfig` with config item 65000.
86102

87103
## Credits
88104

89105
- DNS reload mechanism via [DNS-MITM_Manager](https://github.com/znxDomain/DNS-MITM_Manager) by znxDomain
90106
- Server list from [NintendoClients Wiki](https://github.com/kinnay/NintendoClients/wiki/Server-List)
91-
- Built with [libnx](https://github.com/switchbrew/libnx) and [SDL2](https://www.libsdl.org/)
107+
- Settings verified against [Atmosphere](https://github.com/Atmosphere-NX/Atmosphere) source (`settings_sd_kvs.cpp`)
108+
- Built with [libnx](https://github.com/switchbrew/libnx), [SDL2](https://www.libsdl.org/), [libcurl](https://curl.se/libcurl/), and [jansson](https://github.com/akheron/jansson)
92109

93110
## License
94111

include/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define CONFIG_H
33

44
#define APP_NAME "AetherBlock"
5-
#define APP_VERSION "1.0.0"
5+
#define APP_VERSION "1.0.1"
66
#define APP_AUTHOR "HeXbyt3"
77

88
#define HOSTS_MAX_ENTRIES 256

include/release_checker.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#ifndef RELEASE_CHECKER_H
2+
#define RELEASE_CHECKER_H
3+
4+
#include <switch.h>
5+
#include <stdbool.h>
6+
7+
#define GITHUB_API_URL "https://api.github.com/repos/Atmosphere-NX/Atmosphere/releases/latest"
8+
#define RELEASE_TAG_MAX 32
9+
#define RELEASE_NAME_MAX 128
10+
#define RELEASE_FW_MAX 32
11+
#define RELEASE_BODY_MAX 4096
12+
#define RELEASE_DATE_MAX 32
13+
14+
typedef enum {
15+
RELEASE_IDLE = 0,
16+
RELEASE_FETCHING,
17+
RELEASE_SUCCESS,
18+
RELEASE_ERROR,
19+
} ReleaseCheckState;
20+
21+
typedef struct {
22+
/* local system info */
23+
int fw_major, fw_minor, fw_micro;
24+
int ams_major, ams_minor, ams_micro;
25+
bool ams_detected;
26+
27+
/* latest release from GitHub */
28+
char tag_name[RELEASE_TAG_MAX];
29+
char release_name[RELEASE_NAME_MAX];
30+
char supported_fw[RELEASE_FW_MAX];
31+
char body[RELEASE_BODY_MAX];
32+
char published_date[RELEASE_DATE_MAX];
33+
int latest_major, latest_minor, latest_micro;
34+
35+
/* state */
36+
ReleaseCheckState state;
37+
char error_msg[256];
38+
bool update_available;
39+
40+
/* background thread */
41+
Thread fetch_thread;
42+
bool thread_running;
43+
} ReleaseInfo;
44+
45+
void releaseInit(ReleaseInfo *ri);
46+
void releaseReadLocal(ReleaseInfo *ri);
47+
void releaseFetchAsync(ReleaseInfo *ri);
48+
bool releaseFetchDone(ReleaseInfo *ri);
49+
50+
#endif

include/sys_settings.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#ifndef SYS_SETTINGS_H
2+
#define SYS_SETTINGS_H
3+
4+
#include <switch.h>
5+
#include <stdbool.h>
6+
7+
#define SYS_SETTINGS_PATH "/atmosphere/config/system_settings.ini"
8+
#define SYS_SETTINGS_MAX_LINE 512
9+
#define SYS_SETTINGS_MAX_LINES 512
10+
11+
typedef enum {
12+
SETTING_CAT_NETWORK = 0,
13+
SETTING_CAT_TELEMETRY,
14+
SETTING_CAT_HOMEBREW,
15+
SETTING_CAT_COUNT,
16+
} SettingCategory;
17+
18+
typedef struct {
19+
const char *section;
20+
const char *key;
21+
const char *type;
22+
const char *on_val; /* value when toggle is ON */
23+
const char *off_val; /* value when toggle is OFF */
24+
const char *display_name;
25+
const char *description;
26+
SettingCategory category;
27+
bool toggled_on; /* current state: true = on_val written */
28+
bool found_in_file;
29+
bool is_default_on; /* what Atmosphere defaults to */
30+
} SysSettingDef;
31+
32+
typedef struct {
33+
char lines[SYS_SETTINGS_MAX_LINES][SYS_SETTINGS_MAX_LINE];
34+
int line_count;
35+
bool dirty;
36+
bool file_existed;
37+
} SysSettingsFile;
38+
39+
#define SYS_SETTING_COUNT 9
40+
41+
extern SysSettingDef g_sys_setting_defs[SYS_SETTING_COUNT];
42+
43+
const char *settingCategoryName(SettingCategory cat);
44+
45+
Result sysSettingsLoad(SysSettingsFile *sf);
46+
Result sysSettingsSave(SysSettingsFile *sf);
47+
void sysSettingsReadStates(SysSettingsFile *sf);
48+
void sysSettingsToggle(SysSettingsFile *sf, int index);
49+
50+
#endif

include/ui.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@
88
#include "hosts_parser.h"
99
#include "profiles.h"
1010
#include "net_test.h"
11+
#include "sys_settings.h"
12+
#include "release_checker.h"
1113

1214
typedef enum {
1315
SCREEN_MAIN_LIST = 0,
1416
SCREEN_PROFILES,
1517
SCREEN_CONFIRM,
1618
SCREEN_STATUS,
1719
SCREEN_NET_TEST,
20+
SCREEN_SYS_SETTINGS,
21+
SCREEN_RELEASE_CHECK,
1822
} AppScreen;
1923

2024
typedef struct {
@@ -38,6 +42,12 @@ typedef struct {
3842

3943
NetTestState net_test;
4044
int net_test_scroll;
45+
46+
int sys_settings_cursor;
47+
SysSettingsFile *sys_settings_file;
48+
49+
ReleaseInfo release_info;
50+
int release_scroll;
4151
} UIState;
4252

4353
bool uiInit(UIState *ui);

0 commit comments

Comments
 (0)