addressed comments

This commit is contained in:
emmaus 2018-06-29 21:04:49 +00:00
commit 7404d09c2c
13 changed files with 48 additions and 59 deletions

View file

@ -22,7 +22,7 @@ namespace ChocolArm64
public bool EnableCpuTrace { get; set; } public bool EnableCpuTrace { get; set; }
public static ManualResetEvent PauseResetEvent = new ManualResetEvent(true); private ManualResetEvent PauseResetEvent = new ManualResetEvent(true);
public ATranslator(IReadOnlyDictionary<long, string> SymbolTable = null) public ATranslator(IReadOnlyDictionary<long, string> SymbolTable = null)
{ {
@ -64,7 +64,7 @@ namespace ChocolArm64
OpCode.Interpreter(State, Memory, OpCode); OpCode.Interpreter(State, Memory, OpCode);
PauseResetEvent.WaitOne(1000); PauseResetEvent.WaitOne();
} }
while (State.R15 != 0 && State.Running); while (State.R15 != 0 && State.Running);
} }
@ -209,5 +209,15 @@ namespace ChocolArm64
} }
} }
} }
public void Pause()
{
PauseResetEvent.Reset();
}
public void Resume()
{
PauseResetEvent.Set();
}
} }
} }

View file

@ -2,7 +2,7 @@ using System;
namespace Ryujinx.Graphics.Gal namespace Ryujinx.Graphics.Gal
{ {
public unsafe interface IGalRenderer : IDisposable public interface IGalRenderer : IDisposable
{ {
void QueueAction(Action ActionMthd); void QueueAction(Action ActionMthd);

View file

@ -23,7 +23,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
} }
} }
public class FrameBuffer private class FrameBuffer
{ {
public int Width { get; set; } public int Width { get; set; }
public int Height { get; set; } public int Height { get; set; }

View file

@ -1,7 +1,4 @@
using System;
using System.Drawing;
using System.IO; using System.IO;
using System.Text;
namespace Ryujinx.HLE.Loaders.Executables namespace Ryujinx.HLE.Loaders.Executables
{ {
@ -43,12 +40,12 @@ namespace Ryujinx.HLE.Loaders.Executables
int DataSize = Reader.ReadInt32(); int DataSize = Reader.ReadInt32();
int BssSize = Reader.ReadInt32(); int BssSize = Reader.ReadInt32();
this.Mod0Offset = Mod0Offset; this.Mod0Offset = Mod0Offset;
this.TextOffset = TextOffset; this.TextOffset = TextOffset;
this.ROOffset = ROOffset; this.ROOffset = ROOffset;
this.DataOffset = DataOffset; this.DataOffset = DataOffset;
this.BssSize = BssSize; this.BssSize = BssSize;
this.FileSize = FileSize; this.FileSize = FileSize;
byte[] Read(long Position, int Size) byte[] Read(long Position, int Size)
{ {

View file

@ -195,15 +195,7 @@ namespace Ryujinx.HLE.OsHle
if (Processes.TryRemove(ProcessId, out Process)) if (Processes.TryRemove(ProcessId, out Process))
{ {
try Process.StopAllThreadsAsync();
{
Process.StopAllThreadsAsync();
Process.Dispose();
}
catch (ObjectDisposedException Ex)
{
}
if (Processes.Count == 0) if (Processes.Count == 0)
{ {

View file

@ -176,7 +176,7 @@ namespace Ryujinx.HLE.OsHle
throw new ObjectDisposedException(nameof(Process)); throw new ObjectDisposedException(nameof(Process));
} }
ATranslator.PauseResetEvent.Reset(); Translator.Pause();
} }
public void Resume() public void Resume()
@ -186,7 +186,7 @@ namespace Ryujinx.HLE.OsHle
throw new ObjectDisposedException(nameof(Process)); throw new ObjectDisposedException(nameof(Process));
} }
ATranslator.PauseResetEvent.Set(); Translator.Resume();
} }
private void MapRWMemRegion(long Position, long Size, MemoryType Type) private void MapRWMemRegion(long Position, long Size, MemoryType Type)
@ -198,7 +198,7 @@ namespace Ryujinx.HLE.OsHle
{ {
if (Disposed) if (Disposed)
{ {
throw new ObjectDisposedException(nameof(Process)); return;
} }
if (MainThread != null) if (MainThread != null)
@ -423,7 +423,7 @@ namespace Ryujinx.HLE.OsHle
{ {
if (Disposing && !Disposed) if (Disposing && !Disposed)
{ {
ATranslator.PauseResetEvent.Set(); Translator.Resume();
//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

View file

@ -19,22 +19,21 @@ namespace Ryujinx.UI
public void Resume() public void Resume()
{ {
lock (Ns) Ns.Os.ResumeAllProcesses();
Ns.Os.ResumeAllProcesses();
} }
public void Pause() public void Pause()
{ {
lock (Ns) Ns.Os.PauseAllProcesses();
Ns.Os.PauseAllProcesses();
} }
public void ShutDown() public void ShutDown()
{ {
lock (Ns) Ns.Dispose();
Ns.Dispose();
Ns = null; Ns = null;
IsLoaded = false; IsLoaded = false;
IsShutDown.Invoke(null,null); IsShutDown.Invoke(null,null);
} }

View file

@ -45,10 +45,9 @@ namespace Ryujinx.UI
} }
} }
public struct LanguageEntry public struct LanguageEntry
{ {
public string AplicationName; public string AplicationName;
public string DeveloperName; public string DeveloperName;
} }
} }

View file

@ -15,7 +15,6 @@ namespace Ryujinx.UI
public ControlArchive ControlArchive { get; set; } public ControlArchive ControlArchive { 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);

View file

@ -5,10 +5,8 @@ using System.Numerics;
namespace ImGuiNET namespace ImGuiNET
{ {
/// <summary> // Adapted from Mellinoe's file picker for imgui
/// Adapted from Mellinoe's file picker for imgui // https://github.com/mellinoe/synthapp/blob/master/src/synthapp/Widgets/FilePicker.cs
/// https://github.com/mellinoe/synthapp/blob/master/src/synthapp/Widgets/FilePicker.cs
/// </summary>
public class FilePicker public class FilePicker
{ {
private const string FilePickerID = "###FilePicker"; private const string FilePickerID = "###FilePicker";

View file

@ -61,7 +61,7 @@ namespace Ryujinx.UI.Widgets
} }
} }
public unsafe static Tuple<bool,string> DrawList() public unsafe static (bool,string) DrawList()
{ {
uint id = 100; uint id = 100;
@ -131,7 +131,7 @@ namespace Ryujinx.UI.Widgets
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); return (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))
{ {
@ -145,7 +145,7 @@ namespace Ryujinx.UI.Widgets
ImGui.EndChildFrame(); ImGui.EndChildFrame();
} }
return new Tuple<bool, string>(false,string.Empty); return (false, string.Empty);
} }
} }
@ -174,15 +174,11 @@ namespace Ryujinx.UI.Widgets
} }
else else
AppletType = AppletType.Cartridge; AppletType = AppletType.Cartridge;
} }
public byte[] GetIconData() public byte[] GetIconData()
{ {
if (IsNro) return IsNro ? Nro.IconData : null;
{
return Nro.IconData;
}
else return null;
} }
} }

