Commit Graph

24879 Commits

Author SHA1 Message Date
Ralph Sennhauser 8ec21aac53 Group documentation pages
All documentation pages are made subpages of a page Documentation, this
helps browse documentation not directly tied to source code.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-03 20:44:39 +02:00
trompetin17 4dc686564e Fix FreeType font loading from zipped mods
The FreeType font loader was directly passing filesystem-style paths
(e.g., mod.zip/...) to FT_New_Face, which does not support paths inside
ZIP archives. As a result, FreeType failed to open the font, triggering
a crash when the engine attempted to use an invalid face object.

This patch changes the font loading logic to:

Use the VFS to read the .ttf font file into memory (shared_ptr<u8> and
size).

Load the font using FT_New_Memory_Face with the in-memory buffer,
ensuring compatibility with zipped mods.
2025-06-03 11:20:56 -05:00
elexis 67eaa8f1a9 Fix change perspective in replays
Fixes change perspective features of multiplayer replays following cheat
protection in 023527e56e.

Fixes: #8020
2025-06-03 13:52:26 +02:00
trompetin17 81dfd51eb3 Fix hard crash when terrain is missing from map
Previously, opening a map that referenced a deleted or missing terrain
caused a severe crash with multiple error dialogs, forcing users to kill
the process. This change restores the previous behavior where missing
terrains are gracefully handled: a warning is logged and the terrain is
substituted with a fallback placeholder (ErrorTexture from
TextureManager).

This significantly improves UX for developers and modders working with
outdated or broken maps, aligning behavior with expectations from
earlier versions of the editor.
2025-06-02 00:29:03 -05:00
Ralph Sennhauser 9dfc638b80 Add Win64 pipeline support
Extends the current Windows pipeline to also build for AMD64. While at
it use a matrix build.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:39 +02:00
Ralph Sennhauser 623e7f7a47 Disable warning LNK4098
Even with lots of effort [1] to isolate the offending library there is
little to be had, as such disable the warning.

[1] https://gitea.wildfiregames.com/0ad/0ad/pulls/7798#issuecomment-119332

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:39 +02:00
Ralph Sennhauser 241b9f0952 Add missing Win64 dbghelp dlls
Bump svn libs version to get dbghelp.dll and dbgcore.dll.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:39 +02:00
Ralph Sennhauser a8e0e50ae5 Use Bit instead of BIT
The BIT macro is compile time only anyway. Takes care of the warning
"C4334 - <<': result of 32-bit shift implicitly converted to 64 bits".

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:39 +02:00
Ralph Sennhauser 06e2f0bcc3 Fix cast to void for Win64
Make what could be considered a legendary hack less brittle.

    C4312: 'reinterpret_cast': conversion from 'long' to 'void *' of greater size

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:39 +02:00
Ralph Sennhauser e1e1e42939 Update fmt and libxml2 for Wind64
Bump svn rev for libs to get fmt and libxml2 fixes.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:38 +02:00
Ralph Sennhauser b527e6b870 Fix check for availability of wxWidgets for Win64
In premake we check for wxWidgets on Windows to see if we can build
Atlas, this check wasn't adopted when adding support for Win64.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:38 +02:00
Ralph Sennhauser fb56668dd9 Fix size mismatch in shift operation for Win64
Msvc complains about C4334 - 32bit/64bit shift.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:38 +02:00
Ralph Sennhauser 58b70719be Disable conversion warnings on Win64
Those warnings aren't enabled for gcc and clang currently either, so
just disable them for msvc as well.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:38 +02:00
Ralph Sennhauser 904dffdaba Disable warnings for Mongoose on Win64
Mongoose is on the way out, and it's not like the same issue isn't
present for other 64bit platforms, we just don't have those warnings
enable there.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:51:38 +02:00
Ralph Sennhauser ef7f1d336c Move errorlist.pl from build to tools
The target file is checked in into vcs so this tool isn't used during
build and as such better lives in source/tools.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 20:42:44 +02:00
Ralph Sennhauser 4463e9480a Remove leftovers of arclint
All linting was ported to pre-commit or gitea workflows, the only thing
left is an adapter to output to Phabricator which is no longer in use.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-06-01 13:25:24 +02:00
Ralph Sennhauser 895cb63c4a Add --build-archive to spidermonkey build.sh
This option allows to build the spidermonky archive hosted by WFG from
the upstream firefox tarball.

First this serves as documentation as to how the taball is created and
by integrating it into the regular build process allows to easely bump
spidermonky version for local testing.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-31 17:10:10 +02:00
Stan 167020c05c Fix broken build restrictions
In f3ac9e9669 the fail condition was broken causing it to allow building on restricted areas.

Add a test to ensure correct behavior for this case.

Reported by: @wowgetoffyourcellphone
Pull Request: #8021
2025-05-31 10:58:14 +02:00
Stan d3017b6f9c Fix error spam in Atlas
Atlas has no notion of player removal. Each entity would trigger an error in Player.js

