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

GetMemoryPtrSafeWithError() public method

public GetMemoryPtrSafeWithError ( uint Address, String ErrorDescription, bool CanBeNull, InvalidAddressAsEnum Invalid ) : void*
Address uint
ErrorDescription String
CanBeNull bool
Invalid InvalidAddressAsEnum
return void*
        public void* GetMemoryPtrSafeWithError(uint Address, String ErrorDescription, bool CanBeNull, InvalidAddressAsEnum Invalid)
        {
            //Console.Error.WriteLine("{0:X8}, {1}, {2}", Address, CanBeNull, InvalidAsNull);
            try
            {
                void* Result = Memory.PspAddressToPointerSafe(Address, 0, CanBeNull);
                /*
                if (Result == null && !CanBeNull)
                {
                    throw(new PspMemory.InvalidAddressException(""));
                }
                */
                return Result;
            }
            catch (InvalidAddressException InvalidAddressException)
            {
                if (Invalid == InvalidAddressAsEnum.Null) return null;
                if (Invalid == InvalidAddressAsEnum.InvalidAddress) return PspMemory.InvalidPointer;
                throw (new InvalidAddressException("GetMemoryPtrSafeWithError:" + ErrorDescription + " : " + InvalidAddressException.Message, InvalidAddressException));
            }
            catch (Exception Exception)
            {
                if (Invalid == InvalidAddressAsEnum.Null) return null;
                if (Invalid == InvalidAddressAsEnum.InvalidAddress) return PspMemory.InvalidPointer;
                throw (new Exception("GetMemoryPtrSafeWithError: " + ErrorDescription + " : " + Exception.Message, Exception));
            }
        }