Skip to content

Commit

Permalink
rosalina: display SSID in force-wifi-connection menu
Browse files Browse the repository at this point in the history
  • Loading branch information
TuxSH committed Sep 16, 2023
1 parent 6a2e1d4 commit 3b64e25
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions sysmodules/rosalina/source/menus/sysconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -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};
isConnectionForced = false;
Expand Down Expand Up @@ -183,7 +183,7 @@ static bool SysConfigMenu_ForceWifiConnection(int slot)
if(forcedConnection)
sprintf(infoString, "Succesfully forced a connection to: %s", ssid);
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_ClearFramebuffer();
Expand Down Expand Up @@ -258,16 +258,30 @@ void SysConfigMenu_ControlWifi(void)
Draw_FlushFramebuffer();
Draw_Unlock();

int slot = 0;
char slotString[12] = {0};
sprintf(slotString, ">1< 2 3 ");
u32 slot = 0;
char ssids[3][32] = {{0}};

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
{
Draw_Lock();
Draw_DrawString(10, 10, COLOR_TITLE, "System configuration menu");
Draw_DrawString(10, 30, COLOR_WHITE, "Press A to force a connection to slot:");
Draw_DrawString(10, 40, COLOR_WHITE, slotString);
Draw_DrawString(10, 60, COLOR_WHITE, "Press B to go back.");
u32 posY = Draw_DrawString(10, 30, COLOR_WHITE, "Press A to force a connection to slot, B to go back\n\n");

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_Unlock();
Expand All @@ -287,25 +301,13 @@ void SysConfigMenu_ControlWifi(void)
Draw_FlushFramebuffer();
Draw_Unlock();
}
else if(pressed & KEY_LEFT)
else if(pressed & KEY_DOWN)
{
slotString[slot * 4] = ' ';
slotString[(slot * 4) + 2] = ' ';
slot--;
if(slot == -1)
slot = 2;
slotString[slot * 4] = '>';
slotString[(slot * 4) + 2] = '<';
slot = (slot + 1) % 3;
}
else if(pressed & KEY_RIGHT)
else if(pressed & KEY_UP)
{
slotString[slot * 4] = ' ';
slotString[(slot * 4) + 2] = ' ';
slot++;
if(slot == 3)
slot = 0;
slotString[slot * 4] = '>';
slotString[(slot * 4) + 2] = '<';
slot = (3 + slot - 1) % 3;
}
else if(pressed & KEY_B)
return;
Expand Down

0 comments on commit 3b64e25

Please sign in to comment.