(RMenu) Remove RMenu context files and use Gfx context files

instead
This commit is contained in:
twinaphex 2012-11-19 04:09:16 +01:00
parent 3bdfb3a011
commit f0ebecfc32
11 changed files with 1350 additions and 1465 deletions

View File

@ -359,14 +359,7 @@ SCREENSHOTS
/*============================================================
MENU
============================================================ */
#ifdef _XBOX
#include "../rmenu/context/rmenu_ctx_xdk.c"
#endif
#ifdef HAVE_RMENU
#if defined(__CELLOS_LV2__)
#include "../rmenu/context/rmenu_ctx_ps3.c"
#endif
#include "../rmenu/rmenu_stack.c"
#include "../rmenu/rmenu.c"
#endif

View File

@ -1,214 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
* Copyright (C) 2011-2012 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(__CELLOS_LV2__)
#include <sdk_version.h>
#include <sysutil/sysutil_screenshot.h>
#endif
#ifdef HAVE_SYSUTILS
#include <cell/sysmodule.h>
#endif
#include "../rmenu.h"
#include "../../../gfx/gfx_context.h"
#define HARDCODE_FONT_SIZE 0.91f
#define POSITION_X 0.09f
#define POSITION_X_CENTER 0.5f
#define POSITION_Y_START 0.17f
#define POSITION_Y_INCREMENT 0.035f
#define POSITION_Y_BEGIN (POSITION_Y_START + POSITION_Y_INCREMENT)
#define COMMENT_TWO_Y_POSITION 0.91f
#define COMMENT_Y_POSITION 0.82f
#define MSG_QUEUE_X_POSITION g_settings.video.msg_pos_x
#define MSG_QUEUE_Y_POSITION 0.76f
#define MSG_QUEUE_FONT_SIZE 1.03f
#define MSG_PREV_NEXT_Y_POSITION 0.03f
#define CURRENT_PATH_Y_POSITION 0.15f
#define CURRENT_PATH_FONT_SIZE FONT_SIZE
#define FONT_SIZE (g_extern.console.rmenu.font_size)
#define NUM_ENTRY_PER_PAGE 15
#define DRIVE_MAPPING_SIZE 4
const char drive_mappings[DRIVE_MAPPING_SIZE][32] = {
"/app_home/",
"/dev_hdd0/",
"/dev_hdd1/",
"/host_root/"
};
unsigned char drive_mapping_idx = 1;
static void rmenu_ctx_ps3_clear(void)
{
gfx_ctx_clear();
}
static void rmenu_ctx_ps3_blend(bool enable)
{
gfx_ctx_set_blend(enable);
}
static void rmenu_ctx_ps3_init_textures(void)
{
}
static void rmenu_ctx_ps3_free_textures(void)
{
gl_t *gl = driver.video_data;
gl->draw_rmenu = false;
}
static void rmenu_ctx_ps3_render_selection_panel(rmenu_position_t *position)
{
(void)position;
}
static void rmenu_ctx_ps3_render_bg(rmenu_position_t *position)
{
(void)position;
}
static void rmenu_ctx_ps3_swap_buffers(void)
{
gfx_ctx_swap_buffers();
#ifdef HAVE_SYSUTILS
cellSysutilCheckCallback();
#endif
}
void rmenu_ctx_ps3_set_swap_interval(unsigned interval)
{
gfx_ctx_set_swap_interval(interval);
}
static void rmenu_ctx_ps3_set_default_pos(rmenu_default_positions_t *position)
{
position->x_position = POSITION_X;
position->x_position_center = POSITION_X_CENTER;
position->y_position = POSITION_Y_BEGIN;
position->comment_y_position = COMMENT_Y_POSITION;
position->y_position_increment = POSITION_Y_INCREMENT;
position->starting_y_position = POSITION_Y_START;
position->comment_two_y_position = COMMENT_TWO_Y_POSITION;
position->font_size = HARDCODE_FONT_SIZE;
position->msg_queue_x_position = MSG_QUEUE_X_POSITION;
position->msg_queue_y_position = MSG_QUEUE_Y_POSITION;
position->msg_queue_font_size= MSG_QUEUE_FONT_SIZE;
position->msg_prev_next_y_position = MSG_PREV_NEXT_Y_POSITION;
position->current_path_font_size = CURRENT_PATH_FONT_SIZE;
position->current_path_y_position = CURRENT_PATH_Y_POSITION;
position->variable_font_size = FONT_SIZE;
position->entries_per_page = NUM_ENTRY_PER_PAGE;
position->core_msg_x_position = 0.3f;
position->core_msg_y_position = 0.06f;
position->core_msg_font_size = COMMENT_Y_POSITION;
}
static void rmenu_ctx_ps3_render_msg(float xpos, float ypos, float scale, unsigned color, const char *msg, ...)
{
gl_t *gl = driver.video_data;
gl_render_msg_place(gl, xpos, ypos, scale, color, msg);
}
static void rmenu_ctx_ps3_render_menu_enable(bool enable)
{
gl_t *gl = driver.video_data;
gl->draw_rmenu = enable;
}
static void rmenu_ctx_ps3_screenshot_enable(bool enable)
{
#if(CELL_SDK_VERSION > 0x340000)
if(enable)
{
cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
CellScreenShotSetParam screenshot_param = {0, 0, 0, 0};
screenshot_param.photo_title = "RetroArch PS3";
screenshot_param.game_title = "RetroArch PS3";
cellScreenShotSetParameter (&screenshot_param);
cellScreenShotEnable();
}
else
{
cellScreenShotDisable();
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
}
#endif
}
static void rmenu_ctx_ps3_screenshot_dump(void *data)
{
(void)data;
}
static const char * rmenu_ctx_ps3_drive_mapping_previous(void)
{
if(drive_mapping_idx > 0)
drive_mapping_idx--;
return drive_mappings[drive_mapping_idx];
}
static const char * rmenu_ctx_ps3_drive_mapping_next(void)
{
if((drive_mapping_idx + 1) < DRIVE_MAPPING_SIZE)
drive_mapping_idx++;
return drive_mappings[drive_mapping_idx];
}
static void rmenu_ctx_ps3_set_filtering(unsigned index, bool set_smooth)
{
gfx_ctx_set_filtering(index, set_smooth);
}
static void rmenu_ctx_ps3_set_aspect_ratio(unsigned aspectratio_index)
{
driver.video->set_aspect_ratio(NULL, aspectratio_index);
}
static void rmenu_ctx_ps3_set_fbo_enable(unsigned i)
{
gfx_ctx_set_fbo(i);
}
const rmenu_context_t rmenu_ctx_ps3 = {
.clear = rmenu_ctx_ps3_clear,
.set_filtering = rmenu_ctx_ps3_set_filtering,
.set_aspect_ratio = rmenu_ctx_ps3_set_aspect_ratio,
.blend = rmenu_ctx_ps3_blend,
.set_fbo_enable = rmenu_ctx_ps3_set_fbo_enable,
.free_textures = rmenu_ctx_ps3_free_textures,
.init_textures = rmenu_ctx_ps3_init_textures,
.render_selection_panel = rmenu_ctx_ps3_render_selection_panel,
.render_bg = rmenu_ctx_ps3_render_bg,
.render_menu_enable = rmenu_ctx_ps3_render_menu_enable,
.render_msg = rmenu_ctx_ps3_render_msg,
.screenshot_enable = rmenu_ctx_ps3_screenshot_enable,
.screenshot_dump = rmenu_ctx_ps3_screenshot_dump,
.swap_buffers = rmenu_ctx_ps3_swap_buffers,
.set_swap_interval = rmenu_ctx_ps3_set_swap_interval,
.set_default_pos = rmenu_ctx_ps3_set_default_pos,
.drive_mapping_prev = rmenu_ctx_ps3_drive_mapping_previous,
.drive_mapping_next = rmenu_ctx_ps3_drive_mapping_next,
};

