Exemple #1
0
void App::on_echo_filter_unchecked()
{
	spin_filter_echo_buffer_size->set_enabled(false);
	get_slider(spin_filter_echo_buffer_size)->set_enabled(false);
	spin_filter_echo_shift_factor->set_enabled(false);
	get_slider(spin_filter_echo_shift_factor)->set_enabled(false);
	btn_set_soundoutput_filters->set_enabled(true);
}
Exemple #2
0
void App::on_slider_changed_float(Spin *spin)
{
	Slider *slider = get_slider(spin);

	float position = (float) slider->get_position();

	position -= slider->get_min();
	float max = (float) (slider->get_max() + 1 - slider->get_min());

	float spin_min = spin->get_min_float();
	float spin_max = spin->get_max_float();
	float spin_range = spin_max - spin_min;

	float value = (position * spin_range) / max;
	value += spin_min;
	if (value < spin_min)
		value = spin_min;

	if (value > spin_max)
		value = spin_max;

	spin->set_value_float(value);
	spin_value_modified(spin);

}
Exemple #3
0
void
Snes9xPreferences::store_ntsc_settings (void)
{
    config->ntsc_setup.artifacts    = get_slider ("ntsc_artifacts");
    config->ntsc_setup.bleed        = get_slider ("ntsc_bleed");
    config->ntsc_setup.brightness   = get_slider ("ntsc_brightness");
    config->ntsc_setup.contrast     = get_slider ("ntsc_contrast");
    config->ntsc_setup.fringing     = get_slider ("ntsc_fringing");
    config->ntsc_setup.gamma        = get_slider ("ntsc_gamma");
    config->ntsc_setup.hue          = get_slider ("ntsc_hue");
    config->ntsc_setup.merge_fields = get_check  ("ntsc_merge_fields");
    config->ntsc_setup.resolution   = get_slider ("ntsc_resolution");
    config->ntsc_setup.saturation   = get_slider ("ntsc_saturation");
    config->ntsc_setup.sharpness    = get_slider ("ntsc_sharpness");

    return;
}
Exemple #4
0
static void set_slider_to(int s, float v, int snap) {
    if (snap && snap_states[s] != snap) {
        if (ABS(get_slider(s) - v) > params.ui.snap_threshold)
            return;
    }
    v = CLAMP(v, 0., 1.);

    if(s == crossfader_selection_top || s == crossfader_selection_bot) {
        crossfader.position = v;
    } else {
        struct pattern * p = selected_pattern(s);
        if(p != NULL)
            p->intensity = v;
    }

    snap_states[s] = snap;
}
Exemple #5
0
void App::on_slider_changed_integer(Spin *spin)
{
	Slider *slider = get_slider(spin);

	int position = slider->get_position();

	position -= slider->get_min();
	int max = (slider->get_max() + 1 - slider->get_min());

	int spin_min = spin->get_min();
	int spin_max = spin->get_max();
	int spin_range = spin_max - spin_min;

	int value = (position * spin_range) / max;
	value += spin_min;
	if (value < spin_min)
		value = spin_min;

	if (value > spin_max)
		value = spin_max;

	spin->set_value(value);
	spin_value_modified(spin);
}
Exemple #6
0
static void increment_slider(int s, float v) {
    set_slider_to(s, v + get_slider(s), 0);
}
Exemple #7
0
void
Snes9xPreferences::get_settings_from_dialog (void)
{
    int sound_needs_restart = 0;
    int gfx_needs_restart = 0;

    if ((config->sound_driver       != get_combo ("sound_driver"))          ||
        (config->mute_sound         != get_check ("mute_sound_check"))      ||
        (config->sound_buffer_size  != (int) get_spin ("sound_buffer_size"))||
        (Settings.Stereo            != get_check ("stereo_check"))          ||
        (config->sound_playback_rate !=
                     (7 - (get_combo ("playback_combo"))))                  ||
        (config->sound_input_rate   != get_slider ("sound_input_rate"))     ||
        (Settings.SoundSync         != get_check ("sync_sound"))
        )
    {
        sound_needs_restart = 1;
    }

#ifdef USE_XRANDR
    if ((config->change_display_resolution != get_check ("change_display_resolution") ||
            (config->change_display_resolution &&
                    (config->xrr_index != get_combo ("resolution_combo")))) &&
        config->fullscreen)
    {
        top_level->leave_fullscreen_mode ();
        config->xrr_index = get_combo ("resolution_combo");
        config->xrr_width = config->xrr_sizes[config->xrr_index].width;
        config->xrr_height = config->xrr_sizes[config->xrr_index].height;
        config->change_display_resolution = get_check ("change_display_resolution");
        top_level->enter_fullscreen_mode ();
    }
    else
    {
        config->xrr_index = get_combo ("resolution_combo");
        config->xrr_width = config->xrr_sizes[config->xrr_index].width;
        config->xrr_height = config->xrr_sizes[config->xrr_index].height;
    }
#endif

    config->change_display_resolution = get_check ("change_display_resolution");

    if (config->multithreading != get_check ("multithreading"))
        gfx_needs_restart = 1;

    if (config->hw_accel != hw_accel_value (get_combo ("hw_accel")))
        gfx_needs_restart = 1;

    if (config->force_inverted_byte_order != get_check ("force_inverted_byte_order"))
        gfx_needs_restart = 1;

#ifdef USE_OPENGL
#endif

    config->full_screen_on_open       = get_check ("full_screen_on_open");
    Settings.DisplayFrameRate         = get_check ("show_frame_rate");
    config->scale_to_fit              = get_check ("scale_to_fit");
    config->overscan                  = get_check ("overscan");
    config->maintain_aspect_ratio     = get_check ("maintain_aspect_ratio");
    config->aspect_ratio              = get_combo ("aspect_ratio");
    config->scale_method              = get_combo ("scale_method_combo");
    config->hires_effect              = get_combo ("hires_effect");
    config->force_inverted_byte_order = get_check ("force_inverted_byte_order");
    Settings.AutoSaveDelay            = get_entry_value ("save_sram_after_sec");
    config->multithreading            = get_check ("multithreading");
    config->pause_emulation_on_switch = get_check ("pause_emulation_on_switch");
    Settings.SkipFrames               = get_combo ("frameskip_combo");
    Settings.BlockInvalidVRAMAccessMaster   = get_check ("block_invalid_vram_access");
    Settings.UpAndDown                = get_check ("upanddown");
    config->sound_driver              = get_combo ("sound_driver");
    Settings.Stereo                   = get_check ("stereo_check");
    config->sound_playback_rate       = 7 - (get_combo ("playback_combo"));
    config->sound_buffer_size         = get_spin ("sound_buffer_size");
    config->sound_input_rate          = get_slider ("sound_input_rate");
    Settings.SoundSync                = get_check ("sync_sound");
    config->mute_sound                = get_check ("mute_sound_check");
    config->mute_sound_turbo          = get_check ("mute_sound_turbo_check");

    store_ntsc_settings ();
    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");
    config->num_threads               = get_spin ("num_threads");
    config->default_esc_behavior      = get_combo ("default_esc_behavior");
    config->prevent_screensaver       = get_check ("prevent_screensaver");
    config->rewind_buffer_size        = get_spin ("rewind_buffer_size");
    config->rewind_granularity        = get_spin ("rewind_granularity");

#ifdef USE_JOYSTICK
    config->joystick_threshold        = get_spin ("joystick_threshold");
#endif

#ifdef USE_OPENGL
    if (config->sync_to_vblank != get_check ("sync_to_vblank") ||
        config->npot_textures != get_check ("npot_textures") ||
        config->use_pbos != get_check ("use_pbos") ||
        config->pbo_format != get_combo ("pixel_format") ||
        config->use_shaders != get_check ("use_shaders") ||
        get_check ("use_shaders"))
    {
        gfx_needs_restart = 1;
    }

    config->sync_to_vblank            = get_check ("sync_to_vblank");
    config->use_pbos                  = get_check ("use_pbos");
    config->npot_textures             = get_check ("npot_textures");
    config->use_shaders               = get_check ("use_shaders");
    config->sync_every_frame          = get_check ("sync_every_frame");

    strncpy (config->fragment_shader, get_entry_text ("fragment_shader"), PATH_MAX);

    config->pbo_format = get_combo ("pixel_format");
#endif
    char safety_sram_directory [PATH_MAX];

    strncpy (safety_sram_directory, get_entry_text ("sram_directory"), PATH_MAX);
    strncpy (config->savestate_directory, get_entry_text ("savestate_directory"), PATH_MAX);
    strncpy (config->patch_directory, get_entry_text ("patch_directory"), PATH_MAX);
    strncpy (config->cheat_directory, get_entry_text ("cheat_directory"), PATH_MAX);
    strncpy (config->export_directory, get_entry_text ("export_directory"), PATH_MAX);

    if (!strcmp (safety_sram_directory, SAME_GAME))
        safety_sram_directory[0] = '\0';
    if (!strcmp (config->savestate_directory, SAME_GAME))
        config->savestate_directory[0] = '\0';
    if (!strcmp (config->patch_directory, SAME_GAME))
        config->patch_directory[0] = '\0';
    if (!strcmp (config->cheat_directory, SAME_GAME))
        config->cheat_directory[0] = '\0';
    if (!strcmp (config->export_directory, SAME_GAME))
        config->export_directory[0] = '\0';

    if (strcmp (safety_sram_directory, config->sram_directory) && config->rom_loaded)
    {
        GtkWidget *msg;
        int responseid;

        msg = gtk_message_dialog_new (GTK_WINDOW (this->window),
                                      GTK_DIALOG_DESTROY_WITH_PARENT,
                                      GTK_MESSAGE_WARNING,
                                      GTK_BUTTONS_OK_CANCEL,
                                      _("Changing the SRAM directory with a game loaded will replace the .srm file in the selected directory with the SRAM from the running game. If this is not what you want, click 'cancel'."));
        gtk_window_set_title (GTK_WINDOW (msg), _("Warning: Possible File Overwrite"));

        responseid = gtk_dialog_run (GTK_DIALOG (msg));

        if (responseid == GTK_RESPONSE_OK)
        {
            strncpy (config->sram_directory, safety_sram_directory, PATH_MAX);
        }
        else
        {
            if (config->sram_directory[0] == '\0')
                set_entry_text ("sram_directory", SAME_GAME);
            else
                set_entry_text ("sram_directory", config->sram_directory);
        }

        gtk_widget_destroy (msg);
    }
    else
    {
        strncpy (config->sram_directory, safety_sram_directory, PATH_MAX);
    }

    if (Settings.SkipFrames == 0)
        Settings.SkipFrames = AUTO_FRAMERATE;
    else
        Settings.SkipFrames--;

    memcpy (config->pad, pad, (sizeof (JoypadBinding)) * NUM_JOYPADS);
    memcpy (config->shortcut, shortcut, (sizeof (Binding)) * NUM_EMU_LINKS);

    if (sound_needs_restart)
    {
        S9xPortSoundReinit ();
    }

    if (gfx_needs_restart)
    {
        S9xReinitDisplay ();
    }

    S9xDisplayReconfigure ();
    S9xDisplayRefresh (top_level->last_width, top_level->last_height);

    S9xDeinitUpdate (top_level->last_width, top_level->last_height);

    top_level->configure_widgets ();

    if (config->default_esc_behavior != ESC_TOGGLE_MENUBAR)
        top_level->leave_fullscreen_mode ();

    return;
}
Exemple #8
0
void App::set_spin_value(Spin *spin, float value)
{
	spin->set_value_float(value);
	set_slider_to_spin_float(get_slider(spin), spin);
}
Exemple #9
0
void App::set_spin_value(Spin *spin, int value)
{
	spin->set_value(value);
	set_slider_to_spin_integer(get_slider(spin), spin);
}
Exemple #10
0
void App::use_selected_session()
{
	if (selected_sound_session.is_null)
	{
		spin_session_position->set_enabled(false);
		spin_session_frequency->set_enabled(false);
		spin_session_volume->set_enabled(false);
		spin_session_pan->set_enabled(false);
		spin_session_fade_volume->set_enabled(false);
		spin_session_fade_duration->set_enabled(false);

		get_slider(spin_session_position)->set_enabled(false);
		get_slider(spin_session_frequency)->set_enabled(false);
		get_slider(spin_session_volume)->set_enabled(false);
		get_slider(spin_session_pan)->set_enabled(false);
		get_slider(spin_session_fade_volume)->set_enabled(false);
		get_slider(spin_session_fade_duration)->set_enabled(false);

		btn_set_fade_filter->set_enabled(false);
		btn_sess_play->set_enabled(false);
		btn_sess_stop->set_enabled(false);
		btn_sess_destroy->set_enabled(false);
		chk_looping->set_enabled(false);
		return;
	}
	spin_session_position->set_enabled(true);
	spin_session_frequency->set_enabled(true);
	spin_session_volume->set_enabled(true);
	spin_session_pan->set_enabled(true);

	bool fade_enabled = !selected_sound_session.fade_filter.is_null();

	spin_session_fade_volume->set_enabled(fade_enabled);
	spin_session_fade_duration->set_enabled(fade_enabled);

	get_slider(spin_session_position)->set_enabled(true);
	get_slider(spin_session_frequency)->set_enabled(true);
	get_slider(spin_session_volume)->set_enabled(true);
	get_slider(spin_session_pan)->set_enabled(true);
	get_slider(spin_session_fade_volume)->set_enabled(fade_enabled);
	get_slider(spin_session_fade_duration)->set_enabled(fade_enabled);

	set_spin_value(spin_session_position, selected_sound_session.session.get_position_relative());
	set_spin_value(spin_session_frequency, selected_sound_session.session.get_frequency());
	set_spin_value(spin_session_volume, selected_sound_session.session.get_volume());
	set_spin_value(spin_session_pan, selected_sound_session.session.get_pan());

	btn_set_fade_filter->set_enabled(fade_enabled);

	if (selected_sound_session.session.is_playing())
	{
		btn_sess_play->set_enabled(false);
		btn_sess_stop->set_enabled(true);
	}
	else
	{
		btn_sess_play->set_enabled(true);
		btn_sess_stop->set_enabled(false);
	}

	btn_sess_destroy->set_enabled(true);

	chk_looping->set_checked(selected_sound_session.session.get_looping());
	chk_looping->set_enabled(true);
}
Exemple #11
0
void App::on_spin_changed_float(Spin *spin)
{
	set_slider_to_spin_float(get_slider(spin), spin);
	spin_value_modified(spin);
}
Exemple #12
0
void App::on_spin_changed_integer(Spin *spin)
{
	set_slider_to_spin_integer(get_slider(spin), spin);
	spin_value_modified(spin);
}
Exemple #13
0
void App::on_inverse_echo_filter_unchecked()
{
	spin_filter_inverse_echo_buffer_size->set_enabled(false);
	get_slider(spin_filter_inverse_echo_buffer_size)->set_enabled(false);
	btn_set_soundoutput_filters->set_enabled(true);
}
Exemple #14
0
void App::on_fade_filter_unchecked()
{
	spin_filter_fade_volume->set_enabled(false);
	get_slider(spin_filter_fade_volume)->set_enabled(false);
	btn_set_soundoutput_filters->set_enabled(true);
}