Beispiel #1
0
        // SDK location: /audio/pspaudio.h:79
        // SDK declaration: int sceAudioOutputBlocking(int channel, int vol, void *buf);
        public int sceAudioOutputBlocking(int channel, int vol, int buf)
        {
            // TODO: proper blocking - this just waits the thread forever
            // Maybe we could hack this differently using a timer and just wait
            // the thread for a second or two?
            KThread thread = _kernel.ActiveThread;

            thread.Delay(16777, true);

            if (buf == 0)
            {
                return(0);
            }

            if (_driver == null)
            {
                return(0);
            }

            IntPtr buffer;

            unsafe
            {
                buffer = new IntPtr(_memorySystem.Translate(( uint )buf));
            }
            _driver.Output(
                channel,
                buffer,
                true,
                vol);

            return(0);
        }
Beispiel #2
0
        public int __sceSasCore(int sasCore, int outBufPtr)
        {
            // TODO: proper blocking - this just waits the thread forever
            // Maybe we could hack this differently using a timer and just wait
            // the thread for a second or two?
            KThread thread = _kernel.ActiveThread;

            thread.Delay(3000000, true);
            return(0);
        }
        // SDK location: /user/pspthreadman.h:335
        // SDK declaration: int sceKernelDelayThreadCB(SceUInt delay);
        public int sceKernelDelayThreadCB(int delay)
        {
            KThread thread = _kernel.ActiveThread;

            if (thread == null)
            {
                return(-1);
            }

            thread.Delay(( uint )delay, true);

            return(0);
        }
Beispiel #4
0
        private void WaitVblank(bool allowCallbacks)
        {
            // This is essentially the same logic in the video driver, but
            // replicated here because the video driver can't wait for callbacks
            long time;

            NativeMethods.QueryPerformanceCounter(out time);
            long elapsed = time - _lastVblankWait;

            if (_lastVblankWait == 0)
            {
                elapsed = 1000;
            }
            else
            {
                // ticks are 100ns, we need us
                elapsed /= (_frequency / 10000);
                if (elapsed == 0)
                {
                    elapsed = 1000;
                }
            }
            _lastVblankWait = time;

            // elapsed now has the number of milliseconds that have elapsed since the last time
            uint fixedElapsed = 16777 - Math.Min(16777, ( uint )elapsed);

            if (fixedElapsed < 1000)
            {
                return;
            }

            // This could be just a return
            if (_kernel.SpeedLocked == false)
            {
                fixedElapsed = 1000;
            }

            KThread thread = _kernel.ActiveThread;

            Debug.Assert(thread != null);
            thread.Delay(fixedElapsed, allowCallbacks);
        }