mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2026-04-20 23:12:23 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c9633d72f | ||
|
|
1f93fd52d9 | ||
|
|
aac7bbd378 |
@@ -328,6 +328,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||
public void SetAllInputUserAttributes()
|
||||
{
|
||||
UsedInputAttributes |= Constants.AllAttributesMask;
|
||||
ThisInputAttributesComponents |= ~UInt128.Zero >> (128 - Constants.MaxAttributes * 4);
|
||||
}
|
||||
|
||||
public void SetAllOutputUserAttributes()
|
||||
|
||||
@@ -218,10 +218,17 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||
while (usedAttributes != UInt128.Zero)
|
||||
{
|
||||
int index = usedAttributes.TrailingZeroCount();
|
||||
|
||||
InitializeOutputComponent(context, AttributeConsts.UserAttributeBase + index * 4, perPatch: false);
|
||||
int vecIndex = index / 4;
|
||||
|
||||
usedAttributes &= ~UInt128.Pow2(index);
|
||||
|
||||
// We don't need to initialize passthrough attributes.
|
||||
if ((context.Config.PassthroughAttributes & (1 << vecIndex)) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
InitializeOutputComponent(context, AttributeConsts.UserAttributeBase + index * 4, perPatch: false);
|
||||
}
|
||||
|
||||
UInt128 usedAttributesPerPatch = context.Config.NextInputAttributesPerPatchComponents;
|
||||
|
||||
@@ -10,6 +10,12 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||
private ulong _v0;
|
||||
private ulong _v1;
|
||||
|
||||
public UInt128(ulong low, ulong high)
|
||||
{
|
||||
_v0 = low;
|
||||
_v1 = high;
|
||||
}
|
||||
|
||||
public int TrailingZeroCount()
|
||||
{
|
||||
int count = BitOperations.TrailingZeroCount(_v0);
|
||||
@@ -25,25 +31,57 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||
{
|
||||
if (x >= 64)
|
||||
{
|
||||
return new UInt128() { _v0 = 0, _v1 = 1UL << (x - 64 ) };
|
||||
return new UInt128(0, 1UL << (x - 64));
|
||||
}
|
||||
|
||||
return new UInt128() { _v0 = 1UL << x, _v1 = 0 };
|
||||
return new UInt128(1UL << x, 0);
|
||||
}
|
||||
|
||||
public static UInt128 operator ~(UInt128 x)
|
||||
{
|
||||
return new UInt128() { _v0 = ~x._v0, _v1 = ~x._v1 };
|
||||
return new UInt128(~x._v0, ~x._v1);
|
||||
}
|
||||
|
||||
public static UInt128 operator &(UInt128 x, UInt128 y)
|
||||
{
|
||||
return new UInt128() { _v0 = x._v0 & y._v0, _v1 = x._v1 & y._v1 };
|
||||
return new UInt128(x._v0 & y._v0, x._v1 & y._v1);
|
||||
}
|
||||
|
||||
public static UInt128 operator |(UInt128 x, UInt128 y)
|
||||
{
|
||||
return new UInt128() { _v0 = x._v0 | y._v0, _v1 = x._v1 | y._v1 };
|
||||
return new UInt128(x._v0 | y._v0, x._v1 | y._v1);
|
||||
}
|
||||
|
||||
public static UInt128 operator <<(UInt128 x, int shift)
|
||||
{
|
||||
if (shift == 0)
|
||||
{
|
||||
return new UInt128(x._v0, x._v1);
|
||||
}
|
||||
else if (shift >= 64)
|
||||
{
|
||||
return new UInt128(0, x._v0 << (shift - 64));
|
||||
}
|
||||
|
||||
ulong shiftOut = x._v0 >> (64 - shift);
|
||||
|
||||
return new UInt128(x._v0 << shift, (x._v1 << shift) | shiftOut);
|
||||
}
|
||||
|
||||
public static UInt128 operator >>(UInt128 x, int shift)
|
||||
{
|
||||
if (shift == 0)
|
||||
{
|
||||
return new UInt128(x._v0, x._v1);
|
||||
}
|
||||
else if (shift >= 64)
|
||||
{
|
||||
return new UInt128(x._v1 >> (shift - 64), 0);
|
||||
}
|
||||
|
||||
ulong shiftOut = x._v1 & ((1UL << shift) - 1);
|
||||
|
||||
return new UInt128((x._v0 >> shift) | (shiftOut << (64 - shift)), x._v1 >> shift);
|
||||
}
|
||||
|
||||
public static bool operator ==(UInt128 x, UInt128 y)
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.HLE.HOS.Services.Account.Acc;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.Olsc
|
||||
{
|
||||
[Service("olsc:u")] // 10.0.0+
|
||||
class IOlscServiceForApplication : IpcService
|
||||
{
|
||||
private bool _initialized;
|
||||
private bool _initialized;
|
||||
private Dictionary<UserId, bool> _saveDataBackupSettingDatabase;
|
||||
|
||||
public IOlscServiceForApplication(ServiceCtx context) { }
|
||||
|
||||
@@ -16,7 +18,9 @@ namespace Ryujinx.HLE.HOS.Services.Olsc
|
||||
public ResultCode Initialize(ServiceCtx context)
|
||||
{
|
||||
// NOTE: Service call arp:r GetApplicationInstanceUnregistrationNotifier with the pid and initialize some internal struct.
|
||||
// Since we will not support online savedata backup. It's fine to stub it for now.
|
||||
// Since we will not support online savedata backup, it's fine to stub it for now.
|
||||
|
||||
_saveDataBackupSettingDatabase = new Dictionary<UserId, bool>();
|
||||
|
||||
_initialized = true;
|
||||
|
||||
@@ -25,12 +29,11 @@ namespace Ryujinx.HLE.HOS.Services.Olsc
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[CommandHipc(14)]
|
||||
// SetSaveDataBackupSettingEnabled(nn::account::Uid, bool)
|
||||
public ResultCode SetSaveDataBackupSettingEnabled(ServiceCtx context)
|
||||
[CommandHipc(13)]
|
||||
// GetSaveDataBackupSetting(nn::account::Uid) -> u8
|
||||
public ResultCode GetSaveDataBackupSetting(ServiceCtx context)
|
||||
{
|
||||
UserId userId = context.RequestData.ReadStruct<UserId>();
|
||||
ulong saveDataBackupSettingEnabled = context.RequestData.ReadUInt64();
|
||||
UserId userId = context.RequestData.ReadStruct<UserId>();
|
||||
|
||||
if (!_initialized)
|
||||
{
|
||||
@@ -42,8 +45,42 @@ namespace Ryujinx.HLE.HOS.Services.Olsc
|
||||
return ResultCode.NullArgument;
|
||||
}
|
||||
|
||||
// NOTE: Service store the UserId and the boolean in an internal SaveDataBackupSettingDatabase object.
|
||||
// Since we will not support online savedata backup. It's fine to stub it for now.
|
||||
if (_saveDataBackupSettingDatabase[userId])
|
||||
{
|
||||
context.ResponseData.Write((byte)1); // TODO: Determine value.
|
||||
}
|
||||
else
|
||||
{
|
||||
context.ResponseData.Write((byte)2); // TODO: Determine value.
|
||||
}
|
||||
|
||||
// NOTE: Since we will not support online savedata backup, it's fine to stub it for now.
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceOlsc, new { userId });
|
||||
|
||||
return ResultCode.Success;
|
||||
}
|
||||
|
||||
[CommandHipc(14)]
|
||||
// SetSaveDataBackupSettingEnabled(nn::account::Uid, bool)
|
||||
public ResultCode SetSaveDataBackupSettingEnabled(ServiceCtx context)
|
||||
{
|
||||
bool saveDataBackupSettingEnabled = context.RequestData.ReadUInt64() != 0;
|
||||
UserId userId = context.RequestData.ReadStruct<UserId>();
|
||||
|
||||
if (!_initialized)
|
||||
{
|
||||
return ResultCode.NotInitialized;
|
||||
}
|
||||
|
||||
if (userId.IsNull)
|
||||
{
|
||||
return ResultCode.NullArgument;
|
||||
}
|
||||
|
||||
_saveDataBackupSettingDatabase[userId] = saveDataBackupSettingEnabled;
|
||||
|
||||
// NOTE: Since we will not support online savedata backup, it's fine to stub it for now.
|
||||
|
||||
Logger.Stub?.PrintStub(LogClass.ServiceOlsc, new { userId, saveDataBackupSettingEnabled });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user