From 25df2761011fc0554642191d8d417fde307882ae Mon Sep 17 00:00:00 2001 From: Kieron Morris Date: Sat, 8 Mar 2025 18:59:12 +0000 Subject: [PATCH] VirtualBox 7 Compatability Changes - Created a PowerShell script `virtualbox-wrapper.ps1` to wrap calls to vboxmanage and only exit once the virtual machine has been terminated. - Updated launch.json to use the PowerShell launch type to launch `virtualbox-wrapper.ps1` with the machine name supplied as an argument. - Updated `readme.md` to reflect these changes. --- .vscode/launch.json | 13 +++---------- readme.md | 22 ++++++++-------------- virtualbox-wrapper.ps1 | 16 ++++++++++++++++ 3 files changed, 27 insertions(+), 24 deletions(-) create mode 100644 virtualbox-wrapper.ps1 diff --git a/.vscode/launch.json b/.vscode/launch.json index c945c666..56f57f0f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -3,18 +3,11 @@ { "name":"Run", "request": "launch", - "type": "coreclr", + "type": "PowerShell", "preLaunchTask": "Build", - "program": "VBoxSDL", - "args": [ - "--comment", - "Asuro", - "--startvm", - "7d395c96-891c-4139-b77d-9b6b144b0b93" - ], + "script": "${workspaceFolder}/virtualbox-wrapper.ps1", + "args": ["-MachineName", "7d395c96-891c-4139-b77d-9b6b144b0b93"], "cwd": "${workspaceFolder}", - "console": "internalConsole", - "internalConsoleOptions": "neverOpen" } ] } \ No newline at end of file diff --git a/readme.md b/readme.md index 0f1f1865..afb9b984 100644 --- a/readme.md +++ b/readme.md @@ -13,8 +13,8 @@ We welcome everyone to give building/breaking/fixing/shooting Asuro a go, feel f I don't think this needs an explaination. * [VSCode (Optional, but highly recommended)](https://code.visualstudio.com/) Visual Studio code is our IDE of choice, and we have a number of recommended plugins. - * [C# Plugin by Microsoft](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp) - This plugin gives you the ability to use the 'coreclr' task type, allowing the automatic launching of virtualbox with the resulting image generated during compilation of Asuro. + * [PowerShell Plugin by Microsoft](https://marketplace.visualstudio.com/items?itemName=ms-vscode.powershell) + This plugin gives you the ability to use the 'PowerShell' task type, allowing the automatic launching of virtualbox with the resulting image generated during compilation of Asuro. * [VirtualBox](https://www.virtualbox.org/) Virtualbox is our Virtualisation environment of choice, don't ask why, it just is. @@ -27,7 +27,7 @@ We welcome everyone to give building/breaking/fixing/shooting Asuro a go, feel f 3. Install Docker for Windows. 4. Install Git for Windows. 5. Install VSCode & the listed plugins. -6. Install VirtualBox. +6. Install VirtualBox (v7+). 7. Clone this repository. 8. Run the following command in the root of the repo to build the docker image: ```powershell @@ -57,18 +57,11 @@ We welcome everyone to give building/breaking/fixing/shooting Asuro a go, feel f { "name":"Run", "request": "launch", - "type": "coreclr", + "type": "PowerShell", "preLaunchTask": "Build", - "program": "VBoxSDL", - "args": [ - "--comment", - "Asuro", - "--startvm", - "" - ], + "script": "${workspaceFolder}/virtualbox-wrapper.ps1", + "args": ["-MachineName", "7d395c96-891c-4139-b77d-9b6b144b0b93"], "cwd": "${workspaceFolder}", - "console": "internalConsole", - "internalConsoleOptions": "neverOpen" } ] } @@ -77,5 +70,6 @@ We welcome everyone to give building/breaking/fixing/shooting Asuro a go, feel f 13. Open your project folder in VSCode, use CTRL+SHIFT+B to build & F5 to build + run in VBox. 14. Congratulations! You can now play with Asuro! -### Gotchas +### Notes & Gotchas +- The above process has been updated to be compatible with VirtualBox 7+, in which VBoxSDL was removed and vboxmanage should be used in its place. A small wrapper powershell script is used to achieve this. - It was noted that Windows builds above `20H2` seem to have issues installing WSL2. We may have to wait for a patch from Microsoft to fix this. Our devs are currently using build `20H2`. diff --git a/virtualbox-wrapper.ps1 b/virtualbox-wrapper.ps1 new file mode 100644 index 00000000..fdd460f2 --- /dev/null +++ b/virtualbox-wrapper.ps1 @@ -0,0 +1,16 @@ +param ( + $MachineName +) + +VBoxManage.exe startvm $MachineName + +$running=$true +while($running) { + Start-Sleep -Seconds 1 + $status=(VBoxManage.exe list runningvms) + if($status) { + $running=$status.contains($MachineName) + } else { + $running=$false + } +} \ No newline at end of file