mirror of
https://github.com/libretro/RetroArch
synced 2025-01-27 12:35:23 +00:00
(PS3/Xbox 1) Make menu code usable for both PS3/360
This commit is contained in:
parent
8a5641a585
commit
9123da72ae
@ -63,7 +63,7 @@ filebrowser_t tmpBrowser;
|
|||||||
unsigned set_shader = 0;
|
unsigned set_shader = 0;
|
||||||
static unsigned currently_selected_controller_menu = 0;
|
static unsigned currently_selected_controller_menu = 0;
|
||||||
static char strw_buffer[PATH_MAX];
|
static char strw_buffer[PATH_MAX];
|
||||||
char core_text[256];
|
char m_title[256];
|
||||||
|
|
||||||
static uint64_t old_state = 0;
|
static uint64_t old_state = 0;
|
||||||
|
|
||||||
@ -612,7 +612,7 @@ static void display_menubar(menu *current_menu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
render_msg_place_func(x_position, 0.05f, 1.4f, WHITE, current_menu->title);
|
render_msg_place_func(x_position, 0.05f, 1.4f, WHITE, current_menu->title);
|
||||||
render_msg_place_func(0.3f, 0.06f, 0.82f, WHITE, core_text);
|
render_msg_place_func(0.3f, 0.06f, 0.82f, WHITE, m_title);
|
||||||
render_msg_place_func(0.8f, 0.12f, 0.82f, WHITE, rarch_version);
|
render_msg_place_func(0.8f, 0.12f, 0.82f, WHITE, rarch_version);
|
||||||
render_msg_post_func();
|
render_msg_post_func();
|
||||||
}
|
}
|
||||||
@ -2126,7 +2126,7 @@ void menu_init (void)
|
|||||||
struct retro_system_info info;
|
struct retro_system_info info;
|
||||||
retro_get_system_info(&info);
|
retro_get_system_info(&info);
|
||||||
const char *id = info.library_name ? info.library_name : "Unknown";
|
const char *id = info.library_name ? info.library_name : "Unknown";
|
||||||
snprintf(core_text, sizeof(core_text), "Libretro core: %s %s", id, info.library_version);
|
snprintf(m_title, sizeof(m_title), "Libretro core: %s %s", id, info.library_version);
|
||||||
|
|
||||||
menu_stack_push(menu_items, FILE_BROWSER_MENU);
|
menu_stack_push(menu_items, FILE_BROWSER_MENU);
|
||||||
filebrowser_set_root_and_ext(&browser, rarch_console_get_rom_ext(), default_paths.filebrowser_startup_dir);
|
filebrowser_set_root_and_ext(&browser, rarch_console_get_rom_ext(), default_paths.filebrowser_startup_dir);
|
||||||
|
@ -545,7 +545,11 @@ static void display_menubar(menu *current_menu)
|
|||||||
|
|
||||||
float x_position = POSITION_X;
|
float x_position = POSITION_X;
|
||||||
float current_y_position = POSITION_Y_START;
|
float current_y_position = POSITION_Y_START;
|
||||||
|
#ifdef _XBOX1
|
||||||
float font_size = m_menuMainRomListPos_y;
|
float font_size = m_menuMainRomListPos_y;
|
||||||
|
#else
|
||||||
|
float font_size = 0.91f;
|
||||||
|
#endif
|
||||||
|
|
||||||
snprintf(rarch_version, sizeof(rarch_version), "v%s", PACKAGE_VERSION);
|
snprintf(rarch_version, sizeof(rarch_version), "v%s", PACKAGE_VERSION);
|
||||||
|
|
||||||
@ -592,15 +596,26 @@ static void display_menubar(menu *current_menu)
|
|||||||
fb = &tmpBrowser;
|
fb = &tmpBrowser;
|
||||||
case FILE_BROWSER_MENU:
|
case FILE_BROWSER_MENU:
|
||||||
snprintf(current_path, sizeof(current_path), "PATH: %s", filebrowser_get_current_dir(fb));
|
snprintf(current_path, sizeof(current_path), "PATH: %s", filebrowser_get_current_dir(fb));
|
||||||
|
#ifdef _XBOX1
|
||||||
render_msg_place_func(x_position, current_y_position, 0, 0, current_path);
|
render_msg_place_func(x_position, current_y_position, 0, 0, current_path);
|
||||||
|
#else
|
||||||
|
render_msg_place_func(x_position, 0.09f, FONT_SIZE, YELLOW, current_path);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _XBOX1
|
||||||
//Render background image
|
//Render background image
|
||||||
d3d_surface_render(&m_menuMainBG, MENU_MAIN_BG_X, MENU_MAIN_BG_Y,
|
d3d_surface_render(&m_menuMainBG, MENU_MAIN_BG_X, MENU_MAIN_BG_Y,
|
||||||
m_menuMainBG.m_imageInfo.Width, m_menuMainBG.m_imageInfo.Height);
|
m_menuMainBG.m_imageInfo.Width, m_menuMainBG.m_imageInfo.Height);
|
||||||
|
#else
|
||||||
|
render_msg_place_func(x_position, 0.05f, 1.4f, WHITE, current_menu->title);
|
||||||
|
render_msg_place_func(0.3f, 0.06f, 0.82f, WHITE, m_title);
|
||||||
|
render_msg_place_func(0.8f, 0.12f, 0.82f, WHITE, rarch_version);
|
||||||
|
render_msg_post_func();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void browser_update(filebrowser_t * b, uint16_t input, const char *extensions)
|
static void browser_update(filebrowser_t * b, uint16_t input, const char *extensions)
|
||||||
@ -624,6 +639,7 @@ static void browser_update(filebrowser_t * b, uint16_t input, const char *extens
|
|||||||
else if (input & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
else if (input & (1 << RETRO_DEVICE_ID_JOYPAD_START))
|
||||||
{
|
{
|
||||||
action = FILEBROWSER_ACTION_RESET;
|
action = FILEBROWSER_ACTION_RESET;
|
||||||
|
//TODO - Dehardcode this
|
||||||
filebrowser_set_root(b, "/");
|
filebrowser_set_root(b, "/");
|
||||||
strlcpy(b->extensions, extensions, sizeof(b->extensions));
|
strlcpy(b->extensions, extensions, sizeof(b->extensions));
|
||||||
}
|
}
|
||||||
@ -654,32 +670,44 @@ static void browser_render(filebrowser_t *b, float current_x, float current_y, f
|
|||||||
fill_pathname_base(fname_tmp, b->current_dir.list->elems[i].data, sizeof(fname_tmp));
|
fill_pathname_base(fname_tmp, b->current_dir.list->elems[i].data, sizeof(fname_tmp));
|
||||||
currentY = currentY + ySpacing;
|
currentY = currentY + ySpacing;
|
||||||
|
|
||||||
const char *rom_basename = fname_tmp;
|
#ifdef _XBOX1
|
||||||
|
|
||||||
//check if this is the currently selected file
|
//check if this is the currently selected file
|
||||||
const char *current_pathname = filebrowser_get_current_path(b);
|
const char *current_pathname = filebrowser_get_current_path(b);
|
||||||
if(strcmp(current_pathname, b->current_dir.list->elems[i].data) == 0)
|
if(strcmp(current_pathname, b->current_dir.list->elems[i].data) == 0)
|
||||||
d3d_surface_render(&m_menuMainRomSelectPanel, currentX, currentY, ROM_PANEL_WIDTH, ROM_PANEL_HEIGHT);
|
d3d_surface_render(&m_menuMainRomSelectPanel, currentX, currentY, ROM_PANEL_WIDTH, ROM_PANEL_HEIGHT);
|
||||||
|
|
||||||
render_msg_place_func(currentX, currentY, 0, 0, rom_basename);
|
render_msg_place_func(currentX, currentY, 0, 0, fname_tmp);
|
||||||
|
#else
|
||||||
|
render_msg_place_func(currentX, currentY, FONT_SIZE, i == current_index ? RED : b->current_dir.list->elems[i].attr.b ? GREEN : WHITE, fname_tmp);
|
||||||
|
render_msg_post_func();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifndef _XBOX1
|
||||||
|
render_msg_post_func();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_romselect_iterate(filebrowser_t *filebrowser, menu_romselect_action_t action)
|
static void menu_romselect_iterate(filebrowser_t *filebrowser, menu_romselect_action_t action)
|
||||||
{
|
{
|
||||||
|
bool ret = true;
|
||||||
|
|
||||||
switch(action)
|
switch(action)
|
||||||
{
|
{
|
||||||
case MENU_ROMSELECT_ACTION_OK:
|
case MENU_ROMSELECT_ACTION_OK:
|
||||||
if(filebrowser_get_current_path_isdir(filebrowser))
|
if(filebrowser_get_current_path_isdir(filebrowser))
|
||||||
filebrowser_iterate(filebrowser, FILEBROWSER_ACTION_OK);
|
ret = filebrowser_iterate(filebrowser, FILEBROWSER_ACTION_OK);
|
||||||
else
|
else
|
||||||
rarch_console_load_game_wrap(filebrowser_get_current_path(filebrowser), g_console.zip_extract_mode, S_DELAY_45);
|
rarch_console_load_game_wrap(filebrowser_get_current_path(filebrowser), g_console.zip_extract_mode, S_DELAY_45);
|
||||||
break;
|
break;
|
||||||
case MENU_ROMSELECT_ACTION_GOTO_SETTINGS:
|
case MENU_ROMSELECT_ACTION_GOTO_SETTINGS:
|
||||||
|
menu_stack_push(items, GENERAL_VIDEO_MENU);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!ret)
|
||||||
|
rarch_settings_msg(S_MSG_DIR_LOADING_ERROR, S_DELAY_180);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void select_rom(item *items, menu *current_menu, uint64_t input)
|
static void select_rom(item *items, menu *current_menu, uint64_t input)
|
||||||
@ -716,7 +744,15 @@ int menu_init(void)
|
|||||||
const char *id = info.library_name ? info.library_name : "Unknown";
|
const char *id = info.library_name ? info.library_name : "Unknown";
|
||||||
snprintf(m_title, sizeof(m_title), "Libretro core: %s %s", id, info.library_version);
|
snprintf(m_title, sizeof(m_title), "Libretro core: %s %s", id, info.library_version);
|
||||||
|
|
||||||
|
menu_stack_push(menu_items, FILE_BROWSER_MENU);
|
||||||
|
filebrowser_set_root_and_ext(&browser, rarch_console_get_rom_ext(), g_console.default_rom_startup_dir);
|
||||||
|
#ifdef _XBOX1
|
||||||
|
filebrowser_set_root(&tmpBrowser, "D:");
|
||||||
|
#else
|
||||||
|
filebrowser_set_root(&tmpBrowser, "/");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _XBOX1
|
||||||
// Set file cache size
|
// Set file cache size
|
||||||
XSetFileCacheSize(8 * 1024 * 1024);
|
XSetFileCacheSize(8 * 1024 * 1024);
|
||||||
|
|
||||||
@ -727,11 +763,6 @@ int menu_init(void)
|
|||||||
xbox_io_mount("F:", "Harddisk0\\Partition6");
|
xbox_io_mount("F:", "Harddisk0\\Partition6");
|
||||||
xbox_io_mount("G:", "Harddisk0\\Partition7");
|
xbox_io_mount("G:", "Harddisk0\\Partition7");
|
||||||
|
|
||||||
strlcpy(browser.extensions, rarch_console_get_rom_ext(), sizeof(browser.extensions));
|
|
||||||
menu_stack_push(menu_items, FILE_BROWSER_MENU);
|
|
||||||
filebrowser_set_root_and_ext(&browser, rarch_console_get_rom_ext(), g_console.default_rom_startup_dir);
|
|
||||||
filebrowser_set_root(&tmpBrowser, "/");
|
|
||||||
|
|
||||||
width = d3d->d3dpp.BackBufferWidth;
|
width = d3d->d3dpp.BackBufferWidth;
|
||||||
|
|
||||||
// Quick hack to properly center the romlist in 720p,
|
// Quick hack to properly center the romlist in 720p,
|
||||||
@ -758,8 +789,7 @@ int menu_init(void)
|
|||||||
//Center the text (hardcoded)
|
//Center the text (hardcoded)
|
||||||
xpos = width == 640 ? 65 : 400;
|
xpos = width == 640 ? 65 : 400;
|
||||||
ypos = width == 640 ? 430 : 670;
|
ypos = width == 640 ? 430 : 670;
|
||||||
|
#endif
|
||||||
g_console.mode_switch = MODE_MENU;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -769,8 +799,10 @@ void menu_free(void)
|
|||||||
filebrowser_free(&browser);
|
filebrowser_free(&browser);
|
||||||
filebrowser_free(&tmpBrowser);
|
filebrowser_free(&tmpBrowser);
|
||||||
|
|
||||||
|
#ifdef _XBOX1
|
||||||
d3d_surface_free(&m_menuMainBG);
|
d3d_surface_free(&m_menuMainBG);
|
||||||
d3d_surface_free(&m_menuMainRomSelectPanel);
|
d3d_surface_free(&m_menuMainRomSelectPanel);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_loop(void)
|
void menu_loop(void)
|
||||||
@ -899,6 +931,20 @@ void menu_loop(void)
|
|||||||
device_ptr->frame_count++;
|
device_ptr->frame_count++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(current_menu->enum_id == INGAME_MENU_RESIZE && (trig_state & RETRO_DEVICE_ID_JOYPAD_Y) || current_menu->enum_id == INGAME_MENU_SCREENSHOT)
|
||||||
|
{
|
||||||
|
#ifdef __CELLOS_LV2__
|
||||||
|
device_ptr->menu_render = false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gfx_ctx_set_blend(true);
|
||||||
|
#ifdef __CELLOS_LV2__
|
||||||
|
device_ptr->menu_render = true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
filebrowser_t * fb = &browser;
|
filebrowser_t * fb = &browser;
|
||||||
|
|
||||||
switch(current_menu->enum_id)
|
switch(current_menu->enum_id)
|
||||||
@ -989,8 +1035,19 @@ void menu_loop(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gfx_ctx_swap_buffers();
|
gfx_ctx_swap_buffers();
|
||||||
|
#ifdef HAVE_SYSUTILS
|
||||||
|
cellSysutilCheckCallback();
|
||||||
|
#endif
|
||||||
|
if(current_menu->enum_id == INGAME_MENU_RESIZE && (old_state & (1 << RETRO_DEVICE_ID_JOYPAD_Y)) || current_menu->enum_id == INGAME_MENU_SCREENSHOT)
|
||||||
|
{ }
|
||||||
|
else
|
||||||
|
gfx_ctx_set_blend(false);
|
||||||
}while(g_console.menu_enable);
|
}while(g_console.menu_enable);
|
||||||
|
|
||||||
|
#ifdef __CELLOS_LV2__
|
||||||
|
device_ptr->menu_render = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
if(g_console.ingame_menu_enable)
|
if(g_console.ingame_menu_enable)
|
||||||
menu_stack_decrement();
|
menu_stack_decrement();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user