Added last remote object information to crash screen

This commit is contained in:
MysterD 2023-05-22 23:00:11 -07:00
parent 4254538802
commit 7ff1622745
7 changed files with 16 additions and 6 deletions

View File

@ -30,8 +30,10 @@ static std::map<u32, u32> sOverwriteMap;
static u32 find_empty_id() {
u32 id = 256;
while (true) {
if (sIdMap.count(id) == 0) { return id; }
if (sIdMap[id].size() == 0) { return id; }
if (id != 0) {
if (sIdMap.count(id) == 0) { return id; }
if (sIdMap[id].size() == 0) { return id; }
}
id++;
}
}

Binary file not shown.

View File

@ -107,6 +107,7 @@ void apply_platform_displacement(u32 playerIndex, struct Object *platform) {
UNUSED s16 unused2;
UNUSED s16 unused3;
f32 displaceMatrix[4][4];
if (!platform) { return; }
rotation[0] = platform->oAngleVelPitch;
rotation[1] = platform->oAngleVelYaw;

View File

@ -26,12 +26,14 @@
#include "pc/mods/mods.h"
#include "pc/debuglog.h"
char gLastRemoteBhv[256] = "";
typedef struct {
s32 x, y;
u8 r, g, b;
char s[128];
} CrashHandlerText;
static CrashHandlerText sCrashHandlerText[128 + 256];
static CrashHandlerText sCrashHandlerText[128 + 256 + 4];
#define PTR long long unsigned int)(uintptr_t
@ -636,6 +638,7 @@ static void crash_handler(const int signalNum, siginfo_t *info, ucontext_t *cont
}
crash_handler_add_info_str(&pText, 335, 208, "Version", get_version_local());
crash_handler_add_info_str(&pText, 8, 208, "RemoteBhv", gLastRemoteBhv);
// sounds
#ifdef HAVE_SDL2

View File

@ -15,6 +15,7 @@ struct PcDebug {
};
extern struct PcDebug gPcDebug;
extern char gLastRemoteBhv[];
void crash_handler_init(void);

View File

@ -129,6 +129,7 @@ static void coopnet_on_error(enum MPacketErrorNumber error, uint64_t tag) {
break;
}
}
static bool ns_coopnet_initialize(enum NetworkType networkType, bool reconnecting) {
sNetworkType = networkType;
sReconnecting = reconnecting;

View File

@ -6,9 +6,10 @@
#include "src/game/area.h"
#include "behavior_data.h"
#include "behavior_table.h"
#include "src/pc/lua/smlua.h"
#include "src/pc/lua/utils/smlua_model_utils.h"
#include "src/pc/lua/utils/smlua_obj_utils.h"
#include "pc/lua/smlua.h"
#include "pc/lua/utils/smlua_model_utils.h"
#include "pc/lua/utils/smlua_obj_utils.h"
#include "pc/crash_handler.h"
//#define DISABLE_MODULE_LOG 1
#include "pc/debuglog.h"
@ -154,6 +155,7 @@ void network_receive_spawn_objects(struct Packet* p) {
name = gNetworkPlayers[p->localIndex].name;
}
LOG_INFO("rx spawn object %s from %s (%s)", get_behavior_name_from_id(data.behaviorId), name, id);
snprintf(gLastRemoteBhv, 256, "%s %s (%s)", get_behavior_name_from_id(data.behaviorId), name, id);
struct Object* parentObj = NULL;
if (data.parentId == (u32)-1) {