dsda: add some freedooms to db

support other aspect ratios (otherwise hires automap looks bad if we only correct aspect in frontend)
This commit is contained in:
feos 2025-05-30 22:34:51 +03:00
parent 83169be667
commit ec65117fdf
9 changed files with 97 additions and 23 deletions

View File

@ -64,4 +64,37 @@ b68140a796f6fd7f3a5d3226a32b93be Hexen (Mac) Doom
c88a2bb3d783e2ad7b599a8e301e099e Hexen (Beta) Doom
876a5a44c7b68f04b3bb9bc7a5bd69d6 Hexen (v1.0 Demo) Doom
b2543a03521365261d0a0f74d5dd90f0 Hexen (v1.0) Doom
abb033caf81e26f12a2103e1fa25453f Hexen (v1.1) Doom
abb033caf81e26f12a2103e1fa25453f Hexen (v1.1) Doom
05859098bf191899903ef343afba369d FreeDM (v0.8) Doom
cbb27c5f3c2c44d34843cf63daa627f6 FreeDM (v0.9) Doom
f37b8b70e1394289a7ec404f67cdec1a FreeDM (v0.10) Doom
bd4f359f1963e388beda014c5548b420 FreeDM (v0.10.1) Doom
d76d3973c075b069ecb4e16dc9eacbb4 FreeDM (v0.11) Doom
77ba9c0f75c32e4a729490688bb99241 FreeDM (v0.11.1) Doom
9352b09ae878dc52c6c18aa38acda6eb FreeDM (v0.11.2) Doom
87ee2494d921633420ce9bdb418127c4 FreeDM (v0.11.3) Doom
3250aad8b1d40fb7b25b7df6573eb29f FreeDM (v0.12.0) Doom
d40c932a9183ded919afa89f4a729668 FreeDM (v0.12.1) Doom
908dfd77a14cc490c4cea94b62d13449 FreeDM (v0.13.0) Doom
e3668912fc37c479b2840516c887018b Freedoom (v0.8) Doom
30095b256dd3a1566bbc30286f72bc47 Ultimate Freedoom (v0.8) Doom
aca90cf5ac36e996edc58bd0329b979a Freedoom: Phase 1 (v0.9) Doom
9b8d72b59fd93b2b3e116149baa1b142 Freedoom: Phase 1 (v0.10) Doom
91de79621a393a08c39a9ab2c034b766 Freedoom: Phase 1 (v0.10.1) Doom
21a4707fc25d29edf4b098bd400c5c42 Freedoom: Phase 1 (v0.11) Doom
35312e99d2473297aabe0602700bee8a Freedoom: Phase 1 (v0.11.1) Doom
6d00c49520be26f08a6bd001814a32ab Freedoom: Phase 1 (v0.11.2) Doom
ea471a3d38fcee0fb3a69bcd3221e335 Freedoom: Phase 1 (v0.11.3) Doom
0c5f8ff45cc3538d368a0f8d8fc11ce3 Freedoom: Phase 1 (v0.12.0) Doom
b36aa44a23045e503c19af4b4c438a78 Freedoom: Phase 1 (v0.12.1) Doom
b93be13d05148dd01614bc205a03648e Freedoom: Phase 1 (v0.13.0) Doom
8fa57dbc7687f84528eba39dde3a20e0 Freedoom: Phase 2 (v0.9) Doom
c5a4f2d38d78b251d8557cb2d93e40ee Freedoom: Phase 2 (v0.10) Doom
dd9c9e73f5f50d3778c85573cd08d9a4 Freedoom: Phase 2 (v0.10.1) Doom
b1018017c61b06e33c11102d8bafaad0 Freedoom: Phase 2 (v0.11) Doom
ec5b38b30ba2b70e278205776af3fbb5 Freedoom: Phase 2 (v0.11.1) Doom
90832a872b5bb0aca4ca0b20419aad5d Freedoom: Phase 2 (v0.11.2) Doom
984f99af08f085e38070f51095ab7c31 Freedoom: Phase 2 (v0.11.3) Doom
83560b2963424fa4a2eb971194428bf8 Freedoom: Phase 2 (v0.12.0) Doom
ca9a4159a7833544a89144c7f5053412 Freedoom: Phase 2 (v0.12.1) Doom
cd666466759b5e5f63af93c5f0ffd0a1 Freedoom: Phase 2 (v0.13.0) Doom

View File

