From 9261ec6bc858948c7ba73e1ff1301e19623be933 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sat, 25 Apr 2020 10:56:56 -0300 Subject: Fix MME shadow RAM implementation (#1051) --- Ryujinx.Graphics.Gpu/MacroInterpreter.cs | 34 ++++++++++---------------------- 1 file changed, 10 insertions(+), 24 deletions(-) (limited to 'Ryujinx.Graphics.Gpu/MacroInterpreter.cs') diff --git a/Ryujinx.Graphics.Gpu/MacroInterpreter.cs b/Ryujinx.Graphics.Gpu/MacroInterpreter.cs index fa8a4a48..8d2d6202 100644 --- a/Ryujinx.Graphics.Gpu/MacroInterpreter.cs +++ b/Ryujinx.Graphics.Gpu/MacroInterpreter.cs @@ -82,8 +82,7 @@ namespace Ryujinx.Graphics.Gpu /// Optional argument passed to the program, 0 if not used /// Shadow RAM control register value /// Current GPU state - /// Shadow GPU state - public void Execute(int[] mme, int position, int param, ShadowRamControl shadowCtrl, GpuState state, GpuState shadowState) + public void Execute(int[] mme, int position, int param, ShadowRamControl shadowCtrl, GpuState state) { Reset(); @@ -95,11 +94,11 @@ namespace Ryujinx.Graphics.Gpu FetchOpCode(mme); - while (Step(mme, state, shadowState)); + while (Step(mme, state)); // Due to the delay slot, we still need to execute // one more instruction before we actually exit. - Step(mme, state, shadowState); + Step(mme, state); } /// @@ -124,9 +123,8 @@ namespace Ryujinx.Graphics.Gpu /// /// Program code to execute /// Current GPU state - /// Shadow GPU state /// True to continue execution, false if the program exited - private bool Step(int[] mme, GpuState state, GpuState shadowState) + private bool Step(int[] mme, GpuState state) { int baseAddr = _pc - 1; @@ -172,7 +170,7 @@ namespace Ryujinx.Graphics.Gpu { SetDstGpr(FetchParam()); - Send(state, shadowState, result); + Send(state, result); break; } @@ -182,7 +180,7 @@ namespace Ryujinx.Graphics.Gpu { SetDstGpr(result); - Send(state, shadowState, result); + Send(state, result); break; } @@ -204,7 +202,7 @@ namespace Ryujinx.Graphics.Gpu SetMethAddr(result); - Send(state, shadowState, FetchParam()); + Send(state, FetchParam()); break; } @@ -216,7 +214,7 @@ namespace Ryujinx.Graphics.Gpu SetMethAddr(result); - Send(state, shadowState,(result >> 12) & 0x3f); + Send(state, (result >> 12) & 0x3f); break; } @@ -489,24 +487,12 @@ namespace Ryujinx.Graphics.Gpu /// Performs a GPU method call. /// /// Current GPU state - /// Shadow GPU state /// Call argument - private void Send(GpuState state, GpuState shadowState, int value) + private void Send(GpuState state, int value) { - // TODO: Figure out what TrackWithFilter does, compared to Track. - if (_shadowCtrl == ShadowRamControl.Track || - _shadowCtrl == ShadowRamControl.TrackWithFilter) - { - shadowState.Write(_methAddr, value); - } - else if (_shadowCtrl == ShadowRamControl.Replay) - { - value = shadowState.Read(_methAddr); - } - MethodParams meth = new MethodParams(_methAddr, value); - state.CallMethod(meth); + state.CallMethod(meth, _shadowCtrl); _methAddr += _methIncr; } -- cgit v1.2.3