(RARCH_CONSOLE) Refactor more state variables

This commit is contained in:
twinaphex 2013-01-11 19:44:13 +01:00
parent d84dec4c96
commit cc43b84ff2
10 changed files with 188 additions and 85 deletions

View File

@ -62,15 +62,15 @@ void rarch_settings_change(unsigned setting)
break; break;
case S_OVERSCAN_DECREMENT: case S_OVERSCAN_DECREMENT:
g_extern.console.screen.overscan_amount -= 0.01f; g_extern.console.screen.overscan_amount -= 0.01f;
g_extern.console.screen.state.overscan.enable = true; g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_OVERSCAN_ENABLE);
if(g_extern.console.screen.overscan_amount == 0.0f) if(g_extern.console.screen.overscan_amount == 0.0f)
g_extern.console.screen.state.overscan.enable = false; g_extern.lifecycle_menu_state &= ~(1 << MODE_VIDEO_OVERSCAN_ENABLE);
break; break;
case S_OVERSCAN_INCREMENT: case S_OVERSCAN_INCREMENT:
g_extern.console.screen.overscan_amount += 0.01f; g_extern.console.screen.overscan_amount += 0.01f;
g_extern.console.screen.state.overscan.enable = true; g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_OVERSCAN_ENABLE);
if(g_extern.console.screen.overscan_amount == 0.0f) if(g_extern.console.screen.overscan_amount == 0.0f)
g_extern.console.screen.state.overscan.enable = 0; g_extern.lifecycle_menu_state &= ~(1 << MODE_VIDEO_OVERSCAN_ENABLE);
break; break;
case S_RESOLUTION_PREVIOUS: case S_RESOLUTION_PREVIOUS:
if (g_extern.console.screen.resolutions.current.idx) if (g_extern.console.screen.resolutions.current.idx)
@ -117,12 +117,18 @@ void rarch_settings_change(unsigned setting)
break; break;
case S_THROTTLE: case S_THROTTLE:
if(!g_extern.system.force_nonblock) if(!g_extern.system.force_nonblock)
g_extern.console.screen.state.throttle.enable = {
!g_extern.console.screen.state.throttle.enable; if (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_THROTTLE_ENABLE))
g_extern.lifecycle_menu_state &= ~(1 << MODE_VIDEO_THROTTLE_ENABLE);
else
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_THROTTLE_ENABLE);
}
break; break;
case S_TRIPLE_BUFFERING: case S_TRIPLE_BUFFERING:
g_extern.console.screen.state.triple_buffering.enable = if (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE))
!g_extern.console.screen.state.triple_buffering.enable; g_extern.lifecycle_menu_state &= ~(1 << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
else
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
break; break;
} }
} }
@ -154,17 +160,17 @@ void rarch_settings_default(unsigned setting)
break; break;
case S_DEF_OVERSCAN: case S_DEF_OVERSCAN:
g_extern.console.screen.overscan_amount = 0.0f; g_extern.console.screen.overscan_amount = 0.0f;
g_extern.console.screen.state.overscan.enable = false; g_extern.lifecycle_menu_state &= ~(1 << MODE_VIDEO_OVERSCAN_ENABLE);
break; break;
case S_DEF_ROTATION: case S_DEF_ROTATION:
g_extern.console.screen.orientation = ORIENTATION_NORMAL; g_extern.console.screen.orientation = ORIENTATION_NORMAL;
break; break;
case S_DEF_THROTTLE: case S_DEF_THROTTLE:
if(!g_extern.system.force_nonblock) if(!g_extern.system.force_nonblock)
g_extern.console.screen.state.throttle.enable = true; g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_THROTTLE_ENABLE);
break; break;
case S_DEF_TRIPLE_BUFFERING: case S_DEF_TRIPLE_BUFFERING:
g_extern.console.screen.state.triple_buffering.enable = true; g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
break; break;
case S_DEF_SAVE_STATE: case S_DEF_SAVE_STATE:
g_extern.state_slot = 0; g_extern.state_slot = 0;

View File

@ -428,7 +428,7 @@ static void render_text(rgui_handle_t *rgui)
break; break;
#ifdef HW_RVL #ifdef HW_RVL
case RGUI_SETTINGS_VIDEO_SOFT_FILTER: case RGUI_SETTINGS_VIDEO_SOFT_FILTER:
snprintf(type_str, sizeof(type_str), g_extern.console.screen.state.soft_filter.enable ? "ON" : "OFF"); snprintf(type_str, sizeof(type_str), (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_SOFT_FILTER_ENABLE)) ? "ON" : "OFF");
break; break;
#endif #endif
#ifdef GEKKO #ifdef GEKKO
@ -625,7 +625,10 @@ static int rgui_settings_toggle_setting(rgui_file_type_t setting, rgui_action_t
#ifdef HW_RVL #ifdef HW_RVL
case RGUI_SETTINGS_VIDEO_SOFT_FILTER: case RGUI_SETTINGS_VIDEO_SOFT_FILTER:
{ {
g_extern.console.screen.state.soft_filter.enable = !g_extern.console.screen.state.soft_filter.enable; if (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_SOFT_FILTER_ENABLE))
g_extern.lifecycle_menu_state &= ~(1 << MODE_VIDEO_SOFT_FILTER_ENABLE);
else
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_SOFT_FILTER_ENABLE);
driver.video->apply_state_changes(); driver.video->apply_state_changes();
} }
break; break;

