Improved logging (#103)

This commit is contained in:
gdkchan
2018-04-24 15:57:39 -03:00
committed by GitHub
parent 4e24866b47
commit a8ba340dde
57 changed files with 555 additions and 870 deletions

View File

@@ -1,3 +1,4 @@
using Ryujinx.Core.Logging;
using Ryujinx.Core.OsHle.Ipc;
using System.Collections.Generic;
using System.IO;
@@ -14,7 +15,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 1, PopLaunchParameter },
{ 1, PopLaunchParameter },
{ 20, EnsureSaveData },
{ 21, GetDesiredLanguage },
{ 22, SetTerminateResult },
@@ -38,7 +39,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
long UIdLow = Context.RequestData.ReadInt64();
long UIdHigh = Context.RequestData.ReadInt64();
Logging.Stub(LogClass.ServiceAm, $"UidLow = {UIdLow}, UidHigh = {UIdHigh}");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.ResponseData.Write(0L);
@@ -47,7 +48,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
public long GetDesiredLanguage(ServiceCtx Context)
{
Logging.Stub(LogClass.ServiceAm, "LanguageId = 1");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
//This is an enumerator where each number is a differnet language.
//0 is Japanese and 1 is English, need to figure out the other codes.
@@ -60,14 +61,21 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
int ErrorCode = Context.RequestData.ReadInt32();
int Module = ErrorCode & 0xFF;
int Description = (ErrorCode >> 9) & 0xFFF;
string Result = GetFormattedErrorCode(ErrorCode);
Logging.Info(LogClass.ServiceAm, $"({(ErrorModule)Module}){2000 + Module}-{Description}");
Context.Ns.Log.PrintInfo(LogClass.ServiceAm, $"Result = 0x{ErrorCode:x8} ({Result}).");
return 0;
}
private string GetFormattedErrorCode(int ErrorCode)
{
int Module = (ErrorCode >> 0) & 0x1ff;
int Description = (ErrorCode >> 9) & 0x1fff;
return $"{(2000 + Module):d4}-{Description:d4}";
}
public long GetDisplayVersion(ServiceCtx Context)
{
//FIXME: Need to check correct version on a switch.

View File

@@ -13,13 +13,13 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 0, GetCommonStateGetter },
{ 1, GetSelfController },
{ 2, GetWindowController },
{ 3, GetAudioController },
{ 4, GetDisplayController },
{ 11, GetLibraryAppletCreator },
{ 20, GetApplicationFunctions },
{ 0, GetCommonStateGetter },
{ 1, GetSelfController },
{ 2, GetWindowController },
{ 3, GetAudioController },
{ 4, GetDisplayController },
{ 11, GetLibraryAppletCreator },
{ 20, GetApplicationFunctions },
{ 1000, GetDebugFunctions }
};
}

View File

@@ -1,3 +1,4 @@
using Ryujinx.Core.Logging;
using Ryujinx.Core.OsHle.Ipc;
using System.Collections.Generic;
@@ -16,7 +17,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
{ 0, SetExpectedMasterVolume },
{ 1, GetMainAppletExpectedMasterVolume },
{ 2, GetLibraryAppletExpectedMasterVolume },
{ 3, ChangeMainAppletMasterVolume },
{ 3, ChangeMainAppletMasterVolume },
{ 4, SetTransparentVolumeRate }
};
}
@@ -26,7 +27,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
float AppletVolume = Context.RequestData.ReadSingle();
float LibraryAppletVolume = Context.RequestData.ReadSingle();
Logging.Stub(LogClass.ServiceAm, "Stubbed");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@@ -35,7 +36,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
Context.ResponseData.Write(1f);
Logging.Stub(LogClass.ServiceAm, "Stubbed");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@@ -44,7 +45,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
Context.ResponseData.Write(1f);
Logging.Stub(LogClass.ServiceAm, "Stubbed");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@@ -54,7 +55,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
float Unknown0 = Context.RequestData.ReadSingle();
long Unknown1 = Context.RequestData.ReadInt64();
Logging.Stub(LogClass.ServiceAm, "Stubbed");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@@ -63,7 +64,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
float Unknown0 = Context.RequestData.ReadSingle();
Logging.Stub(LogClass.ServiceAm, "Stubbed");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}

View File

@@ -1,3 +1,4 @@
using Ryujinx.Core.Logging;
using Ryujinx.Core.OsHle.Handles;
using Ryujinx.Core.OsHle.Ipc;
using System.Collections.Generic;
@@ -66,7 +67,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
Context.ResponseData.Write((byte)0); //Unknown value.
Logging.Stub(LogClass.ServiceAm, "Stubbed");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}

