mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-23 09:55:48 +00:00
(WIIU) display core frames.
This commit is contained in:
parent
844c6ed582
commit
afdaf9afbd
@ -228,6 +228,10 @@ static int log_write(struct _reent *r, int fd, const char *ptr, size_t len)
|
||||
|
||||
return len;
|
||||
}
|
||||
void net_print(const char* str)
|
||||
{
|
||||
log_write(NULL, 0, str, strlen(str));
|
||||
}
|
||||
|
||||
static devoptab_t dotab_stdout = {
|
||||
"stdout", // device name
|
||||
@ -301,8 +305,8 @@ int __entry_menu(int argc, char **argv)
|
||||
unsigned sleep_ms = 0;
|
||||
int ret = runloop_iterate(&sleep_ms);
|
||||
|
||||
if (ret == 1 && sleep_ms > 0)
|
||||
retro_sleep(sleep_ms);
|
||||
// if (ret == 1 && sleep_ms > 0)
|
||||
// retro_sleep(sleep_ms);
|
||||
task_queue_ctl(TASK_QUEUE_CTL_CHECK, NULL);
|
||||
if (ret == -1)
|
||||
break;
|
||||
|
@ -38,7 +38,7 @@ static frontend_ctx_driver_t *frontend_ctx_drivers[] = {
|
||||
&frontend_ctx_gx,
|
||||
#endif
|
||||
#if defined(WIIU)
|
||||
// &frontend_ctx_wiiu,
|
||||
&frontend_ctx_wiiu,
|
||||
#endif
|
||||
#if defined(__QNX__)
|
||||
&frontend_ctx_qnx,
|
||||
|
@ -39,22 +39,23 @@ typedef struct
|
||||
int width;
|
||||
int height;
|
||||
bool enable;
|
||||
}menu;
|
||||
} menu;
|
||||
|
||||
void* texture;
|
||||
int tex_width;
|
||||
int tex_height;
|
||||
|
||||
}wiiu_video_t;
|
||||
} wiiu_video_t;
|
||||
|
||||
static void *wiiu_gfx_init(const video_info_t *video,
|
||||
const input_driver_t **input, void **input_data)
|
||||
static void* wiiu_gfx_init(const video_info_t* video,
|
||||
const input_driver_t** input, void** input_data)
|
||||
{
|
||||
*input = NULL;
|
||||
*input_data = NULL;
|
||||
|
||||
wiiu_video_t* wiiu = calloc(1, sizeof(*wiiu));
|
||||
if(!wiiu)
|
||||
|
||||
if (!wiiu)
|
||||
return NULL;
|
||||
|
||||
wiiu->screen_buffer0_size = OSScreenGetBufferSizeEx(0);
|
||||
@ -101,11 +102,11 @@ static void *wiiu_gfx_init(const video_info_t *video,
|
||||
|
||||
return wiiu;
|
||||
}
|
||||
static void wiiu_gfx_free(void *data)
|
||||
static void wiiu_gfx_free(void* data)
|
||||
{
|
||||
wiiu_video_t* wiiu = (wiiu_video_t*) data;
|
||||
|
||||
if(!wiiu)
|
||||
if (!wiiu)
|
||||
return;
|
||||
|
||||
MEM1_free(wiiu->screen_buffer0);
|
||||
@ -117,9 +118,9 @@ static void wiiu_gfx_free(void *data)
|
||||
|
||||
}
|
||||
|
||||
static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
unsigned width, unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char *msg)
|
||||
static bool wiiu_gfx_frame(void* data, const void* frame,
|
||||
unsigned width, unsigned height, uint64_t frame_count,
|
||||
unsigned pitch, const char* msg)
|
||||
{
|
||||
(void)frame;
|
||||
(void)width;
|
||||
@ -135,33 +136,51 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
snprintf(frames_str, sizeof(frames_str), "frames : %i", frames++);
|
||||
|
||||
OSScreenClearBufferEx(1, 0);
|
||||
// OSScreenPutFontEx(1, 0, 0, "Hello world on DRC!!!");
|
||||
|
||||
const uint16_t* src = (uint16_t*)wiiu->menu.texture;
|
||||
uint32_t* dst = (uint32_t*)((uint8_t*)wiiu->screen_buffer1 + wiiu->screen_buffer1_id * wiiu->screen_buffer1_size / 2);
|
||||
// for (i = 0; i < wiiu->menu.height; i++)
|
||||
// {
|
||||
// memcpy(dst, src, wiiu->menu.width * sizeof(uint16_t));
|
||||
// dst += 896;
|
||||
// src += wiiu->menu.tex_width;
|
||||
// }
|
||||
|
||||
dst += 896 * (480 - wiiu->menu.height) / 2 + (896 - wiiu->menu.width) / 2;
|
||||
int x, y;
|
||||
for(y = 0; y < wiiu->menu.height; y++)
|
||||
if (wiiu->menu.enable)
|
||||
{
|
||||
for(x = 0; x < wiiu->menu.width; x++)
|
||||
const uint16_t* src = (uint16_t*)wiiu->menu.texture;
|
||||
uint32_t* dst = (uint32_t*)((uint8_t*)wiiu->screen_buffer1 + wiiu->screen_buffer1_id * wiiu->screen_buffer1_size / 2);
|
||||
|
||||
dst += 896 * (480 - wiiu->menu.height) / 2 + (896 - wiiu->menu.width) / 2;
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < wiiu->menu.height; y++)
|
||||
{
|
||||
int r = ((src[x] >> 12) & 0xF) << 4;
|
||||
int g = ((src[x] >> 8) & 0xF) << 4;
|
||||
int b = ((src[x] >> 4) & 0xF) << 4;
|
||||
// r = 0;
|
||||
// g = 0;
|
||||
// b = 0;
|
||||
dst[x] = (r << 0) | (b << 8) | (g << 16);
|
||||
for (x = 0; x < wiiu->menu.width; x++)
|
||||
{
|
||||
int r = ((src[x] >> 12) & 0xF) << 4;
|
||||
int g = ((src[x] >> 8) & 0xF) << 4;
|
||||
int b = ((src[x] >> 4) & 0xF) << 4;
|
||||
dst[x] = (r << 0) | (b << 8) | (g << 16);
|
||||
}
|
||||
|
||||
src += wiiu->menu.tex_width;
|
||||
dst += 896;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
const uint16_t* src = (uint16_t*)frame;
|
||||
uint32_t* dst = (uint32_t*)((uint8_t*)wiiu->screen_buffer1 + wiiu->screen_buffer1_id * wiiu->screen_buffer1_size / 2);
|
||||
|
||||
dst += (896 * (480 - height) + width) / 2;
|
||||
int x, y;
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
int r = ((src[x] >> 11) & 0x1F) << 3;
|
||||
int g = ((src[x] >> 5) & 0x3F) << 2;
|
||||
int b = ((src[x] >> 0) & 0x1F) << 3;
|
||||
dst[x] = (r << 0) | (b << 8) | (g << 16);
|
||||
}
|
||||
|
||||
src += pitch/2;
|
||||
dst += 896;
|
||||
}
|
||||
src += wiiu->menu.tex_width;
|
||||
dst += 896;
|
||||
}
|
||||
|
||||
|
||||
@ -177,39 +196,39 @@ static bool wiiu_gfx_frame(void *data, const void *frame,
|
||||
return true;
|
||||
}
|
||||
|
||||
static void wiiu_gfx_set_nonblock_state(void *data, bool toggle)
|
||||
static void wiiu_gfx_set_nonblock_state(void* data, bool toggle)
|
||||
{
|
||||
(void)data;
|
||||
(void)toggle;
|
||||
}
|
||||
|
||||
static bool wiiu_gfx_alive(void *data)
|
||||
static bool wiiu_gfx_alive(void* data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool wiiu_gfx_focus(void *data)
|
||||
static bool wiiu_gfx_focus(void* data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool wiiu_gfx_suppress_screensaver(void *data, bool enable)
|
||||
static bool wiiu_gfx_suppress_screensaver(void* data, bool enable)
|
||||
{
|
||||
(void)data;
|
||||
(void)enable;
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool wiiu_gfx_has_windowed(void *data)
|
||||
static bool wiiu_gfx_has_windowed(void* data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool wiiu_gfx_set_shader(void *data,
|
||||
enum rarch_shader_type type, const char *path)
|
||||
static bool wiiu_gfx_set_shader(void* data,
|
||||
enum rarch_shader_type type, const char* path)
|
||||
{
|
||||
(void)data;
|
||||
(void)type;
|
||||
@ -218,21 +237,21 @@ static bool wiiu_gfx_set_shader(void *data,
|
||||
return false;
|
||||
}
|
||||
|
||||
static void wiiu_gfx_set_rotation(void *data,
|
||||
unsigned rotation)
|
||||
static void wiiu_gfx_set_rotation(void* data,
|
||||
unsigned rotation)
|
||||
{
|
||||
(void)data;
|
||||
(void)rotation;
|
||||
}
|
||||
|
||||
static void wiiu_gfx_viewport_info(void *data,
|
||||
struct video_viewport *vp)
|
||||
static void wiiu_gfx_viewport_info(void* data,
|
||||
struct video_viewport* vp)
|
||||
{
|
||||
(void)data;
|
||||
(void)vp;
|
||||
}
|
||||
|
||||
static bool wiiu_gfx_read_viewport(void *data, uint8_t *buffer)
|
||||
static bool wiiu_gfx_read_viewport(void* data, uint8_t* buffer)
|
||||
{
|
||||
(void)data;
|
||||
(void)buffer;
|
||||
@ -240,12 +259,12 @@ static bool wiiu_gfx_read_viewport(void *data, uint8_t *buffer)
|
||||
return true;
|
||||
}
|
||||
|
||||
static uintptr_t wiiu_load_texture(void *video_data, void *data,
|
||||
bool threaded, enum texture_filter_type filter_type)
|
||||
static uintptr_t wiiu_load_texture(void* video_data, void* data,
|
||||
bool threaded, enum texture_filter_type filter_type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static void wiiu_unload_texture(void *data, uintptr_t handle)
|
||||
static void wiiu_unload_texture(void* data, uintptr_t handle)
|
||||
{
|
||||
|
||||
}
|
||||
@ -271,19 +290,21 @@ static void wiiu_viewport_info(void* data, struct video_viewport* vp)
|
||||
vp->y = 0;
|
||||
}
|
||||
static void wiiu_set_texture_frame(void* data, const void* frame, bool rgb32,
|
||||
unsigned width, unsigned height, float alpha)
|
||||
unsigned width, unsigned height, float alpha)
|
||||
{
|
||||
int i;
|
||||
wiiu_video_t* wiiu = (wiiu_video_t*) data;
|
||||
if(!wiiu)
|
||||
|
||||
if (!wiiu)
|
||||
return;
|
||||
|
||||
if(!frame || !width || !height)
|
||||
if (!frame || !width || !height)
|
||||
return;
|
||||
|
||||
if(width > wiiu->menu.tex_width)
|
||||
if (width > wiiu->menu.tex_width)
|
||||
width = wiiu->menu.tex_width;
|
||||
if(height > wiiu->menu.tex_height)
|
||||
|
||||
if (height > wiiu->menu.tex_height)
|
||||
height = wiiu->menu.tex_height;
|
||||
|
||||
wiiu->menu.width = width;
|
||||
@ -291,6 +312,7 @@ static void wiiu_set_texture_frame(void* data, const void* frame, bool rgb32,
|
||||
|
||||
const uint16_t* src = frame;
|
||||
uint16_t* dst = (uint16_t*)wiiu->menu.texture;
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
memcpy(dst, src, width * sizeof(uint16_t));
|
||||
@ -307,8 +329,8 @@ static void wiiu_set_texture_enable(void* data, bool state, bool full_screen)
|
||||
|
||||
}
|
||||
|
||||
static void wiiu_set_osd_msg(void *data, const char *msg,
|
||||
const struct font_params *params, void *font)
|
||||
static void wiiu_set_osd_msg(void* data, const char* msg,
|
||||
const struct font_params* params, void* font)
|
||||
{
|
||||
}
|
||||
|
||||
@ -337,8 +359,8 @@ static const video_poke_interface_t wiiu_poke_interface =
|
||||
NULL
|
||||
};
|
||||
|
||||
static void wiiu_gfx_get_poke_interface(void *data,
|
||||
const video_poke_interface_t **iface)
|
||||
static void wiiu_gfx_get_poke_interface(void* data,
|
||||
const video_poke_interface_t** iface)
|
||||
{
|
||||
(void)data;
|
||||
*iface = &wiiu_poke_interface;
|
||||
@ -362,7 +384,7 @@ video_driver_t video_wiiu =
|
||||
wiiu_gfx_read_viewport,
|
||||
NULL, /* read_frame_raw */
|
||||
#ifdef HAVE_OVERLAY
|
||||
NULL, /* overlay_interface */
|
||||
NULL, /* overlay_interface */
|
||||
#endif
|
||||
wiiu_gfx_get_poke_interface,
|
||||
wiiu_gfx_get_poke_interface,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user