Skip to content

Commit 1937420

Browse files
committed
dsda: expose huds and automap stats
make settings changes require reboot explicitly. unsure if I still want them to have immediate effect
1 parent ebbdc1a commit 1937420

File tree

3 files changed

+66
-18
lines changed

3 files changed

+66
-18
lines changed

src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.ISettable.cs

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ public enum SkillLevel : int
6565
NM = 5
6666
}
6767

68+
public enum HudMode : int
69+
{
70+
Vanilla = 0,
71+
DSDA = 1,
72+
None = 2
73+
}
74+
6875
public enum TurningResolution : int
6976
{
7077
[Display(Name = "16 bits (longtics)")]
@@ -139,15 +146,40 @@ public class DoomSettings
139146
[DefaultValue(1)]
140147
[TypeConverter(typeof(ConstrainedIntConverter))]
141148
public int DisplayPlayer { get; set; }
149+
150+
[DisplayName("HUD Mode")]
151+
[Description("Sets heads-up display mode.")]
152+
[DefaultValue(HudMode.Vanilla)]
153+
public HudMode HeadsUpMode { get; set; }
154+
155+
[DisplayName("Extended HUD")]
156+
[Description("Shows DSDA-Doom-specific information above vanilla heads-up-display.")]
157+
[DefaultValue(false)]
158+
public bool DsdaExHud { get; set; }
159+
160+
[DisplayName("Automap Totals")]
161+
[Description("Shows counts for kills, items, and secrets on automap.")]
162+
[DefaultValue(true)]
163+
public bool MapTotals { get; set; }
164+
165+
[DisplayName("Automap Time")]
166+
[Description("Shows elapsed time on automap.")]
167+
[DefaultValue(true)]
168+
public bool MapTime { get; set; }
169+
170+
[DisplayName("Automap Coordinates")]
171+
[Description("Shows in-level coordinates on automap.")]
172+
[DefaultValue(true)]
173+
public bool MapCoordinates { get; set; }
142174

143175
public DoomSettings()
144176
=> SettingsUtil.SetDefaultValues(this);
145177

146178
public DoomSettings Clone()
147-
=> (DoomSettings) MemberwiseClone();
179+
=> (DoomSettings)MemberwiseClone();
148180

149181
public static bool NeedsReboot(DoomSettings x, DoomSettings y)
150-
=> false;
182+
=> !DeepEquality.DeepEquals(x, y);
151183
}
152184
public PutSettingsDirtyBits PutSettings(DoomSettings o)
153185
{
@@ -322,14 +354,12 @@ public CInterface.InitSettings GetNativeSettings(GameInfo game)
322354
Player2Present = Player2Present ? 1 : 0,
323355
Player3Present = Player3Present ? 1 : 0,
324356
Player4Present = Player4Present ? 1 : 0,
325-
Player1Class = (int) Player1Class,
326-
Player2Class = (int) Player2Class,
327-
Player3Class = (int) Player3Class,
328-
Player4Class = (int) Player4Class,
357+
Player1Class = (int)Player1Class,
358+
Player2Class = (int)Player2Class,
359+
Player3Class = (int)Player3Class,
360+
Player4Class = (int)Player4Class,
329361
PreventLevelExit = PreventLevelExit ? 1 : 0,
330362
PreventGameEnd = PreventGameEnd ? 1 : 0
331-
// MouseRunSensitivity is handled at Bizhawk level
332-
// MouseTurnSensitivity is handled at Bizhawk level
333363
};
334364
}
335365

src/BizHawk.Emulation.Cores/Computers/Doom/DSDA.cs

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,38 @@ public DSDA(CoreLoadParameters<DoomSettings, DoomSyncSettings> lp)
7373
uint totalWadSizeKb = (totalWadSize / 1024) + 1;
7474
Console.WriteLine($"Reserving {totalWadSizeKb}kb for WAD file memory");
7575

76-
_configFile = Encoding.ASCII.GetBytes($"screen_resolution \"{
76+
string hudMode = "";
77+
78+
switch (_settings.HeadsUpMode)
79+
{
80+
case HudMode.Vanilla:
81+
hudMode = "screenblocks 10\nhud_displayed 1\n";
82+
break;
83+
case HudMode.DSDA:
84+
hudMode = "screenblocks 11\nhud_displayed 1\n";
85+
break;
86+
case HudMode.None:
87+
hudMode = "screenblocks 11\nhud_displayed 0\n";
88+
break;
89+
}
90+
91+
_configFile = Encoding.ASCII.GetBytes(
92+
hudMode
93+
+ $"screen_resolution \"{
7794
_nativeResolution.X * _settings.ScaleFactor}x{
7895
_nativeResolution.Y * _settings.ScaleFactor}\"\n"
7996
+ $"usegamma {_settings.Gamma}\n"
8097
+ $"render_wipescreen {(_syncSettings.RenderWipescreen ? 1 : 0)}\n"
81-
+ "render_aspect 3\n" // 4:3, controls FOV on higher resolutions (see SetRatio())
82-
+ "render_stretch_hud 0\n"
98+
+ $"dsda_exhud {(_settings.DsdaExHud ? 1 : 0)}\n"
99+
+ $"map_totals {(_settings.MapTotals ? 1 : 0)}\n"
100+
+ $"map_time {(_settings.MapTime ? 1 : 0)}\n"
101+
+ $"map_coordinates {(_settings.MapCoordinates ? 1 : 0)}\n"
83102
+ "render_stretchsky 0\n"
84103
+ "render_doom_lightmaps 1\n"
85-
+ "dsda_exhud 0\n"
104+
+ "render_aspect 3\n" // 4:3, controls FOV on higher resolutions (see SetRatio())
105+
+ "render_stretch_hud 0\n"
86106
+ "uncapped_framerate 0\n"
87-
+ "map_coordinates 0\n"
88-
+ "map_totals 0\n"
89-
+ "map_time 0\n"
107+
+ "dsda_show_level_splits 0\n"
90108
);
91109

92110
_elf = new WaterboxHost(new WaterboxOptions

src/BizHawk.Emulation.Cores/Computers/Doom/LibDSDA.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ public enum GameMode : int
2323
Indetermined = 1 << 4 // no IWAD found.
2424
}
2525

26-
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
27-
public delegate int load_archive_cb(string filename, IntPtr buffer, int maxsize);
28-
2926
[StructLayout(LayoutKind.Sequential)]
3027
public struct InitSettings
3128
{
@@ -86,6 +83,9 @@ public abstract bool dsda_frame_advance(
8683
[BizImport(CallingConvention.Cdecl)]
8784
public abstract void dsda_get_video(out int w, out int h, out int pitch, ref IntPtr buffer, out int palSize, ref IntPtr palBuffer);
8885

86+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
87+
public delegate int load_archive_cb(string filename, IntPtr buffer, int maxsize);
88+
8989
[BizImport(CallingConvention.Cdecl)]
9090
public abstract int dsda_add_wad_file(
9191
string fileName,

0 commit comments

Comments
 (0)