SMO stubs and implementations (#129)

* WIP SMO stubs and implementations

* fixes?

* Add StorageHelper

* Whoops

* Compliant with review.

* Remove unnecessary usings
This commit is contained in:
Starlet
2018-06-02 18:46:09 -04:00
committed by gdkchan
parent f03a43fa38
commit 250e2084f4
22 changed files with 449 additions and 109 deletions

View File

@@ -174,14 +174,14 @@ namespace Ryujinx.Core.OsHle.Services.Nv
private static int ProcessIoctl(ServiceCtx Context, int Cmd, IoctlProcessor Processor)
{
if (CmdIn(Cmd) && Context.Request.GetBufferType0x21Position() == 0)
if (CmdIn(Cmd) && Context.Request.GetBufferType0x21().Position == 0)
{
Context.Ns.Log.PrintError(LogClass.ServiceNv, "Input buffer is null!");
return NvResult.InvalidInput;
}
if (CmdOut(Cmd) && Context.Request.GetBufferType0x22Position() == 0)
if (CmdOut(Cmd) && Context.Request.GetBufferType0x22().Position == 0)
{
Context.Ns.Log.PrintError(LogClass.ServiceNv, "Output buffer is null!");

View File

@@ -37,8 +37,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS
private static int BindChannel(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@@ -47,8 +47,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS
private static int AllocSpace(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuASAllocSpace Args = AMemoryHelper.Read<NvGpuASAllocSpace>(Context.Memory, InputPosition);
@@ -84,8 +84,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS
private static int FreeSpace(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuASAllocSpace Args = AMemoryHelper.Read<NvGpuASAllocSpace>(Context.Memory, InputPosition);
@@ -101,8 +101,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS
private static int UnmapBuffer(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuASUnmapBuffer Args = AMemoryHelper.Read<NvGpuASUnmapBuffer>(Context.Memory, InputPosition);
@@ -118,8 +118,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS
private static int MapBufferEx(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuASMapBufferEx Args = AMemoryHelper.Read<NvGpuASMapBufferEx>(Context.Memory, InputPosition);
@@ -190,8 +190,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS
private static int GetVaRegions(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@@ -200,8 +200,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS
private static int InitializeEx(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@@ -210,7 +210,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuAS
private static int Remap(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
NvGpuASRemap Args = AMemoryHelper.Read<NvGpuASRemap>(Context.Memory, InputPosition);

View File

@@ -38,7 +38,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu
private static int ZcullGetCtxSize(ServiceCtx Context)
{
long OutputPosition = Context.Request.GetBufferType0x22Position();
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuGpuZcullGetCtxSize Args = new NvGpuGpuZcullGetCtxSize();
@@ -53,7 +53,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu
private static int ZcullGetInfo(ServiceCtx Context)
{
long OutputPosition = Context.Request.GetBufferType0x22Position();
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuGpuZcullGetInfo Args = new NvGpuGpuZcullGetInfo();
@@ -77,8 +77,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu
private static int ZbcSetTable(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@@ -87,8 +87,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu
private static int GetCharacteristics(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuGpuGetCharacteristics Args = AMemoryHelper.Read<NvGpuGpuGetCharacteristics>(Context.Memory, InputPosition);
@@ -137,8 +137,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu
private static int GetTpcMasks(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuGpuGetTpcMasks Args = AMemoryHelper.Read<NvGpuGpuGetTpcMasks>(Context.Memory, InputPosition);
@@ -154,7 +154,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu
private static int GetActiveSlotMask(ServiceCtx Context)
{
long OutputPosition = Context.Request.GetBufferType0x22Position();
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvGpuGpuGetActiveSlotMask Args = new NvGpuGpuGetActiveSlotMask();
@@ -170,7 +170,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvGpuGpu
private static int GetGpuTime(ServiceCtx Context)
{
long OutputPosition = Context.Request.GetBufferType0x22Position();
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Memory.WriteInt64(OutputPosition, GetPTimerNanoSeconds());

View File

@@ -27,8 +27,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel
private static int SetUserData(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@@ -37,8 +37,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel
private static int SetNvMap(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@@ -47,8 +47,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel
private static int SubmitGpfifo(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvHostChannelSubmitGpfifo Args = AMemoryHelper.Read<NvHostChannelSubmitGpfifo>(Context.Memory, InputPosition);
@@ -79,8 +79,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel
private static int AllocObjCtx(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@@ -89,8 +89,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel
private static int ZcullBind(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@@ -99,8 +99,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel
private static int SetErrorNotifier(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@@ -109,8 +109,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel
private static int SetPriority(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
@@ -119,8 +119,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostChannel
private static int AllocGpfifoEx2(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Ns.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");

View File

@@ -40,7 +40,7 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl
private static int SyncptIncr(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
int Id = Context.Memory.ReadInt32(InputPosition);
@@ -71,8 +71,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl
private static int GetConfig(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
string Nv = AMemoryHelper.ReadAsciiString(Context.Memory, InputPosition + 0, 0x41);
string Name = AMemoryHelper.ReadAsciiString(Context.Memory, InputPosition + 0x41, 0x41);
@@ -96,8 +96,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl
private static int EventRegister(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
int EventId = Context.Memory.ReadInt32(InputPosition);
@@ -108,8 +108,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl
private static int SyncptReadMinOrMax(ServiceCtx Context, bool Max)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvHostCtrlSyncptRead Args = AMemoryHelper.Read<NvHostCtrlSyncptRead>(Context.Memory, InputPosition);
@@ -134,8 +134,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl
private static int SyncptWait(ServiceCtx Context, bool Extended)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvHostCtrlSyncptWait Args = AMemoryHelper.Read<NvHostCtrlSyncptWait>(Context.Memory, InputPosition);
@@ -202,8 +202,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvHostCtrl
private static int EventWait(ServiceCtx Context, bool Async)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvHostCtrlSyncptWaitEx Args = AMemoryHelper.Read<NvHostCtrlSyncptWaitEx>(Context.Memory, InputPosition);

View File

@@ -36,8 +36,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap
private static int Create(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvMapCreate Args = AMemoryHelper.Read<NvMapCreate>(Context.Memory, InputPosition);
@@ -61,8 +61,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap
private static int FromId(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvMapFromId Args = AMemoryHelper.Read<NvMapFromId>(Context.Memory, InputPosition);
@@ -86,8 +86,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap
private static int Alloc(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvMapAlloc Args = AMemoryHelper.Read<NvMapAlloc>(Context.Memory, InputPosition);
@@ -149,8 +149,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap
private static int Free(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvMapFree Args = AMemoryHelper.Read<NvMapFree>(Context.Memory, InputPosition);
@@ -188,8 +188,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap
private static int Param(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvMapParam Args = AMemoryHelper.Read<NvMapParam>(Context.Memory, InputPosition);
@@ -222,8 +222,8 @@ namespace Ryujinx.Core.OsHle.Services.Nv.NvMap
private static int GetId(ServiceCtx Context)
{
long InputPosition = Context.Request.GetBufferType0x21Position();
long OutputPosition = Context.Request.GetBufferType0x22Position();
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
NvMapGetId Args = AMemoryHelper.Read<NvMapGetId>(Context.Memory, InputPosition);