diff --git a/src/Game.h b/src/Game.h index db22d993a..6001cac5b 100644 --- a/src/Game.h +++ b/src/Game.h @@ -22,12 +22,14 @@ extern struct RayTracer Game_SelectedPos; extern cc_bool Game_UseCPEBlocks; extern cc_string Game_Username; -extern cc_string Game_Mppass; +extern cc_string Game_Mppass; -#ifdef CC_BUILD_N64 -#define DEFAULT_VIEWDIST 20 +#if defined CC_BUILD_N64 + #define DEFAULT_VIEWDIST 20 +#elif defined CC_BUILD_NDS + #define DEFAULT_VIEWDIST 192 #else -#define DEFAULT_VIEWDIST 512 + #define DEFAULT_VIEWDIST 512 #endif #define DEFAULT_MAX_VIEWDIST 32768 diff --git a/src/Graphics_NDS.c b/src/Graphics_NDS.c index c08db81fa..fbaf1de6a 100644 --- a/src/Graphics_NDS.c +++ b/src/Graphics_NDS.c @@ -187,7 +187,7 @@ static void Gfx_RestoreState(void) { InitDefaultResources(); } -cc_bool Gfx_WarnIfNecessary(void) { return false; } +cc_bool Gfx_WarnIfNecessary(void) { return true; } /*########################################################################################################################* diff --git a/src/Platform_NDS.c b/src/Platform_NDS.c index 549f72e63..2cf346efb 100644 --- a/src/Platform_NDS.c +++ b/src/Platform_NDS.c @@ -365,15 +365,32 @@ cc_result Socket_CheckWritable(cc_socket s, cc_bool* writable) { return res; } +static void InitNetworking(void) { + if (!Wifi_InitDefault(INIT_ONLY)) { + Platform_LogConst("Initing WIFI failed"); return; + } + Wifi_AutoConnect(); + + for (int i = 0; i < 300; i++) + { + int status = Wifi_AssocStatus(); + if (status == ASSOCSTATUS_ASSOCIATED) return; + + if (status == ASSOCSTATUS_CANNOTCONNECT) { + Platform_LogConst("Can't connect to WIFI"); return; + } + swiWaitForVBlank(); + } + Platform_LogConst("Gave up after 300 tries"); +} + /*########################################################################################################################* *--------------------------------------------------------Platform---------------------------------------------------------* *#########################################################################################################################*/ void Platform_Init(void) { InitFilesystem(); - if (!Wifi_InitDefault(WFC_CONNECT)) { - Platform_LogConst("Can't connect to WIFI"); - } + InitNetworking(); cpuStartTiming(1); // TODO: Redesign Drawer2D to better handle this