This commit is contained in:
TuxSH 2018-02-02 21:14:57 +01:00 committed by mtheall
parent 7e00ed2054
commit 8b13550b72
4 changed files with 20 additions and 20 deletions

View File

@ -45,7 +45,7 @@ CFLAGS := -g -Wall -O2 \
-ffast-math \ -ffast-math \
$(ARCH) $(DEFINES) $(ARCH) $(DEFINES)
CFLAGS += $(INCLUDE) -DSWITCH -D_SWITCH -DSTATUS_STRING="\"ftpd v$(VERSION)\"" CFLAGS += $(INCLUDE) -DSWITCH -DSTATUS_STRING="\"ftpd v$(VERSION)\""
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11

View File

@ -192,7 +192,7 @@ console_render(void)
gfxSwapBuffers(); gfxSwapBuffers();
} }
#elif defined(_SWITCH) #elif defined(SWITCH)
#include <switch.h> #include <switch.h>
static PrintConsole status_console; static PrintConsole status_console;

View File

@ -26,7 +26,7 @@
#ifdef _3DS #ifdef _3DS
#include <3ds.h> #include <3ds.h>
#define lstat stat #define lstat stat
#elif defined(_SWITCH) #elif defined(SWITCH)
#include <switch.h> #include <switch.h>
#define lstat stat #define lstat stat
#else #else
@ -255,7 +255,7 @@ static bool lcd_power = true;
/*! aptHook cookie */ /*! aptHook cookie */
static aptHookCookie cookie; static aptHookCookie cookie;
#elif defined(_SWITCH) #elif defined(SWITCH)
/*! appletHook cookie */ /*! appletHook cookie */
static AppletHookCookie cookie; static AppletHookCookie cookie;
@ -737,7 +737,7 @@ ftp_session_fill_dirent_type(ftp_session_t *session, const struct stat *st,
type = "file"; type = "file";
else if(S_ISDIR(st->st_mode)) else if(S_ISDIR(st->st_mode))
type = "dir"; type = "dir";
#if !defined(_3DS) && !defined(_SWITCH) #if !defined(_3DS) && !defined(SWITCH)
else if(S_ISLNK(st->st_mode)) else if(S_ISLNK(st->st_mode))
type = "os.unix=symlink"; type = "os.unix=symlink";
else if(S_ISCHR(st->st_mode)) else if(S_ISCHR(st->st_mode))
@ -849,7 +849,7 @@ ftp_session_fill_dirent_type(ftp_session_t *session, const struct stat *st,
"%c%c%c%c%c%c%c%c%c%c %lu 3DS 3DS %lld ", "%c%c%c%c%c%c%c%c%c%c %lu 3DS 3DS %lld ",
S_ISREG(st->st_mode) ? '-' : S_ISREG(st->st_mode) ? '-' :
S_ISDIR(st->st_mode) ? 'd' : S_ISDIR(st->st_mode) ? 'd' :
#if !defined(_3DS) && !defined(_SWITCH) #if !defined(_3DS) && !defined(SWITCH)
S_ISLNK(st->st_mode) ? 'l' : S_ISLNK(st->st_mode) ? 'l' :
S_ISCHR(st->st_mode) ? 'c' : S_ISCHR(st->st_mode) ? 'c' :
S_ISBLK(st->st_mode) ? 'b' : S_ISBLK(st->st_mode) ? 'b' :
@ -1745,7 +1745,7 @@ ftp_session_poll(ftp_session_t *session)
static void static void
update_free_space(void) update_free_space(void)
{ {
#if defined(_3DS) || defined(_SWITCH) #if defined(_3DS) || defined(SWITCH)
#define KiB (1024.0) #define KiB (1024.0)
#define MiB (1024.0*KiB) #define MiB (1024.0*KiB)
#define GiB (1024.0*MiB) #define GiB (1024.0*MiB)
@ -1791,7 +1791,7 @@ update_free_space(void)
static int static int
update_status(void) update_status(void)
{ {
#if defined(_3DS) || defined(_SWITCH) #if defined(_3DS) || defined(SWITCH)
console_set_status("\n" GREEN STATUS_STRING " " console_set_status("\n" GREEN STATUS_STRING " "
#ifdef ENABLE_LOGGING #ifdef ENABLE_LOGGING
"DEBUG " "DEBUG "
@ -1870,7 +1870,7 @@ apt_hook(APT_HookType type,
break; break;
} }
} }
#elif defined(_SWITCH) #elif defined(SWITCH)
/*! Handle applet events /*! Handle applet events
* *
* @param[in] type Event type * @param[in] type Event type
@ -1951,7 +1951,7 @@ ftp_init(void)
console_print(RED "socInit: %08X\n" RESET, (unsigned int)ret); console_print(RED "socInit: %08X\n" RESET, (unsigned int)ret);
goto soc_fail; goto soc_fail;
} }
#elif defined(_SWITCH) #elif defined(SWITCH)
/* we have a lot of memory available so let's use c.a. 360MB */ /* we have a lot of memory available so let's use c.a. 360MB */
static const SocketInitConfig socketInitConfig = { static const SocketInitConfig socketInitConfig = {
.bsdsockets_version = 1, .bsdsockets_version = 1,
@ -2077,7 +2077,7 @@ ftp_exit(void)
console_print(RED "socExit: 0x%08X\n" RESET, (unsigned int)ret); console_print(RED "socExit: 0x%08X\n" RESET, (unsigned int)ret);
free(SOCU_buffer); free(SOCU_buffer);
} }
#elif defined(_SWITCH) #elif defined(SWITCH)
/* deinitialize socket driver */ /* deinitialize socket driver */
console_render(); console_render();
console_print(CYAN "Waiting for socketExit()...\n" RESET); console_print(CYAN "Waiting for socketExit()...\n" RESET);
@ -2146,7 +2146,7 @@ ftp_loop(void)
lcd_power = !lcd_power; lcd_power = !lcd_power;
apt_hook(APTHOOK_ONRESTORE, NULL); apt_hook(APTHOOK_ONRESTORE, NULL);
} }
#elif defined(_SWITCH) #elif defined(SWITCH)
/* check if the user wants to exit */ /* check if the user wants to exit */
hidScanInput(); hidScanInput();
u32 down = hidKeysDown(CONTROLLER_P1_AUTO); u32 down = hidKeysDown(CONTROLLER_P1_AUTO);
@ -3465,7 +3465,7 @@ FTP_DECLARE(PASV)
/* grab a new port */ /* grab a new port */
session->pasv_addr.sin_port = htons(next_data_port()); session->pasv_addr.sin_port = htons(next_data_port());
#if defined(_3DS) || defined(_SWITCH) #if defined(_3DS) || defined(SWITCH)
console_print(YELLOW "binding to %s:%u\n" RESET, console_print(YELLOW "binding to %s:%u\n" RESET,
inet_ntoa(session->pasv_addr.sin_addr), inet_ntoa(session->pasv_addr.sin_addr),
ntohs(session->pasv_addr.sin_port)); ntohs(session->pasv_addr.sin_port));

View File

@ -6,7 +6,7 @@
#include <unistd.h> #include <unistd.h>
#ifdef _3DS #ifdef _3DS
#include <3ds.h> #include <3ds.h>
#elif defined(_SWITCH) #elif defined(SWITCH)
#include <switch.h> #include <switch.h>
#endif #endif
#include "console.h" #include "console.h"
@ -32,7 +32,7 @@ loop(loop_status_t (*callback)(void))
return status; return status;
} }
return LOOP_EXIT; return LOOP_EXIT;
#elif defined(_SWITCH) #elif defined(SWITCH)
while(appletMainLoop()) while(appletMainLoop())
{ {
status = callback(); status = callback();
@ -66,7 +66,7 @@ wait_for_b(void)
/* B was not pressed */ /* B was not pressed */
return LOOP_CONTINUE; return LOOP_CONTINUE;
} }
#elif defined(_SWITCH) #elif defined(SWITCH)
/*! wait until the B button is pressed /*! wait until the B button is pressed
* *
* @returns loop status * @returns loop status
@ -105,8 +105,8 @@ main(int argc,
gfxInitDefault(); gfxInitDefault();
gfxSet3D(false); gfxSet3D(false);
sdmcWriteSafe(false); sdmcWriteSafe(false);
#elif defined(_SWITCH) #elif defined(SWITCH)
gfxInitResolution(644, 480); //gfxInitResolution(644, 480);
gfxInitDefault(); gfxInitDefault();
#endif #endif
@ -155,7 +155,7 @@ main(int argc,
status = LOOP_EXIT; status = LOOP_EXIT;
} }
#if defined(_3DS) || defined(_SWITCH) #if defined(_3DS) || defined(SWITCH)
console_print("Press B to exit\n"); console_print("Press B to exit\n");
#endif #endif
@ -171,7 +171,7 @@ log_fail:
/* deinitialize 3DS services */ /* deinitialize 3DS services */
gfxExit(); gfxExit();
acExit(); acExit();
#elif defined(_SWITCH) #elif defined(SWITCH)
loop(wait_for_b); loop(wait_for_b);
/* deinitialize Switch services */ /* deinitialize Switch services */