Skip to content

Commit 52a3795

Browse files
committed
VmSelector
1 parent 8425eb6 commit 52a3795

35 files changed

+860
-954
lines changed

CMakePresets.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
"displayName": "x64 Debug",
88
"generator": "Visual Studio 17 2022",
99
"architecture": { "value": "x64" },
10-
"binaryDir": "${sourceDir}/build/x64",
10+
"binaryDir": "${sourceDir}/build",
1111
"cacheVariables": {
1212
"CMAKE_BUILD_TYPE": "Debug"
1313
}
1414
},
1515
{
1616
"name": "x64",
1717
"inherits": "x64-debug",
18-
"binaryDir": "${sourceDir}/build/x64",
18+
"binaryDir": "${sourceDir}/build",
1919
"cacheVariables": {
2020
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
2121
}
@@ -25,15 +25,15 @@
2525
"displayName": "Win32 Debug",
2626
"generator": "Visual Studio 17 2022",
2727
"architecture": { "value": "Win32" },
28-
"binaryDir": "${sourceDir}/build/win32",
28+
"binaryDir": "${sourceDir}/build",
2929
"cacheVariables": {
3030
}
3131
},
3232
{
3333
"name": "win32",
3434
"displayName": "Win32 RelWithDebInfo",
3535
"inherits": "win32-debug",
36-
"binaryDir": "${sourceDir}/build/win32",
36+
"binaryDir": "${sourceDir}/build",
3737
"cacheVariables": {
3838
}
3939
}

