YaLTeR / BunnymodXT

Speedrun and TAS tool for Half-Life & friends.
Other
200 stars 38 forks source link

BunnySplit integration breaks when closing "Edit Splits" window in LiveSplit resulting in eventual game crash #62

Open hobokenn opened 4 years ago

hobokenn commented 4 years ago

How to reproduce:

  1. Have the game running with BXT injected, have LiveSplit running.
  2. Click "Edit Splits".
  3. Close the window or press "Cancel".
  4. Start a run, your LiveSplit will be bugged, stuck at 0.
  5. Your game will crash after some time, shortly after making or loading a save or changing the level.

https://youtu.be/TUPdtrFp_tI - crash is at 13:27

hobokenn commented 4 years ago

Another related issue which is much more minor, but nonetheless slightly annoying if someone doesn't know how to deal with it, is livesplit refusing to close when the timer is not running. Looks like it's waiting for updates from bxt/bunnysplit, because it closes on any loading screen or ipc reset.

hobokenn commented 4 years ago

so i think i have a rough idea of what is happening here. if bunnysplit is connected to the pipe, every SetRun() call from here https://github.com/LiveSplit/LiveSplit/blob/d62bda70514b1563b6d26f2082ae8152e7583bd6/LiveSplit/LiveSplit.View/View/TimerForm.cs except SetRun(timerOnlyRun) will raise this exception:

System.IO.IOException
  HResult=0x80070079
  Message=The semaphore timeout period has expired.

  Source=System.Core
  StackTrace:
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.Pipes.NamedPipeClientStream.Connect(Int32 timeout)
   at LiveSplit.BunnySplit.Component.PipeThreadFunc() in C:\Users\nopen\source\LiveSplit\LiveSplit\Components\LiveSplit.BunnySplit\LiveSplit.BunnySplit\Component.cs:line 300

the reason is because SetRun calls functions to deactivate and activate an autosplitter, some of the examples of SetRun are: opening splits from a file/URL/srdc, closing splits and by extension exiting the program (because it needs to close the splits first i think), editing splits and cancelling >> SetRun gets called to restore previously saved copy of the run.

i've tried a few other autosplitters, for example, sourcesplit will reset the timer on cancelling splits editor, but will re-attach to the hl2 process and continue running the timer from 0. celeste autosplitter will stop the timer on cancelling the editor and won't auto-reset when starting a new run, if i reset manually it seems to work fine afterwards. mirror's edge autosplitter works fine, doesn't reset the timer on cancelling and i see debug messages like "dll injected" "pipe connected" every time i cancel.