コード例 #1
0
        public static void dumpThreads()
        {
            ThreadManForUser threadMan = Modules.ThreadManForUserModule;

            for (IEnumerator <SceKernelThreadInfo> it = threadMan.GetEnumerator(); it.MoveNext();)
            {
                SceKernelThreadInfo thread = it.Current;

                log("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
                log(string.Format("Thread Name: '{0}' ID: 0x{1:X4} Module ID: 0x{2:X4}", thread.name, thread.uid, thread.moduleid));
                log(string.Format("Thread Status: 0x{0:X8} {1}", thread.status, thread.StatusName));
                log(string.Format("Thread Attr: 0x{0:X8} Current Priority: 0x{1:X2} Initial Priority: 0x{2:X2}", thread.attr, thread.currentPriority, thread.initPriority));
                log(string.Format("Thread Entry: 0x{0:X8} Stack: 0x{1:X8} - 0x{2:X8} Stack Size: 0x{3:X8}", thread.entry_addr, thread.StackAddr, thread.StackAddr + thread.stackSize, thread.stackSize));
                log(string.Format("Thread Run Clocks: {0:D} Exit Code: 0x{1:X8}", thread.runClocks, thread.exitStatus));
                log(string.Format("Thread Wait Type: {0} Us: {1:D} Forever: {2}", thread.WaitName, thread.wait.micros, thread.wait.forever));
            }
        }
コード例 #2
0
        private void onMbxDeletedCancelled(int mbxid, int result)
        {
            ThreadManForUser threadMan  = Modules.ThreadManForUserModule;
            bool             reschedule = false;

            for (IEnumerator <SceKernelThreadInfo> it = threadMan.GetEnumerator(); it.MoveNext();)
            {
                SceKernelThreadInfo thread = it.Current;
                if (thread.isWaitingFor(PSP_WAIT_MBX, mbxid))
                {
                    thread.cpuContext._v0 = result;
                    threadMan.hleChangeThreadState(thread, PSP_THREAD_READY);
                    reschedule = true;
                }
            }
            // Reschedule only if threads waked up.
            if (reschedule)
            {
                threadMan.hleRescheduleCurrentThread();
            }
        }
コード例 #3
0
        private void onLwMutexDeleted(int lwmid)
        {
            ThreadManForUser threadMan  = Modules.ThreadManForUserModule;
            bool             reschedule = false;

            for (IEnumerator <SceKernelThreadInfo> it = threadMan.GetEnumerator(); it.MoveNext();)
            {
                SceKernelThreadInfo thread = it.Current;
                if (thread.isWaitingFor(PSP_WAIT_LWMUTEX, lwmid))
                {
                    thread.cpuContext._v0 = ERROR_KERNEL_WAIT_DELETE;
                    threadMan.hleChangeThreadState(thread, PSP_THREAD_READY);
                    reschedule = true;
                }
            }
            // Reschedule only if threads waked up.
            if (reschedule)
            {
                threadMan.hleRescheduleCurrentThread();
            }
        }