Changes for VirtualBox 7+ Compatibility
- 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.
This commit is contained in:
		
							
								
								
									
										13
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							@@ -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"
 | 
			
		||||
        }
 | 
			
		||||
    ]
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										22
									
								
								readme.md
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								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", 
 | 
			
		||||
                    "<YOUR UUID HERE>"
 | 
			
		||||
                ],
 | 
			
		||||
                "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`.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										16
									
								
								virtualbox-wrapper.ps1
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								virtualbox-wrapper.ps1
									
									
									
									
									
										Normal file
									
								
							@@ -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
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user