Commit graph

706 commits

Author SHA1 Message Date
Zack Middleton
f41bd37fde Add minimal emscripten support 2024-06-06 20:51:44 -04:00
Stefan Sundin
31c6d2f9d5
Add protocol handler support
This lets the user click a link in a web browser to very easily join a Quake 3 multiplayer game. As browser-based matchmaking websites become more popular, this makes it a lot more convenient and simple to play Quake 3 with others.

The links have the following URI format: quake3://connect/example.com:27950. The format has been designed to be flexible to allow more types of links in the future and avoiding having to make a breaking change. At the moment, "connect" is the only supported command.
2023-04-19 13:48:26 +01:00
kungfooman
29b0cc3a4d vm_x86.c: Add defined(_M_IX86) || defined(_M_X64) (fix for VS2019) 2022-08-18 16:32:19 -04:00
Zack Middleton
75ae9119e6 Fix passing arguments to VM dylib on Apple M1
The engine function pointer to vmMain used variadic arguments but
the vmMain function in the dylib has explicit arguments. Evidently
the arguments are stored on the stack and/or registers differently.

Found by fretn.
2021-11-19 14:54:59 -05:00
Zack Middleton
1c8b1122c5 Fix being unable to enter Team Arena CD key
The CD key defaulted to spaces. Q3 UI uses text overwrite mode by
default so typing the CD key writes over the spaces. Team Arena UI
uses text insert mode by default so to enter the CD key the user
had to delete the spaces or toggling overwrite mode by pressing
the insert key.

Now the CD key defaults to empty so in Team Arena you can just type
it in.
2021-10-23 08:36:10 -04:00
Tom Kidd
de055995d0
Merge pull request #482 from tomkidd/vs2019
Upgrade to build and run from VS2019
2021-10-22 16:38:11 -05:00
Tom Kidd
3afe37a896 Modified MS Store path handling to better follow the pattern of Steam/GOG 2021-10-22 11:28:55 -05:00
Tom Kidd
2fef57fffa Merge remote-tracking branch 'upstream/main' into xcode 2021-10-02 21:30:17 -05:00
Tom Kidd
3c78fe2295 Merge remote-tracking branch 'upstream/main' into vs2019 2021-10-02 21:19:48 -05:00
Adam Mizerski
26780805c8 qsort cannot be called with NULL
resolves #519
2021-09-27 11:15:14 +01:00
Tom Kidd
fa64d4f8a8 Added rudimentary support for automatically finding Microsoft Store version of Quake 3
Unlike the Steam and GOG support I'm not doing a registry search as I don't see anything in the registry that would show us the path. If we find more official ways to search for it later we can address that, in the meantime the path is just hardcoded to where it's installed by default.
2021-09-25 21:30:03 -05:00
Tom Kidd
52a43ae1c4 Upgrades to Xcode project and Apple Silicon support
- Reorganized Xcode project
- Added missionpack support to Xcode project
- Incorporated changes from MaddTheSane for Apple Silicon support https://github.com/maddthesane/ioq3
- Built SDL 2.0.14 for Apple Siicon, added to existing SDL dylib
- Built SDLMain for Apple Silicon, added to existing libSDL2main.a
2021-07-06 17:30:27 -05:00
Zack Middleton
d404519cce Fix rendering IQM models between model frames
For lerped frames (refEntity_t frame not equal oldframe) IQM joint
matrices may have incorrect axis scale. This can cause significant model
distortion. The matrix lerp is linear causing each vector to move in a
straight line between frames instead of arcing like a circle. Each joint
frame can have a different scale so can't just normalize the joint
matrix.

