Exemple #1
0
        public int sceKernelLoadModuleByID(SceUID FileId, uint Flags, SceKernelLMOption *SceKernelLMOption)
        {
            var Args = IoFileMgrForUser.GetFileArgFromHandle(FileId);

            return(sceKernelLoadModuleWithStream(() => { return new FileHandle(Args); }, Args.FullFileName, Flags,
                                                 SceKernelLMOption));
        }
 public int sceIoIoctlAsync(SceUID FileId, uint Command, byte* InputPointer, int InputLength, byte* OutputPointer, int OutputLength)
 {
     var File = GetFileArgFromHandle(FileId);
     File.AsyncLastResult = sceIoIoctl(FileId, Command, InputPointer, InputLength, OutputPointer, OutputLength);
     _DelayIo(IoDelayType.Ioctl);
     return 0;
 }
		public int sceIoLseekAsync(SceUID FileId, long Offset, SeekAnchor Whence)
		{
			var File = HleIoManager.HleIoDrvFileArgPool.Get(FileId);
			File.AsyncLastResult = sceIoLseek(FileId, Offset, Whence);
			_DelayIo(IoDelayType.Seek);
			return 0;
		}
Exemple #4
0
        public int sceIoPollAsync(SceUID FileId, out long Result)
        {
            var File = HleIoManager.HleIoDrvFileArgPool.Get(FileId);

            Result = File.AsyncLastResult;

            return(0);
        }
Exemple #5
0
        public int sceIoLseekAsync(SceUID FileId, long Offset, SeekAnchor Whence)
        {
            var File = HleIoManager.HleIoDrvFileArgPool.Get(FileId);

            File.AsyncLastResult = sceIoLseek(FileId, Offset, Whence);
            _DelayIo(IoDelayType.Seek);
            return(0);
        }
Exemple #6
0
 void IInjectInitialize.Initialize()
 {
     var Iso = IsoLoader.GetIso("../../../pspautotests/input/iotest.iso");
     var Umd = new HleIoDriverIso(Iso);
     HleIoManager.SetDriver("disc:", Umd);
     HleIoManager.Chdir("disc0:/PSP_GAME/USRDIR");
     BootBinFileHandle = IoFileMgrForUser.sceIoOpen("disc0:/PSP_GAME/SYSDIR/BOOT.BIN", HleIoFlags.Read, SceMode.All);
 }
        public SceModule* sceKernelFindModuleByUID(SceUID modid)
        {
            /*
            logWarning("Not implemented sceKernelFindModuleByUID(%d)", modid);

            return uniqueIdFactory.get!Module(modid).sceModule;
            */
            throw(new NotImplementedException());
        }
Exemple #8
0
        public int sceIoIoctlAsync(SceUID FileId, uint Command, byte *InputPointer, int InputLength,
                                   byte *OutputPointer, int OutputLength)
        {
            var File = GetFileArgFromHandle(FileId);

            File.AsyncLastResult = sceIoIoctl(FileId, Command, InputPointer, InputLength, OutputPointer, OutputLength);
            _DelayIo(IoDelayType.Ioctl);
            return(0);
        }
 public SceModule *sceKernelFindModuleByUID(SceUID modid)
 {
     /*
      * logWarning("Not implemented sceKernelFindModuleByUID(%d)", modid);
      *
      * return uniqueIdFactory.get!Module(modid).sceModule;
      */
     throw(new NotImplementedException());
 }
Exemple #10
0
        public int sceIoWriteAsync(SceUID fd, void *data, SceSize size)
        {
            throw(new NotImplementedException());

            /*
             * unimplemented();
             * return -1;
             */
        }
Exemple #11
0
        public int sceIoReadAsync(SceUID FileId, byte *OutputPointer, int OutputSize)
        {
            var File = HleIoManager.HleIoDrvFileArgPool.Get(FileId);

            File.AsyncLastResult = sceIoRead(FileId, OutputPointer, OutputSize);

            _DelayIo(IoDelayType.Read, OutputSize);

            return(0);
        }
        void IInjectInitialize.Initialize()
        {
            var iso = IsoLoader.GetIso("../../../pspautotests/input/iotest.iso");
            var umd = new HleIoDriverIso(iso);

            HleIoManager.SetDriver("disc:", umd);
            HleIoManager.Chdir("disc0:/PSP_GAME/USRDIR");
            BootBinFileHandle =
                IoFileMgrForUser.sceIoOpen("disc0:/PSP_GAME/SYSDIR/BOOT.BIN", HleIoFlags.Read, SceMode.All);
        }
 public int sceIoChangeAsyncPriority(SceUID FileHandle, int Priority)
 {
     return 0;
     //throw(new NotImplementedException());
     /*
     unimplemented_notice();
     //return -1;
     return 0;
     */
 }
