move some stuff and use DisplayManagerBase instead of DisplayManager, in preparation for testing external APIs

This commit is contained in:
SuuperW 2023-10-08 03:10:17 -05:00
parent 30b3819cb1
commit ae76497aa4
6 changed files with 185 additions and 184 deletions

View File

@ -1,65 +1,65 @@
namespace BizHawk.Client.EmuHawk
{
public interface IControlMainform
{
bool WantsToControlReboot { get; }
void RebootCore();
bool WantsToControlSavestates { get; }
void SaveState();
bool LoadState();
void SaveStateAs();
bool LoadStateAs();
void SaveQuickSave(int slot);
bool LoadQuickSave(int slot);
/// <summary>
/// Overrides the select slot method
/// </summary>
/// <returns>Returns whether the function is handled.
/// If false, the mainform should continue with its logic</returns>
bool SelectSlot(int slot);
bool PreviousSlot();
bool NextSlot();
bool WantsToControlReadOnly { get; }
/// <summary>
/// Function that is called by Mainform instead of using its own code
/// when a Tool sets WantsToControlReadOnly.
/// Should not be called directly.
/// </summary>
void ToggleReadOnly();
bool WantsToControlStopMovie { get; }
/// <summary>
/// Function that is called by Mainform instead of using its own code
/// when a Tool sets WantsToControlStopMovie.
/// Should not be called directly.
/// <remarks>Like MainForm's StopMovie(), saving the movie is part of this function's responsibility.</remarks>
/// </summary>
void StopMovie(bool suppressSave);
bool WantsToControlRewind { get; }
void CaptureRewind();
/// <summary>
/// Function that is called by Mainform instead of using its own code
/// when a Tool sets WantsToControlRewind
/// Returns whether or not the rewind action actually occured
/// </summary>
bool Rewind();
bool WantsToControlRestartMovie { get; }
bool RestartMovie();
}
}
namespace BizHawk.Client.Common
{
public interface IControlMainform
{
bool WantsToControlReboot { get; }
void RebootCore();
bool WantsToControlSavestates { get; }
void SaveState();
bool LoadState();
void SaveStateAs();
bool LoadStateAs();
void SaveQuickSave(int slot);
bool LoadQuickSave(int slot);
/// <summary>
/// Overrides the select slot method
/// </summary>
/// <returns>Returns whether the function is handled.
/// If false, the mainform should continue with its logic</returns>
bool SelectSlot(int slot);
bool PreviousSlot();
bool NextSlot();
bool WantsToControlReadOnly { get; }
/// <summary>
/// Function that is called by Mainform instead of using its own code
/// when a Tool sets WantsToControlReadOnly.
/// Should not be called directly.
/// </summary>
void ToggleReadOnly();
bool WantsToControlStopMovie { get; }
/// <summary>
/// Function that is called by Mainform instead of using its own code
/// when a Tool sets WantsToControlStopMovie.
/// Should not be called directly.
/// <remarks>Like MainForm's StopMovie(), saving the movie is part of this function's responsibility.</remarks>
/// </summary>
void StopMovie(bool suppressSave);
bool WantsToControlRewind { get; }
void CaptureRewind();
/// <summary>
/// Function that is called by Mainform instead of using its own code
/// when a Tool sets WantsToControlRewind
/// Returns whether or not the rewind action actually occured
/// </summary>
bool Rewind();
bool WantsToControlRestartMovie { get; }
bool RestartMovie();
}
}

View File

@ -0,0 +1,113 @@
using System;
using BizHawk.Bizware.BizwareGL;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.Common
{
public interface IMainFormForTools : IDialogController
{
CheatCollection CheatList { get; }
string CurrentlyOpenRom { get; }
/// <remarks>only referenced from HexEditor</remarks>
LoadRomArgs CurrentlyOpenRomArgs { get; }
/// <remarks>only referenced from TAStudio</remarks>
bool EmulatorPaused { get; }
/// <remarks>only referenced from TAStudio</remarks>
FirmwareManager FirmwareManager { get; }
/// <remarks>only referenced from TAStudio</remarks>
bool GameIsClosing { get; }
/// <remarks>only referenced from PlaybackBox</remarks>
bool HoldFrameAdvance { get; set; }
/// <remarks>only referenced from BasicBot</remarks>
bool InvisibleEmulation { get; set; }
/// <remarks>only referenced from TAStudio</remarks>
bool IsSeeking { get; }
/// <remarks>only referenced from LuaConsole</remarks>
bool IsTurboing { get; }
int? PauseOnFrame { get; set; }
/// <remarks>only referenced from PlaybackBox</remarks>
bool PressRewind { get; set; }
/// <remarks>only referenced from GenericDebugger</remarks>
event Action<bool> OnPauseChanged;
BitmapBuffer CaptureOSD();
/// <remarks>only referenced from TAStudio</remarks>
void DisableRewind();
/// <remarks>only referenced from TAStudio</remarks>
void EnableRewind(bool enabled);
/// <remarks>only referenced from TAStudio</remarks>
bool EnsureCoreIsAccurate();
/// <remarks>only referenced from TAStudio</remarks>
void FrameAdvance();
/// <remarks>only referenced from LuaConsole</remarks>
void FrameBufferResized();
/// <remarks>only referenced from BasicBot</remarks>
bool LoadQuickSave(int slot, bool suppressOSD = false);
/// <remarks>only referenced from MultiDiskBundler</remarks>
bool LoadRom(string path, LoadRomArgs args);
/// <remarks>only referenced from BookmarksBranchesBox</remarks>
BitmapBuffer MakeScreenshotImage();
void MaybePauseFromMenuOpened();
void MaybeUnpauseFromMenuClosed();
void PauseEmulator();
bool BlockFrameAdvance { get; set; }
/// <remarks>only referenced from TAStudio</remarks>
void RelinquishControl(IControlMainform master);
/// <remarks>only referenced from TAStudio</remarks>
void SeekFrameAdvance();
void SetMainformMovieInfo();
bool StartNewMovie(IMovie movie, bool record);
/// <remarks>only referenced from TAStudio</remarks>
void TakeBackControl();
/// <remarks>only referenced from BasicBot</remarks>
void Throttle();
/// <remarks>only referenced from TAStudio</remarks>
void TogglePause();
void UnpauseEmulator();
/// <remarks>only referenced from BasicBot</remarks>
void Unthrottle();
/// <remarks>only referenced from LogWindow</remarks>
void UpdateDumpInfo(RomStatus? newStatus = null);
/// <remarks>only referenced from BookmarksBranchesBox</remarks>
void UpdateStatusSlots();
/// <remarks>only referenced from TAStudio</remarks>
void UpdateWindowTitle();
}
}

