Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
rebased
Browse files Browse the repository at this point in the history
  • Loading branch information
emmauss committed Mar 26, 2022
1 parent 3df95a0 commit 13d02ab
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 47 deletions.
5 changes: 0 additions & 5 deletions Ryujinx.Ava/AppHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using ARMeilleure.Translation.PTC;
using Avalonia.Input;
using Avalonia.Threading;
using LibHac.FsSystem;
using LibHac.Tools.FsSystem;
using OpenTK.Windowing.Common;
using Ryujinx.Audio.Backends.Dummy;
Expand All @@ -26,7 +25,6 @@
using Ryujinx.Graphics.Gpu;
using Ryujinx.Graphics.OpenGL;
using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.FileSystem.Content;
using Ryujinx.HLE.HOS;
using Ryujinx.HLE.HOS.Services.Account.Acc;
using Ryujinx.HLE.HOS.SystemState;
Expand All @@ -37,12 +35,9 @@
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SPB.Graphics.OpenGL;
using SPB.Platform.WGL;
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;

Expand Down
2 changes: 1 addition & 1 deletion Ryujinx.Ava/Common/SetupValidator.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Ryujinx.Common.Logging;
using Ryujinx.HLE.FileSystem.Content;
using Ryujinx.HLE.FileSystem;
using System;
using System.IO;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Ryujinx.Ava.Ui.Windows;
using Ryujinx.HLE.FileSystem.Content;
using Ryujinx.HLE.FileSystem;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
using System.IO;
Expand Down
6 changes: 2 additions & 4 deletions Ryujinx.Ava/Ui/ViewModels/AvatarProfileViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,20 @@
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem;
using LibHac.Ncm;
using LibHac.Tools.Fs;
using LibHac.Tools.FsSystem;
using LibHac.Tools.FsSystem.NcaUtils;
using Ryujinx.Ava.Ui.Models;
using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.FileSystem.Content;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using System;
using System.Buffers.Binary;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Color = Avalonia.Media.Color;
Expand Down Expand Up @@ -182,7 +180,7 @@ public static void PreloadAvatars(ContentManager contentManager, VirtualFileSyst
}

string contentPath =
contentManager.GetInstalledContentPath(0x010000000000080A, StorageId.NandSystem, NcaContentType.Data);
contentManager.GetInstalledContentPath(0x010000000000080A, StorageId.BuiltInSystem, NcaContentType.Data);
string avatarPath = virtualFileSystem.SwitchPathToSystemPath(contentPath);

if (!string.IsNullOrWhiteSpace(avatarPath))
Expand Down
11 changes: 2 additions & 9 deletions Ryujinx.Ava/Ui/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,37 +1,30 @@
using ARMeilleure.Translation.PTC;
using Avalonia;
using Avalonia.Collections;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Media;
using Avalonia.Threading;
using DynamicData;
using DynamicData.Binding;
using LibHac;
using LibHac.Fs;
using LibHac.FsSystem;
using LibHac.Tools.FsSystem.NcaUtils;
using LibHac.Ncm;
using Ryujinx.Ava.Common;
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.Ui.Controls;
using Ryujinx.Ava.Ui.Models;
using Ryujinx.Ava.Ui.Windows;
using Ryujinx.Common;
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging;
using Ryujinx.Configuration;
using Ryujinx.HLE;
using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.FileSystem.Content;
using Ryujinx.HLE.HOS;
using Ryujinx.Modules;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.IO;
using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
using Path = System.IO.Path;
Expand Down Expand Up @@ -869,7 +862,7 @@ public async void SetGridMode()

