From 60a1ac320a85e5a11808bc7bc674602591f15ef9 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 19 Mar 2024 01:25:56 -0700 Subject: [PATCH] Replays: support old demo format 0x0009 - Old staff ghosts remain compatible --- src/g_demo.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/g_demo.cpp b/src/g_demo.cpp index 10f8ac01b..a92234cf4 100644 --- a/src/g_demo.cpp +++ b/src/g_demo.cpp @@ -95,7 +95,9 @@ tic_t demostarttime; // for comparative timing purposes static constexpr DemoBufferSizes get_buffer_sizes(UINT16 version) { - (void)version; + if (version < 0x000A) // old staff ghost support + return {16, 16, 16}; + // These sizes are compatible as of version 0x000A static_assert(MAXPLAYERNAME == 21); static_assert(SKINNAMESIZE == 16); @@ -154,6 +156,10 @@ demoghost *ghosts = NULL; // DEMO RECORDING // +// Also supported: +// - 0x0009 (older staff ghosts) +// - Player names, skin names and color names were 16 +// bytes. See get_buffer_sizes(). #define DEMOVERSION 0x000A #define DEMOHEADER "\xF0" "KartReplay" "\x0F" @@ -2489,6 +2495,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname) switch(oldversion) // demoversion { case DEMOVERSION: // latest always supported + case 0x0009: // older staff ghosts break; // too old, cannot support. default: @@ -2637,6 +2644,7 @@ void G_LoadDemoInfo(menudemo_t *pdemo, boolean allownonmultiplayer) switch(pdemoversion) { case DEMOVERSION: // latest always supported + case 0x0009: // older staff ghosts if (P_SaveBufferRemaining(&info) < 64) { goto corrupt; @@ -3063,6 +3071,7 @@ void G_DoPlayDemoEx(const char *defdemoname, lumpnum_t deflumpnum) switch(demo.version) { case DEMOVERSION: // latest always supported + case 0x0009: // older staff ghosts break; // too old, cannot support. default: @@ -3515,6 +3524,7 @@ void G_AddGhost(savebuffer_t *buffer, const char *defdemoname) switch(ghostversion) { case DEMOVERSION: // latest always supported + case 0x0009: // older staff ghosts break; // too old, cannot support. default: @@ -3770,6 +3780,7 @@ staffbrief_t *G_GetStaffGhostBrief(UINT8 *buffer) switch(ghostversion) { case DEMOVERSION: // latest always supported + case 0x0009: // older staff ghosts break; // too old, cannot support.