(RMenu) Add low RAM mode

This commit is contained in:
twinaphex 2013-02-17 20:23:27 +01:00
parent 487da5a313
commit 0357f1510c
6 changed files with 45 additions and 1 deletions

View File

@ -167,6 +167,12 @@ static void populate_setting_item(void *data, unsigned input)
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "%s", fname); snprintf(current_item->setting_text, sizeof(current_item->setting_text), "%s", fname);
snprintf(current_item->comment, sizeof(current_item->comment), "INFO - Select a skin for the menu."); snprintf(current_item->comment, sizeof(current_item->comment), "INFO - Select a skin for the menu.");
break; 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");
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: case SETTING_FONT_SIZE:
snprintf(current_item->text, sizeof(current_item->text), "Font Size"); snprintf(current_item->text, sizeof(current_item->text), "Font Size");
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "%f", g_settings.video.font_size); snprintf(current_item->setting_text, sizeof(current_item->setting_text), "%f", g_settings.video.font_size);
@ -1092,6 +1098,26 @@ static int set_setting_action(void *data, unsigned switchvalue, uint64_t input)
RARCH_ERR("Shaders are unsupported on this platform.\n"); RARCH_ERR("Shaders are unsupported on this platform.\n");
} }
break; 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: case SETTING_EMU_SKIN:
if((input & (1ULL << RMENU_DEVICE_NAV_LEFT)) || (input & (1ULL << RMENU_DEVICE_NAV_RIGHT)) || (input & (1ULL << RMENU_DEVICE_NAV_B))) if((input & (1ULL << RMENU_DEVICE_NAV_LEFT)) || (input & (1ULL << RMENU_DEVICE_NAV_RIGHT)) || (input & (1ULL << RMENU_DEVICE_NAV_B)))
{ {

View File

@ -141,6 +141,7 @@ enum
SETTING_EMU_SHOW_DEBUG_INFO_MSG, SETTING_EMU_SHOW_DEBUG_INFO_MSG,
SETTING_EMU_SHOW_INFO_MSG, SETTING_EMU_SHOW_INFO_MSG,
SETTING_EMU_SKIN, SETTING_EMU_SKIN,
SETTING_EMU_LOW_RAM_MODE_ENABLE,
SETTING_RARCH_DEFAULT_EMU, SETTING_RARCH_DEFAULT_EMU,
SETTING_QUIT_RARCH, SETTING_QUIT_RARCH,
SETTING_EMU_DEFAULT_ALL, SETTING_EMU_DEFAULT_ALL,

View File

@ -125,6 +125,7 @@ enum menu_enums
MODE_MENU_INGAME, MODE_MENU_INGAME,
MODE_MENU_INGAME_EXIT, MODE_MENU_INGAME_EXIT,
MODE_MENU_DRAW, MODE_MENU_DRAW,
MODE_MENU_LOW_RAM_MODE_ENABLE,
MODE_INFO_DRAW, MODE_INFO_DRAW,
MODE_FPS_DRAW, MODE_FPS_DRAW,
MODE_EXTLAUNCH_SALAMANDER, MODE_EXTLAUNCH_SALAMANDER,

View File

@ -329,6 +329,9 @@ void texture_image_border_load(const char *path)
static bool gfx_ctx_rmenu_init(void) static bool gfx_ctx_rmenu_init(void)
{ {
if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE))
return true;
texture_image_border_load(g_extern.console.menu_texture_path); texture_image_border_load(g_extern.console.menu_texture_path);
return true; return true;

View File

@ -154,7 +154,9 @@ static bool gfx_ctx_xdk_menu_init(void)
m_menuMainRomListPos_y = 130; m_menuMainRomListPos_y = 130;
} }
texture_image_load(g_extern.console.menu_texture_path, &g_extern.console.menu_texture); if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU_LOW_RAM_MODE_ENABLE)) { }
else
texture_image_load(g_extern.console.menu_texture_path, &g_extern.console.menu_texture);
// Load rom selector panel // Load rom selector panel
texture_image_load("D:\\Media\\menuMainRomSelectPanel.png", &g_extern.console.menu_panel); texture_image_load("D:\\Media\\menuMainRomSelectPanel.png", &g_extern.console.menu_panel);

View File

@ -703,6 +703,10 @@ bool config_load_file(const char *path)
CONFIG_GET_BOOL(input.autodetect_enable, "input_autodetect_enable"); CONFIG_GET_BOOL(input.autodetect_enable, "input_autodetect_enable");
#endif #endif
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 (config_get_string(conf, "environment_variables", if (config_get_string(conf, "environment_variables",
&g_extern.system.environment)) &g_extern.system.environment))
{ {
@ -1194,6 +1198,13 @@ bool config_save_file(const char *path)
config_set_int(conf, "input_autodetect_icade_profile_pad4", input.icade_profile[3]); config_set_int(conf, "input_autodetect_icade_profile_pad4", input.icade_profile[3]);
#endif #endif
#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
config_set_int(conf, "rmenu_low_ram_mode_enable", 0);
#endif
if (g_extern.lifecycle_mode_state & (1ULL << MODE_VIDEO_OVERSCAN_ENABLE)) if (g_extern.lifecycle_mode_state & (1ULL << MODE_VIDEO_OVERSCAN_ENABLE))
config_set_bool(conf, "overscan_enable", true); config_set_bool(conf, "overscan_enable", true);
else else