Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {}
}
48 changes: 44 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
name: spaghetti-windows
path: spaghetti-${{ matrix.config }}

build-macos:
build-macos-arm64:
needs: generate-port-o2r
runs-on: macOS-latest
strategy:
Expand Down Expand Up @@ -119,7 +119,49 @@ jobs:
if: matrix.config == 'Release'
uses: actions/upload-artifact@v4
with:
name: spaghetti-mac-x64
name: spaghetti-mac-arm64
path: spaghetti-${{ matrix.config }}

build-macos-intel:
needs: generate-port-o2r
runs-on: macOS-13
strategy:
matrix:
config: [Release, Debug]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
submodules: recursive
- name: Install dependencies
run: brew install ninja cmake
- name: Install vcpkg
uses: lukka/run-vcpkg@v11.5
with:
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
- name: Build
run: |
cmake -H. -Bbuild-cmake -GNinja -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build build-cmake --config ${{ matrix.config }} -j3
- name: Download spaghetti.o2r
uses: actions/download-artifact@v4
with:
name: spaghetti.o2r
path: ./build-cmake
- name: Create Package
run: |
mkdir spaghetti-${{ matrix.config }}
mv build-cmake/Spaghettify spaghetti-${{ matrix.config }}/
mv build-cmake/spaghetti.o2r spaghetti-${{ matrix.config }}/
mv config.yml spaghetti-${{ matrix.config }}/
mv yamls spaghetti-${{ matrix.config }}/
wget -O spaghetti-${{ matrix.config }}/gamecontrollerdb.txt https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/master/gamecontrollerdb.txt
- name: Publish packaged artifacts
if: matrix.config == 'Release'
uses: actions/upload-artifact@v4
with:
name: spaghetti-mac-intel-x64
path: spaghetti-${{ matrix.config }}

build-linux:
Expand Down Expand Up @@ -310,8 +352,6 @@ jobs:
name: spaghetti-linux-x64
path: |
spaghetti.appimage
config.yml
yamls
gamecontrollerdb.txt

build-linux-docker:
Expand Down
14 changes: 10 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ set(CMAKE_OSX_ARCHITECTURES=arm64;x86_64)

# Set the C++ standard and enable the MSVC parallel build option
set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_STANDARD 11 CACHE STRING "The C standard to use")
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Spaghettify)
set(PROJECT_TEAM "MegaMech")
Expand All @@ -87,15 +88,12 @@ include(cmake/automate-vcpkg.cmake)
set(VCPKG_TRIPLET x64-windows-static)
set(VCPKG_TARGET_TRIPLET x64-windows-static)
vcpkg_bootstrap()
vcpkg_install_packages(zlib bzip2 libzip libpng sdl2 sdl2-net glew glfw3 nlohmann-json tinyxml2 spdlog libogg libvorbis)
vcpkg_install_packages()

set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif()

execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/config.yml" "${CMAKE_BINARY_DIR}/config.yml")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/yamls/" "${CMAKE_BINARY_DIR}/yamls/")

if (MSVC)
set(CPP "${CMAKE_C_COMPILER}" "/EP")
else()
Expand Down Expand Up @@ -312,6 +310,7 @@ else()
add_executable(${PROJECT_NAME} ${ALL_FILES})
endif()


################################################################################
# MSVC runtime library
################################################################################
Expand Down Expand Up @@ -656,6 +655,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
endif()
endif()

add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMENT "Copying asset yamls..."
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/config.yml" "$<TARGET_FILE_DIR:Spaghettify>/config.yml"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/yamls/" "$<TARGET_FILE_DIR:Spaghettify>/yamls/"
)

