Commit graph

807 commits

Author SHA1 Message Date
Daniel Gibson
cdbb526a3b Add Doom3: Phobos to list of mods that need d3xp (STILL UNSUPPORTED!)
Hoping that Team Future eventually fulfills their promise of releasing
the source of the highly praised Phobos mod, I'm adding it to the list.

Currently this is not very useful, but when (if) the phobos source
becomes available I at least won't have to do a new dhewm3 release to
support it (but only provide tfphobos.dll/.so/.dylib).
2022-05-25 06:34:04 +02:00
Daniel Gibson
2f92bc268d Support loading The Lost Mission and librecoopd3xp via mods menu
by adding special cases for them that set `fs_game_base d3xp`.
Unfortunately there is no more generic way to do this, as mods have
no way to tell the engine if they need fs_game_base.
2022-05-25 06:17:29 +02:00
Daniel Gibson
b88b99fadb Fix assertion when switching to mod via menu, #458
The assertion that triggered was "assert(iconvDesc == (SDL_iconv_t)-1);"
in Sys_InitInput() - because when loading a mod the window is recreated,
calling Com_ReloadEngine_f() -> idCommonLocal::InitGame()
 -> idCommonLocal::InitRenderSystem() -> idCommonLocal::InitOpenGL()
 -> R_InitOpenGL() -> Sys_InitInput()

Before that Com_ReloadEngine_f() calls commonLocal.ShutdownGame( true );
which calls the equivalent Shutdown() functions - except so far no one
called Sys_ShutdownInput() (which closes iconvDesc and resets it to -1).
Fixed that by making idRenderSystemLocal::ShutdownOpenGL() call it.
2022-05-24 03:33:13 +02:00
Daniel Gibson
77e70b5df7 Add some missing newlines and fix typo in changelog 2022-05-21 06:30:54 +02:00
Daniel Gibson
0f9e066bf6 Fix running script debugger if fs_basepath is used
I don't think fs_cdpath is relevant (anymore? has it ever been?), but
fs_basepath sure is.
2022-05-18 04:22:25 +02:00
Daniel Gibson
e8a1eb8baf Fix mouse remaining ungrabbed when running map from Radiant 2022-05-18 04:01:33 +02:00
Daniel Gibson
a363ab4e31 Update version to 1.5.2rc1
.. and fix a link in the changelog
2022-05-16 17:44:15 +02:00
Daniel Gibson
c22965bf58 Work around assertion in alphalabs4, fix #409
In the savegame from that bugreport, "monster_zsec_shotgun_12" was
lying dead pretty much at its spawn point.
script/map_alphalabs4.script moves those "ride_of_death" platforms
around, and at the end of a cycle teleports "ride_of_death*_parent" back
to its starting position - and the "ride_of_death*" bound to it, which
is a pushing mover, just gets dragged along by the physics code and thus
can collide with that zombie cadaver, which then tries to push it along,
causing that assertion in TestHugeTranslation().
This is a map bug - Doom3 even prints a warning:
 WARNING: script/map_alphalabs4.script(722): Thread
  'map_alphalabs4::RideOfDeathPath': teleported 'ride_of_death2_parent'
  which has the pushing mover 'ride_of_death2' bound to it
So I just disable that assertion for this specific case..
Also moved the assertion behind the corresponding warning, so that gets
printed before the assertion kills the game..

Also a small change to CMakeLists.txt that should make enabling
LINUX_RELEASE_BINS after CMake has already been run without it work
2022-05-16 05:43:47 +02:00
Daniel Gibson
adad73cda7
CMake: Fix typo in MSVC-specific CPU detection for x64 2022-02-27 00:37:31 +01:00
Daniel Gibson
699779e9ca Make window alpha chan opaque on Wayland, fix #426
For some reason Wayland thought it would be clever to be the only
windowing system that (non-optionally) uses the alpha chan of the
window's default OpenGL framebuffer for window transparency.
This always caused glitches with dhewm3, as Doom3 uses that alpha-chan
for blending tricks (with GL_DST_ALPHA) - especially visible in the main
menu or when the flashlight is on.
So far the workaround has been r_waylandcompat which requests an OpenGL
context/visual without alpha chan (0 alpha bits), but that also causes
glitches.
There's an EGL extension that's supposed to fix this issue
(EGL_EXT_present_opaque), and newer SDL2 versions use it (when using
the wayland backend) - but unfortunately the Mesa implementation is
broken (seems to provide a visual without alpha channel even if one was
requested), see https://gitlab.freedesktop.org/mesa/mesa/-/issues/5886
and https://github.com/libsdl-org/SDL/pull/4306#issuecomment-1014770600
for the corresponding SDL2 discussion

