Пример #1
0
void
Snes9xNetplayDialog::settings_to_dialog ()
{
    set_entry_text ("rom_image", config->netplay_last_rom);
    set_entry_text ("ip_entry", config->netplay_last_host);
    set_check ("sync_reset", config->netplay_sync_reset);
    set_check ("send_image", config->netplay_send_rom);
    set_spin ("port", config->netplay_last_port);
    set_spin ("default_port", config->netplay_default_port);
    set_spin ("frames_behind", config->netplay_max_frame_loss);
    set_check ("connect_radio", !config->netplay_is_server);
    set_check ("host_radio", config->netplay_is_server);

    update_state ();
}
GtkWidget*
group_settings_dialog_new (OobsGroup *group)
{
    GtkWidget *dialog, *widget;
    const gchar *name;
    gchar *title;

    dialog = gst_dialog_get_widget (tool->main_dialog, "group_settings_dialog");
    name = oobs_group_get_name (group);

    if (!name) {
        g_object_set_data (G_OBJECT (dialog), "is_new", GINT_TO_POINTER (FALSE));
        gtk_window_set_title (GTK_WINDOW (dialog), _("New group"));

        widget = gst_dialog_get_widget (tool->main_dialog, "group_settings_gid");
        gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget),
                                   group_settings_find_new_gid ());
    } else {
        g_object_set_data (G_OBJECT (dialog), "is_new", GINT_TO_POINTER (FALSE));

        title = g_strdup_printf (_("Group '%s' Properties"), name);
        gtk_window_set_title (GTK_WINDOW (dialog), title);
        g_free (title);

        widget = gst_dialog_get_widget (tool->main_dialog, "group_settings_gid");
        gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), oobs_group_get_gid (group));
    }

    widget = gst_dialog_get_widget (tool->main_dialog, "group_settings_name");
    set_entry_text (widget, name);

    group_members_table_set_from_group (group);

    return dialog;
}
Пример #3
0
void
Snes9xPreferences::bindings_to_dialog (int joypad)
{
    char    name[256];
    Binding *bindings = (Binding *) &pad[joypad];

    set_combo ("control_combo", joypad);

    for (int i = 0; i < NUM_JOYPAD_LINKS; i++)
    {
        bindings[i].to_string (name);
        set_entry_text (b_links[i].button_name, name);
    }

    for (int i = NUM_JOYPAD_LINKS; b_links[i].button_name; i++)
    {
        shortcut[i - NUM_JOYPAD_LINKS].to_string (name);
        set_entry_text (b_links[i].button_name, name);
    }

    return;
}
Пример #4
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;
}
Пример #5
0
void
Snes9xPreferences::move_settings_to_dialog (void)
{
    set_check ("full_screen_on_open",       config->full_screen_on_open);
    set_check ("show_frame_rate",           Settings.DisplayFrameRate);
    set_check ("change_display_resolution", config->change_display_resolution);
    set_check ("scale_to_fit",              config->scale_to_fit);
    set_check ("overscan",                  config->overscan);
    set_check ("multithreading",            config->multithreading);
    set_combo ("hires_effect",              config->hires_effect);
    set_check ("maintain_aspect_ratio",     config->maintain_aspect_ratio);
    set_combo ("aspect_ratio",              config->aspect_ratio);
    if (config->sram_directory[0] == '\0')
        set_entry_text ("sram_directory", SAME_GAME);
    else
        set_entry_text ("sram_directory", config->sram_directory);
    if (config->savestate_directory[0] == '\0')
        set_entry_text ("savestate_directory", SAME_GAME);
    else
        set_entry_text ("savestate_directory", config->savestate_directory);
    if (config->patch_directory[0] == '\0')
        set_entry_text ("patch_directory", SAME_GAME);
    else
        set_entry_text ("patch_directory", config->patch_directory);
    if (config->cheat_directory[0] == '\0')
        set_entry_text ("cheat_directory", SAME_GAME);
    else
        set_entry_text ("cheat_directory", config->cheat_directory);
    if (config->export_directory[0] == '\0')
        set_entry_text ("export_directory", SAME_GAME);
    else
        set_entry_text ("export_directory", config->export_directory);

    set_combo ("resolution_combo",          config->xrr_index);
    set_combo ("scale_method_combo",        config->scale_method);
    set_entry_value ("save_sram_after_sec", Settings.AutoSaveDelay);
    set_check ("block_invalid_vram_access", Settings.BlockInvalidVRAMAccessMaster);
    set_check ("upanddown",                 Settings.UpAndDown);
    set_combo ("default_esc_behavior",      config->default_esc_behavior);
    set_check ("prevent_screensaver",       config->prevent_screensaver);
    set_check ("force_inverted_byte_order", config->force_inverted_byte_order);
    set_check ("stereo_check",              Settings.Stereo);
    set_combo ("playback_combo",            7 - config->sound_playback_rate);
    set_combo ("hw_accel",                  combo_value (config->hw_accel));
    set_check ("pause_emulation_on_switch", config->pause_emulation_on_switch);
    set_spin  ("num_threads",               config->num_threads);
    set_check ("mute_sound_check",          config->mute_sound);
    set_check ("mute_sound_turbo_check",    config->mute_sound_turbo);
    set_spin  ("sound_buffer_size",         config->sound_buffer_size);
    set_slider ("sound_input_rate",         config->sound_input_rate);
    set_check ("sync_sound",                Settings.SoundSync);
    set_spin  ("rewind_buffer_size",        config->rewind_buffer_size);
    set_spin  ("rewind_granularity",        config->rewind_granularity);

    int num_sound_drivers = 0;
#ifdef USE_PORTAUDIO
    num_sound_drivers++;
#endif
#ifdef USE_OSS
    num_sound_drivers++;
#endif
#ifdef USE_JOYSTICK
    num_sound_drivers++;
#endif
#ifdef USE_ALSA
    num_sound_drivers++;
#endif
#ifdef USE_PULSEAUDIO
    num_sound_drivers++;
#endif

    if (config->sound_driver >= num_sound_drivers)
        config->sound_driver = 0;

    set_combo ("sound_driver",              config->sound_driver);

    if (config->scale_method == FILTER_NTSC)
    {
        gtk_widget_show (get_widget ("ntsc_frame"));
    }
    else
    {
        gtk_widget_hide (get_widget ("ntsc_frame"));
    }

    if (config->scale_method == FILTER_SCANLINES)
    {
        gtk_widget_show (get_widget ("scanline_filter_frame"));
    }
    else
    {
        gtk_widget_hide (get_widget ("scanline_filter_frame"));
    }

    load_ntsc_settings ();
    set_combo ("ntsc_scanline_intensity",   config->ntsc_scanline_intensity);
    set_combo ("scanline_filter_intensity", config->scanline_filter_intensity);

    set_combo ("frameskip_combo",
               Settings.SkipFrames == AUTO_FRAMERATE ?
                   0 : Settings.SkipFrames + 1);
    set_check ("bilinear_filter",           config->bilinear_filter);

#ifdef USE_OPENGL
    set_check ("sync_to_vblank",            config->sync_to_vblank);
    set_check ("sync_every_frame",          config->sync_every_frame);
    set_check ("use_pbos",                  config->use_pbos);
    set_combo ("pixel_format",              config->pbo_format);
    set_check ("npot_textures",             config->npot_textures);
    set_check ("use_shaders",               config->use_shaders);
    set_entry_text ("fragment_shader",      config->fragment_shader);
#endif

#ifdef USE_JOYSTICK
    set_spin ("joystick_threshold",         config->joystick_threshold);
#else
    gtk_widget_set_sensitive (get_widget ("joystick_box"), FALSE);
#endif

    /* Control bindings */
    memcpy (pad, config->pad, (sizeof (JoypadBinding)) * NUM_JOYPADS);
    memcpy (shortcut, config->shortcut, (sizeof (Binding)) * NUM_EMU_LINKS);
    bindings_to_dialog (0);

    set_combo ("joypad_to_swap_with", 0);

    return;
}