2015-11-27 01:33:07 -07:00
|
|
|
// Copyright 2015 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2018-01-20 13:00:28 -07:00
|
|
|
#include "DolphinQt2/Host.h"
|
|
|
|
|
2016-05-11 19:18:30 -06:00
|
|
|
#include <QAbstractEventDispatcher>
|
|
|
|
#include <QApplication>
|
2018-03-23 19:13:56 -06:00
|
|
|
#include <QProgressDialog>
|
2015-11-27 01:33:07 -07:00
|
|
|
|
|
|
|
#include "Common/Common.h"
|
2018-01-20 13:00:28 -07:00
|
|
|
#include "Core/ConfigManager.h"
|
2018-02-14 15:25:01 -07:00
|
|
|
#include "Core/Core.h"
|
|
|
|
#include "Core/Debugger/PPCDebugInterface.h"
|
2015-11-27 01:33:07 -07:00
|
|
|
#include "Core/Host.h"
|
2018-02-14 15:25:01 -07:00
|
|
|
#include "Core/PowerPC/PowerPC.h"
|
2018-02-06 15:12:17 -07:00
|
|
|
#include "DolphinQt2/Settings.h"
|
2018-01-20 13:00:28 -07:00
|
|
|
#include "VideoCommon/RenderBase.h"
|
2015-11-27 01:33:07 -07:00
|
|
|
|
2017-07-13 13:58:26 -06:00
|
|
|
Host::Host() = default;
|
2015-11-27 01:33:07 -07:00
|
|
|
|
|
|
|
Host* Host::GetInstance()
|
|
|
|
{
|
2017-07-13 13:58:26 -06:00
|
|
|
static Host* s_instance = new Host();
|
|
|
|
return s_instance;
|
2015-11-27 01:33:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void* Host::GetRenderHandle()
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return m_render_handle;
|
2015-11-27 01:33:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void Host::SetRenderHandle(void* handle)
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
m_render_handle = handle;
|
2015-11-27 01:33:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Host::GetRenderFocus()
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return m_render_focus;
|
2015-11-27 01:33:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void Host::SetRenderFocus(bool focus)
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
m_render_focus = focus;
|
2015-11-27 01:33:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Host::GetRenderFullscreen()
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return m_render_fullscreen;
|
2015-11-27 01:33:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void Host::SetRenderFullscreen(bool fullscreen)
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
m_render_fullscreen = fullscreen;
|
2015-11-27 01:33:07 -07:00
|
|
|
}
|
|
|
|
|
2018-01-25 23:23:24 -07:00
|
|
|
void Host::ResizeSurface(int new_width, int new_height)
|
2018-01-20 13:00:28 -07:00
|
|
|
{
|
|
|
|
if (g_renderer)
|
2018-01-25 23:23:24 -07:00
|
|
|
g_renderer->ResizeSurface(new_width, new_height);
|
2018-01-20 13:00:28 -07:00
|
|
|
}
|
|
|
|
|
2015-11-27 01:33:07 -07:00
|
|
|
void Host_Message(int id)
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
if (id == WM_USER_STOP)
|
|
|
|
{
|
|
|
|
emit Host::GetInstance()->RequestStop();
|
|
|
|
}
|
|
|
|
else if (id == WM_USER_JOB_DISPATCH)
|
|
|
|
{
|
|
|
|
// Just poke the main thread to get it to wake up, job dispatch
|
|
|
|
// will happen automatically before it goes back to sleep again.
|
|
|
|
QAbstractEventDispatcher::instance(qApp->thread())->wakeUp();
|
|
|
|
}
|
2015-11-27 01:33:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void Host_UpdateTitle(const std::string& title)
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
emit Host::GetInstance()->RequestTitle(QString::fromStdString(title));
|
2015-11-27 01:33:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void* Host_GetRenderHandle()
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return Host::GetInstance()->GetRenderHandle();
|
2015-11-27 01:33:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Host_RendererHasFocus()
|
|
|
|
{
|
2016-06-24 02:43:46 -06:00
|
|
|
return Host::GetInstance()->GetRenderFocus();
|
2015-11-27 01:33:07 -07:00
|
|
|
}
|
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
bool Host_RendererIsFullscreen()
|
|
|
|
{
|
|
|
|
return Host::GetInstance()->GetRenderFullscreen();
|
2015-11-27 01:33:07 -07:00
|
|
|
}
|
2018-02-14 15:25:01 -07:00
|
|
|
|
2016-11-10 09:55:21 -07:00
|
|
|
void Host_YieldToUI()
|
|
|
|
{
|
2016-11-11 05:39:50 -07:00
|
|
|
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
2016-11-10 09:55:21 -07:00
|
|
|
}
|
2018-02-14 15:25:01 -07:00
|
|
|
|
|
|
|
void Host_UpdateDisasmDialog()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-06-25 09:35:24 -06:00
|
|
|
void Host_UpdateProgressDialog(const char* caption, int position, int total)
|
|
|
|
{
|
2018-03-23 19:13:56 -06:00
|
|
|
emit Host::GetInstance()->UpdateProgressDialog(QString::fromUtf8(caption), position, total);
|
2017-06-25 09:35:24 -06:00
|
|
|
}
|
2015-11-27 01:33:07 -07:00
|
|
|
|
|
|
|
// We ignore these, and their purpose should be questioned individually.
|
|
|
|
// In particular, RequestRenderWindowSize, RequestFullscreen, and
|
|
|
|
// UpdateMainFrame should almost certainly be removed.
|
2016-06-24 02:43:46 -06:00
|
|
|
void Host_UpdateMainFrame()
|
|
|
|
{
|
|
|
|
}
|
2018-03-24 09:40:47 -06:00
|
|
|
|
2016-06-24 02:43:46 -06:00
|
|
|
void Host_RequestRenderWindowSize(int w, int h)
|
|
|
|
{
|
2018-03-24 09:40:47 -06:00
|
|
|
emit Host::GetInstance()->RequestRenderSize(w, h);
|
2016-06-24 02:43:46 -06:00
|
|
|
}
|
2018-03-24 09:40:47 -06:00
|
|
|
|
2017-07-12 01:11:29 -06:00
|
|
|
bool Host_UINeedsControllerState()
|
2016-06-24 02:43:46 -06:00
|
|
|
{
|
2018-02-06 15:12:17 -07:00
|
|
|
return Settings::Instance().IsControllerStateNeeded();
|
2016-06-24 02:43:46 -06:00
|
|
|
}
|
|
|
|
void Host_NotifyMapLoaded()
|
|
|
|
{
|
|
|
|
}
|
2016-06-26 00:06:23 -06:00
|
|
|
void Host_ShowVideoConfig(void* parent, const std::string& backend_name)
|
2016-06-24 02:43:46 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
void Host_RefreshDSPDebuggerWindow()
|
|
|
|
{
|
|
|
|
}
|