v3.1.5: ACT_Save nach SetDefaultAccount (Soft-Reboot verlor die Einstellung), Admin-Prüfung stellt act auf den MBMNET-Platz und zeigt beide IDs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6375cd5b00
commit
39ed683c95
@@ -17,7 +17,7 @@ SOURCES := source
|
||||
INCLUDES := source
|
||||
|
||||
# Bei jedem Release erhöhen - das Auto-Update vergleicht diese Nummer
|
||||
VERSION := 3.1.4
|
||||
VERSION := 3.1.5
|
||||
|
||||
APP_TITLE := MBMNET
|
||||
APP_DESCRIPTION := Dein eigenes 3DS-Netzwerk
|
||||
|
||||
+20
-7
@@ -15,9 +15,10 @@
|
||||
|
||||
static volatile bool isAdmin;
|
||||
static char server[64];
|
||||
static char why[96] = "Werkzeuge: kein MBMNET-Konto angemeldet."; // warum (noch) keine Werkzeuge
|
||||
static char why[160] = "Werkzeuge: kein MBMNET-Konto angemeldet."; // warum (noch) keine Werkzeuge
|
||||
static Result lastAct; // letzter Fehler von act (für die Wiederholung)
|
||||
static bool wanted; // MBMNET-Konto angemeldet: prüfen
|
||||
static u8 mbmnetSlot; // Konto-Platz des MBMNET-Kontos (act)
|
||||
|
||||
// Liest die Tokens des angemeldeten Kontos aus dem Konto-Dienst (lokal, ohne Server-Anfrage von act) und lässt
|
||||
// sie vom MBMNET-Server prüfen. Die Tokens hat dieser Server beim Anmelden ausgestellt, er kann sie selbst prüfen.
|
||||
@@ -52,9 +53,20 @@ static Result login(u8 slot)
|
||||
static void check_once(void)
|
||||
{
|
||||
lastAct = 0;
|
||||
u8 slot = 0;
|
||||
ACT_GetCommonInfo(&slot, sizeof(slot), INFO_TYPE_COMMON_CURRENT_ACCOUNT_SLOT);
|
||||
if (!slot) ACT_GetCommonInfo(&slot, sizeof(slot), INFO_TYPE_COMMON_DEFAULT_ACCOUNT_SLOT);
|
||||
u8 current = 0, slot = mbmnetSlot;
|
||||
ACT_GetCommonInfo(¤t, sizeof(current), INFO_TYPE_COMMON_CURRENT_ACCOUNT_SLOT);
|
||||
if (!slot) slot = current;
|
||||
// act steht auf einem anderen Platz (z. B. Pretendo nach einem Soft-Reboot): auf den MBMNET-Platz stellen
|
||||
Result rs = 0;
|
||||
if (slot && current != slot) {
|
||||
snprintf(why, sizeof(why), "Werkzeuge: stelle Konto-Dienst auf Platz %u (war %u) ...", slot, current);
|
||||
ACTA_UnloadConsoleAccount();
|
||||
rs = ACTA_SetDefaultAccount(slot);
|
||||
if (R_SUCCEEDED(rs)) ACT_Save();
|
||||
}
|
||||
AccountId idHere = { 0 }, idCur = { 0 };
|
||||
ACT_GetAccountInfo(idHere, sizeof(idHere), slot, INFO_TYPE_ACCOUNT_ID);
|
||||
if (current && current != slot) ACT_GetAccountInfo(idCur, sizeof(idCur), current, INFO_TYPE_ACCOUNT_ID);
|
||||
static AccountAccessToken at;
|
||||
// 1. direkt lesen; 2. sonst Konto laden (falls nach dem Umschalten nicht geladen); 3. sonst einloggen
|
||||
// Fortschritt in "why": SELECT zeigt, bei welchem Schritt es gerade ist (oder hängt)
|
||||
@@ -69,8 +81,8 @@ static void check_once(void)
|
||||
}
|
||||
if (!at.accessToken[0] && !at.refreshToken[0]) {
|
||||
lastAct = R_FAILED(r4) ? r4 : r1;
|
||||
snprintf(why, sizeof(why), "Werkzeuge: Konto nicht eingeloggt.\nPlatz %u L %08lX A %08lX T %08lX/%08lX",
|
||||
slot, (unsigned long)r2, (unsigned long)r3, (unsigned long)r1, (unsigned long)r4);
|
||||
snprintf(why, sizeof(why), "Werkzeuge: Konto \"%s\" (Platz %u%s%s) nicht eingeloggt.\nL %08lX A %08lX T %08lX/%08lX",
|
||||
idHere, slot, idCur[0] ? ", act war auf " : "", idCur, (unsigned long)r2, (unsigned long)r3, (unsigned long)r1, (unsigned long)r4);
|
||||
return;
|
||||
}
|
||||
static char tokens[0x50];
|
||||
@@ -98,8 +110,9 @@ void admin_progress(const char *step) { if (wanted && !isAdmin && !checked) snpr
|
||||
|
||||
void admin_skipped(void) { if (wanted && !isAdmin) snprintf(why, sizeof(why), "Werkzeuge: Prüfung ausgefallen (umgeschaltet). App neu öffnen."); }
|
||||
|
||||
void admin_prepare(const char *srv, bool mbmnetLoggedIn)
|
||||
void admin_prepare(const char *srv, bool mbmnetLoggedIn, u8 slot)
|
||||
{
|
||||
mbmnetSlot = slot;
|
||||
isAdmin = false;
|
||||
wanted = mbmnetLoggedIn;
|
||||
snprintf(why, sizeof(why), mbmnetLoggedIn ? "Werkzeuge: Server prüft noch ..."
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
// Prüft, ob das angemeldete MBMNET-Konto Admin ist (signierter Anmelde-Nachweis, per HTTPS vom Server bestätigt,
|
||||
// siehe admin.c). admin_prepare beim Start; mbmnetLoggedIn = false: keine Werkzeuge.
|
||||
void admin_prepare(const char *server, bool mbmnetLoggedIn);
|
||||
void admin_prepare(const char *server, bool mbmnetLoggedIn, u8 mbmnetSlot);
|
||||
// Die eigentliche Prüfung (blockiert, im Hintergrund-Thread aufrufen, nicht gleichzeitig mit anderen act-Anfragen)
|
||||
void admin_check(void);
|
||||
// Prüfung fiel aus (es wurde umgeschaltet)
|
||||
|
||||
+5
-1
@@ -139,7 +139,11 @@ static Result use_act_slot(u8 friendAccount, u32 *slotOut, bool *created)
|
||||
}
|
||||
if (logf) fprintf(logf, " -> Konto-Platz %lu\n", (unsigned long)slot);
|
||||
*slotOut = slot;
|
||||
return step("Standard-Konto setzen", ACTA_SetDefaultAccount(slot));
|
||||
rc = step("Standard-Konto setzen", ACTA_SetDefaultAccount(slot));
|
||||
// Ausdrücklich speichern: Beim Soft-Reboot (seit v2.9.8) ging die Einstellung sonst verloren, dann stand
|
||||
// act nach dem Neustart noch auf dem alten Platz (z. B. Pretendo) und meldete sich damit bei MBMNET an.
|
||||
if (R_SUCCEEDED(rc)) note("Konto-Einstellungen speichern", ACT_Save());
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool frdswitch_to(u8 target, bool *created, char *msg, size_t msglen)
|
||||
|
||||
+3
-1
@@ -653,7 +653,9 @@ int main(int argc, char **argv)
|
||||
// Das geht nur, solange das MBMNET-Konto angemeldet ist (MBMNET aktiv, ID verknüpft).
|
||||
{
|
||||
char mid[20];
|
||||
admin_prepare(server, st == STATE_MBMNET && frdswitch_current() == FRIEND_ACCOUNT_MBMNET && nnid_linked(mid, sizeof(mid)));
|
||||
u8 mslot = frdswitch_slot_of(FRIEND_ACCOUNT_MBMNET);
|
||||
admin_prepare(server, st == STATE_MBMNET && frdswitch_current() == FRIEND_ACCOUNT_MBMNET && mslot
|
||||
&& frdswitch_slot_linked(FRIEND_ACCOUNT_MBMNET, mid, sizeof(mid)), mslot);
|
||||
}
|
||||
// Ein SpotPass-Test von früher (App mitten im Test verlassen) darf nicht weiterlaufen
|
||||
spotpass_test_cancel();
|
||||
|
||||
Reference in New Issue
Block a user