aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-03-03 02:24:04 -0300
committergdkchan <gab.dark.100@gmail.com>2018-03-03 02:24:04 -0300
commit646af2498c8ef74546f73ed993f9037e4882493b (patch)
treee01d6505ac42f2a215e896337317cc449830ce48
parentc14c69a10c936f485a4420c93499bd4c3efa8b09 (diff)
Fix paths using ascii instead of utf8 on IFileSystem
-rw-r--r--Ryujinx.Core/OsHle/Services/FspSrv/IFileSystem.cs47
1 files changed, 34 insertions, 13 deletions
diff --git a/Ryujinx.Core/OsHle/Services/FspSrv/IFileSystem.cs b/Ryujinx.Core/OsHle/Services/FspSrv/IFileSystem.cs
index ee9de8bc..7db08154 100644
--- a/Ryujinx.Core/OsHle/Services/FspSrv/IFileSystem.cs
+++ b/Ryujinx.Core/OsHle/Services/FspSrv/IFileSystem.cs
@@ -3,6 +3,7 @@ using Ryujinx.Core.OsHle.Ipc;
using System;
using System.Collections.Generic;
using System.IO;
+using System.Text;
using static Ryujinx.Core.OsHle.IpcServices.ErrorCode;
using static Ryujinx.Core.OsHle.IpcServices.ObjHelper;
@@ -49,7 +50,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
{
long Position = Context.Request.PtrBuff[0].Position;
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
+ string Name = ReadUtf8String(Context.Memory, Position);
long Mode = Context.RequestData.ReadInt64();
int Size = Context.RequestData.ReadInt32();
@@ -83,7 +84,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
{
long Position = Context.Request.PtrBuff[0].Position;
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
+ string Name = ReadUtf8String(Context.Memory, Position);
string FileName = Context.Ns.VFs.GetFullPath(Path, Name);
@@ -106,7 +107,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
{
long Position = Context.Request.PtrBuff[0].Position;
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
+ string Name = ReadUtf8String(Context.Memory, Position);
string DirName = Context.Ns.VFs.GetFullPath(Path, Name);
@@ -144,7 +145,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
{
long Position = Context.Request.PtrBuff[0].Position;
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
+ string Name = ReadUtf8String(Context.Memory, Position);
string DirName = Context.Ns.VFs.GetFullPath(Path, Name);
@@ -168,8 +169,8 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
long OldPosition = Context.Request.PtrBuff[0].Position;
long NewPosition = Context.Request.PtrBuff[0].Position;
- string OldName = AMemoryHelper.ReadAsciiString(Context.Memory, OldPosition);
- string NewName = AMemoryHelper.ReadAsciiString(Context.Memory, NewPosition);
+ string OldName = ReadUtf8String(Context.Memory, OldPosition);
+ string NewName = ReadUtf8String(Context.Memory, NewPosition);
string OldFileName = Context.Ns.VFs.GetFullPath(Path, OldName);
string NewFileName = Context.Ns.VFs.GetFullPath(Path, NewName);
@@ -199,8 +200,8 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
long OldPosition = Context.Request.PtrBuff[0].Position;
long NewPosition = Context.Request.PtrBuff[0].Position;
- string OldName = AMemoryHelper.ReadAsciiString(Context.Memory, OldPosition);
- string NewName = AMemoryHelper.ReadAsciiString(Context.Memory, NewPosition);
+ string OldName = ReadUtf8String(Context.Memory, OldPosition);
+ string NewName = ReadUtf8String(Context.Memory, NewPosition);
string OldDirName = Context.Ns.VFs.GetFullPath(Path, OldName);
string NewDirName = Context.Ns.VFs.GetFullPath(Path, NewName);
@@ -229,7 +230,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
{
long Position = Context.Request.PtrBuff[0].Position;
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
+ string Name = ReadUtf8String(Context.Memory, Position);
string FileName = Context.Ns.VFs.GetFullPath(Path, Name);
@@ -257,7 +258,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
int FilterFlags = Context.RequestData.ReadInt32();
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
+ string Name = ReadUtf8String(Context.Memory, Position);
string FileName = Context.Ns.VFs.GetFullPath(Path, Name);
@@ -293,7 +294,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
int FilterFlags = Context.RequestData.ReadInt32();
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
+ string Name = ReadUtf8String(Context.Memory, Position);
string DirName = Context.Ns.VFs.GetFullPath(Path, Name);
@@ -330,7 +331,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
{
long Position = Context.Request.PtrBuff[0].Position;
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
+ string Name = ReadUtf8String(Context.Memory, Position);
Context.ResponseData.Write(Context.Ns.VFs.GetDrive().AvailableFreeSpace);
@@ -341,7 +342,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
{
long Position = Context.Request.PtrBuff[0].Position;
- string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position);
+ string Name = ReadUtf8String(Context.Memory, Position);
Context.ResponseData.Write(Context.Ns.VFs.GetDrive().TotalSize);
@@ -379,5 +380,25 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
OpenPaths.Remove(DirInterface.HostPath);
}
}
+
+ private string ReadUtf8String(AMemory Memory, long Position)
+ {
+ using (MemoryStream MS = new MemoryStream())
+ {
+ while (true)
+ {
+ byte Value = Memory.ReadByte(Position++);
+
+ if (Value == 0)
+ {
+ break;
+ }
+
+ MS.WriteByte(Value);
+ }
+
+ return Encoding.UTF8.GetString(MS.ToArray());
+ }
+ }
}
} \ No newline at end of file