rosalina: display SSID in force-wifi-connection menu

This commit is contained in:
TuxSH 2023-09-16 21:30:23 +02:00
parent 6a2e1d4aa3
commit 3b64e25402

View File

@ -145,7 +145,7 @@ void SysConfigMenu_UpdateStatus(bool control)
} }
} }
static bool SysConfigMenu_ForceWifiConnection(int slot) static bool SysConfigMenu_ForceWifiConnection(u32 slot)
{ {
char ssid[0x20 + 1] = {0}; char ssid[0x20 + 1] = {0};
isConnectionForced = false; isConnectionForced = false;
@ -183,7 +183,7 @@ static bool SysConfigMenu_ForceWifiConnection(int slot)
if(forcedConnection) if(forcedConnection)
sprintf(infoString, "Succesfully forced a connection to: %s", ssid); sprintf(infoString, "Succesfully forced a connection to: %s", ssid);
else else
sprintf(infoString, "Failed to connect to slot %d", slot + 1); sprintf(infoString, "Failed to connect to slot %d", (int)slot + 1);
Draw_Lock(); Draw_Lock();
Draw_ClearFramebuffer(); Draw_ClearFramebuffer();
@ -258,16 +258,30 @@ void SysConfigMenu_ControlWifi(void)
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
int slot = 0; u32 slot = 0;
char slotString[12] = {0}; char ssids[3][32] = {{0}};
sprintf(slotString, ">1< 2 3 ");
Result resInit = acInit();
for (u32 i = 0; i < 3; i++)
{
// ssid[0] = '\0' if result is an error here
ACI_LoadNetworkSetting(i);
ACI_GetNetworkWirelessEssidSecuritySsid(ssids[i]);
}
if (R_SUCCEEDED(resInit))
acExit();
do do
{ {
Draw_Lock(); Draw_Lock();
Draw_DrawString(10, 10, COLOR_TITLE, "System configuration menu"); Draw_DrawString(10, 10, COLOR_TITLE, "System configuration menu");
Draw_DrawString(10, 30, COLOR_WHITE, "Press A to force a connection to slot:"); u32 posY = Draw_DrawString(10, 30, COLOR_WHITE, "Press A to force a connection to slot, B to go back\n\n");
Draw_DrawString(10, 40, COLOR_WHITE, slotString);
Draw_DrawString(10, 60, COLOR_WHITE, "Press B to go back."); for (u32 i = 0; i < 3; i++)
{
Draw_DrawString(10, posY + SPACING_Y * i, COLOR_TITLE, slot == i ? ">" : " ");
Draw_DrawFormattedString(30, posY + SPACING_Y * i, COLOR_WHITE, "[%d] %s", (int)i + 1, ssids[i]);
}
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
@ -287,25 +301,13 @@ void SysConfigMenu_ControlWifi(void)
Draw_FlushFramebuffer(); Draw_FlushFramebuffer();
Draw_Unlock(); Draw_Unlock();
} }
else if(pressed & KEY_LEFT) else if(pressed & KEY_DOWN)
{ {
slotString[slot * 4] = ' '; slot = (slot + 1) % 3;
slotString[(slot * 4) + 2] = ' ';
slot--;
if(slot == -1)
slot = 2;
slotString[slot * 4] = '>';
slotString[(slot * 4) + 2] = '<';
} }
else if(pressed & KEY_RIGHT) else if(pressed & KEY_UP)
{ {
slotString[slot * 4] = ' '; slot = (3 + slot - 1) % 3;
slotString[(slot * 4) + 2] = ' ';
slot++;
if(slot == 3)
slot = 0;
slotString[slot * 4] = '>';
slotString[(slot * 4) + 2] = '<';
} }
else if(pressed & KEY_B) else if(pressed & KEY_B)
return; return;