Skip to content

Commit 004a6b3

Browse files
Reverting changes to gui
1 parent 1408e7c commit 004a6b3

File tree

3 files changed

+16
-82
lines changed

3 files changed

+16
-82
lines changed

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

+6-12
Original file line numberDiff line numberDiff line change
@@ -954,12 +954,9 @@ private void Ti83PaletteMenuItem_Click(object sender, EventArgs e)
954954
_ => DialogResult.None,
955955
};
956956
if (result.IsOk()) AddOnScreenMessage("Palette settings saved");
957-
}
958-
959-
private static readonly FilesystemFilterSet DOSBoxHDDImageFilterSet = new(new FilesystemFilter("DOSBox HDD Images", new[] { "bin" }))
960-
{
961-
AppendAllFilesEntry = false,
962-
};
957+
}
958+
959+
963960

964961
private static readonly FilesystemFilterSet ZXStateFilesFSFilterSet = new(new FilesystemFilter("ZX-State files", new[] { "szx" }))
965962
{
@@ -1197,12 +1194,9 @@ ToolStripMenuItemEx CreateCoreSubmenu(VSystemCategory cat, string coreName, para
11971194
items.Add(CreateCoreSubmenu(VSystemCategory.Handhelds, CoreNames.Cygne, CreateGenericCoreConfigItem<WonderSwan>(CoreNames.Cygne)));
11981195

11991196
// DOSBox
1200-
var dosboxExportHDDItem = CreateSettingsItem("Export Hard Disk Drive...", N64CircularAnalogRangeMenuItem_Click);
1201-
var dosboxSubmenu = CreateCoreSubmenu(VSystemCategory.PCs, CoreNames.DOSBox, CreateGenericCoreConfigItem<DOSBox>(CoreNames.DOSBox));
1202-
dosboxSubmenu.DropDownOpened += (_, _) => dosboxExportHDDItem.Checked = true;
1203-
items.Add(dosboxSubmenu);
1204-
1205-
// DSDA-Doom
1197+
items.Add(CreateCoreSubmenu(VSystemCategory.PCs, CoreNames.DOSBox, CreateGenericCoreConfigItem<DOSBox>(CoreNames.DOSBox)));
1198+
1199+
// DSDA-Doom
12061200
items.Add(CreateCoreSubmenu(VSystemCategory.Other, CoreNames.DSDA, CreateGenericCoreConfigItem<DSDA>(CoreNames.DSDA)));
12071201

12081202
// Emu83

src/BizHawk.Client.EmuHawk/MainForm.cs

+2-59
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@
3535
using BizHawk.Emulation.Cores.Nintendo.NES;
3636
using BizHawk.Emulation.Cores.Nintendo.SNES;
3737

38+
using BizHawk.Emulation.DiscSystem;
39+
3840
using BizHawk.Client.EmuHawk.ToolExtensions;
3941
using BizHawk.Client.EmuHawk.CoreExtensions;
4042
using BizHawk.Client.EmuHawk.CustomControls;
4143
using BizHawk.Common.CollectionExtensions;
4244
using BizHawk.WinForms.Controls;
43-
using BizHawk.Emulation.Cores.Computers.SinclairSpectrum;
4445

4546
namespace BizHawk.Client.EmuHawk
4647
{
@@ -69,17 +70,6 @@ private void MainForm_Load(object sender, EventArgs e)
6970
{
7071
UpdateWindowTitle();
7172

72-
Slot1StatusButton.Tag = SelectSlot1MenuItem.Tag = 1;
73-
Slot2StatusButton.Tag = SelectSlot2MenuItem.Tag = 2;
74-
Slot3StatusButton.Tag = SelectSlot3MenuItem.Tag = 3;
75-
Slot4StatusButton.Tag = SelectSlot4MenuItem.Tag = 4;
76-
Slot5StatusButton.Tag = SelectSlot5MenuItem.Tag = 5;
77-
Slot6StatusButton.Tag = SelectSlot6MenuItem.Tag = 6;
78-
Slot7StatusButton.Tag = SelectSlot7MenuItem.Tag = 7;
79-
Slot8StatusButton.Tag = SelectSlot8MenuItem.Tag = 8;
80-
Slot9StatusButton.Tag = SelectSlot9MenuItem.Tag = 9;
81-
Slot0StatusButton.Tag = SelectSlot0MenuItem.Tag = 10;
82-
8373
{
8474
for (int i = 1; i <= WINDOW_SCALE_MAX; i++)
8575
{
@@ -2881,12 +2871,6 @@ private void ToggleCaptureMouse()
28812871
AddOnScreenMessage($"Capture Mouse {(Config.CaptureMouse ? "enabled" : "disabled")}");
28822872
}
28832873

2884-
private void ToggleStayOnTop()
2885-
{
2886-
TopMost = Config.MainFormStayOnTop = !Config.MainFormStayOnTop;
2887-
AddOnScreenMessage($"Stay on Top {(Config.MainFormStayOnTop ? "enabled" : "disabled")}");
2888-
}
2889-
28902874
private void VsyncMessage()
28912875
{
28922876
AddOnScreenMessage($"Display Vsync set to {(Config.VSync ? "on" : "off")}");
@@ -4798,11 +4782,7 @@ private void StartSingleInstanceServer()
47984782
}
47994783

48004784
// Create pipe and start the async connection wait
4801-
#if NET5_0_OR_GREATER
4802-
_singleInstanceServer = NamedPipeServerStreamAcl.Create(
4803-
#else
48044785
_singleInstanceServer = new NamedPipeServerStream(
4805-
#endif
48064786
"pipe-{84125ACB-F570-4458-9748-321F887FE795}",
48074787
PipeDirection.In,
48084788
1,
@@ -4906,33 +4886,6 @@ private void OpenRetroAchievements()
49064886
private bool _hasXFixes;
49074887
private readonly IntPtr[] _pointerBarriers = new IntPtr[4];
49084888

4909-
private void dOSToolStripMenuItem_Click(object sender, EventArgs e)
4910-
{
4911-
4912-
}
4913-
4914-
private void exportHDDImageToolStripMenuItem_Click(object sender, EventArgs e)
4915-
{
4916-
try
4917-
{
4918-
var result = this.ShowFileSaveDialog(
4919-
discardCWDChange: true,
4920-
fileExt: "bin",
4921-
filter: DOSBoxHDDImageFilterSet,
4922-
initDir: Config.PathEntries.ToolsAbsolutePath());
4923-
if (result is not null)
4924-
{
4925-
var speccy = (DOSBox) Emulator;
4926-
var snap = speccy.getHDDContents();
4927-
File.WriteAllBytes(result, snap);
4928-
}
4929-
}
4930-
catch (Exception)
4931-
{
4932-
// ignored
4933-
}
4934-
}
4935-
49364889
#if false
49374890
private delegate void CaptureWithConfineDelegate(Control control, Control confineWindow);
49384891

@@ -4954,23 +4907,13 @@ private void CaptureMouse(bool wantCapture)
49544907
_presentationPanel.Control.Cursor = Properties.Resources.BlankCursor;
49554908
_cursorHidden = true;
49564909
BringToFront();
4957-
4958-
if (Config.MainFormMouseCaptureForcesTopmost)
4959-
{
4960-
TopMost = true;
4961-
}
49624910
}
49634911
else
49644912
{
49654913
Cursor.Clip = Rectangle.Empty;
49664914
Cursor.Show();
49674915
_presentationPanel.Control.Cursor = Cursors.Default;
49684916
_cursorHidden = false;
4969-
4970-
if (Config.MainFormMouseCaptureForcesTopmost)
4971-
{
4972-
TopMost = Config.MainFormStayOnTop;
4973-
}
49744917
}
49754918

49764919
// Cursor.Clip is a no-op on Linux, so we need this too

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

+8-11
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public DOSBox(CoreLoadParameters<object, SyncSettings> lp)
7575
// Parsing rom files
7676
foreach (var file in _romAssets)
7777
{
78-
switch (Path.GetExtension(file.RomPath))
78+
switch (file.Extension.ToLowerInvariant())
7979
{
8080
case ".ima":
8181
case ".img":
@@ -107,7 +107,10 @@ public DOSBox(CoreLoadParameters<object, SyncSettings> lp)
107107
// If no formatted hard disk size provided, check if provided as ROM
108108
if (_hardDiskImageFileSize == 0 && _hardDiskImageFile != null)
109109
_hardDiskImageFileSize = (ulong) _hardDiskImageFile.FileData.Length;
110-
110+
111+
112+
uint hddRequiredMemory = (uint) ((_hardDiskImageFileSize) / 1024ul);
113+
Console.WriteLine($"Allocating {_hardDiskImageFileSize} bytes = {hddRequiredMemory}kb to host the HDD");
111114

112115
_CDReadCallback = CDRead;
113116
_libDOSBox = PreInit<LibDOSBox>(new WaterboxOptions
@@ -303,6 +306,9 @@ public DOSBox(CoreLoadParameters<object, SyncSettings> lp)
303306
throw new InvalidOperationException("Core rejected the rom!");
304307
}
305308

309+
// Closing HDD read only file now, if opened
310+
if (_hardDiskImageFileSize > 0) _exe.RemoveReadonlyFile(FileNames.HDD);
311+
306312
// Setting framerate, if forced; otherwise, use the default.
307313
// The default is necessary because DOSBox does not populate framerate value on init. Only after the first frame run
308314
if (_syncSettings.forceFPSNumerator > 0 && _syncSettings.forceFPSDenominator > 0)
@@ -604,14 +610,5 @@ private static class FileNames
604610
public const string HDD = "HardDiskDrive";
605611
}
606612

607-
public byte[] getHDDContents()
608-
{
609-
if (_hardDiskImageFileSize == 0) throw new Exception($"Trying to export HDD contents but no HDD was defined");
610-
611-
var hddSize = _libDOSBox.get_hdd_size();
612-
byte[] hddArray = new byte[hddSize];
613-
_libDOSBox.get_hdd(hddArray);
614-
return hddArray;
615-
}
616613
}
617614
}

0 commit comments

Comments
 (0)