Reported by: @trompetin17
Reviewed by: @trompetin17
Pull Request: #8006
2025-05-30 19:23:32 +02:00
Ralph Sennhauser 02e15da51b Add eslint pre-commit hook
This replaces the old arclint eslint setup 1:1 rule wise, only porting
the configuration to a format recent eslint can read.

Further remove the arclint setup as it is no longer of use.

Thanks to Stan for reviewing all needed fixes to Javascript code to
allow for adding this without compromises.

Fixes: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-30 17:30:25 +02:00
Ralph Sennhauser 666ffb0f18 Fix new and profiler eslint warnings
This fixes 'no-trailing-spaces', 'semi', 'prefer-const' that made it in
since and 'no-shadow', 'no-multi-assign', 'no-invalid-this' as well as
'no-undef-init' in profiler.

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-30 15:25:54 +02:00
phosit d98a205feb Don't pass report explicitly in ReportDraw
The function declaration binds `report` implicitly.

Ref: #7812
2025-05-30 14:16:32 +02:00
phosit e0ed2ae0c8 Replace var in inner scopes from ReportDraw
Variables declared with `var` are also accible after accessing the
scope. This lead to shadowing because variables with the same name are
declared in a later scope.

Ref: #7812
2025-05-30 14:16:31 +02:00
phosit 07ed959422 Remove IIFE in ReportDraw
Since variables declared with `var` don't respect all scopes, when used
in a loop it doesn't create a new variable each iteration. The
initializer value is always assigned to the same variable. That makes
problems when the variable is used in a callback. To work around that
the variable is copied in to a IIFE.
When not using `var` the iife isn't required.

Ref: #7812
2025-05-30 14:16:18 +02:00
phosit 61de7ccbfc Don't use this in do_zoom callbacks
Ref: #7812
2025-05-30 13:22:06 +02:00
phosit 0e9d2a8d5e Remove outInterface from ReportDraw
Only return the one function which is actually used.

Ref: #7812
2025-05-30 13:21:59 +02:00
phosit 83f2a34a50 Make canvas local in ReportDraw
Ref: #7812
2025-05-30 13:21:41 +02:00
trompetin17 d323797d98 Add glyph debug box rendering for font system
This commit introduces optional debugging visuals for font glyph
rendering. When enabled, each glyph is drawn with a surrounding debug
box to aid in visual inspection of glyph layout, spacing, and atlas
behavior.

Usage examples (via console):

// Enable debug box rendering
Engine.ConfigDB_CreateValue("user","fonts.debugBox", true);

// Set debug box color (R G B)
Engine.ConfigDB_CreateValue("user","fonts.debugBoxColor", "35 0 35");

This feature is intended for developers working on font layout or atlas
generation logic, and has no effect on normal gameplay or UI rendering
when disabled.
2025-05-29 06:23:20 -05:00
Ralph Sennhauser 8b1c6c76b6 Make Profiler2Report a class and make eslint happy
This removes all global code and fixes eslint warnings 'no-shadow' and
'no-undef-init'. Leave other possible improvement style wise for an
other time.

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-29 11:03:13 +02:00
Stan b36782388b Allow removing player entities when starting a match. 2025-05-28 23:05:36 +02:00
Ralph Sennhauser e4e80a2504 Use trigger hook to init map Flood
Eslint doesn't like the global return and fails to parse the trigger
script file. Rewrite the script to avoid this and any globals while at
it. Also use OnInitGame as the execution with an IIFE in global scope
wouldn't guarantee when it will be executed or whether the timer
component is already registered.

Further don't concat the warning string as the extraction script for
translation expects a literal.

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-28 20:21:24 +02:00
Ralph Sennhauser 7583c4f241 Fix remaining eslint warnings
Fix instances of semi, no-unreachable, space-unary-ops, and no-invalid-this.

Manual fixes needed for:
eslint --config full.mjs

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-28 19:51:10 +02:00
Ralph Sennhauser 97d76b1495 Fix eslint rule 'prefer-const'
Manual fixes needed for:
eslint --no-config-lookup --rule '"prefer-const": 1'

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-28 19:34:46 +02:00
Ralph Sennhauser f3ac9e9669 Fix eslint rule 'default-case'
Manual fixes needed for:
eslint --no-config-lookup --rule '"default-case": 1'

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-28 19:24:50 +02:00
Ralph Sennhauser d37811d42c Fix eslint rule 'no-invalid-this'
Manual fixes needed for:
eslint --no-config-lookup --rule '"no-invalid-this": 1'

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-28 17:18:33 +02:00
Lancelot de Ferrière e930cf893e Align SM GC time budget with manual GC time budget
6 milliseconds now used everywhere.
2025-05-28 10:14:34 +02:00
Lancelot de Ferrière e3e542b1f9 Always allow last-ditch GCs
As noted on #7979, we run into OOMs since commit af32d386b9. The reason is that the default incremental GC budget is unlimited, which actually doesn't perform incremental GCs. Our settings can lead to situation where the incremental GCs don't actually sweep, thus not freeing memory.
SM has a mechanism to avoid OOM anyways with LAST_DITCH GCs, but by default these can only occur ever 30 seconds. Turn this off.