@ -197,7 +197,7 @@ namespace BizHawk.Client.Common
DSDA.DoomSyncSettings syncSettings = new()
{
InputFormat = DSDA.ControllerTypes.Doom,
InputFormat = DSDA.ControllerType.Doom,
CompatibilityLevel = compLevel,
SkillLevel = skill,
InitialEpisode = episode,

View File

@ -18,7 +18,7 @@ namespace BizHawk.Client.Common
Result.Movie.SystemID = VSystemID.Raw.Doom;
DSDA.DoomSyncSettings syncSettings = new()
{
InputFormat = DSDA.ControllerTypes.Heretic,
InputFormat = DSDA.ControllerType.Heretic,
MultiplayerMode = DSDA.MultiplayerMode.Single_Coop,
MonstersRespawn = false,
FastMonsters = false,

View File

@ -18,7 +18,7 @@ namespace BizHawk.Client.Common
Result.Movie.SystemID = VSystemID.Raw.Doom;
DSDA.DoomSyncSettings syncSettings = new()
{
InputFormat = DSDA.ControllerTypes.Hexen,
InputFormat = DSDA.ControllerType.Hexen,
MultiplayerMode = DSDA.MultiplayerMode.Single_Coop,
MonstersRespawn = false,
FastMonsters = false,

View File

@ -40,7 +40,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
// current max raw mouse delta is 180
.AddAxis($"P{port} Mouse Turning", (longtics ? -180 : -128).RangeTo(longtics ? 180 : 127), 0);
if (settings.InputFormat is not ControllerTypes.Doom)
if (settings.InputFormat is not ControllerType.Doom)
{
controller
.AddAxis($"P{port} Fly / Look", (-7).RangeTo(7), 0)
@ -64,7 +64,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
$"P{port} Weapon Select 4",
]);
if (settings.InputFormat is ControllerTypes.Hexen)
if (settings.InputFormat is ControllerType.Hexen)
{
controller.BoolButtons.AddRange([
$"P{port} Jump",

View File

@ -145,12 +145,12 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
if (controller.IsPressed($"P{port} Use")) players[i].Buttons |= (1 << 1);
// Raven Games
if (_syncSettings.InputFormat is not ControllerTypes.Doom)
if (_syncSettings.InputFormat is not ControllerType.Doom)
{
players[i].FlyLook = controller.AxisValue($"P{port} Fly / Look");
players[i].ArtifactUse = controller.AxisValue($"P{port} Use Artifact");
if (_syncSettings.InputFormat is ControllerTypes.Hexen)
if (_syncSettings.InputFormat is ControllerType.Hexen)
{
players[i].Jump = Convert.ToInt32(controller.IsPressed($"P{port} Jump"));
players[i].EndPlayer = Convert.ToInt32(controller.IsPressed($"P{port} End Player"));

View File

@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
{
public partial class DSDA : ISettable<DSDA.DoomSettings, DSDA.DoomSyncSettings>
{
public enum ControllerTypes
public enum ControllerType
{
Doom,
Heretic,
@ -93,6 +93,17 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
Dark = 2
}
public enum AspectRatio
{
Native = 0,
[Display(Name = "16:9")]
_16by9 = 1,
[Display(Name = "16:10")]
_16by10 = 2,
[Display(Name = "4:3")]
_4by3 = 3,
}
public enum TurningResolution : int
{
[Display(Name = "16 bits (longtics)")]
@ -156,6 +167,12 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
[TypeConverter(typeof(ConstrainedIntConverter))]
public int ScaleFactor { get; set; }
[DisplayName("Internal Aspect Ratio")]
[Description("Sets aspect ratio of the rendered screen. 'Native' is multiples of 320x200 with aspect correction (to 4:3) applied by the frontend. Other modes produce pre-corrected image, useful for viewing Automap on higher resolutions (to avoid pixel distortion caused by external aspect correcton).\n\nRequires restart.")]
[DefaultValue(AspectRatio.Native)]
[TypeConverter(typeof(DescribableEnumConverter))]
public AspectRatio InternalAspect { get; set; }
[DisplayName("Sfx Volume")]
[Description("Sound effects volume [0 - 15].")]
[Range(0, 15)]
@ -206,22 +223,22 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
public bool DisplayCommands { get; set; }
[DisplayName("Automap Totals")]
[Description("Shows counts for kills, items, and secrets on automap.")]
[Description("Shows counts for kills, items, and secrets on Automap.")]
[DefaultValue(false)]
public bool MapTotals { get; set; }
[DisplayName("Automap Time")]
[Description("Shows elapsed time on automap.")]
[Description("Shows elapsed time on Automap.")]
[DefaultValue(false)]
public bool MapTime { get; set; }
[DisplayName("Automap Coordinates")]
[Description("Shows in-level coordinates on automap.")]
[Description("Shows in-level coordinates on Automap.")]
[DefaultValue(false)]
public bool MapCoordinates { get; set; }
[DisplayName("Automap Overlay")]
[Description("Shows automap on top of gameplay.")]
[Description("Shows Automap on top of gameplay.")]
[DefaultValue(MapOverlays.Disabled)]
public MapOverlays MapOverlay { get; set; }
@ -246,7 +263,8 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
}
public PutSettingsDirtyBits PutSettings(DoomSettings o)
{
var ret = _settings.ScaleFactor == o.ScaleFactor
var ret = (_settings.ScaleFactor == o.ScaleFactor
&& _settings.InternalAspect == o.InternalAspect)
? PutSettingsDirtyBits.None
: PutSettingsDirtyBits.RebootCore;
_settings = o;
@ -260,11 +278,11 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
[CoreSettings]
public class DoomSyncSettings
{
[DefaultValue(ControllerTypes.Doom)]
[DefaultValue(ControllerType.Doom)]
[DisplayName("Input Format")]
[Description("The format provided for the players' input.")]
[TypeConverter(typeof(DescribableEnumConverter))]
public ControllerTypes InputFormat { get; set; }
public ControllerType InputFormat { get; set; }
[DisplayName("Player 1 Present")]
[Description("Specifies if player 1 is present")]

View File

@ -7,8 +7,8 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
{
private int[] _palBuffer = [ ];
private int[] _vidBuff = [ ];
public int VirtualWidth => BufferHeight * 4 / 3;
public int VirtualHeight => BufferHeight;
public int VirtualWidth => BufferWidth;
public int VirtualHeight { get; private set; }
public int PaletteSize { get; private set; }
public int BufferWidth { get; private set; }
public int BufferHeight { get; private set; }
@ -37,6 +37,10 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
if (_vidBuff.Length < BufferWidth * BufferHeight) _vidBuff = new int[BufferWidth * BufferHeight];
var videoBuffer = (byte*) videoBufferSrc.ToPointer();
for (var i = 0; i < _vidBuff.Length; i++) _vidBuff[i] = _palBuffer[videoBuffer[i]];
VirtualHeight = _settings.InternalAspect == AspectRatio.Native
? BufferWidth * 3 / 4
: BufferHeight;
}
}
}

View File

@ -71,16 +71,28 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
uint totalWadSizeKb = (totalWadSize / 1024) + 1;
Console.WriteLine($"Reserving {totalWadSizeKb}kb for WAD file memory");
var divider = (_settings.InternalAspect == AspectRatio._16by9
|| _settings.InternalAspect == AspectRatio._16by10)
? 3
: 1;
// when passing render_aspect to the core, we need it to treat native as 4:3
// that ensures FOV is correct on higher resolutions
// but when picking resolution we use original AspectRatio value as index
var renderAspect = (int)(_settings.InternalAspect == AspectRatio.Native ? AspectRatio._4by3
: _settings.InternalAspect == AspectRatio._16by9 ? AspectRatio._16by10
: _settings.InternalAspect);
_configFile = Encoding.ASCII.GetBytes(
$"screen_resolution \"{
_nativeResolution.X * _settings.ScaleFactor}x{
_nativeResolution.Y * _settings.ScaleFactor}\"\n"
+ $"render_wipescreen { (_syncSettings.RenderWipescreen ? 1 : 0)}\n"
_resolutions[(int)_settings.InternalAspect].X * _settings.ScaleFactor / divider}x{
_resolutions[(int)_settings.InternalAspect].Y * _settings.ScaleFactor / divider}\"\n"
+ $"render_aspect {renderAspect}\n"
+ $"render_wipescreen {(_syncSettings.RenderWipescreen ? 1 : 0)}\n"
+ "boom_translucent_sprites 0\n"
+ "render_aspect 3\n" // 4:3, controls FOV on higher resolutions (see SetRatio() in the core)
+ "render_stretch_hud 0\n"
+ "uncapped_framerate 0\n"
+ "dsda_show_level_splits 0\n"
+ "render_stretch_hud 1\n"
);
_elf = new WaterboxHost(new WaterboxOptions
@ -213,7 +225,14 @@ namespace BizHawk.Emulation.Cores.Computers.Doom
private readonly WaterboxHost _elf;
private readonly LibDSDA _core;
private readonly LibDSDA.load_archive_cb _loadCallback;
private readonly Point _nativeResolution = new(320, 200);
private readonly Point[] _resolutions =
[
// order must match AspectRatio values since they're used as indices
new(320, 200),
new(1280, 720),
new(1280, 768),
new(320, 240),
];
private readonly int[] _runSpeeds = [ 25, 50 ];
private readonly int[] _strafeSpeeds = [ 24, 40 ];
private readonly int[] _turnSpeeds = [ 640, 1280, 320 ];