Exemple #14
0
        public int sceIoWriteAsync(SceUID FileId, void *data, SceSize size)
        {
            _DelayIo(IoDelayType.Write, (long)size);
            throw (new NotImplementedException());

            /*
             * unimplemented();
             * return -1;
             */
        }
Exemple #15
0
        //[HlePspNotImplemented]
        public int sceIoChangeAsyncPriority(SceUID FileHandle, int Priority)
        {
            return(0);
            //throw(new NotImplementedException());

            /*
             * unimplemented_notice();
             * //return -1;
             * return 0;
             */
        }
Exemple #16
0
        public int sceIoSetAsyncCallback(SceUID FileId, int CallbackId, int NotifyArgument)
        {
            throw(new NotImplementedException());
#if false
            var File     = GetFileArgFromHandle(FileId);
            var Callback = CallbackManager.Callbacks.Get(CallbackId);
            File.Callback         = Callback;
            File.CallbackArgument = NotifyArgument;
            //CallbackManager.ScheduleCallback(Callback);
            return(0);
#endif
        }
		public int sceIoIoctl(SceUID FileHandle, uint Command, byte* InputPointer, int InputLength, byte* OutputPointer, int OutputLength)
		{
			var HleIoDrvFileArg = GetFileArgFromHandle(FileHandle);
			try
			{
				return HleIoDrvFileArg.HleIoDriver.IoIoctl(HleIoDrvFileArg, Command, InputPointer, InputLength, OutputPointer, OutputLength);
			}
			finally
			{
				_DelayIo(IoDelayType.Ioctl);
			}
		}
		public int sceIoCloseAsync(SceUID FileId)
		{
			var File = HleIoManager.HleIoDrvFileArgPool.Get(FileId);
			File.AsyncLastResult = 0;
			sceIoClose(FileId);

			_DelayIo(IoDelayType.Close);

			//HleIoManager.HleIoDrvFileArgPool.Remove(FileHandle);
			
			return 0;
		}
 public int sceIoDclose(SceUID FileId)
 {
     var HleIoDrvFileArg = GetFileArgFromHandle(FileId);
     try
     {
         return HleIoDrvFileArg.HleIoDriver.IoDclose(HleIoDrvFileArg);
     }
     finally
     {
         _DelayIo(IoDelayType.Dclose);
     }
 }
 public int sceIoLseek32(SceUID FileId, int Offset, SeekAnchor Whence)
 {
     try
     {
         var HleIoDrvFileArg = GetFileArgFromHandle(FileId);
         return((int)HleIoDrvFileArg.HleIoDriver.IoLseek(HleIoDrvFileArg, (long)Offset, Whence));
     }
     finally
     {
         _DelayIo(IoDelayType.Seek);
     }
 }
        public int sceIoDclose(SceUID FileId)
        {
            var HleIoDrvFileArg = GetFileArgFromHandle(FileId);

            try
            {
                return(HleIoDrvFileArg.HleIoDriver.IoDclose(HleIoDrvFileArg));
            }
            finally
            {
                _DelayIo(IoDelayType.Dclose);
            }
        }
 public long sceIoLseek(SceUID FileId, long Offset, SeekAnchor Whence)
 {
     // TODO: Works with directories?
     try
     {
         var HleIoDrvFileArg = GetFileArgFromHandle(FileId);
         return(HleIoDrvFileArg.HleIoDriver.IoLseek(HleIoDrvFileArg, Offset, Whence));
     }
     finally
     {
         _DelayIo(IoDelayType.Seek);
     }
 }