View File

@ -1,114 +0,0 @@
using System;
using BizHawk.Bizware.BizwareGL;
using BizHawk.Client.Common;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public interface IMainFormForTools : IDialogController
{
CheatCollection CheatList { get; }
string CurrentlyOpenRom { get; }
/// <remarks>only referenced from <see cref="HexEditor"/></remarks>
LoadRomArgs CurrentlyOpenRomArgs { get; }
/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
bool EmulatorPaused { get; }
/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
FirmwareManager FirmwareManager { get; }
/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
bool GameIsClosing { get; }
/// <remarks>only referenced from <see cref="PlaybackBox"/></remarks>
bool HoldFrameAdvance { get; set; }
/// <remarks>only referenced from <see cref="BasicBot"/></remarks>
bool InvisibleEmulation { get; set; }
/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
bool IsSeeking { get; }
/// <remarks>only referenced from <see cref="LuaConsole"/></remarks>
bool IsTurboing { get; }
int? PauseOnFrame { get; set; }
/// <remarks>only referenced from <see cref="PlaybackBox"/></remarks>
bool PressRewind { get; set; }
/// <remarks>only referenced from <see cref="GenericDebugger"/></remarks>
event Action<bool> OnPauseChanged;
BitmapBuffer CaptureOSD();
/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
void DisableRewind();
/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
void EnableRewind(bool enabled);
/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
bool EnsureCoreIsAccurate();
/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
void FrameAdvance();
/// <remarks>only referenced from <see cref="LuaConsole"/></remarks>
void FrameBufferResized();
/// <remarks>only referenced from <see cref="BasicBot"/></remarks>
bool LoadQuickSave(int slot, bool suppressOSD = false);
/// <remarks>only referenced from <see cref="MultiDiskBundler"/></remarks>
bool LoadRom(string path, LoadRomArgs args);
/// <remarks>only referenced from <see cref="BookmarksBranchesBox"/></remarks>
BitmapBuffer MakeScreenshotImage();
void MaybePauseFromMenuOpened();
void MaybeUnpauseFromMenuClosed();
void PauseEmulator();
bool BlockFrameAdvance { get; set; }
/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
void RelinquishControl(IControlMainform master);
/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
void SeekFrameAdvance();
void SetMainformMovieInfo();
bool StartNewMovie(IMovie movie, bool record);
/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
void TakeBackControl();
/// <remarks>only referenced from <see cref="BasicBot"/></remarks>
void Throttle();
/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
void TogglePause();
void UnpauseEmulator();
/// <remarks>only referenced from <see cref="BasicBot"/></remarks>
void Unthrottle();
/// <remarks>only referenced from <see cref="LogWindow"/></remarks>
void UpdateDumpInfo(RomStatus? newStatus = null);
/// <remarks>only referenced from <see cref="BookmarksBranchesBox"/></remarks>
void UpdateStatusSlots();
/// <remarks>only referenced from <see cref="TAStudio"/></remarks>
void UpdateWindowTitle();
}
}

View File

@ -1,4 +1,6 @@
namespace BizHawk.Client.EmuHawk
using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class GenericDebugger : IControlMainform
{

View File

@ -15,7 +15,7 @@ namespace BizHawk.Client.EmuHawk
protected ToolManager Tools { get; private set; }
protected DisplayManager DisplayManager { get; private set; }
protected DisplayManagerBase DisplayManager { get; private set; }
protected InputManager InputManager { get; private set; }
@ -35,7 +35,7 @@ namespace BizHawk.Client.EmuHawk
public virtual void Restart() {}
public void SetToolFormBaseProps(
DisplayManager displayManager,
DisplayManagerBase displayManager,
InputManager inputManager,
IMainFormForTools mainForm,
IMovieSession movieSession,

View File

@ -21,7 +21,7 @@ namespace BizHawk.Client.EmuHawk
{
private readonly MainForm _owner;
private Config _config;
private readonly DisplayManager _displayManager;
private readonly DisplayManagerBase _displayManager;
private readonly ExternalToolManager _extToolManager;
private readonly InputManager _inputManager;
private IExternalApiProvider _apiProvider;
@ -46,7 +46,7 @@ namespace BizHawk.Client.EmuHawk
public ToolManager(
MainForm owner,
Config config,
DisplayManager displayManager,
DisplayManagerBase displayManager,
ExternalToolManager extToolManager,
InputManager inputManager,
IEmulator emulator,