v2.9.2: Auffrischen beim Start im Hintergrund (App sofort bedienbar)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1f69ff6c56
commit
43b135f1f6
+36
-11
@@ -269,6 +269,23 @@ static void draw_bottom(int selected, PatchState st, bool admin)
|
||||
#define UNLINKED_MARKER "sdmc:/3ds/mbmnet/nnid-geloest"
|
||||
static bool old_mbmnet_link(void) { FILE *f = fopen(UNLINKED_MARKER, "r"); if (f) fclose(f); return f != NULL; }
|
||||
|
||||
// Auffrischen beim Start (SpotPass anmelden, Patches neu bauen) läuft im Hintergrund: Dabei holt die App
|
||||
// das Miiverse-Zertifikat vom Server, und solange das WLAN noch verbindet, dauert das Sekunden.
|
||||
static volatile bool maintaining;
|
||||
static volatile bool maintenanceChanged;
|
||||
static Thread maintenanceThread;
|
||||
|
||||
static void maintenance_worker(void *arg)
|
||||
{
|
||||
(void)arg;
|
||||
char ignore[96], detail[160];
|
||||
spotpass_register(MBMNET_SERVER, ignore, sizeof(ignore));
|
||||
bool changed = false;
|
||||
// Patches auffrischen: neue Versionen bringen neue Ziele mit (z. B. Miiverse ab v2.8.0)
|
||||
if (patch_enable(MBMNET_SERVER, &changed, detail, sizeof(detail)) && changed) maintenanceChanged = true;
|
||||
maintaining = false;
|
||||
}
|
||||
|
||||
static int armed = -1; // Sicherheitsabfrage (zweimal antippen)
|
||||
static bool launchShop; // Sprung in den MBMNET Shop vorbereitet: App beenden
|
||||
|
||||
@@ -507,16 +524,13 @@ int main(int argc, char **argv)
|
||||
snprintf(msg, sizeof(msg), "Dein MBMNET-Freundekonto hat eine fremde Kennung (%lu).\n"
|
||||
"Tippe auf MBMNET, um es neu anzulegen.", (unsigned long)pid);
|
||||
}
|
||||
// Mitteilungen per SpotPass: bei aktivem MBMNET die Hintergrund-Aufgabe (neu) anmelden
|
||||
// Bei aktivem MBMNET: SpotPass-Aufgabe (neu) anmelden und Patches auffrischen - im Hintergrund
|
||||
if (st == STATE_MBMNET) {
|
||||
char ignore[96];
|
||||
spotpass_register(server, ignore, sizeof(ignore));
|
||||
// Patches auffrischen: neue Versionen bringen neue Ziele mit (z. B. Miiverse ab v2.8.0)
|
||||
bool changed = false;
|
||||
char detail[160];
|
||||
if (patch_enable(server, &changed, detail, sizeof(detail)) && changed && !msg[0])
|
||||
snprintf(msg, sizeof(msg), "Neue MBMNET-Patches (Miiverse) geschrieben.\n"
|
||||
"Bitte den 3DS einmal neu starten (Werkzeuge: Neustart).");
|
||||
maintaining = true;
|
||||
s32 prio = 0x30;
|
||||
svcGetThreadPriority(&prio, CUR_THREAD_HANDLE);
|
||||
maintenanceThread = threadCreate(maintenance_worker, NULL, 64 * 1024, prio + 1, -2, false);
|
||||
if (!maintenanceThread) maintaining = false;
|
||||
}
|
||||
// Das Hintergrund-Modul ist abgeschaltet (Kernel-Absturz): Reste wegräumen, nie wieder starten
|
||||
ftpctl_cleanup_module();
|
||||
@@ -559,12 +573,22 @@ int main(int argc, char **argv)
|
||||
for (int i = 0; i < BTN_COUNT; i++)
|
||||
if (visible(i, admin) && inside(box_of(i, admin), tp)) selected = action = i;
|
||||
}
|
||||
if (queued >= 0) {
|
||||
// Auffrischen fertig
|
||||
if (maintenanceChanged && !maintaining) {
|
||||
maintenanceChanged = false;
|
||||
if (!msg[0])
|
||||
snprintf(msg, sizeof(msg), "Neue MBMNET-Patches (Miiverse) geschrieben.\n"
|
||||
"Bitte den 3DS einmal neu starten (Werkzeuge: Neustart).");
|
||||
}
|
||||
// Umschalten & Co. warten, bis das Auffrischen im Hintergrund durch ist (meist nur einen Moment)
|
||||
bool waitForMaintenance = maintaining && queued >= 0 && queued != BTN_FTP && queued != BTN_SPOTPASS
|
||||
&& queued != BTN_SHOP && queued != BTN_SHOP_DEL;
|
||||
if (queued >= 0 && !waitForMaintenance) {
|
||||
int a = queued;
|
||||
queued = -1;
|
||||
if (run(a, msg, sizeof(msg))) rebootIn = 45; // ca. 0,75 Sekunden zum Lesen
|
||||
st = patch_state();
|
||||
} else if (action >= 0 && rebootIn == 0) {
|
||||
} else if (action >= 0 && rebootIn == 0 && queued < 0) {
|
||||
queued = action;
|
||||
snprintf(msg, sizeof(msg), action <= BTN_DISABLE ? "Schalte um ..." : "Einen Moment ...");
|
||||
}
|
||||
@@ -626,6 +650,7 @@ int main(int argc, char **argv)
|
||||
|
||||
ftpctl_stop(NULL, 0);
|
||||
shopctl_exit();
|
||||
if (maintenanceThread) { threadJoin(maintenanceThread, U64_MAX); threadFree(maintenanceThread); }
|
||||
admin_finish();
|
||||
update_finish();
|
||||
frdswitch_exit();
|
||||
|
||||
Reference in New Issue
Block a user