mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-11 23:12:02 +00:00
am: Cleaning and stub TryPopFromFriendInvitationStorageChannel (#1738)
This commit is contained in:
parent
9abdba5539
commit
fd0b9d1926
1 changed files with 35 additions and 24 deletions
|
@ -5,7 +5,6 @@ using LibHac.Fs;
|
|||
using LibHac.Ns;
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.HLE.Exceptions;
|
||||
using Ryujinx.HLE.HOS.Ipc;
|
||||
using Ryujinx.HLE.HOS.Kernel.Common;
|
||||
using Ryujinx.HLE.HOS.Kernel.Memory;
|
||||
|
@ -18,7 +17,7 @@ using System;
|
|||
using System.Numerics;
|
||||
|
||||
using static LibHac.Fs.ApplicationSaveDataManagement;
|
||||
using AccountUid = Ryujinx.HLE.HOS.Services.Account.Acc.UserId;
|
||||
using AccountUid = Ryujinx.HLE.HOS.Services.Account.Acc.UserId;
|
||||
using ApplicationId = LibHac.Ncm.ApplicationId;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.ApplicationProxy
|
||||
|
@ -31,9 +30,9 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
|
|||
|
||||
public IApplicationFunctions(Horizon system)
|
||||
{
|
||||
_gpuErrorDetectedSystemEvent = new KEvent(system.KernelContext);
|
||||
_gpuErrorDetectedSystemEvent = new KEvent(system.KernelContext);
|
||||
_friendInvitationStorageChannelEvent = new KEvent(system.KernelContext);
|
||||
_notificationStorageChannelEvent = new KEvent(system.KernelContext);
|
||||
_notificationStorageChannelEvent = new KEvent(system.KernelContext);
|
||||
}
|
||||
|
||||
[Command(1)]
|
||||
|
@ -55,7 +54,6 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
|
|||
break;
|
||||
case LaunchParameterKind.Unknown:
|
||||
throw new NotImplementedException("Unknown LaunchParameterKind.");
|
||||
|
||||
default:
|
||||
return ResultCode.ObjectInvalid;
|
||||
}
|
||||
|
@ -74,7 +72,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
|
|||
// EnsureSaveData(nn::account::Uid) -> u64
|
||||
public ResultCode EnsureSaveData(ServiceCtx context)
|
||||
{
|
||||
Uid userId = context.RequestData.ReadStruct<AccountUid>().ToLibHacUid();
|
||||
Uid userId = context.RequestData.ReadStruct<AccountUid>().ToLibHacUid();
|
||||
ApplicationId applicationId = new ApplicationId(context.Process.TitleId);
|
||||
|
||||
BlitStruct<ApplicationControlProperty> controlHolder = context.Device.Application.ControlData;
|
||||
|
@ -88,15 +86,14 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
|
|||
control = ref new BlitStruct<ApplicationControlProperty>(1).Value;
|
||||
|
||||
// The set sizes don't actually matter as long as they're non-zero because we use directory savedata.
|
||||
control.UserAccountSaveDataSize = 0x4000;
|
||||
control.UserAccountSaveDataSize = 0x4000;
|
||||
control.UserAccountSaveDataJournalSize = 0x4000;
|
||||
|
||||
Logger.Warning?.Print(LogClass.ServiceAm,
|
||||
"No control file was found for this game. Using a dummy one instead. This may cause inaccuracies in some games.");
|
||||
}
|
||||
|
||||
Result result = EnsureApplicationSaveData(context.Device.FileSystem.FsClient, out long requiredSize, applicationId,
|
||||
ref control, ref userId);
|
||||
Result result = EnsureApplicationSaveData(context.Device.FileSystem.FsClient, out long requiredSize, applicationId, ref control, ref userId);
|
||||
|
||||
context.ResponseData.Write(requiredSize);
|
||||
|
||||
|
@ -113,9 +110,8 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
|
|||
// TODO: When above calls are implemented, switch to using ns:am
|
||||
|
||||
long desiredLanguageCode = context.Device.System.State.DesiredLanguageCode;
|
||||
|
||||
int supportedLanguages = (int)context.Device.Application.ControlData.Value.SupportedLanguages;
|
||||
int firstSupported = BitOperations.TrailingZeroCount(supportedLanguages);
|
||||
int supportedLanguages = (int)context.Device.Application.ControlData.Value.SupportedLanguages;
|
||||
int firstSupported = BitOperations.TrailingZeroCount(supportedLanguages);
|
||||
|
||||
if (firstSupported > (int)SystemState.TitleLanguage.Chinese)
|
||||
{
|
||||
|
@ -168,6 +164,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
|
|||
public ResultCode GetSaveDataSize(ServiceCtx context)
|
||||
{
|
||||
SaveDataType saveDataType = (SaveDataType)context.RequestData.ReadByte();
|
||||
|
||||
context.RequestData.BaseStream.Seek(7, System.IO.SeekOrigin.Current);
|
||||
|
||||
Uid userId = context.RequestData.ReadStruct<AccountUid>().ToLibHacUid();
|
||||
|
@ -282,10 +279,10 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
|
|||
// InitializeApplicationCopyrightFrameBuffer(s32 width, s32 height, handle<copy, transfer_memory> transfer_memory, u64 transfer_memory_size)
|
||||
public ResultCode InitializeApplicationCopyrightFrameBuffer(ServiceCtx context)
|
||||
{
|
||||
int width = context.RequestData.ReadInt32();
|
||||
int height = context.RequestData.ReadInt32();
|
||||
ulong transferMemorySize = context.RequestData.ReadUInt64();
|
||||
int transferMemoryHandle = context.Request.HandleDesc.ToCopy[0];
|
||||
int width = context.RequestData.ReadInt32();
|
||||
int height = context.RequestData.ReadInt32();
|
||||
ulong transferMemorySize = context.RequestData.ReadUInt64();
|
||||
int transferMemoryHandle = context.Request.HandleDesc.ToCopy[0];
|
||||
ulong transferMemoryAddress = context.Process.HandleTable.GetObject<KTransferMemory>(transferMemoryHandle).Address;
|
||||
|
||||
ResultCode resultCode = ResultCode.InvalidParameters;
|
||||
|
@ -307,13 +304,13 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
|
|||
|
||||
private ResultCode InitializeApplicationCopyrightFrameBufferImpl(ulong transferMemoryAddress, ulong transferMemorySize, int width, int height)
|
||||
{
|
||||
ResultCode resultCode = ResultCode.ObjectInvalid;
|
||||
|
||||
if ((transferMemorySize & 0x3FFFF) != 0)
|
||||
{
|
||||
return ResultCode.InvalidParameters;
|
||||
}
|
||||
|
||||
ResultCode resultCode;
|
||||
|
||||
// if (_copyrightBuffer == null)
|
||||
{
|
||||
// TODO: Initialize buffer and object.
|
||||
|
@ -330,12 +327,12 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
|
|||
// SetApplicationCopyrightImage(buffer<bytes, 0x45> frame_buffer, s32 x, s32 y, s32 width, s32 height, s32 window_origin_mode)
|
||||
public ResultCode SetApplicationCopyrightImage(ServiceCtx context)
|
||||
{
|
||||
long frameBufferPos = context.Request.SendBuff[0].Position;
|
||||
long frameBufferSize = context.Request.SendBuff[0].Size;
|
||||
int x = context.RequestData.ReadInt32();
|
||||
int y = context.RequestData.ReadInt32();
|
||||
int width = context.RequestData.ReadInt32();
|
||||
int height = context.RequestData.ReadInt32();
|
||||
long frameBufferPos = context.Request.SendBuff[0].Position;
|
||||
long frameBufferSize = context.Request.SendBuff[0].Size;
|
||||
int x = context.RequestData.ReadInt32();
|
||||
int y = context.RequestData.ReadInt32();
|
||||
int width = context.RequestData.ReadInt32();
|
||||
int height = context.RequestData.ReadInt32();
|
||||
uint windowOriginMode = context.RequestData.ReadUInt32();
|
||||
|
||||
ResultCode resultCode = ResultCode.InvalidParameters;
|
||||
|
@ -485,6 +482,20 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
|
|||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[Command(141)] // 9.0.0+
|
||||
// TryPopFromFriendInvitationStorageChannel() -> object<nn::am::service::IStorage>
|
||||
public ResultCode TryPopFromFriendInvitationStorageChannel(ServiceCtx context)
|
||||
{
|
||||
// NOTE: IStorage are pushed in the channel with IApplicationAccessor PushToFriendInvitationStorageChannel
|
||||
// If _friendInvitationStorageChannelEvent is signaled, the event is cleared.
|
||||
// If an IStorage is available, returns it with ResultCode.Success.
|
||||
// If not, just returns ResultCode.NotAvailable. Since we don't support friend feature for now, it's fine to do the same.
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceAm);
|
||||
|
||||
return ResultCode.NotAvailable;
|
||||
}
|
||||
|
||||
[Command(150)] // 9.0.0+
|
||||
// GetNotificationStorageChannelEvent() -> handle<copy>
|
||||
public ResultCode GetNotificationStorageChannelEvent(ServiceCtx context)
|
||||
|
|
Loading…
Reference in a new issue