forked from hrydgard/ppsspp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHostTypes.h
156 lines (129 loc) · 4.1 KB
/
HostTypes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
// Copyright (c) 2014- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#pragma once
#include "Core/Host.h"
#if !defined(MOBILE_DEVICE) && defined(USING_QT_UI)
#include "Core/Debugger/SymbolMap.h"
#include "Qt/mainwindow.h"
#endif
// TODO: Get rid of this junk
class NativeHost : public Host {
public:
NativeHost() {
// hasRendered = false;
}
virtual void UpdateUI() {}
virtual void UpdateMemView() {}
virtual void UpdateDisassembly() {}
virtual void SetDebugMode(bool mode) { }
virtual bool InitGL(std::string *error_message) { return true; }
virtual void ShutdownGL() {}
virtual void InitSound(PMixer *mixer);
virtual void UpdateSound() {}
virtual void ShutdownSound();
// this is sent from EMU thread! Make sure that Host handles it properly!
virtual void BootDone() {}
virtual bool IsDebuggingEnabled() {return false;}
virtual bool AttemptLoadSymbolMap() {return false;}
virtual void ResetSymbolMap() {}
virtual void AddSymbol(std::string name, u32 addr, u32 size, int type=0) {}
virtual void SetWindowTitle(const char *message) {}
};
#if !defined(MOBILE_DEVICE) && defined(USING_QT_UI)
static const char* SymbolMapFilename(std::string currentFilename)
{
std::string result = currentFilename;
size_t dot = result.rfind('.');
if (dot == result.npos)
return (result + ".map").c_str();
result.replace(dot, result.npos, ".map");
return result.c_str();
}
class QtHost : public Host {
public:
QtHost(MainWindow *mainWindow_)
{
mainWindow = mainWindow_;
m_GPUStep = false;
m_GPUFlag = 0;
}
virtual void UpdateUI() {
mainWindow->updateMenus();
}
virtual void UpdateMemView() {
if(mainWindow->GetDialogMemory())
mainWindow->GetDialogMemory()->Update();
}
virtual void UpdateDisassembly() {
if(mainWindow->GetDialogDisasm())
mainWindow->GetDialogDisasm()->Update();
if(mainWindow->GetDialogDisplaylist())
mainWindow->GetDialogDisplaylist()->Update();
}
virtual void SetDebugMode(bool mode) {
if(mainWindow->GetDialogDisasm())
mainWindow->GetDialogDisasm()->SetDebugMode(mode);
}
virtual bool InitGL(std::string *error_message) { return true; }
virtual void ShutdownGL() {}
virtual void InitSound(PMixer *mixer);
virtual void UpdateSound() {}
virtual void ShutdownSound();
// this is sent from EMU thread! Make sure that Host handles it properly!
virtual void BootDone() {
symbolMap.SortSymbols();
mainWindow->Boot();
}
virtual bool IsDebuggingEnabled() {
#ifdef _DEBUG
return true;
#else
return false;
#endif
}
virtual bool AttemptLoadSymbolMap() {
return symbolMap.LoadSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart));
}
virtual void PrepareShutdown() {
symbolMap.SaveSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart));
}
virtual void ResetSymbolMap() {}
virtual void AddSymbol(std::string name, u32 addr, u32 size, int type=0) {}
virtual void SetWindowTitle(const char *message) {
QString title = "PPSSPP " + QString(PPSSPP_GIT_VERSION) + " - " + QString::fromUtf8(message);
mainWindow->setWindowTitle(title);
}
bool GPUDebuggingActive()
{
auto dialogDisplayList = mainWindow->GetDialogDisplaylist();
if (dialogDisplayList && dialogDisplayList->isVisible())
{
if (m_GPUStep && m_GPUFlag == -1)
m_GPUFlag = 0;
return true;
}
return false;
}
void SetGPUStep(bool value, int flag = 0, u32 data = 0)
{
m_GPUStep = value;
m_GPUFlag = flag;
m_GPUData = data;
}
private:
MainWindow* mainWindow;
bool m_GPUStep;
int m_GPUFlag;
u32 m_GPUData;
};
#endif