if(NOT CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
include(ExternalProject)
ExternalProject_Add(TorchExternal
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ If you want to playtest a continuous integration build, you can find them at the

* [Windows](https://nightly.link/HarbourMasters/SpaghettiKart/workflows/main/main/spaghetti-windows.zip?status=completed)
* [Linux](https://nightly.link/HarbourMasters/SpaghettiKart/workflows/main/main/spaghetti-linux-x64.zip?status=completed)
* [macOS](https://nightly.link/HarbourMasters/SpaghettiKart/workflows/main/main/spaghetti-mac-x64.zip?status=completed)
* [macOS-arm64](https://nightly.link/HarbourMasters/SpaghettiKart/workflows/main/main/spaghetti-mac-arm64.zip?status=completed)
* [macOS-intel](https://nightly.link/HarbourMasters/SpaghettiKart/workflows/main/main/spaghetti-mac-intel-x64.zip?status=completed)
* [Switch](https://nightly.link/HarbourMasters/SpaghettiKart/workflows/main/main/Spaghettify-switch.zip?status=completed)

Maintainers: [MegaMech](https://www.github.com/MegaMech), [Coco](https://www.github.com/coco875), [Kirito](https://github.com/KiritoDv)
Expand Down
8 changes: 4 additions & 4 deletions cmake/configure-packaging.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY 0)
set(CPACK_COMPONENTS_ALL "Starship")
set(CPACK_COMPONENTS_ALL "SpaghettiKart")

if (CPACK_GENERATOR STREQUAL "External")
list(APPEND CPACK_COMPONENTS_ALL "extractor" "appimage")
Expand All @@ -21,9 +21,9 @@ set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/bin")
endif()

if (CPACK_GENERATOR MATCHES "Bundle")
set(CPACK_BUNDLE_NAME "Starship")
set(CPACK_BUNDLE_NAME "SpaghettiKart")
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_ICON "macosx/SpaghettiKart.icns")
# set(CPACK_BUNDLE_STARTUP_COMMAND "macosx/SpaghettiKart-macos.sh")
set(CPACK_BUNDLE_APPLE_CERT_APP "-")
endif()
4 changes: 3 additions & 1 deletion cmake/packaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ 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/1-alpha-20240109-1/linuxdeploy-x86_64.AppImage
https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20251107-1/linuxdeploy-x86_64.AppImage
${LINUXDEPLOY_EXECUTABLE}
INACTIVITY_TIMEOUT 10
LOG ${CPACK_PACKAGE_DIRECTORY}/linuxdeploy/download.log
Expand All @@ -69,6 +69,8 @@ if (NOT LINUXDEPLOY_EXECUTABLE)
endif()

execute_process(
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CPACK_PACKAGE_DIRECTORY}/config.yml" "${CPACK_TEMPORARY_DIRECTORY}/usr/bin/config.yml"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CPACK_PACKAGE_DIRECTORY}/yamls/" "${CPACK_TEMPORARY_DIRECTORY}/usr/bin/yamls/"
COMMAND
${CMAKE_COMMAND} -E env
OUTPUT=${CPACK_PACKAGE_FILE_NAME}.appimage
Expand Down
4 changes: 2 additions & 2 deletions include/actor_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ enum ActorType {
ACTOR_MARIO_SIGN,
ACTOR_UNKNOWN_0x18,
ACTOR_PALM_TREE,
ACTOR_UNKNOWN_0x1A,
ACTOR_TREE_LUIGI_RACEWAY,
ACTOR_UNKNOWN_0x1B,
ACTOR_TREE_BOWSERS_CASTLE,
ACTOR_TREE_PEACH_CASTLE,
ACTOR_TREE_FRAPPE_SNOWLAND,
ACTOR_CACTUS1_KALAMARI_DESERT,
ACTOR_CACTUS2_KALAMARI_DESERT,
Expand Down
9 changes: 9 additions & 0 deletions include/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@
#define FOUR_PLAYERS_SELECTED 4
#define SELECTED_PLAYER_DEFINES_TOTAL 5

// Camera index into cameras array
enum CameraId {
CAMERA_ONE = 0,
CAMERA_TWO,
CAMERA_THREE,
CAMERA_FOUR,
CAMERA_FREECAM
};

enum PlayerId {
PLAYER_NONE = -1,
PLAYER_ONE = 0,
Expand Down
6 changes: 3 additions & 3 deletions include/waypoints.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ enum {
};

typedef struct {
/* 0x00 */ s16 posX;
/* 0x02 */ s16 posY;
/* 0x04 */ s16 posZ;
/* 0x00 */ s16 x;
/* 0x02 */ s16 y;
/* 0x04 */ s16 z;
/* 0x06 */ u16 trackSectionId;
} TrackPathPoint; // size = 0x08

Expand Down
18 changes: 9 additions & 9 deletions src/actors/blue_and_red_shells/update.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ void func_802B3B44(struct ShellActor* shell) {
Vec3f origPos;

currentWaypoint = shell->pathIndex;
temp_f2 = gCurrentTrackPath[currentWaypoint].posX;
temp_f12 = gCurrentTrackPath[currentWaypoint].posY;
temp_f28 = gCurrentTrackPath[currentWaypoint].posZ;
temp_f2 = gCurrentTrackPath[currentWaypoint].x;
temp_f12 = gCurrentTrackPath[currentWaypoint].y;
temp_f28 = gCurrentTrackPath[currentWaypoint].z;
nextWaypoint = currentWaypoint + 1;

if (nextWaypoint >= gSelectedPathCount) {
Expand All @@ -44,9 +44,9 @@ void func_802B3B44(struct ShellActor* shell) {
temp_f24 = temp_f28 - shell->pos[2];
temp_f0 = (temp_f20 * temp_f20) + (temp_f22 * temp_f22) + (temp_f24 * temp_f24);
if (temp_f0 > 400.0f) {
temp_f18_3 = gCurrentTrackPath[nextWaypoint].posX;
temp_f16_3 = gCurrentTrackPath[nextWaypoint].posY;
temp_f26 = gCurrentTrackPath[nextWaypoint].posZ;
temp_f18_3 = gCurrentTrackPath[nextWaypoint].x;
temp_f16_3 = gCurrentTrackPath[nextWaypoint].y;
temp_f26 = gCurrentTrackPath[nextWaypoint].z;

temp_f12_0 = temp_f18_3 - shell->pos[0];
temp_f12_1 = temp_f16_3 - shell->pos[1];
Expand Down Expand Up @@ -97,9 +97,9 @@ void func_802B3B44(struct ShellActor* shell) {
shell->pos[2] = temp_f28;
shell->pathIndex = nextWaypoint;
} else {
temp_f18_3 = gCurrentTrackPath[nextWaypoint].posX;
temp_f16_3 = gCurrentTrackPath[nextWaypoint].posY;
temp_f26 = gCurrentTrackPath[nextWaypoint].posZ;
temp_f18_3 = gCurrentTrackPath[nextWaypoint].x;
temp_f16_3 = gCurrentTrackPath[nextWaypoint].y;
temp_f26 = gCurrentTrackPath[nextWaypoint].z;

shell->pos[0] = (temp_f2 + temp_f18_3) * 0.5f;
shell->pos[1] = ((temp_f12 + temp_f16_3) * 0.5f) + shell->boundingBoxSize;
Expand Down
6 changes: 3 additions & 3 deletions src/actors/kiwano_fruit/update.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ void update_actor_kiwano_fruit(struct KiwanoFruit* fruit) {
fruit->velocity[0] = 80.0f;
case 1:
nearestWaypoint = gNearestPathPointByPlayerId[(u16) (player - gPlayerOne)];
temp_f2 = player->pos[0] - gCurrentTrackPath[nearestWaypoint].posX;
temp_f16 = player->pos[1] - gCurrentTrackPath[nearestWaypoint].posY;
temp_f14 = player->pos[2] - gCurrentTrackPath[nearestWaypoint].posZ;
temp_f2 = player->pos[0] - gCurrentTrackPath[nearestWaypoint].x;
temp_f16 = player->pos[1] - gCurrentTrackPath[nearestWaypoint].y;
temp_f14 = player->pos[2] - gCurrentTrackPath[nearestWaypoint].z;
temp_f12 = fruit->velocity[0] / sqrtf((temp_f2 * temp_f2) + (temp_f16 * temp_f16) + (temp_f14 * temp_f14));
temp_f2 *= temp_f12;
temp_f16 *= temp_f12;
Expand Down
5 changes: 2 additions & 3 deletions src/actors/mario_sign/render.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ void render_actor_mario_sign(Camera* arg0, UNUSED Mat4 arg1, struct Actor* arg2)
}
if (!(unk < 0.0f)) {

FrameInterpolation_RecordMatrixPush(mtx);
FrameInterpolation_RecordOpenChild("mario_sign", TAG_OBJECT(arg2));

gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH);
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
mtxf_pos_rotation_xyz(mtx, arg2->pos, arg2->rot);
if (render_set_position(mtx, 0) != 0) {
gSPDisplayList(gDisplayListHead++, d_course_mario_raceway_dl_sign);
}
FrameInterpolation_RecordMatrixPop(mtx);

FrameInterpolation_RecordCloseChild();
}
}
14 changes: 13 additions & 1 deletion src/actors/piranha_plant/render.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@
#include <assets/mario_raceway_data.h>
#include <assets/royal_raceway_data.h>

const char* sPiranhaPlantTextures[] = {
gTexturePiranhaPlant1,
gTexturePiranhaPlant2,
gTexturePiranhaPlant3,
gTexturePiranhaPlant4,
gTexturePiranhaPlant5,
gTexturePiranhaPlant6,
gTexturePiranhaPlant7,
gTexturePiranhaPlant8,
gTexturePiranhaPlant9
};

/**
* @brief Renders the piranha plant actor.
* Actor used in Mario Raceway and Royal Raceway.
Expand Down Expand Up @@ -115,7 +127,7 @@ void render_actor_piranha_plant(Camera* arg0, Mat4 arg1, struct PiranhaPlant* ar
if (animationFrame > 8) {
animationFrame = 8;
}
addr = D_802BA058 + (animationFrame << 0xB);
addr = LOAD_ASSET(sPiranhaPlantTextures[animationFrame]);
gDPLoadTextureBlock(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(addr), G_IM_FMT_CI, G_IM_SIZ_8b, 32, 64, 0,
G_TX_MIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
Expand Down
18 changes: 4 additions & 14 deletions src/actors/trees/render.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ void render_actor_tree_moo_moo_farm(Camera* camera, Mat4 arg1, struct Actor* arg
}
}

// have all the properties of the tree
void func_80299864(Camera* camera, Mat4 arg1, struct Actor* arg2) {
void render_actor_tree_luigi_raceway(Camera* camera, Mat4 arg1, struct Actor* arg2) {
f32 temp_f0;
s16 temp_v0 = arg2->flags;

Expand Down Expand Up @@ -195,27 +194,18 @@ void func_80299864(Camera* camera, Mat4 arg1, struct Actor* arg2) {
// Based on the TLUT being loaded above, this ought to be be another
// tree related DL, presumably one found in a course other than Moo Moo farm
// 0x0600FC70

//! @warning Possible bug:
// Previous incorrectly set to:
// d_course_moo_moo_farm_mole_tlut
// Unless both courses use this actor and use the same addr for the texture.
// Just in-case changed the code into a switch to prevent future crashes.
// This comment can be removed when this is confirmed to work.
if (IsLuigiRaceway()) {
gSPDisplayList(gDisplayListHead++, d_course_luigi_raceway_dl_FC70);
}
gSPDisplayList(gDisplayListHead++, d_course_luigi_raceway_dl_FC70);
}
}

/**
* @brief Renders the tree actor in Bowser's Castle.
* @brief Renders Peach's Castle trees in Royal Raceway.
*
* @param camera
* @param arg1
* @param arg2
*/
void render_actor_tree_bowser_castle(Camera* camera, Mat4 arg1, struct Actor* arg2) {
void render_actor_tree_peach_castle(Camera* camera, Mat4 arg1, struct Actor* arg2) {
f32 temp_f0;
s16 temp_v0 = arg2->flags;

Expand Down
8 changes: 4 additions & 4 deletions src/actors/yoshi_egg/render.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void render_actor_yoshi_egg(Camera* arg0, Mat4 arg1, struct YoshiValleyEgg* egg,
sp5C[1] = egg->eggRot;
sp5C[2] = 0;

FrameInterpolation_RecordMatrixPush(sp60);
FrameInterpolation_RecordOpenChild("yoshi_egg", TAG_OBJECT(egg));

mtxf_pos_rotation_xyz(sp60, egg->pos, sp5C);
if (render_set_position(sp60, 0) == 0) {
Expand All @@ -62,18 +62,18 @@ void render_actor_yoshi_egg(Camera* arg0, Mat4 arg1, struct YoshiValleyEgg* egg,

gSPSetGeometryMode(gDisplayListHead++, G_LIGHTING);
gSPDisplayList(gDisplayListHead++, d_course_yoshi_valley_dl_16D70);
FrameInterpolation_RecordMatrixPop(sp60);
FrameInterpolation_RecordCloseChild();
} else {
arg1[3][0] = egg->pos[0];
arg1[3][1] = egg->pos[1];
arg1[3][2] = egg->pos[2];

FrameInterpolation_RecordMatrixPush(arg1);
FrameInterpolation_RecordOpenChild("yoshi_egg2", TAG_OBJECT(egg));

if (render_set_position(arg1, 0) != 0) {
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
gSPDisplayList(gDisplayListHead++, d_course_yoshi_valley_dl_egg_lod0);
}
FrameInterpolation_RecordMatrixPop(arg1);
FrameInterpolation_RecordCloseChild();
}
}
Loading