Move logging to Ryujinx.Common and make it a static class (#413)

This commit is contained in:
ReinUsesLisp 2018-10-17 14:15:50 -03:00 committed by gdkchan
parent 9b19ea3c87
commit b3a4662be1
61 changed files with 612 additions and 585 deletions

View file

@ -1,4 +1,5 @@
using ChocolArm64.Memory;
using Ryujinx.Common.Logging;
using Ryujinx.HLE.HOS.Ipc;
using Ryujinx.HLE.HOS.Kernel;
using Ryujinx.HLE.HOS.Services.Nv.NvGpuAS;
@ -6,7 +7,6 @@ using Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu;
using Ryujinx.HLE.HOS.Services.Nv.NvHostChannel;
using Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl;
using Ryujinx.HLE.HOS.Services.Nv.NvMap;
using Ryujinx.HLE.Logging;
using System;
using System.Collections.Generic;
@ -146,7 +146,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv
public long FinishInitialize(ServiceCtx Context)
{
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
Logger.PrintStub(LogClass.ServiceNv, "Stubbed.");
return 0;
}
@ -180,14 +180,14 @@ namespace Ryujinx.HLE.HOS.Services.Nv
{
if (CmdIn(Cmd) && Context.Request.GetBufferType0x21().Position == 0)
{
Context.Device.Log.PrintError(LogClass.ServiceNv, "Input buffer is null!");
Logger.PrintError(LogClass.ServiceNv, "Input buffer is null!");
return NvResult.InvalidInput;
}
if (CmdOut(Cmd) && Context.Request.GetBufferType0x22().Position == 0)
{
Context.Device.Log.PrintError(LogClass.ServiceNv, "Output buffer is null!");
Logger.PrintError(LogClass.ServiceNv, "Output buffer is null!");
return NvResult.InvalidInput;
}

View file

@ -1,7 +1,7 @@
using ChocolArm64.Memory;
using Ryujinx.Common.Logging;
using Ryujinx.Graphics.Memory;
using Ryujinx.HLE.HOS.Services.Nv.NvMap;
using Ryujinx.HLE.Logging;
using System;
using System.Collections.Concurrent;
@ -42,7 +42,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
Logger.PrintStub(LogClass.ServiceNv, "Stubbed.");
return NvResult.Success;
}
@ -78,7 +78,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
{
Args.Offset = 0;
Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Failed to allocate size {Size:x16}!");
Logger.PrintWarning(LogClass.ServiceNv, $"Failed to allocate size {Size:x16}!");
Result = NvResult.OutOfMemory;
}
@ -115,7 +115,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
}
else
{
Context.Device.Log.PrintWarning(LogClass.ServiceNv,
Logger.PrintWarning(LogClass.ServiceNv,
$"Failed to free offset 0x{Args.Offset:x16} size 0x{Size:x16}!");
Result = NvResult.InvalidInput;
@ -145,7 +145,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
}
else
{
Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid buffer offset {Args.Offset:x16}!");
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid buffer offset {Args.Offset:x16}!");
}
}
@ -167,7 +167,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
if (Map == null)
{
Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid NvMap handle 0x{Args.NvMapHandle:x8}!");
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid NvMap handle 0x{Args.NvMapHandle:x8}!");
return NvResult.InvalidInput;
}
@ -188,7 +188,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
{
string Msg = string.Format(MapErrorMsg, VA, Args.MappingSize);
Context.Device.Log.PrintWarning(LogClass.ServiceNv, Msg);
Logger.PrintWarning(LogClass.ServiceNv, Msg);
return NvResult.InvalidInput;
}
@ -197,7 +197,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
}
else
{
Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Address 0x{Args.Offset:x16} not mapped!");
Logger.PrintWarning(LogClass.ServiceNv, $"Address 0x{Args.Offset:x16} not mapped!");
return NvResult.InvalidInput;
}
@ -231,7 +231,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
{
string Msg = string.Format(MapErrorMsg, Args.Offset, Size);
Context.Device.Log.PrintWarning(LogClass.ServiceNv, Msg);
Logger.PrintWarning(LogClass.ServiceNv, Msg);
Result = NvResult.InvalidInput;
}
@ -245,7 +245,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
{
Args.Offset = 0;
Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Failed to map size 0x{Size:x16}!");
Logger.PrintWarning(LogClass.ServiceNv, $"Failed to map size 0x{Size:x16}!");
Result = NvResult.InvalidInput;
}
@ -265,7 +265,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
Logger.PrintStub(LogClass.ServiceNv, "Stubbed.");
return NvResult.Success;
}
@ -275,7 +275,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
Logger.PrintStub(LogClass.ServiceNv, "Stubbed.");
return NvResult.Success;
}
@ -296,7 +296,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
if (Map == null)
{
Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid NvMap handle 0x{Args.NvMapHandle:x8}!");
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid NvMap handle 0x{Args.NvMapHandle:x8}!");
return NvResult.InvalidInput;
}
@ -306,7 +306,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS
if (Result < 0)
{
Context.Device.Log.PrintWarning(LogClass.ServiceNv,
Logger.PrintWarning(LogClass.ServiceNv,
$"Page 0x{Args.Offset:x16} size 0x{Args.Pages:x16} not allocated!");
return NvResult.InvalidInput;

View file

@ -1,5 +1,5 @@
using ChocolArm64.Memory;
using Ryujinx.HLE.Logging;
using Ryujinx.Common.Logging;
using System;
using System.Diagnostics;
@ -46,7 +46,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu
AMemoryHelper.Write(Context.Memory, OutputPosition, Args);
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
Logger.PrintStub(LogClass.ServiceNv, "Stubbed.");
return NvResult.Success;
}
@ -70,7 +70,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu
AMemoryHelper.Write(Context.Memory, OutputPosition, Args);
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
Logger.PrintStub(LogClass.ServiceNv, "Stubbed.");
return NvResult.Success;
}
@ -80,7 +80,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
Logger.PrintStub(LogClass.ServiceNv, "Stubbed.");
return NvResult.Success;
}
@ -163,7 +163,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuGpu
AMemoryHelper.Write(Context.Memory, OutputPosition, Args);
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
Logger.PrintStub(LogClass.ServiceNv, "Stubbed.");
return NvResult.Success;
}

