Commit graph

2339 commits

Author SHA1 Message Date
Yamagi Burmeister
0ad406a95f Rework HTTP download console output.
We're printing only the two relevant informations: A download was queued
and a download finished or failed. That's enough to see what's going on
and not too noisy.
2018-12-20 18:01:38 +01:00
Yamagi Burmeister
29f9f48a06 Remove canceling of all downloads if the bsp failed to download...
...and fix the bugs, that were worked around with that crap, instead.
This removes some corner cases like cancelation of all HTTP downloads
and fallback to UDP if too many 404 errors were generated. If this is
still a problem in reality - for example HTTP servers blocking the
client after too many 404 or even crashing HTTP server - fix the server
and don't force the clients to work around that.
2018-12-20 18:01:38 +01:00
Yamagi Burmeister
7f085db431 Remove prioritization of pak file download.
We aren't in 1997 anymore, todays broadband connections are fast enough
to handle multiple large files. This may download some assets twice if
the server provides both a pak file with all assets and the assets as
plain files.
2018-12-20 18:01:38 +01:00
Yamagi Burmeister
df82598984 Rewrite memory buffer used by CURL.
There's no need to parse the HTTP header on our side of things, CURL can
do that. And the old buffer code was overcomplicated, simplify it. While
at it switch to normal malloc().
2018-12-20 18:01:38 +01:00
Yamagi Burmeister
9ba97177ea General cleanup of the ported download code.
- A lot of style fixes.
- Remove unused code.
- Simplify things.
- Fix some obvious bugs.
2018-12-20 18:01:38 +01:00
Yamagi Burmeister
3a24b9d6cf Remove the download speed calculation.
While the download speed calculations may be useful their implementation
is crappy and the integration into the console is rather fragile. If we
really want to support the progress bar with HTTP downloads this needs
to be reimplemented.
2018-12-20 18:01:38 +01:00
Yamagi Burmeister
f51661133d Fix URL generation.
The URL generation logic was buggy, it took the local fs_gamedir into
account when determining the files path on the server. That could have
worked in r1q2 or q2dos since they assume that the executable dir is
also the config dir. But it breaks in YQ2 were the executable dir and
the config dir differ.
2018-12-20 18:01:38 +01:00
Yamagi Burmeister
5d9aefd4ef Implement missing client interfaces.
These are:
- CL_ResetPrecacheCheck(): Resets the precacher, forces it to reevaluate
  which assets are available and what needs to be downloaded.
- FS_FileInGamedir(): Checks if a file (and only a real file, not
  somthing in a pak) is available in fs_gamedir.
- FS_AddPAKFromGamedir(): Adds a pak in fs_gamedir to the search path.
2018-12-20 18:01:38 +01:00
Yamagi Burmeister
0a94a8ee92 Port the HTTP / CURL download stuff from q2dos.
This is a very first cut:
* It compiles
* It doesn't crash

What's missing:
* cmake integration
* CURL should be loaded dynamically
* Integration between download code and filesystem
* Likely UTF-8 stuff
* cl_http.c needs cleanup
* Windows support
2018-12-20 18:01:38 +01:00
Yamagi Burmeister
380642468b Use %z modifiert to print a size_t.
This fixes a gcc warning on Win32.
2018-12-20 17:59:19 +01:00
Yamagi Burmeister
aa57ec9f7b Fix oversight in last commit, the '/ 2' is evil. 2018-11-22 21:15:09 +01:00
Yamagi Burmeister
e137ff1168 Fix stupid bug in brush model indix block size calculations.
We're taking indices and converting them to pointer relative to the
hunks base. Yes, that's dirty. Since the indices are stored as 32 bit
values and hunks are generally small using 32 bit pointers is enough,
even on 64 bit platforms. So the code took the size of void* / 2...
See the problem? Yes, that's not a good idea on 32 bit platforms. Bite
the bullet and just take the size of void*. Shouldn't be a problem,
because the indices are the first thing that's loaded and the hunk is
trimmed right after it anyways. If, and just if, we really need each and
every byte in the early stages of map loading we need two cases. One for
64 bit and one for 32 bit.

