CSPspEmu.Hle.HleThread.MainLoop C# (CSharp) Method

MainLoop() private method

private MainLoop ( ) : void
return void
        protected void MainLoop()
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo(GlobalConfig.ThreadCultureName);
            var Memory = CpuThreadState.CpuProcessor.Memory;
            try
            {
                CpuThreadState.ExecuteAT(CpuThreadState.PC & FastPspMemory.FastMemoryMask);
                CpuThreadState.Syscall(HleEmulatorSpecialAddresses.CODE_PTR_EXIT_THREAD_SYSCALL);
            }
            catch (AccessViolationException AccessViolationException)
            {
                Console.Error.WriteLine(AccessViolationException);

                var Field = typeof(AccessViolationException).GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).Single(FieldInfo => FieldInfo.Name == "_target");
                var Address = (ulong)((IntPtr)Field.GetValue(AccessViolationException)).ToInt64();
                throw (new PspMemory.InvalidAddressException(Address));
                //AccessViolationException.
            }
        }