Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
223172ac0b | ||
|
8c9633d72f | ||
|
1f93fd52d9 |
@@ -328,6 +328,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
public void SetAllInputUserAttributes()
|
public void SetAllInputUserAttributes()
|
||||||
{
|
{
|
||||||
UsedInputAttributes |= Constants.AllAttributesMask;
|
UsedInputAttributes |= Constants.AllAttributesMask;
|
||||||
|
ThisInputAttributesComponents |= ~UInt128.Zero >> (128 - Constants.MaxAttributes * 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetAllOutputUserAttributes()
|
public void SetAllOutputUserAttributes()
|
||||||
|
@@ -218,10 +218,17 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
while (usedAttributes != UInt128.Zero)
|
while (usedAttributes != UInt128.Zero)
|
||||||
{
|
{
|
||||||
int index = usedAttributes.TrailingZeroCount();
|
int index = usedAttributes.TrailingZeroCount();
|
||||||
|
int vecIndex = index / 4;
|
||||||
InitializeOutputComponent(context, AttributeConsts.UserAttributeBase + index * 4, perPatch: false);
|
|
||||||
|
|
||||||
usedAttributes &= ~UInt128.Pow2(index);
|
usedAttributes &= ~UInt128.Pow2(index);
|
||||||
|
|
||||||
|
// We don't need to initialize passthrough attributes.
|
||||||
|
if ((context.Config.PassthroughAttributes & (1 << vecIndex)) != 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
InitializeOutputComponent(context, AttributeConsts.UserAttributeBase + index * 4, perPatch: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
UInt128 usedAttributesPerPatch = context.Config.NextInputAttributesPerPatchComponents;
|
UInt128 usedAttributesPerPatch = context.Config.NextInputAttributesPerPatchComponents;
|
||||||
|
@@ -10,6 +10,12 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
private ulong _v0;
|
private ulong _v0;
|
||||||
private ulong _v1;
|
private ulong _v1;
|
||||||
|
|
||||||
|
public UInt128(ulong low, ulong high)
|
||||||
|
{
|
||||||
|
_v0 = low;
|
||||||
|
_v1 = high;
|
||||||
|
}
|
||||||
|
|
||||||
public int TrailingZeroCount()
|
public int TrailingZeroCount()
|
||||||
{
|
{
|
||||||
int count = BitOperations.TrailingZeroCount(_v0);
|
int count = BitOperations.TrailingZeroCount(_v0);
|
||||||
@@ -25,25 +31,57 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||||||
{
|
{
|
||||||
if (x >= 64)
|
if (x >= 64)
|
||||||
{
|
{
|
||||||
return new UInt128() { _v0 = 0, _v1 = 1UL << (x - 64 ) };
|
return new UInt128(0, 1UL << (x - 64));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new UInt128() { _v0 = 1UL << x, _v1 = 0 };
|
return new UInt128(1UL << x, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UInt128 operator ~(UInt128 x)
|
public static UInt128 operator ~(UInt128 x)
|
||||||
{
|
{
|
||||||
return new UInt128() { _v0 = ~x._v0, _v1 = ~x._v1 };
|
return new UInt128(~x._v0, ~x._v1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UInt128 operator &(UInt128 x, UInt128 y)
|
public static UInt128 operator &(UInt128 x, UInt128 y)
|
||||||
{
|
{
|
||||||
return new UInt128() { _v0 = x._v0 & y._v0, _v1 = x._v1 & y._v1 };
|
return new UInt128(x._v0 & y._v0, x._v1 & y._v1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UInt128 operator |(UInt128 x, UInt128 y)
|
public static UInt128 operator |(UInt128 x, UInt128 y)
|
||||||
{
|
{
|
||||||
return new UInt128() { _v0 = x._v0 | y._v0, _v1 = x._v1 | y._v1 };
|
return new UInt128(x._v0 | y._v0, x._v1 | y._v1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static UInt128 operator <<(UInt128 x, int shift)
|
||||||
|
{
|
||||||
|
if (shift == 0)
|
||||||
|
{
|
||||||
|
return new UInt128(x._v0, x._v1);
|
||||||
|
}
|
||||||
|
else if (shift >= 64)
|
||||||
|
{
|
||||||
|
return new UInt128(0, x._v0 << (shift - 64));
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong shiftOut = x._v0 >> (64 - shift);
|
||||||
|
|
||||||
|
return new UInt128(x._v0 << shift, (x._v1 << shift) | shiftOut);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static UInt128 operator >>(UInt128 x, int shift)
|
||||||
|
{
|
||||||
|
if (shift == 0)
|
||||||
|
{
|
||||||
|
return new UInt128(x._v0, x._v1);
|
||||||
|
}
|
||||||
|
else if (shift >= 64)
|
||||||
|
{
|
||||||
|
return new UInt128(x._v1 >> (shift - 64), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong shiftOut = x._v1 & ((1UL << shift) - 1);
|
||||||
|
|
||||||
|
return new UInt128((x._v0 >> shift) | (shiftOut << (64 - shift)), x._v1 >> shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool operator ==(UInt128 x, UInt128 y)
|
public static bool operator ==(UInt128 x, UInt128 y)
|
||||||
|
@@ -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 = 36;
|
public const int CurrentVersion = 37;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Version of the configuration file format
|
/// Version of the configuration file format
|
||||||
@@ -236,6 +236,11 @@ namespace Ryujinx.Configuration
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool StartFullscreen { get; set; }
|
public bool StartFullscreen { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show console window
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowConsole { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enable or disable keyboard support (Independent from controllers binding)
|
/// Enable or disable keyboard support (Independent from controllers binding)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -6,6 +6,7 @@ using Ryujinx.Common.Configuration.Hid.Keyboard;
|
|||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Configuration.System;
|
using Ryujinx.Configuration.System;
|
||||||
using Ryujinx.Configuration.Ui;
|
using Ryujinx.Configuration.Ui;
|
||||||
|
using Ryujinx.Ui.Helper;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
@@ -88,6 +89,11 @@ namespace Ryujinx.Configuration
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ReactiveObject<bool> StartFullscreen { get; private set; }
|
public ReactiveObject<bool> StartFullscreen { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hide / Show Console Window
|
||||||
|
/// </summary>
|
||||||
|
public ReactiveObject<bool> ShowConsole { get; private set; }
|
||||||
|
|
||||||
public UiSection()
|
public UiSection()
|
||||||
{
|
{
|
||||||
GuiColumns = new Columns();
|
GuiColumns = new Columns();
|
||||||
@@ -96,6 +102,8 @@ namespace Ryujinx.Configuration
|
|||||||
EnableCustomTheme = new ReactiveObject<bool>();
|
EnableCustomTheme = new ReactiveObject<bool>();
|
||||||
CustomThemePath = new ReactiveObject<string>();
|
CustomThemePath = new ReactiveObject<string>();
|
||||||
StartFullscreen = new ReactiveObject<bool>();
|
StartFullscreen = new ReactiveObject<bool>();
|
||||||
|
ShowConsole = new ReactiveObject<bool>();
|
||||||
|
ShowConsole.Event += static (s, e) => { ConsoleHelper.SetConsoleWindowState(e.NewValue); };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -508,6 +516,7 @@ namespace Ryujinx.Configuration
|
|||||||
EnableCustomTheme = Ui.EnableCustomTheme,
|
EnableCustomTheme = Ui.EnableCustomTheme,
|
||||||
CustomThemePath = Ui.CustomThemePath,
|
CustomThemePath = Ui.CustomThemePath,
|
||||||
StartFullscreen = Ui.StartFullscreen,
|
StartFullscreen = Ui.StartFullscreen,
|
||||||
|
ShowConsole = Ui.ShowConsole,
|
||||||
EnableKeyboard = Hid.EnableKeyboard,
|
EnableKeyboard = Hid.EnableKeyboard,
|
||||||
EnableMouse = Hid.EnableMouse,
|
EnableMouse = Hid.EnableMouse,
|
||||||
Hotkeys = Hid.Hotkeys,
|
Hotkeys = Hid.Hotkeys,
|
||||||
@@ -574,6 +583,7 @@ namespace Ryujinx.Configuration
|
|||||||
Ui.EnableCustomTheme.Value = false;
|
Ui.EnableCustomTheme.Value = false;
|
||||||
Ui.CustomThemePath.Value = "";
|
Ui.CustomThemePath.Value = "";
|
||||||
Ui.StartFullscreen.Value = false;
|
Ui.StartFullscreen.Value = false;
|
||||||
|
Ui.ShowConsole.Value = true;
|
||||||
Hid.EnableKeyboard.Value = false;
|
Hid.EnableKeyboard.Value = false;
|
||||||
Hid.EnableMouse.Value = false;
|
Hid.EnableMouse.Value = false;
|
||||||
Hid.Hotkeys.Value = new KeyboardHotkeys
|
Hid.Hotkeys.Value = new KeyboardHotkeys
|
||||||
@@ -1008,6 +1018,15 @@ namespace Ryujinx.Configuration
|
|||||||
configurationFileUpdated = true;
|
configurationFileUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (configurationFileFormat.Version < 37)
|
||||||
|
{
|
||||||
|
Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 37.");
|
||||||
|
|
||||||
|
configurationFileFormat.ShowConsole = true;
|
||||||
|
|
||||||
|
configurationFileUpdated = true;
|
||||||
|
}
|
||||||
|
|
||||||
Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
|
Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
|
||||||
Graphics.BackendThreading.Value = configurationFileFormat.BackendThreading;
|
Graphics.BackendThreading.Value = configurationFileFormat.BackendThreading;
|
||||||
Graphics.ResScale.Value = configurationFileFormat.ResScale;
|
Graphics.ResScale.Value = configurationFileFormat.ResScale;
|
||||||
@@ -1061,6 +1080,7 @@ namespace Ryujinx.Configuration
|
|||||||
Ui.EnableCustomTheme.Value = configurationFileFormat.EnableCustomTheme;
|
Ui.EnableCustomTheme.Value = configurationFileFormat.EnableCustomTheme;
|
||||||
Ui.CustomThemePath.Value = configurationFileFormat.CustomThemePath;
|
Ui.CustomThemePath.Value = configurationFileFormat.CustomThemePath;
|
||||||
Ui.StartFullscreen.Value = configurationFileFormat.StartFullscreen;
|
Ui.StartFullscreen.Value = configurationFileFormat.StartFullscreen;
|
||||||
|
Ui.ShowConsole.Value = configurationFileFormat.ShowConsole;
|
||||||
Hid.EnableKeyboard.Value = configurationFileFormat.EnableKeyboard;
|
Hid.EnableKeyboard.Value = configurationFileFormat.EnableKeyboard;
|
||||||
Hid.EnableMouse.Value = configurationFileFormat.EnableMouse;
|
Hid.EnableMouse.Value = configurationFileFormat.EnableMouse;
|
||||||
Hid.Hotkeys.Value = configurationFileFormat.Hotkeys;
|
Hid.Hotkeys.Value = configurationFileFormat.Hotkeys;
|
||||||
|
49
Ryujinx/Ui/Helper/ConsoleHelper.cs
Normal file
49
Ryujinx/Ui/Helper/ConsoleHelper.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
using Ryujinx.Common.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
|
||||||
|
namespace Ryujinx.Ui.Helper
|
||||||
|
{
|
||||||
|
public static class ConsoleHelper
|
||||||
|
{
|
||||||
|
public static bool SetConsoleWindowStateSupported => OperatingSystem.IsWindows();
|
||||||
|
|
||||||
|
public static void SetConsoleWindowState(bool show)
|
||||||
|
{
|
||||||
|
if (OperatingSystem.IsWindows())
|
||||||
|
{
|
||||||
|
SetConsoleWindowStateWindows(show);
|
||||||
|
}
|
||||||
|
else if (show == false)
|
||||||
|
{
|
||||||
|
Logger.Warning?.Print(LogClass.Application, "OS doesn't support hiding console window");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
|
private static void SetConsoleWindowStateWindows(bool show)
|
||||||
|
{
|
||||||
|
const int SW_HIDE = 0;
|
||||||
|
const int SW_SHOW = 5;
|
||||||
|
|
||||||
|
IntPtr hWnd = GetConsoleWindow();
|
||||||
|
|
||||||
|
if (hWnd == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Logger.Warning?.Print(LogClass.Application, "Attempted to show/hide console window but console window does not exist");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowWindow(hWnd, show ? SW_SHOW : SW_HIDE);
|
||||||
|
}
|
||||||
|
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
|
[DllImport("kernel32")]
|
||||||
|
static extern IntPtr GetConsoleWindow();
|
||||||
|
|
||||||
|
[SupportedOSPlatform("windows")]
|
||||||
|
[DllImport("user32")]
|
||||||
|
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
|
||||||
|
}
|
||||||
|
}
|
@@ -107,6 +107,7 @@ namespace Ryujinx.Ui
|
|||||||
[GUI] MenuItem _hideUi;
|
[GUI] MenuItem _hideUi;
|
||||||
[GUI] MenuItem _fullScreen;
|
[GUI] MenuItem _fullScreen;
|
||||||
[GUI] CheckMenuItem _startFullScreen;
|
[GUI] CheckMenuItem _startFullScreen;
|
||||||
|
[GUI] CheckMenuItem _showConsole;
|
||||||
[GUI] CheckMenuItem _favToggle;
|
[GUI] CheckMenuItem _favToggle;
|
||||||
[GUI] MenuItem _firmwareInstallDirectory;
|
[GUI] MenuItem _firmwareInstallDirectory;
|
||||||
[GUI] MenuItem _firmwareInstallFile;
|
[GUI] MenuItem _firmwareInstallFile;
|
||||||
@@ -213,6 +214,9 @@ namespace Ryujinx.Ui
|
|||||||
_startFullScreen.Active = true;
|
_startFullScreen.Active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_showConsole.Active = ConfigurationState.Instance.Ui.ShowConsole.Value;
|
||||||
|
_showConsole.Visible = ConsoleHelper.SetConsoleWindowStateSupported;
|
||||||
|
|
||||||
_actionMenu.Sensitive = false;
|
_actionMenu.Sensitive = false;
|
||||||
_pauseEmulation.Sensitive = false;
|
_pauseEmulation.Sensitive = false;
|
||||||
_resumeEmulation.Sensitive = false;
|
_resumeEmulation.Sensitive = false;
|
||||||
@@ -1535,6 +1539,13 @@ namespace Ryujinx.Ui
|
|||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ShowConsole_Toggled(object sender, EventArgs args)
|
||||||
|
{
|
||||||
|
ConfigurationState.Instance.Ui.ShowConsole.Value = _showConsole.Active;
|
||||||
|
|
||||||
|
SaveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
private void OptionMenu_StateChanged(object o, StateChangedArgs args)
|
private void OptionMenu_StateChanged(object o, StateChangedArgs args)
|
||||||
{
|
{
|
||||||
_manageUserProfiles.Sensitive = _emulationContext == null;
|
_manageUserProfiles.Sensitive = _emulationContext == null;
|
||||||
|
@@ -142,6 +142,15 @@
|
|||||||
<signal name="toggled" handler="StartFullScreen_Toggled" swapped="no"/>
|
<signal name="toggled" handler="StartFullScreen_Toggled" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckMenuItem" id="_showConsole">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Show Log Console</property>
|
||||||
|
<property name="use_underline">True</property>
|
||||||
|
<signal name="toggled" handler="ShowConsole_Toggled" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSeparatorMenuItem">
|
<object class="GtkSeparatorMenuItem">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
Reference in New Issue
Block a user