Files
tyra-linux/docs/install.md
T
2021-05-28 21:07:58 +02:00

5.8 KiB

Installation tutorial

This tutorial will show you, how to:

  • Setup your WSL machine for PS2DEV
  • Install entire PS2DEV+Tyra environment
  • Setup VSCode with Intelisense
  • Setup PCSX2

So let's get started!



VSCode and WSL



Ubuntu configuration and PS2DEV+Tyra

  • Open WSL terminal (Windows search -> wsl)
    Info: Be sure that are you logged as a root!
  • Type these commands
apt-get update && apt-get upgrade -y
apt-get install -y build-essential make texinfo cmake bison flex gettext libgmp3-dev libmpfr-dev libmpc-dev libz-dev wget patch
  • Configure git (replace your name and email)
git config --global user.email "your@email.com"
git config --global user.name "Your Name"
  • Create directories
mkdir /ps2dev
mkdir /ps2dev/built
mkdir /ps2dev/source
mkdir /repos
mkdir /repos/tyra
  • Clone repos
git clone https://github.com/ps2dev/ps2dev.git /ps2dev/source/
git clone https://github.com/h4570/tyra.git /repos/tyra/
  • Open bashrc via nano ~/.bashrc and add these lines at the end of file. Be sure that they are 1:1, so don't add additional spaces!
export PS2DEV=/ps2dev/built
export PS2SDK=$PS2DEV/ps2sdk
export GSKIT=$PS2DEV/gsKit
export PATH=$PATH:$PS2DEV/bin:$PS2DEV/ee/bin:$PS2DEV/iop/bin:$PS2DEV/dvp/bin:$PS2SDK/bin
export PS2HOSTNAME=192.168.0.200
export TYRA=/repos/tyra
export WSL_MAKE_WINDOWS=\\\\\\\\wsl\$\$\\\\Ubuntu-20.04
export WSL_LINUX_PCSX2=/mnt/c/Program\\\ Files\\\ \\\(x86\\\)/PCSX2
  • Refresh env variables via -> . ~/.bashrc
  • Close wsl terminal


Mapping WSL directories to your Windows machine

  • Open cmd and type wsl.exe --list
    Info: Remember your distribution name from this list. My is "Ubuntu-20.04"
  • Click at the windows logo on your keyboard, type "This PC" and open
  • At the upper menu click "Map disk drive"
    Info: Replace my name with your WSL name!
    • Folder: \\wsl$\Ubuntu-20.04
    • Click OK

Info: You will have now new disk on your PC, this is the WSL filesystem.



Configuring VSCode

  • Open VSCode
  • Install extension "Remote - WSL"
  • Install extension "C/C++"
  • Restart VSCode if required
  • VSCode: Click on "File" -> "Open folder in WSL"
    • Open "repos/tyra"
  • VSCode: Click on "Terminal" -> "New terminal"

Info: New terminal should appear. This is the same WSL terminal :)



PS2DEV installation

  • In VSCode's WSL terminal type:
cd /ps2dev/source
./build-all.sh

Info: This can take some time...

  • And open again .bashrc via nano ~/.bashrc and add these lines at the end of file.
export ZLIB=${PS2SDK}/ports
export LIBTIFF=${PS2SDK}/ports
export LIBJPEG=${PS2SDK}/ports
export LIBPNG=${PS2SDK}/ports
  • Refresh env variables via . ~/.bashrc

!!! Please don't forgot to remove/refresh these 4 exports when you will want to update PS2DEV (./build-all.sh), because there is circular dependency between these libs and gsKit which is included in PS2DEV !!!



Build Tyra

  • Go to one of the samples via cd /repos/tyra/src/samples/floors
  • Build debug version: make rebuild-dbg-engine
    Info: If you want to build final version in future, type make rebuild-engine


Install & configure PCSX2

HostFs=enabled
  • Open PCSX2 and map pad to your keyboard, for example:
WASD = Left joy
Arrows = Right joy
Space = X
Circle = C


Run one of the samples

  • Add assets for "floors" sample
  • Download assets from
    https://github.com/h4570/tyra/tree/master/src/samples/floors
  • Windows: Open your WSL folder (This PC -> WSL folder)
  • Extract assets to /repos/tyra/src/samples/floors/bin/ (create bin folder if not exists)
  • Compile sample via make
    Info: Elf file should be produced in /bin
  • Run sample in PSX2 via make run-pcsx2


How to code?

Do some changes in your sample and just type make clean all run-pcsx2 in your sample folder. You can create your own sample, by just copying cube folder.



Setup Intelisense



Advanced: Compiling VU1 programs

Info: Based on https://github.com/microsoft/wsl/issues/2468#issuecomment-374904520

apt-get install qemu qemu-user-static binfmt-support
update-binfmts --install i386 /usr/bin/qemu-i386-static --magic '\x7fELF\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00' --mask '\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xf8\xff\xff\xff\xff\xff\xff\xff'
dpkg --add-architecture i386
apt-get update
apt-get install libstdc++5:i386
chmod 755 /usr/bin/vcl

Info: In Ubuntu 18.04 I was obligated to install lib32ncurses5 also

  • Add this line to ~/.bashrc
service binfmt-support start &>/dev/null
  • Uncomment .vsm/.vcl recipe from Tyra's engine Makefile
  • Download & install VCL preprocessor
mkdir temp && cd temp
git clone https://github.com/glampert/vclpp .
make
cp vclpp /usr/bin/
chmod 755 /usr/bin/vclpp
cd .. && rm -rf ./temp
  • Uncomment .vclpp/.vcl recipe from Tyra's engine Makefile