1
0
Fork 0
Commit graph

637 commits

Author SHA1 Message Date
Patryk Obara
1953d0880b Redefine fileno for Windows
This redefine prevents fake deprecation warning on Windows (C4996) and
prevents a compilation problem when using old MinGW and Windows XP.
2020-01-11 17:50:28 +01:00
Patryk Obara
4d674102d0 Prevent unaligned memory access in adlib
This removes the last warnings in this area; in this case changing endianess
is not used for accessing emulated memory, just to flip few values to
low endian for storage.
2020-01-09 22:50:47 +01:00
Patryk Obara
c4dba16740 Move drives.h to common include dir
Judging by the usage, this header belongs in there instead of being
limited to dos module only.  This change makes it easier to reuse code
for new features related to drives mounting/unmounting.
2020-01-04 08:26:22 +01:00
Patryk Obara
2694aca2b2 Fix effc++ warnings in drives.cpp 2020-01-04 08:26:22 +01:00
Patryk Obara
0506aaf436 Stop silencing disabled C4786 MSVC warning
This is old, and disabled by default in new MSVC compilers.
It was purely infomational warning:

"object name was truncated to 'number' characters in the debug
information"

Regardless, even if we'll decide to silence it again for any reason,
then it should be configured in VS project and not using ifdefed
pragma in the code.
2019-12-29 20:04:39 +01:00
Patryk Obara
475e315943 Stop silencing 'throw' warnings in MSVC
Warning C4290 informs users, that MSVC ignores throw specification. This
is very good warning, because 'throw' specifications were faulty design
and got deprecated in C++11 and REMOVED from the language in C++20.

Throw specifications were replaced by much better 'noexcept' keyword,
which allows for compile-time checks, unlike 'throw', which might
silently inject exception 'std::unexpected'.
2019-12-29 20:04:39 +01:00
Patryk Obara
aff02450d1 Move GCC_ATTRIBUTE out of autoconf 2019-12-29 20:04:39 +01:00
Patryk Obara
3b157cd785 Add missing headers to autoconfig file
Also sort list of headers, so it's easier to assure no files are
missing.
2019-12-29 20:04:39 +01:00
Patryk Obara
ff2968df3f Move 'likely' macros to the compiler support header
This makes it easier to move away from autoconfig in the future.

Also, use '!!' C trick to prevent accidental incorrect usage of
these macros.
2019-12-29 20:04:39 +01:00
Patryk Obara
a7280cf1f7 Query SDL for available texture renderers
There's no point in hardcoding these values - they can be different to
every user (it depends on hardware, OS, SDL version, etc).

Also, future versions of SDL might introduce more renderers, so this way
the code is more future-proof.
2019-12-26 03:23:19 +01:00
Patryk Obara
cb82a60341 Surround WIN32_LEAN_AND_MEAN with ifndef
Otherwise it redefines macro definition in SDL_opengl.h.
2019-12-26 03:23:19 +01:00
Patryk Obara
3a68ba2b26 Indicate system includes for relevant SDL headers 2019-12-26 03:23:19 +01:00
Patryk Obara
0d108a7df5 Remove GFX_SetPalette
After move to SDL2, this function is no longer useful.
2019-12-26 03:23:19 +01:00
Patryk Obara
c81269eebe Remove extern global variable from bios_disk.h
This way interface of swapInDisks function is cleaner and we avoid a
warning when comparing (previously) signed swap position with an
unsigned array size or index.

Also, add some documentation to swapInDisks function.
2019-12-18 23:56:28 +01:00
Patryk Obara
5f282f6015 Use shared_ptr to prevent double free on imageDisk
Also, replacing unique_ptr with shared_ptr makes it unnecessary to move
a pointer when swapping boot disks; moving shared_ptr would lead to
inconsistent internal state.

Fixes: #94
2019-12-18 23:56:28 +01:00
Patryk Obara
5f9ac5eeab Remove code ifdefed for OS/2
Cleanup before replacing SDL1.2 with SDL2.

OS/2 support was introduced in DOSBox in March 2006.  OS/2 reached EOL
in December 2006.