Reported by: langbart
2025-05-28 10:14:20 +02:00
trompetin17 2781d9a6a3 Add Fallback Font support
In previous fontbuilder.py we have the capacity to specified chain fonts
when a glyph is missed from one font.

This commit enable that behavior.
2025-05-28 01:01:03 -05:00
trompetin17 e024f5c88b Fix blurry text by aligning glyph positions
Text rendering appeared blurry due to subpixel positioning when using
LINEAR filtering. Replaced glyph position calculation with std::ceilf()
to ensure integer-aligned drawing coordinates and crisper text.
2025-05-27 21:30:57 -05:00
Vantha b772ebc262 Small normal map improvement 2025-05-27 22:19:24 +02:00
Ralph Sennhauser 03fd1acd5d Fix memory leak wrt renderer instance
The renderer instance is created with new, so use delete.

Direct leak of 80 byte(s) in 1 object(s) allocated from:
    #0 0x7fd3c932870b in operator new(unsigned long) (/usr/lib/gcc/x86_64-pc-linux-gnu/15/libasan.so.8+0x12870b)
    #1 0x55bbedf25fb0 in InitGraphics(CmdLineArgs const&, int, std::vector<CStr8, std::allocator<CStr8> > const&, ScriptContext&, ScriptInterface&) ../../../source/ps/GameSetup/GameSetup.cpp:654
    #2 0x55bbed2bb95e in RunGameOrAtlas ../../../source/main.cpp:684
    #3 0x55bbed271b28 in main ../../../source/main.cpp:759
    #4 0x7fd3c665f3ed in __libc_start_call_main (/lib64/libc.so.6+0x263ed)

Fixes: #7951
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-27 20:36:48 +02:00
Ralph Sennhauser ba9dcd8146 Fix eslint warnings for 'gamestate.js'
Fixes 'no-invalid-this' by converting to arrow function as thisArg is
only accepted by eslint for inlined function, "free" function might be
used in another context.

Also fixes 'consistent-return' and 'default-case' adn while at it
simplify the logic a bit.

Manual fixes needed for:
eslint --config full.mjs binaries/data/mods/public/simulation/ai/common-api/gamestate.js

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-27 19:25:30 +02:00
Dunedan f00dff380d Refactor validate_dae.py for more speed
This refactors validate_dae.py to utilize multiple CPU cores. This makes
it significantly faster. It also improves code quality and adds commands
line options.
2025-05-27 08:05:13 +02:00
Dunedan 4b3d7f018b Improve find_files implementation
Instead of listing files recursively for each directory manually, this
uses the built-in glob functionality of Python's pathlib.Path. As
part of this the found paths are returned as generator instead of a
list. Together this results in easier to read code and better
performance.
2025-05-27 07:32:51 +02:00
Vantha 279233aca1 Two improved normal maps 2025-05-27 07:26:33 +02:00
trompetin17 bdd94bd264 Add font engine aware of Gui.scale
This commit enhances text rendering by leveraging FreeType and a dynamic
font atlas. Previously, GUI scaling relied on bitmap fonts, which led to
blurry and distorted text when scaling up. Now, we scale the font size
directly using FreeType, resulting in much sharper and more readable
text at any GUI scale.

Key improvements:
- Replaced bitmap font scaling with true font size scaling via FreeType.
- Reduced glyph cache dependency on fixed positions, relying on shader
  scaling instead.
- Switched to float-based glyph positioning for more accurate rendering
  and scaling.

These changes ensure clean and consistent text appearance across
different GUI scales.
2025-05-26 13:12:47 -05:00
Ralph Sennhauser 189ec6a7eb Fix eslint rule 'brace-rules'
Manual fixes needed for temporary config braces-rules due to setting up
required plugin:
eslint --no-config-lookup --config brace-rules.mjs

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-26 19:23:19 +02:00
Ralph Sennhauser 8b13be3b03 Fix eslint rule 'consistent-return'
Manual fixes needed for:
eslint --no-config-lookup --rule '"consistent-return": 1'

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-26 18:54:52 +02:00
Dunedan b42ea94c3c Update the pre-commit hooks 2025-05-26 17:19:03 +02:00
Dunedan d111d4cc84 Specify the NodeJS version for markdownlint
Running the markdownlint pre-commit hook as Gitea Action fails for
markdownlint >=0.38.0, as the NodeJS version available in the Act Runner
Docker image so too old for that. To solve this, this commit specifies a
newer NodeJS version to use.
2025-05-26 17:18:58 +02:00