mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-12-23 08:05:47 +00:00
gui/gpu: Implement setting and toggle for Aspect Ratio (#1777)
* gui/gpu: Implement setting and toggle for Aspect Ratio * address gdkchan feedback and add 16:10 * fix config.json file * Fix rebase * Address gdkchan feedback * Address rip feedback * Fix aspectWidth
This commit is contained in:
parent
808380690c
commit
11222516c4
14 changed files with 264 additions and 57 deletions
59
Ryujinx.Common/Configuration/AspectRatioExtensions.cs
Normal file
59
Ryujinx.Common/Configuration/AspectRatioExtensions.cs
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
namespace Ryujinx.Common.Configuration
|
||||||
|
{
|
||||||
|
public enum AspectRatio
|
||||||
|
{
|
||||||
|
Fixed4x3,
|
||||||
|
Fixed16x9,
|
||||||
|
Fixed16x10,
|
||||||
|
Fixed21x9,
|
||||||
|
Fixed32x9,
|
||||||
|
Stretched
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AspectRatioExtensions
|
||||||
|
{
|
||||||
|
public static float ToFloat(this AspectRatio aspectRatio)
|
||||||
|
{
|
||||||
|
return aspectRatio.ToFloatX() / aspectRatio.ToFloatY();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float ToFloatX(this AspectRatio aspectRatio)
|
||||||
|
{
|
||||||
|
return aspectRatio switch
|
||||||
|
{
|
||||||
|
AspectRatio.Fixed4x3 => 4.0f,
|
||||||
|
AspectRatio.Fixed16x9 => 16.0f,
|
||||||
|
AspectRatio.Fixed16x10 => 16.0f,
|
||||||
|
AspectRatio.Fixed21x9 => 21.0f,
|
||||||
|
AspectRatio.Fixed32x9 => 32.0f,
|
||||||
|
_ => 16.0f
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float ToFloatY(this AspectRatio aspectRatio)
|
||||||
|
{
|
||||||
|
return aspectRatio switch
|
||||||
|
{
|
||||||
|
AspectRatio.Fixed4x3 => 3.0f,
|
||||||
|
AspectRatio.Fixed16x9 => 9.0f,
|
||||||
|
AspectRatio.Fixed16x10 => 10.0f,
|
||||||
|
AspectRatio.Fixed21x9 => 9.0f,
|
||||||
|
AspectRatio.Fixed32x9 => 9.0f,
|
||||||
|
_ => 9.0f
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ToText(this AspectRatio aspectRatio)
|
||||||
|
{
|
||||||
|
return aspectRatio switch
|
||||||
|
{
|
||||||
|
AspectRatio.Fixed4x3 => "4:3",
|
||||||
|
AspectRatio.Fixed16x9 => "16:9",
|
||||||
|
AspectRatio.Fixed16x10 => "16:10",
|
||||||
|
AspectRatio.Fixed21x9 => "21:9",
|
||||||
|
AspectRatio.Fixed32x9 => "32:9",
|
||||||
|
_ => "Stretched"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,7 +14,7 @@ namespace Ryujinx.Configuration
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current version of the file format
|
/// The current version of the file format
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const int CurrentVersion = 17;
|
public const int CurrentVersion = 18;
|
||||||
|
|
||||||
public int Version { get; set; }
|
public int Version { get; set; }
|
||||||
|
|
||||||
|
@ -33,6 +33,11 @@ namespace Ryujinx.Configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float MaxAnisotropy { get; set; }
|
public float MaxAnisotropy { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Aspect Ratio applied to the renderer window.
|
||||||
|
/// </summary>
|
||||||
|
public AspectRatio AspectRatio { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dumps shaders in this local directory
|
/// Dumps shaders in this local directory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -278,6 +278,11 @@ namespace Ryujinx.Configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ReactiveObject<float> MaxAnisotropy { get; private set; }
|
public ReactiveObject<float> MaxAnisotropy { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Aspect Ratio applied to the renderer window.
|
||||||
|
/// </summary>
|
||||||
|
public ReactiveObject<AspectRatio> AspectRatio { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resolution Scale. An integer scale applied to applicable render targets. Values 1-4, or -1 to use a custom floating point scale instead.
|
/// Resolution Scale. An integer scale applied to applicable render targets. Values 1-4, or -1 to use a custom floating point scale instead.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -308,6 +313,7 @@ namespace Ryujinx.Configuration
|
||||||
ResScale = new ReactiveObject<int>();
|
ResScale = new ReactiveObject<int>();
|
||||||
ResScaleCustom = new ReactiveObject<float>();
|
ResScaleCustom = new ReactiveObject<float>();
|
||||||
MaxAnisotropy = new ReactiveObject<float>();
|
MaxAnisotropy = new ReactiveObject<float>();
|
||||||
|
AspectRatio = new ReactiveObject<AspectRatio>();
|
||||||
ShadersDumpPath = new ReactiveObject<string>();
|
ShadersDumpPath = new ReactiveObject<string>();
|
||||||
EnableVsync = new ReactiveObject<bool>();
|
EnableVsync = new ReactiveObject<bool>();
|
||||||
EnableShaderCache = new ReactiveObject<bool>();
|
EnableShaderCache = new ReactiveObject<bool>();
|
||||||
|
@ -388,6 +394,7 @@ namespace Ryujinx.Configuration
|
||||||
ResScale = Graphics.ResScale,
|
ResScale = Graphics.ResScale,
|
||||||
ResScaleCustom = Graphics.ResScaleCustom,
|
ResScaleCustom = Graphics.ResScaleCustom,
|
||||||
MaxAnisotropy = Graphics.MaxAnisotropy,
|
MaxAnisotropy = Graphics.MaxAnisotropy,
|
||||||
|
AspectRatio = Graphics.AspectRatio,
|
||||||
GraphicsShadersDumpPath = Graphics.ShadersDumpPath,
|
GraphicsShadersDumpPath = Graphics.ShadersDumpPath,
|
||||||
LoggingEnableDebug = Logger.EnableDebug,
|
LoggingEnableDebug = Logger.EnableDebug,
|
||||||
LoggingEnableStub = Logger.EnableStub,
|
LoggingEnableStub = Logger.EnableStub,
|
||||||
|
@ -449,6 +456,7 @@ namespace Ryujinx.Configuration
|
||||||
Graphics.ResScale.Value = 1;
|
Graphics.ResScale.Value = 1;
|
||||||
Graphics.ResScaleCustom.Value = 1.0f;
|
Graphics.ResScaleCustom.Value = 1.0f;
|
||||||
Graphics.MaxAnisotropy.Value = -1.0f;
|
Graphics.MaxAnisotropy.Value = -1.0f;
|
||||||
|
Graphics.AspectRatio.Value = AspectRatio.Fixed16x9;
|
||||||
Graphics.ShadersDumpPath.Value = "";
|
Graphics.ShadersDumpPath.Value = "";
|
||||||
Logger.EnableDebug.Value = false;
|
Logger.EnableDebug.Value = false;
|
||||||
Logger.EnableStub.Value = true;
|
Logger.EnableStub.Value = true;
|
||||||
|
@ -457,7 +465,7 @@ namespace Ryujinx.Configuration
|
||||||
Logger.EnableError.Value = true;
|
Logger.EnableError.Value = true;
|
||||||
Logger.EnableGuest.Value = true;
|
Logger.EnableGuest.Value = true;
|
||||||
Logger.EnableFsAccessLog.Value = false;
|
Logger.EnableFsAccessLog.Value = false;
|
||||||
Logger.FilteredClasses.Value = new LogClass[] { };
|
Logger.FilteredClasses.Value = Array.Empty<LogClass>();
|
||||||
Logger.GraphicsDebugLevel.Value = GraphicsDebugLevel.None;
|
Logger.GraphicsDebugLevel.Value = GraphicsDebugLevel.None;
|
||||||
Logger.EnableFileLog.Value = true;
|
Logger.EnableFileLog.Value = true;
|
||||||
System.Language.Value = Language.AmericanEnglish;
|
System.Language.Value = Language.AmericanEnglish;
|
||||||
|
@ -753,6 +761,15 @@ namespace Ryujinx.Configuration
|
||||||
configurationFileUpdated = true;
|
configurationFileUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (configurationFileFormat.Version < 18)
|
||||||
|
{
|
||||||
|
Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 18.");
|
||||||
|
|
||||||
|
configurationFileFormat.AspectRatio = AspectRatio.Fixed16x9;
|
||||||
|
|
||||||
|
configurationFileUpdated = true;
|
||||||
|
}
|
||||||
|
|
||||||
List<InputConfig> inputConfig = new List<InputConfig>();
|
List<InputConfig> inputConfig = new List<InputConfig>();
|
||||||
inputConfig.AddRange(configurationFileFormat.ControllerConfig);
|
inputConfig.AddRange(configurationFileFormat.ControllerConfig);
|
||||||
inputConfig.AddRange(configurationFileFormat.KeyboardConfig);
|
inputConfig.AddRange(configurationFileFormat.KeyboardConfig);
|
||||||
|
@ -760,6 +777,7 @@ namespace Ryujinx.Configuration
|
||||||
Graphics.ResScale.Value = configurationFileFormat.ResScale;
|
Graphics.ResScale.Value = configurationFileFormat.ResScale;
|
||||||
Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
|
Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
|
||||||
Graphics.MaxAnisotropy.Value = configurationFileFormat.MaxAnisotropy;
|
Graphics.MaxAnisotropy.Value = configurationFileFormat.MaxAnisotropy;
|
||||||
|
Graphics.AspectRatio.Value = configurationFileFormat.AspectRatio;
|
||||||
Graphics.ShadersDumpPath.Value = configurationFileFormat.GraphicsShadersDumpPath;
|
Graphics.ShadersDumpPath.Value = configurationFileFormat.GraphicsShadersDumpPath;
|
||||||
Logger.EnableDebug.Value = configurationFileFormat.LoggingEnableDebug;
|
Logger.EnableDebug.Value = configurationFileFormat.LoggingEnableDebug;
|
||||||
Logger.EnableStub.Value = configurationFileFormat.LoggingEnableStub;
|
Logger.EnableStub.Value = configurationFileFormat.LoggingEnableStub;
|
||||||
|
|
|
@ -8,6 +8,9 @@ namespace Ryujinx.Graphics.GAL
|
||||||
public int Bottom { get; }
|
public int Bottom { get; }
|
||||||
public bool FlipX { get; }
|
public bool FlipX { get; }
|
||||||
public bool FlipY { get; }
|
public bool FlipY { get; }
|
||||||
|
public bool IsStretched { get; }
|
||||||
|
public float AspectRatioX { get; }
|
||||||
|
public float AspectRatioY { get; }
|
||||||
|
|
||||||
public ImageCrop(
|
public ImageCrop(
|
||||||
int left,
|
int left,
|
||||||
|
@ -15,7 +18,11 @@ namespace Ryujinx.Graphics.GAL
|
||||||
int top,
|
int top,
|
||||||
int bottom,
|
int bottom,
|
||||||
bool flipX,
|
bool flipX,
|
||||||
bool flipY)
|
bool flipY,
|
||||||
|
bool isStretched,
|
||||||
|
float aspectRatioX,
|
||||||
|
float aspectRatioY
|
||||||
|
)
|
||||||
{
|
{
|
||||||
Left = left;
|
Left = left;
|
||||||
Right = right;
|
Right = right;
|
||||||
|
@ -23,6 +30,9 @@ namespace Ryujinx.Graphics.GAL
|
||||||
Bottom = bottom;
|
Bottom = bottom;
|
||||||
FlipX = flipX;
|
FlipX = flipX;
|
||||||
FlipY = flipY;
|
FlipY = flipY;
|
||||||
|
IsStretched = isStretched;
|
||||||
|
AspectRatioX = aspectRatioX;
|
||||||
|
AspectRatioY = aspectRatioY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,5 @@
|
||||||
using OpenTK;
|
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using OpenTK.Graphics.OpenGL;
|
using OpenTK.Graphics.OpenGL;
|
||||||
using OpenTK.Platform;
|
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using Ryujinx.Graphics.OpenGL.Image;
|
using Ryujinx.Graphics.OpenGL.Image;
|
||||||
using System;
|
using System;
|
||||||
|
@ -10,9 +8,6 @@ namespace Ryujinx.Graphics.OpenGL
|
||||||
{
|
{
|
||||||
class Window : IWindow, IDisposable
|
class Window : IWindow, IDisposable
|
||||||
{
|
{
|
||||||
private const int NativeWidth = 1280;
|
|
||||||
private const int NativeHeight = 720;
|
|
||||||
|
|
||||||
private readonly Renderer _renderer;
|
private readonly Renderer _renderer;
|
||||||
|
|
||||||
private int _width;
|
private int _width;
|
||||||
|
@ -25,9 +20,6 @@ namespace Ryujinx.Graphics.OpenGL
|
||||||
public Window(Renderer renderer)
|
public Window(Renderer renderer)
|
||||||
{
|
{
|
||||||
_renderer = renderer;
|
_renderer = renderer;
|
||||||
|
|
||||||
_width = NativeWidth;
|
|
||||||
_height = NativeHeight;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Present(ITexture texture, ImageCrop crop)
|
public void Present(ITexture texture, ImageCrop crop)
|
||||||
|
@ -104,8 +96,8 @@ namespace Ryujinx.Graphics.OpenGL
|
||||||
srcY1 = (int)Math.Ceiling(srcY1 * scale);
|
srcY1 = (int)Math.Ceiling(srcY1 * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ratioX = MathF.Min(1f, (_height * (float)NativeWidth) / ((float)NativeHeight * _width));
|
float ratioX = crop.IsStretched ? 1.0f : MathF.Min(1.0f, _height * crop.AspectRatioX / (_width * crop.AspectRatioY));
|
||||||
float ratioY = MathF.Min(1f, (_width * (float)NativeHeight) / ((float)NativeWidth * _height));
|
float ratioY = crop.IsStretched ? 1.0f : MathF.Min(1.0f, _width * crop.AspectRatioY / (_height * crop.AspectRatioX));
|
||||||
|
|
||||||
int dstWidth = (int)(_width * ratioX);
|
int dstWidth = (int)(_width * ratioX);
|
||||||
int dstHeight = (int)(_height * ratioY);
|
int dstHeight = (int)(_height * ratioY);
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Configuration;
|
||||||
|
using Ryujinx.Common.Logging;
|
||||||
|
using Ryujinx.Configuration;
|
||||||
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;
|
||||||
|
@ -277,13 +279,19 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
||||||
bool flipX = item.Transform.HasFlag(NativeWindowTransform.FlipX);
|
bool flipX = item.Transform.HasFlag(NativeWindowTransform.FlipX);
|
||||||
bool flipY = item.Transform.HasFlag(NativeWindowTransform.FlipY);
|
bool flipY = item.Transform.HasFlag(NativeWindowTransform.FlipY);
|
||||||
|
|
||||||
|
AspectRatio aspectRatio = ConfigurationState.Instance.Graphics.AspectRatio.Value;
|
||||||
|
bool isStretched = aspectRatio == AspectRatio.Stretched;
|
||||||
|
|
||||||
ImageCrop crop = new ImageCrop(
|
ImageCrop crop = new ImageCrop(
|
||||||
cropRect.Left,
|
cropRect.Left,
|
||||||
cropRect.Right,
|
cropRect.Right,
|
||||||
cropRect.Top,
|
cropRect.Top,
|
||||||
cropRect.Bottom,
|
cropRect.Bottom,
|
||||||
flipX,
|
flipX,
|
||||||
flipY);
|
flipY,
|
||||||
|
isStretched,
|
||||||
|
aspectRatio.ToFloatX(),
|
||||||
|
aspectRatio.ToFloatY());
|
||||||
|
|
||||||
TextureCallbackInformation textureCallbackInformation = new TextureCallbackInformation
|
TextureCallbackInformation textureCallbackInformation = new TextureCallbackInformation
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
{
|
{
|
||||||
"version": 17,
|
"version": 18,
|
||||||
"res_scale": 1,
|
"res_scale": 1,
|
||||||
"res_scale_custom": 1,
|
"res_scale_custom": 1,
|
||||||
"max_anisotropy": -1,
|
"max_anisotropy": -1,
|
||||||
|
"aspect_ratio": "Fixed16x9",
|
||||||
"graphics_shaders_dump_path": "",
|
"graphics_shaders_dump_path": "",
|
||||||
"logging_enable_debug": false,
|
"logging_enable_debug": false,
|
||||||
"logging_enable_stub": true,
|
"logging_enable_stub": true,
|
||||||
|
|
|
@ -5,16 +5,16 @@ using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using OpenTK.Graphics.OpenGL;
|
using OpenTK.Graphics.OpenGL;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using Ryujinx.Configuration;
|
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
using Ryujinx.Common.Configuration.Hid;
|
using Ryujinx.Common.Configuration.Hid;
|
||||||
|
using Ryujinx.Configuration;
|
||||||
using Ryujinx.Graphics.OpenGL;
|
using Ryujinx.Graphics.OpenGL;
|
||||||
using Ryujinx.HLE;
|
using Ryujinx.HLE;
|
||||||
using Ryujinx.HLE.HOS.Services.Hid;
|
using Ryujinx.HLE.HOS.Services.Hid;
|
||||||
|
using Ryujinx.Motion;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Ryujinx.Motion;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ui
|
namespace Ryujinx.Ui
|
||||||
{
|
{
|
||||||
|
@ -219,7 +219,6 @@ namespace Ryujinx.Ui
|
||||||
{
|
{
|
||||||
parent.Present();
|
parent.Present();
|
||||||
|
|
||||||
|
|
||||||
string titleNameSection = string.IsNullOrWhiteSpace(_device.Application.TitleName) ? string.Empty
|
string titleNameSection = string.IsNullOrWhiteSpace(_device.Application.TitleName) ? string.Empty
|
||||||
: $" - {_device.Application.TitleName}";
|
: $" - {_device.Application.TitleName}";
|
||||||
|
|
||||||
|
@ -419,6 +418,7 @@ namespace Ryujinx.Ui
|
||||||
StatusUpdatedEvent?.Invoke(this, new StatusUpdatedEventArgs(
|
StatusUpdatedEvent?.Invoke(this, new StatusUpdatedEventArgs(
|
||||||
_device.EnableDeviceVsync,
|
_device.EnableDeviceVsync,
|
||||||
dockedMode,
|
dockedMode,
|
||||||
|
ConfigurationState.Instance.Graphics.AspectRatio.Value.ToText(),
|
||||||
$"Game: {_device.Statistics.GetGameFrameRate():00.00} FPS",
|
$"Game: {_device.Statistics.GetGameFrameRate():00.00} FPS",
|
||||||
$"FIFO: {_device.Statistics.GetFifoPercent():0.00} %",
|
$"FIFO: {_device.Statistics.GetFifoPercent():0.00} %",
|
||||||
$"GPU: {_renderer.GpuVendor}"));
|
$"GPU: {_renderer.GpuVendor}"));
|
||||||
|
@ -632,16 +632,18 @@ namespace Ryujinx.Ui
|
||||||
// OpenTK always captures mouse events, even if out of focus, so check if window is focused.
|
// OpenTK always captures mouse events, even if out of focus, so check if window is focused.
|
||||||
if (_isFocused && _mousePressed)
|
if (_isFocused && _mousePressed)
|
||||||
{
|
{
|
||||||
|
float aspectWidth = SwitchPanelHeight * ConfigurationState.Instance.Graphics.AspectRatio.Value.ToFloat();
|
||||||
|
|
||||||
int screenWidth = AllocatedWidth;
|
int screenWidth = AllocatedWidth;
|
||||||
int screenHeight = AllocatedHeight;
|
int screenHeight = AllocatedHeight;
|
||||||
|
|
||||||
if (AllocatedWidth > (AllocatedHeight * SwitchPanelWidth) / SwitchPanelHeight)
|
if (AllocatedWidth > AllocatedHeight * aspectWidth / SwitchPanelHeight)
|
||||||
{
|
{
|
||||||
screenWidth = (AllocatedHeight * SwitchPanelWidth) / SwitchPanelHeight;
|
screenWidth = (int)(AllocatedHeight * aspectWidth) / SwitchPanelHeight;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screenHeight = (AllocatedWidth * SwitchPanelHeight) / SwitchPanelWidth;
|
screenHeight = (AllocatedWidth * SwitchPanelHeight) / (int)aspectWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
int startX = (AllocatedWidth - screenWidth) >> 1;
|
int startX = (AllocatedWidth - screenWidth) >> 1;
|
||||||
|
@ -659,7 +661,7 @@ namespace Ryujinx.Ui
|
||||||
int screenMouseX = (int)_mouseX - startX;
|
int screenMouseX = (int)_mouseX - startX;
|
||||||
int screenMouseY = (int)_mouseY - startY;
|
int screenMouseY = (int)_mouseY - startY;
|
||||||
|
|
||||||
int mX = (screenMouseX * SwitchPanelWidth) / screenWidth;
|
int mX = (screenMouseX * (int)aspectWidth) / screenWidth;
|
||||||
int mY = (screenMouseY * SwitchPanelHeight) / screenHeight;
|
int mY = (screenMouseY * SwitchPanelHeight) / screenHeight;
|
||||||
|
|
||||||
TouchPoint currentPoint = new TouchPoint
|
TouchPoint currentPoint = new TouchPoint
|
||||||
|
|
|
@ -72,6 +72,7 @@ namespace Ryujinx.Ui
|
||||||
[GUI] CheckMenuItem _pathToggle;
|
[GUI] CheckMenuItem _pathToggle;
|
||||||
[GUI] CheckMenuItem _fileSizeToggle;
|
[GUI] CheckMenuItem _fileSizeToggle;
|
||||||
[GUI] Label _dockedMode;
|
[GUI] Label _dockedMode;
|
||||||
|
[GUI] Label _aspectRatio;
|
||||||
[GUI] Label _gameStatus;
|
[GUI] Label _gameStatus;
|
||||||
[GUI] TreeView _gameTable;
|
[GUI] TreeView _gameTable;
|
||||||
[GUI] TreeSelection _gameTableSelection;
|
[GUI] TreeSelection _gameTableSelection;
|
||||||
|
@ -668,6 +669,7 @@ namespace Ryujinx.Ui
|
||||||
{
|
{
|
||||||
int resScale = ConfigurationState.Instance.Graphics.ResScale;
|
int resScale = ConfigurationState.Instance.Graphics.ResScale;
|
||||||
float resScaleCustom = ConfigurationState.Instance.Graphics.ResScaleCustom;
|
float resScaleCustom = ConfigurationState.Instance.Graphics.ResScaleCustom;
|
||||||
|
|
||||||
Graphics.Gpu.GraphicsConfig.ResScale = (resScale == -1) ? resScaleCustom : resScale;
|
Graphics.Gpu.GraphicsConfig.ResScale = (resScale == -1) ? resScaleCustom : resScale;
|
||||||
Graphics.Gpu.GraphicsConfig.MaxAnisotropy = ConfigurationState.Instance.Graphics.MaxAnisotropy;
|
Graphics.Gpu.GraphicsConfig.MaxAnisotropy = ConfigurationState.Instance.Graphics.MaxAnisotropy;
|
||||||
Graphics.Gpu.GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath;
|
Graphics.Gpu.GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath;
|
||||||
|
@ -810,6 +812,7 @@ namespace Ryujinx.Ui
|
||||||
_fifoStatus.Text = args.FifoStatus;
|
_fifoStatus.Text = args.FifoStatus;
|
||||||
_gpuName.Text = args.GpuName;
|
_gpuName.Text = args.GpuName;
|
||||||
_dockedMode.Text = args.DockedMode;
|
_dockedMode.Text = args.DockedMode;
|
||||||
|
_aspectRatio.Text = args.AspectRatio;
|
||||||
|
|
||||||
if (args.VSyncEnabled)
|
if (args.VSyncEnabled)
|
||||||
{
|
{
|
||||||
|
@ -868,6 +871,13 @@ namespace Ryujinx.Ui
|
||||||
ConfigurationState.Instance.System.EnableDockedMode.Value = !ConfigurationState.Instance.System.EnableDockedMode.Value;
|
ConfigurationState.Instance.System.EnableDockedMode.Value = !ConfigurationState.Instance.System.EnableDockedMode.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AspectRatio_Clicked(object sender, ButtonReleaseEventArgs args)
|
||||||
|
{
|
||||||
|
AspectRatio aspectRatio = ConfigurationState.Instance.Graphics.AspectRatio.Value;
|
||||||
|
|
||||||
|
ConfigurationState.Instance.Graphics.AspectRatio.Value = ((int)aspectRatio + 1) > Enum.GetNames(typeof(AspectRatio)).Length - 1 ? AspectRatio.Fixed4x3 : aspectRatio + 1;
|
||||||
|
}
|
||||||
|
|
||||||
private void Row_Clicked(object sender, ButtonReleaseEventArgs args)
|
private void Row_Clicked(object sender, ButtonReleaseEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Event.Button != 3) return;
|
if (args.Event.Button != 3) return;
|
||||||
|
|
|
@ -562,13 +562,21 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="_gameStatus">
|
<object class="GtkEventBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">0</property>
|
||||||
|
<signal name="button-release-event" handler="AspectRatio_Clicked" swapped="no"/>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="_aspectRatio">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
<property name="margin_left">5</property>
|
<property name="margin_left">5</property>
|
||||||
<property name="margin_right">5</property>
|
<property name="margin_right">5</property>
|
||||||
</object>
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
|
@ -587,7 +595,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="_fifoStatus">
|
<object class="GtkLabel" id="_gameStatus">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
|
@ -611,6 +619,31 @@
|
||||||
<property name="position">7</property>
|
<property name="position">7</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="_fifoStatus">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="halign">start</property>
|
||||||
|
<property name="margin_left">5</property>
|
||||||
|
<property name="margin_right">5</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">8</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSeparator">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">9</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="_gpuName">
|
<object class="GtkLabel" id="_gpuName">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -621,7 +654,7 @@
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">8</property>
|
<property name="position">10</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|
|
@ -71,6 +71,7 @@ namespace Ryujinx.Ui
|
||||||
[GUI] Entry _addGameDirBox;
|
[GUI] Entry _addGameDirBox;
|
||||||
[GUI] Entry _graphicsShadersDumpPath;
|
[GUI] Entry _graphicsShadersDumpPath;
|
||||||
[GUI] ComboBoxText _anisotropy;
|
[GUI] ComboBoxText _anisotropy;
|
||||||
|
[GUI] ComboBoxText _aspectRatio;
|
||||||
[GUI] ComboBoxText _resScaleCombo;
|
[GUI] ComboBoxText _resScaleCombo;
|
||||||
[GUI] Entry _resScaleText;
|
[GUI] Entry _resScaleText;
|
||||||
[GUI] ToggleButton _configureController1;
|
[GUI] ToggleButton _configureController1;
|
||||||
|
@ -249,6 +250,7 @@ namespace Ryujinx.Ui
|
||||||
_systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString());
|
_systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString());
|
||||||
_resScaleCombo.SetActiveId(ConfigurationState.Instance.Graphics.ResScale.Value.ToString());
|
_resScaleCombo.SetActiveId(ConfigurationState.Instance.Graphics.ResScale.Value.ToString());
|
||||||
_anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString());
|
_anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString());
|
||||||
|
_aspectRatio.SetActiveId(((int)ConfigurationState.Instance.Graphics.AspectRatio.Value).ToString());
|
||||||
|
|
||||||
_custThemePath.Buffer.Text = ConfigurationState.Instance.Ui.CustomThemePath;
|
_custThemePath.Buffer.Text = ConfigurationState.Instance.Ui.CustomThemePath;
|
||||||
_resScaleText.Buffer.Text = ConfigurationState.Instance.Graphics.ResScaleCustom.Value.ToString();
|
_resScaleText.Buffer.Text = ConfigurationState.Instance.Graphics.ResScaleCustom.Value.ToString();
|
||||||
|
@ -408,6 +410,7 @@ namespace Ryujinx.Ui
|
||||||
ConfigurationState.Instance.Ui.GameDirs.Value = gameDirs;
|
ConfigurationState.Instance.Ui.GameDirs.Value = gameDirs;
|
||||||
ConfigurationState.Instance.System.FsGlobalAccessLogMode.Value = (int)_fsLogSpinAdjustment.Value;
|
ConfigurationState.Instance.System.FsGlobalAccessLogMode.Value = (int)_fsLogSpinAdjustment.Value;
|
||||||
ConfigurationState.Instance.Graphics.MaxAnisotropy.Value = float.Parse(_anisotropy.ActiveId, CultureInfo.InvariantCulture);
|
ConfigurationState.Instance.Graphics.MaxAnisotropy.Value = float.Parse(_anisotropy.ActiveId, CultureInfo.InvariantCulture);
|
||||||
|
ConfigurationState.Instance.Graphics.AspectRatio.Value = Enum.Parse<AspectRatio>(_aspectRatio.ActiveId);
|
||||||
ConfigurationState.Instance.Graphics.ResScale.Value = int.Parse(_resScaleCombo.ActiveId);
|
ConfigurationState.Instance.Graphics.ResScale.Value = int.Parse(_resScaleCombo.ActiveId);
|
||||||
ConfigurationState.Instance.Graphics.ResScaleCustom.Value = resScaleCustom;
|
ConfigurationState.Instance.Graphics.ResScaleCustom.Value = resScaleCustom;
|
||||||
|
|
||||||
|
@ -422,7 +425,7 @@ namespace Ryujinx.Ui
|
||||||
}
|
}
|
||||||
|
|
||||||
//Events
|
//Events
|
||||||
private void TimeZoneEntry_FocusOut(Object sender, FocusOutEventArgs e)
|
private void TimeZoneEntry_FocusOut(object sender, FocusOutEventArgs e)
|
||||||
{
|
{
|
||||||
if (!_validTzRegions.Contains(_systemTimeZoneEntry.Text))
|
if (!_validTzRegions.Contains(_systemTimeZoneEntry.Text))
|
||||||
{
|
{
|
||||||
|
@ -439,7 +442,7 @@ namespace Ryujinx.Ui
|
||||||
((string)compl.Model.GetValue(iter, 0)).Substring(3).StartsWith(key); // offset
|
((string)compl.Model.GetValue(iter, 0)).Substring(3).StartsWith(key); // offset
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SystemTimeSpin_ValueChanged(Object sender, EventArgs e)
|
private void SystemTimeSpin_ValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
int year = _systemTimeYearSpin.ValueAsInt;
|
int year = _systemTimeYearSpin.ValueAsInt;
|
||||||
int month = _systemTimeMonthSpin.ValueAsInt;
|
int month = _systemTimeMonthSpin.ValueAsInt;
|
||||||
|
|
|
@ -1811,6 +1811,55 @@
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="margin-top">5</property>
|
||||||
|
<property name="margin-bottom">5</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="tooltip-text" translatable="yes">Aspect Ratio applied to the renderer window.</property>
|
||||||
|
<property name="label" translatable="yes">Aspect Ratio:</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="padding">5</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkComboBoxText" id="_aspectRatio">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can-focus">False</property>
|
||||||
|
<property name="tooltip-text" translatable="yes">Aspect Ratio applied to the renderer window.</property>
|
||||||
|
<property name="active-id">1</property>
|
||||||
|
<items>
|
||||||
|
<item id="0" translatable="yes">4:3</item>
|
||||||
|
<item id="1" translatable="yes">16:9</item>
|
||||||
|
<item id="2" translatable="yes">16:10</item>
|
||||||
|
<item id="3" translatable="yes">21:9</item>
|
||||||
|
<item id="4" translatable="yes">32:9</item>
|
||||||
|
<item id="5" translatable="yes">Stretch to Fit Window</item>
|
||||||
|
</items>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="padding">5</property>
|
||||||
|
<property name="position">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
|
|
@ -6,14 +6,16 @@ namespace Ryujinx.Ui
|
||||||
{
|
{
|
||||||
public bool VSyncEnabled;
|
public bool VSyncEnabled;
|
||||||
public string DockedMode;
|
public string DockedMode;
|
||||||
|
public string AspectRatio;
|
||||||
public string GameStatus;
|
public string GameStatus;
|
||||||
public string FifoStatus;
|
public string FifoStatus;
|
||||||
public string GpuName;
|
public string GpuName;
|
||||||
|
|
||||||
public StatusUpdatedEventArgs(bool vSyncEnabled, string dockedMode, string gameStatus, string fifoStatus, string gpuName)
|
public StatusUpdatedEventArgs(bool vSyncEnabled, string dockedMode, string aspectRatio, string gameStatus, string fifoStatus, string gpuName)
|
||||||
{
|
{
|
||||||
VSyncEnabled = vSyncEnabled;
|
VSyncEnabled = vSyncEnabled;
|
||||||
DockedMode = dockedMode;
|
DockedMode = dockedMode;
|
||||||
|
AspectRatio = aspectRatio;
|
||||||
GameStatus = gameStatus;
|
GameStatus = gameStatus;
|
||||||
FifoStatus = fifoStatus;
|
FifoStatus = fifoStatus;
|
||||||
GpuName = gpuName;
|
GpuName = gpuName;
|
||||||
|
|
|
@ -941,6 +941,21 @@
|
||||||
16
|
16
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"aspect_ratio": {
|
||||||
|
"$id": "#/properties/aspect_ratio",
|
||||||
|
"type": "string",
|
||||||
|
"title": "Aspect Ratio applied to the renderer window.",
|
||||||
|
"description": "Aspect Ratio applied to the renderer window.",
|
||||||
|
"default": "Fixed16x9",
|
||||||
|
"examples": [
|
||||||
|
"Fixed4x3",
|
||||||
|
"Fixed16x9",
|
||||||
|
"Fixed16x10",
|
||||||
|
"Fixed21x9",
|
||||||
|
"Fixed32x9",
|
||||||
|
"Stretched"
|
||||||
|
]
|
||||||
|
},
|
||||||
"graphics_shaders_dump_path": {
|
"graphics_shaders_dump_path": {
|
||||||
"$id": "#/properties/graphics_shaders_dump_path",
|
"$id": "#/properties/graphics_shaders_dump_path",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|
Loading…
Reference in a new issue