Commit Graph

85 Commits

Author SHA1 Message Date
Jan Engelhardt
dee5467748 Resolve 160 instances of -Wchar-subscript
`char` is unsigned on some platforms, which breaks the assumption it
can hold value -1. The simple fix is to replace it by int8_t, which
gives compatibility with x86 platforms where Descent3 usually was
delivered on.

Descent3/attach.cpp:668:47: warning: array subscript has type "char" [-Wchar-subscripts]
2025-06-07 01:58:55 +02:00
Jan Engelhardt
5ca72cba5b Replace sizeof(char) by 1
sizeof(char) is 1 by definition. This simplifies some multiplication
statements.
https://en.cppreference.com/w/cpp/language/sizeof.html
2025-06-06 11:47:53 +02:00
Jon Daniel
adda1c1f15 adaptive aligned std::array based vector types (#686) 2025-05-08 21:36:35 +02:00
Azamat H. Hackimov
8800f1b4c7 Implementing base directory populating on init
After initialization, we get following base directories list (in priority order):

* Writable preference path
* User defined paths (cmd-line and configuration)
* Platform defined paths (such as /usr/share/Descent3 on Linux or Steam installation paths on all platforms (TBD))
* Directory of executable

Removing `-setdir` and `-useexedir` as redundant (both can be replaced with `-additionaldir` option).
2025-03-24 23:15:32 +01:00
Louis Gombert
5abb24d9bc Link SDL3 target & include directories properly, use SDL as a 3rd party
Introduce the USE_EXTERNAL_SDL option allowing the use of an external installation of SDL3, for example from the system's package manager.

Also fix double find_package for plog
2025-02-17 22:37:21 +01:00
Louis Gombert
3a1878c0f7 SDL3: run rename_headers.py script from migration guide 2025-02-17 22:36:30 +01:00
Louis Gombert
f2ff77ef4f Global replace SDL2->SDL3 2025-02-17 22:36:22 +01:00
Louis Gombert
7ca92bd1bd Merge pull request #614 from winterheart/ddebug-update
ddebug submodule update
2024-10-05 17:21:19 +02:00
Azamat H. Hackimov
ac7dd20a38 Fix memory leak from unpaired SDL_GetPrefPath() 2024-09-29 19:34:23 +03:00
Azamat H. Hackimov
a59503f881 Move pserror.h to ddebug module 2024-09-24 23:00:53 +03:00
Louis Gombert
d307a0db6e Registry: read hexadecimal values correctly
Hex string values from the registry containing an alpha character were parsed incorrectly. Use more standard hex parsing instead of hand-made incorrect function
2024-09-24 08:09:31 +02:00
Louis Gombert
b33cc21dce Merge pull request #587 from winterheart/module-fixes
Update module, add logger module
2024-09-18 22:18:13 +02:00
Azamat H. Hackimov
dc0cd880e4 Add logger module
Implementing separated logger module.
2024-09-18 22:50:08 +03:00
Louis Gombert
ef113543ab Merge WinController and lnxcontroller files
move controller IO processing to the DDIO module
2024-09-18 22:32:09 +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
Louis Gombert
705c67a1be Merge pull request #546 from winterheart/logging
Enhance logging facility
2024-09-10 09:27:13 +02:00
Azamat H. Hackimov
dc82d2314d Convert linux to use new logging facility 2024-09-10 03:00:25 +03:00
Louis Gombert
dfc192ac81 Merge pull request #548 from pzychotic/fix-errors
Fix small collection of errors
2024-09-08 22:41:46 +02:00
Thomas Roß
68334c54f4 [Linux] Fixed too many parameters to fprintf call 2024-09-07 16:57:37 +02:00
Jan Engelhardt
5f0bdf8184 Fix spello "it's" 2024-09-03 13:26:51 +02:00
Azamat H. Hackimov
79db9aa3e2 Move platform-specific defines and macros to own file crossplat.h 2024-08-20 23:09:27 +03:00
Azamat H. Hackimov
54f9d75e62 Reduce linux_fix.h usage in project 2024-08-20 23:08:10 +03:00
Azamat H. Hackimov
16a6866885 DDIO: new crossplatform SleepMS() function
Use C++ chrono and thread for crossplatform sleep function.
2024-08-20 23:08:10 +03:00
Thomas Roß
cce73891fa [Keyboard] Fixed a bug, where when a keyboard action has a 2nd key binding, both keys need to be hit to trigger the action.
(cherry picked from commit 7f4da73dc8a20202b25a5e2e901684ca08c95018)
2024-08-18 21:21:00 +02:00
Azamat H. Hackimov
0ba3828a13 LINUX: minor cleanup on lnxcontroller.cpp 2024-08-15 11:47:43 +03:00
Azamat H. Hackimov
b911d81c2a LINUX: Use ddio_DoForeachFile()
Replace ddio_FindFileStart() with ddio_DoForeachFile().
2024-08-15 11:47:43 +03:00
Louis Gombert
60c5dbf1fe CMake: add all headers to target sources
This can help with CMake IDE integration and file indexing.
2024-08-09 17:09:14 +02:00
Louis Gombert
10de36c0e4 Merge pull request #469 from tophyr/vcpkg-all-thethings
Use vcpkg on all presets
2024-08-04 14:10:09 +02:00
Chris Sarbora
e5dcce3c9f Use vcpkg for all platform presets 2024-08-03 23:38:01 -05:00
Azamat H. Hackimov
cb9e0f8828 Remove unused osTask class 2024-07-28 16:50:43 +03:00
Azamat H. Hackimov
91354d5b9a Merge pull request #492 from tophyr/pr/posix-defines
Use `POSIX` instead of `__LINUX__` for general OS checks
2024-07-15 23:33:10 +03:00
Chris Sarbora
822a411433 Remove loki_utils
Inline the only usage of `loki_getprefpath()`, and use `Base_directory` (controlled by `-setdir`) instead of `loki_getdatapath()`.

Inline or eliminate some other code that became empty/unused with loki removal.
2024-07-13 03:23:10 -05:00
Chris Sarbora
3da53e567f Programmatically replace all __LINUX__ with POSIX
Steps:
```sh
srcs=$(mktemp)
find . -name "*.cpp" -or -name "*.c" -or -name "*.h" -or -name "*.hpp" -or -name "*.cc" -or -name "*.hh" > $srcs
xargs sed -i 's/ifndef __LINUX__/if !defined(POSIX)/' < $srcs
xargs sed -i 's/ifdef __LINUX__/if defined(POSIX)/' < $srcs
xargs sed -i 's/defined(__LINUX__)/defined(POSIX)/' < $srcs
```
2024-07-12 18:11:54 -05:00
Louis Gombert
5d413b9f30 Fix bad __LINUX__ checks 2024-06-29 18:28:22 +02:00
Louis Gombert
91c18fefc5 Windows SDL2 compilation 2024-06-29 18:21:37 +02:00
Azamat H. Hackimov
59487976f6 Isolate misc module
Isolate misc module for better dependency handling.
2024-06-27 01:26:35 +03:00
Azamat H. Hackimov
c41c3a7cb1 Replace Global* memory functions
Replace Global* memory functions with mem_* equivalents from mem.h, remove compatibility functions on Linux / macOS platforms.
2024-06-15 22:07:45 +03:00
Louis Gombert
15dce81bd1 Merge pull request #396 from GravisZro/cleanup
More clean up
2024-06-04 07:25:15 +00:00
Azamat H. Hackimov
4795388500 Merge pull request #416 from GravisZro/update/finite
Replace _finite with std::isfinite
2024-06-02 23:26:36 +03:00
Louis Gombert
66923d5bc7 Merge pull request #407 from winterheart/remove-ncurses
Remove ncurses usage dependency
2024-06-02 20:11:39 +00:00
GravisZro
4e599257a0 Replace _finite with std::isfinite
A simple drop in replacement that is multiplatform which means the
defintion in `linux_fix.h` is no longer required.
2024-06-02 14:50:51 -04:00
GravisZro
691dc6487d Remove one unused macro definition and fix another 2024-06-01 22:21:51 -04:00
Azamat H. Hackimov
09823f9b40 Cleanup linux console code
Unify all commands into function interface, which simplifies code.
2024-06-02 03:41:50 +03:00
Azamat H. Hackimov
95caa7b6c3 Remove ncurses enabled console
This type of console is enabled only with `-svgalib` and `-dedicated` options. Since there no svgalib direct support (which is pretty old and too specific to Linux tech), it's better completely remove this code for simplicity and reducing external dependencies.
Removed `-svgalib` option as unused now.
2024-05-31 13:12:28 +03:00
GravisZro
f7ae658fe2 Modernize struct/enum/unions type declarations 2024-05-30 03:35:17 -04:00
GravisZro
9cf9781369 Properly format/use variadic macros 2024-05-24 20:57:17 -04:00
Azamat H. Hackimov
a0929aefe2 Rename ddio_common to ddio 2024-05-24 22:18:14 +03:00
Azamat H. Hackimov
6bc3c71a83 Reordering ddio_common module
Merge ddio_lnx and ddio_win into ddio_common module.
2024-05-24 22:17:44 +03:00
GravisZro
dc91b22635 Fix rebase breakage 2024-05-24 09:13:36 -04:00
GravisZro
6a9ddd8736 Replace _vsnprintf/vsnprintf with std::vsnprintf 2024-05-24 08:52:59 -04:00