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

9 Commits

Author SHA1 Message Date
maj00r
0a1c4fd425 fix(physicslog): what no file name may have on Windows is replaced in the name of a log, on every system
A spawned vehicle is named <spawn>:<number>, and its log went to physicslog/<spawn>:<number>.dat. On
NTFS that isn't even an error: it is the stream <number>.dat of the file <spawn>, which nothing lists,
so the log was written and no one could find it. On Linux the file was there, under a name Windows
can't open.

The name of the file of a log has < > : " / \ | ? * and the control characters replaced by _, on every
system, so the logs are named alike everywhere (spawn_ezt:12 is spawn_ezt_12.dat), and a _ before a
name Windows keeps for a device (con, nul, com1..., with an extension too). The bytes of 1250 stay.
The black box tells the log it begins by the same name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 13:00:16 +01:00
maj00r
5498995672 fix(blackbox): the tapes go on after the editor, with the physics logs off
The tapes of the user's vehicles were written by update() after the check for the writer of the
recording, which close() drops on entering the editor (F11). With "physicslog no", the speed recorder's
tape ended at F11 while the drivers' own logs of "physicslog yes" went on.

The tapes are files of their own: they are kept from the moment the recording was to be made, the file
made or not, closed or not, until the simulator closes, after the gap of the time in the editor.
Only the recording itself stops at F11, as before.

Reported in the review of #385.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 12:47:22 +01:00
maj00r
b7950af6b6 feat(physicslog): the logs of the trains only, physicslog.trains
"physicslog.trains yes" in eu07.ini writes the .dat log of each driver who
drives rail vehicles, not of the passengers nor of the road vehicles that make
"physicslog yes" hundreds of files on a big scenery: the tape of every train.
A driver made primary later begins its log then, and isn't counted while it
doesn't log. The black box goes with it when the ini says nothing of its own,
and doesn't write a second log of a driver writing its own. The doc tells the
doors' sides are the vehicle's, the driver's swapped in the rear cab.
2026-11-15 23:48:23 +01:00
maj00r
043b9fb2f0 fix(physicslog): failed logs kept within 64 MB in all, cut outside the lock, never written twice; the writer knows itself when stopped
The lines kept while files can't be written are cut to their share of 64 MB
before the lock the simulation waits on. A log written in part is cut back to
its length, so the next try doesn't write its start twice. A stop from the
writer itself is told by its id even after another thread took it to join, and
the watchdog's flush waits at most its time, the writing on a thread of its own.
2026-11-15 23:38:24 +01:00
maj00r
5d0bf6ed00 fix(blackbox): the wheels of the powered vehicle, as the speedometer has them, and the logs described as the drivers' they are
In a unit driven from an unpowered car, the speed of the wheels was of the car
the user is in, whose wheels never slip; now of the motor car, signed as the
occupied vehicle's speed. The doc tells of a log per driver, and of the two
seconds of real time a crash loses.
2026-11-15 23:32:39 +01:00
maj00r
7b7529e24e feat(blackbox): the cab record holds the speed of the wheels, apart from the vehicle's when they slip
The speed of the cab record is the vehicle's. The speedometer, and a speed recorder's tape with it, shows the
speed of the wheels as they turn, which runs away from it while they slip and drops to 0 while they are
locked in a skid. It is added at the end of the record (194 bytes), where the readers skip what they don't
know; the .dat tapes have it already, in their second column.
2026-11-14 00:48:18 +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
5ca2f7e38f feat(blackbox): the black box on its own, writing the tapes of the user's vehicles at the end
"blackbox yes" in eu07.ini records the black box with the physics logs on or off, "blackbox no" never;
with no entry it goes with "physicslog yes" as before. With the physics logs off, the recorder keeps the
line of the physics log of the driver the user is with, every 0.05 s, and writes it to
physicslog/<vehicle>.dat when the recording closes: the speed recorder's tape of the vehicles the user
was in, without every vehicle keeping a log open and written twenty times a second.

