mirror of
https://github.com/libretro/dosbox-pure.git
synced 2024-12-02 14:36:37 +00:00
Resync 0.9.0
This commit is contained in:
parent
d22a43d80a
commit
286871e6be
5
Makefile
5
Makefile
@ -209,7 +209,8 @@ CFLAGS += -D__LIBRETRO__ -Iinclude -D_FILE_OFFSET_BITS=64
|
||||
CFLAGS += $(COMMONFLAGS)
|
||||
#CFLAGS += -fdata-sections #saves around 32 bytes on most platforms but wrongfully adds up to 60MB on msys2
|
||||
|
||||
LDFLAGS += $(CPUFLAGS) -lpthread -shared
|
||||
LDLIBS := -lpthread
|
||||
LDFLAGS += $(CPUFLAGS) -shared
|
||||
#LDFLAGS += -static-libstdc++ -static-libgcc #adds 1MB to output and still dynamically links against libc and libm
|
||||
|
||||
.PHONY: all clean
|
||||
@ -234,7 +235,7 @@ ifeq ($(STATIC_LINKING), 1)
|
||||
$(AR) rcs $@ $^
|
||||
else
|
||||
$(info Linking $@ ...)
|
||||
$(CXX) $(LDFLAGS) -o $@ $^
|
||||
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
|
||||
ifneq ($(BUILD),DEBUG)
|
||||
@-/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/bin/strip --strip-all $@ $(PIPETONULL);true # gcw0
|
||||
@-strip --strip-all $@ $(PIPETONULL);true # others
|
||||
|
39
README.md
39
README.md
@ -17,13 +17,16 @@ built for RetroArch/Libretro aiming for simplicity and ease of use.
|
||||
* [Keyboard emulation](#keyboard-emulation)
|
||||
* [Joystick emulation](#joystick-emulation)
|
||||
* [On-screen keyboard](#on-screen-keyboard)
|
||||
* [Gamepad mapper](#gamepad-mapper)
|
||||
* [MIDI playback with SoundFonts](#midi-playback-with-soundfonts)
|
||||
* [Cheats support](#cheats-support)
|
||||
* [Save states](#save-states)
|
||||
* [Rewind support](#rewind-support)
|
||||
* [Booter games](#booter-games)
|
||||
* [Loading M3U8 files](#loading-m3u8-files)
|
||||
* [Tips](#tips)
|
||||
* [Playing with keyboard and mouse](#playing-with-keyboard-and-mouse)
|
||||
* [Loading a dosbox.conf file](#loading-a-dosboxconf-file)
|
||||
* [ZIP files can be renamed to DOSZ](#zip-files-can-be-renamed-to-dosz)
|
||||
* [Force opening the start menu](#force-opening-the-start-menu)
|
||||
* [Mount ZIP as A or D drive](#mount-zip-as-a-or-d-drive)
|
||||
@ -31,7 +34,6 @@ built for RetroArch/Libretro aiming for simplicity and ease of use.
|
||||
* [Keyboard layout defaults to US](#keyboard-layout-defaults-to-us)
|
||||
* [Save file handling](#save-file-handling)
|
||||
* [Features not yet implemented](#features-not-yet-implemented)
|
||||
* [Load dosbox.conf](#load-dosboxconf)
|
||||
* [Store ZIP seek index into save file](#store-zip-seek-index-into-save-file)
|
||||
* [Unsupported features](#unsupported-features)
|
||||
* [Building](#building)
|
||||
@ -57,8 +59,8 @@ DOSBox Pure can load games directly from ZIP files without the need to extract t
|
||||
Changes made to a loaded ZIP file will be stored as a separate ZIP file into the libretro saves directory.
|
||||
If a game is loaded directly without using a ZIP file the saves directory is not used.
|
||||
|
||||
### Mount disc images from inside ZIP files
|
||||
CD images (ISO or CUE) and floppy disk images (IMG/IMA/VHD) can be mounted directly from inside ZIP files.
|
||||
### Mount disk images from inside ZIP files
|
||||
CD images (ISO or CUE) and floppy disk images (IMG/IMA/VHD/JRC/TC) can be mounted directly from inside ZIP files.
|
||||
The system will automatically mount the first found disk image as the A: or D: drive.
|
||||
Additional disks can be loaded or swapped by using the `Disc Control` menu in RetroArch.
|
||||
The start menu also offers the option to mount or unmount an image.
|
||||
@ -113,6 +115,18 @@ the move speed.
|
||||
If the cursor is moved above the middle of the screen the keyboard will move to the top.
|
||||
The button can be remapped in the controls menu and there is also a core options to disable it entirely.
|
||||
|
||||
### Gamepad mapper
|
||||
![Gamepad mapper](images/padmapper.png)
|
||||
|
||||
If you need even more customization of the controls than provided by the [Automated controller mappings](#automated-controller-mappings),
|
||||
or the various presets for [mouse](#mouse-emulation), [keyboard](#keyboard-emulation) and [joysticks](#joystick-emulation) you can use
|
||||
the gamepad mapper.
|
||||
|
||||
To open it, click the "PAD MAPPER" button in the [On-screen keyboard](#on-screen-keyboard).
|
||||
|
||||
It is available any time in-game and changes are immediately saved and applied when closing the mapper. Up to 4 functions can be mapped
|
||||
for any button/direction of the gamepad. A mapping can be to any function of the 3 emulated input devices: keyboard, mouse or joystick.
|
||||
|
||||
### MIDI playback with SoundFonts
|
||||
If DOSBox Pure finds one or more `.SF2` sound font file in the `system` directory of the frontend, one of them
|
||||
can be selected via the `Audio > MIDI SoundFont` core option.
|
||||
@ -134,6 +148,14 @@ Save states might not be compatible across different versions of DOSBox Pure.
|
||||
Using the core option `Save States Support`, rewinding can be enabled.
|
||||
Keep in mind that rewind support comes at a high performance cost.
|
||||
|
||||
### Booter games
|
||||
When loading a ZIP file which contains a floppy or hard-disk image or loading such a disk image directly,
|
||||
the [start menu](#start-menu-with-auto-start) will show an additional option `[BOOT IMAGE FILE]`.
|
||||
When selected, a list of system modes (emulated graphics card) will be shown and once a mode is selected,
|
||||
DOSBox Pure will try to boot from the mounted image.
|
||||
While running a booter game, the mounted disk can be easily swapped with the
|
||||
[Disc Control menu](#mount-disk-images-from-inside-zip-files) or hotkeys set in the frontend.
|
||||
|
||||
### Loading M3U8 files
|
||||
If the core gets loaded with a `.m3u8` file, all files listed in it will be added to the
|
||||
disc swap menu. The first image will automatically get mounted as A: or D: drive depending
|
||||
@ -147,6 +169,12 @@ mode available in RetroArch. By default you can toggle game focus by pressing th
|
||||
scroll lock key. While game focus is active, the hotkeys are disabled and keyboard will
|
||||
not cause retro pad button presses (which could cause multiple keys to be pressed at once).
|
||||
|
||||
### Loading a dosbox.conf file
|
||||
If a file named `dosbox.conf` exists in the loaded game directory (for example inside the ZIP file),
|
||||
DOSBox Pure will load the settings in that file and run the autoexec lines from it (if set).
|
||||
It is also possible to load a .conf file directly with the core and it will mount the directory
|
||||
of that file as the C: drive and then load it the same way.
|
||||
|
||||
### ZIP files can be renamed to DOSZ
|
||||
If your libretro frontend wants to load the content of `.ZIP` files instead of sending it to
|
||||
DOSBox Pure to load, the files can be renamed from `.ZIP` to `.DOSZ`.
|
||||
@ -187,11 +215,6 @@ Then gradually until at max 59MB and more, it will be written out 60 seconds aft
|
||||
|
||||
## Features not yet implemented
|
||||
|
||||
### Load dosbox.conf
|
||||
It would be nice to be able to load a `dosbox.conf` file if it exists in the loaded
|
||||
game directory (for example inside the ZIP file). Ideally this would then hide all the options that
|
||||
have been overwritten by that `.conf` file in the core options list.
|
||||
|
||||
### Store ZIP seek index into save file
|
||||
When a DOS games opens a large file and wants to read some data from near the end of the file,
|
||||
DOSBox Pure needs to decompress the entire file to do that. This can be most noticeable when mounting
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
# Software Information
|
||||
display_name = "DOS (DOSBox-Pure)"
|
||||
authors = "DOSBox Team|Psyraven"
|
||||
supported_extensions = "zip|dosz|exe|com|bat|iso|cue|ins|img|ima|vhd|m3u|m3u8"
|
||||
supported_extensions = "zip|dosz|exe|com|bat|iso|cue|ins|img|ima|vhd|jrc|tc|m3u|m3u8|conf"
|
||||
corename = "DOSBox"
|
||||
categories = "Emulator"
|
||||
license = "GPLv2"
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" InitialTargets="DisplayText">
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<VisualStudioYear Condition="'$(VisualStudioVersion)' == '11.0' Or '$(PlatformToolsetVersion)' == '110' Or '$(MSBuildToolsVersion)' == '4.0'">2012</VisualStudioYear>
|
||||
@ -79,7 +79,6 @@
|
||||
</ClCompile>
|
||||
<ClCompile Condition="'$(Configuration)'=='Debug'">
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SupportJustMyCode>false</SupportJustMyCode>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
@ -92,8 +91,7 @@
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<!-- WholeProgramOptimization>true</WholeProgramOptimization -->
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<FloatingPointExceptions>false</FloatingPointExceptions>
|
||||
<EnableEnhancedInstructionSet Condition="'$(Platform)'=='Win32'">StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
@ -110,8 +108,7 @@
|
||||
<Link Condition="'$(Configuration)'=='Release'">
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<!-- LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration -->
|
||||
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
|
||||
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
<IgnoreEmbeddedIDL>true</IgnoreEmbeddedIDL>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 11 KiB |
BIN
images/padmapper.png
Normal file
BIN
images/padmapper.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
@ -33,7 +33,9 @@
|
||||
/* The Section handling Bios Disk Access */
|
||||
#define BIOS_MAX_DISK 10
|
||||
|
||||
#ifdef C_DBP_ENABLE_DISKSWAP
|
||||
#define MAX_SWAPPABLE_DISKS 20
|
||||
#endif
|
||||
struct diskGeo {
|
||||
Bit32u ksize; /* Size in kilobytes */
|
||||
Bit16u secttrack; /* Sectors per track */
|
||||
@ -88,14 +90,18 @@ void incrementFDD(void);
|
||||
#define MAX_DISK_IMAGES (2 + MAX_HDD_IMAGES)
|
||||
|
||||
extern imageDisk *imageDiskList[MAX_DISK_IMAGES];
|
||||
#ifdef C_DBP_ENABLE_DISKSWAP
|
||||
extern imageDisk *diskSwap[MAX_SWAPPABLE_DISKS];
|
||||
extern Bit32s swapPosition;
|
||||
#endif
|
||||
extern Bit16u imgDTASeg; /* Real memory location of temporary DTA pointer for fat image disk access */
|
||||
extern RealPt imgDTAPtr; /* Real memory location of temporary DTA pointer for fat image disk access */
|
||||
extern DOS_DTA *imgDTA;
|
||||
|
||||
#ifdef C_DBP_ENABLE_DISKSWAP
|
||||
void swapInDisks(void);
|
||||
void swapInNextDisk(void);
|
||||
#endif
|
||||
bool getSwapRequest(void);
|
||||
|
||||
#endif
|
||||
|
@ -67,6 +67,7 @@
|
||||
//#define C_DBP_ENABLE_CONFIG_PROGRAM
|
||||
//#define C_DBP_ENABLE_MESSAGEFILE
|
||||
//#define C_DBP_ENABLE_AUTOLOCK
|
||||
//#define C_DBP_ENABLE_DISKSWAP
|
||||
|
||||
// ----- Enabled new features
|
||||
#define C_DBP_LIBRETRO
|
||||
|
1051
keyb2joypad.cpp
1051
keyb2joypad.cpp
File diff suppressed because it is too large
Load Diff
@ -649,22 +649,8 @@ bool CDROM_Interface_Image::LoadCueSheet(char *cuefile)
|
||||
bool success;
|
||||
bool canAddTrack = false;
|
||||
#ifdef C_DBP_SUPPORT_CDROM_MOUNT_DOSFILE
|
||||
Bit32u cuefilesize;
|
||||
DOS_File* df = FindAndOpenDosFile(cuefile, &cuefilesize);
|
||||
if (!df) return false;
|
||||
if (!cuefilesize || cuefilesize > 1024*1024) { df->Close(); delete df; return false; }
|
||||
|
||||
std::string dosfilebuf;
|
||||
dosfilebuf.resize(cuefilesize + 1);
|
||||
dosfilebuf[cuefilesize] = '\0';
|
||||
Bit8u* buf = (Bit8u*)&dosfilebuf[0];
|
||||
for (Bit16u read; cuefilesize; cuefilesize -= read, buf += read)
|
||||
{
|
||||
read = (Bit16u)(cuefilesize > 0xFFFF ? 0xFFFF : cuefilesize);
|
||||
if (!df->Read(buf, &read)) { DBP_ASSERT(0); }
|
||||
}
|
||||
df->Close();
|
||||
delete df;
|
||||
if (!FindAndReadDosFile(cuefile, dosfilebuf)) return false;
|
||||
istringstream inString(dosfilebuf);
|
||||
istream& in = (istream&)inString;
|
||||
#else
|
||||
|
@ -335,7 +335,7 @@ bool DOS_Execute(char * name,PhysPt block_pt,Bit8u flags) {
|
||||
pos=0;DOS_SeekFile(fhandle,&pos,DOS_SEEK_SET);
|
||||
Bit16u dataread=0x1800;
|
||||
DOS_ReadFile(fhandle,loadbuf,&dataread);
|
||||
if (dataread<0x1800) maxsize=dataread;
|
||||
if (dataread<0x1800) maxsize=((dataread+0x10)>>4)+0x20;
|
||||
if (minsize>maxsize) minsize=maxsize;
|
||||
}
|
||||
} else { /* Exe size calculated from header */
|
||||
@ -366,6 +366,7 @@ bool DOS_Execute(char * name,PhysPt block_pt,Bit8u flags) {
|
||||
maxsize=0xffff;
|
||||
/* resize to full extent of memory block */
|
||||
DOS_ResizeMemory(pspseg,&maxsize);
|
||||
memsize=maxsize;
|
||||
}
|
||||
loadseg=pspseg+16;
|
||||
if (!iscom) {
|
||||
|
@ -709,6 +709,11 @@ private:
|
||||
dos_sec->HandleInputline(test);
|
||||
strcpy(test,"ems=false");
|
||||
dos_sec->HandleInputline(test);
|
||||
#ifdef C_DBP_LIBRETRO
|
||||
dos_sec->GetProp("umb")->OnChangedByConfigProgram();
|
||||
dos_sec->GetProp("xms")->OnChangedByConfigProgram();
|
||||
dos_sec->GetProp("ems")->OnChangedByConfigProgram();
|
||||
#endif
|
||||
dos_sec->ExecuteInit(false);
|
||||
}
|
||||
|
||||
@ -777,9 +782,11 @@ public:
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef C_DBP_ENABLE_DISKSWAP
|
||||
if ( i >= MAX_SWAPPABLE_DISKS ) {
|
||||
return; //TODO give a warning.
|
||||
}
|
||||
#endif
|
||||
WriteOut(MSG_Get("PROGRAM_BOOT_IMAGE_OPEN"), temp_line.c_str());
|
||||
Bit32u rombytesize;
|
||||
#ifdef C_DBP_SUPPORT_DISK_MOUNT_DOSFILE
|
||||
@ -788,6 +795,7 @@ public:
|
||||
FILE *usefile = getFSFile(temp_line.c_str(), &floppysize, &rombytesize);
|
||||
#endif
|
||||
if(usefile != NULL) {
|
||||
#ifdef C_DBP_ENABLE_DISKSWAP
|
||||
if(diskSwap[i] != NULL) delete diskSwap[i];
|
||||
diskSwap[i] = new imageDisk(usefile, temp_line.c_str(), floppysize, false);
|
||||
if (usefile_1==NULL) {
|
||||
@ -806,6 +814,24 @@ public:
|
||||
#endif
|
||||
rombytesize_2=rombytesize;
|
||||
}
|
||||
#else
|
||||
imageDisk* disk = new imageDisk(usefile, temp_line.c_str(), floppysize, false);
|
||||
if (usefile_1==NULL) {
|
||||
first_img_path = temp_line;
|
||||
usefile_1=disk;
|
||||
rombytesize_1=rombytesize;
|
||||
if (imageDiskList[0]) delete imageDiskList[0];
|
||||
imageDiskList[0]=disk;
|
||||
} else if (usefile_2==NULL) {
|
||||
usefile_2=disk;
|
||||
rombytesize_2=rombytesize;
|
||||
if (imageDiskList[1]) delete imageDiskList[1];
|
||||
imageDiskList[1]=disk;
|
||||
} else {
|
||||
delete disk;
|
||||
}
|
||||
#endif
|
||||
|
||||
} else {
|
||||
WriteOut(MSG_Get("PROGRAM_BOOT_IMAGE_NOT_OPEN"), temp_line.c_str());
|
||||
return;
|
||||
@ -815,9 +841,11 @@ public:
|
||||
i++;
|
||||
}
|
||||
|
||||
#ifdef C_DBP_ENABLE_DISKSWAP
|
||||
swapPosition = 0;
|
||||
|
||||
swapInDisks();
|
||||
#endif
|
||||
|
||||
if(imageDiskList[drive-65]==NULL) {
|
||||
WriteOut(MSG_Get("PROGRAM_BOOT_UNABLE"), drive);
|
||||
@ -861,6 +889,7 @@ public:
|
||||
} else {
|
||||
WriteOut(MSG_Get("PROGRAM_BOOT_CART_NO_CMDS"));
|
||||
}
|
||||
#ifdef C_DBP_ENABLE_DISKSWAP
|
||||
for(Bitu dct=0;dct<MAX_SWAPPABLE_DISKS;dct++) {
|
||||
if(diskSwap[dct]!=NULL) {
|
||||
delete diskSwap[dct];
|
||||
@ -868,6 +897,10 @@ public:
|
||||
}
|
||||
}
|
||||
//fclose(usefile_1); //delete diskSwap closes the file
|
||||
#else
|
||||
if (usefile_1) delete usefile_1; // clears imageDiskList[0]
|
||||
if (usefile_2) delete usefile_2; // clears imageDiskList[1]
|
||||
#endif
|
||||
return;
|
||||
} else {
|
||||
while (clen!=0) {
|
||||
@ -893,6 +926,7 @@ public:
|
||||
} else {
|
||||
WriteOut(MSG_Get("PROGRAM_BOOT_CART_NO_CMDS"));
|
||||
}
|
||||
#ifdef C_DBP_ENABLE_DISKSWAP
|
||||
for(Bitu dct=0;dct<MAX_SWAPPABLE_DISKS;dct++) {
|
||||
if(diskSwap[dct]!=NULL) {
|
||||
delete diskSwap[dct];
|
||||
@ -900,6 +934,10 @@ public:
|
||||
}
|
||||
}
|
||||
//fclose(usefile_1); //Delete diskSwap closes the file
|
||||
#else
|
||||
if (usefile_1) delete usefile_1; // clears imageDiskList[0]
|
||||
if (usefile_2) delete usefile_2; // clears imageDiskList[1]
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -979,12 +1017,17 @@ public:
|
||||
for(i=0;i<rombytesize_1-0x200;i++) phys_writeb((romseg<<4)+i,rombuf[i]);
|
||||
|
||||
//Close cardridges
|
||||
#ifdef C_DBP_ENABLE_DISKSWAP
|
||||
for(Bitu dct=0;dct<MAX_SWAPPABLE_DISKS;dct++) {
|
||||
if(diskSwap[dct]!=NULL) {
|
||||
delete diskSwap[dct];
|
||||
diskSwap[dct]=NULL;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (usefile_1) delete usefile_1; // clears imageDiskList[0]
|
||||
if (usefile_2) delete usefile_2; // clears imageDiskList[1]
|
||||
#endif
|
||||
|
||||
|
||||
if (cart_cmd=="") {
|
||||
|
@ -408,7 +408,14 @@ DOS_File *FindAndOpenDosFile(char const* filename, Bit32u *bsize, bool* writable
|
||||
for (const char *nDir = n, *nEnd = n + strlen(n); n != nEnd + 1 && p_dos != p_dos_end; nDir = ++n)
|
||||
{
|
||||
while (*n != '/' && *n != '\\' && n != nEnd) n++;
|
||||
if (n == nDir) continue;
|
||||
if (n == nDir || (nDir[0] == '.' && n == nDir + 1)) continue;
|
||||
if (nDir[0] == '.' && nDir[1] == '.' && n == nDir + 2)
|
||||
{
|
||||
// Remove the last parent directory in dos_path on ..
|
||||
if (p_dos == dos_path) continue;
|
||||
for (p_dos--; p_dos > dos_path && p_dos[-1] != '\\'; p_dos--) {}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Create a 8.3 filename from a 4 char prefix and a suffix if filename is too long
|
||||
p_dos += DBP_Make8dot3FileName(p_dos, (Bit32u)(p_dos_end - p_dos), nDir, (Bit32u)(n - nDir));
|
||||
@ -453,6 +460,36 @@ DOS_File *FindAndOpenDosFile(char const* filename, Bit32u *bsize, bool* writable
|
||||
return dos_file;
|
||||
}
|
||||
|
||||
bool FindAndReadDosFile(char const* filename, std::string& out, Bit32u maxsize, char const* relative_to)
|
||||
{
|
||||
Bit32u filesize;
|
||||
DOS_File* df = FindAndOpenDosFile(filename, &filesize, NULL, relative_to);
|
||||
if (!df) return false;
|
||||
if (!filesize || filesize > maxsize) { df->Close(); delete df; return false; }
|
||||
out.resize(filesize + 1);
|
||||
out[filesize] = '\0';
|
||||
Bit8u* buf = (Bit8u*)&out[0];
|
||||
for (Bit16u read; filesize; filesize -= read, buf += read)
|
||||
{
|
||||
read = (Bit16u)(filesize > 0xFFFF ? 0xFFFF : filesize);
|
||||
if (!df->Read(buf, &read)) { DBP_ASSERT(0); }
|
||||
}
|
||||
df->Close();
|
||||
delete df;
|
||||
return true;
|
||||
}
|
||||
|
||||
Bit16u DriveReadFileBytes(DOS_Drive* drv, const char* path, Bit8u* outbuf, Bit16u numbytes)
|
||||
{
|
||||
DOS_File *df = nullptr;
|
||||
Drives['C'-'A']->FileOpen(&df, (char*)path, OPEN_READ);
|
||||
df->AddRef();
|
||||
if (!df->Read(outbuf, &numbytes)) numbytes = 0;
|
||||
df->Close();
|
||||
delete df;
|
||||
return numbytes;
|
||||
}
|
||||
|
||||
//DBP: utility function to evaluate an entire drives filesystem
|
||||
void DriveFileIterator(DOS_Drive* drv, void(*func)(const char* path, bool is_dir, Bit32u size, Bit16u date, Bit16u time, Bit8u attr, Bitu data), Bitu data)
|
||||
{
|
||||
|
@ -484,8 +484,10 @@ private:
|
||||
void DrivePathRemoveEndingDots(const char** path, char path_buf[DOS_PATHLENGTH]);
|
||||
bool DriveForceCloseFile(DOS_Drive* drv, const char* name);
|
||||
void DriveFileIterator(DOS_Drive* drv, void(*func)(const char* path, bool is_dir, Bit32u size, Bit16u date, Bit16u time, Bit8u attr, Bitu data), Bitu data = 0);
|
||||
Bit16u DriveReadFileBytes(DOS_Drive* drv, const char* path, Bit8u* outbuf, Bit16u numbytes);
|
||||
Bit32u DBP_Make8dot3FileName(char* target, Bit32u target_len, const char* source, Bit32u source_len);
|
||||
DOS_File *FindAndOpenDosFile(char const* filename, Bit32u *bsize = NULL, bool* writable = NULL, char const* relative_to = NULL);
|
||||
bool FindAndReadDosFile(char const* filename, std::string& out, Bit32u maxsize = 1024*1024, char const* relative_to = NULL);
|
||||
|
||||
template <typename TVal> struct StringToPointerHashMap
|
||||
{
|
||||
|
@ -58,8 +58,10 @@ void BIOS_SetEquipment(Bit16u equipment);
|
||||
|
||||
/* 2 floppys and 2 harddrives, max */
|
||||
imageDisk *imageDiskList[MAX_DISK_IMAGES];
|
||||
#ifdef C_DBP_ENABLE_DISKSWAP
|
||||
imageDisk *diskSwap[MAX_SWAPPABLE_DISKS];
|
||||
Bit32s swapPosition;
|
||||
#endif
|
||||
|
||||
void updateDPT(void) {
|
||||
Bit32u tmpheads, tmpcyl, tmpsect, tmpsize;
|
||||
@ -99,6 +101,7 @@ void incrementFDD(void) {
|
||||
BIOS_SetEquipment(equipment);
|
||||
}
|
||||
|
||||
#ifdef C_DBP_ENABLE_DISKSWAP
|
||||
void swapInDisks(void) {
|
||||
bool allNull = true;
|
||||
Bit32s diskcount = 0;
|
||||
@ -127,6 +130,7 @@ void swapInDisks(void) {
|
||||
if(swapPos>=MAX_SWAPPABLE_DISKS) swapPos=0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool getSwapRequest(void) {
|
||||
bool sreq=swapping_requested;
|
||||
@ -134,6 +138,7 @@ bool getSwapRequest(void) {
|
||||
return sreq;
|
||||
}
|
||||
|
||||
#ifdef C_DBP_ENABLE_DISKSWAP
|
||||
void swapInNextDisk(bool pressed) {
|
||||
if (!pressed)
|
||||
return;
|
||||
@ -148,6 +153,7 @@ void swapInNextDisk(bool pressed) {
|
||||
swapInDisks();
|
||||
swapping_requested = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Bit8u imageDisk::Read_Sector(Bit32u head,Bit32u cylinder,Bit32u sector,void * data) {
|
||||
@ -242,9 +248,11 @@ imageDisk::~imageDisk()
|
||||
if (dos_file->IsOpen()) dos_file->Close();
|
||||
if (dos_file->RemoveRef() <= 0) delete dos_file;
|
||||
}
|
||||
#ifdef C_DBP_ENABLE_DISKSWAP
|
||||
for(int i=0;i<MAX_SWAPPABLE_DISKS;i++)
|
||||
if (diskSwap[i] == this)
|
||||
diskSwap[i] = NULL;
|
||||
#endif
|
||||
for(int i=0;i<MAX_DISK_IMAGES;i++)
|
||||
if (imageDiskList[i] == this)
|
||||
imageDiskList[i] = NULL;
|
||||
@ -638,13 +646,17 @@ void BIOS_SetupDisks(void) {
|
||||
imageDiskList[i] = NULL;
|
||||
}
|
||||
|
||||
#ifdef C_DBP_ENABLE_DISKSWAP
|
||||
for(i=0;i<MAX_SWAPPABLE_DISKS;i++) {
|
||||
diskSwap[i] = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
diskparm0 = CALLBACK_Allocate();
|
||||
diskparm1 = CALLBACK_Allocate();
|
||||
#ifdef C_DBP_ENABLE_DISKSWAP
|
||||
swapPosition = 0;
|
||||
#endif
|
||||
|
||||
RealSetVec(0x41,CALLBACK_RealPointer(diskparm0));
|
||||
RealSetVec(0x46,CALLBACK_RealPointer(diskparm1));
|
||||
@ -670,6 +682,7 @@ void BIOS_SetupDisks(void) {
|
||||
|
||||
//DBP: Memory cleanup
|
||||
void BIOS_ShutdownDisks(void) {
|
||||
#ifdef C_DBP_ENABLE_DISKSWAP
|
||||
for (int i = 0; i != MAX_SWAPPABLE_DISKS + MAX_DISK_IMAGES; i++) {
|
||||
imageDisk* id = (i < MAX_SWAPPABLE_DISKS ? diskSwap[i] : imageDiskList[i - MAX_SWAPPABLE_DISKS]);
|
||||
if (!id) continue;
|
||||
@ -679,7 +692,23 @@ void BIOS_ShutdownDisks(void) {
|
||||
if (jd == id) jd = NULL;
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (int i = 0; i != MAX_DISK_IMAGES; i++) {
|
||||
imageDisk* id = imageDiskList[i];
|
||||
if (!id) continue;
|
||||
delete id;
|
||||
for (int j = 0; j != MAX_DISK_IMAGES; j++) {
|
||||
imageDisk*& jd = imageDiskList[j];
|
||||
if (jd == id) jd = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
imgDTASeg = 0;
|
||||
imgDTAPtr = 0;
|
||||
if (imgDTA) { delete imgDTA; imgDTA = NULL; }
|
||||
}
|
||||
|
||||
void DBP_SetMountSwappingRequested()
|
||||
{
|
||||
swapping_requested = true;
|
||||
}
|
||||
|
@ -257,7 +257,8 @@ static Bitu IRQ1_Handler(void) {
|
||||
//LOG_MSG("key input %d %d %d %d",scancode,flags1,flags2,flags3);
|
||||
switch (scancode) {
|
||||
/* First the hard ones */
|
||||
case 0xfa: /* ack. Do nothing for now */
|
||||
case 0xfa: /* Acknowledge */
|
||||
leds |=0x10;
|
||||
break;
|
||||
case 0xe1: /* Extended key special. Only pause uses this */
|
||||
flags3 |=0x01;
|
||||
|
@ -403,7 +403,7 @@ void INT10_SetCursorPos(Bit8u row,Bit8u col,Bit8u page) {
|
||||
|
||||
void ReadCharAttr(Bit16u col,Bit16u row,Bit8u page,Bit16u * result) {
|
||||
/* Externally used by the mouse routine */
|
||||
PhysPt fontdata;
|
||||
RealPt fontdata;
|
||||
Bit16u cols = real_readw(BIOSMEM_SEG,BIOSMEM_NB_COLS);
|
||||
BIOS_CHEIGHT;
|
||||
bool split_chr = false;
|
||||
@ -425,18 +425,18 @@ void ReadCharAttr(Bit16u col,Bit16u row,Bit8u page,Bit16u * result) {
|
||||
switch (machine) {
|
||||
case MCH_CGA:
|
||||
case MCH_HERC:
|
||||
fontdata=PhysMake(0xf000,0xfa6e);
|
||||
fontdata=RealMake(0xf000,0xfa6e);
|
||||
break;
|
||||
case TANDY_ARCH_CASE:
|
||||
fontdata=Real2Phys(RealGetVec(0x44));
|
||||
fontdata=RealGetVec(0x44);
|
||||
break;
|
||||
default:
|
||||
fontdata=Real2Phys(RealGetVec(0x43));
|
||||
fontdata=RealGetVec(0x43);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fontdata=Real2Phys(RealGetVec(0x43));
|
||||
fontdata=RealGetVec(0x43);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -444,13 +444,14 @@ void ReadCharAttr(Bit16u col,Bit16u row,Bit8u page,Bit16u * result) {
|
||||
|
||||
for (Bit16u chr=0;chr<256;chr++) {
|
||||
|
||||
if (chr==128 && split_chr) fontdata=Real2Phys(RealGetVec(0x1f));
|
||||
if (chr==128 && split_chr) fontdata=RealGetVec(0x1f);
|
||||
|
||||
bool error=false;
|
||||
Bit16u ty=(Bit16u)y;
|
||||
for (Bit8u h=0;h<cheight;h++) {
|
||||
Bit8u bitsel=128;
|
||||
Bit8u bitline=mem_readb(fontdata++);
|
||||
Bit8u bitline=mem_readb(Real2Phys(fontdata));
|
||||
fontdata=RealMake(RealSeg(fontdata),RealOff(fontdata)+1);
|
||||
Bit8u res=0;
|
||||
Bit8u vidline=0;
|
||||
Bit16u tx=(Bit16u)x;
|
||||
@ -464,7 +465,7 @@ void ReadCharAttr(Bit16u col,Bit16u row,Bit8u page,Bit16u * result) {
|
||||
ty++;
|
||||
if(bitline != vidline){
|
||||
/* It's not character 'chr', move on to the next */
|
||||
fontdata+=(cheight-h-1);
|
||||
fontdata=RealMake(RealSeg(fontdata),RealOff(fontdata)+cheight-h-1);
|
||||
error = true;
|
||||
break;
|
||||
}
|
||||
@ -479,6 +480,7 @@ void ReadCharAttr(Bit16u col,Bit16u row,Bit8u page,Bit16u * result) {
|
||||
*result = 0;
|
||||
}
|
||||
void INT10_ReadCharAttr(Bit16u * result,Bit8u page) {
|
||||
if(CurMode->ptotal==1) page=0;
|
||||
if(page==0xFF) page=real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAGE);
|
||||
Bit8u cur_row=CURSOR_POS_ROW(page);
|
||||
Bit8u cur_col=CURSOR_POS_COL(page);
|
||||
|
@ -461,6 +461,10 @@ public:
|
||||
umb_available=false;
|
||||
}
|
||||
|
||||
//DBP: Added cleanup for restart support (needs to be before Get_bool("xms") check)
|
||||
extern bool DBP_IsShuttingDown();
|
||||
if (DBP_IsShuttingDown()) xms_callback=0;
|
||||
|
||||
if (!section->Get_bool("xms")) return;
|
||||
/* Undo biosclearing */
|
||||
BIOS_ZeroExtendedSize(false);
|
||||
@ -471,10 +475,6 @@ public:
|
||||
/* Free used memory while skipping the 0 handle */
|
||||
for (Bitu i = 1;i<XMS_HANDLES;i++)
|
||||
if(!xms_handles[i].free) XMS_FreeMemory(i);
|
||||
|
||||
//DBP: Added cleanup for restart support
|
||||
extern bool DBP_IsShuttingDown();
|
||||
if (DBP_IsShuttingDown()) xms_callback=0;
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -515,6 +515,7 @@ static AUTOEXEC* test;
|
||||
//DBP: memory cleanup
|
||||
static void AUTOEXEC_ShutDown(Section* /*sec*/) {
|
||||
delete test;
|
||||
VFILE_Remove("AUTOEXEC.BAT");
|
||||
}
|
||||
|
||||
void AUTOEXEC_Init(Section * sec) {
|
||||
|
Loading…
Reference in New Issue
Block a user