Skip to content

Commit 236ff74

Browse files
SergioMartin86YoshiRulzvadosnaprimer
authored
Adding DOSBox as core for DOS TASing (#4217)
* Adding dosbox * Adding placeholder * Adding initial placeholder for DOSBox * update * Update * Update * progress * Progress * Increasing mem capacity * Progress * Now running timer correctly * Progress * Stable * Parsin inputs * Keyboard working * stable before using memfiles * Now accepting rw hdds * Hard disk rw working * Fixing conflict * Getting samples * Reading samples but sounds too low * Reading samples but sounds too low * Now accepting multiple cdrom/floppy images * Allowing swapping * Enabling cdrom and disk swapping * Simplifying * Simplifying * Simplifications * Simplfiications * Capturing sdl delay * Adding configuration presets * Enabling joystick * Enabling joysticks * Added mouse support * Adding mouse support * Progress with hard disk * Adding default hard disk images and making them selectable * Adding mnemonics, more configs, and some refactoring on the standard confs * Processing file extensions * Adding sram * Adding saveram * Adding drive lights * Adding drive lights * Adding memory domains * Removing warnings * Fixing warning * Revert unrelated changes to Multi-Disk Bundler * Re-alphabetise lists and clean up diff * Missed a bit * Make `DOSBox`' `ISaveRam` implementations `override` * Fix `DOSBox`' `[PortedCore]` * Clean up string comparisons in `DOSBox` ctor * Set values for `WriteableHardDiskOptions` instead of translating * Clean up reading of DOSBox config presets from embedded resources * Fix code style warning * Removing duped line * Fixing extension parsing * Small adjustments * Aligning fps to that of normal DOS * Aligning fps to that of normal DOS * Simplified extension getting and adding base config file resource * Remove unused import * Properly measuring extended mem size * Adding more settings and simplifying machine presets * Adding check for SRAM size to prevent wrong-sized HD being loaded * Removing unnecessary directive * Update correct DOS framerate * Adding sensible configuration presets * Adding to the config preset description text * Update src/BizHawk.Emulation.Common/Base Implementations/Bk2MnemonicLookup.cs Co-authored-by: feos <[email protected]> * Removing stale config files * Fixed mouse emulation * Fixed mouse emulation * Removing unused keyboard flag * Addressing feos' comment about virtual height/width * Fixed bug with saveram * fix VirtualWidth scanlines remain constant so they aren't stretched, and width is adjusted to be 4/3 of height, because video modes in DOS were designed for a 4:3 monitor. exact pixel shapes may slightly differ depending on exact pixel clock but setting 4:3 for DOS is standard. * DependentUpon * Making FPS configurable * Making FPS configurable * Adding fps num/denom * Implementing proper fps numerator / denominator defaults for DOS * Passing mouse deltas from bk * Passing mouse deltas from bk to the core * expose and use deltas directly to make it work in hawk, one needs to bind RMouse X/Y for Mouse X/Y Delta in config.ini, by manually editing the file (for now) * Implementing support for .cue+.bin and other cdrom types * Fixing sensitivity * Adjusting mouse sensitivity * Fixing integration for windows * [WIP] loading cds from bk * [WIP] loading cds from bk * Using .cdrom extension for cdroms, and passing disk name to the read callback * Using .cdrom extension for cdroms, and passing disk name to the read callback * Cleanup and fixing .iso loading and swapping * Fixing .iso loading and cdrom swapping * Adding default controllers * Added callback for video updates to prevent tearing * Removing unnecessary message * Fix line endings in `Bk2MnemonicLookup.cs` * Fix indentation * Fix misc. whitespace crimes * Drop redundant `<None Remove/>` * More whitespace fixes * More code style fixes * Small fixes * Fixing misc comments * Adjusting naming * Fixing values * Removing dead code * Clarifying the source of DOS framerate chosen * Removing unused variable * Removing duped assignments * Fixing typo * Removing no-longer required SRAM management * Removing no longer required sram management functions * Removing no-longer needed SRAM logic * Fixing framerates as per feos's comment * Passing init struct for a more tidy initialization. Also fixing identation for good * Fixing hard landing on failure to load SRAM. This is needed to prevent crashes in dosbox when preserving hard disk contents * Added missing submodule and artifact * Reverting unnecessary change * Removing no longer needd dosbox-iso extensions * Removing no-longer necessary virtuals * fix * Adding lines into readme * fixing indentation * Reducing job concurrency for dosbox -- otherwise the server gets overloaded * adding recursive submodule for dosbox-x * Simplifying * Simplifying * Simplifying * Simplifying * Only offer drive switching if more than one drive is present * Adding proper Disc identification for ISO9660 / Joliet (default target DOS) * Adding CDROM case * Moving comments to proper place * Moving comments to proper place * Code style fixes * Clean up handling of Next Disc buttons * Clean up `DOSBoxKeyboard` definition * Remove redundant button mnemonic overrides * remove leftover hack from my initial 2-byte range it's hard to tell from upstream code what the range should be... * Fixing mouse buttons getting stuck and aligning mouse speed minmaxes to what dosbox expects * Removing default framerate for DOS * set mouse speed range to match raw deltas range (see 93bc502) since this makes minimal mouse delta 1 now instead of 2 or 3 (they were different for x and y because ranges were different), I readjusted default sensitivity to match default turning in doom in upsteam * fix casing on public fields we use PublicField, _privateField, and localVariable casing this commit also includes WIP to expose attoseconds like mame does, so that 1 value could be used to determine framerate, and movie parsers won't need too many changes to support DOS framerates * fix num/denom values to match dosbox-x for when it launches into dos video dump info was not super clear so I relied on values that are actually assigned to `fps` in `VGA_SetupDrawing()` TODO: check other machines, update sync settings descriptions when we expose render fps info to user * use an existing thing instead of GetFullName it was copied from uae where I made it because I didn't know about `Path.GetFileName(rom.RomPath)`, it's now fixed in master too increased message duration so user could read potentially long filenames (copied from uae too) * Move init of new `MouseState` to top and eliminate locals * fix naming for mouse states * update submodules * Adding function to get video refresh rate * Adding report on video refresh rate update * Revert "Merge branch 'dosbox' of github.com:SergioMartin86/BizHawk into dosbox" This reverts commit e5b16a6, reversing changes made to ced12c5. * Merge branch 'dosbox' of github.com:SergioMartin86/BizHawk into dosbox * Removing unnecessary directive * Fixing reboot * fps notice formatting * Zero init fps vals * Using variable framerates * Now accepting variable framerates as given by the core * Moving ISO9660 detection lower * Storing refresh rate in savestate -- update it on load if different * fix GetFullName() * Adding function to get number of ran cycles * Adding ICycleTiming * attoseconds are obsolete now * fix loading CDs with spaces in their name * Message duration needs to be left to the user to configure. Just passing a null * Setting notify times back to 4 seconds cause these require a bit more time to read/understand * Updating CycleCount from within wbx * Simplifying cycle timing * Removing FPS change notification, using default waiting times * Updating submodule * Fixing bug in disc swapping * Adding drive selection functionality * fixing period input * Adding logic to present disc swapping operations from repeating when holding the button * added defines for drive id * point submodule to specific branch --------- Co-authored-by: YoshiRulz <[email protected]> Co-authored-by: feos <[email protected]> Co-authored-by: feos <[email protected]>
1 parent 770c295 commit 236ff74

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+5229
-10
lines changed

.github/workflows/waterbox-cores.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
git submodule update --init uae/libretro-uae;
3838
git submodule update --init stella/core;
3939
git submodule update --init dsda/core;
40+
git submodule update --init --recursive dosbox/dosbox-x;
4041
- name: Install clang 18
4142
run: wget https://apt.llvm.org/llvm.sh;
4243
chmod u+x llvm.sh;
@@ -61,6 +62,7 @@ jobs:
6162
Assets/dll/ares64_interpreter.wbx.zst
6263
Assets/dll/ares64_recompiler.wbx.zst
6364
Assets/dll/bsnes.wbx.zst
65+
Assets/dll/dosbox.wbx.zst
6466
Assets/dll/dsda.wbx.zst
6567
Assets/dll/faust.wbx.zst
6668
Assets/dll/gpgx.wbx.zst

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@
8585
[submodule "ExternalProjects/FlooohChips/chips"]
8686
path = ExternalProjects/FlooohChips/chips
8787
url = https://github.com/floooh/chips.git
88+
[submodule "waterbox/dosbox/dosbox-x"]
89+
path = waterbox/dosbox/dosbox-x
90+
url = https://github.com/TASEmulators/dosbox-x.git
91+
branch = wbx
8892
[submodule "waterbox/dsda/core"]
8993
path = waterbox/dsda/core
9094
url = https://github.com/TASEmulators/dsda-doom.git

Assets/defctrl.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,28 @@
11081108
"Mult": 1.0,
11091109
"Deadzone": 0.0
11101110
}
1111+
},
1112+
"DOSBox Controller": {
1113+
"Mouse Position X": {
1114+
"Value": "WMouse X",
1115+
"Mult": 1.0,
1116+
"Deadzone": 0.0
1117+
},
1118+
"Mouse Position Y": {
1119+
"Value": "WMouse Y",
1120+
"Mult": 1.0,
1121+
"Deadzone": 0.0
1122+
},
1123+
"Mouse Speed X": {
1124+
"Value": "RMouse X",
1125+
"Mult": 1.0,
1126+
"Deadzone": 0.0
1127+
},
1128+
"Mouse Speed Y": {
1129+
"Value": "RMouse Y",
1130+
"Mult": 1.0,
1131+
"Deadzone": 0.0
1132+
}
11111133
}
11121134
},
11131135
"AllTrollersFeedbacks": {

Assets/dll/dosbox.wbx.zst

6.24 MB
Binary file not shown.

src/BizHawk.Client.Common/RomLoader.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ void NoCoreForSystem(string sysID)
251251
}
252252
switch (discType)
253253
{
254+
case DiscType.DOS:
255+
game.System = VSystemID.Raw.DOS;
256+
break;
257+
254258
case DiscType.SegaSaturn:
255259
game.System = VSystemID.Raw.SAT;
256260
break;
@@ -998,6 +1002,8 @@ private static class RomFileExtensions
9981002

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

1005+
public static readonly IReadOnlyCollection<string> DOS = new[] { "ima", "img", "xdf", "dmf", "fdd", "fdi", "nfd", "d88" };
1006+
10011007
public static readonly IReadOnlyCollection<string> GB = new[] { "gb", "gbc", "sgb" };
10021008

10031009
public static readonly IReadOnlyCollection<string> GBA = new[] { "gba" };
@@ -1056,6 +1062,7 @@ private static class RomFileExtensions
10561062
.Concat(C64)
10571063
.Concat(Coleco)
10581064
.Concat(Doom)
1065+
.Concat(DOS)
10591066
.Concat(GB)
10601067
.Concat(GBA)
10611068
.Concat(GEN)
@@ -1099,6 +1106,7 @@ private static class RomFileExtensions
10991106
new FilesystemFilter(/*VSystemID.Raw.C64*/"SID Commodore 64 Music File", Array.Empty<string>(), devBuildExtraExts: new[] { "sid" }, devBuildAddArchiveExts: true),
11001107
new FilesystemFilter(/*VSystemID.Raw.Coleco*/"ColecoVision", RomFileExtensions.Coleco, addArchiveExts: true),
11011108
new FilesystemFilter(/*VSystemID.Raw.Doom*/"Doom / Hexen / Heretic WAD File", RomFileExtensions.Doom),
1109+
new FilesystemFilter(/*VSystemID.Raw.DOS*/"DOS", RomFileExtensions.DOS),
11021110
new FilesystemFilter(/*VSystemID.Raw.GB*/"Gameboy", RomFileExtensions.GB.Concat(new[] { "gbs" }).ToList(), addArchiveExts: true),
11031111
new FilesystemFilter(/*VSystemID.Raw.GBA*/"Gameboy Advance", RomFileExtensions.GBA, addArchiveExts: true),
11041112
new FilesystemFilter(/*VSystemID.Raw.GEN*/"Genesis", RomFileExtensions.GEN.Concat(FilesystemFilter.DiscExtensions).ToList(), addArchiveExts: true),

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using BizHawk.Emulation.Cores.Computers.AmstradCPC;
2121
using BizHawk.Emulation.Cores.Computers.AppleII;
2222
using BizHawk.Emulation.Cores.Computers.Commodore64;
23+
using BizHawk.Emulation.Cores.Computers.DOS;
2324
using BizHawk.Emulation.Cores.Computers.Doom;
2425
using BizHawk.Emulation.Cores.Computers.MSX;
2526
using BizHawk.Emulation.Cores.Computers.SinclairSpectrum;
@@ -1192,6 +1193,9 @@ ToolStripMenuItemEx CreateCoreSubmenu(VSystemCategory cat, string coreName, para
11921193
// Cygne
11931194
items.Add(CreateCoreSubmenu(VSystemCategory.Handhelds, CoreNames.Cygne, CreateGenericCoreConfigItem<WonderSwan>(CoreNames.Cygne)));
11941195

1196+
// DOSBox
1197+
items.Add(CreateCoreSubmenu(VSystemCategory.PCs, CoreNames.DOSBox, CreateGenericCoreConfigItem<DOSBox>(CoreNames.DOSBox)));
1198+
11951199
// DSDA-Doom
11961200
items.Add(CreateCoreSubmenu(VSystemCategory.Other, CoreNames.DSDA, CreateGenericCoreConfigItem<DSDA>(CoreNames.DSDA)));
11971201

src/BizHawk.Client.EmuHawk/MainForm.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
using BizHawk.Emulation.Cores;
2929
using BizHawk.Emulation.Cores.Computers.AppleII;
3030
using BizHawk.Emulation.Cores.Computers.Commodore64;
31+
using BizHawk.Emulation.Cores.Computers.DOS;
3132
using BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES;
3233
using BizHawk.Emulation.Cores.Consoles.SNK;
3334
using BizHawk.Emulation.Cores.Nintendo.GBA;
@@ -2024,7 +2025,7 @@ private void LoadSaveRam()
20242025
byte[] sram;
20252026

20262027
// some cores might not know how big the saveram ought to be, so just send it the whole file
2027-
if (Emulator is AppleII or C64 or MGBAHawk or NeoGeoPort or NES { BoardName: "FDS" })
2028+
if (Emulator is AppleII or C64 or DOSBox or MGBAHawk or NeoGeoPort or NES { BoardName: "FDS" })
20282029
{
20292030
sram = File.ReadAllBytes(saveRamPath);
20302031
}

src/BizHawk.Client.EmuHawk/tools/MultiDiskBundler/MultiDiskBundler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public MultiDiskBundler()
3939
VSystemID.Raw.Arcade,
4040
VSystemID.Raw.C64,
4141
VSystemID.Raw.Doom,
42+
VSystemID.Raw.DOS,
4243
VSystemID.Raw.GBL,
4344
VSystemID.Raw.GEN,
4445
VSystemID.Raw.GGL,

src/BizHawk.Emulation.Common/Base Implementations/Bk2MnemonicLookup.cs

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,90 @@ public static string LookupAxis(string button, string systemId)
856856
["Weapon Select 6"] = '6',
857857
["Weapon Select 7"] = '7',
858858
},
859+
[VSystemID.Raw.DOS] = new()
860+
{
861+
["Joystick Button 1"] = '1',
862+
["Joystick Button 2"] = '2',
863+
["Joystick Up"] = 'U',
864+
["Joystick Down"] = 'D',
865+
["Joystick Left"] = 'L',
866+
["Joystick Right"] = 'R',
867+
["Mouse Left Button"] = 'l',
868+
["Mouse Middle Button"] = 'm',
869+
["Mouse Right Button"] = 'r',
870+
["Previous Floppy Disk"] = '<',
871+
["Next Floppy Disk"] = '>',
872+
["Swap Floppy Disk"] = 'v',
873+
["Previous CDROM"] = '{',
874+
["Next CDROM"] = '}',
875+
["Swap CDROM"] = 'w',
876+
["F1"] = 'F',
877+
["F2"] = 'F',
878+
["F3"] = 'F',
879+
["F4"] = 'F',
880+
["F5"] = 'F',
881+
["F6"] = 'F',
882+
["F7"] = 'F',
883+
["F8"] = 'F',
884+
["F9"] = 'F',
885+
["F10"] = 'F',
886+
["F11"] = 'F',
887+
["F12"] = 'F',
888+
["Escape"] = 'e',
889+
["Tab"] = 't',
890+
["Backspace"] = 'b',
891+
["Enter"] = 'e',
892+
["Space"] = 's',
893+
["LeftAlt"] = 'a',
894+
["RightAlt"] = 'a',
895+
["LeftCtrl"] = 'c',
896+
["RightCtrl"] = 'c',
897+
["LeftShift"] = 's',
898+
["RightShift"] = 's',
899+
["CapsLock"] = 'C',
900+
["ScrollLock"] = 'S',
901+
["NumLock"] = 'N',
902+
["Grave"] = '`',
903+
["Minus"] = '-',
904+
["Equals"] = '=',
905+
["Backslash"] = 'b',
906+
["LeftBracket"] = '[',
907+
["RightBracket"] = ']',
908+
["Semicolon"] = ';',
909+
["Quote"] = '\'',
910+
["Period"] = 'p', // because '.' represents no input
911+
["Comma"] = ',',
912+
["Slash"] = '/',
913+
["ExtraLtGt"] = '>',
914+
["PrintScreen"] = 'p',
915+
["Pause"] = 'p',
916+
["Insert"] = 'i',
917+
["Home"] = 'h',
918+
["Pageup"] = 'p',
919+
["Delete"] = 'd',
920+
["End"] = 'e',
921+
["Pagedown"] = 'p',
922+
["Left"] = 'l',
923+
["Up"] = 'u',
924+
["Down"] = 'd',
925+
["Right"] = 'r',
926+
["Keypad1"] = '1',
927+
["Keypad2"] = '2',
928+
["KeyPad3"] = '3',
929+
["KeyPad4"] = '4',
930+
["KeyPad5"] = '5',
931+
["KeyPad6"] = '6',
932+
["KeyPad7"] = '7',
933+
["KeyPad8"] = '8',
934+
["KeyPad9"] = '9',
935+
["KeyPad0"] = '0',
936+
["KeyPadDivide"] = '/',
937+
["KeyPadMultiply"] = '*',
938+
["KeyPadMinus"] = '-',
939+
["keyPadPlus"] = '+',
940+
["KeyPadEnter"] = 'e',
941+
["KeyPadPeriod"] = '.',
942+
}
859943
};
860944

861945
private static readonly Dictionary<string, string> BaseAxisLookupTable = new Dictionary<string, string>

src/BizHawk.Emulation.Common/Database/Database.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,10 @@ public static GameInfo GetGameInfo(byte[] romData, string fileName)
463463
game.System = VSystemID.Raw.Amiga;
464464
break;
465465

466+
case ".D88" or ".DMF" or ".FDD" /*or ".FDI"*/ or ".IMA" or ".IMG" or ".NFD" or ".XDF":
467+
game.System = VSystemID.Raw.DOS;
468+
break;
469+
466470
case ".IPF":
467471
var ipfId = new IpfIdentifier(romData);
468472
game.System = ipfId.IdentifiedSystem;

0 commit comments

Comments
 (0)