diff --git a/Assets/dll/dsda.wbx.zst b/Assets/dll/dsda.wbx.zst index 5e43179c13..ce4b775c18 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/HereticLmpImport.cs b/src/BizHawk.Client.Common/movie/import/HereticLmpImport.cs index 483b2783f9..360787a969 100644 --- a/src/BizHawk.Client.Common/movie/import/HereticLmpImport.cs +++ b/src/BizHawk.Client.Common/movie/import/HereticLmpImport.cs @@ -19,7 +19,7 @@ namespace BizHawk.Client.Common DSDA.DoomSyncSettings syncSettings = new() { InputFormat = DoomControllerTypes.Heretic, - MultiplayerMode = DSDA.MultiplayerMode.M0, + MultiplayerMode = DSDA.MultiplayerMode.Single_Coop, MonstersRespawn = false, FastMonsters = false, NoMonsters = false, diff --git a/src/BizHawk.Client.Common/movie/import/HexenLmpImport.cs b/src/BizHawk.Client.Common/movie/import/HexenLmpImport.cs index 105adcf78c..d7223b7b53 100644 --- a/src/BizHawk.Client.Common/movie/import/HexenLmpImport.cs +++ b/src/BizHawk.Client.Common/movie/import/HexenLmpImport.cs @@ -19,7 +19,7 @@ namespace BizHawk.Client.Common DSDA.DoomSyncSettings syncSettings = new() { InputFormat = DoomControllerTypes.Hexen, - MultiplayerMode = DSDA.MultiplayerMode.M0, + MultiplayerMode = DSDA.MultiplayerMode.Single_Coop, MonstersRespawn = false, FastMonsters = false, NoMonsters = false, diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.IEmulator.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.IEmulator.cs index 83710d3c62..658fe76913 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.IEmulator.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.IEmulator.cs @@ -45,6 +45,10 @@ namespace BizHawk.Emulation.Cores.Computers.Doom { int mouseTurningDelta = _player1LastMouseTurningValue - mouseTurningSpeed; player1Inputs._TurningSpeed += mouseTurningDelta * _syncSettings.MouseTurnSensitivity; + if (_syncSettings.TurningResolution == TurningResolution.Shorttics) + { + player1Inputs._TurningSpeed >>= 8; + } } _player1LastMouseTurningValue = mouseTurningSpeed; @@ -89,6 +93,10 @@ namespace BizHawk.Emulation.Cores.Computers.Doom { int mouseTurningDelta = _player2LastMouseTurningValue - mouseTurningSpeed; player2Inputs._TurningSpeed += mouseTurningDelta * _syncSettings.MouseTurnSensitivity; + if (_syncSettings.TurningResolution == TurningResolution.Shorttics) + { + player2Inputs._TurningSpeed >>= 8; + } } _player2LastMouseTurningValue = mouseTurningSpeed; @@ -133,6 +141,10 @@ namespace BizHawk.Emulation.Cores.Computers.Doom { int mouseTurningDelta = _player3LastMouseTurningValue - mouseTurningSpeed; player3Inputs._TurningSpeed += mouseTurningDelta * _syncSettings.MouseTurnSensitivity; + if (_syncSettings.TurningResolution == TurningResolution.Shorttics) + { + player3Inputs._TurningSpeed >>= 8; + } } _player3LastMouseTurningValue = mouseTurningSpeed; @@ -177,6 +189,10 @@ namespace BizHawk.Emulation.Cores.Computers.Doom { int mouseTurningDelta = _player4LastMouseTurningValue - mouseTurningSpeed; player4Inputs._TurningSpeed += mouseTurningDelta * _syncSettings.MouseTurnSensitivity; + if (_syncSettings.TurningResolution == TurningResolution.Shorttics) + { + player4Inputs._TurningSpeed >>= 8; + } } _player4LastMouseTurningValue = mouseTurningSpeed; diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ISettable.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ISettable.cs index 848e2b894e..809a274ff7 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ISettable.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ISettable.cs @@ -63,27 +63,34 @@ namespace BizHawk.Emulation.Cores.Computers.Doom S4 = 4, [Display(Name = "5 - Nightmare!")] S5 = 5 + } + public enum TurningResolution : int + { + [Display(Name = "16-bit integer (\"longtics\")")] + Longtics = 1, + [Display(Name = "8-bit integer (\"shorttics\")")] + Shorttics = 2, } public enum MultiplayerMode : int { [Display(Name = "0 - Single Player / Coop")] - M0 = 0, + Single_Coop = 0, [Display(Name = "1 - Deathmatch")] - M1 = 1, + Deathmatch = 1, [Display(Name = "2 - Altdeath")] - M2 = 2 + Altdeath = 2 } public enum HexenClass : int { - [Display(Name = "Fighter")] - C1 = 1, + [Display(Name = "FighterFighter")] + Fighter = 1, [Display(Name = "Cleric")] - C2 = 2, + Cleric = 2, [Display(Name = "Mage")] - C3 = 3 + Mage = 3 } public const int TURBO_AUTO = -1; @@ -181,7 +188,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom [DisplayName("Multiplayer Mode")] [Description("Indicates the multiplayer mode")] - [DefaultValue(MultiplayerMode.M0)] + [DefaultValue(MultiplayerMode.Single_Coop)] [TypeConverter(typeof(DescribableEnumConverter))] public MultiplayerMode MultiplayerMode { get; set; } @@ -219,25 +226,25 @@ namespace BizHawk.Emulation.Cores.Computers.Doom [DisplayName("Player 1 Hexen Class")] [Description("The Hexen class to use for player 1. Has no effect for Doom / Heretic")] - [DefaultValue(HexenClass.C1)] + [DefaultValue(HexenClass.Fighter)] [TypeConverter(typeof(DescribableEnumConverter))] public HexenClass Player1Class { get; set; } [DisplayName("Player 2 Hexen Class")] [Description("The Hexen class to use for player 2. Has no effect for Doom / Heretic")] - [DefaultValue(HexenClass.C1)] + [DefaultValue(HexenClass.Fighter)] [TypeConverter(typeof(DescribableEnumConverter))] public HexenClass Player2Class { get; set; } [DisplayName("Player 3 Hexen Class")] [Description("The Hexen class to use for player 3. Has no effect for Doom / Heretic")] - [DefaultValue(HexenClass.C1)] + [DefaultValue(HexenClass.Fighter)] [TypeConverter(typeof(DescribableEnumConverter))] public HexenClass Player3Class { get; set; } [DisplayName("Player 4 Hexen Class")] [Description("The Hexen class to use for player 4. Has no effect for Doom / Heretic")] - [DefaultValue(HexenClass.C1)] + [DefaultValue(HexenClass.Fighter)] [TypeConverter(typeof(DescribableEnumConverter))] public HexenClass Player4Class { get; set; } @@ -251,6 +258,16 @@ namespace BizHawk.Emulation.Cores.Computers.Doom [DefaultValue(true)] public bool StrictMode { get; set; } + [DisplayName("Auto Run")] + [Description("")] + [DefaultValue(true)] + public bool AutoRun { get; set; } + + [DisplayName("Turning Resolution")] + [Description("\"shorttics\" refers to decreased turning resolution used for demos, whereas \"longtics\" refers to the regular turning resolution outside of a demo-recording environment.")] + [DefaultValue(TurningResolution.Longtics)] + public TurningResolution TurningResolution { get; set; } + [DisplayName("Prevent Level Exit")] [Description("Level exit triggers won't have an effect. This is useful for debugging / optimizing / botting purposes.")] [DefaultValue(false)] diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs index 3ad2116a36..60de2c1742 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs @@ -100,29 +100,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom } var initSettings = _syncSettings.GetNativeSettings(lp.Game); - - _args = new List - { - "dsda", - }; - - _args.AddRange([ "-skill", $"{(int) _syncSettings.SkillLevel}" ]); - _args.AddRange([ "-warp", $"{_syncSettings.InitialEpisode}", $"{_syncSettings.InitialMap}" ]); - _args.AddRange([ "-complevel", $"{(int) _syncSettings.CompatibilityMode}" ]); - - ConditionalArg(!_syncSettings.StrictMode, "-tas"); - ConditionalArg(_syncSettings.MonstersRespawn, "-respawn"); - ConditionalArg(_syncSettings.NoMonsters, "-nomonsters"); - ConditionalArg(_syncSettings.ChainEpisodes, "-chain_episodes"); - ConditionalArg(_syncSettings.MultiplayerMode == MultiplayerMode.M1, "-deathmatch"); - ConditionalArg(_syncSettings.MultiplayerMode == MultiplayerMode.M2, "-altdeath"); - ConditionalArg(_syncSettings.Turbo > 0, $"-turbo {_syncSettings.Turbo}"); - ConditionalArg((initSettings._Player1Present + initSettings._Player2Present + initSettings._Player3Present + initSettings._Player4Present) > 1, "-solo-net"); - - Console.WriteLine(); - Console.WriteLine(string.Join(" ", _args)); - Console.WriteLine(); - + CreateArguments(initSettings); var initResult = Core.dsda_init(ref initSettings, _args.Count, _args.ToArray()); if (!initResult) throw new Exception($"{nameof(Core.dsda_init)}() failed"); @@ -148,6 +126,28 @@ namespace BizHawk.Emulation.Cores.Computers.Doom } } + private void CreateArguments(CInterface.InitSettings initSettings) + { + _args = new List + { + "dsda", + }; + + _args.AddRange([ "-skill", $"{(int)_syncSettings.SkillLevel}" ]); + _args.AddRange([ "-warp", $"{_syncSettings.InitialEpisode}", $"{_syncSettings.InitialMap}" ]); + _args.AddRange([ "-complevel", $"{(int)_syncSettings.CompatibilityMode}" ]); + + ConditionalArg(!_syncSettings.StrictMode, "-tas"); + ConditionalArg(_syncSettings.MonstersRespawn, "-respawn"); + ConditionalArg(_syncSettings.NoMonsters, "-nomonsters"); + ConditionalArg(_syncSettings.ChainEpisodes, "-chain_episodes"); + ConditionalArg(_syncSettings.TurningResolution == TurningResolution.Longtics, "-longtics"); + ConditionalArg(_syncSettings.MultiplayerMode == MultiplayerMode.Deathmatch, "-deathmatch"); + ConditionalArg(_syncSettings.MultiplayerMode == MultiplayerMode.Altdeath, "-altdeath"); + ConditionalArg(_syncSettings.Turbo > 0, $"-turbo {_syncSettings.Turbo}"); + ConditionalArg((initSettings._Player1Present + initSettings._Player2Present + initSettings._Player3Present + initSettings._Player4Present) > 1, "-solo-net"); + } + private void ConditionalArg(bool condition, string setting) { if (condition) diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDAControllers.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDAControllers.cs index b6e99baff2..90ff901e07 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDAControllers.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDAControllers.cs @@ -38,7 +38,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom .AddAxis($"P{PortNum} Turning Speed", (-128).RangeTo(127), 0) .AddAxis($"P{PortNum} Weapon Select", (0).RangeTo(7), 0) .AddAxis($"P{PortNum} Mouse Running", (-128).RangeTo(127), 0) - .AddAxis($"P{PortNum} Mouse Turning", (-128).RangeTo(127), 0) + .AddAxis($"P{PortNum} Mouse Turning", (-32768).RangeTo(32767), 0) .MakeImmutable(); } @@ -115,12 +115,12 @@ namespace BizHawk.Emulation.Cores.Computers.Doom { if (c.IsPressed($"P{PortNum} Key Turn Left")) { - x = c.IsPressed($"P{PortNum} Key Shift Run") ? 5 : 2; + x = c.IsPressed($"P{PortNum} Key Shift Run") ? 1280 : 320; } if (c.IsPressed($"P{PortNum} Key Turn Right")) { - x = c.IsPressed($"P{PortNum} Key Shift Run") ? -5 : -2; + x = c.IsPressed($"P{PortNum} Key Shift Run") ? -1280 : -320; } } diff --git a/waterbox/dsda/BizhawkInterface.cxx b/waterbox/dsda/BizhawkInterface.cxx index 47ca189633..b14cce346b 100644 --- a/waterbox/dsda/BizhawkInterface.cxx +++ b/waterbox/dsda/BizhawkInterface.cxx @@ -160,7 +160,20 @@ ECL_EXPORT int dsda_init(InitSettings *settings, int argc, char **argv) // Initializing DSDA core headlessMain(argc, argv); - printf("DSDA Initialized\n"); + printf("DSDA Initialized\n"); + + switch(compatibility_level) { + case prboom_6_compatibility: + longtics = 1; + break; + case mbf21_compatibility: + longtics = 1; + shorttics = !dsda_Flag(dsda_arg_longtics); + break; + default: + longtics = dsda_Flag(dsda_arg_longtics); + break; + } // Initializing audio I_SetSoundCap(); diff --git a/waterbox/dsda/BizhawkInterface.hxx b/waterbox/dsda/BizhawkInterface.hxx index d58afa0d75..e9768c8ba9 100644 --- a/waterbox/dsda/BizhawkInterface.hxx +++ b/waterbox/dsda/BizhawkInterface.hxx @@ -9,6 +9,10 @@ #include "d_player.h" #include "w_wad.h" #include "p_mobj.h" +#include "doomstat.h" +#include "g_game.h" + +#include "dsda/args.h" extern "C" { @@ -41,23 +45,18 @@ extern "C" unsigned char * I_CaptureAudio (int* nsamples); void I_InitSound(void); void I_SetSoundCap (void); + } // Players information extern "C" int enableOutput; -extern "C" player_t players[MAX_MAXPLAYERS]; extern "C" int preventLevelExit; extern "C" int preventGameEnd; extern "C" int reachedLevelExit; extern "C" int reachedGameEnd; -extern "C" int gamemap; -extern "C" int gametic; -extern "C" dboolean playeringame[MAX_MAXPLAYERS]; -extern "C" int consoleplayer; -extern "C" int displayplayer; -extern "C" pclass_t PlayerClass[MAX_MAXPLAYERS]; extern int numthings; extern mobj_t **mobj_ptrs; +extern dsda_arg_t arg_value[dsda_arg_count]; #define PALETTE_SIZE 256 uint32_t _convertedPaletteBuffer[PALETTE_SIZE]; @@ -103,4 +102,8 @@ struct PackedRenderInfo int _RenderVideo; int _RenderAudio; int _PlayerPointOfView; -} __attribute__((packed)); \ No newline at end of file +} __attribute__((packed)); + +dboolean dsda_Flag(dsda_arg_identifier_t id) { + return arg_value[id].found; +} \ No newline at end of file