cleanup, changed rendering style
This commit is contained in:
parent
941bc58063
commit
2084c93569
13 changed files with 403 additions and 91 deletions
|
@ -6,9 +6,10 @@ namespace Ryujinx.UI
|
||||||
public class ControlArchive
|
public class ControlArchive
|
||||||
{
|
{
|
||||||
public LanguageEntry[] LanguageEntries { get; set; }
|
public LanguageEntry[] LanguageEntries { get; set; }
|
||||||
public long ApplicationTitleID { get; set; }
|
|
||||||
public long BaseTitleID { get; set; }
|
public long ApplicationTitleID { get; set; }
|
||||||
public long ProductCode { get; set; }
|
public long BaseTitleID { get; set; }
|
||||||
|
public long ProductCode { get; set; }
|
||||||
public string ApplicationVersion { get; set; }
|
public string ApplicationVersion { get; set; }
|
||||||
|
|
||||||
public ControlArchive(Stream Input)
|
public ControlArchive(Stream Input)
|
||||||
|
@ -20,10 +21,11 @@ namespace Ryujinx.UI
|
||||||
Input.Seek(0x3060, SeekOrigin.Begin);
|
Input.Seek(0x3060, SeekOrigin.Begin);
|
||||||
|
|
||||||
ApplicationVersion = Encoding.ASCII.GetString(Reader.ReadBytes(0x10));
|
ApplicationVersion = Encoding.ASCII.GetString(Reader.ReadBytes(0x10));
|
||||||
BaseTitleID = Reader.ReadInt64();
|
BaseTitleID = Reader.ReadInt64();
|
||||||
ApplicationTitleID = Reader.ReadInt64();
|
ApplicationTitleID = Reader.ReadInt64();
|
||||||
|
|
||||||
Input.Seek(0x30a8, SeekOrigin.Begin);
|
Input.Seek(0x30a8, SeekOrigin.Begin);
|
||||||
|
|
||||||
ProductCode = Reader.ReadInt64();
|
ProductCode = Reader.ReadInt64();
|
||||||
|
|
||||||
LanguageEntries = new LanguageEntry[16];
|
LanguageEntries = new LanguageEntry[16];
|
||||||
|
@ -31,12 +33,13 @@ namespace Ryujinx.UI
|
||||||
using (MemoryStream LanguageStream = new MemoryStream(LanguageEntryData))
|
using (MemoryStream LanguageStream = new MemoryStream(LanguageEntryData))
|
||||||
{
|
{
|
||||||
BinaryReader LanguageReader = new BinaryReader(LanguageStream);
|
BinaryReader LanguageReader = new BinaryReader(LanguageStream);
|
||||||
for (int index = 0; index < 16; index++)
|
|
||||||
|
for (int Index = 0; Index < 16; Index++)
|
||||||
{
|
{
|
||||||
LanguageEntries[index] = new LanguageEntry()
|
LanguageEntries[Index] = new LanguageEntry()
|
||||||
{
|
{
|
||||||
AplicationName = Encoding.ASCII.GetString(LanguageReader.ReadBytes(0x200)).Trim('\0'),
|
AplicationName = Encoding.ASCII.GetString(LanguageReader.ReadBytes(0x200)).Trim('\0'),
|
||||||
DeveloperName = Encoding.ASCII.GetString(LanguageReader.ReadBytes(0x100)).Trim('\0')
|
DeveloperName = Encoding.ASCII.GetString(LanguageReader.ReadBytes(0x100)).Trim('\0')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,12 +7,13 @@ namespace Ryujinx.UI
|
||||||
class Nro : HLE.Loaders.Executables.Nro
|
class Nro : HLE.Loaders.Executables.Nro
|
||||||
{
|
{
|
||||||
public byte[] AssetRomfData { get; set; }
|
public byte[] AssetRomfData { get; set; }
|
||||||
public byte[] IconData { get; set; }
|
public byte[] IconData { get; set; }
|
||||||
private byte[] NACPData { get; set; }
|
public int AssetOffset { get; set; }
|
||||||
public int AssetOffset { get; set; }
|
|
||||||
|
|
||||||
public ControlArchive ControlArchive { get; set; }
|
public ControlArchive ControlArchive { get; set; }
|
||||||
|
|
||||||
|
private byte[] NACPData { get; set; }
|
||||||
|
|
||||||
public Nro(Stream Input, string Name) : base(Input, Name)
|
public Nro(Stream Input, string Name) : base(Input, Name)
|
||||||
{
|
{
|
||||||
BinaryReader Reader = new BinaryReader(Input);
|
BinaryReader Reader = new BinaryReader(Input);
|
||||||
|
@ -34,26 +35,29 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
Input.Seek(AssetOffset, SeekOrigin.Begin);
|
Input.Seek(AssetOffset, SeekOrigin.Begin);
|
||||||
|
|
||||||
int AssetMagic0 = Reader.ReadInt32();
|
int AssetMagic0 = Reader.ReadInt32();
|
||||||
int AssetFormat = Reader.ReadInt32();
|
int AssetFormat = Reader.ReadInt32();
|
||||||
byte[] IconSectionInfo = Reader.ReadBytes(0x10);
|
byte[] IconSectionInfo = Reader.ReadBytes(0x10);
|
||||||
byte[] NACPSectionInfo = Reader.ReadBytes(0x10);
|
byte[] NACPSectionInfo = Reader.ReadBytes(0x10);
|
||||||
byte[] AssetRomfSectionInfo = Reader.ReadBytes(0x10);
|
byte[] AssetRomfSectionInfo = Reader.ReadBytes(0x10);
|
||||||
|
|
||||||
long IconOffset = BitConverter.ToInt64(IconSectionInfo, 0);
|
long IconOffset = BitConverter.ToInt64(IconSectionInfo, 0);
|
||||||
long IconSize = BitConverter.ToInt64(IconSectionInfo, 8);
|
long IconSize = BitConverter.ToInt64(IconSectionInfo, 8);
|
||||||
long NACPOffset = BitConverter.ToInt64(NACPSectionInfo, 0);
|
long NACPOffset = BitConverter.ToInt64(NACPSectionInfo, 0);
|
||||||
long NACPSize = BitConverter.ToInt64(NACPSectionInfo, 8);
|
long NACPSize = BitConverter.ToInt64(NACPSectionInfo, 8);
|
||||||
long RomfOffset = BitConverter.ToInt64(AssetRomfSectionInfo, 0);
|
long RomfOffset = BitConverter.ToInt64(AssetRomfSectionInfo, 0);
|
||||||
long RomfSize = BitConverter.ToInt64(AssetRomfSectionInfo, 8);
|
long RomfSize = BitConverter.ToInt64(AssetRomfSectionInfo, 8);
|
||||||
|
|
||||||
Input.Seek(AssetOffset + IconOffset, SeekOrigin.Begin);
|
Input.Seek(AssetOffset + IconOffset, SeekOrigin.Begin);
|
||||||
|
|
||||||
IconData = Reader.ReadBytes((int)IconSize);
|
IconData = Reader.ReadBytes((int)IconSize);
|
||||||
|
|
||||||
Input.Seek(AssetOffset + NACPOffset, SeekOrigin.Begin);
|
Input.Seek(AssetOffset + NACPOffset, SeekOrigin.Begin);
|
||||||
|
|
||||||
NACPData = Reader.ReadBytes((int)NACPSize);
|
NACPData = Reader.ReadBytes((int)NACPSize);
|
||||||
|
|
||||||
Input.Seek(AssetOffset + RomfOffset, SeekOrigin.Begin);
|
Input.Seek(AssetOffset + RomfOffset, SeekOrigin.Begin);
|
||||||
|
|
||||||
AssetRomfData = Reader.ReadBytes((int)RomfSize);
|
AssetRomfData = Reader.ReadBytes((int)RomfSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,15 +9,17 @@ using Ryujinx.Graphics.Gal.OpenGL;
|
||||||
using Ryujinx.HLE;
|
using Ryujinx.HLE;
|
||||||
using Ryujinx.HLE.Input;
|
using Ryujinx.HLE.Input;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
using Stopwatch = System.Diagnostics.Stopwatch;
|
||||||
|
|
||||||
namespace Ryujinx.UI
|
namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
partial class EmulationWindow : WindowHelper
|
partial class EmulationWindow : WindowHelper
|
||||||
{
|
{
|
||||||
public static EmulationController EmulationController;
|
public static EmulationController EmulationController;
|
||||||
//toggles
|
|
||||||
private bool showMainUI = true;
|
//toggles
|
||||||
private bool showPauseUI;
|
|
||||||
private bool isRunning = false;
|
private bool isRunning = false;
|
||||||
private bool IsRunning
|
private bool IsRunning
|
||||||
{
|
{
|
||||||
|
@ -29,6 +31,7 @@ namespace Ryujinx.UI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool showMainUI = true;
|
||||||
private bool ShowMainUI
|
private bool ShowMainUI
|
||||||
{
|
{
|
||||||
get => showMainUI;
|
get => showMainUI;
|
||||||
|
@ -45,6 +48,7 @@ namespace Ryujinx.UI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool showPauseUI;
|
||||||
private bool ShowPauseUI
|
private bool ShowPauseUI
|
||||||
{
|
{
|
||||||
get => showPauseUI;
|
get => showPauseUI;
|
||||||
|
@ -63,10 +67,9 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
private Page CurrentPage = Page.GameList;
|
private Page CurrentPage = Page.GameList;
|
||||||
|
|
||||||
private bool EscapePressed;
|
private bool EscapePressed;
|
||||||
|
private string CurrentPath;
|
||||||
private string CurrentPath = Environment.CurrentDirectory;
|
private string PackagePath;
|
||||||
private string PackagePath = string.Empty;
|
|
||||||
|
|
||||||
private const int TouchScreenWidth = 1280;
|
private const int TouchScreenWidth = 1280;
|
||||||
private const int TouchScreenHeight = 720;
|
private const int TouchScreenHeight = 720;
|
||||||
|
@ -74,17 +77,33 @@ namespace Ryujinx.UI
|
||||||
private const float TouchScreenRatioX = (float)TouchScreenWidth / TouchScreenHeight;
|
private const float TouchScreenRatioX = (float)TouchScreenWidth / TouchScreenHeight;
|
||||||
private const float TouchScreenRatioY = (float)TouchScreenHeight / TouchScreenWidth;
|
private const float TouchScreenRatioY = (float)TouchScreenHeight / TouchScreenWidth;
|
||||||
|
|
||||||
|
private const int TargetFPS = 60;
|
||||||
|
|
||||||
FilePicker FileDialog;
|
FilePicker FileDialog;
|
||||||
|
|
||||||
IGalRenderer Renderer;
|
IGalRenderer Renderer;
|
||||||
|
|
||||||
public static Switch Ns;
|
public static Switch Ns;
|
||||||
|
|
||||||
|
private Thread RenderThread;
|
||||||
|
|
||||||
|
private bool ResizeEvent;
|
||||||
|
|
||||||
|
private bool TitleEvent;
|
||||||
|
|
||||||
|
private string NewTitle;
|
||||||
|
|
||||||
public EmulationWindow() : base("Ryujinx")
|
public EmulationWindow() : base("Ryujinx")
|
||||||
{
|
{
|
||||||
FileDialog = FilePicker.GetFilePicker("rom",null);
|
CurrentPath = Environment.CurrentDirectory;
|
||||||
|
PackagePath = string.Empty;
|
||||||
|
FileDialog = FilePicker.GetFilePicker("rom",null);
|
||||||
|
|
||||||
InitializeSwitch();
|
InitializeSwitch();
|
||||||
|
|
||||||
|
ResizeEvent = false;
|
||||||
|
|
||||||
|
TitleEvent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnLoad(EventArgs e)
|
protected override void OnLoad(EventArgs e)
|
||||||
|
@ -94,10 +113,87 @@ namespace Ryujinx.UI
|
||||||
VSync = VSyncMode.On;
|
VSync = VSyncMode.On;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnRenderFrame(FrameEventArgs e)
|
private void RenderLoop()
|
||||||
{
|
{
|
||||||
DeltaTime = (float)e.Time;
|
MakeCurrent();
|
||||||
|
|
||||||
|
PrepareTexture();
|
||||||
|
|
||||||
|
Stopwatch Chrono = new Stopwatch();
|
||||||
|
|
||||||
|
Chrono.Start();
|
||||||
|
|
||||||
|
long TicksPerFrame = Stopwatch.Frequency / TargetFPS;
|
||||||
|
|
||||||
|
long Ticks = 0;
|
||||||
|
|
||||||
|
while (Exists && !IsExiting)
|
||||||
|
{
|
||||||
|
if (Ns.WaitFifo())
|
||||||
|
{
|
||||||
|
Ns.ProcessFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
Renderer.RunActions();
|
||||||
|
|
||||||
|
if (ResizeEvent)
|
||||||
|
{
|
||||||
|
ResizeEvent = false;
|
||||||
|
|
||||||
|
Renderer.FrameBuffer.SetWindowSize(Width, Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ticks += Chrono.ElapsedTicks;
|
||||||
|
|
||||||
|
DeltaTime = (float)Chrono.Elapsed.TotalSeconds;
|
||||||
|
|
||||||
|
Chrono.Restart();
|
||||||
|
|
||||||
|
if (Ticks >= TicksPerFrame)
|
||||||
|
{
|
||||||
|
RenderFrame();
|
||||||
|
|
||||||
|
//Queue max. 1 vsync
|
||||||
|
Ticks = Math.Min(Ticks - TicksPerFrame, TicksPerFrame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MainLoop()
|
||||||
|
{
|
||||||
|
VSync = VSyncMode.Off;
|
||||||
|
|
||||||
|
Visible = true;
|
||||||
|
|
||||||
|
Renderer.FrameBuffer.SetWindowSize(Width, Height);
|
||||||
|
|
||||||
|
Context.MakeCurrent(null);
|
||||||
|
|
||||||
|
//OpenTK doesn't like sleeps in its thread, to avoid this a renderer thread is created
|
||||||
|
RenderThread = new Thread(RenderLoop);
|
||||||
|
|
||||||
|
RenderThread.Start();
|
||||||
|
|
||||||
|
while (Exists && !IsExiting)
|
||||||
|
{
|
||||||
|
ProcessEvents();
|
||||||
|
|
||||||
|
if (!IsExiting)
|
||||||
|
{
|
||||||
|
UpdateFrame();
|
||||||
|
|
||||||
|
if (TitleEvent)
|
||||||
|
{
|
||||||
|
TitleEvent = false;
|
||||||
|
|
||||||
|
Title = NewTitle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private new void RenderFrame()
|
||||||
|
{
|
||||||
if (UIActive)
|
if (UIActive)
|
||||||
{
|
{
|
||||||
StartFrame();
|
StartFrame();
|
||||||
|
@ -107,11 +203,13 @@ namespace Ryujinx.UI
|
||||||
if (ShowMainUI)
|
if (ShowMainUI)
|
||||||
{
|
{
|
||||||
showPauseUI = false;
|
showPauseUI = false;
|
||||||
|
|
||||||
RenderMainUI();
|
RenderMainUI();
|
||||||
}
|
}
|
||||||
else if (ShowPauseUI)
|
else if (ShowPauseUI)
|
||||||
{
|
{
|
||||||
showMainUI = false;
|
showMainUI = false;
|
||||||
|
|
||||||
RenderPauseUI();
|
RenderPauseUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +224,9 @@ namespace Ryujinx.UI
|
||||||
double HostFps = Ns.Statistics.GetSystemFrameRate();
|
double HostFps = Ns.Statistics.GetSystemFrameRate();
|
||||||
double GameFps = Ns.Statistics.GetGameFrameRate();
|
double GameFps = Ns.Statistics.GetGameFrameRate();
|
||||||
|
|
||||||
Title = $"Ryujinx | Host FPS: {HostFps:0.0} | Game FPS: {GameFps:0.0}";
|
NewTitle = $"Ryujinx | Host FPS: {HostFps:0.0} | Game FPS: {GameFps:0.0}";
|
||||||
|
|
||||||
|
TitleEvent = true;
|
||||||
|
|
||||||
SwapBuffers();
|
SwapBuffers();
|
||||||
|
|
||||||
|
@ -151,7 +251,7 @@ namespace Ryujinx.UI
|
||||||
Ns.Log.Updated += ConsoleLog.PrintLog;
|
Ns.Log.Updated += ConsoleLog.PrintLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnUpdateFrame(FrameEventArgs e)
|
private new void UpdateFrame()
|
||||||
{
|
{
|
||||||
KeyboardState Keyboard = this.Keyboard ?? new KeyboardState();
|
KeyboardState Keyboard = this.Keyboard ?? new KeyboardState();
|
||||||
|
|
||||||
|
@ -178,8 +278,8 @@ namespace Ryujinx.UI
|
||||||
EscapePressed = false;
|
EscapePressed = false;
|
||||||
|
|
||||||
HidControllerButtons CurrentButton = 0;
|
HidControllerButtons CurrentButton = 0;
|
||||||
HidJoystickPosition LeftJoystick;
|
HidJoystickPosition LeftJoystick;
|
||||||
HidJoystickPosition RightJoystick;
|
HidJoystickPosition RightJoystick;
|
||||||
|
|
||||||
int LeftJoystickDX = 0;
|
int LeftJoystickDX = 0;
|
||||||
int LeftJoystickDY = 0;
|
int LeftJoystickDY = 0;
|
||||||
|
@ -282,7 +382,7 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
MouseState Mouse = this.Mouse.Value;
|
MouseState Mouse = this.Mouse.Value;
|
||||||
|
|
||||||
int ScrnWidth = Width;
|
int ScrnWidth = Width;
|
||||||
int ScrnHeight = Height;
|
int ScrnHeight = Height;
|
||||||
|
|
||||||
if (Width > Height * TouchScreenRatioX)
|
if (Width > Height * TouchScreenRatioX)
|
||||||
|
@ -319,7 +419,7 @@ namespace Ryujinx.UI
|
||||||
//Placeholder values till more data is acquired
|
//Placeholder values till more data is acquired
|
||||||
DiameterX = 10,
|
DiameterX = 10,
|
||||||
DiameterY = 10,
|
DiameterY = 10,
|
||||||
Angle = 90
|
Angle = 90
|
||||||
};
|
};
|
||||||
|
|
||||||
HasTouch = true;
|
HasTouch = true;
|
||||||
|
@ -346,10 +446,6 @@ namespace Ryujinx.UI
|
||||||
CurrentButton,
|
CurrentButton,
|
||||||
LeftJoystick,
|
LeftJoystick,
|
||||||
RightJoystick);
|
RightJoystick);
|
||||||
|
|
||||||
Ns.ProcessFrame();
|
|
||||||
|
|
||||||
Renderer.RunActions();
|
|
||||||
}
|
}
|
||||||
else if (EmulationController != null)
|
else if (EmulationController != null)
|
||||||
if (EmulationController.IsLoaded)
|
if (EmulationController.IsLoaded)
|
||||||
|
@ -373,13 +469,25 @@ namespace Ryujinx.UI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnUnload(EventArgs e)
|
||||||
|
{
|
||||||
|
RenderThread.Join();
|
||||||
|
|
||||||
|
base.OnUnload(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnResize(EventArgs e)
|
||||||
|
{
|
||||||
|
ResizeEvent = true;
|
||||||
|
}
|
||||||
|
|
||||||
public void LoadPackage(string path)
|
public void LoadPackage(string path)
|
||||||
{
|
{
|
||||||
|
|
||||||
MainContext.MakeCurrent(WindowInfo);
|
MainContext.MakeCurrent(WindowInfo);
|
||||||
|
|
||||||
if(Ns == null)
|
if (Ns == null)
|
||||||
InitializeSwitch();
|
InitializeSwitch();
|
||||||
|
|
||||||
if (EmulationController == null)
|
if (EmulationController == null)
|
||||||
EmulationController = new EmulationController(Ns);
|
EmulationController = new EmulationController(Ns);
|
||||||
|
|
|
@ -67,6 +67,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
if (ImGui.Button("Input", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
|
if (ImGui.Button("Input", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
|
||||||
{
|
{
|
||||||
CurrentPage = Page.Input;
|
CurrentPage = Page.Input;
|
||||||
|
@ -90,6 +91,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
OpenFolderPicker = true;
|
OpenFolderPicker = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OpenFolderPicker)
|
if (OpenFolderPicker)
|
||||||
ImGui.OpenPopup("Open Folder");
|
ImGui.OpenPopup("Open Folder");
|
||||||
|
|
||||||
|
@ -101,22 +103,28 @@ namespace Ryujinx.UI.Widgets
|
||||||
Config.DefaultGameDirectory = CurrentPath;
|
Config.DefaultGameDirectory = CurrentPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DialogResult != DialogResult.None)
|
if (DialogResult != DialogResult.None)
|
||||||
{
|
{
|
||||||
OpenFolderPicker = false;
|
OpenFolderPicker = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
|
|
||||||
ImGui.Checkbox("Disable Cpu Memory Checks", ref AOptimizations.DisableMemoryChecks);
|
ImGui.Checkbox("Disable Cpu Memory Checks", ref AOptimizations.DisableMemoryChecks);
|
||||||
|
|
||||||
ImGui.EndChild();
|
ImGui.EndChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Page.Input:
|
case Page.Input:
|
||||||
if (ImGui.BeginChild("inputFrame", true, WindowFlags.AlwaysAutoResize))
|
if (ImGui.BeginChild("inputFrame", true, WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
DrawInputPage();
|
DrawInputPage();
|
||||||
|
|
||||||
ImGui.EndChild();
|
ImGui.EndChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,15 +139,19 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
Apply();
|
Apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.Button("Save", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
|
if (ImGui.Button("Save", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
|
||||||
{
|
{
|
||||||
Apply();
|
Apply();
|
||||||
|
|
||||||
Config.Save(EmulationWindow.Ns.Log);
|
Config.Save(EmulationWindow.Ns.Log);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
if (ImGui.Button("Discard", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
|
if (ImGui.Button("Discard", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
|
||||||
{
|
{
|
||||||
IniParser = new IniParser(Config.IniPath);
|
IniParser = new IniParser(Config.IniPath);
|
||||||
|
|
|
@ -10,7 +10,9 @@ namespace ImGuiNET
|
||||||
public class FilePicker
|
public class FilePicker
|
||||||
{
|
{
|
||||||
private const string FilePickerID = "###FilePicker";
|
private const string FilePickerID = "###FilePicker";
|
||||||
|
|
||||||
private static readonly Dictionary<object, FilePicker> FilePickers = new Dictionary<object, FilePicker>();
|
private static readonly Dictionary<object, FilePicker> FilePickers = new Dictionary<object, FilePicker>();
|
||||||
|
|
||||||
private static readonly Vector2 DefaultFilePickerSize = new Vector2(600, 400);
|
private static readonly Vector2 DefaultFilePickerSize = new Vector2(600, 400);
|
||||||
|
|
||||||
public string CurrentFolder { get; set; }
|
public string CurrentFolder { get; set; }
|
||||||
|
@ -26,6 +28,7 @@ namespace ImGuiNET
|
||||||
else if (string.IsNullOrEmpty(StartingPath) || !Directory.Exists(StartingPath))
|
else if (string.IsNullOrEmpty(StartingPath) || !Directory.Exists(StartingPath))
|
||||||
{
|
{
|
||||||
StartingPath = Environment.CurrentDirectory;
|
StartingPath = Environment.CurrentDirectory;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(StartingPath))
|
if (string.IsNullOrEmpty(StartingPath))
|
||||||
{
|
{
|
||||||
StartingPath = AppContext.BaseDirectory;
|
StartingPath = AppContext.BaseDirectory;
|
||||||
|
@ -68,9 +71,10 @@ namespace ImGuiNET
|
||||||
if (ImGui.Selectable(Drive.Name + "/", IsSelected, SelectableFlags.DontClosePopups
|
if (ImGui.Selectable(Drive.Name + "/", IsSelected, SelectableFlags.DontClosePopups
|
||||||
, new Vector2(ImGui.GetContentRegionAvailableWidth(), Values.SelectibleHeight)))
|
, new Vector2(ImGui.GetContentRegionAvailableWidth(), Values.SelectibleHeight)))
|
||||||
{
|
{
|
||||||
CurrentDrive = Drive.Name;
|
CurrentDrive = Drive.Name;
|
||||||
CurrentFolder = Drive.Name;
|
CurrentFolder = Drive.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PopStyleColor();
|
ImGui.PopStyleColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,8 +132,8 @@ namespace ImGuiNET
|
||||||
if (!FoldersOnly)
|
if (!FoldersOnly)
|
||||||
foreach (string File in Directory.EnumerateFiles(CurrentDirectory.FullName))
|
foreach (string File in Directory.EnumerateFiles(CurrentDirectory.FullName))
|
||||||
{
|
{
|
||||||
string Name = Path.GetFileName(File);
|
string Name = Path.GetFileName(File);
|
||||||
bool IsSelected = SelectedEntry == File;
|
bool IsSelected = SelectedEntry == File;
|
||||||
|
|
||||||
if (ImGui.Selectable(Name, IsSelected, SelectableFlags.DontClosePopups
|
if (ImGui.Selectable(Name, IsSelected, SelectableFlags.DontClosePopups
|
||||||
, new Vector2(ImGui.GetContentRegionAvailableWidth(), Values.SelectibleHeight)))
|
, new Vector2(ImGui.GetContentRegionAvailableWidth(), Values.SelectibleHeight)))
|
||||||
|
@ -149,8 +153,8 @@ namespace ImGuiNET
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui.EndChildFrame();
|
|
||||||
|
|
||||||
|
ImGui.EndChildFrame();
|
||||||
|
|
||||||
if (ImGui.Button("Cancel", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
|
if (ImGui.Button("Cancel", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
|
||||||
{
|
{
|
||||||
|
@ -180,11 +184,13 @@ namespace ImGuiNET
|
||||||
public DialogResult GetFolder(ref string CurrentPath)
|
public DialogResult GetFolder(ref string CurrentPath)
|
||||||
{
|
{
|
||||||
ImGui.SetNextWindowSize(new Vector2(600, 600), Condition.FirstUseEver);
|
ImGui.SetNextWindowSize(new Vector2(600, 600), Condition.FirstUseEver);
|
||||||
|
|
||||||
if (ImGui.BeginPopupModal("Open Folder", WindowFlags.NoResize))
|
if (ImGui.BeginPopupModal("Open Folder", WindowFlags.NoResize))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string Output = CurrentPath;
|
string Output = CurrentPath;
|
||||||
|
|
||||||
DialogResult DialogResult = Draw(ref Output, false, true);
|
DialogResult DialogResult = Draw(ref Output, false, true);
|
||||||
|
|
||||||
if (DialogResult == DialogResult.OK)
|
if (DialogResult == DialogResult.OK)
|
||||||
|
|
|
@ -47,11 +47,15 @@ namespace Ryujinx.UI.Widgets
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Linear);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Linear);
|
||||||
GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1);
|
GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1);
|
||||||
|
|
||||||
NanoJpeg.NJImage image = new NJImage();
|
NJImage Image = new NJImage();
|
||||||
image.Decode(GameItem.GetIconData());
|
|
||||||
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgb, image.Width, image.Height, 0, PixelFormat.Rgb,
|
Image.Decode(GameItem.GetIconData());
|
||||||
PixelType.UnsignedByte, new IntPtr(image.Image));
|
|
||||||
image.Dispose();
|
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgb, Image.Width, Image.Height, 0, PixelFormat.Rgb,
|
||||||
|
PixelType.UnsignedByte, new IntPtr(Image.Image));
|
||||||
|
|
||||||
|
Image.Dispose();
|
||||||
|
|
||||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,12 +67,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
|
|
||||||
public unsafe static (bool,string) DrawList()
|
public unsafe static (bool,string) DrawList()
|
||||||
{
|
{
|
||||||
uint id = 100;
|
uint Id = 100;
|
||||||
|
|
||||||
if (ImGui.Button("Refresh GameList"))
|
if (ImGui.Button("Refresh GameList"))
|
||||||
Refresh(Config.DefaultGameDirectory);
|
Refresh(Config.DefaultGameDirectory);
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
if(ImGui.Button("Select Game Directory"))
|
if(ImGui.Button("Select Game Directory"))
|
||||||
{
|
{
|
||||||
OpenFolderPicker = true;
|
OpenFolderPicker = true;
|
||||||
|
@ -78,6 +83,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
ImGui.OpenPopup("Open Folder");
|
ImGui.OpenPopup("Open Folder");
|
||||||
|
|
||||||
DialogResult DialogResult = FolderPicker.GetFolder(ref GameDirectory);
|
DialogResult DialogResult = FolderPicker.GetFolder(ref GameDirectory);
|
||||||
|
|
||||||
if (DialogResult == DialogResult.OK)
|
if (DialogResult == DialogResult.OK)
|
||||||
{
|
{
|
||||||
Config.DefaultGameDirectory = GameDirectory;
|
Config.DefaultGameDirectory = GameDirectory;
|
||||||
|
@ -91,12 +97,12 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
foreach (GameItem GameItem in GameItems)
|
foreach (GameItem GameItem in GameItems)
|
||||||
{
|
{
|
||||||
id++;
|
Id++;
|
||||||
|
|
||||||
if (GameItem == SelectedGame)
|
if (GameItem == SelectedGame)
|
||||||
ImGui.PushStyleColor(ColorTarget.FrameBg, Values.Color.Yellow);
|
ImGui.PushStyleColor(ColorTarget.FrameBg, Values.Color.Yellow);
|
||||||
|
|
||||||
if (ImGui.BeginChildFrame(id, new Vector2(ImGui.GetContentRegionAvailableWidth(), 60)
|
if (ImGui.BeginChildFrame(Id, new Vector2(ImGui.GetContentRegionAvailableWidth(), 60)
|
||||||
, WindowFlags.AlwaysAutoResize))
|
, WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
if (GameItem.IsNro && GameItem.HasIcon)
|
if (GameItem.IsNro && GameItem.HasIcon)
|
||||||
|
@ -106,7 +112,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ImGui.BeginChildFrame(id + 500, new Vector2(50, 50), WindowFlags.NoResize);
|
ImGui.BeginChildFrame(Id + 500, new Vector2(50, 50), WindowFlags.NoResize);
|
||||||
ImGui.EndChildFrame();
|
ImGui.EndChildFrame();
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGui.Text(Path.GetFileName(GameItem.Path));
|
ImGui.Text(Path.GetFileName(GameItem.Path));
|
||||||
|
@ -114,7 +120,9 @@ namespace Ryujinx.UI.Widgets
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
if (GameItem.IsNro)
|
if (GameItem.IsNro)
|
||||||
{
|
{
|
||||||
if (GameItem.Nro.ControlArchive != null)
|
if (GameItem.Nro.ControlArchive != null)
|
||||||
|
@ -124,6 +132,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
if (GameItem == SelectedGame)
|
if (GameItem == SelectedGame)
|
||||||
|
@ -166,7 +175,9 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (File.Exists(Path))
|
if (File.Exists(Path))
|
||||||
{
|
{
|
||||||
AppletType = AppletType.Homebrew;
|
AppletType = AppletType.Homebrew;
|
||||||
|
|
||||||
FileInfo Package = new FileInfo(Path);
|
FileInfo Package = new FileInfo(Path);
|
||||||
|
|
||||||
if (Package.Extension.ToLower() == ".nro")
|
if (Package.Extension.ToLower() == ".nro")
|
||||||
{
|
{
|
||||||
Nro = new Nro(File.Open(Path, FileMode.Open), new FileInfo(Path).Name);
|
Nro = new Nro(File.Open(Path, FileMode.Open), new FileInfo(Path).Name);
|
||||||
|
|
|
@ -10,7 +10,9 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
ImGui.SetNextWindowPos(Vector2.Zero, Condition.Always,
|
ImGui.SetNextWindowPos(Vector2.Zero, Condition.Always,
|
||||||
Vector2.Zero);
|
Vector2.Zero);
|
||||||
|
|
||||||
ImGui.SetNextWindowSize(new Vector2(Width, Height), Condition.Always);
|
ImGui.SetNextWindowSize(new Vector2(Width, Height), Condition.Always);
|
||||||
|
|
||||||
if (ImGui.BeginWindow("MainWindow", ref showMainUI, WindowFlags.NoTitleBar
|
if (ImGui.BeginWindow("MainWindow", ref showMainUI, WindowFlags.NoTitleBar
|
||||||
| WindowFlags.NoMove | WindowFlags.AlwaysAutoResize))
|
| WindowFlags.NoMove | WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
|
@ -42,6 +44,7 @@ namespace Ryujinx.UI
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
if (ImGui.BeginChildFrame(1, ImGui.GetContentRegionAvailable(),
|
if (ImGui.BeginChildFrame(1, ImGui.GetContentRegionAvailable(),
|
||||||
WindowFlags.AlwaysAutoResize))
|
WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
|
@ -49,30 +52,38 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
case Page.PackageLoader:
|
case Page.PackageLoader:
|
||||||
string output = CurrentPath;
|
string output = CurrentPath;
|
||||||
|
|
||||||
if (FileDialog.Draw(ref output, false) == DialogResult.OK)
|
if (FileDialog.Draw(ref output, false) == DialogResult.OK)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(output))
|
if (!string.IsNullOrWhiteSpace(output))
|
||||||
{
|
{
|
||||||
PackagePath = output;
|
PackagePath = output;
|
||||||
|
|
||||||
LoadPackage(PackagePath);
|
LoadPackage(PackagePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Page.Configuration:
|
case Page.Configuration:
|
||||||
Widgets.ConfigurationWidget.Draw();
|
Widgets.ConfigurationWidget.Draw();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Page.GameList:
|
case Page.GameList:
|
||||||
var SelectedPath = Widgets.GameList.DrawList();
|
var SelectedPath = Widgets.GameList.DrawList();
|
||||||
|
|
||||||
if (SelectedPath.Item1)
|
if (SelectedPath.Item1)
|
||||||
{
|
{
|
||||||
LoadPackage(SelectedPath.Item2);
|
LoadPackage(SelectedPath.Item2);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndChildFrame();
|
ImGui.EndChildFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndChildFrame();
|
ImGui.EndChildFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndWindow();
|
ImGui.EndWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
|
|
||||||
ImGui.SliderFloat(string.Empty, ref CurrentGamePadDeadzone, 0, 1, CurrentGamePadDeadzone.ToString(), 1f);
|
ImGui.SliderFloat(string.Empty, ref CurrentGamePadDeadzone, 0, 1, CurrentGamePadDeadzone.ToString(), 1f);
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
|
@ -119,8 +119,10 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
// Show the Left Analog bindings
|
// Show the Left Analog bindings
|
||||||
ImGui.Text("Left Analog");
|
ImGui.Text("Left Analog");
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Up");
|
ImGui.Text("Up");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)KeyboardInputLayout.Left.StickUp).ToString(),
|
if (ImGui.Button(((Key)KeyboardInputLayout.Left.StickUp).ToString(),
|
||||||
|
@ -134,6 +136,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Left.StickUp = (int)PressedKey;
|
KeyboardInputLayout.Left.StickUp = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[0] = false;
|
Toggles[0] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +144,9 @@ namespace Ryujinx.UI.Widgets
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Down");
|
ImGui.Text("Down");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)KeyboardInputLayout.Left.StickDown).ToString(),
|
if (ImGui.Button(((Key)KeyboardInputLayout.Left.StickDown).ToString(),
|
||||||
|
@ -155,6 +160,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Left.StickDown = (int)PressedKey;
|
KeyboardInputLayout.Left.StickDown = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[1] = false;
|
Toggles[1] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,6 +168,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Left");
|
ImGui.Text("Left");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)KeyboardInputLayout.Left.StickLeft).ToString(),
|
if (ImGui.Button(((Key)KeyboardInputLayout.Left.StickLeft).ToString(),
|
||||||
|
@ -175,13 +182,17 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Left.StickLeft = (int)PressedKey;
|
KeyboardInputLayout.Left.StickLeft = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[2] = false;
|
Toggles[2] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Right");
|
ImGui.Text("Right");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)KeyboardInputLayout.Left.StickRight).ToString(),
|
if (ImGui.Button(((Key)KeyboardInputLayout.Left.StickRight).ToString(),
|
||||||
|
@ -195,6 +206,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Left.StickRight = (int)PressedKey;
|
KeyboardInputLayout.Left.StickRight = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[3] = false;
|
Toggles[3] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,9 +220,11 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
//Show Right Analog Bindings
|
//Show Right Analog Bindings
|
||||||
ImGui.Text("Right Analog");
|
ImGui.Text("Right Analog");
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Up");
|
ImGui.Text("Up");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)KeyboardInputLayout.Right.StickUp).ToString(),
|
if (ImGui.Button(((Key)KeyboardInputLayout.Right.StickUp).ToString(),
|
||||||
|
@ -231,7 +245,9 @@ namespace Ryujinx.UI.Widgets
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Down");
|
ImGui.Text("Down");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)KeyboardInputLayout.Right.StickDown).ToString(),
|
if (ImGui.Button(((Key)KeyboardInputLayout.Right.StickDown).ToString(),
|
||||||
|
@ -245,12 +261,15 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Right.StickDown = (int)PressedKey;
|
KeyboardInputLayout.Right.StickDown = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[5] = false;
|
Toggles[5] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Left");
|
ImGui.Text("Left");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)KeyboardInputLayout.Right.StickLeft).ToString(),
|
if (ImGui.Button(((Key)KeyboardInputLayout.Right.StickLeft).ToString(),
|
||||||
|
@ -264,13 +283,16 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Right.StickLeft = (int)PressedKey;
|
KeyboardInputLayout.Right.StickLeft = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[6] = false;
|
Toggles[6] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Right");
|
ImGui.Text("Right");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)KeyboardInputLayout.Right.StickRight).ToString(),
|
if (ImGui.Button(((Key)KeyboardInputLayout.Right.StickRight).ToString(),
|
||||||
|
@ -284,6 +306,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Right.StickRight = (int)PressedKey;
|
KeyboardInputLayout.Right.StickRight = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[7] = false;
|
Toggles[7] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,6 +321,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
ImGui.Text("Left Analog");
|
ImGui.Text("Left Analog");
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Stick");
|
ImGui.Text("Stick");
|
||||||
|
@ -314,6 +338,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
ControllerInputLayout.Left.Stick =
|
ControllerInputLayout.Left.Stick =
|
||||||
(GamePadStick)Enum.Parse(typeof(GamePadStick), Axis);
|
(GamePadStick)Enum.Parse(typeof(GamePadStick), Axis);
|
||||||
|
|
||||||
Toggles[0] = false;
|
Toggles[0] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -338,6 +363,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
ControllerInputLayout.Left.StickButton =
|
ControllerInputLayout.Left.StickButton =
|
||||||
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
||||||
|
|
||||||
Toggles[3] = false;
|
Toggles[3] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -351,9 +377,11 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
//Show Right Analog Bindings
|
//Show Right Analog Bindings
|
||||||
ImGui.Text("Right Analog");
|
ImGui.Text("Right Analog");
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Stick");
|
ImGui.Text("Stick");
|
||||||
|
|
||||||
if (ImGui.Button(ControllerInputLayout.Right.Stick.ToString()
|
if (ImGui.Button(ControllerInputLayout.Right.Stick.ToString()
|
||||||
|
@ -372,10 +400,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
Toggles[4] = false;
|
Toggles[4] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Button");
|
ImGui.Text("Button");
|
||||||
|
|
||||||
if (ImGui.Button(ControllerInputLayout.Right.StickButton.ToString(),
|
if (ImGui.Button(ControllerInputLayout.Right.StickButton.ToString(),
|
||||||
|
@ -390,6 +421,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
ControllerInputLayout.Right.StickButton =
|
ControllerInputLayout.Right.StickButton =
|
||||||
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
||||||
|
|
||||||
Toggles[7] = false;
|
Toggles[7] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -404,9 +436,11 @@ namespace Ryujinx.UI.Widgets
|
||||||
|
|
||||||
//Show DPad Bindings
|
//Show DPad Bindings
|
||||||
ImGui.Text("D-Pad");
|
ImGui.Text("D-Pad");
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Up");
|
ImGui.Text("Up");
|
||||||
|
|
||||||
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
||||||
|
@ -427,6 +461,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
ControllerInputLayout.Left.DPadUp =
|
ControllerInputLayout.Left.DPadUp =
|
||||||
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
||||||
|
|
||||||
Toggles[8] = false;
|
Toggles[8] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -434,15 +469,19 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Left.DPadUp = (int)PressedKey;
|
KeyboardInputLayout.Left.DPadUp = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[8] = false;
|
Toggles[8] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Down");
|
ImGui.Text("Down");
|
||||||
|
|
||||||
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
||||||
|
@ -475,9 +514,11 @@ namespace Ryujinx.UI.Widgets
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Left");
|
ImGui.Text("Left");
|
||||||
|
|
||||||
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
||||||
|
@ -498,6 +539,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
ControllerInputLayout.Left.DPadLeft =
|
ControllerInputLayout.Left.DPadLeft =
|
||||||
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
||||||
|
|
||||||
Toggles[10] = false;
|
Toggles[10] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -505,15 +547,19 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Left.DPadLeft = (int)PressedKey;
|
KeyboardInputLayout.Left.DPadLeft = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[10] = false;
|
Toggles[10] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Right");
|
ImGui.Text("Right");
|
||||||
|
|
||||||
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
||||||
|
@ -534,6 +580,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
ControllerInputLayout.Left.DPadRight =
|
ControllerInputLayout.Left.DPadRight =
|
||||||
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
||||||
|
|
||||||
Toggles[11] = false;
|
Toggles[11] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -541,11 +588,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Left.DPadRight = (int)PressedKey;
|
KeyboardInputLayout.Left.DPadRight = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[11] = false;
|
Toggles[11] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
@ -554,11 +603,14 @@ namespace Ryujinx.UI.Widgets
|
||||||
static void DrawActionKeys()
|
static void DrawActionKeys()
|
||||||
{
|
{
|
||||||
string ButtonHeader = string.Empty;
|
string ButtonHeader = string.Empty;
|
||||||
|
|
||||||
//Show Action Key Bindings
|
//Show Action Key Bindings
|
||||||
ImGui.Text("Action Keys");
|
ImGui.Text("Action Keys");
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("A");
|
ImGui.Text("A");
|
||||||
|
|
||||||
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
||||||
|
@ -579,6 +631,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
ControllerInputLayout.Right.ButtonA =
|
ControllerInputLayout.Right.ButtonA =
|
||||||
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
||||||
|
|
||||||
Toggles[12] = false;
|
Toggles[12] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -586,15 +639,19 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Right.ButtonA = (int)PressedKey;
|
KeyboardInputLayout.Right.ButtonA = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[12] = false;
|
Toggles[12] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("B");
|
ImGui.Text("B");
|
||||||
|
|
||||||
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
||||||
|
@ -615,6 +672,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
ControllerInputLayout.Right.ButtonB =
|
ControllerInputLayout.Right.ButtonB =
|
||||||
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
||||||
|
|
||||||
Toggles[13] = false;
|
Toggles[13] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -622,14 +680,17 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Right.ButtonB = (int)PressedKey;
|
KeyboardInputLayout.Right.ButtonB = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[13] = false;
|
Toggles[13] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("X");
|
ImGui.Text("X");
|
||||||
|
|
||||||
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
||||||
|
@ -650,6 +711,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
ControllerInputLayout.Right.ButtonX =
|
ControllerInputLayout.Right.ButtonX =
|
||||||
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
||||||
|
|
||||||
Toggles[14] = false;
|
Toggles[14] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -657,15 +719,19 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Right.ButtonX = (int)PressedKey;
|
KeyboardInputLayout.Right.ButtonX = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[14] = false;
|
Toggles[14] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Y");
|
ImGui.Text("Y");
|
||||||
|
|
||||||
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
||||||
|
@ -686,6 +752,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
ControllerInputLayout.Right.ButtonY =
|
ControllerInputLayout.Right.ButtonY =
|
||||||
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
||||||
|
|
||||||
Toggles[15] = false;
|
Toggles[15] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -693,6 +760,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Right.ButtonY = (int)PressedKey;
|
KeyboardInputLayout.Right.ButtonY = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[15] = false;
|
Toggles[15] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -707,12 +775,14 @@ namespace Ryujinx.UI.Widgets
|
||||||
static void DrawTriggers()
|
static void DrawTriggers()
|
||||||
{
|
{
|
||||||
string ButtonHeader = string.Empty;
|
string ButtonHeader = string.Empty;
|
||||||
|
|
||||||
//Draw Triggers
|
//Draw Triggers
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Triggers");
|
ImGui.Text("Triggers");
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("L");
|
ImGui.Text("L");
|
||||||
|
|
||||||
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
||||||
|
@ -733,6 +803,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
ControllerInputLayout.Left.ButtonL =
|
ControllerInputLayout.Left.ButtonL =
|
||||||
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
||||||
|
|
||||||
Toggles[17] = false;
|
Toggles[17] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -740,6 +811,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Left.ButtonL = (int)PressedKey;
|
KeyboardInputLayout.Left.ButtonL = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[17] = false;
|
Toggles[17] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -749,7 +821,9 @@ namespace Ryujinx.UI.Widgets
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("R");
|
ImGui.Text("R");
|
||||||
|
|
||||||
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
||||||
|
@ -770,6 +844,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
ControllerInputLayout.Right.ButtonR =
|
ControllerInputLayout.Right.ButtonR =
|
||||||
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
||||||
|
|
||||||
Toggles[16] = false;
|
Toggles[16] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -777,14 +852,17 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Right.ButtonR = (int)PressedKey;
|
KeyboardInputLayout.Right.ButtonR = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[16] = false;
|
Toggles[16] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("ZL");
|
ImGui.Text("ZL");
|
||||||
|
|
||||||
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
||||||
|
@ -805,6 +883,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
ControllerInputLayout.Left.ButtonZL =
|
ControllerInputLayout.Left.ButtonZL =
|
||||||
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
||||||
|
|
||||||
Toggles[19] = false;
|
Toggles[19] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -812,15 +891,19 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Left.ButtonZL = (int)PressedKey;
|
KeyboardInputLayout.Left.ButtonZL = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[19] = false;
|
Toggles[19] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("ZR");
|
ImGui.Text("ZR");
|
||||||
|
|
||||||
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
||||||
|
@ -841,6 +924,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
ControllerInputLayout.Right.ButtonZR =
|
ControllerInputLayout.Right.ButtonZR =
|
||||||
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
||||||
|
|
||||||
Toggles[18] = false;
|
Toggles[18] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -848,11 +932,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Right.ButtonZR = (int)PressedKey;
|
KeyboardInputLayout.Right.ButtonZR = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[18] = false;
|
Toggles[18] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
@ -864,9 +950,11 @@ namespace Ryujinx.UI.Widgets
|
||||||
|
|
||||||
//Draw Extra
|
//Draw Extra
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("Extra Keys");
|
ImGui.Text("Extra Keys");
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("-");
|
ImGui.Text("-");
|
||||||
|
|
||||||
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
||||||
|
@ -887,6 +975,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
ControllerInputLayout.Left.ButtonMinus =
|
ControllerInputLayout.Left.ButtonMinus =
|
||||||
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
||||||
|
|
||||||
Toggles[20] = false;
|
Toggles[20] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -894,14 +983,17 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Left.ButtonMinus = (int)PressedKey;
|
KeyboardInputLayout.Left.ButtonMinus = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[20] = false;
|
Toggles[20] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
|
|
||||||
ImGui.Text("+");
|
ImGui.Text("+");
|
||||||
|
|
||||||
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
ButtonHeader = CurrentSelectedDevice.DeviceType == DeviceType.Keyboard ?
|
||||||
|
@ -922,6 +1014,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
ControllerInputLayout.Right.ButtonPlus =
|
ControllerInputLayout.Right.ButtonPlus =
|
||||||
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
(GamePadButton)Enum.Parse(typeof(GamePadButton),PressedButton);
|
||||||
|
|
||||||
Toggles[21] = false;
|
Toggles[21] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -929,11 +1022,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (GetKey(ref PressedKey))
|
if (GetKey(ref PressedKey))
|
||||||
{
|
{
|
||||||
KeyboardInputLayout.Right.ButtonPlus = (int)PressedKey;
|
KeyboardInputLayout.Right.ButtonPlus = (int)PressedKey;
|
||||||
|
|
||||||
Toggles[21] = false;
|
Toggles[21] = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
@ -942,11 +1037,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
static bool GetKey(ref Key PressedKey)
|
static bool GetKey(ref Key PressedKey)
|
||||||
{
|
{
|
||||||
IO IO = ImGui.GetIO();
|
IO IO = ImGui.GetIO();
|
||||||
|
|
||||||
foreach (Key Key in Enum.GetValues(typeof(Key)))
|
foreach (Key Key in Enum.GetValues(typeof(Key)))
|
||||||
{
|
{
|
||||||
if (IO.KeysDown[(int)Key])
|
if (IO.KeysDown[(int)Key])
|
||||||
{
|
{
|
||||||
PressedKey = Key;
|
PressedKey = Key;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -956,12 +1053,15 @@ namespace Ryujinx.UI.Widgets
|
||||||
static bool GetButton(ref string PressedButton)
|
static bool GetButton(ref string PressedButton)
|
||||||
{
|
{
|
||||||
IO IO = ImGui.GetIO();
|
IO IO = ImGui.GetIO();
|
||||||
|
|
||||||
GamePadState GamePad = OpenTK.Input.GamePad.GetState(Config.GamePadIndex);
|
GamePadState GamePad = OpenTK.Input.GamePad.GetState(Config.GamePadIndex);
|
||||||
|
|
||||||
foreach (GamePadButton Button in Enum.GetValues(typeof(GamePadButton)))
|
foreach (GamePadButton Button in Enum.GetValues(typeof(GamePadButton)))
|
||||||
{
|
{
|
||||||
if (WindowHelper.IsGamePadButtonPressed(GamePad, Button))
|
if (WindowHelper.IsGamePadButtonPressed(GamePad, Button))
|
||||||
{
|
{
|
||||||
PressedButton = Button.ToString();
|
PressedButton = Button.ToString();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -971,12 +1071,15 @@ namespace Ryujinx.UI.Widgets
|
||||||
static bool GetAxis(ref string Axis)
|
static bool GetAxis(ref string Axis)
|
||||||
{
|
{
|
||||||
IO IO = ImGui.GetIO();
|
IO IO = ImGui.GetIO();
|
||||||
|
|
||||||
GamePadState GamePad = OpenTK.Input.GamePad.GetState(Config.GamePadIndex);
|
GamePadState GamePad = OpenTK.Input.GamePad.GetState(Config.GamePadIndex);
|
||||||
|
|
||||||
foreach (GamePadStick Stick in Enum.GetValues(typeof(GamePadStick)))
|
foreach (GamePadStick Stick in Enum.GetValues(typeof(GamePadStick)))
|
||||||
{
|
{
|
||||||
if (WindowHelper.GetJoystickAxis(GamePad,Stick).Length > 0)
|
if (WindowHelper.GetJoystickAxis(GamePad,Stick).Length > 0)
|
||||||
{
|
{
|
||||||
Axis = Stick.ToString();
|
Axis = Stick.ToString();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -988,7 +1091,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (ImGui.BeginChildFrame(11, GroupSize, WindowFlags.AlwaysAutoResize))
|
if (ImGui.BeginChildFrame(11, GroupSize, WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
ContentWidth = (ImGui.GetContentRegionAvailableWidth() - 10) / 2;
|
ContentWidth = (ImGui.GetContentRegionAvailableWidth() - 10) / 2;
|
||||||
GroupSize = ImGui.GetContentRegionMax();
|
GroupSize = ImGui.GetContentRegionMax();
|
||||||
|
|
||||||
DrawLeftAnalog();
|
DrawLeftAnalog();
|
||||||
|
|
||||||
|
@ -996,6 +1099,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
if (ImGui.BeginChildFrame(12, GroupSize, WindowFlags.AlwaysAutoResize))
|
if (ImGui.BeginChildFrame(12, GroupSize, WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
DrawRightAnalog();
|
DrawRightAnalog();
|
||||||
|
@ -1011,7 +1115,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (ImGui.BeginChildFrame(11, GroupSize, WindowFlags.AlwaysAutoResize))
|
if (ImGui.BeginChildFrame(11, GroupSize, WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
ContentWidth = (ImGui.GetContentRegionAvailableWidth() - 10) / 2;
|
ContentWidth = (ImGui.GetContentRegionAvailableWidth() - 10) / 2;
|
||||||
GroupSize = ImGui.GetContentRegionMax();
|
GroupSize = ImGui.GetContentRegionMax();
|
||||||
|
|
||||||
DrawControllerLeftAnalog();
|
DrawControllerLeftAnalog();
|
||||||
|
|
||||||
|
@ -1019,6 +1123,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
if (ImGui.BeginChildFrame(12, GroupSize, WindowFlags.AlwaysAutoResize))
|
if (ImGui.BeginChildFrame(12, GroupSize, WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
DrawControllerRightAnalog();
|
DrawControllerRightAnalog();
|
||||||
|
@ -1039,6 +1144,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
if (ImGui.BeginChildFrame(14, GroupSize, WindowFlags.AlwaysAutoResize))
|
if (ImGui.BeginChildFrame(14, GroupSize, WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
DrawActionKeys();
|
DrawActionKeys();
|
||||||
|
@ -1054,6 +1160,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
if (ImGui.BeginChildFrame(16, GroupSize, WindowFlags.AlwaysAutoResize))
|
if (ImGui.BeginChildFrame(16, GroupSize, WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
DrawExtras();
|
DrawExtras();
|
||||||
|
@ -1070,28 +1177,32 @@ namespace Ryujinx.UI.Widgets
|
||||||
|
|
||||||
InputDevice KeyboardInputDevice = new InputDevice()
|
InputDevice KeyboardInputDevice = new InputDevice()
|
||||||
{
|
{
|
||||||
Index = short.MaxValue,
|
Index = short.MaxValue,
|
||||||
DeviceType = DeviceType.Keyboard,
|
DeviceType = DeviceType.Keyboard,
|
||||||
Name = "Keyboard"
|
Name = "Keyboard"
|
||||||
};
|
};
|
||||||
ConnectedHIDs.Add(short.MaxValue, KeyboardInputDevice);
|
|
||||||
|
ConnectedHIDs.Add(short.MaxValue, KeyboardInputDevice);
|
||||||
|
|
||||||
// Scans for connected joysticks
|
// Scans for connected joysticks
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
JoystickState GamePad = Joystick.GetState(GamePadIndex);
|
JoystickState GamePad = Joystick.GetState(GamePadIndex);
|
||||||
|
|
||||||
if (GamePad.IsConnected)
|
if (GamePad.IsConnected)
|
||||||
{
|
{
|
||||||
InputDevice GamePadDevice = new InputDevice()
|
InputDevice GamePadDevice = new InputDevice()
|
||||||
{
|
{
|
||||||
Index = GamePadIndex,
|
Index = GamePadIndex,
|
||||||
DeviceType = DeviceType.GamePad,
|
DeviceType = DeviceType.GamePad,
|
||||||
Name = "GamePad " + GamePadIndex
|
Name = "GamePad " + GamePadIndex
|
||||||
};
|
};
|
||||||
|
|
||||||
ConnectedHIDs.Add(GamePadIndex, GamePadDevice);
|
ConnectedHIDs.Add(GamePadIndex, GamePadDevice);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|
||||||
GamePadIndex++;
|
GamePadIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ namespace Ryujinx.UI
|
||||||
System.Numerics.Vector2.Zero);
|
System.Numerics.Vector2.Zero);
|
||||||
|
|
||||||
ImGui.SetNextWindowSize(new System.Numerics.Vector2(Width, Height), Condition.Always);
|
ImGui.SetNextWindowSize(new System.Numerics.Vector2(Width, Height), Condition.Always);
|
||||||
|
|
||||||
if (ImGui.BeginWindow("PauseWindow", ref showMainUI, WindowFlags.NoTitleBar
|
if (ImGui.BeginWindow("PauseWindow", ref showMainUI, WindowFlags.NoTitleBar
|
||||||
| WindowFlags.NoMove | WindowFlags.AlwaysAutoResize))
|
| WindowFlags.NoMove | WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
|
@ -34,6 +35,7 @@ namespace Ryujinx.UI
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
if (ImGui.BeginChildFrame(1, ImGui.GetContentRegionAvailable(),
|
if (ImGui.BeginChildFrame(1, ImGui.GetContentRegionAvailable(),
|
||||||
WindowFlags.AlwaysAutoResize))
|
WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
|
@ -44,6 +46,7 @@ namespace Ryujinx.UI
|
||||||
Values.ButtonHeight)))
|
Values.ButtonHeight)))
|
||||||
{
|
{
|
||||||
ShowPauseUI = false;
|
ShowPauseUI = false;
|
||||||
|
|
||||||
EmulationController.Resume();
|
EmulationController.Resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +54,9 @@ namespace Ryujinx.UI
|
||||||
Values.ButtonHeight)))
|
Values.ButtonHeight)))
|
||||||
{
|
{
|
||||||
ShowPauseUI = false;
|
ShowPauseUI = false;
|
||||||
|
|
||||||
EmulationController.ShutDown();
|
EmulationController.ShutDown();
|
||||||
|
|
||||||
ShowMainUI = true;
|
ShowMainUI = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,12 +66,15 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndChildFrame();
|
ImGui.EndChildFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndChildFrame();
|
ImGui.EndChildFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndWindow();
|
ImGui.EndWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,11 +11,12 @@ namespace Ryujinx.UI
|
||||||
class WindowHelper : GameWindow
|
class WindowHelper : GameWindow
|
||||||
{
|
{
|
||||||
protected float DeltaTime;
|
protected float DeltaTime;
|
||||||
|
protected bool UIActive;
|
||||||
|
|
||||||
protected GraphicsContext MainContext;
|
protected GraphicsContext MainContext;
|
||||||
protected GraphicsContext UIContext;
|
protected GraphicsContext UIContext;
|
||||||
protected bool UIActive;
|
|
||||||
|
|
||||||
private bool IsWindowOpened = false;
|
private bool IsWindowOpened;
|
||||||
private int FontTexture;
|
private int FontTexture;
|
||||||
private float WheelPosition;
|
private float WheelPosition;
|
||||||
|
|
||||||
|
@ -47,19 +48,15 @@ namespace Ryujinx.UI
|
||||||
UIActive = true;
|
UIActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowDemo()
|
|
||||||
{
|
|
||||||
ImGuiNative.igShowDemoWindow(ref IsWindowOpened);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void StartFrame()
|
public void StartFrame()
|
||||||
{
|
{
|
||||||
UIContext.MakeCurrent(WindowInfo);
|
UIContext.MakeCurrent(WindowInfo);
|
||||||
|
|
||||||
IO IO = ImGui.GetIO();
|
IO IO = ImGui.GetIO();
|
||||||
IO.DisplaySize = new System.Numerics.Vector2(Width, Height);
|
|
||||||
|
IO.DisplaySize = new System.Numerics.Vector2(Width, Height);
|
||||||
IO.DisplayFramebufferScale = new System.Numerics.Vector2(Values.CurrentWindowScale);
|
IO.DisplayFramebufferScale = new System.Numerics.Vector2(Values.CurrentWindowScale);
|
||||||
IO.DeltaTime = DeltaTime;
|
IO.DeltaTime = DeltaTime;
|
||||||
|
|
||||||
ImGui.NewFrame();
|
ImGui.NewFrame();
|
||||||
|
|
||||||
|
@ -71,6 +68,7 @@ namespace Ryujinx.UI
|
||||||
ImGui.Render();
|
ImGui.Render();
|
||||||
|
|
||||||
DrawData* data = ImGui.GetDrawData();
|
DrawData* data = ImGui.GetDrawData();
|
||||||
|
|
||||||
RenderImDrawData(data);
|
RenderImDrawData(data);
|
||||||
|
|
||||||
MainContext?.MakeCurrent(WindowInfo);
|
MainContext?.MakeCurrent(WindowInfo);
|
||||||
|
@ -87,9 +85,13 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
// Create OpenGL texture
|
// Create OpenGL texture
|
||||||
FontTexture = GL.GenTexture();
|
FontTexture = GL.GenTexture();
|
||||||
|
|
||||||
GL.BindTexture(TextureTarget.Texture2D, FontTexture);
|
GL.BindTexture(TextureTarget.Texture2D, FontTexture);
|
||||||
|
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)All.Linear);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)All.Linear);
|
||||||
|
|
||||||
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Linear);
|
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Linear);
|
||||||
|
|
||||||
GL.TexImage2D(
|
GL.TexImage2D(
|
||||||
TextureTarget.Texture2D,
|
TextureTarget.Texture2D,
|
||||||
0,
|
0,
|
||||||
|
@ -104,25 +106,21 @@ namespace Ryujinx.UI
|
||||||
// Store the texture identifier in the ImFontAtlas substructure.
|
// Store the texture identifier in the ImFontAtlas substructure.
|
||||||
IO.FontAtlas.SetTexID(FontTexture);
|
IO.FontAtlas.SetTexID(FontTexture);
|
||||||
|
|
||||||
// Cleanup (don't clear the input data if you want to append new fonts later)
|
|
||||||
//io.Fonts->ClearInputData();
|
|
||||||
IO.FontAtlas.ClearTexData();
|
IO.FontAtlas.ClearTexData();
|
||||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected unsafe override void OnLoad(EventArgs e)
|
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||||
{
|
|
||||||
PrepareTexture();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe void HandleInput(IO IO)
|
unsafe void HandleInput(IO IO)
|
||||||
{
|
{
|
||||||
KeyboardState KeyboardState = default(KeyboardState);
|
KeyboardState KeyboardState = default(KeyboardState);
|
||||||
|
|
||||||
if (Keyboard != null)
|
if (Keyboard != null)
|
||||||
if (Keyboard.HasValue)
|
if (Keyboard.HasValue)
|
||||||
KeyboardState = Keyboard.Value;
|
KeyboardState = Keyboard.Value;
|
||||||
|
|
||||||
MouseState MouseState = default(MouseState);
|
MouseState MouseState = default(MouseState);
|
||||||
|
|
||||||
if (Mouse != null)
|
if (Mouse != null)
|
||||||
if (Mouse.HasValue)
|
if (Mouse.HasValue)
|
||||||
MouseState = Mouse.Value;
|
MouseState = Mouse.Value;
|
||||||
|
@ -132,6 +130,7 @@ namespace Ryujinx.UI
|
||||||
if (Mouse.HasValue)
|
if (Mouse.HasValue)
|
||||||
{
|
{
|
||||||
Point WindowPoint = new Point(MouseState.X, MouseState.Y);
|
Point WindowPoint = new Point(MouseState.X, MouseState.Y);
|
||||||
|
|
||||||
IO.MousePosition = new System.Numerics.Vector2(WindowPoint.X,
|
IO.MousePosition = new System.Numerics.Vector2(WindowPoint.X,
|
||||||
WindowPoint.Y);
|
WindowPoint.Y);
|
||||||
}
|
}
|
||||||
|
@ -143,12 +142,16 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
if (KeyboardState[Key])
|
if (KeyboardState[Key])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ImGuiNative.igGetIO()->KeyAlt = (byte)((KeyboardState[Key.AltLeft]
|
ImGuiNative.igGetIO()->KeyAlt = (byte)((KeyboardState[Key.AltLeft]
|
||||||
|| KeyboardState[Key.AltRight]) ? 1 : 0);
|
|| KeyboardState[Key.AltRight]) ? 1 : 0);
|
||||||
|
|
||||||
ImGuiNative.igGetIO()->KeyCtrl = (byte)((KeyboardState[Key.ControlLeft]
|
ImGuiNative.igGetIO()->KeyCtrl = (byte)((KeyboardState[Key.ControlLeft]
|
||||||
|| KeyboardState[Key.ControlRight]) ? 1 : 0);
|
|| KeyboardState[Key.ControlRight]) ? 1 : 0);
|
||||||
|
|
||||||
ImGuiNative.igGetIO()->KeyShift = (byte)((KeyboardState[Key.ShiftLeft]
|
ImGuiNative.igGetIO()->KeyShift = (byte)((KeyboardState[Key.ShiftLeft]
|
||||||
|| KeyboardState[Key.ShiftRight]) ? 1 : 0);
|
|| KeyboardState[Key.ShiftRight]) ? 1 : 0);
|
||||||
|
|
||||||
ImGuiNative.igGetIO()->KeySuper = (byte)((KeyboardState[Key.WinLeft]
|
ImGuiNative.igGetIO()->KeySuper = (byte)((KeyboardState[Key.WinLeft]
|
||||||
|| KeyboardState[Key.WinRight]) ? 1 : 0);
|
|| KeyboardState[Key.WinRight]) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
@ -156,6 +159,7 @@ namespace Ryujinx.UI
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IO.MousePosition = new System.Numerics.Vector2(-1f, -1f);
|
IO.MousePosition = new System.Numerics.Vector2(-1f, -1f);
|
||||||
|
|
||||||
for (int i = 0; i <= 512; i++)
|
for (int i = 0; i <= 512; i++)
|
||||||
{
|
{
|
||||||
IO.KeysDown[i] = false;
|
IO.KeysDown[i] = false;
|
||||||
|
@ -164,8 +168,8 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
if (Mouse.HasValue)
|
if (Mouse.HasValue)
|
||||||
{
|
{
|
||||||
IO.MouseDown[0] = MouseState.LeftButton == ButtonState.Pressed;
|
IO.MouseDown[0] = MouseState.LeftButton == ButtonState.Pressed;
|
||||||
IO.MouseDown[1] = MouseState.RightButton == ButtonState.Pressed;
|
IO.MouseDown[1] = MouseState.RightButton == ButtonState.Pressed;
|
||||||
IO.MouseDown[2] = MouseState.MiddleButton == ButtonState.Pressed;
|
IO.MouseDown[2] = MouseState.MiddleButton == ButtonState.Pressed;
|
||||||
|
|
||||||
float NewWheelPos = MouseState.WheelPrecise;
|
float NewWheelPos = MouseState.WheelPrecise;
|
||||||
|
@ -178,32 +182,47 @@ namespace Ryujinx.UI
|
||||||
private unsafe void RenderImDrawData(DrawData* DrawData)
|
private unsafe void RenderImDrawData(DrawData* DrawData)
|
||||||
{
|
{
|
||||||
Vector4 ClearColor = new Vector4(114f / 255f, 144f / 255f, 154f / 255f, 1.0f);
|
Vector4 ClearColor = new Vector4(114f / 255f, 144f / 255f, 154f / 255f, 1.0f);
|
||||||
|
|
||||||
GL.Viewport(0, 0, Width, Height);
|
GL.Viewport(0, 0, Width, Height);
|
||||||
|
|
||||||
GL.ClearColor(ClearColor.X, ClearColor.Y, ClearColor.Z, ClearColor.W);
|
GL.ClearColor(ClearColor.X, ClearColor.Y, ClearColor.Z, ClearColor.W);
|
||||||
|
|
||||||
GL.Clear(ClearBufferMask.ColorBufferBit);
|
GL.Clear(ClearBufferMask.ColorBufferBit);
|
||||||
|
|
||||||
GL.GetInteger(GetPName.TextureBinding2D, out int last_texture);
|
GL.GetInteger(GetPName.TextureBinding2D, out int last_texture);
|
||||||
|
|
||||||
GL.PushAttrib(AttribMask.EnableBit | AttribMask.ColorBufferBit | AttribMask.TransformBit);
|
GL.PushAttrib(AttribMask.EnableBit | AttribMask.ColorBufferBit | AttribMask.TransformBit);
|
||||||
|
|
||||||
GL.Enable(EnableCap.Blend);
|
GL.Enable(EnableCap.Blend);
|
||||||
|
|
||||||
GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
|
GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
|
||||||
|
|
||||||
GL.Disable(EnableCap.CullFace);
|
GL.Disable(EnableCap.CullFace);
|
||||||
|
|
||||||
GL.Disable(EnableCap.DepthTest);
|
GL.Disable(EnableCap.DepthTest);
|
||||||
|
|
||||||
GL.Enable(EnableCap.ScissorTest);
|
GL.Enable(EnableCap.ScissorTest);
|
||||||
|
|
||||||
GL.EnableClientState(ArrayCap.VertexArray);
|
GL.EnableClientState(ArrayCap.VertexArray);
|
||||||
|
|
||||||
GL.EnableClientState(ArrayCap.TextureCoordArray);
|
GL.EnableClientState(ArrayCap.TextureCoordArray);
|
||||||
|
|
||||||
GL.EnableClientState(ArrayCap.ColorArray);
|
GL.EnableClientState(ArrayCap.ColorArray);
|
||||||
|
|
||||||
GL.Enable(EnableCap.Texture2D);
|
GL.Enable(EnableCap.Texture2D);
|
||||||
|
|
||||||
GL.UseProgram(0);
|
GL.UseProgram(0);
|
||||||
|
|
||||||
// Handle cases of screen coordinates != from framebuffer coordinates (e.g. retina displays)
|
|
||||||
IO IO = ImGui.GetIO();
|
IO IO = ImGui.GetIO();
|
||||||
ImGui.ScaleClipRects(DrawData, IO.DisplayFramebufferScale);
|
|
||||||
|
|
||||||
// Setup orthographic projection matrix
|
ImGui.ScaleClipRects(DrawData, IO.DisplayFramebufferScale);
|
||||||
|
|
||||||
GL.MatrixMode(MatrixMode.Projection);
|
GL.MatrixMode(MatrixMode.Projection);
|
||||||
|
|
||||||
GL.PushMatrix();
|
GL.PushMatrix();
|
||||||
|
|
||||||
GL.LoadIdentity();
|
GL.LoadIdentity();
|
||||||
|
|
||||||
GL.Ortho(
|
GL.Ortho(
|
||||||
0.0f,
|
0.0f,
|
||||||
IO.DisplaySize.X / IO.DisplayFramebufferScale.X,
|
IO.DisplaySize.X / IO.DisplayFramebufferScale.X,
|
||||||
|
@ -211,24 +230,30 @@ namespace Ryujinx.UI
|
||||||
0.0f,
|
0.0f,
|
||||||
-1.0f,
|
-1.0f,
|
||||||
1.0f);
|
1.0f);
|
||||||
|
|
||||||
GL.MatrixMode(MatrixMode.Modelview);
|
GL.MatrixMode(MatrixMode.Modelview);
|
||||||
|
|
||||||
GL.PushMatrix();
|
GL.PushMatrix();
|
||||||
|
|
||||||
GL.LoadIdentity();
|
GL.LoadIdentity();
|
||||||
|
|
||||||
// Render command lists
|
// Render command lists
|
||||||
for (int n = 0; n < DrawData->CmdListsCount; n++)
|
for (int n = 0; n < DrawData->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
NativeDrawList* CmdList = DrawData->CmdLists[n];
|
NativeDrawList* CmdList = DrawData->CmdLists[n];
|
||||||
byte* VtxBuffer = (byte*)CmdList->VtxBuffer.Data;
|
byte* VtxBuffer = (byte*)CmdList->VtxBuffer.Data;
|
||||||
ushort* IdxBuffer = (ushort*)CmdList->IdxBuffer.Data;
|
ushort* IdxBuffer = (ushort*)CmdList->IdxBuffer.Data;
|
||||||
|
|
||||||
GL.VertexPointer(2, VertexPointerType.Float, sizeof(DrawVert), new IntPtr(VtxBuffer + DrawVert.PosOffset));
|
GL.VertexPointer(2, VertexPointerType.Float, sizeof(DrawVert), new IntPtr(VtxBuffer + DrawVert.PosOffset));
|
||||||
|
|
||||||
GL.TexCoordPointer(2, TexCoordPointerType.Float, sizeof(DrawVert), new IntPtr(VtxBuffer + DrawVert.UVOffset));
|
GL.TexCoordPointer(2, TexCoordPointerType.Float, sizeof(DrawVert), new IntPtr(VtxBuffer + DrawVert.UVOffset));
|
||||||
|
|
||||||
GL.ColorPointer(4, ColorPointerType.UnsignedByte, sizeof(DrawVert), new IntPtr(VtxBuffer + DrawVert.ColOffset));
|
GL.ColorPointer(4, ColorPointerType.UnsignedByte, sizeof(DrawVert), new IntPtr(VtxBuffer + DrawVert.ColOffset));
|
||||||
|
|
||||||
for (int Cmd = 0; Cmd < CmdList->CmdBuffer.Size; Cmd++)
|
for (int Cmd = 0; Cmd < CmdList->CmdBuffer.Size; Cmd++)
|
||||||
{
|
{
|
||||||
DrawCmd* PCmd = &(((DrawCmd*)CmdList->CmdBuffer.Data)[Cmd]);
|
DrawCmd* PCmd = &(((DrawCmd*)CmdList->CmdBuffer.Data)[Cmd]);
|
||||||
|
|
||||||
if (PCmd->UserCallback != IntPtr.Zero)
|
if (PCmd->UserCallback != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
@ -236,29 +261,42 @@ namespace Ryujinx.UI
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GL.BindTexture(TextureTarget.Texture2D, PCmd->TextureId.ToInt32());
|
GL.BindTexture(TextureTarget.Texture2D, PCmd->TextureId.ToInt32());
|
||||||
|
|
||||||
GL.Scissor(
|
GL.Scissor(
|
||||||
(int)PCmd->ClipRect.X,
|
(int)PCmd->ClipRect.X,
|
||||||
(int)(IO.DisplaySize.Y - PCmd->ClipRect.W),
|
(int)(IO.DisplaySize.Y - PCmd->ClipRect.W),
|
||||||
(int)(PCmd->ClipRect.Z - PCmd->ClipRect.X),
|
(int)(PCmd->ClipRect.Z - PCmd->ClipRect.X),
|
||||||
(int)(PCmd->ClipRect.W - PCmd->ClipRect.Y));
|
(int)(PCmd->ClipRect.W - PCmd->ClipRect.Y));
|
||||||
|
|
||||||
ushort[] indices = new ushort[PCmd->ElemCount];
|
ushort[] indices = new ushort[PCmd->ElemCount];
|
||||||
|
|
||||||
for (int i = 0; i < indices.Length; i++)
|
for (int i = 0; i < indices.Length; i++)
|
||||||
indices[i] = IdxBuffer[i];
|
indices[i] = IdxBuffer[i];
|
||||||
|
|
||||||
GL.DrawElements(PrimitiveType.Triangles, (int)PCmd->ElemCount, DrawElementsType.UnsignedShort, new IntPtr(IdxBuffer));
|
GL.DrawElements(PrimitiveType.Triangles, (int)PCmd->ElemCount, DrawElementsType.UnsignedShort, new IntPtr(IdxBuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
IdxBuffer += PCmd->ElemCount;
|
IdxBuffer += PCmd->ElemCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore modified state
|
// Restore modified state
|
||||||
GL.DisableClientState(ArrayCap.ColorArray);
|
GL.DisableClientState(ArrayCap.ColorArray);
|
||||||
|
|
||||||
GL.DisableClientState(ArrayCap.TextureCoordArray);
|
GL.DisableClientState(ArrayCap.TextureCoordArray);
|
||||||
|
|
||||||
GL.DisableClientState(ArrayCap.VertexArray);
|
GL.DisableClientState(ArrayCap.VertexArray);
|
||||||
|
|
||||||
GL.BindTexture(TextureTarget.Texture2D, last_texture);
|
GL.BindTexture(TextureTarget.Texture2D, last_texture);
|
||||||
|
|
||||||
GL.MatrixMode(MatrixMode.Modelview);
|
GL.MatrixMode(MatrixMode.Modelview);
|
||||||
|
|
||||||
GL.PopMatrix();
|
GL.PopMatrix();
|
||||||
|
|
||||||
GL.MatrixMode(MatrixMode.Projection);
|
GL.MatrixMode(MatrixMode.Projection);
|
||||||
|
|
||||||
GL.PopMatrix();
|
GL.PopMatrix();
|
||||||
|
|
||||||
GL.PopAttrib();
|
GL.PopAttrib();
|
||||||
|
|
||||||
SwapBuffers();
|
SwapBuffers();
|
||||||
|
|
|
@ -7,10 +7,10 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
public struct InputDevice
|
public struct InputDevice
|
||||||
{
|
{
|
||||||
public int Index;
|
public int Index;
|
||||||
|
public string Name;
|
||||||
public IInputDevice Device;
|
public IInputDevice Device;
|
||||||
public DeviceType DeviceType;
|
public DeviceType DeviceType;
|
||||||
public string Name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DeviceType
|
public enum DeviceType
|
||||||
|
|
|
@ -6,9 +6,9 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
EmulationWindow mainUI = new EmulationWindow();
|
EmulationWindow MainUI = new EmulationWindow();
|
||||||
|
|
||||||
mainUI.Run(60.0, 60.0);
|
MainUI.MainLoop();
|
||||||
|
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue