1
0
Fork 0
Commit graph

4148 commits

Author SHA1 Message Date
Patryk Obara
d34378b621 Define SDL rgb-masks for creating surfaces 2020-03-27 00:54:11 +01:00
Patryk Obara
a5b65b3c8e Initialize default window size before GUI_StartUp 2020-03-27 00:54:11 +01:00
Patryk Obara
acb020147d Move "extern C" to ppscale header 2020-03-27 00:54:11 +01:00
Patryk Obara
facabcee2a Handle surface as the last option during update
SCREEN_SURFACE is no longer the default option, and it's usable only for
debugging purposes. Move it to the last position in switches, to make
texture and opengl a little bit faster.
2020-03-27 00:54:11 +01:00
Patryk Obara
8d5bc9537a Prevent a crash in Windows AMD drivers
Usually, when window is being created without SDL_WINDOW_OPENGL flag,
SDL2 internally re-creates it to support OpenGL during
SDL_CreateRenderer if needed.

This leads to crash in AMD OpenGL drivers (Windows only), which happens
for drivers: "opengl", "opengles", "opengles2".

When the window is created with correct flag from the get-go, the crash
does not happen.

On Linux, the code does not crash either way (at least not when using
Mesa and AMDGPU open source driver), so there's no point in propagating
the hack.

Also, remove a comment that is no longer relevant to the code below.
2020-03-27 00:54:11 +01:00
Patryk Obara
bb43294f68 Store SDL texture render driver as std::string 2020-03-27 00:54:11 +01:00
Patryk Obara
54a50d4231 Replace Lock/UnlockTexture with UpdateTexture
Lock/UnlockTexture is stable and works very well on Linux and with
OpenGL texture driver and on Linux and Windows, but it's usage caused
problems with content of updated texture when used with drivers:
'direct3d11' on Windows and 'metal' on macOS.

Also, Lock/Unlock turned out to be the root cause of deadlocks for
'opengl' driver on AmigaOS.

According to SDL2 documentation, using Lock/UnlockTexture is supposed to
be faster, but in DOSBox usecase we couldn't confirm significant
performance change - there are some community reports indicating, that
UpdateTexture might be actually faster (but we couldn't confirm it
either).

Discussion on this topic can be found on SDL forum:
https://forums.libsdl.org/viewtopic.php?t=9728

In our case, switch to UpdateTexture has no serious negative impact, but
makes the behaviour more robust across the board.
2020-03-27 00:54:11 +01:00
Patryk Obara
fa4e8c28de Update description of sdl.windowresolution 2020-03-27 00:54:11 +01:00
Patryk Obara
3001ef240f Remove old splash screen 2020-03-27 00:54:11 +01:00
Patryk Obara
854c021cdc Update splash screen to use 4:3 aspect ratio
This way it matches the default window size when going into text mode
with aspect=true (default).
2020-03-27 00:54:11 +01:00
Patryk Obara
aed68e9e6e Destroy SDL resources in the proper order
Prevent internal SDL2 asserts on Windows 10 when using output=texture,
also improves stability on AmigaOS and Linux using Wayland.
2020-03-27 00:54:11 +01:00
Patryk Obara
d3f3833f2c Set icon after sdl.window is created
Otherwise internal SDL2 asserts are triggered in Windows debug builds.
2020-03-27 00:54:11 +01:00
Patryk Obara
bf1c7eef18 Fix effc++ warnings in control.h 2020-03-27 00:54:11 +01:00
Patryk Obara
919099c757 Start with the correct full/window resolution
Make the user settings affect splash screen as well as emulator; this
way, when user wants to start in fullscreen, the splash screen will be
displayed in fullscreen - making the startup process more streamlined.

This fixes long-standing problem on SteamOS (or Steam in Big Picture
mode), when starting dosbox moves the user out of fullscreen to window
(to show tiny splash screen), and then back to fullscreen.
2020-03-27 00:54:11 +01:00
Patryk Obara
600ccccd37 Display splash screen using GFX API
Simplify the code displaying the splash screen and extract it to a new
function. Using GFX_* functions avoids the problem of re-creating
the window from scratch after splash is shown, which solves a lot of
problems:

- application window is always visible on screen, it does not disappear
  for a moment between closing splash and starting emulator.
- seriously reduces resolution trashing on start
- user will not experience loss of window focus due to splash screen
  disappearing (this was happening e.g. on AmigaOS)
2020-03-27 00:54:11 +01:00
Patryk Obara
0b173eec08 Cleanup and document GFX_StartUpdate function
Usage of this function depends on the state of global sdl struct; and
it's very easy to make a mistake - documentation should lower this risk.

Change the type of output parameter 'pitch' and assure type safety with
internal SDL types via static asserts.
2020-03-27 00:54:11 +01:00
Patryk Obara
08934b2972 Remove dead code remains of WinDIB usage
This used to have meaning for Windows 9x support via SDL 1.2; the issue
described in README was never mentioned in the context of SDL2.

Add missing include to video header while we're at it.
2020-03-27 00:54:11 +01:00
NicknineTheEagle
e905a6bd5d Implement phone book to remap phone numbers to addresses for modem 2020-03-23 01:05:03 +01:00
NicknineTheEagle
de45c413ae Fix auto-answer (S0) behavior in modem 2020-03-23 01:02:42 +01:00
NicknineTheEagle
880d2d2ceb Implement DTR drop actions (&Dn) and DTR drop delay (S25) in modem
&D0 may be needed for old apps which don't set DTR or set it to garbage.
DTR drop delay is required for Quake otherwise it doesn't disconnect
properly.
2020-03-23 01:02:42 +01:00
NicknineTheEagle
9cb13f6158 Fix a bug with backspace handling in modem
Fixes a bug where entering backspace while command buffer was already
empty added backspace char to the buffer thus screwing it up.
2020-03-23 01:02:37 +01:00
krcroft
99e53a830f Track and free unassigned CStickBindGroup allocations 2020-03-21 23:41:06 +01:00
krcroft
a1a3e0203d Only initialize the mapper once during startup 2020-03-21 23:41:06 +01:00
krcroft
5b8364148a Use prefix form of incrementing iterators 2020-03-20 01:06:23 +01:00
krcroft
c2fcc273da Explicitly ignore some return values 2020-03-20 01:06:23 +01:00
krcroft
269908cad0 Prevent undefined behavior while bit-shifting on 32bit systems 2020-03-20 01:06:23 +01:00
krcroft
b0d90db24a Simplify joystick type assignment logic 2020-03-20 01:06:23 +01:00
krcroft
81efce0862 Refactor and make the joystick querier re-runnable
The previous function could only be effectively run one because
it changes the value of the global 'joytype' to something other
than AUTO, which is what this function looks for to re-query
the joysticks.

Second, if this function is run more than once, then it clobbers
the prior set number of joysticks back to zero (without
re-requerying for the actual quantity), rendering the joysticks
unuseable.

Finally, this function depends on several SDL calls to the joystick
subsystem, but fails to check or initialize it.

The commit:
 - Checks for an initializes the joystick subsystem before using it
 - Always re-queries the current state of the joystick (re-runnable)
 - Simplifies the logic to determine useability (retains criteria)
 - Conservatively writes the joysticks quantities at the end
2020-03-20 01:06:23 +01:00
krcroft
d815c52965 Move member initialization to the definition 2020-03-20 01:06:23 +01:00
krcroft
6c52c06a53 Cleanup leaks 2020-03-20 01:06:23 +01:00
Patryk Obara
2b6e4527be Initialize srcval on all codepaths in xga
Multiple code-paths were using this value uninitialized.
2020-03-19 01:01:23 +01:00
Patryk Obara
ffb9d62ade Change GetMixResult mixmode to uint32_t
There's no reason to use more than 32 bit for this parameter.

Also, limit scope of certain variables as much as possible without
bigger refactorizations.
2020-03-19 01:01:23 +01:00
Patryk Obara
6fe434571c Change DrawWaitSub mixmode to uint32_t
There's no reason to use more than 32 bit for this parameter; source
values are 16 bit, and they occassionally shifted, but always to values
fitting in 32 bit.
2020-03-19 01:01:23 +01:00
Patryk Obara
865ad54a87 Make XGA_DrawWaitSub a static function 2020-03-19 01:01:23 +01:00
Patryk Obara
e25e15ac1d Make XGA_GetMixResult a static function 2020-03-19 01:01:23 +01:00
Patryk Obara
a956f14de1 Inject newlines before displaying DOS prompt
In an earlier change, I removed appending newline outside of batch mode
in DOS shell code - that made DOSBox behave less like MS-DOS and more
like modern shells, that do not try to compensate for buggy
applications.