To work around this issue, dhewm3 now disables the use of that EGL
extension and (optionally) makes sure the alpha channel is opaque at
the end of the frame.
This behavior is controlled with the r_fillWindowAlphaChan CVar:
If it's 1, this always is done (regardless if wayland is used or not),
if it's 0 it's not done (even on wayland),
if it's -1 (the default) it's only done if the SDL "video driver" is
  wayland (this could be easily enhanced later in case other windowing
  systems have the same issue)

r_waylandcompat has been removed (it never worked properly anyway),
so now the window always has an alpha chan
2022-02-05 16:34:34 +01:00
Daniel Gibson
d09ccb8539 If creating window fails, first try to reduce MSAA level, fix #440
so if someone configured 16x AA on a system that doesn't support it
(like when using AMDs open source driver), 8x will be tried before
falling back to a 640x480 window with no AA at all.
(and then it'll try 4x and then 2x and then no AA at all, and only then
 reducing color depth will start, and even later it'll fall back to
 a small 640x480 window)
2022-01-24 06:00:55 +01:00
Daniel Gibson
d34832e4fc Fix Mac build 2022-01-17 15:31:10 +01:00
Daniel Gibson
eff9fd6ac3 GLimp_Init(): Log r_mode and resolution used for creating window 2022-01-16 19:39:35 +01:00
Daniel Gibson
5f3356627e CMake: (Theoretically) support Windows on ARM, try to unify ARM CPU names
I don't have such hardware, so I can't test; I also didn't actually build
dhewm3 (would have to build dependencies for ARM first..), but when
configuring ARM or ARM64 targets for Visual C++ in CMake, that's now
correctly detected in CMake.

Also, now D3_ARCH should always be "arm" for 32bit ARM
and "arm64" for 64bit ARM, also when building with GCC or clang.
2022-01-16 18:17:39 +01:00
Daniel Gibson
67d0b7cf01 dhewm3log.txt for Windows, update changelog
I was lazy and just renamed SDL_win32_main's stdout.txt - but I still
added the dhewm3log-old.txt backup function.

I also renamed Sys_GetHomeDir() to Win_GetHomeDir() as it's Win32-only

