diff --git a/.github/workflows/linux-compile.yml b/.github/workflows/linux-compile.yml index d4f06784e..4cc3e8279 100644 --- a/.github/workflows/linux-compile.yml +++ b/.github/workflows/linux-compile.yml @@ -138,4 +138,75 @@ jobs: - name: Move cache run: | rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache || true \ No newline at end of file + mv /tmp/.buildx-cache-new /tmp/.buildx-cache || true + + build-docker-x86: + runs-on: ubuntu-latest + strategy: + matrix: + config: [Release] + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + submodules: recursive + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: linux/386 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache-x86 + key: ${{ runner.os }}-buildx-x86-${{ hashFiles('script/Dockerfile.x86', 'vcpkg.json') }} + restore-keys: | + ${{ runner.os }}-buildx-x86- + + - name: Build Docker image for x86 + uses: docker/build-push-action@v5 + with: + context: . + file: ./script/Dockerfile.x86 + platforms: linux/386 + push: false + load: true + tags: spaghettikart-x86:latest + cache-from: type=local,src=/tmp/.buildx-cache-x86 + cache-to: type=local,dest=/tmp/.buildx-cache-x86-new,mode=max + + - name: Build project in Docker (x86) + run: | + docker run --rm --platform linux/386 \ + -v "${{ github.workspace }}:/project" \ + spaghettikart-x86:latest \ + bash -c " + cmake -B build-x86 -G Ninja \ + -DCMAKE_BUILD_TYPE=${{ matrix.config }} && \ + cmake --build build-x86 --parallel + " + + - name: Fix permissions + run: sudo chown -R $(id -u):$(id -g) build-x86 + + - name: Create Package + run: | + mkdir -p spaghetti-x86-${{ matrix.config }} + mv build-x86/Spaghettify spaghetti-x86-${{ matrix.config }}/ + + - name: Publish packaged artifacts + uses: actions/upload-artifact@v4 + with: + name: spaghetti-linux-x86-${{ matrix.config }} + path: spaghetti-x86-${{ matrix.config }} + retention-days: 7 + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache-x86 + mv /tmp/.buildx-cache-x86-new /tmp/.buildx-cache-x86 || true \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bea0b4e06..da76a4cb6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -50,6 +50,7 @@ jobs: strategy: matrix: config: [Release, Debug] + arch: [x64, Win32] steps: - uses: actions/checkout@v4 with: @@ -58,7 +59,7 @@ jobs: submodules: recursive - name: Build run: | - cmake -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64 -DCMAKE_BUILD_TYPE=${{ matrix.config }} + cmake -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A ${{ matrix.arch }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} cmake --build ./build/x64 --config ${{ matrix.config }} --parallel 10 - name: Download spaghetti.o2r uses: actions/download-artifact@v4 @@ -79,7 +80,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: spaghetti-windows - path: spaghetti-${{ matrix.config }} + path: spaghetti-${{ matrix.arch }}-${{ matrix.config }} build-macos-arm64: needs: generate-port-o2r @@ -461,6 +462,90 @@ jobs: rm -rf /tmp/.buildx-cache mv /tmp/.buildx-cache-new /tmp/.buildx-cache || true + build-linux-x86-docker: + needs: generate-port-o2r + runs-on: ubuntu-latest + strategy: + matrix: + config: [Release] + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + fetch-tags: true + submodules: recursive + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache-x86 + key: ${{ runner.os }}-buildx-x86-${{ hashFiles('script/Dockerfile.x86', 'vcpkg.json') }} + restore-keys: | + ${{ runner.os }}-buildx-x86- + + - name: Build Docker image for x86 + uses: docker/build-push-action@v5 + with: + context: . + file: ./script/Dockerfile.x86 + platforms: linux/386 + push: false + load: true + tags: spaghettikart-x86:latest + cache-from: type=local,src=/tmp/.buildx-cache-x86 + cache-to: type=local,dest=/tmp/.buildx-cache-x86-new,mode=max + + - name: Build project in Docker (x86) + run: | + docker run --rm --platform linux/386 \ + -v "${{ github.workspace }}:/project" \ + spaghettikart-x86:latest \ + bash -c " + cmake -B build-x86 -G Ninja \ + -DCMAKE_BUILD_TYPE=${{ matrix.config }} && \ + cmake --build build-x86 --parallel + " + + - name: Fix permissions + run: sudo chown -R $(id -u):$(id -g) build-x86 + + - name: Download spaghetti.o2r + uses: actions/download-artifact@v4 + with: + name: spaghetti.o2r + path: ./build-x86 + + - name: Generate AppImage + run: | + docker run --rm --platform linux/386 \ + -v "${{ github.workspace }}:/project" \ + spaghettikart-x86:latest \ + bash -c " + cd /project/build-x86 && \ + cpack -G External || true + " + + - name: Create Package + run: | + mkdir -p spaghetti-x86-${{ matrix.config }} + wget -O gamecontrollerdb.txt https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/master/gamecontrollerdb.txt + mv gamecontrollerdb.txt spaghetti-x86-${{ matrix.config }}/ + cp build-x86/*.appimage spaghetti-x86-${{ matrix.config }}/spaghetti.appimage 2>/dev/null || true + + - name: Publish packaged artifacts + uses: actions/upload-artifact@v4 + with: + name: spaghetti-linux-x86 + path: spaghetti-x86-${{ matrix.config }} + + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache-x86 + mv /tmp/.buildx-cache-x86-new /tmp/.buildx-cache-x86 || true + build-switch: needs: generate-port-o2r runs-on: ubuntu-latest diff --git a/.github/workflows/windows-compile.yml b/.github/workflows/windows-compile.yml index 42258ec9c..519259aef 100644 --- a/.github/workflows/windows-compile.yml +++ b/.github/workflows/windows-compile.yml @@ -10,6 +10,7 @@ jobs: strategy: matrix: config: [Release, Debug] + arch: [x64, Win32] steps: - uses: actions/checkout@v4 with: @@ -18,11 +19,11 @@ jobs: submodules: recursive - name: Build run: | - cmake -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64 -DCMAKE_BUILD_TYPE=${{ matrix.config }} + cmake -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A ${{ matrix.arch }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} cmake --build ./build/x64 --config ${{ matrix.config }} --parallel 10 - name: Upload build uses: actions/upload-artifact@v4 with: - name: spaghetti-windows-${{ matrix.config }} + name: spaghetti-windows-${{ matrix.arch }}-${{ matrix.config }} path: ./build/x64/${{ matrix.config }} retention-days: 1 diff --git a/CMakeLists.txt b/CMakeLists.txt index bb8806422..45dff319a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,8 +84,13 @@ include(cmake/lus-cvars.cmake) if (WIN32) include(cmake/automate-vcpkg.cmake) - set(VCPKG_TRIPLET x64-windows-static) - set(VCPKG_TARGET_TRIPLET x64-windows-static) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(VCPKG_TRIPLET x64-windows-static) + set(VCPKG_TARGET_TRIPLET x64-windows-static) + else() + set(VCPKG_TRIPLET x86-windows-static) + set(VCPKG_TARGET_TRIPLET x86-windows-static) + endif() vcpkg_bootstrap() vcpkg_install_packages() @@ -189,6 +194,7 @@ set(SKIP_XCODE_VERSION_CHECK ON) # TODO: Sorry i broke this set(GFX_DEBUG_DISASSEMBLER OFF) +if(NOT MSVC) include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) check_c_compiler_flag("-Wno-error=int-conversion" HAS_WNO_ERROR_INT_CONVERSION) @@ -203,6 +209,7 @@ endif() if(HAS_WNO_ERROR_CHANGES_MEANING) add_compile_options("$<$:-Wno-error=changes-meaning>") endif() +endif() # Add compile definitions for the target add_compile_definitions( diff --git a/courses/test_track/data.c b/courses/test_track/data.c index a0cf44611..2823906da 100644 --- a/courses/test_track/data.c +++ b/courses/test_track/data.c @@ -69,6 +69,6 @@ TrackPathPoint test_track_path[] = { }; TrackSections test_track_addr[] = { - { mario_Plane_001_mesh, 255, 255, 0x0000 }, + { .model = mario_Plane_001_mesh, 255, 255, 0x0000 }, { 0x00000000, 0, 0, 0x00000 }, }; diff --git a/include/actor_types.h b/include/actor_types.h index 947c78288..cfbe3832f 100644 --- a/include/actor_types.h +++ b/include/actor_types.h @@ -166,7 +166,15 @@ struct RailroadCrossing { /* 0x02 */ s16 flags; /* 0x04 */ s16 someTimer; /* 0x06 */ s16 crossingId; // unused now - /* 0x08 */ void* crossingTrigger; // Crossing Trigger Class + union { + struct { + /* 0x08 */ void* crossingTrigger; // Crossing Trigger Class + }; + struct { // original field in actors + /* 0x08 */ f32 unk_08; + /* 0x0C */ f32 boundingBoxSize; + }; + }; /* 0x10 */ Vec3s rot; /* 0x16 */ s16 unk_16; /* 0x18 */ Vec3f pos; diff --git a/libultraship b/libultraship index 4eadaf990..f5c3843fe 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit 4eadaf990d234148a250234eb44f3b01f6a3af90 +Subproject commit f5c3843fe937320b64ff754fa6bf71b13ff5e7a1 diff --git a/script/Dockerfile.x86 b/script/Dockerfile.x86 new file mode 100644 index 000000000..0d81c0d50 --- /dev/null +++ b/script/Dockerfile.x86 @@ -0,0 +1,78 @@ +# Dockerfile for x86 (32-bit) builds +# Uses native Debian i386 image (Ubuntu 22.04+ dropped i386 support) +FROM --platform=linux/386 debian:bookworm + +ENV DEBIAN_FRONTEND=noninteractive +ENV VCPKG_ROOT=/opt/vcpkg +ENV PATH="${VCPKG_ROOT}:${PATH}" + +# Install base dependencies +RUN apt-get update -y && apt-get -y upgrade && \ + apt-get -y install \ + build-essential \ + gcc \ + g++ \ + git \ + ninja-build \ + curl \ + zip \ + unzip \ + tar \ + pkg-config \ + wget \ + file \ + autoconf \ + automake \ + libtool \ + python3 \ + cmake \ + libx11-dev \ + libxrandr-dev \ + libxi-dev \ + libxinerama-dev \ + libxcursor-dev \ + libgl1-mesa-dev \ + libopengl-dev \ + libwayland-dev \ + libxkbcommon-dev \ + libasound2-dev \ + libpulse-dev \ + libudev-dev \ + libdbus-1-dev \ + libogg-dev \ + libvorbis-dev \ + libpng-dev \ + zlib1g-dev \ + libsdl2-dev \ + nlohmann-json3-dev \ + libspdlog-dev \ + libboost-dev + +# Install tinyxml2 from source +RUN 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 -j$(nproc) && \ + make install && \ + ldconfig && \ + cd ../.. && \ + rm -rf 10.0.0.tar.gz tinyxml2-10.0.0 + +# Install libzip from source (system package has broken CMake config) +RUN 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 && \ + cd libzip-1.10.1 && \ + mkdir -p build && cd build && \ + cmake .. -DENABLE_COMMONCRYPTO=OFF -DENABLE_GNUTLS=OFF -DENABLE_MBEDTLS=OFF -DENABLE_OPENSSL=OFF -DBUILD_TOOLS=OFF -DBUILD_DOC=OFF && \ + make -j$(nproc) && \ + make install && \ + ldconfig && \ + cd ../.. && \ + rm -rf libzip-1.10.1.tar.gz libzip-1.10.1 + +# Note: vcpkg is not available for i386 (no prebuilt binary, bootstrap fails) +# Using system packages instead - static linking handled by CMake + +WORKDIR /project diff --git a/script/build-release.sh b/script/build-release.sh deleted file mode 100755 index 084b8c3c2..000000000 --- a/script/build-release.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -set -e - -# Script to build SpaghettiKart using Docker -# Usage: ./docker/build.sh [Release|Debug] - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -PROJECT_DIR="$(dirname "$SCRIPT_DIR")" - -BUILD_TYPE="${1:-Release}" -BUILD_DIR="build-docker" -IMAGE_NAME="spaghettikart-builder" -USER_ID=$(id -u) -GROUP_ID=$(id -g) - -cd "$PROJECT_DIR" - -# Build Docker image -echo "Building Docker image..." -docker build -t "${IMAGE_NAME}" -f script/Dockerfile . - -# Clean build directory if it contains incompatible cache -if [[ -f "${BUILD_DIR}/CMakeCache.txt" ]] && grep -q "/home/coco" "${BUILD_DIR}/CMakeCache.txt" 2>/dev/null; then - echo "Cleaning incompatible build cache..." - rm -rf "${BUILD_DIR}" -fi - -# Run build in Docker -echo "Building in Docker container..." -docker run --rm \ - -v "$(pwd):/project" \ - -e BUILD_TYPE="${BUILD_TYPE}" \ - -e USER_ID="${USER_ID}" \ - -e GROUP_ID="${GROUP_ID}" \ - "${IMAGE_NAME}" \ - bash -c " - # Copy vcpkg.json and install dependencies - cp vcpkg.json /tmp/vcpkg.json && \ - cd /tmp && \ - \${VCPKG_ROOT}/vcpkg install --triplet x64-linux && \ - cd /project && \ - cmake -B ${BUILD_DIR} -G Ninja \ - -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DCMAKE_TOOLCHAIN_FILE=/opt/vcpkg/scripts/buildsystems/vcpkg.cmake \ - -DVCPKG_TARGET_TRIPLET=x64-linux && \ - cmake --build ${BUILD_DIR} --parallel && \ - cp -f spaghetti.o2r ${BUILD_DIR}/ 2>/dev/null || true && \ - cp -f mk64.o2r ${BUILD_DIR}/ 2>/dev/null || true && \ - cd ${BUILD_DIR} && cpack -G External && \ - chown -R ${USER_ID}:${GROUP_ID} /project/${BUILD_DIR} /project/logs 2>/dev/null || true - " - -echo "" -echo "Build complete!" -echo "Executable: ${BUILD_DIR}/Spaghettify" -ls -1 "${BUILD_DIR}"/*.appimage 2>/dev/null && echo "AppImage generated successfully!" || echo "Note: AppImage generation may have failed" diff --git a/script/build.sh b/script/build.sh new file mode 100755 index 000000000..4395f96f6 --- /dev/null +++ b/script/build.sh @@ -0,0 +1,160 @@ +#!/bin/bash +set -e + +# Unified build script for SpaghettiKart +# +# Usage: +# ./script/build.sh # Build x64 Release (default) +# ./script/build.sh x64 # Build x64 Release +# ./script/build.sh x86 # Build x86 32-bit Release +# ./script/build.sh x64 Debug # Build x64 Debug +# ./script/build.sh all # Build both architectures +# ./script/build.sh x64 Release appimage # Build x64 with AppImage + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_DIR="$(dirname "$SCRIPT_DIR")" + +ARCH="${1:-x64}" +BUILD_TYPE="${2:-Release}" +PACKAGE="${3:-}" # Optional: "appimage" to generate AppImage +USER_ID=$(id -u) +GROUP_ID=$(id -g) + +cd "$PROJECT_DIR" + +build_arch() { + local arch=$1 + local build_type=$2 + local package=$3 + local build_dir="build-docker-${arch}" + local image_name="spaghettikart-${arch}" + local dockerfile="" + local platform="" + local triplet="" + + echo "========================================" + echo "Building ${arch} ${build_type}" + echo "========================================" + + # Set architecture-specific options + if [ "$arch" = "x86" ]; then + dockerfile="script/Dockerfile.x86" + platform="--platform linux/386" + triplet="x86-linux" + # Ensure QEMU is set up for i386 emulation + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes 2>/dev/null || true + else + dockerfile="script/Dockerfile" + triplet="x64-linux" + fi + + # Build Docker image + echo "Building Docker image for ${arch}..." + docker build \ + ${platform} \ + -t "${image_name}" \ + -f "${dockerfile}" . + + # Clean build directory if it contains incompatible cache + if [[ -f "${build_dir}/CMakeCache.txt" ]]; then + echo "Cleaning existing build cache..." + rm -rf "${build_dir}" + fi + + # Build package command if requested + local package_cmd="" + if [ "$package" = "appimage" ]; then + package_cmd="&& cd ${build_dir} && cpack -G External" + fi + + # Run build in Docker + echo "Building in Docker container..." + + # Different build commands for x64 (with vcpkg) and x86 (without vcpkg) + if [ "$arch" = "x86" ]; then + # x86: No vcpkg available, use system packages + docker run --rm \ + ${platform} \ + -v "$(pwd):/project" \ + -e BUILD_TYPE="${build_type}" \ + -e USER_ID="${USER_ID}" \ + -e GROUP_ID="${GROUP_ID}" \ + "${image_name}" \ + bash -c " + cmake -B ${build_dir} -G Ninja \ + -DCMAKE_BUILD_TYPE=${build_type} && \ + cmake --build ${build_dir} --parallel && \ + cp -f spaghetti.o2r ${build_dir}/ 2>/dev/null || true && \ + cp -f mk64.o2r ${build_dir}/ 2>/dev/null || true ${package_cmd} && \ + chown -R ${USER_ID}:${GROUP_ID} /project/${build_dir} 2>/dev/null || true + " + else + # x64: Use vcpkg for static linking + docker run --rm \ + ${platform} \ + -v "$(pwd):/project" \ + -e BUILD_TYPE="${build_type}" \ + -e USER_ID="${USER_ID}" \ + -e GROUP_ID="${GROUP_ID}" \ + "${image_name}" \ + bash -c " + # Install vcpkg dependencies + if [ -f vcpkg.json ]; then + cp vcpkg.json /tmp/vcpkg.json && \ + cd /tmp && \ + \${VCPKG_ROOT}/vcpkg install --triplet ${triplet} 2>/dev/null || true && \ + cd /project + fi && \ + cmake -B ${build_dir} -G Ninja \ + -DCMAKE_BUILD_TYPE=${build_type} \ + -DCMAKE_TOOLCHAIN_FILE=/opt/vcpkg/scripts/buildsystems/vcpkg.cmake \ + -DVCPKG_TARGET_TRIPLET=${triplet} && \ + cmake --build ${build_dir} --parallel && \ + cp -f spaghetti.o2r ${build_dir}/ 2>/dev/null || true && \ + cp -f mk64.o2r ${build_dir}/ 2>/dev/null || true ${package_cmd} && \ + chown -R ${USER_ID}:${GROUP_ID} /project/${build_dir} 2>/dev/null || true + " + fi + + echo "" + echo "${arch} build complete!" + echo "Executable: ${build_dir}/Spaghettify" + if [ -f "${build_dir}/Spaghettify" ]; then + file "${build_dir}/Spaghettify" + fi + if [ "$package" = "appimage" ]; then + ls -1 "${build_dir}"/*.appimage 2>/dev/null && echo "AppImage generated!" || echo "Note: AppImage may have failed" + fi + echo "" +} + +case "$ARCH" in + x64|x86) + build_arch "$ARCH" "$BUILD_TYPE" "$PACKAGE" + ;; + all) + build_arch x64 "$BUILD_TYPE" "$PACKAGE" + build_arch x86 "$BUILD_TYPE" "$PACKAGE" + ;; + *) + echo "Usage: $0 [x64|x86|all] [Release|Debug] [appimage]" + echo "" + echo "Architectures:" + echo " x64 - x86_64 64-bit (default)" + echo " x86 - x86 32-bit" + echo " all - Build both architectures" + echo "" + echo "Options:" + echo " appimage - Generate AppImage package" + echo "" + echo "Examples:" + echo " $0 # Build x64 Release" + echo " $0 x86 # Build x86 Release" + echo " $0 x64 Release appimage # Build x64 with AppImage" + exit 1 + ;; +esac + +echo "========================================" +echo "All builds completed successfully!" +echo "========================================" diff --git a/src/animation.h b/src/animation.h index 7fc35a6dd..21fbefe5e 100644 --- a/src/animation.h +++ b/src/animation.h @@ -168,11 +168,11 @@ Mat4 that the `thing` values are placed into. #define ANIMATION_POP_MATRIX SIMPLE_ANIMATION_INSTRUCTION(POP_MATRIX) #define ANIMATION_STOP SIMPLE_ANIMATION_INSTRUCTION(STOP_ANIMATION) //! the pos is relative to the previous RENDER_MODEL_OR_ADD_POS if ANIMATION_DISABLE_AUTOMATIC_POP is used -#define ANIMATION_RENDER_MODEL_AT(model, x, y, z) RENDER_MODEL_OR_ADD_POS, 0x00000007, 0x00000000, (s64) model, x, y, z +#define ANIMATION_RENDER_MODEL_AT(model, x, y, z) RENDER_MODEL_OR_ADD_POS, 0x00000007, 0x00000000, (uintptr_t) model, x, y, z //! use RENDER_MODEL_OR_ADD_POS #define ANIMATION_RENDER_MODEL(model) ANIMATION_RENDER_MODEL_AT(model, 0x00000000, 0x00000000, 0x00000000) //! use RENDER_MODEL_OR_ADD_POS -#define ANIMATION_ADD_POS(x, y, z) ANIMATION_RENDER_MODEL_AT((s64) NULL, x, y, z) +#define ANIMATION_ADD_POS(x, y, z) ANIMATION_RENDER_MODEL_AT((uintptr_t) NULL, x, y, z) enum animation_type { RENDER_MODEL_OR_ADD_POS, DISABLE_AUTOMATIC_POP_MATRIX, POP_MATRIX, STOP_ANIMATION }; @@ -181,11 +181,11 @@ enum animation_type { RENDER_MODEL_OR_ADD_POS, DISABLE_AUTOMATIC_POP_MATRIX, POP * in the armature */ typedef struct { - /* 0x00 */ s64 type; - /* 0x04 */ s64 size; - /* 0x08 */ s64 always_zero_never_used; + /* 0x00 */ intptr_t type; + /* 0x04 */ intptr_t size; + /* 0x08 */ intptr_t always_zero_never_used; /* 0x0C */ Gfx* model; - /* 0x10 */ s64 pos[3]; + /* 0x10 */ intptr_t pos[3]; } Armature; typedef struct { diff --git a/src/engine/tracks/Track.h b/src/engine/tracks/Track.h index 8dfd1750e..cec6cd722 100644 --- a/src/engine/tracks/Track.h +++ b/src/engine/tracks/Track.h @@ -79,7 +79,10 @@ bool IsTriangleWindingInverted(); * This work is done in render_track_sections() */ typedef struct { - uint64_t crc; + union { + uint64_t crc; + void* model; + }; u8 surfaceType; // Determines what kind of surface the player drives on (ex. dirt, asphalt, etc.) u8 sectionId; u16 clip; // enum in CustomTrack.h diff --git a/src/racing/render_courses.c b/src/racing/render_courses.c index c5cdf7e5f..97a8162f8 100644 --- a/src/racing/render_courses.c +++ b/src/racing/render_courses.c @@ -79,7 +79,7 @@ void parse_track_displaylists(TrackSections* asset) { if (addr == NULL) { printf("Warning: Could not find resource for section %d with crc 0x%llX\n", section->sectionId, section->crc); - addr = (void*) section->crc; + addr = section->model; } generate_collision_mesh(addr, section->surfaceType, section->sectionId); section++;