Add Optimize for GamePad option on Wii U (#13257)

* Add 'Optimize for Wii U GamePad' option

* style nit
This commit is contained in:
vaguerant 2022-03-09 00:56:51 +11:00 committed by GitHub
parent 9bcee062ff
commit 1726d8acb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 92 additions and 12 deletions

View File

@ -951,6 +951,12 @@ static const bool video_3ds_lcd_bottom = true;
static const unsigned video_3ds_display_mode = CTR_VIDEO_MODE_3D;
#endif
#ifdef WIIU
/* On Wii U, whether to optimize for the native TV resolution
* or exactly 2x the Wii U GamePad resolution. */
#define DEFAULT_WIIU_PREFER_DRC false
#endif
/* AUDIO */
/* Will enable audio or not. */

View File

@ -1980,6 +1980,10 @@ static struct config_bool_setting *populate_settings_bool(
SETTING_BOOL("video_3ds_lcd_bottom", &settings->bools.video_3ds_lcd_bottom, true, video_3ds_lcd_bottom, false);
#endif
#ifdef WIIU
SETTING_BOOL("video_wiiu_prefer_drc", &settings->bools.video_wiiu_prefer_drc, true, DEFAULT_WIIU_PREFER_DRC, false);
#endif
SETTING_BOOL("playlist_use_old_format", &settings->bools.playlist_use_old_format, true, DEFAULT_PLAYLIST_USE_OLD_FORMAT, false);
SETTING_BOOL("playlist_compression", &settings->bools.playlist_compression, true, DEFAULT_PLAYLIST_COMPRESSION, false);
SETTING_BOOL("content_runtime_log", &settings->bools.content_runtime_log, true, DEFAULT_CONTENT_RUNTIME_LOG, false);

View File

@ -565,6 +565,7 @@ typedef struct settings
bool video_memory_show;
bool video_msg_bgcolor_enable;
bool video_3ds_lcd_bottom;
bool video_wiiu_prefer_drc;
bool video_notch_write_over_enable;
#ifdef HAVE_VIDEO_LAYOUT
bool video_layout_enable;

View File

@ -195,6 +195,7 @@ static void *wiiu_gfx_init(const video_info_t *video,
wiiu_video_t *wiiu = (wiiu_video_t*)calloc(1, sizeof(*wiiu));
settings_t *settings = config_get_ptr();
const char *input_joypad_driver = settings->arrays.input_joypad_driver;
bool prefer_drc = settings->bools.video_wiiu_prefer_drc;
if (!wiiu)
return NULL;
@ -251,8 +252,16 @@ static void *wiiu_gfx_init(const video_info_t *video,
memset(&wiiu->color_buffer, 0, sizeof(GX2ColorBuffer));
wiiu->color_buffer.surface.dim = GX2_SURFACE_DIM_TEXTURE_2D;
wiiu->color_buffer.surface.width = wiiu->render_mode.width;
wiiu->color_buffer.surface.height = wiiu->render_mode.height;
if (wiiu->render_mode.height != 480 && prefer_drc)
{
wiiu->color_buffer.surface.width = 1708;
wiiu->color_buffer.surface.height = 960;
}
else
{
wiiu->color_buffer.surface.width = wiiu->render_mode.width;
wiiu->color_buffer.surface.height = wiiu->render_mode.height;
}
wiiu->color_buffer.surface.depth = 1;
wiiu->color_buffer.surface.mipLevels = 1;
wiiu->color_buffer.surface.format = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8;
@ -436,18 +445,28 @@ static void *wiiu_gfx_init(const video_info_t *video,
GX2SetTVEnable(GX2_ENABLE);
GX2SetDRCEnable(GX2_ENABLE);
wiiu->keep_aspect = true;
wiiu->should_resize = true;
wiiu->smooth = video->smooth;
wiiu->vsync = video->vsync;
wiiu->keep_aspect = true;
wiiu->should_resize = true;
wiiu->smooth = video->smooth;
wiiu->vsync = video->vsync;
GX2SetSwapInterval(!!video->vsync);
wiiu->vp.x = 0;
wiiu->vp.y = 0;
wiiu->vp.width = wiiu->render_mode.width;
wiiu->vp.height = wiiu->render_mode.height;
wiiu->vp.full_width = wiiu->render_mode.width;
wiiu->vp.full_height = wiiu->render_mode.height;
wiiu->vp.x = 0;
wiiu->vp.y = 0;
if (wiiu->render_mode.height != 480 && prefer_drc)
{
wiiu->vp.width = 1708;
wiiu->vp.height = 960;
wiiu->vp.full_width = 1708;
wiiu->vp.full_height = 960;
}
else
{
wiiu->vp.width = wiiu->render_mode.width;
wiiu->vp.height = wiiu->render_mode.height;
wiiu->vp.full_width = wiiu->render_mode.width;
wiiu->vp.full_height = wiiu->render_mode.height;
}
video_driver_set_size(wiiu->vp.width, wiiu->vp.height);
driver_ctl(RARCH_DRIVER_CTL_SET_REFRESH_RATE, &refresh_rate);

View File

@ -3424,6 +3424,12 @@ MSG_HASH(
MENU_ENUM_LABEL_VIDEO_MONITOR_INDEX,
"video_monitor_index"
)
#if defined(WIIU)
MSG_HASH(
MENU_ENUM_LABEL_VIDEO_WIIU_PREFER_DRC,
"video_wiiu_prefer_drc"
)
#endif
MSG_HASH(
MENU_ENUM_LABEL_VIDEO_WINDOW_OFFSET_X,
"video_window_offset_x"

View File

@ -1540,6 +1540,16 @@ MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_MONITOR_INDEX,
"Select which display screen to use."
)
#if defined (WIIU)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_WIIU_PREFER_DRC,
"Optimize for Wii U GamePad (Restart Required)"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_WIIU_PREFER_DRC,
"Use an exact 2x scale of the GamePad as the viewport. Disable to display at the native TV resolution."
)
#endif
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_ROTATION,
"Video Rotation"

View File

@ -1076,6 +1076,10 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_3ds_lcd_bottom, MENU
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_3ds_display_mode, MENU_ENUM_SUBLABEL_VIDEO_3DS_DISPLAY_MODE)
#endif
#if defined (WIIU)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_wiiu_prefer_drc, MENU_ENUM_SUBLABEL_VIDEO_WIIU_PREFER_DRC)
#endif
#if defined(GEKKO)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_overscan_correction_top, MENU_ENUM_SUBLABEL_VIDEO_OVERSCAN_CORRECTION_TOP)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_overscan_correction_bottom, MENU_ENUM_SUBLABEL_VIDEO_OVERSCAN_CORRECTION_BOTTOM)
@ -4483,6 +4487,11 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_3ds_display_mode);
break;
#endif
#if defined(WIIU)
case MENU_ENUM_LABEL_VIDEO_WIIU_PREFER_DRC:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_wiiu_prefer_drc);
break;
#endif
#if defined(GEKKO)
case MENU_ENUM_LABEL_VIDEO_OVERSCAN_CORRECTION_TOP:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_overscan_correction_top);