View File

@ -201,7 +201,7 @@ static void populate_setting_item(void *data, unsigned input)
#ifdef _XBOX1 #ifdef _XBOX1
case SETTING_FLICKER_FILTER: case SETTING_FLICKER_FILTER:
snprintf(current_item->text, sizeof(current_item->text), "Flicker Filter"); snprintf(current_item->text, sizeof(current_item->text), "Flicker Filter");
snprintf(current_item->setting_text, sizeof(current_item->setting_text), "%d", g_extern.console.screen.state.flicker_filter.enable); snprintf(current_item->setting_text, sizeof(current_item->setting_text), "%d", (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_FLICKER_FILTER_ENABLE) ? true : false));
snprintf(current_item->comment, sizeof(current_item->comment), "INFO - Toggle the [Flicker Filter]."); snprintf(current_item->comment, sizeof(current_item->comment), "INFO - Toggle the [Flicker Filter].");
break; break;
case SETTING_SOFT_DISPLAY_FILTER: case SETTING_SOFT_DISPLAY_FILTER:
@ -217,18 +217,18 @@ static void populate_setting_item(void *data, unsigned input)
break; break;
case SETTING_THROTTLE_MODE: case SETTING_THROTTLE_MODE:
snprintf(current_item->text, sizeof(current_item->text), "Throttle Mode"); snprintf(current_item->text, sizeof(current_item->text), "Throttle Mode");
snprintf(current_item->setting_text, sizeof(current_item->setting_text), g_extern.console.screen.state.throttle.enable ? "ON" : "OFF"); snprintf(current_item->setting_text, sizeof(current_item->setting_text), (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_THROTTLE_ENABLE)) ? "ON" : "OFF");
snprintf(current_item->comment, sizeof(current_item->comment), g_extern.console.screen.state.throttle.enable ? "INFO - [Throttle Mode] is 'ON' - Vsync is enabled." : "INFO - [Throttle Mode] is 'OFF' - Vsync is disabled."); snprintf(current_item->comment, sizeof(current_item->comment), (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_THROTTLE_ENABLE)) ? "INFO - [Throttle Mode] is 'ON' - Vsync is enabled." : "INFO - [Throttle Mode] is 'OFF' - Vsync is disabled.");
break; break;
case SETTING_TRIPLE_BUFFERING: case SETTING_TRIPLE_BUFFERING:
snprintf(current_item->text, sizeof(current_item->text), "Triple Buffering"); snprintf(current_item->text, sizeof(current_item->text), "Triple Buffering");
snprintf(current_item->setting_text, sizeof(current_item->setting_text), g_extern.console.screen.state.triple_buffering.enable ? "ON" : "OFF"); snprintf(current_item->setting_text, sizeof(current_item->setting_text), (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE)) ? "ON" : "OFF");
snprintf(current_item->comment, sizeof(current_item->comment), g_extern.console.screen.state.triple_buffering.enable ? "INFO - [Triple Buffering] is set to 'ON'." : "INFO - [Triple Buffering] is set to 'OFF'."); snprintf(current_item->comment, sizeof(current_item->comment), (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE)) ? "INFO - [Triple Buffering] is set to 'ON'." : "INFO - [Triple Buffering] is set to 'OFF'.");
break; break;
case SETTING_ENABLE_SCREENSHOTS: case SETTING_ENABLE_SCREENSHOTS:
snprintf(current_item->text, sizeof(current_item->text), "Screenshot Option"); snprintf(current_item->text, sizeof(current_item->text), "Screenshot Option");
snprintf(current_item->setting_text, sizeof(current_item->setting_text), g_extern.console.screen.state.screenshots.enable ? "ON" : "OFF"); snprintf(current_item->setting_text, sizeof(current_item->setting_text), (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_SCREENSHOTS_ENABLE)) ? "ON" : "OFF");
snprintf(current_item->comment, sizeof(current_item->comment), "INFO - Screenshots feature is set to '%s'.", g_extern.console.screen.state.screenshots.enable ? "ON" : "OFF"); snprintf(current_item->comment, sizeof(current_item->comment), "INFO - Screenshots feature is set to '%s'.", (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_SCREENSHOTS_ENABLE)) ? "ON" : "OFF");
break; break;
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL) #if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL)
case SETTING_APPLY_SHADER_PRESET_ON_STARTUP: case SETTING_APPLY_SHADER_PRESET_ON_STARTUP:
@ -353,8 +353,8 @@ static void populate_setting_item(void *data, unsigned input)
#endif #endif
case SETTING_ENABLE_CUSTOM_BGM: case SETTING_ENABLE_CUSTOM_BGM:
snprintf(current_item->text, sizeof(current_item->text), "Custom BGM Option"); snprintf(current_item->text, sizeof(current_item->text), "Custom BGM Option");
snprintf(current_item->setting_text, sizeof(current_item->setting_text), g_extern.console.sound.custom_bgm.enable ? "ON" : "OFF"); snprintf(current_item->setting_text, sizeof(current_item->setting_text), (g_extern.lifecycle_menu_state & (1 << MODE_AUDIO_CUSTOM_BGM_ENABLE)) ? "ON" : "OFF");
snprintf(current_item->comment, sizeof(current_item->comment), "INFO - [Custom BGM] is set to '%s'.", g_extern.console.sound.custom_bgm.enable ? "ON" : "OFF"); snprintf(current_item->comment, sizeof(current_item->comment), "INFO - [Custom BGM] is set to '%s'.", (g_extern.lifecycle_menu_state & (1 << MODE_AUDIO_CUSTOM_BGM_ENABLE)) ? "ON" : "OFF");
break; break;
case SETTING_PATH_DEFAULT_ROM_DIRECTORY: case SETTING_PATH_DEFAULT_ROM_DIRECTORY:
snprintf(current_item->text, sizeof(current_item->text), "Startup ROM Directory"); snprintf(current_item->text, sizeof(current_item->text), "Startup ROM Directory");
@ -1225,22 +1225,27 @@ static int set_setting_action(void *data, unsigned switchvalue, uint64_t input)
case SETTING_FLICKER_FILTER: case SETTING_FLICKER_FILTER:
if(input & (1ULL << RMENU_DEVICE_NAV_LEFT)) if(input & (1ULL << RMENU_DEVICE_NAV_LEFT))
{ {
if(g_extern.console.screen.state.flicker_filter.value > 0) if(g_extern.console.screen.flicker_filter_index > 0)
g_extern.console.screen.state.flicker_filter.value--; g_extern.console.screen.flicker_filter_index--;
} }
if(input & (1ULL << RMENU_DEVICE_NAV_RIGHT)) if(input & (1ULL << RMENU_DEVICE_NAV_RIGHT))
{ {
if(g_extern.console.screen.state.flicker_filter.value < 5) if(g_extern.console.screen.flicker_filter_index < 5)
g_extern.console.screen.state.flicker_filter.value++; g_extern.console.screen.flicker_filter_index++;
} }
if(input & (1ULL << RMENU_DEVICE_NAV_START)) if(input & (1ULL << RMENU_DEVICE_NAV_START))
g_extern.console.screen.state.flicker_filter.value = 0; g_extern.console.screen.flicker_filter_index = 0;
break; break;
case SETTING_SOFT_DISPLAY_FILTER: case SETTING_SOFT_DISPLAY_FILTER:
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)))
g_extern.console.screen.state.soft_filter.enable = !g_extern.console.screen.state.soft_filter.enable; {
if (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_SOFT_FILTER_ENABLE))
g_extern.lifecycle_menu_state &= ~(1 << MODE_VIDEO_SOFT_FILTER_ENABLE);
else
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_SOFT_FILTER_ENABLE);
}
if(input & (1ULL << RMENU_DEVICE_NAV_START)) if(input & (1ULL << RMENU_DEVICE_NAV_START))
g_extern.console.screen.state.soft_filter.enable = true; g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_SOFT_FILTER_ENABLE);
break; break;
#endif #endif
case SETTING_HW_OVERSCAN_AMOUNT: case SETTING_HW_OVERSCAN_AMOUNT:
@ -1264,12 +1269,12 @@ static int set_setting_action(void *data, unsigned switchvalue, uint64_t input)
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)))
{ {
rarch_settings_change(S_THROTTLE); rarch_settings_change(S_THROTTLE);
device_ptr->ctx_driver->swap_interval(g_extern.console.screen.state.throttle.enable); device_ptr->ctx_driver->swap_interval((g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_THROTTLE_ENABLE)));
} }
if(input & (1ULL << RMENU_DEVICE_NAV_START)) if(input & (1ULL << RMENU_DEVICE_NAV_START))
{ {
rarch_settings_default(S_DEF_THROTTLE); rarch_settings_default(S_DEF_THROTTLE);
device_ptr->ctx_driver->swap_interval(g_extern.console.screen.state.throttle.enable); device_ptr->ctx_driver->swap_interval((g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_THROTTLE_ENABLE)));
} }
break; break;
case SETTING_TRIPLE_BUFFERING: case SETTING_TRIPLE_BUFFERING:
@ -1280,23 +1285,25 @@ static int set_setting_action(void *data, unsigned switchvalue, uint64_t input)
} }
if(input & (1ULL << RMENU_DEVICE_NAV_START)) if(input & (1ULL << RMENU_DEVICE_NAV_START))
{ {
bool old_buffer_input = g_extern.console.screen.state.triple_buffering.enable;
rarch_settings_default(S_DEF_TRIPLE_BUFFERING); rarch_settings_default(S_DEF_TRIPLE_BUFFERING);
if(!old_buffer_input) if(!(g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE)))
driver.video->restart(); driver.video->restart();
} }
break; break;
case SETTING_ENABLE_SCREENSHOTS: case SETTING_ENABLE_SCREENSHOTS:
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)))
{ {
g_extern.console.screen.state.screenshots.enable = !g_extern.console.screen.state.screenshots.enable; if (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_SCREENSHOTS_ENABLE))
device_ptr->ctx_driver->rmenu_screenshot_enable(g_extern.console.screen.state.screenshots.enable); g_extern.lifecycle_menu_state &= ~(1 << MODE_VIDEO_SCREENSHOTS_ENABLE);
else
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_SCREENSHOTS_ENABLE);
device_ptr->ctx_driver->rmenu_screenshot_enable((g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_SCREENSHOTS_ENABLE)));
} }
if(input & (1ULL << RMENU_DEVICE_NAV_START)) if(input & (1ULL << RMENU_DEVICE_NAV_START))
{ {
g_extern.console.screen.state.screenshots.enable = true; g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_SCREENSHOTS_ENABLE);
device_ptr->ctx_driver->rmenu_screenshot_enable(g_extern.console.screen.state.screenshots.enable); device_ptr->ctx_driver->rmenu_screenshot_enable((g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_SCREENSHOTS_ENABLE)));
} }
break; break;
#if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL) #if defined(HAVE_CG) || defined(HAVE_HLSL) || defined(HAVE_GLSL)
@ -1460,8 +1467,11 @@ static int set_setting_action(void *data, unsigned switchvalue, uint64_t input)
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)))
{ {
#if(CELL_SDK_VERSION > 0x340000) #if(CELL_SDK_VERSION > 0x340000)
g_extern.console.sound.custom_bgm.enable = !g_extern.console.sound.custom_bgm.enable; if (g_extern.lifecycle_menu_state & (1 << MODE_AUDIO_CUSTOM_BGM_ENABLE))
if(g_extern.console.sound.custom_bgm.enable) g_extern.lifecycle_menu_state &= ~(1 << MODE_AUDIO_CUSTOM_BGM_ENABLE);
else
g_extern.lifecycle_menu_state |= (1 << MODE_AUDIO_CUSTOM_BGM_ENABLE);
if (g_extern.lifecycle_menu_state & (1 << MODE_AUDIO_CUSTOM_BGM_ENABLE))
cellSysutilEnableBgmPlayback(); cellSysutilEnableBgmPlayback();
else else
cellSysutilDisableBgmPlayback(); cellSysutilDisableBgmPlayback();
@ -1471,7 +1481,7 @@ static int set_setting_action(void *data, unsigned switchvalue, uint64_t input)
if(input & (1ULL << RMENU_DEVICE_NAV_START)) if(input & (1ULL << RMENU_DEVICE_NAV_START))
{ {
#if(CELL_SDK_VERSION > 0x340000) #if(CELL_SDK_VERSION > 0x340000)
g_extern.console.sound.custom_bgm.enable = true; g_extern.lifecycle_menu_state |= (1 << MODE_AUDIO_CUSTOM_BGM_ENABLE);
#endif #endif
} }
break; break;

View File

@ -357,7 +357,7 @@ static void system_init(void)
static void system_post_init(void) static void system_post_init(void)
{ {
#if (CELL_SDK_VERSION > 0x340000) && !defined(__PSL1GHT__) #if (CELL_SDK_VERSION > 0x340000) && !defined(__PSL1GHT__)
if (g_extern.console.screen.state.screenshots.enable) if (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_SCREENSHOTS_ENABLE))
{ {
#ifdef HAVE_SYSMODULES #ifdef HAVE_SYSMODULES
cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT); cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
@ -372,7 +372,7 @@ static void system_post_init(void)
#endif #endif
} }
#ifdef HAVE_SYSUTILS #ifdef HAVE_SYSUTILS
if (g_extern.console.sound.custom_bgm.enable) if (g_extern.lifecycle_menu_state & (1 << MODE_AUDIO_CUSTOM_BGM_ENABLE))
cellSysutilEnableBgmPlayback(); cellSysutilEnableBgmPlayback();
#endif #endif
#endif #endif
@ -422,7 +422,7 @@ static void system_deinit(void)
#ifndef __PSL1GHT__ #ifndef __PSL1GHT__
/* screenshot PRX */ /* screenshot PRX */
if(g_extern.console.screen.state.screenshots.enable) if (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_SCREENSHOTS_ENABLE))
cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT); cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
#endif #endif

