Save shader parameters.

This commit is contained in:
Brandon Wright 2018-05-12 16:22:27 -05:00
parent 6ad137aca2
commit fac1174f6b
7 changed files with 27 additions and 3 deletions

View File

@ -334,7 +334,7 @@ Snes9xConfig::save_config_file (void)
xml_out_int (xml, "force_inverted_byte_order", force_inverted_byte_order);
xml_out_int (xml, "multithreading", multithreading);
xml_out_string (xml, "last_directory", last_directory);
xml_out_string (xml, "last_directory", last_shader_directory);
xml_out_string (xml, "last_shader_directory", last_shader_directory);
xml_out_string (xml, "sram_directory", sram_directory);
xml_out_string (xml, "savestate_directory", savestate_directory);
xml_out_string (xml, "cheat_directory", cheat_directory);

View File

@ -16,7 +16,8 @@ class S9xDisplayDriver
virtual uint16 *get_current_buffer (void) = 0;
virtual void push_buffer (uint16 *src) = 0;
virtual void reconfigure (int width, int height) = 0;
virtual void *get_parameters () = 0;
virtual void *get_parameters (void) = 0;
virtual void save (void) = 0;
/* Namespaced sizing constants */
static const int image_width = 1024;

View File

@ -18,6 +18,7 @@ class S9xGTKDisplayDriver : public S9xDisplayDriver
void push_buffer (uint16 *src);
void reconfigure (int width, int height);
void *get_parameters (void) { return NULL; }
void save (void) { }
private:
void clear (void);

View File

@ -282,6 +282,17 @@ S9xOpenGLDisplayDriver::get_parameters(void)
return NULL;
}
void
S9xOpenGLDisplayDriver::save (void)
{
if (using_glsl_shaders && glsl_shader)
{
glsl_shader->save();
}
return;
}
void
S9xOpenGLDisplayDriver::clear_buffers (void)
{

View File

@ -40,6 +40,7 @@ class S9xOpenGLDisplayDriver : public S9xDisplayDriver
void push_buffer (uint16 *src);
void reconfigure (int width, int height);
void *get_parameters (void);
void save (void);
static int query_availability (void);
private:

View File

@ -25,6 +25,7 @@ class S9xXVDisplayDriver : public S9xDisplayDriver
void push_buffer (uint16 *src);
void reconfigure (int width, int height);
void *get_parameters (void) { return NULL; }
void save (void) { }
static int query_availability (void);
private:

View File

@ -493,8 +493,11 @@ event_auto_input_rate_toggled (GtkToggleButton *togglebutton, gpointer data)
static void
event_shader_parameters (GtkButton *widget, gpointer data)
{
S9xDisplayDriver *driver = S9xDisplayGetDriver ();
Snes9xPreferences *preferences = (Snes9xPreferences *) data;
#ifdef USE_OPENGL
if (!S9xDisplayGetDriver () || !S9xDisplayGetDriver ()->get_parameters () || !gtk_shader_parameters_dialog (top_level->get_window ()))
if (!driver || !driver->get_parameters () || !gtk_shader_parameters_dialog (top_level->get_window ()))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (top_level->get_window(),
@ -509,6 +512,12 @@ event_shader_parameters (GtkButton *widget, gpointer data)
return;
}
else
{
driver->save();
preferences->set_entry_text ("fragment_shader", preferences->config->fragment_shader);
}
#endif
}