Commit Graph

1218 Commits

Author SHA1 Message Date
Azamat H. Hackimov
627ab62f1f Remove unused ddio_GetTempFileName() 2024-09-18 21:23:18 +03:00
Azamat H. Hackimov
3e402d78d5 Replace ddio_GetTempFileName() with ddio_GetTmpFileName()
Convert global variable Descent3_temp_directory to std::fs::path.
2024-09-18 21:23:18 +03:00
Azamat H. Hackimov
511743d4b3 Implementing new ddio_GetTmpFileName()
New function uses std::filesystem::path and generates result faster than ddio_GetTempFileName() (benchmarked on Linux).
2024-09-18 21:23:18 +03:00
Azamat H. Hackimov
8940a5ae38 Remove unused ddio_CleanPath() 2024-09-18 21:23:14 +03:00
Azamat H. Hackimov
cab252f66c Remove unused ddio_GetParentPath() 2024-09-18 21:22:22 +03:00
Louis Gombert
a33c79c5a6
Merge pull request #574 from jengelh/uninit_vars
Resolve 2 UBSAN warnings about uninitialized vars; establish allocation/type check along with it
2024-09-18 19:46:25 +02:00
Jan Engelhardt
08004b9a47 Add member initializers for struct game_controls
UBSAN warns:

$GIT/Descent3/object.cpp:2452:91: runtime error: load of value 2, which is not a valid value for type 'bool'
2024-09-16 22:12:14 +02:00
Jan Engelhardt
72fc5c6784 Add member initializers for struct lnxController/wincontroller
lnxgameController::flush accesses this->m_MouseActive before that
member being initialized with something sensible, making ASAN report:

linux/lnxcontroller.cpp:259:8: runtime error: load of value 190, which is not a valid value for type 'bool'
linux/lnxcontroller.cpp:259:33: runtime error: load of value 190, which is not a valid value for type 'bool'

Thanks to the introduction of mem_rmalloc, it has been established
that struct lnxgameController is not malloc'd anywhere, so any
instantiation runs its constructor properly.
2024-09-16 22:12:14 +02:00
Jan Engelhardt
3c9234c4c0 mem_malloc type triviality checks (8/8)
(Manual modification.) Change mem_malloc callsites with
non-fundamental types to mem_rmalloc.
2024-09-16 22:12:14 +02:00
Jan Engelhardt
a23c6a42a3 mem_malloc type triviality checks (7/8)
```
git grep -l mem_malloc | xargs perl -i -lpe 's{\((char) \*\)mem_malloc\((\S+)\)}{mem_rmalloc<$1>($2)}'
```
2024-09-16 22:12:14 +02:00
Jan Engelhardt
de0af3b10d mem_malloc type triviality checks (6/8)
```
git grep -l mem_malloc | xargs perl -i -lpe 's{\((uint8_t) \*\)mem_malloc\((\S+)\)}{mem_rmalloc<$1>($2)}'
```
2024-09-16 22:12:13 +02:00
Jan Engelhardt
1551b240d3 mem_malloc type triviality checks (4/8)
```
git grep -l mem_malloc | xargs perl -i -lpe 's{\((\w+) \*\*\)mem_malloc\((\S+) \* sizeof\(\1 \*\)\)}{mem_rmalloc<$1 *>($2)}'
```
2024-09-16 22:12:13 +02:00
Jan Engelhardt
4d2fdb2316 mem_malloc type triviality checks (4/8)
```
git grep -l mem_malloc | xargs perl -i -lpe 's{\((\w+) \*\)mem_malloc\((\S+) \* sizeof\(\1\)\)}{mem_rmalloc<$1 *>($2)}'
```
2024-09-16 22:12:13 +02:00
Jan Engelhardt
bb38a4a565 mem_malloc type triviality checks (3/8)
```
git grep -l mem_malloc | xargs perl -i -lpe 's{\((\w+) \*\*\)mem_malloc\(sizeof\(\1 \*\) \* (\S+)\)}{mem_rmalloc<$1>($2)}'
```
2024-09-16 22:12:13 +02:00
Jan Engelhardt
c7da9daee2 mem_malloc type triviality checks (2/8)
Automated replacement with

```
git grep -l mem_malloc |
xargs perl -i -lpe 's{\((\w+) \*\)mem_malloc\(sizeof\(\1\) \* (\S+)\)}{mem_rmalloc<$1>($2)}'
```
2024-09-16 22:12:12 +02:00
Jan Engelhardt
6fbc86efec mem_malloc type triviality checks (1/8)
git grep -l mem_malloc | xargs perl -i -lpe 's{\((\w+) \*\)mem_malloc\(sizeof\(\1\)\)}{mem_rmalloc<$1>()}'
2024-09-16 21:57:41 +02:00
Jan Engelhardt
ce3a988ad6 Add a mem_malloc wrapper to check type triviality
UBSAN is reporting that some uninitialized variables. To that end, I
would like to add member default initializers to e.g. ``struct
object``. Doing that makes classes nontrivial.

