diff --git a/Assets/dll/dsda.wbx.zst b/Assets/dll/dsda.wbx.zst index 86de75806c..2d540d7467 100644 Binary files a/Assets/dll/dsda.wbx.zst and b/Assets/dll/dsda.wbx.zst differ diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.IEmulator.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.IEmulator.cs index b60d761a20..6506994a8c 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.IEmulator.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.IEmulator.cs @@ -46,19 +46,25 @@ namespace BizHawk.Emulation.Cores.Computers.Doom | Convert.ToInt32(_syncSettings.Player3Present) << 2 | Convert.ToInt32(_syncSettings.Player4Present) << 3; - if (controller.IsPressed("Change Gamma")) commonButtons |= (1 << 0); - if (controller.IsPressed("Automap Toggle")) commonButtons |= (1 << 1); - if (controller.IsPressed("Automap +")) commonButtons |= (1 << 2); - if (controller.IsPressed("Automap -")) commonButtons |= (1 << 3); - if (controller.IsPressed("Automap Full/Zoom")) commonButtons |= (1 << 4); - if (controller.IsPressed("Automap Follow")) commonButtons |= (1 << 5); - if (controller.IsPressed("Automap Up")) commonButtons |= (1 << 6); - if (controller.IsPressed("Automap Down")) commonButtons |= (1 << 7); - if (controller.IsPressed("Automap Right")) commonButtons |= (1 << 8); - if (controller.IsPressed("Automap Left")) commonButtons |= (1 << 9); - if (controller.IsPressed("Automap Grid")) commonButtons |= (1 << 10); - if (controller.IsPressed("Automap Mark")) commonButtons |= (1 << 11); - if (controller.IsPressed("Automap Clear Marks")) commonButtons |= (1 << 12); + if (controller.IsPressed("Change Gamma") && !_lastGammaInput) + { + // cycle through [0 - 4] + _settings.Gamma++; + _settings.Gamma %= 5; + } + + if (controller.IsPressed("Automap Toggle")) commonButtons |= (1 << 0); + if (controller.IsPressed("Automap +")) commonButtons |= (1 << 1); + if (controller.IsPressed("Automap -")) commonButtons |= (1 << 2); + if (controller.IsPressed("Automap Full/Zoom")) commonButtons |= (1 << 3); + if (controller.IsPressed("Automap Follow")) commonButtons |= (1 << 4); + if (controller.IsPressed("Automap Up")) commonButtons |= (1 << 5); + if (controller.IsPressed("Automap Down")) commonButtons |= (1 << 6); + if (controller.IsPressed("Automap Right")) commonButtons |= (1 << 7); + if (controller.IsPressed("Automap Left")) commonButtons |= (1 << 8); + if (controller.IsPressed("Automap Grid")) commonButtons |= (1 << 9); + if (controller.IsPressed("Automap Mark")) commonButtons |= (1 << 10); + if (controller.IsPressed("Automap Clear Marks")) commonButtons |= (1 << 11); for (int i = 0; i < 4; i++) { @@ -170,7 +176,6 @@ namespace BizHawk.Emulation.Cores.Computers.Doom MapOverlay = (int)_settings.MapOverlay, RenderVideo = renderVideo ? 1 : 0, RenderAudio = renderAudio ? 1 : 0, - DoUpdate = _settings.DoUpdate ? 1 : 0, ShowMessages = _settings.ShowMessages ? 1 : 0, ReportSecrets = _settings.ReportSecrets ? 1 : 0, DsdaExHud = _settings.DsdaExHud ? 1 : 0, @@ -190,11 +195,6 @@ namespace BizHawk.Emulation.Cores.Computers.Doom ref players[3], ref renderInfo); - if (_settings.DoUpdate) - { - _settings.DoUpdate = false; - } - if (renderVideo) UpdateVideo(); @@ -208,6 +208,8 @@ namespace BizHawk.Emulation.Cores.Computers.Doom LagCount++; } + _lastGammaInput = controller.IsPressed("Change Gamma"); + return true; } diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ISettable.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ISettable.cs index 48a047d2e3..52a88c8c62 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ISettable.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ISettable.cs @@ -146,9 +146,6 @@ namespace BizHawk.Emulation.Cores.Computers.Doom [CoreSettings] public class DoomSettings { - [JsonIgnore] - public bool DoUpdate = false; - [DisplayName("Internal Resolution Scale Factor")] [Description("Which factor to increase internal resolution by [1 - 12]. Improves \"quality\" of the rendered image at the cost of accuracy.\n\nVanilla resolution is 320x200 resized to 4:3 DAR on a CRT monitor.\n\nRequires restart.")] [Range(1, 12)] @@ -156,18 +153,21 @@ namespace BizHawk.Emulation.Cores.Computers.Doom [TypeConverter(typeof(ConstrainedIntConverter))] public int ScaleFactor { get; set; } + [JsonIgnore] [DisplayName("Sfx Volume")] [Description("Sound effects volume [0 - 15].")] [Range(0, 15)] [DefaultValue(8)] public int SfxVolume { get; set; } + [JsonIgnore] [DisplayName("Music Volume")] [Description("[0 - 15]")] [Range(0, 15)] [DefaultValue(8)] public int MusicVolume { get; set; } + [JsonIgnore] [DisplayName("Gamma Correction Level")] [Description("Increases brightness [0 - 4].\n\nDefault value in vanilla is \"OFF\" (0).")] [Range(0, 4)] @@ -175,56 +175,67 @@ namespace BizHawk.Emulation.Cores.Computers.Doom [TypeConverter(typeof(ConstrainedIntConverter))] public int Gamma { get; set; } + [JsonIgnore] [DisplayName("Show Messages")] [Description("Displays messages about items you pick up.\n\nDefault value in vanilla is \"ON\".")] [DefaultValue(true)] public bool ShowMessages { get; set; } + [JsonIgnore] [DisplayName("Report Revealed Secrets")] [Description("Shows an on-screen notification when revealing a secret.")] [DefaultValue(false)] public bool ReportSecrets { get; set; } + [JsonIgnore] [DisplayName("HUD Mode")] [Description("Sets heads-up display mode.")] [DefaultValue(HudMode.Vanilla)] public HudMode HeadsUpMode { get; set; } + [JsonIgnore] [DisplayName("Extended HUD")] [Description("Shows DSDA-Doom-specific information above vanilla heads-up-display.")] [DefaultValue(false)] public bool DsdaExHud { get; set; } + [JsonIgnore] [DisplayName("Display Coordinates")] [Description("Shows player position, angle, velocity, and distance travelled per frame. Color indicates movement tiers: green - SR40, blue - SR50, red - turbo/wallrun.\n\nAvailable in vanilla via the IDMYPOS cheat code, however vanilla only shows angle, X, and Y.")] [DefaultValue(false)] public bool DisplayCoordinates { get; set; } + [JsonIgnore] [DisplayName("Display Commands")] [Description("Shows input history on the screen. History size is 10, empty commands are excluded.")] [DefaultValue(false)] public bool DisplayCommands { get; set; } + [JsonIgnore] [DisplayName("Automap Totals")] [Description("Shows counts for kills, items, and secrets on automap.")] [DefaultValue(false)] public bool MapTotals { get; set; } + [JsonIgnore] [DisplayName("Automap Time")] [Description("Shows elapsed time on automap.")] [DefaultValue(false)] public bool MapTime { get; set; } + [JsonIgnore] [DisplayName("Automap Coordinates")] [Description("Shows in-level coordinates on automap.")] [DefaultValue(false)] public bool MapCoordinates { get; set; } + [JsonIgnore] [DisplayName("Automap Overlay")] [Description("Shows automap on top of gameplay.")] [DefaultValue(MapOverlays.Disabled)] public MapOverlays MapOverlay { get; set; } + [JsonIgnore] [DisplayName("Automap Details")] [Description("Exposes all linedefs and things.\n\nAvailable in vanilla via the IDDT cheat code.")] [DefaultValue(MapDetail.Normal)] @@ -255,7 +266,6 @@ namespace BizHawk.Emulation.Cores.Computers.Doom if (_settings.DisplayPlayer == 2 && !_syncSettings.Player2Present) throw new Exception($"Trying to set display player '{_settings.DisplayPlayer}' but it is not active in this movie."); if (_settings.DisplayPlayer == 3 && !_syncSettings.Player3Present) throw new Exception($"Trying to set display player '{_settings.DisplayPlayer}' but it is not active in this movie."); if (_settings.DisplayPlayer == 4 && !_syncSettings.Player4Present) throw new Exception($"Trying to set display player '{_settings.DisplayPlayer}' but it is not active in this movie."); - _settings.DoUpdate = true; return ret; } diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.IStatable.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.IStatable.cs index 6c80ae509c..03fadc00fc 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.IStatable.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.IStatable.cs @@ -12,15 +12,15 @@ namespace BizHawk.Emulation.Cores.Computers.Doom { _elf.LoadStateBinary(reader); - _turnHeld[0] = reader.ReadInt32(); - _turnHeld[1] = reader.ReadInt32(); - _turnHeld[2] = reader.ReadInt32(); - _turnHeld[3] = reader.ReadInt32(); - _turnCarry = reader.ReadInt32(); - - Frame = reader.ReadInt32(); - LagCount = reader.ReadInt32(); - IsLagFrame = reader.ReadBoolean(); + _turnHeld[0] = reader.ReadInt32(); + _turnHeld[1] = reader.ReadInt32(); + _turnHeld[2] = reader.ReadInt32(); + _turnHeld[3] = reader.ReadInt32(); + _turnCarry = reader.ReadInt32(); + _lastGammaInput = reader.ReadBoolean(); + Frame = reader.ReadInt32(); + LagCount = reader.ReadInt32(); + IsLagFrame = reader.ReadBoolean(); // any managed pointers that we sent to the core need to be resent now! UpdateVideo(); @@ -35,7 +35,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom writer.Write(_turnHeld[2]); writer.Write(_turnHeld[3]); writer.Write(_turnCarry); - + writer.Write(_lastGammaInput); writer.Write(Frame); writer.Write(LagCount); writer.Write(IsLagFrame); diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs index d265bc8d73..f08bffc543 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs @@ -107,6 +107,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom + $"dsda_command_display { (_settings.DisplayCommands ? 1 : 0)}\n" + $"render_wipescreen { (_syncSettings.RenderWipescreen ? 1 : 0)}\n" + "render_stretchsky 0\n" + + "boom_translucent_sprites 0\n" + "render_doom_lightmaps 1\n" + "render_aspect 3\n" // 4:3, controls FOV on higher resolutions (see SetRatio() in the core) + "render_stretch_hud 0\n" @@ -228,6 +229,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom private readonly byte[] _configFile; private int[] _turnHeld = [ 0, 0, 0, 0 ]; private int _turnCarry = 0; // Chocolate Doom mouse behaviour (enabled in upstream by default) + private bool _lastGammaInput = false; private List _args; private List _wadFiles; private LibDSDA.GameMode _gameMode; diff --git a/src/BizHawk.Emulation.Cores/Computers/Doom/LibDSDA.cs b/src/BizHawk.Emulation.Cores/Computers/Doom/LibDSDA.cs index a3d0729c33..33469b3e0b 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Doom/LibDSDA.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Doom/LibDSDA.cs @@ -59,7 +59,6 @@ namespace BizHawk.Emulation.Cores.Computers.Doom [StructLayout(LayoutKind.Sequential)] public struct PackedRenderInfo { - public int DoUpdate; public int RenderVideo; public int RenderAudio; public int SfxVolume; diff --git a/waterbox/dsda/BizhawkInterface.c b/waterbox/dsda/BizhawkInterface.c index f78f6181f1..f62b88a53a 100644 --- a/waterbox/dsda/BizhawkInterface.c +++ b/waterbox/dsda/BizhawkInterface.c @@ -2,56 +2,13 @@ bool foundIWAD = false; bool wipeDone = true; -CommonButtons last_buttons = { 0 }; +AutomapButtons last_buttons = { 0 }; void render_updates(struct PackedRenderInfo *renderInfo) { - if (renderInfo->DoUpdate) + if (renderInfo->Gamma != dsda_IntConfig(dsda_config_usegamma)) { - if (renderInfo->Gamma != dsda_IntConfig(dsda_config_usegamma)) - { - dsda_UpdateIntConfig(dsda_config_usegamma, renderInfo->Gamma, true); - dsda_AddMessage(usegamma == 0 ? GAMMALVL0 : - usegamma == 1 ? GAMMALVL1 : - usegamma == 2 ? GAMMALVL2 : - usegamma == 3 ? GAMMALVL3 : - GAMMALVL4); - } - - if (renderInfo->MapOverlay != dsda_IntConfig(dsda_config_automap_overlay)) - { - dsda_UpdateIntConfig(dsda_config_automap_overlay, renderInfo->MapOverlay, true); - dsda_AddMessage(automap_overlay == 0 ? AMSTR_OVERLAYOFF : - automap_overlay == 1 ? AMSTR_OVERLAYON : - "Overlay Mode Dark"); - } - - if (renderInfo->ShowMessages != dsda_ShowMessages()) - dsda_UpdateIntConfig(dsda_config_show_messages, renderInfo->ShowMessages, true); - - dsda_UpdateIntConfig(dsda_config_screenblocks, renderInfo->HeadsUpMode != HUD_VANILLA ? 11 : 10, true); - dsda_UpdateIntConfig(dsda_config_hud_displayed, renderInfo->HeadsUpMode == HUD_NONE ? 0 : 1, true); - dsda_UpdateIntConfig(dsda_config_sfx_volume, renderInfo->SfxVolume, true); - dsda_UpdateIntConfig(dsda_config_music_volume, renderInfo->MusicVolume, true); - dsda_UpdateIntConfig(dsda_config_hudadd_secretarea, renderInfo->ReportSecrets, true); - dsda_UpdateIntConfig(dsda_config_exhud, renderInfo->DsdaExHud, true); - dsda_UpdateIntConfig(dsda_config_coordinate_display, renderInfo->DisplayCoordinates, true); - dsda_UpdateIntConfig(dsda_config_command_display, renderInfo->DisplayCommands, true); - dsda_UpdateIntConfig(dsda_config_map_totals, renderInfo->MapTotals, true); - dsda_UpdateIntConfig(dsda_config_map_time, renderInfo->MapTime, true); - dsda_UpdateIntConfig(dsda_config_map_coordinates, renderInfo->MapCoordinates, true); - } -} - -void common_input(CommonButtons buttons) -{ - static int bigstate = 0; - m_paninc.y = 0; - m_paninc.x = 0; - - if (buttons.ChangeGamma && !last_buttons.ChangeGamma) - { - dsda_CycleConfig(dsda_config_usegamma, true); + dsda_UpdateIntConfig(dsda_config_usegamma, renderInfo->Gamma, true); dsda_AddMessage(usegamma == 0 ? GAMMALVL0 : usegamma == 1 ? GAMMALVL1 : usegamma == 2 ? GAMMALVL2 : @@ -59,6 +16,36 @@ void common_input(CommonButtons buttons) GAMMALVL4); } + if (renderInfo->MapOverlay != dsda_IntConfig(dsda_config_automap_overlay)) + { + dsda_UpdateIntConfig(dsda_config_automap_overlay, renderInfo->MapOverlay, true); + dsda_AddMessage(automap_overlay == 0 ? AMSTR_OVERLAYOFF : + automap_overlay == 1 ? AMSTR_OVERLAYON : + "Overlay Mode Dark"); + } + + if (renderInfo->ShowMessages != dsda_ShowMessages()) + dsda_UpdateIntConfig(dsda_config_show_messages, renderInfo->ShowMessages, true); + + dsda_UpdateIntConfig(dsda_config_screenblocks, renderInfo->HeadsUpMode != HUD_VANILLA ? 11 : 10, true); + dsda_UpdateIntConfig(dsda_config_hud_displayed, renderInfo->HeadsUpMode == HUD_NONE ? 0 : 1, true); + dsda_UpdateIntConfig(dsda_config_sfx_volume, renderInfo->SfxVolume, true); + dsda_UpdateIntConfig(dsda_config_music_volume, renderInfo->MusicVolume, true); + dsda_UpdateIntConfig(dsda_config_hudadd_secretarea, renderInfo->ReportSecrets, true); + dsda_UpdateIntConfig(dsda_config_exhud, renderInfo->DsdaExHud, true); + dsda_UpdateIntConfig(dsda_config_coordinate_display, renderInfo->DisplayCoordinates, true); + dsda_UpdateIntConfig(dsda_config_command_display, renderInfo->DisplayCommands, true); + dsda_UpdateIntConfig(dsda_config_map_totals, renderInfo->MapTotals, true); + dsda_UpdateIntConfig(dsda_config_map_time, renderInfo->MapTime, true); + dsda_UpdateIntConfig(dsda_config_map_coordinates, renderInfo->MapCoordinates, true); +} + +void automap_inputs(AutomapButtons buttons) +{ + static int bigstate = 0; + m_paninc.y = 0; + m_paninc.x = 0; + if (buttons.AutomapToggle && !last_buttons.AutomapToggle) { if (automap_active) @@ -196,14 +183,14 @@ ECL_EXPORT void dsda_get_video(int *w, int *h, int *pitch, uint8_t **buffer, int *paletteBuffer = _convertedPaletteBuffer; } -ECL_EXPORT bool dsda_frame_advance(CommonButtons commonButtons, struct PackedPlayerInput *player1Inputs, struct PackedPlayerInput *player2Inputs, struct PackedPlayerInput *player3Inputs, struct PackedPlayerInput *player4Inputs, struct PackedRenderInfo *renderInfo) +ECL_EXPORT bool dsda_frame_advance(AutomapButtons buttons, struct PackedPlayerInput *player1Inputs, struct PackedPlayerInput *player2Inputs, struct PackedPlayerInput *player3Inputs, struct PackedPlayerInput *player4Inputs, struct PackedRenderInfo *renderInfo) { // On-the-fly render changes render_updates(renderInfo); // Setting inputs headlessClearTickCommand(); - common_input(commonButtons); + automap_inputs(buttons); dsda_reveal_map = renderInfo->MapDetails; diff --git a/waterbox/dsda/BizhawkInterface.h b/waterbox/dsda/BizhawkInterface.h index 6993058d38..992b3e4571 100644 --- a/waterbox/dsda/BizhawkInterface.h +++ b/waterbox/dsda/BizhawkInterface.h @@ -112,7 +112,6 @@ typedef union { struct { - bool ChangeGamma:1; bool AutomapToggle:1; bool AutomapZoomIn:1; bool AutomapZoomOut:1; @@ -127,7 +126,7 @@ typedef union bool AutomapClearMarks:1; }; uint32_t data; -} CommonButtons; +} AutomapButtons; struct InitSettings { @@ -158,7 +157,6 @@ struct PackedPlayerInput struct PackedRenderInfo { - int DoUpdate; int RenderVideo; int RenderAudio; int SfxVolume;