However, we should recognize that DOSBox (unlike e.g. FreeDOS) is designed
to run legacy applications, which might make assumptions about DOS
implementation. Some examples:

- PC Player Benchmark assumes, that help commands are displayed exactly
  at 80x25 terminal and formats the output to fill the whole screen
  (scrolling past DOS4GW messages).
- Quake and other ID games print shareware information on exit, but do
  it via a direct memory dump (not interrupts to print DOS text), and
  follow up with setting cursor exactly at line 22 (which is partly
  written already), expecting shell to inject newline.
- PCC Compiler prints status message on exit without newline, depending
  on MS-DOS shell behaviour.
- TEXTUTIL set of external commands do not print nothing to standard
  output, and are designed to clear the screen, therefore writing a
  newline after .COM commands would be a mistake.

Therefore we want to inject this newline, but not in every case.

New implementation reuses a static variable used by Program base class
(for purpose of translating UNIX newlines to DOS newlines) for detection
if it's appropriate to inject an additional newline or not.

Injecting the newline happens in function displaying the DOS prompt (so
we don't need to write additonal logic for separately handling batch
mode). When starting a non-COM, non-internal command the static variable
is set to the state indicating that next DOS prompt should inject the
newline.

Fixes: #208
2020-03-12 20:54:33 +01:00
Peter Veenstra
11c380aaba 0.74-3:mac os x default output change also in trunk now
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4335
2020-03-11 19:54:24 +00:00
Anton Shepelev
d1be65b105 Add output type texturepp for pixel-perfect scaling
The new output type `texturepp' was added, which implements
pixel-perfect scaling using SDL's hardware-accelerated texture output.
In pixel-pefect mode, each original pixel is displayed as a rectangle m
by n pixels, so that m:n yields a reasonably good approximation of the
pixel aspect ratio (PAR) of the emulated graphical mode while using as
much screen space as possible. The balance between the precision of
aspect ratio and the utilisation of screen space is specified as the
`parweight' parameter to pp_getscale() and is currently hard-coded in
sdlmain.cpp.

This implementation emulatates pixel-perfect mode as a special case of
nearest-neighbor interpolation when the horisontal and vertical scaling
factors are integers.
2020-03-09 20:12:36 +01:00
krcroft
83f625178a Ensure the first seek isn't cached 2020-03-08 08:36:21 +01:00
krcroft
bcae097e22 Refresh copyrights and headers 2020-03-07 11:07:48 +01:00
krcroft
37a1610f1c Bump the MP3 fast-seek-table's version identifier
The hashest generated by xxHash have changed between v0.7.2 and v0.7.3,
therefore the hashes in prior-genreated lookup tables will no longer
be valid. By bumping the file's identifier, the fast-seek code will
reject these older files and regenerate new ones.
2020-03-07 01:46:55 +01:00
krcroft
27538eeb2e Update the existing PVS false-positives for xxHash v0.7.3 2020-03-07 01:46:55 +01:00
Yann Collet
355b6faba7 Sync xxHash with upstream (v0.7.3) 2020-03-07 01:46:55 +01:00
Joshua Fern
f2029d71d8 Update copyright dates to 2020 2020-03-07 00:18:01 +01:00
krcroft
16dbd1cec6 Whitespace cleanup 2020-03-06 19:21:44 +01:00
krcroft
08c6fc10c1 Add a signed integer ceiling divide function 2020-03-06 19:21:44 +01:00
krcroft
be643d66b1 Cleanup file size and header length check 2020-03-06 19:21:44 +01:00
krcroft
51284a6d42 Simplify conditional logic 2020-03-06 19:21:44 +01:00
krcroft
0227fae934 Use auto when type is explicitly cast 2020-03-06 19:21:44 +01:00
krcroft
96a9723df5 Drop "[bug]" postfix in assets 2020-03-06 19:21:44 +01:00