dsda: fix -warp

only doom1 uses episode number in -warp, all the rest ignore it and use the first digit to set map (episode is forced to 1 for them). to detect this we now ask the core which gamemode it is (which determines it internally too).

rename complevel setting
This commit is contained in:
feos 2025-03-12 20:40:29 +03:00
parent c826344637
commit 6965767328
8 changed files with 29 additions and 14 deletions

Binary file not shown.

View File

@ -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++],

View File

@ -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++],

View File

@ -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++],

View File

@ -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")]

View File

@ -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<string> _args;
private List<IRomAsset> _wadFiles;
private CInterface.GameMode _gameMode;
/// <summary>
/// core callback for file loading

View File

@ -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);

View File

@ -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