mirror of https://github.com/snes9xgit/snes9x.git
Make rewinding and bilinear filtering global Snes9x settings.
This commit is contained in:
parent
1aaa2d84e3
commit
7411df6c73
|
@ -205,7 +205,7 @@ Snes9xConfig::load_defaults (void)
|
|||
ntsc_setup = snes_ntsc_composite;
|
||||
ntsc_scanline_intensity = 1;
|
||||
scanline_filter_intensity = 0;
|
||||
bilinear_filter = 0;
|
||||
Settings.BilinearFilter = FALSE;
|
||||
netplay_activated = FALSE;
|
||||
netplay_server_up = FALSE;
|
||||
netplay_is_server = FALSE;
|
||||
|
@ -221,6 +221,7 @@ Snes9xConfig::load_defaults (void)
|
|||
|
||||
rewind_granularity = 5;
|
||||
rewind_buffer_size = 0;
|
||||
Settings.Rewinding = FALSE;
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
sync_to_vblank = 1;
|
||||
|
@ -370,7 +371,7 @@ Snes9xConfig::save_config_file (void)
|
|||
xml_out_int (xml, "ntsc_scanline_intensity", ntsc_scanline_intensity);
|
||||
xml_out_int (xml, "scanline_filter_intensity", scanline_filter_intensity);
|
||||
xml_out_int (xml, "hw_accel", hw_accel);
|
||||
xml_out_int (xml, "bilinear_filter", bilinear_filter);
|
||||
xml_out_int (xml, "bilinear_filter", Settings.BilinearFilter);
|
||||
|
||||
xml_out_int (xml, "rewind_buffer_size", rewind_buffer_size);
|
||||
xml_out_int (xml, "rewind_granularity", rewind_granularity);
|
||||
|
@ -558,7 +559,7 @@ Snes9xConfig::set_option (const char *name, const char *value)
|
|||
}
|
||||
else if (!strcasecmp (name, "bilinear_filter"))
|
||||
{
|
||||
bilinear_filter = atoi (value);
|
||||
Settings.BilinearFilter = atoi (value);
|
||||
}
|
||||
else if (!strcasecmp (name, "sync_to_vblank"))
|
||||
{
|
||||
|
|
|
@ -81,7 +81,6 @@ class Snes9xConfig
|
|||
float ntsc_merge_fields;
|
||||
unsigned int ntsc_scanline_intensity;
|
||||
unsigned int scanline_filter_intensity;
|
||||
unsigned char bilinear_filter;
|
||||
unsigned char hw_accel;
|
||||
unsigned char allow_opengl;
|
||||
unsigned char allow_xv;
|
||||
|
|
|
@ -197,7 +197,7 @@ S9xHandlePortCommand (s9xcommand_t cmd, int16 data1, int16 data2)
|
|||
if (cmd.port[0] == PORT_QUIT)
|
||||
quit_binding_down = TRUE;
|
||||
else if (cmd.port[0] == PORT_REWIND)
|
||||
top_level->user_rewind = TRUE;
|
||||
Settings.Rewinding = TRUE;
|
||||
}
|
||||
|
||||
if (data1 == FALSE) /* Release */
|
||||
|
@ -232,7 +232,7 @@ S9xHandlePortCommand (s9xcommand_t cmd, int16 data1, int16 data2)
|
|||
|
||||
else if (cmd.port[0] == PORT_REWIND)
|
||||
{
|
||||
top_level->user_rewind = FALSE;
|
||||
Settings.Rewinding = FALSE;
|
||||
}
|
||||
|
||||
else if (cmd.port[0] == PORT_SEEK_TO_FRAME)
|
||||
|
|
|
@ -127,7 +127,7 @@ S9xGTKDisplayDriver::output (void *src,
|
|||
cairo_matrix_translate (&matrix, -x, -y);
|
||||
cairo_pattern_set_matrix (pattern, &matrix);
|
||||
cairo_pattern_set_filter (pattern,
|
||||
config->bilinear_filter
|
||||
Settings.BilinearFilter
|
||||
? CAIRO_FILTER_BILINEAR
|
||||
: CAIRO_FILTER_NEAREST);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ S9xOpenGLDisplayDriver::update (int width, int height, int yoffset)
|
|||
glBindTexture (GL_TEXTURE_2D, texmap);
|
||||
}
|
||||
|
||||
GLint filter = config->bilinear_filter ? GL_LINEAR : GL_NEAREST;
|
||||
GLint filter = Settings.BilinearFilter ? GL_LINEAR : GL_NEAREST;
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
|
||||
GLint clamp = (using_shaders || !dyn_resizing) ? GL_CLAMP_TO_BORDER : GL_CLAMP_TO_EDGE;
|
||||
|
|
|
@ -799,7 +799,7 @@ Snes9xPreferences::move_settings_to_dialog (void)
|
|||
set_combo ("frameskip_combo",
|
||||
Settings.SkipFrames == AUTO_FRAMERATE ?
|
||||
0 : Settings.SkipFrames + 1);
|
||||
set_check ("bilinear_filter", config->bilinear_filter);
|
||||
set_check ("bilinear_filter", Settings.BilinearFilter);
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
set_check ("sync_to_vblank", config->sync_to_vblank);
|
||||
|
@ -907,7 +907,7 @@ Snes9xPreferences::get_settings_from_dialog (void)
|
|||
config->ntsc_scanline_intensity = get_combo ("ntsc_scanline_intensity");
|
||||
config->scanline_filter_intensity = get_combo ("scanline_filter_intensity");
|
||||
config->hw_accel = hw_accel_value (get_combo ("hw_accel"));
|
||||
config->bilinear_filter = get_check ("bilinear_filter");
|
||||
Settings.BilinearFilter = get_check ("bilinear_filter");
|
||||
config->num_threads = get_spin ("num_threads");
|
||||
config->default_esc_behavior = get_combo ("default_esc_behavior");
|
||||
config->prevent_screensaver = get_check ("prevent_screensaver");
|
||||
|
|
|
@ -351,8 +351,8 @@ S9xIdleFunc (gpointer data)
|
|||
{
|
||||
#endif
|
||||
|
||||
if(top_level->user_rewind)
|
||||
top_level->user_rewind = stateMan.pop();
|
||||
if(Settings.Rewinding)
|
||||
Settings.Rewinding = stateMan.pop();
|
||||
else if(IPPU.TotalEmulatedFrames % gui_config->rewind_granularity == 0)
|
||||
stateMan.push();
|
||||
|
||||
|
|
|
@ -593,7 +593,6 @@ Snes9xWindow::Snes9xWindow (Snes9xConfig *config) :
|
|||
};
|
||||
|
||||
user_pause = 0;
|
||||
user_rewind = 0;
|
||||
sys_pause = 0;
|
||||
last_width = -1;
|
||||
last_height = -1;
|
||||
|
|
|
@ -65,7 +65,6 @@ class Snes9xWindow : public GtkBuilderWindow
|
|||
|
||||
Snes9xConfig *config;
|
||||
int user_pause, sys_pause;
|
||||
int user_rewind;
|
||||
int last_width, last_height;
|
||||
int mouse_region_x, mouse_region_y;
|
||||
int mouse_region_width, mouse_region_height;
|
||||
|
|
|
@ -389,7 +389,7 @@ bool CGLCG::LoadShader(const char* shaderFile)
|
|||
*/
|
||||
if (pass.scaleParams.scaleTypeX == CG_SCALE_NONE && !it->filterSet)
|
||||
{
|
||||
pass.linearFilter = gui_config->bilinear_filter;
|
||||
pass.linearFilter = Settings.BilinearFilter;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -823,7 +823,7 @@ void CGLCG::setShaderVars(int pass)
|
|||
shaderFrameCnt %= shaderPasses[pass].frameCounterMod;
|
||||
setProgram1f(pass, "IN.frame_count", (float)shaderFrameCnt);
|
||||
setProgram1f(
|
||||
pass, "IN.frame_direction", top_level->user_rewind ? -1.0f : 1.0f);
|
||||
pass, "IN.frame_direction", Settings.Rewinding ? -1.0f : 1.0f);
|
||||
|
||||
/* ORIG parameter
|
||||
*/
|
||||
|
|
|
@ -645,7 +645,7 @@ void GLSLShader::render(GLuint &orig, int width, int height, int viewport_width,
|
|||
|
||||
GLuint filter = (pass[i].filter == GLSL_UNDEFINED) ?
|
||||
(lastpass ?
|
||||
(gui_config->bilinear_filter ? GL_LINEAR : GL_NEAREST) : GL_NEAREST
|
||||
(Settings.BilinearFilter ? GL_LINEAR : GL_NEAREST) : GL_NEAREST
|
||||
) : pass[i].filter;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, pass[i - 1].texture);
|
||||
|
@ -813,7 +813,7 @@ void GLSLShader::register_uniforms ()
|
|||
glUseProgram (0);
|
||||
}
|
||||
|
||||
void GLSLShader::set_shader_vars (int p)
|
||||
void GLSLShader::set_shader_vars (unsigned int p)
|
||||
{
|
||||
unsigned int texunit = 0;
|
||||
unsigned int offset = 0;
|
||||
|
@ -869,7 +869,7 @@ void GLSLShader::set_shader_vars (int p)
|
|||
if (pass[p].frame_count_mod)
|
||||
shaderFrameCnt %= pass[p].frame_count_mod;
|
||||
setUniform1i(u->FrameCount, (float) shaderFrameCnt);
|
||||
setUniform1i(u->FrameDirection, top_level->user_rewind ? -1.0f : 1.0f);
|
||||
setUniform1i(u->FrameDirection, Settings.Rewinding ? -1.0f : 1.0f);
|
||||
|
||||
setTexCoords (u->TexCoord);
|
||||
setTexCoords (u->LUTTexCoord);
|
||||
|
@ -920,7 +920,7 @@ void GLSLShader::set_shader_vars (int p)
|
|||
/* PASSX parameters, only for third pass and up
|
||||
*/
|
||||
if (p > 2) {
|
||||
for (int i = 1; i < p - 1; i++) {
|
||||
for (unsigned int i = 1; i < p - 1; i++) {
|
||||
float passSize[2] = { (float) pass[i].width, (float) pass[i].height };
|
||||
setUniform2fv(u->Pass[i].InputSize, passSize);
|
||||
setUniform2fv(u->Pass[i].TextureSize, passSize);
|
||||
|
@ -930,7 +930,7 @@ void GLSLShader::set_shader_vars (int p)
|
|||
}
|
||||
|
||||
/* PASSPREV parameter */
|
||||
for (int i = 0; i < p; i++)
|
||||
for (unsigned int i = 0; i < p; i++)
|
||||
{
|
||||
float passSize[2] = { (float) pass[i].width, (float) pass[i].height };
|
||||
setUniform2fv(u->PassPrev[p - i].InputSize, passSize);
|
||||
|
|
|
@ -107,7 +107,7 @@ typedef struct
|
|||
bool load_shader (char *filename);
|
||||
bool load_shader_file (char *filename);
|
||||
void render (GLuint &orig, int width, int height, int viewport_width, int viewport_height, int viewport_x, int viewport_y);
|
||||
void set_shader_vars (int pass);
|
||||
void set_shader_vars (unsigned int pass);
|
||||
void clear_shader_vars (void);
|
||||
void strip_parameter_pragmas(char *buffer);
|
||||
GLuint compile_shader (char *program,
|
||||
|
|
|
@ -437,6 +437,7 @@ void S9xLoadConfigFiles (char **argv, int argc)
|
|||
Settings.DisplayMovieFrame = conf.GetBool("Display::DisplayFrameCount", false);
|
||||
Settings.AutoDisplayMessages = conf.GetBool("Display::MessagesInImage", true);
|
||||
Settings.InitialInfoStringTimeout = conf.GetInt ("Display::MessageDisplayTime", 120);
|
||||
Settings.BilinearFilter = conf.GetBool("Display::BilinearFilter", false);
|
||||
|
||||
// Settings
|
||||
|
||||
|
|
2
snes9x.h
2
snes9x.h
|
@ -422,6 +422,7 @@ struct SSettings
|
|||
bool8 AutoDisplayMessages;
|
||||
uint32 InitialInfoStringTimeout;
|
||||
uint16 DisplayColor;
|
||||
bool8 BilinearFilter;
|
||||
|
||||
bool8 Multi;
|
||||
char CartAName[PATH_MAX + 1];
|
||||
|
@ -442,6 +443,7 @@ struct SSettings
|
|||
bool8 TurboMode;
|
||||
uint32 HighSpeedSeek;
|
||||
bool8 FrameAdvance;
|
||||
bool8 Rewinding;
|
||||
|
||||
bool8 NetPlay;
|
||||
bool8 NetPlayServer;
|
||||
|
|
Loading…
Reference in New Issue