Commit graph

227 commits

Author SHA1 Message Date
dhewg
a35d8c08b6 Fix usage of wrong define in sys/cpu.cpp 2012-01-08 12:24:57 +01:00
dhewg
47e486b62a Add SDL_win32_main.c
Don't link against SDLmain.[a|lib], always compile it.
We can use pure C MinGW cross compiled libraries with MSVC, and
this is the only static library used.
2012-01-07 19:01:53 +01:00
dhewg
b3085e03b4 Fix sys/win32/* for x86_64 2012-01-07 19:00:43 +01:00
dhewg
4927299cb9 Include malloc.h for alloca for MinGW
Newer versions of MinGW do not seem to require this, but older
ones do.
2012-01-07 15:40:22 +01:00
dhewg
989b812a6e Cleanup DOOMController.mm
Cleanup headers and use MAXPATHLEN.
2012-01-05 00:24:16 +01:00
dhewg
6fa12c3a44 Get rid of the NSObject in DOOMController.mm
SDLmain.m does the bulk of the work for us, so get rid of
the DOOMController NSObject, move the quakeMain() contents to
main() and let SDL do its thing.
2012-01-05 00:24:16 +01:00
dhewg
532b642222 Get rid of checkOS() and checkDVD()
Former is already handled by cmake via -mmacosx-version-min=
and the latter is just a stub.
2012-01-05 00:24:15 +01:00
dhewg
8e5702ef36 Get rid of applicationShouldTerminate()
Redundant, already handled by SDL_QUIT event.
2012-01-05 00:24:15 +01:00
dhewg
23752a2cd2 Get rid of applicationDidFinishLaunching()
SDL already implements this for us and the assert()s are
already part of idlib.
2012-01-05 00:24:15 +01:00
spiral
ec0f836f41 Generate an .app bundle for OSX
Add missing SDLMain and icon/resource files to generated .xcodeproj

Now builds on Lion in XCode4 with the 10.6 SDK using LLVM-GCC4.2.

Also tested on WinXP in VS 9 2008 Professional, I don't appear to have
broken anything there, stuff like MACOSX_BUNDLE_INFO_PLIST is
effectively ignored.
2012-01-05 00:24:15 +01:00
spiral
6453bce10c We don't need XOPEN_SOURCE deprecated content
Just what's in sys/ucontext.h specifically.
2012-01-05 00:24:15 +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
3c90c12605 Don't link against X11 libraries
Not required anymore. All backends use SDL based implementations
now.
2012-01-05 00:24:13 +01:00
dhewg
bf69f7ec76 Use SDL GLimp and input implementations on OSX 2012-01-05 00:24:13 +01:00
dhewg
8df54ffad2 Move OSX ATI_fragment_shader functions
Move the software implementation to
sys/glimp_ati_fragment_shader.cpp in preparation to move to
the SDL based GLimp and events.
2012-01-05 00:24:12 +01:00
dhewg
36870b7e10 Get rid of stubs in the OSX backend 2012-01-05 00:24:12 +01:00
dhewg
b875b54b8b Get rid of Sys_FadeScreens() and Sys_UnfadeScreens()
Unused functions in the OSX backend.
2012-01-05 00:24:12 +01:00
dhewg
fdd6360712 Get rid of Sys_PauseGL() and Sys_ResumeGL()
Unused functions in the OSX backend.
2012-01-05 00:24:12 +01:00
dhewg
fa8e50a086 Get rid of unused Sys_Hide() and Sys_Unhide()
Unused functions in the OSX backend.
2012-01-05 00:24:12 +01:00
dhewg
cab89769b4 Get rid of dead code in the OSX backend
Not used by anything.
2012-01-05 00:24:11 +01:00
dhewg
42841c2435 Get rid of RegCodeHandler()
Unhooked ancient code in the OSX backend which isn't working
for D3XP.
2012-01-05 00:24:11 +01:00
dhewg
8fbc629be6 Add support for spanish keyboard layouts
There is no keyNum_t for º or ª; catch unmapped console keys.
2012-01-05 00:21:43 +01:00
dhewg
bf30c8216a Get rid of GetExceptionCodeInfo()
Unused function is the Windows backend.
2012-01-03 18:14:20 +01:00
dhewg
f7915a5ffa Get rid of dead code in the Windows backend
Not used by anything.
2012-01-02 20:00:11 +01:00
dhewg
1af6da6fdd Make the printf() family on Windows print to stdout
SDL logs this into stdout.txt for us.
2012-01-02 15:44:41 -05:00
dhewg
b83868090c Use SDL GLimp and input implementations on Windows
The DirectX SDK is not required anymore.
2012-01-02 15:44:40 -05:00
dhewg
95233c470b Use BufferCommandText() in win_syscon.cpp
Get rid of the dependency of the local event queue.
2012-01-02 15:44:36 -05: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
29013ff57d Use SDL for r_swapInterval
Enables vsync support for more platforms than just Windows.
2012-01-02 15:44:28 -05:00
dhewg
cd1561ac57 Implement alt+tab for toggling fullscreen mode 2012-01-02 15:44:22 -05:00
dhewg
ba3ae581ab Implement SDL_QUIT event
Shut down gracefully upon WM quit event.
2012-01-02 15:44:19 -05:00
dhewg
79aea4082f Port Linux events to SDL
New CVar "in_kbd" to set the layout for the keyboard. SDL 1.2
doesn't offer any way to determine it, and we need this feature
to use the same key for toggling the console independent of the
keyboard layout.
The old "in_nograb" from the Linux backend is still supported.
2012-01-02 15:44:16 -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
502aaa6fe2 Port Linux GLimp to SDL
Use SDL to set video modes, get a GL context and detect the
amount of VRAM.
As with the Linux GLimp implementation, sys_videoRam can be used
in case the SDL detection fails.
2012-01-02 15:44:09 -05:00
dhewg
1ecf98416c Get rid of GLW_WM_CREATE
Another stub.
2012-01-02 15:44:05 -05:00
dhewg
73779eca39 Get rid of unused GLW_InitExtensions()
Unused forward declaration.
2012-01-02 15:44:02 -05:00
dhewg
32530bf7a2 Get rid of GLimp_EnableLogging
Only stubs left.
2012-01-02 15:44:00 -05:00
dhewg
3be7fae15c Always link the Windows binaries against OpenGL
Just as with every other platform.
2012-01-02 15:43:59 -05:00
dhewg
21f6eeaaeb Move wgl* function pointers
Most are only used in the unused draw_exp.cpp, move them there.
2012-01-02 15:43:56 -05:00
dhewg
e6d8509752 Remove wglGetExtensionsStringARB from win_local.h
It's only used in win_glimp.cpp
2012-01-02 15:43:50 -05:00
dhewg
1afe61cc8d Get rid of dead render thread code
The Windows backend had some preparing code for this feature,
but there is no support at all for this in renderer/.
2012-01-02 15:43:48 -05:00
spiral
1507a657d4 Add ID_GAME_API for dllexport/attribute(visibility)
Delete obsolete Game.def exports files
2011-12-23 13:24:47 +01:00
spiral
13bab7a7e5 Remove MWERKS stuff 2011-12-23 13:04:21 +01:00
dhewg
cdf6fa3702 New define IDSTR_NO_REDIRECT
The defines in idlib/Str.h won't be set to redirect the low
level c string functions to idStr when IDSTR_NO_REDIRECT is
set.

Fixes compilation for MSVC:
error C2761: 'Cmp' : member function redeclaration not allowed

Reported by spiral.
2011-12-22 11:21:55 +01:00
spiral
7e5795dd56 Add missing includes for MSVC
- MSVC doesn't provide C99 headers
- Default to min. req. 64Mb video mem if no COM present
- Move misplaced __attribute__((packed)) from MSVC to MinGW
2011-12-22 11:07:01 +01:00
dhewg
ca04dd36d8 Get rid of the unused Sys_FPU_ClearStack 2011-12-22 11:07:01 +01:00
dhewg
6e0c766d14 Unify all Sys_GetProcessorId()
Use SDL functions whenever possible.
2011-12-22 11:07:00 +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
280c95b52c Use idSys::GetMilliseconds() for idTimer
The class is only used for debugging and statistical purposes.
The precision is now reduced to milliseconds, but that's only
relevant for fine grained debug timings - where the old code
was inaccurate at anyway.
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
7865e432a7 Port the async thread to a SDL timer
SDL implements timers via threads and it lets us easily aim at
a 60Hz frequency.
2011-12-21 17:50:39 +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
0f3c2ebf52 Use SDL for everything endian 2011-12-21 17:40:38 +01:00
dhewg
005677494f Initial SDL setup
Use SDL_main on all platforms.
Fix main() for non-const argv so it matches with the SDL
prototype.
Adapt win32 WinMain() to main() and get rid of the win32 special
case in Common::Init().
2011-12-21 17:40:05 +01:00
dhewg
efc71124b1 TypeInfoGen is standalone, don't compile/link it
Same change for scons as 8ca99602 for CMake.
2011-12-21 17:39:01 +01:00
dhewg
736ec20d4d Untangle the epic precompiled.h mess
Don't include the lazy precompiled.h everywhere, only what's
required for the compilation unit.
platform.h needs to be included instead to provide all essential
defines and types.
All includes use the relative path to the neo or the game
specific root.
Move all idlib related includes from idlib/Lib.h to precompiled.h.
precompiled.h still exists for the MFC stuff in tools/.
Add some missing header guards.
2011-12-19 23:21:47 +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
966a380793 Move BuildDefines.h include to platform.h 2011-12-19 20:33:09 +01:00
dhewg
5d8d3b726e Include cstddef for ptrdiff_t in platform.h 2011-12-19 20:33:09 +01:00
dhewg
90a53d0977 Move idlib typedefs to platform.h 2011-12-19 20:33:03 +01:00
dhewg
cf57db42e9 Move common includes from precompiled.h to platform.h 2011-12-19 20:31:32 +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
e5ec63ce06 Move the game include directory to the build system
Don't include based on a preprocessor symbol, let the build
system make the correct decision.
2011-12-19 20:05:20 +01:00
dhewg
76939c6de7 Delete redundant files 2011-12-15 17:51:36 +01:00
dhewg
b62b033b88 Get rid of all idAudioHardware implementations 2011-12-14 18:37:03 +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
dfdb6b6d4a Remove the unused win32 exception handler
Especially don't send crash reports from this tree to id ;)
2011-12-14 18:20:31 +01:00
dhewg
b2ccf9240c Fix Wwrite-strings warnings in sys/win32
deprecated conversion from string constant to ‘char*’
2011-12-14 18:20:31 +01:00
dhewg
3e25cc751a Always link the win32 binary against OpenAL
Just as with OSX and Linux.
2011-12-14 18:20:31 +01:00
dhewg
b6bcd0a9cb Fix compilation for MinGW
Just a few minor hiccups.
2011-12-14 18:20:30 +01:00
dhewg
661e8f453b Stub out win32 CPU functions for MinGW
Most of these use MSVC style asm.
Binaries compiled with MinGW will not use any SIMD code for now.
2011-12-14 18:20:30 +01:00
dhewg
ed349d71cc Fix Sys_QueMouseEvents for MinGW
DIMOFS_[X|Y|Z] can't be used in a switch statement.
2011-12-14 18:20:30 +01:00
dhewg
b8dc464dc7 Replace one unnecessary afxwin.h
No MFC required in win_taskkeyhook.cpp.
2011-12-14 18:20:30 +01:00
dhewg
f54752c209 Case corrections for includes on case sensitive fs' 2011-12-14 18:20:29 +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
36c5b05f1f Remove the unused and ugly HackChkStk() 2011-12-14 02:40:55 +01:00
dhewg
5052f42c9e Add a CMake build system
Tested on FreeBSD, Linux, and a ghetto rigged OSX i686 cross
compiler.

Find[OGG|Vorbis|VorbisFile].cmake borrowed from osgAudio
2011-12-14 02:40:49 +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
a3cd1cf54b Get rid of all #pragma mark
Fixes error: stray '\245' in program
2011-12-13 19:26:16 +01:00
dhewg
f81d32918f Implement Sys_GetProcessorId for x86 and x86_64
Detect CPU features at runtime via cpuid - code borrowed from
libavutil.
Availability of cpuid is not checked since pentium3 supports it
and that was the minimum requirement anyway.
Only features enabled at compile time will be available.

Forced MMX/SSE/SSE2/SSE3 and it passed all tests via:
./doom3.x86_64 +disconnect +set s_noSound 1 +testSIMD
2011-12-13 19:26:16 +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
8023bc5d56 Always compile all SIMD code
Protect all SIMD implementations with the according defines and
let the compiler decide if it supports the intructions.

Linux will still use Simd_Generic because CPU feature runtime
detection is missing.
2011-12-13 18:56:38 +01:00
dhewg
c15e761bae Get rid of frustum code specialized for gcc
The functions are exactly the same ;)
Maybe splitted into two files because of an ICE on some ancient
gcc?
2011-12-13 16:26:16 +01:00
dhewg
4c38aaae78 Get rid of dmap code specialized for gcc
According to the file this existed because of a gcc 3.5.5
optimization bug, which we do not care anymore about.
2011-12-13 16:25:08 +01:00
dhewg
74acc03147 Enable OpenAL for all platforms
New scons variable 'OPENAL' (defaults to '1') to toggle the
OpenAL sound backend.

Enable via "s_useOpenAL 1".
2011-12-11 17:07:13 +01:00
dhewg
db65f7a61d Use system OpenAL 2011-12-11 17:07:13 +01:00
dhewg
690967c276 Split EAX usage off OpenAL
New define ID_OPENAL_EAX to enable the deprecated EAX on top
of OpenAL.
OpenAL Soft can now be used.
2011-12-11 16:56:11 +01:00
dhewg
b54bc73532 Move Windows only OpenAL files to sys/win32/ 2011-12-11 16:00:31 +01:00
dhewg
bd1fe41b0e Move the OpenAL stub to sys/stub/ 2011-12-11 14:44:30 +01:00
dhewg
a8b1d3a364 Fix POSIX net code for x86_64
Multiplayer working from 32bit dedicated server on FreeBSD with a
64bit Linux client.
2011-12-10 19:24:30 +01:00
dhewg
bdb21d20c8 Fix wrong usage of memset() 2011-12-10 15:36:17 +01:00
dhewg
82aaccc1ad Use the local OSS headers 2011-12-10 15:36:16 +01:00
dhewg
1b8777a008 Get rid of GL_HARDLINK, always link against libGL
This kills the funky GL logging stubs, which unnecessarily
complicates the build process (think future cmake).
As for logging GL calls: Use apitrace for that
https://github.com/apitrace/apitrace
2011-12-10 15:36:16 +01:00
dhewg
9678020677 Fix compilation for *BSD
Change most __linux__ defines to __unix__ for all UNIX like systems.
2011-12-10 15:36:16 +01:00
dhewg
56bd47ac43 Fix Sys_FileTimeStamp return type
Sync with its header.
2011-12-10 15:36:15 +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
98eed69848 Fix -Wreturn-type warnings in the GL stub
no return statement in function returning non-void
2011-12-10 15:36:15 +01:00
dhewg
5c9973773b Force exit on double segfault
All bets are off in this scenario, don't deinit anything.
2011-12-10 15:36:14 +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
ab201cfc06 Stub Sys_GetClockTicks for x86_64
This is only used for debugging/stats.
2011-12-10 15:36:09 +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
49859d747e Comment XFlush() to prevent a crash on exit 2011-12-10 15:36:08 +01:00
dhewg
541f8f967a Fix typo in define
Gets rid of the warning:
XTRHEADS not defined -- this libXNVCtrl.a will not be thread safe!
2011-12-10 15:36:07 +01:00
dhewg
6e89dac99e Fix -Warray-bounds warning 2011-12-10 15:36:06 +01:00
dhewg
2556a3923f Fix -Wunused-result warnings
ignoring return value of

Implement some error checking.
Use [put|get]char in the posix tty code for ease of use.
2011-12-10 15:36:05 +01:00
dhewg
e4771f3a5f Fix -Wunused-variable warnings
unused variable
2011-12-10 15:36:03 +01:00
dhewg
7f4bcf94ca Fix -Wunused-function warnings
defined but not used
2011-12-10 15:36:02 +01:00
dhewg
fc447ec426 Fix -Waddress warning
the address of ‘hwparams’ will always evaluate as ‘true’

This was only in idAudioHardwareALSA::Initialize(), add the
missing return statement too while I'm at it.
2011-12-10 15:36:01 +01:00
dhewg
09f03c531a Fix -Wmissing-braces warnings
missing braces around initializer for ‘const char* [2]’
2011-12-10 15:36:01 +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
dhewg
adebc145e3 Delete foreign build systems
Eventually a cmake based build system will replace all these.
Also, interference with `git grep` can not be tolerated.
2011-12-10 15:34:41 +01:00
dhewg
afcd0a93ea Use system libvorbisfile 2011-12-10 15:34:41 +01:00
dhewg
e704911fed Use system libjpeg8
The unused WriteLossless() was using libjpeg internals found in
jpegint.h. This header is available with libjpeg8, but not shipped
by most distros. Disable the relevant code - no functional
changes.
2011-12-10 15:33:48 +01:00
dhewg
1b858a774f Use system libcurl 2011-12-10 11:00:03 +01:00
Timothee 'TTimo' Besset
15597777fc towards XCode 4 support - need those converted 2011-11-22 17:32:53 -06:00
Timothee 'TTimo' Besset
fb1609f554 hello world 2011-11-22 15:28:15 -06:00