View file

@ -1,7 +1,7 @@
using ChocolArm64.Memory;
using Ryujinx.Common.Logging;
using Ryujinx.Graphics.Memory;
using Ryujinx.HLE.HOS.Services.Nv.NvGpuAS;
using Ryujinx.HLE.Logging;
using System;
using System.Collections.Concurrent;
@ -57,7 +57,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
Logger.PrintStub(LogClass.ServiceNv, "Stubbed.");
return NvResult.Success;
}
@ -67,7 +67,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
Logger.PrintStub(LogClass.ServiceNv, "Stubbed.");
return NvResult.Success;
}
@ -110,7 +110,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
Logger.PrintStub(LogClass.ServiceNv, "Stubbed.");
return NvResult.Success;
}
@ -120,7 +120,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
Logger.PrintStub(LogClass.ServiceNv, "Stubbed.");
return NvResult.Success;
}
@ -130,7 +130,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
Logger.PrintStub(LogClass.ServiceNv, "Stubbed.");
return NvResult.Success;
}
@ -140,7 +140,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
Logger.PrintStub(LogClass.ServiceNv, "Stubbed.");
return NvResult.Success;
}
@ -150,7 +150,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel
long InputPosition = Context.Request.GetBufferType0x21().Position;
long OutputPosition = Context.Request.GetBufferType0x22().Position;
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
Logger.PrintStub(LogClass.ServiceNv, "Stubbed.");
return NvResult.Success;
}

View file