Exemple #23
0
        public int sceIoCloseAsync(SceUID FileId)
        {
            var File = HleIoManager.HleIoDrvFileArgPool.Get(FileId);

            File.AsyncLastResult = 0;
            sceIoClose(FileId);

            _DelayIo(IoDelayType.Close);

            //HleIoManager.HleIoDrvFileArgPool.Remove(FileHandle);

            return(0);
        }
 public int sceIoRead(SceUID FileId, byte *OutputPointer, int OutputSize)
 {
     try
     {
         var HleIoDrvFileArg = GetFileArgFromHandle(FileId);
         //Console.WriteLine("sceIoRead: {0}", OutputSize);
         var Result = HleIoDrvFileArg.HleIoDriver.IoRead(HleIoDrvFileArg, OutputPointer, OutputSize);
         //for (int n = 0; n < OutputSize; n++) Console.Write("{0:X},", OutputPointer[n]);
         return(Result);
     }
     finally
     {
         _DelayIo(IoDelayType.Read, OutputSize);
     }
 }
        public int sceIoIoctl(SceUID FileHandle, uint Command, byte *InputPointer, int InputLength, byte *OutputPointer,
                              int OutputLength)
        {
            var HleIoDrvFileArg = GetFileArgFromHandle(FileHandle);

            try
            {
                return(HleIoDrvFileArg.HleIoDriver.IoIoctl(HleIoDrvFileArg, Command, InputPointer, InputLength,
                                                           OutputPointer, OutputLength));
            }
            finally
            {
                _DelayIo(IoDelayType.Ioctl);
            }
        }
		public int sceIoDread(SceUID FileId, HleIoDirent* IoDirent)
		{
			try
			{
				var HleIoDrvFileArg = GetFileArgFromHandle(FileId);
				return HleIoDrvFileArg.HleIoDriver.IoDread(HleIoDrvFileArg, IoDirent);
			}
			catch (Exception Exception)
			{
				Console.Error.WriteLine(Exception);
				return -1;
			}
			finally
			{
				_DelayIo(IoDelayType.Dread);
			}
		}
 public int sceIoClose(SceUID FileId)
 {
     try
     {
         var HleIoDrvFileArg = GetFileArgFromHandle(FileId);
         return(HleIoDrvFileArg.HleIoDriver.IoClose(HleIoDrvFileArg));
     }
     catch (Exception Exception)
     {
         Console.Error.WriteLine(Exception);
         return(-1);
     }
     finally
     {
         _DelayIo(IoDelayType.Close);
     }
 }
 public int sceIoDread(SceUID FileId, HleIoDirent *IoDirent)
 {
     try
     {
         var HleIoDrvFileArg = GetFileArgFromHandle(FileId);
         return(HleIoDrvFileArg.HleIoDriver.IoDread(HleIoDrvFileArg, IoDirent));
     }
     catch (Exception Exception)
     {
         Console.Error.WriteLine(Exception);
         return(-1);
     }
     finally
     {
         _DelayIo(IoDelayType.Dread);
     }
 }
        public int sceIoWrite(SceUID FileId, byte *InputPointer, int InputSize)
        {
            try
            {
                switch ((StdioForUser.StdHandle)FileId)
                {
                case StdioForUser.StdHandle.Out:
                case StdioForUser.StdHandle.Error:
                    ConsoleUtils.SaveRestoreConsoleState(() =>
                    {
                        //Console.BackgroundColor = ConsoleColor.DarkGray;
                        if ((StdioForUser.StdHandle)FileId == StdioForUser.StdHandle.Out)
                        {
                            Console.ForegroundColor = ConsoleColor.Blue;
                        }
                        else
                        {
                            Console.ForegroundColor = ConsoleColor.Red;
                        }
                        //Console.Error.WriteLine("Output: '{0}'", PointerUtils.PtrToString(InputPointer, InputSize, Encoding.UTF8));
                        Console.Error.Write("{0}",
                                            PointerUtils.PtrToString(InputPointer, InputSize, Encoding.UTF8));
                    });
                    return(0);
                }

                try
                {
                    var HleIoDrvFileArg = GetFileArgFromHandle(FileId);
                    return(HleIoDrvFileArg.HleIoDriver.IoWrite(HleIoDrvFileArg, InputPointer, InputSize));
                }
                catch (Exception Exception)
                {
                    Console.Error.WriteLine(Exception);
                    return(-1);
                }
            }
            finally
            {
                _DelayIo(IoDelayType.Write, InputSize);
            }
        }