As of 2019, OS/2 is being continued by proprietary 32-bit only ArcaOS,
although there is no official SDL2 support, despite pledges from SDL2
maintainers.
2019-12-09 16:27:11 +01:00
krcroft
ef2686ac02 Switch from std::vector to std::array 2019-12-09 09:11:16 +01:00
krcroft
78cc6be86d Make use of template variable, and reformat whitespace 2019-12-09 08:19:26 +01:00
krcroft
c9198b2944 Fix unsafe memory operations and warnings in the fatDrive class
- Move imageDiskList from pointer to vector of unique_ptr
- Replace string operations with size-limited versions
- Initialize members
- Eliminate unecessary casts
- Eliminate memory-leak on pointer assignment
2019-12-09 08:19:26 +01:00
krcroft
48106d6046 Explicitly delete copy and assignment operators 2019-12-07 21:07:38 +01:00
krcroft
8c6758c8d1 Memory overrun and C++11 updates
- Limit write length into buffer, and add comment about corner-case
- Use C++11's syntax to explicitly remove private copy and assignment operators
- Use C++11 container loop syntax to shorting a cleanup function
2019-12-07 19:08:47 +01:00
krcroft
cff6b05559 Improve memory safety in the DOS Drive Cache class
- Fix Bitu printf format type
- Check a pointer prior to dereferencing it
- Prevent writing one-beyond the last index
- Replace strcpy with with helper safe_strcpy, provided by @dreamer - thank you!
- Replace strcat with strncat
- Add constructor intializers for scalars and arrays
- Initialize and replace 0-value pointers with nullptr
- Pass in the buffer length when strncpy'ing into a function variable
2019-12-07 19:08:47 +01:00
krcroft
b55b43f543 Use PRIuPTR and define it for Windows GCC 64-bit 2019-12-03 05:12:28 +01:00
Patryk Obara
7d21bb1408 Move definition out of autoconfig 2019-12-03 05:12:28 +01:00
Patryk Obara
6214b39f9e Revert "Break compilation to test GitHub badges"
This reverts commit 6ae50d77af.
2019-12-01 18:35:25 +01:00
Patryk Obara
6ae50d77af Break compilation to test GitHub badges 2019-12-01 18:09:00 +01:00
krcroft
eaeb001b17 Play into subsequent track(s) if playback length exceeds the the current track
Issue reported by Dagar and Pr3tty F1y, and confirmed as a bug by ripsaw8080.
Thank you!

This fixes the GoG release of Betrayal at Krondor which (either due to CD mastering
issues or a faulty rip), requests playback of a given track at the tail end
of the prior track.

In debugging and performing this fix, many debug messages were improved as well
as making some small small code adjustments, such as using iterators to point to
individual tracks (track->attribute) instead of using the tracks array
(tracks[track -1].attribute).
2019-11-24 17:34:54 +01:00
Patryk Obara
6c42f3adf8 Fix several unused-private-field warnings 2019-11-24 17:14:32 +01:00
Patryk Obara
8e5f7dd55d Merge branch 'svn/trunk' r4290 2019-11-16 12:14:23 +01:00
Peter Veenstra
a533565297 Init some more fields in the constructors, else uninited stuff gets copied in copy constructors.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4289
2019-11-15 18:37:20 +00:00
Patryk Obara
34112dd2da Merge branch 'svn/trunk' r4282 2019-11-12 08:56:37 +01:00
krcroft
d1a6f373cb Refactor CD-DA flow by removing intermediate buffers and loops
Thanks to @ripsaw8080 for insight into CD-DA channel mapping,
@hail-to-the-ryzen for testing and flagging a position-tracking bug,
and @dreamer_ for guidance and code review.

The CD-DA volume and channel mapping loops were moved to generic mixer
calls and no longer require a pre-processing loop:
 - Application-controlled CD-DA volume adjustment is now applied using
   an existing mixer volume scalar that was previously unused by the
   CD-DA code.
 - Mapping of CD-DA left and right channels is now applied at the tail
   end of the mixer's sample ingest sequence.

The following have been removed:
 - The CD-DA callback chunk-wise circular buffer
 - The decode buffers in the Opus and MP3 decoders
 - The decode buffer and conversion buffers in SDL_Sound