View File

@@ -1,3 +1,4 @@
using Ryujinx.Core.Logging;
using Ryujinx.Core.OsHle.Handles;
using Ryujinx.Core.OsHle.Ipc;
using System.Collections.Generic;
@@ -26,7 +27,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
public long RequestToGetForeground(ServiceCtx Context)
{
Logging.Stub(LogClass.ServiceAm, "Stubbed");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@@ -37,7 +38,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
Context.Response.HandleDesc = IpcHandleDesc.MakeCopy(Handle);
Logging.Stub(LogClass.ServiceAm, "Stubbed");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}

View File

@@ -1,3 +1,4 @@
using Ryujinx.Core.Logging;
using Ryujinx.Core.OsHle.Ipc;
using System.Collections.Generic;
@@ -33,7 +34,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Logging.Stub(LogClass.ServiceAm, $"ScreenShot Allowed = {Enable}");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@@ -42,7 +43,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Logging.Stub(LogClass.ServiceAm, $"OperationMode Changed = {Enable}");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@@ -51,7 +52,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Logging.Stub(LogClass.ServiceAm, $"PerformanceMode Changed = {Enable}");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@@ -62,7 +63,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
bool Flag2 = Context.RequestData.ReadByte() != 0 ? true : false;
bool Flag3 = Context.RequestData.ReadByte() != 0 ? true : false;
Logging.Stub(LogClass.ServiceAm, $"Focus Handling Mode Flags = {{{Flag1}|{Flag2}|{Flag3}}}");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@@ -71,7 +72,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Logging.Stub(LogClass.ServiceAm, $"Restart Message Enabled = {Enable}");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@@ -80,7 +81,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Logging.Stub(LogClass.ServiceAm, $"Out Of Focus Suspending Enabled = {Enable}");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}
@@ -89,7 +90,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Logging.Stub(LogClass.ServiceAm, $"HandlesRequestToDisplay Allowed = {Enable}");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}

View File

@@ -17,7 +17,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 0, GetSize },
{ 0, GetSize },
{ 11, Read }
};
@@ -45,7 +45,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
if (Storage.Data.Length > Size)
{
Data = new byte[Size];
Buffer.BlockCopy(Storage.Data, 0, Data, 0, Size);
}
else

View File

@@ -13,15 +13,15 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 0, GetCommonStateGetter },
{ 1, GetSelfController },
{ 2, GetWindowController },
{ 3, GetAudioController },
{ 4, GetDisplayController },
{ 11, GetLibraryAppletCreator },
{ 20, GetHomeMenuFunctions },
{ 21, GetGlobalStateController },
{ 22, GetApplicationCreator },
{ 0, GetCommonStateGetter },
{ 1, GetSelfController },
{ 2, GetWindowController },
{ 3, GetAudioController },
{ 4, GetDisplayController },
{ 11, GetLibraryAppletCreator },
{ 20, GetHomeMenuFunctions },
{ 21, GetGlobalStateController },
{ 22, GetApplicationCreator },
{ 1000, GetDebugFunctions }
};
}
@@ -45,8 +45,8 @@ namespace Ryujinx.Core.OsHle.Services.Am
MakeObject(Context, new IWindowController());
return 0;
}
}
public long GetAudioController(ServiceCtx Context)
{
MakeObject(Context, new IAudioController());

View File

@@ -1,3 +1,4 @@
using Ryujinx.Core.Logging;
using Ryujinx.Core.OsHle.Ipc;
using System.Collections.Generic;
@@ -13,14 +14,14 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
m_Commands = new Dictionary<int, ServiceProcessRequest>()
{
{ 1, GetAppletResourceUserId },
{ 1, GetAppletResourceUserId },
{ 10, AcquireForegroundRights }
};
}
public long GetAppletResourceUserId(ServiceCtx Context)
{
Logging.Stub(LogClass.ServiceAm, $"Applet Resource Id = 0");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
Context.ResponseData.Write(0L);
@@ -29,7 +30,7 @@ namespace Ryujinx.Core.OsHle.Services.Am
public long AcquireForegroundRights(ServiceCtx Context)
{
Logging.Stub(LogClass.ServiceAm, "Stubbed");
Context.Ns.Log.PrintStub(LogClass.ServiceAm, "Stubbed.");
return 0;
}