This fixes issue #346. Kudos to @ricardosdl for the analysis.
2018-11-22 17:41:55 +01:00
Yamagi Burmeister
4443d0a2eb Fix Windows build.
Note to me: Ask contributors if they've tested their changes on Windows.
2018-11-22 16:55:08 +01:00
Yamagi
ee4135fd0a
Merge pull request #343 from 0lvin/cppcheck
Cppcheck fixes
2018-11-14 19:04:27 +01:00
Yamagi Burmeister
587382644c Fix lost time calculation.
Lost time is time that we spend but didn't account. So the lost time
doesn't shorten a second (in fact that would mean that we'll lose the
time twice), it lengthen a second. Since has a small but noticeable
impact on timing when running with vsync enabled.
2018-11-12 22:17:10 +01:00
Denis Pauk
25498be7ca Support retextured images.
Code based on www.quakewiki.net/quakesrc/39.html
Code ignores skin images, and is disabled by default.
2018-11-12 23:02:23 +02:00
Denis Pauk
0307361101 Remove unused cvars 2018-11-12 23:01:08 +02:00
Denis Pauk
1b2708c06e cppcheck fixes.
In src/backends/unix/network.c:
* line 181: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
* line 276: The scope of the variable 'tmp' can be reduced.
* line 665: The scope of the variable 'mcast_addr' can be reduced.
* line 665: The scope of the variable 'mcast_port' can be reduced.
* line 666: The scope of the variable 'error' can be reduced.
* line 775: The scope of the variable 'i' can be reduced.

In src/backends/windows/network.c:
* line 186: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it?
* line 287: The scope of the variable 'tmp' can be reduced.
* line 707: The scope of the variable 'mcast_addr' can be reduced.
* line 707: The scope of the variable 'mcast_port' can be reduced.
* line 1049: The scope of the variable 'err' can be reduced.
* line 1163: The scope of the variable 'i' can be reduced.

In src/client/menu/menu.c

arrayIndexOutOfBounds:
* line 1921: Array 'creditsIndex[256]' accessed at index 256, which is out of bounds.

variableScope:
* line 332: The scope of the variable 'item' can be reduced.
* line 533: The scope of the variable 'x' can be reduced.
* line 533: The scope of the variable 'y' can be reduced.
* line 838: The scope of the variable 'b' can be reduced.
* line 864: The scope of the variable 'b' can be reduced.
* line 1910: The scope of the variable 'n' can be reduced.
* line 2199: The scope of the variable 'str' can be reduced.
* line 2812: The scope of the variable 'length' can be reduced.
* line 2813: The scope of the variable 'i' can be reduced.
* line 3838: The scope of the variable 'c' can be reduced.
* line 4112: The scope of the variable 'scratch' can be reduced.
* line 4181: The scope of the variable 'i' can be reduced.
* line 4345: The scope of the variable 's' can be reduced.

In src/game/player/hud.c

arrayIndexOutOfBounds:
* line 132: Array itemlist[43] accessed at index 255 which is out of bounds.
Itemlist assigned only once, and has only 43 items, better ignore unexisted items.

variableScope:
* line 82: The scope of the variable 'n' can be reduced.
* line 217: The scope of the variable 'x' can be reduced.
* line 217: The scope of the variable 'y' can be reduced.
* line 218: The scope of the variable 'cl' can be reduced.
* line 583: The scope of the variable 'cl' can be reduced.
2018-11-12 22:59:10 +02:00
Hugo Locurcio
2bf45a4750 Fix some typos in documentation 2018-11-10 18:16:30 +01:00
Yamagi
bbdd3f1d60
Merge pull request #342 from earth-metal/master
Add support for CTF options to "start network server" menu.
2018-11-07 18:04:22 +01:00
Yamagi Burmeister
4c63f7893c Update links. 2018-11-07 16:43:54 +01:00
Yamagi Burmeister
3b71e8d309 Transform the CONTRIBUTE file into a Contributing Guide 2018-11-07 16:38:41 +01:00
Yamagi Burmeister
900ef53670 Simplify the README, link to the documentation and the homepage. 2018-11-07 16:38:41 +01:00
Yamagi Burmeister
be7d532b06 Add an index page to the new documentation. 2018-11-07 16:38:41 +01:00
Yamagi Burmeister
22ade5dc7f Add a "configuration guide", explaining the most common options. 2018-11-07 16:38:41 +01:00
Yamagi Burmeister
544787a6b3 Update the packaging guide to be generic.
The packaging guide contained a lot if informations for the 6.x -> 7.x
migration. Since 7.x has long been done remove that instructions and
clarify the generic ones.
2018-11-07 16:38:41 +01:00
Yamagi Burmeister
9f65dcb679 Move the packaging guide into our new doc/ directory. 2018-11-07 16:38:41 +01:00
Yamagi Burmeister
edd3b1da8a Update the cvarlist to match reality. 2018-11-07 16:38:41 +01:00
Yamagi Burmeister
1a6c1f5227 Move the cvar list into the new doc/ directory. 2018-11-07 16:38:41 +01:00
Yamagi Burmeister
ba4d17b300 Add our new installation guide.
It's heavly based on the old README.md, but reworked and clarified.
2018-11-07 16:38:41 +01:00
Yamagi Burmeister
37a840ba0b Bump the default value of vid_maxfps to 300.
This should be save now that the async client is working more or less
flawlessly and is required for high performance displays.
2018-11-06 17:55:05 +01:00
Yamagi Burmeister
3c21575a01 Describe the limitiations of GLimp_GetRefreshRate(). 2018-11-06 12:26:56 +01:00
Yamagi Burmeister
8d5734ce9d Only account pure packet frames for average paket frame times.
With this change the code matches the comment. While most packet frames
are renderer frames, we must not take the render frame time into account
when calculating the average time spend processing the packet frames. I
dont's think that this change makes any measureable difference since the
packet frame time is just a very small fraction of the renderer frame
time.
2018-11-06 11:45:36 +01:00
earth-metal
77dbf36b40 Add support for CTF options to "start network server" menu.
Allow numeric input of "capturelimit" cvar and toggling of CTF dmflags
via menu system.
2018-11-01 21:50:31 -04:00
Yamagi
4155e8c26d
Merge pull request #340 from earth-metal/master
Minor bug-fixes: Case-insensitive file loading & Rogue dmflags display
2018-11-01 17:29:57 +01:00
Yamagi Burmeister
bfebcf0055 Remove unnecessary enforcement of the EUID and EGID.
I guess that these calls were added since dlopen() might ignore the
global LD_LIBRARY_PATH if EUID != UID. In Yamagi Quake II this isn't
a problem because we're enforcing EUID == UID in main() and don't use
LD_LIBRARY_PATH anyways.

