18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-19 22:44:59 +01:00
Commit Graph

178 Commits

Author SHA1 Message Date
053e4cacee Merge branch 'master' into feat/renderers-cleanup 2026-11-16 21:44:48 +01:00
maj00r
7547e6bf07 fix(physicslog): a log whose file can't be written keeps its lines and header, and the writer is stopped once on every way out
A failed write put its lines back, ahead of those since, so a file held by
another program for a while gets its header and every line once it can be
written; up to 4 MB kept per log. Stopping is joined once, and not from the
writer's own thread. main stops the logs after an error it caught too, and the
test watchdog flushes with a time limit, so a disk that doesn't answer doesn't
keep the run from ending.
2026-11-15 23:32:38 +01:00
maj00r
03a3b4c09a feat(physicslog): the logs written every two seconds by a thread of their own, no file kept open; the black box's tapes as it goes
"physicslog yes" kept the .dat of every vehicle with a driver open for the whole run and flushed it twenty
times a second from the simulation's thread: some 580 open files on Tomaszewo. The lines are kept now and a
thread of their own writes them every two seconds, each file opened only for the moment it is written to.
The files, their lines and their text mode stay as they were.

- The black box, with the physics logs off, writes the tapes of the user's vehicles through the same
  writer as it goes, not at the end. A log begins when the user is first in the vehicle and goes on
  while the user looks around outside, until another vehicle is taken; back in it, the log goes on after
  the gap. The vehicle's own driver keeps the log only if it is the primary one, as a passive one's clock
  stands still; otherwise the driver of its train does.
- What is kept is written when the simulator closes, after the black box, at the end of a test run, and
  when the test watchdog ends a run. A crash loses the last two seconds.
- On Tomaszewo with the black box alone, the one tape grows every two seconds. With "physicslog yes", the
  581 logs grow and the simulator holds as many handles as without them; writing them takes the thread
  about 1.9 s, which the closing waits for once.
2026-11-14 00:48:17 +01:00
maj00r
0488519f39 fix: the simulator opens more than 512 files at once, and a shader it can't open says why
With "physicslog yes" every driver keeps its .dat open, and a large scenery (Tomaszewo: some 500 vehicles,
cars of the roads included) took all 512 streams the MSVC runtime gives: the next fopen failed and the
simulator stopped at "cannot read shader: shaders/map.vert" on opening the map. The limit is raised to
8192 at the start (the soft limit of open files up to the hard one on Linux), and a shader file that
doesn't open is told as such, with the system's reason, rather than as one that can't be read.
2026-11-14 00:04:54 +01:00
8701c5de02 Merge branch 'master' into feat/renderers-cleanup 2026-11-10 17:09:09 +01:00
jerrrrycho
8fb596f218 fix(simulation): any exception ends a test run with error, other runs as on master
main() tells a test run (--test) apart before anything runs. Only a test run
catches every exception and installs a std::terminate handler, both ending the
run with the error code and a test: line; any other run keeps master's
exception handling, so on Linux an uncaught runtime_error aborts at the throw
site again.

A test run doesn't start the Discord RPC thread: it published the test
scenery as the player's presence and held the closing up to 5 s.

run.py drops a case scenery's .sbt cache after a run cut short (wall_timeout,
error, a crash, killed by run.py), which could have been writing it.

