[REL] Headlight controls

Discussion in 'Other' started by Seven Smiles, Aug 20, 2019.

  1. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    rF2headlights-1.8.71.jpg For more detail go to the wiki
    ______________________________________________________________________________________________

    Prompted by https://forum.studio-397.com/index.php?threads/flashing-lights.63774/ here is a program that adds various controls of the headlights.
    • Flashing to warn a slower car
    • Flashing in the pits
    • Turning on the headlights automatically
    To get it go to the Releases page, click on Assets for the latest version, download the the .exe file and save it wherever you want.

    May 2020: Virus check https://www.virustotal.com/gui/url/...0450b30ebab099c4a6839accf26563992c5/detection
    V1.8.71 Virus check https://www.virustotal.com/gui/url/120a6b937a68bedf9dbec08b966f7467421ce63b7bb5aa8c79b5be28e260fbfb/detection
    V1.9.75 Virus check
    https://www.virustotal.com/gui/url/c13d32ffe8b25e9e5e8d27edbd92609f566a707b014b96cc48840c2027533a3f/detection

    V1.9.79 Virus check
    https://www.virustotal.com/gui/url/...567215a14e4258d6db312820ab93f7e44d7/detection

    Run rF2headlights.exe and set it up the way you want

    On the left are the buttons or keys that you use
    • You don't have to use all of the controls
    • Toggle headlights is the same as the present control
    • Flash headlights will flash them a number of times
    • Headlights on and off switch the headlights no matter whether they are on or off (like the switch in a real car)
    Below that is the key that is sent to rFactor to control the headlights, the Left Ctrl key in this case.

    In the middle are the Headlight Options
    • Flash when pit limiter on will flash them when the pit limiter is on (wherever you are)
    • Flash when in pit lane will flash them automatically when you enter the pit lane and stop them when you leave
    • Headlights on at start will turn the headlights on when you get in the car, you can turn them off if you want
    • You can set the durations (in milliseconds) of the flashes
    • Automatic headlights will turn the headlights on for you when other drivers do. The slider selects when they turn on:
      • Driver turns them on (i.e. not automatic)
      • At least one other driver has them on
      • More than one other driver has them on
      • At least half of the other drivers have them on
      • All the other drivers have them on
    On the right is a Status window which shows what rFactor is up to.

    When you change something and press Save configuration you have to close the program down and restart it before the changes will take effect.

    Based on the work of @The Iron Wolf https://forum.studio-397.com/index.php?threads/rf2-shared-memory-tools-for-developers.54282/

    ______________________________________________________________________________________________

    If you have trouble
    rf2headlightsDEBUG.exe is the same program but with installer debug turned on. Open up a command window and run it like this
    Code:
    rf2headlightsDEBUG.exe >rpt.txt 2>&1
    
    If rf2headlights doesn't run then post the file rpt.txt here.
     
    Last edited: Jun 5, 2021
    DA, NathanW, atomed and 28 others like this.
  2. Vance Le Garde

    Vance Le Garde Registered

    Joined:
    Oct 5, 2010
    Messages:
    223
    Likes Received:
    31
    Great job, this will help stop people getting DQ'd because the track makers can't think to not have forced headlights in the GDB when they create tracks :( and some one doesn't have their headlights on when exiting the pits like in the new Le Mans track ;) .
     
    Seven Smiles likes this.
  3. Paulus_NL

    Paulus_NL Registered

    Joined:
    Jul 28, 2019
    Messages:
    73
    Likes Received:
    37
    will try this tonight :D
     
    Seven Smiles likes this.
  4. pedro ramada

    pedro ramada Registered

    Joined:
    Jan 4, 2014
    Messages:
    65
    Likes Received:
    52
    Great idea and implementation!! Thanks a lot for this work man!! ;)
     
    Seven Smiles likes this.
  5. Bruce0440

    Bruce0440 Registered

    Joined:
    Apr 26, 2017
    Messages:
    77
    Likes Received:
    19
    WUAUUU!!! Thanks.
     
    Seven Smiles likes this.
  6. Paulus_NL

    Paulus_NL Registered

    Joined:
    Jul 28, 2019
    Messages:
    73
    Likes Received:
    37
    i mapped the buttons. but no flashing in the game.
    The output is checked when the track is loaded, on track etc. Also when i press the flash button it says "overtake flash" etc. But in the game i don't see the light flashing (oreca 07).
     
    Last edited: Aug 21, 2019
  7. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    Do you have the headlight mapped in the game to the same key as this program? By default it's the H key (DIK_H).
    Capture.JPG
     
  8. Paulfield

    Paulfield Registered

    Joined:
    Feb 18, 2012
    Messages:
    235
    Likes Received:
    242
    Start rfactor first see how you go.
     
  9. Rui Santos

    Rui Santos Registered

    Joined:
    Jan 8, 2012
    Messages:
    1,081
    Likes Received:
    1,206
    I want to map a button on button box for "lights" and on the wheel to "flash", is this possible?
     
  10. Paulfield

    Paulfield Registered

    Joined:
    Feb 18, 2012
    Messages:
    235
    Likes Received:
    242
    YES I am using my wheel button no problem, just make sure the default H button on keyboard is set as per Steven pic above. You can map any button on your device to then turn lights on or off.
     
    Rui Santos and Seven Smiles like this.
  11. Chris Lesperance

    Chris Lesperance Registered

    Joined:
    Nov 29, 2012
    Messages:
    1,294
    Likes Received:
    2,061
    It took a little while for me to figure out how to map the buttons. Just clicking and then hitting the button wasn't working initially. Had to hit the button i wanted a few times. But once I got that set, it works great!

    For the duration time, is that milliseconds?
     
  12. Vanisch

    Vanisch Registered

    Joined:
    Oct 21, 2018
    Messages:
    130
    Likes Received:
    80
    [​IMG] So I do not understand that. With me that's just not great. synonymous with me nothing flashes the headlights. The console says, rf2 is running, but I can push what I want, it does not matter.
    The exe file and the ini file are in the BIN64 directory of rf2.
    The buttons for flashing are occupied, but nothing is happening.

    [​IMG]

    [​IMG]
    [​IMG]
     
    Last edited: Aug 22, 2019
  13. Paulfield

    Paulfield Registered

    Joined:
    Feb 18, 2012
    Messages:
    235
    Likes Received:
    242
    Just asking do you have the shared memory file in your plugins 64 folder. shared memory.JPG flasher after start rf2.JPG
     
    Vanisch likes this.
  14. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    Yes:
     
  15. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    @Vanisch Paulfield is right, it seems you have an old version of rFactor2SharedMemoryMapPlugin64.dll. I'll change the code that checks it to make it more obvious.
     
    Vanisch likes this.
  16. Paulus_NL

    Paulus_NL Registered

    Joined:
    Jul 28, 2019
    Messages:
    73
    Likes Received:
    37
    Will try it again this evening. :)
     
  17. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    Updated the first post with a new version. Main visible change is more infomation about rFactor2SharedMemoryMapPlugin but I also found why configuring the controls was a bit hit and miss so it is more responsive now.

    I also spent an hour trying to track down a really weird bug that appeared from nowhere - I eventually spotted that I had two copies of the program running and they were both sending H to rFactor :mad:
     
    Last edited: Aug 22, 2019
    davehenrie, Corti and Paulus_NL like this.
  18. Vanisch

    Vanisch Registered

    Joined:
    Oct 21, 2018
    Messages:
    130
    Likes Received:
    80
    @Seven Smiles , @Paulfield
    Thank you both very much for your help and effort. Now it works fine. It was really the outdated dll file. The console works and the light flashes, and responds to all buttons.

    Many thanks. The tool is really an enrichment

    [​IMG]
     
    Last edited: Aug 22, 2019
    Corti and Seven Smiles like this.
  19. Vanisch

    Vanisch Registered

    Joined:
    Oct 21, 2018
    Messages:
    130
    Likes Received:
    80
    addendum:
    If you are using an older version of SimHub then you must know that when using rf2, simHub overwrites the new rFactor2SharedMemoryMapPlugin64.dll and headlight controls stop working.

    SimHub needs to be updated or manually referenced to the new .dll.
     
    Seven Smiles likes this.
  20. DaVeX

    DaVeX Registered

    Joined:
    Feb 7, 2015
    Messages:
    637
    Likes Received:
    701
    Thanks for it, +1000 to immersion :cool:
     
    davehenrie likes this.

Share This Page