Skip to content

Releases: hecomi/uDesktopDuplication

v1.8.0 Released

21 Nov 09:21
954734e
Compare
Choose a tag to compare

The directory structure has been changed to support UPM. You can now use the Package Manager from the following URL:

And also uDesktopDuplication has been published to npm. You can import uLipSync into your project by registering the following url and scope to Scoped Registry.

  • URL: https://registry.npmjs.com
  • Scope: com.hecomi

v1.7.0 Released!

21 Mar 10:31
Compare
Choose a tag to compare

Update

  • Add asmdef files to separate uDD scripts into different projects.
  • Add ColorScale (for unlit shaders) and Emissive (for a standard shader).

Bug Fix

  • Fix cursor captre bug #33
    ETKEvyEU0AIL5Em

v1.6.0 Released

28 Dec 15:16
Compare
Choose a tag to compare

Update

  • add Monitor.buffer to access the buffer pointer directly.

Bug Fix

  • fix GetPixels() bug #27.

Example

using UnityEngine;
using System;
using System.Runtime.InteropServices;

public class BufferExample : MonoBehaviour
{
    [SerializeField]
    uDesktopDuplication.Texture uddTexture;

    Texture2D texture_;
    Color32[] pixels_;
    GCHandle handle_;
    IntPtr ptr_ = IntPtr.Zero;

    [DllImport("msvcrt.dll", CallingConvention = CallingConvention.Cdecl, SetLastError = false)]
    public static extern IntPtr memcpy(IntPtr dest, IntPtr src, int count);

    void Start()
    {
        if (!uddTexture) return;

        uddTexture.monitor.useGetPixels = true;
        UpdateTexture();
    }

    void OnDestroy()
    {
        if (ptr_ != IntPtr.Zero) {
            handle_.Free();
        }
    }

    void Update()
    {
        if (!uddTexture) return;

        if (uddTexture.monitor.width != texture_.width || 
            uddTexture.monitor.height != texture_.height) {
            UpdateTexture();
        }

        CopyTexture();
    }

    void UpdateTexture()
    {
        var width = uddTexture.monitor.width;
        var height = uddTexture.monitor.height;

        // TextureFormat.BGRA32 should be set but it causes an error now.
        texture_ = new Texture2D(width, height, TextureFormat.RGBA32, false);
        texture_.filterMode = FilterMode.Bilinear;
        pixels_ = texture_.GetPixels32();
        handle_ = GCHandle.Alloc(pixels_, GCHandleType.Pinned);
        ptr_ = handle_.AddrOfPinnedObject();

        GetComponent<Renderer>().material.mainTexture = texture_;
    }

    void CopyTexture()
    {
        var buffer = uddTexture.monitor.buffer;
        if (buffer == IntPtr.Zero) return;

        var width = uddTexture.monitor.width;
        var height = uddTexture.monitor.height;
        memcpy(ptr_, buffer, width * height * sizeof(Byte) * 4);

        texture_.SetPixels32(pixels_);
        texture_.Apply();
    }
}

buffer

The texture of the right-side plane is updated by copying the buffer directly with memcpy() from the left-side one.

v1.5.7 Released

08 Dec 04:45
Compare
Choose a tag to compare

Changes

  • Output more logs like Windows OS, graphics cards, and monitors.
  • Add function-scope timers for debug (only in a debug build).

Output log example

Release build

