Refactor out Application details from Horizon (#1236)

* Initial Application refactor

* Misc typo and access modifier fixes

* Clean unused namespaces

* Address gdkchan's comments

* Move ticket reading to common method

* Change IParentalControlService to use ApplicationLoader.ControlData
This commit is contained in:
mageven 2020-05-15 11:46:46 +05:30 committed by GitHub
parent 0ff00bd6d3
commit ba4830293e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 609 additions and 641 deletions

View file

@ -289,7 +289,7 @@ namespace Ryujinx.HLE.HOS.Services.Account.Acc
// Account actually calls nn::arp::detail::IReader::GetApplicationControlProperty() with the current PID and store the result (NACP File) internally.
// But since we use LibHac and we load one Application at a time, it's not necessary.
context.ResponseData.Write(context.Device.System.ControlData.Value.UserAccountSwitchLock);
context.ResponseData.Write(context.Device.Application.ControlData.Value.UserAccountSwitchLock);
Logger.PrintStub(LogClass.ServiceAcc);

View file

@ -49,7 +49,7 @@ namespace Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.Applicati
Uid userId = context.RequestData.ReadStruct<AccountUid>().ToLibHacUid();
TitleId titleId = new TitleId(context.Process.TitleId);
BlitStruct<ApplicationControlProperty> controlHolder = context.Device.System.ControlData;
BlitStruct<ApplicationControlProperty> controlHolder = context.Device.Application.ControlData;
ref ApplicationControlProperty control = ref controlHolder.Value;

View file

@ -33,7 +33,7 @@ namespace Ryujinx.HLE.HOS.Services.Arp
return new ApplicationLaunchProperty
{
TitleId = context.Device.System.TitleId,
TitleId = context.Device.Application.TitleId,
Version = 0x00,
BaseGameStorageId = (byte)StorageId.NandSystem,
UpdateGameStorageId = (byte)StorageId.None

View file

@ -22,7 +22,7 @@ namespace Ryujinx.HLE.HOS.Services.Arp
launchProperty = new LibHac.Arp.ApplicationLaunchProperty();
launchProperty.BaseStorageId = StorageId.BuiltInUser;
launchProperty.ApplicationId = new ApplicationId(System.TitleId);
launchProperty.ApplicationId = new ApplicationId(System.Device.Application.TitleId);
return Result.Success;
}

View file

@ -14,7 +14,7 @@
long position = context.Request.ReceiveBuff[0].Position;
byte[] nacpData = context.Device.System.ControlData.ByteSpan.ToArray();
byte[] nacpData = context.Device.Application.ControlData.ByteSpan.ToArray();
context.Memory.Write((ulong)position, nacpData);

View file

@ -13,7 +13,7 @@
long position = context.Request.ReceiveBuff[0].Position;
byte[] nacpData = context.Device.System.ControlData.ByteSpan.ToArray();
byte[] nacpData = context.Device.Application.ControlData.ByteSpan.ToArray();
context.Memory.Write((ulong)position, nacpData);

View file

@ -43,8 +43,8 @@ namespace Ryujinx.HLE.HOS.Services.Pctl.ParentalControlServiceFactory
_titleId = titleId;
// TODO: Call nn::arp::GetApplicationControlProperty here when implemented, if it return ResultCode.Success we assign fields.
_ratingAge = Array.ConvertAll(context.Device.System.ControlData.Value.RatingAge.ToArray(), Convert.ToInt32);
_freeCommunicationEnabled = context.Device.System.ControlData.Value.ParentalControl == LibHac.Ns.ParentalControlFlagValue.FreeCommunication;
_ratingAge = Array.ConvertAll(context.Device.Application.ControlData.Value.RatingAge.ToArray(), Convert.ToInt32);
_freeCommunicationEnabled = context.Device.Application.ControlData.Value.ParentalControl == LibHac.Ns.ParentalControlFlagValue.FreeCommunication;
}
}

View file

@ -31,7 +31,7 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pdm.QueryService
}
}
PlayLogQueryCapability queryCapability = (PlayLogQueryCapability)context.Device.System.ControlData.Value.PlayLogQueryCapability;
PlayLogQueryCapability queryCapability = (PlayLogQueryCapability)context.Device.Application.ControlData.Value.PlayLogQueryCapability;
List<ulong> titleIds = new List<ulong>();
@ -45,7 +45,7 @@ namespace Ryujinx.HLE.HOS.Services.Sdb.Pdm.QueryService
// Check if input title ids are in the whitelist.
foreach (ulong titleId in titleIds)
{
if (!context.Device.System.ControlData.Value.PlayLogQueryableApplicationId.Contains(titleId))
if (!context.Device.Application.ControlData.Value.PlayLogQueryableApplicationId.Contains(titleId))
{
return (ResultCode)Am.ResultCode.ObjectInvalid;
}