NvResult is back

This commit is contained in:
Ac_K 2019-07-14 20:09:42 +02:00
parent c94b28a6f1
commit bf5a3afe22
7 changed files with 81 additions and 81 deletions

View file

@ -197,14 +197,14 @@ namespace Ryujinx.HLE.HOS.Services.Nv
{
Logger.PrintError(LogClass.ServiceNv, "Input buffer is null!");
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
if (CmdOut(cmd) && context.Request.GetBufferType0x22().Position == 0)
{
Logger.PrintError(LogClass.ServiceNv, "Output buffer is null!");
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
return processor(context, cmd);

View file

@ -45,7 +45,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
Logger.PrintStub(LogClass.ServiceNv);
return NvError.Success;
return NvResult.Success;
}
private static int AllocSpace(ServiceCtx context)
@ -60,7 +60,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
ulong size = (ulong)args.Pages *
(ulong)args.PageSize;
int result = NvError.Success;
int result = NvResult.Success;
lock (asCtx)
{
@ -81,7 +81,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
Logger.PrintWarning(LogClass.ServiceNv, $"Failed to allocate size {size:x16}!");
result = NvError.OutOfMemory;
result = NvResult.OutOfMemory;
}
else
{
@ -103,7 +103,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
NvGpuASCtx asCtx = GetASCtx(context);
int result = NvError.Success;
int result = NvResult.Success;
lock (asCtx)
{
@ -119,7 +119,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
Logger.PrintWarning(LogClass.ServiceNv,
$"Failed to free offset 0x{args.Offset:x16} size 0x{size:x16}!");
result = NvError.InvalidInput;
result = NvResult.InvalidInput;
}
}
@ -150,7 +150,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
}
}
return NvError.Success;
return NvResult.Success;
}
private static int MapBufferEx(ServiceCtx context)
@ -170,7 +170,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
{
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid NvMap handle 0x{args.NvMapHandle:x8}!");
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
long pa;
@ -191,16 +191,16 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
Logger.PrintWarning(LogClass.ServiceNv, msg);
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
return NvError.Success;
return NvResult.Success;
}
else
{
Logger.PrintWarning(LogClass.ServiceNv, $"Address 0x{args.Offset:x16} not mapped!");
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
}
}
@ -214,7 +214,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
size = (uint)map.Size;
}
int result = NvError.Success;
int result = NvResult.Success;
lock (asCtx)
{
@ -234,7 +234,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
Logger.PrintWarning(LogClass.ServiceNv, msg);
result = NvError.InvalidInput;
result = NvResult.InvalidInput;
}
}
else
@ -248,7 +248,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
Logger.PrintWarning(LogClass.ServiceNv, $"Failed to map size 0x{size:x16}!");
result = NvError.InvalidInput;
result = NvResult.InvalidInput;
}
else
{
@ -268,7 +268,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
Logger.PrintStub(LogClass.ServiceNv);
return NvError.Success;
return NvResult.Success;
}
private static int InitializeEx(ServiceCtx context)
@ -278,7 +278,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
Logger.PrintStub(LogClass.ServiceNv);
return NvError.Success;
return NvResult.Success;
}
private static int Remap(ServiceCtx context, int cmd)
@ -299,7 +299,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
{
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid NvMap handle 0x{args.NvMapHandle:x8}!");
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
long result = vmm.Map(map.Address, (long)(uint)args.Offset << 16,
@ -310,11 +310,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
Logger.PrintWarning(LogClass.ServiceNv,
$"Page 0x{args.Offset:x16} size 0x{args.Pages:x16} not allocated!");
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
}
return NvError.Success;
return NvResult.Success;
}
public static NvGpuASCtx GetASCtx(ServiceCtx context)

View file

@ -48,7 +48,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu
Logger.PrintStub(LogClass.ServiceNv);
return NvError.Success;
return NvResult.Success;
}
private static int ZcullGetInfo(ServiceCtx context)
@ -72,7 +72,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu
Logger.PrintStub(LogClass.ServiceNv);
return NvError.Success;
return NvResult.Success;
}
private static int ZbcSetTable(ServiceCtx context)
@ -82,7 +82,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu
Logger.PrintStub(LogClass.ServiceNv);
return NvError.Success;
return NvResult.Success;
}
private static int GetCharacteristics(ServiceCtx context)
@ -132,7 +132,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu
MemoryHelper.Write(context.Memory, outputPosition, args);
return NvError.Success;
return NvResult.Success;
}
private static int GetTpcMasks(ServiceCtx context)
@ -149,7 +149,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu
MemoryHelper.Write(context.Memory, outputPosition, args);
return NvError.Success;
return NvResult.Success;
}
private static int GetActiveSlotMask(ServiceCtx context)
@ -165,7 +165,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu
Logger.PrintStub(LogClass.ServiceNv);
return NvError.Success;
return NvResult.Success;
}
private static int GetGpuTime(ServiceCtx context)
@ -174,7 +174,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu
context.Memory.WriteInt64(outputPosition, GetPTimerNanoSeconds());
return NvError.Success;
return NvResult.Success;
}
private static long GetPTimerNanoSeconds()

