From b62bcad0902dfcc18090040bdb45ea25c70ea01e Mon Sep 17 00:00:00 2001 From: suqi8 <3383787570@qq.com> Date: Mon, 9 Dec 2024 16:06:01 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat(Scrcpy):=20=E6=B7=BB=E5=8A=A0=E8=99=9A?= =?UTF-8?q?=E6=8B=9F=E5=B1=8F=E5=B9=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 Scrcpy 设置中增加虚拟屏幕相关选项- 新增启用虚拟屏幕和虚拟屏幕包名设置 - 在 Scrcpy 启动参数中添加相应配置 - 更新多语言资源文件,添加虚拟屏幕相关翻译 --- UotanToolbox/Assets/Resources.Designer.cs | 27 ++++++++++++++++ UotanToolbox/Assets/Resources.resx | 9 ++++++ UotanToolbox/Assets/Resources.zh-CN.resx | 9 ++++++ UotanToolbox/Features/Scrcpy/ScrcpyView.axaml | 32 +++++++++++++++++++ .../Features/Scrcpy/ScrcpyViewModel.cs | 13 ++++++-- 5 files changed, 88 insertions(+), 2 deletions(-) diff --git a/UotanToolbox/Assets/Resources.Designer.cs b/UotanToolbox/Assets/Resources.Designer.cs index f02e6858..204a10ee 100644 --- a/UotanToolbox/Assets/Resources.Designer.cs +++ b/UotanToolbox/Assets/Resources.Designer.cs @@ -3421,6 +3421,24 @@ public static string Scrcpy_CameraMirror { } } + /// + /// 查找类似 Enable Virtual Screen 的本地化字符串。 + /// + public static string Scrcpy_Enable_Virtual_Screen { + get { + return ResourceManager.GetString("Scrcpy_Enable_Virtual_Screen", resourceCulture); + } + } + + /// + /// 查找类似 Virtual Screen Package 的本地化字符串。 + /// + public static string Scrcpy_Virtual_Screen_Package { + get { + return ResourceManager.GetString("Scrcpy_Virtual_Screen_Package", resourceCulture); + } + } + /// /// 查找类似 Casting... 的本地化字符串。 /// @@ -3610,6 +3628,15 @@ public static string Scrcpy_WindowTopping { } } + /// + /// 查找类似 Virtual display 的本地化字符串。 + /// + public static string Scrcpy_VirtualDisplay { + get { + return ResourceManager.GetString("Scrcpy_VirtualDisplay", resourceCulture); + } + } + /// /// 查找类似 About 的本地化字符串。 /// diff --git a/UotanToolbox/Assets/Resources.resx b/UotanToolbox/Assets/Resources.resx index 15da0fc8..cb9327dd 100644 --- a/UotanToolbox/Assets/Resources.resx +++ b/UotanToolbox/Assets/Resources.resx @@ -579,6 +579,12 @@ Record Screen + + Enable the virtual screen + + + Virtual Screen Package name + Scrcpy Casting Tool @@ -600,6 +606,9 @@ Window topping + + Virtual display + Create diff --git a/UotanToolbox/Assets/Resources.zh-CN.resx b/UotanToolbox/Assets/Resources.zh-CN.resx index 64f15c01..8d0cd811 100644 --- a/UotanToolbox/Assets/Resources.zh-CN.resx +++ b/UotanToolbox/Assets/Resources.zh-CN.resx @@ -600,6 +600,15 @@ 窗口置顶 + + 虚拟屏幕 + + + 启用虚拟屏幕 + + + 虚拟屏幕包名 + 创建分区 diff --git a/UotanToolbox/Features/Scrcpy/ScrcpyView.axaml b/UotanToolbox/Features/Scrcpy/ScrcpyView.axaml index b3aea4e5..71b7ca1e 100644 --- a/UotanToolbox/Features/Scrcpy/ScrcpyView.axaml +++ b/UotanToolbox/Features/Scrcpy/ScrcpyView.axaml @@ -315,6 +315,38 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/UotanToolbox/Features/Scrcpy/ScrcpyViewModel.cs b/UotanToolbox/Features/Scrcpy/ScrcpyViewModel.cs index 8c79c8e3..6bf5bd1f 100644 --- a/UotanToolbox/Features/Scrcpy/ScrcpyViewModel.cs +++ b/UotanToolbox/Features/Scrcpy/ScrcpyViewModel.cs @@ -18,9 +18,9 @@ public partial class ScrcpyViewModel : MainPageBase { [ObservableProperty] private bool _recordScreen = false, _windowFixed = false, _computerControl = true, _fullScreen = false, _showBorder = true, - _showTouch = true, _closeScreen = false, _screenAwake = false, _screenAwakeStatus = true, _clipboardSync = true, _cameraMirror = false; + _showTouch = true, _closeScreen = false, _screenAwake = false, _screenAwakeStatus = true, _clipboardSync = true, _cameraMirror = false,_enableVirtualScreen = false; [ObservableProperty] private bool _IsConnecting; - [ObservableProperty] private string _windowTitle, _recordFolder; + [ObservableProperty] private string _windowTitle, _recordFolder, _virtualScreenPackage; [ObservableProperty][Range(0d, 50d)] private double _bitRate = 8; [ObservableProperty][Range(0d, 144d)] private double _frameRate = 60; @@ -77,6 +77,15 @@ await Dispatcher.UIThread.InvokeAsync(async () => { arg += $"--max-size {SizeResolution} "; } + + if (EnableVirtualScreen) + { + arg += "--new-display "; + } + if (VirtualScreenPackage != "") + { + arg += $"--start-app={VirtualScreenPackage} "; + } if (WindowTitle is not "" and not null) { From 1eab8a609d87a4f5fa95311e9192994506e915d8 Mon Sep 17 00:00:00 2001 From: suqi8 <3383787570@qq.com> Date: Tue, 10 Dec 2024 16:17:19 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat(Scrcpy):=20=E5=85=A8=E5=B1=8F=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E6=B7=BB=E5=8A=A0=E5=86=85=E5=AE=B9=E4=BF=9D?= =?UTF-8?q?=E6=8A=A4=E5=8A=9F=E8=83=BD=20-=20=E5=9C=A8=E5=85=A8=E5=B1=8F?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8B=E6=B7=BB=E5=8A=A0=20--no-vd-destroy?= =?UTF-8?q?-content=20=E5=8F=82=E6=95=B0=20-=20=E6=AD=A4=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=8F=AF=E9=98=B2=E6=AD=A2=E5=9C=A8=E6=96=AD=E5=BC=80=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E6=97=B6=E5=88=A0=E9=99=A4=E8=99=9A=E6=8B=9F=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=99=A8=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UotanToolbox/Features/Scrcpy/ScrcpyViewModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UotanToolbox/Features/Scrcpy/ScrcpyViewModel.cs b/UotanToolbox/Features/Scrcpy/ScrcpyViewModel.cs index 6bf5bd1f..fa2358ff 100644 --- a/UotanToolbox/Features/Scrcpy/ScrcpyViewModel.cs +++ b/UotanToolbox/Features/Scrcpy/ScrcpyViewModel.cs @@ -98,7 +98,7 @@ await Dispatcher.UIThread.InvokeAsync(async () => if (FullScreen) { - arg += "--fullscreen "; + arg += "--fullscreen --no-vd-destroy-content "; } if (!ShowBorder) From f3fdca2f01ef60f090e9fc1e035142dfa517fea5 Mon Sep 17 00:00:00 2001 From: suqi8 <3383787570@qq.com> Date: Tue, 10 Dec 2024 18:04:06 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat(Scrcpy):=20=E6=B7=BB=E5=8A=A0=E8=99=9A?= =?UTF-8?q?=E6=8B=9F=E5=B1=8F=E5=B9=95=E5=88=86=E8=BE=A8=E7=8E=87=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 ScrcpyView 中添加了虚拟屏幕分辨率设置的文本框 - 在 ScrcpyViewModel 中添加了 VirtualScreenDisplaySize 属性 - 更新了 Resources 文件,添加了相关本地化字符串 - 修改了启动参数,支持自定义虚拟屏幕分辨率 --- UotanToolbox/Assets/Resources.Designer.cs | 24 ++++++++++++++++++- UotanToolbox/Assets/Resources.resx | 6 +++++ UotanToolbox/Assets/Resources.zh-CN.resx | 20 ++++++++++------ UotanToolbox/Features/Scrcpy/ScrcpyView.axaml | 11 ++++++++- .../Features/Scrcpy/ScrcpyViewModel.cs | 14 +++++++++-- 5 files changed, 64 insertions(+), 11 deletions(-) diff --git a/UotanToolbox/Assets/Resources.Designer.cs b/UotanToolbox/Assets/Resources.Designer.cs index 204a10ee..464aa5e7 100644 --- a/UotanToolbox/Assets/Resources.Designer.cs +++ b/UotanToolbox/Assets/Resources.Designer.cs @@ -3438,7 +3438,29 @@ public static string Scrcpy_Virtual_Screen_Package { return ResourceManager.GetString("Scrcpy_Virtual_Screen_Package", resourceCulture); } } - + + /// + /// 查找类似 Virtual Screen Display Size 的本地化字符串。 + /// + public static string Scrcpy_VS_DisplaySize + { + get + { + return ResourceManager.GetString("Scrcpy_VS_DisplaySize", resourceCulture); + } + } + + /// + /// 查找类似 Virtual Screen Display Size Example 的本地化字符串。 + /// + public static string Scrcpy_VS_DisplaySizeExample + { + get + { + return ResourceManager.GetString("Scrcpy_VS_DisplaySizeExample", resourceCulture); + } + } + /// /// 查找类似 Casting... 的本地化字符串。 /// diff --git a/UotanToolbox/Assets/Resources.resx b/UotanToolbox/Assets/Resources.resx index cb9327dd..651837f8 100644 --- a/UotanToolbox/Assets/Resources.resx +++ b/UotanToolbox/Assets/Resources.resx @@ -1497,4 +1497,10 @@ If you wish to replace Magisk, please first select your Magisk on the Basic Flas Fastboot device detected, but it seems that the current system has not written relevant USB rules. Should you try to execute with root privileges? + + Virtual Screen Display Size + + + 1920x1080/460 (Height × Width)/dpi + \ No newline at end of file diff --git a/UotanToolbox/Assets/Resources.zh-CN.resx b/UotanToolbox/Assets/Resources.zh-CN.resx index 8d0cd811..e946a834 100644 --- a/UotanToolbox/Assets/Resources.zh-CN.resx +++ b/UotanToolbox/Assets/Resources.zh-CN.resx @@ -574,11 +574,17 @@ 等比缩放 - + 录屏目录 录制屏幕 + + 启用虚拟屏幕 + + + 虚拟屏幕包名 + Scrcpy投屏工具 @@ -603,12 +609,6 @@ 虚拟屏幕 - - 启用虚拟屏幕 - - - 虚拟屏幕包名 - 创建分区 @@ -1494,4 +1494,10 @@ 检测到Fastboot设备,但当前系统似乎存未写入相关USB规则,是否尝试以Root权限执行? + + 虚拟屏幕大小 + + + 1920x1080/460 (高 × 宽)/dpi + \ No newline at end of file diff --git a/UotanToolbox/Features/Scrcpy/ScrcpyView.axaml b/UotanToolbox/Features/Scrcpy/ScrcpyView.axaml index 71b7ca1e..3b888659 100644 --- a/UotanToolbox/Features/Scrcpy/ScrcpyView.axaml +++ b/UotanToolbox/Features/Scrcpy/ScrcpyView.axaml @@ -317,7 +317,7 @@ @@ -344,6 +344,15 @@ Text="{x:Static assets:Resources.Scrcpy_Virtual_Screen_Package}" /> + + + + diff --git a/UotanToolbox/Features/Scrcpy/ScrcpyViewModel.cs b/UotanToolbox/Features/Scrcpy/ScrcpyViewModel.cs index fa2358ff..c036082b 100644 --- a/UotanToolbox/Features/Scrcpy/ScrcpyViewModel.cs +++ b/UotanToolbox/Features/Scrcpy/ScrcpyViewModel.cs @@ -20,7 +20,7 @@ public partial class ScrcpyViewModel : MainPageBase private bool _recordScreen = false, _windowFixed = false, _computerControl = true, _fullScreen = false, _showBorder = true, _showTouch = true, _closeScreen = false, _screenAwake = false, _screenAwakeStatus = true, _clipboardSync = true, _cameraMirror = false,_enableVirtualScreen = false; [ObservableProperty] private bool _IsConnecting; - [ObservableProperty] private string _windowTitle, _recordFolder, _virtualScreenPackage; + [ObservableProperty] private string _windowTitle, _recordFolder, _virtualScreenPackage, _virtualScreenDisplaySize; [ObservableProperty][Range(0d, 50d)] private double _bitRate = 8; [ObservableProperty][Range(0d, 144d)] private double _frameRate = 60; @@ -80,13 +80,23 @@ await Dispatcher.UIThread.InvokeAsync(async () => if (EnableVirtualScreen) { - arg += "--new-display "; + if (VirtualScreenDisplaySize != "") + { + arg += $"--new-display={VirtualScreenDisplaySize} "; + } + else + { + arg += $"--new-display "; + } } + if (VirtualScreenPackage != "") { arg += $"--start-app={VirtualScreenPackage} "; } + + if (WindowTitle is not "" and not null) { arg += $"--window-title \"{WindowTitle.Replace("\"", "\\\"")}\" ";