View file

@ -1,5 +1,6 @@
using ImGuiNET; using ImGuiNET;
using System; using System;
using System.Numerics;
namespace Ryujinx.UI namespace Ryujinx.UI
{ {
@ -7,30 +8,30 @@ namespace Ryujinx.UI
{ {
void RenderMainUI() void RenderMainUI()
{ {
ImGui.SetNextWindowPos(System.Numerics.Vector2.Zero, Condition.Always, ImGui.SetNextWindowPos(Vector2.Zero, Condition.Always,
System.Numerics.Vector2.Zero); Vector2.Zero);
ImGui.SetNextWindowSize(new System.Numerics.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))
{ {
if (ImGui.BeginChildFrame(0, new System.Numerics.Vector2(-1, -1), if (ImGui.BeginChildFrame(0, new Vector2(-1, -1),
WindowFlags.AlwaysAutoResize)) WindowFlags.AlwaysAutoResize))
{ {
ImGuiNative.igBeginGroup(); ImGuiNative.igBeginGroup();
if (ImGui.Button("Load Package", new System.Numerics.Vector2(Values.ButtonWidth, if (ImGui.Button("Load Package", new Vector2(Values.ButtonWidth,
Values.ButtonHeight))) Values.ButtonHeight)))
{ {
CurrentPage = Page.PackageLoader; CurrentPage = Page.PackageLoader;
} }
if (ImGui.Button("Game List", new System.Numerics.Vector2(Values.ButtonWidth, if (ImGui.Button("Game List", new Vector2(Values.ButtonWidth,
Values.ButtonHeight))) Values.ButtonHeight)))
{ {
CurrentPage = Page.GameList; CurrentPage = Page.GameList;
} }
if (ImGui.Button("Settings", new System.Numerics.Vector2(Values.ButtonWidth, if (ImGui.Button("Settings", new Vector2(Values.ButtonWidth,
Values.ButtonHeight))) Values.ButtonHeight)))
{ {
CurrentPage = Page.Configuration; CurrentPage = Page.Configuration;
@ -78,7 +79,7 @@ namespace Ryujinx.UI
void DrawQuitButton() void DrawQuitButton()
{ {
if (ImGui.Button("Quit Ryujinx", new System.Numerics.Vector2(Values.ButtonWidth, if (ImGui.Button("Quit Ryujinx", new Vector2(Values.ButtonWidth,
Values.ButtonHeight))) Values.ButtonHeight)))
{ {
ImGui.OpenPopup("Quit"); ImGui.OpenPopup("Quit");

View file

@ -179,8 +179,6 @@ namespace Ryujinx.UI
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);
// 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.
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);