View file

@ -71,7 +71,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
// TODO: Relocation, waitchecks, etc.
return NvError.Success;
return NvResult.Success;
}
private static int GetSyncpoint(ServiceCtx context)
@ -86,7 +86,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
MemoryHelper.Write(context.Memory, outputPosition, args);
return NvError.Success;
return NvResult.Success;
}
private static int GetWaitBase(ServiceCtx context)
@ -100,7 +100,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
MemoryHelper.Write(context.Memory, outputPosition, args);
return NvError.Success;
return NvResult.Success;
}
private static int MapBuffer(ServiceCtx context)
@ -122,7 +122,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
{
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{handle:x8}!");
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
lock (map)
@ -136,7 +136,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
}
}
return NvError.Success;
return NvResult.Success;
}
private static int UnmapBuffer(ServiceCtx context)
@ -157,7 +157,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
{
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{handle:x8}!");
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
lock (map)
@ -171,7 +171,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
}
}
return NvError.Success;
return NvResult.Success;
}
private static int SetUserData(ServiceCtx context)
@ -181,7 +181,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
Logger.PrintStub(LogClass.ServiceNv);
return NvError.Success;
return NvResult.Success;
}
private static int SetNvMap(ServiceCtx context)
@ -191,7 +191,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
Logger.PrintStub(LogClass.ServiceNv);
return NvError.Success;
return NvResult.Success;
}
private static int SetTimeout(ServiceCtx context)
@ -200,7 +200,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
GetChannel(context).Timeout = context.Memory.ReadInt32(inputPosition);
return NvError.Success;
return NvResult.Success;
}
private static int SubmitGpfifo(ServiceCtx context)
@ -224,7 +224,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
MemoryHelper.Write(context.Memory, outputPosition, args);
return NvError.Success;
return NvResult.Success;
}
private static int AllocObjCtx(ServiceCtx context)
@ -234,7 +234,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
Logger.PrintStub(LogClass.ServiceNv);
return NvError.Success;
return NvResult.Success;
}
private static int ZcullBind(ServiceCtx context)
@ -244,7 +244,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
Logger.PrintStub(LogClass.ServiceNv);
return NvError.Success;
return NvResult.Success;
}
private static int SetErrorNotifier(ServiceCtx context)
@ -254,7 +254,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
Logger.PrintStub(LogClass.ServiceNv);
return NvError.Success;
return NvResult.Success;
}
private static int SetPriority(ServiceCtx context)
@ -264,7 +264,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
Logger.PrintStub(LogClass.ServiceNv);
return NvError.Success;
return NvResult.Success;
}
private static int AllocGpfifoEx2(ServiceCtx context)
@ -274,7 +274,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
Logger.PrintStub(LogClass.ServiceNv);
return NvError.Success;
return NvResult.Success;
}
private static int KickoffPbWithAttr(ServiceCtx context)
@ -298,7 +298,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
MemoryHelper.Write(context.Memory, outputPosition, args);
return NvError.Success;
return NvResult.Success;
}
private static void PushGpfifo(ServiceCtx context, NvGpuVmm vmm, long gpfifo)

View file