The line and the header of the log are made by one function of the driver, which its own log writes
too, and the file is opened the same way, so the two are the same to the byte: the readers of these
logs (the old Hasler tape viewer, the starter) read them as before.
2026-11-14 00:04:55 +01:00
maj00r
b251b6fe42 feat(blackbox): a black box of the session: the run, the cab, the signals and the stations to a file (#322)
* feat(blackbox): a recorder of the run, the cab, the signals and the stations to a file

With the physics logs on (and the new eu07.ini setting blackbox, on by
default), the simulator writes a black box of the session to
physicslog/*.blackbox: the scenery map (tracks, signals, W4 stop points
with their heading, W6 horn points), the timetables of the user's train,
and at 10 Hz the cab of the vehicle the user sits in (speed, controllers,
brakes, pressures, lights with the pattern the run asks for, the movement
kind), the AI's reference for the same place (target speed, next limit,
braking distance), the consist, the cameras and the vehicles around.
Changes go in as they happen: switches, signal aspects, commands,
signals passed with their aspect, stations stopped at, passed or missed,
horn requests, the autopilot switched on or off, couplings and vehicles
removed.

The driving aid's next speed limit moved from the UI panel to
TController::next_speed_limit(), so the panel and the recorder read the
same. The format is described in blackbox_doc.md; the writer and the
reader of the records have unit tests.

* fix(blackbox): the aspect a signal had when passed, the lamps the ends have, vehicles taken off

- A passed signal is written with the aspect the train had of it, kept in
  the speed table, not the one its memory cell shows when the pass is
  noticed: by then the train itself on the track behind has often set
  it to stop, and most passes were written as at stop.
- The cab record gains the lamps the vehicles at the head and the tail
  have at their outer ends (136 bytes), so a reader can check the light
  pattern against them as the driver does (no upper headlight, the
  auxiliary lamps, the rear-end signals only).
- A vehicle taken off the scenery and still pointed at by a coupler or
  the camera gets no new number; the camera lets go of it.
- The timetable written before a station goes under the vehicle the
  user is in now, not the one of the last look.
- The file buffer is given once the file is open: MSVC passed over one
  given before.
- The doc tells the AI fields before the consist is started and when
  entering a vehicle is a driver change.

* fix(blackbox): the stop of an automatic block signal passed is written as a stop

The speed table keeps the stop of an automatic block signal (SetVelocity 0 x) as the speed allowed after it, with spStopOnSBL; a pass of it was written as that speed with no flag. It is written as 0 with the flag of an automatic block stop again.

* feat(blackbox): the doors, the brakes of the whole train, a diesel's engine and the rest of the cab

The cab record grows from 136 to 190 bytes, so that a reader can check
everything the driver did:

- the doors: the permits on each side, the departure signal, the steps,
  the door lock and whether the doors are locked;
- the brakes: the equalizing reservoir of the driver's valve, the main
  reservoir pipe, the highest brake cylinder pressure of the train, the
  hand brake, the releaser, the setting (G/P/R/Mg) and the mode
  (PS/PN/EP/MED);
- what drives the vehicle (electric, induction, diesel, diesel-electric,
  steam, none), its power, a diesel's oil pressure, water, oil and engine
  temperatures, overheating, fuel and oil pumps, clutch and torque
  converter, the motor fans;
- the cruise control and its speed, the integrated driving handle of a
  unit, the radio channel, the horn's tones.

New device bits use the upper half of the 32-bit field; the new fields
come at the end of the record, so older readers still read it.

* fix(blackbox): the driver's valve field is what its gauge shows, the radio channel has no none

Handle->GetCP() is the equalizing reservoir of most valves but the time reservoir of the FV4a, empty but after an overcharge: the field is named and documented as what the valve shows. With no driver the radio channel reads as the first one, not 0.

---------

Co-authored-by: maj00r <maj00r@host>
2026-11-11 04:30:52 +01:00