コード例 #1
0
        public override void run()
        {
            setLog4jMDC();
            bool doCoreInterpret = false;

            while (!exit_Renamed)
            {
                PspGeList list = ExternalGE.CurrentList;

                if (list == null)
                {
                    if (!Emulator.pause && log.DebugEnabled)
                    {
                        Console.WriteLine(string.Format("CoreThread no current list available... waiting"));
                    }

                    waitForSync(100);
                }
                else if (doCoreInterpret || list.waitForSync(100))
                {
                    InsideRendering = true;

                    doCoreInterpret      = false;
                    NativeUtils.CoreMadr = list.Pc;
                    NativeUtils.updateMemoryUnsafeAddr();

                    //if (log.DebugEnabled)
                    {
                        Console.WriteLine(string.Format("CoreThread processing {0}", list));
                    }

                    while (NativeUtils.coreInterpret())
                    {
                        NativeUtils.updateMemoryUnsafeAddr();

                        //if (log.DebugEnabled)
                        {
                            list.Pc = NativeUtils.CoreMadr;
                            Console.WriteLine(string.Format("CoreThread looping {0}", list));
                        }

                        if (ExternalGE.numberRendererThread > 0 && NativeUtils.RendererIndexCount > 0)
                        {
                            break;
                        }
                    }

                    list.Pc = NativeUtils.CoreMadr;

                    int intrStat = NativeUtils.CoreIntrStat;
                    if ((intrStat & INTR_STAT_END) != 0)
                    {
                        if ((intrStat & INTR_STAT_SIGNAL) != 0)
                        {
                            executeCommandSIGNAL(list);
                        }
                        if ((intrStat & INTR_STAT_FINISH) != 0)
                        {
                            executeCommandFINISH(list);
                        }
                        intrStat &= ~(INTR_STAT_END | INTR_STAT_SIGNAL | INTR_STAT_FINISH);
                        NativeUtils.CoreIntrStat = intrStat;
                    }

                    if (ExternalGE.numberRendererThread > 0 && NativeUtils.RendererIndexCount > 0)
                    {
                        ExternalGE.render();
                        doCoreInterpret = true;
                    }

                    InsideRendering = false;
                }
            }

            Console.WriteLine(string.Format("CoreThread exited"));
        }