1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  3. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  4. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

program for gauges, Servos.

Discussion in 'Miscellaneous' started by sankaman77, Dec 14, 2008.

  1. sankaman77

    sankaman77 New Member

    Joined:
    Nov 11, 2007
    Messages:
    16
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Hi all, i am french and i dont speak german and my english is bad.

    Je me fait un simulateur genre FREX et je voudrais créer un compteur avec : vitesse, RPM, T° Huile, Pression Turbo, Essence.

    J'ai 6 servos et une carte USB
    http://www.opencockpits.com/catalog/tarjeta-servo-p-42.html?cPath=21_32

    Mais je ne sais pas ou trouver les informations dans le jeu.
    Avez vous un plugin, ou un code source d'un plugin existant svp ?

    merci / thanks
  2. egoexpress

    egoexpress Active Member

    Joined:
    Dec 13, 2006
    Messages:
    3,839
    Location:
    Germany - Frankfurt/M
    Balance:
    421Coins
    Ratings:
    +7 / 1 / -0
    Il n'ya support par la carte de open cockpits jusqu'ici. Mais si tu prêtes la carte pour quelques jours a Sirnoname, il peut fair la carte marcher avec X-Sim. Surement il te la envoye en retour quand il a terminé l'implémentation.

    Mais tu pouvais controller les servos aussi avec autres cartes qui sont supporté dans X-Sim dèja.
    Pour example:
    - http://www.pololu.com/catalog/product/207/pictures (8 servos)
    - ou avec un gameport carte vieille rc-servo-with-soundcard-t1006.html (8 servos)

    Salut
    Christian
  3. sankaman77

    sankaman77 New Member

    Joined:
    Nov 11, 2007
    Messages:
    16
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    salut et merci pour les liens, je les avais deja lue.
    je veux passer par l'USB.

    Pour la programmation, ca va je sais le faire.

    c'est pour récupérer les informations du jeu ou je n'y arrive pas.

    il faudrait que je connaisse le fichier ou je pourrais trouver ses informations.

    Merci encore.
    A+
  4. sankaman77

    sankaman77 New Member

    Joined:
    Nov 11, 2007
    Messages:
    16
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
  5. egoexpress

    egoexpress Active Member

    Joined:
    Dec 13, 2006
    Messages:
    3,839
    Location:
    Germany - Frankfurt/M
    Balance:
    421Coins
    Ratings:
    +7 / 1 / -0
    The plugin sourcecode is an example of an software interface between an external I/O-card and X-Sim software.
    You will get game via the X-Sim software into your I/O card.

    Lend Sirnoname your OpenCockpit interface for a few days, and he will most likely be able to write a plugin for it.

    regards
  6. sankaman77

    sankaman77 New Member

    Joined:
    Nov 11, 2007
    Messages:
    16
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    thanks thanks thanks you very much. :clap:

    The tutorial is very good. :clap:

    thanks again :yes:
  7. sankaman77

    sankaman77 New Member

    Joined:
    Nov 11, 2007
    Messages:
    16
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    hi,
    i dont understand how i can find the adress memory.

    i got $gtr2$ and 180 byte = 22,5 octet

    but after, i dont know how to use it.

    i use the program windev and i try to use the fonction ReadProcessMemory but i don't know parameters.

    if i have the source code of mmfvisualizer, i could read how you read in memory.
    for exemple, in mmfvisualizer, we put $gtr2$ and 180,
    the button open MMF, what does he do ? with $gtr2$ and 180 ?

    I am sorry for my english and my questions, it's not very clear

    thanks.
  8. sankaman77

    sankaman77 New Member

    Joined:
    Nov 11, 2007
    Messages:
    16
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Hi and Thanks.

    So, i have to use the CreateFileMappingA fonction instead of ReadProcessMemory ?

    if i find CreateFileMappingA parameters, will i find what i need ? RPM, speed.... ?
  9. sankaman77

    sankaman77 New Member

    Joined:
    Nov 11, 2007
    Messages:
    16
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    ok so for me :

    my code :

    AppelDLL32(kernel32, CreateFileMappingA ,hFile,lpAttributes,flProtect,dwMaximumSizeHigh,dwMaximumSizeLow,lpName)

    i use parameters et the result will be what i need.

    that's it ?
  10. sankaman77

    sankaman77 New Member

    Joined:
    Nov 11, 2007
    Messages:
    16
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Hello.
    Thank you for the code but I do not understand.
    I try, I try, but I do not.

    I succeed to retrieve a value from a memory address but I can not find the address memory of GTR2 values.

    the code that I do not understand :
  11. sankaman77

    sankaman77 New Member

    Joined:
    Nov 11, 2007
    Messages:
    16
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    I got a bug : The fonction OpenFileMapping not found in the Kernel32 DLL

    i think it's because of FILE_MAP_READ when i use OpenFileMappingA
    i got an other message : The passage of the parameter 1 has caused an error.

    good night and thanks again for your help.
  12. sankaman77

    sankaman77 New Member

    Joined:
    Nov 11, 2007
    Messages:
    16
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    :hi:

    program language is WINDEV. http://www.windev.com/

    its a very easy program. you can test the version 10 free.
    its here : http://www.windev.com/windev/WD-Express.htm

    Th program fonctions are for me in french with easy fonctions. for exemple :
    info(Je m'appel Sanka)

    in the help pf program, a search fonctions :
    transferts()
    extraitChaine()
    AppelDll32()
    API()


    all fonctions, program and help are in english too.
    I learned with this software has my job, I did not learn C.
    Bye
  13. egoexpress

    egoexpress Active Member

    Joined:
    Dec 13, 2006
    Messages:
    3,839
    Location:
    Germany - Frankfurt/M
    Balance:
    421Coins
    Ratings:
    +7 / 1 / -0
    @sankaman77

    Why dont you simply try to make your interface compatible to X-Sim? If you get it to accept X-Sim data, then it will work with every game that X-Sim supports.

    regards
  14. sankaman77

    sankaman77 New Member

    Joined:
    Nov 11, 2007
    Messages:
    16
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    hi all.
    Code:
    AppelDLL32(kernel32, CreateFileMappingA , hFile, &lpFileMappigAttributes, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow, &lpName)
    for me with parameters =
    Code:
    nAdresseBloc est un entier = AppelDLL32(kernel32, CreateFileMappingA ,0xFFFFFFFF, Null, 4, 0, 180, $gtr2$)
    nAdresseBloc = 368, i dont understand


    how does it work?
  15. egoexpress

    egoexpress Active Member

    Joined:
    Dec 13, 2006
    Messages:
    3,839
    Location:
    Germany - Frankfurt/M
    Balance:
    421Coins
    Ratings:
    +7 / 1 / -0
    Sirnoname posted a plugin example some posts before:

    download/file.php?id=1549

    Open the file to see the sourcecode, and modify it to your needs (to make it compatible with your interface).

    If you are not able to read C++ programming language, it may be not possible for you to work that out.

    regards
  16. sankaman77

    sankaman77 New Member

    Joined:
    Nov 11, 2007
    Messages:
    16
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    :hi: Hi

    OK so my code begins by :

    mmfhandle est un entier = AppelDLL32(Kernel32, OpenFileMappingA,0xF001F,True,$gtr2$)
    nTest est un entier = AppelDLL32(kernel32, MapViewOfFile , mmfhandle,FILE_MAP_WRITE,0,0,0)
    mmfhandle = 328 if Gtr2 runnig and 0 if is not (It's Ok :D :happy: :yes: )
    nTest = 24510464 it's the memory address ??? if yes, .... :yippiee:

    ok but, adress memory of what ?
    how I find the values of gtr2 with nTest ?
    i use the fonction ChaineRécupère and she give me (nothing)

    And : if I understand, I never use the function CreateFileMapping ????

    Bye
  17. sankaman77

    sankaman77 New Member

    Joined:
    Nov 11, 2007
    Messages:
    16
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    :hi: Hi

    :yippiee: :yippiee: :yippiee: i succeeded !!!!!!

    my code :
    Code:
    mmfhandle = AppelDLL32(Kernel32, OpenFileMappingA,0xF001F,True,$gtr2$)
    AdresseMémoireDépart = AppelDLL32(kernel32, MapViewOfFile , mmfhandle,FILE_MAP_WRITE,0,0,0)
    
    ChaîneDest est une chaîne fixe de 180
    LongueurTransfert est un entier = 180
    Transfert(&ChaîneDest, AdresseMémoireDépart, LongueurTransfert)
    Libellé1  = RPM =  + Asc(ChaîneDest[[24 A 27]])
    Libellé2  = Carburnant =  +Asc(ChaîneDest[[36 A 39]])
    Libellé3  = T° Eau =  +Asc(ChaîneDest[[44 A 47]])
    Libellé4  = T° Huile =  +Asc(ChaîneDest[[48 A 51]])
    Libellé5  = Vitesse =  +Asc(ChaîneDest[[56A 59]])
    Libellé6  = Nbr Tour =  +Val(Asc(ChaîneDest[[64 A 67]])+1)
    Libellé7  = Meilleur Tour =  +Asc(ChaîneDest[[68 A 71]])
    Libellé8  = Dernier Tour =  +Asc(ChaîneDest[[72 A 75]])
    Libellé9  = Temps =  +Asc(ChaîneDest[[76 A 79]])
    Libellé10 = Rapport =  +Asc(ChaîneDest[[89 A 91]])
    but, but i got problem, again,
    1 - sometimes, AdresseMémoireDépart = 0 and i got a big error. and sometime, it works.
    2 - only gear work in continue, not other, i dont understand, it's the same code.
    3 - how free memory atthe end of sequence, because after 2 minutes, my program use 300Mo of RAM.
    4 - How convert int to float ?

    I'm so happy. thanks :clap:
  18. sankaman77

    sankaman77 New Member

    Joined:
    Nov 11, 2007
    Messages:
    16
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Hi
    1 - sometimes, AdresseMémoireDépart = 0 and i got a big error. and sometime, it works.
    I found, its Kernel32 and not kernel32

    2 - only gear work in continue, not other, i dont understand, it's the same code.
    ?????? I dont understand :no:

    3 - how free memory at the end of sequence, because after 2 minutes, my program use 300Mo of RAM.
    For that, i am looking for

    4 - How convert int to float ?
    I have wrong ? that is what i understood with mmfReader.exe

    UnmapViewOfFile(inputmmf);
    Yes, I use it. :yes:
  19. sankaman77

    sankaman77 New Member

    Joined:
    Nov 11, 2007
    Messages:
    16
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    Hi, it's my last problem.

    mmfhandle = AppelDLL32(Kernel32, OpenFileMappingA,0xF001F,True,$gtr2$)
    AdresseMémoireDépart = AppelDLL32(Kernel32, MapViewOfFile , mmfhandle,FILE_MAP_WRITE,0,0,0)
    AdresseMémoireDépart = AdresseMémoireDépart+1
    LIB_Connect = AdresseMémoireDépart
    LIB_Connect1= mmfhandle
    ChaîneDest est une chaîne fixe de 180
    LongueurTransfert est un entier = 180
    Transfert(&ChaîneDest, AdresseMémoireDépart, LongueurTransfert)
    Libellé1 = Asc(ChaîneDest[[24]]) // = 59 or C
    Libellé2 = Asc(ChaîneDest[[25]]) // = 63 or ?
    Libellé3 = Asc(ChaîneDest[[26]]) // = 20 or Cube
    Libellé4 = Asc(ChaîneDest[[27]]) // = 68 or D
    AppelDLL32(Kernel32, UnmapViewOfFile,mmfhandle)

    And I want 592.99 (Calculated Float values, 4 byte)
    I dont understand how to do.
    Can you help me again ???
  20. sankaman77

    sankaman77 New Member

    Joined:
    Nov 11, 2007
    Messages:
    16
    Balance:
    0Coins
    Ratings:
    +0 / 0 / -0
    ok thanks.

    it's time to say a thing. :thbup:
    a big, big, big thanks for the help you gave me. It has me helped enormously. :yes: :thbup:
    you have taken time for me and I thank you very much.
    if one day, you will come to Paris, send me a mail and i offer you a drink at home. :cheers:

    Bye bye and thanks again :highfive: :hi: