From 9976b81f18ee60f855ccfc4403de705ef23f36bc Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Fri, 3 Aug 2012 17:54:22 +0200 Subject: [PATCH] (PS3/Xbox 1) Menu changes --- gfx/context/ps3_ctx.c | 8 +++--- gfx/gfx_context.h | 3 +- ps3/frontend/menu.c | 67 ++++++++++++++++++++++++++----------------- ps3/frontend/menu.h | 7 +++++ xbox1/frontend/menu.c | 23 +++++++-------- 5 files changed, 62 insertions(+), 46 deletions(-) diff --git a/gfx/context/ps3_ctx.c b/gfx/context/ps3_ctx.c index 2c187b849d..41e341e7e7 100644 --- a/gfx/context/ps3_ctx.c +++ b/gfx/context/ps3_ctx.c @@ -334,11 +334,11 @@ const char *ps3_get_resolution_label(uint32_t resolution) switch (resolution) { case CELL_VIDEO_OUT_RESOLUTION_480: - return "720x480 (480p)"; + return "720x480"; case CELL_VIDEO_OUT_RESOLUTION_576: - return "720x576 (576p)"; + return "720x576"; case CELL_VIDEO_OUT_RESOLUTION_720: - return "1280x720 (720p)"; + return "1280x720"; case CELL_VIDEO_OUT_RESOLUTION_960x1080: return "960x1080"; case CELL_VIDEO_OUT_RESOLUTION_1280x1080: @@ -348,7 +348,7 @@ const char *ps3_get_resolution_label(uint32_t resolution) case CELL_VIDEO_OUT_RESOLUTION_1600x1080: return "1600x1080"; case CELL_VIDEO_OUT_RESOLUTION_1080: - return "1920x1080 (1080p)"; + return "1920x1080"; default: return "Unknown"; } diff --git a/gfx/gfx_context.h b/gfx/gfx_context.h index 31fa6424ac..732900363f 100644 --- a/gfx/gfx_context.h +++ b/gfx/gfx_context.h @@ -62,9 +62,8 @@ bool gfx_ctx_get_wm_info(SDL_SysWMinfo *info); #ifndef HAVE_GRIFFIN bool gfx_ctx_window_has_focus(void); - -void gfx_ctx_swap_buffers(void); #endif +void gfx_ctx_swap_buffers(void); void gfx_ctx_input_driver(const input_driver_t **input, void **input_data); diff --git a/ps3/frontend/menu.c b/ps3/frontend/menu.c index eba68f2239..e7225bc3e5 100644 --- a/ps3/frontend/menu.c +++ b/ps3/frontend/menu.c @@ -14,16 +14,17 @@ * If not, see . */ +#if defined(__CELLOS_LV2__) #include #include #include -#include #if(CELL_SDK_VERSION > 0x340000) #include #endif -#include "../ps3_input.h" +#endif + #include "../../console/fileio/file_browser.h" #include "../../console/rarch_console.h" @@ -31,18 +32,30 @@ #include "../../console/rarch_console_input.h" #include "../../console/rarch_console_config.h" #include "../../console/rarch_console_settings.h" + +#ifdef HAVE_RSOUND #include "../../console/rarch_console_rsound.h" +#endif + #include "../../console/rarch_console_video.h" #ifdef HAVE_ZLIB #include "../../console/rarch_console_rzlib.h" #endif +#if defined(HAVE_OPENGL) #include "../../gfx/gl_common.h" #include "../../gfx/gl_font.h" +#endif #include "../../gfx/gfx_context.h" + +#if defined(__CELLOS_LV2__) #include "../../gfx/context/ps3_ctx.h" +#endif + +#if defined(HAVE_CG) #include "../../gfx/shader_cg.h" +#endif #include "../../file.h" #include "../../general.h" @@ -62,7 +75,6 @@ filebrowser_t browser; filebrowser_t tmpBrowser; unsigned set_shader = 0; static unsigned currently_selected_controller_menu = 0; -static char strw_buffer[PATH_MAX]; char m_title[256]; static uint64_t old_state = 0; @@ -362,28 +374,28 @@ menu *menu_stack_get_current_ptr (void) static void menu_stack_refresh (item *items, menu *current_menu) { int page, i, j; - float increment; - float increment_step = 0.03f; + float y_position; + float increment_step = POSITION_Y_INCREMENT; float x_position = POSITION_X; page = 0; j = 0; - increment = 0.16f; + y_position = POSITION_Y_BEGIN; for(i = current_menu->first_setting; i < current_menu->max_settings; i++) { if(!(j < (NUM_ENTRY_PER_PAGE))) { j = 0; - increment = 0.16f; + y_position = POSITION_Y_BEGIN; page++; } items[i].text_xpos = x_position; - items[i].text_ypos = increment; + items[i].text_ypos = y_position; items[i].page = page; set_setting_label(current_menu, items, i); - increment += increment_step; + y_position += increment_step; j++; } } @@ -558,7 +570,7 @@ static void display_menubar(menu *current_menu) char current_path[256], rarch_version[128]; float x_position = POSITION_X; - float font_size = 0.91f; + float font_size = HARDCODE_FONT_SIZE; snprintf(rarch_version, sizeof(rarch_version), "v%s", PACKAGE_VERSION); @@ -706,9 +718,9 @@ static void select_file(item *items, menu *current_menu, uint64_t input) bool ret = true; float x_position = POSITION_X; - float comment_y_position = 0.83f; + float comment_y_position = COMMENT_Y_POSITION; float comment_two_y_position = 0.91f; - float font_size = 0.91f; + float font_size = HARDCODE_FONT_SIZE; switch(current_menu->enum_id) { @@ -814,9 +826,9 @@ static void select_directory(item *items, menu *current_menu, uint64_t input) DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data; float x_position = POSITION_X; - float comment_y_position = 0.83f; + float comment_y_position = COMMENT_Y_POSITION; float comment_two_y_position = 0.91f; - float font_size = 0.91f; + float font_size = HARDCODE_FONT_SIZE; bool is_dir = filebrowser_get_current_path_isdir(&tmpBrowser); browser_update(&tmpBrowser, input, "empty"); @@ -1621,9 +1633,9 @@ static void select_setting(item *items, menu *current_menu, uint64_t input) float x_position = POSITION_X; float x_position_center = 0.5f; - float comment_y_position = 0.83f; + float comment_y_position = COMMENT_Y_POSITION; float comment_two_y_position = 0.91f; - float font_size = 0.91f; + float font_size = HARDCODE_FONT_SIZE; settings_action_t action = SETTINGS_ACTION_NOOP; @@ -1694,9 +1706,9 @@ static void select_rom(item *items, menu *current_menu, uint64_t input) DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data; float x_position = POSITION_X; - float comment_y_position = 0.83f; - float font_size = 0.91f; + float comment_y_position = COMMENT_Y_POSITION; float comment_two_y_position = 0.91f; + float font_size = HARDCODE_FONT_SIZE; browser_update(&browser, input, rarch_console_get_rom_ext()); @@ -1743,11 +1755,11 @@ static void ingame_menu_resize(item *items, menu *current_menu, uint64_t input) float x_position = POSITION_X; float x_position_center = 0.5f; - float font_size = 0.91f; + float font_size = HARDCODE_FONT_SIZE; - float y_position = 0.16f; - float y_position_increment = 0.035f; - float comment_y_position = 0.83f; + float y_position = POSITION_Y_BEGIN; + float y_position_increment = POSITION_Y_INCREMENT; + float comment_y_position = COMMENT_Y_POSITION; g_console.aspect_ratio_index = ASPECT_RATIO_CUSTOM; gfx_ctx_set_aspect_ratio(NULL, g_console.aspect_ratio_index); @@ -1902,15 +1914,16 @@ static void ingame_menu_screenshot(item *items, menu *current_menu, uint64_t inp static void ingame_menu(item *items, menu *current_menu, uint64_t input) { char comment[256], overscan_msg[64]; + char strw_buffer[256]; static unsigned menuitem_colors[MENU_ITEM_LAST]; DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data; float x_position = POSITION_X; - float y_position = 0.16f; - float comment_y_position = 0.83f; - float font_size = 0.91f; + float y_position = POSITION_Y_BEGIN; + float comment_y_position = COMMENT_Y_POSITION; + float font_size = HARDCODE_FONT_SIZE; - float y_position_increment = 0.035f; + float y_position_increment = POSITION_Y_INCREMENT; for(int i = 0; i < MENU_ITEM_LAST; i++) menuitem_colors[i] = GREEN; @@ -2318,7 +2331,7 @@ void menu_loop(void) float x_position = POSITION_X; float starting_y_position = POSITION_Y_START; - float y_position_increment = 0.035f; + float y_position_increment = POSITION_Y_INCREMENT; switch(current_menu->category_id) { diff --git a/ps3/frontend/menu.h b/ps3/frontend/menu.h index 7bade689f4..4cbd1236ac 100644 --- a/ps3/frontend/menu.h +++ b/ps3/frontend/menu.h @@ -21,6 +21,7 @@ #define DEVICE_CAST gl_t* #define input_ptr input_ps3 #define DEVICE_PTR device_ptr +#define HARDCODE_FONT_SIZE 0.91f #define FONT_SIZE (g_console.menu_font_size) #define render_msg_pre_func() gl_render_msg_pre(DEVICE_PTR) #define render_msg_place_func(xpos, ypos, scale, color, msg) gl_render_msg_place(xpos, ypos, scale, color, msg) @@ -28,6 +29,9 @@ #define POSITION_X 0.09f #define POSITION_Y_START 0.10f +#define POSITION_Y_BEGIN (POSITION_Y_START + POSITION_Y_INCREMENT) +#define POSITION_Y_INCREMENT 0.035f +#define COMMENT_Y_POSITION 0.83f #elif defined(_XBOX1) #define DEVICE_CAST xdk_d3d_video_t* #define input_ptr input_xinput @@ -39,6 +43,9 @@ #define POSITION_X m_menuMainRomListPos_x #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) #endif typedef struct diff --git a/xbox1/frontend/menu.c b/xbox1/frontend/menu.c index e0077065dc..2ef04e7ded 100644 --- a/xbox1/frontend/menu.c +++ b/xbox1/frontend/menu.c @@ -47,10 +47,6 @@ d3d_surface_t m_menuMainBG; // Rom list coords int m_menuMainRomListPos_x; int m_menuMainRomListPos_y; - -// Backbuffer width, height -int width; -int height; #endif menu menuStack[10]; @@ -351,28 +347,28 @@ menu *menu_stack_get_current_ptr (void) static void menu_stack_refresh (item *items, menu *current_menu) { int page, i, j; - float increment; - float increment_step = 0.03f; + float y_position; + float increment_step = POSITION_Y_INCREMENT; float x_position = POSITION_X; page = 0; j = 0; - increment = 0.16f; + y_position = 0.16f; for(i = current_menu->first_setting; i < current_menu->max_settings; i++) { if(!(j < (NUM_ENTRY_PER_PAGE))) { j = 0; - increment = 0.16f; + y_position = 0.16f; page++; } items[i].text_xpos = x_position; - items[i].text_ypos = increment; + items[i].text_ypos = y_position; items[i].page = page; set_setting_label(current_menu, items, i); - increment += increment_step; + y_position += increment_step; j++; } } @@ -736,7 +732,7 @@ static void select_rom(item *items, menu *current_menu, uint64_t input) int menu_init(void) { - xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data; + DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data; // Set libretro filename and version to variable struct retro_system_info info; @@ -763,7 +759,8 @@ int menu_init(void) xbox_io_mount("F:", "Harddisk0\\Partition6"); xbox_io_mount("G:", "Harddisk0\\Partition7"); - width = d3d->d3dpp.BackBufferWidth; + // Backbuffer width + int width = device_ptr->d3dpp.BackBufferWidth; // Quick hack to properly center the romlist in 720p, // it might need more work though (font size and rom selector size -> needs more memory) @@ -991,7 +988,7 @@ void menu_loop(void) float x_position = POSITION_X; float starting_y_position = POSITION_Y_START; - float y_position_increment = 20; + float y_position_increment = POSITION_Y_INCREMENT; switch(current_menu->category_id) {