diff --git a/README.md b/README.md index cd7c7ed..c65a92e 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,11 @@ in-region titles. Displays info about several parts of the system. Including serial number, manufacturing date, console type, regions, memory devices... +### Submit System Data +Allows submitting system information to an online database to collect various statistics about Wii U consoles. +This is entirely optional and personally identifying information will be kept confidential. +[The database can be found here!](https://wiiu.gerbilsoft.com/) + ## Building ```bash # build the docker container diff --git a/ios_kernel/source/main.c b/ios_kernel/source/main.c index 54b6a0c..700c741 100644 --- a/ios_kernel/source/main.c +++ b/ios_kernel/source/main.c @@ -73,6 +73,9 @@ int _main(void* arg) // patch MCP_SetSysProdSettings debug mode check *(volatile uint32_t*) (0x05024648 - 0x05000000 + 0x081c0000) = 0x20002000; // mov r0, #0; mov r0, #0 + // nop out odm log to not spam logs when stopping drive + *(volatile uint32_t*) 0x1073880c = 0xe12fff1e; // bx lr + restore_mmu(control_register); // invalidate all cache diff --git a/ios_mcp/imports.ld b/ios_mcp/imports.ld index 6d5feef..fc0c025 100644 --- a/ios_mcp/imports.ld +++ b/ios_mcp/imports.ld @@ -11,6 +11,7 @@ PROVIDE(strncmp = 0x05055e10); PROVIDE(usleep = 0x050564e4); PROVIDE(bspGetHardwareVersion = 0x0503d6e8); +PROVIDE(bspInit = 0x0503d35c); PROVIDE(bspWrite = 0x0503d460); PROVIDE(bspRead = 0x0503d550); diff --git a/ios_mcp/source/imports.h b/ios_mcp/source/imports.h index c00dcfc..3d486b8 100644 --- a/ios_mcp/source/imports.h +++ b/ios_mcp/source/imports.h @@ -68,6 +68,7 @@ typedef enum BSPHardwareVersions { int bspGetHardwareVersion(uint32_t* version); +int bspInit(const char* entity, uint32_t instance, const char* attribute, uint32_t size, const void* buffer); int bspWrite(const char* entity, uint32_t instance, const char* attribute, uint32_t size, const void* buffer); int bspRead(const char* entity, uint32_t instance, const char* attribute, uint32_t size, void* buffer); @@ -108,7 +109,6 @@ int IOS_Syscall0x81(int type, uint32_t address, uint32_t value); // context: 0x70-byte buffer for chaining hash calls together #define IOSC_HASH_CONTEXT_SIZE 0x70 -// NOTE: These flags generate an SHA-256 hash, not SHA-1. #define IOSC_HASH_FLAGS_SHA1_INIT 0x000 #define IOSC_HASH_FLAGS_SHA1_UPDATE 0x001 #define IOSC_HASH_FLAGS_SHA1_FINALIZE 0x002 diff --git a/ios_mcp/source/menu.c b/ios_mcp/source/menu.c index e2f3e4c..74e6b39 100644 --- a/ios_mcp/source/menu.c +++ b/ios_mcp/source/menu.c @@ -161,7 +161,7 @@ int drawMenu(const char* title, const Menu* menu, size_t count, uint8_t cur_flag = 0; uint8_t flag = 0; while (1) { - readSystemEventFlag(&flag); + SMC_ReadSystemEventFlag(&flag); if (cur_flag != flag) { if (flag & SYSTEM_EVENT_FLAG_EJECT_BUTTON) { prev_selected = selected; @@ -212,7 +212,7 @@ void waitButtonInput(void) uint8_t flag = 0; while (1) { - readSystemEventFlag(&flag); + SMC_ReadSystemEventFlag(&flag); if (cur_flag != flag) { if ((flag & SYSTEM_EVENT_FLAG_EJECT_BUTTON) || (flag & SYSTEM_EVENT_FLAG_POWER_BUTTON)) { return; @@ -937,29 +937,30 @@ int menuThread(void* arg) printf("menuThread running\n"); // set LED to purple-orange blinking - setNotificationLED(NOTIF_LED_RED | NOTIF_LED_RED_BLINKING | NOTIF_LED_BLUE | NOTIF_LED_BLUE_BLINKING | NOTIF_LED_ORANGE); + SMC_SetNotificationLED(NOTIF_LED_RED | NOTIF_LED_RED_BLINKING | NOTIF_LED_BLUE | NOTIF_LED_BLUE_BLINKING | NOTIF_LED_ORANGE); // stop ppcHeartbeatThread and reset PPC IOS_CancelThread(ppcHeartBeatThreadId, 0); resetPPC(); // cut power to the disc drive to not eject a disc every eject press - setDrivePower(0); + SMC_SetODDPower(0); #ifdef DC_INIT + // (re-)init the graphics subsystem + GFX_SubsystemInit(0); + /* Note: CONFIGURATION_0 is 720p instead of 480p, but doesn't shut down the GPU properly? The GamePad just stays connected after calling iOS_Shutdown. To be safe, let's use CONFIGURATION_1 for now */ - - // init display output - initDisplay(DC_CONFIGURATION_1); + DISPLAY_DCInit(DC_CONFIGURATION_1); /* Note about the display configuration struct: The returned framebuffer address seems to be AV out only? Writing to the hardcoded addresses in gfx.c works for HDMI though */ - //DisplayController_Config dc_config; - //readDCConfig(&dc_config); + DC_Config dc_config; + DISPLAY_ReadDCConfig(&dc_config); #endif // initialize the font @@ -982,7 +983,7 @@ int menuThread(void* arg) } // set LED to purple - setNotificationLED(NOTIF_LED_RED | NOTIF_LED_BLUE); + SMC_SetNotificationLED(NOTIF_LED_RED | NOTIF_LED_BLUE); int selected = 0; while (1) { diff --git a/ios_mcp/source/menu.h b/ios_mcp/source/menu.h index 9da3a5f..3a5813e 100644 --- a/ios_mcp/source/menu.h +++ b/ios_mcp/source/menu.h @@ -17,11 +17,11 @@ #pragma once -#define VERSION_STRING "0.4+" - #include #include +#define VERSION_STRING "0.5" + // FSA handle // Initialized by menuThread(). extern int fsaHandle; diff --git a/ios_mcp/source/socket.h b/ios_mcp/source/socket.h index 7de98d9..2673a51 100644 --- a/ios_mcp/source/socket.h +++ b/ios_mcp/source/socket.h @@ -4,7 +4,7 @@ #include #include -#define SOL_SOCKET 0xFFFF +#define SOL_SOCKET -1 #define PF_UNSPEC 0 #define PF_INET 2 diff --git a/ios_mcp/source/utils.c b/ios_mcp/source/utils.c index 47d883d..8f22930 100644 --- a/ios_mcp/source/utils.c +++ b/ios_mcp/source/utils.c @@ -46,11 +46,6 @@ int resetPPC(void) return 0; } -int readSystemEventFlag(uint8_t* flag) -{ - return bspRead("SMC", 0, "SystemEventFlag", 1, flag); -} - int copy_file(int fsaFd, const char* src, const char* dst) { int readHandle; @@ -86,22 +81,32 @@ int copy_file(int fsaFd, const char* src, const char* dst) return (res > 0) ? 0 : res; } -int initDisplay(uint32_t configuration) +int GFX_SubsystemInit(uint8_t unk) +{ + return bspInit("GFX", 0, "subsystem", 1, &unk); +} + +int DISPLAY_DCInit(uint32_t configuration) { return bspWrite("DISPLAY", 0, "DC_INIT", 4, &configuration); } -int readDCConfig(DisplayController_Config* config) +int DISPLAY_ReadDCConfig(DC_Config* config) { - return bspRead("DISPLAY", 0, "DC_CONFIG", 0x14, config); + return bspRead("DISPLAY", 0, "DC_CONFIG", sizeof(DC_Config), config); +} + +int SMC_ReadSystemEventFlag(uint8_t* flag) +{ + return bspRead("SMC", 0, "SystemEventFlag", 1, flag); } -int setNotificationLED(uint8_t mask) +int SMC_SetNotificationLED(uint8_t mask) { return bspWrite("SMC", 0, "NotificationLED", 1, &mask); } -int setDrivePower(int power) +int SMC_SetODDPower(int power) { return bspWrite("SMC", 0, "ODDPower", 4, &power); } diff --git a/ios_mcp/source/utils.h b/ios_mcp/source/utils.h index 3df9304..197057b 100644 --- a/ios_mcp/source/utils.h +++ b/ios_mcp/source/utils.h @@ -1,5 +1,6 @@ #pragma once #include +#include /** * Number of elements in an array. @@ -31,13 +32,14 @@ enum { DC_CONFIGURATION_1, }; -typedef struct DisplayController_Config { +typedef struct DC_Config { uint32_t id; uint32_t field_0x4; int width; int height; void* framebuffer; -} DisplayController_Config; +} DC_Config; +static_assert(sizeof(DC_Config) == 0x14); enum { NOTIF_LED_OFF = 0, @@ -57,14 +59,16 @@ int EEPROM_Read(uint16_t offset, uint16_t num, uint16_t* buf); int resetPPC(void); -int readSystemEventFlag(uint8_t* flag); - int copy_file(int fsaFd, const char* src, const char* dst); -int initDisplay(uint32_t configuration); +int GFX_SubsystemInit(uint8_t unk); + +int DISPLAY_DCInit(uint32_t configuration); + +int DISPLAY_ReadDCConfig(DC_Config* config); -int readDCConfig(DisplayController_Config* config); +int SMC_ReadSystemEventFlag(uint8_t* flag); -int setNotificationLED(uint8_t mask); +int SMC_SetNotificationLED(uint8_t mask); -int setDrivePower(int power); +int SMC_SetODDPower(int power); diff --git a/screenshot.png b/screenshot.png index f265c2e..e5a4948 100644 Binary files a/screenshot.png and b/screenshot.png differ