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
+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 ..."
|
||||
|
||||
Reference in New Issue
Block a user