From 6d123dfb88bd3bdf57d42dc2f83efe519978f53e Mon Sep 17 00:00:00 2001 From: "Daniel K. O. (dkosmari)" Date: Fri, 19 Dec 2025 08:17:49 -0300 Subject: [PATCH 1/6] Update to turbojpeg 3. --- source/gfx/JPEGTexture.cpp | 37 ++++++++++++++++++------------------- source/gfx/gfx.c | 4 ++-- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/source/gfx/JPEGTexture.cpp b/source/gfx/JPEGTexture.cpp index 5ef5afa..c5bf5d7 100644 --- a/source/gfx/JPEGTexture.cpp +++ b/source/gfx/JPEGTexture.cpp @@ -7,21 +7,23 @@ GX2Texture *JPEG_LoadTexture(std::span data) { GX2Texture *texture = nullptr; + int height; + int width; - tjhandle handle = tjInitDecompress(); + tjhandle handle = tj3Init(TJINIT_DECOMPRESS); if (!handle) { - return nullptr; + goto error; } - int height; - int width; - int subsamp; - int colorspace; - if (tjDecompressHeader3(handle, - data.data(), data.size(), - &width, &height, - &subsamp, &colorspace)) { - DEBUG_FUNCTION_LINE_ERR("Failed to parse JPEG header\n"); + if (tj3DecompressHeader(handle, data.data(), data.size())) { + DEBUG_FUNCTION_LINE_ERR("Failed to parse JPEG header: %s\n", tj3GetErrorStr(handle)); + goto error; + } + + width = tj3Get(handle, TJPARAM_JPEGWIDTH); + height = tj3Get(handle, TJPARAM_JPEGHEIGHT); + if (width == -1 || height == -1) { + DEBUG_FUNCTION_LINE_ERR("Unknown JPEG image size\n"); goto error; } @@ -62,19 +64,16 @@ GX2Texture *JPEG_LoadTexture(std::span data) { goto error; } - if (tjDecompress2(handle, + if (tj3Decompress8(handle, data.data(), data.size(), static_cast(texture->surface.image), - width, texture->surface.pitch * 4, - height, - TJPF_RGBA, - 0)) { - DEBUG_FUNCTION_LINE_ERR("Failed to read JPEG image\n"); + TJPF_RGBA)) { + DEBUG_FUNCTION_LINE_ERR("Failed to read JPEG image: %s\n", tj3GetErrorStr(handle)); goto error; } - tjDestroy(handle); + tj3Destroy(handle); GX2Invalidate(GX2_INVALIDATE_MODE_CPU | GX2_INVALIDATE_MODE_TEXTURE, texture->surface.image, texture->surface.imageSize); @@ -86,6 +85,6 @@ GX2Texture *JPEG_LoadTexture(std::span data) { std::free(texture->surface.image); } std::free(texture); - tjDestroy(handle); + tj3Destroy(handle); return nullptr; } diff --git a/source/gfx/gfx.c b/source/gfx/gfx.c index 5bc9078..e07fd70 100644 --- a/source/gfx/gfx.c +++ b/source/gfx/gfx.c @@ -200,7 +200,7 @@ static BOOL initBucketHeap() { sGfxHeapForeground = MEMCreateExpHeapEx(base, size, 0); if (!sGfxHeapForeground) { - WHBLogPrintf("%s: MEMCreateExpHeapEx(0x%08X, 0x%X, 0)", __FUNCTION__, base, size); + WHBLogPrintf("%s: MEMCreateExpHeapEx(0x%p, 0x%X, 0)", __FUNCTION__, base, size); return FALSE; } @@ -476,4 +476,4 @@ BOOL GfxInitShaderAttribute(WHBGfxShaderGroup *group, attrib->mask = GfxGetAttribFormatSel(format); attrib->endianSwap = GX2_ENDIAN_SWAP_DEFAULT; return TRUE; -} \ No newline at end of file +} From 0e614ece45d13b460a8c1b4168b6cf81e3f15e03 Mon Sep 17 00:00:00 2001 From: "Daniel K. O. (dkosmari)" Date: Fri, 19 Dec 2025 08:26:19 -0300 Subject: [PATCH 2/6] Fixed formatting. --- source/gfx/JPEGTexture.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/gfx/JPEGTexture.cpp b/source/gfx/JPEGTexture.cpp index c5bf5d7..9f85444 100644 --- a/source/gfx/JPEGTexture.cpp +++ b/source/gfx/JPEGTexture.cpp @@ -65,10 +65,10 @@ GX2Texture *JPEG_LoadTexture(std::span data) { } if (tj3Decompress8(handle, - data.data(), data.size(), - static_cast(texture->surface.image), - texture->surface.pitch * 4, - TJPF_RGBA)) { + data.data(), data.size(), + static_cast(texture->surface.image), + texture->surface.pitch * 4, + TJPF_RGBA)) { DEBUG_FUNCTION_LINE_ERR("Failed to read JPEG image: %s\n", tj3GetErrorStr(handle)); goto error; } From 2f964e193d39b27de4e6bd27f3a0ce94840c4670 Mon Sep 17 00:00:00 2001 From: "Daniel K. O. (dkosmari)" Date: Fri, 19 Dec 2025 08:28:49 -0300 Subject: [PATCH 3/6] More formatting. --- source/gfx/JPEGTexture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/gfx/JPEGTexture.cpp b/source/gfx/JPEGTexture.cpp index 9f85444..2770085 100644 --- a/source/gfx/JPEGTexture.cpp +++ b/source/gfx/JPEGTexture.cpp @@ -20,7 +20,7 @@ GX2Texture *JPEG_LoadTexture(std::span data) { goto error; } - width = tj3Get(handle, TJPARAM_JPEGWIDTH); + width = tj3Get(handle, TJPARAM_JPEGWIDTH); height = tj3Get(handle, TJPARAM_JPEGHEIGHT); if (width == -1 || height == -1) { DEBUG_FUNCTION_LINE_ERR("Unknown JPEG image size\n"); From b02c497bab03b5ca0c96d7d20145161e795982fd Mon Sep 17 00:00:00 2001 From: "Daniel K. O. (dkosmari)" Date: Sat, 20 Dec 2025 21:54:10 -0300 Subject: [PATCH 4/6] Fixed formatting. --- source/gfx/gfx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/gfx/gfx.c b/source/gfx/gfx.c index e07fd70..df33e02 100644 --- a/source/gfx/gfx.c +++ b/source/gfx/gfx.c @@ -200,7 +200,7 @@ static BOOL initBucketHeap() { sGfxHeapForeground = MEMCreateExpHeapEx(base, size, 0); if (!sGfxHeapForeground) { - WHBLogPrintf("%s: MEMCreateExpHeapEx(0x%p, 0x%X, 0)", __FUNCTION__, base, size); + WHBLogPrintf("%s: MEMCreateExpHeapEx(%p, 0x%X, 0)", __FUNCTION__, base, size); return FALSE; } From 2c6bd389a74a8f005e4707359b8e1d6337e47bd1 Mon Sep 17 00:00:00 2001 From: "Daniel K. O. (dkosmari)" Date: Thu, 5 Feb 2026 01:03:37 -0300 Subject: [PATCH 5/6] Updated Dockerfile, crt for newlib and wut. --- Dockerfile | 2 +- source/crt.c | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index ca3e689..0c26d05 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,3 @@ -FROM ghcr.io/wiiu-env/devkitppc:20241128 +FROM ghcr.io/wiiu-env/devkitppc:20260204 WORKDIR project diff --git a/source/crt.c b/source/crt.c index 25bf56f..25e77de 100644 --- a/source/crt.c +++ b/source/crt.c @@ -2,8 +2,6 @@ void __init_wut_malloc(); void __init_wut_newlib(); -void __init_wut_stdcpp(); - void __init_wut_devoptab(); void __attribute__((weak)) __init_wut_socket(); @@ -12,8 +10,6 @@ void __fini_wut_malloc(); void __fini_wut_newlib(); -void __fini_wut_stdcpp(); - void __fini_wut_devoptab(); void __fini(); @@ -24,7 +20,6 @@ void __attribute__((weak)) __init_wut_() { __init_wut_malloc(); __init_wut_newlib(); - __init_wut_stdcpp(); __init_wut_devoptab(); if (&__init_wut_socket) __init_wut_socket(); } @@ -33,7 +28,6 @@ void __attribute__((weak)) __fini_wut_() { __fini(); __fini_wut_devoptab(); - __fini_wut_stdcpp(); __fini_wut_newlib(); __fini_wut_malloc(); } From ef0c429bdc50b8ca144e7ca268a591398bbe0c0b Mon Sep 17 00:00:00 2001 From: "Daniel K. O. (dkosmari)" Date: Thu, 5 Feb 2026 07:09:35 -0300 Subject: [PATCH 6/6] Add __init_wut_thread() call. --- source/crt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/crt.c b/source/crt.c index 25e77de..fb47ab2 100644 --- a/source/crt.c +++ b/source/crt.c @@ -2,6 +2,8 @@ void __init_wut_malloc(); void __init_wut_newlib(); +void __init_wut_thread(); + void __init_wut_devoptab(); void __attribute__((weak)) __init_wut_socket(); @@ -18,6 +20,7 @@ void __attribute__((weak)) __fini_wut_socket(); void __attribute__((weak)) __init_wut_() { + __init_wut_thread(); __init_wut_malloc(); __init_wut_newlib(); __init_wut_devoptab();