mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-24 03:42:31 +00:00
(RMenu) Move RMenu logic out of graphics driver context files
This commit is contained in:
parent
9a4ddfd2e0
commit
1c5144f9bd
@ -42,6 +42,15 @@
|
|||||||
#define EXT_CGP_PRESETS "cgp|CGP"
|
#define EXT_CGP_PRESETS "cgp|CGP"
|
||||||
#define EXT_INPUT_PRESETS "cfg|CFG"
|
#define EXT_INPUT_PRESETS "cfg|CFG"
|
||||||
|
|
||||||
|
#if defined(_XBOX1)
|
||||||
|
#define ROM_PANEL_WIDTH 510
|
||||||
|
#define ROM_PANEL_HEIGHT 20
|
||||||
|
// Rom list coordinates
|
||||||
|
int xpos, ypos;
|
||||||
|
unsigned m_menuMainRomListPos_x = 60;
|
||||||
|
unsigned m_menuMainRomListPos_y = 80;
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool set_libretro_core_as_launch;
|
static bool set_libretro_core_as_launch;
|
||||||
|
|
||||||
filebrowser_t *browser;
|
filebrowser_t *browser;
|
||||||
@ -222,6 +231,128 @@ static void menu_set_default_pos(rmenu_default_positions_t *position)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*============================================================
|
||||||
|
RMENU GRAPHICS
|
||||||
|
============================================================ */
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
|
GLuint menu_texture_id;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void texture_image_border_load(const char *path)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
|
gl_t *gl = driver.video_data;
|
||||||
|
|
||||||
|
if (!gl)
|
||||||
|
return;
|
||||||
|
|
||||||
|
glGenTextures(1, &menu_texture_id);
|
||||||
|
|
||||||
|
RARCH_LOG("Loading texture image for menu...\n");
|
||||||
|
if (!texture_image_load(path, &g_extern.console.menu_texture))
|
||||||
|
{
|
||||||
|
RARCH_ERR("Failed to load texture image for menu.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, menu_texture_id);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, gl->border_type);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gl->border_type);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, RARCH_GL_INTERNAL_FORMAT32,
|
||||||
|
g_extern.console.menu_texture.width, g_extern.console.menu_texture.height, 0,
|
||||||
|
RARCH_GL_TEXTURE_TYPE32, RARCH_GL_FORMAT32, g_extern.console.menu_texture.pixels);
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
||||||
|
|
||||||
|
free(g_extern.console.menu_texture.pixels);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rmenu_gfx_init(void)
|
||||||
|
{
|
||||||
|
if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE))
|
||||||
|
return;
|
||||||
|
|
||||||
|
#ifdef _XBOX1
|
||||||
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||||
|
|
||||||
|
strlcpy(g_extern.console.menu_texture_path,"D:\\Media\\main-menu_480p.png",
|
||||||
|
sizeof(g_extern.console.menu_texture_path));
|
||||||
|
|
||||||
|
texture_image_load(g_extern.console.menu_texture_path, &g_extern.console.menu_texture);
|
||||||
|
texture_image_load("D:\\Media\\menuMainRomSelectPanel.png", &g_extern.console.menu_panel);
|
||||||
|
|
||||||
|
//Display some text
|
||||||
|
//Center the text (hardcoded)
|
||||||
|
xpos = d3d->win_width == 640 ? 65 : 400;
|
||||||
|
ypos = d3d->win_width == 640 ? 430 : 670;
|
||||||
|
#else
|
||||||
|
texture_image_border_load(g_extern.console.menu_texture_path);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rmenu_gfx_draw_panel(rarch_position_t *position)
|
||||||
|
{
|
||||||
|
#ifdef _XBOX1
|
||||||
|
g_extern.console.menu_panel.x = position->x;
|
||||||
|
g_extern.console.menu_panel.y = position->y;
|
||||||
|
g_extern.console.menu_panel.width = ROM_PANEL_WIDTH;
|
||||||
|
g_extern.console.menu_panel.height = ROM_PANEL_HEIGHT;
|
||||||
|
texture_image_render(&g_extern.console.menu_panel);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rmenu_gfx_draw_bg(rarch_position_t *position)
|
||||||
|
{
|
||||||
|
#ifdef _XBOX1
|
||||||
|
g_extern.console.menu_texture.x = 0;
|
||||||
|
g_extern.console.menu_texture.y = 0;
|
||||||
|
texture_image_render(&g_extern.console.menu_texture);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rmenu_gfx_frame(void *data)
|
||||||
|
{
|
||||||
|
(void)data;
|
||||||
|
#if defined(HAVE_OPENGL)
|
||||||
|
gl_t *gl = (gl_t*)data;
|
||||||
|
|
||||||
|
gl_shader_use(gl, RARCH_CG_MENU_SHADER_INDEX);
|
||||||
|
gl_set_viewport(gl, gl->win_width, gl->win_height, true, false);
|
||||||
|
|
||||||
|
if (gl->shader)
|
||||||
|
{
|
||||||
|
gl->shader->set_params(gl->win_width, gl->win_height,
|
||||||
|
gl->win_width, gl->win_height,
|
||||||
|
gl->win_width, gl->win_height,
|
||||||
|
g_extern.frame_count, NULL, NULL, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, menu_texture_id);
|
||||||
|
|
||||||
|
gl->coords.vertex = vertexes_flipped;
|
||||||
|
|
||||||
|
gl_shader_set_coords(gl, &gl->coords, &gl->mvp);
|
||||||
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
||||||
|
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rmenu_gfx_free(void)
|
||||||
|
{
|
||||||
|
#ifdef _XBOX1
|
||||||
|
texture_image_free(&g_extern.console.menu_texture);
|
||||||
|
texture_image_free(&g_extern.console.menu_panel);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/*============================================================
|
/*============================================================
|
||||||
MENU STACK
|
MENU STACK
|
||||||
============================================================ */
|
============================================================ */
|
||||||
@ -736,11 +867,11 @@ static void populate_setting_item(void *data, unsigned input)
|
|||||||
static void display_menubar(uint8_t menu_type)
|
static void display_menubar(uint8_t menu_type)
|
||||||
{
|
{
|
||||||
char title[32];
|
char title[32];
|
||||||
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
|
|
||||||
filebrowser_t *fb = browser;
|
|
||||||
char msg[128];
|
char msg[128];
|
||||||
font_params_t font_parms = {0};
|
font_params_t font_parms = {0};
|
||||||
|
|
||||||
|
filebrowser_t *fb = browser;
|
||||||
|
|
||||||
rmenu_default_positions_t default_pos;
|
rmenu_default_positions_t default_pos;
|
||||||
menu_set_default_pos(&default_pos);
|
menu_set_default_pos(&default_pos);
|
||||||
|
|
||||||
@ -882,7 +1013,7 @@ static void display_menubar(uint8_t menu_type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rarch_position_t position = {0};
|
rarch_position_t position = {0};
|
||||||
device_ptr->ctx_driver->rmenu_draw_bg(&position);
|
rmenu_gfx_draw_bg(&position);
|
||||||
|
|
||||||
font_parms.x = default_pos.core_msg_x_position;
|
font_parms.x = default_pos.core_msg_x_position;
|
||||||
font_parms.y = default_pos.core_msg_y_position;
|
font_parms.y = default_pos.core_msg_y_position;
|
||||||
@ -949,7 +1080,6 @@ static void browser_update(void *data, uint64_t input, const char *extensions)
|
|||||||
static void browser_render(void *data)
|
static void browser_render(void *data)
|
||||||
{
|
{
|
||||||
filebrowser_t *b = (filebrowser_t*)data;
|
filebrowser_t *b = (filebrowser_t*)data;
|
||||||
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
|
|
||||||
unsigned file_count = b->current_dir.list->size;
|
unsigned file_count = b->current_dir.list->size;
|
||||||
unsigned current_index = 0;
|
unsigned current_index = 0;
|
||||||
unsigned page_number = 0;
|
unsigned page_number = 0;
|
||||||
@ -979,7 +1109,7 @@ static void browser_render(void *data)
|
|||||||
rarch_position_t position = {0};
|
rarch_position_t position = {0};
|
||||||
position.x = default_pos.x_position;
|
position.x = default_pos.x_position;
|
||||||
position.y = default_pos.starting_y_position;
|
position.y = default_pos.starting_y_position;
|
||||||
device_ptr->ctx_driver->rmenu_draw_panel(&position);
|
rmenu_gfx_draw_panel(&position);
|
||||||
}
|
}
|
||||||
|
|
||||||
font_parms.x = default_pos.x_position;
|
font_parms.x = default_pos.x_position;
|
||||||
@ -1392,7 +1522,7 @@ static int set_setting_action(uint8_t menu_type, unsigned switchvalue, uint64_t
|
|||||||
{
|
{
|
||||||
if (g_extern.console.screen.resolutions.list[g_extern.console.screen.resolutions.current.idx] == CELL_VIDEO_OUT_RESOLUTION_576)
|
if (g_extern.console.screen.resolutions.list[g_extern.console.screen.resolutions.current.idx] == CELL_VIDEO_OUT_RESOLUTION_576)
|
||||||
{
|
{
|
||||||
if (gfx_ctx_check_resolution(CELL_VIDEO_OUT_RESOLUTION_576))
|
if (g_extern.console.screen.pal_enable)
|
||||||
g_extern.lifecycle_mode_state |= (1ULL<< MODE_VIDEO_PAL_ENABLE);
|
g_extern.lifecycle_mode_state |= (1ULL<< MODE_VIDEO_PAL_ENABLE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2275,9 +2405,6 @@ static int select_setting(uint8_t menu_type, uint64_t input)
|
|||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
|
|
||||||
|
|
||||||
|
|
||||||
switch (menu_type)
|
switch (menu_type)
|
||||||
{
|
{
|
||||||
case GENERAL_VIDEO_MENU:
|
case GENERAL_VIDEO_MENU:
|
||||||
@ -2360,7 +2487,7 @@ static int select_setting(uint8_t menu_type, uint64_t input)
|
|||||||
position.x = default_pos.x_position;
|
position.x = default_pos.x_position;
|
||||||
position.y = default_pos.starting_y_position;
|
position.y = default_pos.starting_y_position;
|
||||||
|
|
||||||
device_ptr->ctx_driver->rmenu_draw_panel(&position);
|
rmenu_gfx_draw_panel(&position);
|
||||||
|
|
||||||
font_parms.x = default_pos.x_position;
|
font_parms.x = default_pos.x_position;
|
||||||
font_parms.y = default_pos.comment_y_position;
|
font_parms.y = default_pos.comment_y_position;
|
||||||
@ -2984,7 +3111,6 @@ static int ingame_menu(uint8_t menu_type, uint64_t input)
|
|||||||
uint8_t max_settings = MAX_NO_OF_INGAME_MENU_SETTINGS;
|
uint8_t max_settings = MAX_NO_OF_INGAME_MENU_SETTINGS;
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
|
|
||||||
font_params_t font_parms = {0};
|
font_params_t font_parms = {0};
|
||||||
|
|
||||||
rmenu_default_positions_t default_pos;
|
rmenu_default_positions_t default_pos;
|
||||||
@ -3035,7 +3161,7 @@ static int ingame_menu(uint8_t menu_type, uint64_t input)
|
|||||||
position.x = default_pos.x_position;
|
position.x = default_pos.x_position;
|
||||||
position.y = default_pos.starting_y_position;
|
position.y = default_pos.starting_y_position;
|
||||||
|
|
||||||
device_ptr->ctx_driver->rmenu_draw_panel(&position);
|
rmenu_gfx_draw_panel(&position);
|
||||||
|
|
||||||
font_parms.x = default_pos.x_position;
|
font_parms.x = default_pos.x_position;
|
||||||
font_parms.y = default_pos.comment_y_position;
|
font_parms.y = default_pos.comment_y_position;
|
||||||
@ -3145,10 +3271,9 @@ static int menu_input_process(uint8_t menu_type, uint64_t old_state)
|
|||||||
RMENU API
|
RMENU API
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
|
|
||||||
void menu_init(void)
|
void menu_init(void)
|
||||||
{
|
{
|
||||||
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
|
|
||||||
|
|
||||||
browser = (filebrowser_t*)filebrowser_init(g_extern.console.main_wrap.default_rom_startup_dir, g_extern.system.valid_extensions);
|
browser = (filebrowser_t*)filebrowser_init(g_extern.console.main_wrap.default_rom_startup_dir, g_extern.system.valid_extensions);
|
||||||
tmpBrowser = (filebrowser_t*)filebrowser_init(default_paths.filesystem_root_dir, "");
|
tmpBrowser = (filebrowser_t*)filebrowser_init(default_paths.filesystem_root_dir, "");
|
||||||
|
|
||||||
@ -3157,11 +3282,14 @@ void menu_init(void)
|
|||||||
|
|
||||||
menu_stack_push(FILE_BROWSER_MENU);
|
menu_stack_push(FILE_BROWSER_MENU);
|
||||||
|
|
||||||
device_ptr->ctx_driver->rmenu_init();
|
rmenu_gfx_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void menu_free(void)
|
void menu_free(void)
|
||||||
{
|
{
|
||||||
|
rmenu_gfx_free();
|
||||||
|
|
||||||
filebrowser_free(browser);
|
filebrowser_free(browser);
|
||||||
filebrowser_free(tmpBrowser);
|
filebrowser_free(tmpBrowser);
|
||||||
}
|
}
|
||||||
@ -3182,7 +3310,7 @@ bool menu_iterate(void)
|
|||||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU_DRAW);
|
g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU_DRAW);
|
||||||
|
|
||||||
#ifndef __CELLOS_LV2__
|
#ifndef __CELLOS_LV2__
|
||||||
device_ptr->ctx_driver->rmenu_init();
|
rmenu_gfx_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_MENU_PREINIT);
|
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_MENU_PREINIT);
|
||||||
@ -3213,6 +3341,7 @@ bool menu_iterate(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rarch_render_cached_frame();
|
rarch_render_cached_frame();
|
||||||
|
rmenu_gfx_frame(driver.video_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//first button input frame
|
//first button input frame
|
||||||
@ -3370,8 +3499,8 @@ deinit:
|
|||||||
|
|
||||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_MENU_DRAW);
|
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_MENU_DRAW);
|
||||||
|
|
||||||
#ifndef __CELLOS_LV2__
|
#ifdef _XBOX1
|
||||||
device_ptr->ctx_driver->rmenu_free();
|
rmenu_gfx_free();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -569,6 +569,7 @@ struct global
|
|||||||
unsigned gamma_correction;
|
unsigned gamma_correction;
|
||||||
unsigned char flicker_filter_index;
|
unsigned char flicker_filter_index;
|
||||||
unsigned char soft_filter_index;
|
unsigned char soft_filter_index;
|
||||||
|
bool pal_enable;
|
||||||
} screen;
|
} screen;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
|
@ -42,20 +42,11 @@
|
|||||||
#include "../shader_cg.h"
|
#include "../shader_cg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_RMENU)
|
|
||||||
GLuint menu_texture_id;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAVE_PSGL)
|
#if defined(HAVE_PSGL)
|
||||||
static PSGLdevice* gl_device;
|
static PSGLdevice* gl_device;
|
||||||
static PSGLcontext* gl_context;
|
static PSGLcontext* gl_context;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int gfx_ctx_check_resolution(unsigned resolution_id)
|
|
||||||
{
|
|
||||||
return cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, resolution_id, CELL_VIDEO_OUT_ASPECT_AUTO, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned gfx_ctx_get_resolution_width(unsigned resolution_id)
|
static unsigned gfx_ctx_get_resolution_width(unsigned resolution_id)
|
||||||
{
|
{
|
||||||
CellVideoOutResolution resolution;
|
CellVideoOutResolution resolution;
|
||||||
@ -141,7 +132,8 @@ static void gfx_ctx_get_available_resolutions (void)
|
|||||||
resolution_count = 0;
|
resolution_count = 0;
|
||||||
for (unsigned i = 0; i < num_videomodes; i++)
|
for (unsigned i = 0; i < num_videomodes; i++)
|
||||||
{
|
{
|
||||||
if(gfx_ctx_check_resolution(videomode[i]))
|
if (cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, videomode[i],
|
||||||
|
CELL_VIDEO_OUT_ASPECT_AUTO, 0))
|
||||||
resolution_count++;
|
resolution_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +142,8 @@ static void gfx_ctx_get_available_resolutions (void)
|
|||||||
|
|
||||||
for (unsigned i = 0; i < num_videomodes; i++)
|
for (unsigned i = 0; i < num_videomodes; i++)
|
||||||
{
|
{
|
||||||
if(gfx_ctx_check_resolution(videomode[i]))
|
if (cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, videomode[i],
|
||||||
|
CELL_VIDEO_OUT_ASPECT_AUTO, 0))
|
||||||
{
|
{
|
||||||
g_extern.console.screen.resolutions.list[g_extern.console.screen.resolutions.count++] = videomode[i];
|
g_extern.console.screen.resolutions.list[g_extern.console.screen.resolutions.count++] = videomode[i];
|
||||||
g_extern.console.screen.resolutions.initial.id = videomode[i];
|
g_extern.console.screen.resolutions.initial.id = videomode[i];
|
||||||
@ -216,94 +209,6 @@ static void gfx_ctx_swap_buffers(void)
|
|||||||
|
|
||||||
static void gfx_ctx_set_resize(unsigned width, unsigned height) { }
|
static void gfx_ctx_set_resize(unsigned width, unsigned height) { }
|
||||||
|
|
||||||
void texture_image_border_load(const char *path)
|
|
||||||
{
|
|
||||||
gl_t *gl = driver.video_data;
|
|
||||||
|
|
||||||
if (!gl)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#ifdef HAVE_RMENU
|
|
||||||
glGenTextures(1, &menu_texture_id);
|
|
||||||
|
|
||||||
RARCH_LOG("Loading texture image for menu...\n");
|
|
||||||
if (!texture_image_load(path, &g_extern.console.menu_texture))
|
|
||||||
{
|
|
||||||
RARCH_ERR("Failed to load texture image for menu.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, menu_texture_id);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, gl->border_type);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gl->border_type);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
||||||
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, RARCH_GL_INTERNAL_FORMAT32,
|
|
||||||
g_extern.console.menu_texture.width, g_extern.console.menu_texture.height, 0,
|
|
||||||
RARCH_GL_TEXTURE_TYPE32, RARCH_GL_FORMAT32, g_extern.console.menu_texture.pixels);
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
|
||||||
|
|
||||||
free(g_extern.console.menu_texture.pixels);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool gfx_ctx_rmenu_init(void)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_RMENU
|
|
||||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
texture_image_border_load(g_extern.console.menu_texture_path);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(HAVE_RMENU)
|
|
||||||
static void gfx_ctx_rmenu_free(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gfx_ctx_rmenu_frame(void *data)
|
|
||||||
{
|
|
||||||
gl_t *gl = (gl_t*)data;
|
|
||||||
|
|
||||||
gl_shader_use(gl, RARCH_CG_MENU_SHADER_INDEX);
|
|
||||||
gl_set_viewport(gl, gl->win_width, gl->win_height, true, false);
|
|
||||||
|
|
||||||
if (gl->shader)
|
|
||||||
{
|
|
||||||
gl->shader->set_params(gl->win_width, gl->win_height,
|
|
||||||
gl->win_width, gl->win_height,
|
|
||||||
gl->win_width, gl->win_height,
|
|
||||||
g_extern.frame_count, NULL, NULL, NULL, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, menu_texture_id);
|
|
||||||
|
|
||||||
gl->coords.vertex = vertexes_flipped;
|
|
||||||
|
|
||||||
gl_shader_set_coords(gl, &gl->coords, &gl->mvp);
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
|
|
||||||
gl_set_viewport(gl, gl->win_width, gl->win_height, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gfx_ctx_menu_draw_panel(rarch_position_t *position)
|
|
||||||
{
|
|
||||||
(void)position;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gfx_ctx_menu_draw_bg(rarch_position_t *position)
|
|
||||||
{
|
|
||||||
(void)position;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void gfx_ctx_update_window_title(bool reset) { }
|
static void gfx_ctx_update_window_title(bool reset) { }
|
||||||
|
|
||||||
static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
|
static void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
|
||||||
@ -376,6 +281,10 @@ static bool gfx_ctx_init(void)
|
|||||||
psglResetCurrentContext();
|
psglResetCurrentContext();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
g_extern.console.screen.pal_enable = cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, CELL_VIDEO_OUT_RESOLUTION_576, CELL_VIDEO_OUT_ASPECT_AUTO, 0);
|
||||||
|
|
||||||
|
gfx_ctx_get_available_resolutions();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -433,13 +342,6 @@ const gfx_ctx_driver_t gfx_ctx_ps3 = {
|
|||||||
NULL,
|
NULL,
|
||||||
"ps3",
|
"ps3",
|
||||||
#ifdef HAVE_RMENU
|
#ifdef HAVE_RMENU
|
||||||
gfx_ctx_get_available_resolutions,
|
|
||||||
gfx_ctx_check_resolution,
|
|
||||||
gfx_ctx_rmenu_init,
|
|
||||||
gfx_ctx_rmenu_frame,
|
|
||||||
gfx_ctx_rmenu_free,
|
|
||||||
gfx_ctx_menu_draw_bg,
|
|
||||||
gfx_ctx_menu_draw_panel,
|
|
||||||
rmenu_ctx_ps3_screenshot_enable,
|
rmenu_ctx_ps3_screenshot_enable,
|
||||||
rmenu_ctx_ps3_screenshot_dump,
|
rmenu_ctx_ps3_screenshot_dump,
|
||||||
#endif
|
#endif
|
||||||
|
@ -42,15 +42,6 @@
|
|||||||
#define XBOX_PRESENTATIONINTERVAL D3DRS_PRESENTINTERVAL
|
#define XBOX_PRESENTATIONINTERVAL D3DRS_PRESENTINTERVAL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_XBOX1) && defined(HAVE_RMENU)
|
|
||||||
#define ROM_PANEL_WIDTH 510
|
|
||||||
#define ROM_PANEL_HEIGHT 20
|
|
||||||
// Rom list coordinates
|
|
||||||
int xpos, ypos;
|
|
||||||
unsigned m_menuMainRomListPos_x;
|
|
||||||
unsigned m_menuMainRomListPos_y;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void gfx_ctx_xdk_set_swap_interval(unsigned interval)
|
static void gfx_ctx_xdk_set_swap_interval(unsigned interval)
|
||||||
{
|
{
|
||||||
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||||
@ -62,11 +53,6 @@ static void gfx_ctx_xdk_set_swap_interval(unsigned interval)
|
|||||||
d3dr->SetRenderState(XBOX_PRESENTATIONINTERVAL, D3DPRESENT_INTERVAL_IMMEDIATE);
|
d3dr->SetRenderState(XBOX_PRESENTATIONINTERVAL, D3DPRESENT_INTERVAL_IMMEDIATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gfx_ctx_xdk_get_available_resolutions (void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void gfx_ctx_xdk_check_window(bool *quit,
|
static void gfx_ctx_xdk_check_window(bool *quit,
|
||||||
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
|
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
|
||||||
{
|
{
|
||||||
@ -83,58 +69,6 @@ static void gfx_ctx_xdk_check_window(bool *quit,
|
|||||||
|
|
||||||
static void gfx_ctx_xdk_set_resize(unsigned width, unsigned height) { }
|
static void gfx_ctx_xdk_set_resize(unsigned width, unsigned height) { }
|
||||||
|
|
||||||
static bool gfx_ctx_xdk_menu_init(void)
|
|
||||||
{
|
|
||||||
#if defined(_XBOX1) && defined(HAVE_RMENU)
|
|
||||||
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
|
||||||
|
|
||||||
int width = d3d->win_width;
|
|
||||||
|
|
||||||
// Load background image
|
|
||||||
if(width == 640)
|
|
||||||
{
|
|
||||||
strlcpy(g_extern.console.menu_texture_path,"D:\\Media\\main-menu_480p.png",
|
|
||||||
sizeof(g_extern.console.menu_texture_path));
|
|
||||||
m_menuMainRomListPos_x = 60;
|
|
||||||
m_menuMainRomListPos_y = 80;
|
|
||||||
}
|
|
||||||
else if(width == 1280)
|
|
||||||
{
|
|
||||||
strlcpy(g_extern.console.menu_texture_path, "D:\\Media\\main-menu_720p.png",
|
|
||||||
sizeof(g_extern.console.menu_texture_path));
|
|
||||||
m_menuMainRomListPos_x = 360;
|
|
||||||
m_menuMainRomListPos_y = 130;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE)) { }
|
|
||||||
else
|
|
||||||
texture_image_load(g_extern.console.menu_texture_path, &g_extern.console.menu_texture);
|
|
||||||
|
|
||||||
// Load rom selector panel
|
|
||||||
texture_image_load("D:\\Media\\menuMainRomSelectPanel.png", &g_extern.console.menu_panel);
|
|
||||||
|
|
||||||
//Display some text
|
|
||||||
//Center the text (hardcoded)
|
|
||||||
xpos = width == 640 ? 65 : 400;
|
|
||||||
ypos = width == 640 ? 430 : 670;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gfx_ctx_xdk_menu_frame(void* data)
|
|
||||||
{
|
|
||||||
(void)data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gfx_ctx_xdk_menu_free(void)
|
|
||||||
{
|
|
||||||
#if defined(_XBOX1) && defined(HAVE_RMENU)
|
|
||||||
texture_image_free(&g_extern.console.menu_texture);
|
|
||||||
texture_image_free(&g_extern.console.menu_panel);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gfx_ctx_xdk_swap_buffers(void)
|
static void gfx_ctx_xdk_swap_buffers(void)
|
||||||
{
|
{
|
||||||
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||||
@ -150,26 +84,6 @@ static bool gfx_ctx_xdk_window_has_focus(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gfx_ctx_xdk_menu_draw_bg(rarch_position_t *position)
|
|
||||||
{
|
|
||||||
#if defined(_XBOX1) && defined(HAVE_RMENU)
|
|
||||||
g_extern.console.menu_texture.x = 0;
|
|
||||||
g_extern.console.menu_texture.y = 0;
|
|
||||||
texture_image_render(&g_extern.console.menu_texture);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gfx_ctx_xdk_menu_draw_panel(rarch_position_t *position)
|
|
||||||
{
|
|
||||||
#if defined(_XBOX1) && defined(HAVE_RMENU)
|
|
||||||
g_extern.console.menu_panel.x = position->x;
|
|
||||||
g_extern.console.menu_panel.y = position->y;
|
|
||||||
g_extern.console.menu_panel.width = ROM_PANEL_WIDTH;
|
|
||||||
g_extern.console.menu_panel.height = ROM_PANEL_HEIGHT;
|
|
||||||
texture_image_render(&g_extern.console.menu_panel);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static void gfx_ctx_xdk_menu_screenshot_enable(bool enable)
|
static void gfx_ctx_xdk_menu_screenshot_enable(bool enable)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -357,17 +271,6 @@ static bool gfx_ctx_xdk_bind_api(enum gfx_ctx_api api)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*============================================================
|
|
||||||
MISC
|
|
||||||
TODO: Refactor
|
|
||||||
============================================================ */
|
|
||||||
|
|
||||||
int gfx_ctx_xdk_check_resolution(unsigned resolution_id)
|
|
||||||
{
|
|
||||||
/* TODO: implement */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool gfx_ctx_init_egl_image_buffer(const video_info_t *video)
|
static bool gfx_ctx_init_egl_image_buffer(const video_info_t *video)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -398,13 +301,6 @@ const gfx_ctx_driver_t gfx_ctx_xdk = {
|
|||||||
NULL,
|
NULL,
|
||||||
"xdk",
|
"xdk",
|
||||||
#if defined(HAVE_RMENU)
|
#if defined(HAVE_RMENU)
|
||||||
gfx_ctx_xdk_get_available_resolutions,
|
|
||||||
gfx_ctx_xdk_check_resolution,
|
|
||||||
gfx_ctx_xdk_menu_init,
|
|
||||||
gfx_ctx_xdk_menu_frame,
|
|
||||||
gfx_ctx_xdk_menu_free,
|
|
||||||
gfx_ctx_xdk_menu_draw_bg,
|
|
||||||
gfx_ctx_xdk_menu_draw_panel,
|
|
||||||
gfx_ctx_xdk_menu_screenshot_enable,
|
gfx_ctx_xdk_menu_screenshot_enable,
|
||||||
gfx_ctx_xdk_menu_screenshot_dump,
|
gfx_ctx_xdk_menu_screenshot_dump,
|
||||||
#endif
|
#endif
|
||||||
|
@ -108,13 +108,6 @@ typedef struct gfx_ctx_driver
|
|||||||
const char *ident;
|
const char *ident;
|
||||||
|
|
||||||
#if defined(HAVE_RMENU)
|
#if defined(HAVE_RMENU)
|
||||||
void (*get_available_resolutions)(void);
|
|
||||||
int (*check_resolution)(unsigned resolution_id);
|
|
||||||
bool (*rmenu_init)(void);
|
|
||||||
void (*rmenu_frame)(void *data);
|
|
||||||
void (*rmenu_free)(void);
|
|
||||||
void (*rmenu_draw_bg)(rarch_position_t *position);
|
|
||||||
void (*rmenu_draw_panel)(rarch_position_t *position);
|
|
||||||
void (*rmenu_screenshot_enable)(bool enable);
|
void (*rmenu_screenshot_enable)(bool enable);
|
||||||
void (*rmenu_screenshot_dump)(void *data);
|
void (*rmenu_screenshot_dump)(void *data);
|
||||||
#endif
|
#endif
|
||||||
|
16
gfx/gl.c
16
gfx/gl.c
@ -1573,9 +1573,7 @@ static bool gl_frame(void *data, const void *frame, unsigned width, unsigned hei
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_RMENU)
|
#if defined(HAVE_RMENU)
|
||||||
if (lifecycle_mode_state & (1ULL << MODE_MENU_DRAW))
|
if (!(lifecycle_mode_state & (1ULL << MODE_MENU_DRAW)))
|
||||||
context_rmenu_frame_func(gl);
|
|
||||||
else
|
|
||||||
#endif
|
#endif
|
||||||
context_swap_buffers_func();
|
context_swap_buffers_func();
|
||||||
|
|
||||||
@ -1596,11 +1594,6 @@ static void gl_free(void *data)
|
|||||||
|
|
||||||
gl_t *gl = (gl_t*)data;
|
gl_t *gl = (gl_t*)data;
|
||||||
|
|
||||||
#ifdef HAVE_RMENU
|
|
||||||
if (gl->ctx_driver->rmenu_free)
|
|
||||||
context_rmenu_free_func();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gl->font_ctx)
|
if (gl->font_ctx)
|
||||||
gl->font_ctx->deinit(gl);
|
gl->font_ctx->deinit(gl);
|
||||||
gl_shader_deinit(gl);
|
gl_shader_deinit(gl);
|
||||||
@ -2249,13 +2242,6 @@ static void gl_start(void)
|
|||||||
|
|
||||||
// Comes too early for console - moved to gl_start
|
// Comes too early for console - moved to gl_start
|
||||||
gl->font_ctx = gl_font_init_first(gl, g_settings.video.font_path, g_settings.video.font_size);
|
gl->font_ctx = gl_font_init_first(gl, g_settings.video.font_path, g_settings.video.font_size);
|
||||||
|
|
||||||
#ifdef HAVE_RMENU
|
|
||||||
context_get_available_resolutions_func();
|
|
||||||
|
|
||||||
if (gl->ctx_driver->rmenu_init)
|
|
||||||
context_rmenu_init_func();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gl_stop(void)
|
static void gl_stop(void)
|
||||||
|
@ -76,8 +76,6 @@
|
|||||||
#define context_get_video_size_func(win, height) gl->ctx_driver->get_video_size(win, height)
|
#define context_get_video_size_func(win, height) gl->ctx_driver->get_video_size(win, height)
|
||||||
#define context_update_window_title_func(var) gl->ctx_driver->update_window_title(var)
|
#define context_update_window_title_func(var) gl->ctx_driver->update_window_title(var)
|
||||||
#define context_destroy_func() gl->ctx_driver->destroy()
|
#define context_destroy_func() gl->ctx_driver->destroy()
|
||||||
#define context_set_fbo_func(var) gl->ctx_driver->set_fbo(var)
|
|
||||||
#define context_get_available_resolutions_func() gl->ctx_driver->get_available_resolutions()
|
|
||||||
#define context_translate_aspect_func(width, height) gl->ctx_driver->translate_aspect(width, height)
|
#define context_translate_aspect_func(width, height) gl->ctx_driver->translate_aspect(width, height)
|
||||||
#define context_set_resize_func(width, height) gl->ctx_driver->set_resize(width, height)
|
#define context_set_resize_func(width, height) gl->ctx_driver->set_resize(width, height)
|
||||||
#define context_swap_buffers_func() gl->ctx_driver->swap_buffers()
|
#define context_swap_buffers_func() gl->ctx_driver->swap_buffers()
|
||||||
@ -91,12 +89,6 @@
|
|||||||
#define context_set_video_mode_func(width, height, fullscreen) gl->ctx_driver->set_video_mode(width, height, fullscreen)
|
#define context_set_video_mode_func(width, height, fullscreen) gl->ctx_driver->set_video_mode(width, height, fullscreen)
|
||||||
#define context_input_driver_func(input, input_data) gl->ctx_driver->input_driver(input, input_data)
|
#define context_input_driver_func(input, input_data) gl->ctx_driver->input_driver(input, input_data)
|
||||||
|
|
||||||
#ifdef HAVE_RMENU
|
|
||||||
#define context_rmenu_init_func() gl->ctx_driver->rmenu_init()
|
|
||||||
#define context_rmenu_frame_func(ctx) gl->ctx_driver->rmenu_frame(ctx)
|
|
||||||
#define context_rmenu_free_func() gl->ctx_driver->rmenu_free()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
#define context_init_egl_image_buffer_func(video) gl->ctx_driver->init_egl_image_buffer(video)
|
#define context_init_egl_image_buffer_func(video) gl->ctx_driver->init_egl_image_buffer(video)
|
||||||
#define context_write_egl_image_func(frame, width, height, pitch, base_size, tex_index, img) \
|
#define context_write_egl_image_func(frame, width, height, pitch, base_size, tex_index, img) \
|
||||||
|
@ -24,11 +24,6 @@
|
|||||||
#define gl_shader_set_params_func(vid, width, height, tex_width, tex_height, out_width, out_height, frame_count, info, prev_info, fbo_info, fbo_info_cnt) gl_glsl_set_params(width, height, tex_width, tex_height, out_width, out_height, frame_count, info, prev_info, fbo_info, fbo_info_cnt)
|
#define gl_shader_set_params_func(vid, width, height, tex_width, tex_height, out_width, out_height, frame_count, info, prev_info, fbo_info, fbo_info_cnt) gl_glsl_set_params(width, height, tex_width, tex_height, out_width, out_height, frame_count, info, prev_info, fbo_info, fbo_info_cnt)
|
||||||
#define gl_shader_set_coords_func(vid, coords, mat) gl_glsl_set_coords(coords); gl_glsl_set_mvp(mat)
|
#define gl_shader_set_coords_func(vid, coords, mat) gl_glsl_set_coords(coords); gl_glsl_set_mvp(mat)
|
||||||
|
|
||||||
#ifdef HAVE_FBO
|
|
||||||
#define context_set_fbo_func(var) gl->ctx_driver->set_fbo(var)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define context_get_available_resolutions_func() gl->ctx_driver->get_available_resolutions()
|
|
||||||
#define context_translate_aspect_func(width, height) (device_aspect)
|
#define context_translate_aspect_func(width, height) (device_aspect)
|
||||||
#define context_set_resize_func(width, height) gl->ctx_driver->set_resize(width, height)
|
#define context_set_resize_func(width, height) gl->ctx_driver->set_resize(width, height)
|
||||||
#define context_swap_buffers_func() eglSwapBuffers(g_egl_dpy, g_egl_surf)
|
#define context_swap_buffers_func() eglSwapBuffers(g_egl_dpy, g_egl_surf)
|
||||||
@ -39,12 +34,6 @@
|
|||||||
#define context_input_driver_func(input, input_data) gl->ctx_driver->input_driver(input, input_data)
|
#define context_input_driver_func(input, input_data) gl->ctx_driver->input_driver(input, input_data)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_RMENU
|
|
||||||
#define context_rmenu_init_func() gl->ctx_driver->rmenu_init()
|
|
||||||
#define context_rmenu_frame_func(ctx) gl->ctx_driver->rmenu_frame(ctx)
|
|
||||||
#define context_rmenu_free_func() gl->ctx_driver->rmenu_free()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_EGL
|
#ifdef HAVE_EGL
|
||||||
#define context_init_egl_image_buffer_func(video) gl->ctx_driver->init_egl_image_buffer(video)
|
#define context_init_egl_image_buffer_func(video) gl->ctx_driver->init_egl_image_buffer(video)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user