[uDD::Log][2018-12-08 13:35:26] Start
[uDD::Log][2018-12-08 13:35:26] OS Version    : 10.0
[uDD::Log][2018-12-08 13:35:26] Build Number  : 17134
[uDD::Log][2018-12-08 13:35:26] Service Pack  : 
[uDD::Log][2018-12-08 13:35:26] Graphics Card [0] : NVIDIA GeForce GTX 1080
[uDD::Log][2018-12-08 13:35:26]   > Monitor[0] : \\.\DISPLAY1
[uDD::Log][2018-12-08 13:35:26]   > Monitor[1] : \\.\DISPLAY2
[uDD::Log][2018-12-08 13:35:26] Graphics Card [1] : Microsoft Basic Render Driver
[uDD::Log][2018-12-08 13:35:26] Monitor::Initialized() =>
[uDD::Log][2018-12-08 13:35:26]     ID    : 0
[uDD::Log][2018-12-08 13:35:26]     Size  : (3840, 2160)
[uDD::Log][2018-12-08 13:35:26]     DPI   : (162, 161)
[uDD::Log][2018-12-08 13:35:26]     Rot   : Landscape
[uDD::Log][2018-12-08 13:35:26] Duplicator::Initialize() => OK.
[uDD::Log][2018-12-08 13:35:26] Monitor::Initialized() =>
[uDD::Log][2018-12-08 13:35:26]     ID    : 1
[uDD::Log][2018-12-08 13:35:26]     Size  : (3840, 2160)
[uDD::Log][2018-12-08 13:35:26]     DPI   : (162, 161)
[uDD::Log][2018-12-08 13:35:26]     Rot   : Landscape
[uDD::Log][2018-12-08 13:35:26] Duplicator::Initialize() => OK.
[uDD::Log][2018-12-08 13:35:33] Stop

Debug build

