Commit graph

793 commits

Author SHA1 Message Date
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
HarryVG
a0007f5f12 updated gitignore 2021-06-19 22:01:37 +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
HarrievG
af5f395256 - Putting back the "Original by Raven" texts 2021-06-17 05:44:23 +02:00
HarrievG
5e27330233 - 64bit debugger fixes 2021-06-17 05:44:23 +02:00
HarrievG
7a2ccee330 debugger 2021-06-17 05:44:23 +02:00
Daniel Gibson
a8ef0f67fe Merge branch 'r_locksurfaces-dhewm3' 2021-06-15 03:28:40 +02:00
Daniel Gibson
c212148d41 Remove R_LockSurfaceScene(), clean up temporary changes
R_LockSurfaceScene() isn't used anymore, surface locking is implemented
differently (so it actually works now :-p)
2021-06-15 03:27:52 +02:00
Daniel Gibson
a11b2d352c r_lockSurfaces: Make mirrors look only a bit broken
it's still not great, but at least they don't float around anymore
2021-06-15 03:27:52 +02:00
Daniel Gibson
633ce814ca r_lockSurfaces: Cleaner handling of view matrix creation etc 2021-06-15 03:27:52 +02:00
Daniel Gibson
907fc5771b Disable r_useScissor when r_lockSurfaces is active 2021-06-15 03:27:52 +02:00
Daniel Gibson
d17fa6b2b6 Fix rendering of ingame GUIs with r_lockSurfaces 1 2021-06-15 03:27:52 +02:00
Daniel Gibson
dcb933efb5 Fix rendering HUD with r_lockSurfaces 1
only override cmd->viewDef in RB_DrawView() if we're drawing the
primary view (which for several calculations before actual drawing
was set to the saved/locked render view)

Note that r_lockSurfaces is more useful with r_useScissor 0 (otherwise
there's black bars over the screen when moving) and r_shadows 0 (otherwise
areas that weren't visible when locking are black because the lights
there are skipped)

remaining bug: gui surfaces move around the screen when looking around
2021-06-15 03:27:52 +02:00
Daniel Gibson
1a6998781b Make r_locksurfaces kinda work
refs #357
2021-06-15 03:26:44 +02:00