View File

@ -8014,6 +8014,13 @@ unsigned menu_displaylist_build_list(
PARSE_ONLY_UINT, false) == 0)
count++;
#if defined(WIIU)
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_VIDEO_WIIU_PREFER_DRC,
PARSE_ONLY_BOOL, false) == 0)
count++;
#endif
#if defined(GEKKO) || defined(PS2) || !defined(__PSL1GHT__) && defined(__PS3__)
if (true)
#else

View File

@ -11268,6 +11268,23 @@ static bool setting_append_list(
}
#endif
#ifdef WIIU
CONFIG_BOOL(
list, list_info,
&settings->bools.video_wiiu_prefer_drc,
MENU_ENUM_LABEL_VIDEO_WIIU_PREFER_DRC,
MENU_ENUM_LABEL_VALUE_VIDEO_WIIU_PREFER_DRC,
DEFAULT_WIIU_PREFER_DRC,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_NONE);
#endif
if (video_driver_has_windowed())
{
CONFIG_ACTION(

View File

@ -1121,6 +1121,7 @@ enum msg_hash_enums
MENU_LABEL(VIDEO_SWAP_INTERVAL),
MENU_LABEL(VIDEO_FULLSCREEN),
MENU_LABEL(VIDEO_MONITOR_INDEX),
MENU_LABEL(VIDEO_WIIU_PREFER_DRC),
MENU_LABEL(VIDEO_WINDOW_SCALE),
MENU_LABEL(VIDEO_WINDOW_OFFSET_X),
MENU_LABEL(VIDEO_WINDOW_OFFSET_Y),