1. Post #1
    Audio Enthusiast
    Tezzanator92's Avatar
    June 2006
    2,778 Posts
    [release]
    Logitech g15 Garrysmod interface DLL

    Download:
    http://www.tezzanator.net/download/click.php?id=5 (839KB - Zip)
    (Includes the DLL, An extended DLL, BMP-to-Lua and source code and docs for everything!)
    Function Overview: http://tezzanator.net/downloads/Lua/docs/gm_g15/

    Just want to use your G15 without developing?
    Robert (Trebor on FP) is my partner on this project and has created a VERY awesome widget system for you to use!
    Thread: http://forums.facepunchstudios.com/s...d.php?t=422348
    [/release]
    [release]
    Requirments
    A Logitech G15
    Garrysmod
    A shred of intelligence
    Logitech LCD Manager:


    Screenshots:

    Pictures from lemming77:


    BMP-to-Lua:

    [/release]
    This DLL provides a Coder-friendly interface to the logitech g15 LCD, It also supports the software emulator provided by logitech to test scripts.

    Usage (There's samples in the zip, This is a basic text example):
    local client = LocalPlayer()
    
    require("g15")
    
    --bEmulator: False
    -- SET TO TRUE IF YOU ARE TESING ON AN EMULATOR
    g15.createLCD(false, "Gmod: Basic health sample")
    
    -- Health Text
    -- ID: 1
    -- Scrolling: False
    -- Size: 1 -> Small
    -- Alignment: 1 -> Left
    -- Width: 120 Pixels
    -- Lines: 1
    g15.addtext( 1, false, 1, 1, 120, 1 )
    
    -- ID: 1
    -- X: 0
    -- Y: 0
    g15.settextorigin( 1, 0, 0 )
    
    function onThink()
      if !client:Alive() then return end
      
      -- We are modifying the text we created at ID 1
      g15.settexttext( 1, "Health: " .. client:Health() .. "%" )
      
      
      -- Update the LCD to show the changes
      g15.updateLCD()
    end
    
    hook.Add( "Think", "updater", onThink ) 
    
    The buttons can also be polled!:
    local client = LocalPlayer()
    require("g15")
    
    g15.createLCD(false, "Gmod: Button input sample")
    
    function onThink()
      if !client:Alive() then return end
      
      if (g15.isbuttonpressed(0)) then
    	client:ConCommand("say I pressed button 1 on my g15!")  
      end
      
      -- Update the LCD
      g15.updateLCD()
    end
    hook.Add( "Think", "updater", onThink ) 
    

    Credits:
    Tezzanator92 - The script/coding
    Robert - Ideas, Lua help and various usefullness; And volunteering his g15 for testing! (I don't own one), And his great work on the widget manager.
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Useful Useful x 7Lua King Lua King x 5Friendly Friendly x 3Artistic Artistic x 1 (list)

  2. Post #2
    smoggy's Avatar
    September 2006
    20 Posts
    Lua King'ed. Gmod stats on my G15! :D

  3. Post #3
    Nukey McNuke's Avatar
    May 2007
    32 Posts
    Nice tezz!

    (too bad i don't have a G15... :argh:)

  4. Post #4
    UberMod
    UberMensch's Avatar
    May 2006
    1,597 Posts
    Is there a max amount of IDs you can have? I don't know how the G15 works, so is there a max amount of lines that can be displayed?

  5. Post #5
    Audio Enthusiast
    Tezzanator92's Avatar
    June 2006
    2,778 Posts
    UberMensch posted:
    Is there a max amount of IDs you can have? I don't know how the G15 works, so is there a max amount of lines that can be displayed?
    By default You can have:
    64 texts
    64 pbars
    128 boxs
    128 pxs

    (The Id system is part of my DLL)

    But you can recompile changing the size of the arrays for more (Though this may suck resources), I think these are decent values, 64 Pieces of text ;)
    The screen on the g15 is 160x43, So whatever you can fit on that (Also supports pages)

    The DLL also supports the Hardware buttons through lua (See samples)


    I Accidently uploaded my Debug DLL. So if it doesn't work; REDOWNLOAD. Sorry, My bad :D

  6. Post #6
    Gold Member
    edberg's Avatar
    June 2005
    2,464 Posts
    Just saying to hold on and take care of your G15's, they discontinued it and replaced it with this "new" G15 instead of calling it the G16 or something.

    I'm sure some people would like it, but I myself don't like the color orange or the lack of G keys, lets hope mines won't break.


    http://www.logitech.com/index.cfm/ke.../3498&cl=us,en

    Edit:

    And the new Windows Vista Winkey! And the lack of that switch that disables it! :argh:

    Edit:

    Oh god do you think it's possible to ever have a wiremod output that outputs to the G15 using this? It would be so awesome to have all my information such as airspeed, damage status, etc displayed on it.

  7. Post #7
    Audio Enthusiast
    Tezzanator92's Avatar
    June 2006
    2,778 Posts
    edberg posted:
    Oh god do you think it's possible to ever have a wiremod output that outputs to the G15 using this? It would be so awesome to have all my information such as airspeed, damage status, etc displayed on it.
    Entirly possible, Just use the DLL In an entity client side. It's up to developers to what they do, Practicly everything is possible! :)

    Infact i might code it, We will see!

  8. Post #8
    Gold Member
    lemming77's Avatar
    March 2005
    892 Posts
    That's very cool, but I'm left with one question that makes me feel stupid... How do you install it?

  9. Post #9
    Audio Enthusiast
    Tezzanator92's Avatar
    June 2006
    2,778 Posts
    lemming77 posted:
    That's very cool, but I'm left with one question that makes me feel stupid... How do you install it?
    This is for developers, But the DLL goes in the usual Lua/Includes/Modules folder.

    The samples can be put in Lua/Autorun/Client (Only put one sample in at a time, They are seperate scripts.

    Hope it helps ;)

  10. Post #10
    Gold Member
    lemming77's Avatar
    March 2005
    892 Posts
    Tezzanator92 posted:
    This is for developers, But the DLL goes in the usual Lua/Includes/Modules folder.

    The samples can be put in Lua/Autorun/Client (Only put one sample in at a time, They are seperate scripts.

    Hope it helps ;)
    Thanks. :)

    Edit:

    There seems to be a problem... I've tried a couple of your examples, and tried making my own script for it, but all of them crash the game with a "memory could not be read" error. Any idea what could be wrong?

  11. Post #11
    Audio Enthusiast
    Tezzanator92's Avatar
    June 2006
    2,778 Posts
    lemming77 posted:
    Thanks. :)

    Edit:

    There seems to be a problem... I've tried a couple of your examples, and tried making my own script for it, but all of them crash the game with a "memory could not be read" error. Any idea what could be wrong?

    They are working for me :S.

    Can you answer me these things so i can narrow it down? :) :
    Have you got the Logtech LCD manager software installed and running?


    Are you using a real or emulated G15?

    Did you get the version after I reuplaoded when I accidently uploaded my debug one (A few posts back)?

  12. Post #12
    Gold Member
    lemming77's Avatar
    March 2005
    892 Posts
    Tezzanator92 posted:
    They are working for me :S.

    Can you answer me these things so i can narrow it down? :) :
    Have you got the Logtech LCD manager software installed and running?


    Are you using a real or emulated G15?

    Did you get the version after I reuplaoded when I accidently uploaded my debug one (A few posts back)?
    No... I thought you meant that program on the disc that comes with the G15 that always runs in the background. Best give that a shot now. Yes, I have a real G15. Yes, I've got the non-debug version you uploaded.

    Edit:

    Works beautifully now, thanks. :)

  13. Post #13
    Audio Enthusiast
    Tezzanator92's Avatar
    June 2006
    2,778 Posts
    lemming77 posted:
    No... I thought you meant that program on the disc that comes with the G15 that always runs in the background. Best give that a shot now. Yes, I have a real G15. Yes, I've got the non-debug version you uploaded.

    Edit:

    Works beautifully now, thanks. :)
    Good, Had me scared there a sec; Thought i'd buggered it all up

  14. Post #14
    BloodShed's Avatar
    April 2005
    62 Posts
    edberg posted:
    Just saying to hold on and take care of your G15's, they discontinued it and replaced it with this "new" G15 instead of calling it the G16 or something.

    I'm sure some people would like it, but I myself don't like the color orange or the lack of G keys, lets hope mines won't break.


    http://www.logitech.com/index.cfm/ke.../3498&cl=us,en
    That is the G15 Keyboard, the one with the 18 G keys is the G15 Gaming keyboard.

  15. Post #15
    Gold Member
    lemming77's Avatar
    March 2005
    892 Posts

    Very nice work, I'm gonna have to play around with this more tomorrow. :D

    Edit:

    BloodShed posted:
    That is the G15 Keyboard, the one with the 18 G keys is the G15 Gaming keyboard.
    I don't see a G15 Gaming Keyboard...

  16. Post #16
    Audio Enthusiast
    Tezzanator92's Avatar
    June 2006
    2,778 Posts
    lemming77 posted:

    Very nice work, I'm gonna have to play around with this more tomorrow. :D

    Edit:


    I don't see a G15 Gaming Keyboard...
    Nice, Mind if i scale it down and put it on the OP?

  17. Post #17
    Ancient's Avatar
    December 2006
    63 Posts
    Oh, awesomeness.

    Gold star for you my friend, as regards from my G15!

  18. Post #18
    Gold Member
    lemming77's Avatar
    March 2005
    892 Posts
    Tezzanator92 posted:
    Nice, Mind if i scale it down and put it on the OP?
    That's fine by me. :)

    Should have something much better soon though... :D

  19. Post #19
    Ancient's Avatar
    December 2006
    63 Posts
    Well, now the DLL to interface the G15 with GMod is out, I'm sure that someone who's eager to release something will make an all-singing, all-dancing G15 Applet for Gmod. It'd be cool for Zombie Survival!

  20. Post #20
    Gold Member
    lemming77's Avatar
    March 2005
    892 Posts
    Damn you pixel limit. :(



    Well, I'm sure swapping some of the pixels in the G logo for squares will help. :)

  21. Post #21
    Audio Enthusiast
    Tezzanator92's Avatar
    June 2006
    2,778 Posts
    I am running some tests to see what null array elements do to memory, If it does nothing i'll make all the limits really high ;)

    Edit:
    Ok, well, A huge array of 4096 only used 4K of memory while null... Doesn't seem too bad?

    Because of this finding, Inside the zip there is another DLL with obscenely high limits (16384 of everything). It uses 65K More memory while null. Only use it if you need to as I don't know what other side effects it will have.

    Just redownload the zip to get it.


    A Little note: The pixels wern't really designed for extensive graphics, But it's a decent work around till I get BMP loading working. Probably never.

    Edit:

    Ok, Here's a small program for generating Lua code from bitmaps!
    http://www.tezzanator.net/download/click.php?id=7

    It's best you feed it black and white bitmaps ;)

    Source code is included


  22. Post #22
    Gold Member
    lemming77's Avatar
    March 2005
    892 Posts
    Tezzanator92 posted:
    I am running some tests to see what null array elements do to memory, If it does nothing i'll make all the limits really high ;)

    Edit:
    Ok, well, A huge array of 4096 only used 4K of memory while null... Doesn't seem too bad?

    Because of this finding, Inside the zip there is another DLL with obscenely high limits (16384 of everything). It uses 65K More memory while null. Only use it if you need to as I don't know what other side effects it will have.

    Just redownload the zip to get it.


    A Little note: The pixels wern't really designed for extensive graphics, But it's a decent work around till I get BMP loading working. Probably never.

    Edit:

    Ok, Here's a small program for generating Lua code from bitmaps!
    http://www.tezzanator.net/download/click.php?id=7

    It's best you feed it black and white bitmaps ;)

    Source code is included

    Sorta puts all the work I put into that logo to waste, I guess. Ah well, a tool I'm sure will be extremely useful. Thanks. Oh, and thanks for increasing the limits. :D

  23. Post #23
    Audio Enthusiast
    Tezzanator92's Avatar
    June 2006
    2,778 Posts
    I have no idea if that program works, But it looks like it would

    Not to mention, It'd be better optimized if you did it yourself (Using the filled boxes etc.)

    Edit:



    It worked :O

  24. Post #24
    Gold Member
    lemming77's Avatar
    March 2005
    892 Posts
    Strange, it didn't work for me... It just seemed to update the text box a billion times a second to show the same message every time, so I couldn't select and copy it fast enough.

    Edit:

    Most of the logo was missing when I used squares for it, so I went back to using individual pixels, and I'm still being held back by that limit. Even with the alternative dll. :(

  25. Post #25
    Audio Enthusiast
    Tezzanator92's Avatar
    June 2006
    2,778 Posts
    lemming77 posted:
    1) Strange, it didn't work for me... It just seemed to update the text box a billion times a second to show the same message every time, so I couldn't select and copy it fast enough.

    Edit:

    2) Most of the logo was missing when I used squares for it, so I went back to using individual pixels, and I'm still being held back by that limit. Even with the alternative dll. :(
    1) Wait till it finishes ;)

    2) Strange... I'll check, one sec...

    Ok, Try this DLL: http://www.tezzanator.net/gm_g15.dll

  26. Post #26
    Gold Member
    lemming77's Avatar
    March 2005
    892 Posts
    Same problem... Could just be that the old code is still in memory on my computer, so I'll try again after a restart. Though that won't be for a while to come.

  27. Post #27
    Audio Enthusiast
    Tezzanator92's Avatar
    June 2006
    2,778 Posts
    That's weird :S

    Code:
    HANDLE texts[16384];
    HANDLE bars[16384];
    HANDLE boxs[16384];
    HANDLE pixels[16384];

  28. Post #28
    trebor's Avatar
    July 2005
    29 Posts
    The widget manager is pretty much finished now. I'm working at a way to manage multiple pages so you can still make complete widgets.
    I'll be away the next 6 days so don't expect a release before saturday. I'd give it to tazz if he was online but he isn't so you have to wait.

  29. Post #29
    Gold Member
    Blynx6's Avatar
    August 2006
    714 Posts
    How do I install this...I've got a g15 gaming keyboard, but i've never installed any DLLs.

  30. Post #30
    Audio Enthusiast
    Tezzanator92's Avatar
    June 2006
    2,778 Posts
    Blynx6 posted:
    How do I install this...I've got a g15 gaming keyboard, but i've never installed any DLLs.

    Put the DLL into Lua/includes/modules in your garrysmod folder (This is off memory, May be slightly different)

    Then put a sample script into lua/autorun/client.

    Then tweak it to your liking.

  31. Post #31
    Gold Member
    Fr0z3n F14m3's Avatar
    January 2005
    195 Posts
    lemming77 posted:
    lawl image
    Very nice work, I'm gonna have to play around with this more tomorrow. :D

    Edit:


    I don't see a G15 Gaming Keyboard...
    I do see a http://www.amazon.com/Logitech-96759.../dp/B000AY0HTU

  32. Post #32
    Audio Enthusiast
    Tezzanator92's Avatar
    June 2006
    2,778 Posts
    This will also work with the z10 Speakers and any other logitech LCD device with some code edits :)

  33. Post #33
    Sora-Chan's Avatar
    March 2006
    7 Posts
    You know what might be a cool addition to this? Though it will go past the LCD portion of the g15. Make it so that you can bind commands to the G keys.

    I've seen some people do this kind of thing for other games. What they did was had a config file where there would be something like

    bind m*g@

    where m* would be the macro set (going from m1 to m3), and g@ would be the g button (going from g1 to g18).

    The user would probably have to set it up so that the profiler will automatically switch over to a blank profile (as in a profile that has no binds setup) when the source engine is running (the hl2.exe process that is), to keep it from trying to do both profile bound keys and GMod bound keys.


    Oh and nice creation Tezzanator.

  34. Post #34
    child porn prodigy
    venom's Avatar
    April 2005
    15,115 Posts
    Looks real good. I'd try it, but I don't have this Gaming Keyboard.

    LUA King'd.

  35. Post #35
    Sora-Chan's Avatar
    March 2006
    7 Posts
    Well today I had a interesting idea to do to get the desired effect in binding keys for GMod....

    Did you know that while you have Function keys on your keyboard.. as in the F1-F12 keys... that computers can recognize up to F64? (Or so I'm told)

    What I'm doing is manually creating a profile (through notepad) to have these keys bound. IF this works, as in the computer can see them.. AND I can bind them within GMod... I will be a very happy girl.

    Oh and I'll post the code for it if it works.

    EDIT: Sorry guys, but the idea failed... Apparently the source engine doesn't see any F key above F12...

  36. Post #36
    Audio Enthusiast
    Tezzanator92's Avatar
    June 2006
    2,778 Posts
    Couldn't you use keys like JHGTYUIOPLMNBV Etc. (The ones far away from wasd) ?

  37. Post #37
    Sora-Chan's Avatar
    March 2006
    7 Posts
    Unfortunately... those keys are already bound... if I remember the only keys I don't have bound are . F7 F8 F10 F11 N Home and End... and it gets hard to remember which key does what some times. Besides, if we could get the G keys be able to be bound it would allow 54 keys to be used.

    Oh and I looked into how the one group that made it so that you could bind the G keys in a game, I found out that they had created a DLL file that automatically, as they put it, aliased the keys to M*G* where M* was the set number and G* was the g key.

    So I figured.. if someone could figure out how to bind the keys to a similar scheme, we could use the alias command to have the keys bound, or maybe just be able to make it so that the keys are recognized by GMod by that kind of setup, it could make things easier when it comes to running scripts, commands, ect.

  38. Post #38
    bive's Avatar
    October 2007
    1 Posts
    Hmm i love this a lot but i can't script or code to save my life, so I am going to make a request:D

    just a few more options in the widget screen so i get more then my ping,hp,and fps on my G15 as that's all i really get. Also so it shows up in the Q menu under settings so i don't have to rip in to console also so i can make changes on the fly :)

    Apart from that this is damn awesome i have a few of your script must say I am a subscriber.

  39. Post #39
    hairycherrys's Avatar
    February 2007
    28 Posts
    how i install?

  40. Post #40

    December 2007
    6 Posts
    make a console thing so you press a button and the g15 is the console so nothing pops up and you type and press enter.