remove some render off logic (this might not be sync safe), move threaded rendering to a sync setting (this probably doesn't affect sync, but best be safe here)

This commit is contained in:
CasualPokePlayer 2022-04-07 16:51:51 -07:00
parent 93dadb021f
commit c496c97c8f
2 changed files with 8 additions and 13 deletions

View File

@ -32,11 +32,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
public class NDSSettings
{
[DisplayName("Threaded 3D Rendering")]
[Description("Offloads 3D rendering to a separate thread")]
[DefaultValue(true)]
public bool ThreadedRendering { get; set; }
[DisplayName("Screen Layout")]
[Description("Adjusts the layout of the screens")]
[DefaultValue(ScreenLayoutKind.Vertical)]
@ -95,6 +90,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
public class NDSSyncSettings
{
[DisplayName("Threaded 3D Rendering")]
[Description("Offloads 3D rendering to a separate thread")]
[DefaultValue(true)]
public bool ThreadedRendering { get; set; }
[JsonIgnore]
private DateTime _initaltime;

View File

@ -327,7 +327,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
protected override LibWaterboxCore.FrameInfo FrameAdvancePrep(IController controller, bool render, bool rendersound)
{
_render = render;
_core.SetTraceCallback(Tracer.IsEnabled() ? _tracecb : null);
return new LibMelonDS.FrameInfo
{
@ -344,19 +343,15 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
private readonly Action _frameThreadStart;
private readonly LibMelonDS.ThreadStartCallback _threadstartcb;
private bool _render;
private Task _frameThreadProcActive;
private void ThreadStartCallback()
{
if (_render)
if (_frameThreadProcActive != null)
{
if (_frameThreadProcActive != null)
{
throw new InvalidOperationException("Attempted to start render thread twice");
}
_frameThreadProcActive = Task.Run(_frameThreadStart);
throw new InvalidOperationException("Attempted to start render thread twice");
}
_frameThreadProcActive = Task.Run(_frameThreadStart);
}
protected override void FrameAdvancePost()