From 441fcc76df9fe4663651ffb831ac93bb65b8c6d1 Mon Sep 17 00:00:00 2001 From: Ivan Kuzmenko <6745157+rndtrash@users.noreply.github.com> Date: Thu, 4 Sep 2025 06:39:10 +0300 Subject: [PATCH 1/3] Added a build script --- .gitignore | 3 ++- build.ps1 | 23 +++++++++++++++++++++++ example.env | 3 ++- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 build.ps1 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 From 1c112977bb52472c36a6e87a2cf4a54b49acce59 Mon Sep 17 00:00:00 2001 From: Ivan Kuzmenko <6745157+rndtrash@users.noreply.github.com> Date: Thu, 4 Sep 2025 06:39:56 +0300 Subject: [PATCH 2/3] Close DosBox-X when LoveDOS exits --- run_dosbox.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/run_dosbox.ps1 b/run_dosbox.ps1 index 08e9d38..df0291f 100644 --- a/run_dosbox.ps1 +++ b/run_dosbox.ps1 @@ -10,4 +10,5 @@ RunProgram -program $dosbox_x -arguments "-nopromptfolder", "-set", "`"cputype=$cpu`"", "-c", "`"MOUNT C $(Resolve-Path "./lovedos/") `"", "-c", "`"MOUNT D $pwd `"", - "-c", "`"c:\love.exe d:\game `"" \ No newline at end of file + "-c", "`"c:\love.exe d:\game `"", + "-c", "exit" \ No newline at end of file From eff0fe1b23c8676b64d884193fe981303a5e9c56 Mon Sep 17 00:00:00 2001 From: Ivan Kuzmenko <6745157+rndtrash@users.noreply.github.com> Date: Thu, 4 Sep 2025 06:40:29 +0300 Subject: [PATCH 3/3] Add `platform.isNative` --- game/platform/dos.lua | 2 +- game/platform/native.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/game/platform/dos.lua b/game/platform/dos.lua index 020864e..0fc5b75 100644 --- a/game/platform/dos.lua +++ b/game/platform/dos.lua @@ -1,4 +1,4 @@ -local platform = {} +local platform = { isNative = false } function platform.init() -- TODO: NOOP diff --git a/game/platform/native.lua b/game/platform/native.lua index 5b9d639..be35531 100644 --- a/game/platform/native.lua +++ b/game/platform/native.lua @@ -1,4 +1,4 @@ -local platform = { mouse = {} } +local platform = { isNative = true, mouse = {} } local screenWidth = 320 local screenHeight = 200