View File

@ -1,248 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
* Copyright (C) 2011-2012 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "../rmenu.h"
#include "../../screenshot.h"
#ifdef _XBOX
#include "../../xdk/xdk_d3d.h"
#endif
#include "../../gfx/gfx_context.h"
#define ROM_PANEL_WIDTH 510
#define ROM_PANEL_HEIGHT 20
#define HARDCODE_FONT_SIZE 21
#define POSITION_X m_menuMainRomListPos_x
#define POSITION_X_CENTER (m_menuMainRomListPos_x + 350)
#define POSITION_Y_START m_menuMainRomListPos_y
#define POSITION_Y_BEGIN (POSITION_Y_START + POSITION_Y_INCREMENT)
#define POSITION_Y_INCREMENT 20
#define COMMENT_Y_POSITION (ypos - ((POSITION_Y_INCREMENT/2) * 3))
#define COMMENT_TWO_Y_POSITION (ypos - ((POSITION_Y_INCREMENT/2) * 1))
#define MSG_QUEUE_X_POSITION POSITION_X
#define MSG_QUEUE_Y_POSITION (ypos - ((POSITION_Y_INCREMENT/2) * 7) + 5)
#define MSG_QUEUE_FONT_SIZE HARDCODE_FONT_SIZE
#define MSG_PREV_NEXT_Y_POSITION 24
#define CURRENT_PATH_Y_POSITION (m_menuMainRomListPos_y - ((POSITION_Y_INCREMENT/2)))
#define CURRENT_PATH_FONT_SIZE 21
#define FONT_SIZE 21
#define NUM_ENTRY_PER_PAGE 12
#define DRIVE_MAPPING_SIZE 5
const char drive_mappings[DRIVE_MAPPING_SIZE][32] = {
"C:",
"D:",
"E:",
"F:",
"G:"
};
unsigned char drive_mapping_idx = 2;
int xpos, ypos;
#ifdef _XBOX1
texture_image m_menuMainRomSelectPanel;
texture_image m_menuMainBG;
// Rom list coords
int m_menuMainRomListPos_x;
int m_menuMainRomListPos_y;
#endif
static void rmenu_ctx_xdk_clear(void)
{
gfx_ctx_xdk_clear();
}
static void rmenu_ctx_xdk_blend(bool enable)
{
gfx_ctx_xdk_set_blend(enable);
}
static void rmenu_ctx_xdk_free_textures(void)
{
#ifdef _XBOX1
texture_image_free(&m_menuMainBG);
texture_image_free(&m_menuMainRomSelectPanel);
#endif
}
static void rmenu_ctx_xdk_init_textures(void)
{
#ifdef _XBOX1
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
int width = d3d->d3dpp.BackBufferWidth;
// Load background image
if(width == 640)
{
texture_image_load("D:\\Media\\main-menu_480p.png", &m_menuMainBG);
m_menuMainRomListPos_x = 60;
m_menuMainRomListPos_y = 80;
}
else if(width == 1280)
{
texture_image_load("D:\\Media\\main-menu_720p.png", &m_menuMainBG);
m_menuMainRomListPos_x = 360;
m_menuMainRomListPos_y = 130;
}
// Load rom selector panel
texture_image_load("D:\\Media\\menuMainRomSelectPanel.png", &m_menuMainRomSelectPanel);
//Display some text
//Center the text (hardcoded)
xpos = width == 640 ? 65 : 400;
ypos = width == 640 ? 430 : 670;
#endif
}
static void rmenu_ctx_xdk_render_selection_panel(rmenu_position_t *position)
{
#ifdef _XBOX1
m_menuMainRomSelectPanel.x = position->x;
m_menuMainRomSelectPanel.y = position->y;
m_menuMainRomSelectPanel.width = ROM_PANEL_WIDTH;
m_menuMainRomSelectPanel.height = ROM_PANEL_HEIGHT;
texture_image_render(&m_menuMainRomSelectPanel);
#endif
}
static void rmenu_ctx_xdk_render_bg(rmenu_position_t *position)
{
#ifdef _XBOX1
m_menuMainBG.x = 0;
m_menuMainBG.y = 0;
texture_image_render(&m_menuMainBG);
#endif
}
static void rmenu_ctx_xdk_swap_buffers(void)
{
gfx_ctx_xdk_swap_buffers();
}
void rmenu_ctx_xdk_set_swap_interval(unsigned interval)
{
gfx_ctx_xdk_set_swap_interval(interval);
}
static void rmenu_ctx_xdk_set_default_pos(rmenu_default_positions_t *position)
{
#ifdef _XBOX1
position->x_position = POSITION_X;
position->x_position_center = POSITION_X_CENTER;
position->y_position = POSITION_Y_BEGIN;
position->comment_y_position = COMMENT_Y_POSITION;
position->y_position_increment = POSITION_Y_INCREMENT;
position->starting_y_position = POSITION_Y_START;
position->comment_two_y_position = COMMENT_TWO_Y_POSITION;
position->font_size = HARDCODE_FONT_SIZE;
position->msg_queue_x_position = MSG_QUEUE_X_POSITION;
position->msg_queue_y_position = MSG_QUEUE_Y_POSITION;
position->msg_queue_font_size= MSG_QUEUE_FONT_SIZE;
position->msg_prev_next_y_position = MSG_PREV_NEXT_Y_POSITION;
position->current_path_font_size = CURRENT_PATH_FONT_SIZE;
position->current_path_y_position = CURRENT_PATH_Y_POSITION;
position->variable_font_size = FONT_SIZE;
position->entries_per_page = NUM_ENTRY_PER_PAGE;
position->core_msg_x_position = position->x_position;
position->core_msg_y_position = position->msg_prev_next_y_position + 0.01f;
position->core_msg_font_size = position->font_size;
#endif
}
static void rmenu_ctx_xdk_render_msg(float xpos, float ypos, float scale, unsigned color, const char *msg, ...)
{
#ifdef _XBOX1
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
xfonts_render_msg_place(d3d, xpos, ypos, scale, msg);
#endif
}
static void rmenu_ctx_xdk_render_menu_enable(bool enable)
{
}
static void rmenu_ctx_xdk_screenshot_enable(bool enable)
{
}
static void rmenu_ctx_xdk_screenshot_dump(void *data)
{
gfx_ctx_xdk_screenshot_dump(NULL);
}
static const char * rmenu_ctx_xdk_drive_mapping_previous(void)
{
if(drive_mapping_idx > 0)
drive_mapping_idx--;
return drive_mappings[drive_mapping_idx];
}
static const char * rmenu_ctx_xdk_drive_mapping_next(void)
{
if((drive_mapping_idx + 1) < DRIVE_MAPPING_SIZE)
drive_mapping_idx++;
return drive_mappings[drive_mapping_idx];
}
static void rmenu_ctx_xdk_set_filtering(unsigned index, bool set_smooth)
{
gfx_ctx_xdk_set_filtering(index, set_smooth);
}
static void rmenu_ctx_xdk_set_aspect_ratio(unsigned aspectratio_index)
{
driver.video->set_aspect_ratio(NULL, aspectratio_index);
}
static void rmenu_ctx_xdk_set_fbo_enable(unsigned i)
{
gfx_ctx_xdk_set_fbo(i);
}
const rmenu_context_t rmenu_ctx_xdk = {
rmenu_ctx_xdk_clear,
rmenu_ctx_xdk_set_filtering,
rmenu_ctx_xdk_set_aspect_ratio,
rmenu_ctx_xdk_blend,
rmenu_ctx_xdk_set_fbo_enable,
rmenu_ctx_xdk_free_textures,
rmenu_ctx_xdk_init_textures,
rmenu_ctx_xdk_render_selection_panel,
rmenu_ctx_xdk_render_bg,
rmenu_ctx_xdk_render_menu_enable,
rmenu_ctx_xdk_render_msg,
rmenu_ctx_xdk_screenshot_enable,
rmenu_ctx_xdk_screenshot_dump,
rmenu_ctx_xdk_swap_buffers,
rmenu_ctx_xdk_set_swap_interval,
rmenu_ctx_xdk_set_default_pos,
rmenu_ctx_xdk_drive_mapping_previous,
rmenu_ctx_xdk_drive_mapping_next,
};

