Files
perfect_dark/port/src/crash.c
T
fgsfds b6a3aef345 port: add logging and some command line args
--log: logs messages to pd.log

--boot-stage N: sets initial stage number to N (MP stages will crash or hang if booted like this)

--no-sound: disable sound

--rom-file S: set ROM filename
2023-08-31 12:54:18 +02:00

41 lines
710 B
C

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <PR/ultratypes.h>
#include "system.h"
u8 g_CrashHasMessage = 0;
s32 g_CrashEnabled = 0;
static char crashMsg[1024];
void crashCreateThread(void)
{
// TODO: install a crash handler of some sort
}
void crashSetMessage(char *string)
{
strncpy(crashMsg, string, sizeof(crashMsg) - 1);
sysLogPrintf(LOG_ERROR, "crashSetMessage: %s", crashMsg);
g_CrashHasMessage = 1;
}
void crashReset(void)
{
crashMsg[0] = 0;
g_CrashHasMessage = 0;
}
void crashAppendChar(char c)
{
g_CrashHasMessage = 1;
for (u32 i = 0; i < sizeof(crashMsg) - 1; ++i) {
if (crashMsg[i] == '\0') {
crashMsg[i] = c;
crashMsg[i + 1] = '\0';
break;
}
}
}