bones_was_here [Wed, 3 Jan 2024 16:58:15 +0000 (02:58 +1000)]
sys: make stdout/stderr configurable during runtime
Adds cvar sys_stdout which offers the same behaviours as the -nostdout
and -stderr cmdline options and is initialised by them if they're passed.
Makes -noterminal cmdline option a synonym for -nostdout, previously it
was effectively the same but less efficient.
Platforms with the fcntl() syscall (ie non-Windows):
Changes to non-blocking stdout/stderr by default to prevent stutters and
halts in certain scenarios.
Adds cvar sys_stdout_blocks for enabling blocking stdout/stderr if
required.
Retrieves stdio stream FDs instead of assuming they're always 0,1,2.
NaitLee [Sun, 29 Jan 2023 08:51:37 +0000 (16:51 +0800)]
Fix several long-lasting font rendering problems:
Fix resources waste of fontmap usage worst-cases;
Fix memory waste of improperly designed `struct ft2_font_map_s`;
Deprecate `r_font_diskcache`
Rudolf Polzer [Tue, 2 Jan 2024 20:48:07 +0000 (12:48 -0800)]
r_viewfbo 0: skip the postprocessing/blending pass if there is nothing to blend.
May save some fps on low-end systems.
NOTE: Had to make sure that 2D rendering does not enable depth test,
as in r_skipblend mode, the main framebuffer Z values are written to as
part of regular 3D rendering. There appear to be no behavioral changes
from this, but we need to be careful here.
r_viewfbo 1 disables this logic (it differs in no other way from r_viewfbo 0)
Rudolf Polzer [Tue, 2 Jan 2024 19:19:28 +0000 (11:19 -0800)]
R_BlendView: fix motion blur by using the correct FBO for it.
Motion blur has to be applied to the view FBO, not the (optional) screen FBO.
Especially as the code generating runs before even writing to the screen FBO.
bones_was_here [Tue, 26 Dec 2023 07:45:26 +0000 (17:45 +1000)]
Makefile: support explicit static linking of all configurable libraries
Fixes a bug in df973c344562c8cadc2413d36dcaa03f8e9040c2 where
libd0_rijndael static linking only worked if
DP_LINK_CRYPTO_RIJNDAEL=static was read from the environment rather than
being passed as an override.
bones_was_here [Thu, 21 Dec 2023 11:06:36 +0000 (21:06 +1000)]
cvar: use unsigned for flags and hashindex
Signed is too error-prone with bitwise operations. The common pattern
of passing ~0 (all bits set) resulted in neededflags=-1 in a backtrace
on x86_64.
bones_was_here [Tue, 12 Dec 2023 10:13:26 +0000 (20:13 +1000)]
net_slist: reduce worst-case time until any given server first appears
Fixes sending multiple queries to servers that happen to be early in the
list before sending any to servers late in the list, when
net_slist_maxtries > 1, which was a side-effect of making
net_slist_maxtries work as described in fe2b222e32752c408fbe5ccf4ac3fb546f8ff41a.
Slightly reduces the total real time and CPU time to query all servers.
bones_was_here [Sat, 9 Dec 2023 07:49:56 +0000 (17:49 +1000)]
cbuf: recycle node after it executes, clear commands on Host_Error()
This reverts 626658074c8dd5c2288becd836103e2efdb9b741 which looks like a
potentially racy or non-threadsafe approach, and instead prevents
problems by clearing the command buffers if Host_Error() is called and
doesn't shut down DP.
bones_was_here [Fri, 1 Dec 2023 06:18:45 +0000 (16:18 +1000)]
client: improve server connection status messages
Always logs various errors and rejections that previously were only
visible with developer cvar(s) set. Among other things this fixes
silent failure when trying to join a full server.
Includes IP address in more messages.
Uses CON_ERROR and CON_WARN colours for various errors and warns.
Moves status message generation to the code that sets the relevant
states. This allows more information to be included, makes the code
easier to follow and reduces polling.
Fixes some cases where a message was always clobbered before it could be
displayed.
Merges the built-in menu and loading screen connection status generation
and buffering.
bones_was_here [Sun, 26 Nov 2023 01:17:53 +0000 (11:17 +1000)]
Sys_Sleep overhaul
One function to rule them all, and in the darkplaces sleep threads.
Makes sub-millisecond accuracy available on Windows.
Increases the number of sockets we can monitor on Windows.
Improves Curl_Select() a little.
Updates flags of some timing-related cvars.
bones_was_here [Sat, 11 Nov 2023 10:47:50 +0000 (20:47 +1000)]
cl_maxfps*: various adjustments
Ensures minimum FPS of 10 even while idle to prevent weird issues
(networking assumes at least 10).
If you want to save more resources, hide the game window (disables
rendering entirely) such as by using vid_minimize_on_focus_loss 1.
Disables cl_maxfps_alwayssleep by default, on modern systems with
accurate timers and higher FPS this has a significant impact.
Allows cl_maxfps_alwayssleep to be used with cl_maxfps 0, this was
requested some time ago.
Switches from cl_maxidlefps to cl_maxfps when querying servers to give
pings representative of what can be expected when playing on them.
Simplifies state tracking, ping is now either valid or not set (0) and
isn't abused to store state.
Includes a hash-verified timestamp in pings, fixes impossible pings
(happened when querytime was updated before response arrived) and the
ability to add servers to a client's list with unsolicited packets
(abusing the LAN support).
Checks that DP/QW master server list packets originate from a configured
master (cvar net_sourceaddresscheck).
Fixes unreliable LAN support.
Significantly reduces the total time to complete a full query cycle for
DP servers by improving the logic as well as turning up some cvars.
Prints warnings if DP or QW master server queries time out.
Makes net_slist_maxtries actually give better ping reports like its
description says.
Makes net_slist_pause completely pause (QC builtin resorthostcache()
used by Xonotic and Nexuiz bypassed it), clarifies description, uses a
callback instead of polling to handle changes.
Changes sv_masters[] and sv_qwmasters[] iteration to a more idiomatic
pattern pattern (numeric limit instead of a "null cvar" terminator).
Checks that sockets are open before writing to them in
NetConn_QueryQueueFrame() to avoid crashing in case we ever close a
lower numbered socket while a higher numbered one is still open.
Separates QW master list parsing into a func (like DP list parsing).
Fixes sending a DP master query string to the QW masters if the first
socket is an IPv6 one.
bones_was_here [Fri, 3 Nov 2023 09:15:06 +0000 (19:15 +1000)]
net_slist: update types, declarations
Mostly this changes array indices and externally-sourced data that
should never trigger signed overflow to unsigned,
and changes to lhnetaddresstype_t where applicable.
Fixes an old bug in the DP Quake server list where if there are less
servers than the most that could fit onscreen, the list jumps around
and/or duplicates entries when moving the cursor down.
bones_was_here [Fri, 3 Nov 2023 07:55:44 +0000 (17:55 +1000)]
net_slist: code style/formatting fixes
I wouldn't normally nitpick this stuff but the random tabs mixed into
code and comment lines were too annoying and fixing it later commits
would make their diff too noisy.
bones_was_here [Sun, 12 Nov 2023 12:33:10 +0000 (22:33 +1000)]
Fix bug where +binds could get latched at low FPS
This was introduced in 6b21c467a83808e3becf61afe7b67a88f870b502 which
didn't ensure the -bind would be executed after the +bind when the
keydown and keyup events are processed in the same frame.
bones_was_here [Thu, 5 Oct 2023 18:44:37 +0000 (04:44 +1000)]
input: stop capturing mouse movement if window is hidden without first losing focus
Fixes players looking all around after they alt+tabbed.
Moves the logic for selecting the mouse mode out of screen drawing and
into SDL event handling where it's unaffected if we early-out of drawing
the frame.
Prevents mouse "grab" (raw/relative mode + cursor hiding) in a few
"loading" situations.
bones_was_here [Wed, 4 Oct 2023 16:43:12 +0000 (02:43 +1000)]
vid: implement monitor selection with instant cvar changes
Adds cvars: vid_display, vid_info_displaycount
Prints the monitors detected at startup and on hotplug.
Requires SDL headers >= 2.0.18 at build time.
At runtime older versions should still work but may lack some functionality.
May not work properly or at all if vid_desktopfullscreen is 0.
May require vid_restart after hotplug events.
---
Changes existing cvars vid_fullscreen, vid_desktopfullscreen, vid_resizable,
vid_borderless to apply instantly.
Also (for windowed mode) works around window managers that move the
window after SDL creates and centres it (typically when adding a
titlebar), so the crosshair is always at the centre of the monitor.
Adds some missing SDL_WINDOWEVENT enumerations.
Changes the GL viewport size retrieval from screen coordinates to
pixels, which is a prerequisite for "HIGHDPI" aka "Apple Retina"
support.
bones_was_here [Tue, 3 Oct 2023 17:24:44 +0000 (03:24 +1000)]
vid_vsync: fully support adaptive, remove polling, print better errors
Adaptive vsync was partially supported: it worked if set before window
creation but not if toggled on afterwards, and wasn't mentioned in the
cvar description.
The immediate application of `vid_vsync` cvar changes was implented by
polling, which was ok for one cvar but I'll be making more vid_ cvars
apply immediately (no vid_restart needed), and don't want to poll for
things that rarely change every frame.
SDL is now queried for the current state of vsync instead of storing
what we believe to be the current state.
If the setting can't be applied the reason (as reported by SDL) is now
printed.
bones_was_here [Fri, 27 Oct 2023 15:47:55 +0000 (01:47 +1000)]
Fix GCC 13 warns: ‘new_velocity[0]’ may be used uninitialized
Pretty sure this was a false positive, for it to happen `numplanes`
would have to be <= 0 in the loop which sets `new_velocity` which should
be impossible. Declaring `numplanes` as unsigned placates the compiler,
and these ints should be unsigned anyway because they index an array.
bones_was_here [Tue, 3 Oct 2023 02:36:16 +0000 (12:36 +1000)]
Implement OpenGL version checking, use it for occlusion queries
This allows DP to use core features added after 3.2 without crashing,
in this case query buffer objects.
In div0-stable GL_ARB_query_buffer_object was checked but that extension
was written against 4.3 and became part of core in 4.4 so we can just
check for 4.4.