mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-09-10 11:55:16 +00:00
@@ -8,14 +8,14 @@ namespace Ryujinx.Horizon
|
||||
{
|
||||
public static class HorizonStatic
|
||||
{
|
||||
internal static void HandlePlayReport(PlayReport report) =>
|
||||
internal static void HandlePlayReport(PlayReport report) =>
|
||||
new Thread(() => PlayReport?.Invoke(report))
|
||||
{
|
||||
Name = "HLE.PlayReportEvent",
|
||||
Name = "HLE.PlayReportEvent",
|
||||
IsBackground = true,
|
||||
Priority = ThreadPriority.AboveNormal
|
||||
}.Start();
|
||||
|
||||
|
||||
public static event Action<PlayReport> PlayReport;
|
||||
|
||||
[field: ThreadStatic]
|
||||
|
@@ -131,7 +131,7 @@ namespace Ryujinx.Horizon.Prepo.Ipc
|
||||
{
|
||||
enabled = false;
|
||||
|
||||
if (_permissionLevel == PrepoServicePermissionLevel.User || _permissionLevel == PrepoServicePermissionLevel.System)
|
||||
if (_permissionLevel is PrepoServicePermissionLevel.User or PrepoServicePermissionLevel.System)
|
||||
{
|
||||
enabled = _userAgreementCheckEnabled;
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace Ryujinx.Horizon.Prepo.Ipc
|
||||
[CmifCommand(40101)] // 2.0.0+
|
||||
public Result SetUserAgreementCheckEnabled(bool enabled)
|
||||
{
|
||||
if (_permissionLevel == PrepoServicePermissionLevel.User || _permissionLevel == PrepoServicePermissionLevel.System)
|
||||
if (_permissionLevel is PrepoServicePermissionLevel.User or PrepoServicePermissionLevel.System)
|
||||
{
|
||||
_userAgreementCheckEnabled = enabled;
|
||||
|
||||
@@ -188,17 +188,17 @@ namespace Ryujinx.Horizon.Prepo.Ipc
|
||||
{
|
||||
return PrepoResult.InvalidBufferSize;
|
||||
}
|
||||
|
||||
|
||||
StringBuilder builder = new();
|
||||
MessagePackObject deserializedReport = MessagePackSerializer.UnpackMessagePackObject(reportBuffer.ToArray());
|
||||
|
||||
PlayReport playReport = new()
|
||||
{
|
||||
Kind = playReportKind,
|
||||
Kind = playReportKind,
|
||||
Room = gameRoom,
|
||||
ReportData = deserializedReport
|
||||
};
|
||||
|
||||
|
||||
builder.AppendLine();
|
||||
builder.AppendLine("PlayReport log:");
|
||||
builder.AppendLine($" Kind: {playReportKind}");
|
||||
@@ -225,7 +225,7 @@ namespace Ryujinx.Horizon.Prepo.Ipc
|
||||
_arp.GetApplicationLaunchProperty(out ApplicationLaunchProperty applicationLaunchProperty, applicationInstanceId).AbortOnFailure();
|
||||
|
||||
playReport.Version = applicationLaunchProperty.Version;
|
||||
|
||||
|
||||
builder.AppendLine($" ApplicationVersion: {applicationLaunchProperty.Version}");
|
||||
|
||||
if (!userId.IsNull)
|
||||
@@ -236,7 +236,7 @@ namespace Ryujinx.Horizon.Prepo.Ipc
|
||||
|
||||
builder.AppendLine($" Room: {gameRoom}");
|
||||
builder.AppendLine($" Report: {MessagePackObjectFormatter.Format(deserializedReport)}");
|
||||
|
||||
|
||||
HorizonStatic.HandlePlayReport(playReport);
|
||||
|
||||
Logger.Info?.Print(LogClass.ServicePrepo, builder.ToString());
|
||||
|
@@ -1,4 +1,4 @@
|
||||
using MsgPack;
|
||||
using MsgPack;
|
||||
using Ryujinx.Horizon.Sdk.Account;
|
||||
using Ryujinx.Horizon.Sdk.Ncm;
|
||||
|
||||
@@ -9,13 +9,13 @@ namespace Ryujinx.Horizon.Prepo.Types
|
||||
public PlayReportKind Kind { get; init; }
|
||||
public string Room { get; init; }
|
||||
public MessagePackObject ReportData { get; init; }
|
||||
|
||||
|
||||
public ApplicationId? AppId;
|
||||
public ulong? Pid;
|
||||
public uint Version;
|
||||
public Uid? UserId;
|
||||
}
|
||||
|
||||
|
||||
public enum PlayReportKind
|
||||
{
|
||||
Normal,
|
||||
|
@@ -121,7 +121,7 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail
|
||||
|
||||
if (!_isUsbDeviceSupported && device.IsUsbDevice())
|
||||
{
|
||||
device = _registry.DefaultDevice;
|
||||
device = VirtualDeviceSessionRegistry.DefaultDevice;
|
||||
}
|
||||
|
||||
if (name.Length > 0)
|
||||
@@ -147,7 +147,7 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail
|
||||
|
||||
if (!_isUsbDeviceSupported && device.IsUsbDevice())
|
||||
{
|
||||
device = _registry.DefaultDevice;
|
||||
device = VirtualDeviceSessionRegistry.DefaultDevice;
|
||||
}
|
||||
|
||||
channelCount = (int)device.ChannelCount;
|
||||
|
@@ -22,7 +22,7 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail
|
||||
[CmifCommand(0)]
|
||||
public Result ListAudioIns(out int count, [Buffer(HipcBufferFlags.Out | HipcBufferFlags.MapAlias)] Span<DeviceName> names)
|
||||
{
|
||||
string[] deviceNames = _impl.ListAudioIns(filtered: false);
|
||||
string[] deviceNames = AudioInputManager.ListAudioIns(filtered: false);
|
||||
|
||||
count = 0;
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail
|
||||
[CmifCommand(4)] // 3.0.0+
|
||||
public Result ListAudioInsAutoFiltered(out int count, [Buffer(HipcBufferFlags.Out | HipcBufferFlags.AutoSelect)] Span<DeviceName> names)
|
||||
{
|
||||
string[] deviceNames = _impl.ListAudioIns(filtered: true);
|
||||
string[] deviceNames = AudioInputManager.ListAudioIns(filtered: true);
|
||||
|
||||
count = 0;
|
||||
|
||||
|
@@ -22,7 +22,7 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail
|
||||
[CmifCommand(0)]
|
||||
public Result ListAudioOuts(out int count, [Buffer(HipcBufferFlags.Out | HipcBufferFlags.MapAlias)] Span<DeviceName> names)
|
||||
{
|
||||
string[] deviceNames = _impl.ListAudioOuts();
|
||||
string[] deviceNames = AudioOutputManager.ListAudioOuts();
|
||||
|
||||
count = 0;
|
||||
|
||||
|
@@ -229,7 +229,7 @@ namespace Ryujinx.Horizon.Sdk.Codec.Detail
|
||||
return GetWorkBufferSizeForMultiStreamExImpl(out size, in parameter, fromDsp: true);
|
||||
}
|
||||
|
||||
private Result GetWorkBufferSizeExImpl(out int size, in HardwareOpusDecoderParameterInternalEx parameter, bool fromDsp)
|
||||
private static Result GetWorkBufferSizeExImpl(out int size, in HardwareOpusDecoderParameterInternalEx parameter, bool fromDsp)
|
||||
{
|
||||
size = 0;
|
||||
|
||||
@@ -253,7 +253,7 @@ namespace Ryujinx.Horizon.Sdk.Codec.Detail
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
private Result GetWorkBufferSizeForMultiStreamExImpl(out int size, in HardwareOpusMultiStreamDecoderParameterInternalEx parameter, bool fromDsp)
|
||||
private static Result GetWorkBufferSizeForMultiStreamExImpl(out int size, in HardwareOpusMultiStreamDecoderParameterInternalEx parameter, bool fromDsp)
|
||||
{
|
||||
size = 0;
|
||||
|
||||
@@ -305,7 +305,7 @@ namespace Ryujinx.Horizon.Sdk.Codec.Detail
|
||||
{
|
||||
const int SilkDecoderSize = 0x2160;
|
||||
|
||||
if (channelsCount < 1 || channelsCount > 2)
|
||||
if (channelsCount is < 1 or > 2)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -351,12 +351,12 @@ namespace Ryujinx.Horizon.Sdk.Codec.Detail
|
||||
|
||||
private static bool IsValidChannelCount(int channelsCount)
|
||||
{
|
||||
return channelsCount > 0 && channelsCount <= 2;
|
||||
return channelsCount is > 0 and <= 2;
|
||||
}
|
||||
|
||||
private static bool IsValidMultiChannelCount(int channelsCount)
|
||||
{
|
||||
return channelsCount > 0 && channelsCount <= 255;
|
||||
return channelsCount is > 0 and <= 255;
|
||||
}
|
||||
|
||||
private static bool IsValidSampleRate(int sampleRate)
|
||||
|
@@ -47,6 +47,7 @@ namespace Ryujinx.Horizon.Sdk.Ngc.Detail
|
||||
{
|
||||
path = $"{MountName}:/ac_{regionIndex}_not_b_nx";
|
||||
}
|
||||
|
||||
break;
|
||||
case AcType.AcB1:
|
||||
if (regionIndex < 0)
|
||||
@@ -57,6 +58,7 @@ namespace Ryujinx.Horizon.Sdk.Ngc.Detail
|
||||
{
|
||||
path = $"{MountName}:/ac_{regionIndex}_b1_nx";
|
||||
}
|
||||
|
||||
break;
|
||||
case AcType.AcB2:
|
||||
if (regionIndex < 0)
|
||||
@@ -67,6 +69,7 @@ namespace Ryujinx.Horizon.Sdk.Ngc.Detail
|
||||
{
|
||||
path = $"{MountName}:/ac_{regionIndex}_b2_nx";
|
||||
}
|
||||
|
||||
break;
|
||||
case AcType.AcSimilarForm:
|
||||
path = $"{MountName}:/ac_similar_form_nx";
|
||||
|
@@ -8,7 +8,6 @@ namespace Ryujinx.Horizon.Sdk.Ngc.Detail
|
||||
{
|
||||
abstract class ProfanityFilterBase
|
||||
{
|
||||
#pragma warning disable IDE0230 // Use UTF-8 string literal
|
||||
private static readonly byte[][] _wordSeparators =
|
||||
[
|
||||
[0x0D],
|
||||
@@ -92,7 +91,6 @@ namespace Ryujinx.Horizon.Sdk.Ngc.Detail
|
||||
[0xEF, 0xBC, 0x8D],
|
||||
[0xEF, 0xBC, 0xBD]
|
||||
];
|
||||
#pragma warning restore IDE0230
|
||||
|
||||
private enum SignFilterStep
|
||||
{
|
||||
@@ -115,7 +113,7 @@ namespace Ryujinx.Horizon.Sdk.Ngc.Detail
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (word[index] == '@' || word[index] == '\uFF20')
|
||||
else if (word[index] is '@' or '\uFF20')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -142,6 +140,7 @@ namespace Ryujinx.Horizon.Sdk.Ngc.Detail
|
||||
step = SignFilterStep.DetectEmailUserAtSign;
|
||||
matchStart = index;
|
||||
}
|
||||
|
||||
break;
|
||||
case SignFilterStep.DetectEmailUserAtSign:
|
||||
bool hasMatch = false;
|
||||
@@ -205,6 +204,7 @@ namespace Ryujinx.Horizon.Sdk.Ngc.Detail
|
||||
{
|
||||
index = domainIndex - 1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -232,7 +232,7 @@ namespace Ryujinx.Horizon.Sdk.Ngc.Detail
|
||||
text[startOffset] = 0xc1;
|
||||
text[startOffset + 1] = 0xc1;
|
||||
}
|
||||
else if (maskMode == MaskMode.Overwrite || maskMode == MaskMode.ReplaceByOneCharacter)
|
||||
else if (maskMode is MaskMode.Overwrite or MaskMode.ReplaceByOneCharacter)
|
||||
{
|
||||
text[startOffset] = 0xc0;
|
||||
text[startOffset + 1] = 0xc0;
|
||||
@@ -312,7 +312,7 @@ namespace Ryujinx.Horizon.Sdk.Ngc.Detail
|
||||
}
|
||||
else if ((character & 0x80) != 0)
|
||||
{
|
||||
if (character >= 0xc2 && character < 0xe0)
|
||||
if (character is >= 0xc2 and < 0xe0)
|
||||
{
|
||||
characterByteLength = 2;
|
||||
}
|
||||
@@ -621,7 +621,7 @@ namespace Ryujinx.Horizon.Sdk.Ngc.Detail
|
||||
|
||||
if ((character & 0x80) != 0)
|
||||
{
|
||||
if (character >= 0xc2 && character < 0xe0)
|
||||
if (character is >= 0xc2 and < 0xe0)
|
||||
{
|
||||
characterByteLength = 2;
|
||||
}
|
||||
@@ -751,7 +751,7 @@ namespace Ryujinx.Horizon.Sdk.Ngc.Detail
|
||||
|
||||
if ((character & 0x80) != 0 || character == 0)
|
||||
{
|
||||
if (character >= 0xc2 && character < 0xe0)
|
||||
if (character is >= 0xc2 and < 0xe0)
|
||||
{
|
||||
characterByteLength = 2;
|
||||
}
|
||||
|
@@ -33,6 +33,7 @@ namespace Ryujinx.Horizon.Sdk.OsTypes.Impl
|
||||
{
|
||||
InterProcessEventImpl.Close(ipEvent.ReadableHandle);
|
||||
}
|
||||
|
||||
ipEvent.ReadableHandleManaged = false;
|
||||
}
|
||||
|
||||
@@ -42,6 +43,7 @@ namespace Ryujinx.Horizon.Sdk.OsTypes.Impl
|
||||
{
|
||||
InterProcessEventImpl.Close(ipEvent.WritableHandle);
|
||||
}
|
||||
|
||||
ipEvent.WritableHandleManaged = false;
|
||||
}
|
||||
}
|
||||
|
@@ -124,6 +124,7 @@ namespace Ryujinx.Horizon.Sdk.OsTypes.Impl
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
break;
|
||||
case WaitCancelled:
|
||||
lock (_lock)
|
||||
@@ -133,6 +134,7 @@ namespace Ryujinx.Horizon.Sdk.OsTypes.Impl
|
||||
return _signaledHolder;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
lock (_lock)
|
||||
|
@@ -62,8 +62,8 @@ namespace Ryujinx.Horizon.Sdk.Sf.Cmif
|
||||
|
||||
Result commandResult = commandHandler.Invoke(ref outHeader, ref context, inMessageRawData);
|
||||
|
||||
if (commandResult.Module == SfResult.ModuleId ||
|
||||
commandResult.Module == HipcResult.ModuleId)
|
||||
if (commandResult.Module is SfResult.ModuleId or
|
||||
HipcResult.ModuleId)
|
||||
{
|
||||
Logger.Warning?.Print(LogClass.KernelIpc, $"{commandHandler.MethodName} returned error {commandResult}");
|
||||
}
|
||||
|
@@ -206,6 +206,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
|
||||
{
|
||||
return MemoryMarshal.Cast<byte, int>(inMessage)[3];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -82,6 +82,7 @@ namespace Ryujinx.Horizon.Sdk.Sf
|
||||
_outMapAliasBuffersCount++;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case CommandArgType.InCopyHandle:
|
||||
_inCopyHandlesCount++;
|
||||
@@ -386,9 +387,7 @@ namespace Ryujinx.Horizon.Sdk.Sf
|
||||
outRawData = MemoryMarshal.Cast<uint, byte>(response.DataWords);
|
||||
}
|
||||
|
||||
#pragma warning disable CA1822 // Mark member as static
|
||||
public void SetOutObjects(ref ServiceDispatchContext context, HipcMessageData response, Span<IServiceObject> objects)
|
||||
#pragma warning restore CA1822
|
||||
public static void SetOutObjects(ref ServiceDispatchContext context, HipcMessageData response, Span<IServiceObject> objects)
|
||||
{
|
||||
if (objects.Length == 0)
|
||||
{
|
||||
|
Reference in New Issue
Block a user