Commit graph

2462 commits

Author SHA1 Message Date
Ralph Sennhauser
149baf116b
Replace all use of POSIX truncate
Use `<filesystem>` instead of `truncate` and remove `truncate`
portability wrapper.

Add a helper function `StatusFromSystemError` to convert error_code to
`Status`.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-15 15:33:59 +02:00
Ralph Sennhauser
57f5b73458
Remove unused wrapper for POSIX rmdir
std::filesystem::remove can be used instead.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-15 15:33:59 +02:00
Ralph Sennhauser
518ed74496
Replace all use of POSIX unlink
Use `<filesystem>` instead of `unlink` and remove `unlink` portability
wrapper.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-15 15:33:59 +02:00
Ralph Sennhauser
71400e8045
Drop unused lowlevel functions
and associated types. Aka posix dirent.h abstraction.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-14 21:58:59 +02:00
Ralph Sennhauser
43e7dbc6da
Use std::filesystem for filesystem abstraction
Drop the use of lowlevel interfaces and consitently use the cpp
interface decupling it from systm dependent code.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-14 21:58:59 +02:00
Ralph Sennhauser
2d317d509d
Remove unix_ExecutablePathname
The function was used as a fallback for when a platform specific approach
isn't available. Given that it effectively is a roundabout way to derive
it from argv[0] which we use as a generic fallback anyway just remove
it.

This further allows to make cxxtest optional.

Refs: #8618
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-08 20:59:45 +02:00
Ralph Sennhauser
ae6d3bfc4e
Implement BSD specific sys_ExecutablePathname
This is more reliable than argv[0] which is effectively used via
unix_ExecutablePathname. Also drop the fallback as it effectively is the
same as the generic fallback and blocks making cxxtest optional.

On FreeBSD the procfs is not mounted by default, so use a syscall
instead.

Refs: #8618
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-08 20:59:45 +02:00
Ralph Sennhauser
349478aa6b
Remove Linux sys_ExecutablePathname fallback
The fallback is of little value and blocks making cxxtest an optional
build dependency. While at it use realpath instead of readlink.

Refs: #8618
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-08 20:59:45 +02:00
Ralph Sennhauser
6fc47e2997
Cleanup wposix header and source
Remove stale NAN and INFINITY, both have equivalents since C++11 and
cleanup headers in wposix source file.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-08 19:52:53 +02:00
Ralph Sennhauser
94f13073ce
Remove unused allocator page_aligned
Unused and since C++17 not really valuable with std::aligned_alloc
(_aligned_malloc and _aligned_free in case of MSVC) available. We also
have an other similar interface with "lib/sysdep/vm.h".

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-05 16:57:20 +02:00
Ralph Sennhauser
0c0552a428
Replace M_PI with C++ numbers
C++20 added π (pi) to the standard, replace the C macro globally.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-04 20:29:48 +02:00
Ralph Sennhauser
a0bb103390
Unwrap SDL_Event
Some checks failed
checkrefs / lfscheck (push) Has been cancelled
checkrefs / checkrefs (push) Has been cancelled
lint / cppcheck (push) Has been cancelled
lint / copyright (push) Has been cancelled
lint / jenkinsfiles (push) Has been cancelled
pre-commit / build (push) Has been cancelled
Since C++11 a C typedef'ed union can be forward declared, so the wrapper
is no longer needed.

While at it switch signatures to refs and convert C style casts.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-05-20 19:44:52 +02:00
Vladislav Belov
456e2a0b56
Removes dummy GL functions as replaced by core
Some checks are pending
checkrefs / lfscheck (push) Waiting to run
checkrefs / checkrefs (push) Waiting to run
lint / cppcheck (push) Waiting to run
lint / copyright (push) Waiting to run
lint / jenkinsfiles (push) Waiting to run
pre-commit / build (push) Waiting to run
2026-04-25 17:47:06 +02:00
Vladislav Belov
68091177ac
Removes ArrayDeleter 2026-04-10 23:03:00 +02:00
Daniel Richard G.
eab11c247c Add nominal support for LoongArch64 and RISC-V 64
Fixes #6584, #6834
2026-03-23 08:20:10 +01:00
Ralph Sennhauser
ba4ef61c15
Use cpp-httplib instead of mongoose
Use cpp-httplib for Profiler2 and RLInterface instead of mongoose.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-01-24 10:45:48 +01:00
phosit
b67faf35c3
Switch main branch to Release 29 2025-12-18 18:16:11 +01:00
phosit
977bf5c0d1
Don't pass the AppHooks as pointer
It's not permitted to pass a nullptr to the `app_hooks_update`. So a
reference should be used.

