snipem / gt7dashboard

Gran Turismo 7 Race Telemetry Dashboard
GNU General Public License v3.0
177 stars 30 forks source link

Fixing replay mode compatibility by adding telemetry stream state detection #2

Closed Nathaniel-Wu closed 1 year ago

Nathaniel-Wu commented 1 year ago

An attempt to restore the capability to use the tool with the replay mode. Based on the discovery I posted here.

The only thing this fix does is determine what the player is doing based on the context of the telemetry stream, and force the GTData.in_race field to be True if we find that the player is in replay mode. The rest of the code base is untouched. Hopefully nothing is broken.

Some constants might need a bit of tweaking down the line, but it should work most of the time, with two caveats:

  1. If you start the software while already in replay mode, it can't tell whether you are in the pre-race menu or a replay.
  2. It determines that you're exiting a replay by detecting a large delta in engine RPM or car speed, so it might prematurely determine that you've exited the replay if you skip or rewind the replay.

In both cases, just quit and restart the replay.

snipem commented 1 year ago

It seems like your changes interfere with some basic functionality. For example: Last Lap time, Max Speed, Min Body Height are not longer logged correctly. This is what I saw when I was racing with your branch yesterday.

snipem commented 1 year ago

I have added a manual recording switch for replays with #6

Nathaniel-Wu commented 1 year ago

It seems like your changes interfere with some basic functionality. For example: Last Lap time, Max Speed, Min Body Height are not longer logged correctly. This is what I saw when I was racing with your branch yesterday.

I'm not sure why it does that, I only added a recvtime field to GTData, and other parts of run() is stateless, all my changes do is determine whether the in_race field should actually be True when the raw value is False, it should not affect other parts of your program. The only possibility I can think of is that you used some fields of GTData not by field identifier but by bytes offsets or typecasted it to something else (I don't even know if you can do these things in python), and my added recvtime field interferes that.