Commit graph

18 commits

Author SHA1 Message Date
Daniel Gibson
cec460d38c Move stuff from sys/posix/ and sys/win32/ to sys/common/
All these files were almost identical, so there is no good reason to
have them twice..

and change CMakeLists.txt accordingly

(Not that this commit won't compile because some #includes are still
broken - will be fixed in the next one)
2013-03-18 00:38:58 +01:00
Daniel Gibson
95a1066004 prepare unification of more sys/win32/ and sys/posix/ stuff
because the code is almost the same anyway, so
* add win32 support to sys/posix/posix_signin.cpp
* add posix support to sys/win32/win_savegame.cpp
2013-03-18 00:38:40 +01:00
Daniel Gibson
c635566bcc Move sys/posix/posix_net.cpp to sys/common/socket_net.cpp, remove win_net.cpp
and adjust the CMakeLists.txt accordingly
2013-03-17 23:35:12 +01:00
Daniel Gibson
a2be306fed Add Winsock support to posix_net.cpp (to remove code duplication)
win_net.cpp and posix_net.cpp were almost identical, i.e. caused a lot
of duplicated code.
To get rid of that, unify both files - by adding Winsock support to
posix_net.cpp and, in the next step, moving posix_net.cpp to sys/common/
and removing win_net.cpp
2013-03-17 23:35:12 +01:00
Daniel Gibson
d5898abfa4 Don't use net_port as port to connect to
the connect commands supports adding the port with ":"
like "connect 10.1.2.3:27016" - if no port is set, it defaults to 27015

net_port is still used as the port to listen on and to send from.
2013-03-17 23:35:12 +01:00
Daniel Gibson
e8c8a04c07 rewrote posix_net.cpp based on win_net.cpp
And suddenly hosting a server on linux works at least locally
(with client and server on the same machine).
Even though there are still strange bugs (massive lags in one
direction, doesn't work in LAN), at least it works at all now.
2013-03-17 23:33:39 +01:00
Daniel Gibson
9aa63e4074 Some timer-related improvements for POSIX
* idSysSignal::Wait should now handle timeouts > 1s better (or at all)
* Use clock_gettime for Sys_Milliseconds()
* Use CLOCK_MONOTONIC_RAW (and CLOCK_MONOTONIC as fallback if
  that's not available) for Sys_Milliseconds() and Sys_Microseconds()
  CLOCK_MONOTONIC can behave strange when NTP is used
* Small fixes in Sys_Microseconds(): use 64bit int to store time
  (like return type...), divide by 1000 (not 1000000) for nsec=>musec
2013-03-16 14:32:47 +01:00
Daniel Gibson
a203345897 Configurable username for Multi-Player (ui_name), com_pause no cheat
D3BFG gets the username from Steam, in the GPL release it just
uses the hostname.
Now it's possible to set a custom name with the ui_name CVAR
(like in classic doom3). If ui_name is empty ("") the hostname
is used.

The window losing focus in MP resulted in the console being spammed
with "changing com_pause not allowed in Multi Player" (or similar)
messages. Added CVAR_NOCHEAT flag to com_pause to get rid of that.
2013-03-16 14:32:47 +01:00
Daniel Gibson
cf8d287a4e Fix Sys_ListFiles() on POSIX once again
Turned out that as "extension" (which is really more like a pattern
that matches the whole file) was even used with patterns like "*.*"
so we do proper matching using fnmatch() now - which is even easier
than the old way.
Now deleting savegames on POSIX works.
2013-01-04 14:40:35 +01:00
Daniel Gibson
a405b37f13 Pause when window loses focus, introduce com_pause
If the window loses focus com_pause is set to 1, when it regains focus
it's set to 0.
The behaviour on Win32 stayed the same (the implementation is less
hacky though) and Linux now matchces that.
2013-01-04 14:40:35 +01:00
Daniel Gibson
a102d9d469 also do Sys_Sleep for less then 20ms
Sys_Sleep(10) is used quite often throughout the code.
2012-12-30 16:26:24 +01:00
Daniel Gibson
edb4856abd Set timestamp for savegames on POSIX
So they can be sorted correctly etc
2012-12-29 05:29:56 +01:00
Daniel Gibson
1e3bc3429b Fix Sys_ListFiles() on POSIX as needed for savegames
In Sys_ListFiles() the extension was abused to match whole
filenames (of savegames), not just their extensions - that
didn't work with the POSIX backend, now it does.

Sys_ListFiles() now also supports "*" as a wildcard that matches
all files - needed for deleting savegames.
However, things like "bl*" or "*ub" don't work.

While at it, I replaced readdir() with the thread-safe readdir_r()
2012-12-29 05:29:29 +01:00
Robert Beckebans
731428164f Fixed error: class idLocalUserWin has no member named StorageSizeAvailable 2012-12-20 02:38:01 +01:00
Robert Beckebans
8b8cfe7d25 Small changes to pthreads. 2012-12-14 13:10:52 +01:00
Robert Beckebans
7b43a34f37 Changed idSysSignal pthread implementation to consider the manualReset parameter 2012-12-14 11:50:20 +01:00
Robert Beckebans
a1730fa430 Supplemented Linux backend with missing functions. -> [100%] Built target RBDoom3 on Kubuntu 12.10 2012-12-11 23:17:23 +01:00
Robert Beckebans
6d70f04cc9 Ported the Win32 threads to POSIX pthreads. 2012-12-09 01:55:59 +01:00