From 05db6b899528ab7faed8e1679324815f3c9760a1 Mon Sep 17 00:00:00 2001 From: Isaac0-dev <62234577+Isaac0-dev@users.noreply.github.com> Date: Tue, 28 Feb 2023 02:22:31 +1000 Subject: [PATCH] give clients access to mod incompatible tags (#296) * rerun autogen * 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));