2018-02-20 12:41:58 +01:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <wups.h>
|
2018-06-20 16:16:16 +02:00
|
|
|
|
2018-07-17 13:21:07 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2018-06-28 23:26:57 +02:00
|
|
|
void OSScreenInit(void);
|
|
|
|
void OSScreenShutdown(void);
|
|
|
|
uint32_t OSScreenGetBufferSizeEx(uint32_t bufferNum);
|
|
|
|
void OSScreenSetBufferEx(uint32_t bufferNum, void * addr);
|
|
|
|
void OSScreenClearBufferEx(uint32_t bufferNum, uint32_t temp);
|
|
|
|
void OSScreenFlipBuffersEx(uint32_t bufferNum);
|
|
|
|
void OSScreenPutFontEx(uint32_t bufferNum, uint32_t posX, uint32_t posY, const char * buffer);
|
|
|
|
void OSScreenEnableEx(uint32_t bufferNum, int32_t enable);
|
|
|
|
void OSScreenPutPixelEx(uint32_t bufferNum, uint32_t posX, uint32_t posY, uint32_t color);
|
2018-02-20 12:41:58 +01:00
|
|
|
|
2018-06-30 16:49:49 +02:00
|
|
|
static OverlayOpenFunction overlayfunction_ptr __attribute__((section(".data"))) = NULL;
|
2018-02-20 12:41:58 +01:00
|
|
|
|
2018-03-11 17:12:46 +01:00
|
|
|
void WUPS_InitOverlay(wups_loader_init_overlay_args_t args) {
|
2018-06-30 16:49:49 +02:00
|
|
|
overlayfunction_ptr = args.overlayfunction_ptr;
|
2018-03-11 17:12:46 +01:00
|
|
|
}
|
2018-02-20 12:41:58 +01:00
|
|
|
|
2018-03-11 17:12:46 +01:00
|
|
|
void WUPS_Overlay_PrintTextOnScreen(wups_overlay_options_type_t screen, int x,int y, const char * msg, ...) {
|
|
|
|
if(screen == WUPS_OVERLAY_NONE) {
|
|
|
|
return;
|
2018-02-20 12:41:58 +01:00
|
|
|
}
|
2018-03-11 17:12:46 +01:00
|
|
|
|
|
|
|
char * tmp = NULL;
|
|
|
|
|
|
|
|
va_list va;
|
|
|
|
va_start(va, msg);
|
|
|
|
if((vasprintf(&tmp, msg, va) >= 0) && tmp) {
|
|
|
|
if(screen != WUPS_OVERLAY_DRC_ONLY) { // Draw TV if it's not DRC exclusive.
|
|
|
|
OSScreenPutFontEx(0, x, y, tmp);
|
2018-02-20 12:41:58 +01:00
|
|
|
}
|
2018-03-11 17:12:46 +01:00
|
|
|
if(screen != WUPS_OVERLAY_TV_ONLY) { // Draw DRC if it's not TV exclusive.
|
|
|
|
OSScreenPutFontEx(1, x, y, tmp);
|
2018-02-20 12:41:58 +01:00
|
|
|
}
|
|
|
|
}
|
2018-03-11 17:12:46 +01:00
|
|
|
va_end(va);
|
|
|
|
|
|
|
|
if(tmp) {
|
|
|
|
free(tmp);
|
2018-02-20 12:41:58 +01:00
|
|
|
}
|
2018-03-11 17:12:46 +01:00
|
|
|
}
|
2018-02-20 12:41:58 +01:00
|
|
|
|
2018-03-11 17:12:46 +01:00
|
|
|
void WUPS_Overlay_OSScreenClear(wups_overlay_options_type_t screen) {
|
|
|
|
if(screen == WUPS_OVERLAY_NONE) {
|
|
|
|
return;
|
2018-02-20 12:41:58 +01:00
|
|
|
}
|
2018-03-11 17:12:46 +01:00
|
|
|
if(screen != WUPS_OVERLAY_DRC_ONLY) { // Clear TV if it's not DRC exclusive.
|
|
|
|
OSScreenClearBufferEx(0, 0);
|
2018-02-20 12:41:58 +01:00
|
|
|
}
|
2018-03-11 17:12:46 +01:00
|
|
|
if(screen != WUPS_OVERLAY_TV_ONLY) { // Clear DRC if it's not TV exclusive.
|
|
|
|
OSScreenClearBufferEx(1, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void WUPS_Overlay_FlipBuffers(wups_overlay_options_type_t screen) {
|
|
|
|
if(screen == WUPS_OVERLAY_NONE) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(screen != WUPS_OVERLAY_DRC_ONLY) { // Flip TV buffer if it's not DRC exclusive.
|
|
|
|
OSScreenFlipBuffersEx(0);
|
|
|
|
}
|
|
|
|
if(screen != WUPS_OVERLAY_TV_ONLY) { // Flip DRC buffer if it's not TV exclusive.
|
|
|
|
OSScreenFlipBuffersEx(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-15 16:04:22 +02:00
|
|
|
void WUPS_OpenOverlay(wups_overlay_options_type_t screen, overlay_callback callback, void* arg) {
|
2018-03-11 17:12:46 +01:00
|
|
|
if(overlayfunction_ptr != NULL) {
|
2018-07-15 16:04:22 +02:00
|
|
|
overlayfunction_ptr(screen, callback, arg);
|
2018-03-11 17:12:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|