Get Skeletool dependencies from system

Do not install while building
This commit is contained in:
Matt Penny 2024-10-19 17:34:15 -04:00
parent 42a9189c95
commit 3b9fba522b
9 changed files with 111 additions and 108 deletions

View File

@ -18,37 +18,38 @@ RUN apt-get update -y && \
dpkg --add-architecture i386 && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
binutils-mips-n64 \
newlib-mips-n64 \
build-essential \
cimg-dev \
cmake \
ffmpeg \
gcc-mips-n64 \
n64sdk \
makemask \
root-compatibility-environment \
libmpc-dev \
sfz2n64 \
vtf2png \
libxi6 \
libxxf86vm-dev \
libxfixes3 \
libxrender1 \
libgl1 \
python3 \
pip \
pipx \
git \
imagemagick \
libassimp-dev \
libgl1 \
liblua5.4-0 \
liblua5.4-dev \
libmpc-dev \
libpng-dev \
libtiff-dev \
libassimp-dev \
git \
cmake \
build-essential \
wget \
unzip \
sox \
nodejs \
libxfixes3 \
libxi6 \
libxrender1 \
libxxf86vm-dev \
libyaml-cpp-dev \
lua5.4 \
liblua5.4-dev \
liblua5.4-0 \
ffmpeg \
makemask \
newlib-mips-n64 \
nodejs \
n64sdk \
pip \
pipx \
python3 \
root-compatibility-environment \
sfz2n64 \
sox \
unzip \
vtf2png \
wget
RUN mkdir /opt/blender

View File

@ -13,10 +13,6 @@ VTF2PNG:=vtf2png
SFZ2N64:=sfz2n64
$(SKELATOOL64):
skelatool64/setup_dependencies.sh
@$(MAKE) -C skelatool64
# Use tag name if the current commit is tagged, otherwise use commit hash

View File

