-
Notifications
You must be signed in to change notification settings - Fork 0
Android VM on PC
NOTE this assumes you want to use this guide for VGM ripping. If you want to actually play games just buy a decent phone, you cheapass.
Evidently if you can find all game's data in the .APK (open as zip) or by googling you don't need this. This guide is for games that download data and can't be easily found out there, or games that use obfuscated executables we want to reverse engineer.
Use BlueStacks/Nox/etc and enjoy the viruses.
Otherwise: Sorry, this is complex stuff. Not that complex, but enough that you'll need to follow the boring guide below. Though basically:
- download a custom Android .ISO for PC
- install a virtual machine (VM) program
- make a virtual device and install Android inside
- setup some extra steps in the Android OS and use normally
- install and extract game files directly from the virtual HDD via 7-zip
"Ok, I'll just google and find something easier blah blah". Good luck, I sure couldn't. Maybe there are some guides and Youtube tutorials, don't forget to subscribe, though doubt they'll explain actual compatibility details, file extraction and so on.
Keep in mind: compatibility is only so-so, this is a general technology limitation and not an issue with a certain program version (chances are in the future there could be better methods though). I haven't tried recent BlueStacks but AFAIK they use the same internal tech described below, so no miracles here.
If you have an spare phone that has a 64-bit CPU and is rootable that'd be a better way to rip games, but it's also a bit of a hassle to setup root, then transfer data to PC per game, so when it works this method can be useful too.
Options:
- install some popular Android "emulator" like BlueStacks, Nox, LDPlayer and so on
- install Android in your PC as alt boot
- install Android in a virtual machine (VM)
"Emulators" basically use a modded VirtualBox VM (rarely qemu), and "probably" are a bit more compatible since they are geared toward playing games. On the other hand are likely full of spyware and who knows what evil crap.
Installing Android on you PC will "probably" run Android faster, but needs boot modding (not for the faint of heart) and may not be compatible with your CPU/graphic card/etc, I wouldn't bother.
Android VM is safe and relatively simple, but slowest (you need a decent PC, and even a beefy PC won't be very fast).
If you don't care about your PC try BlueStacks, otherwise try a VM (see below).
Android devices (your mobile phone, tablet, or whatever) have various CPU flavors:
- ARM 32: older/most mobile devices
- ARM 64: newer mobile devices
- X86 (x64): not that many. PCs use this.
Android games come in .apk that is basically a renamed .zip you can open. In 99% of modern games have a /lib dir with the game compiled as .so libraries. The trick here is that a .so only works for one CPU (ARM64 can run ARM32 though).
For compatibity, games may compile and include multiple libraries (meaning subdirs in /lib, for each type of CPU). HOWEVER! games often only include ARM/ARM64 (since no game really needs X86). But since PCs use X86, and we want to rip ARM32/ARM64 games = won't work.
To solve this, emulator/VMs have the often-called "native bridge". This basically is a ARM/ARM64 emulator, and while it works compatibility is only so-so. Main native bridge is called "libhoudini", and isn't developed anymore. Meaning any VM/emulator basically uses that old (modded?) lib. There is a more current method for native bridge, but isn't really usable at the moment (discussed later).
So if you try a game (with native bridge on) and it crashes, though luck.
Options:
- qemu
- Virtual Box 6.x
- VMware Workstation 16 Player
- Android SDK + Android emulator
qemu is mainly for Linux, though there are Windows version around. While (in theory) it's decently fast and compatible I couldn't get it to install Android due to display driver limitations on Windows.
Others are free, while Virtual Box is also open source (nice). However VMware has (some) 3D hardware support for Android, while VBox doesn't. Meaning, VBox is much slower (Android menus aren't smooth and 3D is slow), though still usable.
Official android emulator (AFAIK) uses qemu, and has some (supposed) advantages, like 3D acceleration and ARM/ARM64 emulation when using Android +11. However being this is a development testing tool, meaning it isn't very usable for game use (untested though). There aren't (AFAIK) any projects that use Android 11 for its ARM stuff, so basically not useful now but may help improve things in the future.
In any case, we want to create a virtual machine (VM) and install an Android OS version for PC. Your only choice is Android-x86 7.1 (note that Android is Google's OS, while Android-x86 is a custom version for PC made by some folks based on Google's). You want 7.1 b/c (as of 2021) newer versions (8.x, 14.x) either don't install correctly in VMs or native bridge doesn't work for that version. Games typically have Android <5.x compatibility, so it shouldn't matter (Android-x86 has nougat/oreo).
There are other Android clones based on Android-x86 (BlissOS, etc) but don't bother, minor tweaks but same compatibility. In case you didn't read the above: only thing that matters for games is "native bridge", and all clones use the same libs.
Go to: https://www.android-x86.org/ and get the iso, I used android-x86_64-7.1-r5.iso
. Note you need a 64-bit version (plus install as a 64-bit VM) to get ARM 64 games running.
You want VMware (faster), though this also explains VBox.
- install "VMware Workstation Player" (tested with version 16)
- https://www.vmware.com/es/products/workstation-player/workstation-player-evaluation.html
- VMware has some similarly named stuff, beware it's "player"
- open and press "create a new virtual machine", dialog opens
- "install later", next
- "Linux 4.x kernel 64-bit", next
- set name/location as needed
- set max disk size as needed (set at least +16GB) AND 1 single file, next
- HDD is dynamic and won't use space in your disk until needed
- can be increased later, but will break easy extraction
- finish
- right click on VM > settings
- CD/DVD: select Android-x86 .ISO
- Memory: at least 2GB
- most games are fine with 2GB but a few may need more +4GB
- Display: Accelerate 3D graphics
- IMPORTANT, failure to enable this will stop Android from booting (changes display driver)
- ignore warning about VMTools, Android can't use them
- other settings work fine as default
- install Virtual Box (tested with version 6.x)
- open and press "new", dialog opens
- set name, "Linux" type, "Linux 2.6 / 3.x / etc (64-bit)" version, next
- Memory: at least 2GB, next
- most games are fine with 2GB but a few may need more +4GB
- new virtual disk, next
- type "VHD" (or possibly "VMDK"), NOT VDI, next
- dynamic type, next
- set max disk size as needed (set at least +16GB) AND 1 single file, next
- HDD is dynamic and won't use space in your disk until needed
- finish
- select VM and press "config"
- select "Display"
- video memory 64MB or such
- graphics controller = VBoxVGA (ignore "invalid setting" below)
- IMPORTANT, failure to enable this will stop Android from booting (changes display driver)
- don't enable 3D acceleration (not possible with VBox + Android)
- select "Storage"
- click on Controller: IDE > Empty, then right side's disc button > chose a disk file > select Android .ISO
- other settings work fine as default
- ignore warning about Guest Extensions, Android can't use them
- select "Display"
Once you have done the above, ISO will be "inserted" in the virtual DVD.
There is a guide with images here but it's made for installing in an actual PC: https://www.android-x86.org/installhowto.html
In a VM it's similar but you need to setup the virtual machine. This being a "virtual machine" it literally boots a fake mini-PC, and since Android is Linux-based it works similarly to a Linux installation. It's all virtual so no worries, won't damage your PC if you mess up.
Open (double click/play) your new VM in VMware/Vbox, accept text boxes, click inside the VM's window. This will "capture" mouse and keyboard (so mouse is now "inside"). To stop this capture press:
- VMware: CTRL+ALT
- VBox: right CTRL
After opening the VM and if you selected the ISO correctly, a "live installation" menu should shows up (blue)
- move with up/down and left/right keys (remember, click inside VM first)
- select "Advanced options..."
- select "Auto_installation"
- "YES" when asked, wait
- all virtual, won't destroy your data
- select "Reboot" + "OK", enter
- In VBox you need to close the VM, go to config, "Storage" > Disc button > remove Virtual disk from storage
- if all worked ok you'll see a black boot loader with "Android-x86" as first option
- will auto-select after a while and try to boot
- does it show a bit "android" logo? cool, see below
- stuck on "Detecting Android-x86"? see graphic card config above, or close VM + remove .iso
If auto_install somehow doesn't work, it's possible to manually do so. Just in case:
- on "live installation" select "install"
- that should load Linux's ancient disk manager (gray)
- use up/down to select vertical options and left/right for horizontal options
- select vertical "Create/Modify partitions", horizontal "OK", enter
- "[NO]" when asked to "use GPT", enter
- this loads partition manager (black)
- select "[New]", enter
- select "[Primary]", enter
- size default (uses all), enter
- a new "sda1" thing should have appeared, select "[Bootable]", enter
- select horizontal "[Write]", enter, write "yes" when asked, wait
- select horizontal "[Quit]", enter (goes back to gray disk manager)
- select "sda1" partition, enter
- vertical "ext4", enter
- select format "Yes", enter
- select 'install boot loader GRUB' "Yes", enter
- select 'install system as read-write' "Yes", enter
- wait a while
- select "Reboot"
- congrats, you survived Linux's usability
If the above worked, Android-x86 will boot after a while and begin setup (same as any Android phone, should be easy enough to figure out: select lang, select "VirtWifi", etc, etc). You will be asked for a Google email account. You can skip this (and setup later), but various services and games won't work without it (not all though), try an alt account.
VBox sometimes semi-freezes when setting email on setup. If after a while doesn't work, just restart, skip email setup, then set it later in settings.
Once setup is done then it'll ask what "Home app" (AKA desktop) you want. Launcher3 is phone-like, while Taskbar is more Windows-like. Neither are pleasant to control with a mouse, but what can you do. You'd think the Windows-like would be easier, but there are plenty of phone-style behaviors still (personally I use Launcher3 since it's easier to find stuff, being phone-like).
First go to settings > Apps compability > enable native bridge (will download + install). Also if "phone" goes to sleep sometimes it seems to sleep forever, try changing those settings too.
Remember, if you didn't install/setup native bridge above you won't be able to even install ARM/ARM64 games AKA almost every game.
Once that is done, you can either:
- use google play store to install your region's APK
- needs a google account
- simple enough but limited
- use a custom store to install other region's APKs
- for example "qooapp" (probably full of Chinese spyware but no matter, this being a VM)
- open browser, google "qooapp", install APK (Android will ask to change permissions manually, simple enough)
- install "XAPK Manager" first, then download + install XAPKs online
Now go get some games and try running them (Nier Reincarnation or Dragon Ball Z Dokkan Battle are ARM64-only games on the Google store that make a decent test, not very playable with mouse though). ARM32-only games usually work well enough, while ARM64 tend to crash a bit more (X32 aren't very common but should work perfectly).
Got to install a game but crashes? Nothing you can do. Could be native bridge doesn't work for this game, or game detects VMs and shutdowns. You'll have to buy a rootable phone if you really want to rip that.
Game refuses to install? Possibly native bridge wasn't installed (for example you can't install ARM64 only games in an ARM32 phone).
Note Android-x86 comes as root, which some games detect and refuse to handle.
Before ripping anything, note that games may:
- include all data in the .APK
- included minimal data on .APK, and download all on boot (sometimes optional)
- download all data after first tutorial (sometimes skippable, otherwise learn how gacha works for the umpteenth time)
- download partial data, and have a button (in title screen or in-game config screen) to download all data
- download only required data, no way to get everything at once
The last case can usually be solved by ripping URLs (see Advanced ripping below), and you can apply it to other downloads too.
Anyway, asuming game did download stuff, how to get it back?
- on your PC, go to the VM's virtual disk location
- VMware (.vmdk) default: C:\Users(user)\Documents\Virtual Machines\
- VBox (.vhd) default: C:\Users(user)\VirtualBox VMs
- open with 7-zip (may need to stop VM first), this'll show internal Android paths
- if 7-zip gives error, and VM is closed, you probably selected the wrong virtual disk type during VM creation
- base APK is usually in:
- ./android-7.1-r5/data/app/(game id)
- data is usually in (either or multiple):
- ./android-7.1-r5/data/app/(game id)
- ./android-7.1-r5/data/media/0/Android/data/(game id)
- ./android-7.1-r5/data/media/0/Android/obb/(game id)
- ./android-7.1-r5/data/media/0/obb/(game id)
base.apk often has default BGM like title screens, don't forget to check it.
Now you extract those dirs with 7-zip and you have all data, use typical VGM-ripping steps here (game uses Unity = try AssetStudio, UE4 = UModel or quickbms, may need decryption key from game's .so). If you aren't used to mobile ripping, well, it's not very pleasant (AKA lots of crap dirs and fragmented stuff, hash names, etc) but should be simple enough. Some games are extra encrypted, so could be be much harder.
Getting URLs from games (simple way, but bloated):
- start game, go to some screen that downloads data (preferably all data)
- you can press the change app / [ ] square button in bottom menu to halt game
- from Windows' task manager select VM process, make a memdump (right click > dump, then right click > show memdump)
- for VMWare, dump "VMware Workstation VMX", not "VMware Player"
- dumps are big, beware (several GBs)
- use
strings2.exe
over mempdump:strings2.exe > mem.txt
- you want strings2 over hex edit or something b/c some URLs will be in
U T F - 1 6
- you want strings2 over hex edit or something b/c some URLs will be in
- use
grep.exe
overstrings2
results:grep.exe '^http' mem.txt > mem.grep.txt
- with some luck you'll have all/most URLs that the game uses to download (plus lots of useless extra URLs), you can pick vgm-only
- open with notepad++ > edit > line operations > remove duplicate lines, then > sort lines lex. ascending
- typically look for "https://(some url related to the game)/(assets-something)/(filenames)
- copy and paste URLs on browser to test if one works
- some URLs may be incomplete since this is a memdump, it's normal (typically will be repeated elsewhere in full)
- in rare cases games needs extra verification params and URLs don't work in browser (find headers + use tool below)
- download helper (ask for examples): https://github.com/bnnm/vgm-tools/blob/master/py/dl.py
Getting URLs from games and decrypting Unity files (a bit more involved):
- this method makes more focused memdumps (a bit smaller), mainly for obfuscated Unity crap
- get GameGuardian, install APK, find in apps (won't auto-open) then open
- there are 2 GG, try one with HW icon first and see how it goes
- GG installs in a obfuscated name to avoid app detection, it's normal
- will setup first, will "default" method, allow root (don't forget this! you'll need to reinstall otherwise)
- press start, some icon will appear in the top left of the screen
- start game, go to some screen that downloads data (preferably all data)
- press GG button, select your game's process
- you can press the change app / [ ] square button in bottom menu to halt game
- in GG weird menu, press the last list button on top right (triple bar), then the new list button that appears on right
- select "dump memory" (use defaults), save
- after a while should make a memdump of the game and
- extract dump to PC from ./android-7.1-r5/data/media/0/
- .tar/zip without compression and use
strings2
to get URLs from this game (see above) - for obfuscated Unity games:
- unobfuscated global-metadata should be somewhere in the file
- generated *-map file will tell you where il2cpp address is, extract il2cpp and
- https://github.com/bnnm/vgmstream/wiki/hcakey
- this method also works in rooted phones