Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
VirtualBoyGo powershell
<#
.SYNOPSIS
Downloads VirtualBoyGo source code
.DESCRIPTION
Gathers all dependencies and places them in the correct folders!
.NOTES
Author : Benjamin McLean mclean.ben@gmail.com
.LINK
https://github.com/CidVonHighwind/VirtualBoyGo
#>
# Warning: Getting this to build and work properly in Android Studio may require not only your ANDROID_HOME environment variable to be set for your Android SDK, but also ANDROID_NDK_HOME for your Android NDK. If you fail to do this, you may have signing problems.
<# INSTRUCTIONS:
1. Make sure you have 7-zip https://www.7-zip.org/ installed in the default location because my PowerShell depends on it.
2. Make sure you have Git for Windows https://git-scm.com/download/win installed. Might as well also grab GitExtensions https://gitextensions.github.io/ , GitHub Desktop https://desktop.github.com/ and Notepad++ https://notepad-plus-plus.org/ because these tools are nice to have, but not required. Git for Windows is required, however.
3. Get Android Studio and the Android SDK. The way I recommend doing this is through the JetBrains Toolbox app https://www.jetbrains.com/toolbox/app/ because it will keep your tools updated for you.
4. Set your ANDROID_HOME and ANDROID_NDK_HOME environment variables. Yes, you need ANDROID_NDK_HOME set for this to build.
5. Make yourself a folder to work in, such as C:\Oculus which I used.
6. Get Oculus Mobile SDK 1.23 https://developer.oculus.com/downloads/package/oculus-mobile-sdk/ which comes as a zip file called "ovr_sdk_mobile_1.23.zip" and save it in your working folder. My PowerShell will unzip it for you, so just save the zip in the folder.
7. Get this, my awesome PowerShell script https://gist.github.com/BenMcLean/f277a12160a5efa3474a4b2a60d0b866 and save it in your working folder as "VirtualBoyGo.ps1"
8. Get my easy PowerShell launcher https://gist.github.com/BenMcLean/7d593af547cd168fe02a266d317d4005 and save it in your working folder as "VirtualBoyGo.bat"
9. Run "VirtualBoyGo.bat" The batch file will launch the PowerShell for you if the names match. Hopefully it should run without errors. :)
10. In Android Studio, import the gradle project in your working folder\ovr_sdk_mobile_1.23\VrSamples\VirtualBoyGo\Android and build it. I used Gradle version 4.4
Now it'll build!
#>
# Setting ErrorAction
$ProgressPreference = "SilentlyContinue" # Progress bar can significantly impact Invoke-WebRequest cmdlet performance, see issue: https://github.com/PowerShell/PowerShell/issues/2138
# Module Import
Import-Module Microsoft.PowerShell.Archive
# Setting Variables
$path = Split-Path -Parent $PSCommandPath
$mobileSdkFolder = "ovr_sdk_mobile_1.23"
# Checking required environmental application supports
Write-Output "Checking for 7zip"
if (-not (Test-Path "$env:ProgramFiles\7-Zip\7z.exe")) {throw "$env:ProgramFiles\7-Zip\7z.exe needed"}
set-alias sz "$env:ProgramFiles\7-Zip\7z.exe"
Write-Output "Extracting Oculus Mobile SDK"
if (-not (test-path "$path\$mobileSdkFolder.zip")) {throw "$path\$mobileSdkFolder.zip needed. Please download it from https://developer.oculus.com/downloads/package/oculus-mobile-sdk/"}
Expand-Archive "$mobileSdkFolder.zip" -Destination "$path/$mobileSdkFolder"
Write-Output "Editing cflags.mk"
Set-Location "$path\$mobileSdkFolder\"
Set-Content "cflags.mk" -Value (Get-Content "cflags.mk" | Select-String -Pattern "Werror" -NotMatch) # Removes any line with the word "Werror" in it
Add-Content "cflags.mk" "`nLOCAL_CFLAGS += -Wno-format`nLOCAL_CFLAGS += -Wno-unused-variable`nLOCAL_CFLAGS += -Wno-ignored-qualifiers`nLOCAL_CFLAGS += -frtti`nLOCAL_CFLAGS += -Wno-sign-compare`nLOCAL_CFLAGS += -Wno-unused-function`n`nCFLAGS += -Wall`nCFLAGS += -mword-relocations`nCFLAGS += -mtune=mpcore`nCFLAGS += -mfloat-abi=hard`nCFLAGS += -fomit-frame-pointer`nCFLAGS += -ffast-math`n"
Write-Output "download this repo and copy it into ""$path\$mobileSdkFolder\VrSamples\"""
Set-Location "$path\$mobileSdkFolder\VrSamples\"
git clone https://github.com/CidVonHighwind/VirtualBoyGo.git
Write-Output "download https://github.com/CidVonHighwind/FrontendGo and copy it into ""$path\$mobileSdkFolder\VrSamples\"""
git clone https://github.com/CidVonHighwind/FrontendGo.git
Write-Output "download https://github.com/CidVonHighwind/BeetleVBLibretroGo and copy it into ""$path\$mobileSdkFolder\VrEmulators\"""
New-Item -Path "$path\$mobileSdkFolder\" -Name "VrEmulators" -ItemType "directory"
Set-Location "$path\$mobileSdkFolder\VrEmulators\"
git clone https://github.com/CidVonHighwind/BeetleVBLibretroGo.git
Write-Output "download ""FreeType 2.10.0"" https://download.savannah.gnu.org/releases/freetype/ and copy the ""include"" and the ""src"" folder into ""$mobileSdkFolder/VrEmulators/FreeType/"" folder"
New-Item -Path "$path\$mobileSdkFolder\VrEmulators" -Name "FreeType" -ItemType "directory"
Set-Location "$path\$mobileSdkFolder\VrEmulators\"
Invoke-WebRequest -Uri "https://download.savannah.gnu.org/releases/freetype/freetype-2.10.0.tar.gz" -OutFile "$path\$mobileSdkFolder\VrEmulators\freetype-2.10.0.tar.gz"
sz e "$path\$mobileSdkFolder\VrEmulators\freetype-2.10.0.tar.gz" "-aoa"
sz x -r "$path\$mobileSdkFolder\VrEmulators\freetype-2.10.0.tar" "-aoa"
Copy-Item "$path\$mobileSdkFolder\VrEmulators\freetype-2.10.0\include\" -Destination "$path\$mobileSdkFolder\VrEmulators\FreeType\" -Recurse -Force
Copy-Item "$path\$mobileSdkFolder\VrEmulators\freetype-2.10.0\src\" -Destination "$path\$mobileSdkFolder\VrEmulators\FreeType\" -Recurse -Force
Remove-Item "freetype-2.10.0.tar" -Force
Remove-Item "$path\$mobileSdkFolder\VrEmulators\freetype-2.10.0" -Recurse -Force
Write-Output "Also copy the ""Android.mk"" and the ""Application.mk"" files from the FrontendGo repo and copy them into ""$path\$mobileSdkFolder\VrEmulators\FreeType\"""
Copy-Item "$path\$mobileSdkFolder\VrSamples\FrontendGo\freetype mk\Android.mk" "$path\$mobileSdkFolder\VrEmulators\FreeType\" -Force
Copy-Item "$path\$mobileSdkFolder\VrSamples\FrontendGo\freetype mk\Application.mk" "$path\$mobileSdkFolder\VrEmulators\FreeType\" -Force
Write-Output "download ""gli 0.8.2.0"" https://github.com/g-truc/gli/releases and copy the gli folder (the one next to doc, test, util, etc.) into ""$mobileSdkFolder/VrEmulators/"""
Set-Location "$path\$mobileSdkFolder\VrEmulators\"
Invoke-WebRequest -Uri "https://github.com/g-truc/gli/releases/download/0.8.2.0/gli-0.8.2.0.zip" -OutFile "gli-0.8.2.0.zip"
Expand-Archive "gli-0.8.2.0.zip" -Destination "gli-0.8.2.0"
Copy-Item "gli-0.8.2.0\gli\gli" "$path\$mobileSdkFolder\VrEmulators\" -Recurse -Force
Remove-Item "$path\$mobileSdkFolder\VrEmulators\gli-0.8.2.0" -Recurse -Force
Write-Output "download ""glm 0.9.8.0"" https://github.com/g-truc/glm/releases/tag/0.9.8.0 and copy the glm folder (the one next to doc, test, util, etc.) into ""$mobileSdkFolder/VrEmulators/"""
Set-Location "$path\$mobileSdkFolder\VrEmulators\"
Invoke-WebRequest -Uri "https://github.com/g-truc/glm/releases/download/0.9.8.0/glm-0.9.8.0.zip" -OutFile "glm-0.9.8.0.zip"
Expand-Archive "glm-0.9.8.0.zip" -Destination "glm-0.9.8.0"
Copy-Item "glm-0.9.8.0\glm\glm" "$path\$mobileSdkFolder\VrEmulators\" -Recurse -Force
Remove-Item "$path\$mobileSdkFolder\VrEmulators\glm-0.9.8.0" -Recurse -Force
Write-Output "open the VirtualBoyGo project in Android Studio"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.