dsda: fix settings changes dying on loadstate
handle gamma changes on the hawk side DoUpdate is no longer needed
This commit is contained in:
parent
1ec5d2e81c
commit
8a70238e75
Binary file not shown.
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
|
|||
_turnHeld[2] = reader.ReadInt32();
|
||||
_turnHeld[3] = reader.ReadInt32();
|
||||
_turnCarry = reader.ReadInt32();
|
||||
|
||||
_lastGammaInput = reader.ReadBoolean();
|
||||
Frame = reader.ReadInt32();
|
||||
LagCount = reader.ReadInt32();
|
||||
IsLagFrame = reader.ReadBoolean();
|
||||
|
@ -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);
|
||||
|
|
|
@ -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<string> _args;
|
||||
private List<IRomAsset> _wadFiles;
|
||||
private LibDSDA.GameMode _gameMode;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -2,12 +2,10 @@
|
|||
|
||||
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))
|
||||
{
|
||||
dsda_UpdateIntConfig(dsda_config_usegamma, renderInfo->Gamma, true);
|
||||
|
@ -40,25 +38,14 @@ void render_updates(struct PackedRenderInfo *renderInfo)
|
|||
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)
|
||||
void automap_inputs(AutomapButtons 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_AddMessage(usegamma == 0 ? GAMMALVL0 :
|
||||
usegamma == 1 ? GAMMALVL1 :
|
||||
usegamma == 2 ? GAMMALVL2 :
|
||||
usegamma == 3 ? GAMMALVL3 :
|
||||
GAMMALVL4);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue