diff --git a/.gitignore b/.gitignore index 2eea525..de410db 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.env \ No newline at end of file +.env +build/ \ No newline at end of file diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..6c45a5f --- /dev/null +++ b/build.ps1 @@ -0,0 +1,23 @@ +#!/usr/bin/env pwsh + +. ".\common.ps1" + +$game_name = $env:GAME_NAME ?? "game" + +New-Item -ItemType Directory -Force -Path "./build/" | Out-Null +tar -cf "./build/$game_name.tar" -C $(Resolve-Path "./game/") * + +$output = "./build/$game_name.exe" +[System.IO.File]::Copy("./lovedos/love.exe", $output, $true) +Add-Content $output -AsByteStream -Value $(Get-Content -Raw -AsByteStream $(Resolve-Path "./build/$game_name.tar")) +try { + $stream = $(Get-Item $output).Open([System.IO.FileMode]::Append) + $writer = [System.IO.BinaryWriter]::new($stream) + + $tar = Get-Item "./build/$game_name.tar" + $writer.Write([Char[]] ('T', 'A', 'R', 0)) + $writer.Write([Int32] ($tar.Length + 8)) +} finally { + $writer.Dispose() + $stream.Dispose() +} \ No newline at end of file diff --git a/example.env b/example.env index 5232231..0d33b0f 100644 --- a/example.env +++ b/example.env @@ -1,3 +1,4 @@ LOVE2D_EXE=C:/Program Files/LOVE/love.exe DOSBOX_X_EXE=C:/DOSBox-X/dosbox-x.exe -DOSBOX_X_CPU=pentium_ii \ No newline at end of file +DOSBOX_X_CPU=pentium_ii +GAME_NAME=example \ No newline at end of file