From c0b4219aff88df8596eec97831370f863ef5b012 Mon Sep 17 00:00:00 2001 From: Jas Laferriere Date: Mon, 17 Oct 2022 15:45:31 -0400 Subject: [PATCH] add additional output on game crash --- .gitignore | 1 + .../AdditionalCrashInfo.asm | 47 ++++++++++++++++++ .../AdditionalCrashInfoStatic.s | 17 +++++++ Output/Console/g_crash_output.bin | Bin 0 -> 288 bytes Output/Console/g_crash_output.txt | 38 ++++++++++++++ build-console-all.bat | 34 +++++++++++++ build.bat | 1 + console_crash_output.json | 28 +++++++++++ 8 files changed, 166 insertions(+) create mode 100644 Debugging/AdditionalCrashInfo/AdditionalCrashInfo.asm create mode 100644 Debugging/AdditionalCrashInfo/AdditionalCrashInfoStatic.s create mode 100644 Output/Console/g_crash_output.bin create mode 100644 Output/Console/g_crash_output.txt create mode 100644 build-console-all.bat create mode 100644 console_crash_output.json diff --git a/.gitignore b/.gitignore index 992f0cd..dbe4d61 100644 --- a/.gitignore +++ b/.gitignore @@ -222,6 +222,7 @@ pip-log.txt .vscode Output/Console/install.bat +Output/Console/install-core-only.bat Output/Netplay/install.bat Output/Netplay/build-netplay.bat - Shortcut.lnk Output/Playback/install.bat diff --git a/Debugging/AdditionalCrashInfo/AdditionalCrashInfo.asm b/Debugging/AdditionalCrashInfo/AdditionalCrashInfo.asm new file mode 100644 index 0000000..3824536 --- /dev/null +++ b/Debugging/AdditionalCrashInfo/AdditionalCrashInfo.asm @@ -0,0 +1,47 @@ +################################################################################ +# Address: 0x80394a68 +################################################################################ + +.include "Common/Common.s" +.include "Debugging/AdditionalCrashInfo/AdditionalCrashInfoStatic.s" + +b CODE_START + +STATIC_MEMORY_TABLE_BLRL: +blrl +createAdditionalCrashInfoStaticMem + +FN_PRINT_STR_AT_OFFSET: +backup + +# Get string to print, save to r3 +mr r31, r3 +bl STATIC_MEMORY_TABLE_BLRL +mflr r3 +add r3, r3, r31 + +# Call OSReport function, r4+ and f1+ args should have been set by caller +branchl r12, OSReport + +restore +blr + +CODE_START: +addi r27, r4, 0 # replaced code line + +li r3, ACISMO_NEW_LINE_CHAR_STR +bl FN_PRINT_STR_AT_OFFSET +li r3, ACISMO_VERSION_STR +bl FN_PRINT_STR_AT_OFFSET +li r3, ACISMO_NEW_LINE_CHAR_STR +bl FN_PRINT_STR_AT_OFFSET +li r3, ACISMO_CONSOLE_RUNTIME_STR +loadwz r4, 0x804d7420 # Console runtime frame count +bl FN_PRINT_STR_AT_OFFSET +li r3, ACISMO_SCENE_RUNTIME_STR +loadGlobalFrame r4 # Scene runtime frame count +bl FN_PRINT_STR_AT_OFFSET +li r3, ACISMO_NEW_LINE_CHAR_STR +bl FN_PRINT_STR_AT_OFFSET + +EXIT: \ No newline at end of file diff --git a/Debugging/AdditionalCrashInfo/AdditionalCrashInfoStatic.s b/Debugging/AdditionalCrashInfo/AdditionalCrashInfoStatic.s new file mode 100644 index 0000000..3ba4969 --- /dev/null +++ b/Debugging/AdditionalCrashInfo/AdditionalCrashInfoStatic.s @@ -0,0 +1,17 @@ +# Define additional crash info static mem offsets, these must be synced with the static mem +# defined below +.set ACISMO_VERSION_STR, 0 # char[64] +.set ACISMO_CONSOLE_RUNTIME_STR, ACISMO_VERSION_STR + 64 # char[29] +.set ACISMO_SCENE_RUNTIME_STR, ACISMO_CONSOLE_RUNTIME_STR + 29 # char[27] +.set ACISMO_NEW_LINE_CHAR_STR, ACISMO_SCENE_RUNTIME_STR + 27 # char[2] + +.macro createAdditionalCrashInfoStaticMem +# The string below should be overwritten by the application to provide correct version +# IMPORTANT: The version string should ALWAYS be first +.string "Placeholder for Version and Application: v00.00.00-000-00000000" +.string " Console runtime: %d frames\n" +.string " Scene runtime: %d frames\n" +.string "\n" + +.align 2 +.endm \ No newline at end of file diff --git a/Output/Console/g_crash_output.bin b/Output/Console/g_crash_output.bin new file mode 100644 index 0000000000000000000000000000000000000000..5b914e6fa4fa57bb072e4c0e26d6c6498d49cab4 GIT binary patch literal 288 zcmX?P>6O92z@Y5Gz;ME^fk81KCowrSBR?l4wMZc?zepi0wWv5VKTjbsFGazzpdcqR zIk5!Dw^ArGFwg@dT>}FH5C#JV1?T*{;{2Rcg`(2DlFZyxD+SdQg|wo?+|*(&28H0{ z)I97`TtG+Ea4;>Kz{tQdMe)DFzD9-(HTBXJ-v9sS)?_d(t4aPPV%yMQlGqcrqPCNH znO_5o;x3??21bS_7K#iHYB)e*3<}mM3=9?t3?O}5fiweS4Gq2tEhP#K cEnvBcK(Sb$m`6j)+ytQ7MyT3KpjI#d0I+0Y?*IS* literal 0 HcmV?d00001 diff --git a/Output/Console/g_crash_output.txt b/Output/Console/g_crash_output.txt new file mode 100644 index 0000000..cc7093f --- /dev/null +++ b/Output/Console/g_crash_output.txt @@ -0,0 +1,38 @@ +$Crash Output [Fizzi] +*Outputs additional information when the game crashes +C2394A68 00000023 #Debugging/AdditionalCrashInfo/AdditionalCrashInfo.asm +480000C8 4E800021 +506C6163 65686F6C +64657220 666F7220 +56657273 696F6E20 +616E6420 4170706C +69636174 696F6E3A +20763030 2E30302E +30302D30 30302D30 +30303030 30303000 +20436F6E 736F6C65 +2072756E 74696D65 +3A202564 20667261 +6D65730A 00205363 +656E6520 72756E74 +696D653A 20256420 +6672616D 65730A00 +0A000000 7C0802A6 +90010004 9421FF20 +BE8100B0 7C7F1B78 +4BFFFF6D 7C6802A6 +7C63FA14 3D808034 +618C56A8 7D8903A6 +4E800421 BA8100B0 +800100E4 382100E0 +7C0803A6 4E800020 +3B640000 38600078 +4BFFFFB5 38600000 +4BFFFFAD 38600078 +4BFFFFA5 38600040 +3C80804D 60847420 +80840000 4BFFFF91 +3860005D 3C808048 +80849D60 4BFFFF81 +38600078 4BFFFF79 +60000000 00000000 diff --git a/build-console-all.bat b/build-console-all.bat new file mode 100644 index 0000000..a55a058 --- /dev/null +++ b/build-console-all.bat @@ -0,0 +1,34 @@ +@echo off +echo Building console_core.json for Port A... +gecko build -c console_core.json -defsym "STG_EXIIndex=0" -o "Output/Console/g_core_porta.bin" +echo. + +echo Building console_core.json... +gecko build -c console_core.json -defsym "STG_EXIIndex=1" -o "Output/Console/g_core.bin" +echo. + +set list=console_UCF.json +set list=%list%;console_UCF_stealth.json +set list=%list%;console_mods_stealth.json +set list=%list%;console_mods_tournament.json +set list=%list%;console_mods_friendlies.json +set list=%list%;console_PAL.json +set list=%list%;console_stages_stadium.json +set list=%list%;console_stages_all.json +set list=%list%;console_gameplay_lgl.json +set list=%list%;console_gameplay_wobbling.json +set list=%list%;console_gameplay_both.json +set list=%list%;console_lag_pd.json +set list=%list%;console_lag_pdhalfvb.json +set list=%list%;console_screen_wide.json +set list=%list%;console_screen_wide_shutters.json +set list=%list%;console_safety.json +set list=%list%;console_crash_output.json + +for %%a in (%list%) do ( + echo Building %%a... + gecko build -c %%a + echo. +) + +pause diff --git a/build.bat b/build.bat index 8b10648..b785903 100644 --- a/build.bat +++ b/build.bat @@ -31,6 +31,7 @@ set list=%list%;console_lag_pdhalfvb.json set list=%list%;console_screen_wide.json set list=%list%;console_screen_wide_shutters.json set list=%list%;console_safety.json +set list=%list%;console_crash_output.json for %%a in (%list%) do ( echo Building %%a... diff --git a/console_crash_output.json b/console_crash_output.json new file mode 100644 index 0000000..23d7cc9 --- /dev/null +++ b/console_crash_output.json @@ -0,0 +1,28 @@ +{ + "outputFiles": [ + { + "file": "Output/Console/g_crash_output.bin" + }, + { + "file": "Output/Console/g_crash_output.txt" + } + ], + "codes": [ + { + "name": "Crash Output", + "authors": [ + "Fizzi" + ], + "description": [ + "Outputs additional information when the game crashes" + ], + "build": [ + { + "type": "injectFolder", + "sourceFolder": "Debugging/AdditionalCrashInfo", + "annotation": "Prints crash info [Fizzi]" + } + ] + } + ] +} \ No newline at end of file