Added Control Settings

one day done feature :P
This commit is contained in:
Xpl0itR 2019-06-10 01:27:22 +01:00
parent a97fcd3859
commit 454ef62ee6
No known key found for this signature in database
GPG key ID: 91798184109676AD
10 changed files with 1143 additions and 30 deletions

View file

@ -138,12 +138,12 @@ namespace Ryujinx
/// <summary>
/// Enable or disable keyboard support (Independent from controllers binding)
/// </summary>
public bool EnableKeyboard { get; private set; }
public bool EnableKeyboard { get; set; }
/// <summary>
/// Keyboard control bindings
/// </summary>
public NpadKeyboard KeyboardControls { get; private set; }
public NpadKeyboard KeyboardControls { get; set; }
/// <summary>
/// Controller control bindings
@ -211,6 +211,7 @@ namespace Ryujinx
}
GeneralSettings.ConfigureSettings(Instance);
ControlSettings.ConfigureControls(Instance);
Logger.AddTarget(new AsyncLogTargetWrapper(
new ConsoleLogTarget(),

View file

@ -0,0 +1,246 @@
using Gtk;
using GUI = Gtk.Builder.ObjectAttribute;
using Ryujinx.UI.Input;
using System;
using System.Reflection;
using System.Collections.Generic;
namespace Ryujinx
{
public class ControlSettings : Window
{
private HLE.Switch device { get; set; }
internal static Configuration SwitchConfig { get; private set; }
[GUI] Window CSWin;
[GUI] CheckButton EnableKeyboard;
[GUI] Image ControllerImage;
[GUI] ToggleButton LStickUp1;
[GUI] ToggleButton LStickDown1;
[GUI] ToggleButton LStickLeft1;
[GUI] ToggleButton LStickRight1;
[GUI] ToggleButton LStickButton1;
[GUI] ToggleButton DpadUp1;
[GUI] ToggleButton DpadDown1;
[GUI] ToggleButton DpadLeft1;
[GUI] ToggleButton DpadRight1;
[GUI] ToggleButton Minus1;
[GUI] ToggleButton L1;
[GUI] ToggleButton ZL1;
[GUI] ToggleButton RStickUp1;
[GUI] ToggleButton RStickDown1;
[GUI] ToggleButton RStickLeft1;
[GUI] ToggleButton RStickRight1;
[GUI] ToggleButton RStickButton1;
[GUI] ToggleButton A1;
[GUI] ToggleButton B1;
[GUI] ToggleButton X1;
[GUI] ToggleButton Y1;
[GUI] ToggleButton Plus1;
[GUI] ToggleButton R1;
[GUI] ToggleButton ZR1;
public static void ConfigureControls(Configuration Instance) { SwitchConfig = Instance; }
public ControlSettings(HLE.Switch _device) : this(new Builder("Ryujinx.GUI.ControlSettings.glade"), _device) { }
private ControlSettings(Builder builder, HLE.Switch _device) : base(builder.GetObject("CSWin").Handle)
{
device = _device;
builder.Autoconnect(this);
CSWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxIcon.png");
ControllerImage.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.GUI.assets.ryujinxIcon.png", 500, 500);
LStickUp1.Toggled += (o, args) => Button_Pressed(o, args, LStickUp1);
LStickDown1.Toggled += (o, args) => Button_Pressed(o, args, LStickDown1);
LStickLeft1.Toggled += (o, args) => Button_Pressed(o, args, LStickLeft1);
LStickRight1.Toggled += (o, args) => Button_Pressed(o, args, LStickRight1);
LStickButton1.Toggled += (o, args) => Button_Pressed(o, args, LStickButton1);
DpadUp1.Toggled += (o, args) => Button_Pressed(o, args, DpadUp1);
DpadDown1.Toggled += (o, args) => Button_Pressed(o, args, DpadDown1);
DpadLeft1.Toggled += (o, args) => Button_Pressed(o, args, DpadLeft1);
DpadRight1.Toggled += (o, args) => Button_Pressed(o, args, DpadRight1);
Minus1.Toggled += (o, args) => Button_Pressed(o, args, Minus1);
L1.Toggled += (o, args) => Button_Pressed(o, args, L1);
ZL1.Toggled += (o, args) => Button_Pressed(o, args, ZL1);
RStickUp1.Toggled += (o, args) => Button_Pressed(o, args, RStickUp1);
RStickDown1.Toggled += (o, args) => Button_Pressed(o, args, RStickDown1);
RStickLeft1.Toggled += (o, args) => Button_Pressed(o, args, RStickLeft1);
RStickRight1.Toggled += (o, args) => Button_Pressed(o, args, RStickRight1);
RStickButton1.Toggled += (o, args) => Button_Pressed(o, args, RStickButton1);
A1.Toggled += (o, args) => Button_Pressed(o, args, A1);
B1.Toggled += (o, args) => Button_Pressed(o, args, B1);
X1.Toggled += (o, args) => Button_Pressed(o, args, X1);
Y1.Toggled += (o, args) => Button_Pressed(o, args, Y1);
Plus1.Toggled += (o, args) => Button_Pressed(o, args, Plus1);
R1.Toggled += (o, args) => Button_Pressed(o, args, R1);
ZR1.Toggled += (o, args) => Button_Pressed(o, args, ZR1);
if (SwitchConfig.EnableKeyboard) { EnableKeyboard.Click(); }
LStickUp1.Label = SwitchConfig.KeyboardControls.LeftJoycon.StickUp.ToString();
LStickDown1.Label = SwitchConfig.KeyboardControls.LeftJoycon.StickDown.ToString();
LStickLeft1.Label = SwitchConfig.KeyboardControls.LeftJoycon.StickLeft.ToString();
LStickRight1.Label = SwitchConfig.KeyboardControls.LeftJoycon.StickRight.ToString();
LStickButton1.Label = SwitchConfig.KeyboardControls.LeftJoycon.StickButton.ToString();
DpadUp1.Label = SwitchConfig.KeyboardControls.LeftJoycon.DPadUp.ToString();
DpadDown1.Label = SwitchConfig.KeyboardControls.LeftJoycon.DPadDown.ToString();
DpadLeft1.Label = SwitchConfig.KeyboardControls.LeftJoycon.DPadLeft.ToString();
DpadRight1.Label = SwitchConfig.KeyboardControls.LeftJoycon.DPadRight.ToString();
Minus1.Label = SwitchConfig.KeyboardControls.LeftJoycon.ButtonMinus.ToString();
L1.Label = SwitchConfig.KeyboardControls.LeftJoycon.ButtonL.ToString();
ZL1.Label = SwitchConfig.KeyboardControls.LeftJoycon.ButtonZl.ToString();
RStickUp1.Label = SwitchConfig.KeyboardControls.RightJoycon.StickUp.ToString();
RStickDown1.Label = SwitchConfig.KeyboardControls.RightJoycon.StickDown.ToString();
RStickLeft1.Label = SwitchConfig.KeyboardControls.RightJoycon.StickLeft.ToString();
RStickRight1.Label = SwitchConfig.KeyboardControls.RightJoycon.StickRight.ToString();
RStickButton1.Label = SwitchConfig.KeyboardControls.RightJoycon.StickButton.ToString();
A1.Label = SwitchConfig.KeyboardControls.RightJoycon.ButtonA.ToString();
B1.Label = SwitchConfig.KeyboardControls.RightJoycon.ButtonB.ToString();
X1.Label = SwitchConfig.KeyboardControls.RightJoycon.ButtonX.ToString();
Y1.Label = SwitchConfig.KeyboardControls.RightJoycon.ButtonY.ToString();
Plus1.Label = SwitchConfig.KeyboardControls.RightJoycon.ButtonPlus.ToString();
R1.Label = SwitchConfig.KeyboardControls.RightJoycon.ButtonR.ToString();
ZR1.Label = SwitchConfig.KeyboardControls.RightJoycon.ButtonZr.ToString();
}
//Events
private void Button_Pressed(object button, EventArgs args, ToggleButton Button)
{
KeyPressEvent += On_KeyPress;
void On_KeyPress(object obj , KeyPressEventArgs KeyPressed)
{
string key = KeyPressed.Event.Key.ToString();
if (GdkToTKInput.ContainsKey(key)) { Button.Label = GdkToTKInput[key]; }
else { Button.Label = "A"; }
Button.SetStateFlags(0, true);
KeyPressEvent -= On_KeyPress;
}
}
private void SaveToggle_Activated(object obj, EventArgs args)
{
if (EnableKeyboard.Active) { SwitchConfig.EnableKeyboard = true; }
SwitchConfig.KeyboardControls.LeftJoycon = new NpadKeyboardLeft()
{
StickUp = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), LStickUp1.Label),
StickDown = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), LStickDown1.Label),
StickLeft = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), LStickLeft1.Label),
StickRight = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), LStickRight1.Label),
StickButton = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), LStickButton1.Label),
DPadUp = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), DpadUp1.Label),
DPadDown = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), DpadDown1.Label),
DPadLeft = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), DpadLeft1.Label),
DPadRight = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), DpadRight1.Label),
ButtonMinus = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), Minus1.Label),
ButtonL = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), L1.Label),
ButtonZl = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), ZL1.Label),
};
SwitchConfig.KeyboardControls.RightJoycon = new NpadKeyboardRight()
{
StickUp = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), RStickUp1.Label),
StickDown = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), RStickDown1.Label),
StickLeft = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), RStickLeft1.Label),
StickRight = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), RStickRight1.Label),
StickButton = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), RStickButton1.Label),
ButtonA = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), A1.Label),
ButtonB = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), B1.Label),
ButtonX = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), X1.Label),
ButtonY = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), Y1.Label),
ButtonPlus = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), Plus1.Label),
ButtonR = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), R1.Label),
ButtonZr = (OpenTK.Input.Key)Enum.Parse(typeof(OpenTK.Input.Key), ZR1.Label),
};
Configuration.SaveConfig(SwitchConfig, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config.json"));
Configuration.Configure(device, SwitchConfig);
Destroy();
}
private void CloseToggle_Activated(object obj, EventArgs args)
{
Destroy();
}
public readonly Dictionary<string, string> GdkToTKInput = new Dictionary<string, string>()
{
{"A", "A"},
{"B", "B"},
{"C", "C"},
{"D", "D"},
{"E", "E"},
{"F", "F"},
{"G", "G"},
{"H", "H"},
{"I", "I"},
{"J", "J"},
{"K", "K"},
{"L", "L"},
{"M", "M"},
{"N", "N"},
{"O", "O"},
{"P", "P"},
{"Q", "Q"},
{"R", "R"},
{"S", "S"},
{"T", "T"},
{"U", "U"},
{"V", "V"},
{"W", "W"},
{"X", "X"},
{"Y", "Y"},
{"Z", "Z"},
{"a", "A"},
{"b", "B"},
{"c", "C"},
{"d", "D"},
{"e", "E"},
{"f", "F"},
{"g", "G"},
{"h", "H"},
{"i", "I"},
{"j", "J"},
{"k", "K"},
{"l", "L"},
{"m", "M"},
{"n", "N"},
{"o", "O"},
{"p", "P"},
{"q", "Q"},
{"r", "R"},
{"s", "S"},
{"t", "T"},
{"u", "U"},
{"v", "V"},
{"w", "W"},
{"x", "X"},
{"y", "Y"},
{"z", "Z"},
{"Key_0", "Number0"},
{"Key_1", "Number1"},
{"Key_2", "Number2"},
{"Key_3", "Number3"},
{"Key_4", "Number4"},
{"Key_5", "Number5"},
{"Key_6", "Number6"},
{"Key_7", "Number7"},
{"Key_8", "Number8"},
{"Key_9", "Number9"},
{"equal", "Plus"},
{"minus", "Minus"},
{"uparrow", "Up"},
{"downarrow", "Down"},
{"leftarrow", "Left"},
{"rightarrow", "Right"},
};
}
}

