Add IP address to screen

This commit is contained in:
BullyWiiPlaza 2017-04-11 20:16:26 +02:00
parent c521bcd633
commit c630849186
7 changed files with 35 additions and 10 deletions

View File

@ -59,7 +59,7 @@ MAKEFLAGS += --no-print-directory
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project # 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 # list of directories containing libraries, this must be the top level containing

View File

@ -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, 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(void, DisassemblePPCRange, void *, void *, DisasmReport, DisasmGetSym, u32);
EXPORT_DECL(bool, DisassemblePPCOpcode, u32 *, char *, u32, 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, OSIsDebuggerInitialized, void);
// EXPORT_DECL(int, compress2, char *, int*, const char *, int, int); // 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 //! Memory functions
//!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //!----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -162,7 +174,8 @@ EXPORT_VAR(unsigned int *, pMEMFreeToDefaultHeap);
EXPORT_DECL(int, MEMGetBaseHeapHandle, int mem_arena); 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); EXPORT_DECL(void *, MEMAllocFromFrmHeapEx, int heap, unsigned int size, int align);

View File

@ -80,5 +80,4 @@ void InitSocketFunctionPointers(void)
ACGetAssignedAddress(&hostIpAddress); ACGetAssignedAddress(&hostIpAddress);
socket_lib_init(); socket_lib_init();
} }

View File

@ -30,6 +30,8 @@ extern "C" {
#include <gctypes.h> #include <gctypes.h>
extern u32 hostIpAddress;
#define INADDR_ANY 0 #define INADDR_ANY 0
#define AF_INET 2 #define AF_INET 2

View File

@ -119,10 +119,17 @@ int Menu_Main(void) {
OSScreenClearBufferEx(0, 0); OSScreenClearBufferEx(0, 0);
OSScreenClearBufferEx(1, 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(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, 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(0);
OSScreenFlipBuffersEx(1); OSScreenFlipBuffersEx(1);
@ -154,7 +161,8 @@ int Menu_Main(void) {
OSScreenClearBufferEx(0, 0); OSScreenClearBufferEx(0, 0);
OSScreenClearBufferEx(1, 0); OSScreenClearBufferEx(1, 0);
char codeHandlerNotFoundMessageBuffer[100]; char codeHandlerNotFoundMessageBuffer[100];
snprintf(codeHandlerNotFoundMessageBuffer, sizeof(codeHandlerNotFoundMessageBuffer), "%s not found", filePath); snprintf(codeHandlerNotFoundMessageBuffer, sizeof(codeHandlerNotFoundMessageBuffer), "%s not found",
filePath);
PRINT_TEXT2(0, 0, codeHandlerNotFoundMessageBuffer) PRINT_TEXT2(0, 0, codeHandlerNotFoundMessageBuffer)
OSScreenFlipBuffersEx(0); OSScreenFlipBuffersEx(0);
OSScreenFlipBuffersEx(1); OSScreenFlipBuffersEx(1);

View File

@ -1,3 +1,4 @@
#include <iosuhax.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -62,7 +63,7 @@ struct pygecko_bss_t {
#define EWOULDBLOCK 6 #define EWOULDBLOCK 6
#define DATA_BUFFER_SIZE 0x5000 #define DATA_BUFFER_SIZE 0x5000
#define WRITE_SCREEN_MESSAGE_BUFFER_SIZE 100 #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 ONLY_ZEROS_READ 0xB0
#define NON_ZEROS_READ 0xBD #define NON_ZEROS_READ 0xBD
@ -913,6 +914,8 @@ static int rungecko(struct pygecko_bss_t *bss, int clientfd) {
break; break;
} }
case COMMAND_REPLACE_FILE: { case COMMAND_REPLACE_FILE: {
// int res = IOSUHAX_Open(NULL);
// TODO FSOpenFile ACCESS_ERROR // TODO FSOpenFile ACCESS_ERROR
// Receive the file path // Receive the file path

Binary file not shown.