Merge branch 'master' into aot
This commit is contained in:
commit
040dd3c5df
408 changed files with 2964 additions and 1567 deletions
|
@ -39,6 +39,11 @@ namespace Ryujinx.Common.Logging
|
||||||
m_Time = Stopwatch.StartNew();
|
m_Time = Stopwatch.StartNew();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void RestartTime()
|
||||||
|
{
|
||||||
|
m_Time.Restart();
|
||||||
|
}
|
||||||
|
|
||||||
public static void AddTarget(ILogTarget target)
|
public static void AddTarget(ILogTarget target)
|
||||||
{
|
{
|
||||||
m_LogTargets.Add(target);
|
m_LogTargets.Add(target);
|
||||||
|
@ -134,4 +139,4 @@ namespace Ryujinx.Common.Logging
|
||||||
return $"{Class} {Caller}: {Message}";
|
return $"{Class} {Caller}: {Message}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ using Ryujinx.HLE.HOS.Kernel.Common;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Memory;
|
using Ryujinx.HLE.HOS.Kernel.Memory;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Process;
|
using Ryujinx.HLE.HOS.Kernel.Process;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
|
using Ryujinx.HLE.HOS.Services.Settings;
|
||||||
using Ryujinx.HLE.HOS.Services.Sm;
|
using Ryujinx.HLE.HOS.Services.Sm;
|
||||||
using Ryujinx.HLE.HOS.Services.Time.Clock;
|
using Ryujinx.HLE.HOS.Services.Time.Clock;
|
||||||
using Ryujinx.HLE.HOS.SystemState;
|
using Ryujinx.HLE.HOS.SystemState;
|
||||||
|
@ -204,7 +205,7 @@ namespace Ryujinx.HLE.HOS
|
||||||
// TODO: use "time!standard_steady_clock_rtc_update_interval_minutes" and implement a worker thread to be accurate.
|
// TODO: use "time!standard_steady_clock_rtc_update_interval_minutes" and implement a worker thread to be accurate.
|
||||||
StandardSteadyClockCore.Instance.ConfigureSetupValue();
|
StandardSteadyClockCore.Instance.ConfigureSetupValue();
|
||||||
|
|
||||||
if (Services.Set.NxSettings.Settings.TryGetValue("time!standard_network_clock_sufficient_accuracy_minutes", out object standardNetworkClockSufficientAccuracyMinutes))
|
if (NxSettings.Settings.TryGetValue("time!standard_network_clock_sufficient_accuracy_minutes", out object standardNetworkClockSufficientAccuracyMinutes))
|
||||||
{
|
{
|
||||||
TimeSpanType standardNetworkClockSufficientAccuracy = new TimeSpanType((int)standardNetworkClockSufficientAccuracyMinutes * 60000000000);
|
TimeSpanType standardNetworkClockSufficientAccuracy = new TimeSpanType((int)standardNetworkClockSufficientAccuracyMinutes * 60000000000);
|
||||||
|
|
||||||
|
|
|
@ -165,40 +165,48 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BindingFlags staticNonPublic = BindingFlags.NonPublic | BindingFlags.Static;
|
||||||
|
|
||||||
// Print all the arguments for debugging purposes.
|
// Print all the arguments for debugging purposes.
|
||||||
int inputArgsCount = methodArgs.Length - byRefArgsCount;
|
int inputArgsCount = methodArgs.Length - byRefArgsCount;
|
||||||
|
|
||||||
generator.Emit(OpCodes.Ldc_I4_S, inputArgsCount);
|
if (inputArgsCount != 0)
|
||||||
|
|
||||||
generator.Emit(OpCodes.Newarr, typeof(object));
|
|
||||||
|
|
||||||
string argsFormat = svcName;
|
|
||||||
|
|
||||||
for (int index = 0; index < inputArgsCount; index++)
|
|
||||||
{
|
{
|
||||||
argsFormat += $" {methodArgs[index].Name}: 0x{{{index}:X8}},";
|
generator.Emit(OpCodes.Ldc_I4, inputArgsCount);
|
||||||
|
|
||||||
generator.Emit(OpCodes.Dup);
|
generator.Emit(OpCodes.Newarr, typeof(object));
|
||||||
generator.Emit(OpCodes.Ldc_I4_S, index);
|
|
||||||
generator.Emit(OpCodes.Conv_I);
|
|
||||||
|
|
||||||
generator.Emit(OpCodes.Ldarg_1);
|
string argsFormat = svcName;
|
||||||
generator.Emit(OpCodes.Ldc_I4, byRefArgsCount + index);
|
|
||||||
|
|
||||||
MethodInfo info = typeof(IExecutionContext).GetMethod(nameof(IExecutionContext.GetX));
|
for (int index = 0; index < inputArgsCount; index++)
|
||||||
|
{
|
||||||
|
argsFormat += $" {methodArgs[index].Name}: 0x{{{index}:X8}},";
|
||||||
|
|
||||||
generator.Emit(OpCodes.Call, info);
|
generator.Emit(OpCodes.Dup);
|
||||||
|
generator.Emit(OpCodes.Ldc_I4, index);
|
||||||
|
|
||||||
generator.Emit(OpCodes.Box, typeof(ulong));
|
generator.Emit(OpCodes.Ldarg_1);
|
||||||
|
generator.Emit(OpCodes.Ldc_I4, byRefArgsCount + index);
|
||||||
|
|
||||||
generator.Emit(OpCodes.Stelem_Ref);
|
MethodInfo info = typeof(IExecutionContext).GetMethod(nameof(IExecutionContext.GetX));
|
||||||
|
|
||||||
|
generator.Emit(OpCodes.Call, info);
|
||||||
|
|
||||||
|
generator.Emit(OpCodes.Box, typeof(ulong));
|
||||||
|
|
||||||
|
generator.Emit(OpCodes.Stelem_Ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
argsFormat = argsFormat.Substring(0, argsFormat.Length - 1);
|
||||||
|
|
||||||
|
generator.Emit(OpCodes.Ldstr, argsFormat);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
generator.Emit(OpCodes.Ldnull);
|
||||||
|
|
||||||
argsFormat = argsFormat.Substring(0, argsFormat.Length - 1);
|
generator.Emit(OpCodes.Ldstr, svcName);
|
||||||
|
}
|
||||||
generator.Emit(OpCodes.Ldstr, argsFormat);
|
|
||||||
|
|
||||||
BindingFlags staticNonPublic = BindingFlags.NonPublic | BindingFlags.Static;
|
|
||||||
|
|
||||||
MethodInfo printArgsMethod = typeof(SvcTable).GetMethod(nameof(PrintArguments), staticNonPublic);
|
MethodInfo printArgsMethod = typeof(SvcTable).GetMethod(nameof(PrintArguments), staticNonPublic);
|
||||||
|
|
||||||
|
@ -226,7 +234,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
||||||
throw new InvalidOperationException($"Method \"{svcName}\" has a invalid ref type \"{argType.Name}\".");
|
throw new InvalidOperationException($"Method \"{svcName}\" has a invalid ref type \"{argType.Name}\".");
|
||||||
}
|
}
|
||||||
|
|
||||||
generator.Emit(OpCodes.Ldloca_S, (byte)local.LocalIndex);
|
generator.Emit(OpCodes.Ldloca, local);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -325,6 +333,18 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
||||||
throw new InvalidSvcException($"Method \"{svcName}\" has a invalid ref type \"{type.Name}\".");
|
throw new InvalidSvcException($"Method \"{svcName}\" has a invalid ref type \"{type.Name}\".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void PrintArguments(object[] argValues, string formatOrSvcName)
|
||||||
|
{
|
||||||
|
if (argValues != null)
|
||||||
|
{
|
||||||
|
Logger.PrintDebug(LogClass.KernelSvc, string.Format(formatOrSvcName, argValues));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.PrintDebug(LogClass.KernelSvc, formatOrSvcName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void PrintResult(KernelResult result, string svcName)
|
private static void PrintResult(KernelResult result, string svcName)
|
||||||
{
|
{
|
||||||
if (result != KernelResult.Success &&
|
if (result != KernelResult.Success &&
|
||||||
|
@ -339,10 +359,5 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
||||||
Logger.PrintDebug(LogClass.KernelSvc, $"{svcName} returned result {result}.");
|
Logger.PrintDebug(LogClass.KernelSvc, $"{svcName} returned result {result}.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void PrintArguments(object[] argValues, string format)
|
|
||||||
{
|
|
||||||
Logger.PrintDebug(LogClass.KernelSvc, string.Format(format, argValues));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
using Ryujinx.HLE.HOS.SystemState;
|
using Ryujinx.HLE.Utilities;
|
||||||
using Ryujinx.HLE.Utilities;
|
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Acc
|
namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||||
{
|
{
|
||||||
public class AccountUtils
|
public class AccountUtils
|
||||||
{
|
{
|
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||||
|
{
|
||||||
|
[Service("acc:su")]
|
||||||
|
class IAccountServiceForAdministrator : IpcService
|
||||||
|
{
|
||||||
|
public IAccountServiceForAdministrator(ServiceCtx context) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,22 +1,18 @@
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE.FileSystem;
|
using Ryujinx.HLE.HOS.Services.Arp;
|
||||||
using Ryujinx.HLE.HOS.Services.Glue;
|
|
||||||
using Ryujinx.HLE.HOS.SystemState;
|
|
||||||
using Ryujinx.HLE.Utilities;
|
using Ryujinx.HLE.Utilities;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Acc
|
namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||||
{
|
{
|
||||||
[Service("acc:u0")]
|
[Service("acc:u0")]
|
||||||
[Service("acc:u1")]
|
class IAccountServiceForApplication : IpcService
|
||||||
class IAccountService : IpcService
|
|
||||||
{
|
{
|
||||||
private bool _userRegistrationRequestPermitted = false;
|
private bool _userRegistrationRequestPermitted = false;
|
||||||
|
|
||||||
private ApplicationLaunchProperty _applicationLaunchProperty;
|
private ApplicationLaunchProperty _applicationLaunchProperty;
|
||||||
|
|
||||||
public IAccountService(ServiceCtx context) { }
|
public IAccountServiceForApplication(ServiceCtx context) { }
|
||||||
|
|
||||||
[Command(0)]
|
[Command(0)]
|
||||||
// GetUserCount() -> i32
|
// GetUserCount() -> i32
|
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||||
|
{
|
||||||
|
[Service("acc:u1")]
|
||||||
|
class IAccountServiceForSystemService : IpcService
|
||||||
|
{
|
||||||
|
public IAccountServiceForSystemService(ServiceCtx context) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||||
|
{
|
||||||
|
[Service("acc:aa")]
|
||||||
|
class IBaasAccessTokenAccessor : IpcService
|
||||||
|
{
|
||||||
|
public IBaasAccessTokenAccessor(ServiceCtx context) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE.HOS.Services.Glue;
|
using Ryujinx.HLE.HOS.Services.Arp;
|
||||||
using Ryujinx.HLE.Utilities;
|
using Ryujinx.HLE.Utilities;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Acc
|
namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||||
{
|
{
|
||||||
class IManagerForApplication : IpcService
|
class IManagerForApplication : IpcService
|
||||||
{
|
{
|
|
@ -1,12 +1,11 @@
|
||||||
using ARMeilleure.Memory;
|
using ARMeilleure.Memory;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE.HOS.SystemState;
|
|
||||||
using Ryujinx.HLE.Utilities;
|
using Ryujinx.HLE.Utilities;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Acc
|
namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||||
{
|
{
|
||||||
class IProfile : IpcService
|
class IProfile : IpcService
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.SystemState
|
namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||||
{
|
{
|
||||||
public enum AccountState
|
public enum AccountState
|
||||||
{
|
{
|
|
@ -1,7 +1,7 @@
|
||||||
using Ryujinx.HLE.Utilities;
|
using Ryujinx.HLE.Utilities;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.SystemState
|
namespace Ryujinx.HLE.HOS.Services.Account.Acc
|
||||||
{
|
{
|
||||||
class UserProfile
|
class UserProfile
|
||||||
{
|
{
|
8
Ryujinx.HLE/HOS/Services/Account/Dauth/IService.cs
Normal file
8
Ryujinx.HLE/HOS/Services/Account/Dauth/IService.cs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Account.Dauth
|
||||||
|
{
|
||||||
|
[Service("dauth:0")] // 5.0.0+
|
||||||
|
class IService : IpcService
|
||||||
|
{
|
||||||
|
public IService(ServiceCtx context) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Acc
|
namespace Ryujinx.HLE.HOS.Services.Account
|
||||||
{
|
{
|
||||||
enum ResultCode
|
enum ResultCode
|
||||||
{
|
{
|
|
@ -1,4 +1,6 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
using Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService
|
||||||
{
|
{
|
||||||
class ISystemAppletProxy : IpcService
|
class ISystemAppletProxy : IpcService
|
||||||
{
|
{
|
|
@ -2,9 +2,10 @@
|
||||||
using Ryujinx.HLE.HOS.Ipc;
|
using Ryujinx.HLE.HOS.Ipc;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Common;
|
using Ryujinx.HLE.HOS.Kernel.Common;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
|
using Ryujinx.HLE.HOS.Services.Am.AppletAE.Storage;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.LibraryAppletCreator
|
||||||
{
|
{
|
||||||
class ILibraryAppletAccessor : IpcService
|
class ILibraryAppletAccessor : IpcService
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
|
||||||
{
|
{
|
||||||
class IApplicationCreator : IpcService
|
class IApplicationCreator : IpcService
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
|
||||||
{
|
{
|
||||||
class IAudioController : IpcService
|
class IAudioController : IpcService
|
||||||
{
|
{
|
|
@ -2,15 +2,16 @@ using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE.HOS.Ipc;
|
using Ryujinx.HLE.HOS.Ipc;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Common;
|
using Ryujinx.HLE.HOS.Kernel.Common;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
|
using Ryujinx.HLE.HOS.Services.Apm;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
|
||||||
{
|
{
|
||||||
class ICommonStateGetter : IpcService
|
class ICommonStateGetter : IpcService
|
||||||
{
|
{
|
||||||
private KEvent _displayResolutionChangeEvent;
|
private KEvent _displayResolutionChangeEvent;
|
||||||
|
|
||||||
private Apm.CpuBoostMode _cpuBoostMode = Apm.CpuBoostMode.Disabled;
|
private CpuBoostMode _cpuBoostMode = CpuBoostMode.Disabled;
|
||||||
|
|
||||||
public ICommonStateGetter(Horizon system)
|
public ICommonStateGetter(Horizon system)
|
||||||
{
|
{
|
||||||
|
@ -64,9 +65,9 @@ namespace Ryujinx.HLE.HOS.Services.Am
|
||||||
// GetPerformanceMode() -> u32
|
// GetPerformanceMode() -> u32
|
||||||
public ResultCode GetPerformanceMode(ServiceCtx context)
|
public ResultCode GetPerformanceMode(ServiceCtx context)
|
||||||
{
|
{
|
||||||
Apm.PerformanceMode mode = context.Device.System.State.DockedMode
|
PerformanceMode mode = context.Device.System.State.DockedMode
|
||||||
? Apm.PerformanceMode.Docked
|
? PerformanceMode.Docked
|
||||||
: Apm.PerformanceMode.Handheld;
|
: PerformanceMode.Handheld;
|
||||||
|
|
||||||
context.ResponseData.Write((int)mode);
|
context.ResponseData.Write((int)mode);
|
||||||
|
|
||||||
|
@ -130,7 +131,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
|
||||||
return ResultCode.CpuBoostModeInvalid;
|
return ResultCode.CpuBoostModeInvalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
_cpuBoostMode = (Apm.CpuBoostMode)cpuBoostMode;
|
_cpuBoostMode = (CpuBoostMode)cpuBoostMode;
|
||||||
|
|
||||||
// NOTE: There is a condition variable after the assignment, probably waiting something with apm:sys service (SetCpuBoostMode call?).
|
// NOTE: There is a condition variable after the assignment, probably waiting something with apm:sys service (SetCpuBoostMode call?).
|
||||||
// Since we will probably never support CPU boost things, it's not needed to implement more.
|
// Since we will probably never support CPU boost things, it's not needed to implement more.
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
|
||||||
|
{
|
||||||
|
class IDebugFunctions : IpcService
|
||||||
|
{
|
||||||
|
public IDebugFunctions() { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
|
||||||
{
|
{
|
||||||
class IDisplayController : IpcService
|
class IDisplayController : IpcService
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
|
||||||
{
|
{
|
||||||
class IGlobalStateController : IpcService
|
class IGlobalStateController : IpcService
|
||||||
{
|
{
|
|
@ -4,7 +4,7 @@ using Ryujinx.HLE.HOS.Kernel.Common;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
|
||||||
{
|
{
|
||||||
class IHomeMenuFunctions : IpcService
|
class IHomeMenuFunctions : IpcService
|
||||||
{
|
{
|
|
@ -1,4 +1,6 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
using Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.LibraryAppletCreator;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
|
||||||
{
|
{
|
||||||
class ILibraryAppletCreator : IpcService
|
class ILibraryAppletCreator : IpcService
|
||||||
{
|
{
|
|
@ -4,7 +4,7 @@ using Ryujinx.HLE.HOS.Kernel.Common;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
|
||||||
{
|
{
|
||||||
class ISelfController : IpcService
|
class ISelfController : IpcService
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
|
||||||
{
|
{
|
||||||
class IWindowController : IpcService
|
class IWindowController : IpcService
|
||||||
{
|
{
|
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
|
||||||
|
{
|
||||||
|
enum FocusState
|
||||||
|
{
|
||||||
|
InFocus = 1,
|
||||||
|
OutOfFocus = 2
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
|
||||||
{
|
{
|
||||||
enum MessageInfo
|
enum MessageInfo
|
||||||
{
|
{
|
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy
|
||||||
|
{
|
||||||
|
enum OperationMode
|
||||||
|
{
|
||||||
|
Handheld = 0,
|
||||||
|
Docked = 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
using Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE
|
||||||
{
|
{
|
||||||
[Service("appletAE")]
|
[Service("appletAE")]
|
||||||
class IAllSystemAppletProxiesService : IpcService
|
class IAllSystemAppletProxiesService : IpcService
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE
|
||||||
{
|
{
|
||||||
class IStorage : IpcService
|
class IStorage : IpcService
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE
|
||||||
{
|
{
|
||||||
class IStorageAccessor : IpcService
|
class IStorageAccessor : IpcService
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletAE.Storage
|
||||||
{
|
{
|
||||||
class StorageHelper
|
class StorageHelper
|
||||||
{
|
{
|
||||||
|
@ -16,9 +16,9 @@ namespace Ryujinx.HLE.HOS.Services.Am
|
||||||
ms.SetLength(0x88);
|
ms.SetLength(0x88);
|
||||||
|
|
||||||
writer.Write(LaunchParamsMagic);
|
writer.Write(LaunchParamsMagic);
|
||||||
writer.Write(1); //IsAccountSelected? Only lower 8 bits actually used.
|
writer.Write(1); // IsAccountSelected? Only lower 8 bits actually used.
|
||||||
writer.Write(1L); //User Id Low (note: User Id needs to be != 0)
|
writer.Write(1L); // User Id Low (note: User Id needs to be != 0)
|
||||||
writer.Write(0L); //User Id High
|
writer.Write(0L); // User Id High
|
||||||
|
|
||||||
return ms.ToArray();
|
return ms.ToArray();
|
||||||
}
|
}
|
|
@ -1,10 +1,21 @@
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
|
using Ryujinx.HLE.HOS.Ipc;
|
||||||
|
using Ryujinx.HLE.HOS.Kernel.Common;
|
||||||
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
|
using Ryujinx.HLE.HOS.Services.Am.AppletAE;
|
||||||
|
using Ryujinx.HLE.HOS.Services.Am.AppletAE.Storage;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.ApplicationProxy
|
||||||
{
|
{
|
||||||
class IApplicationFunctions : IpcService
|
class IApplicationFunctions : IpcService
|
||||||
{
|
{
|
||||||
public IApplicationFunctions() { }
|
private KEvent _gpuErrorDetectedSystemEvent;
|
||||||
|
|
||||||
|
public IApplicationFunctions(Horizon system)
|
||||||
|
{
|
||||||
|
_gpuErrorDetectedSystemEvent = new KEvent(system);
|
||||||
|
}
|
||||||
|
|
||||||
[Command(1)]
|
[Command(1)]
|
||||||
// PopLaunchParameter(u32) -> object<nn::am::service::IStorage>
|
// PopLaunchParameter(u32) -> object<nn::am::service::IStorage>
|
||||||
|
@ -111,5 +122,23 @@ namespace Ryujinx.HLE.HOS.Services.Am
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Command(130)] // 8.0.0+
|
||||||
|
// GetGpuErrorDetectedSystemEvent() -> handle<copy>
|
||||||
|
public ResultCode GetGpuErrorDetectedSystemEvent(ServiceCtx context)
|
||||||
|
{
|
||||||
|
if (context.Process.HandleTable.GenerateHandle(_gpuErrorDetectedSystemEvent.ReadableEvent, out int gpuErrorDetectedSystemEventHandle) != KernelResult.Success)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Out of handles!");
|
||||||
|
}
|
||||||
|
|
||||||
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(gpuErrorDetectedSystemEventHandle);
|
||||||
|
|
||||||
|
// NOTE: This is used by "sdk" NSO during applet-application initialization.
|
||||||
|
// A seperate thread is setup where event-waiting is handled.
|
||||||
|
// When the Event is signaled, official sw will assert.
|
||||||
|
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,7 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
using Ryujinx.HLE.HOS.Services.Am.AppletAE.AllSystemAppletProxiesService.SystemAppletProxy;
|
||||||
|
using Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.ApplicationProxy;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService
|
||||||
{
|
{
|
||||||
class IApplicationProxy : IpcService
|
class IApplicationProxy : IpcService
|
||||||
{
|
{
|
||||||
|
@ -62,7 +65,7 @@ namespace Ryujinx.HLE.HOS.Services.Am
|
||||||
// GetApplicationFunctions() -> object<nn::am::service::IApplicationFunctions>
|
// GetApplicationFunctions() -> object<nn::am::service::IApplicationFunctions>
|
||||||
public ResultCode GetApplicationFunctions(ServiceCtx context)
|
public ResultCode GetApplicationFunctions(ServiceCtx context)
|
||||||
{
|
{
|
||||||
MakeObject(context, new IApplicationFunctions());
|
MakeObject(context, new IApplicationFunctions(context.Device.System));
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
|
using Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
namespace Ryujinx.HLE.HOS.Services.Am
|
||||||
{
|
{
|
||||||
[Service("appletOE")]
|
[Service("appletOE")]
|
|
@ -1,8 +0,0 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
|
||||||
{
|
|
||||||
enum FocusState
|
|
||||||
{
|
|
||||||
InFocus = 1,
|
|
||||||
OutOfFocus = 2
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
|
||||||
{
|
|
||||||
class IDebugFunctions : IpcService
|
|
||||||
{
|
|
||||||
public IDebugFunctions() { }
|
|
||||||
}
|
|
||||||
}
|
|
8
Ryujinx.HLE/HOS/Services/Am/Idle/IPolicyManagerSystem.cs
Normal file
8
Ryujinx.HLE/HOS/Services/Am/Idle/IPolicyManagerSystem.cs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Am.Idle
|
||||||
|
{
|
||||||
|
[Service("idle:sys")]
|
||||||
|
class IPolicyManagerSystem : IpcService
|
||||||
|
{
|
||||||
|
public IPolicyManagerSystem(ServiceCtx context) { }
|
||||||
|
}
|
||||||
|
}
|
8
Ryujinx.HLE/HOS/Services/Am/Omm/IOperationModeManager.cs
Normal file
8
Ryujinx.HLE/HOS/Services/Am/Omm/IOperationModeManager.cs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Am.Omm
|
||||||
|
{
|
||||||
|
[Service("omm")]
|
||||||
|
class IOperationModeManager : IpcService
|
||||||
|
{
|
||||||
|
public IOperationModeManager(ServiceCtx context) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Am
|
|
||||||
{
|
|
||||||
enum OperationMode
|
|
||||||
{
|
|
||||||
Handheld = 0,
|
|
||||||
Docked = 1
|
|
||||||
}
|
|
||||||
}
|
|
8
Ryujinx.HLE/HOS/Services/Am/Spsm/IPowerStateInterface.cs
Normal file
8
Ryujinx.HLE/HOS/Services/Am/Spsm/IPowerStateInterface.cs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Am.Spsm
|
||||||
|
{
|
||||||
|
[Service("spsm")]
|
||||||
|
class IPowerStateInterface : IpcService
|
||||||
|
{
|
||||||
|
public IPowerStateInterface(ServiceCtx context) { }
|
||||||
|
}
|
||||||
|
}
|
8
Ryujinx.HLE/HOS/Services/Am/Tcap/IManager.cs
Normal file
8
Ryujinx.HLE/HOS/Services/Am/Tcap/IManager.cs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Am.Tcap
|
||||||
|
{
|
||||||
|
[Service("tcap")]
|
||||||
|
class IManager : IpcService
|
||||||
|
{
|
||||||
|
public IManager(ServiceCtx context) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,8 +2,8 @@ using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Graphics.Gal;
|
using Ryujinx.Graphics.Gal;
|
||||||
using Ryujinx.Graphics.Memory;
|
using Ryujinx.Graphics.Memory;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
using Ryujinx.HLE.HOS.Services.Nv.NvGpuAS;
|
using Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvGpuAS;
|
||||||
using Ryujinx.HLE.HOS.Services.Nv.NvMap;
|
using Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -28,101 +28,6 @@ namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
private const int BufferQueueCount = 0x40;
|
private const int BufferQueueCount = 0x40;
|
||||||
private const int BufferQueueMask = BufferQueueCount - 1;
|
private const int BufferQueueMask = BufferQueueCount - 1;
|
||||||
|
|
||||||
[Flags]
|
|
||||||
private enum HalTransform
|
|
||||||
{
|
|
||||||
FlipX = 1,
|
|
||||||
FlipY = 2,
|
|
||||||
Rotate90 = 4,
|
|
||||||
Rotate180 = FlipX | FlipY,
|
|
||||||
Rotate270 = Rotate90 | Rotate180,
|
|
||||||
}
|
|
||||||
|
|
||||||
private enum BufferState
|
|
||||||
{
|
|
||||||
Free,
|
|
||||||
Dequeued,
|
|
||||||
Queued,
|
|
||||||
Acquired
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x8)]
|
|
||||||
private struct Fence
|
|
||||||
{
|
|
||||||
public int id;
|
|
||||||
public int value;
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 0x24)]
|
|
||||||
private struct MultiFence
|
|
||||||
{
|
|
||||||
[FieldOffset(0x0)]
|
|
||||||
public int FenceCount;
|
|
||||||
|
|
||||||
[FieldOffset(0x4)]
|
|
||||||
public Fence Fence0;
|
|
||||||
|
|
||||||
[FieldOffset(0xC)]
|
|
||||||
public Fence Fence1;
|
|
||||||
|
|
||||||
[FieldOffset(0x14)]
|
|
||||||
public Fence Fence2;
|
|
||||||
|
|
||||||
[FieldOffset(0x1C)]
|
|
||||||
public Fence Fence3;
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x10)]
|
|
||||||
private struct Rect
|
|
||||||
{
|
|
||||||
public int Top;
|
|
||||||
public int Left;
|
|
||||||
public int Right;
|
|
||||||
public int Bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit)]
|
|
||||||
private struct QueueBufferObject
|
|
||||||
{
|
|
||||||
[FieldOffset(0x0)]
|
|
||||||
public long Timestamp;
|
|
||||||
|
|
||||||
[FieldOffset(0x8)]
|
|
||||||
public int IsAutoTimestamp;
|
|
||||||
|
|
||||||
[FieldOffset(0xC)]
|
|
||||||
public Rect Crop;
|
|
||||||
|
|
||||||
[FieldOffset(0x1C)]
|
|
||||||
public int ScalingMode;
|
|
||||||
|
|
||||||
[FieldOffset(0x20)]
|
|
||||||
public HalTransform Transform;
|
|
||||||
|
|
||||||
[FieldOffset(0x24)]
|
|
||||||
public int StickyTransform;
|
|
||||||
|
|
||||||
[FieldOffset(0x28)]
|
|
||||||
public int Unknown;
|
|
||||||
|
|
||||||
[FieldOffset(0x2C)]
|
|
||||||
public int SwapInterval;
|
|
||||||
|
|
||||||
[FieldOffset(0x30)]
|
|
||||||
public MultiFence Fence;
|
|
||||||
}
|
|
||||||
|
|
||||||
private struct BufferEntry
|
|
||||||
{
|
|
||||||
public BufferState State;
|
|
||||||
|
|
||||||
public HalTransform Transform;
|
|
||||||
|
|
||||||
public Rect Crop;
|
|
||||||
|
|
||||||
public GbpBuffer Data;
|
|
||||||
}
|
|
||||||
|
|
||||||
private BufferEntry[] _bufferQueue;
|
private BufferEntry[] _bufferQueue;
|
||||||
|
|
||||||
private AutoResetEvent _waitBufferFree;
|
private AutoResetEvent _waitBufferFree;
|
13
Ryujinx.HLE/HOS/Services/Android/Types/BufferEntry.cs
Normal file
13
Ryujinx.HLE/HOS/Services/Android/Types/BufferEntry.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
struct BufferEntry
|
||||||
|
{
|
||||||
|
public BufferState State;
|
||||||
|
|
||||||
|
public HalTransform Transform;
|
||||||
|
|
||||||
|
public Rect Crop;
|
||||||
|
|
||||||
|
public GbpBuffer Data;
|
||||||
|
}
|
||||||
|
}
|
10
Ryujinx.HLE/HOS/Services/Android/Types/BufferState.cs
Normal file
10
Ryujinx.HLE/HOS/Services/Android/Types/BufferState.cs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
enum BufferState
|
||||||
|
{
|
||||||
|
Free,
|
||||||
|
Dequeued,
|
||||||
|
Queued,
|
||||||
|
Acquired
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
enum ColorBytePerPixel
|
||||||
|
{
|
||||||
|
Bpp1 = 1,
|
||||||
|
Bpp2 = 2,
|
||||||
|
Bpp4 = 4,
|
||||||
|
Bpp8 = 8,
|
||||||
|
Bpp16 = 16,
|
||||||
|
Bpp24 = 24,
|
||||||
|
Bpp32 = 32,
|
||||||
|
Bpp48 = 48,
|
||||||
|
Bpp64 = 64,
|
||||||
|
Bpp96 = 96,
|
||||||
|
Bpp128 = 128
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
enum ColorComponent : uint
|
||||||
|
{
|
||||||
|
X1 = (0x01 << ColorShift.Component) | ColorBytePerPixel.Bpp1,
|
||||||
|
X2 = (0x02 << ColorShift.Component) | ColorBytePerPixel.Bpp2,
|
||||||
|
X4 = (0x03 << ColorShift.Component) | ColorBytePerPixel.Bpp4,
|
||||||
|
X8 = (0x04 << ColorShift.Component) | ColorBytePerPixel.Bpp8,
|
||||||
|
Y4X4 = (0x05 << ColorShift.Component) | ColorBytePerPixel.Bpp8,
|
||||||
|
X3Y3Z2 = (0x06 << ColorShift.Component) | ColorBytePerPixel.Bpp8,
|
||||||
|
X8Y8 = (0x07 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
X8Y8X8Z8 = (0x08 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
Y8X8Z8X8 = (0x09 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
X16 = (0x0A << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
Y2X14 = (0x0B << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
Y4X12 = (0x0C << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
Y6X10 = (0x0D << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
Y8X8 = (0x0E << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
X10 = (0x0F << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
X12 = (0x10 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
Z5Y5X6 = (0x11 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
X5Y6Z5 = (0x12 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
X6Y5Z5 = (0x13 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
X1Y5Z5W5 = (0x14 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
X4Y4Z4W4 = (0x15 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
X5Y1Z5W5 = (0x16 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
X5Y5Z1W5 = (0x17 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
X5Y5Z5W1 = (0x18 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
||||||
|
X8Y8Z8 = (0x19 << ColorShift.Component) | ColorBytePerPixel.Bpp24,
|
||||||
|
X24 = (0x1A << ColorShift.Component) | ColorBytePerPixel.Bpp24,
|
||||||
|
X32 = (0x1C << ColorShift.Component) | ColorBytePerPixel.Bpp32,
|
||||||
|
X16Y16 = (0x1D << ColorShift.Component) | ColorBytePerPixel.Bpp32,
|
||||||
|
X11Y11Z10 = (0x1E << ColorShift.Component) | ColorBytePerPixel.Bpp32,
|
||||||
|
X2Y10Z10W10 = (0x20 << ColorShift.Component) | ColorBytePerPixel.Bpp32,
|
||||||
|
X8Y8Z8W8 = (0x21 << ColorShift.Component) | ColorBytePerPixel.Bpp32,
|
||||||
|
Y10X10 = (0x22 << ColorShift.Component) | ColorBytePerPixel.Bpp32,
|
||||||
|
X10Y10Z10W2 = (0x23 << ColorShift.Component) | ColorBytePerPixel.Bpp32,
|
||||||
|
Y12X12 = (0x24 << ColorShift.Component) | ColorBytePerPixel.Bpp32,
|
||||||
|
X20Y20Z20 = (0x26 << ColorShift.Component) | ColorBytePerPixel.Bpp64,
|
||||||
|
X16Y16Z16W16 = (0x27 << ColorShift.Component) | ColorBytePerPixel.Bpp64,
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
enum ColorDataType
|
||||||
|
{
|
||||||
|
Integer = 0x0 << ColorShift.DataType,
|
||||||
|
Float = 0x1 << ColorShift.DataType,
|
||||||
|
Stencil = 0x2 << ColorShift.DataType
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,136 +1,5 @@
|
||||||
// ReSharper disable InconsistentNaming
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
namespace Ryujinx.HLE.HOS.Services.Android
|
|
||||||
{
|
{
|
||||||
class ColorShift
|
|
||||||
{
|
|
||||||
public const int Swizzle = 16;
|
|
||||||
public const int DataType = 14;
|
|
||||||
public const int Space = 32;
|
|
||||||
public const int Component = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum ColorSwizzle
|
|
||||||
{
|
|
||||||
XYZW = 0x688 << ColorShift.Swizzle,
|
|
||||||
ZYXW = 0x60a << ColorShift.Swizzle,
|
|
||||||
WZYX = 0x053 << ColorShift.Swizzle,
|
|
||||||
YZWX = 0x0d1 << ColorShift.Swizzle,
|
|
||||||
XYZ1 = 0xa88 << ColorShift.Swizzle,
|
|
||||||
YZW1 = 0xad1 << ColorShift.Swizzle,
|
|
||||||
XXX1 = 0xa00 << ColorShift.Swizzle,
|
|
||||||
XZY1 = 0xa50 << ColorShift.Swizzle,
|
|
||||||
ZYX1 = 0xa0a << ColorShift.Swizzle,
|
|
||||||
WZY1 = 0xa53 << ColorShift.Swizzle,
|
|
||||||
X000 = 0x920 << ColorShift.Swizzle,
|
|
||||||
Y000 = 0x921 << ColorShift.Swizzle,
|
|
||||||
XY01 = 0xb08 << ColorShift.Swizzle,
|
|
||||||
X001 = 0xb20 << ColorShift.Swizzle,
|
|
||||||
X00X = 0x121 << ColorShift.Swizzle,
|
|
||||||
X00Y = 0x320 << ColorShift.Swizzle,
|
|
||||||
_0YX0 = 0x80c << ColorShift.Swizzle,
|
|
||||||
_0ZY0 = 0x814 << ColorShift.Swizzle,
|
|
||||||
_0XZ0 = 0x884 << ColorShift.Swizzle,
|
|
||||||
_0X00 = 0x904 << ColorShift.Swizzle,
|
|
||||||
_00X0 = 0x824 << ColorShift.Swizzle,
|
|
||||||
_000X = 0x124 << ColorShift.Swizzle,
|
|
||||||
_0XY0 = 0x844 << ColorShift.Swizzle,
|
|
||||||
XXXY = 0x200 << ColorShift.Swizzle,
|
|
||||||
YYYX = 0x049 << ColorShift.Swizzle
|
|
||||||
}
|
|
||||||
|
|
||||||
enum ColorBytePerPixel
|
|
||||||
{
|
|
||||||
Bpp1 = 1,
|
|
||||||
Bpp2 = 2,
|
|
||||||
Bpp4 = 4,
|
|
||||||
Bpp8 = 8,
|
|
||||||
Bpp16 = 16,
|
|
||||||
Bpp24 = 24,
|
|
||||||
Bpp32 = 32,
|
|
||||||
Bpp48 = 48,
|
|
||||||
Bpp64 = 64,
|
|
||||||
Bpp96 = 96,
|
|
||||||
Bpp128 = 128
|
|
||||||
}
|
|
||||||
|
|
||||||
enum ColorComponent : uint
|
|
||||||
{
|
|
||||||
X1 = (0x01 << ColorShift.Component) | ColorBytePerPixel.Bpp1,
|
|
||||||
X2 = (0x02 << ColorShift.Component) | ColorBytePerPixel.Bpp2,
|
|
||||||
X4 = (0x03 << ColorShift.Component) | ColorBytePerPixel.Bpp4,
|
|
||||||
X8 = (0x04 << ColorShift.Component) | ColorBytePerPixel.Bpp8,
|
|
||||||
Y4X4 = (0x05 << ColorShift.Component) | ColorBytePerPixel.Bpp8,
|
|
||||||
X3Y3Z2 = (0x06 << ColorShift.Component) | ColorBytePerPixel.Bpp8,
|
|
||||||
X8Y8 = (0x07 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
X8Y8X8Z8 = (0x08 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
Y8X8Z8X8 = (0x09 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
X16 = (0x0A << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
Y2X14 = (0x0B << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
Y4X12 = (0x0C << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
Y6X10 = (0x0D << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
Y8X8 = (0x0E << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
X10 = (0x0F << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
X12 = (0x10 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
Z5Y5X6 = (0x11 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
X5Y6Z5 = (0x12 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
X6Y5Z5 = (0x13 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
X1Y5Z5W5 = (0x14 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
X4Y4Z4W4 = (0x15 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
X5Y1Z5W5 = (0x16 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
X5Y5Z1W5 = (0x17 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
X5Y5Z5W1 = (0x18 << ColorShift.Component) | ColorBytePerPixel.Bpp16,
|
|
||||||
X8Y8Z8 = (0x19 << ColorShift.Component) | ColorBytePerPixel.Bpp24,
|
|
||||||
X24 = (0x1A << ColorShift.Component) | ColorBytePerPixel.Bpp24,
|
|
||||||
X32 = (0x1C << ColorShift.Component) | ColorBytePerPixel.Bpp32,
|
|
||||||
X16Y16 = (0x1D << ColorShift.Component) | ColorBytePerPixel.Bpp32,
|
|
||||||
X11Y11Z10 = (0x1E << ColorShift.Component) | ColorBytePerPixel.Bpp32,
|
|
||||||
X2Y10Z10W10 = (0x20 << ColorShift.Component) | ColorBytePerPixel.Bpp32,
|
|
||||||
X8Y8Z8W8 = (0x21 << ColorShift.Component) | ColorBytePerPixel.Bpp32,
|
|
||||||
Y10X10 = (0x22 << ColorShift.Component) | ColorBytePerPixel.Bpp32,
|
|
||||||
X10Y10Z10W2 = (0x23 << ColorShift.Component) | ColorBytePerPixel.Bpp32,
|
|
||||||
Y12X12 = (0x24 << ColorShift.Component) | ColorBytePerPixel.Bpp32,
|
|
||||||
X20Y20Z20 = (0x26 << ColorShift.Component) | ColorBytePerPixel.Bpp64,
|
|
||||||
X16Y16Z16W16 = (0x27 << ColorShift.Component) | ColorBytePerPixel.Bpp64,
|
|
||||||
}
|
|
||||||
|
|
||||||
enum ColorDataType
|
|
||||||
{
|
|
||||||
Integer = 0x0 << ColorShift.DataType,
|
|
||||||
Float = 0x1 << ColorShift.DataType,
|
|
||||||
Stencil = 0x2 << ColorShift.DataType
|
|
||||||
}
|
|
||||||
|
|
||||||
enum ColorSpace : ulong
|
|
||||||
{
|
|
||||||
NonColor = 0x0L << ColorShift.Space,
|
|
||||||
LinearRGBA = 0x1L << ColorShift.Space,
|
|
||||||
SRGB = 0x2L << ColorShift.Space,
|
|
||||||
|
|
||||||
RGB709 = 0x3L << ColorShift.Space,
|
|
||||||
LinearRGB709 = 0x4L << ColorShift.Space,
|
|
||||||
|
|
||||||
LinearScRGB = 0x5L << ColorShift.Space,
|
|
||||||
|
|
||||||
RGB2020 = 0x6L << ColorShift.Space,
|
|
||||||
LinearRGB2020 = 0x7L << ColorShift.Space,
|
|
||||||
RGB2020_PQ = 0x8L << ColorShift.Space,
|
|
||||||
|
|
||||||
ColorIndex = 0x9L << ColorShift.Space,
|
|
||||||
|
|
||||||
YCbCr601 = 0xAL << ColorShift.Space,
|
|
||||||
YCbCr601_RR = 0xBL << ColorShift.Space,
|
|
||||||
YCbCr601_ER = 0xCL << ColorShift.Space,
|
|
||||||
YCbCr709 = 0xDL << ColorShift.Space,
|
|
||||||
YCbCr709_ER = 0xEL << ColorShift.Space,
|
|
||||||
|
|
||||||
BayerRGGB = 0x10L << ColorShift.Space,
|
|
||||||
BayerBGGR = 0x11L << ColorShift.Space,
|
|
||||||
BayerGRBG = 0x12L << ColorShift.Space,
|
|
||||||
BayerGBRG = 0x13L << ColorShift.Space,
|
|
||||||
|
|
||||||
XYZ = 0x14L << ColorShift.Space,
|
|
||||||
}
|
|
||||||
|
|
||||||
enum ColorFormat : ulong
|
enum ColorFormat : ulong
|
||||||
{
|
{
|
||||||
NonColor8 = ColorSpace.NonColor | ColorSwizzle.X000 | ColorComponent.X8 | ColorDataType.Integer,
|
NonColor8 = ColorSpace.NonColor | ColorSwizzle.X000 | ColorComponent.X8 | ColorDataType.Integer,
|
10
Ryujinx.HLE/HOS/Services/Android/Types/Color/ColorShift.cs
Normal file
10
Ryujinx.HLE/HOS/Services/Android/Types/Color/ColorShift.cs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
class ColorShift
|
||||||
|
{
|
||||||
|
public const int Swizzle = 16;
|
||||||
|
public const int DataType = 14;
|
||||||
|
public const int Space = 32;
|
||||||
|
public const int Component = 8;
|
||||||
|
}
|
||||||
|
}
|
33
Ryujinx.HLE/HOS/Services/Android/Types/Color/ColorSpace.cs
Normal file
33
Ryujinx.HLE/HOS/Services/Android/Types/Color/ColorSpace.cs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
enum ColorSpace : ulong
|
||||||
|
{
|
||||||
|
NonColor = 0x0L << ColorShift.Space,
|
||||||
|
LinearRGBA = 0x1L << ColorShift.Space,
|
||||||
|
SRGB = 0x2L << ColorShift.Space,
|
||||||
|
|
||||||
|
RGB709 = 0x3L << ColorShift.Space,
|
||||||
|
LinearRGB709 = 0x4L << ColorShift.Space,
|
||||||
|
|
||||||
|
LinearScRGB = 0x5L << ColorShift.Space,
|
||||||
|
|
||||||
|
RGB2020 = 0x6L << ColorShift.Space,
|
||||||
|
LinearRGB2020 = 0x7L << ColorShift.Space,
|
||||||
|
RGB2020_PQ = 0x8L << ColorShift.Space,
|
||||||
|
|
||||||
|
ColorIndex = 0x9L << ColorShift.Space,
|
||||||
|
|
||||||
|
YCbCr601 = 0xAL << ColorShift.Space,
|
||||||
|
YCbCr601_RR = 0xBL << ColorShift.Space,
|
||||||
|
YCbCr601_ER = 0xCL << ColorShift.Space,
|
||||||
|
YCbCr709 = 0xDL << ColorShift.Space,
|
||||||
|
YCbCr709_ER = 0xEL << ColorShift.Space,
|
||||||
|
|
||||||
|
BayerRGGB = 0x10L << ColorShift.Space,
|
||||||
|
BayerBGGR = 0x11L << ColorShift.Space,
|
||||||
|
BayerGRBG = 0x12L << ColorShift.Space,
|
||||||
|
BayerGBRG = 0x13L << ColorShift.Space,
|
||||||
|
|
||||||
|
XYZ = 0x14L << ColorShift.Space,
|
||||||
|
}
|
||||||
|
}
|
31
Ryujinx.HLE/HOS/Services/Android/Types/Color/ColorSwizzle.cs
Normal file
31
Ryujinx.HLE/HOS/Services/Android/Types/Color/ColorSwizzle.cs
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
enum ColorSwizzle
|
||||||
|
{
|
||||||
|
XYZW = 0x688 << ColorShift.Swizzle,
|
||||||
|
ZYXW = 0x60a << ColorShift.Swizzle,
|
||||||
|
WZYX = 0x053 << ColorShift.Swizzle,
|
||||||
|
YZWX = 0x0d1 << ColorShift.Swizzle,
|
||||||
|
XYZ1 = 0xa88 << ColorShift.Swizzle,
|
||||||
|
YZW1 = 0xad1 << ColorShift.Swizzle,
|
||||||
|
XXX1 = 0xa00 << ColorShift.Swizzle,
|
||||||
|
XZY1 = 0xa50 << ColorShift.Swizzle,
|
||||||
|
ZYX1 = 0xa0a << ColorShift.Swizzle,
|
||||||
|
WZY1 = 0xa53 << ColorShift.Swizzle,
|
||||||
|
X000 = 0x920 << ColorShift.Swizzle,
|
||||||
|
Y000 = 0x921 << ColorShift.Swizzle,
|
||||||
|
XY01 = 0xb08 << ColorShift.Swizzle,
|
||||||
|
X001 = 0xb20 << ColorShift.Swizzle,
|
||||||
|
X00X = 0x121 << ColorShift.Swizzle,
|
||||||
|
X00Y = 0x320 << ColorShift.Swizzle,
|
||||||
|
_0YX0 = 0x80c << ColorShift.Swizzle,
|
||||||
|
_0ZY0 = 0x814 << ColorShift.Swizzle,
|
||||||
|
_0XZ0 = 0x884 << ColorShift.Swizzle,
|
||||||
|
_0X00 = 0x904 << ColorShift.Swizzle,
|
||||||
|
_00X0 = 0x824 << ColorShift.Swizzle,
|
||||||
|
_000X = 0x124 << ColorShift.Swizzle,
|
||||||
|
_0XY0 = 0x844 << ColorShift.Swizzle,
|
||||||
|
XXXY = 0x200 << ColorShift.Swizzle,
|
||||||
|
YYYX = 0x049 << ColorShift.Swizzle
|
||||||
|
}
|
||||||
|
}
|
11
Ryujinx.HLE/HOS/Services/Android/Types/Fence.cs
Normal file
11
Ryujinx.HLE/HOS/Services/Android/Types/Fence.cs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
[StructLayout(LayoutKind.Sequential, Size = 0x8)]
|
||||||
|
struct Fence
|
||||||
|
{
|
||||||
|
public int Id;
|
||||||
|
public int Value;
|
||||||
|
}
|
||||||
|
}
|
37
Ryujinx.HLE/HOS/Services/Android/Types/GbpBuffer.cs
Normal file
37
Ryujinx.HLE/HOS/Services/Android/Types/GbpBuffer.cs
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
using Ryujinx.Common;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
struct GbpBuffer
|
||||||
|
{
|
||||||
|
public GraphicBufferHeader Header { get; private set; }
|
||||||
|
public NvGraphicBuffer Buffer { get; private set; }
|
||||||
|
|
||||||
|
public int Size => Marshal.SizeOf<NvGraphicBuffer>() + Marshal.SizeOf<GraphicBufferHeader>();
|
||||||
|
|
||||||
|
public GbpBuffer(BinaryReader reader)
|
||||||
|
{
|
||||||
|
Header = reader.ReadStruct<GraphicBufferHeader>();
|
||||||
|
|
||||||
|
// ignore fds
|
||||||
|
// TODO: check if that is used in official implementation
|
||||||
|
reader.BaseStream.Position += Header.FdsCount * 4;
|
||||||
|
|
||||||
|
if (Header.IntsCount != 0x51)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException($"Unexpected Graphic Buffer ints count (expected 0x51, found 0x{Header.IntsCount:x}");
|
||||||
|
}
|
||||||
|
|
||||||
|
Buffer = reader.ReadStruct<NvGraphicBuffer>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Write(BinaryWriter writer)
|
||||||
|
{
|
||||||
|
writer.WriteStruct(Header);
|
||||||
|
writer.WriteStruct(Buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
[StructLayout(LayoutKind.Sequential, Size = 0x28)]
|
||||||
|
struct GraphicBufferHeader
|
||||||
|
{
|
||||||
|
public int Magic;
|
||||||
|
public int Width;
|
||||||
|
public int Height;
|
||||||
|
public int Stride;
|
||||||
|
public int Format;
|
||||||
|
public int Usage;
|
||||||
|
|
||||||
|
public int Pid;
|
||||||
|
public int RefCount;
|
||||||
|
|
||||||
|
public int FdsCount;
|
||||||
|
public int IntsCount;
|
||||||
|
}
|
||||||
|
}
|
14
Ryujinx.HLE/HOS/Services/Android/Types/HalTransform.cs
Normal file
14
Ryujinx.HLE/HOS/Services/Android/Types/HalTransform.cs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
[Flags]
|
||||||
|
enum HalTransform
|
||||||
|
{
|
||||||
|
FlipX = 1,
|
||||||
|
FlipY = 2,
|
||||||
|
Rotate90 = 4,
|
||||||
|
Rotate180 = FlipX | FlipY,
|
||||||
|
Rotate270 = Rotate90 | Rotate180
|
||||||
|
}
|
||||||
|
}
|
23
Ryujinx.HLE/HOS/Services/Android/Types/MultiFence.cs
Normal file
23
Ryujinx.HLE/HOS/Services/Android/Types/MultiFence.cs
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
[StructLayout(LayoutKind.Explicit, Size = 0x24)]
|
||||||
|
struct MultiFence
|
||||||
|
{
|
||||||
|
[FieldOffset(0x0)]
|
||||||
|
public int FenceCount;
|
||||||
|
|
||||||
|
[FieldOffset(0x4)]
|
||||||
|
public Fence Fence0;
|
||||||
|
|
||||||
|
[FieldOffset(0xC)]
|
||||||
|
public Fence Fence1;
|
||||||
|
|
||||||
|
[FieldOffset(0x14)]
|
||||||
|
public Fence Fence2;
|
||||||
|
|
||||||
|
[FieldOffset(0x1C)]
|
||||||
|
public Fence Fence3;
|
||||||
|
}
|
||||||
|
}
|
41
Ryujinx.HLE/HOS/Services/Android/Types/NvGraphicBuffer.cs
Normal file
41
Ryujinx.HLE/HOS/Services/Android/Types/NvGraphicBuffer.cs
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
[StructLayout(LayoutKind.Explicit, Size = 0x144)]
|
||||||
|
struct NvGraphicBuffer
|
||||||
|
{
|
||||||
|
[FieldOffset(0x4)]
|
||||||
|
public int NvMapId;
|
||||||
|
|
||||||
|
[FieldOffset(0xC)]
|
||||||
|
public int Magic;
|
||||||
|
|
||||||
|
[FieldOffset(0x10)]
|
||||||
|
public int Pid;
|
||||||
|
|
||||||
|
[FieldOffset(0x14)]
|
||||||
|
public int Type;
|
||||||
|
|
||||||
|
[FieldOffset(0x18)]
|
||||||
|
public int Usage;
|
||||||
|
|
||||||
|
[FieldOffset(0x1C)]
|
||||||
|
public int PixelFormat;
|
||||||
|
|
||||||
|
[FieldOffset(0x20)]
|
||||||
|
public int ExternalPixelFormat;
|
||||||
|
|
||||||
|
[FieldOffset(0x24)]
|
||||||
|
public int Stride;
|
||||||
|
|
||||||
|
[FieldOffset(0x28)]
|
||||||
|
public int FrameBufferSize;
|
||||||
|
|
||||||
|
[FieldOffset(0x2C)]
|
||||||
|
public int PlanesCount;
|
||||||
|
|
||||||
|
[FieldOffset(0x34)]
|
||||||
|
public NvGraphicBufferSurfaceArray Surfaces;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
[StructLayout(LayoutKind.Explicit, Size = 0x58)]
|
||||||
|
struct NvGraphicBufferSurface
|
||||||
|
{
|
||||||
|
[FieldOffset(0)]
|
||||||
|
public uint Width;
|
||||||
|
|
||||||
|
[FieldOffset(0x4)]
|
||||||
|
public uint Height;
|
||||||
|
|
||||||
|
[FieldOffset(0x8)]
|
||||||
|
public ColorFormat ColorFormat;
|
||||||
|
|
||||||
|
[FieldOffset(0x10)]
|
||||||
|
public int Layout;
|
||||||
|
|
||||||
|
[FieldOffset(0x14)]
|
||||||
|
public int Pitch;
|
||||||
|
|
||||||
|
[FieldOffset(0x18)]
|
||||||
|
public int NvMapHandle;
|
||||||
|
|
||||||
|
[FieldOffset(0x1C)]
|
||||||
|
public int Offset;
|
||||||
|
|
||||||
|
[FieldOffset(0x20)]
|
||||||
|
public int Kind;
|
||||||
|
|
||||||
|
[FieldOffset(0x24)]
|
||||||
|
public int BlockHeightLog2;
|
||||||
|
|
||||||
|
[FieldOffset(0x28)]
|
||||||
|
public int ScanFormat;
|
||||||
|
|
||||||
|
[FieldOffset(0x30)]
|
||||||
|
public long Flags;
|
||||||
|
|
||||||
|
[FieldOffset(0x38)]
|
||||||
|
public long Size;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
[StructLayout(LayoutKind.Explicit)]
|
||||||
|
struct NvGraphicBufferSurfaceArray
|
||||||
|
{
|
||||||
|
[FieldOffset(0x0)]
|
||||||
|
private NvGraphicBufferSurface Surface0;
|
||||||
|
|
||||||
|
[FieldOffset(0x58)]
|
||||||
|
private NvGraphicBufferSurface Surface1;
|
||||||
|
|
||||||
|
[FieldOffset(0xb0)]
|
||||||
|
private NvGraphicBufferSurface Surface2;
|
||||||
|
|
||||||
|
public NvGraphicBufferSurface this[int index]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (index == 0)
|
||||||
|
{
|
||||||
|
return Surface0;
|
||||||
|
}
|
||||||
|
else if (index == 1)
|
||||||
|
{
|
||||||
|
return Surface1;
|
||||||
|
}
|
||||||
|
else if (index == 2)
|
||||||
|
{
|
||||||
|
return Surface2;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new IndexOutOfRangeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
35
Ryujinx.HLE/HOS/Services/Android/Types/QueueBufferObject.cs
Normal file
35
Ryujinx.HLE/HOS/Services/Android/Types/QueueBufferObject.cs
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
[StructLayout(LayoutKind.Explicit)]
|
||||||
|
struct QueueBufferObject
|
||||||
|
{
|
||||||
|
[FieldOffset(0x0)]
|
||||||
|
public long Timestamp;
|
||||||
|
|
||||||
|
[FieldOffset(0x8)]
|
||||||
|
public int IsAutoTimestamp;
|
||||||
|
|
||||||
|
[FieldOffset(0xC)]
|
||||||
|
public Rect Crop;
|
||||||
|
|
||||||
|
[FieldOffset(0x1C)]
|
||||||
|
public int ScalingMode;
|
||||||
|
|
||||||
|
[FieldOffset(0x20)]
|
||||||
|
public HalTransform Transform;
|
||||||
|
|
||||||
|
[FieldOffset(0x24)]
|
||||||
|
public int StickyTransform;
|
||||||
|
|
||||||
|
[FieldOffset(0x28)]
|
||||||
|
public int Unknown;
|
||||||
|
|
||||||
|
[FieldOffset(0x2C)]
|
||||||
|
public int SwapInterval;
|
||||||
|
|
||||||
|
[FieldOffset(0x30)]
|
||||||
|
public MultiFence Fence;
|
||||||
|
}
|
||||||
|
}
|
13
Ryujinx.HLE/HOS/Services/Android/Types/Rect.cs
Normal file
13
Ryujinx.HLE/HOS/Services/Android/Types/Rect.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Android
|
||||||
|
{
|
||||||
|
[StructLayout(LayoutKind.Sequential, Size = 0x10)]
|
||||||
|
struct Rect
|
||||||
|
{
|
||||||
|
public int Top;
|
||||||
|
public int Left;
|
||||||
|
public int Right;
|
||||||
|
public int Bottom;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Apm
|
namespace Ryujinx.HLE.HOS.Services.Apm
|
||||||
{
|
{
|
||||||
[Service("apm")]
|
[Service("apm")] // 8.0.0+
|
||||||
[Service("apm:p")]
|
|
||||||
class IManager : IpcService
|
class IManager : IpcService
|
||||||
{
|
{
|
||||||
public IManager(ServiceCtx context) { }
|
public IManager(ServiceCtx context) { }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
using Ryujinx.HLE.Utilities;
|
using Ryujinx.HLE.Utilities;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Glue
|
namespace Ryujinx.HLE.HOS.Services.Arp
|
||||||
{
|
{
|
||||||
class ApplicationLaunchProperty
|
class ApplicationLaunchProperty
|
||||||
{
|
{
|
8
Ryujinx.HLE/HOS/Services/Arp/IReader.cs
Normal file
8
Ryujinx.HLE/HOS/Services/Arp/IReader.cs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Hid
|
||||||
|
{
|
||||||
|
[Service("arp:r")]
|
||||||
|
class IReader : IpcService
|
||||||
|
{
|
||||||
|
public IReader(ServiceCtx context) { }
|
||||||
|
}
|
||||||
|
}
|
8
Ryujinx.HLE/HOS/Services/Arp/IWriter.cs
Normal file
8
Ryujinx.HLE/HOS/Services/Arp/IWriter.cs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Arp
|
||||||
|
{
|
||||||
|
[Service("arp:w")]
|
||||||
|
class IWriter : IpcService
|
||||||
|
{
|
||||||
|
public IWriter(ServiceCtx context) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
|
||||||
{
|
|
||||||
static class AudioConsts
|
|
||||||
{
|
|
||||||
public const int HostSampleRate = 48000;
|
|
||||||
public const int HostChannelsCount = 2;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,192 +0,0 @@
|
||||||
using Ryujinx.Audio;
|
|
||||||
using Ryujinx.Common.Logging;
|
|
||||||
using Ryujinx.HLE.HOS.Services.Aud.AudioRenderer;
|
|
||||||
using Ryujinx.HLE.Utilities;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud
|
|
||||||
{
|
|
||||||
[Service("audren:u")]
|
|
||||||
class IAudioRendererManager : IpcService
|
|
||||||
{
|
|
||||||
private const int Rev0Magic = ('R' << 0) |
|
|
||||||
('E' << 8) |
|
|
||||||
('V' << 16) |
|
|
||||||
('0' << 24);
|
|
||||||
|
|
||||||
private const int Rev = 5;
|
|
||||||
|
|
||||||
public const int RevMagic = Rev0Magic + (Rev << 24);
|
|
||||||
|
|
||||||
public IAudioRendererManager(ServiceCtx context) { }
|
|
||||||
|
|
||||||
[Command(0)]
|
|
||||||
// OpenAudioRenderer(nn::audio::detail::AudioRendererParameterInternal, u64, nn::applet::AppletResourceUserId, pid, handle<copy>, handle<copy>)
|
|
||||||
// -> object<nn::audio::detail::IAudioRenderer>
|
|
||||||
public ResultCode OpenAudioRenderer(ServiceCtx context)
|
|
||||||
{
|
|
||||||
IAalOutput audioOut = context.Device.AudioOut;
|
|
||||||
|
|
||||||
AudioRendererParameter Params = GetAudioRendererParameter(context);
|
|
||||||
|
|
||||||
MakeObject(context, new IAudioRenderer(
|
|
||||||
context.Device.System,
|
|
||||||
context.Memory,
|
|
||||||
audioOut,
|
|
||||||
Params));
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Command(1)]
|
|
||||||
// GetWorkBufferSize(nn::audio::detail::AudioRendererParameterInternal) -> u64
|
|
||||||
public ResultCode GetAudioRendererWorkBufferSize(ServiceCtx context)
|
|
||||||
{
|
|
||||||
AudioRendererParameter Params = GetAudioRendererParameter(context);
|
|
||||||
|
|
||||||
int revision = (Params.Revision - Rev0Magic) >> 24;
|
|
||||||
|
|
||||||
if (revision <= Rev)
|
|
||||||
{
|
|
||||||
bool isSplitterSupported = revision >= 3;
|
|
||||||
bool isVariadicCommandBufferSizeSupported = revision >= 5;
|
|
||||||
|
|
||||||
long size;
|
|
||||||
|
|
||||||
size = IntUtils.AlignUp(Params.Unknown8 * 4, 64);
|
|
||||||
size += Params.MixCount * 0x400;
|
|
||||||
size += (Params.MixCount + 1) * 0x940;
|
|
||||||
size += Params.VoiceCount * 0x3F0;
|
|
||||||
size += IntUtils.AlignUp((Params.MixCount + 1) * 8, 16);
|
|
||||||
size += IntUtils.AlignUp(Params.VoiceCount * 8, 16);
|
|
||||||
size += IntUtils.AlignUp(
|
|
||||||
((Params.SinkCount + Params.MixCount) * 0x3C0 + Params.SampleCount * 4) *
|
|
||||||
(Params.Unknown8 + 6), 64);
|
|
||||||
size += (Params.SinkCount + Params.MixCount) * 0x2C0;
|
|
||||||
size += (Params.EffectCount + Params.VoiceCount * 4) * 0x30 + 0x50;
|
|
||||||
|
|
||||||
if (isSplitterSupported)
|
|
||||||
{
|
|
||||||
size += IntUtils.AlignUp((
|
|
||||||
NodeStatesGetWorkBufferSize(Params.MixCount + 1) +
|
|
||||||
EdgeMatrixGetWorkBufferSize(Params.MixCount + 1)), 16);
|
|
||||||
|
|
||||||
size += Params.SplitterDestinationDataCount * 0xE0;
|
|
||||||
size += Params.SplitterCount * 0x20;
|
|
||||||
size += IntUtils.AlignUp(Params.SplitterDestinationDataCount * 4, 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
size = Params.EffectCount * 0x4C0 +
|
|
||||||
Params.SinkCount * 0x170 +
|
|
||||||
Params.VoiceCount * 0x100 +
|
|
||||||
IntUtils.AlignUp(size, 64) + 0x40;
|
|
||||||
|
|
||||||
if (Params.PerformanceManagerCount >= 1)
|
|
||||||
{
|
|
||||||
size += (((Params.EffectCount +
|
|
||||||
Params.SinkCount +
|
|
||||||
Params.VoiceCount +
|
|
||||||
Params.MixCount + 1) * 16 + 0x658) *
|
|
||||||
(Params.PerformanceManagerCount + 1) + 0x13F) & ~0x3FL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isVariadicCommandBufferSizeSupported)
|
|
||||||
{
|
|
||||||
size += Params.EffectCount * 0x840 +
|
|
||||||
Params.MixCount * 0x5A38 +
|
|
||||||
Params.SinkCount * 0x148 +
|
|
||||||
Params.SplitterDestinationDataCount * 0x540 +
|
|
||||||
Params.VoiceCount * (Params.SplitterCount * 0x68 + 0x2E0) +
|
|
||||||
((Params.VoiceCount + Params.MixCount + Params.EffectCount + Params.SinkCount + 0x65) << 6) + 0x3F8 + 0x7E;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
size += 0x1807E;
|
|
||||||
}
|
|
||||||
|
|
||||||
size = size & ~0xFFFL;
|
|
||||||
|
|
||||||
context.ResponseData.Write(size);
|
|
||||||
|
|
||||||
Logger.PrintDebug(LogClass.ServiceAudio, $"WorkBufferSize is 0x{size:x16}.");
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
context.ResponseData.Write(0L);
|
|
||||||
|
|
||||||
Logger.PrintWarning(LogClass.ServiceAudio, $"Library Revision 0x{Params.Revision:x8} is not supported!");
|
|
||||||
|
|
||||||
return ResultCode.UnsupportedRevision;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private AudioRendererParameter GetAudioRendererParameter(ServiceCtx context)
|
|
||||||
{
|
|
||||||
AudioRendererParameter Params = new AudioRendererParameter();
|
|
||||||
|
|
||||||
Params.SampleRate = context.RequestData.ReadInt32();
|
|
||||||
Params.SampleCount = context.RequestData.ReadInt32();
|
|
||||||
Params.Unknown8 = context.RequestData.ReadInt32();
|
|
||||||
Params.MixCount = context.RequestData.ReadInt32();
|
|
||||||
Params.VoiceCount = context.RequestData.ReadInt32();
|
|
||||||
Params.SinkCount = context.RequestData.ReadInt32();
|
|
||||||
Params.EffectCount = context.RequestData.ReadInt32();
|
|
||||||
Params.PerformanceManagerCount = context.RequestData.ReadInt32();
|
|
||||||
Params.VoiceDropEnable = context.RequestData.ReadInt32();
|
|
||||||
Params.SplitterCount = context.RequestData.ReadInt32();
|
|
||||||
Params.SplitterDestinationDataCount = context.RequestData.ReadInt32();
|
|
||||||
Params.Unknown2C = context.RequestData.ReadInt32();
|
|
||||||
Params.Revision = context.RequestData.ReadInt32();
|
|
||||||
|
|
||||||
return Params;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int NodeStatesGetWorkBufferSize(int value)
|
|
||||||
{
|
|
||||||
int result = IntUtils.AlignUp(value, 64);
|
|
||||||
|
|
||||||
if (result < 0)
|
|
||||||
{
|
|
||||||
result |= 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 4 * (value * value) + 0x12 * value + 2 * (result / 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int EdgeMatrixGetWorkBufferSize(int value)
|
|
||||||
{
|
|
||||||
int result = IntUtils.AlignUp(value * value, 64);
|
|
||||||
|
|
||||||
if (result < 0)
|
|
||||||
{
|
|
||||||
result |= 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result / 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Command(2)]
|
|
||||||
// GetAudioDeviceService(nn::applet::AppletResourceUserId) -> object<nn::audio::detail::IAudioDevice>
|
|
||||||
public ResultCode GetAudioDeviceService(ServiceCtx context)
|
|
||||||
{
|
|
||||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
||||||
|
|
||||||
MakeObject(context, new IAudioDevice(context.Device.System));
|
|
||||||
|
|
||||||
return ResultCode.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Command(4)] // 4.0.0+
|
|
||||||
// GetAudioDeviceServiceWithRevisionInfo(nn::applet::AppletResourceUserId, u32) -> object<nn::audio::detail::IAudioDevice>
|
|
||||||
public ResultCode GetAudioDeviceServiceWithRevisionInfo(ServiceCtx context)
|
|
||||||
{
|
|
||||||
long appletResourceUserId = context.RequestData.ReadInt64();
|
|
||||||
int revisionInfo = context.RequestData.ReadInt32();
|
|
||||||
|
|
||||||
Logger.PrintStub(LogClass.ServiceAudio, new { appletResourceUserId, revisionInfo });
|
|
||||||
|
|
||||||
return GetAudioDeviceService(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -5,7 +5,7 @@ using Ryujinx.HLE.HOS.Kernel.Common;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud.AudioOut
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioOutManager
|
||||||
{
|
{
|
||||||
class IAudioOut : IpcService, IDisposable
|
class IAudioOut : IpcService, IDisposable
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud.AudioOut
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioOutManager
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
struct AudioOutData
|
struct AudioOutData
|
|
@ -0,0 +1,9 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
|
{
|
||||||
|
static class AudioRendererCommon
|
||||||
|
{
|
||||||
|
public static bool CheckValidRevision(AudioRendererParameter parameters) => GetRevisionVersion(parameters.Revision) <= AudioRendererConsts.Revision;
|
||||||
|
public static bool CheckFeatureSupported(int revision, int supportedRevision) => revision >= supportedRevision;
|
||||||
|
public static int GetRevisionVersion(int revision) => (revision - AudioRendererConsts.Rev0Magic) >> 24;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
|
{
|
||||||
|
class BehaviorInfo
|
||||||
|
{
|
||||||
|
private const int _revision = AudioRendererConsts.Revision;
|
||||||
|
|
||||||
|
private int _userRevision = 0;
|
||||||
|
|
||||||
|
public BehaviorInfo()
|
||||||
|
{
|
||||||
|
/* TODO: this class got a size of 0xC0
|
||||||
|
0x00 - uint - Internal Revision
|
||||||
|
0x04 - uint - User Revision
|
||||||
|
0x08 - ... unknown ...
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsSplitterSupported() => AudioRendererCommon.CheckFeatureSupported(_userRevision, SupportTags.Splitter);
|
||||||
|
public bool IsSplitterBugFixed() => AudioRendererCommon.CheckFeatureSupported(_userRevision, SupportTags.SplitterBugFix);
|
||||||
|
public bool IsVariadicCommandBufferSizeSupported() => AudioRendererCommon.CheckFeatureSupported(_userRevision, SupportTags.VariadicCommandBufferSize);
|
||||||
|
public bool IsElapsedFrameCountSupported() => AudioRendererCommon.CheckFeatureSupported(_userRevision, SupportTags.ElapsedFrameCount);
|
||||||
|
|
||||||
|
public int GetPerformanceMetricsDataFormat() => AudioRendererCommon.CheckFeatureSupported(_userRevision, SupportTags.PerformanceMetricsDataFormatVersion2) ? 2 : 1;
|
||||||
|
|
||||||
|
public void SetUserLibRevision(int revision)
|
||||||
|
{
|
||||||
|
_userRevision = AudioRendererCommon.GetRevisionVersion(revision);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
|
{
|
||||||
|
static class CommandGenerator
|
||||||
|
{
|
||||||
|
public static long CalculateCommandBufferSize(AudioRendererParameter parameters)
|
||||||
|
{
|
||||||
|
return parameters.EffectCount * 0x840 +
|
||||||
|
parameters.SubMixCount * 0x5A38 +
|
||||||
|
parameters.SinkCount * 0x148 +
|
||||||
|
parameters.SplitterDestinationDataCount * 0x540 +
|
||||||
|
(parameters.SplitterCount * 0x68 + 0x2E0) * parameters.VoiceCount +
|
||||||
|
((parameters.VoiceCount + parameters.SubMixCount + parameters.EffectCount + parameters.SinkCount + 0x65) << 6) +
|
||||||
|
0x3F8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
using Ryujinx.Common;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
|
{
|
||||||
|
static class EdgeMatrix
|
||||||
|
{
|
||||||
|
public static int GetWorkBufferSize(int totalMixCount)
|
||||||
|
{
|
||||||
|
int size = BitUtils.AlignUp(totalMixCount * totalMixCount, AudioRendererConsts.BufferAlignment);
|
||||||
|
|
||||||
|
if (size < 0)
|
||||||
|
{
|
||||||
|
size |= 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
return size / 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ using Ryujinx.HLE.HOS.SystemState;
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
{
|
{
|
||||||
class IAudioDevice : IpcService
|
class IAudioDevice : IpcService
|
||||||
{
|
{
|
|
@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
|
||||||
using System.Runtime.Intrinsics;
|
using System.Runtime.Intrinsics;
|
||||||
using System.Runtime.Intrinsics.X86;
|
using System.Runtime.Intrinsics.X86;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
{
|
{
|
||||||
class IAudioRenderer : IpcService, IDisposable
|
class IAudioRenderer : IpcService, IDisposable
|
||||||
{
|
{
|
||||||
|
@ -51,8 +51,8 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
||||||
_params = Params;
|
_params = Params;
|
||||||
|
|
||||||
_track = audioOut.OpenTrack(
|
_track = audioOut.OpenTrack(
|
||||||
AudioConsts.HostSampleRate,
|
AudioRendererConsts.HostSampleRate,
|
||||||
AudioConsts.HostChannelsCount,
|
AudioRendererConsts.HostChannelsCount,
|
||||||
AudioCallback);
|
AudioCallback);
|
||||||
|
|
||||||
_memoryPools = CreateArray<MemoryPoolContext>(Params.EffectCount + Params.VoiceCount * 4);
|
_memoryPools = CreateArray<MemoryPoolContext>(Params.EffectCount + Params.VoiceCount * 4);
|
||||||
|
@ -86,7 +86,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
||||||
// GetMixBufferCount() -> u32
|
// GetMixBufferCount() -> u32
|
||||||
public ResultCode GetMixBufferCount(ServiceCtx context)
|
public ResultCode GetMixBufferCount(ServiceCtx context)
|
||||||
{
|
{
|
||||||
context.ResponseData.Write(_params.MixCount);
|
context.ResponseData.Write(_params.SubMixCount);
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
@ -145,6 +145,10 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
||||||
|
|
||||||
UpdateDataHeader inputHeader = reader.Read<UpdateDataHeader>();
|
UpdateDataHeader inputHeader = reader.Read<UpdateDataHeader>();
|
||||||
|
|
||||||
|
BehaviorInfo behaviorInfo = new BehaviorInfo();
|
||||||
|
|
||||||
|
behaviorInfo.SetUserLibRevision(inputHeader.Revision);
|
||||||
|
|
||||||
reader.Read<BehaviorIn>(inputHeader.BehaviorSize);
|
reader.Read<BehaviorIn>(inputHeader.BehaviorSize);
|
||||||
|
|
||||||
MemoryPoolIn[] memoryPoolsIn = reader.Read<MemoryPoolIn>(inputHeader.MemoryPoolSize);
|
MemoryPoolIn[] memoryPoolsIn = reader.Read<MemoryPoolIn>(inputHeader.MemoryPoolSize);
|
||||||
|
@ -207,20 +211,27 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
||||||
|
|
||||||
int updateHeaderSize = Marshal.SizeOf<UpdateDataHeader>();
|
int updateHeaderSize = Marshal.SizeOf<UpdateDataHeader>();
|
||||||
|
|
||||||
outputHeader.Revision = IAudioRendererManager.RevMagic;
|
outputHeader.Revision = AudioRendererConsts.RevMagic;
|
||||||
outputHeader.BehaviorSize = 0xb0;
|
outputHeader.BehaviorSize = 0xb0;
|
||||||
outputHeader.MemoryPoolSize = (_params.EffectCount + _params.VoiceCount * 4) * 0x10;
|
outputHeader.MemoryPoolSize = (_params.EffectCount + _params.VoiceCount * 4) * 0x10;
|
||||||
outputHeader.VoiceSize = _params.VoiceCount * 0x10;
|
outputHeader.VoiceSize = _params.VoiceCount * 0x10;
|
||||||
outputHeader.EffectSize = _params.EffectCount * 0x10;
|
outputHeader.EffectSize = _params.EffectCount * 0x10;
|
||||||
outputHeader.SinkSize = _params.SinkCount * 0x20;
|
outputHeader.SinkSize = _params.SinkCount * 0x20;
|
||||||
outputHeader.PerformanceManagerSize = 0x10;
|
outputHeader.PerformanceManagerSize = 0x10;
|
||||||
outputHeader.TotalSize = updateHeaderSize +
|
|
||||||
outputHeader.BehaviorSize +
|
if (behaviorInfo.IsElapsedFrameCountSupported())
|
||||||
outputHeader.MemoryPoolSize +
|
{
|
||||||
outputHeader.VoiceSize +
|
outputHeader.ElapsedFrameCountInfoSize = 0x10;
|
||||||
outputHeader.EffectSize +
|
}
|
||||||
outputHeader.SinkSize +
|
|
||||||
outputHeader.PerformanceManagerSize;
|
outputHeader.TotalSize = updateHeaderSize +
|
||||||
|
outputHeader.BehaviorSize +
|
||||||
|
outputHeader.MemoryPoolSize +
|
||||||
|
outputHeader.VoiceSize +
|
||||||
|
outputHeader.EffectSize +
|
||||||
|
outputHeader.SinkSize +
|
||||||
|
outputHeader.PerformanceManagerSize +
|
||||||
|
outputHeader.ElapsedFrameCountInfoSize;
|
||||||
|
|
||||||
writer.Write(outputHeader);
|
writer.Write(outputHeader);
|
||||||
|
|
||||||
|
@ -280,9 +291,10 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
AdpcmDecoderContext context = new AdpcmDecoderContext();
|
AdpcmDecoderContext context = new AdpcmDecoderContext
|
||||||
|
{
|
||||||
context.Coefficients = new short[size >> 1];
|
Coefficients = new short[size >> 1]
|
||||||
|
};
|
||||||
|
|
||||||
for (int offset = 0; offset < size; offset += 2)
|
for (int offset = 0; offset < size; offset += 2)
|
||||||
{
|
{
|
||||||
|
@ -304,7 +316,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
||||||
|
|
||||||
private void AppendMixedBuffer(long tag)
|
private void AppendMixedBuffer(long tag)
|
||||||
{
|
{
|
||||||
int[] mixBuffer = new int[MixBufferSamplesCount * AudioConsts.HostChannelsCount];
|
int[] mixBuffer = new int[MixBufferSamplesCount * AudioRendererConsts.HostChannelsCount];
|
||||||
|
|
||||||
foreach (VoiceContext voice in _voices)
|
foreach (VoiceContext voice in _voices)
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
{
|
{
|
||||||
class MemoryPoolContext
|
class MemoryPoolContext
|
||||||
{
|
{
|
|
@ -0,0 +1,19 @@
|
||||||
|
using Ryujinx.Common;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
|
{
|
||||||
|
static class NodeStates
|
||||||
|
{
|
||||||
|
public static long GetWorkBufferSize(int totalMixCount)
|
||||||
|
{
|
||||||
|
int size = BitUtils.AlignUp(totalMixCount, AudioRendererConsts.BufferAlignment);
|
||||||
|
|
||||||
|
if (size < 0)
|
||||||
|
{
|
||||||
|
size |= 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 4 * (totalMixCount * totalMixCount) + 12 * totalMixCount + 2 * (size / 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
|
{
|
||||||
|
static class PerformanceManager
|
||||||
|
{
|
||||||
|
public static long GetRequiredBufferSizeForPerformanceMetricsPerFrame(BehaviorInfo behaviorInfo, AudioRendererParameter parameters)
|
||||||
|
{
|
||||||
|
int performanceMetricsDataFormat = behaviorInfo.GetPerformanceMetricsDataFormat();
|
||||||
|
|
||||||
|
if (performanceMetricsDataFormat == 2)
|
||||||
|
{
|
||||||
|
return 24 * (parameters.VoiceCount +
|
||||||
|
parameters.EffectCount +
|
||||||
|
parameters.SubMixCount +
|
||||||
|
parameters.SinkCount + 1) + 0x990;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (performanceMetricsDataFormat != 1)
|
||||||
|
{
|
||||||
|
Logger.PrintWarning(LogClass.ServiceAudio, $"PerformanceMetricsDataFormat: {performanceMetricsDataFormat} is not supported!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (((parameters.VoiceCount +
|
||||||
|
parameters.EffectCount +
|
||||||
|
parameters.SubMixCount +
|
||||||
|
parameters.SinkCount + 1) << 32) >> 0x1C) + 0x658;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
{
|
{
|
||||||
static class Resampler
|
static class Resampler
|
||||||
{
|
{
|
|
@ -0,0 +1,25 @@
|
||||||
|
using Ryujinx.Common;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
|
{
|
||||||
|
class SplitterContext
|
||||||
|
{
|
||||||
|
public static long CalcWorkBufferSize(BehaviorInfo behaviorInfo, AudioRendererParameter parameters)
|
||||||
|
{
|
||||||
|
if (!behaviorInfo.IsSplitterSupported())
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
long size = parameters.SplitterDestinationDataCount * 0xE0 +
|
||||||
|
parameters.SplitterCount * 0x20;
|
||||||
|
|
||||||
|
if (!behaviorInfo.IsSplitterBugFixed())
|
||||||
|
{
|
||||||
|
size += BitUtils.AlignUp(4 * parameters.SplitterDestinationDataCount, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
|
{
|
||||||
|
static class AudioRendererConsts
|
||||||
|
{
|
||||||
|
// Revision Consts
|
||||||
|
public const int Revision = 7;
|
||||||
|
public const int Rev0Magic = ('R' << 0) | ('E' << 8) | ('V' << 16) | ('0' << 24);
|
||||||
|
public const int RevMagic = Rev0Magic + (Revision << 24);
|
||||||
|
|
||||||
|
// Misc Consts
|
||||||
|
public const int BufferAlignment = 0x40;
|
||||||
|
|
||||||
|
// Host Consts
|
||||||
|
public const int HostSampleRate = 48000;
|
||||||
|
public const int HostChannelsCount = 2;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
struct AudioRendererParameter
|
struct AudioRendererParameter
|
||||||
{
|
{
|
||||||
public int SampleRate;
|
public int SampleRate;
|
||||||
public int SampleCount;
|
public int SampleCount;
|
||||||
public int Unknown8;
|
public int MixBufferCount;
|
||||||
public int MixCount;
|
public int SubMixCount;
|
||||||
public int VoiceCount;
|
public int VoiceCount;
|
||||||
public int SinkCount;
|
public int SinkCount;
|
||||||
public int EffectCount;
|
public int EffectCount;
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
|
||||||
struct BehaviorIn
|
struct BehaviorIn
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0xc, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Size = 0xc, Pack = 1)]
|
||||||
struct BiquadFilter
|
struct BiquadFilter
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x20, Pack = 4)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x20, Pack = 4)]
|
||||||
struct MemoryPoolIn
|
struct MemoryPoolIn
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
|
||||||
struct MemoryPoolOut
|
struct MemoryPoolOut
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
{
|
{
|
||||||
enum MemoryPoolState
|
enum MemoryPoolState
|
||||||
{
|
{
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
{
|
{
|
||||||
enum PlayState : byte
|
enum PlayState : byte
|
||||||
{
|
{
|
|
@ -0,0 +1,11 @@
|
||||||
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
|
{
|
||||||
|
static class SupportTags
|
||||||
|
{
|
||||||
|
public const int Splitter = 2;
|
||||||
|
public const int SplitterBugFix = 5;
|
||||||
|
public const int PerformanceMetricsDataFormatVersion2 = 5;
|
||||||
|
public const int VariadicCommandBufferSize = 5;
|
||||||
|
public const int ElapsedFrameCount = 5;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
{
|
{
|
||||||
struct UpdateDataHeader
|
struct UpdateDataHeader
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
public int SinkSize;
|
public int SinkSize;
|
||||||
public int PerformanceManagerSize;
|
public int PerformanceManagerSize;
|
||||||
public int Unknown24;
|
public int Unknown24;
|
||||||
public int Unknown28;
|
public int ElapsedFrameCountInfoSize;
|
||||||
public int Unknown2C;
|
public int Unknown2C;
|
||||||
public int Unknown30;
|
public int Unknown30;
|
||||||
public int Unknown34;
|
public int Unknown34;
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x70, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x70, Pack = 1)]
|
||||||
struct VoiceChannelResourceIn
|
struct VoiceChannelResourceIn
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x170, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x170, Pack = 1)]
|
||||||
struct VoiceIn
|
struct VoiceIn
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x10, Pack = 4)]
|
||||||
struct VoiceOut
|
struct VoiceOut
|
|
@ -1,6 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer
|
namespace Ryujinx.HLE.HOS.Services.Audio.AudioRendererManager
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x38, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x38, Pack = 1)]
|
||||||
struct WaveBuffer
|
struct WaveBuffer
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue