From 86a5aa3494d63a54ee1f610bfc9be3d02a2a339f Mon Sep 17 00:00:00 2001 From: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com> Date: Wed, 22 Feb 2023 15:55:02 +1000 Subject: [PATCH 1/5] rerun autogen --- autogen/lua_definitions/constants.lua | 2 +- docs/lua/constants.md | 2 +- src/pc/lua/smlua_constants_autogen.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index c97a939c..ba3e1f95 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -3926,7 +3926,7 @@ HUD_DISPLAY_FLAG_EMPHASIZE_POWER = 0x8000 HUD_DISPLAY_NONE = 0x0000 --- @type HUDDisplayFlag -HUD_DISPLAY_DEFAULT = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA | HUD_DISPLAY_FLAG_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020 +HUD_DISPLAY_DEFAULT = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA_AND_POWER | HUD_DISPLAY_FLAG_CAMERA | HUD_DISPLAY_FLAG_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020 --- @class MarioAnimID diff --git a/docs/lua/constants.md b/docs/lua/constants.md index 2d421ac3..38107ff6 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -1364,7 +1364,7 @@ | HUD_DISPLAY_FLAG_POWER | 0x0100 | | HUD_DISPLAY_FLAG_EMPHASIZE_POWER | 0x8000 | | HUD_DISPLAY_NONE | 0x0000 | -| HUD_DISPLAY_DEFAULT | HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA | HUD_DISPLAY_FLAG_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020 | +| HUD_DISPLAY_DEFAULT | HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA_AND_POWER | HUD_DISPLAY_FLAG_CAMERA | HUD_DISPLAY_FLAG_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020 | [:arrow_up_small:](#) diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index 77040d4f..f1b2a483 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -1496,7 +1496,7 @@ char gSmluaConstants[] = "" "HUD_DISPLAY_FLAG_POWER = 0x0100\n" "HUD_DISPLAY_FLAG_EMPHASIZE_POWER = 0x8000\n" "HUD_DISPLAY_NONE = 0x0000\n" -"HUD_DISPLAY_DEFAULT = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA | HUD_DISPLAY_FLAG_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020\n" +"HUD_DISPLAY_DEFAULT = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA_AND_POWER | HUD_DISPLAY_FLAG_CAMERA | HUD_DISPLAY_FLAG_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020\n" "MARIO_ANIM_SLOW_LEDGE_GRAB = 0\n" "MARIO_ANIM_FALL_OVER_BACKWARDS = 1\n" "MARIO_ANIM_BACKWARD_AIR_KB = 2\n" From 977405c8c3c7ee8de5f91d177383424ab2c11043 Mon Sep 17 00:00:00 2001 From: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com> Date: Mon, 27 Feb 2023 22:58:00 +1000 Subject: [PATCH 2/5] give clients access to mod incompatible tags And fix a crash when warping to the cake end picture --- data/dynos_gfx_init.cpp | 2 +- src/game/rendering_graph_node.c | 3 ++- src/pc/network/packets/packet_mod_list.c | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/data/dynos_gfx_init.cpp b/data/dynos_gfx_init.cpp index 468cd265..197db2a3 100644 --- a/data/dynos_gfx_init.cpp +++ b/data/dynos_gfx_init.cpp @@ -48,7 +48,7 @@ static void ScanPacksFolder(SysPath _DynosPacksFolder) { // If pack folder exists, add it to the pack list SysPath _PackFolder = fstring("%s/%s", _DynosPacksFolder.c_str(), _DynosPacksEnt->d_name); if (fs_sys_dir_exists(_PackFolder.c_str())) { - struct PackData* _Pack = DynOS_Pack_Add(_PackFolder); + DynOS_Pack_Add(_PackFolder); DynOS_Actor_GeneratePack(_PackFolder); DynOS_Tex_GeneratePack(_PackFolder, _PackFolder, false); } diff --git a/src/game/rendering_graph_node.c b/src/game/rendering_graph_node.c index fa4c752e..e17a0e04 100644 --- a/src/game/rendering_graph_node.c +++ b/src/game/rendering_graph_node.c @@ -14,6 +14,7 @@ #include "pc/lua/smlua_hooks.h" #include "pc/utils/misc.h" #include "pc/debuglog.h" +#include "include/course_table.h" /** * This file contains the code that processes the scene graph for rendering. @@ -282,7 +283,7 @@ void patch_mtx_interpolated(f32 delta) { // calculate outside of for loop to reduce overhead // technically this is improper use of mtxf functions, but coop doesn't target N64 bool translateCamSpace = (gMtxTblSize > 0) && sCameraNode && (sCameraNode->matrixPtr != NULL) && (sCameraNode->matrixPtrPrev != NULL); - if (translateCamSpace) { + if (translateCamSpace && gCurrCourseNum != COURSE_CAKE_END) { mtxf_inverse(camTranfInv.m, *sCameraNode->matrixPtr); mtxf_inverse(prevCamTranfInv.m, *sCameraNode->matrixPtrPrev); } diff --git a/src/pc/network/packets/packet_mod_list.c b/src/pc/network/packets/packet_mod_list.c index 4e3ea73e..975d6820 100644 --- a/src/pc/network/packets/packet_mod_list.c +++ b/src/pc/network/packets/packet_mod_list.c @@ -52,6 +52,9 @@ void network_send_mod_list(void) { u16 nameLength = strlen(mod->name); if (nameLength > 31) { nameLength = 31; } + u16 incompatibleLength = strlen(mod->incompatible); + if (incompatibleLength > 31) { incompatibleLength = 31; } + u16 relativePathLength = strlen(mod->relativePath); u64 modSize = mod->size; @@ -60,6 +63,8 @@ void network_send_mod_list(void) { packet_write(&p, &i, sizeof(u16)); packet_write(&p, &nameLength, sizeof(u16)); packet_write(&p, mod->name, sizeof(u8) * nameLength); + packet_write(&p, &incompatibleLength, sizeof(u16)); + packet_write(&p, mod->incompatible, sizeof(u8) * incompatibleLength); packet_write(&p, &relativePathLength, sizeof(u16)); packet_write(&p, mod->relativePath, sizeof(u8) * relativePathLength); packet_write(&p, &modSize, sizeof(u64)); @@ -179,6 +184,19 @@ void network_receive_mod_list_entry(struct Packet* p) { packet_read(p, name, nameLength * sizeof(u8)); mod->name = strdup(name); + // get incompatible length + u16 incompatibleLength = 0; + packet_read(p, &incompatibleLength, sizeof(u16)); + if (incompatibleLength > 31) { + LOG_ERROR("Received name with invalid length!"); + return; + } + + // get incompatible + char incompatible[32] = { 0 }; + packet_read(p, incompatible, incompatibleLength * sizeof(u8)); + mod->incompatible = strdup(incompatible); + // get other fields u16 relativePathLength = 0; packet_read(p, &relativePathLength, sizeof(u16)); From 93ccfb33ec118f71b0355ac61acd192578340f42 Mon Sep 17 00:00:00 2001 From: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com> Date: Tue, 28 Feb 2023 22:49:10 +1000 Subject: [PATCH 3/5] whoops --- src/pc/network/packets/packet_mod_list.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pc/network/packets/packet_mod_list.c b/src/pc/network/packets/packet_mod_list.c index 975d6820..6582a5d9 100644 --- a/src/pc/network/packets/packet_mod_list.c +++ b/src/pc/network/packets/packet_mod_list.c @@ -52,8 +52,11 @@ void network_send_mod_list(void) { u16 nameLength = strlen(mod->name); if (nameLength > 31) { nameLength = 31; } - u16 incompatibleLength = strlen(mod->incompatible); - if (incompatibleLength > 31) { incompatibleLength = 31; } + u16 incompatibleLength = 0; + if (mod->incompatible) { + incompatibleLength = strlen(mod->incompatible); + if (incompatibleLength > 31) { incompatibleLength = 31; } + } u16 relativePathLength = strlen(mod->relativePath); u64 modSize = mod->size; From a1cab41218a52be09c944dc6f513c58ae3ad35a8 Mon Sep 17 00:00:00 2001 From: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com> Date: Tue, 28 Feb 2023 23:20:55 +1000 Subject: [PATCH 4/5] fix client crash --- src/pc/network/packets/packet_mod_list.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/pc/network/packets/packet_mod_list.c b/src/pc/network/packets/packet_mod_list.c index 6582a5d9..d753de56 100644 --- a/src/pc/network/packets/packet_mod_list.c +++ b/src/pc/network/packets/packet_mod_list.c @@ -67,7 +67,11 @@ void network_send_mod_list(void) { packet_write(&p, &nameLength, sizeof(u16)); packet_write(&p, mod->name, sizeof(u8) * nameLength); packet_write(&p, &incompatibleLength, sizeof(u16)); - packet_write(&p, mod->incompatible, sizeof(u8) * incompatibleLength); + if (mod->incompatible) { + packet_write(&p, mod->incompatible, sizeof(u8) * incompatibleLength); + } else { + packet_write(&p, "", 0); + } packet_write(&p, &relativePathLength, sizeof(u16)); packet_write(&p, mod->relativePath, sizeof(u8) * relativePathLength); packet_write(&p, &modSize, sizeof(u64)); @@ -196,9 +200,13 @@ void network_receive_mod_list_entry(struct Packet* p) { } // get incompatible - char incompatible[32] = { 0 }; - packet_read(p, incompatible, incompatibleLength * sizeof(u8)); - mod->incompatible = strdup(incompatible); + if (incompatibleLength > 0) { + char incompatible[32] = { 0 }; + packet_read(p, incompatible, incompatibleLength * sizeof(u8)); + mod->incompatible = strdup(incompatible); + } else { + packet_read(p, 0, 0); + } // get other fields u16 relativePathLength = 0; From 7bbfaa7851ea2570c6d560cbb25e3c38d71d8cc3 Mon Sep 17 00:00:00 2001 From: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com> Date: Wed, 1 Mar 2023 23:23:20 +1000 Subject: [PATCH 5/5] put everyone in the jumbo star cutscene if one person is in it --- src/pc/network/packets/packet_player.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pc/network/packets/packet_player.c b/src/pc/network/packets/packet_player.c index 09d76761..c93671eb 100644 --- a/src/pc/network/packets/packet_player.c +++ b/src/pc/network/packets/packet_player.c @@ -402,6 +402,10 @@ void network_receive_player(struct Packet* p) { LOG_INFO("%s entered the debug free fly state", np->name); } #endif + + if (np->currLevelNum == LEVEL_BOWSER_3 && m->action == ACT_JUMBO_STAR_CUTSCENE && gMarioStates[0].action != ACT_JUMBO_STAR_CUTSCENE) { + set_mario_action((struct MarioState*) &gMarioStates[0], ACT_JUMBO_STAR_CUTSCENE, 0); + } } void network_update_player(void) {