Exemple #30
0
        public int _sceIoWaitAsyncCB(SceUID FileId, out long Result, bool HandleCallbacks,
                                     CpuThreadState CpuThreadState)
        {
            var File = HleIoManager.HleIoDrvFileArgPool.Get(FileId);

            Result            = File.AsyncLastResult;
            CpuThreadState.Lo = (int)FileId;

            return(0);

            /*
             * logInfo("_sceIoWaitAsyncCB(fd=%d, callbacks=%d)", FileHandle, HandleCallbacks);
             * FileHandle fileHandle = uniqueIdFactory.get!FileHandle(FileHandle);
             * Result = fileHandle.lastOperationResult;
             * if (HandleCallbacks) {
             *  hleEmulatorState.callbacksHandler.executeQueued(currentThreadState);
             * }
             * currentRegisters.LO = FileHandle;
             * return FileHandle;
             */
        }
		public int sceIoWriteAsync(SceUID FileId, void* data, SceSize size)
		{
			_DelayIo(IoDelayType.Write, (long)size);
			throw (new NotImplementedException());
			/*
			unimplemented();
			return -1;
			*/
		}
		//[HlePspNotImplemented]
		public int sceIoWaitAsyncCB(SceUID FileId, out long Result, CpuThreadState CpuThreadState)
		{
			//throw (new NotImplementedException());
			return _sceIoWaitAsyncCB(FileId, out Result, HandleCallbacks: true, CpuThreadState : CpuThreadState);
		}
		public int sceIoPollAsync(SceUID FileId, out long Result)
		{
			var File = HleIoManager.HleIoDrvFileArgPool.Get(FileId);
			Result = File.AsyncLastResult;

			return 0;
		}
Exemple #34
0
 public int sceKernelLoadModuleByID(SceUID FileId, uint Flags, SceKernelLMOption* SceKernelLMOption)
 {
     var Args = IoFileMgrForUser.GetFileArgFromHandle(FileId);
     return sceKernelLoadModuleWithStream(() =>
     {
         return new FileHandle(Args);
     }, Args.FullFileName, Flags, SceKernelLMOption);
 }
		public int _sceIoWaitAsyncCB(SceUID FileId, out long Result, bool HandleCallbacks, CpuThreadState CpuThreadState)
		{
			var File = HleIoManager.HleIoDrvFileArgPool.Get(FileId);
			Result = File.AsyncLastResult;
			CpuThreadState.LO = (int)FileId;

			return 0;
			/*
			logInfo("_sceIoWaitAsyncCB(fd=%d, callbacks=%d)", FileHandle, HandleCallbacks);
			FileHandle fileHandle = uniqueIdFactory.get!FileHandle(FileHandle);
			*Result = fileHandle.lastOperationResult;
			if (HandleCallbacks) {
				hleEmulatorState.callbacksHandler.executeQueued(currentThreadState);
			}
			currentRegisters.LO = FileHandle;
			return FileHandle;
			*/
		}
		public int sceIoLseek32(SceUID FileId, int Offset, SeekAnchor Whence)
		{
			try
			{
				var HleIoDrvFileArg = GetFileArgFromHandle(FileId);
				return (int)HleIoDrvFileArg.HleIoDriver.IoLseek(HleIoDrvFileArg, (long)Offset, Whence);
			}
			finally
			{
				_DelayIo(IoDelayType.Seek);
			}
		}
Exemple #37
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="FileHandle"></param>
		/// <returns></returns>
		public HleIoDrvFileArg GetFileArgFromHandle(SceUID FileHandle)
		{
			return HleIoManager.HleIoDrvFileArgPool.Get(FileHandle);
		}
		public int sceIoLseek32Async(SceUID FileId, uint Offset, SeekAnchor Whence)
		{
			return sceIoLseekAsync(FileId, (long)Offset, Whence);
		}
