Skip to content

Commit

Permalink
Merge branch 'Ryujinx:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
TSRBerry authored Oct 29, 2022
2 parents 2b8dfcf + 4e34170 commit 0d11c1d
Show file tree
Hide file tree
Showing 17 changed files with 171 additions and 70 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/nightly_pr_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
const pull_head_sha = '${{github.event.workflow_run.head_sha}}';
const issue_number = await (async () => {
const pulls = await github.pulls.list({owner, repo});
const pulls = await github.rest.pulls.list({owner, repo});
for await (const {data} of github.paginate.iterator(pulls)) {
for (const pull of data) {
if (pull.head.sha === pull_head_sha) {
Expand All @@ -31,7 +31,7 @@ jobs:
return core.error(`No matching pull request found`);
}
const {data: {artifacts}} = await github.actions.listWorkflowRunArtifacts({owner, repo, run_id});
const {data: {artifacts}} = await github.rest.actions.listWorkflowRunArtifacts({owner, repo, run_id});
if (!artifacts.length) {
return core.error(`No artifacts found`);
}
Expand All @@ -57,12 +57,12 @@ jobs:
body += hidden_headless_artifacts;
body += hidden_debug_artifacts;
const {data: comments} = await github.issues.listComments({repo, owner, issue_number});
const {data: comments} = await github.rest.issues.listComments({repo, owner, issue_number});
const existing_comment = comments.find((c) => c.user.login === 'github-actions[bot]');
if (existing_comment) {
core.info(`Updating comment ${existing_comment.id}`);
await github.issues.updateComment({repo, owner, comment_id: existing_comment.id, body});
await github.rest.issues.updateComment({repo, owner, comment_id: existing_comment.id, body});
} else {
core.info(`Creating a comment`);
await github.issues.createComment({repo, owner, issue_number, body});
await github.rest.issues.createComment({repo, owner, issue_number, body});
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@

## Compatibility

As of October 2022, Ryujinx has been tested on approximately 3,600 titles; over 3,500 boot past menus and into gameplay, with roughly 3,000 of those being considered playable. You can check out the compatibility list [here](https://github.com/Ryujinx/Ryujinx-Games-List/issues).
Anyone is free to submit a new game test or update an existing game test entry; simply follow the new issue template and testing guidelines, or post as a reply to the applicable game issue. Use the search function to see if a game has been tested already!
As of October 2022, Ryujinx has been tested on approximately 3,700 titles; over 3,500 boot past menus and into gameplay, with roughly 3,000 of those being considered playable.
You can check out the compatibility list [here](https://github.com/Ryujinx/Ryujinx-Games-List/issues). Anyone is free to submit a new game test or update an existing game test entry; simply follow the new issue template and testing guidelines, or post as a reply to the applicable game issue. Use the search function to see if a game has been tested already!

## Usage

Expand Down Expand Up @@ -90,7 +90,7 @@ Ryujinx system files are stored in the `Ryujinx` folder. This folder is located

- **GPU**

The GPU emulator emulates the Switch's Maxwell GPU using the OpenGL API (version 4.5 minimum) through a custom build of OpenTK. There are currently four graphics enhancements available to the end user in Ryujinx: disk shader caching, resolution scaling, aspect ratio adjustment and anisotropic filtering. These enhancements can be adjusted or toggled as desired in the GUI.
The GPU emulator emulates the Switch's Maxwell GPU using either the OpenGL (version 4.5 minimum) or Vulkan APIs through a custom build of OpenTK or Silk.NET respectively. There are currently four graphics enhancements available to the end user in Ryujinx: Disk Shader Caching, Resolution Scaling, Aspect Ratio Adjustment, and Anisotropic Filtering. These enhancements can be adjusted or toggled as desired in the GUI.

- **Input**

Expand Down
2 changes: 1 addition & 1 deletion Ryujinx.Ava/Ryujinx.Ava.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<PackageReference Include="Silk.NET.Vulkan" Version="2.10.1" />
<PackageReference Include="Silk.NET.Vulkan.Extensions.EXT" Version="2.10.1" />
<PackageReference Include="Silk.NET.Vulkan.Extensions.KHR" Version="2.10.1" />
<PackageReference Include="SPB" Version="0.0.4-build24" />
<PackageReference Include="SPB" Version="0.0.4-build27" />
<PackageReference Include="SharpZipLib" Version="1.3.3" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
</ItemGroup>
Expand Down
56 changes: 26 additions & 30 deletions Ryujinx.Ava/Ui/Controls/ContentDialogHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Avalonia.Controls.Primitives;
using Avalonia.Media;
using Avalonia.Threading;
using FluentAvalonia.Core;
using FluentAvalonia.UI.Controls;
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.Ui.Models;
Expand All @@ -27,7 +28,10 @@ private async static Task<UserResult> ShowContentDialog(
string secondaryButton,
string closeButton,
int iconSymbol,
UserResult primaryButtonResult = UserResult.Ok)
UserResult primaryButtonResult = UserResult.Ok,
ManualResetEvent deferResetEvent = null,
Func<Window, Task> doWhileDeferred = null,
TypedEventHandler<ContentDialog, ContentDialogButtonClickEventArgs> deferCloseAction = null)
{
UserResult result = UserResult.None;

Expand Down Expand Up @@ -110,12 +114,19 @@ async Task ShowDialog()
contentDialog.SecondaryButtonCommand = MiniCommand.Create(() =>
{
result = UserResult.No;
contentDialog.PrimaryButtonClick -= deferCloseAction;
});
contentDialog.CloseButtonCommand = MiniCommand.Create(() =>
{
result = UserResult.Cancel;
contentDialog.PrimaryButtonClick -= deferCloseAction;
});

if (deferResetEvent != null)
{
contentDialog.PrimaryButtonClick += deferCloseAction;
}

await contentDialog.ShowAsync(ContentDialogPlacement.Popup);

overlay?.Close();
Expand Down Expand Up @@ -143,35 +154,20 @@ public async static Task<UserResult> ShowDeferredContentDialog(
Func<Window, Task> doWhileDeferred = null)
{
bool startedDeferring = false;

UserResult result = UserResult.None;

ContentDialog contentDialog = new ContentDialog
{
Title = title,
PrimaryButtonText = primaryButton,
SecondaryButtonText = secondaryButton,
CloseButtonText = closeButton,
Content = CreateDialogTextContent(primaryText, secondaryText, iconSymbol),
PrimaryButtonCommand = MiniCommand.Create(() =>
{
result = primaryButton == LocaleManager.Instance["InputDialogYes"] ? UserResult.Yes : UserResult.Ok;
}),
};
contentDialog.SecondaryButtonCommand = MiniCommand.Create(() =>
{
contentDialog.PrimaryButtonClick -= DeferClose;
result = UserResult.No;
});
contentDialog.CloseButtonCommand = MiniCommand.Create(() =>
{
contentDialog.PrimaryButtonClick -= DeferClose;
result = UserResult.Cancel;
});
contentDialog.PrimaryButtonClick += DeferClose;
await contentDialog.ShowAsync(ContentDialogPlacement.Popup);

return result;
return await ShowContentDialog(
title,
primaryText,
secondaryText,
primaryButton,
secondaryButton,
closeButton,
iconSymbol,
primaryButton == LocaleManager.Instance["InputDialogYes"] ? UserResult.Yes : UserResult.Ok,
deferResetEvent,
doWhileDeferred,
DeferClose);

async void DeferClose(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
Expand All @@ -180,15 +176,15 @@ async void DeferClose(ContentDialog sender, ContentDialogButtonClickEventArgs ar
return;
}

contentDialog.PrimaryButtonClick -= DeferClose;
sender.PrimaryButtonClick -= DeferClose;

startedDeferring = true;

var deferral = args.GetDeferral();

result = primaryButton == LocaleManager.Instance["InputDialogYes"] ? UserResult.Yes : UserResult.Ok;

contentDialog.PrimaryButtonClick -= DeferClose;
sender.PrimaryButtonClick -= DeferClose;

#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
Task.Run(() =>
Expand Down
5 changes: 2 additions & 3 deletions Ryujinx.Graphics.Vulkan/BufferHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ class BufferHolder : IDisposable
private const int MaxUpdateBufferSize = 0x10000;

public const AccessFlags DefaultAccessFlags =
AccessFlags.AccessIndirectCommandReadBit |
AccessFlags.AccessShaderReadBit |
AccessFlags.AccessShaderWriteBit |
AccessFlags.AccessTransferReadBit |
AccessFlags.AccessTransferWriteBit |
AccessFlags.AccessUniformReadBit |
AccessFlags.AccessShaderReadBit |
AccessFlags.AccessShaderWriteBit;
AccessFlags.AccessUniformReadBit;

private readonly VulkanRenderer _gd;
private readonly Device _device;
Expand Down
33 changes: 25 additions & 8 deletions Ryujinx.Graphics.Vulkan/PipelineBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,26 @@ public unsafe void ClearRenderTargetDepthStencil(int layer, int layerCount, floa
Gd.Api.CmdClearAttachments(CommandBuffer, 1, &attachment, 1, &clearRect);
}

public void CommandBufferBarrier()
public unsafe void CommandBufferBarrier()
{
// TODO: More specific barrier?
Barrier();
MemoryBarrier memoryBarrier = new MemoryBarrier()
{
SType = StructureType.MemoryBarrier,
SrcAccessMask = BufferHolder.DefaultAccessFlags,
DstAccessMask = AccessFlags.AccessIndirectCommandReadBit
};

Gd.Api.CmdPipelineBarrier(
CommandBuffer,
PipelineStageFlags.PipelineStageAllCommandsBit,
PipelineStageFlags.PipelineStageDrawIndirectBit,
0,
1,
memoryBarrier,
0,
null,
0,
null);
}

public void CopyBuffer(BufferHandle source, BufferHandle destination, int srcOffset, int dstOffset, int size)
Expand Down Expand Up @@ -535,10 +551,11 @@ public void SetBlendState(int index, BlendDescriptor blend)
vkBlend = new PipelineColorBlendAttachmentState();
}

_newState.BlendConstantR = blend.BlendConstant.Red;
_newState.BlendConstantG = blend.BlendConstant.Green;
_newState.BlendConstantB = blend.BlendConstant.Blue;
_newState.BlendConstantA = blend.BlendConstant.Alpha;
DynamicState.SetBlendConstants(
blend.BlendConstant.Red,
blend.BlendConstant.Green,
blend.BlendConstant.Blue,
blend.BlendConstant.Alpha);

SignalStateChange();
}
Expand Down Expand Up @@ -823,7 +840,7 @@ public void SetTransformFeedbackBuffers(ReadOnlySpan<BufferRange> buffers)

if (range.Handle != BufferHandle.Null)
{
_transformFeedbackBuffers[i] =
_transformFeedbackBuffers[i] =
new BufferState(Gd.BufferManager.GetBuffer(CommandBuffer, range.Handle, range.Offset, range.Size, true), range.Offset, range.Size);
_transformFeedbackBuffers[i].BindTransformFeedbackBuffer(Gd, Cbs, (uint)i);
}
Expand Down
5 changes: 0 additions & 5 deletions Ryujinx.Graphics.Vulkan/PipelineConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ public static PipelineState ToVulkanPipelineState(this ProgramPipelineState stat

// It is assumed that Dynamic State is enabled when this conversion is used.

pipeline.BlendConstantA = state.BlendDescriptors[0].BlendConstant.Alpha;
pipeline.BlendConstantB = state.BlendDescriptors[0].BlendConstant.Blue;
pipeline.BlendConstantG = state.BlendDescriptors[0].BlendConstant.Green;
pipeline.BlendConstantR = state.BlendDescriptors[0].BlendConstant.Red;

pipeline.CullMode = state.CullEnable ? state.CullMode.Convert() : CullModeFlags.CullModeNone;

pipeline.DepthBoundsTestEnable = false; // Not implemented.
Expand Down
33 changes: 28 additions & 5 deletions Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,34 @@ struct PipelineDynamicState
private uint _frontWriteMask;
private uint _frontReference;

private Array4<float> _blendConstants;

public int ViewportsCount;
public Array16<Viewport> Viewports;

private enum DirtyFlags
{
None = 0,
DepthBias = 1 << 0,
Scissor = 1 << 1,
Stencil = 1 << 2,
Viewport = 1 << 3,
All = DepthBias | Scissor | Stencil | Viewport
Blend = 1 << 0,
DepthBias = 1 << 1,
Scissor = 1 << 2,
Stencil = 1 << 3,
Viewport = 1 << 4,
All = Blend | DepthBias | Scissor | Stencil | Viewport
}

private DirtyFlags _dirty;

public void SetBlendConstants(float r, float g, float b, float a)
{
_blendConstants[0] = r;
_blendConstants[1] = g;
_blendConstants[2] = b;
_blendConstants[3] = a;

_dirty |= DirtyFlags.Blend;
}

public void SetDepthBias(float slopeFactor, float constantFactor, float clamp)
{
_depthBiasSlopeFactor = slopeFactor;
Expand Down Expand Up @@ -87,6 +100,11 @@ public void ForceAllDirty()

public void ReplayIfDirty(Vk api, CommandBuffer commandBuffer)
{
if (_dirty.HasFlag(DirtyFlags.Blend))
{
RecordBlend(api, commandBuffer);
}

if (_dirty.HasFlag(DirtyFlags.DepthBias))
{
RecordDepthBias(api, commandBuffer);
Expand All @@ -110,6 +128,11 @@ public void ReplayIfDirty(Vk api, CommandBuffer commandBuffer)
_dirty = DirtyFlags.None;
}

private void RecordBlend(Vk api, CommandBuffer commandBuffer)
{
api.CmdSetBlendConstants(commandBuffer, _blendConstants.AsSpan());
}

private void RecordDepthBias(Vk api, CommandBuffer commandBuffer)
{
api.CmdSetDepthBias(commandBuffer, _depthBiasConstantFactor, _depthBiasClamp, _depthBiasSlopeFactor);
Expand Down
5 changes: 3 additions & 2 deletions Ryujinx.Graphics.Vulkan/PipelineState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ public unsafe Auto<DisposablePipeline> CreateGraphicsPipeline(
colorBlendState.BlendConstants[3] = BlendConstantA;

bool supportsExtDynamicState = gd.Capabilities.SupportsExtendedDynamicState;
int dynamicStatesCount = supportsExtDynamicState ? 8 : 7;
int dynamicStatesCount = supportsExtDynamicState ? 9 : 8;

DynamicState* dynamicStates = stackalloc DynamicState[dynamicStatesCount];

Expand All @@ -510,10 +510,11 @@ public unsafe Auto<DisposablePipeline> CreateGraphicsPipeline(
dynamicStates[4] = DynamicState.StencilCompareMask;
dynamicStates[5] = DynamicState.StencilWriteMask;
dynamicStates[6] = DynamicState.StencilReference;
dynamicStates[7] = DynamicState.BlendConstants;

if (supportsExtDynamicState)
{
dynamicStates[7] = DynamicState.VertexInputBindingStrideExt;
dynamicStates[8] = DynamicState.VertexInputBindingStrideExt;
}

var pipelineDynamicStateCreateInfo = new PipelineDynamicStateCreateInfo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class ISelfController : IpcService
private bool _handlesRequestToDisplay = false;
private bool _autoSleepDisabled = false;
private bool _albumImageTakenNotificationEnabled = false;
private bool _recordVolumeMuted = false;

private uint _screenShotImageOrientation = 0;
private uint _idleTimeDetectionExtension = 0;
Expand Down Expand Up @@ -389,5 +390,18 @@ public ResultCode SaveCurrentScreenshot(ServiceCtx context)

return ResultCode.Success;
}

[CommandHipc(130)] // 13.0.0+
// SetRecordVolumeMuted(b8)
public ResultCode SetRecordVolumeMuted(ServiceCtx context)
{
bool recordVolumeMuted = context.RequestData.ReadBoolean();

Logger.Stub?.PrintStub(LogClass.ServiceAm, new { recordVolumeMuted });

_recordVolumeMuted = recordVolumeMuted;

return ResultCode.Success;
}
}
}
}
14 changes: 13 additions & 1 deletion Ryujinx.HLE/HOS/Services/Hid/Irs/IIrSensorServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,18 @@ public ResultCode CheckFirmwareVersion(ServiceCtx context)
return ResultCode.Success;
}

[CommandHipc(318)] // 4.0.0+
// StopImageProcessorAsync(nn::irsensor::IrCameraHandle, nn::applet::AppletResourceUserId, pid)
public ResultCode StopImageProcessorAsync(ServiceCtx context)
{
int irCameraHandle = context.RequestData.ReadInt32();
long appletResourceUserId = context.RequestData.ReadInt64();

Logger.Stub?.PrintStub(LogClass.ServiceIrs, new { appletResourceUserId, irCameraHandle });

return ResultCode.Success;
}

[CommandHipc(319)] // 4.0.0+
// ActivateIrsensorWithFunctionLevel(nn::applet::AppletResourceUserId, nn::irsensor::PackedFunctionLevel, pid)
public ResultCode ActivateIrsensorWithFunctionLevel(ServiceCtx context)
Expand All @@ -225,4 +237,4 @@ private ResultCode CheckCameraHandle(IrCameraHandle irCameraHandle)
return ResultCode.Success;
}
}
}
}
Loading

0 comments on commit 0d11c1d

Please sign in to comment.