Commit graph

284 commits

Author SHA1 Message Date
Yamagi Burmeister
5b44c9f3b4 Make the (new and old) download code UTF-8 compatible.
- Replace all remove() with Sys_Remove().
- Implement Sys_Rename() and replace all rename() with it.

This is believed to close #348.
2018-12-20 18:01:38 +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
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
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
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
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 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
Yamagi
881d9afda6
Merge pull request #322 from Smilo-platform/master
Fix IPV6 networking
2018-10-01 17:33:04 +02:00
Yamagi Burmeister
012ab85b31 On Windows we need to pass wchar strings to remove().
Until now the server just called remove() to delete the servers state
from the HDD. That was fine on Linux were UTF-8 is used but failed
silently on Windows in case that the working dir path had some Unicode
characters. Replace remove() by Sys_Remove(), on Linux it's just a
wrapper around remove() on Windows it does a UTF8->UTF-16 conversion
and calls _wremove(). This fixes issue 318.
2018-09-30 18:57:06 +02:00
Unknown
79bcd35a3d Changed ipv6 address 2018-09-12 08:55:13 +02:00
Unknown
220f0a940a Fixed ipv6 address to use 0.0.0.0 instead of 127.0.0.1 2018-09-11 15:35:21 +02:00
Unknown
b5b491710c Fixed incorrect ipv6 local address 2018-09-11 15:07:37 +02:00
Yamagi Burmeister
10bdaaec06 Move stb_image_write.h into vid. It's used there, only. 2018-08-07 11:45:26 +02:00
Yamagi Burmeister
af703e8cd9 Remove the old SDL 1.2 version of the icon. 2018-08-07 10:35:18 +02:00
Yamagi Burmeister
1fcd0324e0 Move the icon into the vid interface.
It's only used there.
2018-08-07 10:30:11 +02:00
Yamagi Burmeister
5bff7e1568 Move refresh.c into the client and rename to glimp_sdl.c.
The GL backends have been an integral part of the vid interface for
years.
2018-08-07 10:08:20 +02:00
Yamagi Burmeister
b805b4e044 Move vid.c and dependencies into the client.
The vid interface has been exclusive to the client for years, trace
that in the file hierarchy.
2018-08-07 10:00:21 +02:00
Yamagi Burmeister
61400d1ae8 Move input.c and input.h into the client and rename to sdl.c.
The input system backend was once used in the client and the renderers,
but for some years now it has been an integral part of the client only.
Move it there.
2018-08-07 09:43:34 +02:00
Yamagi Burmeister
956902538f Move sound.c into the sound system source and rename to sdl.c.
The OpenAL backend was already part of the sound system source. And
there's no need for the SDL backend to be part of the generic backends.
2018-08-07 09:31:08 +02:00
Yamagi Burmeister
5501c38736 Move qal.c and qal.h to the other sound system sources.
The OpenAL backends used only by the sound system, there no need to
have them in the generic part of the sources.
2018-08-07 09:23:07 +02:00
Yamagi Burmeister
63350c418e Clearify some FIXMEs and bump the renderer API.
The last commits did some bigger changes to the interaction between the
GL renderers and the client. The code is now SDL 2.0 conformant, window
and context creation are strictly distinct operations. SDL is only
initialized when necessary. Since this broke the client <-> renderer
API, bump it's version.

There a lot of things left to do for dark and cold winter evenings:

* The software renderer implements it's own window handling and
  reinitialized SDL whenever vid_restart is called. This is highly
  problematic.
* vid_fullscreen is abused to communicate changes to renderer config
  throughout the code. That's a very ugly, messy and potential very
  problematic hack. But not easy to remove.
* Some funtion calls between the client and the renderer are
  unnecessary.

The changes to the client <-> renderer interaction fixed issue #302.
2018-07-31 18:57:13 +02:00
Yamagi Burmeister
6855f97487 Reset SDLs GL state before reinitializing the renderer.
In the old world we deinitialized and reinitialized SDL each time we
restarted or changed the renderer. That would clear the whole GL state.
In the new world we let SDL running and just recreate the windows. In
some cases parts of the old renderers state would leak into the new
renderer, leading to strange problems.
2018-07-31 14:32:13 +02:00
Yamagi Burmeister
bef21c101e General cleanup of vid.c
* Reformat code and reorder functions.
* Remove unnecessary stuff.
* Move everything possible into headers.
* Implement a clean fallback logic, gl3 -> gl1 -> soft.
2018-07-31 14:32:13 +02:00
Yamagi Burmeister
b8a062e36b Cleanup and refactor gl3_sdl.c.
* Another round of general cleanup.
* Introduce gl3_libgl cvar to force a libGL.
* Fix stencil buffer tests.
* Further untangle window <-> context stuff.

The window is now fully at client side, the context at renderer side.
This is another break of the renderer API. And at least GL1 needs to
track this, it's broken for now.
2018-07-31 14:32:13 +02:00
Yamagi Burmeister
5db73a795b General cleanup of refresh.c.
* Even more syntax and code style fixes.
* Rename functions to match their actual purpose.
* Fix comments.
* SDL initialization and shutdown is now client side only. With
  SDL 1.2 finally gone there's no need to involve the renderers
  in it.

This breaks the client <-> renderer API. I haven't bumped the API
version with this commit because there're likely more changes when
I'm going through the renderer side of things. The VID backend also
needs a lot of love...

