mirror of
https://github.com/libretro/RetroArch
synced 2025-03-26 11:37:30 +00:00
(RMenu) Improve Low RAM mode for RMenu
This commit is contained in:
parent
0357f1510c
commit
3fe68149a6
@ -168,10 +168,18 @@ static void populate_setting_item(void *data, unsigned input)
|
||||
snprintf(current_item->comment, sizeof(current_item->comment), "INFO - Select a skin for the menu.");
|
||||
break;
|
||||
case SETTING_EMU_LOW_RAM_MODE_ENABLE:
|
||||
fill_pathname_base(fname, g_extern.console.menu_texture_path, sizeof(fname));
|
||||
snprintf(current_item->text, sizeof(current_item->text), "Low RAM Mode");
|
||||
snprintf(current_item->setting_text, sizeof(current_item->setting_text), (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE)) ? "ON" : "OFF");
|
||||
if (g_extern.lifecycle_mode_state & (1ULL <<MODE_MENU_LOW_RAM_MODE_ENABLE) ||
|
||||
g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE_PENDING))
|
||||
{
|
||||
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "ON");
|
||||
snprintf(current_item->comment, sizeof(current_item->comment), "INFO - Will load skin at startup.");
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "OFF");
|
||||
snprintf(current_item->comment, sizeof(current_item->comment), "INFO - Will not load skin at startup to save up on RAM.");
|
||||
}
|
||||
break;
|
||||
case SETTING_FONT_SIZE:
|
||||
snprintf(current_item->text, sizeof(current_item->text), "Font Size");
|
||||
@ -1098,26 +1106,6 @@ static int set_setting_action(void *data, unsigned switchvalue, uint64_t input)
|
||||
RARCH_ERR("Shaders are unsupported on this platform.\n");
|
||||
}
|
||||
break;
|
||||
case SETTING_EMU_LOW_RAM_MODE_ENABLE:
|
||||
if((input & (1ULL << RMENU_DEVICE_NAV_LEFT)) || (input & (1ULL << RMENU_DEVICE_NAV_RIGHT)) || (input & (1ULL << RMENU_DEVICE_NAV_B)))
|
||||
{
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE))
|
||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE);
|
||||
else
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE);
|
||||
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_INFO_DRAW))
|
||||
rmenu_settings_msg(S_MSG_RESTART_RARCH, S_DELAY_180);
|
||||
|
||||
}
|
||||
if(input & (1ULL << RMENU_DEVICE_NAV_START))
|
||||
{
|
||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE);
|
||||
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_INFO_DRAW))
|
||||
rmenu_settings_msg(S_MSG_RESTART_RARCH, S_DELAY_180);
|
||||
}
|
||||
break;
|
||||
case SETTING_EMU_SKIN:
|
||||
if((input & (1ULL << RMENU_DEVICE_NAV_LEFT)) || (input & (1ULL << RMENU_DEVICE_NAV_RIGHT)) || (input & (1ULL << RMENU_DEVICE_NAV_B)))
|
||||
{
|
||||
@ -1134,6 +1122,35 @@ static int set_setting_action(void *data, unsigned switchvalue, uint64_t input)
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case SETTING_EMU_LOW_RAM_MODE_ENABLE:
|
||||
if((input & (1ULL << RMENU_DEVICE_NAV_LEFT)) || (input & (1ULL << RMENU_DEVICE_NAV_RIGHT)) || (input & (1ULL << RMENU_DEVICE_NAV_B)))
|
||||
{
|
||||
if (!(g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE_PENDING)))
|
||||
{
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE))
|
||||
g_extern.lifecycle_mode_state &= ~(1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE);
|
||||
else
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE_PENDING);
|
||||
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_INFO_DRAW))
|
||||
rmenu_settings_msg(S_MSG_RESTART_RARCH, S_DELAY_180);
|
||||
}
|
||||
}
|
||||
if(input & (1ULL << RMENU_DEVICE_NAV_START))
|
||||
{
|
||||
if (!(g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE)))
|
||||
{
|
||||
if (!(g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE_PENDING)))
|
||||
{
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE);
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE_PENDING);
|
||||
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_INFO_DRAW))
|
||||
rmenu_settings_msg(S_MSG_RESTART_RARCH, S_DELAY_180);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SETTING_FONT_SIZE:
|
||||
if(input & (1ULL << RMENU_DEVICE_NAV_LEFT))
|
||||
{
|
||||
@ -2623,10 +2640,23 @@ bool rmenu_iterate(void)
|
||||
rmenu_default_positions_t default_pos;
|
||||
device_ptr->ctx_driver->rmenu_set_default_pos(&default_pos);
|
||||
|
||||
if ((g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE)))
|
||||
{
|
||||
#if defined(HAVE_OPENGL)
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
#elif defined(HAVE_D3D8) || defined(HAVE_D3D9)
|
||||
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
|
||||
LPDIRECT3DDEVICE d3dr = (LPDIRECT3DDEVICE)d3d->d3d_render_device;
|
||||
d3dr->Clear(0, NULL, D3DCLEAR_TARGET, 0xff000000, 1.0f, 0);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_DRAW))
|
||||
device_ptr->ctx_driver->set_blend(true);
|
||||
|
||||
rarch_render_cached_frame();
|
||||
}
|
||||
|
||||
if(current_menu.input_poll)
|
||||
rmenu_input_poll(¤t_menu, &rmenu_state);
|
||||
|
@ -140,8 +140,8 @@ enum
|
||||
SETTING_EMU_CURRENT_SAVE_STATE_SLOT,
|
||||
SETTING_EMU_SHOW_DEBUG_INFO_MSG,
|
||||
SETTING_EMU_SHOW_INFO_MSG,
|
||||
SETTING_EMU_SKIN,
|
||||
SETTING_EMU_LOW_RAM_MODE_ENABLE,
|
||||
SETTING_EMU_SKIN,
|
||||
SETTING_RARCH_DEFAULT_EMU,
|
||||
SETTING_QUIT_RARCH,
|
||||
SETTING_EMU_DEFAULT_ALL,
|
||||
|
@ -126,6 +126,7 @@ enum menu_enums
|
||||
MODE_MENU_INGAME_EXIT,
|
||||
MODE_MENU_DRAW,
|
||||
MODE_MENU_LOW_RAM_MODE_ENABLE,
|
||||
MODE_MENU_LOW_RAM_MODE_ENABLE_PENDING,
|
||||
MODE_INFO_DRAW,
|
||||
MODE_FPS_DRAW,
|
||||
MODE_EXTLAUNCH_SALAMANDER,
|
||||
|
Binary file not shown.
@ -705,7 +705,10 @@ bool config_load_file(const char *path)
|
||||
|
||||
int low_ram_mode = 0;
|
||||
if (config_get_int(conf, "rmenu_low_ram_mode_enable", &low_ram_mode))
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE);
|
||||
{
|
||||
if (low_ram_mode == 1)
|
||||
g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE);
|
||||
}
|
||||
|
||||
if (config_get_string(conf, "environment_variables",
|
||||
&g_extern.system.environment))
|
||||
@ -1201,6 +1204,8 @@ bool config_save_file(const char *path)
|
||||
#ifdef HAVE_RMENU
|
||||
if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE))
|
||||
config_set_int(conf, "rmenu_low_ram_mode_enable", 1);
|
||||
else if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE_PENDING))
|
||||
config_set_int(conf, "rmenu_low_ram_mode_enable", 1);
|
||||
else
|
||||
config_set_int(conf, "rmenu_low_ram_mode_enable", 0);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user