@ -59,7 +59,6 @@ The following commands allow the scripts to run on the system, then it runs the
As always it is good practice look over scripts from the internet before running them on your system.
```sh
sudo chmod +x skelatool64/setup_dependencies.sh
sudo chmod +x tools/romfix64.sh
sudo chmod +x tools/setup.sh
./tools/setup.sh

View File

@ -1,22 +1,40 @@
## How to build
## How to Build
### SDK
First, you will need to setup [Modern SDK](https://crashoveride95.github.io/n64hbrew/modernsdk/startoff.html).
Next, you will need to install the latest version of Blender 3.6 LTS (please don't use e.g. 4.x, only 3.6.x will work correctly). Then set the environment variable `BLENDER_3_6` to be the absolute path where the Blender 3.6 executable is located on your system.
### Game Dependencies
You can install most dependencies using your package manager's default repository:
```sh
sudo apt install build-essential cmake ffmpeg git imagemagick nodejs pip pipx python3 sox unzip
```
For the following dependencies, first add the following custom repository:
```sh
echo "deb [trusted=yes] https://lambertjamesd.github.io/apt/ ./" \
| sudo tee /etc/apt/sources.list.d/lambertjamesd.list
sudo apt update
sudo apt install sfz2n64 vtf2png
```
Next, you will need to install Blender 3.6 LTS (please don't use e.g. 4.x, only 3.6.x will work correctly). Then set the environment variable `BLENDER_3_6` to be the absolute path where the Blender 3.6 executable is located on your system.
```sh
sudo snap install blender --channel=3.6lts/stable --classic
```
e.g. add this to your ~/.bashrc if you used snap (or you can use `which blender` to find the path of Blender 3.6)
E.g., add this to your `~/.bashrc` if you used snap (or you can use `which blender` to find the path of Blender 3.6):
```bash
export BLENDER_3_6="/snap/bin/blender"
```
<br />
You will need to install Python `vpk`:
Install the Python `vpk` module using pipx:
```sh
sudo apt install pipx
@ -24,41 +42,21 @@ pipx ensurepath
pipx install vpk
```
<br />
### Skeletool Dependencies
Setup and install dependencies for `skelatool64`:
```sh
sudo apt install cimg-dev libassimp-dev liblua5.4-0 liblua5.4-dev libpng-dev libtiff-dev libyaml-cpp-dev lua5.4
```
**Note:** Lua 5.4 is required!
### Getting the Code
Clone the Portal64 repo or download the zip.
```sh
sudo apt install git
git clone https://github.com/lambertjamesd/portal64.git
git clone https://github.com/mwpenny/portal64-still-alive.git portal64
cd portal64
```
Setup and install dependencies for `skelatool64`
```sh
echo "deb [trusted=yes] https://lambertjamesd.github.io/apt/ ./" \
| sudo tee /etc/apt/sources.list.d/lambertjamesd.list
sudo apt update
sudo apt install vtf2png sfz2n64 sox imagemagick unzip
``
```
Install ffmpeg 4.3.1
```
sudo snap install ffmpeg # version 4.3.1
```
<br />
Install lua5.4 (You may need to remove other installed versions first, skelatool64 needs to be built with luac 5.4!)
```sh
sudo apt install lua5.4 liblua5.4-dev liblua5.4-0
```
<br />
You will need to install nodejs. You can use apt for this
```sh
sudo apt install nodejs
```

View File

@ -1,17 +0,0 @@
#!/usr/bin/bash
sudo apt install -y libpng-dev libtiff-dev libassimp-dev g++ liblua5.4-dev cmake
pushd $(dirname "$0")
git clone https://github.com/jbeder/yaml-cpp.git
cmake -S yaml-cpp -B yaml-cpp
make -C yaml-cpp
wget -O CImg_3.1.3.zip http://cimg.eu/files/CImg_3.1.3.zip
unzip -o CImg_3.1.3.zip
rm -rf cimg
mv CImg-3.1.3 cimg
popd

View File

@ -5,6 +5,6 @@ CImgu8::CImgu8(const std::string& filename) : mImg(filename.c_str()) {
}
CImgu8::CImgu8(const cimg_library_suffixed::CImg<unsigned char>& img) : mImg(img) {
CImgu8::CImgu8(const cimg_library::CImg<unsigned char>& img) : mImg(img) {
}

View File

@ -16,8 +16,8 @@
class CImgu8 {
public:
CImgu8(const std::string& filename);
CImgu8(const cimg_library_suffixed::CImg<unsigned char>& img);
cimg_library_suffixed::CImg<unsigned char> mImg;
CImgu8(const cimg_library::CImg<unsigned char>& img);
cimg_library::CImg<unsigned char> mImg;
};
#endif

View File

@ -115,7 +115,7 @@ bool PixelIAu8::WriteToStream(DataChunkStream& output, G_IM_SIZ size) {
}
}
struct PixelRGBAu8 readRGBAPixel(cimg_library_suffixed::CImg<unsigned char>& input, int x, int y) {
struct PixelRGBAu8 readRGBAPixel(cimg_library::CImg<unsigned char>& input, int x, int y) {
struct PixelRGBAu8 result;
result.r = 0;
@ -143,7 +143,7 @@ struct PixelRGBAu8 readRGBAPixel(cimg_library_suffixed::CImg<unsigned char>& inp
return result;
}
struct PixelIu8 readIPixel(cimg_library_suffixed::CImg<unsigned char>& input, int x, int y) {
struct PixelIu8 readIPixel(cimg_library::CImg<unsigned char>& input, int x, int y) {
switch (input.spectrum()) {
case 4:
case 3:
@ -160,7 +160,7 @@ struct PixelIu8 readIPixel(cimg_library_suffixed::CImg<unsigned char>& input, in
return PixelIu8(0);
}
struct PixelIAu8 readIAPixel(cimg_library_suffixed::CImg<unsigned char>& input, int x, int y) {
struct PixelIAu8 readIAPixel(cimg_library::CImg<unsigned char>& input, int x, int y) {
uint8_t alpha = 0xFF;
switch (input.spectrum()) {
@ -181,7 +181,7 @@ struct PixelIAu8 readIAPixel(cimg_library_suffixed::CImg<unsigned char>& input,
return PixelIAu8(0, alpha);
}
void writeRGBAPixel(cimg_library_suffixed::CImg<unsigned char>& input, int x, int y, struct PixelRGBAu8 value) {
void writeRGBAPixel(cimg_library::CImg<unsigned char>& input, int x, int y, struct PixelRGBAu8 value) {
switch (input.spectrum()) {
case 4:
input(x, y, 0, 3) = value.a;
@ -198,7 +198,7 @@ void writeRGBAPixel(cimg_library_suffixed::CImg<unsigned char>& input, int x, in
}
}
void writeIAPixel(cimg_library_suffixed::CImg<unsigned char>& input, int x, int y, struct PixelIAu8 value) {
void writeIAPixel(cimg_library::CImg<unsigned char>& input, int x, int y, struct PixelIAu8 value) {
switch (input.spectrum()) {
case 4:
input(x, y, 0, 3) = value.a;
@ -215,7 +215,7 @@ void writeIAPixel(cimg_library_suffixed::CImg<unsigned char>& input, int x, int
}
}
bool convertPixel(cimg_library_suffixed::CImg<unsigned char>& input, int x, int y, DataChunkStream& output, G_IM_FMT fmt, G_IM_SIZ siz, const std::shared_ptr<PalleteDefinition>& pallete) {
bool convertPixel(cimg_library::CImg<unsigned char>& input, int x, int y, DataChunkStream& output, G_IM_FMT fmt, G_IM_SIZ siz, const std::shared_ptr<PalleteDefinition>& pallete) {
switch (fmt) {
case G_IM_FMT::G_IM_FMT_RGBA: {
PixelRGBAu8 pixel = readRGBAPixel(input, x, y);
@ -281,7 +281,7 @@ uint8_t floatToByte(float input) {
return result;
}
void applyTwoToneEffect(cimg_library_suffixed::CImg<unsigned char>& input, PixelRGBAu8& maxColor, PixelRGBAu8& minColor) {
void applyTwoToneEffect(cimg_library::CImg<unsigned char>& input, PixelRGBAu8& maxColor, PixelRGBAu8& minColor) {
LinearLeastSquares r;
LinearLeastSquares g;
LinearLeastSquares b;
@ -333,8 +333,8 @@ void applyTwoToneEffect(cimg_library_suffixed::CImg<unsigned char>& input, Pixel
#define NORMAL_45_STEEPNESS 16
void calculateNormalMap(cimg_library_suffixed::CImg<unsigned char>& input) {
cimg_library_suffixed::CImg<unsigned char> result(input.width(), input.height(), 1, 3);
void calculateNormalMap(cimg_library::CImg<unsigned char>& input) {
cimg_library::CImg<unsigned char> result(input.width(), input.height(), 1, 3);
for (int y = 0; y < input.height(); ++y) {
for (int x = 0; x < input.width(); ++x) {
@ -360,7 +360,7 @@ void calculateNormalMap(cimg_library_suffixed::CImg<unsigned char>& input) {
input = result;
}
void invertImage(cimg_library_suffixed::CImg<unsigned char>& input) {
void invertImage(cimg_library::CImg<unsigned char>& input) {
for (int y = 0; y < input.height(); ++y) {
for (int x = 0; x < input.width(); ++x) {
PixelRGBAu8 colorValue = readRGBAPixel(input, x, y);
@ -369,7 +369,7 @@ void invertImage(cimg_library_suffixed::CImg<unsigned char>& input) {
}
}
void selectChannel(cimg_library_suffixed::CImg<unsigned char>& input, TextureDefinitionEffect effects) {
void selectChannel(cimg_library::CImg<unsigned char>& input, TextureDefinitionEffect effects) {
for (int y = 0; y < input.height(); ++y) {
for (int x = 0; x < input.width(); ++x) {
PixelRGBAu8 colorValue = readRGBAPixel(input, x, y);
@ -387,7 +387,7 @@ void selectChannel(cimg_library_suffixed::CImg<unsigned char>& input, TextureDef
PalleteDefinition::PalleteDefinition(const std::string& filename):
mName(getBaseName(replaceExtension(filename, "")) + "_tlut") {
cimg_library_suffixed::CImg<unsigned char> imageData(filename.c_str());
cimg_library::CImg<unsigned char> imageData(filename.c_str());
DataChunkStream dataStream;
@ -536,7 +536,7 @@ TextureDefinition::TextureDefinition(
}
}
bool isGrayscale(cimg_library_suffixed::CImg<unsigned char>& input, int x, int y) {
bool isGrayscale(cimg_library::CImg<unsigned char>& input, int x, int y) {
switch (input.spectrum()) {
case 1:
case 2:
@ -549,7 +549,7 @@ bool isGrayscale(cimg_library_suffixed::CImg<unsigned char>& input, int x, int y
return false;
}
int colorHash(cimg_library_suffixed::CImg<unsigned char>& input, int x, int y) {
int colorHash(cimg_library::CImg<unsigned char>& input, int x, int y) {
switch (input.spectrum()) {
case 1:
case 2:
@ -563,7 +563,7 @@ int colorHash(cimg_library_suffixed::CImg<unsigned char>& input, int x, int y) {
}
void TextureDefinition::DetermineIdealFormat(const std::string& filename, G_IM_FMT& fmt, G_IM_SIZ& siz) {
cimg_library_suffixed::CImg<unsigned char> imageData(filename.c_str());
cimg_library::CImg<unsigned char> imageData(filename.c_str());
bool hasColor = false;
bool hasFullTransparency = false;

View File

@ -9,14 +9,40 @@ sudo dpkg --add-architecture i386
sudo apt update
# Install various packages
sudo apt install binutils-mips-n64 gcc-mips-n64 git imagemagick liblua5.4-0 liblua5.4-dev lua5.4 make makemask newlib-mips-n64 nodejs n64sdk root-compatibility-environment sfz2n64 sox unzip vtf2png -y
sudo apt install -y \
binutils-mips-n64 \
build-essential
cimg-dev \
cmake \
ffmpeg \
gcc-mips-n64 \
git \
imagemagick \
libassimp-dev \
liblua5.4-0 \
liblua5.4-dev \
libpng-dev \
libtiff-dev \
libyaml-cpp-dev \
lua5.4 \
makemask \
newlib-mips-n64 \
nodejs \
n64sdk \
pip \
pipx \
python3 \
root-compatibility-environment \
sfz2n64 \
sox \
unzip \
vtf2png
# Ubuntu WSL needs these for some reason.
# Ubuntu WSL needs these for some reason.
sudo apt-get update && sudo apt-get install libxfixes3 libxi6 libxkbcommon0 libxxf86vm1 libgl1-mesa-glx -y
# Install Blender and FFmpeg specific versions via snap
# Install Blender specific version via snap
sudo snap install blender --channel=3.6lts/stable --classic
sudo snap install ffmpeg
# Append environment variables to .bashrc
echo 'export N64_LIBGCCDIR=/opt/crashsdk/lib/gcc/mips64-elf/12.2.0' >> ~/.bashrc