diff --git a/.github/workflows/cross_compile.yml b/.github/workflows/cross_compile.yml index 5488064..8e36128 100644 --- a/.github/workflows/cross_compile.yml +++ b/.github/workflows/cross_compile.yml @@ -71,9 +71,24 @@ jobs: CGO_ENABLED: 0 run: | if [ "$GOOS" = "windows" ]; then - go build -o output/palworld-go-${{ matrix.os }}-${{ matrix.goarch }}.exe + go build -ldflags="-s -w" -o output/palworld-go-${{ matrix.os }}-${{ matrix.goarch }}.exe else - go build -o output/palworld-go-${{ matrix.os }}-${{ matrix.goarch }} + go build -ldflags="-s -w" -o output/palworld-go-${{ matrix.os }}-${{ matrix.goarch }} + fi + + - name: Compress executable files with UPX (except for palworld-go-android-arm64) + run: | + sudo apt-get update + sudo apt-get install -y upx + if [[ "${{ matrix.os }}" == *"windows"* ]]; then + FILENAME="output/palworld-go-${{ matrix.os }}-${{ matrix.goarch }}.exe" + else + FILENAME="output/palworld-go-${{ matrix.os }}-${{ matrix.goarch }}" + fi + if [[ "${{ matrix.os }}" == "android" && "${{ matrix.goarch }}" == "arm64" ]]; then + echo "Skipping UPX compression for $FILENAME" + else + upx --best --lzma "$FILENAME" fi - name: Upload artifacts diff --git a/main.go b/main.go index 180170a..c3b35c9 100644 --- a/main.go +++ b/main.go @@ -56,8 +56,8 @@ func main() { if runtime.GOOS == "windows" { //检查程序是否运行在合适目录 if _, err := os.Stat("PalServer.exe"); os.IsNotExist(err) { - // PalServer.exe不存在,查找PalServer-Win64-Test-Cmd.exe的路径 - cmd := exec.Command("cmd", "/C", "wmic process where name='PalServer-Win64-Test-Cmd.exe' get ExecutablePath") + // PalServer.exe不存在,查找PalServer-Win64-Shipping-Cmd.exe的路径 + cmd := exec.Command("cmd", "/C", "wmic process where name='PalServer-Win64-Shipping-Cmd.exe' get ExecutablePath") output, err := cmd.Output() if err != nil { fmt.Println("Failed to execute command:", err) @@ -66,7 +66,7 @@ func main() { outputStr := string(output) if !strings.Contains(outputStr, "ExecutablePath") { - fmt.Println("PalServer-Win64-Test-Cmd.exe not found") + fmt.Println("PalServer-Win64-Shipping-Cmd.exe not found") fmt.Println("Notice:Please restart this program after launching the game server, and the installation will be completed automatically, releasing a launch icon to the desktop.") fmt.Println("请打开游戏服务端后再次运行本程序,将会自动完成安装,释放启动图标到桌面。") showMessage("提示", "请打开游戏服务端保持运行后的同时运行本程序,\n将会自动寻找游戏路径,\n自动完成安装,并释放启动图标到桌面。\n请到桌面使用StartPalWorld.bat启动我。\nNotice:Please restart this program after launching the game server, and the installation will be completed automatically, releasing a launch icon to the desktop.") diff --git a/mod/embeds/palguard.dll b/mod/embeds/palguard.dll index 7fbf04d..83446a2 100644 Binary files a/mod/embeds/palguard.dll and b/mod/embeds/palguard.dll differ diff --git a/sys/restart_unix.go b/sys/restart_unix.go index bc933f5..70698a5 100644 --- a/sys/restart_unix.go +++ b/sys/restart_unix.go @@ -62,7 +62,7 @@ func KillProcess(config config.Config) error { if runtime.GOOS == "windows" { // Windows: 直接指定要结束的进程名称 - cmd = exec.Command("taskkill", "/IM", "PalServer-Win64-Test-Cmd.exe", "/F") + cmd = exec.Command("taskkill", "/IM", "PalServer-Win64-Shipping-Cmd.exe", "/F") } else { // 非Windows: 使用pkill命令和进程名称 cmd = exec.Command("pkill", "-f", "PalServer-Linux-Test") diff --git a/sys/restart_windows.go b/sys/restart_windows.go index a384141..9c065da 100644 --- a/sys/restart_windows.go +++ b/sys/restart_windows.go @@ -244,7 +244,7 @@ func RestartService(config config.Config) { fmt.Sprintf("-players=%d", config.WorldSettings.ServerPlayerMaxNum), } } else { - exePath = filepath.Join(config.GamePath, "Pal", "Binaries", "Win64", "PalServer-Win64-Test-Cmd.exe") + exePath = filepath.Join(config.GamePath, "Pal", "Binaries", "Win64", "PalServer-Win64-Shipping-Cmd.exe") args = []string{ "Pal", "-RconEnabled=True", @@ -310,7 +310,7 @@ func RestartService(config config.Config) { } ` // 使用config.GamePath和processName填充PowerShell脚本模板 - psScriptFormatted := fmt.Sprintf(psScript, "PalServer-Win64-Test-Cmd.exe", config.GamePath) + psScriptFormatted := fmt.Sprintf(psScript, "PalServer-Win64-Shipping-Cmd.exe", config.GamePath) // 调用PowerShell执行脚本 cmd := exec.Command("powershell", "-Command", psScriptFormatted)