These removals and API changes allow the image player's buffer
to be passed-through ultimately to the audio codec, skipping multiple
intermediate buffers.
2019-11-12 08:16:53 +01:00
Peter Veenstra
8f3474ecfd Make it possible to compile without CoreMIDI and CoreAudio on Mac OS X using a non-Apple compiler. Give some feedback to user in this case. (modified version of patch by krcroft with input from jmarsh, Dominus and Qbix)
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4281
2019-11-10 14:50:11 +00:00
Patryk Obara
d68af8b650 Merge branch 'svn/trunk' r4279 2019-11-02 19:30:48 +01:00
Sjoerd van der Berg
e20e8fa92c Some dma changes to make the world a better place
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4279
2019-11-02 11:21:48 +00:00
Patryk Obara
9099f0620e Merge branch 'svn/trunk' 2019-10-20 07:15:43 +02:00
Peter Veenstra
276b187181 Make frameskip an integer.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4273
2019-10-19 19:52:24 +00:00
Patryk Obara
a323e173c2 Merge branch 'svn/trunk' 2019-10-03 23:44:48 +02:00
Peter Veenstra
60204619d0 - Fix url to forum.
- Fix Bit8u instead of char weirdness for imageDisk (dreamer_)
- Give device_t a virtual empty destructor so some warning program
  doesn't go crazy.
- Give the code that moves the Z drive its own function for readability.
- Give sizes arrays default values again for warning program.
- Rewrite IMGMOUNT in order to exit early for clarity and attempt
  to group things together.



Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4267
2019-10-03 20:03:43 +00:00
Patryk Obara
b62a637157 Import svn:ignore props to .gitignore files 2019-09-15 20:34:57 +02:00
Peter Veenstra
ad88f982c0 Add some size checks when accessing Drives[], mostly needed when DOS_DRIVES is not set to 26, make size parsing not go outside the target array.
Let's not try to assign a drive in the switchlist to a too high number.
Don't access imagelist for drives >D when unmounting. 


Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4239
2019-06-25 06:12:13 +00:00
Peter Veenstra
e90de61263 Create fopen_wrapper so we can filter out specific directories, which DOS games should have no access to
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4238
2019-06-24 20:09:59 +00:00
Peter Veenstra
f8dd3db095 Add functionality to add overlay directories to drive_cache.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4216
2019-04-22 14:21:53 +00:00
Peter Veenstra
eb26b9a58e Change first_shell to be DOS_Shell instead of Program. Makes future manipulations easier.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4211
2019-04-20 13:48:55 +00:00
Peter Veenstra
dc6a76d354 Store whether generated code is 16 or 32 bit, so this information can be used when checking for self modifying code. Some code is identical except for being 32 or 16 bit. Fixes some hard to reproduce problems (with small codeblocks). Thanks jmarsh!
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4206
2019-04-19 12:16:14 +00:00
Peter Veenstra
c03a6f497c We use the old style headers in other places and use the functions/types without std::
Should help compilation on FreeBSD.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4203
2019-04-06 17:02:40 +00:00
ripsaw8080
3978e05909 Improve prefetch and simple cores to not switch to normal core on trap execution. Fixes the demo version of Prehistorik 2 and similar cases that use the trap flag and prefetch tricks. Thanks NewRisingSun.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4201
2019-04-01 22:06:11 +00:00
Peter Veenstra
4a1ef4d3d7 Refine stack overflow and underflow for the fpu a bit.
Overflow is still treated as Exit.
Underflow is ignored in release mode as it happens every now and then and doesn't seem to cause issues if ignored, thus restoring 0.74 behaviour.



Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4199
2019-04-01 14:32:18 +00:00
Peter Veenstra
202bfa1155 New Drive type: overlay.
When active, this drive redirects new and changed files to a different location.
The files in the overlay and normal drive are merged on startup and kept up to date when the game changes something. 
Files in the overlay are priotizedi, if they exists, above the normal files. 
The drive will switch to an overlayed version of the file on the first write! (Not when opening the file in write-mode).
The overlay is capable of creating missing directories.

With the help of DBOVERLAY files, the drive keeps track of files that are present in the normal directory but deleted by the game. 
All changes are preserved between sessions. 

Current design principles/limitations/requirements:
1) All directories that can be used for saving, must exist already in the base before mounting. (they will be created by DOSBox if missing in the overlay)
2) All filenames inside the overlay directories are UPPERCASE and conform to the 8.3 standard except for the special DBOVERLAY files.
3) To keep point 1 valid at all times, support for creating/renaming/removing directories has been disabled.

Thanks for the help GOG.


Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4196
2019-03-25 13:49:25 +00:00
ripsaw8080
64d25c4be4 Acknowledge mouse interrupt before entering user routine; fixes sound stutter during mouse movement in Eye of the Beholder III and Casino Tournament of Champions. Clear button counters in the mouse driver reset function; prevents unintended skipping of intro in MechWarrior and others.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4188
2019-02-04 15:15:58 +00:00