F2 Example Plugin: CheckHWControl omissions

Discussion in 'Technical & Support' started by Seven Smiles, Jun 17, 2020.

  1. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    I'm trying to use this for a couple of add-on programs but although my version of the plugin is working there are two issues:
    1. The "PitDisplay" control (matching "Control - Pit Display" in Controller.JSON) is not in the list, there is only "DisplayMode" ( "Control - Display Mode") which cycles through the LCD modes. I can work around that by operating "DisplayMode" until the pit display is showing but it's messy and I'm guessing this is easy to fix.
    2. The "Headlights" control doesn't operate the headlights, I presume because it's considered an "actual vehicle input"?
      Code:
      // ** Sorry, no control allowed over actual vehicle inputs ... would be too easy to cheat! **
      I have worked around this with my Headlights program but it would be nice to do it "properly" and this is not a true "vehicle input" and certainly doesn't allow cheating.
     
    Corti likes this.
  2. Lazza

    Lazza Registered

    Joined:
    Oct 5, 2010
    Messages:
    12,382
    Likes Received:
    6,600
    And that's why you have a Headlights program, and I have a half written headlight flashing plugin I abandoned when I found the control couldn't be used from a plugin :D :rolleyes:
     
    Corti and Seven Smiles like this.
  3. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    Supplementary question: given the comment
    Code:
      // Note: since the game calls this function every frame for every available control, you might consider
      // doing a binary search if you are checking more than 7 or 8 strings, just to keep the speed up.
    why is CheckHWcontrol called with strings that are never going to be acted upon if they do match, a complete waste of processor time? o_O
     
  4. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    Answering my own question 1, ToggleMFDB does "Control - Pit Display" In addition, the menu items can be operated whether it's toggled on or off and the changes show up in AccessPitMenu()

    Next: why is CheckHWcontrol called with these strings especially!
    'MusicPause'
    'MusicPlay'
    'MusicPlayNext'
    'MusicPlayPrevious'
    'MusicVolumeDown'
    'MusicVolumeUp'
     
    Last edited: Jun 22, 2020

Share This Page