diff --git a/Makefile b/Makefile index 3d3789c..eab66e0 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ MAKEFLAGS += --no-print-directory #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- -LIBS := -lz +LIBS := -lz -liosuhax #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing diff --git a/src/dynamic_libs/os_functions.c b/src/dynamic_libs/os_functions.c index 2ea232d..a7cf516 100644 --- a/src/dynamic_libs/os_functions.c +++ b/src/dynamic_libs/os_functions.c @@ -141,18 +141,30 @@ EXPORT_DECL(int, OSScreenEnableEx, unsigned int bufferNum, int enable); EXPORT_DECL(int, OSAllocFromSystem, unsigned int size, unsigned int align); -EXPORT_DECL(int, OSFreeToSystem, void* ptr); +EXPORT_DECL(int, OSFreeToSystem, void *ptr); EXPORT_DECL(void, DisassemblePPCRange, void *, void *, DisasmReport, DisasmGetSym, u32); EXPORT_DECL(bool, DisassemblePPCOpcode, u32 *, char *, u32, DisasmGetSym, u32); -EXPORT_DECL(void*, OSGetSymbolName, u32, u8*, u32); +EXPORT_DECL(void*, OSGetSymbolName, u32, u8 *, u32); EXPORT_DECL(int, OSIsDebuggerInitialized, void); // EXPORT_DECL(int, compress2, char *, int*, const char *, int, int); +// !------------- + +EXPORT_DECL(int, IOS_Ioctl, int fd, unsigned int request, void *input_buffer, unsigned int input_buffer_len, + void *output_buffer, unsigned int output_buffer_len); + +EXPORT_DECL(int, IOS_IoctlAsync, int fd, unsigned int request, void *input_buffer, unsigned int input_buffer_len, + void *output_buffer, unsigned int output_buffer_len, void *cb, void *cbarg); + +EXPORT_DECL(int, IOS_Open, char *path, unsigned int mode); + +EXPORT_DECL(int, IOS_Close, int fd); + //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //! Memory functions //!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -162,7 +174,8 @@ EXPORT_VAR(unsigned int *, pMEMFreeToDefaultHeap); EXPORT_DECL(int, MEMGetBaseHeapHandle, int mem_arena); -EXPORT_DECL(unsigned int, MEMGetAllocatableSizeForFrmHeapEx, int heap, int align); +EXPORT_DECL(unsigned + int, MEMGetAllocatableSizeForFrmHeapEx, int heap, int align); EXPORT_DECL(void *, MEMAllocFromFrmHeapEx, int heap, unsigned int size, int align); diff --git a/src/dynamic_libs/socket_functions.c b/src/dynamic_libs/socket_functions.c index 697bfb2..b27052c 100644 --- a/src/dynamic_libs/socket_functions.c +++ b/src/dynamic_libs/socket_functions.c @@ -80,5 +80,4 @@ void InitSocketFunctionPointers(void) ACGetAssignedAddress(&hostIpAddress); socket_lib_init(); -} - +} \ No newline at end of file diff --git a/src/dynamic_libs/socket_functions.h b/src/dynamic_libs/socket_functions.h index eef0bdd..85b12be 100644 --- a/src/dynamic_libs/socket_functions.h +++ b/src/dynamic_libs/socket_functions.h @@ -30,6 +30,8 @@ extern "C" { #include +extern u32 hostIpAddress; + #define INADDR_ANY 0 #define AF_INET 2 diff --git a/src/main.c b/src/main.c index eb2acd3..2feaa2c 100644 --- a/src/main.c +++ b/src/main.c @@ -119,10 +119,17 @@ int Menu_Main(void) { OSScreenClearBufferEx(0, 0); OSScreenClearBufferEx(1, 0); + // Build the IP address message + char ipAddressMessageBuffer[64]; + InitSocketFunctionPointers(); + __os_snprintf(ipAddressMessageBuffer, 64, "Your Wii U's IP address: %i.%i.%i.%i", + (hostIpAddress >> 24) & 0xFF, (hostIpAddress >> 16) & 0xFF, (hostIpAddress >> 8) & 0xFF, hostIpAddress & 0xFF); + PRINT_TEXT2(14, 1, "-- TCP Gecko Installer --") - PRINT_TEXT2(0, 5, "Press A to install TCPGecko.") + PRINT_TEXT2(7, 2, ipAddressMessageBuffer) + PRINT_TEXT2(0, 5, "Press A to install TCPGecko...") PRINT_TEXT2(0, 6, "Press X to install TCPGecko with CosmoCortney's codehandler...") - PRINT_TEXT2(0, 17, "Press Home to exit ...") + PRINT_TEXT2(0, 17, "Press Home to exit...") OSScreenFlipBuffersEx(0); OSScreenFlipBuffersEx(1); @@ -154,7 +161,8 @@ int Menu_Main(void) { OSScreenClearBufferEx(0, 0); OSScreenClearBufferEx(1, 0); char codeHandlerNotFoundMessageBuffer[100]; - snprintf(codeHandlerNotFoundMessageBuffer, sizeof(codeHandlerNotFoundMessageBuffer), "%s not found", filePath); + snprintf(codeHandlerNotFoundMessageBuffer, sizeof(codeHandlerNotFoundMessageBuffer), "%s not found", + filePath); PRINT_TEXT2(0, 0, codeHandlerNotFoundMessageBuffer) OSScreenFlipBuffersEx(0); OSScreenFlipBuffersEx(1); diff --git a/src/pygecko.c b/src/pygecko.c index ed3081b..f3ae424 100644 --- a/src/pygecko.c +++ b/src/pygecko.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -62,7 +63,7 @@ struct pygecko_bss_t { #define EWOULDBLOCK 6 #define DATA_BUFFER_SIZE 0x5000 #define WRITE_SCREEN_MESSAGE_BUFFER_SIZE 100 -#define SERVER_VERSION "03/30/2017" +#define SERVER_VERSION "04/11/2017" #define ONLY_ZEROS_READ 0xB0 #define NON_ZEROS_READ 0xBD @@ -913,6 +914,8 @@ static int rungecko(struct pygecko_bss_t *bss, int clientfd) { break; } case COMMAND_REPLACE_FILE: { + // int res = IOSUHAX_Open(NULL); + // TODO FSOpenFile ACCESS_ERROR // Receive the file path diff --git a/tcpgecko.elf b/tcpgecko.elf index afc9ea3..2c4040a 100644 Binary files a/tcpgecko.elf and b/tcpgecko.elf differ