shithub: cstory

Download patch

ref: c454f4426dea6fd05b76a56e7990790abd61c01c
parent: a12e971509617b9ac8e1a8bbfbd21611eadc7179
author: Clownacy <Clownacy@users.noreply.github.com>
date: Tue Apr 21 18:16:07 EDT 2020

Wii U: Implemented `Backend_PrintError` & co.

--- a/src/Backends/WiiU/Misc.cpp
+++ b/src/Backends/WiiU/Misc.cpp
@@ -1,10 +1,14 @@
 #include "../Misc.h"
 
+#include <stdarg.h>
+#include <stdio.h>
 #include <string.h>
 
 #include <coreinit/thread.h>
 #include <padscore/kpad.h>
 #include <vpad/input.h>
+#include <whb/log.h>
+#include <whb/log_udp.h>
 #include <whb/proc.h>
 #include <whb/sdcard.h>
 
@@ -25,6 +29,8 @@
 	// Enable Wii U Pro Controllers to be connected
 	WPADEnableURCC(1);
 
+	WHBLogUdpInit();
+
 	ticks_per_second = OSGetSystemInfo()->busClockSpeed / 4;
 
 	return true;
@@ -32,6 +38,8 @@
 
 void Backend_Deinit(void)
 {
+	WHBLogUdpDeinit();
+
 	WPADShutdown();
 
 	VPADShutdown();
@@ -128,21 +136,33 @@
 
 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)