@ -1,5 +1,5 @@
using ChocolArm64.Memory;
using Ryujinx.HLE.Logging;
using Ryujinx.Common.Logging;
using System;
using System.Collections.Concurrent;
using System.Text;
@ -95,7 +95,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
{
if (StringValue.Length > 0x100)
{
Context.Device.Log.PrintError(Logging.LogClass.ServiceNv, $"{Domain}!{Name} String value size is too big!");
Logger.PrintError(LogClass.ServiceNv, $"{Domain}!{Name} String value size is too big!");
}
else
{
@ -118,7 +118,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
Context.Memory.WriteBytes(OutputPosition + 0x82, SettingBuffer);
Context.Device.Log.PrintDebug(Logging.LogClass.ServiceNv, $"Got setting {Domain}!{Name}");
Logger.PrintDebug(LogClass.ServiceNv, $"Got setting {Domain}!{Name}");
}
return NvResult.Success;
@ -144,7 +144,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
int EventId = Context.Memory.ReadInt32(InputPosition);
Context.Device.Log.PrintStub(LogClass.ServiceNv, "Stubbed.");
Logger.PrintStub(LogClass.ServiceNv, "Stubbed.");
return NvResult.Success;
}
@ -201,7 +201,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
}
else
{
Context.Device.Log.PrintDebug(LogClass.ServiceNv, "Waiting syncpt with timeout of " + Args.Timeout + "ms...");
Logger.PrintDebug(LogClass.ServiceNv, "Waiting syncpt with timeout of " + Args.Timeout + "ms...");
using (ManualResetEvent WaitEvent = new ManualResetEvent(false))
{
@ -232,7 +232,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl
}
}
Context.Device.Log.PrintDebug(LogClass.ServiceNv, "Resuming...");
Logger.PrintDebug(LogClass.ServiceNv, "Resuming...");
}
if (Extended)

View file

@ -1,6 +1,6 @@
using ChocolArm64.Memory;
using Ryujinx.Common.Logging;
using Ryujinx.Graphics.Memory;
using Ryujinx.HLE.Logging;
using Ryujinx.HLE.Utilities;
using System.Collections.Concurrent;
@ -29,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
case 0x010e: return GetId (Context);
}
Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Unsupported Ioctl command 0x{Cmd:x8}!");
Logger.PrintWarning(LogClass.ServiceNv, $"Unsupported Ioctl command 0x{Cmd:x8}!");
return NvResult.NotSupported;
}
@ -43,7 +43,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
if (Args.Size == 0)
{
Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid size 0x{Args.Size:x8}!");
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid size 0x{Args.Size:x8}!");
return NvResult.InvalidInput;
}
@ -52,7 +52,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
Args.Handle = AddNvMap(Context, new NvMapHandle(Size));
Context.Device.Log.PrintInfo(LogClass.ServiceNv, $"Created map {Args.Handle} with size 0x{Size:x8}!");
Logger.PrintInfo(LogClass.ServiceNv, $"Created map {Args.Handle} with size 0x{Size:x8}!");
AMemoryHelper.Write(Context.Memory, OutputPosition, Args);
@ -70,7 +70,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
if (Map == null)
{
Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!");
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!");
return NvResult.InvalidInput;
}
@ -95,14 +95,14 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
if (Map == null)
{
Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!");
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!");
return NvResult.InvalidInput;
}
if ((Args.Align & (Args.Align - 1)) != 0)
{
Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid alignment 0x{Args.Align:x8}!");
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid alignment 0x{Args.Align:x8}!");
return NvResult.InvalidInput;
}
@ -159,7 +159,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
if (Map == null)
{
Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!");
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!");
return NvResult.InvalidInput;
}
@ -168,7 +168,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
{
DeleteNvMap(Context, Args.Handle);
Context.Device.Log.PrintInfo(LogClass.ServiceNv, $"Deleted map {Args.Handle}!");
Logger.PrintInfo(LogClass.ServiceNv, $"Deleted map {Args.Handle}!");
Args.Address = Map.Address;
Args.Flags = 0;
@ -197,7 +197,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
if (Map == null)
{
Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!");
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!");
return NvResult.InvalidInput;
}
@ -231,7 +231,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap
if (Map == null)
{
Context.Device.Log.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!");
Logger.PrintWarning(LogClass.ServiceNv, $"Invalid handle 0x{Args.Handle:x8}!");
return NvResult.InvalidInput;
}