mirror of
https://github.com/wiiu-env/ftpiiu_plugin.git
synced 2024-11-16 17:59:19 +01:00
Compile with latest wut, compile with WUPS 0.5
This commit is contained in:
parent
71ee86025f
commit
dd28076063
@ -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
|
12
src/ftp.c
12
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 <errno.h>
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/dir.h>
|
||||
#include <coreinit/thread.h>
|
||||
#include <unistd.h>
|
||||
#include <nsysnet/socket.h>
|
||||
#include <errno.h>
|
||||
#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.");
|
||||
|
34
src/main.cpp
34
src/main.cpp
@ -1,34 +1,14 @@
|
||||
|
||||
#include <wups.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <stdint.h>
|
||||
#include <cstring>
|
||||
#include <iosuhax.h>
|
||||
#include <iosuhax_devoptab.h>
|
||||
#include <iosuhax_disc_interface.h>
|
||||
#include <proc_ui/procui.h>
|
||||
#include <coreinit/foreground.h>
|
||||
|
||||
#include <coreinit/screen.h>
|
||||
#include <sysapp/launch.h>
|
||||
#include <coreinit/dynload.h>
|
||||
#include <nn/ac.h>
|
||||
#include <stdarg.h>
|
||||
#include <whb/proc.h>
|
||||
#include <stdlib.h>
|
||||
#include <coreinit/thread.h>
|
||||
#include <coreinit/cache.h>
|
||||
#include <coreinit/time.h>
|
||||
#include <stdio.h>
|
||||
#include <whb/libmanager.h>
|
||||
#include "utils/logger.h"
|
||||
#include "utils/utils.h"
|
||||
#include <whb/log_udp.h>
|
||||
|
||||
#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();
|
||||
|
||||
//!*******************************************************************
|
||||
|
14
src/main.h
14
src/main.h
@ -6,21 +6,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
#include <nsysnet/socket.h>
|
||||
#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);
|
||||
|
@ -27,7 +27,6 @@ misrepresented as being the original software.
|
||||
#include <malloc.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <nsysnet/socket.h>
|
||||
#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;
|
||||
|
10
src/net.h
10
src/net.h
@ -28,8 +28,16 @@ misrepresented as being the original software.
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if 0
|
||||
void initialise_network();
|
||||
|
Loading…
Reference in New Issue
Block a user