View File

@ -120,6 +120,13 @@ enum menu_enums
MODE_EXITSPAWN, MODE_EXITSPAWN,
MODE_LOAD_FIRST_SHADER, MODE_LOAD_FIRST_SHADER,
MODE_LOAD_SECOND_SHADER, MODE_LOAD_SECOND_SHADER,
MODE_VIDEO_TRIPLE_BUFFERING_ENABLE,
MODE_VIDEO_FLICKER_FILTER_ENABLE,
MODE_VIDEO_SOFT_FILTER_ENABLE,
MODE_VIDEO_SCREENSHOTS_ENABLE,
MODE_VIDEO_THROTTLE_ENABLE,
MODE_VIDEO_OVERSCAN_ENABLE,
MODE_AUDIO_CUSTOM_BGM_ENABLE,
}; };
// All config related settings go here. // All config related settings go here.
@ -525,21 +532,12 @@ struct global
unsigned orientation; unsigned orientation;
float overscan_amount; float overscan_amount;
unsigned gamma_correction; unsigned gamma_correction;
unsigned char flicker_filter_index;
struct unsigned char soft_filter_index;
{
rarch_boolean_state_t triple_buffering;
rarch_boolean_state_t overscan;
rarch_boolean_state_t flicker_filter;
rarch_boolean_state_t soft_filter;
rarch_boolean_state_t screenshots;
rarch_boolean_state_t throttle;
} state;
} screen; } screen;
struct struct
{ {
rarch_boolean_state_t custom_bgm;
unsigned mode; unsigned mode;
#ifdef _XBOX1 #ifdef _XBOX1
unsigned volume_level; unsigned volume_level;

View File

@ -417,7 +417,7 @@ static bool gfx_ctx_init(void)
params.depthFormat = GL_NONE; params.depthFormat = GL_NONE;
params.multisamplingMode = GL_MULTISAMPLING_NONE_SCE; params.multisamplingMode = GL_MULTISAMPLING_NONE_SCE;
if (g_extern.console.screen.state.triple_buffering.enable) if (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE))
{ {
params.enable |= PSGL_DEVICE_PARAMETERS_BUFFERING_MODE; params.enable |= PSGL_DEVICE_PARAMETERS_BUFFERING_MODE;
params.bufferingMode = PSGL_BUFFERING_MODE_TRIPLE; params.bufferingMode = PSGL_BUFFERING_MODE_TRIPLE;

View File

@ -633,7 +633,7 @@ void gl_set_projection(void *data, struct gl_ortho *ortho, bool allow_rotate)
{ {
gl_t *gl = (gl_t*)data; gl_t *gl = (gl_t*)data;
#ifdef RARCH_CONSOLE #ifdef RARCH_CONSOLE
if (g_extern.console.screen.state.overscan.enable) if (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_OVERSCAN_ENABLE))
{ {
ortho->left = -g_extern.console.screen.overscan_amount / 2; ortho->left = -g_extern.console.screen.overscan_amount / 2;
ortho->right = 1 + g_extern.console.screen.overscan_amount / 2; ortho->right = 1 + g_extern.console.screen.overscan_amount / 2;

View File

@ -683,9 +683,10 @@ static void gx_resize(void *data)
int x = 0, y = 0; int x = 0, y = 0;
unsigned width = gx->win_width, height = gx->win_height; unsigned width = gx->win_width, height = gx->win_height;
u32 lifecycle_menu_state = g_extern.lifecycle_menu_state;
#ifdef HW_RVL #ifdef HW_RVL
VIDEO_SetTrapFilter(g_extern.console.screen.state.soft_filter.enable); VIDEO_SetTrapFilter(lifecycle_menu_state & (1 << MODE_VIDEO_SOFT_FILTER_ENABLE));
#endif #endif
GX_SetDispCopyGamma(g_extern.console.screen.gamma_correction); GX_SetDispCopyGamma(g_extern.console.screen.gamma_correction);
@ -746,7 +747,8 @@ static void gx_resize(void *data)
Mtx44 m1, m2; Mtx44 m1, m2;
float top = 1, bottom = -1, left = -1, right = 1; float top = 1, bottom = -1, left = -1, right = 1;
if (g_extern.console.screen.state.overscan.enable)
if (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_OVERSCAN_ENABLE))
{ {
top -= g_extern.console.screen.overscan_amount / 2; top -= g_extern.console.screen.overscan_amount / 2;
left += g_extern.console.screen.overscan_amount / 2; left += g_extern.console.screen.overscan_amount / 2;

View File

@ -256,14 +256,16 @@ void config_set_defaults(void)
// g_extern // g_extern
strlcpy(g_extern.console.main_wrap.paths.default_sram_dir, default_paths.sram_dir, sizeof(g_extern.console.main_wrap.paths.default_sram_dir)); strlcpy(g_extern.console.main_wrap.paths.default_sram_dir, default_paths.sram_dir, sizeof(g_extern.console.main_wrap.paths.default_sram_dir));
g_extern.console.screen.state.overscan.enable = false;
g_extern.console.screen.overscan_amount = 0.0f; g_extern.console.screen.overscan_amount = 0.0f;
g_extern.console.sound.custom_bgm.enable = true;
g_extern.console.screen.gamma_correction = DEFAULT_GAMMA; g_extern.console.screen.gamma_correction = DEFAULT_GAMMA;
g_extern.console.screen.state.screenshots.enable = true; g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_OVERSCAN_ENABLE);
g_extern.console.screen.state.throttle.enable = true; g_extern.lifecycle_menu_state |= (1 << MODE_AUDIO_CUSTOM_BGM_ENABLE);
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_SCREENSHOTS_ENABLE);
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_THROTTLE_ENABLE);
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_SOFT_FILTER_ENABLE);
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_FLICKER_FILTER_ENABLE);
g_extern.console.screen.state.triple_buffering.enable = true;
g_extern.console.main_wrap.state.default_savestate_dir.enable = false; g_extern.console.main_wrap.state.default_savestate_dir.enable = false;
g_extern.console.main_wrap.state.default_sram_dir.enable = false; g_extern.console.main_wrap.state.default_sram_dir.enable = false;
g_extern.console.screen.orientation = ORIENTATION_NORMAL; g_extern.console.screen.orientation = ORIENTATION_NORMAL;
@ -282,10 +284,8 @@ void config_set_defaults(void)
g_extern.console.screen.viewports.custom_vp.x = 0; g_extern.console.screen.viewports.custom_vp.x = 0;
g_extern.console.screen.viewports.custom_vp.y = 0; g_extern.console.screen.viewports.custom_vp.y = 0;
#ifdef _XBOX1 #ifdef _XBOX1
g_extern.console.screen.state.flicker_filter.enable = 1;
g_extern.console.sound.volume_level = 0; g_extern.console.sound.volume_level = 0;
#endif #endif
g_extern.console.screen.state.soft_filter.enable = true;
#ifdef HAVE_ZLIB #ifdef HAVE_ZLIB
g_extern.file_state.zip_extract_mode = 0; g_extern.file_state.zip_extract_mode = 0;
#endif #endif
@ -474,6 +474,14 @@ bool config_load_file(const char *path)
CONFIG_GET_BOOL_EXTERN(console.screen.gamma_correction, "gamma_correction"); CONFIG_GET_BOOL_EXTERN(console.screen.gamma_correction, "gamma_correction");
bool msg_enable = false; bool msg_enable = false;
bool throttle_enable = false;
bool triple_buffering_enable = false;
bool custom_bgm_enable = false;
bool overscan_enable = false;
bool screenshots_enable = false;
bool flicker_filter_enable = false;
bool soft_filter_enable = false;
if (config_get_bool(conf, "info_msg_enable", &msg_enable)) if (config_get_bool(conf, "info_msg_enable", &msg_enable))
{ {
if (msg_enable) if (msg_enable)
@ -482,16 +490,68 @@ bool config_load_file(const char *path)
g_extern.lifecycle_menu_state &= ~(1 << MODE_INFO_DRAW); g_extern.lifecycle_menu_state &= ~(1 << MODE_INFO_DRAW);
} }
CONFIG_GET_BOOL_EXTERN(console.screen.state.screenshots.enable, "screenshots_enable"); if (config_get_bool(conf, "throttle_enable", &throttle_enable))
CONFIG_GET_BOOL_EXTERN(console.screen.state.throttle.enable, "throttle_enable"); {
CONFIG_GET_BOOL_EXTERN(console.screen.state.triple_buffering.enable, "triple_buffering_enable"); if (throttle_enable)
CONFIG_GET_BOOL_EXTERN(console.screen.state.overscan.enable, "overscan_enable"); g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_THROTTLE_ENABLE);
CONFIG_GET_BOOL_EXTERN(console.sound.custom_bgm.enable, "custom_bgm_enable"); else
g_extern.lifecycle_menu_state &= ~(1 << MODE_VIDEO_THROTTLE_ENABLE);
}
if (config_get_bool(conf, "triple_buffering_enable", &triple_buffering_enable))
{
if (triple_buffering_enable)
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
else
g_extern.lifecycle_menu_state &= ~(1 << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE);
}
if (config_get_bool(conf, "overscan_enable", &overscan_enable))
{
if (overscan_enable)
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_OVERSCAN_ENABLE);
else
g_extern.lifecycle_menu_state &= ~(1 << MODE_VIDEO_OVERSCAN_ENABLE);
}
if (config_get_bool(conf, "custom_bgm_enable", &custom_bgm_enable))
{
if (custom_bgm_enable)
g_extern.lifecycle_menu_state |= (1 << MODE_AUDIO_CUSTOM_BGM_ENABLE);
else
g_extern.lifecycle_menu_state &= ~(1 << MODE_AUDIO_CUSTOM_BGM_ENABLE);
}
if (config_get_bool(conf, "screenshots_enable", &screenshots_enable))
{
if (screenshots_enable)
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_SCREENSHOTS_ENABLE);
else
g_extern.lifecycle_menu_state &= ~(1 << MODE_VIDEO_SCREENSHOTS_ENABLE);
}
if (config_get_bool(conf, "flicker_filter_enable", &flicker_filter_enable))
{
if (flicker_filter_enable)
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_FLICKER_FILTER_ENABLE);
else
g_extern.lifecycle_menu_state &= ~(1 << MODE_VIDEO_FLICKER_FILTER_ENABLE);
}
if (config_get_bool(conf, "soft_filter_enable", &soft_filter_enable))
{
if (soft_filter_enable)
g_extern.lifecycle_menu_state |= (1 << MODE_VIDEO_SOFT_FILTER_ENABLE);
else
g_extern.lifecycle_menu_state &= ~(1 << MODE_VIDEO_SOFT_FILTER_ENABLE);
}
CONFIG_GET_BOOL_EXTERN(console.main_wrap.state.default_sram_dir.enable, "sram_dir_enable"); CONFIG_GET_BOOL_EXTERN(console.main_wrap.state.default_sram_dir.enable, "sram_dir_enable");
CONFIG_GET_BOOL_EXTERN(console.main_wrap.state.default_savestate_dir.enable, "savestate_dir_enable"); CONFIG_GET_BOOL_EXTERN(console.main_wrap.state.default_savestate_dir.enable, "savestate_dir_enable");
CONFIG_GET_FLOAT_EXTERN(console.screen.overscan_amount, "overscan_amount"); CONFIG_GET_FLOAT_EXTERN(console.screen.overscan_amount, "overscan_amount");
CONFIG_GET_INT_EXTERN(console.screen.flicker_filter_index, "flicker_filter_index");
CONFIG_GET_INT_EXTERN(console.screen.soft_filter_index, "soft_filter_index");
#ifdef _XBOX1 #ifdef _XBOX1
CONFIG_GET_INT_EXTERN(console.screen.state.flicker_filter.enable, "flicker_filter");
CONFIG_GET_INT_EXTERN(console.sound.volume_level, "sound_volume_level"); CONFIG_GET_INT_EXTERN(console.sound.volume_level, "sound_volume_level");
#endif #endif
#ifdef HAVE_ZLIB #ifdef HAVE_ZLIB
@ -500,7 +560,6 @@ bool config_load_file(const char *path)
CONFIG_GET_INT_EXTERN(console.screen.resolutions.current.id, "current_resolution_id"); CONFIG_GET_INT_EXTERN(console.screen.resolutions.current.id, "current_resolution_id");
CONFIG_GET_INT_EXTERN(state_slot, "state_slot"); CONFIG_GET_INT_EXTERN(state_slot, "state_slot");
CONFIG_GET_INT_EXTERN(audio_data.mute, "audio_mute"); CONFIG_GET_INT_EXTERN(audio_data.mute, "audio_mute");
CONFIG_GET_BOOL_EXTERN(console.screen.state.soft_filter.enable, "soft_display_filter_enable");
CONFIG_GET_INT_EXTERN(console.screen.orientation, "screen_orientation"); CONFIG_GET_INT_EXTERN(console.screen.orientation, "screen_orientation");
CONFIG_GET_INT_EXTERN(console.sound.mode, "sound_mode"); CONFIG_GET_INT_EXTERN(console.sound.mode, "sound_mode");
CONFIG_GET_INT_EXTERN(console.screen.viewports.custom_vp.x, "custom_viewport_x"); CONFIG_GET_INT_EXTERN(console.screen.viewports.custom_vp.x, "custom_viewport_x");
@ -1092,21 +1151,47 @@ bool config_save_file(const char *path)
config_set_float(conf, "audio_rate_control_delta", g_settings.audio.rate_control_delta); config_set_float(conf, "audio_rate_control_delta", g_settings.audio.rate_control_delta);
config_set_string(conf, "system_directory", g_settings.system_directory); config_set_string(conf, "system_directory", g_settings.system_directory);
config_set_bool(conf, "overscan_enable", g_extern.console.screen.state.overscan.enable); if (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_OVERSCAN_ENABLE))
config_set_bool(conf, "screenshots_enable", g_extern.console.screen.state.screenshots.enable); config_set_bool(conf, "overscan_enable", true);
else
config_set_bool(conf, "overscan_enable", false);
if (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_SCREENSHOTS_ENABLE))
config_set_bool(conf, "screenshots_enable", true);
else
config_set_bool(conf, "screenshots_enable", false);
config_set_bool(conf, "gamma_correction", g_extern.console.screen.gamma_correction); config_set_bool(conf, "gamma_correction", g_extern.console.screen.gamma_correction);
#ifdef _XBOX1 #ifdef _XBOX1
config_set_int(conf, "flicker_filter", g_extern.console.screen.state.flicker_filter.value);
config_set_int(conf, "sound_volume_level", g_extern.console.sound.volume_level); config_set_int(conf, "sound_volume_level", g_extern.console.sound.volume_level);
#endif #endif
config_set_bool(conf, "throttle_enable", g_extern.console.screen.state.throttle.enable); if (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_THROTTLE_ENABLE))
config_set_bool(conf, "triple_buffering_enable", g_extern.console.screen.state.triple_buffering.enable); config_set_bool(conf, "throttle_enable", true);
else
config_set_bool(conf, "throttle_enable", false);
if (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_TRIPLE_BUFFERING_ENABLE))
config_set_bool(conf, "triple_buffering_enable", true);
else
config_set_bool(conf, "triple_buffering_enable", false);
if (g_extern.lifecycle_menu_state & (1 << MODE_INFO_DRAW)) if (g_extern.lifecycle_menu_state & (1 << MODE_INFO_DRAW))
config_set_bool(conf, "info_msg_enable", true); config_set_bool(conf, "info_msg_enable", true);
else else
config_set_bool(conf, "info_msg_enable", false); config_set_bool(conf, "info_msg_enable", false);
if (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_SOFT_FILTER_ENABLE))
config_set_bool(conf, "soft_filter_enable", true);
else
config_set_bool(conf, "soft_filter_enable", false);
if (g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_FLICKER_FILTER_ENABLE))
config_set_bool(conf, "flicker_filter_enable", true);
else
config_set_bool(conf, "flicker_filter_enable", false);
config_set_int(conf, "flicker_filter_index", g_extern.console.screen.flicker_filter_index);
config_set_int(conf, "soft_filter_index", g_extern.console.screen.soft_filter_index);
config_set_int(conf, "current_resolution_id", g_extern.console.screen.resolutions.current.id); config_set_int(conf, "current_resolution_id", g_extern.console.screen.resolutions.current.id);
config_set_int(conf, "custom_viewport_width", g_extern.console.screen.viewports.custom_vp.width); config_set_int(conf, "custom_viewport_width", g_extern.console.screen.viewports.custom_vp.width);
config_set_int(conf, "custom_viewport_height", g_extern.console.screen.viewports.custom_vp.height); config_set_int(conf, "custom_viewport_height", g_extern.console.screen.viewports.custom_vp.height);
@ -1123,9 +1208,12 @@ bool config_save_file(const char *path)
config_set_int(conf, "sound_mode", g_extern.console.sound.mode); config_set_int(conf, "sound_mode", g_extern.console.sound.mode);
config_set_int(conf, "state_slot", g_extern.state_slot); config_set_int(conf, "state_slot", g_extern.state_slot);
config_set_int(conf, "audio_mute", g_extern.audio_data.mute); config_set_int(conf, "audio_mute", g_extern.audio_data.mute);
config_set_bool(conf, "soft_display_filter_enable", g_extern.console.screen.state.soft_filter.enable);
config_set_int(conf, "screen_orientation", g_extern.console.screen.orientation); config_set_int(conf, "screen_orientation", g_extern.console.screen.orientation);
config_set_bool(conf, "custom_bgm_enable", g_extern.console.sound.custom_bgm.enable);
if (g_extern.lifecycle_menu_state & (1 << MODE_AUDIO_CUSTOM_BGM_ENABLE))
config_set_bool(conf, "custom_bgm_enable", true);
else
config_set_bool(conf, "custom_bgm_enable", false);
config_set_bool(conf, "sram_dir_enable", g_extern.console.main_wrap.state.default_sram_dir.enable); config_set_bool(conf, "sram_dir_enable", g_extern.console.main_wrap.state.default_sram_dir.enable);
config_set_bool(conf, "savestate_dir_enable", g_extern.console.main_wrap.state.default_savestate_dir.enable); config_set_bool(conf, "savestate_dir_enable", g_extern.console.main_wrap.state.default_savestate_dir.enable);

