(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,
};

View File

@ -59,8 +59,6 @@ unsigned set_shader = 0;
unsigned currently_selected_controller_menu = 0;
char m_title[256];
static const rmenu_context_t *context;
static uint64_t old_state = 0;
typedef enum {
@ -496,11 +494,12 @@ static void populate_setting_item(unsigned i, item *current_item)
static void display_menubar(menu *current_menu)
{
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
filebrowser_t *fb = &browser;
char current_path[256], rarch_version[128], msg[128];
rmenu_default_positions_t default_pos;
context->set_default_pos(&default_pos);
device_ptr->ctx_driver->rmenu_set_default_pos(&default_pos);
snprintf(rarch_version, sizeof(rarch_version), "v%s", PACKAGE_VERSION);
@ -508,7 +507,7 @@ static void display_menubar(menu *current_menu)
{
case GENERAL_VIDEO_MENU:
snprintf(msg, sizeof(msg), "NEXT -> [%s]", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_R));
context->render_msg(default_pos.x_position, default_pos.current_path_y_position, default_pos.current_path_font_size, WHITE, msg);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.current_path_y_position, default_pos.current_path_font_size, WHITE, msg);
break;
case GENERAL_AUDIO_MENU:
case EMU_GENERAL_MENU:
@ -516,12 +515,12 @@ static void display_menubar(menu *current_menu)
case EMU_AUDIO_MENU:
case PATH_MENU:
snprintf(msg, sizeof(msg), "[%s] <- PREV | NEXT -> [%s]", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_L), rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_R));
context->render_msg(default_pos.x_position, default_pos.current_path_y_position, default_pos.current_path_font_size, WHITE, msg);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.current_path_y_position, default_pos.current_path_font_size, WHITE, msg);
break;
case CONTROLS_MENU:
case INGAME_MENU_RESIZE:
snprintf(msg, sizeof(msg), "[%s] <- PREV", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_L));
context->render_msg(default_pos.x_position, default_pos.current_path_y_position, default_pos.current_path_font_size, WHITE, msg);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.current_path_y_position, default_pos.current_path_font_size, WHITE, msg);
break;
default:
break;
@ -544,19 +543,19 @@ static void display_menubar(menu *current_menu)
fb = &tmpBrowser;
case FILE_BROWSER_MENU:
snprintf(current_path, sizeof(current_path), "PATH: %s", filebrowser_get_current_dir(fb));
context->render_msg(default_pos.x_position, default_pos.current_path_y_position, default_pos.current_path_font_size, WHITE, current_path);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.current_path_y_position, default_pos.current_path_font_size, WHITE, current_path);
break;
default:
break;
}
rmenu_position_t position = {0};
context->render_bg(&position);
rarch_position_t position = {0};
device_ptr->ctx_driver->rmenu_draw_bg(&position);
context->render_msg(default_pos.core_msg_x_position, default_pos.core_msg_y_position, default_pos.core_msg_font_size, WHITE, m_title);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.core_msg_x_position, default_pos.core_msg_y_position, default_pos.core_msg_font_size, WHITE, m_title);
#ifdef __CELLOS_LV2__
context->render_msg(default_pos.x_position, 0.05f, 1.4f, WHITE, current_menu->title);
context->render_msg(0.80f, 0.015f, 0.82f, WHITE, rarch_version);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, 0.05f, 1.4f, WHITE, current_menu->title);
device_ptr->ctx_driver->rmenu_render_msg(0.80f, 0.015f, 0.82f, WHITE, rarch_version);
#endif
}
@ -595,11 +594,12 @@ static void browser_update(filebrowser_t * b, uint64_t input, const char *extens
static void browser_render(filebrowser_t * b)
{
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
unsigned file_count = b->current_dir.list->size;
unsigned int current_index, page_number, page_base, i;
rmenu_default_positions_t default_pos;
context->set_default_pos(&default_pos);
device_ptr->ctx_driver->rmenu_set_default_pos(&default_pos);
current_index = b->current_dir.ptr;
page_number = current_index / default_pos.entries_per_page;
@ -615,23 +615,24 @@ static void browser_render(filebrowser_t * b)
const char *current_pathname = filebrowser_get_current_path(b);
if(strcmp(current_pathname, b->current_dir.list->elems[i].data) == 0)
{
rmenu_position_t position = {0};
rarch_position_t position = {0};
position.x = default_pos.x_position;
position.y = default_pos.starting_y_position;
context->render_selection_panel(&position);
device_ptr->ctx_driver->rmenu_draw_panel(&position);
}
context->render_msg(default_pos.x_position, default_pos.starting_y_position, default_pos.variable_font_size, i == current_index ? RED : b->current_dir.list->elems[i].attr.b ? GREEN : WHITE, fname_tmp);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.starting_y_position, default_pos.variable_font_size, i == current_index ? RED : b->current_dir.list->elems[i].attr.b ? GREEN : WHITE, fname_tmp);
}
}
static void select_file(menu *current_menu, uint64_t input)
{
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
char extensions[256], comment[256], path[PATH_MAX];
bool ret = true;
rmenu_default_positions_t default_pos;
context->set_default_pos(&default_pos);
device_ptr->ctx_driver->rmenu_set_default_pos(&default_pos);
switch(current_menu->enum_id)
{
@ -685,11 +686,11 @@ static void select_file(menu *current_menu, uint64_t input)
break;
case PRESET_CHOICE:
strlcpy(g_extern.file_state.cgp_path, path, sizeof(g_extern.file_state.cgp_path));
context->set_fbo_enable(FBO_DEINIT);
device_ptr->ctx_driver->set_fbo(FBO_DEINIT);
#ifdef HAVE_OPENGL
gl_cg_reinit(path);
#endif
context->set_fbo_enable(FBO_INIT);
device_ptr->ctx_driver->set_fbo(FBO_INIT);
break;
#endif
case INPUT_PRESET_CHOICE:
@ -726,19 +727,20 @@ static void select_file(menu *current_menu, uint64_t input)
display_menubar(current_menu);
context->render_msg(default_pos.x_position, default_pos.comment_y_position, default_pos.font_size, WHITE, comment);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.comment_y_position, default_pos.font_size, WHITE, comment);
snprintf(comment, sizeof(comment), "[%s] - return to settings [%s] - Reset Startdir", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_X), rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_START));
context->render_msg(default_pos.x_position, default_pos.comment_two_y_position, default_pos.font_size, YELLOW, comment);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.comment_two_y_position, default_pos.font_size, YELLOW, comment);
}
static void select_directory(menu *current_menu, uint64_t input)
{
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
char path[PATH_MAX], msg[256];
bool ret = true;
rmenu_default_positions_t default_pos;
context->set_default_pos(&default_pos);
device_ptr->ctx_driver->rmenu_set_default_pos(&default_pos);
bool is_dir = filebrowser_get_current_path_isdir(&tmpBrowser);
browser_update(&tmpBrowser, input, "empty");
@ -810,13 +812,13 @@ static void select_directory(menu *current_menu, uint64_t input)
display_menubar(current_menu);
snprintf(msg, sizeof(msg), "[%s] - Enter dir | [%s] - Go back", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_B), rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_X));
context->render_msg(default_pos.x_position, default_pos.comment_two_y_position, default_pos.font_size, YELLOW, msg);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.comment_two_y_position, default_pos.font_size, YELLOW, msg);
snprintf(msg, sizeof(msg), "[%s] - Reset to startdir", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_START));
context->render_msg(default_pos.x_position, default_pos.comment_two_y_position + (default_pos.y_position_increment * 1), default_pos.font_size, YELLOW, msg);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.comment_two_y_position + (default_pos.y_position_increment * 1), default_pos.font_size, YELLOW, msg);
snprintf(msg, sizeof(msg), "INFO - Browse to a directory and assign it as the path by\npressing [%s].", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_Y));
context->render_msg(default_pos.x_position, default_pos.comment_y_position, default_pos.font_size, WHITE, msg);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.comment_y_position, default_pos.font_size, WHITE, msg);
}
static void set_keybind_digital(uint64_t default_retro_joypad_id, uint64_t input)
@ -838,6 +840,7 @@ static void set_keybind_digital(uint64_t default_retro_joypad_id, uint64_t input
#ifdef __CELLOS_LV2__
static void rarch_filename_input_and_save (unsigned filename_type)
{
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
bool filename_entered = false;
char filename_tmp[256], filepath[PATH_MAX];
oskutil_write_initial_message(&g_extern.console.misc.oskutil_handle, L"example");
@ -847,8 +850,12 @@ static void rarch_filename_input_and_save (unsigned filename_type)
while(OSK_IS_RUNNING(g_extern.console.misc.oskutil_handle))
{
context->clear();
context->swap_buffers();
device_ptr->ctx_driver->clear();
device_ptr->ctx_driver->swap_buffers();
bool quit, resize;
unsigned width, height, frame_count;
frame_count = 0;
device_ptr->ctx_driver->check_window(&quit, &resize, &width, &height, frame_count);
}
if(g_extern.console.misc.oskutil_handle.text_can_be_fetched)
@ -880,8 +887,12 @@ static void rarch_filename_input_and_save (unsigned filename_type)
while(OSK_IS_RUNNING(g_extern.console.misc.oskutil_handle))
{
/* OSK Util gets updated */
context->clear();
context->swap_buffers();
device_ptr->ctx_driver->clear();
device_ptr->ctx_driver->swap_buffers();
bool quit, resize;
unsigned width, height, frame_count;
frame_count = 0;
device_ptr->ctx_driver->check_window(&quit, &resize, &width, &height, frame_count);
}
if(g_extern.console.misc.oskutil_handle.text_can_be_fetched)
@ -915,6 +926,8 @@ static void rarch_filename_input_and_save (unsigned filename_type)
static void set_setting_action(menu *current_menu, unsigned switchvalue, uint64_t input)
{
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
switch(switchvalue)
{
#ifdef __CELLOS_LV2__
@ -1016,29 +1029,29 @@ static void set_setting_action(menu *current_menu, unsigned switchvalue, uint64_
if(input & (1 << RMENU_DEVICE_NAV_LEFT))
{
rarch_settings_change(S_ASPECT_RATIO_DECREMENT);
context->set_aspect_ratio(g_settings.video.aspect_ratio_idx);
driver.video->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);
}
if(input & (1 << RMENU_DEVICE_NAV_RIGHT))
{
rarch_settings_change(S_ASPECT_RATIO_INCREMENT);
context->set_aspect_ratio(g_settings.video.aspect_ratio_idx);
driver.video->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);
}
if(input & (1 << RMENU_DEVICE_NAV_START))
{
rarch_settings_default(S_DEF_ASPECT_RATIO);
context->set_aspect_ratio(g_settings.video.aspect_ratio_idx);
driver.video->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);
}
break;
case SETTING_HW_TEXTURE_FILTER:
if((input & (1 << RMENU_DEVICE_NAV_LEFT)) || (input & (1 << RMENU_DEVICE_NAV_RIGHT)) || (input & (1 << RMENU_DEVICE_NAV_B)))
{
rarch_settings_change(S_HW_TEXTURE_FILTER);
context->set_filtering(1, g_settings.video.smooth);
device_ptr->ctx_driver->set_filtering(1, g_settings.video.smooth);
}
if(input & (1 << RMENU_DEVICE_NAV_START))
{
rarch_settings_change(S_DEF_HW_TEXTURE_FILTER);
context->set_filtering(1, g_settings.video.smooth);
device_ptr->ctx_driver->set_filtering(1, g_settings.video.smooth);
}
break;
#ifdef HAVE_FBO
@ -1046,12 +1059,12 @@ static void set_setting_action(menu *current_menu, unsigned switchvalue, uint64_
if((input & (1 << RMENU_DEVICE_NAV_LEFT)) || (input & (1 << RMENU_DEVICE_NAV_RIGHT)) || (input & (1 << RMENU_DEVICE_NAV_B)))
{
rarch_settings_change(S_HW_TEXTURE_FILTER_2);
context->set_filtering(2, g_settings.video.second_pass_smooth);
device_ptr->ctx_driver->set_filtering(2, g_settings.video.second_pass_smooth);
}
if(input & (1 << RMENU_DEVICE_NAV_START))
{
rarch_settings_change(S_DEF_HW_TEXTURE_FILTER_2);
context->set_filtering(2, g_settings.video.second_pass_smooth);
device_ptr->ctx_driver->set_filtering(2, g_settings.video.second_pass_smooth);
}
break;
case SETTING_SCALE_ENABLED:
@ -1060,14 +1073,14 @@ static void set_setting_action(menu *current_menu, unsigned switchvalue, uint64_
rarch_settings_change(S_SCALE_ENABLED);
if(g_settings.video.render_to_texture)
context->set_fbo_enable(FBO_INIT);
device_ptr->ctx_driver->set_fbo(FBO_INIT);
else
context->set_fbo_enable(FBO_DEINIT);
device_ptr->ctx_driver->set_fbo(FBO_DEINIT);
}
if(input & (1 << RMENU_DEVICE_NAV_START))
{
rarch_settings_default(S_DEF_SCALE_ENABLED);
context->set_fbo_enable(FBO_REINIT);
device_ptr->ctx_driver->set_fbo(FBO_REINIT);
}
break;
case SETTING_SCALE_FACTOR:
@ -1080,7 +1093,7 @@ static void set_setting_action(menu *current_menu, unsigned switchvalue, uint64_
if(should_decrement)
{
rarch_settings_change(S_SCALE_FACTOR_DECREMENT);
context->set_fbo_enable(FBO_REINIT);
device_ptr->ctx_driver->set_fbo(FBO_REINIT);
}
}
}
@ -1092,14 +1105,14 @@ static void set_setting_action(menu *current_menu, unsigned switchvalue, uint64_
if(should_increment)
{
rarch_settings_change(S_SCALE_FACTOR_INCREMENT);
context->set_fbo_enable(FBO_REINIT);
device_ptr->ctx_driver->set_fbo(FBO_REINIT);
}
}
}
if(input & (1 << RMENU_DEVICE_NAV_START))
{
rarch_settings_default(S_DEF_SCALE_FACTOR);
context->set_fbo_enable(FBO_REINIT);
device_ptr->ctx_driver->set_fbo(FBO_REINIT);
}
break;
#endif
@ -1146,12 +1159,12 @@ static void set_setting_action(menu *current_menu, unsigned switchvalue, uint64_
if((input & (1 << RMENU_DEVICE_NAV_LEFT)) || (input & (1 << RMENU_DEVICE_NAV_RIGHT)) || (input & (1 << RMENU_DEVICE_NAV_B)))
{
rarch_settings_change(S_THROTTLE);
context->set_swap_interval(g_extern.console.screen.state.throttle.enable);
device_ptr->ctx_driver->swap_interval(g_extern.console.screen.state.throttle.enable);
}
if(input & (1 << RMENU_DEVICE_NAV_START))
{
rarch_settings_default(S_DEF_THROTTLE);
context->set_swap_interval(g_extern.console.screen.state.throttle.enable);
device_ptr->ctx_driver->swap_interval(g_extern.console.screen.state.throttle.enable);
}
break;
case SETTING_TRIPLE_BUFFERING:
@ -1173,12 +1186,12 @@ static void set_setting_action(menu *current_menu, unsigned switchvalue, uint64_
if((input & (1 << RMENU_DEVICE_NAV_LEFT)) || (input & (1 << RMENU_DEVICE_NAV_RIGHT)) || (input & (1 << RMENU_DEVICE_NAV_B)))
{
g_extern.console.screen.state.screenshots.enable = !g_extern.console.screen.state.screenshots.enable;
context->screenshot_enable(g_extern.console.screen.state.screenshots.enable);
device_ptr->ctx_driver->rmenu_screenshot_enable(g_extern.console.screen.state.screenshots.enable);
}
if(input & (1 << RMENU_DEVICE_NAV_START))
{
g_extern.console.screen.state.screenshots.enable = true;
context->screenshot_enable(g_extern.console.screen.state.screenshots.enable);
device_ptr->ctx_driver->rmenu_screenshot_enable(g_extern.console.screen.state.screenshots.enable);
}
break;
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL)
@ -1228,8 +1241,12 @@ static void set_setting_action(menu *current_menu, unsigned switchvalue, uint64_
oskutil_start(&g_extern.console.misc.oskutil_handle);
while(OSK_IS_RUNNING(g_extern.console.misc.oskutil_handle))
{
context->clear();
context->swap_buffers();
device_ptr->ctx_driver->clear();
device_ptr->ctx_driver->swap_buffers();
bool quit, resize;
unsigned width, height, frame_count;
frame_count = 0;
device_ptr->ctx_driver->check_window(&quit, &resize, &width, &height, frame_count);
}
if(g_extern.console.misc.oskutil_handle.text_can_be_fetched)
@ -1593,13 +1610,14 @@ static void settings_iterate(menu *current_menu, item *items, settings_action_t
static void select_setting(menu *current_menu, uint64_t input)
{
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
item *items = (item*)malloc(current_menu->max_settings * sizeof(*items));
unsigned i;
char msg[256];
rmenu_default_positions_t default_pos;
context->set_default_pos(&default_pos);
device_ptr->ctx_driver->rmenu_set_default_pos(&default_pos);
unsigned j = 0;
int page = 0;
@ -1642,17 +1660,17 @@ static void select_setting(menu *current_menu, uint64_t input)
if(items[i].page == current_menu->page)
{
default_pos.starting_y_position += default_pos.y_position_increment;
context->render_msg(default_pos.x_position, default_pos.starting_y_position, default_pos.variable_font_size, current_menu->selected == items[i].enum_id ? YELLOW : WHITE, items[i].text);
context->render_msg(default_pos.x_position_center, default_pos.starting_y_position, default_pos.variable_font_size, WHITE, items[i].setting_text);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.starting_y_position, default_pos.variable_font_size, current_menu->selected == items[i].enum_id ? YELLOW : WHITE, items[i].text);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position_center, default_pos.starting_y_position, default_pos.variable_font_size, WHITE, items[i].setting_text);
if(current_menu->selected == items[i].enum_id)
{
rmenu_position_t position = {0};
rarch_position_t position = {0};
position.x = default_pos.x_position;
position.y = default_pos.starting_y_position;
context->render_selection_panel(&position);
context->render_msg(default_pos.x_position, default_pos.comment_y_position, default_pos.font_size, WHITE, items[i].comment);
device_ptr->ctx_driver->rmenu_draw_panel(&position);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.comment_y_position, default_pos.font_size, WHITE, items[i].comment);
}
}
}
@ -1660,20 +1678,21 @@ static void select_setting(menu *current_menu, uint64_t input)
free(items);
snprintf(msg, sizeof(msg), "[%s] + [%s] - Resume game", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_L3), rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_R3));
context->render_msg(default_pos.x_position, default_pos.comment_two_y_position, default_pos.font_size, YELLOW, msg);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.comment_two_y_position, default_pos.font_size, YELLOW, msg);
snprintf(msg, sizeof(msg), "[%s] - Reset to default", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_START));
context->render_msg(default_pos.x_position, default_pos.comment_two_y_position + (default_pos.y_position_increment * 1), default_pos.font_size, YELLOW, msg);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.comment_two_y_position + (default_pos.y_position_increment * 1), default_pos.font_size, YELLOW, msg);
}
static void menu_romselect_iterate(filebrowser_t *filebrowser, menu_romselect_action_t action)
{
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
bool ret = true;
switch(action)
{
case MENU_DRIVE_MAPPING_PREV:
{
const char * drive_map = context->drive_mapping_prev();
const char * drive_map = device_ptr->ctx_driver->drive_mapping_previous();
if(drive_map != NULL)
{
filebrowser_set_root_and_ext(filebrowser, rarch_console_get_rom_ext(), drive_map);
@ -1683,7 +1702,7 @@ static void menu_romselect_iterate(filebrowser_t *filebrowser, menu_romselect_ac
break;
case MENU_DRIVE_MAPPING_NEXT:
{
const char * drive_map = context->drive_mapping_next();
const char * drive_map = device_ptr->ctx_driver->drive_mapping_next();
if(drive_map != NULL)
{
filebrowser_set_root_and_ext(filebrowser, rarch_console_get_rom_ext(), drive_map);
@ -1711,10 +1730,11 @@ static void menu_romselect_iterate(filebrowser_t *filebrowser, menu_romselect_ac
static void select_rom(menu *current_menu, uint64_t input)
{
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
char msg[128];
rmenu_default_positions_t default_pos;
context->set_default_pos(&default_pos);
device_ptr->ctx_driver->rmenu_set_default_pos(&default_pos);
browser_update(&browser, input, rarch_console_get_rom_ext());
@ -1743,15 +1763,15 @@ static void select_rom(menu *current_menu, uint64_t input)
else
snprintf(msg, sizeof(msg), "INFO - Press [%s] to load the game.", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_B));
context->render_msg(default_pos.x_position, default_pos.comment_y_position, default_pos.font_size, WHITE, msg);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.comment_y_position, default_pos.font_size, WHITE, msg);
display_menubar(current_menu);
snprintf(msg, sizeof(msg), "[%s] + [%s] - resume game", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_L3), rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_R3));
context->render_msg(default_pos.x_position, default_pos.comment_two_y_position, default_pos.font_size, YELLOW, msg);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.comment_two_y_position, default_pos.font_size, YELLOW, msg);
snprintf(msg, sizeof(msg), "[%s] - Settings", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_SELECT));
context->render_msg(default_pos.x_position, default_pos.comment_two_y_position + (default_pos.y_position_increment * 1), default_pos.font_size, YELLOW, msg);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.comment_two_y_position + (default_pos.y_position_increment * 1), default_pos.font_size, YELLOW, msg);
}
static bool show_menu_screen = true;
@ -1761,10 +1781,10 @@ static void ingame_menu_resize(menu *current_menu, uint64_t input)
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
rmenu_default_positions_t default_pos;
context->set_default_pos(&default_pos);
device_ptr->ctx_driver->rmenu_set_default_pos(&default_pos);
g_settings.video.aspect_ratio_idx = ASPECT_RATIO_CUSTOM;
context->set_aspect_ratio(g_settings.video.aspect_ratio_idx);
driver.video->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);
if(input & (1 << RMENU_DEVICE_NAV_LEFT_ANALOG_L))
{
@ -1856,65 +1876,66 @@ static void ingame_menu_resize(menu *current_menu, uint64_t input)
snprintf(viewport_w, sizeof(viewport_w), "Viewport W: #%d", g_extern.console.screen.viewports.custom_vp.width);
snprintf(viewport_h, sizeof(viewport_h), "Viewport H: #%d", g_extern.console.screen.viewports.custom_vp.height);
context->render_msg(default_pos.x_position, default_pos.y_position, default_pos.font_size, GREEN, viewport_x);
context->render_msg(default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*1), default_pos.font_size, GREEN, viewport_y);
context->render_msg(default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*2), default_pos.font_size, GREEN, viewport_w);
context->render_msg(default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*3), default_pos.font_size, GREEN, viewport_h);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.y_position, default_pos.font_size, GREEN, viewport_x);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*1), default_pos.font_size, GREEN, viewport_y);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*2), default_pos.font_size, GREEN, viewport_w);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*3), default_pos.font_size, GREEN, viewport_h);
context->render_msg(default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*4), default_pos.font_size, WHITE, "CONTROLS:");
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*4), default_pos.font_size, WHITE, "CONTROLS:");
snprintf(msg, sizeof(msg), "[%s] or [%s]", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_LEFT), rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_ANALOG_LEFT_DPAD_LEFT));
context->render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*5), default_pos.font_size, WHITE, msg);
context->render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*5), default_pos.font_size, WHITE, "- Viewport X --");
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*5), default_pos.font_size, WHITE, msg);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*5), default_pos.font_size, WHITE, "- Viewport X --");
snprintf(msg, sizeof(msg), "[%s] or [%s]", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_RIGHT), rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_ANALOG_LEFT_DPAD_RIGHT));
context->render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*6), default_pos.font_size, WHITE, msg);
context->render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*6), default_pos.font_size, WHITE, "- Viewport X ++");
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*6), default_pos.font_size, WHITE, msg);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*6), default_pos.font_size, WHITE, "- Viewport X ++");
snprintf(msg, sizeof(msg), "[%s] or [%s]", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_UP), rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_ANALOG_LEFT_DPAD_UP));
context->render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*7), default_pos.font_size, WHITE, msg);
context->render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*7), default_pos.font_size, WHITE, "- Viewport Y ++");
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*7), default_pos.font_size, WHITE, msg);
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*7), default_pos.font_size, WHITE, "- Viewport Y ++");
snprintf(msg, sizeof(msg), "[%s] or [%s]", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_DOWN), rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_ANALOG_LEFT_DPAD_DOWN));
context->render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*8), default_pos.font_size, WHITE, msg);
context->render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*8), default_pos.font_size, WHITE, "- Viewport Y --");
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*8), default_pos.font_size, WHITE, msg);
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*8), default_pos.font_size, WHITE, "- Viewport Y --");
snprintf(msg, sizeof(msg), "[%s] or [%s]", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_L), rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_ANALOG_RIGHT_DPAD_LEFT));
context->render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*9), default_pos.font_size, WHITE, msg);
context->render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*9), default_pos.font_size, WHITE, "- Viewport W --");
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*9), default_pos.font_size, WHITE, msg);
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*9), default_pos.font_size, WHITE, "- Viewport W --");
snprintf(msg, sizeof(msg), "[%s] or [%s]", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_R), rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_ANALOG_RIGHT_DPAD_RIGHT));
context->render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*10), default_pos.font_size, WHITE, msg);
context->render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*10), default_pos.font_size, WHITE, "- Viewport W ++");
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*10), default_pos.font_size, WHITE, msg);
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*10), default_pos.font_size, WHITE, "- Viewport W ++");
snprintf(msg, sizeof(msg), "[%s] or [%s]", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_L2), rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_ANALOG_RIGHT_DPAD_UP));
context->render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*11), default_pos.font_size, WHITE, msg);
context->render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*11), default_pos.font_size, WHITE, "- Viewport H ++");
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*11), default_pos.font_size, WHITE, msg);
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*11), default_pos.font_size, WHITE, "- Viewport H ++");
snprintf(msg, sizeof(msg), "[%s] or [%s]", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_R2), rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_ANALOG_RIGHT_DPAD_DOWN));
context->render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*12), default_pos.font_size, WHITE, msg);
context->render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*12), default_pos.font_size, WHITE, "- Viewport H --");
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*12), default_pos.font_size, WHITE, msg);
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*12), default_pos.font_size, WHITE, "- Viewport H --");
snprintf(msg, sizeof(msg), "[%s]", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_X));
context->render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*13), default_pos.font_size, WHITE, msg);
context->render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*13), default_pos.font_size, WHITE, "- Reset To Defaults");
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*13), default_pos.font_size, WHITE, msg);
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*13), default_pos.font_size, WHITE, "- Reset To Defaults");
snprintf(msg, sizeof(msg), "[%s]", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_Y));
context->render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*14), default_pos.font_size, WHITE, msg);
context->render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*14), default_pos.font_size, WHITE, "- Show Game");
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*14), default_pos.font_size, WHITE, msg);
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*14), default_pos.font_size, WHITE, "- Show Game");
snprintf(msg, sizeof(msg), "[%s]", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_A));
context->render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*15), default_pos.font_size, WHITE, msg);
context->render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*15), default_pos.font_size, WHITE, "- Go back");
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*15), default_pos.font_size, WHITE, msg);
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position_center, default_pos.y_position+(default_pos.y_position_increment*15), default_pos.font_size, WHITE, "- Go back");
snprintf(msg, sizeof(msg), "Press [%s] to reset to defaults.", rarch_input_find_platform_key_label(1 << RETRO_DEVICE_ID_JOYPAD_X));
context->render_msg (default_pos.x_position, default_pos.comment_y_position, default_pos.font_size, WHITE, msg);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.comment_y_position, default_pos.font_size, WHITE, msg);
}
}
static void ingame_menu_screenshot(menu *current_menu, uint64_t input)
{
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
(void)current_menu;
if(g_extern.console.rmenu.state.ingame_menu.enable)
@ -1922,11 +1943,11 @@ static void ingame_menu_screenshot(menu *current_menu, uint64_t input)
if(input & (1 << RMENU_DEVICE_NAV_A))
{
menu_stack_pop();
context->render_menu_enable(true);
device_ptr->ctx_driver->rmenu_enable(true);
}
if(input & (1 << RMENU_DEVICE_NAV_B))
context->screenshot_dump(NULL);
device_ptr->ctx_driver->rmenu_screenshot_dump(NULL);
}
}
@ -1934,11 +1955,12 @@ static void ingame_menu_screenshot(menu *current_menu, uint64_t input)
static void ingame_menu(menu *current_menu, uint64_t input)
{
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
char comment[256], strw_buffer[256];
unsigned menuitem_colors[MENU_ITEM_LAST];
rmenu_default_positions_t default_pos;
context->set_default_pos(&default_pos);
device_ptr->ctx_driver->rmenu_set_default_pos(&default_pos);
for(int i = 0; i < MENU_ITEM_LAST; i++)
menuitem_colors[i] = WHITE;
@ -2101,51 +2123,51 @@ static void ingame_menu(menu *current_menu, uint64_t input)
display_menubar(current_menu);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_LOAD_STATE_SLOT, sizeof(strw_buffer));
context->render_msg(default_pos.x_position, default_pos.y_position, default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_LOAD_STATE), strw_buffer);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.y_position, default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_LOAD_STATE), strw_buffer);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_SAVE_STATE_SLOT, sizeof(strw_buffer));
context->render_msg(default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_SAVE_STATE), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_SAVE_STATE), strw_buffer);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_SAVE_STATE), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_SAVE_STATE), strw_buffer);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_ASPECT_RATIO, sizeof(strw_buffer));
context->render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_KEEP_ASPECT_RATIO)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_KEEP_ASPECT_RATIO), strw_buffer);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_KEEP_ASPECT_RATIO)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_KEEP_ASPECT_RATIO), strw_buffer);
snprintf(strw_buffer, sizeof(strw_buffer), "Overscan: %f", g_extern.console.screen.overscan_amount);
context->render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_OVERSCAN_AMOUNT)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_OVERSCAN_AMOUNT), strw_buffer);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_OVERSCAN_AMOUNT)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_OVERSCAN_AMOUNT), strw_buffer);
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_ROTATION, sizeof(strw_buffer));
context->render_msg (default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_ORIENTATION)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_ORIENTATION), strw_buffer);
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_ORIENTATION)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_ORIENTATION), strw_buffer);
#ifdef HAVE_FBO
rarch_settings_create_menu_item_label(strw_buffer, S_LBL_SCALE_FACTOR, sizeof(strw_buffer));
context->render_msg (default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_SCALE_FACTOR)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_SCALE_FACTOR), strw_buffer);
device_ptr->ctx_driver->rmenu_render_msg (default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_SCALE_FACTOR)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_SCALE_FACTOR), strw_buffer);
#endif
context->render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_RESIZE_MODE)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_RESIZE_MODE), "Resize Mode");
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_RESIZE_MODE)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_RESIZE_MODE), "Resize Mode");
context->render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_FRAME_ADVANCE)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_FRAME_ADVANCE), "Frame Advance");
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_FRAME_ADVANCE)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_FRAME_ADVANCE), "Frame Advance");
context->render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_SCREENSHOT_MODE)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_SCREENSHOT_MODE), "Screenshot Mode");
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_SCREENSHOT_MODE)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_SCREENSHOT_MODE), "Screenshot Mode");
context->render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_RESET)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_RESET), "Reset");
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_RESET)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_RESET), "Reset");
context->render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_RETURN_TO_GAME)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_RETURN_TO_GAME), "Return to Game");
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_RETURN_TO_GAME)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_RETURN_TO_GAME), "Return to Game");
context->render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_RETURN_TO_MENU)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_RETURN_TO_MENU), "Return to Menu");
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_RETURN_TO_MENU)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_RETURN_TO_MENU), "Return to Menu");
context->render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_CHANGE_LIBRETRO)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_CHANGE_LIBRETRO), "Change libretro core");
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_CHANGE_LIBRETRO)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_CHANGE_LIBRETRO), "Change libretro core");
#ifdef HAVE_MULTIMAN
context->render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_RETURN_TO_MULTIMAN)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_RETURN_TO_MULTIMAN), "Return to multiMAN");
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_RETURN_TO_MULTIMAN)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_RETURN_TO_MULTIMAN), "Return to multiMAN");
#endif
context->render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_QUIT_RARCH)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_QUIT_RARCH), "Quit RetroArch");
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, (default_pos.y_position+(default_pos.y_position_increment*MENU_ITEM_QUIT_RARCH)), default_pos.font_size, MENU_ITEM_SELECTED(MENU_ITEM_QUIT_RARCH), "Quit RetroArch");
context->render_msg(default_pos.x_position, default_pos.comment_y_position, default_pos.font_size, WHITE, comment);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.x_position, default_pos.comment_y_position, default_pos.font_size, WHITE, comment);
rmenu_position_t position = {0};
rarch_position_t position = {0};
position.x = default_pos.x_position;
position.y = (default_pos.y_position+(default_pos.y_position_increment * g_extern.console.rmenu.ingame_menu.idx));
context->render_selection_panel(&position);
device_ptr->ctx_driver->rmenu_draw_panel(&position);
}
static void rmenu_filebrowser_init(void)
@ -2163,11 +2185,7 @@ static void rmenu_filebrowser_free(void)
void menu_init (void)
{
#if defined(__CELLOS_LV2__)
context = &rmenu_ctx_ps3;
#elif defined(_XBOX1)
context = (rmenu_context_t*)&rmenu_ctx_xdk;
#endif
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;
//Set libretro filename and version to variable
struct retro_system_info info;
@ -2176,6 +2194,8 @@ void menu_init (void)
snprintf(m_title, sizeof(m_title), "%s %s", id, info.library_version);
rmenu_filebrowser_init();
device_ptr->ctx_driver->rmenu_init();
}
void menu_free (void)
@ -2193,7 +2213,7 @@ void menu_loop(void)
if(g_extern.console.rmenu.state.ingame_menu.enable)
menu_stack_push(INGAME_MENU);
context->init_textures();
device_ptr->ctx_driver->rmenu_enable(true);
menu current_menu;
menu_stack_force_refresh();
@ -2208,7 +2228,7 @@ void menu_loop(void)
menu_stack_get_current_ptr(&current_menu);
context->set_default_pos(&default_pos);
device_ptr->ctx_driver->rmenu_set_default_pos(&default_pos);
input_ptr.poll(NULL);
@ -2250,16 +2270,16 @@ void menu_loop(void)
}
}
context->clear();
device_ptr->ctx_driver->clear();
if(!show_menu_screen || current_menu.enum_id == INGAME_MENU_SCREENSHOT)
{
context->render_menu_enable(false);
device_ptr->ctx_driver->rmenu_enable(false);
}
else
{
context->blend(true);
context->render_menu_enable(true);
device_ptr->ctx_driver->set_blend(true);
device_ptr->ctx_driver->rmenu_enable(true);
}
rarch_render_cached_frame();
@ -2359,18 +2379,22 @@ void menu_loop(void)
if (message && g_extern.console.rmenu.state.msg_info.enable)
{
context->render_msg(default_pos.msg_queue_x_position, default_pos.msg_queue_y_position, default_pos.msg_queue_font_size, WHITE, message);
device_ptr->ctx_driver->rmenu_render_msg(default_pos.msg_queue_x_position, default_pos.msg_queue_y_position, default_pos.msg_queue_font_size, WHITE, message);
}
context->swap_buffers();
device_ptr->ctx_driver->swap_buffers();
bool quit, resize;
unsigned width, height, frame_count;
frame_count = 0;
device_ptr->ctx_driver->check_window(&quit, &resize, &width, &height, frame_count);
if(current_menu.enum_id == INGAME_MENU_RESIZE && (old_state & (1 << RMENU_DEVICE_NAV_Y)) || current_menu.enum_id == INGAME_MENU_SCREENSHOT)
{ }
else
context->blend(false);
device_ptr->ctx_driver->set_blend(false);
}while(g_extern.console.rmenu.state.rmenu.enable);
context->free_textures();
device_ptr->ctx_driver->rmenu_enable(false);
if(g_extern.console.rmenu.state.ingame_menu.enable)
menu_stack_pop();

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,
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;