17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 08:39:19 +02:00
Commit Graph

3116 Commits

Author SHA1 Message Date
maj00r
3daf984a64 put audit --fix includes in the fragment, not the purview
The inserter aimed at the spot before the first import, which in a module
unit is past the module declaration - so the includes landed in the
purview, attaching those declarations to the module, and re-running piled
up duplicates. It now targets the global module fragment for module units
and keeps the before-first-import rule only for ordinary units.
2026-09-10 14:37:03 +02:00
maj00r
9ea57e0525 fix the Windows-only sources and the resource encoding
LPT.cpp and PoKeys55.cpp never imported the modules holding WriteLog,
ToLower and contains. Neither file is compiled on Linux, so nothing had
caught it; Console.cpp, which is built the same way, already had its
imports.

eu07.rc.in was stored in CP1250 - the o-acute in "pojazdow" is a single
0xF3 byte. rc.exe guessed a codepage, llvm-rc refuses to. Re-encoded as
UTF-8 with a BOM, which both recognise.
2026-09-10 14:35:10 +02:00
maj00r
14b2e6dc6f define WIN32 when not building with the MSVC driver
Only Platform/Windows-MSVC.cmake passes /DWIN32; neither Windows-GNU nor
the GNU branch of Windows-Clang does. Switching drivers silently took the
macro away from every translation unit, and third-party code that tests
the unprefixed WIN32 took its non-Windows path: FSR2 defined wcscpy_s as
wcscpy, which then failed against the SDK's own three-argument call. asio
reads the same macro.

Defined before any add_subdirectory so every target sees it.
2026-09-10 14:24:15 +02:00
maj00r
5b4df01565 pick the AVX2 spelling by driver, not by platform
betterRenderer gated on WIN32, and WIN32 is true for clang's GNU driver
too, so /arch:AVX2 reached a driver that reads it as a file name.

Swept every compile and link option in the tree for MSVC-style flags
without an MSVC guard; this was the only one left.
2026-09-10 14:14:53 +02:00
maj00r
fcbf034a91 spell the delay-load flag for the driver in use
clang's GNU driver read /DELAYLOAD:dxcompiler.dll as a file name. CMake's
LINKER: prefix emits -Xlinker for it and passes it bare under MSVC.

The other raw linker flags in the tree sit inside if(MSVC), which is
false for this driver, so they never reach the command line.
2026-09-10 14:08:48 +02:00
maj00r
14e12582b6 give CMake forward slashes on Windows
CMake writes the compiler paths verbatim into CMakeRCCompiler.cmake and
friends, where a backslash starts an escape sequence, so %ProgramFiles%
arrived as "C:\Program Files/LLVM/..." and tripped on \P. Same trap
waits for the Python root at C:\hostedtoolcache.
2026-09-10 13:57:08 +02:00
maj00r
78c8961591 use clang's GNU driver on Windows, not clang-cl
CMake wires up C++20 module scanning for Clang only when the frontend
variant is GNU; for clang-cl it sets nothing and refuses to generate:
"the compiler does not provide a way to discover the import graph
dependencies". Not a missing tool, a hard gap - Compiler/Clang-CXX.cmake
guards the whole scandep block on the GNU variant.

clang++ on Windows still targets x86_64-pc-windows-msvc, so the ABI, the
SDK, the vcpkg packages and D3D12 are unchanged. CMake then takes the
GNU path and leaves MSVC false, which is what the /MD /Zi /O2 block wants
anyway; the version resource had to move to a WIN32 guard to survive.
2026-09-10 13:49:54 +02:00
maj00r
7daf200748 build Windows with clang-cl instead of MSVC
clang-cl keeps the MSVC ABI, so the Windows SDK, the vcpkg packages and
D3D12 all still link; only the front end changes. That front end is the
one whose module support has been giving way - global module fragment
merging and type completeness at a template's instantiation point.

Switches the job to Ninja, which is where CMake's module scanning is best
supported, with vcvars64 for the SDK paths. Ninja is single-config, so
the artifacts move from build/bin/<config>/ to build/bin/.