View file

@ -0,0 +1,850 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkDialog" id="CSWin">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Ryujinx - Control Settings</property>
<property name="modal">True</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkToggleButton" id="SaveToggle">
<property name="label" translatable="yes">Save</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="toggled" handler="SaveToggle_Activated" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="CloseToggle">
<property name="label" translatable="yes">Close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="toggled" handler="CloseToggle_Activated" swapped="no"/>
</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">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkNotebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkBox" id="ControllerBox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="EnableKeyboard">
<property name="label" translatable="yes">Enable Keyboard Support</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">10</property>
<property name="position">0</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">1</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">2</property>
<property name="column_spacing">5</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">LStick Up</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">LStick Down</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">LStick Left</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">LStick Right</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">LStick Button</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Dpad Up</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Dpad Down</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Dpad Left</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Dpad Right</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">8</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">-</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">9</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">L</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">10</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">ZL</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">11</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">ZR</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">11</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">R</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">10</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">+</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">9</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Y</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">8</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">X</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">7</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">B</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">A</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">RStick Button</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">RStick Right</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">RStick Left</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">RStick Down</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">RStick Up</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="LStickUp1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="LStickDown1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="LStickLeft1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="LStickRight1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="LStickButton1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="DpadUp1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="DpadDown1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="DpadLeft1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">7</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="DpadRight1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">8</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="Minus1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">9</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="L1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">10</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="ZL1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">11</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="RStickUp1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="RStickDown1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="RStickLeft1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="RStickRight1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="RStickButton1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="A1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="B1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="X1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">7</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="Y1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">8</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="Plus1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">9</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="R1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">10</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="ZR1">
<property name="label" translatable="yes"> </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">11</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">10</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="ControllerImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">True</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="position">2</property>
</packing>
</child>
</object>
</child>
<child type="tab">
<object class="GtkLabel" id="Controller1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Controller 1</property>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Multiple controllers are not yet supported</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab_expand">True</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="Controller2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Controller 2</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Multiple controllers are not yet supported</property>
</object>
<packing>
<property name="position">2</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="Controller3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Controller 3</property>
</object>
<packing>
<property name="position">2</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Multiple controllers are not yet supported</property>
</object>
<packing>
<property name="position">3</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="Controller4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Controller 4</property>
</object>
<packing>
<property name="position">3</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Multiple controllers are not yet supported</property>
</object>
<packing>
<property name="position">4</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="Controller5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Controller 5</property>
</object>
<packing>
<property name="position">4</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Multiple controllers are not yet supported</property>
</object>
<packing>
<property name="position">5</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="Controller6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Controller 6</property>
</object>
<packing>
<property name="position">5</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Multiple controllers are not yet supported</property>
</object>
<packing>
<property name="position">6</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="Controller7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Controller 7</property>
</object>
<packing>
<property name="position">6</property>
<property name="tab_fill">False</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Multiple controllers are not yet supported</property>
</object>
<packing>
<property name="position">7</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel" id="Controller8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Controller 8</property>
</object>
<packing>
<property name="position">7</property>
<property name="tab_fill">False</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View file

