diff --git a/src/overlay.cpp b/src/overlay.cpp index 3a7dbaa..e0860fc 100644 --- a/src/overlay.cpp +++ b/src/overlay.cpp @@ -26,9 +26,11 @@ void OSScreenEnableEx(uint32_t bufferNum, int32_t enable); void OSScreenPutPixelEx(uint32_t bufferNum, uint32_t posX, uint32_t posY, uint32_t color); static OverlayOpenFunction overlayfunction_ptr __attribute__((section(".data"))) = NULL; +static ConvertTextureFunction textureconvertfunction_ptr __attribute__((section(".data"))) = NULL; void WUPS_InitOverlay(wups_loader_init_overlay_args_t args) { overlayfunction_ptr = args.overlayfunction_ptr; + textureconvertfunction_ptr = args.textureconvertfunction_ptr; } void WUPS_Overlay_PrintTextOnScreen(wups_overlay_options_type_t screen, int x,int y, const char * msg, ...) { @@ -85,6 +87,12 @@ void WUPS_OpenOverlay(wups_overlay_options_type_t screen, overlay_callback callb } } +bool WUPS_ConvertImageToTexture(const uint8_t *img, int32_t imgSize, void * texture) { + if(textureconvertfunction_ptr != NULL) { + return textureconvertfunction_ptr(img, imgSize, texture); + } + return false; +} #ifdef __cplusplus } #endif diff --git a/wups_include/wups/utils.h b/wups_include/wups/utils.h index f88bb78..a6614e8 100644 --- a/wups_include/wups/utils.h +++ b/wups_include/wups/utils.h @@ -36,9 +36,11 @@ wups_overlay_options_type_t; typedef void (*overlay_callback)(wups_overlay_options_type_t, void*); typedef void (*OverlayOpenFunction)(wups_overlay_options_type_t screen, overlay_callback callback, void*); +typedef bool (*ConvertTextureFunction)(const uint8_t *img, int32_t imgSize, void * texture); typedef struct wups_loader_init_overlay_args_t { OverlayOpenFunction overlayfunction_ptr; + ConvertTextureFunction textureconvertfunction_ptr; } wups_loader_init_overlay_args_t; typedef int (*OpenFunction) (const char *pathname, int flags); @@ -125,6 +127,9 @@ void WUPS_Overlay_FlipBuffers(wups_overlay_options_type_t screen); void WUPS_OpenOverlay(wups_overlay_options_type_t screen, overlay_callback callback, void* args); +// texture needs to be a GX2Texture +bool WUPS_ConvertImageToTexture(const uint8_t *img, int32_t imgSize, void * texture); + /** Reads a 32bit value from a given address with kernel rights. This function only has an effect if the plugin has the "WUPS_ALLOW_KERNEL" hook and the loader is NOT blocking the kernel access.