CMakeLists: the MSVC-only blocks tested CMAKE_CXX_COMPILER_ID, which
clang-cl reports as Clang, so the version resource, the icon and /utf-8
would have been dropped silently. They test MSVC now, which is true for
both. /MAP and /MP stay behind a real-MSVC check - the first is a
link.exe spelling, the second clang-cl rejects.
2026-09-10 13:35:35 +02:00
maj00r
96161dcacb include the platform header where Win32 types are used
windows.cpp and piped_proc.cpp reached windows.h through an imported
module's global module fragment, which does not cross the boundary.
LPT.cpp and zmq_input.cpp never had it at all - the first was in an
MSBuild batch that aborted before reaching it, the second is behind
WITH_ZMQ and has not been compiled by either CI job.

The earlier sweep only looked inside #ifdef _WIN32 blocks, but these
files are gated by CMake instead, so they have no such block.
2026-09-10 02:40:50 +02:00
maj00r
c158a5c3ee include windows.h where Driver.cpp calls CreateDirectory
The _WIN32 branch of the physics-log setup calls a Win32 API the file
never included; Linux takes the mkdir branch, so it never showed up
locally. Swept the tree for the same shape - Win32 calls inside _WIN32
blocks without windows.h - and this was the only one.
2026-09-10 02:21:33 +02:00
maj00r
02c6e6895e cover the units that are not module units
The template-header propagation only walked files with a module
declaration, so EU07.cpp, windows.cpp, export_e3d_standalone.cpp and
every betterRenderer source were outside it - including the file with
main(). They reach cParser and friends through eu07.simcore and
instantiate their templates without the headers those bodies name.

Adds audit_modules.py, which checks the whole tree for the seven classes
this migration hit; all seven are clean now.
2026-09-10 02:04:06 +02:00
maj00r
b8f040e6fd propagate template headers transitively, import Console where used
AnimModel.cpp reaches cParser through the simulation core, not a direct
import, so the previous pass missed it; the propagation now follows the
whole import closure. Train.cpp, drivermode.cpp and Globals.cpp call
Console:: inside _WIN32 guards without importing eu07.console - invisible
on Linux, where those blocks are skipped.
2026-09-10 01:41:24 +02:00
maj00r
6550c88536 give importers the headers module templates need
A template defined in a module interface is instantiated in the importing
unit, where its body's types must be complete. A declaration reaching the
importer only through the interface's global module fragment is not
enough for MSVC: cParser::operator>> uses std::stringstream, and every
unit that parsed a float got an incomplete type.

526 headers across 161 units, derived from what each interface's template
bodies actually name.
2026-09-10 01:20:33 +02:00
maj00r
26501b0fd7 hoist standard includes above everything else
Ordering them before the imports in the same file was not enough: a
project header on line 1 can import a module several levels down whose
global module fragment already pulled in the same standard header, and
that include guard does not cross the module boundary. Putting them
first means the guard is set before anything can import.

Skips vendored single-header libraries and anything inside an #if.
2026-09-10 01:02:17 +02:00
maj00r
cfd1c1f318 repair the include reordering
The previous pass dropped imports into the middle of HR_RETURN's
line continuations, breaking nvrenderer_d3d12.cpp, and its scan gave up
on the first line of any file with a BOM - which is why nvtexture.cpp
still had five includes sitting after its imports. Rewritten to skip
macro continuations, tolerate a BOM, and insert only immediately before
the first import.
2026-09-10 00:52:06 +02:00
maj00r
1455583ab6 put every include before every import
A header first pulled in through an imported module's global module
fragment leaves no include guard in the importing unit - macros do not
cross a module boundary - so a later textual include parses it again and
MSVC rejects the redefinition. Redoes the betterRenderer sweep with
placement that stays out of #if blocks, which is where the previous one
dropped <fstream> and broke nvrenderer_d3d12.cpp.
2026-09-10 00:40:32 +02:00
maj00r
2695c8e525 include what you use in betterRenderer
Its sources reached the standard library through the project headers they
included; those are imports now. 178 headers across 56 files, plus 18 C
library headers elsewhere for memcpy/printf and friends. MSVC's STL does
not supply these transitively the way libstdc++ does.
2026-09-10 00:26:55 +02:00
maj00r
2896c2dd60 add the C library headers MSVC needs
Unqualified uint8_t/size_t and friends were reaching 24 units through
some other header on libstdc++; MSVC's STL does not do that, which broke
gl/ubo.cppm (and made its UBS_PAD macro look like garbage). Also
silences C5244, MSVC's counterpart to the clang warning about glm being
included in the module purview, which is deliberate here.
2026-09-10 00:10:52 +02:00
maj00r
7667d8d4d3 build betterRenderer against the modules
Verified locally now that Vulkan and DXC are installed: all 31 targets
compile. glm has to come from eu07.glm only - having it both as a plain
include and as an import made every overload ambiguous. nvrenderer.h is
self-sufficient, since register.cpp includes nothing else. Fixes the
vcpkg triplet, which was pinned to x64-windows.
2026-09-09 23:45:53 +02:00
maj00r
06f6c6035b let betterRenderer import the modules
The module file set moves to its own eu07_modules library: a target can
only consume C++20 modules by linking the target that owns them, and
betterRenderer is a separate add_library. Its project includes become
imports.