@ -13,7 +13,6 @@ namespace Ryujinx
internal static Configuration SwitchConfig { get; private set; }
//UI Controls
[GUI] Window GSWin;
[GUI] CheckButton ErrorLogToggle;
[GUI] CheckButton WarningLogToggle;
@ -28,6 +27,7 @@ namespace Ryujinx
[GUI] CheckButton FSICToggle;
[GUI] CheckButton AggrToggle;
[GUI] CheckButton IgnoreToggle;
[GUI] CheckButton DirectKeyboardAccess;
[GUI] ComboBoxText SystemLanguageSelect;
[GUI] CheckButton CustThemeToggle;
[GUI] Entry CustThemeDir;
@ -58,6 +58,7 @@ namespace Ryujinx
if (SwitchConfig.EnableFsIntegrityChecks) { FSICToggle.Click(); }
if (SwitchConfig.EnableAggressiveCpuOpts) { AggrToggle.Click(); }
if (SwitchConfig.IgnoreMissingServices) { IgnoreToggle.Click(); }
if (SwitchConfig.EnableKeyboard) { DirectKeyboardAccess.Click(); }
if (SwitchConfig.EnableCustomTheme) { CustThemeToggle.Click(); }
SystemLanguageSelect.SetActiveId(SwitchConfig.SystemLanguage.ToString());
@ -73,27 +74,23 @@ namespace Ryujinx
if (CustThemeToggle.Active == false) { CustThemeDir.Sensitive = false; } else { CustThemeDir.Sensitive = true; }
}
private void CloseToggle_Activated(object obj, EventArgs args)
{
Destroy();
}
private void SaveToggle_Activated(object obj, EventArgs args)
{
if (ErrorLogToggle.Active) { SwitchConfig.LoggingEnableError = true; }
if (WarningLogToggle.Active) { SwitchConfig.LoggingEnableWarn = true; }
if (InfoLogToggle.Active) { SwitchConfig.LoggingEnableInfo = true; }
if (StubLogToggle.Active) { SwitchConfig.LoggingEnableStub = true; }
if (DebugLogToggle.Active) { SwitchConfig.LoggingEnableDebug = true; }
if (FileLogToggle.Active) { SwitchConfig.EnableFileLog = true; }
if (DockedModeToggle.Active) { SwitchConfig.DockedMode = true; }
if (DiscordToggle.Active) { SwitchConfig.EnableDiscordIntergration = true; }
if (VSyncToggle.Active) { SwitchConfig.EnableVsync = true; }
if (MultiSchedToggle.Active) { SwitchConfig.EnableMulticoreScheduling = true; }
if (FSICToggle.Active) { SwitchConfig.EnableFsIntegrityChecks = true; }
if (AggrToggle.Active) { SwitchConfig.EnableAggressiveCpuOpts = true; }
if (IgnoreToggle.Active) { SwitchConfig.IgnoreMissingServices = true; }
if (CustThemeToggle.Active) { SwitchConfig.EnableCustomTheme = true; }
if (ErrorLogToggle.Active) { SwitchConfig.LoggingEnableError = true; }
if (WarningLogToggle.Active) { SwitchConfig.LoggingEnableWarn = true; }
if (InfoLogToggle.Active) { SwitchConfig.LoggingEnableInfo = true; }
if (StubLogToggle.Active) { SwitchConfig.LoggingEnableStub = true; }
if (DebugLogToggle.Active) { SwitchConfig.LoggingEnableDebug = true; }
if (FileLogToggle.Active) { SwitchConfig.EnableFileLog = true; }
if (DockedModeToggle.Active) { SwitchConfig.DockedMode = true; }
if (DiscordToggle.Active) { SwitchConfig.EnableDiscordIntergration = true; }
if (VSyncToggle.Active) { SwitchConfig.EnableVsync = true; }
if (MultiSchedToggle.Active) { SwitchConfig.EnableMulticoreScheduling = true; }
if (FSICToggle.Active) { SwitchConfig.EnableFsIntegrityChecks = true; }
if (AggrToggle.Active) { SwitchConfig.EnableAggressiveCpuOpts = true; }
if (IgnoreToggle.Active) { SwitchConfig.IgnoreMissingServices = true; }
if (DirectKeyboardAccess.Active) { SwitchConfig.EnableKeyboard = true; }
if (CustThemeToggle.Active) { SwitchConfig.EnableCustomTheme = true; }
SwitchConfig.SystemLanguage = (SystemLanguage)Enum.Parse(typeof(SystemLanguage), SystemLanguageSelect.ActiveId);
SwitchConfig.CustomThemePath = CustThemeDir.Buffer.Text;
@ -105,5 +102,10 @@ namespace Ryujinx
Destroy();
}
private void CloseToggle_Activated(object obj, EventArgs args)
{
Destroy();
}
}
}