Allocations throughout the code occur with e.g.
``mem_malloc(sizeof(T))``, which is, tersely speaking, incompatible
with triviality. Therefore, mem_malloc call sites will be rewritten
to invoke ``mem_rmalloc<T>`` instead, to enforce a compile-time check
that ``T`` is indeed trivial.

``mem_rmalloc<T>`` is modeled to look like ``make_unique<T>``, i.e.
can be called with no arguments to allocate space for a single thing,
or called with a size_t argument that specifies the number of
elements (automatic byte sizing is applied internally).
2024-09-16 21:57:41 +02:00
Louis Gombert
7282af9cd8
Merge pull request #568 from winterheart/valgrind
Fix discovered memory leaks
2024-09-16 20:48:56 +02:00
Louis Gombert
f80fa0b518
Merge pull request #573 from jengelh/strict-aliasing
Resolve UBSAN strict aliasing reports
2024-09-16 20:44:59 +02:00
Azamat H. Hackimov
9ac702dcda
Merge pull request #569 from ccfly42/online-directip-netcon
Add Descent3 Online netcon
2024-09-15 23:07:38 +03:00
Christian Baumann
7501a5bcdc rename netcon 2024-09-15 13:19:26 +02:00
Christian Baumann
5b3c444032 fix memory corruption & change temp path 2024-09-15 12:38:41 +02:00
Azamat H. Hackimov
616f921e97
Merge pull request #585 from sirken/main
BUILD.md - add `--recurse-submodules` when cloning

Fixes #584
2024-09-12 15:24:38 +03:00
Azamat H. Hackimov
8d2935c32c Fix some warnings on uninitialized MVE variables 2024-09-12 15:11:32 +03:00
sirken
5cf245e7cb Add --recurse-submodules when cloning 2024-09-11 22:15:39 -06:00
Louis Gombert
705c67a1be
Merge pull request #546 from winterheart/logging
Enhance logging facility
2024-09-10 09:27:13 +02:00
Azamat H. Hackimov
2b396d2d87 Handle error on uninitialized plog submodule
Fail cmake configuration if plog submodule is not initialized.
2024-09-10 03:01:16 +03:00
Azamat H. Hackimov
ad33f3d79f Update gamespy.cpp to use new logger 2024-09-10 03:00:57 +03:00
Azamat H. Hackimov
8b0f27604c Use plog from vcpkg on CI
Additional documentation on changes.
2024-09-10 03:00:57 +03:00
Azamat H. Hackimov
83de469e96 Add plog license information
plog is licensed under MIT license.
2024-09-10 03:00:26 +03:00
Azamat H. Hackimov
9172c9dd9f Checkout plog submodule to tag 1.1.10 2024-09-10 03:00:26 +03:00
Azamat H. Hackimov
ad3aa8bb42 Cleanup misc submodule
Move common parts from platform-specific ifdefs.
2024-09-10 03:00:26 +03:00
Azamat H. Hackimov
25c4837b1d Editor: fix compilation
Add `"mono.h"` where needed.
2024-09-10 03:00:26 +03:00
Azamat H. Hackimov
cc61f5de31 Convert win32 to use new logging facility 2024-09-10 03:00:26 +03:00
Azamat H. Hackimov
83ff0eef99 GitHub Actions: recursive checkout sources 2024-09-10 03:00:26 +03:00
Azamat H. Hackimov
e19bb71cf7 Convert core game to use new logging facility 2024-09-10 03:00:26 +03:00
Azamat H. Hackimov
14691a5549 Convert networking to use new logging facility 2024-09-10 03:00:26 +03:00
Azamat H. Hackimov
b1f9b61d44 Cleanup ddebug submodule
Remove unused functions.
2024-09-10 03:00:26 +03:00
Azamat H. Hackimov
0abd11f08f Convert ui to use new logging facility 2024-09-10 03:00:26 +03:00
Azamat H. Hackimov
a4f00480b1 Convert streamaudio to use new logging facility 2024-09-10 03:00:25 +03:00
Azamat H. Hackimov
ae8e1b4a48 Convert sndlib to use new logging facility 2024-09-10 03:00:25 +03:00
Azamat H. Hackimov
df93488815 Convert rtperfomance to use new logging facility 2024-09-10 03:00:25 +03:00
Azamat H. Hackimov
d8de33eb35 Convert renderer to use new logging facility 2024-09-10 03:00:25 +03:00
Azamat H. Hackimov
c32c2d3db3 Convert physics to use new logging facility 2024-09-10 03:00:25 +03:00
Azamat H. Hackimov
ffdbc8b621 Convert music to use new logging facility 2024-09-10 03:00:25 +03:00
Azamat H. Hackimov
b9de85791d Convert model to use new logging facility 2024-09-10 03:00:25 +03:00
Azamat H. Hackimov
b11927fc46 Convert mem to use new logging facility 2024-09-10 03:00:25 +03:00
Azamat H. Hackimov
4259fe4c18 Convert manage to use new logging facility 2024-09-10 03:00:25 +03:00
Azamat H. Hackimov
dc82d2314d Convert linux to use new logging facility 2024-09-10 03:00:25 +03:00
Azamat H. Hackimov
e627dfc546 Convert grtext to use new logging facility 2024-09-10 03:00:25 +03:00