mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2025-08-30 07:25:05 +00:00
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0052 warnings * Address or silence dotnet format IDE1006 warnings * Address dotnet format CA1816 warnings * Address or silence dotnet format CA2208 warnings * Address or silence dotnet format CA1806 and a few CA1854 warnings * Address dotnet format CA2211 warnings * Address dotnet format CA1822 warnings * Address or silence dotnet format CA1069 warnings * Make dotnet format succeed in style mode * Address or silence dotnet format CA2211 warnings * Address review comments * Address dotnet format CA2208 warnings properly * Make ProcessResult readonly * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Add previously silenced warnings back I have no clue how these disappeared * Revert formatting changes for while and for-loops * Format if-blocks correctly * Run dotnet format style after rebase * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Run dotnet format analyzers after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Fix a few disabled warnings * Fix naming rule violation, Convert shader properties to auto-property and convert values to const * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Fix and silence a few dotnet-format warnings again * Run dotnet format after rebase * Use using declaration instead of block syntax * Address IDE0251 warnings * Address a few disabled IDE0060 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass * Fix naming rule violations * Fix typo * Add trailing commas, use targeted new and use array initializer * Fix build issues * Fix remaining build issues * Remove SuppressMessage for CA1069 where possible * Address dotnet format issues * Address formatting issues Co-authored-by: Ac_K <acoustik666@gmail.com> * Add GetHashCode implementation for RenderingSurfaceInfo * Explicitly silence CA1822 for every affected method in Syscall * Address formatting issues in Demangler.cs * Address review feedback Co-authored-by: Ac_K <acoustik666@gmail.com> * Revert marking service methods as static * Next dotnet format pass * Address review feedback --------- Co-authored-by: Ac_K <acoustik666@gmail.com>
146 lines
5.3 KiB
C#
146 lines
5.3 KiB
C#
using Ryujinx.HLE.HOS.Ipc;
|
|
using Ryujinx.HLE.HOS.Services.Sdb.Pl.Types;
|
|
using Ryujinx.Horizon.Common;
|
|
using System;
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Sdb.Pl
|
|
{
|
|
[Service("pl:u")]
|
|
[Service("pl:s")] // 9.0.0+
|
|
class ISharedFontManager : IpcService
|
|
{
|
|
private int _fontSharedMemHandle;
|
|
|
|
public ISharedFontManager(ServiceCtx context) { }
|
|
|
|
[CommandCmif(0)]
|
|
// RequestLoad(u32)
|
|
public ResultCode RequestLoad(ServiceCtx context)
|
|
{
|
|
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
|
SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32();
|
|
#pragma warning restore IDE0059
|
|
|
|
// We don't need to do anything here because we do lazy initialization
|
|
// on SharedFontManager (the font is loaded when necessary).
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[CommandCmif(1)]
|
|
// GetLoadState(u32) -> u32
|
|
public ResultCode GetLoadState(ServiceCtx context)
|
|
{
|
|
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
|
SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32();
|
|
#pragma warning restore IDE0059
|
|
|
|
// 1 (true) indicates that the font is already loaded.
|
|
// All fonts are already loaded.
|
|
context.ResponseData.Write(1);
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[CommandCmif(2)]
|
|
// GetFontSize(u32) -> u32
|
|
public ResultCode GetFontSize(ServiceCtx context)
|
|
{
|
|
SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32();
|
|
|
|
context.ResponseData.Write(context.Device.System.SharedFontManager.GetFontSize(fontType));
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[CommandCmif(3)]
|
|
// GetSharedMemoryAddressOffset(u32) -> u32
|
|
public ResultCode GetSharedMemoryAddressOffset(ServiceCtx context)
|
|
{
|
|
SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32();
|
|
|
|
context.ResponseData.Write(context.Device.System.SharedFontManager.GetSharedMemoryAddressOffset(fontType));
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[CommandCmif(4)]
|
|
// GetSharedMemoryNativeHandle() -> handle<copy>
|
|
public ResultCode GetSharedMemoryNativeHandle(ServiceCtx context)
|
|
{
|
|
context.Device.System.SharedFontManager.EnsureInitialized(context.Device.System.ContentManager);
|
|
|
|
if (_fontSharedMemHandle == 0)
|
|
{
|
|
if (context.Process.HandleTable.GenerateHandle(context.Device.System.FontSharedMem, out _fontSharedMemHandle) != Result.Success)
|
|
{
|
|
throw new InvalidOperationException("Out of handles!");
|
|
}
|
|
}
|
|
|
|
context.Response.HandleDesc = IpcHandleDesc.MakeCopy(_fontSharedMemHandle);
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[CommandCmif(5)]
|
|
// GetSharedFontInOrderOfPriority(bytes<8, 1>) -> (u8, u32, buffer<unknown, 6>, buffer<unknown, 6>, buffer<unknown, 6>)
|
|
public ResultCode GetSharedFontInOrderOfPriority(ServiceCtx context)
|
|
{
|
|
#pragma warning disable IDE0059 // Remove unnecessary value assignment
|
|
long languageCode = context.RequestData.ReadInt64();
|
|
#pragma warning restore IDE0059
|
|
int loadedCount = 0;
|
|
|
|
for (SharedFontType type = 0; type < SharedFontType.Count; type++)
|
|
{
|
|
uint offset = (uint)type * 4;
|
|
|
|
if (!AddFontToOrderOfPriorityList(context, type, offset))
|
|
{
|
|
break;
|
|
}
|
|
|
|
loadedCount++;
|
|
}
|
|
|
|
context.ResponseData.Write(loadedCount);
|
|
context.ResponseData.Write((int)SharedFontType.Count);
|
|
|
|
return ResultCode.Success;
|
|
}
|
|
|
|
[CommandCmif(6)] // 4.0.0+
|
|
// GetSharedFontInOrderOfPriorityForSystem(bytes<8, 1>) -> (u8, u32, buffer<unknown, 6>, buffer<unknown, 6>, buffer<unknown, 6>)
|
|
public ResultCode GetSharedFontInOrderOfPriorityForSystem(ServiceCtx context)
|
|
{
|
|
// TODO: Check the differencies with GetSharedFontInOrderOfPriority.
|
|
|
|
return GetSharedFontInOrderOfPriority(context);
|
|
}
|
|
|
|
private bool AddFontToOrderOfPriorityList(ServiceCtx context, SharedFontType fontType, uint offset)
|
|
{
|
|
ulong typesPosition = context.Request.ReceiveBuff[0].Position;
|
|
ulong typesSize = context.Request.ReceiveBuff[0].Size;
|
|
|
|
ulong offsetsPosition = context.Request.ReceiveBuff[1].Position;
|
|
ulong offsetsSize = context.Request.ReceiveBuff[1].Size;
|
|
|
|
ulong fontSizeBufferPosition = context.Request.ReceiveBuff[2].Position;
|
|
ulong fontSizeBufferSize = context.Request.ReceiveBuff[2].Size;
|
|
|
|
if (offset + 4 > (uint)typesSize ||
|
|
offset + 4 > (uint)offsetsSize ||
|
|
offset + 4 > (uint)fontSizeBufferSize)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
context.Memory.Write(typesPosition + offset, (int)fontType);
|
|
context.Memory.Write(offsetsPosition + offset, context.Device.System.SharedFontManager.GetSharedMemoryAddressOffset(fontType));
|
|
context.Memory.Write(fontSizeBufferPosition + offset, context.Device.System.SharedFontManager.GetFontSize(fontType));
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|