Skip to content

Commit

Permalink
Buildfix
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexRamallo committed Aug 20, 2022
1 parent 9a588c6 commit 7101eed
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 189 deletions.
4 changes: 4 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ build-job:
rules:
- if: '$CI_COMMIT_TAG =~ /^release-.*$/'
script:
- cd sdl2-vitagl-lugaru && mkdir -p build && cd build
- cmake .. -DCMAKE_TOOLCHAIN_FILE=$VITASDK/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DVIDEO_VITA_VGL=TRUE -DVIDEO_VITA_PVR=FALSE
- make install -j`nproc`
- cd ../../
- python3 ./waf configure_release
- python3 ./waf build_release --tex-quality=pvrtcbest
- mv build/release/Lugaru.vpk ./Lugaru.vpk
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "vitagl"]
path = vitagl
url = ../vitagl-lugaru
[submodule "sdl2-vitagl-lugaru"]
path = sdl2-vitagl-lugaru
url = ../sdl2-vitagl-lugaru
134 changes: 55 additions & 79 deletions COMPILING.md
Original file line number Diff line number Diff line change
@@ -1,113 +1,89 @@
# Compiling
# Building LugaruVita

As it stands, the version of Lugaru in this repository supports Linux, OSX
and Windows. Not all toolchains are tested, thus we would welcome help from
new contributors especially regarding MSVC and OSX support.
The original build system was replaced with waf in order to more easily support inclusion of an asset processor (for transcoding textures). Waf is included in the repo (it's a Python script), so there's no need to download it.

## Common dependencies
Builds tested on Ubuntu only, but it might still work on Windows/Mac with minor modifications to the instructions below.

You will need the following development libraries and tools, usually
available via your package manager (dnf, urpmi, apt, brew, etc.):
**NOTE:** There's a Dockerfile that you can use to build, or as a reference for setting up your environment.

- CMake
- SDL2
- Mesa OpenGL Utility library (GLU)
- LibJPEG (TurboJPEG)
- LibPNG
- OpenAL Soft
- Ogg, Vorbis and Vorbisfile
## Dependencies

## GNU/Linux
You need to obtain these dependencies yourself

Both GCC and Clang are supported as compilers. Define the `CC` and `CXX` env
variables according to the compiler you want to use, if not the default one.
Then build with:
* Python 3.7+ and Pip
* "Pillow" library from Pip
* [PVRTexTool from Imagination Technologies](https://developer.imaginationtech.com/pvrtextool/). You can create a free account to download it. (make sure `PVRTexToolCLI` is in your PATH)
* [VitaSDK](https://vitasdk.org) (make sure the `VITASDK` environment variable is present)

## Installing Pillow

Depending on how pip is installed, you may need one of the following variations:

```
mkdir build && cd build
cmake ..
make
pip install pillow
#or
python3 -m pip install pillow
#or
pip3 install pillow
#or...
```

The resulting `lugaru` binary will expect to find the `Data/` folder next to
it, so either copy `build/lugaru` in the main directory, or create a symbolic
link to run the game.
## Building SDL2-VitaGL

### Packaging

If you want to package Lugaru for a GNU/Linux distribution, or if you want to
install it system-wide locally, you need to set the `SYSTEM_INSTALL` CMake
option, and (optionally) define the CMAKE_INSTALL_BINDIR and _DATADIR if they
differ from the default ones (`bin` and `share` appended to the prefix).
Example:
TODO: improve this

```
git clone https://gitlab.com/alexramallo/lugaruvita && cd lugaruvita
git submodule --init --recursive
cd sdl2-vitagl-lugaru
mkdir build && cd build
cmake -DSYSTEM_INSTALL=ON \
-DCMAKE_INSTALL_BINDIR=games \
-DCMAKE_INSTALL_DATADIR=share/games \
..
make
sudo make install
cmake .. -DCMAKE_TOOLCHAIN_FILE=$VITASDK/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DVIDEO_VITA_VGL=TRUE -DVIDEO_VITA_PVR=FALSE
make install -j8
```

## Mac OSX
## Building a release VPK

The instructions are similar to the GNU/Linux ones, provided you have
installed Xcode and the required dependencies (e.g. via homebrew).
NOTE: `waf` is a Python script and this project requires Python 3.7 or later. You might have to use `python3 ./waf` instead, depending on how your system is configured.

## Windows

As of now, only MinGW32 and MinGW64 are supported, and were only tested by
cross-compiling from Linux.
```
./waf configure_release
./waf build_release --tex-quality=pvrtcbest
### MSVC
#Alternatively (only if you have VitaCompanion installed on your Vita/VitaTV)
Help needed :)
./waf install_release --tex-quality=pvrtcbest --PSVITAIP=<ipaddress>:<port> --destdir=./INSTALL
```

### MinGW on Windows
Output will be at `build/release/LugaruVita.vpk`. If you used the `install_release` command instead, then the VPK will also be uploaded to your Vita/VitaTV at `ux0:data/LugaruVita.vpk`, so that it can be installed with VitaShell.

Help needed :)
Note: Transcoding textures can take a very long time (multiple hours), so for testing purposes it's best to use `--tex-quality=pvrtcnormal` or `--tex-quality=pvrtcfastest` (which is default if you omit the option)

### Cross-compiling from Linux
## Debug/incremental builds (for development)

Cross-compiling for Windows using MinGW32 and MinGW64 was tested on Fedora
and Mageia. The instructions may vary for other distros, do not hesitate to
send a merge request to update them if need be.
```
./waf configure --no-audio --profiling
./waf build --no-vpk
```

You will need to install the `mingw32-` or `mingw64-` variants of the
dependencies listed above.
This will build the assets `build/Data.zip` and the application `build/eboot.bin`.

#### MinGW32
If using [VitaCompanion](https://github.com/devnoname120/vitacompanion), you can automatically **build + install + launch** the game on your Vita/VitaTV with the following command:

First you will need to setup some environment variables:
```
export PKG_CONFIG_LIBDIR="/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/i686-w64-mingw32/sys-root/mingw/share/pkgconfig"
export PATH=/usr/i686-w64-mingw32/bin:$PATH
./waf install --PSVITAIP=<ipaddress>:<port> --destdir=./INSTALL --no-vpk --vclaunch=1
```

Then build:
```
mkdir build-mingw32 && cd build-mingw32
cmake .. -DCMAKE_TOOLCHAIN_FILE=/usr/share/mingw/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=install
make
make install
```
This gives you a fast edit-run loop with a single command (as long as your FTP connection is fast).

The `make install` step should copy the `Data/` and required DLLs from the
system to `build-mingw32/install`.
That will ONLY work if you've installed the VPK manually through VitaShell at least once. This command also works for release builds by replacing `install` with `install_release`

#### MinGW64
(also note the --destdir flag is a lazy hack, don't think about it too much...)

The instructions are similar to those for MinGW32:
### Debug/development tools

```
export PKG_CONFIG_LIBDIR="/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/x86_64-w64-mingw32/sys-root/mingw/share/pkgconfig"
export PATH=/usr/x86_64-w64-mingw32/bin:$PATH
```
```
mkdir build-mingw64 && cd build-mingw64
cmake .. -DCMAKE_TOOLCHAIN_FILE=/usr/share/mingw/toolchain-mingw64.cmake -DCMAKE_INSTALL_PREFIX=install
make
make install
```
Note that LugaruOSS has its own runtime development tools, but I have not tested to see if they work.

* If you configured your debug build with the `--profiling` flag, you can press **Left Shoulder + Triangle** to dump the last 100 frames of profiling data to `ux0:data/microprofile_dump.html` as well as the last couple thousand lines of logs to `ux0:data/lugaru_runlog.txt`.

* `vita_debug.py` is a simple script that will automatically download the last core dump and lugaru_runlog.txt, and display them with vitaparsecore and a konsole window using lnav. This is highly specific to my workflow, but it can be trivially modified if you want. It requires you to manually change the ip address of your vita before running.
9 changes: 1 addition & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,4 @@ ENV PATH=/usr/local/vitasdk/bin:$PATH
RUN git clone https://github.com/vitasdk/vdpm && \
cd vdpm && \
./bootstrap-vitasdk.sh && \
./install-all.sh

#Build and install SDL2-VitaGL port
RUN git clone https://github.com/Northfear/SDL --branch=vitagl && \
cd SDL && mkdir build && cd build && \
cmake .. -DCMAKE_TOOLCHAIN_FILE=$VITASDK/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DVIDEO_VITA_VGL=TRUE -DVIDEO_VITA_PVR=FALSE && \
make install

./install-all.sh
86 changes: 8 additions & 78 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Lugaru Vita

![Box art](/screenshot/boxart.png "Lugaru Vita")

This is a port of [Lugaru](https://osslugaru.gitlab.io/) to the PS Vita by [AlexRamallo](https://aramallo.com).

This includes a lot of major refactoring of the original LugaruOSS codebase. The original game ran on a single thread, and I had to refactor many systems to support multithreading, otherwise it would not be playable on the Vita. I also made zero effort to support desktops/other platforms, so it currently only builds for Vita, and many of the changes I did make likely introduced subtle changes to the original gameplay. Therefore, merging this with upstream is probably not going to happen any time soon.
Expand Down Expand Up @@ -48,83 +50,11 @@ There are a couple of issues to be aware of. I'm releasing it as-is because the

# Building

The original build system was replaced with waf in order to more easily support inclusion of an asset processor (for transcoding textures). Waf is included in the repo (it's a Python script), so there's no need to download it.

Builds tested on Ubuntu only, but it might still work on Windows/Mac with minor modifications to the instructions below.

## Dependencies

* Python 3.7+ and Pip
* "Pillow" library from Pip
* [PVRTexTool from Imagination Technologies](https://developer.imaginationtech.com/pvrtextool/). You can create a free account to download it. (make sure `PVRTexToolCLI` is in your PATH)
* [VitaSDK](https://vitasdk.org) (make sure the `VITASDK` environment variable is present)
* [SDL2 VitaGL library by NorthFear](https://github.com/Northfear/SDL/tree/vitagl)

## Installing Pillow

Depending on how pip is installed, you may need one of the following variations:

```
pip install pillow
#or
python3 -m pip install pillow
#or
pip3 install pillow
#or...
```

## Building SDL2-VitaGL

```
git clone https://github.com/Northfear/SDL sdl2-vita --branch vitagl
cd sdl2-vita
mkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=$VITASDK/share/vita.toolchain.cmake -DBUILD_TYPE=Release
make install
```

## Building a release VPK

NOTE: `waf` is a Python script which requires Python 3.7 or later. You might have to use `python3 ./waf` instead, depending on how your system is configured.

```
./waf configure_release
./waf build_release --tex-quality=pvrtcbest
#Alternatively (only if you have VitaCompanion installed on your Vita/VitaTV)
./waf install_release --tex-quality=pvrtcbest --PSVITAIP=<ipaddress>:<port> --destdir=./INSTALL
```

Output will be at `build/release/LugaruVita.vpk`. If you used the `install_release` command instead, then the VPK will also be uploaded to your Vita/VitaTV at `ux0:data/LugaruVita.vpk`, so that it can be installed with VitaShell.

Note: Transcoding textures can take a very long time (multiple hours), so for testing purposes it's best to use `--tex-quality=pvrtcnormal` or `--tex-quality=pvrtcfastest` (which is default if you omit the option)

## Debug/incremental builds (for development)

```
./waf configure --no-audio --profiling
./waf build --no-vpk
```

This will build the assets `build/Data.zip` and the application `build/eboot.bin`.

If using [VitaCompanion](https://github.com/devnoname120/vitacompanion), you can automatically **build + install + launch** the game on your Vita/VitaTV with the following command:

```
./waf install --PSVITAIP=<ipaddress>:<port> --destdir=./INSTALL --no-vpk --vclaunch=1
```

This gives you a fast edit-run loop with a single command (as long as your FTP connection is fast).

That will ONLY work if you've installed the VPK manually through VitaShell at least once. This command also works for release builds by replacing `install` with `install_release`

(also note the --destdir flag is a lazy hack, don't think about it too much...)

### Debug/development tools

Note that LugaruOSS has its own runtime development tools, but I have not tested to see if they work.
See [COMPILING.md](COMPILING.md)

* If you configured your debug build with the `--profiling` flag, you can press **Left Shoulder + Triangle** to dump the last 100 frames of profiling data to `ux0:data/microprofile_dump.html` as well as the last couple thousand lines of logs to `ux0:data/lugaru_runlog.txt`.
# Screenshots

* `vita_debug.py` is a simple script that will automatically download the last core dump and lugaru_runlog.txt, and display them with vitaparsecore and a konsole window using lnav. This is highly specific to my workflow, but it can be trivially modified if you want. It requires you to manually change the ip address of your vita before running.
![scr1](/screenshot/scr1.jpg "Dead wolf")
![scr2](/screenshot/scr2.jpg "Weapons")
![scr3](/screenshot/scr3.jpg "Ragdolls")
![scr4](/screenshot/scr4.jpg "Sneak attacks")
2 changes: 1 addition & 1 deletion Source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ void DoUpdate()
}else if(phys_quality == 2){
max_count = 4;
}else{
max_count = 8;
max_count = 8;
}

if(count > max_count){
Expand Down
21 changes: 0 additions & 21 deletions conanfile.txt

This file was deleted.

Binary file modified sce_sys/pic0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot/boxart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot/scr1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot/scr2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot/scr3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot/scr4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions sdl2-vitagl-lugaru
Submodule sdl2-vitagl-lugaru added at f1a70f
4 changes: 2 additions & 2 deletions vita_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
outlog = "lugaru_runlog.txt"

logfile = "lugaru_runlog.txt"
elf = "build/Lugaru.elf"
#elf = "build/release/Lugaru.elf"
#elf = "build/Lugaru.elf"
elf = "build/release/Lugaru.elf"

#logfile = "SharkServer.log"
#elf = "build/tool_vita_shark_eboot_debug/tool/shark_server/VitaShaRK Server.elf"
Expand Down

0 comments on commit 7101eed

Please sign in to comment.