On Windows it's in Documents\My Games\dhewm3\dhewm3log.txt
2022-01-16 18:17:39 +01:00
Daniel Gibson
5438c9409f dhewm3log.txt for AROS
basically the same as for POSIX, except I don't know where the
save dir is. I hope this works, can't test it myself..
2022-01-16 06:12:51 +01:00
Daniel Gibson
952292b4a6 POSIX: log output to save_path/dhewm3log.txt
and refactorings needed for that (I want to create the log right at the
 beginning before much else has been initialized, so using things like
 idStr or Sys_GetPath() isn't safe)

save_path being $XDG_DATA_HOME/dhewm3/ (usually ~/.local/share/dhewm3/)
on most POSIX systems, $HOME/Library/Application Support/dhewm3/ on Mac

If the log file already exists, it's renamed to dhewm3log-old.txt first,
so there's always the most recent and the last log available.
2022-01-16 06:11:20 +01:00
Daniel Gibson
4f74c15afe Make sure MAX_OSPATH has sane size; fix some typos 2022-01-16 06:02:40 +01:00
Daniel Gibson
d679e393c3 Add D3_(v)snprintfC99() for C99-compatible implementations
These are now used by idStr::(v)snPrintf(), and in the future can
be used if a (v)snprintf() that's guaranteed not to call
common->Warning() or similar is needed (e.g. used during early startup)
2022-01-10 04:06:54 +01:00
Daniel Gibson
ae63021d00 Add absolute mouse mode and refactor mouse grabbing code
There were lots of places in the code that called Sys_GrabInput(),
some of them each frame.
Most of this is unified in events.cpp now, in handleMouseGrab() which
is called once per frame by Sys_GenerateEvents() - this makes reasoning
about when the mouse is grabbed and when not a lot easier.
Sys_GrabInput(false) still is called in a few places, before operations
that tend to take long (like loading a map or vid_restart), but
(hopefully) not regularly anymore.

The other big change is that the game now uses SDLs absolute mouse mode
for fullscreen menus (except the PDA which is an ugly hack), so the
ingame cursor is at the same position as the system cursor, which
especially helps when debugging with `in_nograb 1` and should also help
if someone wants to integrate an additional GUI toolkit like Dear ImGui.
2022-01-10 00:46:32 +01:00
Daniel Gibson
00b58d1f0f Print available displays and mouse position before creating window
to debug issues like "dhewm3 chose wrong fullscreen resolution"
or "dhewm3 started on wrong display"
2022-01-08 18:10:06 +01:00
Daniel Gibson
8cb4843022 Shorten file path in backtraces
The build dir isn't relevant, only the source path starting with neo/ is

Also removed instances of nullptr
2022-01-08 17:02:24 +01:00
Daniel Gibson
3e039ca898 Fix misleading indentation in roq codec.cpp 2022-01-08 16:59:10 +01:00
Daniel Gibson
ea781c577e Use idStr::Copynz() instead of strncpy()
to guarantee \0-termination
2022-01-08 16:58:48 +01:00
Daniel Gibson
df0916ecf8 Mac: Fix RAM detection for >2GB
Sys_GetSystemRam() for OSX used some deprecated MacOS function from 1989
that used int32 for the amount of bytes.
Now using sysctl() instead, should be supported since at least 10.2.8
at least it's in
https://github.com/phracker/MacOSX-SDKs/blob/master/MacOSX10.2.8.sdk/usr/include/sys/sysctl.h
2022-01-08 16:07:22 +01:00
Felipe Woods
8e0d28374d Prevent user from running dhewm3 as root. 2021-12-16 23:08:09 +01:00
Daniel Gibson
dcbe0b172e Print SDL2 "video driver" at startup 2021-11-21 03:13:35 +01:00
Daniel Gibson
4b97bbca00 Update stb_vorbis to v1.22 and stb_image to v2.27
.. the latest releases.
Fixes sound issues on macOS/intel

While I was at it, updated stb_image as well
2021-10-31 06:14:59 +01:00
David CARLIER
3bf55225ab SDL backend, macOs warning build fixes proposal. 2021-10-30 23:55:31 +02:00
Daniel Gibson
0958d8464a CMakeLists.txt: Make D3_ARCH/dumpmachine output prettier
the newline in ${cc_dumpmachine_out} was a bit ugly
2021-10-12 19:59:40 +02:00
Daniel Gibson
ad327d34d1 Add support for GL_ATI_separate_stencil
glStencilOpSeparateATI() should behave exactly the same as
glStencilOpSeparate() so supporting it is easy enough and might help
some people with hardware or drivers that don't support OpenGL 2.0,
like the Mac OSX versions for PPC.
2021-10-12 19:32:32 +02:00
SiliconExarch
4f0c54f63f Fix compatibility with Mac OSX 10.4 and 10.5
- Fix build with SDL <=2.0.3
  SDL_GetGlobalMouseState was introduced in 2.0.4
  (which doesn't support OSX 10.5 or older)
- Don't include execinfo.h on Mac OS X 10.4
  This file isn't included in the 10.4 SDK
- Use custom typedef for PFNGLSTENCILOPSEPARATEPROC on OSX 10.4/10.5
  because the system OpenGL headers for those versions don't have it
2021-10-12 19:07:41 +02:00
Daniel Gibson
443802b683 Fix D3_ARCH (work around CMake being useless)
CMAKE_SYSTEM_PROCESSOR used to be broken, CMake "fixed" it by redefining
its meaning (from "Target CPU" to "Host CPU except when crosscompiling").
On Windows it always prints the host CPU, on Linux it at least made trouble
in chroots and when running 64bit kernels with 32bit userlands (this used
to be not totally uncommon on x86 before distros completely switched to
amd64, and apparently Raspbian/Raspberry Pi OS does this on RPi4, see #267)

Thankfully gcc and clang support "-dumpmachine" to print their (default)
target system, so use that instead (MSVC already had a special case).
On the upside, this allows getting rid of the MinGW special case.
I hope this also works with Apple Clang..
2021-09-13 09:10:11 +02:00
SiliconExarch
f6bfdd16f9 Fix runtime assert on PPC OS X
Passing the -mone-byte-bool flag when building for PPC on OS X overrides the defaults so that sizeof( bool )==1
2021-08-26 22:56:45 +02:00
Daniel Gibson
78eef43d50 Fix rendering of mars globe in main menu with some drivers
The problem was that negative values (from dhewm3tmpres.xyz) were passed
to POW, and POW doesn't have to support negative bases, according to
ARB_fragment_program.txt, and Intels Linux drive apparently doesn't,
see also https://gitlab.freedesktop.org/mesa/mesa/-/issues/5131

Using MUL_SAT instead of MUL to clamp the value that gets passed to POW
afterwards to [0, 1] fixes the problem without any disadvantages.
2021-08-17 19:43:01 +02:00
Daniel Gibson
981863788f Update Changelog
and fix a typo in a comment in the shader gamma injection code
2021-07-19 17:09:36 +02:00
Daniel Gibson
6dbcf6523e Shader Gamma: support "OUTPUT bla = result.color;" in frag. shaders
so far the code assumed that "result.color" is always used directly,
but the ARB shaders allow creating an alias with the aforementioned
syntax. So turn that into an variable-alias for dhewm3tmpres.
2021-07-19 05:26:22 +02:00
HarrievG
5897ad09f0 correctly reset iconvDesc 2021-07-19 01:28:43 +02:00
HarrievG
0b00c78dc0 - another margin size fix 2021-07-18 22:06:38 +02:00
Daniel Gibson
4ce48965a5 SDL2: Better non-ASCII supprt (text input, scancode names)
as long as it's chars Doom3 supports, i.e. it can be converted
to ISO-8859-1

also renamed kbdNames to _in_kbdNames to reduce likelyhood of clashes
(as it can't be static)
2021-07-18 03:30:56 +02:00
Daniel Gibson
06ff49c6b6 Restore C++98 compatibility (NULL instead of nullptr)
and print a message when libcurl has been found
2021-07-17 18:24:46 +02:00
Daniel Gibson
5e4e1d61be Merge branch 'debugger' 2021-07-16 02:21:16 +02:00
Daniel Gibson
21f1ba3161 Script Debugger: Scale script text according to DPI scaling
and scale the breakpoint dots accordingly - now they don't looked all
squashed anymore.

I think ResizeImageList() is more correct now, at least this helped with
the breakpoint dots.
2021-07-16 02:19:27 +02:00
Daniel Gibson
a7660020b8 Fix usage of invalid pointer in idCompiler::CompileFile()
The `const char* filename` arg is passed from idProgram::CompileText(),
where it's from idProgram::filename - and that filename can get modified
in idCompiler::NextToken() when it calls gameLocal.program.GetFilenum()
and if the idStr grows and reallocates for that modification,
the filename pointer becomes invalid.
So store `filename` in an idStr and use that when logging the
compile time.
2021-07-15 07:00:18 +02:00
Daniel Gibson
78ab625edd Improve handling of "console key", add in_ignoreConsoleKey CVar
If in_ignoreConsoleKey is set, the console can only be opened with
Shift+Esc, not `/^/whatever, so you can easily type whatever character
is on your "console key" into the game, or even bind that key.
Otherwise, with SDL2, that key (KEY_SCANCODE_GRAVE) always generates the
newly added K_CONSOLE.
in_kbd has a new (SDL2-only) "auto" mode which tries to detect the
keyboard layout based on SDL_GetKeyFromScancode( SDL_SCANCODE_GRAVE ).
Wherever Sys_GetConsoleKey() is called, I now take the current state of
Shift into account, so we don't discard more chars than necessary, esp.
when they keyboard-layout (in_kbd) is *not* correctly set.

(TBH the only reason besides SDL1.2 to keep in_kbd around is to ignore
 the char generated by the "console key" in the console..)
2021-07-15 07:00:18 +02:00
Daniel Gibson
f88812c56f Add in_grabKeyboard CVar to grab keyboard if mouse is grabbed, #323
It's set to 0 by default (which is the original behavior), if set to 1,
SDL2 will grab the keyboard, so Alt-Tab or the Windows Key etc will not
be handled by the operating system but by dhewm3 (=> you can bind the
Windows key like any normal key and it won't open the start menu)
2021-07-15 07:00:18 +02:00
Daniel Gibson
24a6643a60 Add explicit support for Right Ctrl and Right Shift keys, #323
so far they were handled the same as their Left counterparts
2021-07-15 07:00:18 +02:00
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
c3d77abd2b Script Debugger: Support line numbers up to 9999
but it's still a bit wonky with DPI-scaling

I also made the rect calculations a bit more intuitive
and removed a misleading comment in my breakpoint list code
2021-07-15 02:31:40 +02:00
HarrievG
764d23a394 - fixed lnr range after zoom/resize 2021-07-14 23:37:28 +02:00
HarrievG
5c3d95efee - Added line nrs to script richedit 2021-07-14 23:32:28 +02:00
HarrievG
b9833e7e6e - Fixed Once Breakpoints
- Send scriptlist on connect.
- upped version info
2021-07-13 20:36:53 +02:00
Daniel Gibson
6211d6e724 Debugger: Implement List of Breakpoints
Double-clicking an entry opens the script at the correct line.
Single-clicking the breakpoint symbol in the list removes the breakpoint,
and so does selecting the breakpoint in the list and pressing the Del key.
2021-07-13 06:12:44 +02:00
Daniel Gibson
fbd188853c Debugger: Make "Filename" colums wider
and "Line" column narrower.

The "Filename" columns weren't wide enough for many script filenames
2021-07-13 06:12:29 +02:00
Daniel Gibson
4172b006cc Debugger: Support OnceOnly-Breakpoints ("Run To Cursor") 2021-07-13 06:11:45 +02:00
HarrievG
d7eff865af - automatically scroll the console output to last line on print 2021-07-05 10:37:29 +02:00
HarrievG
6e8b6a6773 - automatically enable com_enableDebuggerServer when launching the debugger from a game which does not have the debugger server running 2021-07-05 10:09:28 +02:00
HarrievG
fe162e626f - removed unused onceOnly flag for debugger breakpoints. 2021-07-03 21:46:16 +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
1d6ae1acc1 When saving a game via menu, select and show new savegame
now it scrolls to the top of the list after saving, so one can see
the newly created savegame.
2021-07-03 02:25:20 +02:00
Daniel Gibson
8d8f345c25 idListWindow: Scroll to selected item
from listName_sel_0

that way when setting that state-int and calling StateChanged(),
the list is scrolled so the selected item is visible
2021-07-03 02:25:20 +02:00
Daniel Gibson
10dea591a8 Use more than one QuickSave file, #392
Now the game cycles between QuickSave, QuickSave2, QuickSave3, ...
(up to com_numQuicksaves files, 4 by default, up to 99), always
replacing the oldest.
Quick-loading always loads the newest quicksave, but all quicksaves
can be loaded via the load game menu.
2021-07-03 02:25:20 +02:00
HarrievG
e32b178fd1 - setting com_debuggerSupported=false in style. 2021-07-03 01:33:46 +02:00
HarrievG
b80de2b89b - correctly reset com_debuggerSupported 2021-07-03 01:22:36 +02:00
HarrievG
784f1d567c - Moved debugger intialistion after GameDll load
- DebuggerServer will not intialize when the additional function FT_UpdateDebugger is not set
2021-07-03 01:14:49 +02:00
HarrievG
61019b97ff rename functionType for debugger 2021-07-01 09:07:35 +02:00
HarrievG
ebf53cdc21 rev feedback v1. 2021-07-01 01:09:15 +02:00
HarrievG
d4db77b9ed - Unbreaking Game and GameEdit API / ABI for game debugger use 2021-06-28 23:38:38 +02:00
Daniel Gibson
277dbf89f1 Make sure shaders are only loaded once at startup, fix #386
this *shouldn't* matter, but due to some Mesa bug is does:
If the shaders have been loaded already (with R_LoadARBProgram()),
then loading them again (like from the `reloadARBprograms` console cmd
or as it happens if the `r_gammaInShader` has been modified) will
cause glitches with the open source radeonsi driver (maybe also with
others? at least the open source intel driver seems unaffected).
As r_gammaInShader was marked as modified at startup (before the shaders
were even loaded) they were loaded twice: First as expected when OpenGL
is initialized, then again in R_CheckCvars() which is executed each
frame. Marking as at not modified in R_InitOpenGL() prevents this and
thus works around the bug.
However this means that changing r_gammaInShader at runtime will still
trigger this bug (while with non-broken drivers it switches seamlessly
between gamma in shader and gamma in hardware without a vid_restart).
2021-06-24 18:37:14 +02:00
Daniel Gibson
8747ee63d3 Make sure sampleTime used in sound updates is multiple of 8
Originally sound updates only happened about every 100ms and
`sampleTime` (or `newSoundTime`) was a multiple of 4096
(`MIXBUFFER_SAMPLES`).
After I changed this to updates every 16ms and made the calculation of
`sampleTime` a lot simpler, it could be any value (as it's current
amount of milliseconds multiplied by 44.1).
It generally seemed to work, but it seems advisable to make it a
multiple of 8 (see also "Fix endless loop when decoding OGGs" commit).
So I round it to the nearest multiple of 8 now. Furthermore I increased
the accuracy when the game has been running for a long time by using
double instead of float, and tried to make sure that `sampleTime` is
always positive (or at least as long as `inTime` is positive).
2021-06-24 06:45:24 +02:00
Daniel Gibson
d55b7fa6c9 Don't use stringDataAllocator in idStr, it's not thread-safe
idStr is used in both the main thread and the async sound thread, so
it should better be thread-safe.. idDynamicBlockAlloc is not.
Use realloc() and free() instead.

For some reason this caused a lot more crashes (due to inconsistencies
in the allocator's heap) with newer Linux distros (like XUbuntu 20.04)
and when using GCC9, while they rarely reproduced with GCC7 or on
XUbuntu 18.04

fixes #391
2021-06-24 03:26:51 +02:00
Daniel Gibson
aedf0b4b21 Fix endless loop when decoding OGGs, #390
In idSampleDecoderLocal::DecodeOGG() `totalSamples` was 1 and
`reqSamples` was 0, which caused an endless loop.. this was caused by
idSoundWorldLocal::ReadFromSaveGame() setting
`chan->openalStreamingOffset` to an odd number, I think due to
`currentSoundTime` being an odd number.
To fix that, I round up `chan->openalStreamingOffset` to a (very) even
number, and to be double-sure I also added a check in DecodeOgg() to
make sure it exits the loop if `reqSamples` is 0.
2021-06-22 02:59:59 +02:00
HarrievG
7e367a0e62 - Added Console input / command exec to debugger 2021-06-21 14:59:28 +02:00
Daniel Gibson
8eb91c79cb Force SDL to minimize the window when focus is lost, fix #360
This was changed in SDL 2.0.14 and causes problems on several platforms
and window managers.
Fix taken from Yamagi Quake II
2021-06-20 03:59:30 +02:00
Daniel Gibson
fa8ab0ca49 GCC/Clang: Remove -fno-unsafe-math-optimizations
it's redundant because it's default as long as -ffast-math isn't used,
and according to
https://github.com/RobertBeckebans/RBDOOM-3-BFG/pull/575#issuecomment-862044631
in clang12 it causes warnings when used with -fno-trapping-math.
2021-06-20 03:36:39 +02:00
Daniel Gibson
d5fd0990a1 Win32: Fix deadlocks if Sys_Printf() or Sys_Error() was called in thread
If those functions (e.g. called by common->Printf(), common->Error())
weren't called from the mainthread and win_outputEditString was set to 1,
a deadlock could occur.
Specifically, the async thread (handling sound) was calling
common->Warning() -> Sys_Printf() -> Conbuf_AppendText() which called
SendMessageA() which blocks until the main thread handles the message.
The main thread however was in idSampleDecoderLocal::Decode() trying to
enter CRITICAL_SECTION_ONE, which was held by the async thread
(it's used to synchronize sound handling between main and async thread).

So now if Sys_Printf() (or Sys_Error() which should have the same problem)
is not called by the main thread, the text is buffered and
Conbuf_AppendText() is called for the buffered lines in the next frame
in Win_Frame().
2021-06-20 03:36:39 +02:00
Daniel Gibson
a523c28c18 Add SysIsMainThread() function
returns true if called in the main thread
2021-06-20 03:36:39 +02:00
Daniel Gibson
1b4badfd41 Ignore if stb_vorbis decodes one sample less than expected
In idSampleDecoderLocal::DecodeOGG() sometimes (esp. in The Lost Mission
mod) it happens that stb_vorbis_get_samples_float() decodes one sample
less than expected so one is left and when trying to decode that,
stb_vorbis_get_samples_float() returns 0, which we interpreted as an error.
This case is now handled more gracefully: No warning is printed (except
if developer 1) and failed is not set (setting it would prevent the sound
from being played again, I think).
2021-06-20 03:36:39 +02:00
Daniel Gibson
52ea5b3877 Fix endless loop in GLimp_Init(), #386
shouldn't have reused i in the inner loop..
2021-06-20 03:36:39 +02:00
Daniel Gibson
dc42bdc873 Do gamma correction (r_gamma, r_brightness) in shaders
by injecting code to do it into fragment shaders.

Can be disabled with r_gammaInShaders 0

refs #385
2021-06-20 03:36:39 +02:00
Daniel Gibson
40fa8a7dfa Fix script debugging when server is running on Linux
the script paths were wrong, on Linux they were like
"pak000.pk4/script/doom_util.script" while on Windows it's only
"script/doom_util.script".
Fixed idFileSystemLocal::OSPathToRelativePath() to skip ...pk4/

also fixed GCC compile error in Common.cpp
2021-06-19 21:30:26 +02:00
Daniel Gibson
07da116640 Fix debugger resume 2021-06-19 21:30:26 +02:00
HarrievG
d455ac5223 - set com_editors appropiately when debugger forces connection. 2021-06-19 21:30:26 +02:00
HarrievG
5260de58c4 - fixed command line arguments for game when debugger client launches it. 2021-06-19 21:30:26 +02:00
HarrievG
d7be3964d4 - always accept debugger messages from loopback 2021-06-19 21:30:26 +02:00
HarrievG
02dcd00788 - Hide game window when launching script debugger 2021-06-19 21:30:26 +02:00
HarrievG
8a455c3c7a - Debugger server can be toggled with : com_enableDebuggerServer [1 / 0]
- Added com_dbgClientAdr for debugger server to connect to
- Added com_dbgServerAdr for the debugger client to connect to
2021-06-19 21:30:26 +02:00
Daniel Gibson
c2b34e6fe8 Remove idBitMsg::Read/WriteInt64() again
not used anymore
2021-06-19 21:30:26 +02:00
Daniel Gibson
0b644a1648 Fix crashes on shutdown
idCommonLocal::VPrintf() wanted to call session->UpdateScreen() even though
the renderer was in the process of being shut down and that caused crashes
2021-06-19 21:30:26 +02:00
Daniel Gibson
2cff2ae137 DebuggerServer: should now also work with SDL1.2 2021-06-19 21:30:26 +02:00
Daniel Gibson
6b6b28a401 Make DebuggerServer portable (use SDL instead of WinAPI) 2021-06-19 21:30:26 +02:00
HarrievG
85167fa180 - fixed deadlock fix for debugger server 2021-06-17 05:44:23 +02:00
HarrievG
3ce93c7749 - Debuggersever now always builds, but is disabled by default in runtime.
- use com_enableDebuggerServer=1 to enable debugger server.
2021-06-17 05:44:23 +02:00
HarrievG
5ff3b0b9ee - fixed wierd bracked position 2021-06-17 05:44:23 +02:00
HarrievG
99ca9f0543 - D3XP debugger fixes 2021-06-17 05:44:23 +02:00
HarrievG
5ebda5eab5 - removed clientside use of mBreakprogram ptr 2021-06-17 05:44:23 +02:00
HarrievG
cd9284d876 - Debugger is guarded behind tools. 2021-06-17 05:44:23 +02:00
HarrievG
a8709206d8 - Whitespace fix 2021-06-17 05:44:23 +02:00
HarrievG
46157857b5 - Always write 64b program pointer 2021-06-17 05:44:23 +02:00
HarrievG
7f7ed7e45f - Removing ugly (and wrong) include hack for SDL on MSCV+VCPKG.
This has been resolved anyway, and should never been submitted.
2021-06-17 05:44:23 +02:00