소스 검색

Fix SystemPathToSwitchPath platform issues and make sure to delete temporary NRO after sessions dispose (#293)

Thomas Guillemard 7 년 전
부모
커밋
c9fc52edb6
3개의 변경된 파일7개의 추가작업 그리고 8개의 파일을 삭제
  1. 0 1
      Ryujinx.HLE/OsHle/Horizon.cs
  2. 5 5
      Ryujinx.HLE/OsHle/Process.cs
  3. 2 2
      Ryujinx.HLE/VirtualFileSystem.cs

+ 0 - 1
Ryujinx.HLE/OsHle/Horizon.cs

@@ -96,7 +96,6 @@ namespace Ryujinx.HLE.OsHle
 
             if (IsNro && (SwitchFilePath == null || !SwitchFilePath.StartsWith("sdmc:/")))
             {
-                // TODO: avoid copying the file if we are already inside a sdmc directory
                 string SwitchPath = $"sdmc:/switch/{Name}{Homebrew.TemporaryNroSuffix}";
                 string TempPath = Ns.VFs.SwitchPathToSystemPath(SwitchPath);
 

+ 5 - 5
Ryujinx.HLE/OsHle/Process.cs

@@ -403,11 +403,6 @@ namespace Ryujinx.HLE.OsHle
         {
             if (Disposing && !Disposed)
             {
-                if (NeedsHbAbi && Executables[0].FilePath.EndsWith(Homebrew.TemporaryNroSuffix))
-                {
-                    File.Delete(Executables[0].FilePath);
-                }
-
                 //If there is still some thread running, disposing the objects is not
                 //safe as the thread may try to access those resources. Instead, we set
                 //the flag to have the Process disposed when all threads finishes.
@@ -431,6 +426,11 @@ namespace Ryujinx.HLE.OsHle
                     }
                 }
 
+                if (NeedsHbAbi && Executables.Count > 0 && Executables[0].FilePath.EndsWith(Homebrew.TemporaryNroSuffix))
+                {
+                    File.Delete(Executables[0].FilePath);
+                }
+
                 INvDrvServices.UnloadProcess(this);
 
                 AppletState.Dispose();

+ 2 - 2
Ryujinx.HLE/VirtualFileSystem.cs

@@ -57,11 +57,11 @@ namespace Ryujinx.HLE
 
         public string SystemPathToSwitchPath(string SystemPath)
         {
-            string BaseSystemPath = GetBasePath() + "/";
+            string BaseSystemPath = GetBasePath() + Path.DirectorySeparatorChar;
             if (SystemPath.StartsWith(BaseSystemPath))
             {
                 string RawPath = SystemPath.Replace(BaseSystemPath, "");
-                int FirstSeparatorOffset = RawPath.IndexOf('/');
+                int FirstSeparatorOffset = RawPath.IndexOf(Path.DirectorySeparatorChar);
                 if (FirstSeparatorOffset == -1)
                 {
                     return $"{RawPath}:/";