diff --git a/.github/workflows/compilation.yml b/.github/workflows/compilation.yml index f574355..1e35fb2 100644 --- a/.github/workflows/compilation.yml +++ b/.github/workflows/compilation.yml @@ -32,11 +32,11 @@ jobs: make - name: Compile unit test project - working-directory: ./src/unit_tests/ + working-directory: ./ env: TYRA: ${GITHUB_WORKSPACE} run: | - make + make tests - name: Compile cube project working-directory: ./ diff --git a/Makefile b/Makefile index 4cb74dd..e6ff12f 100644 --- a/Makefile +++ b/Makefile @@ -60,16 +60,30 @@ all: $(ENGINE_OBJS) cp -f $(LIB_NAME) $(PS2SDK)/ee/lib rm -f $(ENGINE_OBJS) -# cube example +# Cube example cube: $(MAKE) -C src/samples/cube all clean -# dolphin example + +# Dolphin example dolphin: $(MAKE) -C src/samples/dolphin all clean -# floors example + +# Floors example floors: $(MAKE) -C src/samples/floors all clean +# Rebuild the engine +rebuild-engine: + $(MAKE) -C src/engine && make && make EE_CXXFLAGS="-DNDEBUG $(EE_CXXFLAGS)" + +# Rebuild debug engine +rebuild-dbg-engine: + $(MAKE) -C src/engine && make && make + +# Unit tests folder +tests: + $(MAKE) -C src/unit_tests all clean + # %.vcl: %.vclpp # $(EE_VCLPP) $< $@ @@ -80,4 +94,4 @@ floors: $(EE_DVP) $< -o $@ include $(PS2SDK)/samples/Makefile.pref -include $(PS2SDK)/samples/Makefile.eeglobal +include $(PS2SDK)/samples/Makefile.eeglobal \ No newline at end of file diff --git a/docs/install.md b/docs/install.md index 1eb5f3e..e4a885c 100644 --- a/docs/install.md +++ b/docs/install.md @@ -1,43 +1,49 @@ # 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 +- Setup PCSX2 So let's get started! --- +
## VSCode and WSL -- Install VSCode from -https://code.visualstudio.com/ -- Install WSL -https://docs.microsoft.com/en-us/windows/wsl/install-win10 -`Info: Please choose Ubuntu-20.04` -- Set root as default WSL user. -Open `cmd.exe` and type: -`ubuntu2004 config --default-user root` +Install VSCode from +https://code.visualstudio.com/ +Install WSL https://docs.microsoft.com/en-us/windows/wsl/install-win10 Info: Please choose Ubuntu-20.04 +Set root as default WSL user. +Open cmd.exe and type: +ubuntu2004 config --default-user root --- +
## Ubuntu configuration and PS2DEV+Tyra -- Open WSL terminal (Windows search -> wsl) -`Info: Be sure that are you logged as a root!` + +- 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 @@ -45,12 +51,16 @@ 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 @@ -61,42 +71,48 @@ 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"` + +- 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 +- 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" +- VSCode: Click on "Terminal" -> "New terminal" -`Info: New terminal should appear. This is the same WSL terminal :)` +`Info: New terminal should appear. This is the same WSL terminal :)` --- +
## PS2DEV installation + - In VSCode's WSL terminal type: + ``` cd /ps2dev/source unset ZLIB @@ -105,42 +121,46 @@ unset LIBJPEG unset LIBPNG ./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 !!! +### 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 ` ---- +- Just hit make all on the root of tyra folder or you can go via `cd /src/engine` and hit `make all` there. +- If you wanna build the debug build or rebuild the engine, just `make rebuild-engine ` on the root of tyra or `make rebuild-dbg-engine` to build debug version or go to one of the samples via `cd /repos/tyra/src/samples/floors `and do the same process above +
## Install & configure PCSX2 -- Download & install PCSX2 from (1.6+ version) -https://pcsx2.net/ -- Extract bios files from -https://romsmania.cc/bios/pcsx2-playstation-2-bios-3 -to -`C:\Users%USERNAME%\Documents\PCSX2\bios` + +- Download & install PCSX2 from (1.6+ version)https://pcsx2.net/ +- Extract bios files fromhttps://romsmania.cc/bios/pcsx2-playstation-2-bios-3to `C:\Users%USERNAME%\Documents\PCSX2\bios` - Close `PCSX2` if you have opened! - Open `C:\Users\hasto\Documents\PCSX2\inis\PCSX2_vm.ini` in notepad + ``` HostFs=enabled ``` + - Open PCSX2 and map pad to your keyboard, for example: + ``` WASD = Left joy Arrows = Right joy @@ -149,45 +169,54 @@ Circle = C ``` --- +
-## Run one of the samples +## Run one of the samples - Method 1 - Add assets for "floors" sample -- Download assets from - https://github.com/h4570/tyra/tree/master/src/samples/floors +- 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` +- Compile sample via `make``Info: Elf file should be produced in /bin ` +- Run sample in PCSX2 via `make run-pcsx2` + +## Run one of the samples Method 2 + +- Run `make floors` on the root of tyra project or change directory to the sampels via `cd src/samples/floors` and do the `make install` command --- +
## 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 -- Download +Download http://apgcglz.cluster028.hosting.ovh.net/tyra/intellisense.zip -- Unpack `.vscode` folder to WSL's `/repos/tyra/` -`Info: This configuration is set for cube sample, but you can change it in tasks.json file` - +Unpack .vscode folder to WSL's /repos/tyra/ +Info: This configuration is set for cube sample, but you can change it in tasks.json file --- +
## Advanced: Compiling VU1 programs + `Info: Based on https://github.com/microsoft/wsl/issues/2468#issuecomment-374904520` + - Download VCL -http://lukasz.dk/files/vcl.1.4.beta7.x86.tgz + http://lukasz.dk/files/vcl.1.4.beta7.x86.tgz - Rename `vcl_14beta7_x86` binary to `vcl` - Put `vcl` to WSL's `/usr/bin` + ``` 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' @@ -196,13 +225,18 @@ 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 . @@ -211,4 +245,5 @@ cp vclpp /usr/bin/ chmod 755 /usr/bin/vclpp cd .. && rm -rf ./temp ``` + - Uncomment `.vclpp`/`.vcl` recipe from Tyra's engine `Makefile`