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..fb47ab2 100644 --- a/source/crt.c +++ b/source/crt.c @@ -2,7 +2,7 @@ void __init_wut_malloc(); void __init_wut_newlib(); -void __init_wut_stdcpp(); +void __init_wut_thread(); void __init_wut_devoptab(); @@ -12,8 +12,6 @@ void __fini_wut_malloc(); void __fini_wut_newlib(); -void __fini_wut_stdcpp(); - void __fini_wut_devoptab(); void __fini(); @@ -22,9 +20,9 @@ void __attribute__((weak)) __fini_wut_socket(); void __attribute__((weak)) __init_wut_() { + __init_wut_thread(); __init_wut_malloc(); __init_wut_newlib(); - __init_wut_stdcpp(); __init_wut_devoptab(); if (&__init_wut_socket) __init_wut_socket(); } @@ -33,7 +31,6 @@ void __attribute__((weak)) __fini_wut_() { __fini(); __fini_wut_devoptab(); - __fini_wut_stdcpp(); __fini_wut_newlib(); __fini_wut_malloc(); } diff --git a/source/gfx/JPEGTexture.cpp b/source/gfx/JPEGTexture.cpp index 5ef5afa..2770085 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, - 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"); + if (tj3Decompress8(handle, + 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; } - 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..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%08X, 0x%X, 0)", __FUNCTION__, base, size); + WHBLogPrintf("%s: MEMCreateExpHeapEx(%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 +}