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
@@ -17,7 +17,7 @@ SOURCES := source
|
|||||||
INCLUDES := source
|
INCLUDES := source
|
||||||
|
|
||||||
# Bei jedem Release erhöhen - das Auto-Update vergleicht diese Nummer
|
# Bei jedem Release erhöhen - das Auto-Update vergleicht diese Nummer
|
||||||
VERSION := 2.9.1
|
VERSION := 2.9.2
|
||||||
|
|
||||||
APP_TITLE := MBMNET
|
APP_TITLE := MBMNET
|
||||||
APP_DESCRIPTION := Dein eigenes 3DS-Netzwerk (v$(VERSION))
|
APP_DESCRIPTION := Dein eigenes 3DS-Netzwerk (v$(VERSION))
|
||||||
|
|||||||
+36
-11
@@ -269,6 +269,23 @@ static void draw_bottom(int selected, PatchState st, bool admin)
|
|||||||
#define UNLINKED_MARKER "sdmc:/3ds/mbmnet/nnid-geloest"
|
#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; }
|
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 int armed = -1; // Sicherheitsabfrage (zweimal antippen)
|
||||||
static bool launchShop; // Sprung in den MBMNET Shop vorbereitet: App beenden
|
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"
|
snprintf(msg, sizeof(msg), "Dein MBMNET-Freundekonto hat eine fremde Kennung (%lu).\n"
|
||||||
"Tippe auf MBMNET, um es neu anzulegen.", (unsigned long)pid);
|
"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) {
|
if (st == STATE_MBMNET) {
|
||||||
char ignore[96];
|
maintaining = true;
|
||||||
spotpass_register(server, ignore, sizeof(ignore));
|
s32 prio = 0x30;
|
||||||
// Patches auffrischen: neue Versionen bringen neue Ziele mit (z. B. Miiverse ab v2.8.0)
|
svcGetThreadPriority(&prio, CUR_THREAD_HANDLE);
|
||||||
bool changed = false;
|
maintenanceThread = threadCreate(maintenance_worker, NULL, 64 * 1024, prio + 1, -2, false);
|
||||||
char detail[160];
|
if (!maintenanceThread) maintaining = false;
|
||||||
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).");
|
|
||||||
}
|
}
|
||||||
// Das Hintergrund-Modul ist abgeschaltet (Kernel-Absturz): Reste wegräumen, nie wieder starten
|
// Das Hintergrund-Modul ist abgeschaltet (Kernel-Absturz): Reste wegräumen, nie wieder starten
|
||||||
ftpctl_cleanup_module();
|
ftpctl_cleanup_module();
|
||||||
@@ -559,12 +573,22 @@ int main(int argc, char **argv)
|
|||||||
for (int i = 0; i < BTN_COUNT; i++)
|
for (int i = 0; i < BTN_COUNT; i++)
|
||||||
if (visible(i, admin) && inside(box_of(i, admin), tp)) selected = action = 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;
|
int a = queued;
|
||||||
queued = -1;
|
queued = -1;
|
||||||
if (run(a, msg, sizeof(msg))) rebootIn = 45; // ca. 0,75 Sekunden zum Lesen
|
if (run(a, msg, sizeof(msg))) rebootIn = 45; // ca. 0,75 Sekunden zum Lesen
|
||||||
st = patch_state();
|
st = patch_state();
|
||||||
} else if (action >= 0 && rebootIn == 0) {
|
} else if (action >= 0 && rebootIn == 0 && queued < 0) {
|
||||||
queued = action;
|
queued = action;
|
||||||
snprintf(msg, sizeof(msg), action <= BTN_DISABLE ? "Schalte um ..." : "Einen Moment ...");
|
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);
|
ftpctl_stop(NULL, 0);
|
||||||
shopctl_exit();
|
shopctl_exit();
|
||||||
|
if (maintenanceThread) { threadJoin(maintenanceThread, U64_MAX); threadFree(maintenanceThread); }
|
||||||
admin_finish();
|
admin_finish();
|
||||||
update_finish();
|
update_finish();
|
||||||
frdswitch_exit();
|
frdswitch_exit();
|
||||||
|
|||||||
Reference in New Issue
Block a user