File diff suppressed because it is too large Load Diff

View File

@ -38,14 +38,6 @@ typedef struct
unsigned char page; /* page */
} item;
typedef struct rmenu_position
{
float x;
float y;
float width;
float height;
} rmenu_position_t;
typedef struct rmenu_default_positions
{
float x_position;
@ -69,28 +61,6 @@ typedef struct rmenu_default_positions
unsigned entries_per_page;
} rmenu_default_positions_t;
typedef struct rmenu_context
{
void (*clear)(void);
void (*set_filtering)(unsigned index, bool set_smooth);
void (*set_aspect_ratio)(unsigned aspectratio_index);
void (*blend)(bool enable);
void (*set_fbo_enable)(unsigned i);
void (*free_textures)(void);
void (*init_textures)(void);
void (*render_selection_panel)(rmenu_position_t *position);
void (*render_bg)(rmenu_position_t *position);
void (*render_menu_enable)(bool enable);
void (*render_msg)(float xpos, float ypos, float scale, unsigned color, const char *msg, ...);
void (*screenshot_enable)(bool enable);
void (*screenshot_dump)(void *data);
void (*swap_buffers)(void);
void (*set_swap_interval)(unsigned interval);
void (*set_default_pos)(rmenu_default_positions_t *position);
const char * (*drive_mapping_prev)(void);
const char * (*drive_mapping_next)(void);
} rmenu_context_t;
enum
{
CATEGORY_FILEBROWSER,

View File

@ -31,6 +31,7 @@
#include "../image.h"
#include "../gfx_context.h"
#include "../gl_font.h"
#if defined(HAVE_RMENU)
GLuint menu_texture_id;
@ -42,6 +43,38 @@ static PSGLdevice* gl_device;
static PSGLcontext* gl_context;
#endif
#define HARDCODE_FONT_SIZE 0.91f
#define POSITION_X 0.09f
#define POSITION_X_CENTER 0.5f
#define POSITION_Y_START 0.17f
#define POSITION_Y_INCREMENT 0.035f
#define POSITION_Y_BEGIN (POSITION_Y_START + POSITION_Y_INCREMENT)
#define COMMENT_TWO_Y_POSITION 0.91f
#define COMMENT_Y_POSITION 0.82f
#define MSG_QUEUE_X_POSITION g_settings.video.msg_pos_x
#define MSG_QUEUE_Y_POSITION 0.76f
#define MSG_QUEUE_FONT_SIZE 1.03f
#define MSG_PREV_NEXT_Y_POSITION 0.03f
#define CURRENT_PATH_Y_POSITION 0.15f
#define CURRENT_PATH_FONT_SIZE FONT_SIZE
#define FONT_SIZE (g_extern.console.rmenu.font_size)
#define NUM_ENTRY_PER_PAGE 15
#define DRIVE_MAPPING_SIZE 4
const char drive_mappings[DRIVE_MAPPING_SIZE][32] = {
"/app_home/",
"/dev_hdd0/",
"/dev_hdd1/",
"/host_root/"
};
unsigned char drive_mapping_idx = 1;
static int gfx_ctx_check_resolution(unsigned resolution_id)
{
return cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, resolution_id, CELL_VIDEO_OUT_ASPECT_AUTO, 0);
@ -79,6 +112,76 @@ static float gfx_ctx_get_aspect_ratio(void)
return 16.0f/9.0f;
}
static void gfx_ctx_ps3_set_default_pos(rmenu_default_positions_t *position)
{
position->x_position = POSITION_X;
position->x_position_center = POSITION_X_CENTER;
position->y_position = POSITION_Y_BEGIN;
position->comment_y_position = COMMENT_Y_POSITION;
position->y_position_increment = POSITION_Y_INCREMENT;
position->starting_y_position = POSITION_Y_START;
position->comment_two_y_position = COMMENT_TWO_Y_POSITION;
position->font_size = HARDCODE_FONT_SIZE;
position->msg_queue_x_position = MSG_QUEUE_X_POSITION;
position->msg_queue_y_position = MSG_QUEUE_Y_POSITION;
position->msg_queue_font_size= MSG_QUEUE_FONT_SIZE;
position->msg_prev_next_y_position = MSG_PREV_NEXT_Y_POSITION;
position->current_path_font_size = CURRENT_PATH_FONT_SIZE;
position->current_path_y_position = CURRENT_PATH_Y_POSITION;
position->variable_font_size = FONT_SIZE;
position->entries_per_page = NUM_ENTRY_PER_PAGE;
position->core_msg_x_position = 0.3f;
position->core_msg_y_position = 0.06f;
position->core_msg_font_size = COMMENT_Y_POSITION;
}
static void rmenu_ctx_ps3_render_msg(float xpos, float ypos, float scale, unsigned color, const char *msg, ...)
{
gl_t *gl = driver.video_data;
gl_render_msg_place(gl, xpos, ypos, scale, color, msg);
}
static void rmenu_ctx_ps3_screenshot_enable(bool enable)
{
#if(CELL_SDK_VERSION > 0x340000)
if(enable)
{
cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
CellScreenShotSetParam screenshot_param = {0, 0, 0, 0};
screenshot_param.photo_title = "RetroArch PS3";
screenshot_param.game_title = "RetroArch PS3";
cellScreenShotSetParameter (&screenshot_param);
cellScreenShotEnable();
}
else
{
cellScreenShotDisable();
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
}
#endif
}
static void rmenu_ctx_ps3_screenshot_dump(void *data)
{
(void)data;
}
static const char * rmenu_ctx_ps3_drive_mapping_previous(void)
{
if(drive_mapping_idx > 0)
drive_mapping_idx--;
return drive_mappings[drive_mapping_idx];
}
static const char * rmenu_ctx_ps3_drive_mapping_next(void)
{
if((drive_mapping_idx + 1) < DRIVE_MAPPING_SIZE)
drive_mapping_idx++;
return drive_mappings[drive_mapping_idx];
}
static void gfx_ctx_get_available_resolutions (void)
{
bool defaultresolution;
@ -197,6 +300,8 @@ static void gfx_ctx_set_blend(bool enable)
static void gfx_ctx_set_resize(unsigned width, unsigned height) { }
bool rmenu_inited = false;
static bool gfx_ctx_rmenu_init(void)
{
gl_t *gl = driver.video_data;
@ -229,10 +334,34 @@ static bool gfx_ctx_rmenu_init(void)
free(menu_texture.pixels);
#endif
rmenu_inited = true;
return true;
}
#if defined(HAVE_RMENU)
static void gfx_ctx_rmenu_free(void)
{
gl_t *gl = driver.video_data;
gl->draw_rmenu = false;
}
static void gfx_ctx_menu_enable(bool enable)
{
gl_t *gl = driver.video_data;
if (enable)
{
if(!rmenu_inited)
gfx_ctx_rmenu_init();
gl->draw_rmenu = true;
}
else
{
gfx_ctx_rmenu_free();
}
}
static void gfx_ctx_rmenu_frame(void *data)
{
gl_t *gl = (gl_t*)data;
@ -240,10 +369,13 @@ static void gfx_ctx_rmenu_frame(void *data)
gl_shader_use(gl, RARCH_CG_MENU_SHADER_INDEX);
gl_set_viewport(gl, gl->win_width, gl->win_height, true, false);
gl_shader_set_params(gl, gl->win_width, gl->win_height,
gl->win_width, gl->win_height,
gl->win_width, gl->win_height,
gl->frame_count, NULL, NULL, NULL, 0);
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,
gl->frame_count, NULL, NULL, NULL, 0);
}
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, menu_texture_id);
@ -256,6 +388,17 @@ static void gfx_ctx_rmenu_frame(void *data)
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) { }
@ -423,19 +566,26 @@ const gfx_ctx_driver_t gfx_ctx_ps3 = {
"ps3",
// RARCH_CONSOLE stuff.
gfx_ctx_clear,
gfx_ctx_set_blend,
gfx_ctx_set_filtering,
gfx_ctx_get_available_resolutions,
gfx_ctx_check_resolution,
gfx_ctx_set_fbo,
#ifdef HAVE_RMENU
gfx_ctx_rmenu_init,
#else
NULL,
#endif
gfx_ctx_set_fbo,
#ifdef HAVE_RMENU
gfx_ctx_rmenu_frame
gfx_ctx_rmenu_frame,
gfx_ctx_rmenu_free,
gfx_ctx_menu_enable,
gfx_ctx_menu_draw_bg,
gfx_ctx_menu_draw_panel,
gfx_ctx_ps3_set_default_pos,
rmenu_ctx_ps3_render_msg,
rmenu_ctx_ps3_screenshot_enable,
rmenu_ctx_ps3_screenshot_dump,
rmenu_ctx_ps3_drive_mapping_previous,
rmenu_ctx_ps3_drive_mapping_next,
#endif
};

