Wait for wifi on start

This commit is contained in:
Michael Theall 2016-01-16 00:22:26 -06:00
parent 74c7e00f14
commit 2ff33ca398
2 changed files with 30 additions and 1 deletions

View File

@ -1065,7 +1065,34 @@ ftp_init(void)
int rc; int rc;
#ifdef _3DS #ifdef _3DS
Result ret; Result ret = 0;
u32 wifi = 0;
bool loop;
console_print(GREEN "Waiting for wifi...\n" RESET);
/* wait for wifi to be available */
while((loop = aptMainLoop()) && !wifi && (ret == 0 || ret == 0xE0A09D2E))
{
hidScanInput();
if(hidKeysDown() & KEY_B)
{
loop = false;
break;
}
ret = ACU_GetWifiStatus(&wifi);
if(ret != 0)
wifi = 0;
}
if(ret != 0)
console_print(RED "ACU_GetWifiStatus returns 0x%lx\n" RESET, ret);
if(!loop || ret != 0)
return -1;
console_print(GREEN "Ready!\n" RESET);
#if ENABLE_LOGGING #if ENABLE_LOGGING
/* open log file */ /* open log file */

View File

@ -63,6 +63,7 @@ main(int argc,
{ {
#ifdef _3DS #ifdef _3DS
/* initialize needed 3DS services */ /* initialize needed 3DS services */
acInit();
gfxInitDefault(); gfxInitDefault();
gfxSet3D(false); gfxSet3D(false);
sdmcWriteSafe(false); sdmcWriteSafe(false);
@ -88,6 +89,7 @@ main(int argc,
#ifdef _3DS #ifdef _3DS
/* deinitialize 3DS services */ /* deinitialize 3DS services */
gfxExit(); gfxExit();
acExit();
#endif #endif
return 0; return 0;