Move SetDebugMode notification

This commit is contained in:
Henrik Rydgård 2023-03-21 11:40:48 +01:00
parent fc1732cc22
commit f60f5ccaea
13 changed files with 20 additions and 33 deletions

View file

@ -138,7 +138,7 @@ enum class SystemNotification {
UI,
MEM_VIEW,
DISASSEMBLY,
DEBUG_MODE,
DEBUG_MODE_CHANGE,
BOOT_DONE, // this is sent from EMU thread! Make sure that Host handles it properly!
SYMBOL_MAP_UPDATED,
SWITCH_UMD_UPDATED,

View file

@ -368,20 +368,19 @@ bool Core_Run(GraphicsContext *ctx) {
void Core_EnableStepping(bool step, const char *reason, u32 relatedAddress) {
if (step) {
host->SetDebugMode(true);
Core_UpdateState(CORE_STEPPING);
steppingCounter++;
_assert_msg_(reason != nullptr, "No reason specified for break");
steppingReason = reason;
steppingAddress = relatedAddress;
} else {
host->SetDebugMode(false);
// Clear the exception if we resume.
Core_ResetException();
coreState = CORE_RUNNING;
coreStatePending = false;
m_StepCond.notify_all();
}
System_Notify(SystemNotification::DEBUG_MODE_CHANGE);
}
bool Core_NextFrame() {

View file

@ -27,8 +27,6 @@ class Host {
public:
virtual ~Host() {}
virtual void SetDebugMode(bool mode) { }
virtual bool InitGraphics(std::string *error_string, GraphicsContext **ctx) = 0;
virtual void ShutdownGraphics() = 0;

View file

@ -21,6 +21,8 @@
#include "UI/OnScreenDisplay.h"
#include "Qt/mainwindow.h"
#include "Core/Debugger/SymbolMap.h"
class QtHost : public Host {
public:
@ -29,8 +31,6 @@ public:
mainWindow = mainWindow_;
}
void SetDebugMode(bool mode) override {}
bool InitGraphics(std::string *error_message, GraphicsContext **ctx) override { return true; }
void ShutdownGraphics() override {}

View file

@ -40,6 +40,8 @@
#include "Common/Profiler/Profiler.h"
#include "QtMain.h"
#include "QtHost.h"
#include "Qt/mainwindow.h"
#include "Common/Data/Text/I18n.h"
#include "Common/Thread/ThreadUtil.h"
#include "Common/Data/Encoding/Utf8.h"
@ -57,6 +59,7 @@ static float refreshRate = 60.f;
static int browseFileEvent = -1;
static int browseFolderEvent = -1;
QTCamera *qtcamera = nullptr;
MainWindow *g_mainWindow;
#ifdef SDL
SDL_AudioSpec g_retFmt;
@ -259,7 +262,7 @@ void System_Notify(SystemNotification notification) {
switch (notification) {
case SystemNotification::BOOT_DONE:
g_symbolMap->SortSymbols();
mainWindow->Notify(MainWindowMsg::BOOT_DONE);
g_mainWindow->Notify(MainWindowMsg::BOOT_DONE);
break;
case SystemNotification::SYMBOL_MAP_UPDATED:
if (g_symbolMap)
@ -782,6 +785,12 @@ int main(int argc, char *argv[])
NativeInit(argc, (const char **)argv, savegame_dir.c_str(), external_dir.c_str(), nullptr);
g_mainWindow = new MainWindow(nullptr, g_Config.UseFullScreen());
g_mainWindow->show();
if (host == nullptr) {
host = new QtHost(g_mainWindow);
}
// TODO: Support other backends than GL, like Vulkan, in the Qt backend.
g_Config.iGPUBackend = (int)GPUBackend::OPENGL;

View file

@ -24,8 +24,6 @@ class NativeHost : public Host {
public:
NativeHost() {}
void SetDebugMode(bool mode) override { }
bool InitGraphics(std::string *error_message, GraphicsContext **ctx) override { return true; }
void ShutdownGraphics() override {}

View file

@ -834,14 +834,6 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
std::string sysName = System_GetProperty(SYSPROP_NAME);
isOuya = KeyMap::IsOuya(sysName);
#if !defined(MOBILE_DEVICE) && defined(USING_QT_UI)
MainWindow *mainWindow = new MainWindow(nullptr, g_Config.UseFullScreen());
mainWindow->show();
if (host == nullptr) {
host = new QtHost(mainWindow);
}
#endif
// We do this here, instead of in NativeInitGraphics, because the display may be reset.
// When it's reset we don't want to forget all our managed things.
CheckFailedGPUBackends();

View file

@ -75,8 +75,6 @@ void UWPHost::UpdateSound() {
void UWPHost::ShutdownSound() {
}
void UWPHost::SetDebugMode(bool mode) {}
void UWPHost::PollControllers() {
for (const auto& device : this->input)
{

View file

@ -12,8 +12,6 @@ public:
UWPHost();
~UWPHost();
void SetDebugMode(bool mode) override;
// If returns false, will return a null context
bool InitGraphics(std::string *error_message, GraphicsContext **ctx) override;
void PollControllers() override;

View file

@ -189,11 +189,6 @@ void WindowsHost::UpdateSound() {
void WindowsHost::ShutdownSound() {
}
void WindowsHost::SetDebugMode(bool mode) {
if (disasmWindow)
PostDialogMessage(disasmWindow, WM_DEB_SETDEBUGLPARAM, 0, (LPARAM)mode);
}
void WindowsHost::PollControllers() {
static int checkCounter = 0;
static const int CHECK_FREQUENCY = 71;

View file

@ -34,8 +34,6 @@ public:
UpdateConsolePosition();
}
void SetDebugMode(bool mode) override;
// If returns false, will return a null context
bool InitGraphics(std::string *error_message, GraphicsContext **ctx) override;
void PollControllers() override;

View file

@ -384,9 +384,8 @@ void System_Notify(SystemNotification notification) {
g_symbolMap->SortSymbols();
PostMessage(MainWindow::GetHWND(), WM_USER + 1, 0, 0);
bool mode = !g_Config.bAutoRun;
if (disasmWindow)
PostDialogMessage(disasmWindow, WM_DEB_SETDEBUGLPARAM, 0, (LPARAM)mode);
PostDialogMessage(disasmWindow, WM_DEB_SETDEBUGLPARAM, 0, (LPARAM)Core_IsStepping());
break;
}
@ -421,6 +420,11 @@ void System_Notify(SystemNotification notification) {
case SystemNotification::SWITCH_UMD_UPDATED:
PostMessage(MainWindow::GetHWND(), MainWindow::WM_USER_SWITCHUMD_UPDATED, 0, 0);
break;
case SystemNotification::DEBUG_MODE_CHANGE:
if (disasmWindow)
PostDialogMessage(disasmWindow, WM_DEB_SETDEBUGLPARAM, 0, (LPARAM)Core_IsStepping());
break;
}
}

View file

@ -26,8 +26,6 @@
// TODO: Get rid of this junk
class HeadlessHost : public Host {
public:
void SetDebugMode(bool mode) override { }
void SetGraphicsCore(GPUCore core) { gpuCore_ = core; }
bool InitGraphics(std::string *error_message, GraphicsContext **ctx) override {return false;}
void ShutdownGraphics() override {}