From c454f4426dea6fd05b76a56e7990790abd61c01c Mon Sep 17 00:00:00 2001 From: Clownacy Date: Tue, 21 Apr 2020 22:16:07 +0100 Subject: [PATCH] Wii U: Implemented `Backend_PrintError` & co. --- src/Backends/WiiU/Misc.cpp | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/src/Backends/WiiU/Misc.cpp b/src/Backends/WiiU/Misc.cpp index 93adcccc..4434a971 100644 --- a/src/Backends/WiiU/Misc.cpp +++ b/src/Backends/WiiU/Misc.cpp @@ -1,10 +1,14 @@ #include "../Misc.h" +#include +#include #include #include #include #include +#include +#include #include #include @@ -25,6 +29,8 @@ bool Backend_Init(void) // Enable Wii U Pro Controllers to be connected WPADEnableURCC(1); + WHBLogUdpInit(); + ticks_per_second = OSGetSystemInfo()->busClockSpeed / 4; return true; @@ -32,6 +38,8 @@ bool Backend_Init(void) void Backend_Deinit(void) { + WHBLogUdpDeinit(); + WPADShutdown(); VPADShutdown(); @@ -128,21 +136,33 @@ void Backend_GetKeyboardState(bool *keyboard_state) void Backend_ShowMessageBox(const char *title, const char *message) { - (void)title; - (void)message; - // TODO - We might be able to funnel this into `WHBLogPrintf`... + Backend_PrintInfo("ShowMessageBox - %s - %s", title, message); } ATTRIBUTE_FORMAT_PRINTF(1, 2) void Backend_PrintError(const char *format, ...) { - (void)format; - // TODO - We might be able to funnel this into `WHBLogPrintf`... + char message_buffer[0x100]; + + va_list argument_list; + va_start(argument_list, format); + vsprintf(message_buffer, format, argument_list); + va_end(argument_list); + + WHBLogPrint("ERROR:"); + WHBLogPrint(message_buffer); } ATTRIBUTE_FORMAT_PRINTF(1, 2) void Backend_PrintInfo(const char *format, ...) { - (void)format; - // TODO - We might be able to funnel this into `WHBLogPrintf`... + char message_buffer[0x100]; + + va_list argument_list; + va_start(argument_list, format); + vsprintf(message_buffer, format, argument_list); + va_end(argument_list); + + WHBLogPrint("INFO:"); + WHBLogPrint(message_buffer); } unsigned long Backend_GetTicks(void)