Skip to content

Commit 302983b

Browse files
committed
dos: output and accept .hdd
fix filename report for CD swapping restore 4sec message duration for swaps (there's no way to read it for long filenames otherwise)
1 parent 3df637a commit 302983b

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

src/BizHawk.Client.Common/RomLoader.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ private void LoadOther(
454454
".exe" => VSystemID.Raw.PSX,
455455
".nsf" => VSystemID.Raw.NES,
456456
".gbs" => VSystemID.Raw.GB,
457+
".hdd" => VSystemID.Raw.DOS,
457458
_ => rom.GameInfo.System,
458459
};
459460

@@ -1002,7 +1003,7 @@ private static class RomFileExtensions
10021003

10031004
public static readonly IReadOnlyCollection<string> Doom = new[] { "wad" };
10041005

1005-
public static readonly IReadOnlyCollection<string> DOS = new[] { "ima", "img", "xdf", "dmf", "fdd", "fdi", "nfd", "d88" };
1006+
public static readonly IReadOnlyCollection<string> DOS = new[] { "ima", "img", "xdf", "dmf", "fdd", "fdi", "nfd", "d88", "hdd" };
10061007

10071008
public static readonly IReadOnlyCollection<string> GB = new[] { "gb", "gbc", "sgb" };
10081009

src/BizHawk.Client.EmuHawk/MainForm.VSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ private void DOSSExportHddMenuItem_Click(object sender, EventArgs e)
389389
{
390390
var result = this.ShowFileSaveDialog(
391391
discardCWDChange: true,
392-
fileExt: "bin",
392+
fileExt: "hdd",
393393
filter: DOSBoxHDDImageFilterSet,
394394
initDir: Config.PathEntries.ToolsAbsolutePath());
395395
if (result is not null)

src/BizHawk.Emulation.Cores/Computers/DOS/DOSBox.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public sealed partial class DOSBox : WaterboxCore
3737
private LibDOSBox _libDOSBox;
3838
private readonly List<IRomAsset> _romAssets;
3939
private readonly List<IDiscAsset> _discAssets;
40+
private const int _messageDuration = 4;
4041

4142
// Drive management variables
4243
private List<IRomAsset> _floppyDiskImageFiles = new List<IRomAsset>();
@@ -48,6 +49,7 @@ public sealed partial class DOSBox : WaterboxCore
4849
private bool _disposed;
4950

5051
private string GetFullName(IRomAsset rom) => Path.GetFileName(rom.RomPath.SubstringAfter('|'));
52+
private string GetFullName(IDiscAsset disk) => Path.GetFileName(disk.DiscData.Name.SubstringAfter('|'));
5153

5254
// CD Handling logic
5355
private List<string> _cdRomFileNames = new List<string>();
@@ -82,7 +84,7 @@ public DOSBox(CoreLoadParameters<object, SyncSettings> lp)
8284
_floppyDiskImageFiles.Add(file);
8385
break;
8486

85-
case ".bin":
87+
case ".hdd":
8688
_hardDiskImageFile = file;
8789
break;
8890

@@ -131,7 +133,7 @@ public DOSBox(CoreLoadParameters<object, SyncSettings> lp)
131133

132134
// Getting disc data structure
133135
var CDDataStruct = GetCDDataStruct(_discAssets[discIdx].DiscData);
134-
Console.WriteLine($"[CD] Adding Disc {discIdx}: '{_discAssets[discIdx].DiscName}' as '{cdRomFileName}' with sector count: {CDDataStruct.End}, track count: {CDDataStruct.Last}.");
136+
Console.WriteLine($"[CD] Adding Disc {discIdx}: '{GetFullName(_discAssets[discIdx])}' as '{cdRomFileName}' with sector count: {CDDataStruct.End}, track count: {CDDataStruct.Last}.");
135137

136138
// Adding file name to list
137139
_cdRomFileNames.Add(cdRomFileName);
@@ -451,20 +453,20 @@ protected override LibWaterboxCore.FrameInfo FrameAdvancePrep(IController contro
451453
if (!_isPrevFloppyDiskPressed && controller.IsPressed(Inputs.PrevFloppyDisk))
452454
{
453455
_currentFloppyDisk = _currentFloppyDisk == 0 ? _floppyDiskCount - 1 : _currentFloppyDisk - 1;
454-
CoreComm.Notify($"Selected {FileNames.FD}{_currentFloppyDisk}: {Path.GetFileName(_floppyDiskImageFiles[_currentFloppyDisk].RomPath)}", null);
456+
CoreComm.Notify($"Selected {FileNames.FD}{_currentFloppyDisk}: {GetFullName(_floppyDiskImageFiles[_currentFloppyDisk])}", _messageDuration);
455457
}
456458

457459
if (!_isNextFloppyDiskPressed && controller.IsPressed(Inputs.NextFloppyDisk))
458460
{
459461
_currentFloppyDisk = (_currentFloppyDisk + 1) % _floppyDiskCount;
460-
CoreComm.Notify($"Selected {FileNames.FD}{_currentFloppyDisk}: {Path.GetFileName(_floppyDiskImageFiles[_currentFloppyDisk].RomPath)}", null);
462+
CoreComm.Notify($"Selected {FileNames.FD}{_currentFloppyDisk}: {GetFullName(_floppyDiskImageFiles[_currentFloppyDisk])}", _messageDuration);
461463
}
462464

463465
// Processing floppy disk swapping
464466
if (!_isSwapFloppyDiskPressed && controller.IsPressed(Inputs.SwapFloppyDisk))
465467
{
466468
fi.DriveActions.InsertFloppyDisk = _currentFloppyDisk;
467-
CoreComm.Notify($"Insterted {FileNames.FD}{_currentFloppyDisk}: {Path.GetFileName(_floppyDiskImageFiles[_currentFloppyDisk].RomPath)} into drive A:", null);
469+
CoreComm.Notify($"Insterted {FileNames.FD}{_currentFloppyDisk}: {GetFullName(_floppyDiskImageFiles[_currentFloppyDisk])} into drive A:", _messageDuration);
468470
}
469471
}
470472

@@ -475,20 +477,20 @@ protected override LibWaterboxCore.FrameInfo FrameAdvancePrep(IController contro
475477
if (!_isPrevCDROMPressed && controller.IsPressed(Inputs.PrevCDROM))
476478
{
477479
_currentCDROM = _currentCDROM == 0 ? _cdRomFileNames.Count - 1 : _currentCDROM - 1;
478-
CoreComm.Notify($"Selected {FileNames.CD}{_currentCDROM}: {_cdRomFileNames[_currentCDROM]}", null);
480+
CoreComm.Notify($"Selected {FileNames.CD}{_currentCDROM}: {GetFullName(_discAssets[_currentCDROM])}", _messageDuration);
479481
}
480482

481483
if (!_isNextCDROMPressed && controller.IsPressed(Inputs.NextCDROM))
482484
{
483485
_currentCDROM = (_currentCDROM + 1) % _cdRomFileNames.Count;
484-
CoreComm.Notify($"Selected {FileNames.CD}{_currentCDROM}: {_cdRomFileNames[_currentCDROM]}", null);
486+
CoreComm.Notify($"Selected {FileNames.CD}{_currentCDROM}: {GetFullName(_discAssets[_currentCDROM])}", _messageDuration);
485487
}
486488

487489
// Processing CDROM disk swapping
488490
if (!_isSwapCDROMPressed && controller.IsPressed(Inputs.SwapCDROM))
489491
{
490492
fi.DriveActions.InsertCDROM = _currentCDROM;
491-
CoreComm.Notify($"Insterted {FileNames.CD}{_currentCDROM}: {_cdRomFileNames[_currentCDROM]} into drive D:", null);
493+
CoreComm.Notify($"Insterted {FileNames.CD}{_currentCDROM}: {GetFullName(_discAssets[_currentCDROM])} into drive D:", _messageDuration);
492494
}
493495
}
494496

0 commit comments

Comments
 (0)