Skip to content

Instantly share code, notes, and snippets.

@jonathanweinberg
Forked from BenMcLean/VirtualBoyGo.ps1
Last active June 4, 2019 04:25
Show Gist options
  • Save jonathanweinberg/810d9b56c0a9e440599e3c9bccd21193 to your computer and use it in GitHub Desktop.
Save jonathanweinberg/810d9b56c0a9e440599e3c9bccd21193 to your computer and use it in GitHub Desktop.
VirtualBoyGo powershell
## 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
$path = 'c:\temp'
$mobileSdk = 'ovr_sdk_mobile_1.23.zip'
$mobileSdkFolder = [io.path]::GetFileNameWithoutExtension("$mobileSdk")
## 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 "Checking for the Oculus Mobile SDK"
Write-Output "download the ""Oculus Mobile SDK 1.23.0"" https://developer.oculus.com/downloads/package/oculus-mobile-sdk/"
if (-not (Test-Path "$path\$mobileSdk")) {throw "$path\$mobileSdk needed"}
Expand-Archive "$mobileSdk" -Destination "$path\$mobileSdkFolder"
Write-Output "Preparing to modify ""$path\$mobileSdkFolder\Application.mk"", checking to see if .old backup exists."
if ((Test-Path "$path\$mobileSdkFolder\Application.mk.old") -eq $False)
{
Write-Output """$path\$mobileSdkFolder\Application.mk"" does not exist, creating backup."
Copy-Item -Path "$path\$mobileSdkFolder\Application.mk" -Destination "$path\$mobileSdkFolder\Application.mk.old"
}
if ((Test-Path "$path\$mobileSdkFolder\Application.mk.old") -eq $True)
{
Write-Output """$path\$mobileSdkFolder\Application.mk"" does exist, skipping backup."
}
Write-Output "Adding to ""$path\$mobileSdkFolder\Application.mk"", the following:"
Add-Content "$path\$mobileSdkFolder\Application.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"
## Clone VirtualBoyGo, FrontEndGo, and BeetleVBLibretroGo git's
## May see errors, but if git is installed it should work.
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\VrSamples\VrEmulators\"""
New-Item -Path "$path\$mobileSdkFolder\VrSamples\" -Name "VrEmulators" -ItemType "directory"
Set-Location 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 ""ovr_sdk_mobile_1.23/VrEmulators/FreeType/"" folder"
New-Item -Path "$path\$mobileSdkFolder\" -Name "VrEmulators" -ItemType "directory"
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\ovr_sdk_mobile_1.23\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 into ""$path\$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" "$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 into ""ovr_sdk_mobile_1.23/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" "$path\$mobileSdkFolder\VrEmulators\" -Recurse -Force
##Remove-Item "$path\ovr_sdk_mobile_1.23\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