I'm trying to code a little homebrew app that either opens the system settings (he can't open the Wii U menu without it feezing), since he needs that to unbrick his Wii U or enable Internet by changing the configuration so it fits his WiFi credentials from now, not like 10 years ago. I have tried everything, some code is even written by Copilot and ChatGPT and I tried to fix it but no luck. Since the Wii U Toolchain (wut) from devkitpro has little to no documentation, so I came here. I know my code is messy and stuff but I really hope you guys can help me here.
main.cpp:
#include <stdio.h>
#include <coreinit/screen.h>
#include <vpad/input.h>
#include <wut.h>
#include <whb/proc.h>
#include <whb/log.h>
#include <whb/log_console.h>
#include <sysapp/launch.h>
#include <nn/ac.h>
int main(int argc, char **argv) {
// Initialisiere alles
WHBProcInit();
VPADInit();
OSScreenInit();
WHBLogConsoleInit();
nn::ac::Initialize();
while (WHBProcIsRunning()) {
VPADStatus vpad;
VPADRead(VPAD_CHAN_0, &vpad, 1, NULL);
OSScreenClearBufferEx(SCREEN_DRC, 0x000000FF);
OSScreenClearBufferEx(SCREEN_TV, 0x000000FF);
OSScreenPutFontEx(SCREEN_DRC, 0, 0, "Drücke A für Systemeinstellungen");
OSScreenPutFontEx(SCREEN_TV, 0, 0, "Drücke A für Systemeinstellungen");
OSScreenFlipBuffersEx(SCREEN_DRC);
OSScreenFlipBuffersEx(SCREEN_TV);
OSScreenPutFontEx(SCREEN_DRC, 0, 20, "Drücke Y für Intaned");
OSScreenPutFontEx(SCREEN_TV, 0, 20, "Drücke Y für Intaned");
OSScreenFlipBuffersEx(SCREEN_DRC);
OSScreenFlipBuffersEx(SCREEN_TV);
if (vpad.trigger & VPAD_BUTTON_A) {
uint64_t titleid = 0x0005001010047200;
SYSLaunchTitle(titleid);
}
if (vpad.trigger & VPAD_BUTTON_Y) {
OSScreenClearBufferEx(SCREEN_DRC, 0x000000FF);
OSScreenClearBufferEx(SCREEN_TV, 0x000000FF);
OSScreenPutFontEx(SCREEN_DRC, 0, 20, "Der Y-Knopf wurde gedrückt!");
OSScreenPutFontEx(SCREEN_TV, 0, 20, "Der Y-Knopf wurde gedrückt!");
OSScreenFlipBuffersEx(SCREEN_DRC);
OSScreenFlipBuffersEx(SCREEN_TV);
nn::os::SleepThread(nn::TimeSpan::FromNanoSeconds(1500000000))
nn::ac::ConfigIdNum config;
nn::ac::GetStartupIdNum(&config);
nn::ac::Details details;
nn::ac::GetDetails(config, &details);
OSScreenClearBufferEx(SCREEN_DRC, 0x000000FF);
OSScreenClearBufferEx(SCREEN_TV, 0x000000FF);
OSScreenPutFontEx(SCREEN_DRC, 0, 0, "Drücke Y für die Netzwerkdetails");
OSScreenPutFontEx(SCREEN_TV, 0, 0, "Drücke Y für die Netzwerkdetails");
OSScreenFlipBuffersEx(SCREEN_DRC);
OSScreenFlipBuffersEx(SCREEN_TV);
if(vpad.trigger & VPAD_BUTTON_Y){
char buffer[1024];
snprintf(buffer, sizeof(buffer), "IP Address: %s, SSID: %s, Gateway: %s",
details.ip_address, details.ssid, details.gateway);
const char* str = buffer;
OSScreenPutFontEx(SCREEN_DRC, 0, 20, str);
OSScreenPutFontEx(SCREEN_TV, 0, 20, str);
}
nn::ac::ConnectAsync(config);
while (nn::ac::GetStatus() != nn::ac::Status_Connecting) {
nn::os::SleepThread(nn::TimeSpan::FromNanoSeconds(5000000000));
}
if (nn::ac::GetStatus() == nn::ac::Status_Connected) {
OSScreenClearBufferEx(SCREEN_DRC, 0x000000FF);
OSScreenClearBufferEx(SCREEN_TV, 0x000000FF);
OSScreenPutFontEx(SCREEN_DRC, 0, 0, "WLAN ist am start");
OSScreenPutFontEx(SCREEN_TV, 0, 0, "WLAN ist am start");
OSScreenFlipBuffersEx(SCREEN_DRC);
OSScreenFlipBuffersEx(SCREEN_TV);
} else {
OSScreenClearBufferEx(SCREEN_DRC, 0x000000FF);
OSScreenClearBufferEx(SCREEN_TV, 0x000000FF);
OSScreenPutFontEx(SCREEN_DRC, 0, 0, "WLAN sagt nahhh");
OSScreenPutFontEx(SCREEN_TV, 0, 0, "WLAN sagt nahhh");
OSScreenFlipBuffersEx(SCREEN_DRC);
OSScreenFlipBuffersEx(SCREEN_TV);
}
}
}
WHBLogConsoleFree();
WHBProcShutdown();
OSScreenShutdown();
VPADShutdown();
nn::ac::Finalize();
return 0;
}
I'm using following commands to compile it on the devkitpro msys2:
cmake -B build -S . -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/WiiU.cmake
ninja -C build
If you're wondering what errors I have when compiling. I'm happy to provide:
D:/Wii U/main.cpp: In function 'int main(int, char**)':
D:/Wii U/main.cpp:48:17: error: 'nn::os' has not been declared
48 | nn::os::SleepThread(nn::TimeSpan::FromNanoSeconds(1500000000))
| ^~
D:/Wii U/main.cpp:48:37: error: 'nn::TimeSpan' has not been declared
48 | nn::os::SleepThread(nn::TimeSpan::FromNanoSeconds(1500000000))
| ^~~~~~~~
D:/Wii U/main.cpp:50:21: error: 'GetStartupIdNum' is not a member of 'nn::ac'; did you mean 'GetStartupId'?
50 | nn::ac::GetStartupIdNum(&config);
| ^~~~~~~~~~~~~~~
| GetStartupId
D:/Wii U/main.cpp:50:38: error: 'config' was not declared in this scope
50 | nn::ac::GetStartupIdNum(&config);
| ^~~~~~
D:/Wii U/main.cpp:51:21: error: 'Details' is not a member of 'nn::ac'; did you mean 'detail'?
51 | nn::ac::Details details;
| ^~~~~~~
| detail
D:/Wii U/main.cpp:52:21: error: 'GetDetails' is not a member of 'nn::ac'
52 | nn::ac::GetDetails(config, &details);
| ^~~~~~~~~~
D:/Wii U/main.cpp:52:41: error: 'details' was not declared in this scope
52 | nn::ac::GetDetails(config, &details);
| ^~~~~~~
D:/Wii U/main.cpp:70:28: error: 'GetStatus' is not a member of 'nn::ac'; did you mean 'GetStartupId'?
70 | while (nn::ac::GetStatus() != nn::ac::Status_Connecting) {
| ^~~~~~~~~
| GetStartupId
D:/Wii U/main.cpp:70:51: error: 'Status_Connecting' is not a member of 'nn::ac'
70 | while (nn::ac::GetStatus() != nn::ac::Status_Connecting) {
| ^~~~~~~~~~~~~~~~~
D:/Wii U/main.cpp:71:21: error: 'nn::os' has not been declared
71 | nn::os::SleepThread(nn::TimeSpan::FromNanoSeconds(5000000000));
| ^~
D:/Wii U/main.cpp:71:41: error: 'nn::TimeSpan' has not been declared
71 | nn::os::SleepThread(nn::TimeSpan::FromNanoSeconds(5000000000));
| ^~~~~~~~
D:/Wii U/main.cpp:74:25: error: 'GetStatus' is not a member of 'nn::ac'; did you mean 'GetStartupId'?
74 | if (nn::ac::GetStatus() == nn::ac::Status_Connected) {
| ^~~~~~~~~
| GetStartupId
D:/Wii U/main.cpp:74:48: error: 'Status_Connected' is not a member of 'nn::ac'
74 | if (nn::ac::GetStatus() == nn::ac::Status_Connected) {
| ^~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
I'm trying to either:
Open the system settings
or
Alter the WiFi configuration so the Wii U can connect to wifi
using the Wii U toolchain (wut) of devkitpro