Esempio n. 1
0
gboolean
S9xIdleFunc (gpointer data)
{
    if (needs_fullscreening)
    {
        top_level->enter_fullscreen_mode();
        needs_fullscreening = FALSE;
    }

    if (Settings.Paused)
    {
        S9xSetSoundMute (gui_config->mute_sound);
        S9xSoundStop ();

#ifdef USE_JOYSTICK
        gui_config->flush_joysticks ();
#endif

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

        /* Move to a timer-based function to use less CPU */
        g_timeout_add (100, S9xPauseFunc, NULL);
        top_level->update_statusbar ();
        return FALSE;
    }

    if (syncing)
        S9xSyncSpeedFinish ();

    S9xCheckPointerTimer ();

    S9xProcessEvents (TRUE);

#ifdef NETPLAY_SUPPORT
    if (!S9xNetplayPush ())
    {
#endif
        
    if(top_level->user_rewind)
        top_level->user_rewind = stateMan.pop();
    else if(IPPU.TotalEmulatedFrames % gui_config->rewindGranularity == 0)
        stateMan.push();
        
    S9xMainLoop ();
    S9xMixSound ();

#ifdef NETPLAY_SUPPORT
        S9xNetplayPop ();
    }
#endif

    return TRUE;
}
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;
}
Esempio n. 3
0
void
S9xNoROMLoaded (void)
{
    S9xSoundStop ();
    gui_config->rom_loaded = FALSE;
    S9xDisplayRefresh (-1, -1);
    top_level->configure_widgets ();
    top_level->update_statusbar ();

    return;
}
Esempio n. 4
0
gboolean
S9xIdleFunc (gpointer data)
{
    if (needs_fullscreening)
    {
        top_level->enter_fullscreen_mode();
        needs_fullscreening = FALSE;
    }

    if (Settings.Paused)
    {
        S9xSetSoundMute (gui_config->mute_sound);
        S9xSoundStop ();

#ifdef USE_JOYSTICK
        gui_config->flush_joysticks ();
#endif

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

        /* Move to a timer-based function to use less CPU */
        g_timeout_add (100, S9xPauseFunc, NULL);
        top_level->update_statusbar ();
        return FALSE;
    }

    if (syncing)
        S9xSyncSpeedFinish ();

    S9xCheckPointerTimer ();

    S9xProcessEvents (TRUE);

#ifdef NETPLAY_SUPPORT
    if (!S9xNetplayPush ())
    {
#endif

    if(Settings.Rewinding)
    {
        uint16 joypads[8];
        for (int i = 0; i < 8; i++)
            joypads[i] = MovieGetJoypad(i);

        Settings.Rewinding = stateMan.pop();

        for (int i = 0; i < 8; i++)
            MovieSetJoypad (i, joypads[i]);
    }
    else if(IPPU.TotalEmulatedFrames % gui_config->rewind_granularity == 0)
        stateMan.push();

    static int muted_from_turbo = FALSE;
    static int mute_saved_state = FALSE;

    if (Settings.TurboMode && !muted_from_turbo && gui_config->mute_sound_turbo)
    {
        muted_from_turbo = TRUE;
        mute_saved_state = Settings.Mute;
        S9xSetSoundMute (TRUE);
    }

    if (!Settings.TurboMode && muted_from_turbo)
    {
        muted_from_turbo = FALSE;
        Settings.Mute = mute_saved_state;
    }

    S9xMainLoop ();

#ifdef NETPLAY_SUPPORT
        S9xNetplayPop ();
    }
#endif

    return TRUE;
}