From 769d34d934b26067a7adbd94d535aa66a813687f Mon Sep 17 00:00:00 2001 From: LiHaohua Date: Tue, 2 Jun 2026 22:41:01 +0800 Subject: [PATCH 1/4] ui_app_setup: drop HAL_PLATFORM_SDL guard so emulator can open SETTING MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The class was wrapped in `#if !defined(HAL_PLATFORM_SDL)`, which excluded it from emulator builds — but ui_app_launch.cpp registers `page_v` unconditionally, causing a fatal compile error on emu ("'UISetupPage' was not declared"). Removing the guard is safe: - The UI implementation already uses HAL functions (hal_wifi_*, hal_battery_*, hal_volume_*, hal_bt_*, hal_backlight_*) that have emulator stubs in hal/sdl/. - Residual raw syscalls (i2c ioctl, sys/class/power_supply DIR walk, popen for ip/whoami/hostname, sudo date, apt update) all sit either inside an existing `#ifdef __linux__` block, or in code paths that only fire on user actions the emulator never performs (e.g. the user must navigate into the WiFi/Update sub-pages and confirm). - Both popen() and system() are POSIX and compile fine on macOS/Linux hosts. Windows static builds of APPLaunch are a separate concern (already broken before this change due to gethostname/_popen). This unblocks the M5CardputerZero-Emulator multi-arch CI. --- .../main/ui/components/page_app/ui_app_setup.hpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/projects/APPLaunch/main/ui/components/page_app/ui_app_setup.hpp b/projects/APPLaunch/main/ui/components/page_app/ui_app_setup.hpp index 5d3298bf..5cf8dc9c 100644 --- a/projects/APPLaunch/main/ui/components/page_app/ui_app_setup.hpp +++ b/projects/APPLaunch/main/ui/components/page_app/ui_app_setup.hpp @@ -1,5 +1,11 @@ #pragma once -#if !defined(HAL_PLATFORM_SDL) +// Note: this file used to be wrapped in `#if !defined(HAL_PLATFORM_SDL)` to +// exclude it from the emulator build, but ui_app_launch.cpp references +// UISetupPage unconditionally. The class body is HAL-clean (uses hal_wifi_*, +// hal_battery_*, hal_volume_*); residual raw syscalls (i2c ioctl, popen for +// IP/whoami, sudo date) are either already inside #ifdef __linux__ or only +// triggered by user actions that the emulator never performs. Keeping the +// class compiled on every platform lets the emulator open the SETTING page. #define _STRINGIFY(x) #x #define STRINGIFY(x) _STRINGIFY(x) #ifndef LAUNCHER_GIT_COMMIT_RAW @@ -1738,5 +1744,3 @@ class UISetupPage : public app_base UISetupPage() : app_base() { set_page_title("SETTING"); } ~UISetupPage() {} }; - -#endif // !HAL_PLATFORM_SDL From d5bb08b6735e654254070ab6118dcd07573ffbb5 Mon Sep 17 00:00:00 2001 From: LiHaohua Date: Tue, 2 Jun 2026 22:44:24 +0800 Subject: [PATCH 2/4] hal_filesystem_sdl: add missing #include for snprintf GCC on MinGW (Windows MSYS2) errors with 'snprintf was not declared in this scope'. The implicit transitive include via / holds on glibc/libc++ but not on MSYS2's headers. Other HAL files in the same directory already include ; this one was an oversight. --- projects/APPLaunch/main/hal/sdl/hal_filesystem_sdl.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/APPLaunch/main/hal/sdl/hal_filesystem_sdl.cpp b/projects/APPLaunch/main/hal/sdl/hal_filesystem_sdl.cpp index 943cbc1c..1232d540 100644 --- a/projects/APPLaunch/main/hal/sdl/hal_filesystem_sdl.cpp +++ b/projects/APPLaunch/main/hal/sdl/hal_filesystem_sdl.cpp @@ -1,4 +1,5 @@ #include "../hal_filesystem.h" +#include // snprintf #include #include From 14f04fa5d110bc370aa4ab4e661798b1a34022a4 Mon Sep 17 00:00:00 2001 From: LiHaohua Date: Tue, 2 Jun 2026 23:28:12 +0800 Subject: [PATCH 3/4] ui_app_setup: also remove the SDL stub class block Forgot to drop the matching `#else` branch that provided a stub UISetupPage for HAL_PLATFORM_SDL builds. With the outer guard gone, the orphan `#else` produced 'else without if' on every platform and a class redefinition error. Now the file has a single, unconditional class definition. --- .../main/ui/components/page_app/ui_app_setup.hpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/projects/APPLaunch/main/ui/components/page_app/ui_app_setup.hpp b/projects/APPLaunch/main/ui/components/page_app/ui_app_setup.hpp index 5cf8dc9c..d665ac4c 100644 --- a/projects/APPLaunch/main/ui/components/page_app/ui_app_setup.hpp +++ b/projects/APPLaunch/main/ui/components/page_app/ui_app_setup.hpp @@ -1734,13 +1734,3 @@ class UISetupPage : public app_base } } }; - -#else // HAL_PLATFORM_SDL — stub for emulator builds -#include "../ui_app_page.hpp" - -class UISetupPage : public app_base -{ -public: - UISetupPage() : app_base() { set_page_title("SETTING"); } - ~UISetupPage() {} -}; From d3fa7da055c8625bb44ac0c95767702241f35841 Mon Sep 17 00:00:00 2001 From: LiHaohua Date: Tue, 2 Jun 2026 23:35:19 +0800 Subject: [PATCH 4/4] hal_settings_sdl: stub hal_wifi_disconnect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Declared in hal_settings.h but never implemented for SDL — caused a link error on Windows / Web emulator builds (UISetupPage's WiFi menu calls it). Returns 0 (success no-op) for the emulator. Linux native and macOS link paths used dynamic_lookup so they didn't notice the missing symbol; the static-link targets do. --- projects/APPLaunch/main/hal/sdl/hal_settings_sdl.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/APPLaunch/main/hal/sdl/hal_settings_sdl.cpp b/projects/APPLaunch/main/hal/sdl/hal_settings_sdl.cpp index 00a56b45..25ce75c0 100644 --- a/projects/APPLaunch/main/hal/sdl/hal_settings_sdl.cpp +++ b/projects/APPLaunch/main/hal/sdl/hal_settings_sdl.cpp @@ -53,6 +53,8 @@ int hal_wifi_connect(const char *ssid, const char *password) (void)ssid; (void)password; return 0; } +int hal_wifi_disconnect(void) { return 0; } + hal_bt_status_t hal_bt_get_status(void) { hal_bt_status_t st;