From d1fba48c6f85643ab48d51e1d10e35de3997adc2 Mon Sep 17 00:00:00 2001 From: Nico Meister Date: Mon, 26 Oct 2026 21:20:41 +0100 Subject: [PATCH] =?UTF-8?q?v3.1.3:=20Admin-Pr=C3=BCfung=20zuerst=20(unabh?= =?UTF-8?q?=C3=A4ngig=20von=20den=20Patches),=20SELECT=20zeigt=20den=20Auf?= =?UTF-8?q?frischen-Schritt=20(welches=20Modul)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- Makefile | 2 +- source/admin.c | 4 +++- source/main.c | 23 +++++++++++++++-------- source/patcher.c | 11 +++++++++++ source/patcher.h | 2 ++ 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index cdd7421..fbeb57c 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ SOURCES := source INCLUDES := source # Bei jedem Release erhöhen - das Auto-Update vergleicht diese Nummer -VERSION := 3.1.2 +VERSION := 3.1.3 APP_TITLE := MBMNET APP_DESCRIPTION := Dein eigenes 3DS-Netzwerk diff --git a/source/admin.c b/source/admin.c index 5ca3288..cc3eff2 100644 --- a/source/admin.c +++ b/source/admin.c @@ -88,7 +88,8 @@ static void check_once(void) const char *admin_why(void) { return why; } -void admin_progress(const char *step) { if (wanted && !isAdmin) snprintf(why, sizeof(why), "Werkzeuge: warte auf %s ...", step); } +static bool checked; // Prüfung gelaufen: Ergebnis/Fehler in "why" nicht mehr überschreiben +void admin_progress(const char *step) { if (wanted && !isAdmin && !checked) snprintf(why, sizeof(why), "Werkzeuge: warte auf %s ...", step); } void admin_skipped(void) { if (wanted && !isAdmin) snprintf(why, sizeof(why), "Werkzeuge: Prüfung ausgefallen (umgeschaltet). App neu öffnen."); } @@ -105,6 +106,7 @@ void admin_prepare(const char *srv, bool mbmnetLoggedIn) void admin_check(void) { if (!wanted) return; + checked = true; // act noch mit etwas anderem beschäftigt ("ungültiger Zustand"): kurz warten und noch einmal for (int attempt = 0; attempt < 2; attempt++) { check_once(); diff --git a/source/main.c b/source/main.c index d7eeaa8..e47b509 100644 --- a/source/main.c +++ b/source/main.c @@ -331,6 +331,10 @@ static bool begin_busy(void) return false; } +// Was das Auffrischen gerade macht (bei SELECT angezeigt, wenn es keine Werkzeuge gibt) +static char maintStep[64] = "startet"; +static void maint_step(const char *step) { snprintf(maintStep, sizeof(maintStep), "%s", step); } + static bool refresh_patches(void) { char detail[160]; @@ -347,15 +351,19 @@ static void maintenance_worker(void *arg) char ignore[96]; // 1. Patches auffrischen (Miiverse-CA aus dem Zwischenspeicher; nur beim allerersten Mal vom Server) bool hadCa = olvpatch_ca_cached(); - admin_progress("Patches"); + // 0. Admin? Zuerst, damit die Werkzeuge nicht vom Rest abhängen (act ist hier noch frei) + if (!switchRequested) admin_check(); + patch_progress = maint_step; + maint_step("Patches"); refresh_patches(); - admin_progress("SpotPass"); + patch_progress = NULL; + maint_step("SpotPass"); // 2. SpotPass-Aufgabe anmelden if (begin_busy()) { spotpass_register(MBMNET_SERVER, ignore, sizeof(ignore)); maintenanceBusy = false; } - admin_progress("Konto-Abgleich"); + maint_step("Konto-Abgleich"); // 3. Konto mit dem MBMNET-Server abgleichen (holt u. a. den Mii von der Webseite). Höchstens 5 s, // bei einem Umschalt-Wunsch sofort abbrechen. u8 slot = frdswitch_slot_of(FRIEND_ACCOUNT_MBMNET); @@ -372,14 +380,13 @@ static void maintenance_worker(void *arg) svcCloseHandle(done); } maintenanceBusy = false; - // 3b. Admin? (braucht act - deshalb erst nach dem Konto-Abgleich, nie gleichzeitig). Hält das Umschalten - // nicht auf: Tippt man vorher, fällt die Prüfung aus (nach dem Neustart gibt es eine neue). - if (!switchRequested) admin_check(); - else admin_skipped(); + // 4. Miiverse-CA frisch vom Server (nur Netz; Patches nur neu bauen, wenn sie sich geändert hat) bool caChanged = false; + maint_step("Miiverse-Zertifikat"); if (!switchRequested && olvpatch_refresh_ca(MBMNET_SERVER, &caChanged) && caChanged && hadCa) refresh_patches(); // prüft selbst noch einmal, ob umgeschaltet werden soll + maint_step("fertig"); maintaining = false; } @@ -690,7 +697,7 @@ int main(int argc, char **argv) } bool wasTools = toolsToggled; if (down & KEY_SELECT && admin_is()) toolsToggled = !toolsToggled; - else if (down & KEY_SELECT) snprintf(msg, sizeof(msg), "%s", admin_why()); + else if (down & KEY_SELECT) snprintf(msg, sizeof(msg), "%s\n(Auffrischen: %s)", admin_why(), maintStep); if (down & KEY_B && toolsToggled) toolsToggled = false; if (!admin_is()) toolsToggled = false; // Werkzeuge nur für Admins (Server hat es bestätigt) // Werkzeuge nur mit SELECT, beim Öffnen immer aus diff --git a/source/patcher.c b/source/patcher.c index 98ff2bb..0b12d95 100644 --- a/source/patcher.c +++ b/source/patcher.c @@ -523,6 +523,15 @@ static void remove_splash(void) // --- Aktivieren / Deaktivieren ----------------------------------------------- +void (*patch_progress)(const char *step); +static void progress(const char *what, const Target *t) +{ + if (!patch_progress) return; + char line[64]; + snprintf(line, sizeof(line), "%s %s-Modul", what, t->label); + patch_progress(line); +} + bool patch_enable(const char *server, bool *changed, char *msg, size_t msglen) { *changed = false; @@ -538,6 +547,7 @@ bool patch_enable(const char *server, bool *changed, char *msg, size_t msglen) static u8 ips[TARGET_COUNT][IPS_CAP]; u32 ipsLen[TARGET_COUNT]; for (size_t i = 0; i < TARGET_COUNT; i++) { + progress("Patches:", &targets[i]); if (targets[i].optional) { // Miiverse ipsLen[i] = build_miiverse(&targets[i], server, ips[i], IPS_CAP); continue; @@ -547,6 +557,7 @@ bool patch_enable(const char *server, bool *changed, char *msg, size_t msglen) ipsLen[i] = cache_load(&targets[i], key, ips[i], IPS_CAP); if (ipsLen[i]) continue; static Patch patch; + progress("Patches: lese", &targets[i]); if (!build_patch(&targets[i], server, &patch, msg, msglen)) { if (targets[i].optional || targets[i].soft) { ipsLen[i] = 0; msg[0] = 0; continue; } // auslassen return false; diff --git a/source/patcher.h b/source/patcher.h index f405f2e..e7ef683 100644 --- a/source/patcher.h +++ b/source/patcher.h @@ -22,6 +22,8 @@ bool patch_migrate(void); // Erzeugt die Patches (Freunde + Konto) und aktiviert MBMNET. msg bekommt eine lesbare Meldung. // *changed: true, wenn sich Patch-Dateien geändert haben (dann ist ein Neustart nötig). bool patch_enable(const char *server, bool *changed, char *msg, size_t msglen); +// Wird bei jedem Schritt von patch_enable mit einer kurzen Beschreibung aufgerufen (Anzeige, Fehlersuche) +extern void (*patch_progress)(const char *step); // Schreibt alle Adress-Texte aus den Modulen nach DIAG_FILE (zur Fehlersuche). bool patch_diagnose(char *msg, size_t msglen); // Entfernt unsere Patches und stellt eventuell gesicherte fremde Patches wieder her.