From dd28076063c1f1c51edf313ac3ac57b12a07cea1 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 17 Apr 2021 14:20:41 +0200 Subject: [PATCH] Compile with latest wut, compile with WUPS 0.5 --- Dockerfile | 4 ++-- src/ftp.c | 12 ++++++------ src/main.cpp | 34 ++-------------------------------- src/main.h | 14 ++------------ src/net.c | 7 +++---- src/net.h | 10 +++++++++- src/vrt.c | 2 +- 7 files changed, 25 insertions(+), 58 deletions(-) diff --git a/Dockerfile b/Dockerfile index ce4dd6a..32a0363 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -FROM wiiuenv/devkitppc:20210101 +FROM wiiuenv/devkitppc:20210414 -COPY --from=wiiuenv/wiiupluginsystem:20210316 /artifacts $DEVKITPRO +COPY --from=wiiuenv/wiiupluginsystem:20210417 /artifacts $DEVKITPRO COPY --from=wiiuenv/libiosuhax:20210109 /artifacts $DEVKITPRO WORKDIR project \ No newline at end of file diff --git a/src/ftp.c b/src/ftp.c index 9f06a02..099a39a 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -23,19 +23,19 @@ misrepresented as being the original software. 3.This notice may not be removed or altered from any source distribution. */ +#include #include #include #include #include #include #include -#include +#include #include "main.h" #include "utils/logger.h" //! TODO: fix those function #define gettime() OSGetTick() -#define errno wiiu_geterrno() #include "ftp.h" #include "virtualpath.h" @@ -746,7 +746,7 @@ static bool process_accept_events(int32_t server) { int32_t peer; struct sockaddr_in client_address; int32_t addrlen = sizeof(client_address); - while ((peer = network_accept(server, (struct sockaddr *)&client_address, &addrlen)) != -WIIU_EAGAIN) { + while ((peer = network_accept(server, (struct sockaddr *)&client_address, &addrlen)) != -EAGAIN) { if (peer < 0) { console_printf("Error accepting connection: [%i] %s\n", -peer, strerror(-peer)); return false; @@ -813,8 +813,8 @@ static void process_data_events(client_t *client) { } else { if ((result = network_connect(client->data_socket, (struct sockaddr *)&client->address, sizeof(client->address))) < 0) { if (result == -EINPROGRESS || result == -EALREADY) - result = -WIIU_EAGAIN; - if ((result != -WIIU_EAGAIN) && (result != -EISCONN)) { + result = -EAGAIN; + if ((result != -EAGAIN) && (result != -EISCONN)) { console_printf("Unable to connect to client: [%i] %s\n", -result, strerror(-result)); } } @@ -833,7 +833,7 @@ static void process_data_events(client_t *client) { result = client->data_callback(client->data_socket, client->data_connection_callback_arg); } - if (result <= 0 && result != -WIIU_EAGAIN) { + if (result <= 0 && result != -EAGAIN) { cleanup_data_resources(client); if (result < 0) { result = write_reply(client, 520, "Closing data connection, error occurred during transfer."); diff --git a/src/main.cpp b/src/main.cpp index 57ea08e..d490d28 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,34 +1,14 @@ - #include -#include -#include -#include -#include -#include +#include #include #include #include -#include -#include - -#include -#include #include #include -#include -#include -#include -#include #include -#include -#include -#include #include "utils/logger.h" -#include "utils/utils.h" #include - #include "virtualpath.h" -#include "net.h" #include "BackgroundThread.hpp" #define MAX_CONSOLE_LINES_TV 27 @@ -46,22 +26,12 @@ uint32_t hostIpAddress = 0; int iosuhaxMount = 0; int fsaFd = -1; -BackgroundThread * thread = NULL; +BackgroundThread * thread = nullptr; /* Entry point */ ON_APPLICATION_START() { - WHBInitializeSocketLibrary(); - - nn::ac::ConfigIdNum configId; - - nn::ac::Initialize(); - nn::ac::GetStartupId(&configId); - nn::ac::Connect(configId); - ACGetAssignedAddress(&hostIpAddress); - nn::ac::Finalize(); - WHBLogUdpInit(); //!******************************************************************* diff --git a/src/main.h b/src/main.h index dfc7038..77d7698 100644 --- a/src/main.h +++ b/src/main.h @@ -6,21 +6,11 @@ extern "C" { #endif #include -#include +#include "net.h" #define MAXPATHLEN 256 -#define WIIU_EAGAIN EWOULDBLOCK -#define ENODATA 1 -#define EISCONN 3 -#define EWOULDBLOCK 6 -#define EALREADY 10 -#define EAGAIN EWOULDBLOCK -#define EINVAL 11 -#define ENOMEM 18 -#define EINPROGRESS 22 - -#define wiiu_geterrno() (socketlasterr()) +#define wiiu_geterrno() (errno) //! C wrapper for our C++ functions int Menu_Main(void); diff --git a/src/net.c b/src/net.c index 612a392..9d57f58 100644 --- a/src/net.c +++ b/src/net.c @@ -27,7 +27,6 @@ misrepresented as being the original software. #include #include #include -#include #include "main.h" #define MIN(x, y) ((x) < (y) ? (x) : (y)) @@ -48,7 +47,7 @@ void initialise_network() { int32_t result = -1; while (!check_reset_synchronous() && result < 0) { net_deinit(); - while (!check_reset_synchronous() && (result = net_init()) == -WIIU_EAGAIN); + while (!check_reset_synchronous() && (result = net_init()) == -EAGAIN); if (result < 0) printf("net_init() failed: [%i] %s, retrying...\n", result, strerror(-result)); } @@ -148,7 +147,7 @@ int32_t network_close(int32_t s) { if(s < 0) return -1; - return socketclose(s); + return close(s); } int32_t set_blocking(int32_t s, bool blocking) { @@ -245,7 +244,7 @@ int32_t send_from_file(int32_t s, FILE *f) { goto end; } free(buf); - return -WIIU_EAGAIN; + return -EAGAIN; end: free(buf); return result; diff --git a/src/net.h b/src/net.h index 2b8c553..2406df9 100644 --- a/src/net.h +++ b/src/net.h @@ -28,8 +28,16 @@ misrepresented as being the original software. extern "C"{ #endif -#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include #if 0 void initialise_network(); diff --git a/src/vrt.c b/src/vrt.c index e6e2252..314e88f 100644 --- a/src/vrt.c +++ b/src/vrt.c @@ -22,7 +22,7 @@ misrepresented as being the original software. 3.This notice may not be removed or altered from any source distribution. */ -#include + #include #include #include