mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2026-04-21 09:31:56 +00:00
Merge branch ryujinx:master into master
This commit is contained in:
commit
9beb4efb56
58 changed files with 410 additions and 443 deletions
|
|
@ -10,7 +10,7 @@ Make sure your SDK version is higher or equal to the required version specified
|
||||||
|
|
||||||
### Step 2
|
### Step 2
|
||||||
|
|
||||||
Either use `git clone https://github.com/Ryubing/Ryujinx` on the command line to clone the repository or use Code --> Download zip button to get the files.
|
Either use `git clone https://git.ryujinx.app/ryubing/ryujinx.git` on the command line to clone the repository or use Code --> Download zip button to get the files.
|
||||||
|
|
||||||
### Step 3
|
### Step 3
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6454,7 +6454,7 @@
|
||||||
"he_IL": "",
|
"he_IL": "",
|
||||||
"it_IT": "Voglio ripristinare le mie impostazioni.",
|
"it_IT": "Voglio ripristinare le mie impostazioni.",
|
||||||
"ja_JP": "",
|
"ja_JP": "",
|
||||||
"ko_KR": "설정을 초기화하고 싶습니다.",
|
"ko_KR": "설정을 초기화하고자 합니다.",
|
||||||
"no_NO": "Jeg vil tilbakestille innstillingene mine.",
|
"no_NO": "Jeg vil tilbakestille innstillingene mine.",
|
||||||
"pl_PL": "",
|
"pl_PL": "",
|
||||||
"pt_BR": "Quero redefinir minhas configurações.",
|
"pt_BR": "Quero redefinir minhas configurações.",
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ namespace Ryujinx.Common.Logging.Targets
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
using var signal = new ManualResetEventSlim(false);
|
using ManualResetEventSlim signal = new ManualResetEventSlim(false);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_messageQueue.Add(new FlushEventArgs(signal));
|
_messageQueue.Add(new FlushEventArgs(signal));
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,11 @@ namespace Ryujinx.Cpu
|
||||||
/// </summary>
|
/// </summary>
|
||||||
uint Fpsr { get; set; }
|
uint Fpsr { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Floating-point Status and Control Register.
|
||||||
|
/// </summary>
|
||||||
|
uint Fpscr => Fpsr | Fpcr;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates whenever the CPU is running 64-bit (AArch64 mode) or 32-bit (AArch32 mode) code.
|
/// Indicates whenever the CPU is running 64-bit (AArch64 mode) or 32-bit (AArch32 mode) code.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||||
GpuChannelComputeState computeState,
|
GpuChannelComputeState computeState,
|
||||||
ulong gpuVa)
|
ulong gpuVa)
|
||||||
{
|
{
|
||||||
if (_cpPrograms.TryGetValue(gpuVa, out var cpShader) && IsShaderEqual(channel, poolState, computeState, cpShader, gpuVa))
|
if (_cpPrograms.TryGetValue(gpuVa, out CachedShaderProgram cpShader) && IsShaderEqual(channel, poolState, computeState, cpShader, gpuVa))
|
||||||
{
|
{
|
||||||
return cpShader;
|
return cpShader;
|
||||||
}
|
}
|
||||||
|
|
@ -252,8 +252,8 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||||
{
|
{
|
||||||
channel.TextureManager.UpdateRenderTargets();
|
channel.TextureManager.UpdateRenderTargets();
|
||||||
|
|
||||||
var rtControl = state.RtControl;
|
RtControl rtControl = state.RtControl;
|
||||||
var msaaMode = state.RtMsaaMode;
|
TextureMsaaMode msaaMode = state.RtMsaaMode;
|
||||||
|
|
||||||
pipeline.SamplesCount = msaaMode.SamplesInX() * msaaMode.SamplesInY();
|
pipeline.SamplesCount = msaaMode.SamplesInX() * msaaMode.SamplesInY();
|
||||||
|
|
||||||
|
|
@ -267,7 +267,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||||
{
|
{
|
||||||
int rtIndex = rtControl.UnpackPermutationIndex(index);
|
int rtIndex = rtControl.UnpackPermutationIndex(index);
|
||||||
|
|
||||||
var colorState = rtColorStateSpan[rtIndex];
|
RtColorState colorState = rtColorStateSpan[rtIndex];
|
||||||
|
|
||||||
if (index >= count || colorState.Format == 0 || colorState.WidthOrStride == 0)
|
if (index >= count || colorState.Format == 0 || colorState.WidthOrStride == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -312,12 +312,12 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||||
ref GpuChannelGraphicsState graphicsState,
|
ref GpuChannelGraphicsState graphicsState,
|
||||||
ShaderAddresses addresses)
|
ShaderAddresses addresses)
|
||||||
{
|
{
|
||||||
if (_gpPrograms.TryGetValue(addresses, out var gpShaders) && IsShaderEqual(channel, ref poolState, ref graphicsState, gpShaders, addresses))
|
if (_gpPrograms.TryGetValue(addresses, out CachedShaderProgram gpShaders) && IsShaderEqual(channel, ref poolState, ref graphicsState, gpShaders, addresses))
|
||||||
{
|
{
|
||||||
return gpShaders;
|
return gpShaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_graphicsShaderCache.TryFind(channel, ref poolState, ref graphicsState, addresses, out gpShaders, out var cachedGuestCode))
|
if (_graphicsShaderCache.TryFind(channel, ref poolState, ref graphicsState, addresses, out gpShaders, out CachedGraphicsGuestCode cachedGuestCode))
|
||||||
{
|
{
|
||||||
_gpPrograms[addresses] = gpShaders;
|
_gpPrograms[addresses] = gpShaders;
|
||||||
return gpShaders;
|
return gpShaders;
|
||||||
|
|
@ -590,7 +590,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||||
|
|
||||||
for (int i = 0; i < Constants.TotalTransformFeedbackBuffers; i++)
|
for (int i = 0; i < Constants.TotalTransformFeedbackBuffers; i++)
|
||||||
{
|
{
|
||||||
var tf = tfStateSpan[i];
|
TfState tf = tfStateSpan[i];
|
||||||
|
|
||||||
descs[i] = new TransformFeedbackDescriptor(
|
descs[i] = new TransformFeedbackDescriptor(
|
||||||
tf.BufferIndex,
|
tf.BufferIndex,
|
||||||
|
|
@ -696,7 +696,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||||
/// <returns>The generated translator context</returns>
|
/// <returns>The generated translator context</returns>
|
||||||
public static TranslatorContext DecodeComputeShader(IGpuAccessor gpuAccessor, TargetApi api, ulong gpuVa)
|
public static TranslatorContext DecodeComputeShader(IGpuAccessor gpuAccessor, TargetApi api, ulong gpuVa)
|
||||||
{
|
{
|
||||||
var options = CreateTranslationOptions(api, DefaultFlags | TranslationFlags.Compute);
|
TranslationOptions options = CreateTranslationOptions(api, DefaultFlags | TranslationFlags.Compute);
|
||||||
return Translator.CreateContext(gpuVa, gpuAccessor, options);
|
return Translator.CreateContext(gpuVa, gpuAccessor, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -713,7 +713,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||||
/// <returns>The generated translator context</returns>
|
/// <returns>The generated translator context</returns>
|
||||||
public static TranslatorContext DecodeGraphicsShader(IGpuAccessor gpuAccessor, TargetApi api, TranslationFlags flags, ulong gpuVa)
|
public static TranslatorContext DecodeGraphicsShader(IGpuAccessor gpuAccessor, TargetApi api, TranslationFlags flags, ulong gpuVa)
|
||||||
{
|
{
|
||||||
var options = CreateTranslationOptions(api, flags);
|
TranslationOptions options = CreateTranslationOptions(api, flags);
|
||||||
return Translator.CreateContext(gpuVa, gpuAccessor, options);
|
return Translator.CreateContext(gpuVa, gpuAccessor, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -739,7 +739,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||||
{
|
{
|
||||||
ulong cb1DataAddress = channel.BufferManager.GetGraphicsUniformBufferAddress(0, 1);
|
ulong cb1DataAddress = channel.BufferManager.GetGraphicsUniformBufferAddress(0, 1);
|
||||||
|
|
||||||
var memoryManager = channel.MemoryManager;
|
MemoryManager memoryManager = channel.MemoryManager;
|
||||||
|
|
||||||
codeA ??= memoryManager.GetSpan(vertexA.Address, vertexA.Size).ToArray();
|
codeA ??= memoryManager.GetSpan(vertexA.Address, vertexA.Size).ToArray();
|
||||||
codeB ??= memoryManager.GetSpan(currentStage.Address, currentStage.Size).ToArray();
|
codeB ??= memoryManager.GetSpan(currentStage.Address, currentStage.Size).ToArray();
|
||||||
|
|
@ -777,7 +777,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||||
/// <returns>Compiled graphics shader code</returns>
|
/// <returns>Compiled graphics shader code</returns>
|
||||||
private static TranslatedShader TranslateShader(ShaderDumper dumper, GpuChannel channel, TranslatorContext context, byte[] code, bool asCompute)
|
private static TranslatedShader TranslateShader(ShaderDumper dumper, GpuChannel channel, TranslatorContext context, byte[] code, bool asCompute)
|
||||||
{
|
{
|
||||||
var memoryManager = channel.MemoryManager;
|
MemoryManager memoryManager = channel.MemoryManager;
|
||||||
|
|
||||||
ulong cb1DataAddress = context.Stage == ShaderStage.Compute
|
ulong cb1DataAddress = context.Stage == ShaderStage.Compute
|
||||||
? channel.BufferManager.GetComputeUniformBufferAddress(1)
|
? channel.BufferManager.GetComputeUniformBufferAddress(1)
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
size = DefaultLocalMemorySize;
|
size = DefaultLocalMemorySize;
|
||||||
}
|
}
|
||||||
|
|
||||||
var lmem = new MemoryDefinition("local_memory", AggregateType.Array | AggregateType.U32, BitUtils.DivRoundUp(size, sizeof(uint)));
|
MemoryDefinition lmem = new MemoryDefinition("local_memory", AggregateType.Array | AggregateType.U32, BitUtils.DivRoundUp(size, sizeof(uint)));
|
||||||
|
|
||||||
LocalMemoryId = Properties.AddLocalMemory(lmem);
|
LocalMemoryId = Properties.AddLocalMemory(lmem);
|
||||||
}
|
}
|
||||||
|
|
@ -112,7 +112,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
size = DefaultSharedMemorySize;
|
size = DefaultSharedMemorySize;
|
||||||
}
|
}
|
||||||
|
|
||||||
var smem = new MemoryDefinition("shared_memory", AggregateType.Array | AggregateType.U32, BitUtils.DivRoundUp(size, sizeof(uint)));
|
MemoryDefinition smem = new MemoryDefinition("shared_memory", AggregateType.Array | AggregateType.U32, BitUtils.DivRoundUp(size, sizeof(uint)));
|
||||||
|
|
||||||
SharedMemoryId = Properties.AddSharedMemory(smem);
|
SharedMemoryId = Properties.AddSharedMemory(smem);
|
||||||
}
|
}
|
||||||
|
|
@ -273,16 +273,16 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
bool coherent,
|
bool coherent,
|
||||||
bool separate)
|
bool separate)
|
||||||
{
|
{
|
||||||
var dimensions = type == SamplerType.None ? 0 : type.GetDimensions();
|
int dimensions = type == SamplerType.None ? 0 : type.GetDimensions();
|
||||||
var dict = isImage ? _usedImages : _usedTextures;
|
Dictionary<TextureInfo, TextureMeta> dict = isImage ? _usedImages : _usedTextures;
|
||||||
|
|
||||||
var usageFlags = TextureUsageFlags.None;
|
TextureUsageFlags usageFlags = TextureUsageFlags.None;
|
||||||
|
|
||||||
if (intCoords)
|
if (intCoords)
|
||||||
{
|
{
|
||||||
usageFlags |= TextureUsageFlags.NeedsScaleValue;
|
usageFlags |= TextureUsageFlags.NeedsScaleValue;
|
||||||
|
|
||||||
var canScale = _stage.SupportsRenderScale() && arrayLength == 1 && !write && dimensions == 2;
|
bool canScale = _stage.SupportsRenderScale() && arrayLength == 1 && !write && dimensions == 2;
|
||||||
|
|
||||||
if (!canScale)
|
if (!canScale)
|
||||||
{
|
{
|
||||||
|
|
@ -304,9 +304,9 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
|
|
||||||
// For array textures, we also want to use type as key,
|
// For array textures, we also want to use type as key,
|
||||||
// since we may have texture handles stores in the same buffer, but for textures with different types.
|
// since we may have texture handles stores in the same buffer, but for textures with different types.
|
||||||
var keyType = arrayLength > 1 ? type : SamplerType.None;
|
SamplerType keyType = arrayLength > 1 ? type : SamplerType.None;
|
||||||
var info = new TextureInfo(cbufSlot, handle, arrayLength, separate, keyType, format);
|
TextureInfo info = new TextureInfo(cbufSlot, handle, arrayLength, separate, keyType, format);
|
||||||
var meta = new TextureMeta()
|
TextureMeta meta = new TextureMeta()
|
||||||
{
|
{
|
||||||
AccurateType = accurateType,
|
AccurateType = accurateType,
|
||||||
Type = type,
|
Type = type,
|
||||||
|
|
@ -316,7 +316,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
int setIndex;
|
int setIndex;
|
||||||
int binding;
|
int binding;
|
||||||
|
|
||||||
if (dict.TryGetValue(info, out var existingMeta))
|
if (dict.TryGetValue(info, out TextureMeta existingMeta))
|
||||||
{
|
{
|
||||||
dict[info] = MergeTextureMeta(meta, existingMeta);
|
dict[info] = MergeTextureMeta(meta, existingMeta);
|
||||||
setIndex = existingMeta.Set;
|
setIndex = existingMeta.Set;
|
||||||
|
|
@ -373,7 +373,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
nameSuffix = cbufSlot < 0 ? $"{prefix}_tcb_{handle:X}" : $"{prefix}_cb{cbufSlot}_{handle:X}";
|
nameSuffix = cbufSlot < 0 ? $"{prefix}_tcb_{handle:X}" : $"{prefix}_cb{cbufSlot}_{handle:X}";
|
||||||
}
|
}
|
||||||
|
|
||||||
var definition = new TextureDefinition(
|
TextureDefinition definition = new TextureDefinition(
|
||||||
setIndex,
|
setIndex,
|
||||||
binding,
|
binding,
|
||||||
arrayLength,
|
arrayLength,
|
||||||
|
|
@ -433,8 +433,8 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
{
|
{
|
||||||
selectedMeta.UsageFlags |= TextureUsageFlags.NeedsScaleValue;
|
selectedMeta.UsageFlags |= TextureUsageFlags.NeedsScaleValue;
|
||||||
|
|
||||||
var dimensions = type.GetDimensions();
|
int dimensions = type.GetDimensions();
|
||||||
var canScale = _stage.SupportsRenderScale() && selectedInfo.ArrayLength == 1 && dimensions == 2;
|
bool canScale = _stage.SupportsRenderScale() && selectedInfo.ArrayLength == 1 && dimensions == 2;
|
||||||
|
|
||||||
if (!canScale)
|
if (!canScale)
|
||||||
{
|
{
|
||||||
|
|
@ -454,7 +454,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
|
|
||||||
public BufferDescriptor[] GetConstantBufferDescriptors()
|
public BufferDescriptor[] GetConstantBufferDescriptors()
|
||||||
{
|
{
|
||||||
var descriptors = new BufferDescriptor[_usedConstantBufferBindings.Count];
|
BufferDescriptor[] descriptors = new BufferDescriptor[_usedConstantBufferBindings.Count];
|
||||||
|
|
||||||
int descriptorIndex = 0;
|
int descriptorIndex = 0;
|
||||||
|
|
||||||
|
|
@ -478,7 +478,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
|
|
||||||
public BufferDescriptor[] GetStorageBufferDescriptors()
|
public BufferDescriptor[] GetStorageBufferDescriptors()
|
||||||
{
|
{
|
||||||
var descriptors = new BufferDescriptor[_sbSlots.Count];
|
BufferDescriptor[] descriptors = new BufferDescriptor[_sbSlots.Count];
|
||||||
|
|
||||||
int descriptorIndex = 0;
|
int descriptorIndex = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -242,8 +242,8 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
usedFeatures |= FeatureFlags.VtgAsCompute;
|
usedFeatures |= FeatureFlags.VtgAsCompute;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cfgs = new ControlFlowGraph[functions.Length];
|
ControlFlowGraph[] cfgs = new ControlFlowGraph[functions.Length];
|
||||||
var frus = new RegisterUsage.FunctionRegisterUsage[functions.Length];
|
RegisterUsage.FunctionRegisterUsage[] frus = new RegisterUsage.FunctionRegisterUsage[functions.Length];
|
||||||
|
|
||||||
for (int i = 0; i < functions.Length; i++)
|
for (int i = 0; i < functions.Length; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -266,14 +266,14 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
|
|
||||||
for (int i = 0; i < functions.Length; i++)
|
for (int i = 0; i < functions.Length; i++)
|
||||||
{
|
{
|
||||||
var cfg = cfgs[i];
|
ControlFlowGraph cfg = cfgs[i];
|
||||||
|
|
||||||
int inArgumentsCount = 0;
|
int inArgumentsCount = 0;
|
||||||
int outArgumentsCount = 0;
|
int outArgumentsCount = 0;
|
||||||
|
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
var fru = frus[i];
|
RegisterUsage.FunctionRegisterUsage fru = frus[i];
|
||||||
|
|
||||||
inArgumentsCount = fru.InArguments.Length;
|
inArgumentsCount = fru.InArguments.Length;
|
||||||
outArgumentsCount = fru.OutArguments.Length;
|
outArgumentsCount = fru.OutArguments.Length;
|
||||||
|
|
@ -325,7 +325,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
FeatureFlags usedFeatures,
|
FeatureFlags usedFeatures,
|
||||||
byte clipDistancesWritten)
|
byte clipDistancesWritten)
|
||||||
{
|
{
|
||||||
var sInfo = StructuredProgram.MakeStructuredProgram(
|
StructuredProgramInfo sInfo = StructuredProgram.MakeStructuredProgram(
|
||||||
funcs,
|
funcs,
|
||||||
attributeUsage,
|
attributeUsage,
|
||||||
definitions,
|
definitions,
|
||||||
|
|
@ -340,7 +340,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
_ => 1
|
_ => 1
|
||||||
};
|
};
|
||||||
|
|
||||||
var info = new ShaderProgramInfo(
|
ShaderProgramInfo info = new ShaderProgramInfo(
|
||||||
resourceManager.GetConstantBufferDescriptors(),
|
resourceManager.GetConstantBufferDescriptors(),
|
||||||
resourceManager.GetStorageBufferDescriptors(),
|
resourceManager.GetStorageBufferDescriptors(),
|
||||||
resourceManager.GetTextureDescriptors(),
|
resourceManager.GetTextureDescriptors(),
|
||||||
|
|
@ -356,7 +356,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
clipDistancesWritten,
|
clipDistancesWritten,
|
||||||
originalDefinitions.OmapTargets);
|
originalDefinitions.OmapTargets);
|
||||||
|
|
||||||
var hostCapabilities = new HostCapabilities(
|
HostCapabilities hostCapabilities = new HostCapabilities(
|
||||||
GpuAccessor.QueryHostReducedPrecision(),
|
GpuAccessor.QueryHostReducedPrecision(),
|
||||||
GpuAccessor.QueryHostSupportsFragmentShaderInterlock(),
|
GpuAccessor.QueryHostSupportsFragmentShaderInterlock(),
|
||||||
GpuAccessor.QueryHostSupportsFragmentShaderOrderingIntel(),
|
GpuAccessor.QueryHostSupportsFragmentShaderOrderingIntel(),
|
||||||
|
|
@ -367,7 +367,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
GpuAccessor.QueryHostSupportsTextureShadowLod(),
|
GpuAccessor.QueryHostSupportsTextureShadowLod(),
|
||||||
GpuAccessor.QueryHostSupportsViewportMask());
|
GpuAccessor.QueryHostSupportsViewportMask());
|
||||||
|
|
||||||
var parameters = new CodeGenParameters(attributeUsage, definitions, resourceManager.Properties, hostCapabilities, GpuAccessor, Options.TargetApi);
|
CodeGenParameters parameters = new CodeGenParameters(attributeUsage, definitions, resourceManager.Properties, hostCapabilities, GpuAccessor, Options.TargetApi);
|
||||||
|
|
||||||
return Options.TargetLanguage switch
|
return Options.TargetLanguage switch
|
||||||
{
|
{
|
||||||
|
|
@ -486,10 +486,10 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
|
|
||||||
public ShaderProgram GenerateVertexPassthroughForCompute()
|
public ShaderProgram GenerateVertexPassthroughForCompute()
|
||||||
{
|
{
|
||||||
var attributeUsage = new AttributeUsage(GpuAccessor);
|
AttributeUsage attributeUsage = new AttributeUsage(GpuAccessor);
|
||||||
var resourceManager = new ResourceManager(ShaderStage.Vertex, GpuAccessor);
|
ResourceManager resourceManager = new ResourceManager(ShaderStage.Vertex, GpuAccessor);
|
||||||
|
|
||||||
var reservations = GetResourceReservations();
|
ResourceReservations reservations = GetResourceReservations();
|
||||||
|
|
||||||
int vertexInfoCbBinding = reservations.VertexInfoConstantBufferBinding;
|
int vertexInfoCbBinding = reservations.VertexInfoConstantBufferBinding;
|
||||||
|
|
||||||
|
|
@ -508,7 +508,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
BufferDefinition vertexOutputBuffer = new(BufferLayout.Std430, 1, vertexDataSbBinding, "vb_input", vertexInputStruct);
|
BufferDefinition vertexOutputBuffer = new(BufferLayout.Std430, 1, vertexDataSbBinding, "vb_input", vertexInputStruct);
|
||||||
resourceManager.Properties.AddOrUpdateStorageBuffer(vertexOutputBuffer);
|
resourceManager.Properties.AddOrUpdateStorageBuffer(vertexOutputBuffer);
|
||||||
|
|
||||||
var context = new EmitterContext();
|
EmitterContext context = new EmitterContext();
|
||||||
|
|
||||||
Operand vertexIndex = Options.TargetApi == TargetApi.OpenGL
|
Operand vertexIndex = Options.TargetApi == TargetApi.OpenGL
|
||||||
? context.Load(StorageKind.Input, IoVariable.VertexId)
|
? context.Load(StorageKind.Input, IoVariable.VertexId)
|
||||||
|
|
@ -553,13 +553,13 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var operations = context.GetOperations();
|
Operation[] operations = context.GetOperations();
|
||||||
var cfg = ControlFlowGraph.Create(operations);
|
ControlFlowGraph cfg = ControlFlowGraph.Create(operations);
|
||||||
var function = new Function(cfg.Blocks, "main", false, 0, 0);
|
Function function = new Function(cfg.Blocks, "main", false, 0, 0);
|
||||||
|
|
||||||
var transformFeedbackOutputs = GetTransformFeedbackOutputs(GpuAccessor, out ulong transformFeedbackVecMap);
|
TransformFeedbackOutput[] transformFeedbackOutputs = GetTransformFeedbackOutputs(GpuAccessor, out ulong transformFeedbackVecMap);
|
||||||
|
|
||||||
var definitions = new ShaderDefinitions(ShaderStage.Vertex, transformFeedbackVecMap, transformFeedbackOutputs)
|
ShaderDefinitions definitions = new ShaderDefinitions(ShaderStage.Vertex, transformFeedbackVecMap, transformFeedbackOutputs)
|
||||||
{
|
{
|
||||||
LastInVertexPipeline = true
|
LastInVertexPipeline = true
|
||||||
};
|
};
|
||||||
|
|
@ -604,10 +604,10 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var attributeUsage = new AttributeUsage(GpuAccessor);
|
AttributeUsage attributeUsage = new AttributeUsage(GpuAccessor);
|
||||||
var resourceManager = new ResourceManager(ShaderStage.Geometry, GpuAccessor);
|
ResourceManager resourceManager = new ResourceManager(ShaderStage.Geometry, GpuAccessor);
|
||||||
|
|
||||||
var context = new EmitterContext();
|
EmitterContext context = new EmitterContext();
|
||||||
|
|
||||||
for (int v = 0; v < maxOutputVertices; v++)
|
for (int v = 0; v < maxOutputVertices; v++)
|
||||||
{
|
{
|
||||||
|
|
@ -648,11 +648,11 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
|
|
||||||
context.EndPrimitive();
|
context.EndPrimitive();
|
||||||
|
|
||||||
var operations = context.GetOperations();
|
Operation[] operations = context.GetOperations();
|
||||||
var cfg = ControlFlowGraph.Create(operations);
|
ControlFlowGraph cfg = ControlFlowGraph.Create(operations);
|
||||||
var function = new Function(cfg.Blocks, "main", false, 0, 0);
|
Function function = new Function(cfg.Blocks, "main", false, 0, 0);
|
||||||
|
|
||||||
var definitions = new ShaderDefinitions(
|
ShaderDefinitions definitions = new ShaderDefinitions(
|
||||||
ShaderStage.Geometry,
|
ShaderStage.Geometry,
|
||||||
GpuAccessor.QueryGraphicsState(),
|
GpuAccessor.QueryGraphicsState(),
|
||||||
false,
|
false,
|
||||||
|
|
|
||||||
|
|
@ -904,8 +904,8 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
pattern.OffsetIndex.CopyTo(shaderParams[..pattern.OffsetIndex.Length]);
|
pattern.OffsetIndex.CopyTo(shaderParams[..pattern.OffsetIndex.Length]);
|
||||||
|
|
||||||
using var patternScoped = gd.BufferManager.ReserveOrCreate(gd, cbs, ParamsBufferSize);
|
using ScopedTemporaryBuffer patternScoped = gd.BufferManager.ReserveOrCreate(gd, cbs, ParamsBufferSize);
|
||||||
var patternBuffer = patternScoped.Holder;
|
BufferHolder patternBuffer = patternScoped.Holder;
|
||||||
|
|
||||||
patternBuffer.SetDataUnchecked<int>(patternScoped.Offset, shaderParams);
|
patternBuffer.SetDataUnchecked<int>(patternScoped.Offset, shaderParams);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
using Ryujinx.Common;
|
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Linq;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.Debugger
|
namespace Ryujinx.HLE.Debugger
|
||||||
{
|
{
|
||||||
|
|
@ -55,7 +53,7 @@ namespace Ryujinx.HLE.Debugger
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var originalInstruction = new byte[length];
|
byte[] originalInstruction = new byte[length];
|
||||||
if (!ReadMemory(address, originalInstruction))
|
if (!ReadMemory(address, originalInstruction))
|
||||||
{
|
{
|
||||||
Logger.Error?.Print(LogClass.GdbStub, $"Failed to read memory at 0x{address:X16} to set breakpoint.");
|
Logger.Error?.Print(LogClass.GdbStub, $"Failed to read memory at 0x{address:X16} to set breakpoint.");
|
||||||
|
|
@ -68,7 +66,7 @@ namespace Ryujinx.HLE.Debugger
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var breakpoint = new Breakpoint(originalInstruction);
|
Breakpoint breakpoint = new(originalInstruction);
|
||||||
if (_breakpoints.TryAdd(address, breakpoint))
|
if (_breakpoints.TryAdd(address, breakpoint))
|
||||||
{
|
{
|
||||||
Logger.Debug?.Print(LogClass.GdbStub, $"Breakpoint set at 0x{address:X16}");
|
Logger.Debug?.Print(LogClass.GdbStub, $"Breakpoint set at 0x{address:X16}");
|
||||||
|
|
@ -109,7 +107,7 @@ namespace Ryujinx.HLE.Debugger
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ClearAll()
|
public void ClearAll()
|
||||||
{
|
{
|
||||||
foreach (var bp in _breakpoints)
|
foreach (KeyValuePair<ulong, Breakpoint> bp in _breakpoints)
|
||||||
{
|
{
|
||||||
if (!WriteMemory(bp.Key, bp.Value.OriginalData))
|
if (!WriteMemory(bp.Key, bp.Value.OriginalData))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -64,10 +64,10 @@ namespace Ryujinx.HLE.Debugger
|
||||||
Logger.Notice.Print(LogClass.GdbStub, "NACK received!");
|
Logger.Notice.Print(LogClass.GdbStub, "NACK received!");
|
||||||
continue;
|
continue;
|
||||||
case '\x03':
|
case '\x03':
|
||||||
_messages.Add(new BreakInMessage());
|
_messages.Add(StatelessMessage.BreakIn);
|
||||||
break;
|
break;
|
||||||
case '$':
|
case '$':
|
||||||
string cmd = "";
|
string cmd = string.Empty;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
int x = _readStream.ReadByte();
|
int x = _readStream.ReadByte();
|
||||||
|
|
@ -85,7 +85,7 @@ namespace Ryujinx.HLE.Debugger
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_messages.Add(new SendNackMessage());
|
_messages.Add(StatelessMessage.SendNack);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
58
src/Ryujinx.HLE/Debugger/Debugger.MessageHandler.cs
Normal file
58
src/Ryujinx.HLE/Debugger/Debugger.MessageHandler.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.Debugger
|
||||||
|
{
|
||||||
|
public partial class Debugger
|
||||||
|
{
|
||||||
|
private void MessageHandlerMain()
|
||||||
|
{
|
||||||
|
while (!_shuttingDown)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
switch (_messages.Take())
|
||||||
|
{
|
||||||
|
case StatelessMessage { Type: MessageType.BreakIn }:
|
||||||
|
Logger.Notice.Print(LogClass.GdbStub, "Break-in requested");
|
||||||
|
_commands.Interrupt();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case StatelessMessage { Type: MessageType.SendNack }:
|
||||||
|
_writeStream.WriteByte((byte)'-');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case StatelessMessage { Type: MessageType.Kill }:
|
||||||
|
return;
|
||||||
|
|
||||||
|
case CommandMessage { Command: { } cmd }:
|
||||||
|
Logger.Debug?.Print(LogClass.GdbStub, $"Received Command: {cmd}");
|
||||||
|
_writeStream.WriteByte((byte)'+');
|
||||||
|
_commandProcessor.Process(cmd);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ThreadBreakMessage { Context: { } ctx }:
|
||||||
|
DebugProcess.DebugStop();
|
||||||
|
GThread = CThread = ctx.ThreadUid;
|
||||||
|
_breakHandlerEvent.Set();
|
||||||
|
_commandProcessor.Reply($"T05thread:{ctx.ThreadUid:x};");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
Logger.Error?.Print(LogClass.GdbStub, "Error while processing GDB messages", e);
|
||||||
|
}
|
||||||
|
catch (NullReferenceException e)
|
||||||
|
{
|
||||||
|
Logger.Error?.Print(LogClass.GdbStub, "Error while processing GDB messages", e);
|
||||||
|
}
|
||||||
|
catch (ObjectDisposedException e)
|
||||||
|
{
|
||||||
|
Logger.Error?.Print(LogClass.GdbStub, "Error while processing GDB messages", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
104
src/Ryujinx.HLE/Debugger/Debugger.Rcmd.cs
Normal file
104
src/Ryujinx.HLE/Debugger/Debugger.Rcmd.cs
Normal file
|
|
@ -0,0 +1,104 @@
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
|
using Ryujinx.HLE.HOS.Kernel.Process;
|
||||||
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.Debugger
|
||||||
|
{
|
||||||
|
public partial class Debugger
|
||||||
|
{
|
||||||
|
public string GetStackTrace()
|
||||||
|
{
|
||||||
|
if (GThread == null)
|
||||||
|
return "No thread selected\n";
|
||||||
|
|
||||||
|
return Process?.Debugger?.GetGuestStackTrace(DebugProcess.GetThread(GThread.Value)) ?? "No application process found\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetRegisters()
|
||||||
|
{
|
||||||
|
if (GThread == null)
|
||||||
|
return "No thread selected\n";
|
||||||
|
|
||||||
|
return Process?.Debugger?.GetCpuRegisterPrintout(DebugProcess.GetThread(GThread.Value)) ?? "No application process found\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetMinidump()
|
||||||
|
{
|
||||||
|
StringBuilder response = new();
|
||||||
|
response.AppendLine("=== Begin Minidump ===\n");
|
||||||
|
response.AppendLine(GetProcessInfo());
|
||||||
|
|
||||||
|
foreach (KThread thread in GetThreads())
|
||||||
|
{
|
||||||
|
response.AppendLine($"=== Thread {thread.ThreadUid} ===");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string stackTrace = Process.Debugger.GetGuestStackTrace(thread);
|
||||||
|
response.AppendLine(stackTrace);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
response.AppendLine($"[Error getting stack trace: {e.Message}]");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string registers = Process.Debugger.GetCpuRegisterPrintout(thread);
|
||||||
|
response.AppendLine(registers);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
response.AppendLine($"[Error getting registers: {e.Message}]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
response.AppendLine("=== End Minidump ===");
|
||||||
|
|
||||||
|
Logger.Info?.Print(LogClass.GdbStub, response.ToString());
|
||||||
|
return response.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetProcessInfo()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (Process is not { } kProcess)
|
||||||
|
return "No application process found\n";
|
||||||
|
|
||||||
|
StringBuilder sb = new();
|
||||||
|
|
||||||
|
sb.AppendLine($"Program Id: 0x{kProcess.TitleId:x16}");
|
||||||
|
sb.AppendLine($"Application: {(kProcess.IsApplication ? 1 : 0)}");
|
||||||
|
sb.AppendLine("Layout:");
|
||||||
|
sb.AppendLine(
|
||||||
|
$" Alias: 0x{kProcess.MemoryManager.AliasRegionStart:x10} - 0x{kProcess.MemoryManager.AliasRegionEnd - 1:x10}");
|
||||||
|
sb.AppendLine(
|
||||||
|
$" Heap: 0x{kProcess.MemoryManager.HeapRegionStart:x10} - 0x{kProcess.MemoryManager.HeapRegionEnd - 1:x10}");
|
||||||
|
sb.AppendLine(
|
||||||
|
$" Aslr: 0x{kProcess.MemoryManager.AslrRegionStart:x10} - 0x{kProcess.MemoryManager.AslrRegionEnd - 1:x10}");
|
||||||
|
sb.AppendLine(
|
||||||
|
$" Stack: 0x{kProcess.MemoryManager.StackRegionStart:x10} - 0x{kProcess.MemoryManager.StackRegionEnd - 1:x10}");
|
||||||
|
|
||||||
|
sb.AppendLine("Modules:");
|
||||||
|
HleProcessDebugger debugger = kProcess.Debugger;
|
||||||
|
if (debugger != null)
|
||||||
|
{
|
||||||
|
foreach (HleProcessDebugger.Image image in debugger.GetLoadedImages())
|
||||||
|
{
|
||||||
|
ulong endAddress = image.BaseAddress + image.Size - 1;
|
||||||
|
sb.AppendLine($" 0x{image.BaseAddress:x10} - 0x{endAddress:x10} {image.Name}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger.Error?.Print(LogClass.GdbStub, $"Error getting process info: {e.Message}");
|
||||||
|
return $"Error getting process info: {e.Message}\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -57,172 +57,24 @@ namespace Ryujinx.HLE.Debugger
|
||||||
internal KProcess Process => Device.System?.DebugGetApplicationProcess();
|
internal KProcess Process => Device.System?.DebugGetApplicationProcess();
|
||||||
internal IDebuggableProcess DebugProcess => Device.System?.DebugGetApplicationProcessDebugInterface();
|
internal IDebuggableProcess DebugProcess => Device.System?.DebugGetApplicationProcessDebugInterface();
|
||||||
|
|
||||||
internal KThread[] GetThreads() =>
|
internal KThread[] GetThreads() => DebugProcess.ThreadUids.Select(DebugProcess.GetThread).ToArray();
|
||||||
DebugProcess.GetThreadUids().Select(x => DebugProcess.GetThread(x)).ToArray();
|
|
||||||
|
|
||||||
internal bool IsProcess32Bit => DebugProcess.GetThread(GThread.Value).Context.IsAarch32;
|
internal bool IsProcess32Bit => DebugProcess.GetThread(GThread.Value).Context.IsAarch32;
|
||||||
|
|
||||||
private void MessageHandlerMain()
|
internal bool WriteRegister(IExecutionContext ctx, int registerId, StringStream ss) =>
|
||||||
{
|
|
||||||
while (!_shuttingDown)
|
|
||||||
{
|
|
||||||
IMessage msg = _messages.Take();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
switch (msg)
|
|
||||||
{
|
|
||||||
case BreakInMessage:
|
|
||||||
Logger.Notice.Print(LogClass.GdbStub, "Break-in requested");
|
|
||||||
_commandProcessor.Commands.Interrupt();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SendNackMessage:
|
|
||||||
_writeStream.WriteByte((byte)'-');
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CommandMessage { Command: var cmd }:
|
|
||||||
Logger.Debug?.Print(LogClass.GdbStub, $"Received Command: {cmd}");
|
|
||||||
_writeStream.WriteByte((byte)'+');
|
|
||||||
_commandProcessor.Process(cmd);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ThreadBreakMessage { Context: var ctx }:
|
|
||||||
DebugProcess.DebugStop();
|
|
||||||
GThread = CThread = ctx.ThreadUid;
|
|
||||||
_breakHandlerEvent.Set();
|
|
||||||
_commandProcessor.Reply($"T05thread:{ctx.ThreadUid:x};");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case KillMessage:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
Logger.Error?.Print(LogClass.GdbStub, "Error while processing GDB messages", e);
|
|
||||||
}
|
|
||||||
catch (NullReferenceException e)
|
|
||||||
{
|
|
||||||
Logger.Error?.Print(LogClass.GdbStub, "Error while processing GDB messages", e);
|
|
||||||
}
|
|
||||||
catch (ObjectDisposedException e)
|
|
||||||
{
|
|
||||||
Logger.Error?.Print(LogClass.GdbStub, "Error while processing GDB messages", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal bool WriteRegister(IExecutionContext ctx, int gdbRegId, StringStream ss) =>
|
|
||||||
IsProcess32Bit
|
IsProcess32Bit
|
||||||
? ctx.WriteRegister32(gdbRegId, ss)
|
? ctx.WriteRegister32(registerId, ss)
|
||||||
: ctx.WriteRegister64(gdbRegId, ss);
|
: ctx.WriteRegister64(registerId, ss);
|
||||||
|
|
||||||
internal string ReadRegister(IExecutionContext ctx, int gdbRegId) =>
|
internal string ReadRegister(IExecutionContext ctx, int registerId) =>
|
||||||
IsProcess32Bit
|
IsProcess32Bit
|
||||||
? ctx.ReadRegister32(gdbRegId)
|
? ctx.ReadRegister32(registerId)
|
||||||
: ctx.ReadRegister64(gdbRegId);
|
: ctx.ReadRegister64(registerId);
|
||||||
|
|
||||||
public string GetStackTrace()
|
|
||||||
{
|
|
||||||
if (GThread == null)
|
|
||||||
return "No thread selected\n";
|
|
||||||
|
|
||||||
return Process?.Debugger?.GetGuestStackTrace(DebugProcess.GetThread(GThread.Value)) ?? "No application process found\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetRegisters()
|
|
||||||
{
|
|
||||||
if (GThread == null)
|
|
||||||
return "No thread selected\n";
|
|
||||||
|
|
||||||
return Process?.Debugger?.GetCpuRegisterPrintout(DebugProcess.GetThread(GThread.Value)) ?? "No application process found\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetMinidump()
|
|
||||||
{
|
|
||||||
var response = new StringBuilder();
|
|
||||||
response.AppendLine("=== Begin Minidump ===\n");
|
|
||||||
response.AppendLine(GetProcessInfo());
|
|
||||||
|
|
||||||
foreach (var thread in GetThreads())
|
|
||||||
{
|
|
||||||
response.AppendLine($"=== Thread {thread.ThreadUid} ===");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string stackTrace = Process.Debugger.GetGuestStackTrace(thread);
|
|
||||||
response.AppendLine(stackTrace);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
response.AppendLine($"[Error getting stack trace: {e.Message}]");
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string registers = Process.Debugger.GetCpuRegisterPrintout(thread);
|
|
||||||
response.AppendLine(registers);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
response.AppendLine($"[Error getting registers: {e.Message}]");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
response.AppendLine("=== End Minidump ===");
|
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.GdbStub, response.ToString());
|
|
||||||
return response.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetProcessInfo()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (Process == null)
|
|
||||||
return "No application process found\n";
|
|
||||||
|
|
||||||
KProcess kProcess = Process;
|
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
|
||||||
|
|
||||||
sb.AppendLine($"Program Id: 0x{kProcess.TitleId:x16}");
|
|
||||||
sb.AppendLine($"Application: {(kProcess.IsApplication ? 1 : 0)}");
|
|
||||||
sb.AppendLine("Layout:");
|
|
||||||
sb.AppendLine(
|
|
||||||
$" Alias: 0x{kProcess.MemoryManager.AliasRegionStart:x10} - 0x{kProcess.MemoryManager.AliasRegionEnd - 1:x10}");
|
|
||||||
sb.AppendLine(
|
|
||||||
$" Heap: 0x{kProcess.MemoryManager.HeapRegionStart:x10} - 0x{kProcess.MemoryManager.HeapRegionEnd - 1:x10}");
|
|
||||||
sb.AppendLine(
|
|
||||||
$" Aslr: 0x{kProcess.MemoryManager.AslrRegionStart:x10} - 0x{kProcess.MemoryManager.AslrRegionEnd - 1:x10}");
|
|
||||||
sb.AppendLine(
|
|
||||||
$" Stack: 0x{kProcess.MemoryManager.StackRegionStart:x10} - 0x{kProcess.MemoryManager.StackRegionEnd - 1:x10}");
|
|
||||||
|
|
||||||
sb.AppendLine("Modules:");
|
|
||||||
var debugger = kProcess.Debugger;
|
|
||||||
if (debugger != null)
|
|
||||||
{
|
|
||||||
var images = debugger.GetLoadedImages();
|
|
||||||
for (int i = 0; i < images.Count; i++)
|
|
||||||
{
|
|
||||||
var image = images[i];
|
|
||||||
ulong endAddress = image.BaseAddress + image.Size - 1;
|
|
||||||
string name = image.Name;
|
|
||||||
sb.AppendLine($" 0x{image.BaseAddress:x10} - 0x{endAddress:x10} {name}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Logger.Error?.Print(LogClass.GdbStub, $"Error getting process info: {e.Message}");
|
|
||||||
return $"Error getting process info: {e.Message}\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Dispose(true);
|
Dispose(true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
protected virtual void Dispose(bool disposing)
|
||||||
|
|
@ -237,7 +89,7 @@ namespace Ryujinx.HLE.Debugger
|
||||||
_readStream?.Close();
|
_readStream?.Close();
|
||||||
_writeStream?.Close();
|
_writeStream?.Close();
|
||||||
_debuggerThread.Join();
|
_debuggerThread.Join();
|
||||||
_messages.Add(new KillMessage());
|
_messages.Add(StatelessMessage.Kill);
|
||||||
_messageHandlerThread.Join();
|
_messageHandlerThread.Join();
|
||||||
_messages.Dispose();
|
_messages.Dispose();
|
||||||
_breakHandlerEvent.Dispose();
|
_breakHandlerEvent.Dispose();
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||||
switch (ss.ReadChar())
|
switch (ss.ReadChar())
|
||||||
{
|
{
|
||||||
case '!':
|
case '!':
|
||||||
if (!ss.IsEmpty())
|
if (!ss.IsEmpty)
|
||||||
{
|
{
|
||||||
goto unknownCommand;
|
goto unknownCommand;
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +62,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||||
ReplyOK();
|
ReplyOK();
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
if (!ss.IsEmpty())
|
if (!ss.IsEmpty)
|
||||||
{
|
{
|
||||||
goto unknownCommand;
|
goto unknownCommand;
|
||||||
}
|
}
|
||||||
|
|
@ -70,10 +70,10 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||||
Commands.Query();
|
Commands.Query();
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
Commands.Continue(ss.IsEmpty() ? null : ss.ReadRemainingAsHex());
|
Commands.Continue(ss.IsEmpty ? null : ss.ReadRemainingAsHex());
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
if (!ss.IsEmpty())
|
if (!ss.IsEmpty)
|
||||||
{
|
{
|
||||||
goto unknownCommand;
|
goto unknownCommand;
|
||||||
}
|
}
|
||||||
|
|
@ -81,7 +81,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||||
Commands.Detach();
|
Commands.Detach();
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
if (!ss.IsEmpty())
|
if (!ss.IsEmpty)
|
||||||
{
|
{
|
||||||
goto unknownCommand;
|
goto unknownCommand;
|
||||||
}
|
}
|
||||||
|
|
@ -172,7 +172,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||||
if (ss.ConsumeRemaining("fThreadInfo"))
|
if (ss.ConsumeRemaining("fThreadInfo"))
|
||||||
{
|
{
|
||||||
Reply(
|
Reply(
|
||||||
$"m{Debugger.DebugProcess.GetThreadUids().Select(x => $"{x:x}").JoinToString(",")}");
|
$"m{Debugger.DebugProcess.ThreadUids.Select(x => $"{x:x}").JoinToString(",")}");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -225,7 +225,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||||
|
|
||||||
if (len >= (ulong)data.Length - offset)
|
if (len >= (ulong)data.Length - offset)
|
||||||
{
|
{
|
||||||
Reply("l" + Helpers.ToBinaryFormat(data.Substring((int)offset)));
|
Reply("l" + Helpers.ToBinaryFormat(data[(int)offset..]));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -274,7 +274,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||||
case 'Q':
|
case 'Q':
|
||||||
goto unknownCommand;
|
goto unknownCommand;
|
||||||
case 's':
|
case 's':
|
||||||
Commands.Step(ss.IsEmpty() ? null : ss.ReadRemainingAsHex());
|
Commands.Step(ss.IsEmpty ? null : ss.ReadRemainingAsHex());
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||||
{
|
{
|
||||||
// GDB is performing initial contact. Stop everything.
|
// GDB is performing initial contact. Stop everything.
|
||||||
Debugger.DebugProcess.DebugStop();
|
Debugger.DebugProcess.DebugStop();
|
||||||
Debugger.GThread = Debugger.CThread = Debugger.DebugProcess.GetThreadUids().First();
|
Debugger.GThread = Debugger.CThread = Debugger.DebugProcess.ThreadUids.First();
|
||||||
Processor.Reply($"T05thread:{Debugger.CThread:x};");
|
Processor.Reply($"T05thread:{Debugger.CThread:x};");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,7 +63,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||||
Debugger.DebugProcess.DebugStop();
|
Debugger.DebugProcess.DebugStop();
|
||||||
if (Debugger.GThread == null || Debugger.GetThreads().All(x => x.ThreadUid != Debugger.GThread.Value))
|
if (Debugger.GThread == null || Debugger.GetThreads().All(x => x.ThreadUid != Debugger.GThread.Value))
|
||||||
{
|
{
|
||||||
Debugger.GThread = Debugger.CThread = Debugger.DebugProcess.GetThreadUids().First();
|
Debugger.GThread = Debugger.CThread = Debugger.DebugProcess.ThreadUids.First();
|
||||||
}
|
}
|
||||||
|
|
||||||
Processor.Reply($"T02thread:{Debugger.GThread:x};");
|
Processor.Reply($"T02thread:{Debugger.GThread:x};");
|
||||||
|
|
@ -151,7 +151,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Processor.Reply(ss.IsEmpty());
|
Processor.Reply(ss.IsEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void SetThread(char op, ulong? threadId)
|
internal void SetThread(char op, ulong? threadId)
|
||||||
|
|
@ -194,7 +194,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var data = new byte[len];
|
byte[] data = new byte[len];
|
||||||
Debugger.DebugProcess.CpuMemory.Read(addr, data);
|
Debugger.DebugProcess.CpuMemory.Read(addr, data);
|
||||||
Processor.Reply(Helpers.ToHex(data));
|
Processor.Reply(Helpers.ToHex(data));
|
||||||
}
|
}
|
||||||
|
|
@ -211,7 +211,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var data = new byte[len];
|
byte[] data = new byte[len];
|
||||||
for (ulong i = 0; i < len; i++)
|
for (ulong i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
data[i] = (byte)ss.ReadLengthAsHex(2);
|
data[i] = (byte)ss.ReadLengthAsHex(2);
|
||||||
|
|
@ -251,7 +251,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||||
|
|
||||||
IExecutionContext ctx = Debugger.DebugProcess.GetThread(Debugger.GThread.Value).Context;
|
IExecutionContext ctx = Debugger.DebugProcess.GetThread(Debugger.GThread.Value).Context;
|
||||||
|
|
||||||
Processor.Reply(Debugger.WriteRegister(ctx, gdbRegId, ss) && ss.IsEmpty());
|
Processor.Reply(Debugger.WriteRegister(ctx, gdbRegId, ss) && ss.IsEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Step(ulong? newPc)
|
internal void Step(ulong? newPc)
|
||||||
|
|
|
||||||
|
|
@ -13,65 +13,56 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||||
*/
|
*/
|
||||||
private const uint FpcrMask = 0xfc1fffff;
|
private const uint FpcrMask = 0xfc1fffff;
|
||||||
|
|
||||||
public static string ReadRegister64(this IExecutionContext state, int gdbRegId)
|
public static string ReadRegister64(this IExecutionContext state, int registerId) =>
|
||||||
{
|
registerId switch
|
||||||
switch (gdbRegId)
|
|
||||||
{
|
{
|
||||||
case >= 0 and <= 31:
|
>= 0 and <= 31 => Helpers.ToHex(BitConverter.GetBytes(state.GetX(registerId))),
|
||||||
return Helpers.ToHex(BitConverter.GetBytes(state.GetX(gdbRegId)));
|
32 => Helpers.ToHex(BitConverter.GetBytes(state.DebugPc)),
|
||||||
case 32:
|
33 => Helpers.ToHex(BitConverter.GetBytes(state.Pstate)),
|
||||||
return Helpers.ToHex(BitConverter.GetBytes(state.DebugPc));
|
>= 34 and <= 65 => Helpers.ToHex(state.GetV(registerId - 34).ToArray()),
|
||||||
case 33:
|
66 => Helpers.ToHex(BitConverter.GetBytes((uint)state.Fpsr)),
|
||||||
return Helpers.ToHex(BitConverter.GetBytes(state.Pstate));
|
67 => Helpers.ToHex(BitConverter.GetBytes((uint)state.Fpcr)),
|
||||||
case >= 34 and <= 65:
|
_ => null
|
||||||
return Helpers.ToHex(state.GetV(gdbRegId - 34).ToArray());
|
};
|
||||||
case 66:
|
|
||||||
return Helpers.ToHex(BitConverter.GetBytes((uint)state.Fpsr));
|
|
||||||
case 67:
|
|
||||||
return Helpers.ToHex(BitConverter.GetBytes((uint)state.Fpcr));
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool WriteRegister64(this IExecutionContext state, int gdbRegId, StringStream ss)
|
public static bool WriteRegister64(this IExecutionContext state, int registerId, StringStream ss)
|
||||||
{
|
{
|
||||||
switch (gdbRegId)
|
switch (registerId)
|
||||||
{
|
{
|
||||||
case >= 0 and <= 31:
|
case >= 0 and <= 31:
|
||||||
{
|
{
|
||||||
ulong value = ss.ReadLengthAsLEHex(16);
|
ulong value = ss.ReadLengthAsLittleEndianHex(16);
|
||||||
state.SetX(gdbRegId, value);
|
state.SetX(registerId, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case 32:
|
case 32:
|
||||||
{
|
{
|
||||||
ulong value = ss.ReadLengthAsLEHex(16);
|
ulong value = ss.ReadLengthAsLittleEndianHex(16);
|
||||||
state.DebugPc = value;
|
state.DebugPc = value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case 33:
|
case 33:
|
||||||
{
|
{
|
||||||
ulong value = ss.ReadLengthAsLEHex(8);
|
ulong value = ss.ReadLengthAsLittleEndianHex(8);
|
||||||
state.Pstate = (uint)value;
|
state.Pstate = (uint)value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case >= 34 and <= 65:
|
case >= 34 and <= 65:
|
||||||
{
|
{
|
||||||
ulong value0 = ss.ReadLengthAsLEHex(16);
|
ulong value0 = ss.ReadLengthAsLittleEndianHex(16);
|
||||||
ulong value1 = ss.ReadLengthAsLEHex(16);
|
ulong value1 = ss.ReadLengthAsLittleEndianHex(16);
|
||||||
state.SetV(gdbRegId - 34, new V128(value0, value1));
|
state.SetV(registerId - 34, new V128(value0, value1));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case 66:
|
case 66:
|
||||||
{
|
{
|
||||||
ulong value = ss.ReadLengthAsLEHex(8);
|
ulong value = ss.ReadLengthAsLittleEndianHex(8);
|
||||||
state.Fpsr = (uint)value;
|
state.Fpsr = (uint)value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case 67:
|
case 67:
|
||||||
{
|
{
|
||||||
ulong value = ss.ReadLengthAsLEHex(8);
|
ulong value = ss.ReadLengthAsLittleEndianHex(8);
|
||||||
state.Fpcr = (uint)value;
|
state.Fpcr = (uint)value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -80,65 +71,64 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ReadRegister32(this IExecutionContext state, int gdbRegId)
|
public static string ReadRegister32(this IExecutionContext state, int registerId)
|
||||||
{
|
{
|
||||||
switch (gdbRegId)
|
switch (registerId)
|
||||||
{
|
{
|
||||||
case >= 0 and <= 14:
|
case >= 0 and <= 14:
|
||||||
return Helpers.ToHex(BitConverter.GetBytes((uint)state.GetX(gdbRegId)));
|
return Helpers.ToHex(BitConverter.GetBytes((uint)state.GetX(registerId)));
|
||||||
case 15:
|
case 15:
|
||||||
return Helpers.ToHex(BitConverter.GetBytes((uint)state.DebugPc));
|
return Helpers.ToHex(BitConverter.GetBytes((uint)state.DebugPc));
|
||||||
case 16:
|
case 16:
|
||||||
return Helpers.ToHex(BitConverter.GetBytes((uint)state.Pstate));
|
return Helpers.ToHex(BitConverter.GetBytes(state.Pstate));
|
||||||
case >= 17 and <= 32:
|
case >= 17 and <= 32:
|
||||||
return Helpers.ToHex(state.GetV(gdbRegId - 17).ToArray());
|
return Helpers.ToHex(state.GetV(registerId - 17).ToArray());
|
||||||
case >= 33 and <= 64:
|
case >= 33 and <= 64:
|
||||||
int reg = (gdbRegId - 33);
|
int reg = (registerId - 33);
|
||||||
int n = reg / 2;
|
int n = reg / 2;
|
||||||
int shift = reg % 2;
|
int shift = reg % 2;
|
||||||
ulong value = state.GetV(n).Extract<ulong>(shift);
|
ulong value = state.GetV(n).Extract<ulong>(shift);
|
||||||
return Helpers.ToHex(BitConverter.GetBytes(value));
|
return Helpers.ToHex(BitConverter.GetBytes(value));
|
||||||
case 65:
|
case 65:
|
||||||
uint fpscr = (uint)state.Fpsr | (uint)state.Fpcr;
|
return Helpers.ToHex(BitConverter.GetBytes(state.Fpscr));
|
||||||
return Helpers.ToHex(BitConverter.GetBytes(fpscr));
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool WriteRegister32(this IExecutionContext state, int gdbRegId, StringStream ss)
|
public static bool WriteRegister32(this IExecutionContext state, int registerId, StringStream ss)
|
||||||
{
|
{
|
||||||
switch (gdbRegId)
|
switch (registerId)
|
||||||
{
|
{
|
||||||
case >= 0 and <= 14:
|
case >= 0 and <= 14:
|
||||||
{
|
{
|
||||||
ulong value = ss.ReadLengthAsLEHex(8);
|
ulong value = ss.ReadLengthAsLittleEndianHex(8);
|
||||||
state.SetX(gdbRegId, value);
|
state.SetX(registerId, value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case 15:
|
case 15:
|
||||||
{
|
{
|
||||||
ulong value = ss.ReadLengthAsLEHex(8);
|
ulong value = ss.ReadLengthAsLittleEndianHex(8);
|
||||||
state.DebugPc = value;
|
state.DebugPc = value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case 16:
|
case 16:
|
||||||
{
|
{
|
||||||
ulong value = ss.ReadLengthAsLEHex(8);
|
ulong value = ss.ReadLengthAsLittleEndianHex(8);
|
||||||
state.Pstate = (uint)value;
|
state.Pstate = (uint)value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case >= 17 and <= 32:
|
case >= 17 and <= 32:
|
||||||
{
|
{
|
||||||
ulong value0 = ss.ReadLengthAsLEHex(16);
|
ulong value0 = ss.ReadLengthAsLittleEndianHex(16);
|
||||||
ulong value1 = ss.ReadLengthAsLEHex(16);
|
ulong value1 = ss.ReadLengthAsLittleEndianHex(16);
|
||||||
state.SetV(gdbRegId - 17, new V128(value0, value1));
|
state.SetV(registerId - 17, new V128(value0, value1));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case >= 33 and <= 64:
|
case >= 33 and <= 64:
|
||||||
{
|
{
|
||||||
ulong value = ss.ReadLengthAsLEHex(16);
|
ulong value = ss.ReadLengthAsLittleEndianHex(16);
|
||||||
int regId = (gdbRegId - 33);
|
int regId = (registerId - 33);
|
||||||
int regNum = regId / 2;
|
int regNum = regId / 2;
|
||||||
int shift = regId % 2;
|
int shift = regId % 2;
|
||||||
V128 reg = state.GetV(regNum);
|
V128 reg = state.GetV(regNum);
|
||||||
|
|
@ -147,7 +137,7 @@ namespace Ryujinx.HLE.Debugger.Gdb
|
||||||
}
|
}
|
||||||
case 65:
|
case 65:
|
||||||
{
|
{
|
||||||
ulong value = ss.ReadLengthAsLEHex(8);
|
ulong value = ss.ReadLengthAsLittleEndianHex(8);
|
||||||
state.Fpsr = (uint)value & FpcrMask;
|
state.Fpsr = (uint)value & FpcrMask;
|
||||||
state.Fpcr = (uint)value & ~FpcrMask;
|
state.Fpcr = (uint)value & ~FpcrMask;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@ namespace Ryujinx.HLE.Debugger
|
||||||
void DebugContinue(KThread thread);
|
void DebugContinue(KThread thread);
|
||||||
bool DebugStep(KThread thread);
|
bool DebugStep(KThread thread);
|
||||||
KThread GetThread(ulong threadUid);
|
KThread GetThread(ulong threadUid);
|
||||||
DebugState GetDebugState();
|
|
||||||
bool IsThreadPaused(KThread thread);
|
bool IsThreadPaused(KThread thread);
|
||||||
ulong[] GetThreadUids();
|
|
||||||
public void DebugInterruptHandler(IExecutionContext ctx);
|
public void DebugInterruptHandler(IExecutionContext ctx);
|
||||||
IVirtualMemoryManager CpuMemory { get; }
|
IVirtualMemoryManager CpuMemory { get; }
|
||||||
|
ulong[] ThreadUids { get; }
|
||||||
|
DebugState DebugState { get; }
|
||||||
void InvalidateCacheRegion(ulong address, ulong size);
|
void InvalidateCacheRegion(ulong address, ulong size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
47
src/Ryujinx.HLE/Debugger/IMessage.cs
Normal file
47
src/Ryujinx.HLE/Debugger/IMessage.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
using Ryujinx.Cpu;
|
||||||
|
|
||||||
|
namespace Ryujinx.HLE.Debugger
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Marker interface for debugger messages.
|
||||||
|
/// </summary>
|
||||||
|
interface IMessage;
|
||||||
|
|
||||||
|
public enum MessageType
|
||||||
|
{
|
||||||
|
Kill,
|
||||||
|
BreakIn,
|
||||||
|
SendNack
|
||||||
|
}
|
||||||
|
|
||||||
|
record struct StatelessMessage(MessageType Type) : IMessage
|
||||||
|
{
|
||||||
|
public static StatelessMessage Kill => new(MessageType.Kill);
|
||||||
|
public static StatelessMessage BreakIn => new(MessageType.BreakIn);
|
||||||
|
public static StatelessMessage SendNack => new(MessageType.SendNack);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct CommandMessage : IMessage
|
||||||
|
{
|
||||||
|
public readonly string Command;
|
||||||
|
|
||||||
|
public CommandMessage(string cmd)
|
||||||
|
{
|
||||||
|
Command = cmd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ThreadBreakMessage : IMessage
|
||||||
|
{
|
||||||
|
public IExecutionContext Context { get; }
|
||||||
|
public ulong Address { get; }
|
||||||
|
public int Opcode { get; }
|
||||||
|
|
||||||
|
public ThreadBreakMessage(IExecutionContext context, ulong address, int opcode)
|
||||||
|
{
|
||||||
|
Context = context;
|
||||||
|
Address = address;
|
||||||
|
Opcode = opcode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
namespace Ryujinx.HLE.Debugger
|
|
||||||
{
|
|
||||||
struct BreakInMessage : IMessage
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
namespace Ryujinx.HLE.Debugger
|
|
||||||
{
|
|
||||||
struct CommandMessage : IMessage
|
|
||||||
{
|
|
||||||
public string Command;
|
|
||||||
|
|
||||||
public CommandMessage(string cmd)
|
|
||||||
{
|
|
||||||
Command = cmd;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
namespace Ryujinx.HLE.Debugger
|
|
||||||
{
|
|
||||||
interface IMessage
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
namespace Ryujinx.HLE.Debugger
|
|
||||||
{
|
|
||||||
struct KillMessage : IMessage
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
namespace Ryujinx.HLE.Debugger
|
|
||||||
{
|
|
||||||
struct SendNackMessage : IMessage
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
using IExecutionContext = Ryujinx.Cpu.IExecutionContext;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.Debugger
|
|
||||||
{
|
|
||||||
public class ThreadBreakMessage : IMessage
|
|
||||||
{
|
|
||||||
public IExecutionContext Context { get; }
|
|
||||||
public ulong Address { get; }
|
|
||||||
public int Opcode { get; }
|
|
||||||
|
|
||||||
public ThreadBreakMessage(IExecutionContext context, ulong address, int opcode)
|
|
||||||
{
|
|
||||||
Context = context;
|
|
||||||
Address = address;
|
|
||||||
Opcode = opcode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -5,63 +5,56 @@ namespace Ryujinx.HLE.Debugger
|
||||||
{
|
{
|
||||||
internal class StringStream
|
internal class StringStream
|
||||||
{
|
{
|
||||||
private readonly string Data;
|
private readonly string _data;
|
||||||
private int Position;
|
private int _position;
|
||||||
|
|
||||||
public StringStream(string s)
|
public StringStream(string s)
|
||||||
{
|
{
|
||||||
Data = s;
|
_data = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsEmpty => _position >= _data.Length;
|
||||||
|
|
||||||
public char ReadChar()
|
public char ReadChar() => _data[_position++];
|
||||||
{
|
|
||||||
return Data[Position++];
|
|
||||||
}
|
|
||||||
|
|
||||||
public string ReadUntil(char needle)
|
public string ReadUntil(char needle)
|
||||||
{
|
{
|
||||||
int needlePos = Data.IndexOf(needle, Position);
|
int needlePos = _data.IndexOf(needle, _position);
|
||||||
|
|
||||||
if (needlePos == -1)
|
if (needlePos == -1)
|
||||||
{
|
{
|
||||||
needlePos = Data.Length;
|
needlePos = _data.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
string result = Data.Substring(Position, needlePos - Position);
|
string result = _data.Substring(_position, needlePos - _position);
|
||||||
Position = needlePos + 1;
|
_position = needlePos + 1;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ReadLength(int len)
|
public string ReadLength(int len)
|
||||||
{
|
{
|
||||||
string result = Data.Substring(Position, len);
|
string result = _data.Substring(_position, len);
|
||||||
Position += len;
|
_position += len;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ReadRemaining()
|
public string ReadRemaining()
|
||||||
{
|
{
|
||||||
string result = Data.Substring(Position);
|
string result = _data[_position..];
|
||||||
Position = Data.Length;
|
_position = _data.Length;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ulong ReadRemainingAsHex()
|
public ulong ReadRemainingAsHex()
|
||||||
{
|
=> ulong.Parse(ReadRemaining(), NumberStyles.HexNumber);
|
||||||
return ulong.Parse(ReadRemaining(), NumberStyles.HexNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ulong ReadUntilAsHex(char needle)
|
public ulong ReadUntilAsHex(char needle)
|
||||||
{
|
=> ulong.Parse(ReadUntil(needle), NumberStyles.HexNumber);
|
||||||
return ulong.Parse(ReadUntil(needle), NumberStyles.HexNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ulong ReadLengthAsHex(int len)
|
public ulong ReadLengthAsHex(int len)
|
||||||
{
|
=> ulong.Parse(ReadLength(len), NumberStyles.HexNumber);
|
||||||
return ulong.Parse(ReadLength(len), NumberStyles.HexNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ulong ReadLengthAsLEHex(int len)
|
public ulong ReadLengthAsLittleEndianHex(int len)
|
||||||
{
|
{
|
||||||
Debug.Assert(len % 2 == 0);
|
Debug.Assert(len % 2 == 0);
|
||||||
|
|
||||||
|
|
@ -83,9 +76,9 @@ namespace Ryujinx.HLE.Debugger
|
||||||
|
|
||||||
public bool ConsumePrefix(string prefix)
|
public bool ConsumePrefix(string prefix)
|
||||||
{
|
{
|
||||||
if (Data.Substring(Position).StartsWith(prefix))
|
if (_data[_position..].StartsWith(prefix))
|
||||||
{
|
{
|
||||||
Position += prefix.Length;
|
_position += prefix.Length;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -93,17 +86,12 @@ namespace Ryujinx.HLE.Debugger
|
||||||
|
|
||||||
public bool ConsumeRemaining(string match)
|
public bool ConsumeRemaining(string match)
|
||||||
{
|
{
|
||||||
if (Data.Substring(Position) == match)
|
if (_data[_position..] == match)
|
||||||
{
|
{
|
||||||
Position += match.Length;
|
_position += match.Length;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsEmpty()
|
|
||||||
{
|
|
||||||
return Position >= Data.Length;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
{
|
{
|
||||||
moduleName = string.Empty;
|
moduleName = string.Empty;
|
||||||
|
|
||||||
var rodataStart = image.BaseAddress + image.Size;
|
ulong rodataStart = image.BaseAddress + image.Size;
|
||||||
|
|
||||||
KMemoryInfo roInfo = _owner.MemoryManager.QueryMemory(rodataStart);
|
KMemoryInfo roInfo = _owner.MemoryManager.QueryMemory(rodataStart);
|
||||||
if (roInfo.Permission != KMemoryPermission.Read)
|
if (roInfo.Permission != KMemoryPermission.Read)
|
||||||
|
|
@ -275,7 +275,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rwdataStart = roInfo.Address + roInfo.Size;
|
ulong rwdataStart = roInfo.Address + roInfo.Size;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -305,7 +305,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
}
|
}
|
||||||
|
|
||||||
pathLength = Math.Min(pathLength, rodataBuf.Length - 8);
|
pathLength = Math.Min(pathLength, rodataBuf.Length - 8);
|
||||||
var pathBuf = rodataBuf.Slice(8, pathLength);
|
Span<byte> pathBuf = rodataBuf.Slice(8, pathLength);
|
||||||
int lastSlash = pathBuf.LastIndexOfAny(new byte[] { (byte)'\\', (byte)'/' });
|
int lastSlash = pathBuf.LastIndexOfAny(new byte[] { (byte)'\\', (byte)'/' });
|
||||||
|
|
||||||
moduleName = Encoding.ASCII.GetString(pathBuf.Slice(lastSlash + 1).TrimEnd((byte)0));
|
moduleName = Encoding.ASCII.GetString(pathBuf.Slice(lastSlash + 1).TrimEnd((byte)0));
|
||||||
|
|
@ -483,12 +483,11 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
|
|
||||||
lock (_images)
|
lock (_images)
|
||||||
{
|
{
|
||||||
var image = new Image(textOffset, textSize, symbols.OrderBy(x => x.Value).ToArray());
|
Image image = new(textOffset, textSize, symbols.OrderBy(x => x.Value).ToArray());
|
||||||
|
|
||||||
string moduleName;
|
if (!GetModuleName(out string moduleName, image))
|
||||||
if (!GetModuleName(out moduleName, image))
|
|
||||||
{
|
{
|
||||||
var newIndex = _images.Count;
|
int newIndex = _images.Count;
|
||||||
moduleName = $"(unknown{newIndex})";
|
moduleName = $"(unknown{newIndex})";
|
||||||
}
|
}
|
||||||
image.Name = moduleName;
|
image.Name = moduleName;
|
||||||
|
|
|
||||||
|
|
@ -1338,22 +1338,24 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DebugState GetDebugState()
|
public DebugState DebugState => (DebugState)_parent.debugState;
|
||||||
{
|
|
||||||
return (DebugState)_parent.debugState;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsThreadPaused(KThread target)
|
public bool IsThreadPaused(KThread target)
|
||||||
{
|
{
|
||||||
return (target.SchedFlags & ThreadSchedState.ThreadPauseFlag) != 0;
|
return (target.SchedFlags & ThreadSchedState.ThreadPauseFlag) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ulong[] GetThreadUids()
|
public ulong[] ThreadUids
|
||||||
{
|
{
|
||||||
lock (_parent._threadingLock)
|
get
|
||||||
{
|
{
|
||||||
var threads = _parent._threads.Where(x => !x.TerminationRequested).ToArray();
|
lock (_parent._threadingLock)
|
||||||
return threads.Select(x => x.ThreadUid).ToArray();
|
{
|
||||||
|
return _parent._threads
|
||||||
|
.Where(x => !x.TerminationRequested)
|
||||||
|
.Select(x => x.ThreadUid)
|
||||||
|
.ToArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1361,8 +1363,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
{
|
{
|
||||||
lock (_parent._threadingLock)
|
lock (_parent._threadingLock)
|
||||||
{
|
{
|
||||||
var threads = _parent._threads.Where(x => !x.TerminationRequested).ToArray();
|
return _parent._threads.Where(x => !x.TerminationRequested)
|
||||||
return threads.FirstOrDefault(x => x.ThreadUid == threadUid);
|
.FirstOrDefault(x => x.ThreadUid == threadUid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1379,7 +1381,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
_parent.InterruptHandler(ctx);
|
_parent.InterruptHandler(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IVirtualMemoryManager CpuMemory { get { return _parent.CpuMemory; } }
|
public IVirtualMemoryManager CpuMemory => _parent.CpuMemory;
|
||||||
|
|
||||||
public void InvalidateCacheRegion(ulong address, ulong size)
|
public void InvalidateCacheRegion(ulong address, ulong size)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Kernel.Process
|
namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
using ARMeilleure.State;
|
using ARMeilleure.State;
|
||||||
using Ryujinx.Cpu;
|
using Ryujinx.Cpu;
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Kernel.Process
|
namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -293,7 +293,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading
|
||||||
KThread currentThread = KernelStatic.GetCurrentThread();
|
KThread currentThread = KernelStatic.GetCurrentThread();
|
||||||
KThread selectedThread = _state.SelectedThread;
|
KThread selectedThread = _state.SelectedThread;
|
||||||
|
|
||||||
if (!currentThread.IsThreadNamed && currentThread.GetThreadName() != "")
|
if (!currentThread.IsThreadNamed && string.IsNullOrEmpty(currentThread.GetThreadName()))
|
||||||
{
|
{
|
||||||
currentThread.HostThread.Name = $"<{currentThread.GetThreadName()}>";
|
currentThread.HostThread.Name = $"<{currentThread.GetThreadName()}>";
|
||||||
currentThread.IsThreadNamed = true;
|
currentThread.IsThreadNamed = true;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
using ARMeilleure.State;
|
using ARMeilleure.State;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Cpu;
|
using Ryujinx.Cpu;
|
||||||
using Ryujinx.HLE.Debugger;
|
|
||||||
using Ryujinx.HLE.HOS.Kernel.Common;
|
using Ryujinx.HLE.HOS.Kernel.Common;
|
||||||
using Ryujinx.HLE.HOS.Kernel.Process;
|
using Ryujinx.HLE.HOS.Kernel.Process;
|
||||||
using Ryujinx.HLE.HOS.Kernel.SupervisorCall;
|
using Ryujinx.HLE.HOS.Kernel.SupervisorCall;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Security.Principal;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Loader
|
namespace Ryujinx.HLE.HOS.Services.Loader
|
||||||
{
|
{
|
||||||
enum ResultCode
|
enum ResultCode
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Proxy;
|
using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Proxy;
|
||||||
using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types;
|
using Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Impl
|
||||||
{
|
{
|
||||||
enum WsaError
|
enum WsaError
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types
|
namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types
|
||||||
{
|
{
|
||||||
enum BsdSocketOption
|
enum BsdSocketOption
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types
|
namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd.Types
|
||||||
{
|
{
|
||||||
enum LinuxError
|
enum LinuxError
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
||||||
{
|
{
|
||||||
enum Status
|
enum Status
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ using Ryujinx.Common;
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Common.PreciseSleep;
|
using Ryujinx.Common.PreciseSleep;
|
||||||
using Ryujinx.Cpu;
|
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using Ryujinx.Graphics.Gpu;
|
using Ryujinx.Graphics.Gpu;
|
||||||
using Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap;
|
using Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvMap;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
||||||
{
|
{
|
||||||
enum ColorFormat : ulong
|
enum ColorFormat : ulong
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS.Services.Time
|
namespace Ryujinx.HLE.HOS.Services.Time
|
||||||
{
|
{
|
||||||
public enum ResultCode
|
public enum ResultCode
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.Loaders.Elf
|
namespace Ryujinx.HLE.Loaders.Elf
|
||||||
{
|
{
|
||||||
enum ElfDynamicTag
|
enum ElfDynamicTag
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Graphics.Gpu;
|
using Ryujinx.Graphics.Gpu;
|
||||||
using Ryujinx.HLE.Loaders.Executables;
|
using Ryujinx.HLE.Loaders.Executables;
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using System;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using static Ryujinx.HLE.HOS.ModLoader;
|
using static Ryujinx.HLE.HOS.ModLoader;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ using Ryujinx.Cpu;
|
||||||
using Ryujinx.HLE.HOS.SystemState;
|
using Ryujinx.HLE.HOS.SystemState;
|
||||||
using Ryujinx.HLE.Loaders.Processes.Extensions;
|
using Ryujinx.HLE.Loaders.Processes.Extensions;
|
||||||
using Ryujinx.Horizon.Common;
|
using Ryujinx.Horizon.Common;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE.Loaders.Processes
|
namespace Ryujinx.HLE.Loaders.Processes
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ using Ryujinx.HLE.Loaders.Processes;
|
||||||
using Ryujinx.HLE.UI;
|
using Ryujinx.HLE.UI;
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace Ryujinx.HLE
|
namespace Ryujinx.HLE
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
using Ryujinx.Common.Memory;
|
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
|
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common;
|
||||||
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad;
|
using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad;
|
||||||
using System;
|
using System;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ namespace Ryujinx.Horizon.Audio
|
||||||
{
|
{
|
||||||
class HwopusIpcServer
|
class HwopusIpcServer
|
||||||
{
|
{
|
||||||
private const int MaxSessionsCount = 24;
|
private const int MaxSessionsCount = 25;
|
||||||
|
|
||||||
private const int PointerBufferSize = 0x1000;
|
private const int PointerBufferSize = 0x1000;
|
||||||
private const int MaxDomains = 8;
|
private const int MaxDomains = 8;
|
||||||
|
|
|
||||||
|
|
@ -362,7 +362,7 @@ namespace Ryujinx.Input.SDL2
|
||||||
|
|
||||||
if (HasConfiguration)
|
if (HasConfiguration)
|
||||||
{
|
{
|
||||||
var joyconStickConfig = GetLogicalJoyStickConfig(inputId);
|
JoyconConfigControllerStick<GamepadInputId, Common.Configuration.Hid.Controller.StickInputId> joyconStickConfig = GetLogicalJoyStickConfig(inputId);
|
||||||
|
|
||||||
if (joyconStickConfig != null)
|
if (joyconStickConfig != null)
|
||||||
{
|
{
|
||||||
|
|
@ -398,7 +398,7 @@ namespace Ryujinx.Input.SDL2
|
||||||
|
|
||||||
public bool IsPressed(GamepadButtonInputId inputId)
|
public bool IsPressed(GamepadButtonInputId inputId)
|
||||||
{
|
{
|
||||||
if (!_buttonsDriverMapping.TryGetValue(inputId, out var button))
|
if (!_buttonsDriverMapping.TryGetValue(inputId, out SDL_GameControllerButton button))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ namespace Ryujinx.Input.SDL2
|
||||||
|
|
||||||
private static (int leftIndex, int rightIndex) DetectJoyConPair(List<string> gamepadsIds)
|
private static (int leftIndex, int rightIndex) DetectJoyConPair(List<string> gamepadsIds)
|
||||||
{
|
{
|
||||||
var gamepadNames = gamepadsIds.Where(gamepadId => gamepadId != Id)
|
List<string> gamepadNames = gamepadsIds.Where(gamepadId => gamepadId != Id)
|
||||||
.Select((_, index) => SDL_GameControllerNameForIndex(index)).ToList();
|
.Select((_, index) => SDL_GameControllerNameForIndex(index)).ToList();
|
||||||
int leftIndex = gamepadNames.IndexOf(SDL2JoyCon.LeftName);
|
int leftIndex = gamepadNames.IndexOf(SDL2JoyCon.LeftName);
|
||||||
int rightIndex = gamepadNames.IndexOf(SDL2JoyCon.RightName);
|
int rightIndex = gamepadNames.IndexOf(SDL2JoyCon.RightName);
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,8 @@ namespace Ryujinx.Ava.Input
|
||||||
{
|
{
|
||||||
_size = new Size((int)rect.Width, (int)rect.Height);
|
_size = new Size((int)rect.Width, (int)rect.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleScrollStopped()
|
private void HandleScrollStopped()
|
||||||
{
|
{
|
||||||
Scroll = new Vector2(0, 0);
|
Scroll = new Vector2(0, 0);
|
||||||
}
|
}
|
||||||
|
|
@ -104,12 +104,18 @@ namespace Ryujinx.Ava.Input
|
||||||
}
|
}
|
||||||
private void Parent_PointerPressedEvent(object o, PointerPressedEventArgs args)
|
private void Parent_PointerPressedEvent(object o, PointerPressedEventArgs args)
|
||||||
{
|
{
|
||||||
uint button = (uint)args.GetCurrentPoint(_widget).Properties.PointerUpdateKind;
|
PointerPoint currentPoint = args.GetCurrentPoint(_widget);
|
||||||
|
uint button = (uint)currentPoint.Properties.PointerUpdateKind;
|
||||||
|
|
||||||
if ((uint)PressedButtons.Length > button)
|
if ((uint)PressedButtons.Length > button)
|
||||||
{
|
{
|
||||||
PressedButtons[button] = true;
|
PressedButtons[button] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.Pointer.Type == PointerType.Touch) // mouse position is unchanged for touch events, set touch position
|
||||||
|
{
|
||||||
|
CurrentPosition = new Vector2((float)currentPoint.Position.X, (float)currentPoint.Position.Y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Parent_PointerMovedEvent(object o, PointerEventArgs args)
|
private void Parent_PointerMovedEvent(object o, PointerEventArgs args)
|
||||||
|
|
|
||||||
|
|
@ -201,8 +201,6 @@ namespace Ryujinx.Ava.Systems
|
||||||
ConfigurationState.Instance.Graphics.AspectRatio.Event += UpdateAspectRatioState;
|
ConfigurationState.Instance.Graphics.AspectRatio.Event += UpdateAspectRatioState;
|
||||||
ConfigurationState.Instance.System.EnableDockedMode.Event += UpdateDockedModeState;
|
ConfigurationState.Instance.System.EnableDockedMode.Event += UpdateDockedModeState;
|
||||||
ConfigurationState.Instance.System.AudioVolume.Event += UpdateAudioVolumeState;
|
ConfigurationState.Instance.System.AudioVolume.Event += UpdateAudioVolumeState;
|
||||||
ConfigurationState.Instance.System.EnableDockedMode.Event += UpdateDockedModeState;
|
|
||||||
ConfigurationState.Instance.System.AudioVolume.Event += UpdateAudioVolumeState;
|
|
||||||
ConfigurationState.Instance.Graphics.AntiAliasing.Event += UpdateAntiAliasing;
|
ConfigurationState.Instance.Graphics.AntiAliasing.Event += UpdateAntiAliasing;
|
||||||
ConfigurationState.Instance.Graphics.ScalingFilter.Event += UpdateScalingFilter;
|
ConfigurationState.Instance.Graphics.ScalingFilter.Event += UpdateScalingFilter;
|
||||||
ConfigurationState.Instance.Graphics.ScalingFilterLevel.Event += UpdateScalingFilterLevel;
|
ConfigurationState.Instance.Graphics.ScalingFilterLevel.Event += UpdateScalingFilterLevel;
|
||||||
|
|
|
||||||
|
|
@ -848,7 +848,7 @@ namespace Ryujinx.Ava.Systems.AppLibrary
|
||||||
|
|
||||||
TimeSpan temporary = TimeSpan.Zero;
|
TimeSpan temporary = TimeSpan.Zero;
|
||||||
|
|
||||||
foreach (var installedApplication in Applications.Items)
|
foreach (ApplicationData installedApplication in Applications.Items)
|
||||||
{
|
{
|
||||||
temporary += LoadAndSaveMetaData(installedApplication.IdString).TimePlayed;
|
temporary += LoadAndSaveMetaData(installedApplication.IdString).TimePlayed;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ namespace Ryujinx.Ava.Systems
|
||||||
WorkingDirectory = executableDirectory,
|
WorkingDirectory = executableDirectory,
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var arg in args)
|
foreach (string arg in args)
|
||||||
{
|
{
|
||||||
processStart.ArgumentList.Add(arg);
|
processStart.ArgumentList.Add(arg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ namespace Ryujinx.Ava.UI.Applet
|
||||||
|
|
||||||
private string GetWindowsFontByLanguage()
|
private string GetWindowsFontByLanguage()
|
||||||
{
|
{
|
||||||
var culture = CultureInfo.CurrentUICulture;
|
CultureInfo culture = CultureInfo.CurrentUICulture;
|
||||||
string langCode = culture.Name;
|
string langCode = culture.Name;
|
||||||
|
|
||||||
return culture.TwoLetterISOLanguageName switch
|
return culture.TwoLetterISOLanguageName switch
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ namespace Ryujinx.Ava.UI.Models
|
||||||
|
|
||||||
private static async Task<string> GetAllAsyncRequestImpl(HttpClient client = null)
|
private static async Task<string> GetAllAsyncRequestImpl(HttpClient client = null)
|
||||||
{
|
{
|
||||||
var ldnWebHost = ConfigurationState.Instance.Multiplayer.GetLdnWebServer();
|
string ldnWebHost = ConfigurationState.Instance.Multiplayer.GetLdnWebServer();
|
||||||
|
|
||||||
LocaleManager.Associate(LocaleKeys.LdnGameListRefreshToolTip, ldnWebHost);
|
LocaleManager.Associate(LocaleKeys.LdnGameListRefreshToolTip, ldnWebHost);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
SortApply();
|
SortApply();
|
||||||
}
|
}
|
||||||
|
|
||||||
var filtered = _visibleEntries;
|
IEnumerable<LdnGameModel> filtered = _visibleEntries;
|
||||||
|
|
||||||
if (OnlyShowForOwnedGames)
|
if (OnlyShowForOwnedGames)
|
||||||
filtered = filtered.Where(x => _ownedGameTitleIds.ContainsIgnoreCase(x.Title.Id));
|
filtered = filtered.Where(x => _ownedGameTitleIds.ContainsIgnoreCase(x.Title.Id));
|
||||||
|
|
|
||||||
|
|
@ -348,7 +348,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
{
|
{
|
||||||
if (ts.HasValue)
|
if (ts.HasValue)
|
||||||
{
|
{
|
||||||
var formattedPlayTime = ValueFormatUtils.FormatTimeSpan(ts.Value);
|
string formattedPlayTime = ValueFormatUtils.FormatTimeSpan(ts.Value);
|
||||||
LocaleManager.Associate(LocaleKeys.GameListLabelTotalTimePlayed, formattedPlayTime);
|
LocaleManager.Associate(LocaleKeys.GameListLabelTotalTimePlayed, formattedPlayTime);
|
||||||
ShowTotalTimePlayed = formattedPlayTime != string.Empty;
|
ShowTotalTimePlayed = formattedPlayTime != string.Empty;
|
||||||
return;
|
return;
|
||||||
|
|
@ -827,10 +827,10 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
|
|
||||||
private void RefreshGrid()
|
private void RefreshGrid()
|
||||||
{
|
{
|
||||||
var appsList = Applications.ToObservableChangeSet()
|
IObservableList<ApplicationData> appsList = Applications.ToObservableChangeSet()
|
||||||
.Filter(Filter)
|
.Filter(Filter)
|
||||||
.Sort(GetComparer())
|
.Sort(GetComparer())
|
||||||
.Bind(out var apps)
|
.Bind(out ReadOnlyObservableCollection<ApplicationData> apps)
|
||||||
.AsObservableList();
|
.AsObservableList();
|
||||||
|
|
||||||
AppsObservableList = apps;
|
AppsObservableList = apps;
|
||||||
|
|
|
||||||
|
|
@ -447,9 +447,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
_virtualFileSystem = virtualFileSystem;
|
_virtualFileSystem = virtualFileSystem;
|
||||||
_contentManager = contentManager;
|
_contentManager = contentManager;
|
||||||
|
|
||||||
if (gameIconData != null && gameIconData.Length > 0)
|
if (gameIconData is { Length: > 0 })
|
||||||
{
|
{
|
||||||
using var ms = new MemoryStream(gameIconData);
|
using MemoryStream ms = new(gameIconData);
|
||||||
_gameIcon = new Bitmap(ms);
|
_gameIcon = new Bitmap(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue