diff --git a/command_event.c b/command_event.c index fac069c7e4..1b62bf26a9 100644 --- a/command_event.c +++ b/command_event.c @@ -1059,6 +1059,22 @@ bool event_command(enum event_command cmd) switch (cmd) { + case EVENT_CMD_SET_PER_GAME_RESOLUTION: + { + unsigned width = 0, height = 0; + + event_command(EVENT_CMD_VIDEO_SET_ASPECT_RATIO); + + if (video_driver_get_video_output_size(&width, &height)) + { + video_driver_set_video_mode(width, height, true); + + char msg[PATH_MAX_LENGTH] = {0}; + snprintf(msg, sizeof(msg),"Resolution: %dx%d",width, height); + rarch_main_msg_queue_push(msg, 1, 100, true); + } + } + break; case EVENT_CMD_LOAD_CONTENT_PERSIST: #ifdef HAVE_DYNAMIC event_command(EVENT_CMD_LOAD_CORE); diff --git a/command_event.h b/command_event.h index 02558f7425..d60e1c60eb 100644 --- a/command_event.h +++ b/command_event.h @@ -34,6 +34,7 @@ enum event_command EVENT_CMD_LOAD_CONTENT_FFMPEG, #endif EVENT_CMD_LOAD_CONTENT_IMAGEVIEWER, + EVENT_CMD_SET_PER_GAME_RESOLUTION, /* Loads core. */ EVENT_CMD_LOAD_CORE_DEINIT, EVENT_CMD_LOAD_CORE, diff --git a/gfx/drivers/gx_gfx.c b/gfx/drivers/gx_gfx.c index 2b0a684080..df3fd3f749 100644 --- a/gfx/drivers/gx_gfx.c +++ b/gfx/drivers/gx_gfx.c @@ -238,6 +238,7 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines, max_width, max_height, i; gx_video_t *gx = (gx_video_t*)data; settings_t *settings = config_get_ptr(); + global_t *global = global_get_ptr(); (void)level; @@ -435,6 +436,10 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines, for(i = 0; i < GX_RESOLUTIONS_LAST; i++) if(fbWidth == menu_gx_resolutions[i][0] && lines == menu_gx_resolutions[i][1]) menu_current_gx_resolution = i; + + global->console.screen.resolutions.width = menu_gx_resolutions[menu_current_gx_resolution][0]; + global->console.screen.resolutions.height = menu_gx_resolutions[menu_current_gx_resolution][0]; + RARCH_LOG("GX Resolution Index: %d\n", menu_current_gx_resolution); } diff --git a/gfx/drivers_context/ps3_ctx.c b/gfx/drivers_context/ps3_ctx.c index d9c9620969..182eb9e08a 100644 --- a/gfx/drivers_context/ps3_ctx.c +++ b/gfx/drivers_context/ps3_ctx.c @@ -302,7 +302,14 @@ static bool gfx_ctx_ps3_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen) { - (void)data; + global_t *global = global_get_ptr(); + + if (!global) + return false; + + global->console.screen.resolutions.width = width; + global->console.screen.resolutions.height = height; + return true; } diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 7f7d88970b..18c2a13c7d 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1835,18 +1835,14 @@ static int action_ok_video_resolution(const char *path, { unsigned width = 0; unsigned height = 0; - global_t *global = global_get_ptr(); if (video_driver_get_video_output_size(&width, &height)) { char msg[PATH_MAX_LENGTH] = {0}; #ifdef __CELLOS_LV2__ event_command(EVENT_CMD_REINIT); -#else - video_driver_set_video_mode(width, height, true); - global->console.screen.resolutions.width = width; - global->console.screen.resolutions.height = height; #endif + video_driver_set_video_mode(width, height, true); snprintf(msg, sizeof(msg),"Applying: %dx%d\n START to reset", width, height); menu_display_msg_queue_push(msg, 1, 100, true); } diff --git a/menu/cbs/menu_cbs_start.c b/menu/cbs/menu_cbs_start.c index 55821acedb..00b1b7bd48 100644 --- a/menu/cbs/menu_cbs_start.c +++ b/menu/cbs/menu_cbs_start.c @@ -264,26 +264,17 @@ static int action_start_core_setting(unsigned type, return 0; } -static int action_start_video_resolution( - unsigned type, const char *label) +static int action_start_video_resolution(unsigned type, const char *label) { unsigned width = 0, height = 0; - global_t *global = global_get_ptr(); video_driver_set_video_mode(640, 480, true); - if (!global) - return -1; - if (video_driver_get_video_output_size(&width, &height)) { char msg[PATH_MAX_LENGTH] = {0}; - video_driver_set_video_mode(width, height, true); - global->console.screen.resolutions.width = width; - global->console.screen.resolutions.height = height; - - snprintf(msg, sizeof(msg),"Resetting to: %dx%d",width, height); + snprintf(msg, sizeof(msg),"Resetting to: %dx%d", width, height); menu_display_msg_queue_push(msg, 1, 100, true); } diff --git a/retroarch.c b/retroarch.c index cd57694397..8192879244 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1209,22 +1209,7 @@ int rarch_main_init(int argc, char *argv[]) event_command(EVENT_CMD_REMAPPING_INIT); event_command(EVENT_CMD_SAVEFILES_INIT); -#if defined(GEKKO) && defined(HW_RVL) - { - unsigned width = 0, height = 0; - - event_command(EVENT_CMD_VIDEO_SET_ASPECT_RATIO); - video_driver_ctl(RARCH_DISPLAY_CTL_SET_ASPECT_RATIO, NULL); - - width = global->console.screen.resolutions.width; - height = global->console.screen.resolutions.height; - video_driver_set_video_mode(width, height, true); - - char msg[PATH_MAX_LENGTH] = {0}; - snprintf(msg, sizeof(msg),"Resolution: %dx%d",width, height); - rarch_main_msg_queue_push(msg, 1, 100, true); - } -#endif + event_command(EVENT_CMD_SET_PER_GAME_RESOLUTION); global->inited.error = false; global->inited.main = true;