CXX_EXTENSIONS must match across the two - a BMI built with -std=c++20
is refused by a unit compiled with -std=gnu++20.
2026-09-09 23:30:34 +02:00
maj00r
ce5ee288ff fix the clang CI build
Every module unit now includes the standard headers it uses. Declarations
reaching a unit only through an imported module's global module fragment
are reachable but not visible, so ADL misses the free operators older
libstdc++ declares beside a type - reproduced on ubuntu 24.04 (libstdc++
13), where gl/vao.cpp could not compare vector iterators.

Also drops a stale editor/editorSettings.hpp from the MSVC source list,
which broke the Windows configure step, silences the deliberate
include-in-purview warning in the glm wrapper, and removes GCC support:
clang or MSVC only.
2026-09-09 22:52:28 +02:00
maj00r
f16b5deefb build with clang
Linux CI switches to clang 22; fixes what that exposed - export on
out-of-line member definitions, missing std includes, missing glm
imports. GCC 16 still builds.
2026-09-09 22:34:32 +02:00
maj00r
3f7960aad5 pch migration to modules [wip] 2026-09-09 20:35:26 +02:00
jerrrrycho
c3007e3237 ci: skip Sonar coverage gate 2026-09-06 15:02:10 +02:00
7a469190ca Merge pull request #168 from pwarszawski/whois-owner-fallback
whois: fall back to the consist owner in the +0/+7 mode too
2026-09-05 21:08:29 +02:00
3b061a1bf1 Merge pull request #171 from pwarszawski/event-name-registration-casefold
event names: fix registration/lookup casing mismatch for non-ASCII identifiers
2026-09-05 21:07:41 +02:00
76eede79aa Merge pull request #154 from MaSzyna-EU07/uart-independent-dynamic-brake
Add independent dynamic brake support (eg. Vectron) to UART controllers
2026-09-05 20:04:34 +02:00
fadcc2d666 Merge pull request #170 from MaSzyna-EU07/fix/reflections-and-burned-colors
Fix relfections on default shader and tonemapping
2026-09-05 20:03:31 +02:00
Piotr Warszawski
2dcae05c77 event names: drop redundant locale-dependent ToLower() at registration
make_event() lowercased the event name twice: cParser::getToken() already
folds ASCII via toLowerChar() (which intentionally leaves bytes >= 0x80
alone), then ToLower() ran std::tolower() over every byte on top of that.

With a non-"C" global locale, that second pass remaps cp1250 uppercase
accented letters (e.g. 0xAF -> 0xBF). Every lookup path - TTrack::AssignEvents(),
child-event resolution in multi_event, event-launcher name resolution -
normalizes only through the parser, so a registered name containing such a
letter can no longer be found: the track logs "can't find assigned event"
and the binding is silently dropped.

