From fc81c2634ce269317563657822aec0fb4e8d9acc Mon Sep 17 00:00:00 2001 From: Lenheart <947330670@qq.com> Date: Wed, 18 Mar 2026 12:51:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(switch):=20=E6=B7=BB=E5=8A=A0=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E7=9B=AE=E6=A0=87=E6=97=B6=E8=87=AA=E5=8A=A8=E6=89=A7?= =?UTF-8?q?=E8=A1=8Cnxlink=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加on_run回调函数,在目标运行时会自动通过nxlink.exe启动生成的NRO文件 --- platform/switch.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/platform/switch.lua b/platform/switch.lua index 6e933cb..50eeba6 100644 --- a/platform/switch.lua +++ b/platform/switch.lua @@ -47,7 +47,6 @@ target("Frostbite2D") -- 构建后生成 NRO 文件 - -- 复制着色器文件到输出目录 after_build(function (target) local elf_file = target:targetfile() local output_dir = path.directory(elf_file) @@ -80,4 +79,17 @@ target("Frostbite2D") print("Copy assets directory: " .. assets_dir .. " -> " .. target_assets_dir) end end) + target_end() + +on_run(function (target) + local output_dir = path.directory(target:targetfile()) + local nro_file = path.join(output_dir, "hello_world.nro") + os.execv("cmd.exe", { + "/c", + "chcp 65001 >nul & nxlink.exe", + "-s", + "-a", "192.168.200.50", + nro_file + }) +end) \ No newline at end of file