View File

@ -38,6 +38,56 @@
#define XBOX_PRESENTATIONINTERVAL D3DRS_PRESENTINTERVAL
#endif
#define ROM_PANEL_WIDTH 510
#define ROM_PANEL_HEIGHT 20
#define HARDCODE_FONT_SIZE 21
#define POSITION_X m_menuMainRomListPos_x
#define POSITION_X_CENTER (m_menuMainRomListPos_x + 350)
#define POSITION_Y_START m_menuMainRomListPos_y
#define POSITION_Y_BEGIN (POSITION_Y_START + POSITION_Y_INCREMENT)
#define POSITION_Y_INCREMENT 20
#define COMMENT_Y_POSITION (ypos - ((POSITION_Y_INCREMENT/2) * 3))
#define COMMENT_TWO_Y_POSITION (ypos - ((POSITION_Y_INCREMENT/2) * 1))
#define MSG_QUEUE_X_POSITION POSITION_X
#define MSG_QUEUE_Y_POSITION (ypos - ((POSITION_Y_INCREMENT/2) * 7) + 5)
#define MSG_QUEUE_FONT_SIZE HARDCODE_FONT_SIZE
#define MSG_PREV_NEXT_Y_POSITION 24
#define CURRENT_PATH_Y_POSITION (m_menuMainRomListPos_y - ((POSITION_Y_INCREMENT/2)))
#define CURRENT_PATH_FONT_SIZE 21
#define FONT_SIZE 21
#define NUM_ENTRY_PER_PAGE 12
#define DRIVE_MAPPING_SIZE 5
const char drive_mappings[DRIVE_MAPPING_SIZE][32] = {
"C:",
"D:",
"E:",
"F:",
"G:"
};
unsigned char drive_mapping_idx = 2;
int xpos, ypos;
#ifdef _XBOX1
texture_image m_menuMainRomSelectPanel;
texture_image m_menuMainBG;
// Rom list coords
int m_menuMainRomListPos_x;
int m_menuMainRomListPos_y;
#endif
bool rmenu_inited = false;
static void gfx_ctx_xdk_set_blend(bool enable)
{
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
@ -81,6 +131,20 @@ static void gfx_ctx_xdk_check_window(bool *quit,
static void gfx_ctx_xdk_set_resize(unsigned width, unsigned height) { }
static void gfx_ctx_menu_enable(bool enable)
{
if (enable)
{
if(!rmenu_inited)
gfx_ctx_xdk_menu_init();
}
else
{
gfx_ctx_xdk_menu_free();
rmenu_inited = false;
}
}
static void gfx_ctx_xdk_swap_buffers(void)
{
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
@ -114,9 +178,122 @@ static bool gfx_ctx_xdk_window_has_focus(void)
static bool gfx_ctx_xdk_menu_init(void)
{
#ifdef _XBOX1
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
int width = d3d->d3dpp.BackBufferWidth;
// Load background image
if(width == 640)
{
texture_image_load("D:\\Media\\main-menu_480p.png", &m_menuMainBG);
m_menuMainRomListPos_x = 60;
m_menuMainRomListPos_y = 80;
}
else if(width == 1280)
{
texture_image_load("D:\\Media\\main-menu_720p.png", &m_menuMainBG);
m_menuMainRomListPos_x = 360;
m_menuMainRomListPos_y = 130;
}
// Load rom selector panel
texture_image_load("D:\\Media\\menuMainRomSelectPanel.png", &m_menuMainRomSelectPanel);
//Display some text
//Center the text (hardcoded)
xpos = width == 640 ? 65 : 400;
ypos = width == 640 ? 430 : 670;
#endif
rmenu_inited = false;
return true;
}
static void gfx_ctx_xdk_menu_free(void)
{
#ifdef _XBOX1
texture_image_free(&m_menuMainBG);
texture_image_free(&m_menuMainRomSelectPanel);
#endif
}
static void gfx_ctx_xdk_menu_draw_bg(rarch_position_t *position)
{
#ifdef _XBOX1
m_menuMainBG.x = 0;
m_menuMainBG.y = 0;
texture_image_render(&m_menuMainBG);
#endif
}
static void gfx_ctx_xdk_menu_draw_panel(rarch_position_t *position)
{
#ifdef _XBOX1
m_menuMainRomSelectPanel.x = position->x;
m_menuMainRomSelectPanel.y = position->y;
m_menuMainRomSelectPanel.width = ROM_PANEL_WIDTH;
m_menuMainRomSelectPanel.height = ROM_PANEL_HEIGHT;
texture_image_render(&m_menuMainRomSelectPanel);
#endif
}
static void gfx_ctx_xdk_menu_set_default_pos(rmenu_default_positions_t *position)
{
#ifdef _XBOX1
position->x_position = POSITION_X;
position->x_position_center = POSITION_X_CENTER;
position->y_position = POSITION_Y_BEGIN;
position->comment_y_position = COMMENT_Y_POSITION;
position->y_position_increment = POSITION_Y_INCREMENT;
position->starting_y_position = POSITION_Y_START;
position->comment_two_y_position = COMMENT_TWO_Y_POSITION;
position->font_size = HARDCODE_FONT_SIZE;
position->msg_queue_x_position = MSG_QUEUE_X_POSITION;
position->msg_queue_y_position = MSG_QUEUE_Y_POSITION;
position->msg_queue_font_size= MSG_QUEUE_FONT_SIZE;
position->msg_prev_next_y_position = MSG_PREV_NEXT_Y_POSITION;
position->current_path_font_size = CURRENT_PATH_FONT_SIZE;
position->current_path_y_position = CURRENT_PATH_Y_POSITION;
position->variable_font_size = FONT_SIZE;
position->entries_per_page = NUM_ENTRY_PER_PAGE;
position->core_msg_x_position = position->x_position;
position->core_msg_y_position = position->msg_prev_next_y_position + 0.01f;
position->core_msg_font_size = position->font_size;
#endif
}
static void gfx_ctx_xdk_menu_render_msg(float xpos, float ypos, float scale, unsigned color, const char *msg, ...)
{
#ifdef _XBOX1
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
xfonts_render_msg_place(d3d, xpos, ypos, scale, msg);
#endif
}
static void gfx_ctx_xdk_menu_screenshot_enable(bool enable)
{
}
static void gfx_ctx_xdk_menu_screenshot_dump(void *data)
{
gfx_ctx_xdk_screenshot_dump(NULL);
}
static const char *gfx_ctx_xdk_menu_drive_mapping_previous(void)
{
if(drive_mapping_idx > 0)
drive_mapping_idx--;
return drive_mappings[drive_mapping_idx];
}
static const char *gfx_ctx_xdk_menu_drive_mapping_next(void)
{
if((drive_mapping_idx + 1) < DRIVE_MAPPING_SIZE)
drive_mapping_idx++;
return drive_mappings[drive_mapping_idx];
}
static void gfx_ctx_xdk_update_window_title(bool reset) { }
static void gfx_ctx_xdk_get_video_size(unsigned *width, unsigned *height)
@ -551,11 +728,23 @@ const gfx_ctx_driver_t gfx_ctx_xdk = {
"xdk",
// RARCH_CONSOLE stuff.
gfx_ctx_xdk_clear,
gfx_ctx_xdk_set_blend,
gfx_ctx_xdk_set_filtering,
gfx_ctx_xdk_get_available_resolutions,
gfx_ctx_xdk_check_resolution,
gfx_ctx_xdk_set_fbo,
gfx_ctx_xdk_menu_init,
gfx_ctx_xdk_set_fbo,
gfx_ctx_xdk_menu_frame,
gfx_ctx_xdk_menu_free,
gfx_ctx_menu_enable,
gfx_ctx_xdk_menu_draw_bg,
gfx_ctx_xdk_menu_draw_panel,
gfx_ctx_xdk_menu_set_default_pos,
gfx_ctx_xdk_menu_render_msg,
gfx_ctx_xdk_menu_screenshot_enable,
gfx_ctx_xdk_menu_screenshot_dump,
gfx_ctx_xdk_menu_drive_mapping_previous,
gfx_ctx_xdk_menu_drive_mapping_next
};

View File

@ -23,6 +23,10 @@
#include "../config.h"
#endif
#if defined(RARCH_CONSOLE) || defined(HAVE_RMENU)
#include "../console/rmenu/rmenu.h"
#endif
#define MAX_EGLIMAGE_TEXTURES 32
enum gfx_ctx_api
@ -34,6 +38,14 @@ enum gfx_ctx_api
GFX_CTX_OPENVG_API
};
typedef struct rarch_position
{
float x;
float y;
float width;
float height;
} rarch_position_t;
typedef void (*gfx_ctx_proc_t)(void);
typedef struct gfx_ctx_driver
@ -93,14 +105,27 @@ typedef struct gfx_ctx_driver
const char *ident;
#ifdef RARCH_CONSOLE
void (*clear)(void);
void (*set_blend)(bool enable);
void (*set_filtering)(unsigned index, bool set_smooth);
void (*get_available_resolutions)(void);
int (*check_resolution)(unsigned resolution_id);
bool (*rmenu_init)(void);
void (*set_fbo)(unsigned);
#endif
#ifdef HAVE_RMENU
bool (*rmenu_init)(void);
void (*rmenu_frame)(void *data);
void (*rmenu_free)(void);
void (*rmenu_enable)(bool enable);
void (*rmenu_draw_bg)(rarch_position_t *position);
void (*rmenu_draw_panel)(rarch_position_t *position);
void (*rmenu_set_default_pos)(rmenu_default_positions_t *position);
void (*rmenu_render_msg)(float xpos, float ypos, float scale, unsigned color, const char *msg, ...);
void (*rmenu_screenshot_enable)(bool enable);
void (*rmenu_screenshot_dump)(void *data);
const char *(*drive_mapping_previous)(void);
const char *(*drive_mapping_next)(void);
#endif
} gfx_ctx_driver_t;

View File

@ -364,11 +364,7 @@ static void gl_shader_scale(gl_t *gl, unsigned index, struct gl_fbo_scale *scale
if (gl->shader)
gl->shader->shader_scale(index, scale);
}
#endif
///////////////////
#ifdef HAVE_FBO
static void gl_compute_fbo_geometry(gl_t *gl, unsigned width, unsigned height,
unsigned vp_width, unsigned vp_height)
{

View File

@ -122,7 +122,7 @@ static void check_window(xdk_d3d_video_t *d3d)
{
bool quit, resize;
d3d->driver->check_window(&quit,
d3d->ctx_driver->check_window(&quit,
&resize, NULL, NULL,
d3d->frame_count);
@ -161,7 +161,7 @@ static void xdk_d3d_free(void * data)
d3d9_deinit_font();
#endif
d3d->driver->destroy();
d3d->ctx_driver->destroy();
free(d3d);
}
@ -351,9 +351,9 @@ static void *xdk_d3d_init(const video_info_t *video, const input_driver_t **inpu
return NULL;
}
RARCH_LOG("Found D3D context: %s\n", d3d->driver->ident);
RARCH_LOG("Found D3D context: %s\n", d3d->ctx_driver->ident);
d3d->driver->get_video_size(&d3d->full_x, &d3d->full_y);
d3d->ctx_driver->get_video_size(&d3d->full_x, &d3d->full_y);
RARCH_LOG("Detecting screen resolution: %ux%u.\n", d3d->full_x, d3d->full_y);
gfx_ctx_xdk_set_swap_interval(d3d->vsync ? 1 : 0);
@ -362,7 +362,7 @@ static void *xdk_d3d_init(const video_info_t *video, const input_driver_t **inpu
if (!hlsl_shader_init())
{
RARCH_ERR("Shader init failed.\n");
d3d->driver->destroy();
d3d->ctx_driver->destroy();
free(d3d);
return NULL;
}

View File

@ -54,7 +54,7 @@ typedef struct DrawVerticeFormats
typedef struct xdk_d3d_video
{
const gfx_ctx_driver_t *driver;
const gfx_ctx_driver_t *ctx_driver;
bool block_swap;
#ifdef HAVE_FBO
bool fbo_enabled;