(PS3) Rewrite resolution context code

This commit is contained in:
Twinaphex 2012-08-10 04:47:58 +02:00
parent 552180f276
commit fcebaca85e
3 changed files with 29 additions and 32 deletions

View File

@ -136,8 +136,12 @@ static void set_setting_label(menu * current_menu, item *items, unsigned current
{ {
#ifdef __CELLOS_LV2__ #ifdef __CELLOS_LV2__
case SETTING_CHANGE_RESOLUTION: case SETTING_CHANGE_RESOLUTION:
{
unsigned width = gfx_ctx_get_resolution_width(g_console.supported_resolutions[g_console.current_resolution_index]);
unsigned height = gfx_ctx_get_resolution_height(g_console.supported_resolutions[g_console.current_resolution_index]);
set_setting_label_color(items,g_console.initial_resolution_id == g_console.supported_resolutions[g_console.current_resolution_index], currentsetting); set_setting_label_color(items,g_console.initial_resolution_id == g_console.supported_resolutions[g_console.current_resolution_index], currentsetting);
snprintf(items[currentsetting].setting_text, sizeof(items[currentsetting].setting_text), ps3_get_resolution_label(g_console.supported_resolutions[g_console.current_resolution_index])); snprintf(items[currentsetting].setting_text, sizeof(items[currentsetting].setting_text), "%dx%d", width, height);
}
break; break;
#endif #endif
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL) #if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL)
@ -604,9 +608,6 @@ static void menu_stack_push(item *items, unsigned menu_id)
menu_stack_refresh(items, current_menu); menu_stack_refresh(items, current_menu);
} }
//forward decls
extern const char *ps3_get_resolution_label(unsigned resolution);
static void display_menubar(menu *current_menu) static void display_menubar(menu *current_menu)
{ {
DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data; DEVICE_CAST device_ptr = (DEVICE_CAST)driver.video_data;

View File

@ -257,10 +257,14 @@ void gfx_ctx_get_available_resolutions (void)
defaultresolution = true; defaultresolution = true;
uint32_t videomode[] = { uint32_t videomode[] = {
CELL_VIDEO_OUT_RESOLUTION_480, CELL_VIDEO_OUT_RESOLUTION_576, CELL_VIDEO_OUT_RESOLUTION_480,
CELL_VIDEO_OUT_RESOLUTION_960x1080, CELL_VIDEO_OUT_RESOLUTION_720, CELL_VIDEO_OUT_RESOLUTION_576,
CELL_VIDEO_OUT_RESOLUTION_1280x1080, CELL_VIDEO_OUT_RESOLUTION_1440x1080, CELL_VIDEO_OUT_RESOLUTION_960x1080,
CELL_VIDEO_OUT_RESOLUTION_1600x1080, CELL_VIDEO_OUT_RESOLUTION_1080 CELL_VIDEO_OUT_RESOLUTION_720,
CELL_VIDEO_OUT_RESOLUTION_1280x1080,
CELL_VIDEO_OUT_RESOLUTION_1440x1080,
CELL_VIDEO_OUT_RESOLUTION_1600x1080,
CELL_VIDEO_OUT_RESOLUTION_1080
}; };
num_videomodes = sizeof(videomode) / sizeof(uint32_t); num_videomodes = sizeof(videomode) / sizeof(uint32_t);
@ -303,29 +307,20 @@ int gfx_ctx_check_resolution(unsigned resolution_id)
return cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, resolution_id, CELL_VIDEO_OUT_ASPECT_AUTO, 0); return cellVideoOutGetResolutionAvailability(CELL_VIDEO_OUT_PRIMARY, resolution_id, CELL_VIDEO_OUT_ASPECT_AUTO, 0);
} }
const char *ps3_get_resolution_label(uint32_t resolution) unsigned gfx_ctx_get_resolution_width(unsigned resolution_id)
{ {
switch (resolution) CellVideoOutResolution resolution;
{ cellVideoOutGetResolution(resolution_id, &resolution);
case CELL_VIDEO_OUT_RESOLUTION_480:
return "720x480"; return resolution.width;
case CELL_VIDEO_OUT_RESOLUTION_576: }
return "720x576";
case CELL_VIDEO_OUT_RESOLUTION_720: unsigned gfx_ctx_get_resolution_height(unsigned resolution_id)
return "1280x720"; {
case CELL_VIDEO_OUT_RESOLUTION_960x1080: CellVideoOutResolution resolution;
return "960x1080"; cellVideoOutGetResolution(resolution_id, &resolution);
case CELL_VIDEO_OUT_RESOLUTION_1280x1080:
return "1280x1080"; return resolution.height;
case CELL_VIDEO_OUT_RESOLUTION_1440x1080:
return "1440x1080";
case CELL_VIDEO_OUT_RESOLUTION_1600x1080:
return "1600x1080";
case CELL_VIDEO_OUT_RESOLUTION_1080:
return "1920x1080";
default:
return "Unknown";
}
} }
void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate) void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate)

View File

@ -19,7 +19,8 @@
void gfx_ctx_get_available_resolutions (void); void gfx_ctx_get_available_resolutions (void);
int gfx_ctx_check_resolution(unsigned resolution_id); int gfx_ctx_check_resolution(unsigned resolution_id);
const char *ps3_get_resolution_label(uint32_t resolution); unsigned gfx_ctx_get_resolution_width(unsigned resolution_id);
unsigned gfx_ctx_get_resolution_height(unsigned resolution_id);
void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate); void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate);
void gfx_ctx_set_aspect_ratio(void *data, unsigned aspectratio_index); void gfx_ctx_set_aspect_ratio(void *data, unsigned aspectratio_index);
void gfx_ctx_set_overscan(void); void gfx_ctx_set_overscan(void);