0
0
Fork 0

Add special log for stubs (#81)

* add stub loglevel

* add log for stubbed methods
This commit is contained in:
emmauss 2018-04-17 03:24:42 +03:00 committed by gdkchan
parent 494e6dfa1e
commit b334aab435
19 changed files with 122 additions and 14 deletions

View file

@ -17,6 +17,7 @@ namespace Ryujinx.Core
public static bool LoggingEnableError { get; private set; }
public static bool LoggingEnableFatal { get; private set; }
public static bool LoggingEnableIpc { get; private set; }
public static bool LoggingEnableStub { get; private set; }
public static bool LoggingEnableLogFile { get; private set; }
public static bool LoggingEnableFilter { get; private set; }
public static bool[] LoggingFilteredClasses { get; private set; }
@ -37,6 +38,7 @@ namespace Ryujinx.Core
LoggingEnableError = Convert.ToBoolean(Parser.Value("Logging_Enable_Error"));
LoggingEnableFatal = Convert.ToBoolean(Parser.Value("Logging_Enable_Fatal"));
LoggingEnableIpc = Convert.ToBoolean(Parser.Value("Logging_Enable_Ipc"));
LoggingEnableStub = Convert.ToBoolean(Parser.Value("Logging_Enable_Stub"));
LoggingEnableLogFile = Convert.ToBoolean(Parser.Value("Logging_Enable_LogFile"));
LoggingEnableFilter = Convert.ToBoolean(Parser.Value("Logging_Enable_Filter"));
LoggingFilteredClasses = new bool[(int)LogClass.Count];

View file

@ -20,6 +20,7 @@ namespace Ryujinx.Core
private static bool EnableWarn = Config.LoggingEnableWarn;
private static bool EnableError = Config.LoggingEnableError;
private static bool EnableFatal = Config.LoggingEnableFatal;
private static bool EnableStub = Config.LoggingEnableIpc;
private static bool EnableIpc = Config.LoggingEnableIpc;
private static bool EnableFilter = Config.LoggingEnableFilter;
private static bool EnableLogFile = Config.LoggingEnableLogFile;
@ -27,12 +28,13 @@ namespace Ryujinx.Core
private enum LogLevel
{
Debug = 1,
Error = 2,
Fatal = 3,
Info = 4,
Trace = 5,
Warn = 6
Debug,
Error,
Fatal,
Info,
Stub,
Trace,
Warn
}
static Logging()
@ -68,6 +70,9 @@ namespace Ryujinx.Core
case LogLevel.Info:
consoleColor = ConsoleColor.White;
break;
case LogLevel.Stub:
consoleColor = ConsoleColor.DarkYellow;
break;
case LogLevel.Trace:
consoleColor = ConsoleColor.DarkGray;
break;
@ -129,6 +134,21 @@ namespace Ryujinx.Core
}
}
public static void Stub(LogClass LogClass, string Message, [CallerMemberName] string CallingMember = "")
{
if (EnableStub)
{
LogMessage(new LogEntry
{
CallingMember = CallingMember,
LogLevel = LogLevel.Stub,
LogClass = LogClass,
Message = Message,
ExecutionTime = GetExecutionTime()
});
}
}
public static void Debug(LogClass LogClass,string Message, [CallerMemberName] string CallingMember = "")
{
if (EnableDebug)

View file

@ -22,6 +22,8 @@ namespace Ryujinx.Core.OsHle.Services.Acc
public long ListOpenUsers(ServiceCtx Context)
{
Logging.Stub(LogClass.ServiceAcc, "Stubbed");
return 0;
}
@ -34,6 +36,8 @@ namespace Ryujinx.Core.OsHle.Services.Acc
public long InitializeApplicationInfo(ServiceCtx Context)
{
Logging.Stub(LogClass.ServiceAcc, "Stubbed");
return 0;
}

View file

@ -20,11 +20,15 @@ namespace Ryujinx.Core.OsHle.Services.Acc
public long CheckAvailability(ServiceCtx Context)
{
Logging.Stub(LogClass.ServiceAcc, "Stubbed");
return 0;
}
public long GetAccountId(ServiceCtx Context)
{
Logging.Stub(LogClass.ServiceAcc, "AccountId = 0xcafeL");
Context.ResponseData.Write(0xcafeL);
return 0;

View file

@ -19,6 +19,8 @@ namespace Ryujinx.Core.OsHle.Services.Acc
public long GetBase(ServiceCtx Context)
{
Logging.Stub(LogClass.ServiceAcc, "Stubbed");
Context.ResponseData.Write(0L);
Context.ResponseData.Write(0L);
Context.ResponseData.Write(0L);

View file

@ -37,6 +37,8 @@ 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.ResponseData.Write(0L);
return 0;
@ -44,6 +46,8 @@ namespace Ryujinx.Core.OsHle.Services.Am
public long GetDesiredLanguage(ServiceCtx Context)
{
Logging.Stub(LogClass.ServiceAm, "LanguageId = 1");
//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.
Context.ResponseData.Write(1L);

View file

@ -32,6 +32,8 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Logging.Stub(LogClass.ServiceAm, $"ScreenShot Allowed = {Enable}");
return 0;
}
@ -39,6 +41,8 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Logging.Stub(LogClass.ServiceAm, $"OperationMode Changed = {Enable}");
return 0;
}
@ -46,6 +50,8 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Logging.Stub(LogClass.ServiceAm, $"PerformanceMode Changed = {Enable}");
return 0;
}
@ -55,6 +61,8 @@ 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}}}");
return 0;
}
@ -62,6 +70,8 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Logging.Stub(LogClass.ServiceAm, $"Restart Message Enabled = {Enable}");
return 0;
}
@ -69,6 +79,8 @@ namespace Ryujinx.Core.OsHle.Services.Am
{
bool Enable = Context.RequestData.ReadByte() != 0 ? true : false;
Logging.Stub(LogClass.ServiceAm, $"Out Of Focus Suspending Enabled = {Enable}");
return 0;
}
}

