Exemplo n.º 1
0
    // Emulates 'runsamples' number of samples, or until a video frame has to be drawn. (1 sample = 2 cpu cycles)
    public int RunFor(int runsamples)
    {
        int videoFrameDoneSampleCount = Libgambatte.gambatte_runfor(Handle, VideoBuffer, 160, AudioBuffer, ref runsamples);
        int outsamples = videoFrameDoneSampleCount >= 0 ? BufferSamples + videoFrameDoneSampleCount : BufferSamples + runsamples;

        BufferSamples   += runsamples;
        BufferSamples   -= outsamples;
        EmulatedSamples += (ulong)outsamples;

        if (Scene != null)
        {
            Scene.OnAudioReady(outsamples);
            // returns a positive value if the video frame hass been completed.
            if (videoFrameDoneSampleCount >= 0)
            {
                Scene.Begin();
                Scene.Render();
                Scene.End();
            }
        }

        return(runsamples);
    }
Exemplo n.º 2
0
    // Emulates 'runsamples' number of samples, or until a video frame has to be drawn. (1 sample = 2 cpu cycles)
    public int RunFor(int runsamples)
    {
        int videoFrameDoneSampleCount = Libgambatte.gambatte_runfor(Handle, VideoBuffer, 160, AudioBuffer, ref runsamples);
        int outsamples = videoFrameDoneSampleCount >= 0 ? BufferSamples + videoFrameDoneSampleCount : BufferSamples + runsamples;

        BufferSamples   += runsamples;
        BufferSamples   -= outsamples;
        EmulatedSamples += (ulong)outsamples;

        if (Scene != null)
        {
            Scene.OnAudioReady(outsamples);
            // returns a positive value if a video frame needs to be drawn.
            if (videoFrameDoneSampleCount >= 0)
            {
                Scene.Begin();
                Scene.Render();
                Scene.End();
            }
        }

        return(Libgambatte.gambatte_gethitinterruptaddress(Handle));
    }