@ -55,12 +55,12 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
if ((uint)id >= NvHostSyncpt.SyncptsCount)
{
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
GetUserCtx(context).Syncpt.Increment(id);
return NvError.Success;
return NvResult.Success;
}
private static int SyncptWait(ServiceCtx context)
@ -122,10 +122,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
Logger.PrintDebug(LogClass.ServiceNv, $"Got setting {domain}!{name}");
}
return NvError.Success;
return NvResult.Success;
}
return NvError.NotAvailableInProduction;
return NvResult.NotAvailableInProduction;
}
private static int EventWait(ServiceCtx context)
@ -147,7 +147,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
Logger.PrintStub(LogClass.ServiceNv);
return NvError.Success;
return NvResult.Success;
}
private static int SyncptReadMinOrMax(ServiceCtx context, bool max)
@ -159,7 +159,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
if ((uint)args.Id >= NvHostSyncpt.SyncptsCount)
{
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
if (max)
@ -173,7 +173,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
MemoryHelper.Write(context.Memory, outputPosition, args);
return NvError.Success;
return NvResult.Success;
}
private static int SyncptWait(ServiceCtx context, bool extended)
@ -187,18 +187,18 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
if ((uint)args.Id >= NvHostSyncpt.SyncptsCount)
{
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
int result;
if (syncpt.MinCompare(args.Id, args.Thresh))
{
result = NvError.Success;
result = NvResult.Success;
}
else if (args.Timeout == 0)
{
result = NvError.TryAgain;
result = NvResult.TryAgain;
}
else
{
@ -221,15 +221,15 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
{
waitEvent.WaitOne();
result = NvError.Success;
result = NvResult.Success;
}
else if (waitEvent.WaitOne(timeout))
{
result = NvError.Success;
result = NvResult.Success;
}
else
{
result = NvError.TimedOut;
result = NvResult.TimedOut;
}
}
@ -253,7 +253,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
if ((uint)args.Id >= NvHostSyncpt.SyncptsCount)
{
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
void WriteArgs()
@ -269,7 +269,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
WriteArgs();
return NvError.Success;
return NvResult.Success;
}
if (!async)
@ -281,7 +281,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
{
WriteArgs();
return NvError.TryAgain;
return NvResult.TryAgain;
}
NvHostEvent Event;
@ -294,7 +294,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
if ((uint)eventIndex >= NvHostCtrlUserCtx.EventsCount)
{
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
Event = GetUserCtx(context).Events[eventIndex];
@ -324,11 +324,11 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
args.Value |= eventIndex;
result = NvError.TryAgain;
result = NvResult.TryAgain;
}
else
{
result = NvError.InvalidInput;
result = NvResult.InvalidInput;
}
WriteArgs();

View file

@ -32,7 +32,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
Logger.PrintWarning(LogClass.ServiceNv, $"Unsupported Ioctl command 0x{cmd:x8}!");
return NvError.NotSupported;
return NvResult.NotSupported;
}
private static int Create(ServiceCtx context)
@ -46,7 +46,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
{
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid size 0x{args.Size:x8}!");
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
int size = IntUtils.AlignUp(args.Size, NvGpuVmm.PageSize);
@ -57,7 +57,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
MemoryHelper.Write(context.Memory, outputPosition, args);
return NvError.Success;
return NvResult.Success;
}
private static int FromId(ServiceCtx context)
@ -73,7 +73,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
{
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{args.Handle:x8}!");
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
map.IncrementRefCount();
@ -82,7 +82,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
MemoryHelper.Write(context.Memory, outputPosition, args);
return NvError.Success;
return NvResult.Success;
}
private static int Alloc(ServiceCtx context)
@ -98,14 +98,14 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
{
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{args.Handle:x8}!");
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
if ((args.Align & (args.Align - 1)) != 0)
{
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid alignment 0x{args.Align:x8}!");
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
if ((uint)args.Align < NvGpuVmm.PageSize)
@ -113,7 +113,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
args.Align = NvGpuVmm.PageSize;
}
int result = NvError.Success;
int result = NvResult.Success;
if (!map.Allocated)
{
@ -131,10 +131,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
// When the address is zero, we need to allocate
// our own backing memory for the NvMap.
// TODO: Is this allocation inside the transfer memory?
result = NvError.OutOfMemory;
result = NvResult.OutOfMemory;
}
if (result == NvError.Success)
if (result == NvResult.Success)
{
map.Size = size;
map.Address = address;
@ -159,7 +159,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
{
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{args.Handle:x8}!");
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
if (map.DecrementRefCount() <= 0)
@ -181,7 +181,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
MemoryHelper.Write(context.Memory, outputPosition, args);
return NvError.Success;
return NvResult.Success;
}
private static int Param(ServiceCtx context)
@ -197,7 +197,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
{
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{args.Handle:x8}!");
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
switch ((NvMapHandleParam)args.Param)
@ -210,12 +210,12 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
// Note: Base is not supported and returns an error.
// Any other value also returns an error.
default: return NvError.InvalidInput;
default: return NvResult.InvalidInput;
}
MemoryHelper.Write(context.Memory, outputPosition, args);
return NvError.Success;
return NvResult.Success;
}
private static int GetId(ServiceCtx context)
@ -231,14 +231,14 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
{
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{args.Handle:x8}!");
return NvError.InvalidInput;
return NvResult.InvalidInput;
}
args.Id = args.Handle;
MemoryHelper.Write(context.Memory, outputPosition, args);
return NvError.Success;
return NvResult.Success;
}
private static int AddNvMap(ServiceCtx context, NvMapHandle map)

View file

@ -1,6 +1,6 @@
namespace Ryujinx.HLE.HOS.Services.Nv
{
static class NvError
static class NvResult
{
public const int NotAvailableInProduction = 196614;
public const int Success = 0;