fix some crashes and bugs (#381)

- fix crash in bhv_lll_bowser_puzzle_piece_update (thanks to djoslin)
- fix crash in platform_on_track_act_init
- fix chat commands not working on dev builds
- log when the crash handler is called
- if a custom level tries to set an invalid background, change it to BACKGROUND_OCEAN_SKY
This commit is contained in:
Isaac0-dev 2023-05-05 06:26:50 +10:00 committed by GitHub
parent 7e1e869114
commit 326dc43326
4 changed files with 13 additions and 0 deletions

View File

@ -112,6 +112,8 @@ bool exec_dev_chat_command(char* command) {
smlua_exec_file(&command[6]);
return true;
}
return false;
}
void dev_display_chat_commands(void) {

View File

@ -8,6 +8,8 @@
#include "game/rendering_graph_node.h"
#include "game/area.h"
#include "geo_layout.h"
#include "include/geo_commands.h"
#include "pc/debuglog.h"
// unused Mtx(s)
s16 identityMtx[4][4] = { { 1, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 1 } };
@ -486,6 +488,11 @@ struct GraphNodeBackground *init_graph_node_background(struct AllocOnlyPool *poo
if (graphNode != NULL) {
init_scene_graph_node_links(&graphNode->fnNode.node, GRAPH_NODE_TYPE_BACKGROUND);
if (background > BACKGROUND_CUSTOM) {
LOG_ERROR("invalid background id");
background = BACKGROUND_OCEAN_SKY;
}
graphNode->background = (background << 16) | background;
graphNode->fnNode.func = backgroundFunc;
graphNode->unused = zero; // always 0, unused

View File

@ -315,6 +315,8 @@ static void platform_on_track_rock_ski_lift(void) {
* Update function for bhvPlatformOnTrack.
*/
void bhv_platform_on_track_update(void) {
if (!o->oPlatformOnTrackStartWaypoint) { return; }
switch (o->oAction) {
case PLATFORM_ON_TRACK_ACT_INIT:
platform_on_track_act_init();

View File

@ -24,6 +24,7 @@
#include "pc/network/network.h"
#include "pc/gfx/gfx_rendering_api.h"
#include "pc/mods/mods.h"
#include "pc/debuglog.h"
typedef struct {
s32 x, y;
@ -298,6 +299,7 @@ static CRASH_HANDLER_TYPE crash_handler(EXCEPTION_POINTERS *ExceptionInfo) {
#elif __linux__
static void crash_handler(const int signalNum, siginfo_t *info, ucontext_t *context) {
#endif
LOG_INFO("game crashed! preparing crash screen...");
memset(sCrashHandlerText, 0, sizeof(sCrashHandlerText));
CrashHandlerText *pText = &sCrashHandlerText[0];
gDjuiDisabled = true;