LiveSplit / asr

Helper crate to write auto splitters for LiveSplit One's auto splitting runtime.
https://livesplit.org/asr/asr
Apache License 2.0
10 stars 10 forks source link

Add Process Listing and Attach by PID #52

Closed PARTYMANX closed 1 year ago

PARTYMANX commented 1 year ago

Adds two functions:

Process::attach_pid attaches to a process by referencing its PID. Process::list lists all PIDs associated with processes with the name passed in.

Together, these allow an autosplitter to define its own logic for discovering and attaching to processes.

Sometimes start time or largest PID don't quite get the right process. For example, Tony Hawk's Pro Skater 1+2 has a bootstrap and game process, both with the same name. They start in the same second, so the regular Process::attach logic often selects the incorrect process. This pull request allows an author to check each process closer to determine which one is desired. (rather messy) example of usage here: https://github.com/PARTYMANX/thps-autosplitter/blob/thps12-disambiguate/src/lib.rs#L19

Companion pull request to https://github.com/LiveSplit/livesplit-core/pull/721. Solves #50.