aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-03-03 14:04:58 -0300
committergdkchan <gab.dark.100@gmail.com>2018-03-03 14:04:58 -0300
commit7d48886750dadf839eb2bb37e3a81314b5497c36 (patch)
treebcaa7f14974ec7a00d40829ecb9f14805be131c3
parent646af2498c8ef74546f73ed993f9037e4882493b (diff)
Fix Rename* functions on FspSrv, add a separate class do hold system settings on Switch
-rw-r--r--Ryujinx.Core/OsHle/Services/FspSrv/IFileSystem.cs41
-rw-r--r--Ryujinx.Core/OsHle/Services/Set/ServiceSetSys.cs4
-rw-r--r--Ryujinx.Core/Settings/ColorSet.cs8
-rw-r--r--Ryujinx.Core/Settings/SetSys.cs7
-rw-r--r--Ryujinx.Core/Switch.cs11
5 files changed, 44 insertions, 27 deletions
diff --git a/Ryujinx.Core/OsHle/Services/FspSrv/IFileSystem.cs b/Ryujinx.Core/OsHle/Services/FspSrv/IFileSystem.cs
index 7db08154..3593bafb 100644
--- a/Ryujinx.Core/OsHle/Services/FspSrv/IFileSystem.cs
+++ b/Ryujinx.Core/OsHle/Services/FspSrv/IFileSystem.cs
@@ -50,7 +50,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
{
long Position = Context.Request.PtrBuff[0].Position;
- string Name = ReadUtf8String(Context.Memory, Position);
+ string Name = ReadUtf8String(Context);
long Mode = Context.RequestData.ReadInt64();
int Size = Context.RequestData.ReadInt32();
@@ -84,7 +84,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
{
long Position = Context.Request.PtrBuff[0].Position;
- string Name = ReadUtf8String(Context.Memory, Position);
+ string Name = ReadUtf8String(Context);
string FileName = Context.Ns.VFs.GetFullPath(Path, Name);
@@ -107,7 +107,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
{
long Position = Context.Request.PtrBuff[0].Position;
- string Name = ReadUtf8String(Context.Memory, Position);
+ string Name = ReadUtf8String(Context);
string DirName = Context.Ns.VFs.GetFullPath(Path, Name);
@@ -145,7 +145,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
{
long Position = Context.Request.PtrBuff[0].Position;
- string Name = ReadUtf8String(Context.Memory, Position);
+ string Name = ReadUtf8String(Context);
string DirName = Context.Ns.VFs.GetFullPath(Path, Name);
@@ -166,11 +166,8 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
public long RenameFile(ServiceCtx Context)
{
- long OldPosition = Context.Request.PtrBuff[0].Position;
- long NewPosition = Context.Request.PtrBuff[0].Position;
-
- string OldName = ReadUtf8String(Context.Memory, OldPosition);
- string NewName = ReadUtf8String(Context.Memory, NewPosition);
+ string OldName = ReadUtf8String(Context, 0);
+ string NewName = ReadUtf8String(Context, 1);
string OldFileName = Context.Ns.VFs.GetFullPath(Path, OldName);
string NewFileName = Context.Ns.VFs.GetFullPath(Path, NewName);
@@ -197,11 +194,8 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
public long RenameDirectory(ServiceCtx Context)
{
- long OldPosition = Context.Request.PtrBuff[0].Position;
- long NewPosition = Context.Request.PtrBuff[0].Position;
-
- string OldName = ReadUtf8String(Context.Memory, OldPosition);
- string NewName = ReadUtf8String(Context.Memory, NewPosition);
+ string OldName = ReadUtf8String(Context, 0);
+ string NewName = ReadUtf8String(Context, 1);
string OldDirName = Context.Ns.VFs.GetFullPath(Path, OldName);
string NewDirName = Context.Ns.VFs.GetFullPath(Path, NewName);
@@ -230,7 +224,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
{
long Position = Context.Request.PtrBuff[0].Position;
- string Name = ReadUtf8String(Context.Memory, Position);
+ string Name = ReadUtf8String(Context);
string FileName = Context.Ns.VFs.GetFullPath(Path, Name);
@@ -258,7 +252,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
int FilterFlags = Context.RequestData.ReadInt32();
- string Name = ReadUtf8String(Context.Memory, Position);
+ string Name = ReadUtf8String(Context);
string FileName = Context.Ns.VFs.GetFullPath(Path, Name);
@@ -294,7 +288,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
int FilterFlags = Context.RequestData.ReadInt32();
- string Name = ReadUtf8String(Context.Memory, Position);
+ string Name = ReadUtf8String(Context);
string DirName = Context.Ns.VFs.GetFullPath(Path, Name);
@@ -331,7 +325,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
{
long Position = Context.Request.PtrBuff[0].Position;
- string Name = ReadUtf8String(Context.Memory, Position);
+ string Name = ReadUtf8String(Context);
Context.ResponseData.Write(Context.Ns.VFs.GetDrive().AvailableFreeSpace);
@@ -342,7 +336,7 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
{
long Position = Context.Request.PtrBuff[0].Position;
- string Name = ReadUtf8String(Context.Memory, Position);
+ string Name = ReadUtf8String(Context);
Context.ResponseData.Write(Context.Ns.VFs.GetDrive().TotalSize);
@@ -381,13 +375,16 @@ namespace Ryujinx.Core.OsHle.IpcServices.FspSrv
}
}
- private string ReadUtf8String(AMemory Memory, long Position)
+ private string ReadUtf8String(ServiceCtx Context, int Index = 0)
{
+ long Position = Context.Request.PtrBuff[Index].Position;
+ long Size = Context.Request.PtrBuff[Index].Size;
+
using (MemoryStream MS = new MemoryStream())
{
- while (true)
+ while (Size-- > 0)
{
- byte Value = Memory.ReadByte(Position++);
+ byte Value = Context.Memory.ReadByte(Position++);
if (Value == 0)
{
diff --git a/Ryujinx.Core/OsHle/Services/Set/ServiceSetSys.cs b/Ryujinx.Core/OsHle/Services/Set/ServiceSetSys.cs
index 68b30354..41c5d8b3 100644
--- a/Ryujinx.Core/OsHle/Services/Set/ServiceSetSys.cs
+++ b/Ryujinx.Core/OsHle/Services/Set/ServiceSetSys.cs
@@ -22,8 +22,8 @@ namespace Ryujinx.Core.OsHle.IpcServices.Set
public static long GetColorSetId(ServiceCtx Context)
{
- //Use white system theme
- Context.ResponseData.Write(1);
+ Context.ResponseData.Write((int)Context.Ns.Settings.ThemeColor);
+
return 0;
}
diff --git a/Ryujinx.Core/Settings/ColorSet.cs b/Ryujinx.Core/Settings/ColorSet.cs
new file mode 100644
index 00000000..43483363
--- /dev/null
+++ b/Ryujinx.Core/Settings/ColorSet.cs
@@ -0,0 +1,8 @@
+namespace Ryujinx.Core.Settings
+{
+ public enum ColorSet
+ {
+ BasicWhite = 0,
+ BasicBlack = 1
+ }
+}
diff --git a/Ryujinx.Core/Settings/SetSys.cs b/Ryujinx.Core/Settings/SetSys.cs
new file mode 100644
index 00000000..d8b6eb6e
--- /dev/null
+++ b/Ryujinx.Core/Settings/SetSys.cs
@@ -0,0 +1,7 @@
+namespace Ryujinx.Core.Settings
+{
+ public class SetSys
+ {
+ public ColorSet ThemeColor;
+ }
+}
diff --git a/Ryujinx.Core/Switch.cs b/Ryujinx.Core/Switch.cs
index 0d5f8e72..6f41da81 100644
--- a/Ryujinx.Core/Switch.cs
+++ b/Ryujinx.Core/Switch.cs
@@ -1,6 +1,7 @@
using ChocolArm64.Memory;
using Ryujinx.Core.Input;
using Ryujinx.Core.OsHle;
+using Ryujinx.Core.Settings;
using Ryujinx.Graphics.Gal;
using Ryujinx.Graphics.Gpu;
using System;
@@ -15,7 +16,9 @@ namespace Ryujinx.Core
internal NsGpu Gpu { get; private set; }
internal Horizon Os { get; private set; }
internal VirtualFs VFs { get; private set; }
- public Hid Hid { get; private set; }
+
+ public Hid Hid { get; private set; }
+ public SetSys Settings { get; private set; }
public event EventHandler Finish;
@@ -24,9 +27,11 @@ namespace Ryujinx.Core
Ram = Marshal.AllocHGlobal((IntPtr)AMemoryMgr.RamSize);
Gpu = new NsGpu(Renderer);
- Os = new Horizon(this);
VFs = new VirtualFs();
- Hid = new Hid(this);
+
+ Hid = new Hid(this);
+ Os = new Horizon(this);
+ Settings = new SetSys();
}
public void FinalizeAllProcesses()