diff --git a/Assets/dll/dsda.wbx.zst b/Assets/dll/dsda.wbx.zst index 4a79736c28..3057466eb4 100644 Binary files a/Assets/dll/dsda.wbx.zst and b/Assets/dll/dsda.wbx.zst differ diff --git a/src/BizHawk.Client.Common/movie/import/DoomLmpImport.cs b/src/BizHawk.Client.Common/movie/import/DoomLmpImport.cs index 883d888b8a..84bb873b81 100644 --- a/src/BizHawk.Client.Common/movie/import/DoomLmpImport.cs +++ b/src/BizHawk.Client.Common/movie/import/DoomLmpImport.cs @@ -38,7 +38,7 @@ namespace BizHawk.Client.Common DSDA.DoomSyncSettings syncSettings = new() { InputFormat = DoomControllerTypes.Doom, - CompatibilityMode = presumedCompatibilityLevel, + CompatibilityLevel = presumedCompatibilityLevel, SkillLevel = (DSDA.SkillLevel) (1 + input[i++]), InitialEpisode = input[i++], InitialMap = input[i++], diff --git a/src/BizHawk.Client.Common/movie/import/HereticLmpImport.cs b/src/BizHawk.Client.Common/movie/import/HereticLmpImport.cs index 3ad0927bfc..d8268c0622 100644 --- a/src/BizHawk.Client.Common/movie/import/HereticLmpImport.cs +++ b/src/BizHawk.Client.Common/movie/import/HereticLmpImport.cs @@ -23,7 +23,7 @@ namespace BizHawk.Client.Common MonstersRespawn = false, FastMonsters = false, NoMonsters = false, - CompatibilityMode = DSDA.CompatibilityLevel.C0, + CompatibilityLevel = DSDA.CompatibilityLevel.C0, SkillLevel = (DSDA.SkillLevel) (1 + input[i++]), InitialEpisode = input[i++], InitialMap = input[i++], diff --git a/src/BizHawk.Client.Common/movie/import/HexenLmpImport.cs b/src/BizHawk.Client.Common/movie/import/HexenLmpImport.cs index e1c27bc137..0518cfe3fd 100644 --- a/src/BizHawk.Client.Common/movie/import/HexenLmpImport.cs +++ b/src/BizHawk.Client.Common/movie/import/HexenLmpImport.cs @@ -23,7 +23,7 @@ namespace BizHawk.Client.Common MonstersRespawn = false, FastMonsters = false, NoMonsters = false, - CompatibilityMode = DSDA.CompatibilityLevel.C0, + CompatibilityLevel = DSDA.CompatibilityLevel.C0, SkillLevel = (DSDA.SkillLevel) (1 + input[i++]), InitialEpisode = input[i++], InitialMap = input[i++], diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ISettable.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ISettable.cs index 679d11dd7d..f8571f4f0c 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ISettable.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ISettable.cs @@ -189,11 +189,11 @@ namespace BizHawk.Emulation.Cores.Computers.Doom [DefaultValue(false)] public bool Player4Present { get; set; } - [DisplayName("Compatibility Mode")] + [DisplayName("Compatibility Level")] [Description("The version of Doom or its ports that this movie is meant to emulate.")] [DefaultValue(CompatibilityLevel.C2)] [TypeConverter(typeof(DescribableEnumConverter))] - public CompatibilityLevel CompatibilityMode { get; set; } + public CompatibilityLevel CompatibilityLevel { get; set; } [DisplayName("Skill Level")] [Description("Establishes the general difficulty settings.")] @@ -208,8 +208,8 @@ namespace BizHawk.Emulation.Cores.Computers.Doom public MultiplayerMode MultiplayerMode { get; set; } [DisplayName("Initial Episode")] - [Description("Selects the initial episode. Use '0' for non-episodic IWads (e.g., DOOM2)")] - [DefaultValue(0)] + [Description("Selects the initial episode. Ignored for non-episodic IWADs (e.g., DOOM2)")] + [DefaultValue(1)] public int InitialEpisode { get; set; } [DisplayName("Initial Map")] diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs index b6f0767d14..9df4b82058 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs @@ -84,7 +84,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom + "render_stretch_hud 0\n" + "render_stretchsky 0\n" + "render_doom_lightmaps 1\n" - + "render_stretchsky 0\n" + + "render_wipescreen 0\n" + "map_coordinates 0\n" + "map_totals 0\n" ); @@ -120,7 +120,8 @@ namespace BizHawk.Emulation.Cores.Computers.Doom foreach (var wadFile in _wadFiles) { var loadWadResult = _core.dsda_add_wad_file(wadFile.RomPath, wadFile.RomData.Length, _loadCallback); - if (!loadWadResult) throw new Exception($"Could not load WAD file: '{wadFile.RomPath}'"); + if (loadWadResult is 0) throw new Exception($"Could not load WAD file: '{wadFile.RomPath}'"); + _gameMode = (CInterface.GameMode)loadWadResult; } _elf.AddReadonlyFile(_configFile, "dsda-doom.cfg"); @@ -159,9 +160,12 @@ namespace BizHawk.Emulation.Cores.Computers.Doom "dsda", }; + _args.Add("-warp"); + ConditionalArg(_syncSettings.InitialEpisode is not 0 && _gameMode != CInterface.GameMode.Commercial, $"{_syncSettings.InitialEpisode}"); + _args.Add($"{_syncSettings.InitialMap}"); + _args.AddRange([ "-skill", $"{(int)_syncSettings.SkillLevel}" ]); - _args.AddRange([ "-warp", $"{_syncSettings.InitialEpisode}", $"{_syncSettings.InitialMap}" ]); - _args.AddRange([ "-complevel", $"{(int)_syncSettings.CompatibilityMode}" ]); + _args.AddRange([ "-complevel", $"{(int)_syncSettings.CompatibilityLevel}" ]); _args.AddRange([ "-config", "dsda-doom.cfg" ]); ConditionalArg(!_syncSettings.StrictMode, "-tas"); @@ -200,6 +204,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom private int[] _turnHeld = [ 0, 0, 0, 0 ]; private List _args; private List _wadFiles; + private CInterface.GameMode _gameMode; /// /// core callback for file loading diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/LibDSDA.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/LibDSDA.cs index 9cf32f64b4..457621d117 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/LibDSDA.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/LibDSDA.cs @@ -13,6 +13,16 @@ namespace BizHawk.Emulation.Cores.Computers.Doom Sectors = 2 } + public enum GameMode : int + { + Fail = 0, + Shareware = 1 << 0, // DOOM 1 shareware, E1, M9 + Registered = 1 << 1, // DOOM 1 registered, E3, M27 + Commercial = 1 << 2, // DOOM 2 retail, E1 M34 (DOOM 2 german edition not handled) + Retail = 1 << 3, // DOOM 1 retail, E4, M36 + Indetermined = 1 << 4 // no IWAD found. + } + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate int load_archive_cb(string filename, IntPtr buffer, int maxsize); @@ -77,7 +87,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom public abstract void dsda_get_video(out int w, out int h, out int pitch, ref IntPtr buffer, out int palSize, ref IntPtr palBuffer); [BizImport(CallingConvention.Cdecl)] - public abstract bool dsda_add_wad_file( + public abstract int dsda_add_wad_file( string fileName, int fileSize, load_archive_cb feload_archive_cb); diff --git a/waterbox/dsda/BizhawkInterface.cxx b/waterbox/dsda/BizhawkInterface.cxx index ca3256230f..95182f3724 100644 --- a/waterbox/dsda/BizhawkInterface.cxx +++ b/waterbox/dsda/BizhawkInterface.cxx @@ -253,8 +253,8 @@ ECL_EXPORT int dsda_add_wad_file(const char *filename, const int size, ECL_ENTRY // Checking for correct header if (recognizedFormat == false) { fprintf(stderr, "Error with '%s': it contains an unrecognized header '%s'\n", filename, header); return 0; } - // Return 1 for all ok - return 1; + // All ok + return 1 << gamemode; } // the Doom engine doesn't have traditional memory regions because it's not an emulator