mirror of
https://github.com/libretro/ppsspp.git
synced 2024-12-14 04:28:42 +00:00
157 lines
4.1 KiB
C++
157 lines
4.1 KiB
C++
// 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
|