From 0fe3c33c46d85dafcb67348fefa17cc9a76639f9 Mon Sep 17 00:00:00 2001 From: feos Date: Thu, 22 May 2025 20:17:56 +0300 Subject: [PATCH] dsda: disable BOOM demo import for now passing rngseed didn't fix sync, and passing all the settings is too much work for this release. will support it afterwards. instead just tell the user BOOM demos are not supported --- .../movie/import/DoomLmpImport.cs | 22 ++++++++++++------- .../Computers/Doom/DSDA.ISettable.cs | 10 +++++++-- .../Computers/Doom/LibDSDA.cs | 1 + waterbox/dsda/BizhawkInterface.c | 3 +++ waterbox/dsda/BizhawkInterface.h | 2 ++ 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/BizHawk.Client.Common/movie/import/DoomLmpImport.cs b/src/BizHawk.Client.Common/movie/import/DoomLmpImport.cs index c3276c96f3..a23bc67eb8 100644 --- a/src/BizHawk.Client.Common/movie/import/DoomLmpImport.cs +++ b/src/BizHawk.Client.Common/movie/import/DoomLmpImport.cs @@ -1,3 +1,5 @@ +using System.Buffers.Binary; + using BizHawk.Common.IOExtensions; using BizHawk.Emulation.Common; using BizHawk.Emulation.Cores; @@ -49,6 +51,7 @@ namespace BizHawk.Client.Common var monstersRespawn = false; var fastMonsters = false; var noMonsters = false; + //var rngSeed = 1993U; Result.Movie.HeaderEntries[HeaderKeys.Core] = CoreNames.DSDA; Result.Movie.SystemID = VSystemID.Raw.Doom; @@ -106,6 +109,10 @@ namespace BizHawk.Client.Common } else // Boom territory { + Result.Errors.Add($"Found BOOM demo format: v{(int)version}. Importing it is currently not supported."); + return; + + /* i++; // skip to signature's second byte var portID = input[i++]; i += 4; // skip the rest of the signature @@ -184,12 +191,10 @@ namespace BizHawk.Client.Common monstersRespawn = input[i++] is not 0; fastMonsters = input[i++] is not 0; noMonsters = input[i++] is not 0; - - var optionsSize = compLevel == DSDA.CompatibilityLevel.MBF21 ? 21 + 25 : 64; - i += optionsSize - 9; // subtract the options we already parsed - - if (version == DemoVersion.Boom_2_00) - i += 256 - optionsSize; + i++; // demo insurance + rngSeed = BinaryPrimitives.ReadUInt32BigEndian(input.AsSpan(i, 4)); + i = 0x4D; + */ } DSDA.DoomSyncSettings syncSettings = new() @@ -205,13 +210,14 @@ namespace BizHawk.Client.Common NoMonsters = noMonsters, TurningResolution = turningResolution, RenderWipescreen = false, + //RNGSeed = rngSeed, }; syncSettings.Player1Present = input[i++] is not 0; syncSettings.Player2Present = input[i++] is not 0; syncSettings.Player3Present = input[i++] is not 0; syncSettings.Player4Present = input[i++] is not 0; - + /* if (compLevel >= DSDA.CompatibilityLevel.Boom_Compatibility && version >= DemoVersion.Boom_2_00) { @@ -219,7 +225,7 @@ namespace BizHawk.Client.Common var g_maxplayers = 4; i += FUTURE_MAXPLAYERS - g_maxplayers; } - + */ Result.Movie.SyncSettingsJson = ConfigService.SaveWithType(syncSettings); var doomController = new DoomControllerDeck( diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ISettable.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ISettable.cs index 90e9c984e7..7145c6ac86 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ISettable.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ISettable.cs @@ -403,7 +403,12 @@ namespace BizHawk.Emulation.Cores.Computers.Doom [Description("How fast the Doom player will run when using the mouse.")] [DefaultValue(1)] public int MouseRunSensitivity { get; set; } - + /* + [DisplayName("Initial RNG Seed")] + [Description("Boom demos.")] + [DefaultValue(1993)] + public uint RNGSeed { get; set; } + */ [DisplayName("Player 1 Hexen Class")] [Description("The Hexen class to use for player 1. Has no effect for Doom / Heretic")] [DefaultValue(HexenClass.Fighter)] @@ -441,7 +446,8 @@ namespace BizHawk.Emulation.Cores.Computers.Doom Player3Class = (int)Player3Class, Player4Class = (int)Player4Class, PreventLevelExit = PreventLevelExit ? 1 : 0, - PreventGameEnd = PreventGameEnd ? 1 : 0 + PreventGameEnd = PreventGameEnd ? 1 : 0, + //RNGSeed = RNGSeed, }; } diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/LibDSDA.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/LibDSDA.cs index 33469b3e0b..1972478afb 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/LibDSDA.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/LibDSDA.cs @@ -36,6 +36,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom public int Player4Class; public int PreventLevelExit; public int PreventGameEnd; + //public uint RNGSeed; } [StructLayout(LayoutKind.Sequential)] diff --git a/waterbox/dsda/BizhawkInterface.c b/waterbox/dsda/BizhawkInterface.c index ad0875c299..6bb6277bc2 100644 --- a/waterbox/dsda/BizhawkInterface.c +++ b/waterbox/dsda/BizhawkInterface.c @@ -283,6 +283,9 @@ ECL_EXPORT int dsda_init(struct InitSettings *settings, int argc, char **argv) break; } + //if (compatibility_level >= boom_202_compatibility) + // rngseed = settings->RNGSeed; + // Initializing audio I_SetSoundCap(); I_InitSound(); diff --git a/waterbox/dsda/BizhawkInterface.h b/waterbox/dsda/BizhawkInterface.h index 992b3e4571..c1d425e7f2 100644 --- a/waterbox/dsda/BizhawkInterface.h +++ b/waterbox/dsda/BizhawkInterface.h @@ -26,6 +26,7 @@ extern void headlessSetTickCommand(int playerId, int forwardSpeed, int strafingS extern void headlessGetMapName(char *outString); extern void headlessSetSaveStatePointer(void *savePtr, int saveStateSize); extern size_t headlessGetEffectiveSaveSize(); +extern unsigned int rngseed; // Video extern void headlessUpdateVideo(); @@ -140,6 +141,7 @@ struct InitSettings int Player4Class; int PreventLevelExit; int PreventGameEnd; + //unsigned int RNGSeed; } __attribute__((packed)); struct PackedPlayerInput