Commit graph

46 commits

Author SHA1 Message Date
Daniel Gibson
ae2d3a7e99 Support (hopefully) all keyboard keys via scancodes, #323
If a key is pressed whichs SDL_Keycode isn't known to Doom3 (has no
corresponding K_* constant), its SDL_Scancode is mapped to the
corresponding newly added K_SC_* scancode constant.
I think I have K_SC_* constants for all keys that differ between
keyboard layouts (which is mostly printable characters; F1-F12, Ctrl,
Shift, ... should be the same on all layouts, which means that e.g.
SDL_SCANCODE_F1 always belongs to SDLK_F1 which the old code already
maps to Doom3's K_F1).
What's extra nice (IMO) is that when Doom3 requests a *localized* name
of the key (like for showing in the bindings menu), we actually use the
name of the SDL_Keycode that *currently* belongs to the scancode, and
esp. the "Western High-ASCII characters" (ISO-8859-1) supported by Doom3
like Ä or Ñ are displayed correctly.

(I already implemented a very similar hack in Yamagi Quake II and
 reused the list of scancodes)

This should fix most of the problems reported in #323
2021-07-15 07:00:18 +02:00
Daniel Gibson
61a49a2547 Implement clipboard support on POSIX platforms with SDL2
Added Sys_FreeClipboardData(char*) so I don't have to copy the string
from SDL_GetClipboardText() into a Mem_Alloc() buffer, but can just
do the right thing per platform, which in case of POSIX/SDL2 is
SDL_free().
SDL1.2 doesn't have clipboard support, otherwise I'd have removed all
platform-specific implementations and used SDL_Get/SetClipboardText()
everywhere (IIRC AROS only supports SDL1.2?)
2021-07-03 02:25:20 +02:00
Daniel Gibson
a523c28c18 Add SysIsMainThread() function
returns true if called in the main thread
2021-06-20 03:36:39 +02:00
David Carlier
09c1330a0e make it compilable under openbsd 2016-12-09 16:21:54 +00:00
dhewg
d2b7eac843 Get rid of Sys_SetFatalError()
Unnecessary.
2012-07-06 01:24:25 +02:00
dhewg
84717833e1 Get rid of sysMemoryStats_t
Unused.
2012-07-06 01:06:56 +02:00
dhewg
b58f51dbfa Get rid of Sys_FPU_StackIsEmpty()
Same as with Sys_FPU_GetState().
2012-07-06 01:06:53 +02:00
dhewg
0ccef1eba8 Get rid of Sys_FPU_GetState()
This was only implemented with MSVC style asm.
Comments suggest that it was used to help catch invalid FOV calculations,
which were probably only happening with ancient compiler bugs.
2012-07-06 01:06:53 +02:00
dhewg
93fdc96e60 Get rid of Sys_FPU_EnableExceptions()
No exceptions were ever enabled.
2012-07-06 01:06:51 +02:00
dhewg
65b13cb73e Use a more modern way to set the fpu precision 2012-07-06 01:06:51 +02:00
dhewg
a4558bb080 Get rid of Sys_FPU_SetRounding()
Unused.
2012-07-05 21:31:49 +02:00
Andre d
7a5b8b1ec0 Remove (faulty/outdated) video ram detection 2012-07-04 22:47:38 +02:00
dhewg
e55753e626 Introduce fs_configpath
Split fs_savepath for config files. This is in preparation for
moving the writable paths on *nix to $XDG_DATA_HOME and
$XDG_CONFIG_HOME.
Affected files: config.spec, *.cfg, doomkey, xpkey.
2012-07-03 21:12:58 +02:00
dhewg
478fa783f6 Unify Sys_*Path() into Sys_GetPath() 2012-07-03 21:12:56 +02:00
dhewg
1ce658e835 Get rid of memory status functions
Unused.
2012-01-08 12:24:58 +01:00
dhewg
6a1d6cb842 Always allow multiple instances 2012-01-08 12:24:58 +01:00
dhewg
9542663097 Get rid of Sys_DefaultCDPath()
Stub on all platforms.
2012-01-08 12:24:58 +01:00
dhewg
1fed72fbb4 Get rid of Sys_DoPreferences()
The OSX backend was the only one utilizing this to set CVars
for the video mode.
Not required anymore since its now based on SDL.
2012-01-05 00:24:13 +01:00
dhewg
44b35ccf13 Make Sys_GetScanTable() only available on Windows
Sys_GetScanTable() and MapKey() are only used by the Windows backend
or the Windows-only tools.
Rename to Win_GetScanTable() and move MapKey() as Win_MapKey() to
win_input.cpp.
2012-01-02 15:44:35 -05:00
dhewg
5d69699edf Rename Posix_ConsoleInput() to Sys_ConsoleInput()
Sync with Windows implementation and add it to sys_public.h in
preparation to move the event queue to SDL.
2012-01-02 15:44:16 -05:00
dhewg
ca04dd36d8 Get rid of the unused Sys_FPU_ClearStack 2011-12-22 11:07:01 +01:00
dhewg
d4281b56bf Get rid of Sys_GetProcessorString()
This was only used for a printf() and not implemented for all
the platforms we can now run on.
We also don't want to force a CPU type on Windows.
2011-12-22 10:38:40 +01:00
dhewg
4150029322 Unify CPUID_FTZ and CPUID_DAZ
Get rid of the 2 CPUID flags and combine them with SSE in one
implementation.
SSE flags can now be set on all x86 and x86_64 platforms -
independent of -ffast-math.
Helper defines borrowed from STREFLOP.
2011-12-22 10:38:40 +01:00
dhewg
acfe2489e4 Get rid of unused CPUID flags 2011-12-22 10:38:40 +01:00
dhewg
e2b46a5a34 Get rid of Sys_GetClockticks() and Sys_ClockTicksPerSecond()
Now unused.
2011-12-22 10:38:39 +01:00
dhewg
a99971f44c Add GetMilliseconds to idSys
To be used for the overhauled idTimer in idlib/.
2011-12-22 10:38:38 +01:00
dhewg
c994974ffc Port Sys_Milliseconds() to SDL
Sync with SDL and use unsigned int as return type.
Code outside of sys/ still uses signed ints to store the result.
2011-12-22 10:38:38 +01:00
dhewg
317e63887c Port Sys_Sleep() to SDL 2011-12-22 10:38:38 +01:00
dhewg
e7482b4957 Port all thread related functions to SDL
Setting thread priorities has been dropped (it is not portable).
The background download thread now exits gracefully.
g_threads is not public anymore.
2011-12-22 10:38:37 +01:00
dhewg
5a052e846f Move MAX_THREADS as define to BuildDefines.h 2011-12-21 17:50:39 +01:00
dhewg
1a25b165b0 Port critical sections and events to SDL
Use SDL mutexes and conditions.
One new critical section CRITICAL_SECTION_SYS for events.
2011-12-21 17:50:35 +01:00
dhewg
da60a2a631 Adapt structs for easy forward declarations
Get rid of the tag namespace.
2011-12-19 23:18:15 +01:00
dhewg
96ef0754e2 Split platform specific code from precompiled.h
New header sys/platform.h.
2011-12-19 20:31:28 +01:00
dhewg
9df3383b61 Remove Sys_LoadOpenAL() and Sys_FreeOpenAL()
This is not required anymore, all binaries on all platforms
either link against OpenAL or use the stub.
2011-12-14 18:23:49 +01:00
dhewg
5c3a28e027 Basic infrastructure to build with MinGW
Add WIN32 support to CMake (core and games, no dedicated for now).
Only use MFC when it is available.
2011-12-14 18:19:38 +01:00
dhewg
41a1122a82 Remove the unused and useless CallStack code
This was never enabled and only implemented for Windows.
2011-12-14 02:39:42 +01:00
dhewg
18762483e6 Change return type of [Sys_]GetProcessorId to int
Fixes compile error: invalid conversion from 'int' to 'cpuid_t'
2011-12-13 18:57:30 +01:00
dhewg
5ee2e5b564 Fix and cleanup endianess defines
Use various defines set by the compiler to determine the
endianess of the target arch.
2011-12-10 15:36:15 +01:00
dhewg
04832863e8 Basic infrastructure to build on *BSD 2011-12-10 15:36:15 +01:00
dhewg
f9dd2f93eb Fix platform dependent thread function definitions
Thread return types are different between platforms, and its
probably not a good idea to return something of a different size,
cast the callback and expect it to not crash.
2011-12-10 15:36:13 +01:00
dhewg
0c84e4bff3 Fix shared library loading for x86_64
Library handles are "void *" on posix.
2011-12-10 15:36:10 +01:00
dhewg
6b1e27b157 Trivial pointer cast fixes for x86_64 2011-12-10 15:36:09 +01:00
dhewg
2995bcab30 Basic infrastructure for native x86_64 builds
Let scons link directly in the build folder.
Multiple archs can coexist next to each other.
New scons variable "X86" to cross compile x86 binaries on x86_64.
2011-12-10 15:36:08 +01:00
dhewg
79ad905e05 Fix all whitespace errors
Excluding 3rd party files.
2011-12-10 15:35:54 +01:00
dhewg
ff493f6847 Fix quoting in GPL headers 2011-12-10 15:34:48 +01:00
Timothee 'TTimo' Besset
fb1609f554 hello world 2011-11-22 15:28:15 -06:00