Store joints as quaternions and spherical lerp between them and then
convert to a matrix. For my test model, setting up the skeleton is four
times slower now but it still seems to be fast enough to be usable.
2019-04-29 15:01:47 -05:00
kungfooman
a6df505d59 Prevent Q_IsColorString from asserting on negative ascii chars 2018-12-14 10:00:24 +00:00
Zack Middleton
da861ff3a2 Fix not closing description.txt and fix path seperator
0 length description.txt files were not closed.
2018-05-03 16:13:19 -05:00
Zack Middleton
05758d52f4 Remove unnecessary NULL pointer check in Cmd_RemoveCommand 2018-04-26 11:22:55 -05:00
IR4T4
63e59a4591 Fix the behaviour of CVAR_LATCH|CVAR_CHEAT cvars
Fix the output/behaviour of CVAR_CHEAT flagged cvars in case they are
also of type CVAR_LATCH (avoid the early latch case return to make it
work as intended).
2018-04-08 22:08:04 -05:00
Dominic Fandrey
bf4c7a0341 Add missing address operator in cm_polylib.c
Also avoid nullptr dereference.
2018-04-08 21:41:31 -05:00
Dominic Fandrey
3a702ded65 Fix signed bit operations in MSG_ReadBits 2018-04-08 21:41:31 -05:00
Zack Middleton
4ea0eebfe5 Fix nullptr dereference in front of nullptr check in FS_CheckPak0
Found using LLVM sanitizer. Reported by Dominic "lonkamikaze" Fandrey
and David "devnexen" CARLIER.
2018-04-08 20:56:08 -05:00
Eugene C
9f294ce520 Fix MSG_Read*String*() functions not being able to read last byte from message
This is exact root of q3msgboom bug http://aluigi.altervista.org/adv/q3msgboom-adv.txt
Unfortunately, server still need this ugly '1022 char limit' hack to support unfixed clients in some degree.
And as it affects MSG_ReadBigString() - unfixed clients can still be crashed by 8191-chars long configstrings that comes with gamestate
2018-04-03 22:36:24 -05:00
Zack Middleton
0d6edd227a Support Unicode characters greater than 0xFF in cl_consoleKeys
Unrelated: make '0x' value be -1 (invalid) instead of 0.

Reported by MAN-AT-ARMS.
2018-02-22 18:15:53 -06:00
Thomas Köppe
3f29b8558d [qcommon] Make several zone variables and functions static. 2018-02-07 09:13:27 -06:00
Thomas Köppe
d047210aca [qcommon] Remove dead serialization code 2018-02-05 10:37:46 -06:00
Zack Middleton
71a9a5efa6 Make FS_InvalidGameDir() consider subdirectories invalid
fs_game shouldn't be a subdirectory and it simplifies the code.
2018-02-04 20:34:48 -06:00
Zack Middleton
83119a990a Fix Q_vsnprintf for mingw-w64
By default mingw-w64 uses Microsoft's broken _vsnprintf() in msvcrt.dll.
It can be overriden by defining __USE_MINGW_ANSI_STDIO but let's just
use the same behavior for both MSVC and mingw-w64.

Reported by @birdstakes.
2018-02-04 08:04:13 -06:00
Zack Middleton
738465d677 Revert my recent cvar latch changes
My cvar latch system changes prevent the Game VM from changing
g_gametype when the value is out of range due to it being registed in
the engine. It's been pointed out as fragile method of security, which
was still exploitable, by Noah Metzger (Chomenor). It doesn't seem like
this is working out to be a good solution.

The issue of fs_game '..' on server being relicated on client via
systeminfo exploit is still fixed as it's not affected by latch.
There are a few cases from current values of fs_game are used which
ideally should use fs_gamedir char array which has been validated.

Revert "Don't let VMs change engine latch cvars immediately"
Partially revert "Fix fs_game '..' reading outside of home and base path"
Revert "Fix VMs forcing engine latch cvar to update to latched value"
2018-01-21 22:45:46 -06:00
Zack Middleton
ed8d48cac3 Fix VMs forcing engine latch cvar to update to latched value
A few commits ago I stopped VM's Cvar_Set() from instantly updating
latched values. Now VM can't call Cvar_Register() afterword to force
latched value to be used.

Reported by Noah Metzger (Chomenor).
2018-01-21 19:49:16 -06:00
Zack Middleton
3638f69dff Fix fs_game '..' reading outside of home and base path
VMs could set fs_game to '..' at anytime to access files outside of home
and base path. fs_game sent by server to clients could also be '..' to
access files outside of home and base path.

'..' was not caught by FS_CheckDirTraversal() as it expects filenames
not a single directory.

I've made fs_game be latched to prevent VMs from changing it with no
good way to validate it before it's used. com_basegame and fs_basegame
are now latched as well.

Additionally, it's now possible to change com_basegame while the engine
is running. game_restart or vid_restart will make it take affect.
com_homepath is now CVAR_PROTECTED to prevent VMs from changing it
to a directory traversal.

