update Unity version to 2017.4.
This commit is contained in:
@@ -134,6 +134,8 @@ void Duplicator::CheckUnityAdapter()
|
||||
|
||||
void Duplicator::Start()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
if (state_ != State::Ready) return;
|
||||
|
||||
Stop();
|
||||
@@ -179,6 +181,8 @@ void Duplicator::Start()
|
||||
|
||||
void Duplicator::Stop()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
shouldRun_ = false;
|
||||
|
||||
if (thread_.joinable())
|
||||
@@ -235,6 +239,8 @@ const Duplicator::Frame& Duplicator::GetLastFrame() const
|
||||
|
||||
void Duplicator::Duplicate(UINT timeout)
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
if (!dupl_ || !device_) return;
|
||||
|
||||
ComPtr<IDXGIResource> resource;
|
||||
@@ -347,6 +353,8 @@ void Duplicator::UpdateCursor(
|
||||
const ComPtr<ID3D11Texture2D>& texture,
|
||||
const DXGI_OUTDUPL_FRAME_INFO& frameInfo)
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
auto& manager = GetMonitorManager();
|
||||
|
||||
if (frameInfo.PointerPosition.Visible)
|
||||
@@ -365,6 +373,8 @@ void Duplicator::UpdateCursor(
|
||||
|
||||
void Duplicator::UpdateMetadata(UINT totalBufferSize)
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
metaData_.buffer.ExpandIfNeeded(totalBufferSize);
|
||||
if (!metaData_.buffer.Empty())
|
||||
{
|
||||
@@ -376,6 +386,8 @@ void Duplicator::UpdateMetadata(UINT totalBufferSize)
|
||||
|
||||
void Duplicator::UpdateMoveRects()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
const auto hr = dupl_->GetFrameMoveRects(
|
||||
metaData_.buffer.Size(),
|
||||
metaData_.buffer.As<DXGI_OUTDUPL_MOVE_RECT>(),
|
||||
@@ -418,6 +430,8 @@ void Duplicator::UpdateMoveRects()
|
||||
|
||||
void Duplicator::UpdateDirtyRects()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
const auto hr = dupl_->GetFrameDirtyRects(
|
||||
metaData_.buffer.Size() - metaData_.moveRectSize,
|
||||
metaData_.buffer.As<RECT>(metaData_.moveRectSize /* offset */),
|
||||
|
||||
@@ -30,6 +30,8 @@ void Monitor::Initialize(
|
||||
const ComPtr<IDXGIOutput> &output
|
||||
)
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
adapter_ = adapter;
|
||||
output_ = output;
|
||||
|
||||
@@ -64,12 +66,16 @@ void Monitor::Initialize(
|
||||
|
||||
void Monitor::Finalize()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
StopCapture();
|
||||
}
|
||||
|
||||
|
||||
void Monitor::Render()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
const auto& frame = duplicator_->GetLastFrame();
|
||||
|
||||
if (frame.id == lastFrameId_) return;
|
||||
@@ -113,6 +119,8 @@ void Monitor::Render()
|
||||
|
||||
void Monitor::StartCapture()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
if (duplicator_->GetState() == DuplicatorState::Ready)
|
||||
{
|
||||
duplicator_->Start();
|
||||
@@ -122,6 +130,8 @@ void Monitor::StartCapture()
|
||||
|
||||
void Monitor::StopCapture()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
duplicator_->Stop();
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ MonitorManager::~MonitorManager()
|
||||
|
||||
void MonitorManager::Initialize()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
Finalize();
|
||||
|
||||
// Get factory
|
||||
@@ -63,6 +65,8 @@ void MonitorManager::Initialize()
|
||||
|
||||
void MonitorManager::Finalize()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
for (const auto& monitor : monitors_)
|
||||
{
|
||||
monitor->Finalize();
|
||||
@@ -74,6 +78,8 @@ void MonitorManager::Finalize()
|
||||
|
||||
void MonitorManager::Update()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
if (isReinitializationRequired_)
|
||||
{
|
||||
Reinitialize();
|
||||
@@ -84,6 +90,8 @@ void MonitorManager::Update()
|
||||
|
||||
void MonitorManager::RequireReinitilization()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
Debug::Log("MonitorManager::Reinitialize() was required.");
|
||||
isReinitializationRequired_ = true;
|
||||
}
|
||||
@@ -91,6 +99,8 @@ void MonitorManager::RequireReinitilization()
|
||||
|
||||
void MonitorManager::Reinitialize()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
Debug::Log("MonitorManager::Reinitialize()");
|
||||
Initialize();
|
||||
SendMessageToUnity(Message::Reinitialized);
|
||||
|
||||
@@ -35,6 +35,8 @@ extern "C"
|
||||
|
||||
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API Initialize()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
if (g_unity && !g_manager)
|
||||
{
|
||||
Debug::Initialize();
|
||||
@@ -63,6 +65,8 @@ extern "C"
|
||||
|
||||
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API Finalize()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
if (!g_manager) return;
|
||||
|
||||
g_manager->Finalize();
|
||||
@@ -76,6 +80,8 @@ extern "C"
|
||||
|
||||
void UNITY_INTERFACE_API OnGraphicsDeviceEvent(UnityGfxDeviceEventType event)
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case kUnityGfxDeviceEventInitialize:
|
||||
@@ -93,6 +99,8 @@ extern "C"
|
||||
|
||||
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API UnityPluginLoad(IUnityInterfaces* unityInterfaces)
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
g_unity = unityInterfaces;
|
||||
auto unityGraphics = g_unity->Get<IUnityGraphics>();
|
||||
unityGraphics->RegisterDeviceEventCallback(OnGraphicsDeviceEvent);
|
||||
@@ -100,6 +108,8 @@ extern "C"
|
||||
|
||||
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API UnityPluginUnload()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
auto unityGraphics = g_unity->Get<IUnityGraphics>();
|
||||
unityGraphics->UnregisterDeviceEventCallback(OnGraphicsDeviceEvent);
|
||||
g_unity = nullptr;
|
||||
@@ -107,6 +117,8 @@ extern "C"
|
||||
|
||||
void UNITY_INTERFACE_API OnRenderEvent(int id)
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
if (!g_manager) return;
|
||||
if (auto monitor = g_manager->GetMonitor(id))
|
||||
{
|
||||
@@ -121,18 +133,24 @@ extern "C"
|
||||
|
||||
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API Reinitialize()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
if (!g_manager) return;
|
||||
return g_manager->Reinitialize();
|
||||
}
|
||||
|
||||
UNITY_INTERFACE_EXPORT void UNITY_INTERFACE_API Update()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
if (!g_manager) return;
|
||||
g_manager->Update();
|
||||
}
|
||||
|
||||
UNITY_INTERFACE_EXPORT Message UNITY_INTERFACE_API PopMessage()
|
||||
{
|
||||
Debug::Log(__FUNCTION__);
|
||||
|
||||
if (g_messages.empty()) return Message::None;
|
||||
|
||||
const auto message = g_messages.front();
|
||||
|
||||
Reference in New Issue
Block a user