CSPspEmu.Core.Cpu.CpuThreadState.CopyRegistersFrom C# (CSharp) Method

CopyRegistersFrom() public method

public CopyRegistersFrom ( CpuThreadState that ) : void
that CpuThreadState
return void
        public unsafe void CopyRegistersFrom(CpuThreadState that)
        {
            this.PC = that.PC;
            this.Fcr31 = that.Fcr31;
            this.IC = that.IC;
            this.LO = that.LO;
            this.HI = that.HI;
            fixed (float* ThisFPR = &this.FPR0)
            fixed (float* ThatFPR = &that.FPR0)
            fixed (uint* ThisGPR = &this.GPR0)
            fixed (uint* ThatGPR = &that.GPR0)
            {
                for (int n = 0; n < 32; n++)
                {
                    ThisFPR[n] = ThatFPR[n];
                    ThisGPR[n] = ThatGPR[n];
                }
            }

            fixed (float* ThisVFR = &this.VFR0)
            fixed (float* ThatVFR = &that.VFR0)
            {
                for (int n = 0; n < 128; n++)
                {
                    ThisVFR[n] = ThatVFR[n];
                }
            }
        }

Usage Example

Example #1
0
        public int ExecuteQueued(CpuThreadState CpuThreadState, bool MustReschedule)
        {
            int ExecutedCount = 0;

            if (HasScheduledCallbacks)
            {
                //Console.Error.WriteLine("STARTED CALLBACKS");
                while (HasScheduledCallbacks)
                {
                    var HleCallback = DequeueScheduledCallback();

                    var FakeCpuThreadState = new CpuThreadState(CpuProcessor);
                    FakeCpuThreadState.CopyRegistersFrom(CpuThreadState);
                    HleCallback.SetArgumentsToCpuThreadState(FakeCpuThreadState);

                    try
                    {
                        HleInterop.Execute(FakeCpuThreadState);
                    }
                    finally
                    {
                        ExecutedCount++;
                    }

                    //Console.Error.WriteLine("  CALLBACK ENDED : " + HleCallback);
                    if (MustReschedule)
                    {
                        //Console.Error.WriteLine("    RESCHEDULE");
                        break;
                    }
                }
                //Console.Error.WriteLine("ENDED CALLBACKS");
            }

            return ExecutedCount;
        }
All Usage Examples Of CSPspEmu.Core.Cpu.CpuThreadState::CopyRegistersFrom