2015-11-27 08:33:07 +00:00
|
|
|
// Copyright 2015 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2016-05-12 01:18:30 +00:00
|
|
|
#include <QAbstractEventDispatcher>
|
|
|
|
#include <QApplication>
|
2015-11-27 08:33:07 +00:00
|
|
|
#include <QMutexLocker>
|
|
|
|
|
|
|
|
#include "Common/Common.h"
|
|
|
|
#include "Core/Host.h"
|
|
|
|
#include "DolphinQt2/Host.h"
|
|
|
|
#include "DolphinQt2/MainWindow.h"
|
|
|
|
|
|
|
|
Host* Host::m_instance = nullptr;
|
|
|
|
|
|
|
|
Host* Host::GetInstance()
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
if (m_instance == nullptr)
|
|
|
|
m_instance = new Host();
|
|
|
|
return m_instance;
|
2015-11-27 08:33:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void* Host::GetRenderHandle()
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
QMutexLocker locker(&m_lock);
|
|
|
|
return m_render_handle;
|
2015-11-27 08:33:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Host::SetRenderHandle(void* handle)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
QMutexLocker locker(&m_lock);
|
|
|
|
m_render_handle = handle;
|
2015-11-27 08:33:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Host::GetRenderFocus()
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
QMutexLocker locker(&m_lock);
|
|
|
|
return m_render_focus;
|
2015-11-27 08:33:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Host::SetRenderFocus(bool focus)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
QMutexLocker locker(&m_lock);
|
|
|
|
m_render_focus = focus;
|
2015-11-27 08:33:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Host::GetRenderFullscreen()
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
QMutexLocker locker(&m_lock);
|
|
|
|
return m_render_fullscreen;
|
2015-11-27 08:33:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Host::SetRenderFullscreen(bool fullscreen)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
QMutexLocker locker(&m_lock);
|
|
|
|
m_render_fullscreen = fullscreen;
|
2015-11-27 08:33:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Host_Message(int id)
|
|
|
|
{
|
2016-06-24 08:43:46 +00: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 08:33:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Host_UpdateTitle(const std::string& title)
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
emit Host::GetInstance()->RequestTitle(QString::fromStdString(title));
|
2015-11-27 08:33:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void* Host_GetRenderHandle()
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
return Host::GetInstance()->GetRenderHandle();
|
2015-11-27 08:33:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Host_RendererHasFocus()
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
return Host::GetInstance()->GetRenderFocus();
|
2015-11-27 08:33:07 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
bool Host_RendererIsFullscreen()
|
|
|
|
{
|
|
|
|
return Host::GetInstance()->GetRenderFullscreen();
|
2015-11-27 08:33:07 +00:00
|
|
|
}
|
2016-11-10 16:55:21 +00:00
|
|
|
void Host_YieldToUI()
|
|
|
|
{
|
2016-11-11 12:39:50 +00:00
|
|
|
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
|
2016-11-10 16:55:21 +00:00
|
|
|
}
|
2015-11-27 08:33:07 +00: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 08:43:46 +00:00
|
|
|
void Host_UpdateMainFrame()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void Host_RequestRenderWindowSize(int w, int h)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
bool Host_UIHasFocus()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
void Host_NotifyMapLoaded()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void Host_UpdateDisasmDialog()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void Host_SetWiiMoteConnectionState(int state)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void Host_ConnectWiimote(int wm_idx, bool connect)
|
|
|
|
{
|
|
|
|
}
|
2016-06-26 06:06:23 +00:00
|
|
|
void Host_ShowVideoConfig(void* parent, const std::string& backend_name)
|
2016-06-24 08:43:46 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
void Host_RefreshDSPDebuggerWindow()
|
|
|
|
{
|
|
|
|
}
|