Vita Development environment
HijackedBrain, 23 September 2018
How to set QtCreator for Vita development
Ok so developing on Vita with vitasdk (no unity, no official sdk, etc) can be a pain in the ass to setup correctly.
Here’s a little tutorial for my future self (or anybody stumbling upon this blog entry) on how to get a working windows10, QtCreator, vitasdk setup working. With shortcuts and all the benefits (Just a little heads up, you’ll be using WSL’s QtCreator, not windows’s one)
- Windows Subsystem for Linux installation (WSL) :
- install WSL https://docs.microsoft.com/en-us/windows/wsl/install-win10
- Pick whatever distrib you like. (debian being obviously the best choice ;).
- (pin WSL’s Bash on the taskbar) Install “Windows Subsystem for Linux” (WSL) . And Give up on MSYS2 because this thing corrupt itself for no reasons sometimes….
- Install VitaSDK (https://vitasdk.org/, we’ll do the global variables stuff later on) :
apt-get install make git cmake tar mingw64/mingw-w64-x86_64-libwinpthread-git git clone https://github.com/vitasdk/vdpm cd vdpm ./bootstrap-vitasdk.sh ./install-all.sh
- Install QtCreator :
apt-get install qtcreator
- Xming server (windows side) for graphical WSL graphical application :
- Install Xming an XServer for window, that will allow us to run WSL graphical application https://sourceforge.net/projects/xming/
- Set a WSL’s QtCreator shortcut
- Create a WSLQtCreator.bat script and put this in it, it will automatically launch Xming’s server and qtcreator (and also kill Xming when you’ll close qtcreator)
start Xming -multiwindow -clipboard -dpi 108 timeout 1 > NUL bash --login -c "qtcreator" Taskkill /IM Xming.exe /F
- ( Convert the .bat to a .exe and use some really professional grade icon file for the shortcut like this one)
- Create a WSLQtCreator.bat script and put this in it, it will automatically launch Xming’s server and qtcreator (and also kill Xming when you’ll close qtcreator)
- Setup VitaCompanion
- https://github.com/devnoname120/vitacompanion (Do it on both pc and vita sides obviously, make sure to use the correct ur0 partition, not the ux0 one)
- Setup global variables and vita tools
- Put those lines in your /etc/profile
export VITASDK=/usr/local/vitasdk export PATH=$VITASDK/bin:$PATH export DISPLAY=:0 #For Xming window server
- Put those lines in your ~/.bashrc (or also in /etc/profile)
function vitasendfile { /home/$USER/Tools/vitasendfile.sh $1 $2 $3 } function vitareboot { /home/$USER/Tools/vitareboot.sh $1 } function vitaexecute { /home/$USER/Tools/vitareexecute.sh }
- And put associated tools (download here) in /home/$USER/Tools/ folder. Those are just basic script encapsulating the vitacompanion command. This way we’ll be able to call them directly from QtCreator
- Put those lines in your /etc/profile
- Setup QtCreator
- Open QtCreator
- ( Setting up the build directory : Tools -> Options -> Build & Run -> Default Build Directory -> remove the ../ at the beginning, so it will build in a subfolder instead of a folder next to the source code )
- Setting up the Compilers : Tools -> Options -> Build & Run -> Kits -> Add -> GCC(C & C++). Add the gcc & g++ vita compilers located at /usr/local/vitasdk/bin/
- Setting up the “kit” : Create a new kit and use the two newly added compilers, and use the following “CMake Configuration” : CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx} CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C} QtCreator will cry about gdb’s ABI not corresponding to the compilers’s ones… Don’t mind this … There is no vita compatible gdb for now
- Setting up the External Tools :
- Create a Tools -> Options -> Environment -> External Tools:
- Create a “Reboot” tool : Description : “Reboot Vita” ; Executable : “/home/aramir/Tools/vitareboot.sh” ; Arguments : “192.168.1.24” ; Working Directory : “”
- Create a “SendVPK” tool : Description : “Send vpk file to Vita” ; Executable : “/home/aramir/Tools/vitasendfile.sh” ; Arguments : “%{CurrentProject:BuildPath}/%{CurrentProject:Name} 192.168.1.24 ux0:/tmp/” ; Working Directory : “%{CurrentProject:BuildPath}”
- Create a “SendEboot” tool : Description : “Send Eboot.bin to Vita” ; Executable : “/home/aramir/Tools/vitasendfile.sh” ; Arguments : “%{CurrentProject:BuildPath}/%{CurrentProject:Name} 192.168.1.24 %{CurrentProject:Path}/CMakeLists.txt” ; Working Directory : “%{CurrentProject:BuildPath}”
- Create a “Execute” tool : Description : “Execute program” ; Executable : “/home/aramir/Tools/vitaexecute.sh” ; Arguments : “%{CurrentProject:Path}/CMakeLists.txt 192.168.1.24” ; Working Directory : “%{CurrentProject:Path}”
- For those tools, I assume that your Vita’s IP adress is 192.168.1.24 and determine your VITA_TITLEID by parsing the CMakeLists.txt
- Setting up the commands, map the created External tools :
- External.Reboot -> Ctrl+Alt+R
- External.SendVPK -> Ctrl+Alt+V
- External.SendEboot -> Ctrl+Alt+E
- External.Execute -> Ctrl+Alt+X
-
Test setup with HelloWorld project, you can use the one at /usr/local/vitasdk/share/gcc-arm-vita-eabi/samples/hello_cpp_world or donwload it somewhere else (eg : http://modconsoles.fr/saves/psvita/hello_world.zip )
- How to use ?
- (Right click on the “hello world” in the Projects view -> Run CMake)
- Simply build the program, hitting the usual “hammer logo” at the bottom left (or press Ctrl+Shift+B)
- Press Ctrl+Alt+V to send the .vpk file to the Vita
- Go to your vita, open VitaShell and install it from ux0:/tmp/xxx/.vpk
- (Run it from the LiveArea screen)
- Modify something in the code, press Ctrl+Alt+E to send ONLY the updated eboot.bin
- Press Ctrl+Alt+X to run the Program
- Keep in mind that the FTP server and PSP2Shell/VitaCompanion are “sensitive flowers”. So sometimes you might have to restart the vita
- vitasendfile, vitareboot and vitaexecute are accessible directly from your bash thanks to the .bashrc
- More ? How to debug ?
- Download and set everything for VitaParseCore
- Write yourself a bash script (eg : vitaparsecoredump.sh) and set an alias for it in your .bashrc cause it’s way too long to call vita-parse-core by hand everytime.
- Compile your program (using your QtCreator’s kit in debug mode) and crash your application
- Get the .psp2dump from ux0:/data and open it by calling vitaparsecoredump this way “vitaparsecoredump.sh <.psp2dump> <.elf>”. Beware usual CMakeLists.txt out there will create a .elf for you but the “.elf” extension will be stripped because of the unorthodox way vitasdk work with Linux’s QtCreator. tldr ? “vitaparsecoredump ~/dumpsFolder/dummyDump.psp2dmp HelloWorld”
- Here’s vitaparsecoredump.sh :
#!/bin/bash if [ $# -eq 0 ]; then echo "Usage : vitaparsecoredump.sh <.psp2dump> <.elf>" exit 1 fi python2 /home/aramir/Tools/vita-parse-core/main.py $1 $2
Useful links:
- VitaDevWiki : https://playstationdev.wiki/psvitadevwiki/index.php?title=Main_Page
- Wiki Henkaku : https://wiki.henkaku.xyz/vita/Main_Page
- Vita SDK Documentation : https://docs.vitasdk.org/
- VitaSdk : https://github.com/vitasdk
- SDL examples : https://github.com/xerpi/SDL-Vita/tree/master/test
- Vdpm : https://github.com/vitasdk/vdpm
- Vita Toolchain explanation : https://github.com/vitasdk/vita-toolchain/blob/master/README.md
- VitaDB : https://vitadb.rinnegatamante.it/#/
- How2Homebrew : https://gist.github.com/xyzz/cb6ad5fd3ce14e6c71cf77a9d810ce4f
- VitaCompanion : https://github.com/devnoname120/vitacompanion
- VitaGL : https://github.com/Rinnegatamante/vitaGL/
- VitaShaders : https://github.com/xyzz/vita-shaders
- VitaParseCore : https://github.com/xyzz/vita-parse-core
- h-encore : https://github.com/TheOfficialFloW/h-encore/blob/master/WRITE-UP.md
- Riot vitasdk room : https://riot.im/app/#/room/#vitasdk:matrix.org
- Riot henkaku room : https://riot.im/app/#/room/#henkaku:matrix.org