This requires my two previous commits for preventing VMs from changing
engine latch cvars and only Cvar_Get fs_game in FS_Startup (so CVAR_INIT
isn't added in serveral other places).

Reported by Noah Metzger (Chomenor).
2018-01-21 06:02:28 -06:00
Zack Middleton
78ca670d4f Don't let VMs change engine latch cvars immediately
If a VM increases sv_maxclients while a server is running the engine
will crash. The value should be latched until engine decides to update
the cvar; the same as when a user sets it.
2018-01-21 06:02:08 -06:00
Zack Middleton
adef4e6c9e Don't register fs_game cvar everywhere just to get the value 2018-01-21 06:02:08 -06:00
Zack Middleton
3a6af1bc48 Fix VMs being able to change CVAR_PROTECTED cvars
VM could use Cvar_Register to set a protected cvar as user created and
was then able to use Cvar_Register with CVAR_ROM to change the value.

Don't allow Cvar_Register to affect protected cvars and prevent VMs
from adding internal flags to any cvars (creator, modified, protected,
nonexistent).

Reported by Noah Metzger (Chomenor).
2018-01-21 06:02:08 -06:00
Thomas Köppe
917bca4f7d Use standard offsetof facility. Dereferencing a null pointer results
in undefined behaviour.
2018-01-21 06:01:50 -06:00
Thomas Köppe
ed1794fe17 Change shift expressions to unsigned types. Shifting signed values to
a result that is not representable has undefined behaviour.
2018-01-21 06:01:50 -06:00
Zack Middleton
7e2aa2c627 Remove extra plus sign from Huff_Compress()
There was an extra plus sign in Huff_Compress(). It wasn't causing any
issues as it does not affect the generated code. Removing it makes the
source code the same as Huff_Decompress().

The odd source code was brought to my attention by Tobias Kuehnhammer.
2018-01-14 18:38:38 -06:00
Edward Betts
fe42b8653d Correct spelling mistakes. 2017-11-22 01:40:20 -06:00
Thomas Köppe
b3223dcfcb [qcommon] Use unsigned types where wrapping arithmetic is intended
The use of signed types in these expressions lead to overflow, hence undefined behaviour. The "sum" aggregator in Com_TouchMemory isn't even used (and presumbably just exists to inhibit optimizations from removing the memory access).
2017-10-02 19:46:37 -05:00
Zack Middleton
ead54782d0 Improve client input responsiveness
Move sampling input to the other side of framerate limiter.

Thanks to Alexander "wareya" Nadeau and Juraj "youurayy" Vitko for
pointing this out.
2017-08-21 21:40:54 -05:00
Zack Middleton
be1c71d363 Combine mouse movement events in event queue
Fixes 'Com_QueueEvent: overflow' spam after hitch / map load.

Based on patch by @ec-.
2017-08-21 20:12:26 -05:00
Zack Middleton
d2b1d124d4 Fix/improve buffer overflow in MSG_ReadBits/MSG_WriteBits
Prevent reading past end of message in MSG_ReadBits. If read past
end of msg->data buffer (16348 bytes) the engine could SEGFAULT.
Make MSG_WriteBits use an exact buffer overflow check instead of
possibly failing with a few bytes left.
2017-08-02 14:55:22 -05:00
Zack Middleton
7c252066a3 Fix set-but-not-used variable warnings in vm_armv7l.c
offsidx and const_value were set but not used.
2017-07-08 16:48:23 -05:00
Zack Middleton
dfce71929a Add con_autochat and con_autoclear cvars 2017-06-08 15:46:19 -05:00
Eugene C
c259e7cba3 Fix comment 2017-05-25 09:44:18 +01:00
ec-
566fb0edfc Allow unaligned load/store in QVM interpreter/x86 compiler
constructions like (dataMask & ~3) was used to protect against out-of-bound load/store when address is 4-byte closer to dataMask
 but at the same time it effectively cut low address bits for ALL load/store operations which is totally wrong in terms of conformance to ALLOWED (i.e. generated by q3lcc from C sources) low-level operations like packed binary data parsing
2017-05-25 09:44:18 +01:00
Zack Middleton
2c225a5a2b Merge pull request #199 from UniQP/typos
Fix some typos in comments
2017-05-24 13:41:15 -05:00
Zack Middleton
66365a3a85 Merge pull request #198 from UniQP/deadvariable
Remove dead variables
2017-05-24 13:40:53 -05:00
Zack Middleton
351e8f84d2 Merge pull request #270 from mickael9/unused-warning
Don't include (mission)pak_checksums in standalone build
2017-05-24 12:26:55 -05:00
Zack Middleton
05858d30e8 Don't load libraries with non-standard file extensions
Also don't allow writting files ending in a library extension such
as ".so.0" or ".dylib.0".
2017-05-24 10:28:46 -05:00
Max Crofts
af69d1148f Improve FS_GetModList
- Paths to search for mods are now specified in an array

- Mods can now consist solely of ".pk3dir" folders and still be
considered valid

- The function now has a consistent style
2017-04-12 17:49:50 +10:00
Max Crofts
7ff610db35 Detect GOG install path 2017-04-07 16:26:26 +10:00