[uDD::Log][2018-12-08 13:43:35] Start
[uDD::Log][2018-12-08 13:43:35] OS Version    : 10.0
[uDD::Log][2018-12-08 13:43:35] Build Number  : 17134
[uDD::Log][2018-12-08 13:43:35] Service Pack  : 
[uDD::Log][2018-12-08 13:43:35] >> [0]MonitorManager::Initialize
[uDD::Log][2018-12-08 13:43:35] Graphics Card [0] : NVIDIA GeForce GTX 1080
[uDD::Log][2018-12-08 13:43:35]   > Monitor[0] : \\.\DISPLAY1
[uDD::Log][2018-12-08 13:43:35]   > Monitor[1] : \\.\DISPLAY2
[uDD::Log][2018-12-08 13:43:35] Graphics Card [1] : Microsoft Basic Render Driver
[uDD::Log][2018-12-08 13:43:35] >> [1]Monitor::Initialize
[uDD::Log][2018-12-08 13:43:35] Monitor::Initialized() =>
[uDD::Log][2018-12-08 13:43:35]     ID    : 0
[uDD::Log][2018-12-08 13:43:35]     Size  : (3840, 2160)
[uDD::Log][2018-12-08 13:43:35]     DPI   : (162, 161)
[uDD::Log][2018-12-08 13:43:35]     Rot   : Landscape
[uDD::Log][2018-12-08 13:43:35] >> [2]Duplicator::InitializeDevice
[uDD::Log][2018-12-08 13:43:35] >> [3]IsolatedD3D11Device::Create
[uDD::Log][2018-12-08 13:43:35] << [3]IsolatedD3D11Device::Create : 22291[us]
[uDD::Log][2018-12-08 13:43:35] << [2]Duplicator::InitializeDevice : 22461[us]
[uDD::Log][2018-12-08 13:43:35] >> [4]Duplicator::InitializeDuplication
[uDD::Log][2018-12-08 13:43:35] Duplicator::Initialize() => OK.
[uDD::Log][2018-12-08 13:43:35] << [4]Duplicator::InitializeDuplication : 7352[us]
[uDD::Log][2018-12-08 13:43:35] >> [5]Duplicator::CheckUnityAdapter
[uDD::Log][2018-12-08 13:43:35] >> [6]GetUnityAdapterLuid
[uDD::Log][2018-12-08 13:43:35] << [6]GetUnityAdapterLuid : 27[us]
[uDD::Log][2018-12-08 13:43:35] << [5]Duplicator::CheckUnityAdapter : 82[us]
[uDD::Log][2018-12-08 13:43:35] << [1]Monitor::Initialize : 30201[us]
[uDD::Log][2018-12-08 13:43:35] >> [7]Monitor::StartCapture
[uDD::Log][2018-12-08 13:43:35] >> [8]Duplicator::Start
[uDD::Log][2018-12-08 13:43:35] >> [9]Duplicator::Stop
[uDD::Log][2018-12-08 13:43:35] << [9]Duplicator::Stop : 20[us]
[uDD::Log][2018-12-08 13:43:35] >> [10]Duplicator::Duplicate
[uDD::Log][2018-12-08 13:43:35] >> [11]Duplicator::Release
[uDD::Log][2018-12-08 13:43:35] << [11]Duplicator::Release : 24[us]
[uDD::Log][2018-12-08 13:43:35] << [8]Duplicator::Start : 440[us]
[uDD::Log][2018-12-08 13:43:35] << [7]Monitor::StartCapture : 650[us]
[uDD::Log][2018-12-08 13:43:35] >> [12]Monitor::Initialize
[uDD::Log][2018-12-08 13:43:35] Monitor::Initialized() =>
[uDD::Log][2018-12-08 13:43:35]     ID    : 1
[uDD::Log][2018-12-08 13:43:35]     Size  : (3840, 2160)
[uDD::Log][2018-12-08 13:43:35]     DPI   : (162, 161)
[uDD::Log][2018-12-08 13:43:35]     Rot   : Landscape
[uDD::Log][2018-12-08 13:43:35] >> [14]Duplicator::InitializeDevice
[uDD::Log][2018-12-08 13:43:35] >> [13]IsolatedD3D11Device::GetCompatibleSharedTexture
[uDD::Log][2018-12-08 13:43:35] >> [15]IsolatedD3D11Device::Create
[uDD::Log][2018-12-08 13:43:35] << [13]IsolatedD3D11Device::GetCompatibleSharedTexture : 350[us]
[uDD::Log][2018-12-08 13:43:35] >> [16]Duplicator::UpdateCursor
[uDD::Log][2018-12-08 13:43:35] >> [17]Cursor::UpdateBuffer
[uDD::Log][2018-12-08 13:43:35] << [17]Cursor::UpdateBuffer : 56[us]
[uDD::Log][2018-12-08 13:43:35] >> [18]Cursor::UpdateTexture
[uDD::Log][2018-12-08 13:43:35] << [18]Cursor::UpdateTexture : 3162[us]
[uDD::Log][2018-12-08 13:43:35] << [16]Duplicator::UpdateCursor : 3399[us]
[uDD::Log][2018-12-08 13:43:35] >> [19]Duplicator::UpdateMetadata
[uDD::Log][2018-12-08 13:43:35] << [19]Duplicator::UpdateMetadata : 24[us]
[uDD::Log][2018-12-08 13:43:35] << [10]Duplicator::Duplicate : 4279[us]
[uDD::Log][2018-12-08 13:43:35] >> [20]Duplicator::Duplicate
[uDD::Log][2018-12-08 13:43:35] >> [21]Duplicator::Release
[uDD::Log][2018-12-08 13:43:35] << [21]Duplicator::Release : 68[us]
[uDD::Log][2018-12-08 13:43:35] << [15]IsolatedD3D11Device::Create : 19484[us]
[uDD::Log][2018-12-08 13:43:35] << [14]Duplicator::InitializeDevice : 19582[us]
[uDD::Log][2018-12-08 13:43:35] >> [22]Duplicator::InitializeDuplication
...

v1.5.6 Released

17 Nov 04:29
Compare
Choose a tag to compare

Bug Fix

  • Fix Shader.PropertyToID() problem in Unity 5.x #26

v1.5.5 Released

12 Sep 12:50
Compare
Choose a tag to compare

Bug Fix

  • fix the crash bug caused by Windows sleep.

v1.5.4 Released

11 Sep 15:08
Compare
Choose a tag to compare

Bug Fix

  • fixed a runtime error when using the IL2CPP scripting backend #24 (thank you @dj-kusuha 👍)
  • consider clipPos and clipScale for raycast.

v1.5.3 Released

04 Aug 15:28
Compare
Choose a tag to compare

Bug fix

  • Fix darker screen bug caused after Unity 2018.1.

v1.5.2 Released

23 Aug 16:39
Compare
Choose a tag to compare

Bug Fix

  • Fix bugs that caused x86 build problem.

v1.5.1 Released

07 Jan 15:22
Compare
Choose a tag to compare

Bug Fix

  • Fix flickering cursor bug caused by the update timing of cursor image in GPU.

Demo