Skip to content

Commit

Permalink
Add Ability to Hide OSD Messages
Browse files Browse the repository at this point in the history
  • Loading branch information
DarthMew committed Oct 6, 2024
1 parent 261e52b commit 349bc50
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 20 deletions.
55 changes: 35 additions & 20 deletions libretro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ static retro_input_state_t input_state_cb;
static unsigned frame_count = 0;
static unsigned internal_frame_count = 0;
static bool display_internal_framerate = false;
static bool display_notifications = true;
static bool allow_frame_duping = false;
static bool failed_init = false;
static unsigned image_offset = 0;
Expand Down Expand Up @@ -3986,6 +3987,17 @@ static void check_variables(bool startup)
else
display_internal_framerate = false;

var.key = BEETLE_OPT(display_osd);
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
if (strcmp(var.value, "enabled") == 0)
display_notifications = true;
else if (strcmp(var.value, "disabled") == 0)
display_notifications = false;
}
else
display_notifications = true;

var.key = BEETLE_OPT(crop_overscan);
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
Expand Down Expand Up @@ -5292,27 +5304,30 @@ void MDFND_DispMessage(
enum retro_message_target target, enum retro_message_type type,
const char *str)
{
if (libretro_msg_interface_version >= 1)
{
struct retro_message_ext msg = {
str,
3000,
priority,
level,
target,
type,
-1
};
environ_cb(RETRO_ENVIRONMENT_SET_MESSAGE_EXT, &msg);
}
else
{
struct retro_message msg =
if (display_notifications)
{
if (libretro_msg_interface_version >= 1)
{
struct retro_message_ext msg = {
str,
3000,
priority,
level,
target,
type,
-1
};
environ_cb(RETRO_ENVIRONMENT_SET_MESSAGE_EXT, &msg);
}
else
{
str,
180
};
environ_cb(RETRO_ENVIRONMENT_SET_MESSAGE, &msg);
struct retro_message msg =
{
str,
180
};
environ_cb(RETRO_ENVIRONMENT_SET_MESSAGE, &msg);
}
}
}

Expand Down
14 changes: 14 additions & 0 deletions libretro_core_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,20 @@ struct retro_core_option_v2_definition option_defs_us[] = {
},
"disabled"
},
{
BEETLE_OPT(display_osd),
"Display OSD Messages",
NULL,
"Display OSD messages generated by the core.",
NULL,
"osd",
{
{ "enabled", NULL },
{ "disabled", NULL },
{ NULL, NULL },
},
"enabled"
},
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) || defined(HAVE_VULKAN)
{
BEETLE_OPT(display_vram),
Expand Down

0 comments on commit 349bc50

Please sign in to comment.