View File

@ -698,10 +698,6 @@ static bool xdk_d3d_frame(void *data, const void *frame,
#ifdef HAVE_FBO #ifdef HAVE_FBO
D3DSurface* pRenderTarget0; D3DSurface* pRenderTarget0;
#endif #endif
#ifdef _XBOX1
unsigned flicker_filter = g_extern.console.screen.state.flicker_filter.value;
bool soft_filter_enable = g_extern.console.screen.state.soft_filter.enable;
#endif
d3dr->Clear(0, NULL, D3DCLEAR_TARGET, 0x00000000, 1.0f, 0); d3dr->Clear(0, NULL, D3DCLEAR_TARGET, 0x00000000, 1.0f, 0);
@ -824,8 +820,8 @@ static bool xdk_d3d_frame(void *data, const void *frame,
d3dr->Clear(0, NULL, D3DCLEAR_TARGET, 0xff000000, 1.0f, 0); d3dr->Clear(0, NULL, D3DCLEAR_TARGET, 0xff000000, 1.0f, 0);
d3dr->BeginScene(); d3dr->BeginScene();
d3dr->SetFlickerFilter(flicker_filter); d3dr->SetFlickerFilter(g_extern.console.screen.flicker_filter_index);
d3dr->SetSoftDisplayFilter(soft_filter_enable); d3dr->SetSoftDisplayFilter(g_extern.lifecycle_menu_state & (1 << MODE_VIDEO_SOFT_FILTER_ENABLE));
d3dr->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); d3dr->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
d3dr->EndScene(); d3dr->EndScene();
#elif defined(_XBOX360) #elif defined(_XBOX360)