Example #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;
}
Example #2
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;
}
Example #3
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;
}