dosbox: don't shrink the image

it'd arguably make sense to shrink, if we could downscale it with some smooth algo. this is based on the fact that on a CRT monitor you also see scanlines at fixed thickness (unless you adjust the output) and only width is variable (and depends on pixel density + size of overscan). so upscaling 240p by exactly 2 and then adjusting with made sense on the paper (and it's what we do for CRT encodes). but hawk can't default to a smooth algo, and it can't only apply it on shrink while everything is resized using point. so it's better to just never shrink and let height also be variable. that's kinda what everyone else is doing anyway.
This commit is contained in:
feos 2025-06-05 16:51:58 +03:00
parent c2b767f1f8
commit d09d215aa0
1 changed files with 13 additions and 2 deletions

View File

@ -37,6 +37,10 @@ namespace BizHawk.Emulation.Cores.Computers.DOS
private readonly List<IRomAsset> _romAssets;
private readonly List<IDiscAsset> _discAssets;
private const int _messageDuration = 4;
private const double _wAspect = 4.0;
private const double _hAspect = 3.0;
private int _correctedWidth = LibDOSBox.VGA_MAX_WIDTH;
private int _correctedHeight = LibDOSBox.VGA_MAX_HEIGHT;
// Drive management variables
private List<IRomAsset> _floppyDiskImageFiles = new List<IRomAsset>();
@ -55,7 +59,8 @@ namespace BizHawk.Emulation.Cores.Computers.DOS
private Dictionary<string, DiscSectorReader> _cdRomFileToReaderMap = new Dictionary<string, DiscSectorReader>();
private readonly LibDOSBox.CDReadCallback _CDReadCallback;
public override int VirtualWidth => BufferHeight * 4 / 3;
public override int VirtualWidth => _correctedWidth;
public override int VirtualHeight => _correctedHeight;
// Image selection / swapping variables
@ -537,6 +542,12 @@ namespace BizHawk.Emulation.Cores.Computers.DOS
{
DriveLightOn = _libDOSBox.GetDriveActivityFlag();
// never shrink the virtual buffer
_correctedHeight = BufferWidth > BufferHeight * _wAspect / _hAspect
? (int)Math.Round(BufferWidth * _hAspect / _wAspect)
: BufferHeight;
_correctedWidth = (int)Math.Round(VirtualHeight * _wAspect / _hAspect);
// Checking refresh rate base on the reported refresh rate updates
var currentRefreshRateNumerator = VsyncNumerator;
var currentRefreshRateDenominator = VsyncDenominator;