libs/amDebugger/src/amDebugger/config.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ struct CfgBase {
1212

1313
#define CFG_DECLARE(TCfgClass) \
1414
TS_REFLECT_CLASS(TCfgClass, CfgBase); \
15-
static TCfgClass* get() \
15+
static TCfgClass& get() \
1616
{ \
1717
static TCfgClass instance; \
18-
return &instance; \
18+
return instance; \
1919
}
2020

2121

@@ -58,4 +58,4 @@ struct CfgVmPrefs : public CfgBase {
5858
EVmModel model = EVmModel::A500;
5959
EVmModelCfg modelCfg = EVmModelCfg::A500_DEF;
6060
};
61-
inline static CfgVmPrefs* g_cfg_vm_prefs = CfgVmPrefs::get();
61+
inline static CfgVmPrefs& g_cfg_vm_prefs = CfgVmPrefs::get();

libs/amDebugger/src/amDebugger/debugger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void Debugger::execConsoleCmd(qd::string&& cmd)
7878

7979
bool Debugger::isDebugActivated() const
8080
{
81-
return m_pVm->getVmDebugMode() == EVmDebugMode::Break;
81+
return m_pVm ? m_pVm->getVmDebugMode() == EVmDebugMode::Break : false;
8282
}
8383

8484

libs/amDebugger/src/amDebugger/debuggerOps.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ struct AmDebuggerOperationCreator : public qd::UiOperationCreator {
5858
//------------------------------------------------------------------------
5959
// Operations arguments
6060
//
61-
struct UaeResetAmiga : public amD::operation::OperationArgs {
62-
DECLARE_OPERATION_1(amD::operation::UaeResetAmiga);
61+
struct VmEmuReset : public amD::operation::OperationArgs {
62+
DECLARE_OPERATION_1(amD::operation::VmEmuReset);
6363
static void setup(qd::operation::OpDesc& d)
6464
{
6565
d.m_id = "reset";
@@ -193,8 +193,8 @@ struct DebugWaitScanLines : public amD::operation::OperationArgs {
193193

194194

195195

196-
struct UaeWndAlwaysOnTop : public amD::operation::OperationArgs {
197-
DECLARE_OPERATION_1(amD::operation::UaeWndAlwaysOnTop);
196+
struct VmPlayerWndAlwaysOnTop : public amD::operation::OperationArgs {
197+
DECLARE_OPERATION_1(amD::operation::VmPlayerWndAlwaysOnTop);
198198
static void setup(qd::operation::OpDesc& d)
199199
{
200200
d.m_name = "Always on Top";

libs/amDebugger/src/amDebugger/debuggerWndApp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void DebuggerApp::destroy()
129129
}
130130

131131

132-
void DebuggerApp::update(float /*dt*/, float /*time*/)
132+
void DebuggerApp::updateAppPart(float /*dt*/, float /*time*/)
133133
{
134134
if (isWndVisible())
135135
{
@@ -143,7 +143,7 @@ void DebuggerApp::update(float /*dt*/, float /*time*/)
143143
}
144144

145145

146-
void DebuggerApp::render()
146+
void DebuggerApp::renderAppPart()
147147
{
148148
if (isWndVisible() && m_pQimGuiCtx->m_frameStarted)
149149
m_pQimGuiCtx->render(qd::Color(128, 128, 128));

libs/amDebugger/src/amDebugger/debuggerWndApp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ class DebuggerApp
6363
virtual void onPartCreate(ApplicationPart::OnCreate_t& prm) override;
6464
void init();
6565
virtual void destroy() override;
66-
virtual void update(float dt, float time) override;
67-
virtual void render() override;
66+
virtual void updateAppPart(float dt, float time) override;
67+
virtual void renderAppPart() override;
6868
bool isWndVisible() const;
6969
void setWndVisible(bool v);
7070
virtual qd::EFlow onSdlEventProc(SDL_Event& event) override;

libs/amDebugger/src/amDebugger/ui/debuggerDesktop.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
#include "qd/qui/operationsRegistry.h"
88
#include "qd/qui/shortcutMgr.h"
99
#include "qd/typeSystem/typeRegistry.h"
10+
#include "qd/stl/optional.h"
11+
#include "qd/stl/span.h"
1012
#include <amDebugger/debuggerOps.h>
1113
#include <amDebugger/shortcutsList.h>
1214
#include <amDebugger/window/disassembly_wnd.h>
13-
#include <EASTL/optional.h>
14-
#include <EASTL/span.h>
1515
#include <imgui/imgui.h>
1616
#include <imgui/imgui_internal.h>
1717

@@ -52,21 +52,21 @@ void DebuggerDesktop::_drawMainMenuBar()
5252
if (ImGui::BeginMainMenuBar())
5353
{
5454
Debugger* pDbg = m_pDbg;
55-
IVm::VM* vm = pDbg->getVm();
5655

5756
if (auto pm = qIm::LockMenu("File"))
5857
{
5958
}
6059

6160
if (auto pm = qIm::LockMenu("Emulator"))
6261
{
63-
qIm::menuItemFromOperationArgs_<amD::operation::UaeWndAlwaysOnTop>(pDbg);
64-
qIm::menuItemFromOperationArgs_<amD::operation::UaeResetAmiga>(pDbg);
62+
qIm::menuItemFromOperationArgs_<amD::operation::VmPlayerWndAlwaysOnTop>(pDbg);
63+
qIm::menuItemFromOperationArgs_<amD::operation::VmEmuReset>(pDbg);
6564
}
6665

6766
if (auto pm = qIm::LockMenu("Debug"))
6867
{
69-
IVm::EVmDebugMode debugMode = vm->getVmDebugMode();
68+
IVm::VM* vm = pDbg->getVm();
69+
IVm::EVmDebugMode debugMode = vm ? vm->getVmDebugMode().get() : IVm::EVmDebugMode::Live;
7070
qIm::menuItemFromOperationArgs_<amD::operation::DebugTraceContinue>(pDbg, "", false,
7171
debugMode.isBreak());
7272
qIm::menuItemFromOperationArgs_<amD::operation::DebugTraceStart>(pDbg, "", false, debugMode.isLive());
@@ -80,6 +80,7 @@ void DebuggerDesktop::_drawMainMenuBar()
8080
ImGui::Separator();
8181

8282
amD::operation::DebugDmaOption debugDmaOp;
83+
if (vm)
8384
{
8485
qd::OperationsRegistry& opMgr = qd::OperationsRegistry::get();
8586
const qd::operation::OpDesc& opDesc = opMgr.getOpDesc_(&debugDmaOp);
@@ -185,7 +186,7 @@ void DebuggerDesktop::drawImGuiMainFrame()
185186
// clang-format off
186187
amD::operation::DisasmTraceStepInto
187188
, amD::operation::DebugWaitScanLines
188-
, amD::operation::UaeWndAlwaysOnTop
189+
, amD::operation::VmPlayerWndAlwaysOnTop
189190
, amD::operation::DebugTraceContinue
190191
, amD::operation::DebugTraceStart
191192
, amD::operation::DisasmToggleBreakpoint
@@ -211,7 +212,7 @@ void DebuggerDesktop::_drawToolBar()
211212
window->DC.LayoutType = ImGuiLayoutType_Horizontal;
212213

213214
Debugger* dbg = getDbg();
214-
eastl::string hint;
215+
qd::string hint;
215216

216217
bool isDbgMode = dbg->isDebugActivated();
217218
if (ImGui::Checkbox("Trace", &isDbgMode))

libs/qd/app/appPartsMgr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void AppPartsManager::update(float dt, float time)
172172
if (!pCurPart->isReadyToActivate())
173173
continue;
174174

175-
pCurPart->update(dt, time);
175+
pCurPart->updateAppPart(dt, time);
176176
}
177177
}
178178
}
@@ -211,7 +211,7 @@ void AppPartsManager::render()
211211
for (int i = 0; i < (int)pActParts.size(); ++i)
212212
{
213213
ApplicationPart* pCurPart = pActParts[i];
214-
pCurPart->render();
214+
pCurPart->renderAppPart();
215215
}
216216
}
217217

libs/qd/app/applicationPart.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,9 @@ class ApplicationPart : public qd::Node
8484
void setApp(qd::Application* pApp) { m_pApp = pApp; }
8585

8686

87-
virtual void update(float /*dt*/, float /*time*/) {}
88-
virtual void render() {}
89-
90-
91-
virtual void postRender() {}
87+
virtual void updateAppPart(float /*dt*/, float /*time*/) {}
88+
virtual void renderAppPart() {}
89+
virtual void postRenderAppPart() {}
9290

9391
virtual void destroyImp() {}
9492
virtual void destroy() override;

libs/qd/enum/enumBase.h

Lines changed: 53 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -6,77 +6,60 @@
66
// EnumNamespace = "Namespace::ToEnum::"
77
// example: ENUM_DECLARE_BASE(app::shortcut::, EShortcutId, Type, UNDEF);
88
//
9-
#define ENUM_DECLARE_BASE(EnumNamespace, EnumNameStruct, eEnumType, _DefaultValue) \
10-
private: \
11-
typedef EnumNamespace EnumNameStruct EThis; /* CONCAT NAME */ \
12-
protected: \
13-
typedef eEnumType TEnum; \
14-
\
15-
public: \
16-
eEnumType mV; /* member */ \
17-
constexpr inline EnumNameStruct() \
18-
: mV(static_cast<TEnum>(_DefaultValue)) \
19-
{} \
20-
template<typename V> \
21-
constexpr inline EnumNameStruct(V Value) \
22-
: mV(static_cast<TEnum>(Value)) \
23-
{} \
24-
constexpr inline EnumNameStruct(const EnumNameStruct& r) \
25-
: mV(r.mV) \
26-
{} \
27-
constexpr inline EnumNameStruct& operator= (const EnumNameStruct& r) throw() \
28-
{ \
29-
mV = r.mV; \
30-
return *this; \
31-
} \
32-
template<typename V> \
33-
inline constexpr EnumNameStruct& operator= (const V& Value) throw() \
34-
{ \
35-
mV = static_cast<TEnum>(Value); \
36-
return *this; \
37-
} \
38-
inline constexpr operator TEnum () const \
39-
{ \
40-
return mV; \
41-
} \
42-
inline constexpr EnumNameStruct& operator++ () /* ++ prefix */ throw() \
43-
{ \
44-
mV = (TEnum)(mV + 1); /* -V1016 */ \
45-
return *this; \
46-
} \
47-
inline constexpr EnumNameStruct& operator-- () throw() \
48-
{ \
49-
mV = (TEnum)(mV - 1); /* -V1016 */ \
50-
return *this; \
51-
} /* -- prefix */ \
52-
inline constexpr EnumNameStruct operator++ (int) /* postfix ++ */ throw() \
53-
{ \
54-
EnumNameStruct t(mV); \
55-
mV = (TEnum)(mV + 1); /* -V1016 */ \
56-
return t; \
57-
} \
58-
inline constexpr EnumNameStruct operator-- (int) /* postfix -- */ throw() \
59-
{ \
60-
EnumNameStruct t(mV); \
61-
mV = (TEnum)(mV - 1); /* -V1016 */ \
62-
return t; \
63-
} \
64-
template<typename V> \
65-
inline constexpr bool operator== (const V& Value) throw() \
66-
{ \
67-
return (mV == (TEnum)Value); \
68-
} \
69-
template<typename V> \
70-
inline constexpr bool operator!= (const V& Value) throw() \
71-
{ \
72-
return !(mV == (TEnum)Value); \
73-
} \
74-
template<typename V> \
75-
inline constexpr volatile EnumNameStruct& operator= (const V& Value) volatile throw() \
76-
{ \
77-
mV = (TEnum)Value; \
78-
return *this; \
9+
// clang-format off
10+
#define ENUM_DECLARE_BASE(EnumNamespace, EnumNameStruct, eEnumType, _DefaultValue) \
11+
private: \
12+
typedef EnumNamespace EnumNameStruct EThis; /* CONCAT NAME */ \
13+
protected: \
14+
typedef eEnumType TEnum; \
15+
\
16+
public: \
17+
eEnumType mV; /* member */ \
18+
constexpr inline EnumNameStruct() : mV(static_cast<TEnum>(_DefaultValue)) {} \
19+
template<typename V> \
20+
constexpr inline EnumNameStruct(V Value) : mV(static_cast<TEnum>(Value)) {} \
21+
constexpr inline EnumNameStruct(const EnumNameStruct& r) : mV(r.mV) {} \
22+
constexpr inline EnumNameStruct& operator= (const EnumNameStruct& r) throw() { \
23+
mV = r.mV; \
24+
return *this; \
25+
} \
26+
template<typename V> \
27+
inline constexpr EnumNameStruct& operator= (const V& Value) throw() { \
28+
mV = static_cast<TEnum>(Value); \
29+
return *this; \
30+
} \
31+
inline constexpr operator TEnum () const throw() { return mV; } \
32+
inline constexpr TEnum get() const throw() { return mV; } \
33+
inline constexpr EnumNameStruct& operator++ () /* ++ prefix */ throw() { \
34+
mV = (TEnum)(mV + 1); /* -V1016 */ \
35+
return *this; \
36+
} \
37+
inline constexpr EnumNameStruct& operator-- () throw() { /* --prefix */ \
38+
mV = (TEnum)(mV - 1); /* -V1016 */ \
39+
return *this; \
40+
} \
41+
inline constexpr EnumNameStruct operator++ (int) /* postfix ++ */ throw() { \
42+
EnumNameStruct t(mV); \
43+
mV = (TEnum)(mV + 1); /* -V1016 */ \
44+
return t; \
45+
} \
46+
inline constexpr EnumNameStruct operator-- (int) /* postfix -- */ throw() { \
47+
EnumNameStruct t(mV); \
48+
mV = (TEnum)(mV - 1); /* -V1016 */ \
49+
return t; \
50+
} \
51+
template<typename V> \
52+
inline constexpr bool operator== (const V& Value) throw() { return (mV == (TEnum)Value);} \
53+
template<typename V> \
54+
inline constexpr bool operator!= (const V& Value) throw() { \
55+
return !(mV == (TEnum)Value); \
56+
} \
57+
template<typename V> \
58+
inline constexpr volatile EnumNameStruct& operator= (const V& Value) volatile throw() { \
59+
mV = (TEnum)Value; \
60+
return *this; \
7961
}
62+
// clang-format on
8063
//////////////////////////////////////////////////////////////////////////
8164

8265

0 commit comments

Comments
 (0)