View file

@ -20,6 +20,8 @@ namespace Ryujinx.Core.OsHle.Services.Am
public long GetAppletResourceUserId(ServiceCtx Context)
{
Logging.Stub(LogClass.ServiceAm, $"Applet Resource Id = 0");
Context.ResponseData.Write(0L);
return 0;
@ -27,6 +29,8 @@ namespace Ryujinx.Core.OsHle.Services.Am
public long AcquireForegroundRights(ServiceCtx Context)
{
Logging.Stub(LogClass.ServiceAm, "Stubbed");
return 0;
}
}

View file

@ -32,6 +32,9 @@ namespace Ryujinx.Core.OsHle.Services.Apm
Context.ResponseData.Write((uint)PerformanceConfiguration.PerformanceConfiguration1);
Logging.Stub(LogClass.ServiceApm, $"PerformanceMode = {PerfMode}, PerformanceConfiguration =" +
$" {PerformanceConfiguration.PerformanceConfiguration1}");
return 0;
}
}

View file

@ -57,6 +57,8 @@ namespace Ryujinx.Core.OsHle.Services.Aud
string Name = AMemoryHelper.ReadAsciiString(Context.Memory, Position, Size);
Logging.Stub(LogClass.ServiceAudio, $"Volume = {Volume}, Position = {Position}, Size = {Size}");
return 0;
}
}

View file

@ -124,14 +124,14 @@ namespace Ryujinx.Core.OsHle.Services.Aud
public long AppendAudioOutBufferEx(ServiceCtx Context)
{
Logging.Warn(LogClass.ServiceAudio, "Not implemented!");
Logging.Stub(LogClass.ServiceAudio, "Stubbed");
return 0;
}
public long GetReleasedAudioOutBufferEx(ServiceCtx Context)
{
Logging.Warn(LogClass.ServiceAudio, "Not implemented!");
Logging.Stub(LogClass.ServiceAudio, "Stubbed");
return 0;
}

View file

