From f06d22d6f01e657ebbc0c8ef082739cd468e47b5 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz <42140194+IsaacMarovitz@users.noreply.github.com> Date: Sun, 11 Feb 2024 02:09:18 +0000 Subject: Infra: Capitalisation Consistency (#6296) * Rename Ryujinx.UI.Common * Rename Ryujinx.UI.LocaleGenerator * Update in Files AboutWindow * Configuration State * Rename projects * Ryujinx/UI * Fix build * Main remaining inconsistencies * HLE.UI Namespace * HLE.UI Files * Namespace * Ryujinx.UI.Common.Configuration.UI * Ryujinx.UI.Common,Configuration.UI Files * More instances --- src/Ryujinx.HLE/Ui/DynamicTextChangedHandler.cs | 4 - src/Ryujinx.HLE/Ui/IDynamicTextInputHandler.cs | 16 --- src/Ryujinx.HLE/Ui/IHostUiHandler.cs | 51 --------- src/Ryujinx.HLE/Ui/IHostUiTheme.cs | 13 --- src/Ryujinx.HLE/Ui/Input/NpadButtonHandler.cs | 6 - src/Ryujinx.HLE/Ui/Input/NpadReader.cs | 140 ------------------------ src/Ryujinx.HLE/Ui/KeyPressedHandler.cs | 6 - src/Ryujinx.HLE/Ui/KeyReleasedHandler.cs | 6 - src/Ryujinx.HLE/Ui/RenderingSurfaceInfo.cs | 45 -------- src/Ryujinx.HLE/Ui/ThemeColor.cs | 18 --- 10 files changed, 305 deletions(-) delete mode 100644 src/Ryujinx.HLE/Ui/DynamicTextChangedHandler.cs delete mode 100644 src/Ryujinx.HLE/Ui/IDynamicTextInputHandler.cs delete mode 100644 src/Ryujinx.HLE/Ui/IHostUiHandler.cs delete mode 100644 src/Ryujinx.HLE/Ui/IHostUiTheme.cs delete mode 100644 src/Ryujinx.HLE/Ui/Input/NpadButtonHandler.cs delete mode 100644 src/Ryujinx.HLE/Ui/Input/NpadReader.cs delete mode 100644 src/Ryujinx.HLE/Ui/KeyPressedHandler.cs delete mode 100644 src/Ryujinx.HLE/Ui/KeyReleasedHandler.cs delete mode 100644 src/Ryujinx.HLE/Ui/RenderingSurfaceInfo.cs delete mode 100644 src/Ryujinx.HLE/Ui/ThemeColor.cs (limited to 'src/Ryujinx.HLE/Ui') diff --git a/src/Ryujinx.HLE/Ui/DynamicTextChangedHandler.cs b/src/Ryujinx.HLE/Ui/DynamicTextChangedHandler.cs deleted file mode 100644 index cb9ca0de..00000000 --- a/src/Ryujinx.HLE/Ui/DynamicTextChangedHandler.cs +++ /dev/null @@ -1,4 +0,0 @@ -namespace Ryujinx.HLE.Ui -{ - public delegate void DynamicTextChangedHandler(string text, int cursorBegin, int cursorEnd, bool overwriteMode); -} diff --git a/src/Ryujinx.HLE/Ui/IDynamicTextInputHandler.cs b/src/Ryujinx.HLE/Ui/IDynamicTextInputHandler.cs deleted file mode 100644 index e530d2c4..00000000 --- a/src/Ryujinx.HLE/Ui/IDynamicTextInputHandler.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; - -namespace Ryujinx.HLE.Ui -{ - public interface IDynamicTextInputHandler : IDisposable - { - event DynamicTextChangedHandler TextChangedEvent; - event KeyPressedHandler KeyPressedEvent; - event KeyReleasedHandler KeyReleasedEvent; - - bool TextProcessingEnabled { get; set; } - - void SetText(string text, int cursorBegin); - void SetText(string text, int cursorBegin, int cursorEnd); - } -} diff --git a/src/Ryujinx.HLE/Ui/IHostUiHandler.cs b/src/Ryujinx.HLE/Ui/IHostUiHandler.cs deleted file mode 100644 index 68f78f22..00000000 --- a/src/Ryujinx.HLE/Ui/IHostUiHandler.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Ryujinx.HLE.HOS.Applets; -using Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.ApplicationProxy.Types; - -namespace Ryujinx.HLE.Ui -{ - public interface IHostUiHandler - { - /// - /// Displays an Input Dialog box to the user and blocks until text is entered. - /// - /// Text that the user entered. Set to `null` on internal errors - /// True when OK is pressed, False otherwise. Also returns True on internal errors - bool DisplayInputDialog(SoftwareKeyboardUiArgs args, out string userText); - - /// - /// Displays a Message Dialog box to the user and blocks until it is closed. - /// - /// True when OK is pressed, False otherwise. - bool DisplayMessageDialog(string title, string message); - - /// - /// Displays a Message Dialog box specific to Controller Applet and blocks until it is closed. - /// - /// True when OK is pressed, False otherwise. - bool DisplayMessageDialog(ControllerAppletUiArgs args); - - /// - /// Tell the UI that we need to transisition to another program. - /// - /// The device instance. - /// The program kind. - /// The value associated to the . - void ExecuteProgram(Switch device, ProgramSpecifyKind kind, ulong value); - - /// Displays a Message Dialog box specific to Error Applet and blocks until it is closed. - /// - /// False when OK is pressed, True when another button (Details) is pressed. - bool DisplayErrorAppletDialog(string title, string message, string[] buttonsText); - - /// - /// Creates a handler to process keyboard inputs into text strings. - /// - /// An instance of the text handler. - IDynamicTextInputHandler CreateDynamicTextInputHandler(); - - /// - /// Gets fonts and colors used by the host. - /// - IHostUiTheme HostUiTheme { get; } - } -} diff --git a/src/Ryujinx.HLE/Ui/IHostUiTheme.cs b/src/Ryujinx.HLE/Ui/IHostUiTheme.cs deleted file mode 100644 index 11d82361..00000000 --- a/src/Ryujinx.HLE/Ui/IHostUiTheme.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Ryujinx.HLE.Ui -{ - public interface IHostUiTheme - { - string FontFamily { get; } - - ThemeColor DefaultBackgroundColor { get; } - ThemeColor DefaultForegroundColor { get; } - ThemeColor DefaultBorderColor { get; } - ThemeColor SelectionBackgroundColor { get; } - ThemeColor SelectionForegroundColor { get; } - } -} diff --git a/src/Ryujinx.HLE/Ui/Input/NpadButtonHandler.cs b/src/Ryujinx.HLE/Ui/Input/NpadButtonHandler.cs deleted file mode 100644 index 2d1c1c49..00000000 --- a/src/Ryujinx.HLE/Ui/Input/NpadButtonHandler.cs +++ /dev/null @@ -1,6 +0,0 @@ -using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad; - -namespace Ryujinx.HLE.Ui.Input -{ - delegate void NpadButtonHandler(int npadIndex, NpadButton button); -} diff --git a/src/Ryujinx.HLE/Ui/Input/NpadReader.cs b/src/Ryujinx.HLE/Ui/Input/NpadReader.cs deleted file mode 100644 index 8fc95dc9..00000000 --- a/src/Ryujinx.HLE/Ui/Input/NpadReader.cs +++ /dev/null @@ -1,140 +0,0 @@ -using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common; -using Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Npad; - -namespace Ryujinx.HLE.Ui.Input -{ - /// - /// Class that converts Hid entries for the Npad into pressed / released events. - /// - class NpadReader - { - private readonly Switch _device; - private readonly NpadCommonState[] _lastStates; - - public event NpadButtonHandler NpadButtonUpEvent; - public event NpadButtonHandler NpadButtonDownEvent; - - public NpadReader(Switch device) - { - _device = device; - _lastStates = new NpadCommonState[_device.Hid.SharedMemory.Npads.Length]; - } - - public NpadButton GetCurrentButtonsOfNpad(int npadIndex) - { - return _lastStates[npadIndex].Buttons; - } - - public NpadButton GetCurrentButtonsOfAllNpads() - { - NpadButton buttons = 0; - - foreach (var state in _lastStates) - { - buttons |= state.Buttons; - } - - return buttons; - } - - private static ref RingLifo GetCommonStateLifo(ref NpadInternalState npad) - { - switch (npad.StyleSet) - { - case NpadStyleTag.FullKey: - return ref npad.FullKey; - case NpadStyleTag.Handheld: - return ref npad.Handheld; - case NpadStyleTag.JoyDual: - return ref npad.JoyDual; - case NpadStyleTag.JoyLeft: - return ref npad.JoyLeft; - case NpadStyleTag.JoyRight: - return ref npad.JoyRight; - case NpadStyleTag.Palma: - return ref npad.Palma; - default: - return ref npad.SystemExt; - } - } - - public void Update(bool supressEvents = false) - { - ref var npads = ref _device.Hid.SharedMemory.Npads; - - // Process each input individually. - for (int npadIndex = 0; npadIndex < npads.Length; npadIndex++) - { - UpdateNpad(npadIndex, supressEvents); - } - } - - private void UpdateNpad(int npadIndex, bool supressEvents) - { - const int MaxEntries = 1024; - - ref var npadState = ref _device.Hid.SharedMemory.Npads[npadIndex]; - ref var lastEntry = ref _lastStates[npadIndex]; - - var fullKeyEntries = GetCommonStateLifo(ref npadState.InternalState).ReadEntries(MaxEntries); - - int firstEntryNum; - - // Scan the LIFO for the first entry that is newer that what's already processed. - for (firstEntryNum = fullKeyEntries.Length - 1; - firstEntryNum >= 0 && fullKeyEntries[firstEntryNum].Object.SamplingNumber <= lastEntry.SamplingNumber; - firstEntryNum--) - { - } - - if (firstEntryNum == -1) - { - return; - } - - for (; firstEntryNum >= 0; firstEntryNum--) - { - var entry = fullKeyEntries[firstEntryNum]; - - // The interval of valid entries should be contiguous. - if (entry.SamplingNumber < lastEntry.SamplingNumber) - { - break; - } - - if (!supressEvents) - { - ProcessNpadButtons(npadIndex, entry.Object.Buttons); - } - - lastEntry = entry.Object; - } - } - - private void ProcessNpadButtons(int npadIndex, NpadButton buttons) - { - NpadButton lastButtons = _lastStates[npadIndex].Buttons; - - for (ulong buttonMask = 1; buttonMask != 0; buttonMask <<= 1) - { - NpadButton currentButton = (NpadButton)buttonMask & buttons; - NpadButton lastButton = (NpadButton)buttonMask & lastButtons; - - if (lastButton != 0) - { - if (currentButton == 0) - { - NpadButtonUpEvent?.Invoke(npadIndex, lastButton); - } - } - else - { - if (currentButton != 0) - { - NpadButtonDownEvent?.Invoke(npadIndex, currentButton); - } - } - } - } - } -} diff --git a/src/Ryujinx.HLE/Ui/KeyPressedHandler.cs b/src/Ryujinx.HLE/Ui/KeyPressedHandler.cs deleted file mode 100644 index 31e75437..00000000 --- a/src/Ryujinx.HLE/Ui/KeyPressedHandler.cs +++ /dev/null @@ -1,6 +0,0 @@ -using Ryujinx.Common.Configuration.Hid; - -namespace Ryujinx.HLE.Ui -{ - public delegate bool KeyPressedHandler(Key key); -} diff --git a/src/Ryujinx.HLE/Ui/KeyReleasedHandler.cs b/src/Ryujinx.HLE/Ui/KeyReleasedHandler.cs deleted file mode 100644 index d5b6d201..00000000 --- a/src/Ryujinx.HLE/Ui/KeyReleasedHandler.cs +++ /dev/null @@ -1,6 +0,0 @@ -using Ryujinx.Common.Configuration.Hid; - -namespace Ryujinx.HLE.Ui -{ - public delegate bool KeyReleasedHandler(Key key); -} diff --git a/src/Ryujinx.HLE/Ui/RenderingSurfaceInfo.cs b/src/Ryujinx.HLE/Ui/RenderingSurfaceInfo.cs deleted file mode 100644 index 0b3d0a90..00000000 --- a/src/Ryujinx.HLE/Ui/RenderingSurfaceInfo.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Ryujinx.HLE.HOS.Services.SurfaceFlinger; -using System; - -namespace Ryujinx.HLE.Ui -{ - /// - /// Information about the indirect layer that is being drawn to. - /// - class RenderingSurfaceInfo : IEquatable - { - public ColorFormat ColorFormat { get; } - public uint Width { get; } - public uint Height { get; } - public uint Pitch { get; } - public uint Size { get; } - - public RenderingSurfaceInfo(ColorFormat colorFormat, uint width, uint height, uint pitch, uint size) - { - ColorFormat = colorFormat; - Width = width; - Height = height; - Pitch = pitch; - Size = size; - } - - public bool Equals(RenderingSurfaceInfo other) - { - return ColorFormat == other.ColorFormat && - Width == other.Width && - Height == other.Height && - Pitch == other.Pitch && - Size == other.Size; - } - - public override bool Equals(object obj) - { - return obj is RenderingSurfaceInfo info && Equals(info); - } - - public override int GetHashCode() - { - return BitConverter.ToInt32(BitConverter.GetBytes(((ulong)ColorFormat) ^ Width ^ Height ^ Pitch ^ Size)); - } - } -} diff --git a/src/Ryujinx.HLE/Ui/ThemeColor.cs b/src/Ryujinx.HLE/Ui/ThemeColor.cs deleted file mode 100644 index 23657ed2..00000000 --- a/src/Ryujinx.HLE/Ui/ThemeColor.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Ryujinx.HLE.Ui -{ - public readonly struct ThemeColor - { - public float A { get; } - public float R { get; } - public float G { get; } - public float B { get; } - - public ThemeColor(float a, float r, float g, float b) - { - A = a; - R = r; - G = g; - B = b; - } - } -} -- cgit v1.2.3