Exemple #39
0
 public int sceIoCancel(SceUID FileId)
 {
     throw (new NotImplementedException());
 }
		public int sceIoWrite(SceUID FileId, byte* InputPointer, int InputSize)
		{
			try
			{
				switch ((StdioForUser.StdHandle)FileId)
				{
					case StdioForUser.StdHandle.Out:
					case StdioForUser.StdHandle.Error:
						ConsoleUtils.SaveRestoreConsoleState(() =>
						{
							//Console.BackgroundColor = ConsoleColor.DarkGray;
							if ((StdioForUser.StdHandle)FileId == StdioForUser.StdHandle.Out)
							{
								Console.ForegroundColor = ConsoleColor.Blue;
							}
							else
							{
								Console.ForegroundColor = ConsoleColor.Red;
							}
							//Console.Error.WriteLine("Output: '{0}'", PointerUtils.PtrToString(InputPointer, InputSize, Encoding.UTF8));
							Console.Error.Write("{0}", PointerUtils.PtrToString(InputPointer, InputSize, Encoding.UTF8));
						});
						return 0;
				}

				try
				{
					var HleIoDrvFileArg = GetFileArgFromHandle(FileId);
					return HleIoDrvFileArg.HleIoDriver.IoWrite(HleIoDrvFileArg, InputPointer, InputSize);
				}
				catch (Exception Exception)
				{
					Console.Error.WriteLine(Exception);
					return -1;
				}
			}
			finally
			{
				_DelayIo(IoDelayType.Write, InputSize);
			}
		}
		public int sceIoCancel(SceUID FileId)
		{
			throw (new NotImplementedException());
		}
 public int sceIoReopen(string NewFileName, HleIoFlags SceIoFlags, SceMode SceMode, SceUID FileDescriptor)
 {
     throw(new NotImplementedException());
 }
		public long sceIoLseek(SceUID FileId, long Offset, SeekAnchor Whence)
		{
			try
			{
				var HleIoDrvFileArg = GetFileArgFromHandle(FileId);
				return HleIoDrvFileArg.HleIoDriver.IoLseek(HleIoDrvFileArg, Offset, Whence);
			}
			finally
			{
				_DelayIo(IoDelayType.Seek);
			}
		}
		public int sceIoRead(SceUID FileId, byte* OutputPointer, int OutputSize)
		{
			try
			{
				var HleIoDrvFileArg = GetFileArgFromHandle(FileId);
				var Result = HleIoDrvFileArg.HleIoDriver.IoRead(HleIoDrvFileArg, OutputPointer, OutputSize);
				//for (int n = 0; n < OutputSize; n++) Console.Write("{0:X},", OutputPointer[n]);
				return Result;
			}
			finally
			{
				_DelayIo(IoDelayType.Read, OutputSize);
			}
		}
 public int sceIoReopen(string NewFileName, HleIoFlags SceIoFlags, SceMode SceMode, SceUID FileDescriptor)
 {
     //throw(new NotImplementedException());
     return(0);
 }
Exemple #46
0
 //[HlePspNotImplemented]
 public int sceIoWaitAsyncCB(SceUID FileId, out long Result, CpuThreadState CpuThreadState)
 {
     //throw (new NotImplementedException());
     return(_sceIoWaitAsyncCB(FileId, out Result, HandleCallbacks: true, CpuThreadState: CpuThreadState));
 }
		public int sceIoSetAsyncCallback(SceUID FileId, int CallbackId, int NotifyArgument)
		{
			throw(new NotImplementedException());
#if false
			var File = GetFileArgFromHandle(FileId); 
			var Callback = CallbackManager.Callbacks.Get(CallbackId);
			File.Callback = Callback;
			File.CallbackArgument = NotifyArgument;
			//CallbackManager.ScheduleCallback(Callback);
			return 0;
#endif
		}
 public int sceIoWriteAsync(SceUID fd, void* data, SceSize size)
 {
     throw(new NotImplementedException());
     /*
     unimplemented();
     return -1;
     */
 }
		public int sceIoClose(SceUID FileId)
		{
			try
			{
				var HleIoDrvFileArg = GetFileArgFromHandle(FileId);
				return HleIoDrvFileArg.HleIoDriver.IoClose(HleIoDrvFileArg);
			}
			catch (Exception Exception)
			{
				Console.Error.WriteLine(Exception);
				return -1;
			}
			finally
			{
				_DelayIo(IoDelayType.Close);
			}
		}
Exemple #50
0
 public int sceIoLseek32Async(SceUID FileId, uint Offset, SeekAnchor Whence)
 {
     return(sceIoLseekAsync(FileId, (long)Offset, Whence));
 }
		public int sceIoReadAsync(SceUID FileId, byte* OutputPointer, int OutputSize)
		{
			var File = HleIoManager.HleIoDrvFileArgPool.Get(FileId);
			File.AsyncLastResult = sceIoRead(FileId, OutputPointer, OutputSize);

			_DelayIo(IoDelayType.Read, OutputSize);

			return 0;
		}
 /// <summary>
 ///
 /// </summary>
 /// <param name="FileHandle"></param>
 /// <returns></returns>
 public HleIoDrvFileArg GetFileArgFromHandle(SceUID FileHandle)
 {
     return(HleIoManager.HleIoDrvFileArgPool.Get(FileHandle));
 }