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.
SV_FlyMove(): defer SV_Impact() call until after ground detection
Quake didn't use SV_PushEntity in SV_FlyMove() and id1 fiends depend on
the original behaviour of setting ONGROUND (etc) before calling
SV_Impact().
Fixes https://github.com/DarkPlacesEngine/darkplaces/issues/94
bones_was_here [Sat, 5 Aug 2023 08:20:44 +0000 (18:20 +1000)]
Fix mod_q1bsp_zero_hullsize_cutoff only applying to HLBSP in some cases
In 0dfd32e1e2bb2c1bd5e58b3202271c391be423de in one code path this
applied to Q1BSP and HLBSP, but the other code path was slightly
different and there it only applied to HLBSP. Oops :)
Properly reset server timers and perf stats after level change
This prevents the server running "catchup" physics frames immediately
after level change (when sv_maxphysicsframesperserverframe > 1) and
makes accurate stats available almost immediately (all 0 before that).
Moves perf stats from persistent to temporary storage.