Add StorageHelper
This commit is contained in:
parent
a7f08b8ded
commit
bff6464c54
4 changed files with 30 additions and 63 deletions
|
@ -27,12 +27,10 @@ namespace Ryujinx.Core.OsHle.Services.Am
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private const uint LaunchParamsMagic = 0xc79497ca;
|
|
||||||
|
|
||||||
public long PopLaunchParameter(ServiceCtx Context)
|
public long PopLaunchParameter(ServiceCtx Context)
|
||||||
{
|
{
|
||||||
//Only the first 0x18 bytes of the Data seems to be actually used.
|
//Only the first 0x18 bytes of the Data seems to be actually used.
|
||||||
MakeObject(Context, new IStorage(MakeLaunchParams()));
|
MakeObject(Context, new IStorage(StorageHelper.MakeLaunchParams()));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -116,23 +114,5 @@ namespace Ryujinx.Core.OsHle.Services.Am
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] MakeLaunchParams()
|
|
||||||
{
|
|
||||||
//Size needs to be at least 0x88 bytes otherwise application errors.
|
|
||||||
using (MemoryStream MS = new MemoryStream())
|
|
||||||
{
|
|
||||||
BinaryWriter Writer = new BinaryWriter(MS);
|
|
||||||
|
|
||||||
MS.SetLength(0x88);
|
|
||||||
|
|
||||||
Writer.Write(LaunchParamsMagic);
|
|
||||||
Writer.Write(1); //IsAccountSelected? Only lower 8 bits actually used.
|
|
||||||
Writer.Write(1L); //User Id Low (note: User Id needs to be != 0)
|
|
||||||
Writer.Write(0L); //User Id High
|
|
||||||
|
|
||||||
return MS.ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,6 @@ namespace Ryujinx.Core.OsHle.Services.Am
|
||||||
StateChangedEvent = new KEvent();
|
StateChangedEvent = new KEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private const uint LaunchParamsMagic = 0xc79497ca;
|
|
||||||
|
|
||||||
public long GetAppletStateChangedEvent(ServiceCtx Context)
|
public long GetAppletStateChangedEvent(ServiceCtx Context)
|
||||||
{
|
{
|
||||||
StateChangedEvent.WaitEvent.Set();
|
StateChangedEvent.WaitEvent.Set();
|
||||||
|
@ -66,27 +64,9 @@ namespace Ryujinx.Core.OsHle.Services.Am
|
||||||
|
|
||||||
public long PopOutData(ServiceCtx Context)
|
public long PopOutData(ServiceCtx Context)
|
||||||
{
|
{
|
||||||
MakeObject(Context, new IStorage(MakeLaunchParams()));
|
MakeObject(Context, new IStorage(StorageHelper.MakeLaunchParams()));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] MakeLaunchParams()
|
|
||||||
{
|
|
||||||
//Size needs to be at least 0x88 bytes otherwise application errors.
|
|
||||||
using (MemoryStream MS = new MemoryStream())
|
|
||||||
{
|
|
||||||
BinaryWriter Writer = new BinaryWriter(MS);
|
|
||||||
|
|
||||||
MS.SetLength(0x88);
|
|
||||||
|
|
||||||
Writer.Write(LaunchParamsMagic);
|
|
||||||
Writer.Write(1); //IsAccountSelected? Only lower 8 bits actually used.
|
|
||||||
Writer.Write(1L); //User Id Low (note: User Id needs to be != 0)
|
|
||||||
Writer.Write(0L); //User Id High
|
|
||||||
|
|
||||||
return MS.ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -19,8 +19,6 @@ namespace Ryujinx.Core.OsHle.Services.Am
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private const uint LaunchParamsMagic = 0xc79497ca;
|
|
||||||
|
|
||||||
public long CreateLibraryApplet(ServiceCtx Context)
|
public long CreateLibraryApplet(ServiceCtx Context)
|
||||||
{
|
{
|
||||||
MakeObject(Context, new ILibraryAppletAccessor());
|
MakeObject(Context, new ILibraryAppletAccessor());
|
||||||
|
@ -30,27 +28,9 @@ namespace Ryujinx.Core.OsHle.Services.Am
|
||||||
|
|
||||||
public long CreateStorage(ServiceCtx Context)
|
public long CreateStorage(ServiceCtx Context)
|
||||||
{
|
{
|
||||||
MakeObject(Context, new IStorage(MakeLaunchParams()));
|
MakeObject(Context, new IStorage(StorageHelper.MakeLaunchParams()));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] MakeLaunchParams()
|
|
||||||
{
|
|
||||||
//Size needs to be at least 0x88 bytes otherwise application errors.
|
|
||||||
using (MemoryStream MS = new MemoryStream())
|
|
||||||
{
|
|
||||||
BinaryWriter Writer = new BinaryWriter(MS);
|
|
||||||
|
|
||||||
MS.SetLength(0x88);
|
|
||||||
|
|
||||||
Writer.Write(LaunchParamsMagic);
|
|
||||||
Writer.Write(1); //IsAccountSelected? Only lower 8 bits actually used.
|
|
||||||
Writer.Write(1L); //User Id Low (note: User Id needs to be != 0)
|
|
||||||
Writer.Write(0L); //User Id High
|
|
||||||
|
|
||||||
return MS.ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
27
Ryujinx.Core/OsHle/Services/Am/StorageHelper.cs
Normal file
27
Ryujinx.Core/OsHle/Services/Am/StorageHelper.cs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace Ryujinx.Core.OsHle.Services.Am
|
||||||
|
{
|
||||||
|
class StorageHelper
|
||||||
|
{
|
||||||
|
private const uint LaunchParamsMagic = 0xc79497ca;
|
||||||
|
|
||||||
|
public static byte[] MakeLaunchParams()
|
||||||
|
{
|
||||||
|
//Size needs to be at least 0x88 bytes otherwise application errors.
|
||||||
|
using (MemoryStream MS = new MemoryStream())
|
||||||
|
{
|
||||||
|
BinaryWriter Writer = new BinaryWriter(MS);
|
||||||
|
|
||||||
|
MS.SetLength(0x88);
|
||||||
|
|
||||||
|
Writer.Write(LaunchParamsMagic);
|
||||||
|
Writer.Write(1); //IsAccountSelected? Only lower 8 bits actually used.
|
||||||
|
Writer.Write(1L); //User Id Low (note: User Id needs to be != 0)
|
||||||
|
Writer.Write(0L); //User Id High
|
||||||
|
|
||||||
|
return MS.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue