(3DS) Add new3ds speedup toggle (#13718)

This commit is contained in:
MrHuu 2022-03-09 08:20:15 +01:00 committed by GitHub
parent b1f52a25ea
commit 9ed51bc528
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 66 additions and 1 deletions

View File

@ -945,8 +945,10 @@ static const float message_bgcolor_opacity = 1.0f;
#define DEFAULT_ALLOW_ROTATE true
#if defined(_3DS)
/* Enable New3DS clock and L2 cache */
static const bool new3ds_speedup_enable = true;
/* Enable bottom LCD screen */
static const bool video_3ds_lcd_bottom = true;
static const bool video_3ds_lcd_bottom = true;
/* Sets video display mode (3D, 2D, etc.) */
static const unsigned video_3ds_display_mode = CTR_VIDEO_MODE_3D;
#endif

View File

@ -1977,6 +1977,7 @@ static struct config_bool_setting *populate_settings_bool(
SETTING_BOOL("sustained_performance_mode", &settings->bools.sustained_performance_mode, true, sustained_performance_mode, false);
#ifdef _3DS
SETTING_BOOL("new3ds_speedup_enable", &settings->bools.new3ds_speedup_enable, true, new3ds_speedup_enable, false);
SETTING_BOOL("video_3ds_lcd_bottom", &settings->bools.video_3ds_lcd_bottom, true, video_3ds_lcd_bottom, false);
#endif

View File

@ -921,6 +921,9 @@ typedef struct settings
bool ai_service_pause;
bool gamemode_enable;
#ifdef _3DS
bool new3ds_speedup_enable;
#endif
} bools;
} settings_t;

View File

@ -1033,6 +1033,7 @@ static void* ctr_init(const video_info_t* video,
void* ctrinput = NULL;
settings_t *settings = config_get_ptr();
bool lcd_bottom = settings->bools.video_3ds_lcd_bottom;
bool speedup_enable = settings->bools.new3ds_speedup_enable;
ctr_video_t* ctr = (ctr_video_t*)linearAlloc(sizeof(ctr_video_t));
if (!ctr)
@ -1220,6 +1221,8 @@ static void* ctr_init(const video_info_t* video,
gspSetEventCallback(GSPGPU_EVENT_VBlank0,
(ThreadFunc)ctr_vsync_hook, ctr, false);
osSetSpeedupEnable(speedup_enable);
return ctr;
}

View File

@ -4755,6 +4755,10 @@ MSG_HASH(
"no_favorites"
)
#if defined(_3DS)
MSG_HASH(
MENU_ENUM_LABEL_NEW3DS_SPEEDUP_ENABLE,
"new3ds_speedup_enable"
)
MSG_HASH(
MENU_ENUM_LABEL_VIDEO_3DS_LCD_BOTTOM,
"video_3ds_lcd_bottom"

View File

@ -13091,6 +13091,14 @@ MSG_HASH(
)
#endif
#if defined(_3DS)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_NEW3DS_SPEEDUP_ENABLE,
"Enable New3DS Clock / L2 Cache"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_NEW3DS_SPEEDUP_ENABLE,
"Enable New3DS clock speed (804MHz) and L2 cache."
)
MSG_HASH(
MENU_ENUM_LABEL_VALUE_VIDEO_3DS_LCD_BOTTOM,
"3DS Bottom Screen"

View File

@ -1072,6 +1072,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_gamemode_enable, MENU
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_brightness_control, MENU_ENUM_SUBLABEL_BRIGHTNESS_CONTROL)
#if defined(_3DS)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_new3ds_speedup_enable, MENU_ENUM_SUBLABEL_NEW3DS_SPEEDUP_ENABLE)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_3ds_lcd_bottom, MENU_ENUM_SUBLABEL_VIDEO_3DS_LCD_BOTTOM)
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_video_3ds_display_mode, MENU_ENUM_SUBLABEL_VIDEO_3DS_DISPLAY_MODE)
#endif
@ -4480,6 +4481,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_brightness_control);
break;
#if defined(_3DS)
case MENU_ENUM_LABEL_NEW3DS_SPEEDUP_ENABLE:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_new3ds_speedup_enable);
break;
case MENU_ENUM_LABEL_VIDEO_3DS_LCD_BOTTOM:
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_video_3ds_lcd_bottom);
break;

View File

@ -9097,6 +9097,17 @@ unsigned menu_displaylist_build_list(
false) == 0)
count++;
}
#ifdef _3DS
u8 device_model = 0xFF;
CFGU_GetSystemModel(&device_model);
if ((device_model == 2) || (device_model == 4) || (device_model == 5))
{
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
MENU_ENUM_LABEL_NEW3DS_SPEEDUP_ENABLE,
PARSE_ONLY_BOOL, false) == 0)
count++;
}
#endif
}
break;
case DISPLAYLIST_ONSCREEN_DISPLAY_SETTINGS_LIST:

View File

@ -8551,6 +8551,18 @@ static void timezone_change_handler(rarch_setting_t *setting)
}
#endif
#ifdef _3DS
static void new3ds_speedup_change_handler(rarch_setting_t *setting)
{
settings_t *settings = config_get_ptr();
if (!setting)
return;
osSetSpeedupEnable(*setting->value.target.boolean);
}
#endif
static bool setting_append_list_input_player_options(
rarch_setting_t **list,
rarch_setting_info_t *list_info,
@ -17773,6 +17785,22 @@ static bool setting_append_list(
1, true, true);
}
CONFIG_BOOL(
list, list_info,
&settings->bools.new3ds_speedup_enable,
MENU_ENUM_LABEL_NEW3DS_SPEEDUP_ENABLE,
MENU_ENUM_LABEL_VALUE_NEW3DS_SPEEDUP_ENABLE,
new3ds_speedup_enable,
MENU_ENUM_LABEL_VALUE_OFF,
MENU_ENUM_LABEL_VALUE_ON,
&group_info,
&subgroup_info,
parent_group,
general_write_handler,
general_read_handler,
SD_FLAG_CMD_APPLY_AUTO);
(*list)[list_info->index - 1].change_handler = new3ds_speedup_change_handler;
CONFIG_BOOL(
list, list_info,
&settings->bools.video_3ds_lcd_bottom,

View File

@ -1329,6 +1329,7 @@ enum msg_hash_enums
MENU_LABEL(DESKTOP_MENU_ENABLE),
MENU_LABEL(UI_MENUBAR_ENABLE),
MENU_LABEL(NEW3DS_SPEEDUP_ENABLE),
MENU_LABEL(VIDEO_3DS_LCD_BOTTOM),
MENU_LABEL(VIDEO_3DS_DISPLAY_MODE),