CppCheck says one shouldn't take pointer to a temporary.
2025-11-20 19:38:33 +01:00
Ralph Sennhauser
16c9795cd1
Remove generic cache
The removal of the VFS cache in 89e339dd16
meant there is no longer a user. As such also clean out the generic
parts with the Landlord and a LRU policies.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-10-31 17:03:34 +01:00
Ralph Sennhauser
eba8439295
Replace boost::filesystem std::filyestem
Bumping the minimum version of macOS to 10.15 for spidermonky [1] also
allows us to use std::filesystem instead of boosts implementation.

[1] f14a98e26f

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-10-29 09:56:32 +01:00
Itms
866d6f0527
Add an engine "compatible" version
When a patch version is released, it must declare compatibility with the
previous patch versions of the same main release. This allows players to
keep replaying their games and to keep playing online with users of
other patches of the same main release.

This should have anticipated for dae7a8c394
2025-10-26 09:16:46 +01:00
Itms
50f6da2a13
Use the PYROGENESIS_VERSION macro instead of a global
Reviewed-At: https://gitea.wildfiregames.com/0ad/0ad/pulls/8222
2025-10-26 09:16:44 +01:00
Vladislav Belov
cb58116270
Fixes lseek for big files on Windows
It was broken in ef69c37f66, before that we were using _lseeki64.

Fixes #8459
2025-10-25 13:35:59 +02:00
phosit
019374d5c7
Bump copyright year for windows build 2025-10-15 12:36:00 +02:00
Vladislav Belov
fb94cc704f
Makes loading terrain textures more smooth 2025-10-13 00:14:45 +02:00
Vladislav Belov
e4de94415e
Removes unused pointer from the allocate function
Also allows to compare ProxyAllocator. For example, it might be
required for containers to compare iterators.
2025-10-12 00:53:10 +02:00
Vladislav Belov
e63c80c613
Reduces string allocations in paths. 2025-10-05 01:31:27 +02:00
Ralph Sennhauser
e22c5bd05e
Fix some includes in atlas
Make include-what-you-use happy with some files in source/tools/atlas
and fix what needs to be fixed.

Update premake script to include missing deps and drop various extra
paths for simplification.

Don't always include wx/wx.h via precompiled.h in case PCH is disabled.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-08-21 14:18:38 +02:00
Ralph Sennhauser
5b5f678e3f
Fix some includes all over the place
Make include-what-you-use happy with some files in source and fix what
needs to be fixed.

Add markers to precompiled.h header includes to avoid
include-what-you-use wanting them to be removed.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-08-14 20:15:30 +02:00
Ralph Sennhauser
3647921bed
Fix some includes all over the place
Make include-what-you-use happy with some files in source and fix what
needs to be fixed.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-08-13 19:38:21 +02:00
Ralph Sennhauser
af3f7acfe7
Explicitly const_cast string literal for C API
The implicit conversion form sting literal to char* for C compatibility
was removed with C++11, seems MSVC caught up with this in C++20.

Use explicit cast instead where needed and change API to const char*
otherwise.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-08-12 20:45:15 +02:00
Ralph Sennhauser
45afefa961
Rename wcsnlen and strnlen to C11 names
Those functions were added to the C11 standard as an extension under the
name wcsnlen_s and strnlen_s. Also supported under that name in Windows.

Renaming avoids a possible name conflict with the posix functions of the
same name. Further this new name follows the pattern of names of the
other "secure" functions.

Fixes: #8274
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-08-10 07:33:00 +02:00
Itms
03fff3572f Use conforming preprocessor with modern MSVC
https://learn.microsoft.com/en-us/cpp/preprocessor/preprocessor-experimental-overview
2025-08-04 17:35:48 +02:00
Ralph Sennhauser
7dece41990
Fix includes in source/lib
Make include-what-you-use happy with some files in source/lib and fix
what needs to be fixed.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-08-03 10:15:37 +02:00
phosit
971525a41b Remove TIMER_BEGIN and TIMER_END
`TIMER` messages where printed to stdout which lead to noise.

Refs: #1003
2025-07-29 18:19:59 +02:00
phosit
f721f56ad4 Replace TIMER with PROFILE2
`TIMER` messages where printed to stdout which lead to noise.

Refs: #1003
2025-07-29 18:19:49 +02:00
Ralph Sennhauser
aed1570040
Fix some includes in source/ps
Make include-what-you-use happy with some files in source/ps and fix
what needs to be fixed.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-28 16:59:04 +02:00
phosit
08d8f0f61c Remove UNUSED2
The remaining uses can be changed to `std::ignore`.
Fix #7760
2025-07-28 13:16:37 +02:00
phosit
eb3f0166f8 Prefer [[maybe_unused]] over UNUSED2
`[[maybe_unused]]` is in the C++ standard.
2025-07-28 13:16:37 +02:00
phosit
5be02743fa Don't use UNUSED2 on always unused variables
Not introducing a variable enforces that the variable is not used.
`UNUSED2` on the other hand is used to silence the warning.
2025-07-28 13:16:37 +02:00
Ralph Sennhauser
27f7216be7
Use proper units for time conversion
On *nix the conversion of timeval and timespec to double needs to use
the actual unit in use instead of the unrelated clock resolution.

Fixes: aa3bd08513
Fixes: #8215
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-27 14:11:52 +02:00
Ralph Sennhauser
70b8c6eb52
Prefer standard int types
<cstdint> since C++11 defines all those int types and macros, therefore
drop extra definitions in source/lib.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-25 15:53:40 +02:00
Ralph Sennhauser
9c7bbd531f
Fix some includes in source/lib
Make include-what-you-use happy with some files in source/lib and fix
what needs to be fixed.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-25 07:11:21 +02:00
trompetin17
df7b2fcd2a
Win: include <cctype> for isalpha without PCH
Building the workspace with `--without-pch` fails on MSVC:

    source/lib/sysdep/os/win/acpi.cpp(123): error C3861: 'isalpha':
    identifier not found

The pre-compiled header normally brings in `<cctype>`, but when PCH
generation is disabled the translation unit must include the header
explicitly.

Add the missing `#include <cctype>` to
`source/lib/sysdep/os/win/acpi.cpp`.

No functional change; the code now compiles cleanly with or without PCH.
2025-07-23 09:17:27 -05:00
Stan
ef69c37f66
Add VS2022 support with the v143 toolset 2025-07-23 09:19:29 +02:00
Stan
0d60ecbf96
Remove OS_MAC macro
It hasn't been used in a while, and we shouldn't pretend to support macOS < 10.9.
2025-07-19 18:16:14 +02:00
Ralph Sennhauser
4324dc1447
Fix some includes in source/lib
Make include-what-you-use happy with some files in source/lib and fix
what needs to be fixed.

Ref: #8086
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-17 20:07:25 +02:00
Ralph Sennhauser
0a78acf4dd
Drop header lib/posix/posix_time.h
Only used for timespec which is in <ctime> since C++17. All other uses
were already obsolete with C++11 so remove the header wrapper.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-16 18:28:05 +02:00
Ralph Sennhauser
826dba847c
Make wfilesystem.cpp freestanding
Copy some wtime internals to wfilesystem.cpp with internal linkage only,
this code has had no use outside of wfilesystem and was only added to
wtime in case other use cases could be found. This will allow removing
posix_time and affiliated code.

wfilesystem will become obsolete with the move to <filesystem>

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-16 18:28:05 +02:00
Ralph Sennhauser
2e6f62dcf9
Use clock_gettime on macOS
Is a Posix function and available on macOS since version 10.12, has better
granularity than gettimeofday. Add missing header <time.h> where
clock_gettime is specified.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-07-16 18:28:05 +02:00