mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05:00
Dreamcast: Display crash screen
This commit is contained in:
parent
df49656b25
commit
8557bd0205
2 changed files with 62 additions and 6 deletions
6
.github/workflows/build_dreamcast.yml
vendored
6
.github/workflows/build_dreamcast.yml
vendored
|
@ -43,6 +43,12 @@ jobs:
|
|||
SOURCE_FILE: 'ClassiCube-dc.cdi'
|
||||
DEST_NAME: 'ClassiCube-dc.cdi'
|
||||
|
||||
- uses: ./.github/actions/upload_build
|
||||
if: ${{ always() && steps.compile.outcome == 'success' }}
|
||||
with:
|
||||
SOURCE_FILE: 'ClassiCube-dc.iso'
|
||||
DEST_NAME: 'ClassiCube-dc.iso'
|
||||
|
||||
- uses: ./.github/actions/upload_build
|
||||
if: ${{ always() && steps.compile.outcome == 'success' }}
|
||||
with:
|
||||
|
|
|
@ -53,7 +53,10 @@ cc_uint64 Stopwatch_Measure(void) {
|
|||
}
|
||||
|
||||
static uint32 str_offset;
|
||||
static cc_bool log_debugger = true;
|
||||
static cc_bool log_timestamp = true;
|
||||
extern cc_bool window_inited;
|
||||
|
||||
#define MAX_ONSCREEN_LINES 17
|
||||
#define ONSCREEN_LINE_HEIGHT (24 + 2) // 8 * 3 text, plus 2 pixel padding
|
||||
#define Onscreen_LineOffset(y) ((10 + y + (str_offset * ONSCREEN_LINE_HEIGHT)) * vid_mode->width)
|
||||
|
@ -72,17 +75,23 @@ static void LogOnscreen(const char* msg, int len) {
|
|||
timer_ms_gettime(&secs, &ms);
|
||||
|
||||
String_InitArray(str, buffer);
|
||||
String_Format2(&str, "[%p2.%p3] ", &secs, &ms);
|
||||
if (log_timestamp) String_Format2(&str, "[%p2.%p3] ", &secs, &ms);
|
||||
String_AppendAll(&str, msg, len);
|
||||
|
||||
sq_set16(vram_s + Onscreen_LineOffset(0), 0, ONSCREEN_LINE_HEIGHT * 2 * vid_mode->width);
|
||||
short* dst = vram_s + Onscreen_LineOffset(0);
|
||||
int num_pixels = ONSCREEN_LINE_HEIGHT * 2 * vid_mode->width;
|
||||
for (int i = 0; i < num_pixels; i++) dst[i] = 0;
|
||||
//sq_set16(vram_s + Onscreen_LineOffset(0), 0, ONSCREEN_LINE_HEIGHT * 2 * vid_mode->width);
|
||||
|
||||
FallbackFont_Plot(&str, PlotOnscreen, 3, NULL);
|
||||
str_offset = (str_offset + 1) % MAX_ONSCREEN_LINES;
|
||||
}
|
||||
|
||||
void Platform_Log(const char* msg, int len) {
|
||||
dbgio_write_buffer_xlat(msg, len);
|
||||
dbgio_write_buffer_xlat("\n", 1);
|
||||
if (log_debugger) {
|
||||
dbgio_write_buffer_xlat(msg, len);
|
||||
dbgio_write_buffer_xlat("\n", 1);
|
||||
}
|
||||
|
||||
if (window_inited) return;
|
||||
// Log details on-screen for initial modem initing etc
|
||||
|
@ -120,7 +129,48 @@ void DateTime_CurrentLocal(struct cc_datetime* t) {
|
|||
/*########################################################################################################################*
|
||||
*-------------------------------------------------------Crash handling----------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
void CrashHandler_Install(void) { }
|
||||
static void HandleCrash(irq_t evt, irq_context_t* ctx, void* data) {
|
||||
uint32_t code = evt;
|
||||
log_timestamp = false;
|
||||
window_inited = false;
|
||||
str_offset = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
Platform_LogConst("** CLASSICUBE FATALLY CRASHED **");
|
||||
Platform_Log2("PC: %h, error: %h",
|
||||
&ctx->pc, &code);
|
||||
Platform_LogConst("");
|
||||
|
||||
static const char* const regNames[] = {
|
||||
"R0 ", "R1 ", "R2 ", "R3 ", "R4 ", "R5 ", "R6 ", "R7 ",
|
||||
"R8 ", "R9 ", "R10", "R11", "R12", "R13", "R14", "R15"
|
||||
};
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
Platform_Log4(" %c: %h %c: %h",
|
||||
regNames[i], &ctx->r[i],
|
||||
regNames[i + 8], &ctx->r[i + 8]);
|
||||
}
|
||||
|
||||
Platform_Log4(" %c : %h %c : %h",
|
||||
"SR", &ctx->sr,
|
||||
"PR", &ctx->pr);
|
||||
|
||||
Platform_LogConst("");
|
||||
Platform_LogConst("Please report on ClassiCube Discord or forums");
|
||||
Platform_LogConst("");
|
||||
Platform_LogConst("You will need to restart your Dreamcast");
|
||||
Platform_LogConst("");
|
||||
|
||||
// Only log to serial/emu console first time
|
||||
log_debugger = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CrashHandler_Install(void) {
|
||||
irq_set_handler(EXC_UNHANDLED_EXC, HandleCrash, NULL);
|
||||
}
|
||||
|
||||
void Process_Abort2(cc_result result, const char* raw_msg) {
|
||||
Logger_DoAbort(result, raw_msg, NULL);
|
||||
|
|
Loading…
Reference in a new issue