技术分享 · 2025年4月9日

Sunshine + Moonlight 串流

实现手机玩 PC 里面 Playnite 管理的游戏

第一步:访问 Sunshine 官方 GitHub 仓库

https://github.com/LizardByte/Sunshine/releases
下载:sunshine-windows-portable.zip   便携版
运行:D:\Games\sunshine-windows-portable\Sunshine 路径下,sunshine.exe 启用服务

第二步:浏览器访问本地 Sunshine 管理界面

https://localhost:47990
初始用户名:sunshine   密码:sunshine

第三步:安装 ViGEmBus 虚拟手柄驱动

https://github.com/nefarius/ViGEmBus/releases
下载:ViGEmBus_1.22.0_x64_x86_arm64.exe 并安装,重启 Sunshine 生效!!!
注释:ViGEmBus 是虚拟手柄驱动,用于把手机端(Moonlight)手柄输入,映射成 Windows 能识别的手柄(Xbox 360/One)信号。如果没它,你在手机上连接手柄,PC 是感知不到的!

第四步:在 Google Play 或 Github 下载最新版 Moonlight 并安装

Moonlight PC客户端⬇
https://github.com/moonlight-stream/moonlight-qt
Moonlight 安卓客户端⬇
https://github.com/moonlight-stream/moonlight-android
iOS 设备或 Apple TV 客户端⬇
https://github.com/moonlight-stream/moonlight-ios

第五步:在 Sunshine 的设置

在 https://localhost:47990 顶部找到 Configuration 进入设置中文界面
进入顶部应用程序,添加新应用
应用名称:Playnite
命令:"D:\Games\Playnite\Playnite.FullscreenApp.exe" #填写 Playnite 的全屏应用程序路径
工作目录:D:\Games\Playnite #填写 Playnite 的文件夹路径
以管理员身份运行:勾选✔
图片:D:\Games\Playnite\playnite.png #上传自定义的 Logo 图片
其他保持默认!

第六步:在 Moonlight 客户端的设置

完成手机与 PC 的配对
在手机打开 Moonlight 点击,Lenovo-7840HS,查看 PIN 码。
在 PC 的浏览器 https://localhost:47990/pin ,在 PIN 中,输入手机上看见的 PIN 码。
在手机的 Moonlight 中设置,将画面拉伸至全屏✔

第七步:YUZU 模拟 Switch 手柄设置

在 YUZU ,模拟,设置,控制,玩家1,输入设备,选择 XBOX 360 Controller 0【另一个手柄选择 XBOX 360 Controller 1】

第八步:非局域网,远程串流的设置

***在路由器的设置:
1、确保 net.xxxxxxx.com 域名已经成功 DDNS 到本地 IP
2、配置 Sunshine 的端口转发
TCP端口:47984, 47989, 47990, 48010
UDP端口:47998, 47999,48000
***在 Moonlight 客户端的设置:
1、在 Moonlight 主界面,点击右上角的 “Add Manually” 或 “手动添加服务器”
2、在手动添加界面,输入你的DDNS域名:net.xxxxxxx.com,并点击“确认”
注意:确保你输入的是完整的域名,不要加 http:// 或 https://,只需输入 net.xxxxxxx.com
3、完成 Moonlight 与 Sunshine 的 PIN 配对

第九步:设置证书,解决 https 安全访问【慎用,暂未解决串流连接失败的问题】

证书路径:
D:\Games\sunshine-windows-portable\Sunshine\config\credentials
把 net.xxxxxxx.com 证书和密钥内容,替换进去!
使用 https://net.xxxxxxx.com:47990 访问!
完美实现 https 安全访问!!!

END