Files
ryujinx/src/Ryujinx.HLE/HOS/Services/Fs/IDeviceOperator.cs
Aaron Robinson c76f65904d Enable full trimming
Enables full trimming for Ryujinx, and in doing so removes many usages of reflection, namely:

IUserService no longer uses reflection to find possible service types, and now has a generated switch based on name

Ryujinx.HLE.HOS.Tamper no longer uses dynamic to do operations, now using INumber<T> and friends

Cmif and Tipc commands in Ryujinx.HLE.HOS.Services no longer get resolved via reflection and are now done via generated virtual methods

Fix things broken by trimming (profile panel, DiscordRPC)
2026-03-18 14:50:17 -05:00

59 lines
1.7 KiB
C#

using LibHac;
using LibHac.Common;
using GameCardHandle = System.UInt32;
namespace Ryujinx.HLE.HOS.Services.Fs
{
partial class IDeviceOperator : DisposableIpcService
{
private SharedRef<LibHac.FsSrv.Sf.IDeviceOperator> _baseOperator;
public IDeviceOperator(ref SharedRef<LibHac.FsSrv.Sf.IDeviceOperator> baseOperator)
{
_baseOperator = SharedRef<LibHac.FsSrv.Sf.IDeviceOperator>.CreateMove(ref baseOperator);
}
[CommandCmif(0)]
// IsSdCardInserted() -> b8 is_inserted
public ResultCode IsSdCardInserted(ServiceCtx context)
{
Result result = _baseOperator.Get.IsSdCardInserted(out bool isInserted);
context.ResponseData.Write(isInserted);
return (ResultCode)result.Value;
}
[CommandCmif(200)]
// IsGameCardInserted() -> b8 is_inserted
public ResultCode IsGameCardInserted(ServiceCtx context)
{
Result result = _baseOperator.Get.IsGameCardInserted(out bool isInserted);
context.ResponseData.Write(isInserted);
return (ResultCode)result.Value;
}
[CommandCmif(202)]
// GetGameCardHandle() -> u32 gamecard_handle
public ResultCode GetGameCardHandle(ServiceCtx context)
{
Result result = _baseOperator.Get.GetGameCardHandle(out GameCardHandle handle);
context.ResponseData.Write(handle);
return (ResultCode)result.Value;
}
protected override void Dispose(bool isDisposing)
{
if (isDisposing)
{
_baseOperator.Destroy();
}
}
}
}