Removing the extra ToLower() makes the registration key match every lookup
site (ASCII-only folding, non-ASCII bytes compared verbatim), and matches
the direction toLowerChar()'s own comment already points at for UTF-8.
2026-09-05 19:10:58 +02:00
Piotr Warszawski
1ce576c0c6 whois: log the no-activator case instead of failing silently
A whois with no triggering vehicle previously just wrote nothing to
the target cell with no trace in the log, which is a real pain to
diagnose from the scenery side (this is exactly the kind of thing that
cost real debugging time on a station script recently).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-04 22:22:25 +02:00
Piotr Warszawski
7ead4f11b4 whois: guard against a null activator
whois_event::run_() dereferenced m_activator unconditionally in every
branch (this predates this PR). getvalues_event::run_() and
putvalues_event::run_() already guard the same way elsewhere in this
file; whois_event was missing it. Single early return covers every
branch, old and new.
2026-09-04 22:09:23 +02:00
Piotr Warszawski
4f47233a89 whois: fall back to the consist owner in the +0/+7 mode too
The +8/+16/+24/+32/+40 (and the new +48) modes all pick the reporting
vehicle the same way: the activator's own Mechanik if it's the primary
driver, otherwise the consist's controlling vehicle (ctOwner) - so the
event still resolves correctly if a wagon happens to trigger it ahead
of its locomotive.

+0 (train name / stations left / stop flag) predates that pattern and
never got it: it required m_activator->Mechanik directly and silently
wrote nothing otherwise. A whois hook placed where the loco doesn't
necessarily lead (e.g. a train that reverses direction, or one being
propelled) can have a wagon trigger the event first and the memcell
stays empty, with no error - hard to diagnose from scenery side.

Same owner-selection, same guard semantics (still nothing written if
neither the activator nor its consist has a controller), only the
source of the vehicle it reads from is widened.
2026-09-04 21:01:33 +02:00
6befd69968 Merge pull request #149 from combolek/getpf
state_manager: Optimize computation of pressure flow for Oerlikon ESt valves
2026-09-04 16:39:49 +02:00
maj00r
a9b561cd65 Merge pull request #162 from MaSzyna-EU07/bugfix/260825-00jor
make targetfps great again
2026-09-03 22:18:16 +02:00
jakubg1
db6296124b Merge pull request #166 from jakubg1/dev/revert_remove_instructor_panel
Revert "Remove training card window"
2026-09-02 12:37:40 +02:00
jakubg1
ba19db8715 Revert "Remove training card window"
This reverts commit 363b50c9c2.
2026-09-02 12:32:35 +02:00
jakubg1
4e35a5f45f Merge pull request #160 from jakubg1/dev/remove_instructor_panel
Remove training card window
2026-09-02 11:59:49 +02:00
jakubg1
a2f62c56ff Merge pull request #161 from jakubg1/dev/epfuse_engage_fix
Fix EP fuse auto-(dis)engaging
2026-09-02 11:59:30 +02:00
766a957527 Fix relfections on default shader and tonemapping 2026-09-01 20:41:06 +02:00
maj00r
0aceb120e2 make targetfps great again 2026-08-25 18:03:55 +02:00
jakubg1
f8cb5e4431 Fix EP fuse auto-(dis)engaging
When the Autorewident function is enabled, the EP fuse switch will no longer automatically engage or disengage if the player is controlling the train. This would happen for example when approaching a station.
2026-08-24 00:24:15 +02:00
jakubg1
363b50c9c2 Remove training card window
This was a leftover from attempts at modifying MaSzyna for professional simulators.
Interaction with this window could cause a crash.
2026-08-23 22:37:33 +02:00
jakubg1
9a0b63a97c Merge pull request #133 from dos1/launcher-panel
launcher: Open on scenery list panel
2026-08-23 21:53:12 +02:00
df9ba73a88 Merge pull request #158 from MaSzyna-EU07/migrate-to-actions
Migrate to actions
2026-08-20 23:11:27 +02:00
66302bd88e Remove appveyor and update readme 2026-08-19 14:50:28 +02:00
8024c2be7b Revert "Delete appveyor.yml"
This reverts commit 8a22553e7c.
2026-08-19 14:48:03 +02:00
3c61168783 Revert "Delete azure-pipelines.yml"
This reverts commit 67bb6e1d3c.
2026-08-19 14:47:59 +02:00
67bb6e1d3c Delete azure-pipelines.yml eu07-2026.423-prerelease 2026-08-19 14:45:49 +02:00
8a22553e7c Delete appveyor.yml eu07-2026.422-prerelease 2026-08-19 14:45:33 +02:00
6b50a6aa68 Update CI configuration for Windows and Linux builds 2026-08-19 14:23:40 +02:00