chihirobelmo / FalconBMS-Alternative-Launcher

Configure and save FalconBMS setup per Joysticks.
Other
131 stars 30 forks source link

First-run failure to write or load new pop file w/ BMS-Auto.key (race -condition?) #99

Closed arithex closed 1 year ago

arithex commented 1 year ago

First reported by Prime/AviationPlus https://www.youtube.com/watch?v=sB0DukjvIp0 but I think I remember this happening to me too when I first installed 4.37.

Repro:

  1. clean install
  2. during first run, prompts to change callsign (let's say, "Yankee") and pilot name ("Yankee Joe")
  3. launch BMS, go to Setting / Controllers screen

Observed:

Expected:

Further:

  1. close BMS
  2. restart the launcher, and launch BMS again
  3. now things appear ok -- callsign is "Yankee" and key file is "BMS - Auto.key"

Theory (I haven't fully debugged this, just repro'd it):

arithex commented 1 year ago

https://imgur.com/a/n299Tbq

arithex commented 1 year ago

Debugging this, I uncovered 1 potential race and 1 problem with the Callsign.pop file initial creation.

1- we launch 'bms-logcat.exe' and don't wait for it to complete.. that's an easy fix

2- the initial Callsign.pop file we emit, seems to be rejected by BMS and it emits its own fresh new Callsign.pop file, which points to BMS-Full.key

looking at a binary diff, what AL emits vs what BMS emits, there are quite a few bits different.. even the total size is grown by 4 bytes.

looks like we haven't refreshed that block of code since 4.35? (it's in OverrideSettingFor435.cs :)

I'll send you a PR.. you can decide what to do with it, of course. But if the pop file format has further evolved for 4.37 U3 or 4.38.. you'll have to take over.

ps I have newfound respect for the difficulty you faced building all this, without source access..