This commit is contained in:
MegaMech
2025-02-09 00:59:00 -07:00
23 changed files with 2469 additions and 235 deletions
+39 -19
View File
@@ -1,31 +1,51 @@
name: Linux Compile test
name: Linux Validation
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "master" ]
pull_request:
branches: [ "*" ]
jobs:
build:
if: 0
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
with:
submodules: "true"
- name: Get Complementary file
uses: actions/checkout@v4.1.1
with:
path: complementary_file
repository: UnspaghettifyKart/action-build-private-file
ssh-key: ${{ secrets.LINUX_SSH_PRIVATE_KEY }}
submodules: recursive
- name: Update machine
run: sudo apt update
- name: Install dependencies
run: sudo apt-get install gcc g++ git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev libboost-dev libopengl-dev libogg-dev libvorbis-dev
- name: Install latest SDL
run: |
sudo apt install build-essential cmake pkg-config git binutils-mips-linux-gnu python3 zlib1g-dev libaudiofile-dev libcapstone-dev
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
wget https://www.libsdl.org/release/SDL2-2.24.1.tar.gz
tar -xzf SDL2-2.24.1.tar.gz
cd SDL2-2.24.1
./configure
make -j 10
sudo make install
- name: Install latest tinyxml2
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
wget https://github.com/leethomason/tinyxml2/archive/refs/tags/10.0.0.tar.gz
tar -xzf 10.0.0.tar.gz
cd tinyxml2-10.0.0
mkdir -p build
cd build
cmake ..
make
sudo make install
- name: Build
run: |
cp -r complementary_file/* .
echo "${{ secrets.AES_KEY }}" | openssl enc -d -aes-256-cbc -pass stdin -pbkdf2 -in baserom.us.z64.aes -out baserom.us.z64
make assets
make -j || ./first-diff.py
cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=Release
cmake --build build-cmake -j
- name: Create Package
run: |
mkdir spaghetti-release
mv build-cmake/spaghetti spaghetti-release/
- name: Publish packaged artifacts
uses: actions/upload-artifact@v4
with:
name: spaghetti-linux-x64
path: spaghetti-release
retention-days: 1
+19 -22
View File
@@ -1,32 +1,29 @@
name: Macos Compile test
name: MacOS Validation
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "master" ]
pull_request:
branches: [ "*" ]
jobs:
build:
if: 0
runs-on: macos-latest
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
with:
submodules: "true"
- name: Get Complementary file
uses: actions/checkout@v4.1.1
with:
path: complementary_file
repository: UnspaghettifyKart/action-build-private-file
ssh-key: ${{ secrets.MACOS_SSH_PRIVATE_KEY }}
submodules: recursive
- name: Install dependencies
run: |
brew update
brew install python3 capstone coreutils make pkg-config tehzz/n64-dev/mips64-elf-binutils cmake
run: brew install sdl2 libpng glew ninja cmake libzip nlohmann-json tinyxml2 spdlog vorbis-tools
- name: Build
run: |
cp -r complementary_file/* .
echo "${{ secrets.AES_KEY }}" | openssl enc -d -aes-256-cbc -pass stdin -pbkdf2 -in baserom.us.z64.aes -out baserom.us.z64
make assets
make -j
cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=Release
cmake --build build-cmake -j
- name: Create Package
run: |
mkdir spaghetti-release
mv build-cmake/spaghetti spaghetti-release/
- name: Publish packaged artifacts
uses: actions/upload-artifact@v4
with:
name: spaghetti-mac-x64
path: spaghetti-release
retention-days: 1
+195
View File
@@ -0,0 +1,195 @@
name: GenerateBuilds
on:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
generate-port-o2r:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install dependencies
run: sudo apt-get install gcc g++ git cmake ninja-build lsb-release
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.13
with:
key: ${{ runner.os }}-o2r-ccache-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-o2r-ccache-${{ github.ref }}
${{ runner.os }}-o2r-ccache-
- name: Cache build folders
uses: actions/cache@v4
with:
key: ${{ runner.os }}-o2r-build-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-o2r-build-${{ github.ref }}
${{ runner.os }}-o2r-build-
path: |
torch/cmake-build-release
- name: Generate spaghetti.o2r
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
make -C torch type=release -j3
torch/cmake-build-release/torch pack port spaghetti.o2r o2r
- uses: actions/upload-artifact@v4
with:
name: spaghetti.o2r
path: spaghetti.o2r
retention-days: 1
build-windows:
needs: generate-port-o2r
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build
run: |
cmake -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64 -DCMAKE_BUILD_TYPE=Release
cmake --build ./build/x64 --config Release --parallel 10
- name: Download spaghetti.o2r
uses: actions/download-artifact@v4
with:
name: spaghetti.o2r
path: ./build/x64/Release
- name: Create Package
run: |
mkdir spaghetti-release
mv build/x64/Release/Spaghetti.exe spaghetti-release/
mv build/x64/Release/spaghetti.o2r spaghetti-release/
mv config.yml spaghetti-release/
mv assets spaghetti-release/
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/master/gamecontrollerdb.txt" -OutFile "spaghetti-release/gamecontrollerdb.txt"
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: spaghetti-windows
path: spaghetti-release
build-macos:
needs: generate-port-o2r
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: brew install sdl2 libpng glew ninja cmake libzip nlohmann-json tinyxml2 spdlog vorbis-tools
- name: Build
run: |
cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=Release
cmake --build build-cmake --config Release -j3
- name: Download spaghetti.o2r
uses: actions/download-artifact@v4
with:
name: spaghetti.o2r
path: ./build-cmake
- name: Create Package
run: |
mkdir spaghetti-release
mv build-cmake/Spaghetti spaghetti-release/
mv build-cmake/spaghetti.o2r spaghetti-release/
mv config.yml spaghetti-release/
mv assets spaghetti-release/
wget -O spaghetti-release/gamecontrollerdb.txt https://github.com/mdqinc/SDL_GameControllerDB/blob/master/gamecontrollerdb.txt
- name: Publish packaged artifacts
uses: actions/upload-artifact@v4
with:
name: spaghetti-mac-x64
path: spaghetti-release
build-linux:
needs: generate-port-o2r
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Update machine
run: sudo apt update
- name: Install dependencies
run: sudo apt-get install gcc g++ git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev libboost-dev libopengl-dev libogg-dev libvorbis-dev
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.14
with:
key: linux-ccache-${{ github.ref }}-${{ github.sha }}
restore-keys: |
linux-ccache-${{ github.ref }}
linux-ccache-
- name: Cache build folders
uses: actions/cache@v4
with:
key: linux-build-${{ github.ref }}-${{ github.sha }}
restore-keys: |
linux-build-${{ github.ref }}
linux-build-
path: |
SDL2-2.30.3
tinyxml2-10.0.0
libzip-1.10.1
- name: Install latest SDL
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
if [ ! -d "SDL2-2.30.3" ]; then
wget https://www.libsdl.org/release/SDL2-2.30.3.tar.gz
tar -xzf SDL2-2.30.3.tar.gz
fi
cd SDL2-2.30.3
./configure --enable-hidapi-libusb
make -j 10
sudo make install
sudo cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/
- name: Install latest tinyxml2
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
wget https://github.com/leethomason/tinyxml2/archive/refs/tags/10.0.0.tar.gz
tar -xzf 10.0.0.tar.gz
cd tinyxml2-10.0.0
mkdir -p build
cd build
cmake ..
make
sudo make install
- name: Install libzip without crypto
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
if [ ! -d "libzip-1.10.1" ]; then
wget https://github.com/nih-at/libzip/releases/download/v1.10.1/libzip-1.10.1.tar.gz
tar -xzf libzip-1.10.1.tar.gz
fi
cd libzip-1.10.1
mkdir -p build
cd build
cmake .. -DENABLE_COMMONCRYPTO=OFF -DENABLE_GNUTLS=OFF -DENABLE_MBEDTLS=OFF -DENABLE_OPENSSL=OFF
make
sudo make install
sudo cp -av /usr/local/lib/libzip* /lib/x86_64-linux-gnu/
- name: Download spaghetti.o2r
uses: actions/download-artifact@v4
with:
name: spaghetti.o2r
path: ./build-cmake
- name: Build
run: |
cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=Release
cmake --build build-cmake --config Release -j3
(cd build-cmake && cpack -G External)
wget -O gamecontrollerdb.txt https://github.com/mdqinc/SDL_GameControllerDB/blob/master/gamecontrollerdb.txt
mv README.md readme.txt
mv build-cmake/*.appimage spaghetti.appimage
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: Spaghetti-linux
path: |
spaghetti.appimage
config.yml
assets
gamecontrollerdb.txt
+12 -21
View File
@@ -1,32 +1,23 @@
name: Windows Compile test
name: Windows Validation
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "master" ]
branches: [ "*" ]
jobs:
build:
if: 0
runs-on: windows-2022
steps:
- uses: actions/checkout@v4.1.1
- uses: actions/checkout@v4
with:
submodules: "true"
- name: Get Complementary file
uses: actions/checkout@v4.1.1
with:
path: complementary_file
repository: UnspaghettifyKart/action-build-private-file
ssh-key: ${{ secrets.WINDOWS_SSH_PRIVATE_KEY }}
- name: Install dependencies
run: |
Invoke-WebRequest https://github.com/coco875/mk64-tools/releases/download/v0.0.8/mips-tools-chain-windows.zip -OutFile mips-tools-chain-windows.zip
Expand-Archive mips-tools-chain-windows.zip -DestinationPath mips-tools-chain-windows
Copy-Item -Path mips-tools-chain-windows/mingw64 -Destination tools -Recurse
submodules: recursive
- name: Build
run: |
Copy-Item -Path complementary_file/* -Destination . -Recurse
echo "${{ secrets.AES_KEY }}" | openssl enc -d -aes-256-cbc -pass stdin -pbkdf2 -in baserom.us.z64.aes -out baserom.us.z64
python tools/windows_build.py
cmake -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64 -DCMAKE_BUILD_TYPE=Release
cmake --build ./build/x64
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: spaghetti-windows
path: ./build/x64/Debug
retention-days: 1
-1
View File
@@ -111,7 +111,6 @@ mingw64/
# torch
torch.hash.yml
build*
cmake*
.idea
# the game
+40 -4
View File
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR)
# Set the project version and language
project(Spaghettify VERSION 0.1.0 LANGUAGES C CXX ASM)
include(FetchContent)
if(APPLE)
enable_language(OBJCXX)
@@ -23,7 +24,7 @@ include(FindFontconfig)
include(cmake/lus-cvars.cmake)
if (WIN32)
include(libultraship/cmake/automate-vcpkg.cmake)
include(cmake/automate-vcpkg.cmake)
set(VCPKG_TRIPLET x64-windows-static)
set(VCPKG_TARGET_TRIPLET x64-windows-static)
vcpkg_bootstrap()
@@ -234,7 +235,6 @@ file(DOWNLOAD "https://raw.githubusercontent.com/DLTcollab/sse2neon/refs/heads/m
include_directories(${SSE2NEON_DIR})
#=================== DRLibs ===================
include(FetchContent)
FetchContent_Declare(
dr_libs
GIT_REPOSITORY https://github.com/mackron/dr_libs.git
@@ -376,8 +376,8 @@ if(USE_NETWORKING)
endif()
find_package(SDL2_net REQUIRED)
include_directories(${SDL2_NET_INCLUDE_DIRS})
# target_link_libraries(${PROJECT_NAME} PRIVATE SDL2_net::SDL2_net)
# target_compile_definitions(${PROJECT_NAME} PRIVATE USE_NETWORKING)
# target_link_libraries(${PROJECT_NAME} PRIVATE SDL2_net::SDL2_net)
# target_compile_definitions(${PROJECT_NAME} PRIVATE USE_NETWORKING)
endif()
option(USE_STANDALONE "Build as a standalone executable" OFF)
@@ -636,3 +636,39 @@ add_custom_target(
COMMAND ${TORCH_EXECUTABLE} pack port spaghetti.o2r o2r
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/spaghetti.o2r" "${CMAKE_BINARY_DIR}/spaghetti.o2r"
)
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_custom_target(CreateOSXIcons
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/macosx/spaghettikart.iconset
COMMAND sips -z 16 16 logo.png --out ${CMAKE_BINARY_DIR}/macosx/spaghettikart.iconset/icon_16x16.png
COMMAND sips -z 32 32 logo.png --out ${CMAKE_BINARY_DIR}/macosx/spaghettikart.iconset/icon_16x16@2x.png
COMMAND sips -z 32 32 logo.png --out ${CMAKE_BINARY_DIR}/macosx/spaghettikart.iconset/icon_32x32.png
COMMAND sips -z 64 64 logo.png --out ${CMAKE_BINARY_DIR}/macosx/spaghettikart.iconset/icon_32x32@2x.png
COMMAND sips -z 128 128 logo.png --out ${CMAKE_BINARY_DIR}/macosx/spaghettikart.iconset/icon_128x128.png
COMMAND sips -z 256 256 logo.png --out ${CMAKE_BINARY_DIR}/macosx/spaghettikart.iconset/icon_128x128@2x.png
COMMAND sips -z 256 256 logo.png --out ${CMAKE_BINARY_DIR}/macosx/spaghettikart.iconset/icon_256x256.png
COMMAND sips -z 512 512 logo.png --out ${CMAKE_BINARY_DIR}/macosx/spaghettikart.iconset/icon_256x256@2x.png
COMMAND sips -z 512 512 logo.png --out ${CMAKE_BINARY_DIR}/macosx/spaghettikart.iconset/icon_512x512.png
COMMAND cp logo.png ${CMAKE_BINARY_DIR}/macosx/spaghettikart.iconset/icon_512x512@2x.png
COMMAND iconutil -c icns -o ${CMAKE_BINARY_DIR}/macosx/spaghettikart.icns ${CMAKE_BINARY_DIR}/macosx/spaghettikart.iconset
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Creating OSX icons ..."
)
add_dependencies(${PROJECT_NAME} CreateOSXIcons)
configure_file("${CMAKE_SOURCE_DIR}/Info.plist" "${CMAKE_BINARY_DIR}/Info.plist" COPYONLY)
endif()
set_property(TARGET ${PROJECT_NAME} PROPERTY APPIMAGE_DESKTOP_FILE_TERMINAL YES)
set_property(TARGET ${PROJECT_NAME} PROPERTY APPIMAGE_DESKTOP_FILE "${CMAKE_SOURCE_DIR}/SpaghettiKart.desktop")
set_property(TARGET ${PROJECT_NAME} PROPERTY APPIMAGE_ICON_FILE "${CMAKE_SOURCE_DIR}/logo.png")
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CPACK_GENERATOR "External")
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows|NintendoSwitch|CafeOS")
set(CPACK_GENERATOR "ZIP")
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(CPACK_GENERATOR "Bundle")
endif()
set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_SOURCE_DIR}/cmake/configure-packaging.cmake)
include(cmake/packaging.cmake)
+61 -76
View File
@@ -1,101 +1,86 @@
# Mario Kart 64
This work-in-progress decompilation of Mario Kart 64 pursues historical and educational elements within the game found via taking it apart and putting it back together. Inspiration to do so not only emanates from the game's hardware and technology but also its immensely positive effects on the cultures and families of nearly every nationality.
[comment]: <> (Todo: Make Light Mode Image)
[comment]: <> (Todo: Make Dark Mode Image)
This repository does not contain assets. Compiling requires asset extraction from a prior copy of the game.
# SpaghettiKart
It supports and builds the following versions:
Developed by:
* [MegaMech](https://www.github.com/MegaMech)
* [Coco](https://www.github.com/coco875)
| ROM Output | Revision| SHA-1 Checksum |
|-------------------|---------|------------------------------------------|
| mk64.us.z64 | USA | 579c48e211ae952530ffc8738709f078d5dd215e |
| mk64.eu-1.0.z64 | EUR 1.0 | a729039453210b84f17019dda3f248d5888f7690 |
| mk64.eu-final.z64 | EUR 1.1 | f6b5f519dd57ea59e9f013cc64816e9d273b2329 |
## Discord
[![Linux Compile](https://github.com/n64decomp/mk64/actions/workflows/linux-compile.yml/badge.svg)](https://github.com/n64decomp/mk64/actions/workflows/linux-compile.yml)
Official Discord: https://discord.com/invite/shipofharkinian
## Progress
If you're having any trouble after reading through this `README`, feel free ask for help in the SpaghettiKart Support text channels. Please keep in mind that we do not condone piracy.
Total progress consists of all code segments together.
# Quick Start
Game code progress consists of `main`, `ending` and `racing`.
SpaghettiKart does not include any copyrighted assets. You are required to provide a supported copy of the game.
![Build Status](https://n64decomp.github.io/mk64/total_progress.svg)
![Build Status](https://n64decomp.github.io/mk64/game_progress.svg)
### 1. Verify your ROM dump
The supported ROM is the USA 1.1 Rev A version. You can verify you have dumped a supported copy of the game by using the SHA-1 File Checksum Online at https://www.romhacking.net/hash/. The hash for a US 1.0 ROM is SHA-1: 579C48E211AE952530FFC8738709F078D5DD215E.
![Build Status](https://n64decomp.github.io/mk64/asm_funcs.svg)
![Build Status](https://n64decomp.github.io/mk64/m2c_funcs.svg)
![Build Status](https://n64decomp.github.io/mk64/nonmatching_funcs.svg)
### 2. Verify your ROM is in .z64 format
Your ROM needs to be in .z64 format. If it's in .n64 format, use the following to convert it to a .z64: https://hack64.net/tools/swapper.php
- ![Build Status](https://n64decomp.github.io/mk64/seg_main_progress.svg)
- ![Build Status](https://n64decomp.github.io/mk64/seg_ending_progress.svg)
- ![Build Status](https://n64decomp.github.io/mk64/seg_racing_progress.svg)
- ![Build Status](https://n64decomp.github.io/mk64/audio_progress.svg)
- ![Build Status](https://n64decomp.github.io/mk64/libultra_progress.svg)
### 2. Download SpaghettiKart from [Releases](https://github.com/HarbourMasters/SpaghettiKart/releases)
## Quick Start
### 3. Generating the O2R from the ROM
#### Windows
* Extract every file from the zip into a folder of your choosing.
* Copy your ROM to the root of the folder you extracted the zip to.
* Run "generate_o2r.bat"
```
git submodule update --init --recursive
```
Extract assets
```
make assets -j
make -j
```
#### MacOS
* Extract every file from the zip into a folder of your choosing.
* Copy your ROM to the root of the folder you extracted the zip to.
* Run "generate_o2r.sh"
## Building
### 4. Play!
* Launch `SpaghettiKart.exe`
Congratulations, you are now sailing with SpaghettiKart! Have fun!
Build instructions located in the [API docs](https://n64decomp.github.io/mk64/compiling.html)
See also, the comprehensive API and documentation which includes an overview of the code-base while also discussing significant concepts, features, and modding.
# Configuration
## Current State
### Default keyboard configuration
| N64 | A | B | Z | Start | Analog stick | C buttons | D-Pad |
| - | - | - | - | - | - | - | - |
| Keyboard | X | C | Z | Space | WASD | Arrow keys | TFGH |
The code-base may change significanty overtime as naming and documentation continues. The code-base is shiftable.
### Other shortcuts
| Keys | Action |
| - | - |
| F1 | Toggle menubar |
| F11 | Fullscreen |
| Tab | Toggle Alternate assets |
| Ctrl+R | Reset |
Some menu textures are compressed using a format called tkmk00. A byte-matching compressor/decompressor does not yet exist.
### Graphics Backends
Currently, there are three rendering APIs supported: DirectX11 (Windows), OpenGL (all platforms), and Metal (macOS). You can change which API to use in the `Settings` menu of the menubar, which requires a restart. If you're having an issue with crashing, you can change the API in the `spaghettify.cfg.json` file by finding the line `"Backend":{`... and changing the `id` value to `3` and set the `Name` to `OpenGL`. `DirectX 11` with id `2` is the default on Windows. `Metal` with id `4` is the default on macOS.
## Project Structure
mk64
├── asm: Handwritten assembly code, rom header and boot
│ ├── non_matchings: Assembly for non-matching sections
│ └── os: Libultra handwritten assembly code
├── assets: Textures
├── courses: Course data, geography, display lists and staff ghosts
├── build: Output directory
├── data: Misc data, text, audio banks, and instrument sets
├── docs: Build guides
├── include: Header files
├── music: Sequences
├── src: C source code for the game
| ├── actors: Individual actors split out from other files
│ ├── audio: Sample tables and audio code
│ ├── data: Misc data referenced in other C files
| ├── debug: Custom debug code
| ├── ending: Podium ceremony and credits code
│ ├── os: Libultra C code
| └── racing: Race and game engine code
├── textures: Texture data, bitmaps
| ├── common: Textures common to many courses
| ├── courses: Course specific textures
| ├── crash screen: Crash screen font image
│ ├── raw: Raw textures
│ ├── standalone: Whole textures
| ├── startup_logo: Reflection map
| └── trophy: Ceremony cutscene podium and trophy textures
└── tools: build tools
# Custom Assets
Custom assets are packed in `.o2r` or `.otr` files. To use custom assets, place them in the `mods` folder.
## Documentation
If you're interested in creating and/or packing your own custom asset `.o2r`/`.otr` files, check out the following tools:
* [**retro - OTR and O2R generator**](https://github.com/HarbourMasters64/retro)
* [**fast64 - Blender plugin (Note that SF64 is not supported at this time)**](https://github.com/HarbourMasters/fast64)
Documentation available online at [https://n64decomp.github.io/mk64/](https://n64decomp.github.io/mk64/).
# Development
### Building
Documentation generated using [Doxygen](https://www.doxygen.nl/index.html). Run `make doc` to test locally. Documentation resides in `docs/html`. Open index.html to view the site.
If you want to manually compile SpaghettiKart, please consult the [building instructions](https://github.com/HarbourMasters/SpaghettiKart/blob/main/docs/BUILDING.md).
## Contributing
### Playtesting
If you want to playtest a continuous integration build, you can find them at the links below. Keep in mind that these are for playtesting only, and you will likely encounter bugs and possibly crashes.
Pull requests are welcome. For major changes, please discuss in the Discord.
* [Windows](https://nightly.link/HarbourMasters/SpaghettiKart/workflows/main/main/spaghettify-windows.zip)
* [macOS](https://nightly.link/HarbourMasters/SpaghettiKart/workflows/main/main/spaghettify-mac-x64.zip)
* [Linux](https://nightly.link/HarbourMasters/SpaghettiKart/workflows/main/main/SpaghettiKart-linux.zip)
Run `make format` to ensure it meets the project's coding standards.
If code needs to avoid formatting place `// clang-format off` before the code and `// clang-format on` after.
Official Discord: [discord.gg/DuYH3Fh](https://discord.gg/DuYH3Fh)
<a href="https://github.com/Kenix3/libultraship/">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="./docs/poweredbylus.darkmode.png">
<img alt="Powered by libultraship" src="./docs/poweredbylus.lightmode.png">
</picture>
</a>
+191
View File
@@ -0,0 +1,191 @@
#------------------------------------------------------------------------------------------------------------
#
# Automate-VCPKG by Andre Taulien
# ===============================
#
# Project Repository: https://github.com/REGoth-project/Automate-VCPKG
# License ..........: MIT, see end of file.
#
# Based on: https://github.com/sutambe/cpptruths/blob/vcpkg_cmake_blog/cpp0x/vcpkg_test/CMakeLists.txt
#
#
# While [Vcpkg](https://github.com/microsoft/vcpkg) on it's own is awesome, it does add
# a little bit of complexity to getting a project to build. Even more if the one trying
# to compile your application is not too fond of the commandline. Additionally, CMake
# commands tend to get rather long with the toolchain path.
#
# To keep things simple for new users who just want to get the project to build, this
# script offers a solution.
#
# Lets assume your main `CMakelists.txt` looks something like this:
#
# cmake_minimum_required (VERSION 3.12.0)
# project (MyProject)
#
# add_executable(MyExecutable main.c)
#
# To integrate Vcpkg into that `CMakelists.txt`, simple put the following lines before the
# call to `project(MyProject)`:
#
# include(cmake/automate-vcpkg.cmake)
#
# vcpkg_bootstrap()
# vcpkg_install_packages(libsquish physfs)
#
# The call to `vcpkg_bootstrap()` will clone the official Vcpkg repository and bootstrap it.
# If it detected an existing environment variable defining a valid `VCPKG_ROOT`, it will
# update the existing installation of Vcpkg.
#
# Arguments to `vcpkg_install_packages()` are the packages you want to install using Vcpkg.
#
# If you want to keep the possibility for users to chose their own copy of Vcpkg, you can
# simply not run the code snippet mentioned above, something like this will work:
#
# option(SKIP_AUTOMATE_VCPKG "When ON, you will need to built the packages
# required by MyProject on your own or supply your own vcpkg toolchain.")
#
# if (NOT SKIP_AUTOMATE_VCPKG)
# include(cmake/automate-vcpkg.cmake)
#
# vcpkg_bootstrap()
# vcpkg_install_packages(libsquish physfs)
# endif()
#
# Then, the user has to supply the packages on their own, be it through Vcpkg or manually
# specifying their locations.
#------------------------------------------------------------------------------------------------------------
cmake_minimum_required (VERSION 3.12)
if(WIN32)
set(VCPKG_FALLBACK_ROOT ${CMAKE_CURRENT_BINARY_DIR}/vcpkg CACHE STRING "vcpkg configuration directory to use if vcpkg was not installed on the system before")
else()
set(VCPKG_FALLBACK_ROOT ${CMAKE_CURRENT_BINARY_DIR}/.vcpkg CACHE STRING "vcpkg configuration directory to use if vcpkg was not installed on the system before")
endif()
# On Windows, Vcpkg defaults to x86, even on x64 systems. If we're
# doing a 64-bit build, we need to fix that.
if (WIN32)
# Since the compiler checks haven't run yet, we need to figure
# out the value of CMAKE_SIZEOF_VOID_P ourselfs
include(CheckTypeSize)
enable_language(C)
check_type_size("void*" SIZEOF_VOID_P BUILTIN_TYPES_ONLY)
if (SIZEOF_VOID_P EQUAL 8)
message(STATUS "Using Vcpkg triplet 'x64-windows'")
set(VCPKG_TRIPLET x64-windows)
endif()
endif()
if(NOT DEFINED VCPKG_ROOT)
if(NOT DEFINED ENV{VCPKG_ROOT})
set(VCPKG_ROOT ${VCPKG_FALLBACK_ROOT})
else()
set(VCPKG_ROOT $ENV{VCPKG_ROOT})
endif()
endif()
# Installs a new copy of Vcpkg or updates an existing one
macro(vcpkg_bootstrap)
_install_or_update_vcpkg()
# Find out whether the user supplied their own VCPKG toolchain file
if(NOT DEFINED ${CMAKE_TOOLCHAIN_FILE})
# We know this wasn't set before so we need point the toolchain file to the newly found VCPKG_ROOT
set(CMAKE_TOOLCHAIN_FILE ${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake CACHE STRING "")
# Just setting vcpkg.cmake as toolchain file does not seem to actually pull in the code
include(${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
set(AUTOMATE_VCPKG_USE_SYSTEM_VCPKG OFF)
else()
# VCPKG_ROOT has been defined by the toolchain file already
set(AUTOMATE_VCPKG_USE_SYSTEM_VCPKG ON)
endif()
message(STATUS "Automate VCPKG status:")
message(STATUS " VCPKG_ROOT.....: ${VCPKG_ROOT}")
message(STATUS " VCPKG_EXEC.....: ${VCPKG_EXEC}")
message(STATUS " VCPKG_BOOTSTRAP: ${VCPKG_BOOTSTRAP}")
endmacro()
macro(_install_or_update_vcpkg)
if(NOT EXISTS ${VCPKG_ROOT})
message(STATUS "Cloning vcpkg in ${VCPKG_ROOT}")
execute_process(COMMAND git clone https://github.com/Microsoft/vcpkg.git ${VCPKG_ROOT})
# If a reproducible build is desired (and potentially old libraries are # ok), uncomment the
# following line and pin the vcpkg repository to a specific githash.
# execute_process(COMMAND git checkout 745a0aea597771a580d0b0f4886ea1e3a94dbca6 WORKING_DIRECTORY ${VCPKG_ROOT})
else()
# The following command has no effect if the vcpkg repository is in a detached head state.
message(STATUS "Auto-updating vcpkg in ${VCPKG_ROOT}")
execute_process(COMMAND git pull WORKING_DIRECTORY ${VCPKG_ROOT})
endif()
if(NOT EXISTS ${VCPKG_ROOT}/README.md)
message(FATAL_ERROR "***** FATAL ERROR: Could not clone vcpkg *****")
endif()
if(WIN32)
set(VCPKG_EXEC ${VCPKG_ROOT}/vcpkg.exe)
set(VCPKG_BOOTSTRAP ${VCPKG_ROOT}/bootstrap-vcpkg.bat)
else()
set(VCPKG_EXEC ${VCPKG_ROOT}/vcpkg)
set(VCPKG_BOOTSTRAP ${VCPKG_ROOT}/bootstrap-vcpkg.sh)
endif()
if(NOT EXISTS ${VCPKG_EXEC})
message("Bootstrapping vcpkg in ${VCPKG_ROOT}")
execute_process(COMMAND ${VCPKG_BOOTSTRAP} WORKING_DIRECTORY ${VCPKG_ROOT})
endif()
if(NOT EXISTS ${VCPKG_EXEC})
message(FATAL_ERROR "***** FATAL ERROR: Could not bootstrap vcpkg *****")
endif()
endmacro()
# Installs the list of packages given as parameters using Vcpkg
macro(vcpkg_install_packages)
# Need the given list to be space-separated
#string (REPLACE ";" " " PACKAGES_LIST_STR "${ARGN}")
message(STATUS "Installing/Updating the following vcpkg-packages: ${PACKAGES_LIST_STR}")
if (VCPKG_TRIPLET)
set(ENV{VCPKG_DEFAULT_TRIPLET} "${VCPKG_TRIPLET}")
endif()
execute_process(
COMMAND ${VCPKG_EXEC} install ${ARGN}
WORKING_DIRECTORY ${VCPKG_ROOT}
)
endmacro()
# MIT License
#
# Copyright (c) 2019 REGoth-project
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
+29
View File
@@ -0,0 +1,29 @@
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY 0)
set(CPACK_COMPONENTS_ALL "Starship")
if (CPACK_GENERATOR STREQUAL "External")
list(APPEND CPACK_COMPONENTS_ALL "extractor" "appimage")
endif()
if (CPACK_GENERATOR MATCHES "DEB|RPM")
# https://unix.stackexchange.com/a/11552/254512
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/ship/bin")#/${CMAKE_PROJECT_VERSION}")
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY 0)
elseif (CPACK_GENERATOR MATCHES "ZIP")
set(CPACK_PACKAGING_INSTALL_PREFIX "")
endif()
if (CPACK_GENERATOR MATCHES "External")
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
SET(CPACK_MONOLITHIC_INSTALL 1)
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/bin")
endif()
if (CPACK_GENERATOR MATCHES "Bundle")
set(CPACK_BUNDLE_NAME "Starship")
set(CPACK_BUNDLE_PLIST "macosx/Info.plist")
set(CPACK_BUNDLE_ICON "macosx/Starship.icns")
# set(CPACK_BUNDLE_STARTUP_COMMAND "macosx/Starship-macos.sh")
set(CPACK_BUNDLE_APPLE_CERT_APP "-")
endif()
File diff suppressed because it is too large Load Diff
+61
View File
@@ -0,0 +1,61 @@
# - Find ogg
# Find the native ogg includes and libraries
#
# OGG_INCLUDE_DIRS - where to find ogg.h, etc.
# OGG_LIBRARIES - List of libraries when using ogg.
# OGG_FOUND - True if ogg found.
if (OGG_INCLUDE_DIR)
# Already in cache, be silent
set(OGG_FIND_QUIETLY TRUE)
endif ()
find_package (PkgConfig QUIET)
pkg_check_modules (PC_OGG QUIET ogg>=1.3.0)
set (OGG_VERSION ${PC_OGG_VERSION})
find_path (OGG_INCLUDE_DIR ogg/ogg.h
HINTS
${PC_OGG_INCLUDEDIR}
${PC_OGG_INCLUDE_DIRS}
${OGG_ROOT}
)
# MSVC built ogg may be named ogg_static.
# The provided project files name the library with the lib prefix.
find_library (OGG_LIBRARY
NAMES
ogg
ogg_static
libogg
libogg_static
HINTS
${PC_OGG_LIBDIR}
${PC_OGG_LIBRARY_DIRS}
${OGG_ROOT}
)
# Handle the QUIETLY and REQUIRED arguments and set OGG_FOUND
# to TRUE if all listed variables are TRUE.
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (Ogg
REQUIRED_VARS
OGG_LIBRARY
OGG_INCLUDE_DIR
VERSION_VAR
OGG_VERSION
)
if (OGG_FOUND)
set (OGG_LIBRARIES ${OGG_LIBRARY})
set (OGG_INCLUDE_DIRS ${OGG_INCLUDE_DIR})
if(NOT TARGET Ogg::ogg)
add_library(Ogg::ogg UNKNOWN IMPORTED)
set_target_properties(Ogg::ogg PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIRS}"
IMPORTED_LOCATION "${OGG_LIBRARIES}"
)
endif ()
endif ()
mark_as_advanced (OGG_INCLUDE_DIR OGG_LIBRARY)
+34
View File
@@ -0,0 +1,34 @@
# - Find PulseAudio includes and libraries
#
# PULSEAUDIO_FOUND - True if PULSEAUDIO_INCLUDE_DIR &
# PULSEAUDIO_LIBRARY are found
#
# PULSEAUDIO_INCLUDE_DIR - where to find pulse/pulseaudio.h, etc.
# PULSEAUDIO_LIBRARY - the pulse library
# PULSEAUDIO_VERSION_STRING - the version of PulseAudio found
#
find_path(PULSEAUDIO_INCLUDE_DIR
NAMES pulse/pulseaudio.h
DOC "The PulseAudio include directory"
)
find_library(PULSEAUDIO_LIBRARY
NAMES pulse
DOC "The PulseAudio library"
)
if(PULSEAUDIO_INCLUDE_DIR AND EXISTS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h")
file(STRINGS "${PULSEAUDIO_INCLUDE_DIR}/pulse/version.h" pulse_version_str
REGEX "^#define[\t ]+pa_get_headers_version\\(\\)[\t ]+\\(\".*\"\\)")
string(REGEX REPLACE "^.*pa_get_headers_version\\(\\)[\t ]+\\(\"([^\"]*)\"\\).*$" "\\1"
PULSEAUDIO_VERSION_STRING "${pulse_version_str}")
unset(pulse_version_str)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PulseAudio
REQUIRED_VARS PULSEAUDIO_LIBRARY PULSEAUDIO_INCLUDE_DIR
VERSION_VAR PULSEAUDIO_VERSION_STRING
)
+197
View File
@@ -0,0 +1,197 @@
#[=======================================================================[.rst:
FindVorbis
----------
Finds the native vorbis, vorbisenc amd vorbisfile includes and libraries.
Imported Targets
^^^^^^^^^^^^^^^^
This module provides the following imported targets, if found:
``Vorbis::vorbis``
The Vorbis library
``Vorbis::vorbisenc``
The VorbisEnc library
``Vorbis::vorbisfile``
The VorbisFile library
Result Variables
^^^^^^^^^^^^^^^^
This will define the following variables:
``Vorbis_Vorbis_INCLUDE_DIRS``
List of include directories when using vorbis.
``Vorbis_Enc_INCLUDE_DIRS``
List of include directories when using vorbisenc.
``Vorbis_File_INCLUDE_DIRS``
List of include directories when using vorbisfile.
``Vorbis_Vorbis_LIBRARIES``
List of libraries when using vorbis.
``Vorbis_Enc_LIBRARIES``
List of libraries when using vorbisenc.
``Vorbis_File_LIBRARIES``
List of libraries when using vorbisfile.
``Vorbis_FOUND``
True if vorbis and requested components found.
``Vorbis_Vorbis_FOUND``
True if vorbis found.
``Vorbis_Enc_FOUND``
True if vorbisenc found.
``Vorbis_Enc_FOUND``
True if vorbisfile found.
Cache variables
^^^^^^^^^^^^^^^
The following cache variables may also be set:
``Vorbis_Vorbis_INCLUDE_DIR``
The directory containing ``vorbis/vorbis.h``.
``Vorbis_Enc_INCLUDE_DIR``
The directory containing ``vorbis/vorbisenc.h``.
``Vorbis_File_INCLUDE_DIR``
The directory containing ``vorbis/vorbisenc.h``.
``Vorbis_Vorbis_LIBRARY``
The path to the vorbis library.
``Vorbis_Enc_LIBRARY``
The path to the vorbisenc library.
``Vorbis_File_LIBRARY``
The path to the vorbisfile library.
Hints
^^^^^
A user may set ``Vorbis_ROOT`` to a vorbis installation root to tell this module where to look.
#]=======================================================================]
if (Vorbis_Vorbis_INCLUDE_DIR)
# Already in cache, be silent
set (Vorbis_FIND_QUIETLY TRUE)
endif ()
set (Vorbis_Vorbis_FIND_QUIETLY TRUE)
set (Vorbis_Enc_FIND_QUIETLY TRUE)
set (Vorbis_File_FIND_QUIETLY TRUE)
find_package (Ogg QUIET)
find_package (PkgConfig QUIET)
pkg_check_modules (PC_Vorbis_Vorbis QUIET vorbis)
pkg_check_modules (PC_Vorbis_Enc QUIET vorbisenc)
pkg_check_modules (PC_Vorbis_File QUIET vorbisfile)
set (Vorbis_VERSION ${PC_Vorbis_Vorbis_VERSION})
find_path (Vorbis_Vorbis_INCLUDE_DIR vorbis/codec.h
HINTS
${PC_Vorbis_Vorbis_INCLUDEDIR}
${PC_Vorbis_Vorbis_INCLUDE_DIRS}
${Vorbis_ROOT}
)
find_path (Vorbis_Enc_INCLUDE_DIR vorbis/vorbisenc.h
HINTS
${PC_Vorbis_Enc_INCLUDEDIR}
${PC_Vorbis_Enc_INCLUDE_DIRS}
${Vorbis_ROOT}
)
find_path (Vorbis_File_INCLUDE_DIR vorbis/vorbisfile.h
HINTS
${PC_Vorbis_File_INCLUDEDIR}
${PC_Vorbis_File_INCLUDE_DIRS}
${Vorbis_ROOT}
)
find_library (Vorbis_Vorbis_LIBRARY
NAMES
vorbis
vorbis_static
libvorbis
libvorbis_static
HINTS
${PC_Vorbis_Vorbis_LIBDIR}
${PC_Vorbis_Vorbis_LIBRARY_DIRS}
${Vorbis_ROOT}
)
find_library (Vorbis_Enc_LIBRARY
NAMES
vorbisenc
vorbisenc_static
libvorbisenc
libvorbisenc_static
HINTS
${PC_Vorbis_Enc_LIBDIR}
${PC_Vorbis_Enc_LIBRARY_DIRS}
${Vorbis_ROOT}
)
find_library (Vorbis_File_LIBRARY
NAMES
vorbisfile
vorbisfile_static
libvorbisfile
libvorbisfile_static
HINTS
${PC_Vorbis_File_LIBDIR}
${PC_Vorbis_File_LIBRARY_DIRS}
${Vorbis_ROOT}
)
include (FindPackageHandleStandardArgs)
if (Vorbis_Vorbis_LIBRARY AND Vorbis_Vorbis_INCLUDE_DIR AND Ogg_FOUND)
set (Vorbis_Vorbis_FOUND TRUE)
endif ()
if (Vorbis_Enc_LIBRARY AND Vorbis_Enc_INCLUDE_DIR AND Vorbis_Vorbis_FOUND)
set (Vorbis_Enc_FOUND TRUE)
endif ()
if (Vorbis_Vorbis_FOUND AND Vorbis_File_LIBRARY AND Vorbis_File_INCLUDE_DIR)
set (Vorbis_File_FOUND TRUE)
endif ()
find_package_handle_standard_args (Vorbis
REQUIRED_VARS
Vorbis_Vorbis_LIBRARY
Vorbis_Vorbis_INCLUDE_DIR
Ogg_FOUND
HANDLE_COMPONENTS
VERSION_VAR Vorbis_VERSION)
if (Vorbis_Vorbis_FOUND)
set (Vorbis_Vorbis_INCLUDE_DIRS ${VORBIS_INCLUDE_DIR})
set (Vorbis_Vorbis_LIBRARIES ${VORBIS_LIBRARY} ${OGG_LIBRARIES})
if (NOT TARGET Vorbis::vorbis)
add_library (Vorbis::vorbis UNKNOWN IMPORTED)
set_target_properties (Vorbis::vorbis PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_Vorbis_INCLUDE_DIR}"
IMPORTED_LOCATION "${Vorbis_Vorbis_LIBRARY}"
INTERFACE_LINK_LIBRARIES Ogg::ogg
)
endif ()
if (Vorbis_Enc_FOUND)
set (Vorbis_Enc_INCLUDE_DIRS ${Vorbis_Enc_INCLUDE_DIR})
set (Vorbis_Enc_LIBRARIES ${Vorbis_Enc_LIBRARY} ${Vorbis_Enc_LIBRARIES})
if (NOT TARGET Vorbis::vorbisenc)
add_library (Vorbis::vorbisenc UNKNOWN IMPORTED)
set_target_properties (Vorbis::vorbisenc PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_Enc_INCLUDE_DIR}"
IMPORTED_LOCATION "${Vorbis_Enc_LIBRARY}"
INTERFACE_LINK_LIBRARIES Vorbis::vorbis
)
endif ()
endif ()
if (Vorbis_File_FOUND)
set (Vorbis_File_INCLUDE_DIRS ${Vorbis_File_INCLUDE_DIR})
set (Vorbis_File_LIBRARIES ${Vorbis_File_LIBRARY} ${Vorbis_File_LIBRARIES})
if (NOT TARGET Vorbis::vorbisfile)
add_library (Vorbis::vorbisfile UNKNOWN IMPORTED)
set_target_properties (Vorbis::vorbisfile PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_File_INCLUDE_DIR}"
IMPORTED_LOCATION "${Vorbis_File_LIBRARY}"
INTERFACE_LINK_LIBRARIES Vorbis::vorbis
)
endif ()
endif ()
endif ()
mark_as_advanced (Vorbis_Vorbis_INCLUDE_DIR Vorbis_Vorbis_LIBRARY)
mark_as_advanced (Vorbis_Enc_INCLUDE_DIR Vorbis_Enc_LIBRARY)
mark_as_advanced (Vorbis_File_INCLUDE_DIR Vorbis_File_LIBRARY)
+48
View File
@@ -0,0 +1,48 @@
if (MSVC)
set(WINDOWS_LIBUSB_PATH "$ENV{LIBUSB_PATH}/VS2019/MS64/static")
# check if we're using something else than 64bit..
if (NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
set(WINDOWS_LIBUSB_PATH "$ENV{LIBUSB_PATH}/VS2019/MS32/static")
endif()
endif()
if (MINGW)
set(WINDOWS_LIBUSB_PATH "$ENV{LIBUSB_PATH}/MinGW64/static")
# check if we're using something else than 64bit..
if (NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
set(WINDOWS_LIBUSB_PATH "$ENV{LIBUSB_PATH}/MinGW32/static")
endif()
endif()
find_library (LIBUSB_LIBRARY
NAMES libusb libusb-1.0 usb-1.0
PATHS "/usr/lib" "/usr/local/lib/" "${WINDOWS_LIBUSB_PATH}")
find_path (LIBUSB_INCLUDEDIR
NAMES libusb.h libusb-1.0.h
PATHS "/usr/local/include/" "$ENV{LIBUSB_PATH}/include/libusb-1.0"
PATH_SUFFIXES "include" "libusb" "libusb-1.0")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(libUsb DEFAULT_MSG
LIBUSB_LIBRARY
LIBUSB_INCLUDEDIR)
if (LIBUSB_FOUND AND NOT TARGET libUsb::libUsb)
add_library(libUsb::libUsb STATIC IMPORTED)
set_target_properties(
libUsb::libUsb
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${LIBUSB_INCLUDEDIR}"
IMPORTED_LOCATION "${LIBUSB_LIBRARY}")
if (MSVC OR MINGW)
set_target_properties(
libUsb::libUsb
PROPERTIES
IMPORTED_IMPLIB "${LIBUSB_LIBRARY}"
)
endif()
endif()
+84
View File
@@ -0,0 +1,84 @@
# - try to find the udev library
#
# Cache Variables: (probably not for direct use in your scripts)
# UDEV_INCLUDE_DIR
# UDEV_SOURCE_DIR
# UDEV_LIBRARY
#
# Non-cache variables you might use in your CMakeLists.txt:
# UDEV_FOUND
# UDEV_INCLUDE_DIRS
# UDEV_LIBRARIES
#
# Requires these CMake modules:
# FindPackageHandleStandardArgs (known included with CMake >=2.6.2)
#
# Original Authors:
# 2014, Kevin M. Godby <kevin@godby.org>
# 2021, Ryan Pavlik <ryan.pavlik@collabora.com> <abiryan@ryand.net>
#
# Copyright 2014, Kevin M. Godby <kevin@godby.org>
# Copyright 2021, Collabora, Ltd.
#
# SPDX-License-Identifier: BSL-1.0
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(UDEV_ROOT_DIR
"${UDEV_ROOT_DIR}"
CACHE
PATH
"Directory to search for udev")
if(NOT ANDROID)
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_LIBUDEV QUIET libudev)
endif()
endif()
find_library(UDEV_LIBRARY
NAMES
udev
PATHS
${PC_LIBUDEV_LIBRARY_DIRS}
${PC_LIBUDEV_LIBDIR}
HINTS
"${UDEV_ROOT_DIR}"
PATH_SUFFIXES
lib
)
get_filename_component(_libdir "${UDEV_LIBRARY}" PATH)
find_path(UDEV_INCLUDE_DIR
NAMES
libudev.h
PATHS
${PC_LIBUDEV_INCLUDE_DIRS}
${PC_LIBUDEV_INCLUDEDIR}
HINTS
"${_libdir}"
"${_libdir}/.."
"${UDEV_ROOT_DIR}"
PATH_SUFFIXES
include
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(udev
DEFAULT_MSG
UDEV_LIBRARY
UDEV_INCLUDE_DIR
)
if(UDEV_FOUND)
list(APPEND UDEV_LIBRARIES ${UDEV_LIBRARY})
list(APPEND UDEV_INCLUDE_DIRS ${UDEV_INCLUDE_DIR})
mark_as_advanced(UDEV_ROOT_DIR)
endif()
mark_as_advanced(UDEV_INCLUDE_DIR
UDEV_LIBRARY)
+90
View File
@@ -0,0 +1,90 @@
# these are cache variables, so they could be overwritten with -D,
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}"
CACHE STRING "The resulting package name"
)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simple C++ application"
CACHE STRING "Package description for the package metadata"
)
set(CPACK_PACKAGE_VENDOR "Some Company")
set(CPACK_VERBATIM_VARIABLES YES)
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
SET(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_SOURCE_DIR}/_packages")
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_PACKAGE_CONTACT "YOUR@E-MAIL.net")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "YOUR NAME")
# set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CPACK_SYSTEM_NAME ${LSB_RELEASE_CODENAME_SHORT})
# package name for deb
# if set, then instead of some-application-0.9.2-Linux.deb
# you'll get some-application_0.9.2_amd64.deb (note the underscores too)
#set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
set( CPACK_DEBIAN_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}-${ARCHITECTURE}.deb )
# if you want every group to have its own package,
# although the same happens if this is not sent (so it defaults to ONE_PER_GROUP)
# and CPACK_DEB_COMPONENT_INSTALL is set to YES
set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE)#ONE_PER_GROUP)
# without this you won't be able to pack only specified component
set(CPACK_DEB_COMPONENT_INSTALL YES)
set(CPACK_EXTERNAL_ENABLE_STAGING YES)
set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${PROJECT_BINARY_DIR}/appimage-generate.cmake")
file(GENERATE
OUTPUT "${PROJECT_BINARY_DIR}/appimage-generate.cmake"
CONTENT [[
include(CMakePrintHelpers)
cmake_print_variables(CPACK_TEMPORARY_DIRECTORY)
cmake_print_variables(CPACK_TOPLEVEL_DIRECTORY)
cmake_print_variables(CPACK_PACKAGE_DIRECTORY)
cmake_print_variables(CPACK_PACKAGE_FILE_NAME)
find_program(LINUXDEPLOY_EXECUTABLE
NAMES linuxdeploy linuxdeploy-x86_64.AppImage
PATHS ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy)
if (NOT LINUXDEPLOY_EXECUTABLE)
message(STATUS "Downloading linuxdeploy")
set(LINUXDEPLOY_EXECUTABLE ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy/linuxdeploy)
file(DOWNLOAD
https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
${LINUXDEPLOY_EXECUTABLE}
INACTIVITY_TIMEOUT 10
LOG ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy/download.log
STATUS LINUXDEPLOY_DOWNLOAD)
execute_process(COMMAND chmod +x ${LINUXDEPLOY_EXECUTABLE} COMMAND_ECHO STDOUT)
endif()
execute_process(
COMMAND
${CMAKE_COMMAND} -E env
OUTPUT=${CPACK_PACKAGE_FILE_NAME}.appimage
VERSION=$<IF:$<BOOL:${CPACK_PACKAGE_VERSION}>,${CPACK_PACKAGE_VERSION},0.1.0>
NO_STRIP=true
${LINUXDEPLOY_EXECUTABLE}
--appimage-extract-and-run
--appdir=${CPACK_TEMPORARY_DIRECTORY}
--executable=$<TARGET_FILE:Spaghettify>
$<$<BOOL:$<TARGET_PROPERTY:Spaghettify,APPIMAGE_DESKTOP_FILE>>:--desktop-file=$<TARGET_PROPERTY:Spaghettify,APPIMAGE_DESKTOP_FILE>>
$<$<BOOL:$<TARGET_PROPERTY:Spaghettify,APPIMAGE_ICON_FILE>>:--icon-file=$<TARGET_PROPERTY:Spaghettify,APPIMAGE_ICON_FILE>>
--output=appimage
--verbosity=2
)
]])
endif()
include(CPack)
+26
View File
@@ -0,0 +1,26 @@
set (CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
# specify the cross compiler
set (CMAKE_C_COMPILER x86_64-w64-mingw32-gcc CACHE STRING "The C compiler to use")
set (CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++ CACHE STRING "The C++ compiler to use")
# where is the target environment
set (CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
# search for programs in the build host directories
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
# set the resource compiler (RHBZ #652435)
set (CMAKE_RC_COMPILER windres)
set (CMAKE_MC_COMPILER windmc)
# override boost thread component suffix as mingw-w64-boost is compiled with threadapi=win32
set (Boost_THREADAPI win32)
set (CMAKE_AR:FILEPATH x86_64-w64-mingw32-ar)
set (CMAKE_RANLIB:FILEPATH x86_64-w64-mingw32-ranlib)
+221
View File
@@ -0,0 +1,221 @@
# Building Starship
## Windows
Requires:
* At least 8GB of RAM (machines with 4GB have seen complier failures)
* Visual Studio 2022 Community Edition with the C++ feature set
* One of the Windows SDKs that comes with Visual Studio, for example the current Windows 10 version 10.0.19041.0
* The `MSVC v143 - VS 2022 C++ build tools` component of Visual Studio
* Python 3 (can be installed manually or as part of Visual Studio)
* Git (can be installed manually or as part of Visual Studio)
* Cmake (can be installed via chocolatey or manually)
During installation, check the "Desktop development with C++" feature set:
![image](https://user-images.githubusercontent.com/30329717/183511274-d11aceea-7900-46ec-acb6-3f2cc110021a.png)
Doing so should also check one of the Windows SDKs by default. Then, in the installation details in the right-hand column, make sure you also check the v143 toolset. This is often done by default.
It is recommended that you install Python and Git standalone, the install process in VS Installer has given some issues in the past.
1. Clone the Starship repository
_Note: Be sure to either clone with the ``--recursive`` flag or do ``git submodule update --init`` after cloning to pull in the libultraship submodule!_
2. After setup and initial build, use the built-in OTR extraction to make your sf64.o2r file.
_Note: Instructions assume using powershell_
```powershell
# Navigate to the spaghetti repo within powershell. ie: cd "C:\yourpath\spaghetti"
cd spaghetti
# Setup cmake project
# Add `-DCMAKE_BUILD_TYPE:STRING=Release` if you're packaging
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64
# Generate sf64.o2r
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target ExtractAssets
# Compile project
# Add `--config Release` if you're packaging
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64
# Now you can run the executable in .\build\x64 or run in Visual Studio
```
### Developing Starship
With the cmake build system you have two options for working on the project:
#### Visual Studio
To develop using Visual Studio you only need to use cmake to generate the solution file:
```powershell
# Generates spaghetti.sln at `build/x64` for Visual Studio 2022
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64
```
#### Visual Studio Code or another editor
To develop using Visual Studio Code or another editor you only need to open the repository in it.
To build you'll need to follow the instructions from the building section.
_Note: If you're using Visual Studio Code, the [cpack plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._
_Experimental: You can also use another build system entirely rather than MSVC like [Ninja](https://ninja-build.org/) for possibly better performance._
### Generating the distributable
After compiling the project you can generate the distributable by running:
```powershell
# Go to build folder
cd "build/x64"
# Generate
& 'C:\Program Files\CMake\bin\cpack.exe' -G ZIP
```
### Additional CMake Targets
#### Clean
```powershell
# If you need to clean the project you can run
C:\Program Files\CMake\bin\cmake.exe --build build-cmake --target clean
```
## Linux
### Install dependencies
#### Debian/Ubuntu
```sh
# using gcc
apt-get install gcc g++ git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev libboost-dev libopengl-dev libogg-dev ibvorbis-dev
# or using clang
apt-get install clang git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev libboost-dev libopengl-dev libogg-dev libvorbis-dev
```
#### Arch
```sh
# using gcc
pacman -S gcc git cmake ninja lsb-release sdl2 libpng libzip nlohmann-json tinyxml2 spdlog sdl2_net boost libogg libvorbis
# or using clang
pacman -S clang git cmake ninja lsb-release sdl2 libpng libzip nlohmann-json tinyxml2 spdlog sdl2_net boost libogg libvorbis
```
#### Fedora
```sh
# using gcc
dnf install gcc gcc-c++ git cmake ninja-build lsb_release SDL2-devel libpng-devel libzip-devel libzip-tools nlohmann-json-devel tinyxml2-devel spdlog-devel boost-devel libogg-devel libvorbis-devel
# or using clang
dnf install clang git cmake ninja-build lsb_release SDL2-devel libpng-devel libzip-devel libzip-tools nlohmann-json-devel tinyxml2-devel spdlog-devel boost-devel libogg-devel libvorbis-devel
```
#### openSUSE
```sh
# using gcc
zypper in gcc gcc-c++ git cmake ninja SDL2-devel libpng16-devel libzip-devel libzip-tools nlohmann_json-devel tinyxml2-devel spdlog-devel libogg-devel libvorbis-devel
# or using clang
zypper in clang libstdc++-devel git cmake ninja SDL2-devel libpng16-devel libzip-devel libzip-tools nlohmann_json-devel tinyxml2-devel spdlog-devel libogg-devel libvorbis-devel
```
### Build
_Note: If you're using Visual Studio Code, the [CMake Tools plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._
```bash
# Clone the repo and enter the directory
git clone https://github.com/HarbourMasters/SpaghettiKart.git
cd SpaghettiKart
# Clone the submodules
git submodule update --init
# Generate Ninja project
# Add `-DCMAKE_BUILD_TYPE:STRING=Release` if you're packaging
# Add `-DPython3_EXECUTABLE=$(which python3)` if you are using non-standard Python installations such as PyEnv
cmake -H. -Bbuild-cmake -GNinja
# Generate sf64.o2r
cmake --build build-cmake --target ExtractAssets
# Compile the project
# Add `--config Release` if you're packaging
cmake --build build-cmake
# Now you can run the executable in ./build-cmake/mm/2s2h.elf
# To develop the project open the repository in VSCode (or your preferred editor)
```
### Generate a distributable
After compiling the project you can generate a distributable by running of the following:
```bash
# Go to build folder
cd build-cmake
# Generate
cpack -G DEB
cpack -G ZIP
cpack -G External (creates appimage)
```
### Additional CMake Targets
#### Clean
```bash
# If you need to clean the project you can run
cmake --build build-cmake --target clean
```
## macOS
Requires Xcode (or xcode-tools) && `sdl2, libpng, glew, ninja, cmake, nlohmann-json, libzip, vorbis-tools` (can be installed via homebrew, macports, etc)
**Important: For maximum performance make sure you have ninja build tools installed!**
_Note: If you're using Visual Studio Code, the [cpack plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._
```bash
# Clone the repo
git clone https://github.com/HarbourMasters/SpaghettiKart.git
cd SpaghettiKart
# Clone the submodule libultraship
git submodule update --init
# Generate Ninja project
# Add `-DCMAKE_BUILD_TYPE:STRING=Release` if you're packaging
cmake -H. -Bbuild-cmake -GNinja
# Generate sf64.o2r
cmake --build build-cmake --target ExtractAssets
# Compile the project
# Add `--config Release` if you're packaging
cmake --build build-cmake
# Now you can run the executable file:
./build-cmake/mm/spaghetti-macos
# To develop the project open the repository in VSCode (or your preferred editor)
```
### Generating a distributable
After compiling the project you can generate a distributable by running of the following:
```bash
# Go to build folder
cd build-cmake
# Generate
cpack
```
### Additional CMake Targets
#### Clean
```bash
# If you need to clean the project you can run
cmake --build build-cmake --target clean
```
# Compatible Roms
See [`supportedHashes.json`](supportedHashes.json)
## Getting CI to work on your fork
The CI works via [Github Actions](https://github.com/features/actions) where we mostly make use of machines hosted by Github; except for the very first step of the CI process called "Extract assets". This steps extracts assets from the game file and generates an "assets" folder in `mm/`.
To get this step working on your fork, you'll need to add a machine to your own repository as a self-hosted runner via "Settings > Actions > Runners" in your repository settings. Make sure to add the 'asset-builder' tag to your newly added runner to assign it to run this step. To setup your runner as a service read the docs [here](https://docs.github.com/en/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service?platform=linux).
### Runner on Windows
You'll have to enable the ability to run unsigned scripts through PowerShell. To do this, open Powershell as administrator and run `set-executionpolicy remotesigned`. Most dependencies get installed as part of the CI process. You will also need to separately install 7z and add it to the PATH so `7z` can be run as a command. [Chocolatey](https://chocolatey.org/) or other package managers can be used to install it easily.
### Runner on UNIX systems
If you're on macOS or Linux take a look at `macports-deps.txt` or `apt-deps.txt` to see the dependencies expected to be on your machine.
-92
View File
@@ -1,92 +0,0 @@
If you have some problem to get it setup you can refer to [https://github.com/HarbourMasters/Shipwright/blob/develop/docs/BUILDING.md](https://github.com/HarbourMasters/Shipwright/blob/develop/docs/BUILDING.md)
# Contribute
## Github
1) Fork
2) Create a new branch
3) `git clone --branch <branch_name> <fork_url>`
4) Place baserom.us.z64 in root.
5) `git submodule update --init`
6) copy from mk64 assets/course in assets
# Windows
## Setup
```bat
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64
```
## Extract Assets
```bat
& 'C:\Program Files\CMake\bin\cmake' --build "build/x64" --target ExtractAssets
```
## Compile
```bat
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64
```
## Clean
```bat
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target clean
```
# Linux
## Install dependencies
### Debian/Ubuntu
(not tried)
```sh
# using gcc
apt-get install gcc g++ git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev libboost-dev libopengl-dev
# or using clang
apt-get install clang git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev libboost-dev libopengl-dev
```
### Arch
(not tried)
```sh
# using gcc
pacman -S gcc git cmake ninja lsb-release sdl2 libpng libzip nlohmann-json tinyxml2 spdlog sdl2_net boost
# or using clang
pacman -S clang git cmake ninja lsb-release sdl2 libpng libzip nlohmann-json tinyxml2 spdlog sdl2_net boost
```
### Fedora
```sh
# using gcc
dnf install gcc gcc-c++ git cmake ninja-build lsb_release SDL2-devel libpng-devel libzip-devel libzip-tools json-devel tinyxml2-devel spdlog-devel boost-devel SDL2_net-devel
# or using clang
dnf install clang git cmake ninja-build lsb_release SDL2-devel libpng-devel libzip-devel libzip-tools json-devel tinyxml2-devel spdlog-devel boost-devel SDL2_net-devel
```
### openSUSE
(not tried)
```sh
# using gcc
zypper in gcc gcc-c++ git cmake ninja SDL2-devel libpng16-devel libzip-devel libzip-tools nlohmann_json-devel tinyxml2-devel spdlog-devel
# or using clang
zypper in clang libstdc++-devel git cmake ninja SDL2-devel libpng16-devel libzip-devel libzip-tools nlohmann_json-devel tinyxml2-devel spdlog-devel
```
## Setup
```bash
cmake -H. -Bbuild-cmake -GNinja
```
## Extract Assets
```bash
cmake --build build-cmake --target ExtractAssets
```
## Compile
```bash
cmake --build build-cmake
```
## Clean
```bash
cmake --build build-cmake --target clean
```
Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.
Binary file not shown.