From 2cb78030be72e85cbd4ef9eb8f83d6cf39418874 Mon Sep 17 00:00:00 2001 From: Yuuki Hikari Date: Mon, 11 Jun 2018 19:44:19 -0400 Subject: [PATCH] Get local IP address on Switch correctly (#1) --- source/ftp.c | 2 +- source/main.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/ftp.c b/source/ftp.c index c709672..4f35c38 100644 --- a/source/ftp.c +++ b/source/ftp.c @@ -2020,7 +2020,7 @@ ftp_init(void) /* get address to listen on */ serv_addr.sin_family = AF_INET; -#ifdef _3DS +#if defined(_3DS) || defined(SWITCH) serv_addr.sin_addr.s_addr = gethostid(); serv_addr.sin_port = htons(LISTEN_PORT); #else diff --git a/source/main.c b/source/main.c index 27b887f..cd1421a 100644 --- a/source/main.c +++ b/source/main.c @@ -105,8 +105,10 @@ main(int argc, gfxInitDefault(); gfxSet3D(false); sdmcWriteSafe(false); -#elif defined(__SWITCH__) +#elif defined(SWITCH) + /* initialize needed Switch services */ //gfxInitResolution(644, 480); + nifmInitialize(); gfxInitDefault(); #endif @@ -176,6 +178,7 @@ log_fail: /* deinitialize Switch services */ gfxExit(); + nifmExit(); #endif return 0; }