cleanup, refactoring, style changes, fixes
This commit is contained in:
parent
f1ffb129d6
commit
b9d2039995
21 changed files with 634 additions and 417 deletions
|
@ -22,11 +22,7 @@ namespace ChocolArm64
|
||||||
|
|
||||||
public bool EnableCpuTrace { get; set; }
|
public bool EnableCpuTrace { get; set; }
|
||||||
|
|
||||||
public static long CyclesExecuted { get; set; }
|
public static ManualResetEvent PauseResetEvent = new ManualResetEvent(true);
|
||||||
|
|
||||||
public static bool Pause { get; set; } = false;
|
|
||||||
|
|
||||||
public static ManualResetEvent PauseResetEvent = new ManualResetEvent(false);
|
|
||||||
|
|
||||||
public ATranslator(IReadOnlyDictionary<long, string> SymbolTable = null)
|
public ATranslator(IReadOnlyDictionary<long, string> SymbolTable = null)
|
||||||
{
|
{
|
||||||
|
@ -68,9 +64,6 @@ namespace ChocolArm64
|
||||||
|
|
||||||
OpCode.Interpreter(State, Memory, OpCode);
|
OpCode.Interpreter(State, Memory, OpCode);
|
||||||
|
|
||||||
CyclesExecuted++;
|
|
||||||
|
|
||||||
while (Pause)
|
|
||||||
PauseResetEvent.WaitOne(1000);
|
PauseResetEvent.WaitOne(1000);
|
||||||
}
|
}
|
||||||
while (State.R15 != 0 && State.Running);
|
while (State.R15 != 0 && State.Running);
|
||||||
|
@ -102,10 +95,7 @@ namespace ChocolArm64
|
||||||
|
|
||||||
Position = Sub.Execute(State, Memory);
|
Position = Sub.Execute(State, Memory);
|
||||||
|
|
||||||
CyclesExecuted++;
|
PauseResetEvent.WaitOne();
|
||||||
|
|
||||||
while (Pause)
|
|
||||||
PauseResetEvent.WaitOne(1000);
|
|
||||||
}
|
}
|
||||||
while (Position != 0 && State.Running);
|
while (Position != 0 && State.Running);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,8 @@ namespace Ryujinx.HLE.OsHle
|
||||||
|
|
||||||
private ConcurrentDictionary<int, Process> Processes;
|
private ConcurrentDictionary<int, Process> Processes;
|
||||||
|
|
||||||
|
private bool IsDisposing;
|
||||||
|
|
||||||
public SystemStateMgr SystemState { get; private set; }
|
public SystemStateMgr SystemState { get; private set; }
|
||||||
|
|
||||||
internal MemoryAllocator Allocator { get; private set; }
|
internal MemoryAllocator Allocator { get; private set; }
|
||||||
|
@ -170,7 +172,7 @@ namespace Ryujinx.HLE.OsHle
|
||||||
|
|
||||||
internal void ExitProcess(int ProcessId)
|
internal void ExitProcess(int ProcessId)
|
||||||
{
|
{
|
||||||
if (Processes.TryGetValue(ProcessId, out Process Process) && Process.NeedsHbAbi)
|
if (Processes.TryGetValue(ProcessId, out Process Process) && Process.NeedsHbAbi && !IsDisposing)
|
||||||
{
|
{
|
||||||
string NextNro = Homebrew.ReadHbAbiNextLoadPath(Process.Memory, Process.HbAbiDataPosition);
|
string NextNro = Homebrew.ReadHbAbiNextLoadPath(Process.Memory, Process.HbAbiDataPosition);
|
||||||
|
|
||||||
|
@ -192,9 +194,16 @@ namespace Ryujinx.HLE.OsHle
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Processes.TryRemove(ProcessId, out Process))
|
if (Processes.TryRemove(ProcessId, out Process))
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
Process.StopAllThreadsAsync();
|
Process.StopAllThreadsAsync();
|
||||||
Process.Dispose();
|
Process.Dispose();
|
||||||
|
}
|
||||||
|
catch (ObjectDisposedException Ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (Processes.Count == 0)
|
if (Processes.Count == 0)
|
||||||
{
|
{
|
||||||
|
@ -215,6 +224,8 @@ namespace Ryujinx.HLE.OsHle
|
||||||
|
|
||||||
protected virtual void Dispose(bool Disposing)
|
protected virtual void Dispose(bool Disposing)
|
||||||
{
|
{
|
||||||
|
IsDisposing = Disposing;
|
||||||
|
|
||||||
if (Disposing)
|
if (Disposing)
|
||||||
{
|
{
|
||||||
foreach (Process Process in Processes.Values)
|
foreach (Process Process in Processes.Values)
|
||||||
|
|
|
@ -176,7 +176,7 @@ namespace Ryujinx.HLE.OsHle
|
||||||
throw new ObjectDisposedException(nameof(Process));
|
throw new ObjectDisposedException(nameof(Process));
|
||||||
}
|
}
|
||||||
|
|
||||||
ATranslator.Pause = true;
|
ATranslator.PauseResetEvent.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Resume()
|
public void Resume()
|
||||||
|
@ -186,7 +186,6 @@ namespace Ryujinx.HLE.OsHle
|
||||||
throw new ObjectDisposedException(nameof(Process));
|
throw new ObjectDisposedException(nameof(Process));
|
||||||
}
|
}
|
||||||
|
|
||||||
ATranslator.Pause = false;
|
|
||||||
ATranslator.PauseResetEvent.Set();
|
ATranslator.PauseResetEvent.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,6 +423,8 @@ namespace Ryujinx.HLE.OsHle
|
||||||
{
|
{
|
||||||
if (Disposing && !Disposed)
|
if (Disposing && !Disposed)
|
||||||
{
|
{
|
||||||
|
ATranslator.PauseResetEvent.Set();
|
||||||
|
|
||||||
//If there is still some thread running, disposing the objects is not
|
//If there is still some thread running, disposing the objects is not
|
||||||
//safe as the thread may try to access those resources. Instead, we set
|
//safe as the thread may try to access those resources. Instead, we set
|
||||||
//the flag to have the Process disposed when all threads finishes.
|
//the flag to have the Process disposed when all threads finishes.
|
||||||
|
|
|
@ -99,6 +99,7 @@ namespace Ryujinx.HLE
|
||||||
Os.Dispose();
|
Os.Dispose();
|
||||||
VFs.Dispose();
|
VFs.Dispose();
|
||||||
Gpu.Dispose();
|
Gpu.Dispose();
|
||||||
|
AudioOut.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,11 +98,21 @@ namespace Ryujinx
|
||||||
|
|
||||||
DefaultGameDirectory = Parser.GetValue("Default_Game_Directory");
|
DefaultGameDirectory = Parser.GetValue("Default_Game_Directory");
|
||||||
|
|
||||||
|
VirtualFileSystem FS = new HLE.VirtualFileSystem();
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(DefaultGameDirectory))
|
if (string.IsNullOrWhiteSpace(DefaultGameDirectory))
|
||||||
{
|
{
|
||||||
VirtualFileSystem FS = new HLE.VirtualFileSystem();
|
|
||||||
DefaultGameDirectory = Path.Combine(FS.GetSdCardPath(), "switch");
|
DefaultGameDirectory = Path.Combine(FS.GetSdCardPath(), "switch");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Directory.Exists(DefaultGameDirectory))
|
||||||
|
{
|
||||||
|
if (!Directory.CreateDirectory(DefaultGameDirectory).Exists)
|
||||||
|
{
|
||||||
|
DefaultGameDirectory = Path.Combine(FS.GetSdCardPath(), "switch");
|
||||||
|
Directory.CreateDirectory(DefaultGameDirectory);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Save(Logger Log)
|
public static void Save(Logger Log)
|
||||||
|
@ -165,7 +175,7 @@ namespace Ryujinx
|
||||||
{
|
{
|
||||||
private readonly Dictionary<string, string> Values;
|
private readonly Dictionary<string, string> Values;
|
||||||
private readonly Dictionary<string, string> Comments;
|
private readonly Dictionary<string, string> Comments;
|
||||||
private string Path;
|
private readonly string Path;
|
||||||
|
|
||||||
public IniParser(string Path)
|
public IniParser(string Path)
|
||||||
{
|
{
|
||||||
|
@ -214,20 +224,25 @@ namespace Ryujinx
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
List<string> Records = new List<string>();
|
List<string> Records = new List<string>();
|
||||||
|
|
||||||
foreach (var Record in Values)
|
foreach (var Record in Values)
|
||||||
{
|
{
|
||||||
if (Comments.ContainsKey(Record.Key))
|
if (Comments.ContainsKey(Record.Key))
|
||||||
{
|
{
|
||||||
string Comment = Comments[Record.Key];
|
string Comment = Comments[Record.Key];
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(Comment))
|
if (!string.IsNullOrWhiteSpace(Comment))
|
||||||
{
|
{
|
||||||
Records.Add(Environment.NewLine);
|
Records.Add(Environment.NewLine);
|
||||||
Records.Add(Comments[Record.Key]);
|
Records.Add(Comments[Record.Key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Records.Add(string.Format("{0} = {1}", Record.Key, Record.Value));
|
Records.Add(string.Format("{0} = {1}", Record.Key, Record.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
File.WriteAllLines(Path, Records);
|
File.WriteAllLines(Path, Records);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
using System;
|
using Ryujinx.HLE;
|
||||||
using System.Collections.Generic;
|
using System;
|
||||||
using System.Text;
|
using System.IO;
|
||||||
using Ryujinx.HLE;
|
|
||||||
|
|
||||||
namespace Ryujinx.UI
|
namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
class EmulationController
|
class EmulationController
|
||||||
{
|
{
|
||||||
public bool IsLoaded = false;
|
public bool IsLoaded = false;
|
||||||
|
|
||||||
private Switch Ns;
|
private Switch Ns;
|
||||||
|
|
||||||
|
public event EventHandler IsShutDown;
|
||||||
|
|
||||||
public EmulationController(Switch Ns)
|
public EmulationController(Switch Ns)
|
||||||
{
|
{
|
||||||
this.Ns = Ns;
|
this.Ns = Ns;
|
||||||
|
@ -17,13 +19,13 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
public void Resume()
|
public void Resume()
|
||||||
{
|
{
|
||||||
lock(Ns)
|
lock (Ns)
|
||||||
Ns.Os.ResumeAllProcesses();
|
Ns.Os.ResumeAllProcesses();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Pause()
|
public void Pause()
|
||||||
{
|
{
|
||||||
lock(Ns)
|
lock (Ns)
|
||||||
Ns.Os.PauseAllProcesses();
|
Ns.Os.PauseAllProcesses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +33,42 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
lock (Ns)
|
lock (Ns)
|
||||||
Ns.Dispose();
|
Ns.Dispose();
|
||||||
|
Ns = null;
|
||||||
|
IsLoaded = false;
|
||||||
|
IsShutDown.Invoke(null,null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Load(string Path)
|
||||||
|
{
|
||||||
|
if (Directory.Exists(Path))
|
||||||
|
{
|
||||||
|
string[] RomFsFiles = Directory.GetFiles(Path, "*.istorage");
|
||||||
|
|
||||||
|
if (RomFsFiles.Length == 0)
|
||||||
|
{
|
||||||
|
RomFsFiles = Directory.GetFiles(Path, "*.romfs");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RomFsFiles.Length > 0)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Loading as cart with RomFS.");
|
||||||
|
|
||||||
|
Ns.LoadCart(Path, RomFsFiles[0]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Loading as cart WITHOUT RomFS.");
|
||||||
|
|
||||||
|
Ns.LoadCart(Path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (File.Exists(Path))
|
||||||
|
{
|
||||||
|
Console.WriteLine("Loading as homebrew.");
|
||||||
|
|
||||||
|
Ns.LoadProgram(Path);
|
||||||
|
}
|
||||||
|
IsLoaded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ namespace Ryujinx.UI
|
||||||
byte[] LanguageEntryData = Reader.ReadBytes(0x3000);
|
byte[] LanguageEntryData = Reader.ReadBytes(0x3000);
|
||||||
|
|
||||||
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();
|
||||||
|
|
12
Ryujinx.ImGui/Extensions/DialogResult.cs
Normal file
12
Ryujinx.ImGui/Extensions/DialogResult.cs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
public enum DialogResult
|
||||||
|
{
|
||||||
|
OK,
|
||||||
|
Cancel,
|
||||||
|
Yes,
|
||||||
|
No,
|
||||||
|
None
|
||||||
|
}
|
|
@ -10,9 +10,7 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
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; }
|
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; }
|
||||||
|
@ -38,6 +36,7 @@ namespace Ryujinx.UI
|
||||||
if (AssetMagic == "ASET")
|
if (AssetMagic == "ASET")
|
||||||
{
|
{
|
||||||
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);
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using OpenTK.Input;
|
||||||
|
using OpenTK.Graphics;
|
||||||
using Ryujinx.Audio;
|
using Ryujinx.Audio;
|
||||||
using Ryujinx.Audio.OpenAL;
|
using Ryujinx.Audio.OpenAL;
|
||||||
using Ryujinx.Graphics.Gal;
|
using Ryujinx.Graphics.Gal;
|
||||||
using Ryujinx.Graphics.Gal.OpenGL;
|
using Ryujinx.Graphics.Gal.OpenGL;
|
||||||
using Ryujinx.HLE;
|
using Ryujinx.HLE;
|
||||||
using Ryujinx.HLE.Input;
|
using Ryujinx.HLE.Input;
|
||||||
using OpenTK.Graphics;
|
|
||||||
using OpenTK.Input;
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace Ryujinx.UI
|
namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
partial class EmulationWindow : WindowHelper
|
partial class EmulationWindow : WindowHelper
|
||||||
{
|
{
|
||||||
|
public static EmulationController EmulationController;
|
||||||
//toggles
|
//toggles
|
||||||
private bool showMainUI = true;
|
private bool showMainUI = true;
|
||||||
private bool showPauseUI;
|
private bool showPauseUI;
|
||||||
|
@ -26,10 +26,6 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
isRunning = value;
|
isRunning = value;
|
||||||
UIActive = !value;
|
UIActive = !value;
|
||||||
if (!value)
|
|
||||||
{
|
|
||||||
//ShowMainUI = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,9 +35,14 @@ namespace Ryujinx.UI
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
showMainUI = value;
|
showMainUI = value;
|
||||||
showPauseUI = !value && !isRunning;
|
if (value)
|
||||||
|
{
|
||||||
|
CurrentPage = Page.GameList;
|
||||||
UIActive = value;
|
UIActive = value;
|
||||||
}
|
}
|
||||||
|
else if (!ShowPauseUI)
|
||||||
|
UIActive = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShowPauseUI
|
private bool ShowPauseUI
|
||||||
|
@ -50,13 +51,16 @@ namespace Ryujinx.UI
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
showPauseUI = value;
|
showPauseUI = value;
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
CurrentPage = Page.Emulation;
|
||||||
UIActive = value;
|
UIActive = value;
|
||||||
showMainUI = !value;
|
}
|
||||||
|
else if (!ShowMainUI)
|
||||||
|
UIActive = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private EmulationController EmulationController;
|
|
||||||
|
|
||||||
private Page CurrentPage = Page.GameList;
|
private Page CurrentPage = Page.GameList;
|
||||||
|
|
||||||
private bool EscapePressed;
|
private bool EscapePressed;
|
||||||
|
@ -73,24 +77,14 @@ namespace Ryujinx.UI
|
||||||
FilePicker FileDialog;
|
FilePicker FileDialog;
|
||||||
|
|
||||||
IGalRenderer Renderer;
|
IGalRenderer Renderer;
|
||||||
IAalOutput AudioOut;
|
|
||||||
public static Switch Ns;
|
public static Switch Ns;
|
||||||
|
|
||||||
public EmulationWindow() : base("Test")
|
public EmulationWindow() : base("Ryujinx")
|
||||||
{
|
{
|
||||||
FileDialog = FilePicker.GetFilePicker("rom",null);
|
FileDialog = FilePicker.GetFilePicker("rom",null);
|
||||||
|
|
||||||
Renderer = new OGLRenderer();
|
InitializeSwitch();
|
||||||
|
|
||||||
AudioOut = new OpenALAudioOut();
|
|
||||||
|
|
||||||
Ns = new Switch(Renderer, AudioOut);
|
|
||||||
|
|
||||||
Config.Read(Ns.Log);
|
|
||||||
|
|
||||||
EmulationController = new EmulationController(Ns);
|
|
||||||
|
|
||||||
Ns.Log.Updated += ConsoleLog.PrintLog;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnLoad(EventArgs e)
|
protected override void OnLoad(EventArgs e)
|
||||||
|
@ -98,17 +92,18 @@ namespace Ryujinx.UI
|
||||||
base.OnLoad(e);
|
base.OnLoad(e);
|
||||||
|
|
||||||
VSync = VSyncMode.On;
|
VSync = VSyncMode.On;
|
||||||
|
|
||||||
Renderer.FrameBuffer.SetWindowSize(Width, Height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnRenderFrame(FrameEventArgs e)
|
protected override void OnRenderFrame(FrameEventArgs e)
|
||||||
{
|
{
|
||||||
_deltaTime = (float)e.Time;
|
DeltaTime = (float)e.Time;
|
||||||
|
|
||||||
if (UIActive)
|
if (UIActive)
|
||||||
{
|
{
|
||||||
StartFrame();
|
StartFrame();
|
||||||
|
|
||||||
isRunning = false;
|
isRunning = false;
|
||||||
|
|
||||||
if (ShowMainUI)
|
if (ShowMainUI)
|
||||||
{
|
{
|
||||||
showPauseUI = false;
|
showPauseUI = false;
|
||||||
|
@ -119,7 +114,7 @@ namespace Ryujinx.UI
|
||||||
showMainUI = false;
|
showMainUI = false;
|
||||||
RenderPauseUI();
|
RenderPauseUI();
|
||||||
}
|
}
|
||||||
ImGuiNative.igShowMetricsWindow(ref UIActive);
|
|
||||||
EndFrame();
|
EndFrame();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -139,9 +134,28 @@ namespace Ryujinx.UI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void InitializeSwitch()
|
||||||
|
{
|
||||||
|
MainContext.MakeCurrent(WindowInfo);
|
||||||
|
|
||||||
|
Renderer = new OGLRenderer();
|
||||||
|
|
||||||
|
Renderer.FrameBuffer.SetWindowSize(Width, Height);
|
||||||
|
|
||||||
|
IAalOutput AudioOut = new OpenALAudioOut();
|
||||||
|
|
||||||
|
Ns = new Switch(Renderer, AudioOut);
|
||||||
|
|
||||||
|
Config.Read(Ns.Log);
|
||||||
|
|
||||||
|
Ns.Log.Updated += ConsoleLog.PrintLog;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnUpdateFrame(FrameEventArgs e)
|
protected override void OnUpdateFrame(FrameEventArgs e)
|
||||||
{
|
{
|
||||||
if(!UIActive)
|
KeyboardState Keyboard = this.Keyboard.HasValue ? this.Keyboard.Value : new KeyboardState();
|
||||||
|
|
||||||
|
if (!UIActive)
|
||||||
{
|
{
|
||||||
if (Keyboard[Key.Escape] && !EscapePressed)
|
if (Keyboard[Key.Escape] && !EscapePressed)
|
||||||
{
|
{
|
||||||
|
@ -153,7 +167,9 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
if (EmulationController.IsLoaded)
|
if (EmulationController.IsLoaded)
|
||||||
ShowPauseUI = true;
|
ShowPauseUI = true;
|
||||||
|
|
||||||
UIActive = true;
|
UIActive = true;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (Keyboard[Key.Escape])
|
else if (Keyboard[Key.Escape])
|
||||||
|
@ -218,8 +234,10 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
//Get screen touch position from left mouse click
|
//Get screen touch position from left mouse click
|
||||||
//OpenTK always captures mouse events, even if out of focus, so check if window is focused.
|
//OpenTK always captures mouse events, even if out of focus, so check if window is focused.
|
||||||
if (Focused && Mouse?.GetState().LeftButton == ButtonState.Pressed)
|
if (Focused && Mouse?.LeftButton == ButtonState.Pressed)
|
||||||
{
|
{
|
||||||
|
MouseState Mouse = this.Mouse.Value;
|
||||||
|
|
||||||
int ScrnWidth = Width;
|
int ScrnWidth = Width;
|
||||||
int ScrnHeight = Height;
|
int ScrnHeight = Height;
|
||||||
|
|
||||||
|
@ -289,15 +307,18 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
Renderer.RunActions();
|
Renderer.RunActions();
|
||||||
}
|
}
|
||||||
else if(EmulationController.IsLoaded)
|
else if (EmulationController != null)
|
||||||
|
if (EmulationController.IsLoaded)
|
||||||
{
|
{
|
||||||
if (Keyboard[Key.Escape] && !EscapePressed)
|
if (Keyboard[Key.Escape] && !EscapePressed)
|
||||||
{
|
{
|
||||||
EscapePressed = true;
|
EscapePressed = true;
|
||||||
|
|
||||||
EmulationController.Resume();
|
EmulationController.Resume();
|
||||||
|
|
||||||
if (ShowPauseUI & EmulationController.IsLoaded)
|
if (ShowPauseUI & EmulationController.IsLoaded)
|
||||||
showPauseUI = false;
|
showPauseUI = false;
|
||||||
|
|
||||||
UIActive = false;
|
UIActive = false;
|
||||||
IsRunning = true;
|
IsRunning = true;
|
||||||
}
|
}
|
||||||
|
@ -310,38 +331,29 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
public void LoadPackage(string path)
|
public void LoadPackage(string path)
|
||||||
{
|
{
|
||||||
ShowMainUI = false;
|
|
||||||
MainContext.MakeCurrent(WindowInfo);
|
MainContext.MakeCurrent(WindowInfo);
|
||||||
if (Directory.Exists(path))
|
|
||||||
{
|
|
||||||
string[] RomFsFiles = Directory.GetFiles(path, "*.istorage");
|
|
||||||
|
|
||||||
if (RomFsFiles.Length == 0)
|
if(Ns == null)
|
||||||
{
|
InitializeSwitch();
|
||||||
RomFsFiles = Directory.GetFiles(path, "*.romfs");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RomFsFiles.Length > 0)
|
if (EmulationController == null)
|
||||||
{
|
EmulationController = new EmulationController(Ns);
|
||||||
Console.WriteLine("Loading as cart with RomFS.");
|
|
||||||
|
|
||||||
Ns.LoadCart(path, RomFsFiles[0]);
|
EmulationController.IsShutDown += EmulationController_IsShutDown;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine("Loading as cart WITHOUT RomFS.");
|
|
||||||
|
|
||||||
Ns.LoadCart(path);
|
EmulationController.Load(path);
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (File.Exists(path))
|
|
||||||
{
|
|
||||||
Console.WriteLine("Loading as homebrew.");
|
|
||||||
|
|
||||||
Ns.LoadProgram(path);
|
|
||||||
}
|
|
||||||
IsRunning = true;
|
IsRunning = true;
|
||||||
EmulationController.IsLoaded = true;
|
|
||||||
|
ShowMainUI = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EmulationController_IsShutDown(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
EmulationController = null;
|
||||||
|
|
||||||
|
Ns = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Page
|
enum Page
|
||||||
|
|
|
@ -1,22 +1,19 @@
|
||||||
using System;
|
using ImGuiNET;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using ImGuiNET;
|
|
||||||
using System.Numerics;
|
|
||||||
using Ryujinx.HLE.Input;
|
using Ryujinx.HLE.Input;
|
||||||
using OpenTK.Input;
|
using System.Numerics;
|
||||||
|
|
||||||
namespace Ryujinx.UI.Widgets
|
namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
public partial class ConfigurationWidget
|
public partial class ConfigurationWidget
|
||||||
{
|
{
|
||||||
public static JoyCon CurrentJoyConLayout;
|
|
||||||
static Page CurrentPage = Page.General;
|
|
||||||
static bool ConfigIntialized = false;
|
static bool ConfigIntialized = false;
|
||||||
static bool OpenFolderPicker;
|
static bool OpenFolderPicker;
|
||||||
static string CurrentPath;
|
static string CurrentPath;
|
||||||
|
|
||||||
static IniParser IniParser;
|
static IniParser IniParser;
|
||||||
static FolderPicker FolderPicker;
|
static FolderPicker FolderPicker;
|
||||||
|
static JoyCon CurrentJoyConLayout;
|
||||||
|
static Page CurrentPage = Page.General;
|
||||||
|
|
||||||
static ConfigurationWidget()
|
static ConfigurationWidget()
|
||||||
{
|
{
|
||||||
|
@ -60,31 +57,28 @@ namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
ImGui.Text("General Emulation Settings");
|
ImGui.Text("General Emulation Settings");
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
ImGui.LabelText("","Default Game Directory");
|
ImGui.LabelText("", "Default Game Directory");
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
if( ImGui.Selectable(Config.DefaultGameDirectory))
|
if (ImGui.Selectable(Config.DefaultGameDirectory))
|
||||||
{
|
{
|
||||||
OpenFolderPicker = true;
|
OpenFolderPicker = true;
|
||||||
}
|
}
|
||||||
if (OpenFolderPicker)
|
if (OpenFolderPicker)
|
||||||
ImGui.OpenPopup("OpenFolder");
|
ImGui.OpenPopup("OpenFolder");
|
||||||
|
|
||||||
ImGui.SetNextWindowSize(new Vector2(500, 500), Condition.FirstUseEver);
|
DialogResult DialogResult = FolderPicker.GetFolder(ref CurrentPath);
|
||||||
if(ImGui.BeginPopupModal("OpenFolder",WindowFlags.NoResize))
|
if (DialogResult == DialogResult.OK)
|
||||||
{
|
{
|
||||||
string output = CurrentPath;
|
if (!string.IsNullOrWhiteSpace(CurrentPath))
|
||||||
if (FolderPicker.Draw(ref output, false))
|
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(output))
|
Config.DefaultGameDirectory = CurrentPath;
|
||||||
{
|
|
||||||
Config.DefaultGameDirectory = output;
|
|
||||||
}
|
}
|
||||||
ImGui.CloseCurrentPopup();
|
}
|
||||||
|
if (DialogResult != DialogResult.None)
|
||||||
|
{
|
||||||
OpenFolderPicker = false;
|
OpenFolderPicker = false;
|
||||||
}
|
}
|
||||||
ImGui.EndPopup();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
ImGui.Checkbox("Disable Cpu Memory Checks", ref AOptimizations.DisableMemoryChecks);
|
ImGui.Checkbox("Disable Cpu Memory Checks", ref AOptimizations.DisableMemoryChecks);
|
||||||
|
|
|
@ -12,114 +12,114 @@ namespace ImGuiNET
|
||||||
public class FilePicker
|
public class FilePicker
|
||||||
{
|
{
|
||||||
private const string FilePickerID = "###FilePicker";
|
private const string FilePickerID = "###FilePicker";
|
||||||
private static readonly Dictionary<object, FilePicker> s_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; }
|
||||||
public string SelectedFile { get; set; }
|
public string SelectedEntry { get; set; }
|
||||||
|
|
||||||
public static FilePicker GetFilePicker(object o, string startingPath)
|
public static FilePicker GetFilePicker(object Id, string StartingPath)
|
||||||
{
|
{
|
||||||
if (File.Exists(startingPath))
|
if (File.Exists(StartingPath))
|
||||||
{
|
{
|
||||||
startingPath = new FileInfo(startingPath).DirectoryName;
|
StartingPath = new FileInfo(StartingPath).DirectoryName;
|
||||||
}
|
}
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s_filePickers.TryGetValue(o, out FilePicker fp))
|
if (!FilePickers.TryGetValue(Id, out FilePicker FilePicker))
|
||||||
{
|
{
|
||||||
fp = new FilePicker();
|
FilePicker = new FilePicker
|
||||||
fp.CurrentFolder = startingPath;
|
|
||||||
s_filePickers.Add(o, fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return fp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Draw(ref string selected, bool returnOnSelection)
|
|
||||||
{
|
{
|
||||||
bool result = false;
|
CurrentFolder = StartingPath
|
||||||
result = DrawFolder(ref selected, returnOnSelection);
|
};
|
||||||
return result;
|
|
||||||
|
FilePickers.Add(Id, FilePicker);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool DrawFolder(ref string selected, bool returnOnSelection = false)
|
return FilePicker;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogResult Draw(ref string SelectedPath, bool ReturnOnSelection)
|
||||||
|
{
|
||||||
|
return DrawFolder(ref SelectedPath, ReturnOnSelection);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DialogResult DrawFolder(ref string SelectedPath, bool ReturnOnSelection = false)
|
||||||
{
|
{
|
||||||
ImGui.Text("Current Folder: " + CurrentFolder);
|
ImGui.Text("Current Folder: " + CurrentFolder);
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
if (ImGui.BeginChildFrame(1, ImGui.GetContentRegionAvailable() - new Vector2(20, Values.ButtonHeight),
|
if (ImGui.BeginChildFrame(1, ImGui.GetContentRegionAvailable() - new Vector2(20, Values.ButtonHeight),
|
||||||
WindowFlags.Default))
|
WindowFlags.Default))
|
||||||
{
|
{
|
||||||
DirectoryInfo di = new DirectoryInfo(CurrentFolder);
|
DirectoryInfo CurrentDirectory = new DirectoryInfo(CurrentFolder);
|
||||||
if (di.Exists)
|
if (CurrentDirectory.Exists)
|
||||||
{
|
{
|
||||||
if (di.Parent != null)
|
if (CurrentDirectory.Parent != null)
|
||||||
{
|
{
|
||||||
ImGui.PushStyleColor(ColorTarget.Text, Values.Color.Yellow);
|
ImGui.PushStyleColor(ColorTarget.Text, Values.Color.Yellow);
|
||||||
|
|
||||||
if (ImGui.Selectable("../", false, SelectableFlags.DontClosePopups
|
if (ImGui.Selectable("../", false, SelectableFlags.DontClosePopups
|
||||||
, new Vector2(ImGui.GetContentRegionAvailableWidth(), Values.SelectibleHeight)))
|
, new Vector2(ImGui.GetContentRegionAvailableWidth(), Values.SelectibleHeight)))
|
||||||
{
|
{
|
||||||
CurrentFolder = di.Parent.FullName;
|
CurrentFolder = CurrentDirectory.Parent.FullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PopStyleColor();
|
ImGui.PopStyleColor();
|
||||||
}
|
}
|
||||||
foreach (var dir in Directory.EnumerateFileSystemEntries(di.FullName))
|
|
||||||
|
foreach (string Dir in Directory.EnumerateFileSystemEntries(CurrentDirectory.FullName))
|
||||||
{
|
{
|
||||||
if (Directory.Exists(dir))
|
if (Directory.Exists(Dir))
|
||||||
{
|
{
|
||||||
string name = Path.GetFileName(dir);
|
string Name = Path.GetFileName(Dir);
|
||||||
bool isSelected = SelectedFile == dir;
|
bool IsSelected = SelectedEntry == Dir;
|
||||||
|
|
||||||
ImGui.PushStyleColor(ColorTarget.Text, Values.Color.Yellow);
|
ImGui.PushStyleColor(ColorTarget.Text, Values.Color.Yellow);
|
||||||
|
|
||||||
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)))
|
||||||
{
|
{
|
||||||
SelectedFile = dir;
|
SelectedEntry = Dir;
|
||||||
selected = SelectedFile;
|
SelectedPath = SelectedEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectedFile != null)
|
if (SelectedEntry != null)
|
||||||
if (ImGui.IsMouseDoubleClicked(0) && SelectedFile.Equals(dir))
|
if (ImGui.IsMouseDoubleClicked(0) && SelectedEntry.Equals(Dir))
|
||||||
{
|
{
|
||||||
SelectedFile = null;
|
SelectedEntry = null;
|
||||||
selected = null;
|
SelectedPath = null;
|
||||||
CurrentFolder = dir;
|
CurrentFolder = Dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PopStyleColor();
|
ImGui.PopStyleColor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (var file in Directory.EnumerateFiles(di.FullName))
|
foreach (string File in Directory.EnumerateFiles(CurrentDirectory.FullName))
|
||||||
{
|
{
|
||||||
string name = Path.GetFileName(file);
|
string Name = Path.GetFileName(File);
|
||||||
bool isSelected = SelectedFile == 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)))
|
||||||
{
|
{
|
||||||
SelectedFile = file;
|
SelectedEntry = File;
|
||||||
if (returnOnSelection)
|
if (ReturnOnSelection)
|
||||||
{
|
{
|
||||||
selected = SelectedFile;
|
SelectedPath = SelectedEntry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectedFile != null)
|
if (SelectedEntry != null)
|
||||||
if (ImGui.IsMouseDoubleClicked(0) && SelectedFile.Equals(file))
|
if (ImGui.IsMouseDoubleClicked(0) && SelectedEntry.Equals(File))
|
||||||
{
|
{
|
||||||
selected = file;
|
SelectedPath = File;
|
||||||
result = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,20 +129,27 @@ namespace ImGuiNET
|
||||||
|
|
||||||
if (ImGui.Button("Cancel", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
|
if (ImGui.Button("Cancel", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
|
||||||
{
|
{
|
||||||
result = false;
|
return DialogResult.Cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectedFile != null)
|
if (SelectedEntry != null)
|
||||||
{
|
{
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
if (ImGui.Button("Load", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
|
if (ImGui.Button("Load", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
|
||||||
{
|
{
|
||||||
result = true;
|
SelectedPath = SelectedEntry;
|
||||||
selected = SelectedFile;
|
|
||||||
|
return DialogResult.OK;
|
||||||
|
}
|
||||||
|
else if (ReturnOnSelection)
|
||||||
|
{
|
||||||
|
SelectedPath = SelectedEntry;
|
||||||
|
|
||||||
|
return DialogResult.OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return DialogResult.None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,91 +11,91 @@ namespace ImGuiNET
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class FolderPicker
|
public class FolderPicker
|
||||||
{
|
{
|
||||||
private const string FilePickerID = "###FilePicker";
|
private const string FolderPickerID = "###FolderPicker";
|
||||||
private static readonly Dictionary<object, FolderPicker> s_folderPickers
|
private static readonly Dictionary<object, FolderPicker> FolderPickers
|
||||||
= new Dictionary<object, FolderPicker>();
|
= new Dictionary<object, FolderPicker>();
|
||||||
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; }
|
||||||
public string SelectedFile { get; set; }
|
public string SelectedDirectory { get; set; }
|
||||||
|
|
||||||
public static FolderPicker GetFolderPicker(object o, string startingPath)
|
public static FolderPicker GetFolderPicker(object Id, string StartingPath)
|
||||||
{
|
{
|
||||||
if (File.Exists(startingPath))
|
if (File.Exists(StartingPath))
|
||||||
{
|
{
|
||||||
startingPath = new FileInfo(startingPath).DirectoryName;
|
StartingPath = new FileInfo(StartingPath).DirectoryName;
|
||||||
}
|
}
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s_folderPickers.TryGetValue(o, out FolderPicker fp))
|
if (!FolderPickers.TryGetValue(Id, out FolderPicker FolderPicker))
|
||||||
{
|
{
|
||||||
fp = new FolderPicker();
|
FolderPicker = new FolderPicker
|
||||||
fp.CurrentFolder = startingPath;
|
|
||||||
s_folderPickers.Add(o, fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return fp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Draw(ref string selected, bool returnOnSelection)
|
|
||||||
{
|
{
|
||||||
bool result = false;
|
CurrentFolder = StartingPath
|
||||||
result = DrawFolder(ref selected, returnOnSelection);
|
};
|
||||||
return result;
|
|
||||||
|
FolderPickers.Add(Id, FolderPicker);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool DrawFolder(ref string selected, bool returnOnSelection = false)
|
return FolderPicker;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogResult Draw(ref string Selected, bool ReturnOnSelection)
|
||||||
|
{
|
||||||
|
return DrawFolder(ref Selected, ReturnOnSelection);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DialogResult DrawFolder(ref string Selected, bool ReturnOnSelection = false)
|
||||||
{
|
{
|
||||||
ImGui.Text("Current Folder: " + CurrentFolder);
|
ImGui.Text("Current Folder: " + CurrentFolder);
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
if (ImGui.BeginChildFrame(1, ImGui.GetContentRegionAvailable() - new Vector2(20, Values.ButtonHeight),
|
if (ImGui.BeginChildFrame(1, ImGui.GetContentRegionAvailable() - new Vector2(20, Values.ButtonHeight),
|
||||||
WindowFlags.Default))
|
WindowFlags.Default))
|
||||||
{
|
{
|
||||||
DirectoryInfo di = new DirectoryInfo(CurrentFolder);
|
DirectoryInfo CurrentDirectory = new DirectoryInfo(CurrentFolder);
|
||||||
if (di.Exists)
|
if (CurrentDirectory.Exists)
|
||||||
{
|
{
|
||||||
if (di.Parent != null)
|
if (CurrentDirectory.Parent != null)
|
||||||
{
|
{
|
||||||
ImGui.PushStyleColor(ColorTarget.Text, Values.Color.Yellow);
|
ImGui.PushStyleColor(ColorTarget.Text, Values.Color.Yellow);
|
||||||
|
|
||||||
if (ImGui.Selectable("../", false, SelectableFlags.DontClosePopups
|
if (ImGui.Selectable("../", false, SelectableFlags.DontClosePopups
|
||||||
, new Vector2(ImGui.GetContentRegionAvailableWidth(), Values.SelectibleHeight)))
|
, new Vector2(ImGui.GetContentRegionAvailableWidth(), Values.SelectibleHeight)))
|
||||||
{
|
{
|
||||||
CurrentFolder = di.Parent.FullName;
|
CurrentFolder = CurrentDirectory.Parent.FullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PopStyleColor();
|
ImGui.PopStyleColor();
|
||||||
}
|
}
|
||||||
foreach (var dir in Directory.EnumerateFileSystemEntries(di.FullName))
|
foreach (var Dir in Directory.EnumerateFileSystemEntries(CurrentDirectory.FullName))
|
||||||
{
|
{
|
||||||
if (Directory.Exists(dir))
|
if (Directory.Exists(Dir))
|
||||||
{
|
{
|
||||||
string name = Path.GetFileName(dir);
|
string Name = Path.GetFileName(Dir);
|
||||||
bool isSelected = SelectedFile == dir;
|
bool IsSelected = SelectedDirectory == Dir;
|
||||||
|
|
||||||
ImGui.PushStyleColor(ColorTarget.Text, Values.Color.Yellow);
|
ImGui.PushStyleColor(ColorTarget.Text, Values.Color.Yellow);
|
||||||
|
|
||||||
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)))
|
||||||
{
|
{
|
||||||
SelectedFile = dir;
|
SelectedDirectory = Dir;
|
||||||
selected = SelectedFile;
|
Selected = SelectedDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectedFile != null)
|
if (SelectedDirectory != null)
|
||||||
if (ImGui.IsMouseDoubleClicked(0) && SelectedFile.Equals(dir))
|
if (ImGui.IsMouseDoubleClicked(0) && SelectedDirectory.Equals(Dir))
|
||||||
{
|
{
|
||||||
SelectedFile = null;
|
SelectedDirectory = null;
|
||||||
selected = null;
|
Selected = null;
|
||||||
CurrentFolder = dir;
|
CurrentFolder = Dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PopStyleColor();
|
ImGui.PopStyleColor();
|
||||||
|
@ -108,20 +108,59 @@ namespace ImGuiNET
|
||||||
|
|
||||||
if (ImGui.Button("Cancel", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
|
if (ImGui.Button("Cancel", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
|
||||||
{
|
{
|
||||||
result = false;
|
return DialogResult.Cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SelectedFile != null)
|
if (SelectedDirectory != null)
|
||||||
{
|
{
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
if (ImGui.Button("Open", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
|
if (ImGui.Button("Open", new Vector2(Values.ButtonWidth, Values.ButtonHeight)))
|
||||||
{
|
{
|
||||||
result = true;
|
Selected = SelectedDirectory;
|
||||||
selected = SelectedFile;
|
|
||||||
|
return DialogResult.OK;
|
||||||
|
}
|
||||||
|
else if(ReturnOnSelection)
|
||||||
|
{
|
||||||
|
Selected = SelectedDirectory;
|
||||||
|
|
||||||
|
return DialogResult.OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return DialogResult.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DialogResult GetFolder(ref string CurrentPath)
|
||||||
|
{
|
||||||
|
ImGui.SetNextWindowSize(new Vector2(500, 500), Condition.FirstUseEver);
|
||||||
|
if (ImGui.BeginPopupModal("OpenFolder", WindowFlags.NoResize))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string Output = CurrentPath;
|
||||||
|
DialogResult DialogResult = Draw(ref Output, false);
|
||||||
|
|
||||||
|
if (DialogResult == DialogResult.OK)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(Output))
|
||||||
|
{
|
||||||
|
return DialogResult.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(DialogResult!= DialogResult.None)
|
||||||
|
ImGui.CloseCurrentPopup();
|
||||||
|
|
||||||
|
return DialogResult;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ImGui.EndPopup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return DialogResult.None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,102 +1,101 @@
|
||||||
using System;
|
using ImGuiNET;
|
||||||
using System.IO;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Drawing.Imaging;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using ImGuiNET;
|
|
||||||
using System.Numerics;
|
|
||||||
using NanoJpeg;
|
using NanoJpeg;
|
||||||
using OpenTK.Graphics.OpenGL;
|
using OpenTK.Graphics.OpenGL;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Numerics;
|
||||||
|
|
||||||
namespace Ryujinx.UI.Widgets
|
namespace Ryujinx.UI.Widgets
|
||||||
{
|
{
|
||||||
class GameList
|
class GameList
|
||||||
{
|
{
|
||||||
static List<GameItem> GameItems = new List<GameItem>();
|
|
||||||
static GameItem SelectedGame;
|
|
||||||
static bool OpenFolderPicker;
|
static bool OpenFolderPicker;
|
||||||
|
static string GameDirectory;
|
||||||
|
static List<GameItem> GameItems;
|
||||||
|
static GameItem SelectedGame;
|
||||||
static FolderPicker FolderPicker;
|
static FolderPicker FolderPicker;
|
||||||
static string CurrentPath;
|
|
||||||
|
|
||||||
static GameList()
|
static GameList()
|
||||||
{
|
{
|
||||||
Refresh(Config.DefaultGameDirectory);
|
GameDirectory = Config.DefaultGameDirectory;
|
||||||
FolderPicker = FolderPicker.GetFolderPicker("FolderDialog", Config.DefaultGameDirectory);
|
FolderPicker = FolderPicker.GetFolderPicker("FolderDialog", Config.DefaultGameDirectory);
|
||||||
|
|
||||||
|
Refresh(GameDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe static void Refresh(string Path)
|
public unsafe static void Refresh(string Path)
|
||||||
{
|
{
|
||||||
GameItems = new List<GameItem>();
|
GameItems = new List<GameItem>();
|
||||||
|
|
||||||
foreach (string entry in Directory.EnumerateFileSystemEntries(Path))
|
foreach (string entry in Directory.EnumerateFileSystemEntries(Path))
|
||||||
{
|
{
|
||||||
if (File.Exists(entry))
|
if (File.Exists(entry))
|
||||||
{
|
{
|
||||||
string Extension = System.IO.Path.GetExtension(entry).ToLower();
|
string Extension = System.IO.Path.GetExtension(entry).ToLower();
|
||||||
|
|
||||||
if (Extension == ".nro" || Extension == ".nso")
|
if (Extension == ".nro" || Extension == ".nso")
|
||||||
{
|
{
|
||||||
GameItem GameItem = new GameItem(entry);
|
GameItem GameItem = new GameItem(entry);
|
||||||
|
|
||||||
if (GameItem.IsNro && GameItem.HasIcon)
|
if (GameItem.IsNro && GameItem.HasIcon)
|
||||||
{
|
{
|
||||||
GameItem.TextureID = GL.GenTexture();
|
GameItem.TextureID = GL.GenTexture();
|
||||||
|
|
||||||
GL.BindTexture(TextureTarget.Texture2D, GameItem.TextureID);
|
GL.BindTexture(TextureTarget.Texture2D, GameItem.TextureID);
|
||||||
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.PixelStore(PixelStoreParameter.UnpackAlignment, 1);
|
GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1);
|
||||||
|
|
||||||
NanoJpeg.NJImage image = new NJImage();
|
NanoJpeg.NJImage image = new NJImage();
|
||||||
image.Decode(GameItem.GetIconData());
|
image.Decode(GameItem.GetIconData());
|
||||||
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgb, image.Width, image.Height, 0, OpenTK.Graphics.OpenGL.PixelFormat.Rgb,
|
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgb, image.Width, image.Height, 0, PixelFormat.Rgb,
|
||||||
PixelType.UnsignedByte, new IntPtr(image.Image));
|
PixelType.UnsignedByte, new IntPtr(image.Image));
|
||||||
image.Dispose();
|
image.Dispose();
|
||||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameItems.Add(GameItem);
|
GameItems.Add(GameItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Directory.Exists(Path))
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe static void DrawList()
|
public unsafe static Tuple<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;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OpenFolderPicker)
|
if (OpenFolderPicker)
|
||||||
ImGui.OpenPopup("OpenFolder");
|
ImGui.OpenPopup("OpenFolder");
|
||||||
|
|
||||||
ImGui.SetNextWindowSize(new Vector2(500, 500), Condition.FirstUseEver);
|
DialogResult DialogResult = FolderPicker.GetFolder(ref GameDirectory);
|
||||||
if (ImGui.BeginPopupModal("OpenFolder", WindowFlags.NoResize))
|
if (DialogResult == DialogResult.OK)
|
||||||
{
|
{
|
||||||
string output = CurrentPath;
|
Config.DefaultGameDirectory = GameDirectory;
|
||||||
if (FolderPicker.Draw(ref output, false))
|
Refresh(GameDirectory);
|
||||||
{
|
|
||||||
if (!string.IsNullOrWhiteSpace(output))
|
|
||||||
{
|
|
||||||
Config.DefaultGameDirectory = output;
|
|
||||||
Refresh(output);
|
|
||||||
}
|
}
|
||||||
ImGui.CloseCurrentPopup();
|
|
||||||
|
if (DialogResult != DialogResult.None)
|
||||||
OpenFolderPicker = false;
|
OpenFolderPicker = false;
|
||||||
}
|
|
||||||
ImGui.EndPopup();
|
|
||||||
}
|
|
||||||
if (ImGui.BeginChildFrame(20, ImGui.GetContentRegionAvailable(), WindowFlags.AlwaysAutoResize))
|
if (ImGui.BeginChildFrame(20, ImGui.GetContentRegionAvailable(), WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
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))
|
||||||
{
|
{
|
||||||
|
@ -113,6 +112,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
ImGui.Text(Path.GetFileName(GameItem.Path));
|
ImGui.Text(Path.GetFileName(GameItem.Path));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
if (GameItem.IsNro)
|
if (GameItem.IsNro)
|
||||||
|
@ -125,33 +125,39 @@ namespace Ryujinx.UI.Widgets
|
||||||
|
|
||||||
}
|
}
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
if (GameItem == SelectedGame)
|
if (GameItem == SelectedGame)
|
||||||
ImGui.PopStyleColor();
|
ImGui.PopStyleColor();
|
||||||
|
|
||||||
if (ImGui.IsMouseDoubleClicked(0) && ImGui.IsItemHovered(HoveredFlags.AllowWhenOverlapped) && GameItem == SelectedGame)
|
if (ImGui.IsMouseDoubleClicked(0) && ImGui.IsItemHovered(HoveredFlags.AllowWhenOverlapped) && GameItem == SelectedGame)
|
||||||
{
|
{
|
||||||
|
return new Tuple<bool, string>(true, GameItem.Path);
|
||||||
}
|
}
|
||||||
else if (ImGui.IsMouseClicked(0) && ImGui.IsItemHovered(HoveredFlags.AllowWhenOverlapped | HoveredFlags.RootAndChildWindows))
|
else if (ImGui.IsMouseClicked(0) && ImGui.IsItemHovered(HoveredFlags.AllowWhenOverlapped | HoveredFlags.RootAndChildWindows))
|
||||||
{
|
{
|
||||||
SelectedGame = GameItem;
|
SelectedGame = GameItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndChildFrame();
|
ImGui.EndChildFrame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndChildFrame();
|
ImGui.EndChildFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new Tuple<bool, string>(false,string.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GameItem
|
class GameItem
|
||||||
{
|
{
|
||||||
public AppletType AppletType;
|
public AppletType AppletType { get; set; }
|
||||||
public string Path;
|
public Nro Nro { get; set; }
|
||||||
public Nro Nro;
|
public string Path { get; set; }
|
||||||
public bool IsNro;
|
public int TextureID { get; set; }
|
||||||
|
|
||||||
|
public bool IsNro => (System.IO.Path.GetExtension(Path) == ".nro");
|
||||||
public bool HasIcon => Nro?.IconData != null;
|
public bool HasIcon => Nro?.IconData != null;
|
||||||
public int TextureID;
|
|
||||||
|
|
||||||
public GameItem(string Path)
|
public GameItem(string Path)
|
||||||
{
|
{
|
||||||
|
@ -163,7 +169,6 @@ namespace Ryujinx.UI.Widgets
|
||||||
FileInfo Package = new FileInfo(Path);
|
FileInfo Package = new FileInfo(Path);
|
||||||
if (Package.Extension.ToLower() == ".nro")
|
if (Package.Extension.ToLower() == ".nro")
|
||||||
{
|
{
|
||||||
IsNro = true;
|
|
||||||
Nro = new Nro(File.Open(Path, FileMode.Open), new FileInfo(Path).Name);
|
Nro = new Nro(File.Open(Path, FileMode.Open), new FileInfo(Path).Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,15 +176,6 @@ namespace Ryujinx.UI.Widgets
|
||||||
AppletType = AppletType.Cartridge;
|
AppletType = AppletType.Cartridge;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bitmap GetBitmap()
|
|
||||||
{
|
|
||||||
if (IsNro)
|
|
||||||
{
|
|
||||||
return new Bitmap(new Bitmap(new MemoryStream(Nro.IconData)),new Size(50,50));
|
|
||||||
}
|
|
||||||
else return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] GetIconData()
|
public byte[] GetIconData()
|
||||||
{
|
{
|
||||||
if (IsNro)
|
if (IsNro)
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
case Page.PackageLoader:
|
case Page.PackageLoader:
|
||||||
string output = CurrentPath;
|
string output = CurrentPath;
|
||||||
if (FileDialog.Draw(ref output, false))
|
if (FileDialog.Draw(ref output, false) == DialogResult.OK)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(output))
|
if (!string.IsNullOrWhiteSpace(output))
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,11 @@ namespace Ryujinx.UI
|
||||||
Widgets.ConfigurationWidget.Draw();
|
Widgets.ConfigurationWidget.Draw();
|
||||||
break;
|
break;
|
||||||
case Page.GameList:
|
case Page.GameList:
|
||||||
Widgets.GameList.DrawList();
|
var SelectedPath = Widgets.GameList.DrawList();
|
||||||
|
if (SelectedPath.Item1)
|
||||||
|
{
|
||||||
|
LoadPackage(SelectedPath.Item2);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ImGui.EndChildFrame();
|
ImGui.EndChildFrame();
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
using System;
|
using ImGuiNET;
|
||||||
using ImGuiNET;
|
|
||||||
using System.Numerics;
|
|
||||||
using Ryujinx.HLE.Input;
|
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Numerics;
|
||||||
|
|
||||||
|
|
||||||
namespace Ryujinx.UI.Widgets
|
namespace Ryujinx.UI.Widgets
|
||||||
|
@ -11,33 +10,40 @@ namespace Ryujinx.UI.Widgets
|
||||||
public partial class ConfigurationWidget
|
public partial class ConfigurationWidget
|
||||||
{
|
{
|
||||||
static bool[] Toggles = new bool[50];
|
static bool[] Toggles = new bool[50];
|
||||||
|
|
||||||
static float ContentWidth;
|
static float ContentWidth;
|
||||||
static Vector2 GroupSize;
|
static Vector2 GroupSize;
|
||||||
static Key pressedKey;
|
static Key pressedKey;
|
||||||
static bool RequestPopup = false;
|
static bool RequestPopup;
|
||||||
|
|
||||||
public static void DrawInputPage()
|
public static void DrawInputPage()
|
||||||
{
|
{
|
||||||
Vector2 AvailableSpace = ImGui.GetContentRegionAvailable();
|
Vector2 AvailableSpace = ImGui.GetContentRegionAvailable();
|
||||||
|
|
||||||
GroupSize = new Vector2(AvailableSpace.X / 2, AvailableSpace.Y / 3);
|
GroupSize = new Vector2(AvailableSpace.X / 2, AvailableSpace.Y / 3);
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
ImGui.EndChildFrame();
|
ImGui.EndChildFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
if (ImGui.BeginChildFrame(12, GroupSize, WindowFlags.AlwaysAutoResize))
|
if (ImGui.BeginChildFrame(12, GroupSize, WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
DrawRightAnalog();
|
DrawRightAnalog();
|
||||||
|
|
||||||
ImGui.EndChildFrame();
|
ImGui.EndChildFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.BeginChildFrame(13, GroupSize, WindowFlags.AlwaysAutoResize))
|
if (ImGui.BeginChildFrame(13, GroupSize, WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
DrawDpad();
|
DrawDpad();
|
||||||
|
|
||||||
ImGui.EndChildFrame();
|
ImGui.EndChildFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,12 +51,14 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (ImGui.BeginChildFrame(14, GroupSize, WindowFlags.AlwaysAutoResize))
|
if (ImGui.BeginChildFrame(14, GroupSize, WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
DrawActionKeys();
|
DrawActionKeys();
|
||||||
|
|
||||||
ImGui.EndChildFrame();
|
ImGui.EndChildFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.BeginChildFrame(15, GroupSize, WindowFlags.AlwaysAutoResize))
|
if (ImGui.BeginChildFrame(15, GroupSize, WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
DrawTriggers();
|
DrawTriggers();
|
||||||
|
|
||||||
ImGui.EndChildFrame();
|
ImGui.EndChildFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +66,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
if (ImGui.BeginChildFrame(16, GroupSize, WindowFlags.AlwaysAutoResize))
|
if (ImGui.BeginChildFrame(16, GroupSize, WindowFlags.AlwaysAutoResize))
|
||||||
{
|
{
|
||||||
DrawExtras();
|
DrawExtras();
|
||||||
|
|
||||||
ImGui.EndChildFrame();
|
ImGui.EndChildFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,8 +82,10 @@ namespace Ryujinx.UI.Widgets
|
||||||
| WindowFlags.NoResize))
|
| WindowFlags.NoResize))
|
||||||
{
|
{
|
||||||
ImGui.Text("Please enter a key");
|
ImGui.Text("Please enter a key");
|
||||||
|
|
||||||
if (!RequestPopup)
|
if (!RequestPopup)
|
||||||
ImGui.CloseCurrentPopup();
|
ImGui.CloseCurrentPopup();
|
||||||
|
|
||||||
ImGui.EndPopup();
|
ImGui.EndPopup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,11 +98,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("Up");
|
ImGui.Text("Up");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.StickUp).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.StickUp).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[0] = true;
|
Toggles[0] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[0])
|
if (Toggles[0])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -100,16 +113,19 @@ namespace Ryujinx.UI.Widgets
|
||||||
Toggles[0] = false;
|
Toggles[0] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("Down");
|
ImGui.Text("Down");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.StickDown).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.StickDown).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[1] = true;
|
Toggles[1] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[1])
|
if (Toggles[1])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -118,15 +134,18 @@ namespace Ryujinx.UI.Widgets
|
||||||
Toggles[1] = false;
|
Toggles[1] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("Left");
|
ImGui.Text("Left");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.StickLeft).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.StickLeft).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[2] = true;
|
Toggles[2] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[2])
|
if (Toggles[2])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -140,11 +159,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("Right");
|
ImGui.Text("Right");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.StickRight).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.StickRight).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[3] = true;
|
Toggles[3] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[3])
|
if (Toggles[3])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -167,16 +188,19 @@ namespace Ryujinx.UI.Widgets
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("Up");
|
ImGui.Text("Up");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.StickUp).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.StickUp).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[4] = true;
|
Toggles[4] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[4])
|
if (Toggles[4])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
{
|
{
|
||||||
CurrentJoyConLayout.Right.StickUp = (int)pressedKey;
|
CurrentJoyConLayout.Right.StickUp = (int)pressedKey;
|
||||||
|
|
||||||
Toggles[4] = false;
|
Toggles[4] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,11 +209,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("Down");
|
ImGui.Text("Down");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.StickDown).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.StickDown).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[5] = true;
|
Toggles[5] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[5])
|
if (Toggles[5])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -202,11 +228,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("Left");
|
ImGui.Text("Left");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.StickLeft).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.StickLeft).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[6] = true;
|
Toggles[6] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[6])
|
if (Toggles[6])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -220,11 +248,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("Right");
|
ImGui.Text("Right");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.StickRight).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.StickRight).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[7] = true;
|
Toggles[7] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[7])
|
if (Toggles[7])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -246,11 +276,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("Up");
|
ImGui.Text("Up");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.DPadUp).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.DPadUp).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[8] = true;
|
Toggles[8] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[8])
|
if (Toggles[8])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -264,11 +296,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("Down");
|
ImGui.Text("Down");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.DPadDown).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.DPadDown).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[9] = true;
|
Toggles[9] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[9])
|
if (Toggles[9])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -281,11 +315,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("Left");
|
ImGui.Text("Left");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.DPadLeft).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.DPadLeft).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[10] = true;
|
Toggles[10] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[10])
|
if (Toggles[10])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -299,11 +335,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("Right");
|
ImGui.Text("Right");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.DPadRight).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.DPadRight).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[11] = true;
|
Toggles[11] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[11])
|
if (Toggles[11])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -325,11 +363,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("A");
|
ImGui.Text("A");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.ButtonA).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.ButtonA).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[12] = true;
|
Toggles[12] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[12])
|
if (Toggles[12])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -343,11 +383,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("B");
|
ImGui.Text("B");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.ButtonB).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.ButtonB).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[13] = true;
|
Toggles[13] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[13])
|
if (Toggles[13])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -360,11 +402,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("X");
|
ImGui.Text("X");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.ButtonX).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.ButtonX).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[14] = true;
|
Toggles[14] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[14])
|
if (Toggles[14])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -378,11 +422,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("Y");
|
ImGui.Text("Y");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.ButtonY).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.ButtonY).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[15] = true;
|
Toggles[15] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[15])
|
if (Toggles[15])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -391,6 +437,7 @@ namespace Ryujinx.UI.Widgets
|
||||||
Toggles[15] = false;
|
Toggles[15] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
@ -405,11 +452,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("L");
|
ImGui.Text("L");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.ButtonL).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.ButtonL).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[17] = true;
|
Toggles[17] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[17])
|
if (Toggles[17])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -418,16 +467,19 @@ namespace Ryujinx.UI.Widgets
|
||||||
Toggles[17] = false;
|
Toggles[17] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiNative.igEndGroup();
|
ImGuiNative.igEndGroup();
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("R");
|
ImGui.Text("R");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.ButtonR).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.ButtonR).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[16] = true;
|
Toggles[16] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[16])
|
if (Toggles[16])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -440,11 +492,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("ZL");
|
ImGui.Text("ZL");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.ButtonZL).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.ButtonZL).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[19] = true;
|
Toggles[19] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[19])
|
if (Toggles[19])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -458,11 +512,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("ZR");
|
ImGui.Text("ZR");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.ButtonZR).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.ButtonZR).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[18] = true;
|
Toggles[18] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[18])
|
if (Toggles[18])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -481,13 +537,16 @@ 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("-");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.ButtonMinus).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Left.ButtonMinus).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[20] = true;
|
Toggles[20] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[20])
|
if (Toggles[20])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -500,11 +559,13 @@ namespace Ryujinx.UI.Widgets
|
||||||
|
|
||||||
ImGuiNative.igBeginGroup();
|
ImGuiNative.igBeginGroup();
|
||||||
ImGui.Text("+");
|
ImGui.Text("+");
|
||||||
|
|
||||||
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.ButtonPlus).ToString(),
|
if (ImGui.Button(((Key)CurrentJoyConLayout.Right.ButtonPlus).ToString(),
|
||||||
new Vector2(ContentWidth, 50)))
|
new Vector2(ContentWidth, 50)))
|
||||||
{
|
{
|
||||||
Toggles[21] = true;
|
Toggles[21] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Toggles[21])
|
if (Toggles[21])
|
||||||
{
|
{
|
||||||
if (GetKey(ref pressedKey))
|
if (GetKey(ref pressedKey))
|
||||||
|
@ -521,11 +582,11 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using ImGuiNET;
|
||||||
using ImGuiNET;
|
|
||||||
namespace Ryujinx.UI
|
namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
partial class EmulationWindow
|
partial class EmulationWindow
|
||||||
|
@ -8,6 +7,7 @@ namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
ImGui.SetNextWindowPos(System.Numerics.Vector2.Zero, Condition.Always,
|
ImGui.SetNextWindowPos(System.Numerics.Vector2.Zero, Condition.Always,
|
||||||
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))
|
||||||
|
@ -51,13 +51,14 @@ namespace Ryujinx.UI
|
||||||
Values.ButtonHeight)))
|
Values.ButtonHeight)))
|
||||||
{
|
{
|
||||||
ShowPauseUI = false;
|
ShowPauseUI = false;
|
||||||
EmulationController.Resume();
|
|
||||||
EmulationController.ShutDown();
|
EmulationController.ShutDown();
|
||||||
ShowMainUI = true;
|
ShowMainUI = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Page.Configuration:
|
case Page.Configuration:
|
||||||
Widgets.ConfigurationWidget.Draw();
|
Widgets.ConfigurationWidget.Draw();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ImGui.EndChildFrame();
|
ImGui.EndChildFrame();
|
||||||
|
|
|
@ -1,39 +1,46 @@
|
||||||
using System;
|
using ImGuiNET;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Input;
|
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using OpenTK.Graphics.OpenGL;
|
using OpenTK.Graphics.OpenGL;
|
||||||
using ImGuiNET;
|
using OpenTK.Input;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.UI
|
namespace Ryujinx.UI
|
||||||
{
|
{
|
||||||
class WindowHelper : GameWindow
|
class WindowHelper : GameWindow
|
||||||
{
|
{
|
||||||
protected float _deltaTime;
|
protected float DeltaTime;
|
||||||
bool IsWindowOpened = false;
|
|
||||||
int s_fontTexture;
|
|
||||||
float _wheelPosition;
|
|
||||||
protected GraphicsContext MainContext;
|
protected GraphicsContext MainContext;
|
||||||
protected GraphicsContext UIContext;
|
protected GraphicsContext UIContext;
|
||||||
protected bool UIActive;
|
protected bool UIActive;
|
||||||
|
|
||||||
public WindowHelper(string title) : base(1280, 720, GraphicsMode.Default, title, GameWindowFlags.Default
|
private bool IsWindowOpened = false;
|
||||||
|
private int FontTexture;
|
||||||
|
private float WheelPosition;
|
||||||
|
|
||||||
|
protected KeyboardState? Keyboard = null;
|
||||||
|
|
||||||
|
protected MouseState? Mouse = null;
|
||||||
|
|
||||||
|
public WindowHelper(string Title) : base(1280, 720, GraphicsMode.Default, Title, GameWindowFlags.Default
|
||||||
, DisplayDevice.Default, 3, 3, GraphicsContextFlags.ForwardCompatible)
|
, DisplayDevice.Default, 3, 3, GraphicsContextFlags.ForwardCompatible)
|
||||||
{
|
{
|
||||||
Title = title;
|
base.Title = Title;
|
||||||
|
|
||||||
IsWindowOpened = true;
|
IsWindowOpened = true;
|
||||||
|
|
||||||
Location = new Point(
|
Location = new Point(
|
||||||
(DisplayDevice.Default.Width / 2) - (Width / 2),
|
(DisplayDevice.Default.Width / 2) - (Width / 2),
|
||||||
(DisplayDevice.Default.Height / 2) - (Height / 2));
|
(DisplayDevice.Default.Height / 2) - (Height / 2));
|
||||||
|
|
||||||
MainContext = (GraphicsContext)Context;
|
MainContext = new GraphicsContext(GraphicsMode.Default,
|
||||||
|
WindowInfo, 3, 3, GraphicsContextFlags.ForwardCompatible);
|
||||||
|
|
||||||
UIContext = new GraphicsContext(GraphicsMode.Default,
|
UIContext = new GraphicsContext(GraphicsMode.Default,
|
||||||
WindowInfo,4,5,GraphicsContextFlags.ForwardCompatible);
|
WindowInfo, 3, 3, GraphicsContextFlags.ForwardCompatible);
|
||||||
|
|
||||||
UIContext.MakeCurrent(WindowInfo);
|
UIContext.MakeCurrent(WindowInfo);
|
||||||
|
|
||||||
UIActive = true;
|
UIActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,35 +52,39 @@ namespace Ryujinx.UI
|
||||||
public void StartFrame()
|
public void StartFrame()
|
||||||
{
|
{
|
||||||
UIContext.MakeCurrent(WindowInfo);
|
UIContext.MakeCurrent(WindowInfo);
|
||||||
IO io = ImGui.GetIO();
|
|
||||||
io.DisplaySize = new System.Numerics.Vector2(Width, Height);
|
IO IO = ImGui.GetIO();
|
||||||
io.DisplayFramebufferScale = new System.Numerics.Vector2(Values.CurrentWindowScale);
|
IO.DisplaySize = new System.Numerics.Vector2(Width, Height);
|
||||||
io.DeltaTime = _deltaTime;
|
IO.DisplayFramebufferScale = new System.Numerics.Vector2(Values.CurrentWindowScale);
|
||||||
|
IO.DeltaTime = DeltaTime;
|
||||||
|
|
||||||
ImGui.NewFrame();
|
ImGui.NewFrame();
|
||||||
HandleInput(io);
|
|
||||||
|
HandleInput(IO);
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe void EndFrame()
|
public unsafe void EndFrame()
|
||||||
{
|
{
|
||||||
ImGui.Render();
|
ImGui.Render();
|
||||||
|
|
||||||
DrawData* data = ImGui.GetDrawData();
|
DrawData* data = ImGui.GetDrawData();
|
||||||
RenderImDrawData(data);
|
RenderImDrawData(data);
|
||||||
|
|
||||||
MainContext.MakeCurrent(WindowInfo);
|
MainContext?.MakeCurrent(WindowInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected unsafe void PrepareTexture()
|
protected unsafe void PrepareTexture()
|
||||||
{
|
{
|
||||||
ImGui.GetIO().FontAtlas.AddDefaultFont();
|
ImGui.GetIO().FontAtlas.AddDefaultFont();
|
||||||
|
|
||||||
IO io = ImGui.GetIO();
|
IO IO = ImGui.GetIO();
|
||||||
|
|
||||||
// Build texture atlas
|
// Build texture atlas
|
||||||
FontTextureData texData = io.FontAtlas.GetTexDataAsAlpha8();
|
FontTextureData texData = IO.FontAtlas.GetTexDataAsAlpha8();
|
||||||
|
|
||||||
// Create OpenGL texture
|
// Create OpenGL texture
|
||||||
s_fontTexture = GL.GenTexture();
|
FontTexture = GL.GenTexture();
|
||||||
GL.BindTexture(TextureTarget.Texture2D, s_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(
|
||||||
|
@ -88,11 +99,11 @@ namespace Ryujinx.UI
|
||||||
new IntPtr(texData.Pixels));
|
new IntPtr(texData.Pixels));
|
||||||
|
|
||||||
// Store the texture identifier in the ImFontAtlas substructure.
|
// Store the texture identifier in the ImFontAtlas substructure.
|
||||||
io.FontAtlas.SetTexID(s_fontTexture);
|
IO.FontAtlas.SetTexID(FontTexture);
|
||||||
|
|
||||||
// Cleanup (don't clear the input data if you want to append new fonts later)
|
// Cleanup (don't clear the input data if you want to append new fonts later)
|
||||||
//io.Fonts->ClearInputData();
|
//io.Fonts->ClearInputData();
|
||||||
io.FontAtlas.ClearTexData();
|
IO.FontAtlas.ClearTexData();
|
||||||
GL.BindTexture(TextureTarget.Texture2D, 0);
|
GL.BindTexture(TextureTarget.Texture2D, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,69 +112,79 @@ namespace Ryujinx.UI
|
||||||
PrepareTexture();
|
PrepareTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe void HandleInput(IO io)
|
unsafe void HandleInput(IO IO)
|
||||||
{
|
{
|
||||||
MouseState cursorState = Mouse.GetCursorState();
|
KeyboardState KeyboardState = default(KeyboardState);
|
||||||
MouseState mouseState = Mouse.GetState();
|
if (Keyboard != null)
|
||||||
|
if (Keyboard.HasValue)
|
||||||
|
KeyboardState = Keyboard.Value;
|
||||||
|
|
||||||
|
MouseState MouseState = default(MouseState);
|
||||||
|
if (Mouse != null)
|
||||||
|
if (Mouse.HasValue)
|
||||||
|
MouseState = Mouse.Value;
|
||||||
|
|
||||||
if (Focused)
|
if (Focused)
|
||||||
{
|
{
|
||||||
Point windowPoint = PointToClient(new Point(cursorState.X, cursorState.Y));
|
if (Mouse.HasValue)
|
||||||
io.MousePosition = new System.Numerics.Vector2(windowPoint.X / io.DisplayFramebufferScale.X,
|
|
||||||
windowPoint.Y / io.DisplayFramebufferScale.Y);
|
|
||||||
|
|
||||||
foreach (Key key in Enum.GetValues(typeof(Key)))
|
|
||||||
{
|
{
|
||||||
io.KeysDown[(int)key] = Keyboard[key];
|
Point WindowPoint = new Point(MouseState.X, MouseState.Y);
|
||||||
if (Keyboard[key])
|
IO.MousePosition = new System.Numerics.Vector2(WindowPoint.X,
|
||||||
|
WindowPoint.Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.Keyboard.HasValue)
|
||||||
|
foreach (Key Key in Enum.GetValues(typeof(Key)))
|
||||||
|
{
|
||||||
|
IO.KeysDown[(int)Key] = KeyboardState[Key];
|
||||||
|
|
||||||
|
if (KeyboardState[Key])
|
||||||
continue;
|
continue;
|
||||||
ImGuiNative.igGetIO()->KeyAlt = (byte)((Keyboard[Key.AltLeft]
|
ImGuiNative.igGetIO()->KeyAlt = (byte)((KeyboardState[Key.AltLeft]
|
||||||
|| Keyboard[Key.AltRight]) ? 1 : 0);
|
|| KeyboardState[Key.AltRight]) ? 1 : 0);
|
||||||
ImGuiNative.igGetIO()->KeyCtrl = (byte)((Keyboard[Key.ControlLeft]
|
ImGuiNative.igGetIO()->KeyCtrl = (byte)((KeyboardState[Key.ControlLeft]
|
||||||
|| Keyboard[Key.ControlRight]) ? 1 : 0);
|
|| KeyboardState[Key.ControlRight]) ? 1 : 0);
|
||||||
ImGuiNative.igGetIO()->KeyShift = (byte)((Keyboard[Key.ShiftLeft]
|
ImGuiNative.igGetIO()->KeyShift = (byte)((KeyboardState[Key.ShiftLeft]
|
||||||
|| Keyboard[Key.ShiftRight]) ? 1 : 0);
|
|| KeyboardState[Key.ShiftRight]) ? 1 : 0);
|
||||||
ImGuiNative.igGetIO()->KeySuper = (byte)((Keyboard[Key.WinLeft]
|
ImGuiNative.igGetIO()->KeySuper = (byte)((KeyboardState[Key.WinLeft]
|
||||||
|| Keyboard[Key.WinRight]) ? 1 : 0);
|
|| KeyboardState[Key.WinRight]) ? 1 : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
io.MouseDown[0] = mouseState.LeftButton == ButtonState.Pressed;
|
if (Mouse.HasValue)
|
||||||
io.MouseDown[1] = mouseState.RightButton == ButtonState.Pressed;
|
|
||||||
io.MouseDown[2] = mouseState.MiddleButton == ButtonState.Pressed;
|
|
||||||
|
|
||||||
float newWheelPos = mouseState.WheelPrecise;
|
|
||||||
float delta = newWheelPos - _wheelPosition;
|
|
||||||
_wheelPosition = newWheelPos;
|
|
||||||
io.MouseWheel = delta;
|
|
||||||
}
|
|
||||||
|
|
||||||
private unsafe void RenderImDrawData(DrawData* draw_data)
|
|
||||||
{
|
{
|
||||||
// Rendering
|
IO.MouseDown[0] = MouseState.LeftButton == ButtonState.Pressed;
|
||||||
int display_w, display_h;
|
IO.MouseDown[1] = MouseState.RightButton == ButtonState.Pressed;
|
||||||
display_w = Width;
|
IO.MouseDown[2] = MouseState.MiddleButton == ButtonState.Pressed;
|
||||||
display_h = Height;
|
|
||||||
|
|
||||||
Vector4 clear_color = new Vector4(114f / 255f, 144f / 255f, 154f / 255f, 1.0f);
|
float NewWheelPos = MouseState.WheelPrecise;
|
||||||
GL.Viewport(0, 0, display_w, display_h);
|
float Delta = NewWheelPos - WheelPosition;
|
||||||
GL.ClearColor(clear_color.X, clear_color.Y, clear_color.Z, clear_color.W);
|
WheelPosition = NewWheelPos;
|
||||||
|
IO.MouseWheel = Delta;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private unsafe void RenderImDrawData(DrawData* DrawData)
|
||||||
|
{
|
||||||
|
Vector4 ClearColor = new Vector4(114f / 255f, 144f / 255f, 154f / 255f, 1.0f);
|
||||||
|
GL.Viewport(0, 0, Width, Height);
|
||||||
|
GL.ClearColor(ClearColor.X, ClearColor.Y, ClearColor.Z, ClearColor.W);
|
||||||
GL.Clear(ClearBufferMask.ColorBufferBit);
|
GL.Clear(ClearBufferMask.ColorBufferBit);
|
||||||
|
|
||||||
// We are using the OpenGL fixed pipeline to make the example code simpler to read!
|
// We are using the OpenGL fixed pipeline to make the example code simpler to read!
|
||||||
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, vertex/texcoord/color pointers.
|
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled, vertex/texcoord/color pointers.
|
||||||
int last_texture;
|
GL.GetInteger(GetPName.TextureBinding2D, out int last_texture);
|
||||||
GL.GetInteger(GetPName.TextureBinding2D, out 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(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.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);
|
||||||
|
@ -175,8 +196,8 @@ namespace Ryujinx.UI
|
||||||
GL.UseProgram(0);
|
GL.UseProgram(0);
|
||||||
|
|
||||||
// Handle cases of screen coordinates != from framebuffer coordinates (e.g. retina displays)
|
// Handle cases of screen coordinates != from framebuffer coordinates (e.g. retina displays)
|
||||||
IO io = ImGui.GetIO();
|
IO IO = ImGui.GetIO();
|
||||||
ImGui.ScaleClipRects(draw_data, io.DisplayFramebufferScale);
|
ImGui.ScaleClipRects(DrawData, IO.DisplayFramebufferScale);
|
||||||
|
|
||||||
// Setup orthographic projection matrix
|
// Setup orthographic projection matrix
|
||||||
GL.MatrixMode(MatrixMode.Projection);
|
GL.MatrixMode(MatrixMode.Projection);
|
||||||
|
@ -184,8 +205,8 @@ namespace Ryujinx.UI
|
||||||
GL.LoadIdentity();
|
GL.LoadIdentity();
|
||||||
GL.Ortho(
|
GL.Ortho(
|
||||||
0.0f,
|
0.0f,
|
||||||
io.DisplaySize.X / io.DisplayFramebufferScale.X,
|
IO.DisplaySize.X / IO.DisplayFramebufferScale.X,
|
||||||
io.DisplaySize.Y / io.DisplayFramebufferScale.Y,
|
IO.DisplaySize.Y / IO.DisplayFramebufferScale.Y,
|
||||||
0.0f,
|
0.0f,
|
||||||
-1.0f,
|
-1.0f,
|
||||||
1.0f);
|
1.0f);
|
||||||
|
@ -194,40 +215,37 @@ namespace Ryujinx.UI
|
||||||
GL.LoadIdentity();
|
GL.LoadIdentity();
|
||||||
|
|
||||||
// Render command lists
|
// Render command lists
|
||||||
for (int n = 0; n < draw_data->CmdListsCount; n++)
|
for (int n = 0; n < DrawData->CmdListsCount; n++)
|
||||||
{
|
{
|
||||||
NativeDrawList* cmd_list = draw_data->CmdLists[n];
|
NativeDrawList* CmdList = DrawData->CmdLists[n];
|
||||||
byte* vtx_buffer = (byte*)cmd_list->VtxBuffer.Data;
|
byte* VtxBuffer = (byte*)CmdList->VtxBuffer.Data;
|
||||||
ushort* idx_buffer = (ushort*)cmd_list->IdxBuffer.Data;
|
ushort* IdxBuffer = (ushort*)CmdList->IdxBuffer.Data;
|
||||||
|
|
||||||
DrawVert vert0 = *((DrawVert*)vtx_buffer);
|
GL.VertexPointer(2, VertexPointerType.Float, sizeof(DrawVert), new IntPtr(VtxBuffer + DrawVert.PosOffset));
|
||||||
DrawVert vert1 = *(((DrawVert*)vtx_buffer) + 1);
|
GL.TexCoordPointer(2, TexCoordPointerType.Float, sizeof(DrawVert), new IntPtr(VtxBuffer + DrawVert.UVOffset));
|
||||||
DrawVert vert2 = *(((DrawVert*)vtx_buffer) + 2);
|
GL.ColorPointer(4, ColorPointerType.UnsignedByte, sizeof(DrawVert), new IntPtr(VtxBuffer + DrawVert.ColOffset));
|
||||||
|
|
||||||
GL.VertexPointer(2, VertexPointerType.Float, sizeof(DrawVert), new IntPtr(vtx_buffer + DrawVert.PosOffset));
|
for (int Cmd = 0; Cmd < CmdList->CmdBuffer.Size; Cmd++)
|
||||||
GL.TexCoordPointer(2, TexCoordPointerType.Float, sizeof(DrawVert), new IntPtr(vtx_buffer + DrawVert.UVOffset));
|
|
||||||
GL.ColorPointer(4, ColorPointerType.UnsignedByte, sizeof(DrawVert), new IntPtr(vtx_buffer + DrawVert.ColOffset));
|
|
||||||
|
|
||||||
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
|
|
||||||
{
|
{
|
||||||
DrawCmd* pcmd = &(((DrawCmd*)cmd_list->CmdBuffer.Data)[cmd_i]);
|
DrawCmd* PCmd = &(((DrawCmd*)CmdList->CmdBuffer.Data)[Cmd]);
|
||||||
if (pcmd->UserCallback != IntPtr.Zero)
|
if (PCmd->UserCallback != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
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++) { indices[i] = idx_buffer[i]; }
|
for (int i = 0; i < indices.Length; i++)
|
||||||
GL.DrawElements(PrimitiveType.Triangles, (int)pcmd->ElemCount, DrawElementsType.UnsignedShort, new IntPtr(idx_buffer));
|
indices[i] = IdxBuffer[i];
|
||||||
|
GL.DrawElements(PrimitiveType.Triangles, (int)PCmd->ElemCount, DrawElementsType.UnsignedShort, new IntPtr(IdxBuffer));
|
||||||
}
|
}
|
||||||
idx_buffer += pcmd->ElemCount;
|
IdxBuffer += PCmd->ElemCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,5 +262,30 @@ namespace Ryujinx.UI
|
||||||
|
|
||||||
SwapBuffers();
|
SwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnKeyDown(KeyboardKeyEventArgs e)
|
||||||
|
{
|
||||||
|
Keyboard = e.Keyboard;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnKeyUp(KeyboardKeyEventArgs e)
|
||||||
|
{
|
||||||
|
Keyboard = e.Keyboard;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnMouseDown(MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
Mouse = e.Mouse;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnMouseUp(MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
Mouse = e.Mouse;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnMouseMove(MouseMoveEventArgs e)
|
||||||
|
{
|
||||||
|
Mouse = e.Mouse;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ 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.Run(60.0, 60.0);
|
||||||
|
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ImGui.NET" Version="0.4.5" />
|
<PackageReference Include="ImGui.NET" Version="0.4.5" />
|
||||||
<PackageReference Include="OpenTK.NETCore" Version="1.1.2749.6433" />
|
<PackageReference Include="OpenTK.NetStandard" Version="1.0.4" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="4.5.0" />
|
<PackageReference Include="System.Drawing.Common" Version="4.5.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"profiles": {
|
|
||||||
"Ryujinx": {
|
|
||||||
"commandName": "Project",
|
|
||||||
"commandLineArgs": "\"C:\\Users\\Emmanuel Hansen\\AppData\\Roaming\\RyuFs\\sdmc\\switch\\fruity\\fruity.nro\""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue