Commit Graph

2477 Commits

Author SHA1 Message Date
Vladislav Belov 7790c0972b Removes legacy timers
Modern profiling tools provide more details and more precise
measurements for more platforms. For simpler cases we have our in-game
profiler.
2026-06-28 13:34:01 +02:00
Ralph Sennhauser 4967922447 Don't load WGL
Depend on SDL and wxWidgets doing the necessary work.

Also remove WGL from glad.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-28 09:49:26 +02:00
Ralph Sennhauser c5a9d18cfa Drop use of GLX and EGL
Only used for hw-report and only when using GLX which is for X11 only.
The usefulness of those reported properties is questionable and X11 is
becoming rarer.

This allows us to drop a direct dependency on X11 delegating the
handling to SDL and wxWidgets respectively GTK.

Further SDL3 wont expose supported video driver at compile time making
this step more meaningful.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-28 09:49:26 +02:00
Ralph Sennhauser 08cd7e9096 Drop vsync workaround for wxWidgets
wxWidgets already sets it's prefered mode.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-28 09:49:25 +02:00
vyordan ec8b420abc Move Script* classes to Script namespace
- Rename ScriptEngine, ScriptContext, ScriptInterface, ScriptRequest to
  Script::Engine, Script::Context, Script::Interface, Script::Request
- Remove 'Script' prefix from filenames:
  ScriptContext.* → Context.*
  ScriptInterface.* → Interface.*
  ScriptRequest.* → Request.*
  ScriptEngine.* → Engine.*
  ScriptConversions.* → Conversions.*
  ScriptExceptions.* → Exceptions.*
  ScriptForward.* → ForwardDeclarations.*
  ScriptStats.* → Stats.*
- Update all includes, forward declarations, and friend classes
- Use namespace Script { ... } in .cpp definitions to avoid repetitive
  Script:: prefix (keeping global callbacks outside)
- Rename internal implementation structs:
  ScriptInterface_impl → Interface_impl
  ScriptFunction → Function
- Update copyright year to 2026 in all touched files
- Suppress pre-existing cppcheck warnings (uninitvar, nullPointer, unknown
  macro) by adding them to suppressions-list.txt (these are not caused
  by this refactor)

Fixes #7516
2026-06-20 17:43:00 +02:00
Ralph Sennhauser 181a29597d Remove helper function FileExists
Use std::filesystem at caller site instead.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-20 12:01:38 +02:00
Ralph Sennhauser 355c068068 Remove helper function FileSize
Use std::filesystem at caller site instead.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-20 09:00:57 +02:00
phosit 3af4287f6d Change the return type of event-handler
The return value is more strongly typed.
2026-06-19 20:53:52 +02:00
phosit 47e8a17a41 New input handling system
The new system allows to register all function objects as Input::Handler
not only function pointers.
To not get dangling references a handler is unsubscribed on it's
destruction.
The order in with the handlers are executed has to be specified by the
slot-argument, instead of the reverse order of registration.
2026-06-19 20:53:51 +02:00
Ralph Sennhauser 52dee75c47 Remove unused helpers from wfilesystem
Were used for mtime conversion. Cpp-20 has std::chrono::file_clock.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-18 20:47:34 +02:00
Ralph Sennhauser 3c0274c7cc Remove unused android filesystem helpers
We don't use neither opendir nor readdir nor closedir. Further there are
no callers for init_libc().

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-18 19:48:05 +02:00
Ralph Sennhauser 62e116340e Remove POSIX rename wrapper
Unused by now, use `<filesystem>` instead.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-18 17:46:00 +02:00
Ralph Sennhauser 792949e812 Remove POSIX mkdir wrapper
Unused by now, use `<filesystem>` instead.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-18 10:53:30 +02:00
Ralph Sennhauser e3c65841de Replace all uses of POSIX stat
Use `<filesystem>` instead of `stat` and remove wrapper.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-17 13:14:28 +02:00
Ralph Sennhauser 8336e679af Replace all uses of POSIX realpath
Use `<filesystem>` instead of `realpath` and remove wrapper.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2026-06-16 14:08:02 +02:00
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
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 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