public async void OpenMiiApplet()
{
string contentPath = _owner.ContentManager.GetInstalledContentPath(0x0100000000001009, StorageId.NandSystem, NcaContentType.Program);
string contentPath = _owner.ContentManager.GetInstalledContentPath(0x0100000000001009, StorageId.BuiltInSystem, NcaContentType.Program);

if (!string.IsNullOrWhiteSpace(contentPath))
{
Expand Down
2 changes: 0 additions & 2 deletions Ryujinx.Ava/Ui/ViewModels/SettingsViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Avalonia.Collections;
using Avalonia.Controls;
using Avalonia.Threading;
using LibHac.FsSystem;
using LibHac.Tools.FsSystem;
using Ryujinx.Audio.Backends.OpenAL;
using Ryujinx.Audio.Backends.SDL2;
Expand All @@ -15,7 +14,6 @@
using Ryujinx.Configuration;
using Ryujinx.Configuration.System;
using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.FileSystem.Content;
using Ryujinx.HLE.HOS.Services.Time.TimeZone;
using System;
using System.Collections.Generic;
Expand Down
6 changes: 1 addition & 5 deletions Ryujinx.Ava/Ui/Windows/AvatarWindow.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
using FluentAvalonia.UI.Controls;
using Ryujinx.Ava.Ui.ViewModels;
using Ryujinx.HLE.FileSystem.Content;
using Ryujinx.HLE.HOS.Services.Account.Acc;
using Ryujinx.HLE.FileSystem;
using System;

namespace Ryujinx.Ava.Ui.Windows
Expand Down
8 changes: 0 additions & 8 deletions Ryujinx.Ava/Ui/Windows/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
using Avalonia;
using Avalonia.Collections;
using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.LogicalTree;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
using Avalonia.Threading;
using Avalonia.VisualTree;
using FluentAvalonia.UI.Controls;
using LibHac;
using LibHac.Common;
using Ryujinx.Ava.Common;
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.Ui.Applet;
Expand All @@ -23,7 +17,6 @@
using Ryujinx.Configuration;
using Ryujinx.Graphics.Gpu;
using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.FileSystem.Content;
using Ryujinx.HLE.HOS;
using Ryujinx.HLE.HOS.Services.Account.Acc;
using Ryujinx.Input.Avalonia;
Expand All @@ -34,7 +27,6 @@
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using InputManager = Ryujinx.Input.HLE.InputManager;
using ProgressBar = Avalonia.Controls.ProgressBar;
Expand Down
1 change: 0 additions & 1 deletion Ryujinx.Ava/Ui/Windows/SettingsWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.Ui.ViewModels;
using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.FileSystem.Content;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down
1 change: 0 additions & 1 deletion Ryujinx.Ava/Ui/Windows/UserProfileWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Avalonia.Markup.Xaml;
using Ryujinx.Ava.Ui.ViewModels;
using Ryujinx.HLE.FileSystem;
using Ryujinx.HLE.FileSystem.Content;
using Ryujinx.HLE.HOS.Services.Account.Acc;
using System.Threading.Tasks;
using UserProfile = Ryujinx.Ava.Ui.Models.UserProfile;
Expand Down
15 changes: 5 additions & 10 deletions Ryujinx.Graphics.OpenGL/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,11 @@ public void Present(ITexture texture, ImageCrop crop, Func<int, bool> swapBuffer

(int oldDrawFramebufferHandle, int oldReadFramebufferHandle) = ((Pipeline)_renderer.Pipeline).GetBoundFramebuffers();

CopyTextureToFrameBufferRGB(0, GetCopyFramebufferHandleLazy(), (TextureView)texture, crop, swapBuffersCallback);

GL.BindFramebuffer(FramebufferTarget.ReadFramebuffer, _stagingFrameBuffer);

_currentTexture = swapBuffersCallback(_stagingTextures[_currentTexture]) ? ++_currentTexture % _stagingTextures.Length : _currentTexture;
CopyTextureToFrameBufferRGB(_stagingFrameBuffer, GetCopyFramebufferHandleLazy(), (TextureView)texture, crop, swapBuffersCallback);

GL.BindFramebuffer(FramebufferTarget.ReadFramebuffer, oldReadFramebufferHandle);
GL.BindFramebuffer(FramebufferTarget.DrawFramebuffer, oldDrawFramebufferHandle);

((Pipeline)_renderer.Pipeline).RestoreScissor0Enable();
((Pipeline)_renderer.Pipeline).RestoreRasterizerDiscard();

GL.Enable(EnableCap.FramebufferSrgb);

GL.PixelStore(PixelStoreParameter.UnpackAlignment, 4);
Expand Down Expand Up @@ -91,7 +84,7 @@ public void SetSize(int width, int height)
_sizeChanged = true;
}

private void CopyTextureToFrameBufferRGB(int drawFramebuffer, int readFramebuffer, TextureView view, ImageCrop crop, Action swapBuffersCallback)
private void CopyTextureToFrameBufferRGB(int drawFramebuffer, int readFramebuffer, TextureView view, ImageCrop crop, Func<int, bool> swapBuffersCallback)
{
GL.BindFramebuffer(FramebufferTarget.DrawFramebuffer, drawFramebuffer);
GL.BindFramebuffer(FramebufferTarget.ReadFramebuffer, readFramebuffer);
Expand Down Expand Up @@ -195,7 +188,9 @@ private void CopyTextureToFrameBufferRGB(int drawFramebuffer, int readFramebuffe
GL.Viewport(0, 0, _width, _height);
GL.BindFramebuffer(FramebufferTarget.Framebuffer, drawFramebuffer);

swapBuffersCallback();
GL.BindFramebuffer(FramebufferTarget.ReadFramebuffer, _stagingFrameBuffer);

_currentTexture = swapBuffersCallback(_stagingTextures[_currentTexture]) ? ++_currentTexture % _stagingTextures.Length : _currentTexture;

((Pipeline)_renderer.Pipeline).RestoreClipControl();
((Pipeline)_renderer.Pipeline).RestoreScissor0Enable();
Expand Down

0 comments on commit 13d02ab

Please sign in to comment.