From 4f10d814c674e051c59d40b7b9249ac7b665b6ff Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Fri, 7 Mar 2025 17:32:11 +1100 Subject: [PATCH] Wii U: Try to fix water renderering --- src/AudioBackend.c | 4 ++++ src/Graphics_WiiU.c | 11 +++++++++++ src/Platform_WiiU.c | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/src/AudioBackend.c b/src/AudioBackend.c index f6ab23710..c35eacaa1 100644 --- a/src/AudioBackend.c +++ b/src/AudioBackend.c @@ -1416,11 +1416,15 @@ void Audio_FreeChunks(struct AudioChunk* chunks, int numChunks) { *-------------------------------------------------------Wii U backend-----------------------------------------------------* *#########################################################################################################################*/ #include +static cc_bool ax_inited; struct AudioContext { int count; }; #define AUDIO_COMMON_ALLOC cc_bool AudioBackend_Init(void) { + if (ax_inited) return true; + ax_inited = true; + AXInit(); return true; } diff --git a/src/Graphics_WiiU.c b/src/Graphics_WiiU.c index 7ba11d339..de7087002 100644 --- a/src/Graphics_WiiU.c +++ b/src/Graphics_WiiU.c @@ -211,9 +211,20 @@ void Gfx_SetDepthWrite(cc_bool enabled) { } static void SetColorWrite(cc_bool r, cc_bool g, cc_bool b, cc_bool a) { + GX2ChannelMask mask = 0; + if (r) mask |= GX2_CHANNEL_MASK_R; + if (g) mask |= GX2_CHANNEL_MASK_G; + if (b) mask |= GX2_CHANNEL_MASK_B; + if (a) mask |= GX2_CHANNEL_MASK_A; + + // TODO: use GX2SetColorControl to disable all writing ??? + GX2SetTargetChannelMasks(mask, 0,0,0, 0,0,0,0); } void Gfx_DepthOnlyRendering(cc_bool depthOnly) { + cc_bool enabled = !depthOnly; + SetColorWrite(enabled & gfx_colorMask[0], enabled & gfx_colorMask[1], + enabled & gfx_colorMask[2], enabled & gfx_colorMask[3]); } diff --git a/src/Platform_WiiU.c b/src/Platform_WiiU.c index ddc047505..091b3bbf2 100644 --- a/src/Platform_WiiU.c +++ b/src/Platform_WiiU.c @@ -10,6 +10,7 @@ #include "Utils.h" #include "Errors.h" #include "PackedCol.h" +#include "Audio.h" #include #include #include @@ -454,6 +455,9 @@ cc_bool Platform_DescribeError(cc_result res, cc_string* dst) { void Platform_Init(void) { WHBProcInit(); + // Otherwise loading sound gets stuck endlessly repeating + AudioBackend_Init(); + mkdir("ClassiCube", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); }