@ -54,11 +54,15 @@ namespace Ryujinx.Core.OsHle.Services.Aud
public long StartAudioRenderer(ServiceCtx Context)
{
Logging.Stub(LogClass.ServiceAudio, "Stubbed");
return 0;
}
public long StopAudioRenderer(ServiceCtx Context)
{
Logging.Stub(LogClass.ServiceAudio, "Stubbed");
return 0;
}

View file

@ -42,6 +42,8 @@ namespace Ryujinx.Core.OsHle.Services.Aud
int Unknown2c = Context.RequestData.ReadInt32();
int Rev1Magic = Context.RequestData.ReadInt32();
Logging.Stub(LogClass.ServiceAudio, "BufferSize = 0x400L");
Context.ResponseData.Write(0x400L);
return 0;

View file

@ -45,6 +45,8 @@ namespace Ryujinx.Core.OsHle.Services.Hid
public long ActivateDebugPad(ServiceCtx Context)
{
Logging.Stub(LogClass.ServiceHid, "Stubbed");
return 0;
}
@ -52,6 +54,8 @@ namespace Ryujinx.Core.OsHle.Services.Hid
{
long AppletResourceUserId = Context.RequestData.ReadInt64();
Logging.Stub(LogClass.ServiceHid, "Stubbed");
return 0;
}
@ -59,6 +63,8 @@ namespace Ryujinx.Core.OsHle.Services.Hid
{
long AppletResourceUserId = Context.RequestData.ReadInt64();
Logging.Stub(LogClass.ServiceHid, "Stubbed");
return 0;
}
@ -66,6 +72,8 @@ namespace Ryujinx.Core.OsHle.Services.Hid
{
long AppletResourceUserId = Context.RequestData.ReadInt64();
Logging.Stub(LogClass.ServiceHid, "Stubbed");
return 0;
}
@ -75,6 +83,8 @@ namespace Ryujinx.Core.OsHle.Services.Hid
long AppletResourceUserId = Context.RequestData.ReadInt64();
Logging.Stub(LogClass.ServiceHid, "Stubbed");
return 0;
}
@ -82,6 +92,8 @@ namespace Ryujinx.Core.OsHle.Services.Hid
{
Context.ResponseData.Write(0);
Logging.Stub(LogClass.ServiceHid, "Stubbed");
return 0;
}
@ -90,6 +102,8 @@ namespace Ryujinx.Core.OsHle.Services.Hid
long Unknown0 = Context.RequestData.ReadInt64();
long Unknown8 = Context.RequestData.ReadInt64();
Logging.Stub(LogClass.ServiceHid, "Stubbed");
return 0;
}
@ -97,6 +111,8 @@ namespace Ryujinx.Core.OsHle.Services.Hid
{
long Unknown = Context.RequestData.ReadInt64();
Logging.Stub(LogClass.ServiceHid, "Stubbed");
return 0;
}
@ -104,6 +120,8 @@ namespace Ryujinx.Core.OsHle.Services.Hid
{
long Unknown = Context.RequestData.ReadInt64();
Logging.Stub(LogClass.ServiceHid, "Stubbed");
return 0;
}
@ -112,6 +130,8 @@ namespace Ryujinx.Core.OsHle.Services.Hid
long Unknown0 = Context.RequestData.ReadInt64();
long Unknown8 = Context.RequestData.ReadInt64();
Logging.Stub(LogClass.ServiceHid, "Stubbed");
return 0;
}
@ -119,6 +139,8 @@ namespace Ryujinx.Core.OsHle.Services.Hid
{
Context.ResponseData.Write(0L);
Logging.Stub(LogClass.ServiceHid, "Stubbed");
return 0;
}
@ -127,6 +149,8 @@ namespace Ryujinx.Core.OsHle.Services.Hid
HidControllerId HidControllerId = (HidControllerId)Context.RequestData.ReadInt32();
long AppletUserResourseId = Context.RequestData.ReadInt64();
Logging.Stub(LogClass.ServiceHid, "Stubbed");
return 0;
}
@ -136,6 +160,8 @@ namespace Ryujinx.Core.OsHle.Services.Hid
long AppletUserResourseId = Context.RequestData.ReadInt64();
long NpadJoyDeviceType = Context.RequestData.ReadInt64();
Logging.Stub(LogClass.ServiceHid, "Stubbed");
return 0;
}
@ -144,6 +170,8 @@ namespace Ryujinx.Core.OsHle.Services.Hid
HidControllerId HidControllerId = (HidControllerId)Context.RequestData.ReadInt32();
long AppletUserResourseId = Context.RequestData.ReadInt64();
Logging.Stub(LogClass.ServiceHid, "Stubbed");
return 0;
}
@ -153,6 +181,8 @@ namespace Ryujinx.Core.OsHle.Services.Hid
long Unknown8 = Context.RequestData.ReadInt32();
long AppletUserResourseId = Context.RequestData.ReadInt64();
Logging.Stub(LogClass.ServiceHid, "Stubbed");
return 0;
}
@ -160,6 +190,8 @@ namespace Ryujinx.Core.OsHle.Services.Hid
{
int VibrationDeviceHandle = Context.RequestData.ReadInt32();
Logging.Stub(LogClass.ServiceHid, $"VibrationDeviceHandle = {VibrationDeviceHandle}, VibrationDeviceInfo = 0");
Context.ResponseData.Write(0L); //VibrationDeviceInfoForIpc
return 0;
@ -174,6 +206,8 @@ namespace Ryujinx.Core.OsHle.Services.Hid
public long SendVibrationValues(ServiceCtx Context)
{
Logging.Stub(LogClass.ServiceHid, "Stubbed");
return 0;
}
}

