mirror of
https://github.com/wiiu-env/ftpiiu_plugin.git
synced 2024-11-04 20:15:09 +01:00
Make changes to work with latest libnx
This commit is contained in:
parent
8338a11bd3
commit
177f00ac63
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
build/*
|
||||
build.*
|
||||
output/
|
||||
ftpd
|
||||
|
@ -50,7 +50,7 @@ CFLAGS := -g -Wall -O2 \
|
||||
-ffast-math \
|
||||
$(ARCH) $(DEFINES)
|
||||
|
||||
CFLAGS += $(INCLUDE) -DSWITCH -DSTATUS_STRING="\"ftpd v$(VERSION)\""
|
||||
CFLAGS += $(INCLUDE) -D__SWITCH__ -DSTATUS_STRING="\"ftpd v$(VERSION)\""
|
||||
|
||||
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
|
||||
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
#ifdef _3DS
|
||||
#include <3ds.h>
|
||||
#elif defined(SWITCH)
|
||||
#elif defined(__SWITCH__)
|
||||
#include <switch.h>
|
||||
#endif
|
||||
|
||||
#if defined(_3DS) || defined(SWITCH)
|
||||
#if defined(_3DS) || defined(__SWITCH__)
|
||||
#define ESC(x) "\x1b[" #x
|
||||
#define RESET ESC(0m)
|
||||
#define BLACK ESC(30m)
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <3ds.h>
|
||||
#define CONSOLE_WIDTH 50
|
||||
#define CONSOLE_HEIGHT 30
|
||||
#elif defined(SWITCH)
|
||||
#elif defined(__SWITCH__)
|
||||
#include <switch.h>
|
||||
#define CONSOLE_WIDTH 80
|
||||
#define CONSOLE_HEIGHT 45
|
||||
@ -134,7 +134,7 @@ print_tcp_table(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#elif defined(SWITCH)
|
||||
#elif defined(__SWITCH__)
|
||||
/*! initialize console subsystem */
|
||||
void
|
||||
console_init(void)
|
||||
@ -149,7 +149,7 @@ console_init(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_3DS) || defined(SWITCH)
|
||||
#if defined(_3DS) || defined(__SWITCH__)
|
||||
|
||||
|
||||
/*! set status bar contents
|
||||
|
26
source/ftp.c
26
source/ftp.c
@ -26,7 +26,7 @@
|
||||
#ifdef _3DS
|
||||
#include <3ds.h>
|
||||
#define lstat stat
|
||||
#elif defined(SWITCH)
|
||||
#elif defined(__SWITCH__)
|
||||
#include <switch.h>
|
||||
#define lstat stat
|
||||
#else
|
||||
@ -37,7 +37,7 @@
|
||||
|
||||
#define POLL_UNKNOWN (~(POLLIN|POLLPRI|POLLOUT))
|
||||
|
||||
#ifndef SWITCH
|
||||
#ifndef __SWITCH__
|
||||
#define XFER_BUFFERSIZE 32768
|
||||
#define SOCK_BUFFERSIZE 32768
|
||||
#define FILE_BUFFERSIZE 65536
|
||||
@ -266,7 +266,7 @@ static bool lcd_power = true;
|
||||
|
||||
/*! aptHook cookie */
|
||||
static aptHookCookie cookie;
|
||||
#elif defined(SWITCH)
|
||||
#elif defined(__SWITCH__)
|
||||
|
||||
/*! appletHook cookie */
|
||||
static AppletHookCookie cookie;
|
||||
@ -750,7 +750,7 @@ ftp_session_fill_dirent_type(ftp_session_t *session, const struct stat *st,
|
||||
type = "file";
|
||||
else if(S_ISDIR(st->st_mode))
|
||||
type = "dir";
|
||||
#if !defined(_3DS) && !defined(SWITCH)
|
||||
#if !defined(_3DS) && !defined(__SWITCH__)
|
||||
else if(S_ISLNK(st->st_mode))
|
||||
type = "os.unix=symlink";
|
||||
else if(S_ISCHR(st->st_mode))
|
||||
@ -862,7 +862,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 ",
|
||||
S_ISREG(st->st_mode) ? '-' :
|
||||
S_ISDIR(st->st_mode) ? 'd' :
|
||||
#if !defined(_3DS) && !defined(SWITCH)
|
||||
#if !defined(_3DS) && !defined(__SWITCH__)
|
||||
S_ISLNK(st->st_mode) ? 'l' :
|
||||
S_ISCHR(st->st_mode) ? 'c' :
|
||||
S_ISBLK(st->st_mode) ? 'b' :
|
||||
@ -1758,7 +1758,7 @@ ftp_session_poll(ftp_session_t *session)
|
||||
static void
|
||||
update_free_space(void)
|
||||
{
|
||||
#if defined(_3DS) || defined(SWITCH)
|
||||
#if defined(_3DS) || defined(__SWITCH__)
|
||||
#define KiB (1024.0)
|
||||
#define MiB (1024.0*KiB)
|
||||
#define GiB (1024.0*MiB)
|
||||
@ -1804,7 +1804,7 @@ update_free_space(void)
|
||||
static int
|
||||
update_status(void)
|
||||
{
|
||||
#if defined(_3DS) || defined(SWITCH)
|
||||
#if defined(_3DS) || defined(__SWITCH__)
|
||||
console_set_status("\n" GREEN STATUS_STRING " "
|
||||
#ifdef ENABLE_LOGGING
|
||||
"DEBUG "
|
||||
@ -1813,7 +1813,7 @@ update_status(void)
|
||||
inet_ntoa(serv_addr.sin_addr),
|
||||
ntohs(serv_addr.sin_port));
|
||||
update_free_space();
|
||||
#elif 0//defined(SWITCH)
|
||||
#elif 0//defined(__SWITCH__)
|
||||
char hostname[128];
|
||||
socklen_t addrlen = sizeof(serv_addr);
|
||||
int rc;
|
||||
@ -1900,7 +1900,7 @@ apt_hook(APT_HookType type,
|
||||
break;
|
||||
}
|
||||
}
|
||||
#elif defined(SWITCH)
|
||||
#elif defined(__SWITCH__)
|
||||
/*! Handle applet events
|
||||
*
|
||||
* @param[in] type Event type
|
||||
@ -1983,7 +1983,7 @@ ftp_init(void)
|
||||
console_print(RED "socInit: %08X\n" RESET, (unsigned int)ret);
|
||||
goto soc_fail;
|
||||
}
|
||||
#elif defined(SWITCH)
|
||||
#elif defined(__SWITCH__)
|
||||
static const SocketInitConfig socketInitConfig = {
|
||||
.bsdsockets_version = 1,
|
||||
|
||||
@ -2108,7 +2108,7 @@ ftp_exit(void)
|
||||
console_print(RED "socExit: 0x%08X\n" RESET, (unsigned int)ret);
|
||||
free(SOCU_buffer);
|
||||
}
|
||||
#elif defined(SWITCH)
|
||||
#elif defined(__SWITCH__)
|
||||
/* deinitialize socket driver */
|
||||
console_render();
|
||||
console_print(CYAN "Waiting for socketExit()...\n" RESET);
|
||||
@ -2177,7 +2177,7 @@ ftp_loop(void)
|
||||
lcd_power = !lcd_power;
|
||||
apt_hook(APTHOOK_ONRESTORE, NULL);
|
||||
}
|
||||
#elif defined(SWITCH)
|
||||
#elif defined(__SWITCH__)
|
||||
/* check if the user wants to exit */
|
||||
hidScanInput();
|
||||
u32 down = hidKeysDown(CONTROLLER_P1_AUTO);
|
||||
@ -3496,7 +3496,7 @@ FTP_DECLARE(PASV)
|
||||
/* grab a new 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,
|
||||
inet_ntoa(session->pasv_addr.sin_addr),
|
||||
ntohs(session->pasv_addr.sin_port));
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <unistd.h>
|
||||
#ifdef _3DS
|
||||
#include <3ds.h>
|
||||
#elif defined(SWITCH)
|
||||
#elif defined(__SWITCH__)
|
||||
#include <switch.h>
|
||||
#endif
|
||||
#include "console.h"
|
||||
@ -32,7 +32,7 @@ loop(loop_status_t (*callback)(void))
|
||||
return status;
|
||||
}
|
||||
return LOOP_EXIT;
|
||||
#elif defined(SWITCH)
|
||||
#elif defined(__SWITCH__)
|
||||
while(appletMainLoop())
|
||||
{
|
||||
status = callback();
|
||||
@ -66,7 +66,7 @@ wait_for_b(void)
|
||||
/* B was not pressed */
|
||||
return LOOP_CONTINUE;
|
||||
}
|
||||
#elif defined(SWITCH)
|
||||
#elif defined(__SWITCH__)
|
||||
/*! wait until the B button is pressed
|
||||
*
|
||||
* @returns loop status
|
||||
@ -105,7 +105,7 @@ main(int argc,
|
||||
gfxInitDefault();
|
||||
gfxSet3D(false);
|
||||
sdmcWriteSafe(false);
|
||||
#elif defined(SWITCH)
|
||||
#elif defined(__SWITCH__)
|
||||
//gfxInitResolution(644, 480);
|
||||
gfxInitDefault();
|
||||
#endif
|
||||
@ -155,7 +155,7 @@ main(int argc,
|
||||
status = LOOP_EXIT;
|
||||
}
|
||||
|
||||
#if defined(_3DS) || defined(SWITCH)
|
||||
#if defined(_3DS) || defined(__SWITCH__)
|
||||
console_print("Press B to exit\n");
|
||||
#endif
|
||||
|
||||
@ -171,7 +171,7 @@ log_fail:
|
||||
/* deinitialize 3DS services */
|
||||
gfxExit();
|
||||
acExit();
|
||||
#elif defined(SWITCH)
|
||||
#elif defined(__SWITCH__)
|
||||
loop(wait_for_b);
|
||||
|
||||
/* deinitialize Switch services */
|
||||
|
Loading…
Reference in New Issue
Block a user