Adding report on video refresh rate update

This commit is contained in:
Sergio Martin 2025-04-13 10:53:26 +02:00
parent 27ef76ba1a
commit ced12c51b4
2 changed files with 30 additions and 1 deletions

View File

@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -41,6 +42,11 @@ namespace BizHawk.Emulation.Cores.Computers.DOS
private int _floppyDiskCount = 0; private int _floppyDiskCount = 0;
private int _currentFloppyDisk = 0; private int _currentFloppyDisk = 0;
private int _currentCDROM = 0; private int _currentCDROM = 0;
// VGA Refresh rate info
private ulong _VGARefreshRateNumerator = LibDOSBox.VIDEO_NUMERATOR_DOS;
private ulong _VGARefreshRateDenominator = LibDOSBox.VIDEO_DENOMINATOR_DOS;
private string GetFullName(IRomAsset rom) => rom.Game.Name + rom.Extension; private string GetFullName(IRomAsset rom) => rom.Game.Name + rom.Extension;
public override int VirtualWidth => BufferHeight * 4 / 3; public override int VirtualWidth => BufferHeight * 4 / 3;
@ -442,6 +448,21 @@ namespace BizHawk.Emulation.Cores.Computers.DOS
protected override void FrameAdvancePost() protected override void FrameAdvancePost()
{ {
DriveLightOn = _libDOSBox.getDriveActivityFlag(); DriveLightOn = _libDOSBox.getDriveActivityFlag();
// Checking on VGA refresh rate updates
var currentVGARefreshRateNumerator = _VGARefreshRateNumerator;
var currentVGARefreshRateDenominator = _VGARefreshRateDenominator;
_VGARefreshRateNumerator = _libDOSBox.getVGARefreshRateNumerator();
_VGARefreshRateDenominator = _libDOSBox.getVGARefreshRateDenominator();
// If it changed, notify now
if (currentVGARefreshRateNumerator != _VGARefreshRateNumerator || currentVGARefreshRateDenominator != _VGARefreshRateDenominator)
{
double newVGARefreshRate = (double) _VGARefreshRateNumerator / _VGARefreshRateDenominator;
CoreComm.Notify($"VGA Refresh Rate changed to: {_VGARefreshRateNumerator} / {_VGARefreshRateDenominator} = {newVGARefreshRate} Hz", null);
Console.WriteLine($"VGA Refresh Rate changed to: {_VGARefreshRateNumerator} / {_VGARefreshRateDenominator} = {newVGARefreshRate} Hz", null);
}
} }
protected override void SaveStateBinaryInternal(BinaryWriter writer) protected override void SaveStateBinaryInternal(BinaryWriter writer)

View File

@ -58,6 +58,12 @@ namespace BizHawk.Emulation.Cores.Computers.DOS
[BizImport(CC)] [BizImport(CC)]
public abstract void pushTrackData(int cdIdx, int trackId, CDTrack data); public abstract void pushTrackData(int cdIdx, int trackId, CDTrack data);
[BizImport(CC)]
public abstract ulong getVGARefreshRateNumerator();
[BizImport(CC)]
public abstract ulong getVGARefreshRateDenominator();
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public class InitSettings public class InitSettings
{ {
@ -89,6 +95,8 @@ namespace BizHawk.Emulation.Cores.Computers.DOS
public JoystickButtons joystick1; public JoystickButtons joystick1;
public JoystickButtons joystick2; public JoystickButtons joystick2;
public MouseInput mouse; public MouseInput mouse;
public ulong vgaRefreshRateNumerator;
public ulong vgaRefreshRateDenominator;
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]