View file

@ -4,6 +4,7 @@
<requires lib="gtk+" version="3.20"/>
<object class="GtkDialog" id="GSWin">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Ryujinx - General Settings</property>
<property name="modal">True</property>
<property name="type_hint">dialog</property>
<child>
@ -236,6 +237,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">System Language:</property>
</object>
<packing>
@ -273,10 +275,12 @@
</packing>
</child>
<child>
<object class="GtkImage">
<object class="GtkCheckButton" id="DirectKeyboardAccess">
<property name="label" translatable="yes">Direct Keyboard Access</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-discard</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>

View file

@ -31,10 +31,8 @@ namespace Ryujinx
private static ListStore TableStore { get; set; }
//UI Controls
[GUI] Window MainWin;
[GUI] MenuItem NFC;
[GUI] MenuItem ControlSettingsMenu;
[GUI] TreeView GameTable;
[GUI] ScrolledWindow GameTableWindow;
[GUI] GLArea GLScreen;
@ -102,7 +100,6 @@ namespace Ryujinx
GLScreen.Hide();
NFC.Sensitive = false;
ControlSettingsMenu.Sensitive = false;
GameTable.AppendColumn("Icon", new CellRendererPixbuf(), "pixbuf", 0);
GameTable.AppendColumn("Game", new CellRendererText(), "text", 1);
@ -327,6 +324,14 @@ namespace Ryujinx
GSWin.Show();
}
private void Control_Settings_Pressed(object o, EventArgs args)
{
var CSWin = new ControlSettings(device);
gtkapp.Register(GLib.Cancellable.Current);
gtkapp.AddWindow(CSWin);
CSWin.Show();
}
private void NFC_Pressed(object o, EventArgs args)
{
FileChooserDialog fc = new FileChooserDialog("Choose the file to open", this, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept);

View file

@ -7,6 +7,9 @@
<property name="title" translatable="yes">Ryujinx</property>
<property name="default_width">1280</property>
<property name="default_height">750</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="box">
<property name="visible">True</property>
@ -88,6 +91,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes">Control Settings</property>
<property name="use_underline">True</property>
<signal name="activate" handler="Control_Settings_Pressed" swapped="no"/>
</object>
</child>
</object>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View file

@ -21,6 +21,7 @@
<ItemGroup>
<EmbeddedResource Include="GUI\assets\ryujinxIcon.png" />
<EmbeddedResource Include="GUI\assets\ryujinxROMIcon.png" />
<EmbeddedResource Include="GUI\ControlSettings.glade" />
<EmbeddedResource Include="GUI\GeneralSettings.glade" />
<EmbeddedResource Include="GUI\MainMenu.glade" />
</ItemGroup>

View file

@ -45,12 +45,12 @@ namespace Ryujinx.UI.Input
/// <summary>
/// Left JoyCon Keyboard Bindings
/// </summary>
public NpadKeyboardLeft LeftJoycon { get; private set; }
public NpadKeyboardLeft LeftJoycon { get; set; }
/// <summary>
/// Right JoyCon Keyboard Bindings
/// </summary>
public NpadKeyboardRight RightJoycon { get; private set; }
public NpadKeyboardRight RightJoycon { get; set; }
/// <summary>
/// Hotkey Keyboard Bindings