Add function to convert images to textures.

This commit is contained in:
Maschell 2019-02-08 20:11:54 +01:00
parent 0ca7b8a344
commit 6a775c1f89
2 changed files with 13 additions and 0 deletions

View File

@ -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

View File

@ -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.