Commit graph

1031 commits

Author SHA1 Message Date
Daniel Gibson
d94bb42d50
Merge pull request #626 from DanielGibson/fix-ppc64be
Fix dhewm3 on 64bit Big Endian platforms like PPC64 BE
2024-11-07 14:54:06 +01:00
Daniel Gibson
218813efb3 Sys_DLL_Load() for Win32: Mention D3_ARCH in warning about wrong arch
also changed that logic a bit so FormatMessage() is only called when
actually used

and while at it, fixed the build with mingw-w64 on my system
(somehow an SDL header used strcmp() and that didn't work with
 `#define strcmp idStr::Cmp` from Str.h)
2024-11-07 06:25:51 +01:00
Daniel Gibson
373f59c484 If game DLL isn't found, fall back to fs_game_base DLL
loosely based on #517, with additional fallback to base.dll if the one
for fs_game_base isn't found either
2024-11-07 06:25:51 +01:00
Daniel Gibson
47d803b4fe Use Mem_MallocA() in Model_Overlay.cpp, tr_light.cpp, tr_trisurf.cpp
I hope that should cover all relevant cases, though there are still
plenty of _alloca() and _alloca16() calls left throughout the code
2024-11-07 06:25:51 +01:00
Daniel Gibson
8bddc84e62 Use Mem_MallocA() in Model_md5.cpp
one step to making HD models (like
https://www.moddb.com/mods/birdman-doom3/downloads/birdman-doom3-v11 )
work, but there's still other places in the code where the HD version
of that model makes dhewm3 crash
2024-11-07 06:25:51 +01:00
Daniel Gibson
5c9d9ff53c Implement Mem_MallocA()+Mem_FreeA(): alloca() but might use Heap
When requesting < 1 MB, _alloca16() is used, otherwise Mem_Alloc16().
Furthermore you must pass a bool that will get true assigned if the
memory has been allocated on the stack, else false.
At the end of the function you must call Mem_FreeA( ptr, onStack )
(where onStack is the aforementioned bool), so Mem_Free16() can be
called if it was allocated on the heap.
2024-11-07 06:25:51 +01:00
Daniel Gibson
3ad384a0da Fix script interpreter on 64bit Big Endian platforms
idInterpreter::Push() is used only for int and (reinterpreted) float
values, not pointers (as far as I can tell), so 32bit values on all
relevant platforms.
It stored its value as intptr_t at `&localstack[ localstackUsed ]` - on
64bit platforms intptr_t is 64bit.
Unfortunately, all code reading from the stack just get got a pointer
to `&localstack[ localstackUsed ]` in the type they want to read
(like `int*` or `float*`) and read that. On Little Endian that happens
to work, on 64bit Big Endian it reads the wrong 4 bytes of the intptr_t,
so it doesn't work.

fixes #625, #472
2024-10-31 03:18:33 +01:00
Daniel Gibson
76a9fdcebe idInterpreter::Call(Sys)Event(): Fix passing integers
All that code is kinda obfuscated, but the integer passing was plain
wrong (if sizeof(int) != sizeof(intptr_t), esp. noticeable on
 Big Endian).
data[i] is used by Callbacks.cpp, and for everything but floats it's
passed directly as an argument (interpreted as either an integer or
a pointer to idVec3 or whatever).
So storing an int in there with `( *( int * )&data[ i ] ) = int(...)`
only sets the first 4 bytes of that intptr_t, which is 8 bytes on 64bit
machines. On Little Endian that just happens to work, on Big Endian
it's the wrong 4 bytes.
2024-10-31 03:18:33 +01:00
Daniel Gibson
fb3f0cc2b4 idClass::operator new() and delete: align to intptr_t
to avoid unaligned reads from class members of idClass or its
derived classes
2024-10-31 03:18:33 +01:00
Daniel Gibson
af13c20614 Fix Dear ImGui colors on Big Endian systems
https://github.com/dhewm/dhewm3/issues/625#issuecomment-2448341504
confirms that it's broken

for the fix, see
https://github.com/ocornut/imgui/issues/6732#issuecomment-1682918657
https://github.com/ocornut/imgui/pull/5190
2024-10-31 03:18:33 +01:00
Daniel Gibson
21f2e3a56a ImGui: Use base85-compressed font
instead of whatever other compression was used there.
Fixes crash on Big Endian systems (#625)
2024-10-31 03:18:13 +01:00
Daniel Gibson
81cab591da Adjust imgui_savestyle.cpp for 1.91.4
ImGuiCol_NavHighlight has been renamed to ImGuiCol_NavCursor
2024-10-29 03:55:07 +01:00
Daniel Gibson
97edc598c1 Update Dear ImGui to 1.91.4 2024-10-29 03:34:42 +01:00
Daniel Gibson
c142dac6f7 Merge branch 'SDL3' 2024-10-29 03:26:57 +01:00
Daniel Gibson
81ba620984 SDL3: Handle r_fillWindowAlphaChan, cleanups and comments
r_fillWindowAlphaChan is a hack to work around an older issue with
Wayland/Mesa, which has been fixed in Mesa 24.1 (and also seems to work
with current NVIDIA drivers). Additionally, in SDL3 the EGL-specific
(and thus mostly only affecting Wayland)
SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY has been replaced with the generic
SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN (that could also affect
other platforms), so it's harder to enable this only for Wayland.
I think most people using SDL3 will use a recent Mesa/driver versions,
so I don't enable it by default for SDL3 (SDL2 behaves like before).
However, with `r_fillWindowAlphaChan 1` the hack can be enabled anyway
(r_fillWindowAlphaChan defaults to "-1" which means "let dhewm3 decide
 whether to enable this")
2024-10-29 03:26:20 +01:00
Daniel Gibson
7354fff406 Fix setting z_off64_t in minizconf.h
checking if Z_LARGE64 is defined doesn't make much sense because
that is from from zlib which this helps replace..
so on non-windows we always ran into the #define z_off64_t z_off_t
case which doesn't give us a 64bit offset on 32bit systems..
Should work better now.

fixes #622
2024-10-11 01:03:53 +02:00
Daniel Gibson
3a6210b154 Hopefully make macOS port compatible with SDL3
.. mostly by not making it use SDL_main.h, because it implements its
own SDL main functionality anyway.

However, I have no way to test this code and as long as SDL3 is not in
homebrew testing it in the CI build isn't easy either.
2024-10-09 18:58:44 +02:00
Daniel Gibson
6181f24c44 SDL3: Now works on Windows as well
Refactored the pseudo-custom SDL_main code a bit: SDL_win32_main.c
is now only used for SDL1.2, SDL2 and SDL3 have a WinMain() function
in win_main.cpp that works pretty much like the SDL2 SDL_main or SDL3
SDL_RunApp() code - except that the argv[] strings passed to the Doom3
main() function (now renamed to SDL_main()) are encoded in ANSI instead
of UTF-8, so paths passed as commandline arguments, like
 dhewm3 +set fs_basepath C:\SüperGämes\Doom3
work with the Win32 ANSI function used by Doom3 to handle paths and files.

For this I also moved the stdout/stderr redirection code from
SDL_win32_main.c to win_main.cpp and cleaned it up a bit
2024-10-09 17:37:08 +02:00
Daniel Gibson
19f28e3c2d Fix more SDL3 compatibility problems
- use SDL_SetHint() to set the video driver to "dummy" for the
  dedicated server
- adjustments for some more functions that now return bool instead
  of int. I hope I found all cases of that now, at least in the generic
  and Linux code, may have to take a closer look at Windows- and Mac-
  specific code
2024-10-09 03:32:17 +02:00
Daniel Gibson
08a8945bdf SDL3: Fix detecting fullscreen mode
a SDL_SyncWindow() was missing, and the return value of
SDL_SetWIndowFullscreen() has changed
2024-10-08 04:30:41 +02:00
Daniel Gibson
01ea89ab3b SDL3: Fix textinput; print available displays and their fullscreen modes 2024-10-07 21:15:22 +02:00
Daniel Gibson
b3be9f7b31 Introduce and use sys_sdl.h to unify <SDL3/SDL.h> and <SDL.h> includes 2024-10-07 17:38:01 +02:00
Daniel Gibson
1a1962088d It builds with SDL3 and SDL2 and SDL1.2 (on Linux)
TextInput doesn't work with SDL3 yet, and non-Linux(-y) platforms
like macOS or Windows don't support SDL3 yet
2024-10-07 17:22:03 +02:00
Daniel Gibson
5d3f143220 Detect endianess in CMakeLists.txt, get rid of most SDL_endian.h uses
.. except where SDL_Swap* is actually used (idlib/Lib.cpp).
Otherwise #if D3_IS_BIG_ENDIAN suffices, (NOT #ifdef, it's always set,
but to either 0 or 1!)
2024-10-07 03:15:50 +02:00
Daniel Gibson
0b0a08d7c4 SDL3 plumbing in CMakeLists.txt 2024-10-07 00:57:08 +02:00
Daniel Gibson
60ec3141cf Update Dear ImGui to v1.91.3
no changes in the code using it were necessary
2024-10-05 17:49:50 +02:00
Daniel Gibson
9f21cea354 Update code using Dear ImGui for v1.91.2 2024-10-02 22:18:30 +02:00
Daniel Gibson
9dffb367e2 imgui_impl_opengl2.cpp: Restore Doom3 compatibility 2024-10-02 22:16:36 +02:00
Daniel Gibson
6bcd18e269 Update Dear ImGui to v1.91.2 2024-10-02 20:34:00 +02:00
Daniel Gibson
c7ad16103b Update imgui_savestyle.cpp to my version with docking branch support 2024-10-02 20:23:50 +02:00
Daniel Gibson
e0e772ef92 Add 1.5.5 WIP entry to changelog
and set the date for 1.5.4 and mention that Soft Particles can slow
down rendering
2024-09-10 15:58:52 +02:00
Daniel Gibson
0af60549ab Add issue template for bug reports and feature requests
what a lame 1000th commit :-p
2024-08-21 02:35:09 +02:00
Daniel Gibson
872905f300 Add Github Actions builds for Windows, Linux and macOS 2024-08-20 21:49:52 +02:00
Daniel Gibson
8863c36067 Bump version to 1.5.5pre 2024-08-16 01:29:59 +02:00
Daniel Gibson
2f9e52a804 Handle soft particles when loading graphics quality preset, #604
When applying the currently configured graphics quality preset
(it's set in the `com_machineSpec` CVar and applied with the
`execMachineSpec` command, or by using the menu), now soft particles
are disabled for all quality presets except for ultra, because this
feature has a noticeable impact on performance with some (slower) GPUs.
2024-08-16 00:25:34 +02:00
Tom Kidd
be2b788c67 Lower macOS requirement 2024-08-03 05:52:42 +02:00
Daniel Gibson
6679490f0a bump version to 1.5.4 2024-08-03 01:47:27 +02:00
Daniel Gibson
c44c0ffda4 bump version to 1.5.4rc3 2024-07-30 02:41:45 +02:00
Daniel Gibson
cef1178776 Allow Soft Particles for player-weapons after all, fix issue properly
The previous commit didn't fix the issue for the pistol and only was a
workaround anyway. So I reverted that and fixed the issue properly.

The underlying issue is that the particle's material sets the
texture matrix (with "translate" or "scale" or whatever), and the soft
particle rendering code (and shader) didn't take the texture matrix
into account.
Now it does, in a similar way as the interaction shader code.

Fixes https://github.com/dhewm/dhewm3-sdk/issues/36
2024-07-30 01:49:08 +02:00
Daniel Gibson
227071bb9a Don't use Soft Particles for particles at player-weapon
or at least if weaponDepthHack is set.

That somehow broke muzzle flash effects in Dentonmod, see
https://github.com/dhewm/dhewm3-sdk/issues/36
2024-07-29 17:59:38 +02:00
Daniel Gibson
b0d7c12404 Bump version to 1.5.4rc2 2024-07-29 02:57:04 +02:00
Daniel Gibson
a4f2d4ae55 Document +set fs_game_base in dhewm3 --help 2024-07-29 02:56:45 +02:00
Daniel Gibson
9c36d2f661 Mods menu: improve base and d3xp entries, set d3xp basemod for more mods
the base game entry is now called "Doom 3 (base game)" instead of
"dhewm3", which should be more obvious, and the d3xp entry now reads
"Resurrection Of Evil (d3xp)" instead of just "d3xp", which certainly
is clearer. d3xp now is also always second in the list (if installed)

Added the freshly supported perfected_roe and sikkmodd3xp mods to the
list of mods that need fs_game_base d3xp set, so they can be started
from the menu.

also added an entry for r_gammaInShader to Configuration.md
2024-07-27 22:11:59 +02:00
Daniel Gibson
4df8495d61 Document r_glDebugContext in Configuration.md; tiny fix in settings menu 2024-07-26 01:45:19 +02:00
Daniel Gibson
961b3f60bd Bump Version to 1.5.4rc1 2024-07-26 00:00:02 +02:00
Tom Kidd
ae6997aef5 On macOS, look for the game dylib in the app bundle 2024-07-25 06:09:25 +02:00
«BielBdeLuna»
b34c625798 added a easier material name for portal skies 2024-07-25 04:38:38 +02:00
Daniel Gibson
d3b2794c24
Merge pull request #578 from DanielGibson/soft-particles
Implement Soft Particles (and capturing depth buffer), based on old The Dark Mod code
2024-07-25 04:27:35 +02:00
Daniel Gibson
7e772f09d1 Update Changelog 2024-07-25 04:19:00 +02:00
Daniel Gibson
2e0b093c79 Soft particles: Disable Particle Stage "softeningRadius" keyword
this avoid breaking the game DLL ABI (framework/DeclParticle.h is part
of the SDK), and for now doesn't make a difference, because that keyword
was introduced by TDM and thus is only used in their particle defs.

When we break the game ABI/API anyway (probably for high FPS support),
this commit can just be reverted
2024-07-25 04:05:51 +02:00