Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(3DS) Add bottom menu options #14323

Merged
merged 1 commit into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion config.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -976,13 +976,17 @@ static const float message_bgcolor_opacity = 1.0f;
* Used for setups where one manually rotates the monitor. */
#define DEFAULT_ALLOW_ROTATE true

#if defined(_3DS)
#ifdef _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;
/* Sets video display mode (3D, 2D, etc.) */
static const unsigned video_3ds_display_mode = CTR_VIDEO_MODE_3D;

#define DEFAULT_BOTTOM_FONT_ENABLE true
#define DEFAULT_BOTTOM_FONT_COLOR 255
#define DEFAULT_BOTTOM_FONT_SCALE 1.48
#endif

#ifdef WIIU
Expand Down
23 changes: 16 additions & 7 deletions configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -1579,7 +1579,10 @@ static struct config_path_setting *populate_settings_path(
SETTING_PATH("bundle_assets_src_path", settings->paths.bundle_assets_src, false, NULL, true);
SETTING_PATH("bundle_assets_dst_path", settings->paths.bundle_assets_dst, false, NULL, true);
SETTING_PATH("bundle_assets_dst_path_subdir", settings->paths.bundle_assets_dst_subdir, false, NULL, true);

#ifdef _3DS
SETTING_PATH("bottom_assets_directory",
settings->paths.directory_bottom_assets, true, NULL, true);
#endif
SETTING_ARRAY("log_dir", settings->paths.log_dir, true, NULL, true);

*size = count;
Expand Down Expand Up @@ -1996,7 +1999,8 @@ static struct config_bool_setting *populate_settings_bool(

#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);
SETTING_BOOL("video_3ds_lcd_bottom", &settings->bools.video_3ds_lcd_bottom, true, video_3ds_lcd_bottom, false);
SETTING_BOOL("bottom_font_enable", &settings->bools.bottom_font_enable, true, bottom_font_enable, false);
#endif

#ifdef WIIU
Expand Down Expand Up @@ -2106,7 +2110,9 @@ static struct config_float_setting *populate_settings_float(
SETTING_FLOAT("video_hdr_max_nits", &settings->floats.video_hdr_max_nits, true, DEFAULT_VIDEO_HDR_MAX_NITS, false);
SETTING_FLOAT("video_hdr_paper_white_nits", &settings->floats.video_hdr_paper_white_nits, true, DEFAULT_VIDEO_HDR_PAPER_WHITE_NITS, false);
SETTING_FLOAT("video_hdr_display_contrast", &settings->floats.video_hdr_display_contrast, true, DEFAULT_VIDEO_HDR_CONTRAST, false);

#ifdef _3DS
SETTING_FLOAT("bottom_font_scale", &settings->floats.bottom_font_scale, true, DEFAULT_BOTTOM_FONT_SCALE, false);
#endif
*size = count;

return tmp;
Expand Down Expand Up @@ -2318,11 +2324,9 @@ static struct config_uint_setting *populate_settings_uint(
#ifdef HAVE_LIBNX
SETTING_UINT("libnx_overclock", &settings->uints.libnx_overclock, true, SWITCH_DEFAULT_CPU_PROFILE, false);
#endif

#ifdef _3DS
SETTING_UINT("video_3ds_display_mode", &settings->uints.video_3ds_display_mode, true, video_3ds_display_mode, false);
SETTING_UINT("video_3ds_display_mode", &settings->uints.video_3ds_display_mode, true, video_3ds_display_mode, false);
#endif

#if defined(DINGUX)
SETTING_UINT("video_dingux_ipu_filter_type", &settings->uints.video_dingux_ipu_filter_type, true, DEFAULT_DINGUX_IPU_FILTER_TYPE, false);
#if defined(DINGUX_BETA)
Expand Down Expand Up @@ -2414,7 +2418,12 @@ static struct config_int_setting *populate_settings_int(
SETTING_INT("video_window_offset_y", &settings->ints.video_window_offset_y, true, DEFAULT_WINDOW_OFFSET_Y, false);
#endif
SETTING_INT("content_favorites_size", &settings->ints.content_favorites_size, true, default_content_favorites_size, false);

#ifdef _3DS
SETTING_INT("bottom_font_color_red", &settings->ints.bottom_font_color_red, true, bottom_font_color_red, false);
SETTING_INT("bottom_font_color_green", &settings->ints.bottom_font_color_green, true, bottom_font_color_green, false);
SETTING_INT("bottom_font_color_blue", &settings->ints.bottom_font_color_blue, true, bottom_font_color_blue, false);
SETTING_INT("bottom_font_color_opacity", &settings->ints.bottom_font_color_opacity, true, bottom_font_color_opacity, false);
#endif
*size = count;

return tmp;
Expand Down
16 changes: 15 additions & 1 deletion configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ typedef struct settings
int video_window_offset_y;
#endif
int content_favorites_size;
#ifdef _3DS
int bottom_font_color_red;
int bottom_font_color_green;
int bottom_font_color_blue;
int bottom_font_color_opacity;
#endif
} ints;

struct
Expand Down Expand Up @@ -382,6 +388,9 @@ typedef struct settings
float input_analog_deadzone;
float input_axis_threshold;
float input_analog_sensitivity;
#ifdef _3DS
float bottom_font_scale;
#endif
} floats;

struct
Expand Down Expand Up @@ -507,7 +516,9 @@ typedef struct settings
char directory_menu_config[PATH_MAX_LENGTH];
char directory_menu_content[PATH_MAX_LENGTH];
char streaming_title[PATH_MAX_LENGTH];

#ifdef _3DS
char directory_bottom_assets[PATH_MAX_LENGTH];
#endif
char log_dir[PATH_MAX_LENGTH];
} paths;

Expand Down Expand Up @@ -552,7 +563,9 @@ typedef struct settings
bool video_framecount_show;
bool video_memory_show;
bool video_msg_bgcolor_enable;
#ifdef _3DS
bool video_3ds_lcd_bottom;
#endif
bool video_wiiu_prefer_drc;
bool video_notch_write_over_enable;
#ifdef HAVE_VIDEO_LAYOUT
Expand Down Expand Up @@ -925,6 +938,7 @@ typedef struct settings
bool gamemode_enable;
#ifdef _3DS
bool new3ds_speedup_enable;
bool bottom_font_enable;
#endif

#ifdef ANDROID
Expand Down
3 changes: 3 additions & 0 deletions defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ enum default_dirs
DEFAULT_DIR_AUDIO_FILTER,
DEFAULT_DIR_VIDEO_FILTER,
DEFAULT_DIR_ASSETS,
#ifdef _3DS
DEFAULT_DIR_BOTTOM_ASSETS,
#endif
DEFAULT_DIR_CORE,
DEFAULT_DIR_CORE_INFO,
DEFAULT_DIR_OVERLAY,
Expand Down
3 changes: 3 additions & 0 deletions frontend/drivers/platform_ctr.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ static void frontend_ctr_get_env(int* argc, char* argv[],
fill_pathname_join(g_defaults.path_config, g_defaults.dirs[DEFAULT_DIR_PORT],
FILE_PATH_MAIN_CONFIG, sizeof(g_defaults.path_config));

fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_BOTTOM_ASSETS], g_defaults.dirs[DEFAULT_DIR_ASSETS],
"ctr", sizeof(g_defaults.dirs[DEFAULT_DIR_BOTTOM_ASSETS]));

#ifndef IS_SALAMANDER
dir_check_defaults("custom.ini");
#endif
Expand Down
18 changes: 12 additions & 6 deletions gfx/common/ctr_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ extern PrintConsole* ctrConsole;
extern const u8 ctr_sprite_shbin[];
extern const u32 ctr_sprite_shbin_size;

static const bool bottom_font_enable;
static const int bottom_font_color_red;
static const int bottom_font_color_green;
static const int bottom_font_color_blue;
static const int bottom_font_color_opacity;

typedef struct
{
float v;
Expand All @@ -56,17 +62,17 @@ typedef struct

typedef enum
{
CTR_VIDEO_MODE_3D = 0,
CTR_VIDEO_MODE_2D,
CTR_VIDEO_MODE_2D_400X240,
CTR_VIDEO_MODE_2D_800X240,
CTR_VIDEO_MODE_LAST
CTR_VIDEO_MODE_3D = 0,
CTR_VIDEO_MODE_2D,
CTR_VIDEO_MODE_2D_400X240,
CTR_VIDEO_MODE_2D_800X240,
CTR_VIDEO_MODE_LAST
} ctr_video_mode_enum;

typedef enum
{
CTR_BOTTOM_MENU_NOT_AVAILABLE = 0,
CTR_BOTTOM_MENU_DEFAULT,
CTR_BOTTOM_MENU_DEFAULT,
CTR_BOTTOM_MENU_SELECT,
} ctr_bottom_menu;

Expand Down
84 changes: 52 additions & 32 deletions gfx/drivers/ctr_gfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static const char *ctr_texture_path(unsigned id)
switch (id)
{
case CTR_TEXTURE_BOTTOM_MENU:
return "ctr/bottom_menu.png";
return "bottom_menu.png";
case CTR_TEXTURE_STATE_THUMBNAIL:
{
static char texture_path[PATH_MAX_LENGTH];
Expand Down Expand Up @@ -395,7 +395,7 @@ static bool ctr_load_bottom_texture(void *data)
if (i == CTR_TEXTURE_STATE_THUMBNAIL)
dir_assets = dir_get_ptr(RARCH_DIR_SAVESTATE);
else
dir_assets = settings->paths.directory_assets;
dir_assets = settings->paths.directory_bottom_assets;

if (gfx_display_reset_textures_list(
ctr_texture_path(i), dir_assets,
Expand Down Expand Up @@ -669,18 +669,30 @@ static void font_driver_render_msg_bottom(ctr_video_t *ctr,

static void ctr_render_bottom_screen(void *data)
{
struct font_params params = { 0, };
ctr_video_t *ctr = (ctr_video_t*)data;
struct font_params params = { 0, };
ctr_video_t *ctr = (ctr_video_t*)data;

settings_t *settings = config_get_ptr();
bool font_enable = settings->bools.bottom_font_enable;
int font_color_red = settings->ints.bottom_font_color_red;
int font_color_green = settings->ints.bottom_font_color_green;
int font_color_blue = settings->ints.bottom_font_color_blue;
int font_color_opacity = settings->ints.bottom_font_color_opacity;
float font_scale = settings->floats.bottom_font_scale;

if (!ctr || !ctr->refresh_bottom_menu)
return;

params.text_align = TEXT_ALIGN_CENTER;
params.color = COLOR_ABGR(255, 255, 255, 255);
params.color = COLOR_ABGR(font_color_opacity,
font_color_blue,
font_color_green,
font_color_red);

switch (ctr->bottom_menu)
{
case CTR_BOTTOM_MENU_NOT_AVAILABLE:
params.color = COLOR_ABGR(255, 255, 255, 255);
params.scale = 1.6f;
params.x = 0.0f;
params.y = 0.5f;
Expand All @@ -690,6 +702,7 @@ static void ctr_render_bottom_screen(void *data)
&params);
break;
case CTR_BOTTOM_MENU_DEFAULT:
params.color = COLOR_ABGR(255, 255, 255, 255);
params.scale = 1.6f;
params.x = 0.0f;
params.y = 0.5f;
Expand All @@ -703,9 +716,7 @@ static void ctr_render_bottom_screen(void *data)
struct ctr_bottom_texture_data *o = NULL;
ctr_texture_t *texture = NULL;

params.scale = 1.48f;
params.color = COLOR_ABGR(
255, 255, 255, 255);
params.scale = font_scale;

/* draw state thumbnail */
if (ctr->state_data_exist)
Expand Down Expand Up @@ -793,35 +804,44 @@ static void ctr_render_bottom_screen(void *data)
CTR_BOTTOM_FRAMEBUFFER_WIDTH);
GPU_DrawArray(GPU_GEOMETRY_PRIM, 0, 1);

/* draw resume game */
params.x = -0.178f;
params.y = 0.78f;

font_driver_render_msg_bottom(ctr,
msg_hash_to_str(MSG_3DS_BOTTOM_MENU_RESUME),
&params);
if (font_enable)
{
/* draw resume game */
params.x = -0.178f;
params.y = 0.78f;

/* draw create restore point */
params.x = -0.178f;
params.y = 0.33f;
font_driver_render_msg_bottom(ctr,
msg_hash_to_str(MSG_3DS_BOTTOM_MENU_RESUME),
&params);

font_driver_render_msg_bottom(ctr,
msg_hash_to_str(MSG_3DS_BOTTOM_MENU_SAVE_STATE),
&params);
/* draw create restore point */
params.x = -0.178f;
params.y = 0.33f;

/* draw load restore point */
params.x = 0.266f;
params.y = 0.24f;
font_driver_render_msg_bottom(ctr,
msg_hash_to_str(MSG_3DS_BOTTOM_MENU_SAVE_STATE),
&params);

font_driver_render_msg_bottom(ctr,
msg_hash_to_str(MSG_3DS_BOTTOM_MENU_LOAD_STATE),
&params);
if (ctr->state_data_exist)
{
/* draw load restore point */
params.x = 0.266f;
params.y = 0.24f;

/* draw date */
params.x = 0.266f;
params.y = 0.87f;
font_driver_render_msg_bottom(ctr, ctr->state_date,
&params);
font_driver_render_msg_bottom(ctr,
msg_hash_to_str(MSG_3DS_BOTTOM_MENU_LOAD_STATE),
&params);
}
}
if (ctr->state_data_exist)
{
/* draw date */
params.x = 0.266f;
params.y = 0.87f;
font_driver_render_msg_bottom(ctr,
ctr->state_date,
&params);
}
}
break;
}
Expand Down
42 changes: 41 additions & 1 deletion intl/msg_hash_lbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,12 @@ MSG_HASH(
MENU_ENUM_LABEL_DEFERRED_MENU_SETTINGS_LIST,
"deferred_menu_settings_list"
)
#ifdef _3DS
MSG_HASH(
MENU_ENUM_LABEL_DEFERRED_MENU_BOTTOM_SETTINGS_LIST,
"deferred_menu_bottom_settings"
)
#endif
MSG_HASH(
MENU_ENUM_LABEL_DEFERRED_MENU_VIEWS_SETTINGS_LIST,
"deferred_menu_views_settings_list"
Expand Down Expand Up @@ -1978,6 +1984,12 @@ MSG_HASH(
MENU_ENUM_LABEL_MENU_SETTINGS,
"menu_settings"
)
#ifdef _3DS
MSG_HASH(
MENU_ENUM_LABEL_MENU_BOTTOM_SETTINGS,
"menu_bottom_settings"
)
#endif
MSG_HASH(
MENU_ENUM_LABEL_MENU_WALLPAPER,
"menu_wallpaper"
Expand Down Expand Up @@ -4960,7 +4972,7 @@ MSG_HASH(
MENU_ENUM_LABEL_NO_FAVORITES_AVAILABLE,
"no_favorites"
)
#if defined(_3DS)
#ifdef _3DS
MSG_HASH(
MENU_ENUM_LABEL_NEW3DS_SPEEDUP_ENABLE,
"new3ds_speedup_enable"
Expand All @@ -4973,6 +4985,34 @@ MSG_HASH(
MENU_ENUM_LABEL_VIDEO_3DS_DISPLAY_MODE,
"video_3ds_display_mode"
)
MSG_HASH(
MENU_ENUM_LABEL_BOTTOM_ASSETS_DIRECTORY,
"bottom_assets_directory"
)
MSG_HASH(
MENU_ENUM_LABEL_BOTTOM_FONT_ENABLE,
"bottom_font_enable"
)
MSG_HASH(
MENU_ENUM_LABEL_BOTTOM_FONT_COLOR_RED,
"bottom_font_color_red"
)
MSG_HASH(
MENU_ENUM_LABEL_BOTTOM_FONT_COLOR_GREEN,
"bottom_font_color_green"
)
MSG_HASH(
MENU_ENUM_LABEL_BOTTOM_FONT_COLOR_BLUE,
"bottom_font_color_blue"
)
MSG_HASH(
MENU_ENUM_LABEL_BOTTOM_FONT_COLOR_OPACITY,
"bottom_font_color_opacity"
)
MSG_HASH(
MENU_ENUM_LABEL_BOTTOM_FONT_SCALE,
"bottom_font_scale"
)
#endif
MSG_HASH(
MENU_ENUM_LABEL_PLAYLIST_USE_OLD_FORMAT,
Expand Down
Loading