Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d076339e3e | ||
|
837836431d | ||
|
9f555db5cd | ||
|
bf7fa60dfc | ||
|
752b93d3b7 | ||
|
f23b2878cc | ||
|
e211c3f00a | ||
|
d3709a753f | ||
|
ab676d58ea | ||
|
2372c194f1 | ||
|
40311310d1 | ||
|
dde9bb5c69 | ||
|
266338a7c9 | ||
|
90156eea4c | ||
|
071c01c235 | ||
|
de06ffb0f7 | ||
|
8a7de35e3f |
@@ -48,6 +48,11 @@ namespace Ryujinx.Audio.Renderer.Common
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Effect to capture mixes (via auxiliary buffers).
|
/// Effect to capture mixes (via auxiliary buffers).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
CaptureBuffer
|
CaptureBuffer,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Effect applying a compressor filter (DRC).
|
||||||
|
/// </summary>
|
||||||
|
Compressor,
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -14,6 +14,7 @@ namespace Ryujinx.Audio.Renderer.Common
|
|||||||
Reverb3d,
|
Reverb3d,
|
||||||
PcmFloat,
|
PcmFloat,
|
||||||
Limiter,
|
Limiter,
|
||||||
CaptureBuffer
|
CaptureBuffer,
|
||||||
|
Compressor
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -31,6 +31,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
LimiterVersion1,
|
LimiterVersion1,
|
||||||
LimiterVersion2,
|
LimiterVersion2,
|
||||||
GroupedBiquadFilter,
|
GroupedBiquadFilter,
|
||||||
CaptureBuffer
|
CaptureBuffer,
|
||||||
|
Compressor
|
||||||
}
|
}
|
||||||
}
|
}
|
173
Ryujinx.Audio/Renderer/Dsp/Command/CompressorCommand.cs
Normal file
173
Ryujinx.Audio/Renderer/Dsp/Command/CompressorCommand.cs
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Ryujinx.Audio.Renderer.Dsp.Effect;
|
||||||
|
using Ryujinx.Audio.Renderer.Dsp.State;
|
||||||
|
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||||
|
|
||||||
|
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
{
|
||||||
|
public class CompressorCommand : ICommand
|
||||||
|
{
|
||||||
|
private const int FixedPointPrecision = 15;
|
||||||
|
|
||||||
|
public bool Enabled { get; set; }
|
||||||
|
|
||||||
|
public int NodeId { get; }
|
||||||
|
|
||||||
|
public CommandType CommandType => CommandType.Compressor;
|
||||||
|
|
||||||
|
public uint EstimatedProcessingTime { get; set; }
|
||||||
|
|
||||||
|
public CompressorParameter Parameter => _parameter;
|
||||||
|
public Memory<CompressorState> State { get; }
|
||||||
|
public ushort[] OutputBufferIndices { get; }
|
||||||
|
public ushort[] InputBufferIndices { get; }
|
||||||
|
public bool IsEffectEnabled { get; }
|
||||||
|
|
||||||
|
private CompressorParameter _parameter;
|
||||||
|
|
||||||
|
public CompressorCommand(uint bufferOffset, CompressorParameter parameter, Memory<CompressorState> state, bool isEnabled, int nodeId)
|
||||||
|
{
|
||||||
|
Enabled = true;
|
||||||
|
NodeId = nodeId;
|
||||||
|
_parameter = parameter;
|
||||||
|
State = state;
|
||||||
|
|
||||||
|
IsEffectEnabled = isEnabled;
|
||||||
|
|
||||||
|
InputBufferIndices = new ushort[Constants.VoiceChannelCountMax];
|
||||||
|
OutputBufferIndices = new ushort[Constants.VoiceChannelCountMax];
|
||||||
|
|
||||||
|
for (int i = 0; i < _parameter.ChannelCount; i++)
|
||||||
|
{
|
||||||
|
InputBufferIndices[i] = (ushort)(bufferOffset + _parameter.Input[i]);
|
||||||
|
OutputBufferIndices[i] = (ushort)(bufferOffset + _parameter.Output[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Process(CommandList context)
|
||||||
|
{
|
||||||
|
ref CompressorState state = ref State.Span[0];
|
||||||
|
|
||||||
|
if (IsEffectEnabled)
|
||||||
|
{
|
||||||
|
if (_parameter.Status == Server.Effect.UsageState.Invalid)
|
||||||
|
{
|
||||||
|
state = new CompressorState(ref _parameter);
|
||||||
|
}
|
||||||
|
else if (_parameter.Status == Server.Effect.UsageState.New)
|
||||||
|
{
|
||||||
|
state.UpdateParameter(ref _parameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ProcessCompressor(context, ref state);
|
||||||
|
}
|
||||||
|
|
||||||
|
private unsafe void ProcessCompressor(CommandList context, ref CompressorState state)
|
||||||
|
{
|
||||||
|
Debug.Assert(_parameter.IsChannelCountValid());
|
||||||
|
|
||||||
|
if (IsEffectEnabled && _parameter.IsChannelCountValid())
|
||||||
|
{
|
||||||
|
Span<IntPtr> inputBuffers = stackalloc IntPtr[Parameter.ChannelCount];
|
||||||
|
Span<IntPtr> outputBuffers = stackalloc IntPtr[Parameter.ChannelCount];
|
||||||
|
Span<float> channelInput = stackalloc float[Parameter.ChannelCount];
|
||||||
|
ExponentialMovingAverage inputMovingAverage = state.InputMovingAverage;
|
||||||
|
float unknown4 = state.Unknown4;
|
||||||
|
ExponentialMovingAverage compressionGainAverage = state.CompressionGainAverage;
|
||||||
|
float previousCompressionEmaAlpha = state.PreviousCompressionEmaAlpha;
|
||||||
|
|
||||||
|
for (int i = 0; i < _parameter.ChannelCount; i++)
|
||||||
|
{
|
||||||
|
inputBuffers[i] = context.GetBufferPointer(InputBufferIndices[i]);
|
||||||
|
outputBuffers[i] = context.GetBufferPointer(OutputBufferIndices[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int sampleIndex = 0; sampleIndex < context.SampleCount; sampleIndex++)
|
||||||
|
{
|
||||||
|
for (int channelIndex = 0; channelIndex < _parameter.ChannelCount; channelIndex++)
|
||||||
|
{
|
||||||
|
channelInput[channelIndex] = *((float*)inputBuffers[channelIndex] + sampleIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
float newMean = inputMovingAverage.Update(FloatingPointHelper.MeanSquare(channelInput), _parameter.InputGain);
|
||||||
|
float y = FloatingPointHelper.Log10(newMean) * 10.0f;
|
||||||
|
float z = 0.0f;
|
||||||
|
|
||||||
|
bool unknown10OutOfRange = false;
|
||||||
|
|
||||||
|
if (newMean < 1.0e-10f)
|
||||||
|
{
|
||||||
|
z = 1.0f;
|
||||||
|
|
||||||
|
unknown10OutOfRange = state.Unknown10 < -100.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y >= state.Unknown10 || unknown10OutOfRange)
|
||||||
|
{
|
||||||
|
float tmpGain;
|
||||||
|
|
||||||
|
if (y >= state.Unknown14)
|
||||||
|
{
|
||||||
|
tmpGain = ((1.0f / Parameter.Ratio) - 1.0f) * (y - Parameter.Threshold);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tmpGain = (y - state.Unknown10) * ((y - state.Unknown10) * -state.CompressorGainReduction);
|
||||||
|
}
|
||||||
|
|
||||||
|
z = FloatingPointHelper.DecibelToLinearExtended(tmpGain);
|
||||||
|
}
|
||||||
|
|
||||||
|
float unknown4New = z;
|
||||||
|
float compressionEmaAlpha;
|
||||||
|
|
||||||
|
if ((unknown4 - z) <= 0.08f)
|
||||||
|
{
|
||||||
|
compressionEmaAlpha = Parameter.ReleaseCoefficient;
|
||||||
|
|
||||||
|
if ((unknown4 - z) >= -0.08f)
|
||||||
|
{
|
||||||
|
if (MathF.Abs(compressionGainAverage.Read() - z) >= 0.001f)
|
||||||
|
{
|
||||||
|
unknown4New = unknown4;
|
||||||
|
}
|
||||||
|
|
||||||
|
compressionEmaAlpha = previousCompressionEmaAlpha;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
compressionEmaAlpha = Parameter.AttackCoefficient;
|
||||||
|
}
|
||||||
|
|
||||||
|
float compressionGain = compressionGainAverage.Update(z, compressionEmaAlpha);
|
||||||
|
|
||||||
|
for (int channelIndex = 0; channelIndex < Parameter.ChannelCount; channelIndex++)
|
||||||
|
{
|
||||||
|
*((float*)outputBuffers[channelIndex] + sampleIndex) = channelInput[channelIndex] * compressionGain * state.OutputGain;
|
||||||
|
}
|
||||||
|
|
||||||
|
unknown4 = unknown4New;
|
||||||
|
previousCompressionEmaAlpha = compressionEmaAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
state.InputMovingAverage = inputMovingAverage;
|
||||||
|
state.Unknown4 = unknown4;
|
||||||
|
state.CompressionGainAverage = compressionGainAverage;
|
||||||
|
state.PreviousCompressionEmaAlpha = previousCompressionEmaAlpha;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Parameter.ChannelCount; i++)
|
||||||
|
{
|
||||||
|
if (InputBufferIndices[i] != OutputBufferIndices[i])
|
||||||
|
{
|
||||||
|
context.CopyBuffer(OutputBufferIndices[i], InputBufferIndices[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -90,32 +90,31 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
|
|
||||||
float inputCoefficient = Parameter.ReleaseCoefficient;
|
float inputCoefficient = Parameter.ReleaseCoefficient;
|
||||||
|
|
||||||
if (sampleInputMax > state.DectectorAverage[channelIndex])
|
if (sampleInputMax > state.DetectorAverage[channelIndex].Read())
|
||||||
{
|
{
|
||||||
inputCoefficient = Parameter.AttackCoefficient;
|
inputCoefficient = Parameter.AttackCoefficient;
|
||||||
}
|
}
|
||||||
|
|
||||||
state.DectectorAverage[channelIndex] += inputCoefficient * (sampleInputMax - state.DectectorAverage[channelIndex]);
|
float detectorValue = state.DetectorAverage[channelIndex].Update(sampleInputMax, inputCoefficient);
|
||||||
|
|
||||||
float attenuation = 1.0f;
|
float attenuation = 1.0f;
|
||||||
|
|
||||||
if (state.DectectorAverage[channelIndex] > Parameter.Threshold)
|
if (detectorValue > Parameter.Threshold)
|
||||||
{
|
{
|
||||||
attenuation = Parameter.Threshold / state.DectectorAverage[channelIndex];
|
attenuation = Parameter.Threshold / detectorValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
float outputCoefficient = Parameter.ReleaseCoefficient;
|
float outputCoefficient = Parameter.ReleaseCoefficient;
|
||||||
|
|
||||||
if (state.CompressionGain[channelIndex] > attenuation)
|
if (state.CompressionGainAverage[channelIndex].Read() > attenuation)
|
||||||
{
|
{
|
||||||
outputCoefficient = Parameter.AttackCoefficient;
|
outputCoefficient = Parameter.AttackCoefficient;
|
||||||
}
|
}
|
||||||
|
|
||||||
state.CompressionGain[channelIndex] += outputCoefficient * (attenuation - state.CompressionGain[channelIndex]);
|
float compressionGain = state.CompressionGainAverage[channelIndex].Update(attenuation, outputCoefficient);
|
||||||
|
|
||||||
ref float delayedSample = ref state.DelayedSampleBuffer[channelIndex * Parameter.DelayBufferSampleCountMax + state.DelayedSampleBufferPosition[channelIndex]];
|
ref float delayedSample = ref state.DelayedSampleBuffer[channelIndex * Parameter.DelayBufferSampleCountMax + state.DelayedSampleBufferPosition[channelIndex]];
|
||||||
|
|
||||||
float outputSample = delayedSample * state.CompressionGain[channelIndex] * Parameter.OutputGain;
|
float outputSample = delayedSample * compressionGain * Parameter.OutputGain;
|
||||||
|
|
||||||
*((float*)outputBuffers[channelIndex] + sampleIndex) = outputSample * short.MaxValue;
|
*((float*)outputBuffers[channelIndex] + sampleIndex) = outputSample * short.MaxValue;
|
||||||
|
|
||||||
|
@@ -101,32 +101,31 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
|
|
||||||
float inputCoefficient = Parameter.ReleaseCoefficient;
|
float inputCoefficient = Parameter.ReleaseCoefficient;
|
||||||
|
|
||||||
if (sampleInputMax > state.DectectorAverage[channelIndex])
|
if (sampleInputMax > state.DetectorAverage[channelIndex].Read())
|
||||||
{
|
{
|
||||||
inputCoefficient = Parameter.AttackCoefficient;
|
inputCoefficient = Parameter.AttackCoefficient;
|
||||||
}
|
}
|
||||||
|
|
||||||
state.DectectorAverage[channelIndex] += inputCoefficient * (sampleInputMax - state.DectectorAverage[channelIndex]);
|
float detectorValue = state.DetectorAverage[channelIndex].Update(sampleInputMax, inputCoefficient);
|
||||||
|
|
||||||
float attenuation = 1.0f;
|
float attenuation = 1.0f;
|
||||||
|
|
||||||
if (state.DectectorAverage[channelIndex] > Parameter.Threshold)
|
if (detectorValue > Parameter.Threshold)
|
||||||
{
|
{
|
||||||
attenuation = Parameter.Threshold / state.DectectorAverage[channelIndex];
|
attenuation = Parameter.Threshold / detectorValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
float outputCoefficient = Parameter.ReleaseCoefficient;
|
float outputCoefficient = Parameter.ReleaseCoefficient;
|
||||||
|
|
||||||
if (state.CompressionGain[channelIndex] > attenuation)
|
if (state.CompressionGainAverage[channelIndex].Read() > attenuation)
|
||||||
{
|
{
|
||||||
outputCoefficient = Parameter.AttackCoefficient;
|
outputCoefficient = Parameter.AttackCoefficient;
|
||||||
}
|
}
|
||||||
|
|
||||||
state.CompressionGain[channelIndex] += outputCoefficient * (attenuation - state.CompressionGain[channelIndex]);
|
float compressionGain = state.CompressionGainAverage[channelIndex].Update(attenuation, outputCoefficient);
|
||||||
|
|
||||||
ref float delayedSample = ref state.DelayedSampleBuffer[channelIndex * Parameter.DelayBufferSampleCountMax + state.DelayedSampleBufferPosition[channelIndex]];
|
ref float delayedSample = ref state.DelayedSampleBuffer[channelIndex * Parameter.DelayBufferSampleCountMax + state.DelayedSampleBufferPosition[channelIndex]];
|
||||||
|
|
||||||
float outputSample = delayedSample * state.CompressionGain[channelIndex] * Parameter.OutputGain;
|
float outputSample = delayedSample * compressionGain * Parameter.OutputGain;
|
||||||
|
|
||||||
*((float*)outputBuffers[channelIndex] + sampleIndex) = outputSample * short.MaxValue;
|
*((float*)outputBuffers[channelIndex] + sampleIndex) = outputSample * short.MaxValue;
|
||||||
|
|
||||||
@@ -144,7 +143,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
ref LimiterStatistics statistics = ref MemoryMarshal.Cast<byte, LimiterStatistics>(ResultState.Span[0].SpecificData)[0];
|
ref LimiterStatistics statistics = ref MemoryMarshal.Cast<byte, LimiterStatistics>(ResultState.Span[0].SpecificData)[0];
|
||||||
|
|
||||||
statistics.InputMax[channelIndex] = Math.Max(statistics.InputMax[channelIndex], sampleInputMax);
|
statistics.InputMax[channelIndex] = Math.Max(statistics.InputMax[channelIndex], sampleInputMax);
|
||||||
statistics.CompressionGainMin[channelIndex] = Math.Min(statistics.CompressionGainMin[channelIndex], state.CompressionGain[channelIndex]);
|
statistics.CompressionGainMin[channelIndex] = Math.Min(statistics.CompressionGainMin[channelIndex], compressionGain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,26 @@
|
|||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.Audio.Renderer.Dsp.Effect
|
||||||
|
{
|
||||||
|
public struct ExponentialMovingAverage
|
||||||
|
{
|
||||||
|
private float _mean;
|
||||||
|
|
||||||
|
public ExponentialMovingAverage(float mean)
|
||||||
|
{
|
||||||
|
_mean = mean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float Read()
|
||||||
|
{
|
||||||
|
return _mean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float Update(float value, float alpha)
|
||||||
|
{
|
||||||
|
_mean += alpha * (value - _mean);
|
||||||
|
|
||||||
|
return _mean;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -16,6 +16,12 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
return (float)value / (1 << qBits);
|
return (float)value / (1 << qBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static float ConvertFloat(float value, int qBits)
|
||||||
|
{
|
||||||
|
return value / (1 << qBits);
|
||||||
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static int ToFixed(float value, int qBits)
|
public static int ToFixed(float value, int qBits)
|
||||||
{
|
{
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Reflection.Metadata;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp
|
namespace Ryujinx.Audio.Renderer.Dsp
|
||||||
@@ -46,6 +47,53 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
return MathF.Pow(10, x);
|
return MathF.Pow(10, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static float Log10(float x)
|
||||||
|
{
|
||||||
|
// NOTE: Nintendo uses an approximation of log10, we don't.
|
||||||
|
// As such, we support the same ranges as Nintendo to avoid unexpected behaviours.
|
||||||
|
return MathF.Pow(10, MathF.Max(x, 1.0e-10f));
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static float MeanSquare(ReadOnlySpan<float> inputs)
|
||||||
|
{
|
||||||
|
float res = 0.0f;
|
||||||
|
|
||||||
|
foreach (float input in inputs)
|
||||||
|
{
|
||||||
|
res += (input * input);
|
||||||
|
}
|
||||||
|
|
||||||
|
res /= inputs.Length;
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Map decibel to linear.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="db">The decibel value to convert</param>
|
||||||
|
/// <returns>Converted linear value/returns>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static float DecibelToLinear(float db)
|
||||||
|
{
|
||||||
|
return MathF.Pow(10.0f, db / 20.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Map decibel to linear in [0, 2] range.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="db">The decibel value to convert</param>
|
||||||
|
/// <returns>Converted linear value in [0, 2] range</returns>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static float DecibelToLinearExtended(float db)
|
||||||
|
{
|
||||||
|
float tmp = MathF.Log2(DecibelToLinear(db));
|
||||||
|
|
||||||
|
return MathF.Truncate(tmp) + MathF.Pow(2.0f, tmp - MathF.Truncate(tmp));
|
||||||
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static float DegreesToRadians(float degrees)
|
public static float DegreesToRadians(float degrees)
|
||||||
{
|
{
|
||||||
|
51
Ryujinx.Audio/Renderer/Dsp/State/CompressorState.cs
Normal file
51
Ryujinx.Audio/Renderer/Dsp/State/CompressorState.cs
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
using Ryujinx.Audio.Renderer.Dsp.Effect;
|
||||||
|
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||||
|
|
||||||
|
namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||||
|
{
|
||||||
|
public class CompressorState
|
||||||
|
{
|
||||||
|
public ExponentialMovingAverage InputMovingAverage;
|
||||||
|
public float Unknown4;
|
||||||
|
public ExponentialMovingAverage CompressionGainAverage;
|
||||||
|
public float CompressorGainReduction;
|
||||||
|
public float Unknown10;
|
||||||
|
public float Unknown14;
|
||||||
|
public float PreviousCompressionEmaAlpha;
|
||||||
|
public float MakeupGain;
|
||||||
|
public float OutputGain;
|
||||||
|
|
||||||
|
public CompressorState(ref CompressorParameter parameter)
|
||||||
|
{
|
||||||
|
InputMovingAverage = new ExponentialMovingAverage(0.0f);
|
||||||
|
Unknown4 = 1.0f;
|
||||||
|
CompressionGainAverage = new ExponentialMovingAverage(1.0f);
|
||||||
|
|
||||||
|
UpdateParameter(ref parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateParameter(ref CompressorParameter parameter)
|
||||||
|
{
|
||||||
|
float threshold = parameter.Threshold;
|
||||||
|
float ratio = 1.0f / parameter.Ratio;
|
||||||
|
float attackCoefficient = parameter.AttackCoefficient;
|
||||||
|
float makeupGain;
|
||||||
|
|
||||||
|
if (parameter.MakeupGainEnabled)
|
||||||
|
{
|
||||||
|
makeupGain = (threshold * 0.5f * (ratio - 1.0f)) - 3.0f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
makeupGain = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
PreviousCompressionEmaAlpha = attackCoefficient;
|
||||||
|
MakeupGain = makeupGain;
|
||||||
|
CompressorGainReduction = (1.0f - ratio) / Constants.ChannelCountMax;
|
||||||
|
Unknown10 = threshold - 1.5f;
|
||||||
|
Unknown14 = threshold + 1.5f;
|
||||||
|
OutputGain = FloatingPointHelper.DecibelToLinearExtended(parameter.OutputGain + makeupGain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,3 +1,4 @@
|
|||||||
|
using Ryujinx.Audio.Renderer.Dsp.Effect;
|
||||||
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
@@ -5,20 +6,20 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
|||||||
{
|
{
|
||||||
public class LimiterState
|
public class LimiterState
|
||||||
{
|
{
|
||||||
public float[] DectectorAverage;
|
public ExponentialMovingAverage[] DetectorAverage;
|
||||||
public float[] CompressionGain;
|
public ExponentialMovingAverage[] CompressionGainAverage;
|
||||||
public float[] DelayedSampleBuffer;
|
public float[] DelayedSampleBuffer;
|
||||||
public int[] DelayedSampleBufferPosition;
|
public int[] DelayedSampleBufferPosition;
|
||||||
|
|
||||||
public LimiterState(ref LimiterParameter parameter, ulong workBuffer)
|
public LimiterState(ref LimiterParameter parameter, ulong workBuffer)
|
||||||
{
|
{
|
||||||
DectectorAverage = new float[parameter.ChannelCount];
|
DetectorAverage = new ExponentialMovingAverage[parameter.ChannelCount];
|
||||||
CompressionGain = new float[parameter.ChannelCount];
|
CompressionGainAverage = new ExponentialMovingAverage[parameter.ChannelCount];
|
||||||
DelayedSampleBuffer = new float[parameter.ChannelCount * parameter.DelayBufferSampleCountMax];
|
DelayedSampleBuffer = new float[parameter.ChannelCount * parameter.DelayBufferSampleCountMax];
|
||||||
DelayedSampleBufferPosition = new int[parameter.ChannelCount];
|
DelayedSampleBufferPosition = new int[parameter.ChannelCount];
|
||||||
|
|
||||||
DectectorAverage.AsSpan().Fill(0.0f);
|
DetectorAverage.AsSpan().Fill(new ExponentialMovingAverage(0.0f));
|
||||||
CompressionGain.AsSpan().Fill(1.0f);
|
CompressionGainAverage.AsSpan().Fill(new ExponentialMovingAverage(1.0f));
|
||||||
DelayedSampleBufferPosition.AsSpan().Fill(0);
|
DelayedSampleBufferPosition.AsSpan().Fill(0);
|
||||||
DelayedSampleBuffer.AsSpan().Fill(0.0f);
|
DelayedSampleBuffer.AsSpan().Fill(0.0f);
|
||||||
|
|
||||||
|
115
Ryujinx.Audio/Renderer/Parameter/Effect/CompressorParameter.cs
Normal file
115
Ryujinx.Audio/Renderer/Parameter/Effect/CompressorParameter.cs
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
using Ryujinx.Audio.Renderer.Server.Effect;
|
||||||
|
using Ryujinx.Common.Memory;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <see cref="IEffectInParameter.SpecificData"/> for <see cref="Common.EffectType.Compressor"/>.
|
||||||
|
/// </summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
public struct CompressorParameter
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The input channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
|
||||||
|
/// </summary>
|
||||||
|
public Array6<byte> Input;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The output channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
|
||||||
|
/// </summary>
|
||||||
|
public Array6<byte> Output;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The maximum number of channels supported.
|
||||||
|
/// </summary>
|
||||||
|
public ushort ChannelCountMax;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The total channel count used.
|
||||||
|
/// </summary>
|
||||||
|
public ushort ChannelCount;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The target sample rate.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This is in kHz.</remarks>
|
||||||
|
public int SampleRate;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The threshold.
|
||||||
|
/// </summary>
|
||||||
|
public float Threshold;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The compressor ratio.
|
||||||
|
/// </summary>
|
||||||
|
public float Ratio;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The attack time.
|
||||||
|
/// <remarks>This is in microseconds.</remarks>
|
||||||
|
/// </summary>
|
||||||
|
public int AttackTime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The release time.
|
||||||
|
/// <remarks>This is in microseconds.</remarks>
|
||||||
|
/// </summary>
|
||||||
|
public int ReleaseTime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The input gain.
|
||||||
|
/// </summary>
|
||||||
|
public float InputGain;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The attack coefficient.
|
||||||
|
/// </summary>
|
||||||
|
public float AttackCoefficient;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The release coefficient.
|
||||||
|
/// </summary>
|
||||||
|
public float ReleaseCoefficient;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The output gain.
|
||||||
|
/// </summary>
|
||||||
|
public float OutputGain;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current usage status of the effect on the client side.
|
||||||
|
/// </summary>
|
||||||
|
public UsageState Status;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicate if the makeup gain should be used.
|
||||||
|
/// </summary>
|
||||||
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
|
public bool MakeupGainEnabled;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reserved/padding.
|
||||||
|
/// </summary>
|
||||||
|
private Array2<byte> _reserved;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if the <see cref="ChannelCount"/> is valid.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Returns true if the <see cref="ChannelCount"/> is valid.</returns>
|
||||||
|
public bool IsChannelCountValid()
|
||||||
|
{
|
||||||
|
return EffectInParameterVersion1.IsChannelCountValid(ChannelCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if the <see cref="ChannelCountMax"/> is valid.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Returns true if the <see cref="ChannelCountMax"/> is valid.</returns>
|
||||||
|
public bool IsChannelCountMaxValid()
|
||||||
|
{
|
||||||
|
return EffectInParameterVersion1.IsChannelCountValid(ChannelCountMax);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -44,7 +44,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// <see cref="Parameter.RendererInfoOutStatus"/> was added to supply the count of update done sent to the DSP.
|
/// <see cref="Parameter.RendererInfoOutStatus"/> was added to supply the count of update done sent to the DSP.
|
||||||
/// A new version of the command estimator was added to address timing changes caused by the voice changes.
|
/// A new version of the command estimator was added to address timing changes caused by the voice changes.
|
||||||
/// Additionally, the rendering limit percent was incremented to 80%.
|
/// Additionally, the rendering limit percent was incremented to 80%.
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>This was added in system update 6.0.0</remarks>
|
/// <remarks>This was added in system update 6.0.0</remarks>
|
||||||
public const int Revision5 = 5 << 24;
|
public const int Revision5 = 5 << 24;
|
||||||
@@ -93,6 +93,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// REV11:
|
/// REV11:
|
||||||
/// The "legacy" effects (Delay, Reverb and Reverb 3D) were updated to match the standard channel mapping used by the audio renderer.
|
/// The "legacy" effects (Delay, Reverb and Reverb 3D) were updated to match the standard channel mapping used by the audio renderer.
|
||||||
|
/// A new effect was added: Compressor. This effect is effectively implemented with a DRC.
|
||||||
/// A new version of the command estimator was added to address timing changes caused by the legacy effects changes.
|
/// A new version of the command estimator was added to address timing changes caused by the legacy effects changes.
|
||||||
/// A voice drop parameter was added in 15.0.0: This allows an application to amplify or attenuate the estimated time of DSP commands.
|
/// A voice drop parameter was added in 15.0.0: This allows an application to amplify or attenuate the estimated time of DSP commands.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -469,6 +469,18 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void GenerateCompressorEffect(uint bufferOffset, CompressorParameter parameter, Memory<CompressorState> state, bool isEnabled, int nodeId)
|
||||||
|
{
|
||||||
|
if (parameter.IsChannelCountValid())
|
||||||
|
{
|
||||||
|
CompressorCommand command = new CompressorCommand(bufferOffset, parameter, state, isEnabled, nodeId);
|
||||||
|
|
||||||
|
command.EstimatedProcessingTime = _commandProcessingTimeEstimator.Estimate(command);
|
||||||
|
|
||||||
|
AddCommand(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate a new <see cref="VolumeCommand"/>.
|
/// Generate a new <see cref="VolumeCommand"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -606,6 +606,17 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void GenerateCompressorEffect(uint bufferOffset, CompressorEffect effect, int nodeId)
|
||||||
|
{
|
||||||
|
Debug.Assert(effect.Type == EffectType.Compressor);
|
||||||
|
|
||||||
|
_commandBuffer.GenerateCompressorEffect(bufferOffset,
|
||||||
|
effect.Parameter,
|
||||||
|
effect.State,
|
||||||
|
effect.IsEnabled,
|
||||||
|
nodeId);
|
||||||
|
}
|
||||||
|
|
||||||
private void GenerateEffect(ref MixState mix, int effectId, BaseEffect effect)
|
private void GenerateEffect(ref MixState mix, int effectId, BaseEffect effect)
|
||||||
{
|
{
|
||||||
int nodeId = mix.NodeId;
|
int nodeId = mix.NodeId;
|
||||||
@@ -650,6 +661,9 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
case EffectType.CaptureBuffer:
|
case EffectType.CaptureBuffer:
|
||||||
GenerateCaptureEffect(mix.BufferOffset, (CaptureBufferEffect)effect, nodeId);
|
GenerateCaptureEffect(mix.BufferOffset, (CaptureBufferEffect)effect, nodeId);
|
||||||
break;
|
break;
|
||||||
|
case EffectType.Compressor:
|
||||||
|
GenerateCompressorEffect(mix.BufferOffset, (CompressorEffect)effect, nodeId);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new NotImplementedException($"Unsupported effect type {effect.Type}");
|
throw new NotImplementedException($"Unsupported effect type {effect.Type}");
|
||||||
}
|
}
|
||||||
|
@@ -179,5 +179,10 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public uint Estimate(CompressorCommand command)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -543,5 +543,10 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public uint Estimate(CompressorCommand command)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -747,5 +747,10 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual uint Estimate(CompressorCommand command)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -232,5 +232,79 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override uint Estimate(CompressorCommand command)
|
||||||
|
{
|
||||||
|
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
|
||||||
|
|
||||||
|
if (_sampleCount == 160)
|
||||||
|
{
|
||||||
|
if (command.Enabled)
|
||||||
|
{
|
||||||
|
switch (command.Parameter.ChannelCount)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
return 34431;
|
||||||
|
case 2:
|
||||||
|
return 44253;
|
||||||
|
case 4:
|
||||||
|
return 63827;
|
||||||
|
case 6:
|
||||||
|
return 83361;
|
||||||
|
default:
|
||||||
|
throw new NotImplementedException($"{command.Parameter.ChannelCount}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (command.Parameter.ChannelCount)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
return (uint)630.12f;
|
||||||
|
case 2:
|
||||||
|
return (uint)638.27f;
|
||||||
|
case 4:
|
||||||
|
return (uint)705.86f;
|
||||||
|
case 6:
|
||||||
|
return (uint)782.02f;
|
||||||
|
default:
|
||||||
|
throw new NotImplementedException($"{command.Parameter.ChannelCount}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (command.Enabled)
|
||||||
|
{
|
||||||
|
switch (command.Parameter.ChannelCount)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
return 51095;
|
||||||
|
case 2:
|
||||||
|
return 65693;
|
||||||
|
case 4:
|
||||||
|
return 95383;
|
||||||
|
case 6:
|
||||||
|
return 124510;
|
||||||
|
default:
|
||||||
|
throw new NotImplementedException($"{command.Parameter.ChannelCount}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (command.Parameter.ChannelCount)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
return (uint)840.14f;
|
||||||
|
case 2:
|
||||||
|
return (uint)826.1f;
|
||||||
|
case 4:
|
||||||
|
return (uint)901.88f;
|
||||||
|
case 6:
|
||||||
|
return (uint)965.29f;
|
||||||
|
default:
|
||||||
|
throw new NotImplementedException($"{command.Parameter.ChannelCount}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -262,6 +262,8 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
|
|||||||
return PerformanceDetailType.Limiter;
|
return PerformanceDetailType.Limiter;
|
||||||
case EffectType.CaptureBuffer:
|
case EffectType.CaptureBuffer:
|
||||||
return PerformanceDetailType.CaptureBuffer;
|
return PerformanceDetailType.CaptureBuffer;
|
||||||
|
case EffectType.Compressor:
|
||||||
|
return PerformanceDetailType.Compressor;
|
||||||
default:
|
default:
|
||||||
throw new NotImplementedException($"{Type}");
|
throw new NotImplementedException($"{Type}");
|
||||||
}
|
}
|
||||||
|
67
Ryujinx.Audio/Renderer/Server/Effect/CompressorEffect.cs
Normal file
67
Ryujinx.Audio/Renderer/Server/Effect/CompressorEffect.cs
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
using Ryujinx.Audio.Renderer.Common;
|
||||||
|
using Ryujinx.Audio.Renderer.Dsp.State;
|
||||||
|
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||||
|
using Ryujinx.Audio.Renderer.Parameter;
|
||||||
|
using Ryujinx.Audio.Renderer.Server.MemoryPool;
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.Audio.Renderer.Server.Effect
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Server state for a compressor effect.
|
||||||
|
/// </summary>
|
||||||
|
public class CompressorEffect : BaseEffect
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The compressor parameter.
|
||||||
|
/// </summary>
|
||||||
|
public CompressorParameter Parameter;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The compressor state.
|
||||||
|
/// </summary>
|
||||||
|
public Memory<CompressorState> State { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new <see cref="CompressorEffect"/>.
|
||||||
|
/// </summary>
|
||||||
|
public CompressorEffect()
|
||||||
|
{
|
||||||
|
State = new CompressorState[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
public override EffectType TargetEffectType => EffectType.Compressor;
|
||||||
|
|
||||||
|
public override ulong GetWorkBuffer(int index)
|
||||||
|
{
|
||||||
|
return GetSingleBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update(out BehaviourParameter.ErrorInfo updateErrorInfo, ref EffectInParameterVersion1 parameter, PoolMapper mapper)
|
||||||
|
{
|
||||||
|
// Nintendo doesn't do anything here but we still require updateErrorInfo to be initialised.
|
||||||
|
updateErrorInfo = new BehaviourParameter.ErrorInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Update(out BehaviourParameter.ErrorInfo updateErrorInfo, ref EffectInParameterVersion2 parameter, PoolMapper mapper)
|
||||||
|
{
|
||||||
|
Debug.Assert(IsTypeValid(ref parameter));
|
||||||
|
|
||||||
|
UpdateParameterBase(ref parameter);
|
||||||
|
|
||||||
|
Parameter = MemoryMarshal.Cast<byte, CompressorParameter>(parameter.SpecificData)[0];
|
||||||
|
IsEnabled = parameter.IsEnabled;
|
||||||
|
|
||||||
|
updateErrorInfo = new BehaviourParameter.ErrorInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void UpdateForCommandGeneration()
|
||||||
|
{
|
||||||
|
UpdateUsageStateForCommandGeneration();
|
||||||
|
|
||||||
|
Parameter.Status = UsageState.Enabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -35,5 +35,6 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
uint Estimate(LimiterCommandVersion2 command);
|
uint Estimate(LimiterCommandVersion2 command);
|
||||||
uint Estimate(GroupedBiquadFilterCommand command);
|
uint Estimate(GroupedBiquadFilterCommand command);
|
||||||
uint Estimate(CaptureBufferCommand command);
|
uint Estimate(CaptureBufferCommand command);
|
||||||
|
uint Estimate(CompressorCommand command);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -240,6 +240,10 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
case EffectType.CaptureBuffer:
|
case EffectType.CaptureBuffer:
|
||||||
effect = new CaptureBufferEffect();
|
effect = new CaptureBufferEffect();
|
||||||
break;
|
break;
|
||||||
|
case EffectType.Compressor:
|
||||||
|
effect = new CompressorEffect();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new NotImplementedException($"EffectType {parameter.Type} not implemented!");
|
throw new NotImplementedException($"EffectType {parameter.Type} not implemented!");
|
||||||
}
|
}
|
||||||
|
@@ -125,7 +125,7 @@ namespace Ryujinx.Ava
|
|||||||
_inputManager = inputManager;
|
_inputManager = inputManager;
|
||||||
_accountManager = accountManager;
|
_accountManager = accountManager;
|
||||||
_userChannelPersistence = userChannelPersistence;
|
_userChannelPersistence = userChannelPersistence;
|
||||||
_renderingThread = new Thread(RenderLoop) { Name = "GUI.RenderThread" };
|
_renderingThread = new Thread(RenderLoop, 1 * 1024 * 1024) { Name = "GUI.RenderThread" };
|
||||||
_hideCursorOnIdle = ConfigurationState.Instance.HideCursorOnIdle;
|
_hideCursorOnIdle = ConfigurationState.Instance.HideCursorOnIdle;
|
||||||
_lastCursorMoveTime = Stopwatch.GetTimestamp();
|
_lastCursorMoveTime = Stopwatch.GetTimestamp();
|
||||||
_glLogLevel = ConfigurationState.Instance.Logger.GraphicsDebugLevel;
|
_glLogLevel = ConfigurationState.Instance.Logger.GraphicsDebugLevel;
|
||||||
|
@@ -157,11 +157,10 @@
|
|||||||
"SettingsTabLoggingEnableFsAccessLogs": "Aktiviere Fs Zugriff-Logs",
|
"SettingsTabLoggingEnableFsAccessLogs": "Aktiviere Fs Zugriff-Logs",
|
||||||
"SettingsTabLoggingFsGlobalAccessLogMode": "Fs Globaler Zugriff-Log-Modus:",
|
"SettingsTabLoggingFsGlobalAccessLogMode": "Fs Globaler Zugriff-Log-Modus:",
|
||||||
"SettingsTabLoggingDeveloperOptions": "Entwickleroptionen (WARNUNG: Beeinträchtigt die Leistung)",
|
"SettingsTabLoggingDeveloperOptions": "Entwickleroptionen (WARNUNG: Beeinträchtigt die Leistung)",
|
||||||
"SettingsTabLoggingOpenglLogLevel": "OpenGL Logstufe:",
|
"SettingsTabLoggingGraphicsBackendLogLevelNone": "Keine",
|
||||||
"SettingsTabLoggingOpenglLogLevelNone": "Keine",
|
"SettingsTabLoggingGraphicsBackendLogLevelError": "Fehler",
|
||||||
"SettingsTabLoggingOpenglLogLevelError": "Fehler",
|
"SettingsTabLoggingGraphicsBackendLogLevelPerformance": "Verlangsamungen",
|
||||||
"SettingsTabLoggingOpenglLogLevelPerformance": "Verlangsamungen",
|
"SettingsTabLoggingGraphicsBackendLogLevelAll": "Alle",
|
||||||
"SettingsTabLoggingOpenglLogLevelAll": "Alle",
|
|
||||||
"SettingsTabLoggingEnableDebugLogs": "Aktiviere Debug-Log",
|
"SettingsTabLoggingEnableDebugLogs": "Aktiviere Debug-Log",
|
||||||
"SettingsTabInput": "Eingabe",
|
"SettingsTabInput": "Eingabe",
|
||||||
"SettingsTabInputEnableDockedMode": "Docked Modus",
|
"SettingsTabInputEnableDockedMode": "Docked Modus",
|
||||||
|
@@ -157,11 +157,10 @@
|
|||||||
"SettingsTabLoggingEnableFsAccessLogs": "Ενεργοποίηση Καταγραφής Πρόσβασης FS",
|
"SettingsTabLoggingEnableFsAccessLogs": "Ενεργοποίηση Καταγραφής Πρόσβασης FS",
|
||||||
"SettingsTabLoggingFsGlobalAccessLogMode": "Λειτουργία Καταγραφής Καθολικής Πρόσβασης FS:",
|
"SettingsTabLoggingFsGlobalAccessLogMode": "Λειτουργία Καταγραφής Καθολικής Πρόσβασης FS:",
|
||||||
"SettingsTabLoggingDeveloperOptions": "Επιλογές Προγραμματιστή (ΠΡΟΕΙΔΟΠΟΙΗΣΗ: Η απόδοση Θα μειωθεί)",
|
"SettingsTabLoggingDeveloperOptions": "Επιλογές Προγραμματιστή (ΠΡΟΕΙΔΟΠΟΙΗΣΗ: Η απόδοση Θα μειωθεί)",
|
||||||
"SettingsTabLoggingOpenglLogLevel": "Επίπεδο Καταγραφής OpenGL:",
|
"SettingsTabLoggingGraphicsBackendLogLevelNone": "Κανένα",
|
||||||
"SettingsTabLoggingOpenglLogLevelNone": "Κανένα",
|
"SettingsTabLoggingGraphicsBackendLogLevelError": "Σφάλμα",
|
||||||
"SettingsTabLoggingOpenglLogLevelError": "Σφάλμα",
|
"SettingsTabLoggingGraphicsBackendLogLevelPerformance": "Επιβραδύνσεις",
|
||||||
"SettingsTabLoggingOpenglLogLevelPerformance": "Επιβραδύνσεις",
|
"SettingsTabLoggingGraphicsBackendLogLevelAll": "Όλα",
|
||||||
"SettingsTabLoggingOpenglLogLevelAll": "Όλα",
|
|
||||||
"SettingsTabLoggingEnableDebugLogs": "Ενεργοποίηση Αρχείων Καταγραφής Εντοπισμού Σφαλμάτων",
|
"SettingsTabLoggingEnableDebugLogs": "Ενεργοποίηση Αρχείων Καταγραφής Εντοπισμού Σφαλμάτων",
|
||||||
"SettingsTabInput": "Χειρισμός",
|
"SettingsTabInput": "Χειρισμός",
|
||||||
"SettingsTabInputEnableDockedMode": "Ενεργοποίηση Docked Mode",
|
"SettingsTabInputEnableDockedMode": "Ενεργοποίηση Docked Mode",
|
||||||
|
@@ -157,11 +157,11 @@
|
|||||||
"SettingsTabLoggingEnableFsAccessLogs": "Enable Fs Access Logs",
|
"SettingsTabLoggingEnableFsAccessLogs": "Enable Fs Access Logs",
|
||||||
"SettingsTabLoggingFsGlobalAccessLogMode": "Fs Global Access Log Mode:",
|
"SettingsTabLoggingFsGlobalAccessLogMode": "Fs Global Access Log Mode:",
|
||||||
"SettingsTabLoggingDeveloperOptions": "Developer Options (WARNING: Will reduce performance)",
|
"SettingsTabLoggingDeveloperOptions": "Developer Options (WARNING: Will reduce performance)",
|
||||||
"SettingsTabLoggingOpenglLogLevel": "OpenGL Log Level:",
|
"SettingsTabLoggingGraphicsBackendLogLevel": "Graphics Backend Log Level:",
|
||||||
"SettingsTabLoggingOpenglLogLevelNone": "None",
|
"SettingsTabLoggingGraphicsBackendLogLevelNone": "None",
|
||||||
"SettingsTabLoggingOpenglLogLevelError": "Error",
|
"SettingsTabLoggingGraphicsBackendLogLevelError": "Error",
|
||||||
"SettingsTabLoggingOpenglLogLevelPerformance": "Slowdowns",
|
"SettingsTabLoggingGraphicsBackendLogLevelPerformance": "Slowdowns",
|
||||||
"SettingsTabLoggingOpenglLogLevelAll": "All",
|
"SettingsTabLoggingGraphicsBackendLogLevelAll": "All",
|
||||||
"SettingsTabLoggingEnableDebugLogs": "Enable Debug Logs",
|
"SettingsTabLoggingEnableDebugLogs": "Enable Debug Logs",
|
||||||
"SettingsTabInput": "Input",
|
"SettingsTabInput": "Input",
|
||||||
"SettingsTabInputEnableDockedMode": "Docked Mode",
|
"SettingsTabInputEnableDockedMode": "Docked Mode",
|
||||||
|
@@ -157,11 +157,10 @@
|
|||||||
"SettingsTabLoggingEnableFsAccessLogs": "Habilitar registros de Fs Access",
|
"SettingsTabLoggingEnableFsAccessLogs": "Habilitar registros de Fs Access",
|
||||||
"SettingsTabLoggingFsGlobalAccessLogMode": "Modo de registros Fs Global Access:",
|
"SettingsTabLoggingFsGlobalAccessLogMode": "Modo de registros Fs Global Access:",
|
||||||
"SettingsTabLoggingDeveloperOptions": "Opciones de desarrollador (ADVERTENCIA: empeorarán el rendimiento)",
|
"SettingsTabLoggingDeveloperOptions": "Opciones de desarrollador (ADVERTENCIA: empeorarán el rendimiento)",
|
||||||
"SettingsTabLoggingOpenglLogLevel": "Nivel de registro de OpenGL:",
|
"SettingsTabLoggingGraphicsBackendLogLevelNone": "Nada",
|
||||||
"SettingsTabLoggingOpenglLogLevelNone": "Nada",
|
"SettingsTabLoggingGraphicsBackendLogLevelError": "Errores",
|
||||||
"SettingsTabLoggingOpenglLogLevelError": "Errores",
|
"SettingsTabLoggingGraphicsBackendLogLevelPerformance": "Ralentizaciones",
|
||||||
"SettingsTabLoggingOpenglLogLevelPerformance": "Ralentizaciones",
|
"SettingsTabLoggingGraphicsBackendLogLevelAll": "Todo",
|
||||||
"SettingsTabLoggingOpenglLogLevelAll": "Todo",
|
|
||||||
"SettingsTabLoggingEnableDebugLogs": "Habilitar registros de debug",
|
"SettingsTabLoggingEnableDebugLogs": "Habilitar registros de debug",
|
||||||
"SettingsTabInput": "Entrada",
|
"SettingsTabInput": "Entrada",
|
||||||
"SettingsTabInputEnableDockedMode": "Modo dock/TV",
|
"SettingsTabInputEnableDockedMode": "Modo dock/TV",
|
||||||
|
@@ -150,11 +150,10 @@
|
|||||||
"SettingsTabLoggingEnableFsAccessLogs": "Activer les journaux des accès au système de fichiers",
|
"SettingsTabLoggingEnableFsAccessLogs": "Activer les journaux des accès au système de fichiers",
|
||||||
"SettingsTabLoggingFsGlobalAccessLogMode": "Niveau des journaux des accès au système de fichiers:",
|
"SettingsTabLoggingFsGlobalAccessLogMode": "Niveau des journaux des accès au système de fichiers:",
|
||||||
"SettingsTabLoggingDeveloperOptions": "Options développeur (ATTENTION: Cela peut réduire les performances)",
|
"SettingsTabLoggingDeveloperOptions": "Options développeur (ATTENTION: Cela peut réduire les performances)",
|
||||||
"SettingsTabLoggingOpenglLogLevel": "Niveau des journaux OpenGL:",
|
"SettingsTabLoggingGraphicsBackendLogLevelNone": "Aucun",
|
||||||
"SettingsTabLoggingOpenglLogLevelNone": "Aucun",
|
"SettingsTabLoggingGraphicsBackendLogLevelError": "Erreur",
|
||||||
"SettingsTabLoggingOpenglLogLevelError": "Erreur",
|
"SettingsTabLoggingGraphicsBackendLogLevelPerformance": "Ralentissements",
|
||||||
"SettingsTabLoggingOpenglLogLevelPerformance": "Ralentissements",
|
"SettingsTabLoggingGraphicsBackendLogLevelAll": "Tout",
|
||||||
"SettingsTabLoggingOpenglLogLevelAll": "Tout",
|
|
||||||
"SettingsTabLoggingEnableDebugLogs": "Activer les journaux de debug",
|
"SettingsTabLoggingEnableDebugLogs": "Activer les journaux de debug",
|
||||||
"SettingsTabInput": "Contrôles",
|
"SettingsTabInput": "Contrôles",
|
||||||
"SettingsTabInputEnableDockedMode": "Active le mode station d'accueil",
|
"SettingsTabInputEnableDockedMode": "Active le mode station d'accueil",
|
||||||
|
@@ -157,11 +157,10 @@
|
|||||||
"SettingsTabLoggingEnableFsAccessLogs": "Attiva Fs Access Logs",
|
"SettingsTabLoggingEnableFsAccessLogs": "Attiva Fs Access Logs",
|
||||||
"SettingsTabLoggingFsGlobalAccessLogMode": "Modalità log accesso globale Fs:",
|
"SettingsTabLoggingFsGlobalAccessLogMode": "Modalità log accesso globale Fs:",
|
||||||
"SettingsTabLoggingDeveloperOptions": "Opzioni da sviluppatore (AVVISO: Ridurrà le prestazioni)",
|
"SettingsTabLoggingDeveloperOptions": "Opzioni da sviluppatore (AVVISO: Ridurrà le prestazioni)",
|
||||||
"SettingsTabLoggingOpenglLogLevel": "Livello di log OpenGL:",
|
"SettingsTabLoggingGraphicsBackendLogLevelNone": "Nessuno",
|
||||||
"SettingsTabLoggingOpenglLogLevelNone": "Nessuno",
|
"SettingsTabLoggingGraphicsBackendLogLevelError": "Errore",
|
||||||
"SettingsTabLoggingOpenglLogLevelError": "Errore",
|
"SettingsTabLoggingGraphicsBackendLogLevelPerformance": "Rallentamenti",
|
||||||
"SettingsTabLoggingOpenglLogLevelPerformance": "Rallentamenti",
|
"SettingsTabLoggingGraphicsBackendLogLevelAll": "Tutto",
|
||||||
"SettingsTabLoggingOpenglLogLevelAll": "Tutto",
|
|
||||||
"SettingsTabLoggingEnableDebugLogs": "Attiva logs di debug",
|
"SettingsTabLoggingEnableDebugLogs": "Attiva logs di debug",
|
||||||
"SettingsTabInput": "Input",
|
"SettingsTabInput": "Input",
|
||||||
"SettingsTabInputEnableDockedMode": "Attiva modalità TV",
|
"SettingsTabInputEnableDockedMode": "Attiva modalità TV",
|
||||||
@@ -558,8 +557,8 @@
|
|||||||
"SettingsSelectThemeFileDialogTitle" : "Seleziona file del tema",
|
"SettingsSelectThemeFileDialogTitle" : "Seleziona file del tema",
|
||||||
"SettingsXamlThemeFile" : "File del tema xaml",
|
"SettingsXamlThemeFile" : "File del tema xaml",
|
||||||
"SettingsTabHotkeysResScaleUpHotkey": "Aumentare la risoluzione:",
|
"SettingsTabHotkeysResScaleUpHotkey": "Aumentare la risoluzione:",
|
||||||
"SettingsTabHotkeysResScaleDownHotkey": "Diminuire la risoluzione:"
|
"SettingsTabHotkeysResScaleDownHotkey": "Diminuire la risoluzione:",
|
||||||
"AvatarWindowTitle": "Gestisci account - Avatar"
|
"AvatarWindowTitle": "Gestisci account - Avatar",
|
||||||
"Amiibo": "Amiibo",
|
"Amiibo": "Amiibo",
|
||||||
"Unknown": "Sconosciuto",
|
"Unknown": "Sconosciuto",
|
||||||
"Usage": "Utilizzo",
|
"Usage": "Utilizzo",
|
||||||
|
@@ -157,11 +157,10 @@
|
|||||||
"SettingsTabLoggingEnableFsAccessLogs": "Fs アクセスログを有効",
|
"SettingsTabLoggingEnableFsAccessLogs": "Fs アクセスログを有効",
|
||||||
"SettingsTabLoggingFsGlobalAccessLogMode": "Fs グローバルアクセスログモード:",
|
"SettingsTabLoggingFsGlobalAccessLogMode": "Fs グローバルアクセスログモード:",
|
||||||
"SettingsTabLoggingDeveloperOptions": "開発者オプション (警告: パフォーマンスが低下します)",
|
"SettingsTabLoggingDeveloperOptions": "開発者オプション (警告: パフォーマンスが低下します)",
|
||||||
"SettingsTabLoggingOpenglLogLevel": "OpenGL ログレベル:",
|
"SettingsTabLoggingGraphicsBackendLogLevelNone": "なし",
|
||||||
"SettingsTabLoggingOpenglLogLevelNone": "なし",
|
"SettingsTabLoggingGraphicsBackendLogLevelError": "エラー",
|
||||||
"SettingsTabLoggingOpenglLogLevelError": "エラー",
|
"SettingsTabLoggingGraphicsBackendLogLevelPerformance": "パフォーマンス低下",
|
||||||
"SettingsTabLoggingOpenglLogLevelPerformance": "パフォーマンス低下",
|
"SettingsTabLoggingGraphicsBackendLogLevelAll": "すべて",
|
||||||
"SettingsTabLoggingOpenglLogLevelAll": "すべて",
|
|
||||||
"SettingsTabLoggingEnableDebugLogs": "デバッグログを有効",
|
"SettingsTabLoggingEnableDebugLogs": "デバッグログを有効",
|
||||||
"SettingsTabInput": "入力",
|
"SettingsTabInput": "入力",
|
||||||
"SettingsTabInputEnableDockedMode": "ドッキングモード",
|
"SettingsTabInputEnableDockedMode": "ドッキングモード",
|
||||||
|
@@ -156,11 +156,10 @@
|
|||||||
"SettingsTabLoggingEnableFsAccessLogs": "Fs 액세스 로그 켜기",
|
"SettingsTabLoggingEnableFsAccessLogs": "Fs 액세스 로그 켜기",
|
||||||
"SettingsTabLoggingFsGlobalAccessLogMode": "Fs 전역 액세스 로그 모드 :",
|
"SettingsTabLoggingFsGlobalAccessLogMode": "Fs 전역 액세스 로그 모드 :",
|
||||||
"SettingsTabLoggingDeveloperOptions": "개발자 옵션 (경고 : 성능이 저하됩니다.)",
|
"SettingsTabLoggingDeveloperOptions": "개발자 옵션 (경고 : 성능이 저하됩니다.)",
|
||||||
"SettingsTabLoggingOpenglLogLevel": "OpenGL 로그 수준 :",
|
"SettingsTabLoggingGraphicsBackendLogLevelNone": "없음",
|
||||||
"SettingsTabLoggingOpenglLogLevelNone": "없음",
|
"SettingsTabLoggingGraphicsBackendLogLevelError": "오류",
|
||||||
"SettingsTabLoggingOpenglLogLevelError": "오류",
|
"SettingsTabLoggingGraphicsBackendLogLevelPerformance": "감속",
|
||||||
"SettingsTabLoggingOpenglLogLevelPerformance": "감속",
|
"SettingsTabLoggingGraphicsBackendLogLevelAll": "모두",
|
||||||
"SettingsTabLoggingOpenglLogLevelAll": "모두",
|
|
||||||
"SettingsTabLoggingEnableDebugLogs": "디버그 로그 사용",
|
"SettingsTabLoggingEnableDebugLogs": "디버그 로그 사용",
|
||||||
"SettingsTabInput": "입력",
|
"SettingsTabInput": "입력",
|
||||||
"SettingsTabInputEnableDockedMode": "도킹 모드 활성화",
|
"SettingsTabInputEnableDockedMode": "도킹 모드 활성화",
|
||||||
|
@@ -157,11 +157,10 @@
|
|||||||
"SettingsTabLoggingEnableFsAccessLogs": "Włącz Logi Dostępu do Systemu Plików",
|
"SettingsTabLoggingEnableFsAccessLogs": "Włącz Logi Dostępu do Systemu Plików",
|
||||||
"SettingsTabLoggingFsGlobalAccessLogMode": "Tryb Globalnych Logów Systemu Plików:",
|
"SettingsTabLoggingFsGlobalAccessLogMode": "Tryb Globalnych Logów Systemu Plików:",
|
||||||
"SettingsTabLoggingDeveloperOptions": "Opcje programistyczne (OSTRZEŻENIE: Zmniejszą wydajność)",
|
"SettingsTabLoggingDeveloperOptions": "Opcje programistyczne (OSTRZEŻENIE: Zmniejszą wydajność)",
|
||||||
"SettingsTabLoggingOpenglLogLevel": "Poziom Logów OpenGL:",
|
"SettingsTabLoggingGraphicsBackendLogLevelNone": "Żadne",
|
||||||
"SettingsTabLoggingOpenglLogLevelNone": "Żadne",
|
"SettingsTabLoggingGraphicsBackendLogLevelError": "Błędy",
|
||||||
"SettingsTabLoggingOpenglLogLevelError": "Błędy",
|
"SettingsTabLoggingGraphicsBackendLogLevelPerformance": "Spowolnienia",
|
||||||
"SettingsTabLoggingOpenglLogLevelPerformance": "Spowolnienia",
|
"SettingsTabLoggingGraphicsBackendLogLevelAll": "Wszystkie",
|
||||||
"SettingsTabLoggingOpenglLogLevelAll": "Wszystkie",
|
|
||||||
"SettingsTabLoggingEnableDebugLogs": "Włącz Logi Debugowania",
|
"SettingsTabLoggingEnableDebugLogs": "Włącz Logi Debugowania",
|
||||||
"SettingsTabInput": "Sterowanie",
|
"SettingsTabInput": "Sterowanie",
|
||||||
"SettingsTabInputEnableDockedMode": "Tryb Zadokowany",
|
"SettingsTabInputEnableDockedMode": "Tryb Zadokowany",
|
||||||
|
@@ -157,11 +157,10 @@
|
|||||||
"SettingsTabLoggingEnableFsAccessLogs": "Habilitar logs de acesso ao sistema de arquivos",
|
"SettingsTabLoggingEnableFsAccessLogs": "Habilitar logs de acesso ao sistema de arquivos",
|
||||||
"SettingsTabLoggingFsGlobalAccessLogMode": "Modo global de logs do sistema de arquivos:",
|
"SettingsTabLoggingFsGlobalAccessLogMode": "Modo global de logs do sistema de arquivos:",
|
||||||
"SettingsTabLoggingDeveloperOptions": "Opções do desenvolvedor (AVISO: Vai reduzir a performance)",
|
"SettingsTabLoggingDeveloperOptions": "Opções do desenvolvedor (AVISO: Vai reduzir a performance)",
|
||||||
"SettingsTabLoggingOpenglLogLevel": "Nível de log do OpenGL:",
|
"SettingsTabLoggingGraphicsBackendLogLevelNone": "Nenhum",
|
||||||
"SettingsTabLoggingOpenglLogLevelNone": "Nenhum",
|
"SettingsTabLoggingGraphicsBackendLogLevelError": "Erro",
|
||||||
"SettingsTabLoggingOpenglLogLevelError": "Erro",
|
"SettingsTabLoggingGraphicsBackendLogLevelPerformance": "Lentidão",
|
||||||
"SettingsTabLoggingOpenglLogLevelPerformance": "Lentidão",
|
"SettingsTabLoggingGraphicsBackendLogLevelAll": "Todos",
|
||||||
"SettingsTabLoggingOpenglLogLevelAll": "Todos",
|
|
||||||
"SettingsTabLoggingEnableDebugLogs": "Habilitar logs de depuração",
|
"SettingsTabLoggingEnableDebugLogs": "Habilitar logs de depuração",
|
||||||
"SettingsTabInput": "Controle",
|
"SettingsTabInput": "Controle",
|
||||||
"SettingsTabInputEnableDockedMode": "Habilitar modo TV",
|
"SettingsTabInputEnableDockedMode": "Habilitar modo TV",
|
||||||
|
@@ -156,11 +156,10 @@
|
|||||||
"SettingsTabLoggingEnableFsAccessLogs": "Включить журналы доступа Fs",
|
"SettingsTabLoggingEnableFsAccessLogs": "Включить журналы доступа Fs",
|
||||||
"SettingsTabLoggingFsGlobalAccessLogMode": "Режим журнала глобального доступа Fs:",
|
"SettingsTabLoggingFsGlobalAccessLogMode": "Режим журнала глобального доступа Fs:",
|
||||||
"SettingsTabLoggingDeveloperOptions": "Параметры разработчика (ВНИМАНИЕ: снизит производительность)",
|
"SettingsTabLoggingDeveloperOptions": "Параметры разработчика (ВНИМАНИЕ: снизит производительность)",
|
||||||
"SettingsTabLoggingOpenglLogLevel": "Уровень журнала OpenGL:",
|
"SettingsTabLoggingGraphicsBackendLogLevelNone": "Ничего",
|
||||||
"SettingsTabLoggingOpenglLogLevelNone": "Ничего",
|
"SettingsTabLoggingGraphicsBackendLogLevelError": "Ошибка",
|
||||||
"SettingsTabLoggingOpenglLogLevelError": "Ошибка",
|
"SettingsTabLoggingGraphicsBackendLogLevelPerformance": "Замедления",
|
||||||
"SettingsTabLoggingOpenglLogLevelPerformance": "Замедления",
|
"SettingsTabLoggingGraphicsBackendLogLevelAll": "Всё",
|
||||||
"SettingsTabLoggingOpenglLogLevelAll": "Всё",
|
|
||||||
"SettingsTabLoggingEnableDebugLogs": "Включить журналы отладки",
|
"SettingsTabLoggingEnableDebugLogs": "Включить журналы отладки",
|
||||||
"SettingsTabInput": "Управление",
|
"SettingsTabInput": "Управление",
|
||||||
"SettingsTabInputEnableDockedMode": "Включить режим закрепления",
|
"SettingsTabInputEnableDockedMode": "Включить режим закрепления",
|
||||||
|
@@ -157,11 +157,10 @@
|
|||||||
"SettingsTabLoggingEnableFsAccessLogs": "Fs Erişim Loglarını Etkinleştir",
|
"SettingsTabLoggingEnableFsAccessLogs": "Fs Erişim Loglarını Etkinleştir",
|
||||||
"SettingsTabLoggingFsGlobalAccessLogMode": "Fs Evrensel Erişim Log Modu:",
|
"SettingsTabLoggingFsGlobalAccessLogMode": "Fs Evrensel Erişim Log Modu:",
|
||||||
"SettingsTabLoggingDeveloperOptions": "Geliştirici Seçenekleri (UYARI: Performansı düşürecektir)",
|
"SettingsTabLoggingDeveloperOptions": "Geliştirici Seçenekleri (UYARI: Performansı düşürecektir)",
|
||||||
"SettingsTabLoggingOpenglLogLevel": "OpenGL Log Seviyesi:",
|
"SettingsTabLoggingGraphicsBackendLogLevelNone": "Hiç",
|
||||||
"SettingsTabLoggingOpenglLogLevelNone": "Hiç",
|
"SettingsTabLoggingGraphicsBackendLogLevelError": "Hata",
|
||||||
"SettingsTabLoggingOpenglLogLevelError": "Hata",
|
"SettingsTabLoggingGraphicsBackendLogLevelPerformance": "Yavaşlamalar",
|
||||||
"SettingsTabLoggingOpenglLogLevelPerformance": "Yavaşlamalar",
|
"SettingsTabLoggingGraphicsBackendLogLevelAll": "Her Şey",
|
||||||
"SettingsTabLoggingOpenglLogLevelAll": "Her Şey",
|
|
||||||
"SettingsTabLoggingEnableDebugLogs": "Hata Ayıklama Loglarını Etkinleştir",
|
"SettingsTabLoggingEnableDebugLogs": "Hata Ayıklama Loglarını Etkinleştir",
|
||||||
"SettingsTabInput": "Giriş Yöntemi",
|
"SettingsTabInput": "Giriş Yöntemi",
|
||||||
"SettingsTabInputEnableDockedMode": "Docked Modunu Etkinleştir",
|
"SettingsTabInputEnableDockedMode": "Docked Modunu Etkinleştir",
|
||||||
|
@@ -157,11 +157,10 @@
|
|||||||
"SettingsTabLoggingEnableFsAccessLogs": "记录文件访问",
|
"SettingsTabLoggingEnableFsAccessLogs": "记录文件访问",
|
||||||
"SettingsTabLoggingFsGlobalAccessLogMode": "记录全局文件访问模式:",
|
"SettingsTabLoggingFsGlobalAccessLogMode": "记录全局文件访问模式:",
|
||||||
"SettingsTabLoggingDeveloperOptions": "开发者选项 (警告: 会降低性能)",
|
"SettingsTabLoggingDeveloperOptions": "开发者选项 (警告: 会降低性能)",
|
||||||
"SettingsTabLoggingOpenglLogLevel": "OpenGL日志级别:",
|
"SettingsTabLoggingGraphicsBackendLogLevelNone": "无",
|
||||||
"SettingsTabLoggingOpenglLogLevelNone": "无",
|
"SettingsTabLoggingGraphicsBackendLogLevelError": "错误",
|
||||||
"SettingsTabLoggingOpenglLogLevelError": "错误",
|
"SettingsTabLoggingGraphicsBackendLogLevelPerformance": "减速",
|
||||||
"SettingsTabLoggingOpenglLogLevelPerformance": "减速",
|
"SettingsTabLoggingGraphicsBackendLogLevelAll": "全部",
|
||||||
"SettingsTabLoggingOpenglLogLevelAll": "全部",
|
|
||||||
"SettingsTabLoggingEnableDebugLogs": "启用调试日志",
|
"SettingsTabLoggingEnableDebugLogs": "启用调试日志",
|
||||||
"SettingsTabInput": "输入",
|
"SettingsTabInput": "输入",
|
||||||
"SettingsTabInputEnableDockedMode": "主机模式",
|
"SettingsTabInputEnableDockedMode": "主机模式",
|
||||||
|
@@ -157,11 +157,10 @@
|
|||||||
"SettingsTabLoggingEnableFsAccessLogs": "記錄檔案存取",
|
"SettingsTabLoggingEnableFsAccessLogs": "記錄檔案存取",
|
||||||
"SettingsTabLoggingFsGlobalAccessLogMode": "記錄全域檔案存取模式:",
|
"SettingsTabLoggingFsGlobalAccessLogMode": "記錄全域檔案存取模式:",
|
||||||
"SettingsTabLoggingDeveloperOptions": "開發者選項 (警告: 會降低效能)",
|
"SettingsTabLoggingDeveloperOptions": "開發者選項 (警告: 會降低效能)",
|
||||||
"SettingsTabLoggingOpenglLogLevel": "OpenGL 日誌級別:",
|
"SettingsTabLoggingGraphicsBackendLogLevelNone": "無",
|
||||||
"SettingsTabLoggingOpenglLogLevelNone": "無",
|
"SettingsTabLoggingGraphicsBackendLogLevelError": "錯誤",
|
||||||
"SettingsTabLoggingOpenglLogLevelError": "錯誤",
|
"SettingsTabLoggingGraphicsBackendLogLevelPerformance": "減速",
|
||||||
"SettingsTabLoggingOpenglLogLevelPerformance": "減速",
|
"SettingsTabLoggingGraphicsBackendLogLevelAll": "全部",
|
||||||
"SettingsTabLoggingOpenglLogLevelAll": "全部",
|
|
||||||
"SettingsTabLoggingEnableDebugLogs": "啟用除錯日誌",
|
"SettingsTabLoggingEnableDebugLogs": "啟用除錯日誌",
|
||||||
"SettingsTabInput": "輸入",
|
"SettingsTabInput": "輸入",
|
||||||
"SettingsTabInputEnableDockedMode": "Docked 模式",
|
"SettingsTabInputEnableDockedMode": "Docked 模式",
|
||||||
|
127
Ryujinx.Ava/Helper/MetalHelper.cs
Normal file
127
Ryujinx.Ava/Helper/MetalHelper.cs
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using Avalonia;
|
||||||
|
|
||||||
|
namespace Ryujinx.Ava.Ui.Helper
|
||||||
|
{
|
||||||
|
public delegate void UpdateBoundsCallbackDelegate(Rect rect);
|
||||||
|
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
static class MetalHelper
|
||||||
|
{
|
||||||
|
private const string LibObjCImport = "/usr/lib/libobjc.A.dylib";
|
||||||
|
|
||||||
|
private struct Selector
|
||||||
|
{
|
||||||
|
public readonly IntPtr NativePtr;
|
||||||
|
|
||||||
|
public unsafe Selector(string value)
|
||||||
|
{
|
||||||
|
int size = System.Text.Encoding.UTF8.GetMaxByteCount(value.Length);
|
||||||
|
byte* data = stackalloc byte[size];
|
||||||
|
|
||||||
|
fixed (char* pValue = value)
|
||||||
|
{
|
||||||
|
System.Text.Encoding.UTF8.GetBytes(pValue, value.Length, data, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
NativePtr = sel_registerName(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator Selector(string value) => new Selector(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static unsafe IntPtr GetClass(string value)
|
||||||
|
{
|
||||||
|
int size = System.Text.Encoding.UTF8.GetMaxByteCount(value.Length);
|
||||||
|
byte* data = stackalloc byte[size];
|
||||||
|
|
||||||
|
fixed (char* pValue = value)
|
||||||
|
{
|
||||||
|
System.Text.Encoding.UTF8.GetBytes(pValue, value.Length, data, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
return objc_getClass(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
private struct NSPoint
|
||||||
|
{
|
||||||
|
public double X;
|
||||||
|
public double Y;
|
||||||
|
|
||||||
|
public NSPoint(double x, double y)
|
||||||
|
{
|
||||||
|
X = x;
|
||||||
|
Y = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private struct NSRect
|
||||||
|
{
|
||||||
|
public NSPoint Pos;
|
||||||
|
public NSPoint Size;
|
||||||
|
|
||||||
|
public NSRect(double x, double y, double width, double height)
|
||||||
|
{
|
||||||
|
Pos = new NSPoint(x, y);
|
||||||
|
Size = new NSPoint(width, height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IntPtr GetMetalLayer(out IntPtr nsView, out UpdateBoundsCallbackDelegate updateBounds)
|
||||||
|
{
|
||||||
|
// Create a new CAMetalLayer.
|
||||||
|
IntPtr layerClass = GetClass("CAMetalLayer");
|
||||||
|
IntPtr metalLayer = IntPtr_objc_msgSend(layerClass, "alloc");
|
||||||
|
objc_msgSend(metalLayer, "init");
|
||||||
|
|
||||||
|
// Create a child NSView to render into.
|
||||||
|
IntPtr nsViewClass = GetClass("NSView");
|
||||||
|
IntPtr child = IntPtr_objc_msgSend(nsViewClass, "alloc");
|
||||||
|
objc_msgSend(child, "init", new NSRect(0, 0, 0, 0));
|
||||||
|
|
||||||
|
// Make its renderer our metal layer.
|
||||||
|
objc_msgSend(child, "setWantsLayer:", (byte)1);
|
||||||
|
objc_msgSend(child, "setLayer:", metalLayer);
|
||||||
|
objc_msgSend(metalLayer, "setContentsScale:", Program.DesktopScaleFactor);
|
||||||
|
|
||||||
|
// Ensure the scale factor is up to date.
|
||||||
|
updateBounds = (Rect rect) => {
|
||||||
|
objc_msgSend(metalLayer, "setContentsScale:", Program.DesktopScaleFactor);
|
||||||
|
};
|
||||||
|
|
||||||
|
nsView = child;
|
||||||
|
return metalLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DestroyMetalLayer(IntPtr nsView, IntPtr metalLayer)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport(LibObjCImport)]
|
||||||
|
private static unsafe extern IntPtr sel_registerName(byte* data);
|
||||||
|
|
||||||
|
[DllImport(LibObjCImport)]
|
||||||
|
private static unsafe extern IntPtr objc_getClass(byte* data);
|
||||||
|
|
||||||
|
[DllImport(LibObjCImport)]
|
||||||
|
private static extern void objc_msgSend(IntPtr receiver, Selector selector);
|
||||||
|
|
||||||
|
[DllImport(LibObjCImport)]
|
||||||
|
private static extern void objc_msgSend(IntPtr receiver, Selector selector, byte value);
|
||||||
|
|
||||||
|
[DllImport(LibObjCImport)]
|
||||||
|
private static extern void objc_msgSend(IntPtr receiver, Selector selector, IntPtr value);
|
||||||
|
|
||||||
|
[DllImport(LibObjCImport)]
|
||||||
|
private static extern void objc_msgSend(IntPtr receiver, Selector selector, NSRect point);
|
||||||
|
|
||||||
|
[DllImport(LibObjCImport)]
|
||||||
|
private static extern void objc_msgSend(IntPtr receiver, Selector selector, double value);
|
||||||
|
|
||||||
|
[DllImport(LibObjCImport, EntryPoint = "objc_msgSend")]
|
||||||
|
private static extern IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector);
|
||||||
|
}
|
||||||
|
}
|
@@ -4,7 +4,6 @@ using Ryujinx.Input;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
|
||||||
using ConfigKey = Ryujinx.Common.Configuration.Hid.Key;
|
using ConfigKey = Ryujinx.Common.Configuration.Hid.Key;
|
||||||
using Key = Ryujinx.Input.Key;
|
using Key = Ryujinx.Input.Key;
|
||||||
|
|
||||||
@@ -13,30 +12,37 @@ namespace Ryujinx.Ava.Input
|
|||||||
internal class AvaloniaKeyboard : IKeyboard
|
internal class AvaloniaKeyboard : IKeyboard
|
||||||
{
|
{
|
||||||
private readonly List<ButtonMappingEntry> _buttonsUserMapping;
|
private readonly List<ButtonMappingEntry> _buttonsUserMapping;
|
||||||
private readonly AvaloniaKeyboardDriver _driver;
|
private readonly AvaloniaKeyboardDriver _driver;
|
||||||
|
private StandardKeyboardInputConfig _configuration;
|
||||||
|
|
||||||
private readonly object _userMappingLock = new();
|
private readonly object _userMappingLock = new();
|
||||||
|
|
||||||
private StandardKeyboardInputConfig _configuration;
|
public string Id { get; }
|
||||||
|
|
||||||
private bool HasConfiguration => _configuration != null;
|
|
||||||
|
|
||||||
public string Id { get; }
|
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
|
|
||||||
public bool IsConnected => true;
|
public bool IsConnected => true;
|
||||||
|
public GamepadFeaturesFlag Features => GamepadFeaturesFlag.None;
|
||||||
|
|
||||||
public GamepadFeaturesFlag Features => GamepadFeaturesFlag.None;
|
private class ButtonMappingEntry
|
||||||
|
{
|
||||||
|
public readonly Key From;
|
||||||
|
public readonly GamepadButtonInputId To;
|
||||||
|
|
||||||
|
public ButtonMappingEntry(GamepadButtonInputId to, Key from)
|
||||||
|
{
|
||||||
|
To = to;
|
||||||
|
From = from;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public AvaloniaKeyboard(AvaloniaKeyboardDriver driver, string id, string name)
|
public AvaloniaKeyboard(AvaloniaKeyboardDriver driver, string id, string name)
|
||||||
{
|
{
|
||||||
_driver = driver;
|
|
||||||
Id = id;
|
|
||||||
Name = name;
|
|
||||||
_buttonsUserMapping = new List<ButtonMappingEntry>();
|
_buttonsUserMapping = new List<ButtonMappingEntry>();
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose() { }
|
_driver = driver;
|
||||||
|
Id = id;
|
||||||
|
Name = name;
|
||||||
|
}
|
||||||
|
|
||||||
public KeyboardStateSnapshot GetKeyboardStateSnapshot()
|
public KeyboardStateSnapshot GetKeyboardStateSnapshot()
|
||||||
{
|
{
|
||||||
@@ -46,11 +52,11 @@ namespace Ryujinx.Ava.Input
|
|||||||
public GamepadStateSnapshot GetMappedStateSnapshot()
|
public GamepadStateSnapshot GetMappedStateSnapshot()
|
||||||
{
|
{
|
||||||
KeyboardStateSnapshot rawState = GetKeyboardStateSnapshot();
|
KeyboardStateSnapshot rawState = GetKeyboardStateSnapshot();
|
||||||
GamepadStateSnapshot result = default;
|
GamepadStateSnapshot result = default;
|
||||||
|
|
||||||
lock (_userMappingLock)
|
lock (_userMappingLock)
|
||||||
{
|
{
|
||||||
if (!HasConfiguration)
|
if (_configuration == null)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -62,17 +68,17 @@ namespace Ryujinx.Ava.Input
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not touch state of the button already pressed
|
// NOTE: Do not touch state of the button already pressed.
|
||||||
if (!result.IsPressed(entry.To))
|
if (!result.IsPressed(entry.To))
|
||||||
{
|
{
|
||||||
result.SetPressed(entry.To, rawState.IsPressed(entry.From));
|
result.SetPressed(entry.To, rawState.IsPressed(entry.From));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(short leftStickX, short leftStickY) = GetStickValues(ref rawState, _configuration.LeftJoyconStick);
|
(short leftStickX, short leftStickY) = GetStickValues(ref rawState, _configuration.LeftJoyconStick);
|
||||||
(short rightStickX, short rightStickY) = GetStickValues(ref rawState, _configuration.RightJoyconStick);
|
(short rightStickX, short rightStickY) = GetStickValues(ref rawState, _configuration.RightJoyconStick);
|
||||||
|
|
||||||
result.SetStick(StickInputId.Left, ConvertRawStickValue(leftStickX), ConvertRawStickValue(leftStickY));
|
result.SetStick(StickInputId.Left, ConvertRawStickValue(leftStickX), ConvertRawStickValue(leftStickY));
|
||||||
result.SetStick(StickInputId.Right, ConvertRawStickValue(rightStickX), ConvertRawStickValue(rightStickY));
|
result.SetStick(StickInputId.Right, ConvertRawStickValue(rightStickX), ConvertRawStickValue(rightStickY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,29 +120,29 @@ namespace Ryujinx.Ava.Input
|
|||||||
|
|
||||||
_buttonsUserMapping.Clear();
|
_buttonsUserMapping.Clear();
|
||||||
|
|
||||||
// Left joycon
|
// Left JoyCon
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftStick, (Key)_configuration.LeftJoyconStick.StickButton));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftStick, (Key)_configuration.LeftJoyconStick.StickButton));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadUp, (Key)_configuration.LeftJoycon.DpadUp));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadUp, (Key)_configuration.LeftJoycon.DpadUp));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadDown, (Key)_configuration.LeftJoycon.DpadDown));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadDown, (Key)_configuration.LeftJoycon.DpadDown));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadLeft, (Key)_configuration.LeftJoycon.DpadLeft));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadLeft, (Key)_configuration.LeftJoycon.DpadLeft));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadRight, (Key)_configuration.LeftJoycon.DpadRight));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadRight, (Key)_configuration.LeftJoycon.DpadRight));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Minus, (Key)_configuration.LeftJoycon.ButtonMinus));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Minus, (Key)_configuration.LeftJoycon.ButtonMinus));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftShoulder, (Key)_configuration.LeftJoycon.ButtonL));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftShoulder, (Key)_configuration.LeftJoycon.ButtonL));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftTrigger, (Key)_configuration.LeftJoycon.ButtonZl));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftTrigger, (Key)_configuration.LeftJoycon.ButtonZl));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleRightTrigger0, (Key)_configuration.LeftJoycon.ButtonSr));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleRightTrigger0, (Key)_configuration.LeftJoycon.ButtonSr));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleLeftTrigger0, (Key)_configuration.LeftJoycon.ButtonSl));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleLeftTrigger0, (Key)_configuration.LeftJoycon.ButtonSl));
|
||||||
|
|
||||||
// Finally right joycon
|
// Right JoyCon
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightStick, (Key)_configuration.RightJoyconStick.StickButton));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightStick, (Key)_configuration.RightJoyconStick.StickButton));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.A, (Key)_configuration.RightJoycon.ButtonA));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.A, (Key)_configuration.RightJoycon.ButtonA));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.B, (Key)_configuration.RightJoycon.ButtonB));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.B, (Key)_configuration.RightJoycon.ButtonB));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.X, (Key)_configuration.RightJoycon.ButtonX));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.X, (Key)_configuration.RightJoycon.ButtonX));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Y, (Key)_configuration.RightJoycon.ButtonY));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Y, (Key)_configuration.RightJoycon.ButtonY));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Plus, (Key)_configuration.RightJoycon.ButtonPlus));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Plus, (Key)_configuration.RightJoycon.ButtonPlus));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightShoulder, (Key)_configuration.RightJoycon.ButtonR));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightShoulder, (Key)_configuration.RightJoycon.ButtonR));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightTrigger, (Key)_configuration.RightJoycon.ButtonZr));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightTrigger, (Key)_configuration.RightJoycon.ButtonZr));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleRightTrigger1, (Key)_configuration.RightJoycon.ButtonSr));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleRightTrigger1, (Key)_configuration.RightJoycon.ButtonSr));
|
||||||
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleLeftTrigger1, (Key)_configuration.RightJoycon.ButtonSl));
|
_buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleLeftTrigger1, (Key)_configuration.RightJoycon.ButtonSl));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,16 +196,6 @@ namespace Ryujinx.Ava.Input
|
|||||||
_driver?.ResetKeys();
|
_driver?.ResetKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ButtonMappingEntry
|
public void Dispose() { }
|
||||||
{
|
|
||||||
public readonly Key From;
|
|
||||||
public readonly GamepadButtonInputId To;
|
|
||||||
|
|
||||||
public ButtonMappingEntry(GamepadButtonInputId to, Key from)
|
|
||||||
{
|
|
||||||
To = to;
|
|
||||||
From = from;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -4,7 +4,6 @@ using Ryujinx.Ava.Common.Locale;
|
|||||||
using Ryujinx.Input;
|
using Ryujinx.Input;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using AvaKey = Avalonia.Input.Key;
|
using AvaKey = Avalonia.Input.Key;
|
||||||
using Key = Ryujinx.Input.Key;
|
using Key = Ryujinx.Input.Key;
|
||||||
|
|
||||||
@@ -13,24 +12,23 @@ namespace Ryujinx.Ava.Input
|
|||||||
internal class AvaloniaKeyboardDriver : IGamepadDriver
|
internal class AvaloniaKeyboardDriver : IGamepadDriver
|
||||||
{
|
{
|
||||||
private static readonly string[] _keyboardIdentifers = new string[1] { "0" };
|
private static readonly string[] _keyboardIdentifers = new string[1] { "0" };
|
||||||
private readonly Control _control;
|
private readonly Control _control;
|
||||||
private readonly HashSet<AvaKey> _pressedKeys;
|
private readonly HashSet<AvaKey> _pressedKeys;
|
||||||
|
|
||||||
public event EventHandler<KeyEventArgs> KeyPressed;
|
public event EventHandler<KeyEventArgs> KeyPressed;
|
||||||
public event EventHandler<KeyEventArgs> KeyRelease;
|
public event EventHandler<KeyEventArgs> KeyRelease;
|
||||||
public event EventHandler<string> TextInput;
|
public event EventHandler<string> TextInput;
|
||||||
|
|
||||||
public string DriverName => "Avalonia";
|
|
||||||
|
|
||||||
|
public string DriverName => "AvaloniaKeyboardDriver";
|
||||||
public ReadOnlySpan<string> GamepadsIds => _keyboardIdentifers;
|
public ReadOnlySpan<string> GamepadsIds => _keyboardIdentifers;
|
||||||
|
|
||||||
public AvaloniaKeyboardDriver(Control control)
|
public AvaloniaKeyboardDriver(Control control)
|
||||||
{
|
{
|
||||||
_control = control;
|
_control = control;
|
||||||
_pressedKeys = new HashSet<AvaKey>();
|
_pressedKeys = new HashSet<AvaKey>();
|
||||||
|
|
||||||
_control.KeyDown += OnKeyPress;
|
_control.KeyDown += OnKeyPress;
|
||||||
_control.KeyUp += OnKeyRelease;
|
_control.KeyUp += OnKeyRelease;
|
||||||
_control.TextInput += Control_TextInput;
|
_control.TextInput += Control_TextInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,21 +39,16 @@ namespace Ryujinx.Ava.Input
|
|||||||
|
|
||||||
public event Action<string> OnGamepadConnected
|
public event Action<string> OnGamepadConnected
|
||||||
{
|
{
|
||||||
add { }
|
add { }
|
||||||
remove { }
|
remove { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public event Action<string> OnGamepadDisconnected
|
public event Action<string> OnGamepadDisconnected
|
||||||
{
|
{
|
||||||
add { }
|
add { }
|
||||||
remove { }
|
remove { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Dispose(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IGamepad GetGamepad(string id)
|
public IGamepad GetGamepad(string id)
|
||||||
{
|
{
|
||||||
if (!_keyboardIdentifers[0].Equals(id))
|
if (!_keyboardIdentifers[0].Equals(id))
|
||||||
@@ -70,15 +63,13 @@ namespace Ryujinx.Ava.Input
|
|||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
_control.KeyUp -= OnKeyPress;
|
_control.KeyUp -= OnKeyPress;
|
||||||
_control.KeyDown -= OnKeyRelease;
|
_control.KeyDown -= OnKeyRelease;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void OnKeyPress(object sender, KeyEventArgs args)
|
protected void OnKeyPress(object sender, KeyEventArgs args)
|
||||||
{
|
{
|
||||||
AvaKey key = args.Key;
|
|
||||||
|
|
||||||
_pressedKeys.Add(args.Key);
|
_pressedKeys.Add(args.Key);
|
||||||
|
|
||||||
KeyPressed?.Invoke(this, args);
|
KeyPressed?.Invoke(this, args);
|
||||||
@@ -98,7 +89,7 @@ namespace Ryujinx.Ava.Input
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AvaloniaMappingHelper.TryGetAvaKey(key, out var nativeKey);
|
AvaloniaKeyboardMappingHelper.TryGetAvaKey(key, out var nativeKey);
|
||||||
|
|
||||||
return _pressedKeys.Contains(nativeKey);
|
return _pressedKeys.Contains(nativeKey);
|
||||||
}
|
}
|
||||||
@@ -107,5 +98,10 @@ namespace Ryujinx.Ava.Input
|
|||||||
{
|
{
|
||||||
_pressedKeys.Clear();
|
_pressedKeys.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Dispose(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -5,7 +5,7 @@ using AvaKey = Avalonia.Input.Key;
|
|||||||
|
|
||||||
namespace Ryujinx.Ava.Input
|
namespace Ryujinx.Ava.Input
|
||||||
{
|
{
|
||||||
internal static class AvaloniaMappingHelper
|
internal static class AvaloniaKeyboardMappingHelper
|
||||||
{
|
{
|
||||||
private static readonly AvaKey[] _keyMapping = new AvaKey[(int)Key.Count]
|
private static readonly AvaKey[] _keyMapping = new AvaKey[(int)Key.Count]
|
||||||
{
|
{
|
||||||
@@ -149,11 +149,11 @@ namespace Ryujinx.Ava.Input
|
|||||||
|
|
||||||
private static readonly Dictionary<AvaKey, Key> _avaKeyMapping;
|
private static readonly Dictionary<AvaKey, Key> _avaKeyMapping;
|
||||||
|
|
||||||
static AvaloniaMappingHelper()
|
static AvaloniaKeyboardMappingHelper()
|
||||||
{
|
{
|
||||||
var inputKeys = Enum.GetValues(typeof(Key));
|
var inputKeys = Enum.GetValues(typeof(Key));
|
||||||
|
|
||||||
// Avalonia.Input.Key is not contiguous and quite large, so use a dictionary instead of an array.
|
// NOTE: Avalonia.Input.Key is not contiguous and quite large, so use a dictionary instead of an array.
|
||||||
_avaKeyMapping = new Dictionary<AvaKey, Key>();
|
_avaKeyMapping = new Dictionary<AvaKey, Key>();
|
||||||
|
|
||||||
foreach (var key in inputKeys)
|
foreach (var key in inputKeys)
|
||||||
@@ -167,15 +167,13 @@ namespace Ryujinx.Ava.Input
|
|||||||
|
|
||||||
public static bool TryGetAvaKey(Key key, out AvaKey avaKey)
|
public static bool TryGetAvaKey(Key key, out AvaKey avaKey)
|
||||||
{
|
{
|
||||||
var keyExist = (int)key < _keyMapping.Length;
|
avaKey = AvaKey.None;
|
||||||
|
|
||||||
|
bool keyExist = (int)key < _keyMapping.Length;
|
||||||
if (keyExist)
|
if (keyExist)
|
||||||
{
|
{
|
||||||
avaKey = _keyMapping[(int)key];
|
avaKey = _keyMapping[(int)key];
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
avaKey = AvaKey.None;
|
|
||||||
}
|
|
||||||
|
|
||||||
return keyExist;
|
return keyExist;
|
||||||
}
|
}
|
@@ -10,15 +10,12 @@ namespace Ryujinx.Ava.Input
|
|||||||
{
|
{
|
||||||
private AvaloniaMouseDriver _driver;
|
private AvaloniaMouseDriver _driver;
|
||||||
|
|
||||||
public GamepadFeaturesFlag Features => throw new NotImplementedException();
|
public string Id => "0";
|
||||||
|
|
||||||
public string Id => "0";
|
|
||||||
|
|
||||||
public string Name => "AvaloniaMouse";
|
public string Name => "AvaloniaMouse";
|
||||||
|
|
||||||
public bool IsConnected => true;
|
public bool IsConnected => true;
|
||||||
|
public GamepadFeaturesFlag Features => throw new NotImplementedException();
|
||||||
public bool[] Buttons => _driver.PressedButtons;
|
public bool[] Buttons => _driver.PressedButtons;
|
||||||
|
|
||||||
public AvaloniaMouse(AvaloniaMouseDriver driver)
|
public AvaloniaMouse(AvaloniaMouseDriver driver)
|
||||||
{
|
{
|
||||||
|
@@ -11,35 +11,50 @@ namespace Ryujinx.Ava.Input
|
|||||||
{
|
{
|
||||||
internal class AvaloniaMouseDriver : IGamepadDriver
|
internal class AvaloniaMouseDriver : IGamepadDriver
|
||||||
{
|
{
|
||||||
private Control _widget;
|
private Control _widget;
|
||||||
private bool _isDisposed;
|
private bool _isDisposed;
|
||||||
private Size _size;
|
private Size _size;
|
||||||
private readonly Window _window;
|
private readonly Window _window;
|
||||||
|
|
||||||
public bool[] PressedButtons { get; }
|
public bool[] PressedButtons { get; }
|
||||||
|
|
||||||
public Vector2 CurrentPosition { get; private set; }
|
public Vector2 CurrentPosition { get; private set; }
|
||||||
public Vector2 Scroll { get; private set; }
|
public Vector2 Scroll { get; private set; }
|
||||||
|
|
||||||
|
public string DriverName => "AvaloniaMouseDriver";
|
||||||
|
public ReadOnlySpan<string> GamepadsIds => new[] { "0" };
|
||||||
|
|
||||||
public AvaloniaMouseDriver(Window window, Control parent)
|
public AvaloniaMouseDriver(Window window, Control parent)
|
||||||
{
|
{
|
||||||
_widget = parent;
|
_widget = parent;
|
||||||
_window = window;
|
_window = window;
|
||||||
|
|
||||||
_widget.PointerMoved += Parent_PointerMovedEvent;
|
_widget.PointerMoved += Parent_PointerMovedEvent;
|
||||||
_widget.PointerPressed += Parent_PointerPressEvent;
|
_widget.PointerPressed += Parent_PointerPressEvent;
|
||||||
_widget.PointerReleased += Parent_PointerReleaseEvent;
|
_widget.PointerReleased += Parent_PointerReleaseEvent;
|
||||||
_widget.PointerWheelChanged += Parent_ScrollEvent;
|
_widget.PointerWheelChanged += Parent_ScrollEvent;
|
||||||
|
|
||||||
_window.PointerMoved += Parent_PointerMovedEvent;
|
_window.PointerMoved += Parent_PointerMovedEvent;
|
||||||
_window.PointerPressed += Parent_PointerPressEvent;
|
_window.PointerPressed += Parent_PointerPressEvent;
|
||||||
_window.PointerReleased += Parent_PointerReleaseEvent;
|
_window.PointerReleased += Parent_PointerReleaseEvent;
|
||||||
_window.PointerWheelChanged += Parent_ScrollEvent;
|
_window.PointerWheelChanged += Parent_ScrollEvent;
|
||||||
|
|
||||||
PressedButtons = new bool[(int)MouseButton.Count];
|
PressedButtons = new bool[(int)MouseButton.Count];
|
||||||
|
|
||||||
_size = new Size((int)parent.Bounds.Width, (int)parent.Bounds.Height);
|
_size = new Size((int)parent.Bounds.Width, (int)parent.Bounds.Height);
|
||||||
parent.GetObservable(Control.BoundsProperty).Subscribe(Resized);
|
|
||||||
|
parent.GetObservable(Visual.BoundsProperty).Subscribe(Resized);
|
||||||
|
}
|
||||||
|
|
||||||
|
public event Action<string> OnGamepadConnected
|
||||||
|
{
|
||||||
|
add { }
|
||||||
|
remove { }
|
||||||
|
}
|
||||||
|
|
||||||
|
public event Action<string> OnGamepadDisconnected
|
||||||
|
{
|
||||||
|
add { }
|
||||||
|
remove { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Resized(Rect rect)
|
private void Resized(Rect rect)
|
||||||
@@ -59,14 +74,12 @@ namespace Ryujinx.Ava.Input
|
|||||||
|
|
||||||
private void Parent_PointerPressEvent(object o, PointerPressedEventArgs args)
|
private void Parent_PointerPressEvent(object o, PointerPressedEventArgs args)
|
||||||
{
|
{
|
||||||
var pointerProperties = args.GetCurrentPoint(_widget).Properties;
|
PressedButtons[(int)args.GetCurrentPoint(_widget).Properties.PointerUpdateKind] = true;
|
||||||
|
|
||||||
PressedButtons[(int)pointerProperties.PointerUpdateKind] = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Parent_PointerMovedEvent(object o, PointerEventArgs args)
|
private void Parent_PointerMovedEvent(object o, PointerEventArgs args)
|
||||||
{
|
{
|
||||||
var position = args.GetPosition(_widget);
|
Point position = args.GetPosition(_widget);
|
||||||
|
|
||||||
CurrentPosition = new Vector2((float)position.X, (float)position.Y);
|
CurrentPosition = new Vector2((float)position.X, (float)position.Y);
|
||||||
}
|
}
|
||||||
@@ -96,22 +109,6 @@ namespace Ryujinx.Ava.Input
|
|||||||
return _size;
|
return _size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string DriverName => "Avalonia";
|
|
||||||
|
|
||||||
public event Action<string> OnGamepadConnected
|
|
||||||
{
|
|
||||||
add { }
|
|
||||||
remove { }
|
|
||||||
}
|
|
||||||
|
|
||||||
public event Action<string> OnGamepadDisconnected
|
|
||||||
{
|
|
||||||
add { }
|
|
||||||
remove { }
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReadOnlySpan<string> GamepadsIds => new[] { "0" };
|
|
||||||
|
|
||||||
public IGamepad GetGamepad(string id)
|
public IGamepad GetGamepad(string id)
|
||||||
{
|
{
|
||||||
return new AvaloniaMouse(this);
|
return new AvaloniaMouse(this);
|
||||||
@@ -126,14 +123,14 @@ namespace Ryujinx.Ava.Input
|
|||||||
|
|
||||||
_isDisposed = true;
|
_isDisposed = true;
|
||||||
|
|
||||||
_widget.PointerMoved -= Parent_PointerMovedEvent;
|
_widget.PointerMoved -= Parent_PointerMovedEvent;
|
||||||
_widget.PointerPressed -= Parent_PointerPressEvent;
|
_widget.PointerPressed -= Parent_PointerPressEvent;
|
||||||
_widget.PointerReleased -= Parent_PointerReleaseEvent;
|
_widget.PointerReleased -= Parent_PointerReleaseEvent;
|
||||||
_widget.PointerWheelChanged -= Parent_ScrollEvent;
|
_widget.PointerWheelChanged -= Parent_ScrollEvent;
|
||||||
|
|
||||||
_window.PointerMoved -= Parent_PointerMovedEvent;
|
_window.PointerMoved -= Parent_PointerMovedEvent;
|
||||||
_window.PointerPressed -= Parent_PointerPressEvent;
|
_window.PointerPressed -= Parent_PointerPressEvent;
|
||||||
_window.PointerReleased -= Parent_PointerReleaseEvent;
|
_window.PointerReleased -= Parent_PointerReleaseEvent;
|
||||||
_window.PointerWheelChanged -= Parent_ScrollEvent;
|
_window.PointerWheelChanged -= Parent_ScrollEvent;
|
||||||
|
|
||||||
_widget = null;
|
_widget = null;
|
||||||
|
@@ -22,10 +22,11 @@ namespace Ryujinx.Ava
|
|||||||
{
|
{
|
||||||
internal class Program
|
internal class Program
|
||||||
{
|
{
|
||||||
public static double WindowScaleFactor { get; set; }
|
public static double WindowScaleFactor { get; set; }
|
||||||
public static string Version { get; private set; }
|
public static double DesktopScaleFactor { get; set; } = 1.0;
|
||||||
public static string ConfigurationPath { get; private set; }
|
public static string Version { get; private set; }
|
||||||
public static bool PreviewerDetached { get; private set; }
|
public static string ConfigurationPath { get; private set; }
|
||||||
|
public static bool PreviewerDetached { get; private set; }
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern int MessageBoxA(IntPtr hWnd, string text, string caption, uint type);
|
public static extern int MessageBoxA(IntPtr hWnd, string text, string caption, uint type);
|
||||||
|
@@ -28,11 +28,13 @@
|
|||||||
<PackageReference Include="jp2masa.Avalonia.Flexbox" Version="0.2.0" />
|
<PackageReference Include="jp2masa.Avalonia.Flexbox" Version="0.2.0" />
|
||||||
<PackageReference Include="DynamicData" Version="7.12.8" />
|
<PackageReference Include="DynamicData" Version="7.12.8" />
|
||||||
<PackageReference Include="FluentAvaloniaUI" Version="1.4.5" />
|
<PackageReference Include="FluentAvaloniaUI" Version="1.4.5" />
|
||||||
<PackageReference Include="XamlNameReferenceGenerator" Version="1.4.2" />
|
<PackageReference Include="XamlNameReferenceGenerator" Version="1.5.1" />
|
||||||
|
|
||||||
<PackageReference Include="OpenTK.Core" Version="4.7.5" />
|
<PackageReference Include="OpenTK.Core" Version="4.7.5" />
|
||||||
<PackageReference Include="Ryujinx.Audio.OpenAL.Dependencies" Version="1.21.0.1" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64'" />
|
<PackageReference Include="Ryujinx.Audio.OpenAL.Dependencies" Version="1.21.0.1" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64' AND '$(RuntimeIdentifier)' != 'osx-arm64'" />
|
||||||
<PackageReference Include="Ryujinx.Graphics.Nvdec.Dependencies" Version="5.0.1-build10" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64'" />
|
<PackageReference Include="Ryujinx.Graphics.Nvdec.Dependencies" Version="5.0.1-build10" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64' AND '$(RuntimeIdentifier)' != 'osx-arm64'" />
|
||||||
|
<PackageReference Include="Ryujinx.Graphics.Nvdec.Dependencies.osx" Version="5.0.1" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'win10-x64'" />
|
||||||
|
<PackageReference Include="Ryujinx.Graphics.Vulkan.Dependencies.MoltenVK" Version="1.2.0" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'win10-x64'" />
|
||||||
<PackageReference Include="Silk.NET.Vulkan" Version="2.16.0" />
|
<PackageReference Include="Silk.NET.Vulkan" Version="2.16.0" />
|
||||||
<PackageReference Include="Silk.NET.Vulkan.Extensions.EXT" Version="2.16.0" />
|
<PackageReference Include="Silk.NET.Vulkan.Extensions.EXT" Version="2.16.0" />
|
||||||
<PackageReference Include="Silk.NET.Vulkan.Extensions.KHR" Version="2.16.0" />
|
<PackageReference Include="Silk.NET.Vulkan.Extensions.KHR" Version="2.16.0" />
|
||||||
@@ -57,14 +59,18 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ContentWithTargetPath Include="..\distribution\windows\alsoft.ini" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64'">
|
<Content Include="..\distribution\windows\alsoft.ini" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64'">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<TargetPath>alsoft.ini</TargetPath>
|
<TargetPath>alsoft.ini</TargetPath>
|
||||||
</ContentWithTargetPath>
|
</Content>
|
||||||
<ContentWithTargetPath Include="..\distribution\legal\THIRDPARTY.md">
|
<Content Include="..\distribution\legal\THIRDPARTY.md">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<TargetPath>THIRDPARTY.md</TargetPath>
|
<TargetPath>THIRDPARTY.md</TargetPath>
|
||||||
</ContentWithTargetPath>
|
</Content>
|
||||||
|
<Content Include="..\LICENSE.txt">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
<TargetPath>LICENSE.txt</TargetPath>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@@ -68,7 +68,7 @@ namespace Ryujinx.Ava.Ui.Applet
|
|||||||
|
|
||||||
private void AvaloniaDynamicTextInputHandler_KeyRelease(object sender, Avalonia.Input.KeyEventArgs e)
|
private void AvaloniaDynamicTextInputHandler_KeyRelease(object sender, Avalonia.Input.KeyEventArgs e)
|
||||||
{
|
{
|
||||||
var key = (HidKey)AvaloniaMappingHelper.ToInputKey(e.Key);
|
var key = (HidKey)AvaloniaKeyboardMappingHelper.ToInputKey(e.Key);
|
||||||
|
|
||||||
if (!(KeyReleasedEvent?.Invoke(key)).GetValueOrDefault(true))
|
if (!(KeyReleasedEvent?.Invoke(key)).GetValueOrDefault(true))
|
||||||
{
|
{
|
||||||
@@ -88,7 +88,7 @@ namespace Ryujinx.Ava.Ui.Applet
|
|||||||
|
|
||||||
private void AvaloniaDynamicTextInputHandler_KeyPressed(object sender, KeyEventArgs e)
|
private void AvaloniaDynamicTextInputHandler_KeyPressed(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
var key = (HidKey)AvaloniaMappingHelper.ToInputKey(e.Key);
|
var key = (HidKey)AvaloniaKeyboardMappingHelper.ToInputKey(e.Key);
|
||||||
|
|
||||||
if (!(KeyPressedEvent?.Invoke(key)).GetValueOrDefault(true))
|
if (!(KeyPressedEvent?.Invoke(key)).GetValueOrDefault(true))
|
||||||
{
|
{
|
||||||
|
@@ -2,11 +2,10 @@ using Avalonia;
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Platform;
|
using Avalonia.Platform;
|
||||||
|
using Ryujinx.Ava.Ui.Helper;
|
||||||
using SPB.Graphics;
|
using SPB.Graphics;
|
||||||
using SPB.Platform;
|
using SPB.Platform;
|
||||||
using SPB.Platform.GLX;
|
using SPB.Platform.GLX;
|
||||||
using SPB.Platform.X11;
|
|
||||||
using SPB.Windowing;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Runtime.Versioning;
|
using System.Runtime.Versioning;
|
||||||
@@ -23,6 +22,10 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
protected GLXWindow X11Window { get; set; }
|
protected GLXWindow X11Window { get; set; }
|
||||||
protected IntPtr WindowHandle { get; set; }
|
protected IntPtr WindowHandle { get; set; }
|
||||||
protected IntPtr X11Display { get; set; }
|
protected IntPtr X11Display { get; set; }
|
||||||
|
protected IntPtr NsView { get; set; }
|
||||||
|
protected IntPtr MetalLayer { get; set; }
|
||||||
|
|
||||||
|
private UpdateBoundsCallbackDelegate _updateBoundsCallback;
|
||||||
|
|
||||||
public event EventHandler<IntPtr> WindowCreated;
|
public event EventHandler<IntPtr> WindowCreated;
|
||||||
public event EventHandler<Size> SizeChanged;
|
public event EventHandler<Size> SizeChanged;
|
||||||
@@ -58,6 +61,7 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
private void StateChanged(Rect rect)
|
private void StateChanged(Rect rect)
|
||||||
{
|
{
|
||||||
SizeChanged?.Invoke(this, rect.Size);
|
SizeChanged?.Invoke(this, rect.Size);
|
||||||
|
_updateBoundsCallback?.Invoke(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IPlatformHandle CreateNativeControlCore(IPlatformHandle parent)
|
protected override IPlatformHandle CreateNativeControlCore(IPlatformHandle parent)
|
||||||
@@ -70,6 +74,11 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
{
|
{
|
||||||
return CreateWin32(parent);
|
return CreateWin32(parent);
|
||||||
}
|
}
|
||||||
|
else if (OperatingSystem.IsMacOS())
|
||||||
|
{
|
||||||
|
return CreateMacOs(parent);
|
||||||
|
}
|
||||||
|
|
||||||
return base.CreateNativeControlCore(parent);
|
return base.CreateNativeControlCore(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,6 +94,10 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
{
|
{
|
||||||
DestroyWin32(control);
|
DestroyWin32(control);
|
||||||
}
|
}
|
||||||
|
else if (OperatingSystem.IsMacOS())
|
||||||
|
{
|
||||||
|
DestroyMacOS();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
base.DestroyNativeControlCore(control);
|
base.DestroyNativeControlCore(control);
|
||||||
@@ -187,6 +200,16 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
return DefWindowProc(hWnd, msg, (IntPtr)wParam, (IntPtr)lParam);
|
return DefWindowProc(hWnd, msg, (IntPtr)wParam, (IntPtr)lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
IPlatformHandle CreateMacOs(IPlatformHandle parent)
|
||||||
|
{
|
||||||
|
MetalLayer = MetalHelper.GetMetalLayer(out IntPtr nsView, out _updateBoundsCallback);
|
||||||
|
|
||||||
|
NsView = nsView;
|
||||||
|
|
||||||
|
return new PlatformHandle(nsView, "NSView");
|
||||||
|
}
|
||||||
|
|
||||||
void DestroyLinux()
|
void DestroyLinux()
|
||||||
{
|
{
|
||||||
X11Window?.Dispose();
|
X11Window?.Dispose();
|
||||||
@@ -198,5 +221,11 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
DestroyWindow(handle.Handle);
|
DestroyWindow(handle.Handle);
|
||||||
UnregisterClass(_className, GetModuleHandle(null));
|
UnregisterClass(_className, GetModuleHandle(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
void DestroyMacOS()
|
||||||
|
{
|
||||||
|
MetalHelper.DestroyMetalLayer(NsView, MetalLayer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -3,6 +3,7 @@ using Ryujinx.Ava.Ui.Controls;
|
|||||||
using Silk.NET.Vulkan;
|
using Silk.NET.Vulkan;
|
||||||
using SPB.Graphics.Vulkan;
|
using SPB.Graphics.Vulkan;
|
||||||
using SPB.Platform.GLX;
|
using SPB.Platform.GLX;
|
||||||
|
using SPB.Platform.Metal;
|
||||||
using SPB.Platform.Win32;
|
using SPB.Platform.Win32;
|
||||||
using SPB.Platform.X11;
|
using SPB.Platform.X11;
|
||||||
using SPB.Windowing;
|
using SPB.Windowing;
|
||||||
@@ -37,6 +38,10 @@ namespace Ryujinx.Ava.Ui
|
|||||||
{
|
{
|
||||||
_window = new SimpleX11Window(new NativeHandle(X11Display), new NativeHandle(WindowHandle));
|
_window = new SimpleX11Window(new NativeHandle(X11Display), new NativeHandle(WindowHandle));
|
||||||
}
|
}
|
||||||
|
else if (OperatingSystem.IsMacOS())
|
||||||
|
{
|
||||||
|
_window = new SimpleMetalWindow(new NativeHandle(NsView), new NativeHandle(MetalLayer));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new PlatformNotSupportedException();
|
throw new PlatformNotSupportedException();
|
||||||
|
@@ -1,45 +0,0 @@
|
|||||||
using Ryujinx.Ui.App.Common;
|
|
||||||
using System.Collections;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Ui.Models
|
|
||||||
{
|
|
||||||
internal class FileSizeSortComparer : IComparer
|
|
||||||
{
|
|
||||||
public int Compare(object x, object y)
|
|
||||||
{
|
|
||||||
string aValue = (x as ApplicationData).TimePlayed;
|
|
||||||
string bValue = (y as ApplicationData).TimePlayed;
|
|
||||||
|
|
||||||
if (aValue[^3..] == "GiB")
|
|
||||||
{
|
|
||||||
aValue = (float.Parse(aValue[0..^3]) * 1024).ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
aValue = aValue[0..^3];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bValue[^3..] == "GiB")
|
|
||||||
{
|
|
||||||
bValue = (float.Parse(bValue[0..^3]) * 1024).ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bValue = bValue[0..^3];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (float.Parse(aValue) > float.Parse(bValue))
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else if (float.Parse(bValue) > float.Parse(aValue))
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,50 +0,0 @@
|
|||||||
using Ryujinx.Ui.App.Common;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Ui.Models.Generic
|
|
||||||
{
|
|
||||||
internal class FileSizeSortComparer : IComparer<ApplicationData>
|
|
||||||
{
|
|
||||||
public FileSizeSortComparer() { }
|
|
||||||
public FileSizeSortComparer(bool isAscending) { _order = isAscending ? 1 : -1; }
|
|
||||||
|
|
||||||
private int _order;
|
|
||||||
|
|
||||||
public int Compare(ApplicationData x, ApplicationData y)
|
|
||||||
{
|
|
||||||
string aValue = x.FileSize;
|
|
||||||
string bValue = y.FileSize;
|
|
||||||
|
|
||||||
if (aValue[^3..] == "GiB")
|
|
||||||
{
|
|
||||||
aValue = (float.Parse(aValue[0..^3]) * 1024).ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
aValue = aValue[0..^3];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bValue[^3..] == "GiB")
|
|
||||||
{
|
|
||||||
bValue = (float.Parse(bValue[0..^3]) * 1024).ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bValue = bValue[0..^3];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (float.Parse(aValue) > float.Parse(bValue))
|
|
||||||
{
|
|
||||||
return -1 * _order;
|
|
||||||
}
|
|
||||||
else if (float.Parse(bValue) > float.Parse(aValue))
|
|
||||||
{
|
|
||||||
return 1 * _order;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,66 +0,0 @@
|
|||||||
using Ryujinx.Ui.App.Common;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Ui.Models.Generic
|
|
||||||
{
|
|
||||||
internal class TimePlayedSortComparer : IComparer<ApplicationData>
|
|
||||||
{
|
|
||||||
public TimePlayedSortComparer() { }
|
|
||||||
public TimePlayedSortComparer(bool isAscending) { _order = isAscending ? 1 : -1; }
|
|
||||||
|
|
||||||
private int _order;
|
|
||||||
|
|
||||||
public int Compare(ApplicationData x, ApplicationData y)
|
|
||||||
{
|
|
||||||
string aValue = x.TimePlayed;
|
|
||||||
string bValue = y.TimePlayed;
|
|
||||||
|
|
||||||
if (aValue.Length > 4 && aValue[^4..] == "mins")
|
|
||||||
{
|
|
||||||
aValue = (float.Parse(aValue[0..^5]) * 60).ToString();
|
|
||||||
}
|
|
||||||
else if (aValue.Length > 3 && aValue[^3..] == "hrs")
|
|
||||||
{
|
|
||||||
aValue = (float.Parse(aValue[0..^4]) * 3600).ToString();
|
|
||||||
}
|
|
||||||
else if (aValue.Length > 4 && aValue[^4..] == "days")
|
|
||||||
{
|
|
||||||
aValue = (float.Parse(aValue[0..^5]) * 86400).ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
aValue = aValue[0..^1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bValue.Length > 4 && bValue[^4..] == "mins")
|
|
||||||
{
|
|
||||||
bValue = (float.Parse(bValue[0..^5]) * 60).ToString();
|
|
||||||
}
|
|
||||||
else if (bValue.Length > 3 && bValue[^3..] == "hrs")
|
|
||||||
{
|
|
||||||
bValue = (float.Parse(bValue[0..^4]) * 3600).ToString();
|
|
||||||
}
|
|
||||||
else if (bValue.Length > 4 && bValue[^4..] == "days")
|
|
||||||
{
|
|
||||||
bValue = (float.Parse(bValue[0..^5]) * 86400).ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bValue = bValue[0..^1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (float.Parse(aValue) > float.Parse(bValue))
|
|
||||||
{
|
|
||||||
return -1 * _order;
|
|
||||||
}
|
|
||||||
else if (float.Parse(bValue) > float.Parse(aValue))
|
|
||||||
{
|
|
||||||
return 1 * _order;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,27 +0,0 @@
|
|||||||
using Ryujinx.Ui.App.Common;
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Ui.Models
|
|
||||||
{
|
|
||||||
internal class LastPlayedSortComparer : IComparer
|
|
||||||
{
|
|
||||||
public int Compare(object x, object y)
|
|
||||||
{
|
|
||||||
string aValue = (x as ApplicationData).LastPlayed;
|
|
||||||
string bValue = (y as ApplicationData).LastPlayed;
|
|
||||||
|
|
||||||
if (aValue == "Never")
|
|
||||||
{
|
|
||||||
aValue = DateTime.UnixEpoch.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bValue == "Never")
|
|
||||||
{
|
|
||||||
bValue = DateTime.UnixEpoch.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
return DateTime.Compare(DateTime.Parse(bValue), DateTime.Parse(aValue));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,61 +0,0 @@
|
|||||||
using Ryujinx.Ui.App.Common;
|
|
||||||
using System.Collections;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Ui.Models
|
|
||||||
{
|
|
||||||
internal class TimePlayedSortComparer : IComparer
|
|
||||||
{
|
|
||||||
public int Compare(object x, object y)
|
|
||||||
{
|
|
||||||
string aValue = (x as ApplicationData).TimePlayed;
|
|
||||||
string bValue = (y as ApplicationData).TimePlayed;
|
|
||||||
|
|
||||||
if (aValue.Length > 4 && aValue[^4..] == "mins")
|
|
||||||
{
|
|
||||||
aValue = (float.Parse(aValue[0..^5]) * 60).ToString();
|
|
||||||
}
|
|
||||||
else if (aValue.Length > 3 && aValue[^3..] == "hrs")
|
|
||||||
{
|
|
||||||
aValue = (float.Parse(aValue[0..^4]) * 3600).ToString();
|
|
||||||
}
|
|
||||||
else if (aValue.Length > 4 && aValue[^4..] == "days")
|
|
||||||
{
|
|
||||||
aValue = (float.Parse(aValue[0..^5]) * 86400).ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
aValue = aValue[0..^1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bValue.Length > 4 && bValue[^4..] == "mins")
|
|
||||||
{
|
|
||||||
bValue = (float.Parse(bValue[0..^5]) * 60).ToString();
|
|
||||||
}
|
|
||||||
else if (bValue.Length > 3 && bValue[^3..] == "hrs")
|
|
||||||
{
|
|
||||||
bValue = (float.Parse(bValue[0..^4]) * 3600).ToString();
|
|
||||||
}
|
|
||||||
else if (bValue.Length > 4 && bValue[^4..] == "days")
|
|
||||||
{
|
|
||||||
bValue = (float.Parse(bValue[0..^5]) * 86400).ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bValue = bValue[0..^1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (float.Parse(aValue) > float.Parse(bValue))
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else if (float.Parse(bValue) > float.Parse(aValue))
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -502,8 +502,10 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||||||
return SortMode switch
|
return SortMode switch
|
||||||
{
|
{
|
||||||
ApplicationSort.LastPlayed => new Models.Generic.LastPlayedSortComparer(IsAscending),
|
ApplicationSort.LastPlayed => new Models.Generic.LastPlayedSortComparer(IsAscending),
|
||||||
ApplicationSort.FileSize => new Models.Generic.FileSizeSortComparer(IsAscending),
|
ApplicationSort.FileSize => IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.FileSizeBytes)
|
||||||
ApplicationSort.TotalTimePlayed => new Models.Generic.TimePlayedSortComparer(IsAscending),
|
: SortExpressionComparer<ApplicationData>.Descending(app => app.FileSizeBytes),
|
||||||
|
ApplicationSort.TotalTimePlayed => IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.TimePlayedNum)
|
||||||
|
: SortExpressionComparer<ApplicationData>.Descending(app => app.TimePlayedNum),
|
||||||
ApplicationSort.Title => IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.TitleName)
|
ApplicationSort.Title => IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.TitleName)
|
||||||
: SortExpressionComparer<ApplicationData>.Descending(app => app.TitleName),
|
: SortExpressionComparer<ApplicationData>.Descending(app => app.TitleName),
|
||||||
ApplicationSort.Favorite => !IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.Favorite)
|
ApplicationSort.Favorite => !IsAscending ? SortExpressionComparer<ApplicationData>.Ascending(app => app.Favorite)
|
||||||
@@ -881,17 +883,17 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||||||
|
|
||||||
public void LoadConfigurableHotKeys()
|
public void LoadConfigurableHotKeys()
|
||||||
{
|
{
|
||||||
if (AvaloniaMappingHelper.TryGetAvaKey((Ryujinx.Input.Key)ConfigurationState.Instance.Hid.Hotkeys.Value.ShowUi, out var showUiKey))
|
if (AvaloniaKeyboardMappingHelper.TryGetAvaKey((Ryujinx.Input.Key)ConfigurationState.Instance.Hid.Hotkeys.Value.ShowUi, out var showUiKey))
|
||||||
{
|
{
|
||||||
ShowUiKey = new KeyGesture(showUiKey, KeyModifiers.None);
|
ShowUiKey = new KeyGesture(showUiKey, KeyModifiers.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AvaloniaMappingHelper.TryGetAvaKey((Ryujinx.Input.Key)ConfigurationState.Instance.Hid.Hotkeys.Value.Screenshot, out var screenshotKey))
|
if (AvaloniaKeyboardMappingHelper.TryGetAvaKey((Ryujinx.Input.Key)ConfigurationState.Instance.Hid.Hotkeys.Value.Screenshot, out var screenshotKey))
|
||||||
{
|
{
|
||||||
ScreenshotKey = new KeyGesture(screenshotKey, KeyModifiers.None);
|
ScreenshotKey = new KeyGesture(screenshotKey, KeyModifiers.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AvaloniaMappingHelper.TryGetAvaKey((Ryujinx.Input.Key)ConfigurationState.Instance.Hid.Hotkeys.Value.Pause, out var pauseKey))
|
if (AvaloniaKeyboardMappingHelper.TryGetAvaKey((Ryujinx.Input.Key)ConfigurationState.Instance.Hid.Hotkeys.Value.Pause, out var pauseKey))
|
||||||
{
|
{
|
||||||
PauseKey = new KeyGesture(pauseKey, KeyModifiers.None);
|
PauseKey = new KeyGesture(pauseKey, KeyModifiers.None);
|
||||||
}
|
}
|
||||||
|
@@ -108,6 +108,8 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsOpenGLAvailable => !OperatingSystem.IsMacOS();
|
||||||
|
|
||||||
public bool DirectoryChanged
|
public bool DirectoryChanged
|
||||||
{
|
{
|
||||||
get => _directoryChanged;
|
get => _directoryChanged;
|
||||||
|
@@ -154,6 +154,12 @@ namespace Ryujinx.Ava.Ui.Windows
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void HandleScalingChanged(double scale)
|
||||||
|
{
|
||||||
|
Program.DesktopScaleFactor = scale;
|
||||||
|
base.HandleScalingChanged(scale);
|
||||||
|
}
|
||||||
|
|
||||||
public void Application_Opened(object sender, ApplicationOpenedEventArgs args)
|
public void Application_Opened(object sender, ApplicationOpenedEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Application != null)
|
if (args.Application != null)
|
||||||
|
@@ -540,7 +540,7 @@
|
|||||||
<ComboBoxItem IsVisible="{Binding IsVulkanAvailable}">
|
<ComboBoxItem IsVisible="{Binding IsVulkanAvailable}">
|
||||||
<TextBlock Text="Vulkan" />
|
<TextBlock Text="Vulkan" />
|
||||||
</ComboBoxItem>
|
</ComboBoxItem>
|
||||||
<ComboBoxItem>
|
<ComboBoxItem IsEnabled="{Binding IsOpenGLAvailable}">
|
||||||
<TextBlock Text="OpenGL" />
|
<TextBlock Text="OpenGL" />
|
||||||
</ComboBoxItem>
|
</ComboBoxItem>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
@@ -876,7 +876,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
|
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
|
||||||
<TextBlock VerticalAlignment="Center"
|
<TextBlock VerticalAlignment="Center"
|
||||||
Text="{locale:Locale SettingsTabLoggingOpenglLogLevel}"
|
Text="{locale:Locale SettingsTabLoggingGraphicsBackendLogLevel}"
|
||||||
ToolTip.Tip="{locale:Locale OpenGlLogLevel}"
|
ToolTip.Tip="{locale:Locale OpenGlLogLevel}"
|
||||||
Width="285" />
|
Width="285" />
|
||||||
<ComboBox SelectedIndex="{Binding OpenglDebugLevel}"
|
<ComboBox SelectedIndex="{Binding OpenglDebugLevel}"
|
||||||
@@ -884,17 +884,17 @@
|
|||||||
HorizontalContentAlignment="Left"
|
HorizontalContentAlignment="Left"
|
||||||
ToolTip.Tip="{locale:Locale OpenGlLogLevel}">
|
ToolTip.Tip="{locale:Locale OpenGlLogLevel}">
|
||||||
<ComboBoxItem>
|
<ComboBoxItem>
|
||||||
<TextBlock Text="{locale:Locale SettingsTabLoggingOpenglLogLevelNone}" />
|
<TextBlock Text="{locale:Locale SettingsTabLoggingGraphicsBackendLogLevelNone}" />
|
||||||
</ComboBoxItem>
|
</ComboBoxItem>
|
||||||
<ComboBoxItem>
|
<ComboBoxItem>
|
||||||
<TextBlock Text="{locale:Locale SettingsTabLoggingOpenglLogLevelError}" />
|
<TextBlock Text="{locale:Locale SettingsTabLoggingGraphicsBackendLogLevelError}" />
|
||||||
</ComboBoxItem>
|
</ComboBoxItem>
|
||||||
<ComboBoxItem>
|
<ComboBoxItem>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Text="{locale:Locale SettingsTabLoggingOpenglLogLevelPerformance}" />
|
Text="{locale:Locale SettingsTabLoggingGraphicsBackendLogLevelPerformance}" />
|
||||||
</ComboBoxItem>
|
</ComboBoxItem>
|
||||||
<ComboBoxItem>
|
<ComboBoxItem>
|
||||||
<TextBlock Text="{locale:Locale SettingsTabLoggingOpenglLogLevelAll}" />
|
<TextBlock Text="{locale:Locale SettingsTabLoggingGraphicsBackendLogLevelAll}" />
|
||||||
</ComboBoxItem>
|
</ComboBoxItem>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
@@ -45,7 +45,14 @@ namespace Ryujinx.Common.Configuration
|
|||||||
|
|
||||||
public static void Initialize(string baseDirPath)
|
public static void Initialize(string baseDirPath)
|
||||||
{
|
{
|
||||||
string userProfilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), DefaultBaseDir);
|
string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||||
|
|
||||||
|
if (appDataPath.Length == 0)
|
||||||
|
{
|
||||||
|
appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
string userProfilePath = Path.Combine(appDataPath, DefaultBaseDir);
|
||||||
string portablePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, DefaultPortableDir);
|
string portablePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, DefaultPortableDir);
|
||||||
|
|
||||||
if (Directory.Exists(portablePath))
|
if (Directory.Exists(portablePath))
|
||||||
|
@@ -8,7 +8,7 @@ namespace Ryujinx.Common.Memory.PartialUnmaps
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A simple implementation of a ReaderWriterLock which can be used from native code.
|
/// A simple implementation of a ReaderWriterLock which can be used from native code.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||||
public struct NativeReaderWriterLock
|
public struct NativeReaderWriterLock
|
||||||
{
|
{
|
||||||
public int WriteLock;
|
public int WriteLock;
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MsgPack.Cli" Version="1.0.1" />
|
<PackageReference Include="MsgPack.Cli" Version="1.0.1" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
|
||||||
<PackageReference Include="System.Management" Version="7.0.0" />
|
<PackageReference Include="System.Management" Version="7.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
|||||||
private const ushort FileFormatVersionMajor = 1;
|
private const ushort FileFormatVersionMajor = 1;
|
||||||
private const ushort FileFormatVersionMinor = 2;
|
private const ushort FileFormatVersionMinor = 2;
|
||||||
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
|
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
|
||||||
private const uint CodeGenVersion = 4011;
|
private const uint CodeGenVersion = 4028;
|
||||||
|
|
||||||
private const string SharedTocFileName = "shared.toc";
|
private const string SharedTocFileName = "shared.toc";
|
||||||
private const string SharedDataFileName = "shared.data";
|
private const string SharedDataFileName = "shared.data";
|
||||||
|
@@ -48,5 +48,10 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
_ => 0
|
_ => 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int GetConstantUbeOffset(int slot)
|
||||||
|
{
|
||||||
|
return UbeBaseOffset + slot * StorageDescSize;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -8,11 +8,14 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
|||||||
{
|
{
|
||||||
static class GlobalToStorage
|
static class GlobalToStorage
|
||||||
{
|
{
|
||||||
public static void RunPass(BasicBlock block, ShaderConfig config, ref int sbUseMask)
|
public static void RunPass(BasicBlock block, ShaderConfig config, ref int sbUseMask, ref int ubeUseMask)
|
||||||
{
|
{
|
||||||
int sbStart = GetStorageBaseCbOffset(config.Stage);
|
int sbStart = GetStorageBaseCbOffset(config.Stage);
|
||||||
int sbEnd = sbStart + StorageDescsSize;
|
int sbEnd = sbStart + StorageDescsSize;
|
||||||
|
|
||||||
|
int ubeStart = UbeBaseOffset;
|
||||||
|
int ubeEnd = UbeBaseOffset + UbeDescsSize;
|
||||||
|
|
||||||
for (LinkedListNode<INode> node = block.Operations.First; node != null; node = node.Next)
|
for (LinkedListNode<INode> node = block.Operations.First; node != null; node = node.Next)
|
||||||
{
|
{
|
||||||
for (int index = 0; index < node.Value.SourcesCount; index++)
|
for (int index = 0; index < node.Value.SourcesCount; index++)
|
||||||
@@ -25,6 +28,16 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
|||||||
{
|
{
|
||||||
sbUseMask |= 1 << storageIndex;
|
sbUseMask |= 1 << storageIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.Stage == ShaderStage.Compute)
|
||||||
|
{
|
||||||
|
int constantIndex = GetStorageIndex(src, ubeStart, ubeEnd);
|
||||||
|
|
||||||
|
if (constantIndex >= 0)
|
||||||
|
{
|
||||||
|
ubeUseMask |= 1 << constantIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(node.Value is Operation operation))
|
if (!(node.Value is Operation operation))
|
||||||
@@ -54,7 +67,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
|||||||
// so NVN "emulates" more constant buffers using global memory access.
|
// so NVN "emulates" more constant buffers using global memory access.
|
||||||
// Here we try to replace the global access back to a constant buffer
|
// Here we try to replace the global access back to a constant buffer
|
||||||
// load.
|
// load.
|
||||||
storageIndex = SearchForStorageBase(block, source, UbeBaseOffset, UbeBaseOffset + UbeDescsSize);
|
storageIndex = SearchForStorageBase(block, source, ubeStart, ubeStart + ubeEnd);
|
||||||
|
|
||||||
if (storageIndex >= 0)
|
if (storageIndex >= 0)
|
||||||
{
|
{
|
||||||
@@ -64,7 +77,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config.SetAccessibleStorageBuffersMask(sbUseMask);
|
config.SetAccessibleBufferMasks(sbUseMask, ubeUseMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static LinkedListNode<INode> ReplaceGlobalWithStorage(BasicBlock block, LinkedListNode<INode> node, ShaderConfig config, int storageIndex)
|
private static LinkedListNode<INode> ReplaceGlobalWithStorage(BasicBlock block, LinkedListNode<INode> node, ShaderConfig config, int storageIndex)
|
||||||
|
@@ -12,16 +12,17 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
|
|||||||
RunOptimizationPasses(blocks);
|
RunOptimizationPasses(blocks);
|
||||||
|
|
||||||
int sbUseMask = 0;
|
int sbUseMask = 0;
|
||||||
|
int ubeUseMask = 0;
|
||||||
|
|
||||||
// Those passes are looking for specific patterns and only needs to run once.
|
// Those passes are looking for specific patterns and only needs to run once.
|
||||||
for (int blkIndex = 0; blkIndex < blocks.Length; blkIndex++)
|
for (int blkIndex = 0; blkIndex < blocks.Length; blkIndex++)
|
||||||
{
|
{
|
||||||
GlobalToStorage.RunPass(blocks[blkIndex], config, ref sbUseMask);
|
GlobalToStorage.RunPass(blocks[blkIndex], config, ref sbUseMask, ref ubeUseMask);
|
||||||
BindlessToIndexed.RunPass(blocks[blkIndex], config);
|
BindlessToIndexed.RunPass(blocks[blkIndex], config);
|
||||||
BindlessElimination.RunPass(blocks[blkIndex], config);
|
BindlessElimination.RunPass(blocks[blkIndex], config);
|
||||||
}
|
}
|
||||||
|
|
||||||
config.SetAccessibleStorageBuffersMask(sbUseMask);
|
config.SetAccessibleBufferMasks(sbUseMask, ubeUseMask);
|
||||||
|
|
||||||
// Run optimizations one last time to remove any code that is now optimizable after above passes.
|
// Run optimizations one last time to remove any code that is now optimizable after above passes.
|
||||||
RunOptimizationPasses(blocks);
|
RunOptimizationPasses(blocks);
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
using Ryujinx.Graphics.Shader.Decoders;
|
||||||
using Ryujinx.Graphics.Shader.IntermediateRepresentation;
|
using Ryujinx.Graphics.Shader.IntermediateRepresentation;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -21,10 +22,11 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
{
|
{
|
||||||
BasicBlock block = blocks[blkIndex];
|
BasicBlock block = blocks[blkIndex];
|
||||||
|
|
||||||
for (LinkedListNode<INode> node = block.Operations.First; node != null; node = node.Next)
|
for (LinkedListNode<INode> node = block.Operations.First; node != null;)
|
||||||
{
|
{
|
||||||
if (node.Value is not Operation operation)
|
if (node.Value is not Operation operation)
|
||||||
{
|
{
|
||||||
|
node = node.Next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,10 +45,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UsesGlobalMemory(operation.Inst))
|
LinkedListNode<INode> nextNode = node.Next;
|
||||||
{
|
|
||||||
node = RewriteGlobalAccess(node, config);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (operation is TextureOperation texOp)
|
if (operation is TextureOperation texOp)
|
||||||
{
|
{
|
||||||
@@ -59,7 +58,15 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
node = InsertSnormNormalization(node, config);
|
node = InsertSnormNormalization(node, config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nextNode = node.Next;
|
||||||
}
|
}
|
||||||
|
else if (UsesGlobalMemory(operation.Inst))
|
||||||
|
{
|
||||||
|
nextNode = RewriteGlobalAccess(node, config)?.Next ?? nextNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
node = nextNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,7 +79,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
bool isStg16Or8 = operation.Inst == Instruction.StoreGlobal16 || operation.Inst == Instruction.StoreGlobal8;
|
bool isStg16Or8 = operation.Inst == Instruction.StoreGlobal16 || operation.Inst == Instruction.StoreGlobal8;
|
||||||
bool isWrite = isAtomic || operation.Inst == Instruction.StoreGlobal || isStg16Or8;
|
bool isWrite = isAtomic || operation.Inst == Instruction.StoreGlobal || isStg16Or8;
|
||||||
|
|
||||||
Operation storageOp;
|
Operation storageOp = null;
|
||||||
|
|
||||||
Operand PrependOperation(Instruction inst, params Operand[] sources)
|
Operand PrependOperation(Instruction inst, params Operand[] sources)
|
||||||
{
|
{
|
||||||
@@ -83,12 +90,42 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
return local;
|
return local;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Operand PrependExistingOperation(Operation operation)
|
||||||
|
{
|
||||||
|
Operand local = Local();
|
||||||
|
|
||||||
|
operation.Dest = local;
|
||||||
|
node.List.AddBefore(node, operation);
|
||||||
|
|
||||||
|
return local;
|
||||||
|
}
|
||||||
|
|
||||||
Operand addrLow = operation.GetSource(0);
|
Operand addrLow = operation.GetSource(0);
|
||||||
Operand addrHigh = operation.GetSource(1);
|
Operand addrHigh = operation.GetSource(1);
|
||||||
|
|
||||||
Operand sbBaseAddrLow = Const(0);
|
Operand sbBaseAddrLow = Const(0);
|
||||||
Operand sbSlot = Const(0);
|
Operand sbSlot = Const(0);
|
||||||
|
|
||||||
|
Operand alignMask = Const(-config.GpuAccessor.QueryHostStorageBufferOffsetAlignment());
|
||||||
|
|
||||||
|
Operand BindingRangeCheck(int cbOffset, out Operand baseAddrLow)
|
||||||
|
{
|
||||||
|
baseAddrLow = Cbuf(0, cbOffset);
|
||||||
|
Operand baseAddrHigh = Cbuf(0, cbOffset + 1);
|
||||||
|
Operand size = Cbuf(0, cbOffset + 2);
|
||||||
|
|
||||||
|
Operand offset = PrependOperation(Instruction.Subtract, addrLow, baseAddrLow);
|
||||||
|
Operand borrow = PrependOperation(Instruction.CompareLessU32, addrLow, baseAddrLow);
|
||||||
|
|
||||||
|
Operand inRangeLow = PrependOperation(Instruction.CompareLessU32, offset, size);
|
||||||
|
|
||||||
|
Operand addrHighBorrowed = PrependOperation(Instruction.Add, addrHigh, borrow);
|
||||||
|
|
||||||
|
Operand inRangeHigh = PrependOperation(Instruction.CompareEqual, addrHighBorrowed, baseAddrHigh);
|
||||||
|
|
||||||
|
return PrependOperation(Instruction.BitwiseAnd, inRangeLow, inRangeHigh);
|
||||||
|
}
|
||||||
|
|
||||||
int sbUseMask = config.AccessibleStorageBuffersMask;
|
int sbUseMask = config.AccessibleStorageBuffersMask;
|
||||||
|
|
||||||
while (sbUseMask != 0)
|
while (sbUseMask != 0)
|
||||||
@@ -101,68 +138,100 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
|
|
||||||
int cbOffset = GetStorageCbOffset(config.Stage, slot);
|
int cbOffset = GetStorageCbOffset(config.Stage, slot);
|
||||||
|
|
||||||
Operand baseAddrLow = Cbuf(0, cbOffset);
|
Operand inRange = BindingRangeCheck(cbOffset, out Operand baseAddrLow);
|
||||||
Operand baseAddrHigh = Cbuf(0, cbOffset + 1);
|
|
||||||
Operand size = Cbuf(0, cbOffset + 2);
|
|
||||||
|
|
||||||
Operand offset = PrependOperation(Instruction.Subtract, addrLow, baseAddrLow);
|
|
||||||
Operand borrow = PrependOperation(Instruction.CompareLessU32, addrLow, baseAddrLow);
|
|
||||||
|
|
||||||
Operand inRangeLow = PrependOperation(Instruction.CompareLessU32, offset, size);
|
|
||||||
|
|
||||||
Operand addrHighBorrowed = PrependOperation(Instruction.Add, addrHigh, borrow);
|
|
||||||
|
|
||||||
Operand inRangeHigh = PrependOperation(Instruction.CompareEqual, addrHighBorrowed, baseAddrHigh);
|
|
||||||
|
|
||||||
Operand inRange = PrependOperation(Instruction.BitwiseAnd, inRangeLow, inRangeHigh);
|
|
||||||
|
|
||||||
sbBaseAddrLow = PrependOperation(Instruction.ConditionalSelect, inRange, baseAddrLow, sbBaseAddrLow);
|
sbBaseAddrLow = PrependOperation(Instruction.ConditionalSelect, inRange, baseAddrLow, sbBaseAddrLow);
|
||||||
sbSlot = PrependOperation(Instruction.ConditionalSelect, inRange, Const(slot), sbSlot);
|
sbSlot = PrependOperation(Instruction.ConditionalSelect, inRange, Const(slot), sbSlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
Operand alignMask = Const(-config.GpuAccessor.QueryHostStorageBufferOffsetAlignment());
|
if (config.AccessibleStorageBuffersMask != 0)
|
||||||
|
|
||||||
Operand baseAddrTrunc = PrependOperation(Instruction.BitwiseAnd, sbBaseAddrLow, alignMask);
|
|
||||||
Operand byteOffset = PrependOperation(Instruction.Subtract, addrLow, baseAddrTrunc);
|
|
||||||
|
|
||||||
Operand[] sources = new Operand[operation.SourcesCount];
|
|
||||||
|
|
||||||
sources[0] = sbSlot;
|
|
||||||
|
|
||||||
if (isStg16Or8)
|
|
||||||
{
|
{
|
||||||
sources[1] = byteOffset;
|
Operand baseAddrTrunc = PrependOperation(Instruction.BitwiseAnd, sbBaseAddrLow, alignMask);
|
||||||
}
|
Operand byteOffset = PrependOperation(Instruction.Subtract, addrLow, baseAddrTrunc);
|
||||||
else
|
|
||||||
{
|
|
||||||
sources[1] = PrependOperation(Instruction.ShiftRightU32, byteOffset, Const(2));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int index = 2; index < operation.SourcesCount; index++)
|
Operand[] sources = new Operand[operation.SourcesCount];
|
||||||
{
|
|
||||||
sources[index] = operation.GetSource(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isAtomic)
|
sources[0] = sbSlot;
|
||||||
{
|
|
||||||
Instruction inst = (operation.Inst & ~Instruction.MrMask) | Instruction.MrStorage;
|
|
||||||
|
|
||||||
storageOp = new Operation(inst, operation.Dest, sources);
|
if (isStg16Or8)
|
||||||
}
|
|
||||||
else if (operation.Inst == Instruction.LoadGlobal)
|
|
||||||
{
|
|
||||||
storageOp = new Operation(Instruction.LoadStorage, operation.Dest, sources);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Instruction storeInst = operation.Inst switch
|
|
||||||
{
|
{
|
||||||
Instruction.StoreGlobal16 => Instruction.StoreStorage16,
|
sources[1] = byteOffset;
|
||||||
Instruction.StoreGlobal8 => Instruction.StoreStorage8,
|
}
|
||||||
_ => Instruction.StoreStorage
|
else
|
||||||
};
|
{
|
||||||
|
sources[1] = PrependOperation(Instruction.ShiftRightU32, byteOffset, Const(2));
|
||||||
|
}
|
||||||
|
|
||||||
storageOp = new Operation(storeInst, null, sources);
|
for (int index = 2; index < operation.SourcesCount; index++)
|
||||||
|
{
|
||||||
|
sources[index] = operation.GetSource(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isAtomic)
|
||||||
|
{
|
||||||
|
Instruction inst = (operation.Inst & ~Instruction.MrMask) | Instruction.MrStorage;
|
||||||
|
|
||||||
|
storageOp = new Operation(inst, operation.Dest, sources);
|
||||||
|
}
|
||||||
|
else if (operation.Inst == Instruction.LoadGlobal)
|
||||||
|
{
|
||||||
|
storageOp = new Operation(Instruction.LoadStorage, operation.Dest, sources);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Instruction storeInst = operation.Inst switch
|
||||||
|
{
|
||||||
|
Instruction.StoreGlobal16 => Instruction.StoreStorage16,
|
||||||
|
Instruction.StoreGlobal8 => Instruction.StoreStorage8,
|
||||||
|
_ => Instruction.StoreStorage
|
||||||
|
};
|
||||||
|
|
||||||
|
storageOp = new Operation(storeInst, null, sources);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (operation.Dest != null)
|
||||||
|
{
|
||||||
|
storageOp = new Operation(Instruction.Copy, operation.Dest, Const(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (operation.Inst == Instruction.LoadGlobal)
|
||||||
|
{
|
||||||
|
int cbeUseMask = config.AccessibleConstantBuffersMask;
|
||||||
|
|
||||||
|
while (cbeUseMask != 0)
|
||||||
|
{
|
||||||
|
int slot = BitOperations.TrailingZeroCount(cbeUseMask);
|
||||||
|
int cbSlot = UbeFirstCbuf + slot;
|
||||||
|
|
||||||
|
cbeUseMask &= ~(1 << slot);
|
||||||
|
|
||||||
|
config.SetUsedConstantBuffer(cbSlot);
|
||||||
|
|
||||||
|
Operand previousResult = PrependExistingOperation(storageOp);
|
||||||
|
|
||||||
|
int cbOffset = GetConstantUbeOffset(slot);
|
||||||
|
|
||||||
|
Operand inRange = BindingRangeCheck(cbOffset, out Operand baseAddrLow);
|
||||||
|
|
||||||
|
Operand baseAddrTruncConst = PrependOperation(Instruction.BitwiseAnd, baseAddrLow, alignMask);
|
||||||
|
Operand byteOffsetConst = PrependOperation(Instruction.Subtract, addrLow, baseAddrTruncConst);
|
||||||
|
|
||||||
|
Operand cbIndex = PrependOperation(Instruction.ShiftRightU32, byteOffsetConst, Const(2));
|
||||||
|
|
||||||
|
Operand[] sourcesCb = new Operand[operation.SourcesCount];
|
||||||
|
|
||||||
|
sourcesCb[0] = Const(cbSlot);
|
||||||
|
sourcesCb[1] = cbIndex;
|
||||||
|
|
||||||
|
for (int index = 2; index < operation.SourcesCount; index++)
|
||||||
|
{
|
||||||
|
sourcesCb[index] = operation.GetSource(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
Operand ldcResult = PrependOperation(Instruction.LoadConstant, sourcesCb);
|
||||||
|
|
||||||
|
storageOp = new Operation(Instruction.ConditionalSelect, operation.Dest, inRange, ldcResult, previousResult);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int index = 0; index < operation.SourcesCount; index++)
|
for (int index = 0; index < operation.SourcesCount; index++)
|
||||||
@@ -171,10 +240,18 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
}
|
}
|
||||||
|
|
||||||
LinkedListNode<INode> oldNode = node;
|
LinkedListNode<INode> oldNode = node;
|
||||||
|
LinkedList<INode> oldNodeList = oldNode.List;
|
||||||
|
|
||||||
node = node.List.AddBefore(node, storageOp);
|
if (storageOp != null)
|
||||||
|
{
|
||||||
|
node = node.List.AddBefore(node, storageOp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
node = null;
|
||||||
|
}
|
||||||
|
|
||||||
node.List.Remove(oldNode);
|
oldNodeList.Remove(oldNode);
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
@@ -66,6 +66,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
public UInt128 ThisInputAttributesComponents { get; private set; }
|
public UInt128 ThisInputAttributesComponents { get; private set; }
|
||||||
|
|
||||||
public int AccessibleStorageBuffersMask { get; private set; }
|
public int AccessibleStorageBuffersMask { get; private set; }
|
||||||
|
public int AccessibleConstantBuffersMask { get; private set; }
|
||||||
|
|
||||||
private int _usedConstantBuffers;
|
private int _usedConstantBuffers;
|
||||||
private int _usedStorageBuffers;
|
private int _usedStorageBuffers;
|
||||||
@@ -100,7 +101,8 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
GpuAccessor = gpuAccessor;
|
GpuAccessor = gpuAccessor;
|
||||||
Options = options;
|
Options = options;
|
||||||
|
|
||||||
AccessibleStorageBuffersMask = (1 << GlobalMemory.StorageMaxCount) - 1;
|
AccessibleStorageBuffersMask = (1 << GlobalMemory.StorageMaxCount) - 1;
|
||||||
|
AccessibleConstantBuffersMask = (1 << GlobalMemory.UbeMaxCount) - 1;
|
||||||
|
|
||||||
UsedInputAttributesPerPatch = new HashSet<int>();
|
UsedInputAttributesPerPatch = new HashSet<int>();
|
||||||
UsedOutputAttributesPerPatch = new HashSet<int>();
|
UsedOutputAttributesPerPatch = new HashSet<int>();
|
||||||
@@ -121,6 +123,11 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
OutputTopology = outputTopology;
|
OutputTopology = outputTopology;
|
||||||
MaxOutputVertices = maxOutputVertices;
|
MaxOutputVertices = maxOutputVertices;
|
||||||
TransformFeedbackEnabled = gpuAccessor.QueryTransformFeedbackEnabled();
|
TransformFeedbackEnabled = gpuAccessor.QueryTransformFeedbackEnabled();
|
||||||
|
|
||||||
|
if (Stage != ShaderStage.Compute)
|
||||||
|
{
|
||||||
|
AccessibleConstantBuffersMask = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShaderConfig(ShaderHeader header, IGpuAccessor gpuAccessor, TranslationOptions options) : this(gpuAccessor, options)
|
public ShaderConfig(ShaderHeader header, IGpuAccessor gpuAccessor, TranslationOptions options) : this(gpuAccessor, options)
|
||||||
@@ -404,9 +411,10 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
UsedFeatures |= flags;
|
UsedFeatures |= flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAccessibleStorageBuffersMask(int mask)
|
public void SetAccessibleBufferMasks(int sbMask, int ubeMask)
|
||||||
{
|
{
|
||||||
AccessibleStorageBuffersMask = mask;
|
AccessibleStorageBuffersMask = sbMask;
|
||||||
|
AccessibleConstantBuffersMask = ubeMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetUsedConstantBuffer(int slot)
|
public void SetUsedConstantBuffer(int slot)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using Silk.NET.Vulkan;
|
using Silk.NET.Vulkan;
|
||||||
@@ -21,6 +21,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
{
|
{
|
||||||
ExtConditionalRendering.ExtensionName,
|
ExtConditionalRendering.ExtensionName,
|
||||||
ExtExtendedDynamicState.ExtensionName,
|
ExtExtendedDynamicState.ExtensionName,
|
||||||
|
ExtTransformFeedback.ExtensionName,
|
||||||
KhrDrawIndirectCount.ExtensionName,
|
KhrDrawIndirectCount.ExtensionName,
|
||||||
KhrPushDescriptor.ExtensionName,
|
KhrPushDescriptor.ExtensionName,
|
||||||
"VK_EXT_custom_border_color",
|
"VK_EXT_custom_border_color",
|
||||||
@@ -36,8 +37,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
|
|
||||||
public static string[] RequiredExtensions { get; } = new string[]
|
public static string[] RequiredExtensions { get; } = new string[]
|
||||||
{
|
{
|
||||||
KhrSwapchain.ExtensionName,
|
KhrSwapchain.ExtensionName
|
||||||
ExtTransformFeedback.ExtensionName
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private static string[] _excludedMessages = new string[]
|
private static string[] _excludedMessages = new string[]
|
||||||
@@ -382,12 +382,12 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
DepthClamp = true,
|
DepthClamp = true,
|
||||||
DualSrcBlend = true,
|
DualSrcBlend = true,
|
||||||
FragmentStoresAndAtomics = true,
|
FragmentStoresAndAtomics = true,
|
||||||
GeometryShader = true,
|
GeometryShader = supportedFeatures.GeometryShader,
|
||||||
ImageCubeArray = true,
|
ImageCubeArray = true,
|
||||||
IndependentBlend = true,
|
IndependentBlend = true,
|
||||||
LogicOp = true,
|
LogicOp = supportedFeatures.LogicOp,
|
||||||
MultiViewport = true,
|
MultiViewport = true,
|
||||||
PipelineStatisticsQuery = true,
|
PipelineStatisticsQuery = supportedFeatures.PipelineStatisticsQuery,
|
||||||
SamplerAnisotropy = true,
|
SamplerAnisotropy = true,
|
||||||
ShaderClipDistance = true,
|
ShaderClipDistance = true,
|
||||||
ShaderFloat64 = supportedFeatures.ShaderFloat64,
|
ShaderFloat64 = supportedFeatures.ShaderFloat64,
|
||||||
|
@@ -39,13 +39,11 @@ namespace Ryujinx.HLE.FileSystem
|
|||||||
{
|
{
|
||||||
public readonly string ContainerPath;
|
public readonly string ContainerPath;
|
||||||
public readonly string NcaPath;
|
public readonly string NcaPath;
|
||||||
public bool Enabled;
|
|
||||||
|
|
||||||
public AocItem(string containerPath, string ncaPath, bool enabled)
|
public AocItem(string containerPath, string ncaPath)
|
||||||
{
|
{
|
||||||
ContainerPath = containerPath;
|
ContainerPath = containerPath;
|
||||||
NcaPath = ncaPath;
|
NcaPath = ncaPath;
|
||||||
Enabled = enabled;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +51,7 @@ namespace Ryujinx.HLE.FileSystem
|
|||||||
|
|
||||||
private VirtualFileSystem _virtualFileSystem;
|
private VirtualFileSystem _virtualFileSystem;
|
||||||
|
|
||||||
private readonly object _lock = new object();
|
private readonly object _lock = new();
|
||||||
|
|
||||||
public ContentManager(VirtualFileSystem virtualFileSystem)
|
public ContentManager(VirtualFileSystem virtualFileSystem)
|
||||||
{
|
{
|
||||||
@@ -226,27 +224,21 @@ namespace Ryujinx.HLE.FileSystem
|
|||||||
pfs0.OpenFile(ref cnmtFile.Ref(), pfs0.EnumerateEntries().Single().FullPath.ToU8Span(), OpenMode.Read);
|
pfs0.OpenFile(ref cnmtFile.Ref(), pfs0.EnumerateEntries().Single().FullPath.ToU8Span(), OpenMode.Read);
|
||||||
|
|
||||||
var cnmt = new Cnmt(cnmtFile.Get.AsStream());
|
var cnmt = new Cnmt(cnmtFile.Get.AsStream());
|
||||||
|
|
||||||
if (cnmt.Type != ContentMetaType.AddOnContent || (cnmt.TitleId & 0xFFFFFFFFFFFFE000) != aocBaseId)
|
if (cnmt.Type != ContentMetaType.AddOnContent || (cnmt.TitleId & 0xFFFFFFFFFFFFE000) != aocBaseId)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
string ncaId = BitConverter.ToString(cnmt.ContentEntries[0].NcaId).Replace("-", "").ToLower();
|
string ncaId = BitConverter.ToString(cnmt.ContentEntries[0].NcaId).Replace("-", "").ToLower();
|
||||||
if (!_aocData.TryAdd(cnmt.TitleId, new AocItem(containerPath, $"{ncaId}.nca", true)))
|
|
||||||
{
|
AddAocItem(cnmt.TitleId, containerPath, $"{ncaId}.nca", true);
|
||||||
Logger.Warning?.Print(LogClass.Application, $"Duplicate AddOnContent detected. TitleId {cnmt.TitleId:X16}");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Logger.Info?.Print(LogClass.Application, $"Found AddOnContent with TitleId {cnmt.TitleId:X16}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddAocItem(ulong titleId, string containerPath, string ncaPath, bool enabled)
|
public void AddAocItem(ulong titleId, string containerPath, string ncaPath, bool mergedToContainer = false)
|
||||||
{
|
{
|
||||||
if (!_aocData.TryAdd(titleId, new AocItem(containerPath, ncaPath, enabled)))
|
// TODO: Check Aoc version.
|
||||||
|
if (!_aocData.TryAdd(titleId, new AocItem(containerPath, ncaPath)))
|
||||||
{
|
{
|
||||||
Logger.Warning?.Print(LogClass.Application, $"Duplicate AddOnContent detected. TitleId {titleId:X16}");
|
Logger.Warning?.Print(LogClass.Application, $"Duplicate AddOnContent detected. TitleId {titleId:X16}");
|
||||||
}
|
}
|
||||||
@@ -254,25 +246,27 @@ namespace Ryujinx.HLE.FileSystem
|
|||||||
{
|
{
|
||||||
Logger.Info?.Print(LogClass.Application, $"Found AddOnContent with TitleId {titleId:X16}");
|
Logger.Info?.Print(LogClass.Application, $"Found AddOnContent with TitleId {titleId:X16}");
|
||||||
|
|
||||||
using (FileStream fileStream = File.OpenRead(containerPath))
|
if (!mergedToContainer)
|
||||||
using (PartitionFileSystem pfs = new PartitionFileSystem(fileStream.AsStorage()))
|
|
||||||
{
|
{
|
||||||
_virtualFileSystem.ImportTickets(pfs);
|
using FileStream fileStream = File.OpenRead(containerPath);
|
||||||
|
using PartitionFileSystem partitionFileSystem = new(fileStream.AsStorage());
|
||||||
|
|
||||||
|
_virtualFileSystem.ImportTickets(partitionFileSystem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearAocData() => _aocData.Clear();
|
public void ClearAocData() => _aocData.Clear();
|
||||||
|
|
||||||
public int GetAocCount() => _aocData.Where(e => e.Value.Enabled).Count();
|
public int GetAocCount() => _aocData.Count;
|
||||||
|
|
||||||
public IList<ulong> GetAocTitleIds() => _aocData.Where(e => e.Value.Enabled).Select(e => e.Key).ToList();
|
public IList<ulong> GetAocTitleIds() => _aocData.Select(e => e.Key).ToList();
|
||||||
|
|
||||||
public bool GetAocDataStorage(ulong aocTitleId, out IStorage aocStorage, IntegrityCheckLevel integrityCheckLevel)
|
public bool GetAocDataStorage(ulong aocTitleId, out IStorage aocStorage, IntegrityCheckLevel integrityCheckLevel)
|
||||||
{
|
{
|
||||||
aocStorage = null;
|
aocStorage = null;
|
||||||
|
|
||||||
if (_aocData.TryGetValue(aocTitleId, out AocItem aoc) && aoc.Enabled)
|
if (_aocData.TryGetValue(aocTitleId, out AocItem aoc))
|
||||||
{
|
{
|
||||||
var file = new FileStream(aoc.ContainerPath, FileMode.Open, FileAccess.Read);
|
var file = new FileStream(aoc.ContainerPath, FileMode.Open, FileAccess.Read);
|
||||||
using var ncaFile = new UniqueRef<IFile>();
|
using var ncaFile = new UniqueRef<IFile>();
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
@@ -11,7 +11,6 @@ using System.Numerics;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using SixLabors.ImageSharp.PixelFormats;
|
using SixLabors.ImageSharp.PixelFormats;
|
||||||
using Ryujinx.Common;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
||||||
{
|
{
|
||||||
@@ -68,8 +67,8 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
|||||||
{
|
{
|
||||||
int ryujinxLogoSize = 32;
|
int ryujinxLogoSize = 32;
|
||||||
|
|
||||||
Stream logoStream = EmbeddedResources.GetStream("Ryujinx.Ui.Common/Resources/Logo_Ryujinx.png");
|
string ryujinxIconPath = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Logo_Ryujinx.png";
|
||||||
_ryujinxLogo = LoadResource(logoStream, ryujinxLogoSize, ryujinxLogoSize);
|
_ryujinxLogo = LoadResource(Assembly.GetExecutingAssembly(), ryujinxIconPath, ryujinxLogoSize, ryujinxLogoSize);
|
||||||
|
|
||||||
string padAcceptIconPath = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Icon_BtnA.png";
|
string padAcceptIconPath = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Icon_BtnA.png";
|
||||||
string padCancelIconPath = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Icon_BtnB.png";
|
string padCancelIconPath = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Icon_BtnB.png";
|
||||||
@@ -117,7 +116,8 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
|||||||
uiThemeFontFamily,
|
uiThemeFontFamily,
|
||||||
"Liberation Sans",
|
"Liberation Sans",
|
||||||
"FreeSans",
|
"FreeSans",
|
||||||
"DejaVu Sans"
|
"DejaVu Sans",
|
||||||
|
"Lucida Grande"
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (string fontFamily in availableFonts)
|
foreach (string fontFamily in availableFonts)
|
||||||
|
@@ -426,9 +426,9 @@ namespace Ryujinx.HLE.HOS
|
|||||||
{
|
{
|
||||||
foreach (DownloadableContentNca downloadableContentNca in downloadableContentContainer.DownloadableContentNcaList)
|
foreach (DownloadableContentNca downloadableContentNca in downloadableContentContainer.DownloadableContentNcaList)
|
||||||
{
|
{
|
||||||
if (File.Exists(downloadableContentContainer.ContainerPath))
|
if (File.Exists(downloadableContentContainer.ContainerPath) && downloadableContentNca.Enabled)
|
||||||
{
|
{
|
||||||
_device.Configuration.ContentManager.AddAocItem(downloadableContentNca.TitleId, downloadableContentContainer.ContainerPath, downloadableContentNca.FullPath, downloadableContentNca.Enabled);
|
_device.Configuration.ContentManager.AddAocItem(downloadableContentNca.TitleId, downloadableContentContainer.ContainerPath, downloadableContentNca.FullPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
<PackageReference Include="MsgPack.Cli" Version="1.0.1" />
|
<PackageReference Include="MsgPack.Cli" Version="1.0.1" />
|
||||||
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
|
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
|
||||||
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta11" />
|
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta11" />
|
||||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.25.0" />
|
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.25.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- Due to Concentus. -->
|
<!-- Due to Concentus. -->
|
||||||
@@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Homebrew.npdm" />
|
<None Remove="Homebrew.npdm" />
|
||||||
|
<None Remove="HOS\Applets\SoftwareKeyboard\Resources\Logo_Ryujinx.png" />
|
||||||
<None Remove="HOS\Applets\SoftwareKeyboard\Resources\Icon_BtnA.png" />
|
<None Remove="HOS\Applets\SoftwareKeyboard\Resources\Icon_BtnA.png" />
|
||||||
<None Remove="HOS\Applets\SoftwareKeyboard\Resources\Icon_BtnB.png" />
|
<None Remove="HOS\Applets\SoftwareKeyboard\Resources\Icon_BtnB.png" />
|
||||||
<None Remove="HOS\Applets\SoftwareKeyboard\Resources\Icon_KeyF6.png" />
|
<None Remove="HOS\Applets\SoftwareKeyboard\Resources\Icon_KeyF6.png" />
|
||||||
@@ -44,6 +45,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Homebrew.npdm" />
|
<EmbeddedResource Include="Homebrew.npdm" />
|
||||||
|
<EmbeddedResource Include="HOS\Applets\SoftwareKeyboard\Resources\Logo_Ryujinx.png" />
|
||||||
<EmbeddedResource Include="HOS\Applets\SoftwareKeyboard\Resources\Icon_BtnA.png" />
|
<EmbeddedResource Include="HOS\Applets\SoftwareKeyboard\Resources\Icon_BtnA.png" />
|
||||||
<EmbeddedResource Include="HOS\Applets\SoftwareKeyboard\Resources\Icon_BtnB.png" />
|
<EmbeddedResource Include="HOS\Applets\SoftwareKeyboard\Resources\Icon_BtnB.png" />
|
||||||
<EmbeddedResource Include="HOS\Applets\SoftwareKeyboard\Resources\Icon_KeyF6.png" />
|
<EmbeddedResource Include="HOS\Applets\SoftwareKeyboard\Resources\Icon_KeyF6.png" />
|
||||||
|
@@ -77,6 +77,26 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
_accountManager = new AccountManager(_libHacHorizonManager.RyujinxClient);
|
_accountManager = new AccountManager(_libHacHorizonManager.RyujinxClient);
|
||||||
_userChannelPersistence = new UserChannelPersistence();
|
_userChannelPersistence = new UserChannelPersistence();
|
||||||
|
|
||||||
|
if (OperatingSystem.IsMacOS())
|
||||||
|
{
|
||||||
|
AutoResetEvent invoked = new AutoResetEvent(false);
|
||||||
|
|
||||||
|
// MacOS must perform SDL polls from the main thread.
|
||||||
|
Ryujinx.SDL2.Common.SDL2Driver.MainThreadDispatcher = (Action action) =>
|
||||||
|
{
|
||||||
|
invoked.Reset();
|
||||||
|
|
||||||
|
WindowBase.QueueMainThreadAction(() =>
|
||||||
|
{
|
||||||
|
action();
|
||||||
|
|
||||||
|
invoked.Set();
|
||||||
|
});
|
||||||
|
|
||||||
|
invoked.WaitOne();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
_inputManager = new InputManager(new SDL2KeyboardDriver(), new SDL2GamepadDriver());
|
_inputManager = new InputManager(new SDL2KeyboardDriver(), new SDL2GamepadDriver());
|
||||||
|
|
||||||
GraphicsConfig.EnableShaderCache = true;
|
GraphicsConfig.EnableShaderCache = true;
|
||||||
|
@@ -12,7 +12,8 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="OpenTK.Core" Version="4.7.5" />
|
<PackageReference Include="OpenTK.Core" Version="4.7.5" />
|
||||||
<PackageReference Include="Ryujinx.Graphics.Nvdec.Dependencies" Version="5.0.1-build10" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64'" />
|
<PackageReference Include="Ryujinx.Graphics.Nvdec.Dependencies" Version="5.0.1-build10" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64' AND '$(RuntimeIdentifier)' != 'osx-arm64'" />
|
||||||
|
<PackageReference Include="Ryujinx.Graphics.Nvdec.Dependencies.osx" Version="5.0.1" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'win10-x64'" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -32,10 +33,14 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ContentWithTargetPath Include="..\distribution\legal\THIRDPARTY.md">
|
<Content Include="..\distribution\legal\THIRDPARTY.md">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<TargetPath>THIRDPARTY.md</TargetPath>
|
<TargetPath>THIRDPARTY.md</TargetPath>
|
||||||
</ContentWithTargetPath>
|
</Content>
|
||||||
|
<Content Include="..\LICENSE.txt">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
<TargetPath>LICENSE.txt</TargetPath>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- Due to .net core 3.1 embedded resource loading -->
|
<!-- Due to .net core 3.1 embedded resource loading -->
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Input.HLE;
|
using Ryujinx.Input.HLE;
|
||||||
|
using Ryujinx.SDL2.Common;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using static SDL2.SDL;
|
using static SDL2.SDL;
|
||||||
@@ -26,15 +27,34 @@ namespace Ryujinx.Headless.SDL2.Vulkan
|
|||||||
MouseDriver.SetClientSize(DefaultWidth, DefaultHeight);
|
MouseDriver.SetClientSize(DefaultWidth, DefaultHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void BasicInvoke(Action action)
|
||||||
|
{
|
||||||
|
action();
|
||||||
|
}
|
||||||
|
|
||||||
public unsafe IntPtr CreateWindowSurface(IntPtr instance)
|
public unsafe IntPtr CreateWindowSurface(IntPtr instance)
|
||||||
{
|
{
|
||||||
if (SDL_Vulkan_CreateSurface(WindowHandle, instance, out ulong surfaceHandle) == SDL_bool.SDL_FALSE)
|
ulong surfaceHandle = 0;
|
||||||
|
|
||||||
|
Action createSurface = () =>
|
||||||
{
|
{
|
||||||
string errorMessage = $"SDL_Vulkan_CreateSurface failed with error \"{SDL_GetError()}\"";
|
if (SDL_Vulkan_CreateSurface(WindowHandle, instance, out surfaceHandle) == SDL_bool.SDL_FALSE)
|
||||||
|
{
|
||||||
|
string errorMessage = $"SDL_Vulkan_CreateSurface failed with error \"{SDL_GetError()}\"";
|
||||||
|
|
||||||
Logger.Error?.Print(LogClass.Application, errorMessage);
|
Logger.Error?.Print(LogClass.Application, errorMessage);
|
||||||
|
|
||||||
throw new Exception(errorMessage);
|
throw new Exception(errorMessage);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (SDL2Driver.MainThreadDispatcher != null)
|
||||||
|
{
|
||||||
|
SDL2Driver.MainThreadDispatcher(createSurface);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
createSurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (IntPtr)surfaceHandle;
|
return (IntPtr)surfaceHandle;
|
||||||
|
@@ -11,6 +11,7 @@ using Ryujinx.Input;
|
|||||||
using Ryujinx.Input.HLE;
|
using Ryujinx.Input.HLE;
|
||||||
using Ryujinx.SDL2.Common;
|
using Ryujinx.SDL2.Common;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@@ -26,6 +27,13 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
private const SDL_WindowFlags DefaultFlags = SDL_WindowFlags.SDL_WINDOW_ALLOW_HIGHDPI | SDL_WindowFlags.SDL_WINDOW_RESIZABLE | SDL_WindowFlags.SDL_WINDOW_INPUT_FOCUS | SDL_WindowFlags.SDL_WINDOW_SHOWN;
|
private const SDL_WindowFlags DefaultFlags = SDL_WindowFlags.SDL_WINDOW_ALLOW_HIGHDPI | SDL_WindowFlags.SDL_WINDOW_RESIZABLE | SDL_WindowFlags.SDL_WINDOW_INPUT_FOCUS | SDL_WindowFlags.SDL_WINDOW_SHOWN;
|
||||||
private const int TargetFps = 60;
|
private const int TargetFps = 60;
|
||||||
|
|
||||||
|
private static ConcurrentQueue<Action> MainThreadActions = new ConcurrentQueue<Action>();
|
||||||
|
|
||||||
|
public static void QueueMainThreadAction(Action action)
|
||||||
|
{
|
||||||
|
MainThreadActions.Enqueue(action);
|
||||||
|
}
|
||||||
|
|
||||||
public NpadManager NpadManager { get; }
|
public NpadManager NpadManager { get; }
|
||||||
public TouchScreenManager TouchScreenManager { get; }
|
public TouchScreenManager TouchScreenManager { get; }
|
||||||
public Switch Device { get; private set; }
|
public Switch Device { get; private set; }
|
||||||
@@ -168,6 +176,14 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
|
|
||||||
public void Render()
|
public void Render()
|
||||||
{
|
{
|
||||||
|
InitializeWindowRenderer();
|
||||||
|
|
||||||
|
Device.Gpu.Renderer.Initialize(_glLogLevel);
|
||||||
|
|
||||||
|
InitializeRenderer();
|
||||||
|
|
||||||
|
_gpuVendorName = GetGpuVendorName();
|
||||||
|
|
||||||
Device.Gpu.Renderer.RunLoop(() =>
|
Device.Gpu.Renderer.RunLoop(() =>
|
||||||
{
|
{
|
||||||
Device.Gpu.SetGpuThread();
|
Device.Gpu.SetGpuThread();
|
||||||
@@ -241,6 +257,14 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
_exitEvent.Dispose();
|
_exitEvent.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ProcessMainThreadQueue()
|
||||||
|
{
|
||||||
|
while (MainThreadActions.TryDequeue(out Action action))
|
||||||
|
{
|
||||||
|
action();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void MainLoop()
|
public void MainLoop()
|
||||||
{
|
{
|
||||||
while (_isActive)
|
while (_isActive)
|
||||||
@@ -249,6 +273,8 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
|
|
||||||
SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
|
||||||
|
ProcessMainThreadQueue();
|
||||||
|
|
||||||
// Polling becomes expensive if it's not slept
|
// Polling becomes expensive if it's not slept
|
||||||
Thread.Sleep(1);
|
Thread.Sleep(1);
|
||||||
}
|
}
|
||||||
@@ -315,14 +341,6 @@ namespace Ryujinx.Headless.SDL2
|
|||||||
|
|
||||||
InitializeWindow();
|
InitializeWindow();
|
||||||
|
|
||||||
InitializeWindowRenderer();
|
|
||||||
|
|
||||||
Device.Gpu.Renderer.Initialize(_glLogLevel);
|
|
||||||
|
|
||||||
InitializeRenderer();
|
|
||||||
|
|
||||||
_gpuVendorName = GetGpuVendorName();
|
|
||||||
|
|
||||||
Thread renderLoopThread = new Thread(Render)
|
Thread renderLoopThread = new Thread(Render)
|
||||||
{
|
{
|
||||||
Name = "GUI.RenderLoop"
|
Name = "GUI.RenderLoop"
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.2.0" />
|
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.4.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@@ -153,7 +153,8 @@ namespace Ryujinx.Memory
|
|||||||
|
|
||||||
if (OperatingSystem.IsMacOSVersionAtLeast(10, 14))
|
if (OperatingSystem.IsMacOSVersionAtLeast(10, 14))
|
||||||
{
|
{
|
||||||
result |= MAP_JIT_DARWIN;
|
// Only to be used with the Hardened Runtime.
|
||||||
|
// result |= MAP_JIT_DARWIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -0,0 +1,16 @@
|
|||||||
|
using NUnit.Framework;
|
||||||
|
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.Tests.Audio.Renderer.Parameter.Effect
|
||||||
|
{
|
||||||
|
class CompressorParameterTests
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void EnsureTypeSize()
|
||||||
|
{
|
||||||
|
Assert.AreEqual(0x38, Unsafe.SizeOf<CompressorParameter>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@@ -12,9 +12,11 @@ namespace Ryujinx.Ui.App.Common
|
|||||||
public string Developer { get; set; }
|
public string Developer { get; set; }
|
||||||
public string Version { get; set; }
|
public string Version { get; set; }
|
||||||
public string TimePlayed { get; set; }
|
public string TimePlayed { get; set; }
|
||||||
|
public double TimePlayedNum { get; set; }
|
||||||
public string LastPlayed { get; set; }
|
public string LastPlayed { get; set; }
|
||||||
public string FileExtension { get; set; }
|
public string FileExtension { get; set; }
|
||||||
public string FileSize { get; set; }
|
public string FileSize { get; set; }
|
||||||
|
public double FileSizeBytes { get; set; }
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
public BlitStruct<ApplicationControlProperty> ControlHolder { get; set; }
|
public BlitStruct<ApplicationControlProperty> ControlHolder { get; set; }
|
||||||
}
|
}
|
||||||
|
@@ -465,9 +465,11 @@ namespace Ryujinx.Ui.App.Common
|
|||||||
Developer = developer,
|
Developer = developer,
|
||||||
Version = version,
|
Version = version,
|
||||||
TimePlayed = ConvertSecondsToReadableString(appMetadata.TimePlayed),
|
TimePlayed = ConvertSecondsToReadableString(appMetadata.TimePlayed),
|
||||||
|
TimePlayedNum = appMetadata.TimePlayed,
|
||||||
LastPlayed = appMetadata.LastPlayed,
|
LastPlayed = appMetadata.LastPlayed,
|
||||||
FileExtension = Path.GetExtension(applicationPath).ToUpper().Remove(0, 1),
|
FileExtension = Path.GetExtension(applicationPath).ToUpper().Remove(0, 1),
|
||||||
FileSize = (fileSize < 1) ? (fileSize * 1024).ToString("0.##") + " MiB" : fileSize.ToString("0.##") + " GiB",
|
FileSize = (fileSize < 1) ? (fileSize * 1024).ToString("0.##") + " MiB" : fileSize.ToString("0.##") + " GiB",
|
||||||
|
FileSizeBytes = fileSize,
|
||||||
Path = applicationPath,
|
Path = applicationPath,
|
||||||
ControlHolder = controlHolder
|
ControlHolder = controlHolder
|
||||||
};
|
};
|
||||||
|
@@ -680,7 +680,7 @@ namespace Ryujinx.Ui.Common.Configuration
|
|||||||
Hid.EnableMouse.Value = false;
|
Hid.EnableMouse.Value = false;
|
||||||
Hid.Hotkeys.Value = new KeyboardHotkeys
|
Hid.Hotkeys.Value = new KeyboardHotkeys
|
||||||
{
|
{
|
||||||
ToggleVsync = Key.Tab,
|
ToggleVsync = Key.F1,
|
||||||
ToggleMute = Key.F2,
|
ToggleMute = Key.F2,
|
||||||
Screenshot = Key.F8,
|
Screenshot = Key.F8,
|
||||||
ShowUi = Key.F4,
|
ShowUi = Key.F4,
|
||||||
@@ -818,7 +818,7 @@ namespace Ryujinx.Ui.Common.Configuration
|
|||||||
|
|
||||||
configurationFileFormat.Hotkeys = new KeyboardHotkeys
|
configurationFileFormat.Hotkeys = new KeyboardHotkeys
|
||||||
{
|
{
|
||||||
ToggleVsync = Key.Tab
|
ToggleVsync = Key.F1
|
||||||
};
|
};
|
||||||
|
|
||||||
configurationFileUpdated = true;
|
configurationFileUpdated = true;
|
||||||
@@ -999,7 +999,7 @@ namespace Ryujinx.Ui.Common.Configuration
|
|||||||
|
|
||||||
configurationFileFormat.Hotkeys = new KeyboardHotkeys
|
configurationFileFormat.Hotkeys = new KeyboardHotkeys
|
||||||
{
|
{
|
||||||
ToggleVsync = Key.Tab,
|
ToggleVsync = Key.F1,
|
||||||
Screenshot = Key.F8
|
Screenshot = Key.F8
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1012,7 +1012,7 @@ namespace Ryujinx.Ui.Common.Configuration
|
|||||||
|
|
||||||
configurationFileFormat.Hotkeys = new KeyboardHotkeys
|
configurationFileFormat.Hotkeys = new KeyboardHotkeys
|
||||||
{
|
{
|
||||||
ToggleVsync = Key.Tab,
|
ToggleVsync = Key.F1,
|
||||||
Screenshot = Key.F8,
|
Screenshot = Key.F8,
|
||||||
ShowUi = Key.F4
|
ShowUi = Key.F4
|
||||||
};
|
};
|
||||||
|
@@ -25,7 +25,7 @@ namespace Ryujinx.Modules
|
|||||||
|
|
||||||
public UpdateDialog(MainWindow mainWindow, Version newVersion, string buildUrl) : this(new Builder("Ryujinx.Modules.Updater.UpdateDialog.glade"), mainWindow, newVersion, buildUrl) { }
|
public UpdateDialog(MainWindow mainWindow, Version newVersion, string buildUrl) : this(new Builder("Ryujinx.Modules.Updater.UpdateDialog.glade"), mainWindow, newVersion, buildUrl) { }
|
||||||
|
|
||||||
private UpdateDialog(Builder builder, MainWindow mainWindow, Version newVersion, string buildUrl) : base(builder.GetObject("UpdateDialog").Handle)
|
private UpdateDialog(Builder builder, MainWindow mainWindow, Version newVersion, string buildUrl) : base(builder.GetRawOwnedObject("UpdateDialog"))
|
||||||
{
|
{
|
||||||
builder.Autoconnect(this);
|
builder.Autoconnect(this);
|
||||||
|
|
||||||
|
@@ -16,6 +16,7 @@ using Ryujinx.Ui.Widgets;
|
|||||||
using SixLabors.ImageSharp.Formats.Jpeg;
|
using SixLabors.ImageSharp.Formats.Jpeg;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -40,6 +41,12 @@ namespace Ryujinx
|
|||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
public static extern int MessageBoxA(IntPtr hWnd, string text, string caption, uint type);
|
public static extern int MessageBoxA(IntPtr hWnd, string text, string caption, uint type);
|
||||||
|
|
||||||
|
[DllImport("libc", SetLastError = true)]
|
||||||
|
static extern int setenv(string name, string value, int overwrite);
|
||||||
|
|
||||||
|
[DllImport("libc")]
|
||||||
|
static extern IntPtr getenv(string name);
|
||||||
|
|
||||||
private const uint MB_ICONWARNING = 0x30;
|
private const uint MB_ICONWARNING = 0x30;
|
||||||
|
|
||||||
static Program()
|
static Program()
|
||||||
@@ -97,6 +104,35 @@ namespace Ryujinx
|
|||||||
XInitThreads();
|
XInitThreads();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (OperatingSystem.IsMacOS())
|
||||||
|
{
|
||||||
|
string baseDirectory = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
|
||||||
|
string resourcesDataDir;
|
||||||
|
|
||||||
|
if (Path.GetFileName(baseDirectory) == "MacOS")
|
||||||
|
{
|
||||||
|
resourcesDataDir = Path.Combine(Directory.GetParent(baseDirectory).FullName, "Resources");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resourcesDataDir = baseDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetEnvironmentVariableNoCaching(string key, string value)
|
||||||
|
{
|
||||||
|
int res = setenv(key, value, 1);
|
||||||
|
Debug.Assert(res != -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// On macOS, GTK3 needs XDG_DATA_DIRS to be set, otherwise it will try searching for "gschemas.compiled" in system directories.
|
||||||
|
SetEnvironmentVariableNoCaching("XDG_DATA_DIRS", Path.Combine(resourcesDataDir, "share"));
|
||||||
|
|
||||||
|
// On macOS, GTK3 needs GDK_PIXBUF_MODULE_FILE to be set, otherwise it will try searching for "loaders.cache" in system directories.
|
||||||
|
SetEnvironmentVariableNoCaching("GDK_PIXBUF_MODULE_FILE", Path.Combine(resourcesDataDir, "lib", "gdk-pixbuf-2.0", "2.10.0", "loaders.cache"));
|
||||||
|
|
||||||
|
SetEnvironmentVariableNoCaching("GTK_IM_MODULE_FILE", Path.Combine(resourcesDataDir, "lib", "gtk-3.0", "3.0.0", "immodules.cache"));
|
||||||
|
}
|
||||||
|
|
||||||
string systemPath = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine);
|
string systemPath = Environment.GetEnvironmentVariable("Path", EnvironmentVariableTarget.Machine);
|
||||||
Environment.SetEnvironmentVariable("Path", $"{Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin")};{systemPath}");
|
Environment.SetEnvironmentVariable("Path", $"{Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin")};{systemPath}");
|
||||||
|
|
||||||
|
@@ -19,10 +19,13 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="GtkSharp" Version="3.22.25.128" />
|
<PackageReference Include="Ryujinx.GtkSharp" Version="3.24.24.59-ryujinx" />
|
||||||
<PackageReference Include="GtkSharp.Dependencies" Version="1.1.1" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64'" />
|
<PackageReference Include="GtkSharp.Dependencies" Version="1.1.1" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64' AND '$(RuntimeIdentifier)' != 'osx-arm64'" />
|
||||||
<PackageReference Include="Ryujinx.Graphics.Nvdec.Dependencies" Version="5.0.1-build10" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64'" />
|
<PackageReference Include="GtkSharp.Dependencies.osx" Version="0.0.5" Condition="'$(RuntimeIdentifier)' == 'osx-x64' OR '$(RuntimeIdentifier)' == 'osx-arm64'" />
|
||||||
<PackageReference Include="Ryujinx.Audio.OpenAL.Dependencies" Version="1.21.0.1" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64'" />
|
<PackageReference Include="Ryujinx.Graphics.Nvdec.Dependencies" Version="5.0.1-build10" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64' AND '$(RuntimeIdentifier)' != 'osx-arm64'" />
|
||||||
|
<PackageReference Include="Ryujinx.Graphics.Nvdec.Dependencies.osx" Version="5.0.1" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'win10-x64'" />
|
||||||
|
<PackageReference Include="Ryujinx.Audio.OpenAL.Dependencies" Version="1.21.0.1" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64' AND '$(RuntimeIdentifier)' != 'osx-arm64'" />
|
||||||
|
<PackageReference Include="Ryujinx.Graphics.Vulkan.Dependencies.MoltenVK" Version="1.2.0" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'win10-x64'" />
|
||||||
<PackageReference Include="OpenTK.Core" Version="4.7.5" />
|
<PackageReference Include="OpenTK.Core" Version="4.7.5" />
|
||||||
<PackageReference Include="OpenTK.Graphics" Version="4.7.5" />
|
<PackageReference Include="OpenTK.Graphics" Version="4.7.5" />
|
||||||
<PackageReference Include="SPB" Version="0.0.4-build28" />
|
<PackageReference Include="SPB" Version="0.0.4-build28" />
|
||||||
@@ -46,14 +49,18 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ContentWithTargetPath Include="..\distribution\windows\alsoft.ini" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64'">
|
<Content Include="..\distribution\windows\alsoft.ini" Condition="'$(RuntimeIdentifier)' != 'linux-x64' AND '$(RuntimeIdentifier)' != 'osx-x64'">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<TargetPath>alsoft.ini</TargetPath>
|
<TargetPath>alsoft.ini</TargetPath>
|
||||||
</ContentWithTargetPath>
|
</Content>
|
||||||
<ContentWithTargetPath Include="..\distribution\legal\THIRDPARTY.md">
|
<Content Include="..\distribution\legal\THIRDPARTY.md">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<TargetPath>THIRDPARTY.md</TargetPath>
|
<TargetPath>THIRDPARTY.md</TargetPath>
|
||||||
</ContentWithTargetPath>
|
</Content>
|
||||||
|
<Content Include="..\LICENSE.txt">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
<TargetPath>LICENSE.txt</TargetPath>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<!-- Due to .net core 3.1 embedded resource loading -->
|
<!-- Due to .net core 3.1 embedded resource loading -->
|
||||||
@@ -62,10 +69,6 @@
|
|||||||
<ApplicationIcon>Ryujinx.ico</ApplicationIcon>
|
<ApplicationIcon>Ryujinx.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'osx-x64'">
|
|
||||||
<DefineConstants>$(DefineConstants);MACOS_BUILD</DefineConstants>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Ui\MainWindow.glade" />
|
<None Remove="Ui\MainWindow.glade" />
|
||||||
<None Remove="Ui\Widgets\ProfileDialog.glade" />
|
<None Remove="Ui\Widgets\ProfileDialog.glade" />
|
||||||
|
134
Ryujinx/Ui/Helper/MetalHelper.cs
Normal file
134
Ryujinx/Ui/Helper/MetalHelper.cs
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
using Gdk;
|
||||||
|
using System;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.Ui.Helper
|
||||||
|
{
|
||||||
|
public delegate void UpdateBoundsCallbackDelegate(Window window);
|
||||||
|
|
||||||
|
[SupportedOSPlatform("macos")]
|
||||||
|
static class MetalHelper
|
||||||
|
{
|
||||||
|
private const string LibObjCImport = "/usr/lib/libobjc.A.dylib";
|
||||||
|
|
||||||
|
private struct Selector
|
||||||
|
{
|
||||||
|
public readonly IntPtr NativePtr;
|
||||||
|
|
||||||
|
public unsafe Selector(string value)
|
||||||
|
{
|
||||||
|
int size = System.Text.Encoding.UTF8.GetMaxByteCount(value.Length);
|
||||||
|
byte* data = stackalloc byte[size];
|
||||||
|
|
||||||
|
fixed (char* pValue = value)
|
||||||
|
{
|
||||||
|
System.Text.Encoding.UTF8.GetBytes(pValue, value.Length, data, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
NativePtr = sel_registerName(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator Selector(string value) => new Selector(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static unsafe IntPtr GetClass(string value)
|
||||||
|
{
|
||||||
|
int size = System.Text.Encoding.UTF8.GetMaxByteCount(value.Length);
|
||||||
|
byte* data = stackalloc byte[size];
|
||||||
|
|
||||||
|
fixed (char* pValue = value)
|
||||||
|
{
|
||||||
|
System.Text.Encoding.UTF8.GetBytes(pValue, value.Length, data, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
return objc_getClass(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
private struct NSPoint
|
||||||
|
{
|
||||||
|
public double X;
|
||||||
|
public double Y;
|
||||||
|
|
||||||
|
public NSPoint(double x, double y)
|
||||||
|
{
|
||||||
|
X = x;
|
||||||
|
Y = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private struct NSRect
|
||||||
|
{
|
||||||
|
public NSPoint Pos;
|
||||||
|
public NSPoint Size;
|
||||||
|
|
||||||
|
public NSRect(double x, double y, double width, double height)
|
||||||
|
{
|
||||||
|
Pos = new NSPoint(x, y);
|
||||||
|
Size = new NSPoint(width, height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IntPtr GetMetalLayer(Display display, Window window, out IntPtr nsView, out UpdateBoundsCallbackDelegate updateBounds)
|
||||||
|
{
|
||||||
|
nsView = gdk_quartz_window_get_nsview(window.Handle);
|
||||||
|
|
||||||
|
// Create a new CAMetalLayer.
|
||||||
|
IntPtr layerClass = GetClass("CAMetalLayer");
|
||||||
|
IntPtr metalLayer = IntPtr_objc_msgSend(layerClass, "alloc");
|
||||||
|
objc_msgSend(metalLayer, "init");
|
||||||
|
|
||||||
|
// Create a child NSView to render into.
|
||||||
|
IntPtr nsViewClass = GetClass("NSView");
|
||||||
|
IntPtr child = IntPtr_objc_msgSend(nsViewClass, "alloc");
|
||||||
|
objc_msgSend(child, "init", new NSRect());
|
||||||
|
|
||||||
|
// Add it as a child.
|
||||||
|
objc_msgSend(nsView, "addSubview:", child);
|
||||||
|
|
||||||
|
// Make its renderer our metal layer.
|
||||||
|
objc_msgSend(child, "setWantsLayer:", (byte)1);
|
||||||
|
objc_msgSend(child, "setLayer:", metalLayer);
|
||||||
|
objc_msgSend(metalLayer, "setContentsScale:", (double)display.GetMonitorAtWindow(window).ScaleFactor);
|
||||||
|
|
||||||
|
// Set the frame position/location.
|
||||||
|
updateBounds = (Window window) => {
|
||||||
|
window.GetPosition(out int x, out int y);
|
||||||
|
int width = window.Width;
|
||||||
|
int height = window.Height;
|
||||||
|
objc_msgSend(child, "setFrame:", new NSRect(x, y, width, height));
|
||||||
|
};
|
||||||
|
|
||||||
|
updateBounds(window);
|
||||||
|
|
||||||
|
return metalLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport(LibObjCImport)]
|
||||||
|
private static unsafe extern IntPtr sel_registerName(byte* data);
|
||||||
|
|
||||||
|
[DllImport(LibObjCImport)]
|
||||||
|
private static unsafe extern IntPtr objc_getClass(byte* data);
|
||||||
|
|
||||||
|
[DllImport(LibObjCImport)]
|
||||||
|
private static extern void objc_msgSend(IntPtr receiver, Selector selector);
|
||||||
|
|
||||||
|
[DllImport(LibObjCImport)]
|
||||||
|
private static extern void objc_msgSend(IntPtr receiver, Selector selector, byte value);
|
||||||
|
|
||||||
|
[DllImport(LibObjCImport)]
|
||||||
|
private static extern void objc_msgSend(IntPtr receiver, Selector selector, IntPtr value);
|
||||||
|
|
||||||
|
[DllImport(LibObjCImport)]
|
||||||
|
private static extern void objc_msgSend(IntPtr receiver, Selector selector, NSRect point);
|
||||||
|
|
||||||
|
[DllImport(LibObjCImport)]
|
||||||
|
private static extern void objc_msgSend(IntPtr receiver, Selector selector, double value);
|
||||||
|
|
||||||
|
[DllImport(LibObjCImport, EntryPoint = "objc_msgSend")]
|
||||||
|
private static extern IntPtr IntPtr_objc_msgSend(IntPtr receiver, Selector selector);
|
||||||
|
|
||||||
|
[DllImport("libgdk-3.0.dylib")]
|
||||||
|
private static extern IntPtr gdk_quartz_window_get_nsview(IntPtr gdkWindow);
|
||||||
|
}
|
||||||
|
}
|
@@ -9,46 +9,56 @@ namespace Ryujinx.Ui.Helper
|
|||||||
{
|
{
|
||||||
string aValue = model.GetValue(a, 5).ToString();
|
string aValue = model.GetValue(a, 5).ToString();
|
||||||
string bValue = model.GetValue(b, 5).ToString();
|
string bValue = model.GetValue(b, 5).ToString();
|
||||||
|
float aFloat;
|
||||||
|
float bFloat;
|
||||||
|
|
||||||
if (aValue.Length > 4 && aValue[^4..] == "mins")
|
if (aValue.Length > 7 && aValue[^7..] == "minutes")
|
||||||
{
|
{
|
||||||
aValue = (float.Parse(aValue[0..^5]) * 60).ToString();
|
aValue = aValue.Replace("minutes", "");
|
||||||
|
aFloat = (float.Parse(aValue) * 60);
|
||||||
}
|
}
|
||||||
else if (aValue.Length > 3 && aValue[^3..] == "hrs")
|
else if (aValue.Length > 5 && aValue[^5..] == "hours")
|
||||||
{
|
{
|
||||||
aValue = (float.Parse(aValue[0..^4]) * 3600).ToString();
|
aValue = aValue.Replace("hours", "");
|
||||||
|
aFloat = (float.Parse(aValue) * 3600);
|
||||||
}
|
}
|
||||||
else if (aValue.Length > 4 && aValue[^4..] == "days")
|
else if (aValue.Length > 4 && aValue[^4..] == "days")
|
||||||
{
|
{
|
||||||
aValue = (float.Parse(aValue[0..^5]) * 86400).ToString();
|
aValue = aValue.Replace("days", "");
|
||||||
|
aFloat = (float.Parse(aValue) * 86400);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aValue = aValue[0..^1];
|
aValue = aValue.Replace("seconds", "");
|
||||||
|
aFloat = float.Parse(aValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bValue.Length > 4 && bValue[^4..] == "mins")
|
if (bValue.Length > 7 && bValue[^7..] == "minutes")
|
||||||
{
|
{
|
||||||
bValue = (float.Parse(bValue[0..^5]) * 60).ToString();
|
bValue = bValue.Replace("minutes", "");
|
||||||
|
bFloat = (float.Parse(bValue) * 60);
|
||||||
}
|
}
|
||||||
else if (bValue.Length > 3 && bValue[^3..] == "hrs")
|
else if (bValue.Length > 5 && bValue[^5..] == "hours")
|
||||||
{
|
{
|
||||||
bValue = (float.Parse(bValue[0..^4]) * 3600).ToString();
|
bValue = bValue.Replace("hours", "");
|
||||||
|
bFloat = (float.Parse(bValue) * 3600);
|
||||||
}
|
}
|
||||||
else if (bValue.Length > 4 && bValue[^4..] == "days")
|
else if (bValue.Length > 4 && bValue[^4..] == "days")
|
||||||
{
|
{
|
||||||
bValue = (float.Parse(bValue[0..^5]) * 86400).ToString();
|
bValue = bValue.Replace("days", "");
|
||||||
|
bFloat = (float.Parse(bValue) * 86400);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bValue = bValue[0..^1];
|
bValue = bValue[0..^8];
|
||||||
|
bFloat = float.Parse(bValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (float.Parse(aValue) > float.Parse(bValue))
|
if (aFloat > bFloat)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else if (float.Parse(bValue) > float.Parse(aValue))
|
else if (bFloat > aFloat)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@@ -142,7 +142,7 @@ namespace Ryujinx.Ui
|
|||||||
|
|
||||||
public MainWindow() : this(new Builder("Ryujinx.Ui.MainWindow.glade")) { }
|
public MainWindow() : this(new Builder("Ryujinx.Ui.MainWindow.glade")) { }
|
||||||
|
|
||||||
private MainWindow(Builder builder) : base(builder.GetObject("_mainWin").Handle)
|
private MainWindow(Builder builder) : base(builder.GetRawOwnedObject("_mainWin"))
|
||||||
{
|
{
|
||||||
builder.Autoconnect(this);
|
builder.Autoconnect(this);
|
||||||
|
|
||||||
@@ -846,9 +846,7 @@ namespace Ryujinx.Ui
|
|||||||
_deviceExitStatus.Reset();
|
_deviceExitStatus.Reset();
|
||||||
|
|
||||||
Translator.IsReadyForTranslation.Reset();
|
Translator.IsReadyForTranslation.Reset();
|
||||||
#if MACOS_BUILD
|
|
||||||
CreateGameWindow();
|
|
||||||
#else
|
|
||||||
Thread windowThread = new Thread(() =>
|
Thread windowThread = new Thread(() =>
|
||||||
{
|
{
|
||||||
CreateGameWindow();
|
CreateGameWindow();
|
||||||
@@ -858,7 +856,6 @@ namespace Ryujinx.Ui
|
|||||||
};
|
};
|
||||||
|
|
||||||
windowThread.Start();
|
windowThread.Start();
|
||||||
#endif
|
|
||||||
|
|
||||||
_gameLoaded = true;
|
_gameLoaded = true;
|
||||||
_actionMenu.Sensitive = true;
|
_actionMenu.Sensitive = true;
|
||||||
|
@@ -1,9 +1,11 @@
|
|||||||
using Gdk;
|
using Gdk;
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
using Ryujinx.Input.HLE;
|
using Ryujinx.Input.HLE;
|
||||||
|
using Ryujinx.Ui.Helper;
|
||||||
using SPB.Graphics.Vulkan;
|
using SPB.Graphics.Vulkan;
|
||||||
using SPB.Platform.Win32;
|
using SPB.Platform.Win32;
|
||||||
using SPB.Platform.X11;
|
using SPB.Platform.X11;
|
||||||
|
using SPB.Platform.Metal;
|
||||||
using SPB.Windowing;
|
using SPB.Windowing;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
@@ -13,6 +15,7 @@ namespace Ryujinx.Ui
|
|||||||
public class VKRenderer : RendererWidgetBase
|
public class VKRenderer : RendererWidgetBase
|
||||||
{
|
{
|
||||||
public NativeWindowBase NativeWindow { get; private set; }
|
public NativeWindowBase NativeWindow { get; private set; }
|
||||||
|
private UpdateBoundsCallbackDelegate _updateBoundsCallback;
|
||||||
|
|
||||||
public VKRenderer(InputManager inputManager, GraphicsDebugLevel glLogLevel) : base(inputManager, glLogLevel) { }
|
public VKRenderer(InputManager inputManager, GraphicsDebugLevel glLogLevel) : base(inputManager, glLogLevel) { }
|
||||||
|
|
||||||
@@ -31,6 +34,12 @@ namespace Ryujinx.Ui
|
|||||||
|
|
||||||
return new SimpleX11Window(new NativeHandle(displayHandle), new NativeHandle(windowHandle));
|
return new SimpleX11Window(new NativeHandle(displayHandle), new NativeHandle(windowHandle));
|
||||||
}
|
}
|
||||||
|
else if (OperatingSystem.IsMacOS())
|
||||||
|
{
|
||||||
|
IntPtr metalLayer = MetalHelper.GetMetalLayer(Display, Window, out IntPtr nsView, out _updateBoundsCallback);
|
||||||
|
|
||||||
|
return new SimpleMetalWindow(new NativeHandle(nsView), new NativeHandle(metalLayer));
|
||||||
|
}
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@@ -53,7 +62,11 @@ namespace Ryujinx.Ui
|
|||||||
WaitEvent.Set();
|
WaitEvent.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.OnConfigureEvent(evnt);
|
bool result = base.OnConfigureEvent(evnt);
|
||||||
|
|
||||||
|
_updateBoundsCallback?.Invoke(Window);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe IntPtr CreateWindowSurface(IntPtr instance)
|
public unsafe IntPtr CreateWindowSurface(IntPtr instance)
|
||||||
|
@@ -18,7 +18,7 @@ namespace Ryujinx.Ui.Widgets
|
|||||||
|
|
||||||
public ProfileDialog() : this(new Builder("Ryujinx.Ui.Widgets.ProfileDialog.glade")) { }
|
public ProfileDialog() : this(new Builder("Ryujinx.Ui.Widgets.ProfileDialog.glade")) { }
|
||||||
|
|
||||||
private ProfileDialog(Builder builder) : base(builder.GetObject("_profileDialog").Handle)
|
private ProfileDialog(Builder builder) : base(builder.GetRawOwnedObject("_profileDialog"))
|
||||||
{
|
{
|
||||||
builder.Autoconnect(this);
|
builder.Autoconnect(this);
|
||||||
Icon = new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Logo_Ryujinx.png");
|
Icon = new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Logo_Ryujinx.png");
|
||||||
|
@@ -46,7 +46,7 @@ namespace Ryujinx.Ui.Windows
|
|||||||
SetDefaultSize(740, 400);
|
SetDefaultSize(740, 400);
|
||||||
SetPosition(WindowPosition.Center);
|
SetPosition(WindowPosition.Center);
|
||||||
|
|
||||||
VBox vbox = new VBox(false, 0);
|
Box vbox = new(Orientation.Vertical, 0);
|
||||||
Add(vbox);
|
Add(vbox);
|
||||||
|
|
||||||
ScrolledWindow scrolledWindow = new ScrolledWindow
|
ScrolledWindow scrolledWindow = new ScrolledWindow
|
||||||
@@ -55,7 +55,7 @@ namespace Ryujinx.Ui.Windows
|
|||||||
};
|
};
|
||||||
scrolledWindow.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
|
scrolledWindow.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
|
||||||
|
|
||||||
HBox hbox = new HBox(false, 0);
|
Box hbox = new(Orientation.Horizontal, 0);
|
||||||
|
|
||||||
Button chooseButton = new Button()
|
Button chooseButton = new Button()
|
||||||
{
|
{
|
||||||
|
@@ -23,7 +23,7 @@ namespace Ryujinx.Ui.Windows
|
|||||||
|
|
||||||
public CheatWindow(VirtualFileSystem virtualFileSystem, ulong titleId, string titleName) : this(new Builder("Ryujinx.Ui.Windows.CheatWindow.glade"), virtualFileSystem, titleId, titleName) { }
|
public CheatWindow(VirtualFileSystem virtualFileSystem, ulong titleId, string titleName) : this(new Builder("Ryujinx.Ui.Windows.CheatWindow.glade"), virtualFileSystem, titleId, titleName) { }
|
||||||
|
|
||||||
private CheatWindow(Builder builder, VirtualFileSystem virtualFileSystem, ulong titleId, string titleName) : base(builder.GetObject("_cheatWindow").Handle)
|
private CheatWindow(Builder builder, VirtualFileSystem virtualFileSystem, ulong titleId, string titleName) : base(builder.GetRawOwnedObject("_cheatWindow"))
|
||||||
{
|
{
|
||||||
builder.Autoconnect(this);
|
builder.Autoconnect(this);
|
||||||
_baseTitleInfoLabel.Text = $"Cheats Available for {titleName} [{titleId:X16}]";
|
_baseTitleInfoLabel.Text = $"Cheats Available for {titleName} [{titleId:X16}]";
|
||||||
|
@@ -119,7 +119,7 @@ namespace Ryujinx.Ui.Windows
|
|||||||
|
|
||||||
public ControllerWindow(MainWindow mainWindow, PlayerIndex controllerId) : this(mainWindow, new Builder("Ryujinx.Ui.Windows.ControllerWindow.glade"), controllerId) { }
|
public ControllerWindow(MainWindow mainWindow, PlayerIndex controllerId) : this(mainWindow, new Builder("Ryujinx.Ui.Windows.ControllerWindow.glade"), controllerId) { }
|
||||||
|
|
||||||
private ControllerWindow(MainWindow mainWindow, Builder builder, PlayerIndex controllerId) : base(builder.GetObject("_controllerWin").Handle)
|
private ControllerWindow(MainWindow mainWindow, Builder builder, PlayerIndex controllerId) : base(builder.GetRawOwnedObject("_controllerWin"))
|
||||||
{
|
{
|
||||||
_mainWindow = mainWindow;
|
_mainWindow = mainWindow;
|
||||||
_selectedGamepad = null;
|
_selectedGamepad = null;
|
||||||
@@ -379,13 +379,16 @@ namespace Ryujinx.Ui.Windows
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_controllerImage.Pixbuf = _controllerType.ActiveId switch
|
if (!OperatingSystem.IsMacOS())
|
||||||
{
|
{
|
||||||
"ProController" => new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Controller_ProCon.svg", 400, 400),
|
_controllerImage.Pixbuf = _controllerType.ActiveId switch
|
||||||
"JoyconLeft" => new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Controller_JoyConLeft.svg", 400, 500),
|
{
|
||||||
"JoyconRight" => new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Controller_JoyConRight.svg", 400, 500),
|
"ProController" => new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Controller_ProCon.svg", 400, 400),
|
||||||
_ => new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Controller_JoyConPair.svg", 400, 500),
|
"JoyconLeft" => new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Controller_JoyConLeft.svg", 400, 500),
|
||||||
};
|
"JoyconRight" => new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Controller_JoyConRight.svg", 400, 500),
|
||||||
|
_ => new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Controller_JoyConPair.svg", 400, 500),
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClearValues()
|
private void ClearValues()
|
||||||
|
@@ -34,7 +34,7 @@ namespace Ryujinx.Ui.Windows
|
|||||||
|
|
||||||
public DlcWindow(VirtualFileSystem virtualFileSystem, string titleId, string titleName) : this(new Builder("Ryujinx.Ui.Windows.DlcWindow.glade"), virtualFileSystem, titleId, titleName) { }
|
public DlcWindow(VirtualFileSystem virtualFileSystem, string titleId, string titleName) : this(new Builder("Ryujinx.Ui.Windows.DlcWindow.glade"), virtualFileSystem, titleId, titleName) { }
|
||||||
|
|
||||||
private DlcWindow(Builder builder, VirtualFileSystem virtualFileSystem, string titleId, string titleName) : base(builder.GetObject("_dlcWindow").Handle)
|
private DlcWindow(Builder builder, VirtualFileSystem virtualFileSystem, string titleId, string titleName) : base(builder.GetRawOwnedObject("_dlcWindow"))
|
||||||
{
|
{
|
||||||
builder.Autoconnect(this);
|
builder.Autoconnect(this);
|
||||||
|
|
||||||
|
@@ -113,7 +113,7 @@ namespace Ryujinx.Ui.Windows
|
|||||||
|
|
||||||
public SettingsWindow(MainWindow parent, VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this(parent, new Builder("Ryujinx.Ui.Windows.SettingsWindow.glade"), virtualFileSystem, contentManager) { }
|
public SettingsWindow(MainWindow parent, VirtualFileSystem virtualFileSystem, ContentManager contentManager) : this(parent, new Builder("Ryujinx.Ui.Windows.SettingsWindow.glade"), virtualFileSystem, contentManager) { }
|
||||||
|
|
||||||
private SettingsWindow(MainWindow parent, Builder builder, VirtualFileSystem virtualFileSystem, ContentManager contentManager) : base(builder.GetObject("_settingsWin").Handle)
|
private SettingsWindow(MainWindow parent, Builder builder, VirtualFileSystem virtualFileSystem, ContentManager contentManager) : base(builder.GetRawOwnedObject("_settingsWin"))
|
||||||
{
|
{
|
||||||
Icon = new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Logo_Ryujinx.png");
|
Icon = new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Logo_Ryujinx.png");
|
||||||
|
|
||||||
@@ -422,7 +422,7 @@ namespace Ryujinx.Ui.Windows
|
|||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
openAlIsSupported = OpenALHardwareDeviceDriver.IsSupported;
|
openAlIsSupported = OpenALHardwareDeviceDriver.IsSupported;
|
||||||
soundIoIsSupported = SoundIoHardwareDeviceDriver.IsSupported;
|
soundIoIsSupported = !OperatingSystem.IsMacOS() && SoundIoHardwareDeviceDriver.IsSupported;
|
||||||
sdl2IsSupported = SDL2HardwareDeviceDriver.IsSupported;
|
sdl2IsSupported = SDL2HardwareDeviceDriver.IsSupported;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -438,6 +438,15 @@ namespace Ryujinx.Ui.Windows
|
|||||||
_ => throw new ArgumentOutOfRangeException()
|
_ => throw new ArgumentOutOfRangeException()
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (OperatingSystem.IsMacOS())
|
||||||
|
{
|
||||||
|
var store = (_graphicsBackend.Model as ListStore);
|
||||||
|
store.GetIter(out TreeIter openglIter, new TreePath(new int[] {1}));
|
||||||
|
store.Remove(ref openglIter);
|
||||||
|
|
||||||
|
_graphicsBackend.Model = store;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdatePreferredGpuComboBox()
|
private void UpdatePreferredGpuComboBox()
|
||||||
|
@@ -40,7 +40,7 @@ namespace Ryujinx.Ui.Windows
|
|||||||
|
|
||||||
public TitleUpdateWindow(MainWindow parent, VirtualFileSystem virtualFileSystem, string titleId, string titleName) : this(new Builder("Ryujinx.Ui.Windows.TitleUpdateWindow.glade"), parent, virtualFileSystem, titleId, titleName) { }
|
public TitleUpdateWindow(MainWindow parent, VirtualFileSystem virtualFileSystem, string titleId, string titleName) : this(new Builder("Ryujinx.Ui.Windows.TitleUpdateWindow.glade"), parent, virtualFileSystem, titleId, titleName) { }
|
||||||
|
|
||||||
private TitleUpdateWindow(Builder builder, MainWindow parent, VirtualFileSystem virtualFileSystem, string titleId, string titleName) : base(builder.GetObject("_titleUpdateWindow").Handle)
|
private TitleUpdateWindow(Builder builder, MainWindow parent, VirtualFileSystem virtualFileSystem, string titleId, string titleName) : base(builder.GetRawOwnedObject("_titleUpdateWindow"))
|
||||||
{
|
{
|
||||||
_parent = parent;
|
_parent = parent;
|
||||||
|
|
||||||
|
@@ -52,7 +52,8 @@ namespace Ryujinx.Ui.Windows
|
|||||||
_selectedLabel = new Label("Selected User Profile:")
|
_selectedLabel = new Label("Selected User Profile:")
|
||||||
{
|
{
|
||||||
Margin = 15,
|
Margin = 15,
|
||||||
Attributes = new AttrList()
|
Attributes = new AttrList(),
|
||||||
|
Halign = Align.Start
|
||||||
};
|
};
|
||||||
_selectedLabel.Attributes.Insert(new Pango.AttrWeight(Weight.Bold));
|
_selectedLabel.Attributes.Insert(new Pango.AttrWeight(Weight.Bold));
|
||||||
|
|
||||||
@@ -136,7 +137,8 @@ namespace Ryujinx.Ui.Windows
|
|||||||
_availableUsersLabel = new Label("Available User Profiles:")
|
_availableUsersLabel = new Label("Available User Profiles:")
|
||||||
{
|
{
|
||||||
Margin = 15,
|
Margin = 15,
|
||||||
Attributes = new AttrList()
|
Attributes = new AttrList(),
|
||||||
|
Halign = Align.Start
|
||||||
};
|
};
|
||||||
_availableUsersLabel.Attributes.Insert(new Pango.AttrWeight(Weight.Bold));
|
_availableUsersLabel.Attributes.Insert(new Pango.AttrWeight(Weight.Bold));
|
||||||
|
|
||||||
@@ -226,10 +228,9 @@ namespace Ryujinx.Ui.Windows
|
|||||||
_usersTreeViewWindow.Add(_usersTreeView);
|
_usersTreeViewWindow.Add(_usersTreeView);
|
||||||
|
|
||||||
_usersTreeViewBox.Add(_usersTreeViewWindow);
|
_usersTreeViewBox.Add(_usersTreeViewWindow);
|
||||||
|
_bottomBox.PackStart(_addButton, false, false, 0);
|
||||||
_bottomBox.PackStart(new Gtk.Alignment(-1, 0, 0, 0) { _addButton }, false, false, 0);
|
_bottomBox.PackStart(_deleteButton, false, false, 0);
|
||||||
_bottomBox.PackStart(new Gtk.Alignment(-1, 0, 0, 0) { _deleteButton }, false, false, 0);
|
_bottomBox.PackEnd(_closeButton, false, false, 0);
|
||||||
_bottomBox.PackEnd(new Gtk.Alignment(1, 0, 0, 0) { _closeButton }, false, false, 0);
|
|
||||||
|
|
||||||
_selectedUserInfoBox.Add(_selectedUserNameEntry);
|
_selectedUserInfoBox.Add(_selectedUserNameEntry);
|
||||||
_selectedUserInfoBox.Add(_selectedUserIdLabel);
|
_selectedUserInfoBox.Add(_selectedUserIdLabel);
|
||||||
@@ -238,12 +239,12 @@ namespace Ryujinx.Ui.Windows
|
|||||||
_selectedUserButtonsBox.Add(_changeProfileImageButton);
|
_selectedUserButtonsBox.Add(_changeProfileImageButton);
|
||||||
|
|
||||||
_selectedUserBox.Add(_selectedUserImage);
|
_selectedUserBox.Add(_selectedUserImage);
|
||||||
_selectedUserBox.PackStart(new Gtk.Alignment(-1, 0, 0, 0) { _selectedUserInfoBox }, true, true, 0);
|
_selectedUserBox.PackStart(_selectedUserInfoBox, false, false, 0);
|
||||||
_selectedUserBox.Add(_selectedUserButtonsBox);
|
_selectedUserBox.PackEnd(_selectedUserButtonsBox, false, false, 0);
|
||||||
|
|
||||||
_mainBox.PackStart(new Gtk.Alignment(-1, 0, 0, 0) { _selectedLabel }, false, false, 0);
|
_mainBox.PackStart(_selectedLabel, false, false, 0);
|
||||||
_mainBox.PackStart(_selectedUserBox, false, true, 0);
|
_mainBox.PackStart(_selectedUserBox, false, true, 0);
|
||||||
_mainBox.PackStart(new Gtk.Alignment(-1, 0, 0, 0) { _availableUsersLabel }, false, false, 0);
|
_mainBox.PackStart(_availableUsersLabel, false, false, 0);
|
||||||
_mainBox.Add(_usersTreeViewBox);
|
_mainBox.Add(_usersTreeViewBox);
|
||||||
_mainBox.Add(_bottomBox);
|
_mainBox.Add(_bottomBox);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user