Version 0.5

This commit is contained in:
GaryOderNichts 2023-04-01 23:26:11 +02:00
commit 7850f4db57
10 changed files with 51 additions and 32 deletions

View file

@ -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

View file

@ -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

View file

@ -11,6 +11,7 @@ PROVIDE(strncmp = 0x05055e10);
PROVIDE(usleep = 0x050564e4);
PROVIDE(bspGetHardwareVersion = 0x0503d6e8);
PROVIDE(bspInit = 0x0503d35c);
PROVIDE(bspWrite = 0x0503d460);
PROVIDE(bspRead = 0x0503d550);

View file

@ -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

View file

@ -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) {

View file

@ -17,11 +17,11 @@
#pragma once
#define VERSION_STRING "0.4+"
#include <stddef.h>
#include <stdint.h>
#define VERSION_STRING "0.5"
// FSA handle
// Initialized by menuThread().
extern int fsaHandle;

View file

@ -4,7 +4,7 @@
#include <stdint.h>
#include <stdio.h>
#define SOL_SOCKET 0xFFFF
#define SOL_SOCKET -1
#define PF_UNSPEC 0
#define PF_INET 2

View file

@ -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 setNotificationLED(uint8_t mask)
int SMC_ReadSystemEventFlag(uint8_t* flag)
{
return bspRead("SMC", 0, "SystemEventFlag", 1, flag);
}
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);
}

View file

@ -1,5 +1,6 @@
#pragma once
#include <stdint.h>
#include <assert.h>
/**
* 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 readDCConfig(DisplayController_Config* config);
int DISPLAY_DCInit(uint32_t configuration);
int setNotificationLED(uint8_t mask);
int DISPLAY_ReadDCConfig(DC_Config* config);
int setDrivePower(int power);
int SMC_ReadSystemEventFlag(uint8_t* flag);
int SMC_SetNotificationLED(uint8_t mask);
int SMC_SetODDPower(int power);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

After

Width:  |  Height:  |  Size: 206 KiB

Before After
Before After