View file

@ -24,7 +24,7 @@ namespace Ryujinx.Core.OsHle.Services.Nifm
MakeObject(Context, new IRequest());
//Todo: Stub
Logging.Stub(LogClass.ServiceNifm, "Stubbed");
return 0;
}

View file

@ -31,14 +31,14 @@ namespace Ryujinx.Core.OsHle.Services.Nifm
{
Context.ResponseData.Write(0);
//Todo: Stub
Logging.Stub(LogClass.ServiceNifm, "Stubbed");
return 0;
}
public long GetResult(ServiceCtx Context)
{
//Todo: Stub
Logging.Stub(LogClass.ServiceNifm, "Stubbed");
return 0;
}
@ -56,14 +56,14 @@ namespace Ryujinx.Core.OsHle.Services.Nifm
public long Cancel(ServiceCtx Context)
{
//Todo: Stub
Logging.Stub(LogClass.ServiceNifm, "Stubbed");
return 0;
}
public long Submit(ServiceCtx Context)
{
//Todo: Stub
Logging.Stub(LogClass.ServiceNifm, "Stubbed");
return 0;
}

View file

@ -22,11 +22,15 @@ namespace Ryujinx.Core.OsHle.Services.Ns
{
Context.ResponseData.Write(0);
Logging.Stub(LogClass.ServiceNs, "Stubbed");
return 0;
}
public static long ListAddOnContent(ServiceCtx Context)
{
Logging.Stub(LogClass.ServiceNs, "Stubbed");
//TODO: This is supposed to write a u32 array aswell.
//It's unknown what it contains.
Context.ResponseData.Write(0);

View file

@ -1,4 +1,5 @@
using Ryujinx.Core.OsHle.Ipc;
using Ryujinx.Core.Settings;
using System.Collections.Generic;
namespace Ryujinx.Core.OsHle.Services.Set
@ -27,6 +28,9 @@ namespace Ryujinx.Core.OsHle.Services.Set
public static long SetColorSetId(ServiceCtx Context)
{
int ColorSetId = Context.RequestData.ReadInt32();
Context.Ns.Settings.ThemeColor = (ColorSet)ColorSetId;
return 0;
}
}

View file

@ -19,6 +19,9 @@ Logging_Enable_Error = true
#Enable print fatal logs
Logging_Enable_Fatal = true
#Enable print stubbed calls logs
Logging_Enable_Stub = false
#Enable print Ipc logs
Logging_Enable_Ipc = false