The -edit branch of the test command line parser had no effect (a token that
isn't an option is ignored either way) and is gone; its test checks what can
be seen instead.
2026-11-08 19:46:16 +01:00
jerrrrycho
349ffb1caf fix(simulation): on Linux an exception ends a test run with its verdict too
The runtime_error the simulator throws on a fatal problem was caught on Windows
only. On Linux a test run aborted on it, with the code of abort() and no
`test:` line. It is caught there too in test mode and ends the test with the
error code and the reason; outside a test it is thrown on as before.
2026-11-08 11:40:13 +01:00
jerrrrycho
ced4e06b35 fix(simulation): no crash message box in test mode
The crash handler of WITHDUMPGEN builds (on by default) shows a message
box before it writes the dump. It also gets the C++ exceptions nothing
catches, since it replaces the CRT's unhandled exception filter. In test
mode nobody is there to close the box, so a crashing test waited for it
until whatever started it gave up (run.py after the case's timeout,
600 s by default). The dump is still written, the exit code is the
exception's.
2026-11-08 09:36:35 +01:00
jerrrrycho
4356e7c3fd fix(simulation): a test run that can't start ends with the error code and says why
- `--test` is looked for before the rest of the command line is read. An
  unknown option before it (e.g. `-s x.scn --test-timout 90 --test`) used
  to end the run with exit code 0, which a caller reads as a pass.
- `--test-timeout` without a value, or with one that isn't a number of
  seconds, fails the run instead of leaving the default or, through atof,
  turning the timeout off.
- These, a missing -s, a failed start and an exception caught in main()
  end the test through test_manager::conclude(), which writes the usual
  `test: error (exit code 5) ... : <reason>` line to stdout and the log.
  Before, `eu07 --test` alone exited with 5 and nothing anywhere: the
  error went to the log queue and the process ended before the log
  thread wrote it. In test mode main() now stops the log thread and
  waits for it before _Exit().

Outside the test mode nothing changes: conclude() does nothing there.
2026-11-08 09:36:28 +01:00
jerrrrycho
441caeed64 refactor(simulation): tidy the test mode code
The test manager is reached through simulation::test() instead of a global,
the result cell is owned by a unique_ptr until the memory table takes it, the
cell value is compared with a margin, strings are built with std::format and
the --test settings moved to apply_test_mode_settings(). The driver's signal
check is folded into UpdateSpeedPosition(), which updates a speed table entry
and reports a signal at stop the head of the train just passed. The test.*
keys are listed with the other settings at the start of the log.
2026-11-07 17:12:11 +01:00
jerrrrycho
02e29f6971 feat(simulation): test mode, --test runs a scenery unattended and exits with the result (eu07/maszyna#541)
eu07 --test -s <scenery> [--test-timeout <s>] runs the scenery in ghostview with
the null renderer (models loaded, no textures), a hidden window, no sound,
network or python, and in fixed steps of 0.03 s of simulation time per frame
(three 10 ms physics steps) as fast as it can. Without -seed it uses a fixed
seed, so two runs give byte-identical physicslogs.

The scenery reports its result to the __test.result memory cell, which the
simulator always creates: value 1 passes once every vehicle has stood still for
1 s, value 0 fails at once. The run ends with exit code
  0 pass, 1 fail,
  2 a train passed a signal at stop (SetVelocity 0 0, as seen in its driver's
    speed table; SetVelocity 0 x on automatic block doesn't count),
  3 timeout (test.timeout, default 3600 s of simulation time),
  4 standstill (every vehicle still for test.standstill s, default 300, with no
    result; a pass with test.pass_on_standstill yes),
  5 error (no -s, the scenery didn't load or has no vehicles, an exception).
The test.* keys go in the scenery's config block; test.fail_if_stop_overran no
only logs a signal passed at danger. Outside the test mode a signal passed at
danger is logged.

The null renderer gets a ui backend which draws nothing, hands out the null
texture and material instead of throwing, and ends the ui frame. A GL context
is still made for the hidden window, without asking for a version, as parts
of the ui create textures with gl calls of their own. No crash dialog or
message box in test mode; the window code no longer needs a monitor.
2026-11-07 16:20:42 +01:00
b151898071 Add small crash reports with crash details, CPU preflight check and eu07_starter 2026-11-01 16:41:03 +01:00
f47172f34d Migration cleanup and renderer documentation 2026-10-15 19:05:35 +02:00
e661b9f1c7 feat(editor): -generate-nodebank-previews mode: png previews of the node bank models, or of the entries given with -entries, drawn offscreen and without a window by the full renderer: square, -resolution 1024 by default, the model in perspective from the front, side and above, fitted to the image less -margin pixels (64 by default) on white background, lit, with materials and with self shadows unless -no-shadows; saved in textures/previews/nodebank under the path of the model with the skin; software rendering of mesa when the graphics driver gives no gl 3.3 or with -software 2026-10-08 18:52:51 +02:00
2e631dcbd6 feat(terrain): binary terrain files (.btf) made out of text terrain files (.txtf) named by terrain directives, checked against length and checksum of the text and loaded section by section when needed; -btf command line conversion; SBT files no longer generated, only loaded 2026-10-06 01:55:38 +02:00
0715437108 Fix include directives 2026-03-14 20:51:11 +01:00
copilot-swe-agent[bot]
7e49aa8740 Rewrite #includes to use explicit subdirectory paths
Co-authored-by: Hirek193 <23196899+Hirek193@users.noreply.github.com>
2026-03-14 19:16:48 +00:00
11e79f52ae Conversion to cpp 20 2026-01-18 21:21:15 +01:00
d70c379efc Thread closing improvements 2026-01-16 15:11:20 +01:00
5421741296 Change subsystem from console to windows 2025-11-07 10:30:22 +01:00
d988567fc5 More detailed crash dumps 2025-09-07 12:49:44 +02:00
f3476be306 Remove double include for windows.h 2025-08-21 20:20:34 +02:00
f5c7092551 Move crash handling logic for windows only blocks 2025-08-21 20:19:12 +02:00
c98227a2e3 Add log timer 2025-07-23 14:48:17 +02:00
1fba26c6cc Console errors highlight 2025-07-23 14:24:56 +02:00
a1510eb4fc Change crashdump name logic 2025-06-11 12:42:09 +02:00
ac2c5ab4cf Add auto dmp file genration 2025-06-02 22:41:39 +02:00
milek7
8fcd17351c flush fixes for e3d exporter 2022-03-06 22:10:38 +01:00
milek7
ce6d530aa8 changes for standalone e3d export 2022-03-06 18:18:07 +01:00
milek7
936effa9db openvr WIP 2020-09-29 22:27:13 +02:00
milek7
aae73106f4 Merge branch 'gfx-work' into sim 2019-04-15 13:10:40 +02:00
milek7
3c28416912 Merge branch 'milek-dev' into gfx-work 2019-04-05 19:36:50 +02:00
milek7
4344ec192a network changes 2019-04-03 01:28:46 +02:00
milek
810ea151e2 fix compiling on MacOS 2019-03-25 20:23:32 +00:00
milek
33a4bb2b14 fix compiling on MacOS 2019-03-25 20:17:27 +00:00
milek7
0453e10534 revert to frequent log flushing, fix for fiz parsing on linux, unify brake_speed interpretation as full rotations per second 2018-08-11 20:13:45 +02:00
milek7
f0b4f42128 throw bad alloc on opengl oom 2018-08-03 22:38:23 +02:00
milek7
08cf801c4e Merge branch 'tmj-dev' into milek-dev 2018-07-17 16:47:25 +02:00
tmj-fstate
ed1e0d8a10 refactoring: basic application code wrapper 2018-07-14 23:44:56 +02:00
tmj-fstate
12d70fe320 virtual slider mouse input mode, minor refactoring, minor bug fixes 2018-07-11 17:45:50 +02:00
tmj-fstate
219e8badc5 position and rotation adjustment value snap mode in scenery editor, position adjustment for memory cells in scenery editor 2018-07-10 01:09:20 +02:00
tmj-fstate
ff1a85fe5d build 180708. model instance position and rotation adjustment in scenery editor, support for event launcher activation with mouse click, minor refactoring 2018-07-08 23:18:27 +02:00
milek7
c248b5bdf4 Merge branch 'tmj-dev' into milek-dev 2018-04-19 23:08:39 +02:00
tmj-fstate
bb87a63eed varying scale cab control animation types, basic shunt mode power slider cab control, minor ai logic tweaks, minor bug fixes 2018-04-18 15:04:04 +02:00
milek7
a914065dd0 Merge branch 'tmj-dev' into milek-dev 2018-04-06 22:33:08 +02:00
tmj-fstate
87f078925c build 180404. optional scenario clock sync with current local time, keyboard input for the ui layer 2018-04-06 01:12:15 +02:00
milek7
473681a12e Merge branch 'tmj-dev' into milek-dev 2018-03-30 00:32:53 +02:00
tmj-fstate
6ffced1d90 file access cross-platform compatibility fixes 2018-03-29 03:48:21 +02:00
milek7
bf3b4bc30e file path fixes (again..), don't capture mouse during loading 2018-03-28 21:49:15 +02:00
milek7
bc2184966f backslash/slash fixes, again 2018-03-26 21:22:20 +02:00