From 88046b44673e6a9237ef187666568375f35762a5 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 18 Apr 2024 21:06:41 +1000 Subject: [PATCH] Saturn: Now runs a tiny bit before crashing due to out of memory --- src/Platform_Saturn.c | 16 +++++++--------- src/_PlatformConsole.h | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Platform_Saturn.c b/src/Platform_Saturn.c index 23c118de9..82033c116 100644 --- a/src/Platform_Saturn.c +++ b/src/Platform_Saturn.c @@ -34,13 +34,14 @@ const char* Platform_AppNameSuffix = " Saturn"; /*########################################################################################################################* *------------------------------------------------------Logging/Time-------------------------------------------------------* *#########################################################################################################################*/ +#define WRITE_ADDRESS CS0(0x00100001) +// in Medafen, patch DummyWrite in src/ss/Cart.cpp to instead log the value + void Platform_Log(const char* msg, int len) { - char tmp[2048 + 1]; - len = min(len, 2048); - Mem_Copy(tmp, msg, len); tmp[len] = '\0'; - - dbgio_printf("%s\n", tmp); - dbgio_flush(); + for (int i = 0; i < len; i++) { + MEMORY_WRITE(8, WRITE_ADDRESS, msg[i]); + } + MEMORY_WRITE(8, WRITE_ADDRESS, '\n'); } TimeMS DateTime_CurrentUTC(void) { @@ -211,9 +212,6 @@ cc_result Socket_CheckWritable(cc_socket s, cc_bool* writable) { *--------------------------------------------------------Platform---------------------------------------------------------* *#########################################################################################################################*/ void Platform_Init(void) { - dbgio_init(); - dbgio_dev_default_init(DBGIO_DEV_VDP2_ASYNC); - dbgio_dev_font_load(); Stopwatch_Init(); Options_SetBool(OPT_USE_CHAT_FONT, true); diff --git a/src/_PlatformConsole.h b/src/_PlatformConsole.h index 1f920d8f0..8a03f417f 100644 --- a/src/_PlatformConsole.h +++ b/src/_PlatformConsole.h @@ -69,7 +69,7 @@ int Platform_GetCommandLineArgs(int argc, STRING_REF char** argv, cc_string* arg // (e.g. when running via some emulators) if (!argc) return 0; -#ifdef CC_BUILD_PS1 +#if defined CC_BUILD_PS1 || defined CC_BUILD_SATURN // When running in DuckStation at least, argv was a five element array of empty strings ??? return 0; #endif