mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 06:40:18 +00:00
Refactor Wii per-game resolution mode to be somewhat generic
This commit is contained in:
parent
de44911092
commit
0f33722f5d
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
17
retroarch.c
17
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user