diff --git a/README.md b/README.md index a6545e5..ef7c7c8 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ randomly and silently crashing on me, defeating its purpose. * runs in the background and watches for the configured application * starts tools you need with the application when it’s up * (optional) kills the tools again when it’s down -* when it’s up, watches configured devices for inputs and focuses the - application if you move the X/Y axis or hit a button +* when it’s up, watches configured devices for input and focuses the application + if you move the X/Y axis or hit a button ## Requirements @@ -26,42 +26,91 @@ source. Obviously needs AutoHotKey installed. ### Using the Executable ## If you don’t want to install AutoHotKey and/or want something that “just works”, -there is [a compiled .exe on the releases page](/releases). +there is [a compiled .exe on the releases +page](https://github.com/alterNERDtive/ahk-joystick-focus/releases/latest). ## Settings ## -FIXXME +Before running the script for the first time, you need to create a `focus.ini` +file or rename the included `focus.example.ini` to that. It contains my personal +settings if you want to go off those as a base. Which is exactly what I’ll be +doing here to explain things. +### Target Application ### + +``` [target] -; target program to set focus to name="EliteDangerous64.exe" +``` +The name of the executable the script should be monitoring for. In case of +Elite: Dangerous, that is `EliteDangerous64.exe`. + +### Polling Rates ### + +``` [polling] -; (in ms) -; the lower you set this, the more CPU it will use and the faster/snappier it will react to joystick input pollingrate=100 -; how often to check for target program running -; this is way less time-critical since it will take a while to load anyway targetcheckrate=5000 +``` +`pollingrate` (in ms) here is the interval at which to check for input on the +configured devices. `targetcheckrate` (also in ms) is the rate at which the +script will check if the target application is running. This is less +time-critical as it will probably take a couple seconds to fully start anyway. + +The lower you set the polling rates, the more CPU it will cost to keep the +script running in the background but also the snappier it will react to inputs. +If you feel like 100 ms are too slow, set a delay that’s smaller. + +### Device Settings ### + +``` [devices] -; intensity of axis movement required to pop focus to the target (5 = 10% movement from center) -threshold=5 -; set these to the correct devices for your sticks/HOTAS -; MIGHT change on reboot, but has been consistent for me so far name1="2Joy" name2="4Joy" -; if you have different curves on the sticks, adjust effective sensitivity here -; (same order as devices) sensitivity1=10 sensitivity2=1 +threshold=5 +``` +In this section of the config file you are defining the devices the script +should be monitoring. + +`name1` through `nameX` are the names in AHK terms, with `Joy` or `1Joy` being +the first in the list. You’ll probably have to go through them in sequence to +find out which physical device is which number. The ordering MIGHT change after +you reboot the system but has been consistent for me so far. It should +definitely change if you reboot with one of the devices unplugged. + +`sensitivity1` through `sensitivityX` is a multiplier used for the axis inputs +of the device with the same number as above. If you do not have set any curves +for your device(s), you should probably leave this at `1` for all of them. +Personally I have a very non-aggressive curve on my right stick, so that ones +multiplier is cranked all the way up to `10`. + +Last but not least, `threshold` will be the intensity of input needed on an axis +to trigger the script to focus your application. `5` means a 10% movement up or +down an axis since the entire range of movement is `0` to `100`, with `50` being +resting position. If your device is “wobbly” and needs a huge dead zone in order +not to produce ghost inputs, you might have to increase this. + +### Tools Settings ### + +``` [tools] -; tools to run path1="C:\Program Files (x86)\EDMarketConnector\EDMarketConnector.exe" path2="D:\Tools\SSChanger\SSChanger.exe" -; whether to kill them when target program shuts down kill=True +``` + +Here you can set tools the script should run alongside your application. + +`path1` to `pathX` has to be set to the full paths of the tools. + +`kill` is a boolean (`True`/`False`) to tell the script whether to kill the +tools again after your target application has shut down. If you want them to +stay open, just set this to `False`. ## Need Help / Want to Contribute? ## diff --git a/focus.example.ini b/focus.example.ini index 448f71f..6019a3e 100755 --- a/focus.example.ini +++ b/focus.example.ini @@ -6,11 +6,11 @@ pollingrate=100 targetcheckrate=5000 [devices] -threshold=5 name1="2Joy" name2="4Joy" sensitivity1=10 sensitivity2=1 +threshold=5 [tools] path1="C:\Program Files (x86)\EDMarketConnector\EDMarketConnector.exe"