It might be a good idea to move this SDL backend files into the client
and rename them. We'll decide that at a later time.
2018-07-31 14:32:13 +02:00
Yamagi Burmeister
2099626b7b Remove SDL 1.2 support from the client side render backend. 2018-07-31 14:24:28 +02:00
Yamagi Burmeister
cc15f0c10c Remove SDL 1.2 support from the SDL sound backend.
While at it do some minor cleanup.
2018-07-31 14:24:28 +02:00
Yamagi Burmeister
3f65f7254b Some general cleanup to the input backup.
* Some globals could be made static.
* Add comments were appropriate.
* And format the file to one coding stile. What is so hard with
  keeping to one style?! MY IDE is even able to interfere the
  style from existing code...
2018-07-31 14:24:28 +02:00
Yamagi Burmeister
4fb271c2df Remove SDL 1.2 from the input backend.
SdL 1.2 had it's time and is becoming a burden. This is the first
in a series of commits that'll remove it from Quake II.
2018-07-31 14:24:28 +02:00
Yamagi Burmeister
15898a2330 Remove CDA support from code. 2018-07-31 14:24:28 +02:00
Simon McVittie
b9aac1ad9b Fix spelling of "information", and re-word a comment with multiple typos 2018-07-21 12:03:23 +01:00
Yamagi Burmeister
176f95cc7c Enable backtrace printing on FreeBSD.
FreeBSD has supported printing backtraces for years. The API is the same
as on Linux, the only difference is that libexecinfo must be linked as a
seperate library. Since the last FreeBSD version with backtrace support
(FreeBSD 9.3) went out of support some time ago unconditionally enable
the printing.
2018-07-13 14:32:31 +02:00
Daniel Gibson
eb259d0c02 Exit game if loading fallback renderer failed
If loading gl3 fails, the game tries gl1 instead.
If that fails as well, the game should quit. Now it does.
2018-07-10 21:46:53 +02:00
Yamagi Burmeister
c2525a1e53 Remove lying comment. We don't rely on on DOS filenames anymore. 2018-06-12 18:22:35 +02:00
Daniel Gibson
8643c843ef Sys_IsDir() and Sys_IsFile() for Windows
I guess now the refactored Ogg/Vorbis code should work on Windows too.

Someone should test that though..
2018-06-12 18:22:35 +02:00
Daniel Gibson
c3af040f0c More ogg/vorbis refactoring, supports GOG-style tracks now
also removed lots of code.

Windows support still missing, needs Sys_IsDir() and Sys_IsFile().
2018-06-12 18:22:35 +02:00
Simon McVittie
c61e2983fc sdl/input: Fix spelling and grammar in a log message
The misspelling of "controller" was detected by Debian's Lintian tool.

Signed-off-by: Simon McVittie <smcv@debian.org>
2018-06-12 12:17:35 +01:00
Yamagi Burmeister
8e1f8fc7c6 Deprecate SDL 1.2.
We're going to remove support for SDL 1.2 shortly after the next
release. Give the last remaining users a very clear warning about
it, error out at force them to edit the code.
2018-06-07 07:39:20 +02:00
Denis Pauk
56ea94978d [-pedantic] fix compilation waring about static array initialization
warning: string length ‘16384’ is greater than the length ‘4095’
ISO C99 compilers are required to support [-Woverlength-strings]
2018-05-20 13:55:04 +03:00
David Carlier
2f0c2f8981 - Fix addrinfo leaks. 2018-05-01 10:17:20 +00:00
maxice8
2365d4705f fix compilation on musl libc. 2018-03-29 10:29:30 -03:00
Yamagi
c68aade396
Merge pull request #275 from 0lvin/3dhaptic
Use  SDL_HAPTIC_CARTESIAN as effect direction.
2018-02-15 07:35:58 +01:00
Daniel Gibson
3acf5f0cba VID_WriteScreenshot() PNG compression level must be < 10
10 is no valid zlib compression level, so make sure it's not used

Thanks to @maraakate for pointing this out!
2018-02-15 00:39:43 +01:00
Denis Pauk
c68fd0be5b Add 3d haptic/SDL_HAPTIC_CARTESIAN with distance and orientation 2018-02-14 23:07:20 +02:00
Yamagi Burmeister
832f3f6497 Implement vid_displayrefreshrate to override the displays refresh rate.
Modern LCD displays often haven't itegral refresh rates like 60hz but
fractional ones  like 59.95hz. SDL communicates the refresh rate as
integer. On X11 the rate is rounded up or down with round(), but on
Windows it's (at least on my system with an AMD Radeon) truncated...
So on an 59.95hz display it's just 59hz, Quake II renders 0.95 frames
too few and the user sees microstutters.

And return the actual / requested display frame rate increased by one
to work around inaccuracies in Quake IIs internal timing. It should be
a problem if we're running a little bit too fast.

This is belived to fix at least a part of issue #277.

Refreshrate 2
2018-02-13 17:36:15 +01:00
Yamagi
f0240af308
Merge pull request #278 from DanielGibson/remember-addressbook
Don't forget entries of Multiplayer "Address Book"
2018-02-13 17:35:59 +01:00
Daniel Gibson
c2061e8c83 Use const char* instead of char* in NET_StringToAdr() 2018-02-12 13:37:58 +01:00
Yamagi Burmeister
1e6f790d51 Make the stdout and stderr redirects unicode aware. 2018-02-05 18:20:41 +01:00