void
S9xNetplayDialogOpen (void)
{
    Snes9xNetplayDialog *np_dialog;

    top_level->pause_from_focus_change ();

    np_dialog = new Snes9xNetplayDialog (gui_config);

    gtk_window_set_transient_for (np_dialog->get_window (),
                                  top_level->get_window ());

    if (np_dialog->show ())
    {
        if (!gui_config->netplay_is_server)
        {
            S9xNetplayConnect ();
        }
        else
        {
            S9xNetplayStartServer ();
        }

        S9xSoundStart ();
    }

    delete np_dialog;

    top_level->unpause_from_focus_change ();

    return;
}
int
S9xNetplayPush (void)
{
    static int statusbar_state = FALSE;

    if (gui_config->netplay_activated &&
        (!Settings.NetPlay || !NetPlay.Connected))
        S9xNetplayDisconnect ();

    if (!Settings.NetPlay)
        return 0;

    if (NetPlay.PendingWait4Sync && !S9xNPWaitForHeartBeatDelay (100))
    {
        S9xProcessEvents (FALSE);

        S9xSoundStop ();
        NetPlay.Paused = TRUE;

        if (statusbar_state == FALSE)
        {
            top_level->update_statusbar ();
            statusbar_state = TRUE;
        }

        return 1;
    }

    NetPlay.Paused = FALSE;

    if (statusbar_state)
    {
        top_level->update_statusbar ();
        statusbar_state = FALSE;
    }

    S9xSoundStart ();

    /* Save the joypad input */
    for (int i = 0; i < 8; i++)
    {
        local_joypads[i] = MovieGetJoypad (i);

        MovieSetJoypad (i, joypads[i]);
    }

    if (NetPlay.PendingWait4Sync)
    {
        NetPlay.PendingWait4Sync = FALSE;
        NetPlay.FrameCount++;
        S9xNPStepJoypadHistory ();
    }

    return 0;
}
示例#3
0
文件: gtk_s9x.cpp 项目: orbea/snes9x
void
S9xROMLoaded (void)
{
    gui_config->rom_loaded = TRUE;
    top_level->configure_widgets ();

    if (gui_config->full_screen_on_open)
    {
        Settings.Paused = FALSE;
        top_level->enter_fullscreen_mode ();
    }

    S9xSoundStart ();

    return;
}
示例#4
0
gboolean
S9xPauseFunc (gpointer data)
{
    S9xProcessEvents (TRUE);

    if (!gui_config->rom_loaded)
        return TRUE;

#ifdef NETPLAY_SUPPORT
    if (!S9xNetplayPush ())
    {
        S9xNetplayPop ();
    }
#endif

    if (!Settings.Paused) /* Coming out of pause */
    {
#ifdef USE_JOYSTICK
        /* Clear joystick queues */
        gui_config->flush_joysticks ();
#endif

        S9xSetSoundMute (FALSE);
        S9xSoundStart ();

#ifdef NETPLAY_SUPPORT
        if (Settings.NetPlay && NetPlay.Connected)
        {
            S9xNPSendPause (FALSE);
        }
#endif

        /* Resume high-performance callback */
        idle_func_id = g_idle_add_full (IDLE_FUNC_PRIORITY,
                                        S9xIdleFunc,
                                        NULL,
                                        NULL);
        top_level->update_statusbar ();
        return FALSE;
    }

    return TRUE;
}