Make history viewer sort of work

This commit is contained in:
NovaSquirrel 2020-10-07 00:47:24 -04:00
parent c15ed1dee1
commit f6bf4d6f2a
2 changed files with 29 additions and 7 deletions

View file

@ -50,6 +50,28 @@ struct InteropRomInfo
static string _romPath;
static string _patchPath;
extern shared_ptr<Console> _historyConsole;
enum class ConsoleId
{
Main = 0,
HistoryViewer = 1
};
shared_ptr<Console> GetConsoleById(ConsoleId consoleId)
{
shared_ptr<Console> console;
switch (consoleId) {
case ConsoleId::Main: console = _console; break;
case ConsoleId::HistoryViewer: console = _historyConsole; break;
}
if (!console) {
//Otherwise return the main CPU
console = _console;
}
return console;
}
extern "C" {
DllExport bool __stdcall TestDll()
@ -164,23 +186,23 @@ extern "C" {
_console->Stop(true);
}
DllExport void __stdcall Pause()
DllExport void __stdcall Pause(ConsoleId consoleId)
{
if(!GameClient::Connected()) {
_console->Pause();
GetConsoleById(consoleId)->Pause();
}
}
DllExport void __stdcall Resume()
DllExport void __stdcall Resume(ConsoleId consoleId)
{
if(!GameClient::Connected()) {
_console->Resume();
GetConsoleById(consoleId)->Resume();
}
}
DllExport bool __stdcall IsPaused()
DllExport bool __stdcall IsPaused(ConsoleId consoleId)
{
shared_ptr<Console> console = _console;
shared_ptr<Console> console = GetConsoleById(consoleId);
if(console) {
return console->IsPaused();
}

View file

@ -45,7 +45,7 @@ extern "C"
#ifdef _WIN32
_historyRenderer.reset(new Renderer(_historyConsole, (HWND)viewerHandle, false));
_historySoundManager.reset(new SoundManager(_historyConsole, (HWND)windowHandle));
// _historySoundManager.reset(new SoundManager(_historyConsole, (HWND)windowHandle));
#else
_historyRenderer.reset(new SdlRenderer(_historyConsole, viewerHandle, false));
_historySoundManager.reset(new SdlSoundManager(_historyConsole));