These calls broke the jack audio server and maybe some other programs.
The problem was debugged by @ScrelliCopter. This commit closes issue
#270.
2018-11-01 17:09:53 +01:00
earth-metal
feeba61721 Fix typo preventing display of Rogue "dmflag" options. 2018-11-01 08:58:18 -04:00
earth-metal
31627ef68b Fix case-insensitive file loading.
Allow usage of capitalization in directory names above the YQ2 working
dir when loading non-PAK/PK3 assets with capitalized "name" criteria.
2018-11-01 08:54:37 -04:00
Yamagi Burmeister
b9e5306c84 Fix memory allocation on Windows.
* Take the cache line roundings into account when allocating a hunk.
* Use size_t were apropriate.
* remove some unnecessary and likely broken calls.

Another case of: "How could this ever work"?
2018-10-25 18:44:24 +02:00
Yamagi Burmeister
60c12228c9 Correct average render / packet time calculations.
We need to reset the avgrenderframetime and avgpacketframetime variables
when we recalculate the average times spend rendering frame and / or
processing package frames. Otherwise the result will be much too high,
leading to lost frames down below. I wonder why nobody complained about
this until now.

While at it lower the security margin from 2% to just 1%. On the one
hand we need a small security margin, because Quake II is not that
precise and out average times spend may be too low. On the other hand
the margin must not be too large, because the bigger the margin is the
bigger is the risk of missing frames... Both 2% and 1% is very small,
in fact often they don't even make a difference because of float ->
int conversations. For example 16 * 0,02 = 0,32 -> cut to 0. But there
are some extrem cases were it matters and my empirical testing showed
that 1% is slighty better then 2%. At least on my system. An it's
better to f*ck up the timing for a small number of frames than missing
a frame. A broken timing is hard to recognize, a missed frame is much
more annoying.
2018-10-23 18:37:25 +02:00
Yamagi Burmeister
861cf25ddf Fix ogg_shuffle display in menu.
In issue #296 it was pointed out that the menu shows ogg_shuffle
always as disabled, even if it's set to 1. This was an oversight,
the menu code was still checking the ogg_squence cvar removed in
the big OGG/Vorbis refactoring. Update it to match reality.
2018-10-22 20:25:16 +02:00
Yamagi Burmeister
80ef326927 Fix map loading on OS X.
@DanielGibson pointed out that _SC_PAGESIZE itself is too big,
_SC_PAGESIZE - 1 is correct. Also apply a small performance
optimization by querying _SC_PAGESIZE only once.
2018-10-09 19:11:47 +02:00
Yamagi
cbe89b982a
Merge pull request #332 from 0lvin/softrender_cleanup
Softrender cleanup
2018-10-09 19:09:03 +02:00
Yamagi Burmeister
b876579d4d Hunk allocation for FreeBSD 2018-10-08 22:29:45 +03:00
Denis Pauk
64babe9422 Allocate hunk equal to filesize 2018-10-08 22:29:45 +03:00
Denis Pauk
659d8e15c5 Add support for 32k+ marksurfaces in map 2018-10-08 22:29:45 +03:00
Denis Pauk
316918c29b cleanup code in sw_surf 2018-10-08 22:29:45 +03:00
Denis Pauk
26e9c6e5c4 cleanup code in sw_polyse 2018-10-08 22:29:45 +03:00
Denis Pauk
c30cffd1ed Use local currentmodel 2018-10-08 22:29:45 +03:00
Denis Pauk
0ff5dc804d Use local currententity 2018-10-08 22:29:45 +03:00