Finding out DLLCalls + parameters for LED?

Discuss other useful utilities, general computing tips & tricks, Internet resources, etc.
User avatar
Scr1pter
Posts: 1272
Joined: 06 Aug 2017, 08:21
Location: Germany

Finding out DLLCalls + parameters for LED?

13 Mar 2024, 12:49

Hey all,

I use an AHK script to set the lighting for my Logitech G PRO TKL keyboard.

Code: Select all

F1::
LGS_Set_Color(100, 0, 0) ; red
return

F2::
LGS_Set_Color(0, 0, 100) ; blue
return

F3::
LGS_Set_Color(0, 100, 0) ; green
return

F4::
LGS_Set_Color(100, 100, 100) ; white
return

LGS_Init_Color()
{
  hModule := DllCall("LoadLibrary", "Str", "C:\Users\User\Documents\Logitech Gaming Software\AutoHotKey-Scripts\LogitechLedEnginesWrapper.dll", "Ptr")
  if hModule = 0
  {
    MsgBox, LogitechLedEnginesWrapper.dll could not be found!
  }
  DllCall("LogitechLedEnginesWrapper\LogiLedInit")  
}
LGS_Set_Color(red, green, blue)
{
  DllCall("LogitechLedEnginesWrapper\LogiLedSetLighting", "Int", red, "Int", green, "Int", blue)
}
Now I wonder if it would also be possible to activate the RGB effects which are inside of the Logitech Gaming Software:
In English it would something like this (including parameters):
1. Fixed color - Color
2. Breath effect - Color - Speed
3. Star effect - Stars - Amount - Sky - Speed
4. Color cycle - Speed
5. Color wave - Direction - Speed
6. Keypress - Color - Backgroundcolor - Speed

My idea was to open the LogitechLedEnginesWrapper with a DLL viewer, and inside of it there are these functions:
LogiLedStopEffectsOnKey 0x0000000180001780 0x00001780 31 (0x1f)
LogiLedStopEffects 0x0000000180001770 0x00001770 30 (0x1e)
LogiLedShutdown 0x0000000180001760 0x00001760 29 (0x1d)
LogiLedSetTargetDevice 0x0000000180001750 0x00001750 28 (0x1c)
LogiLedSetLightingFromBitmap 0x0000000180001740 0x00001740 27 (0x1b)
LogiLedSetLightingForTargetZone 0x0000000180001720 0x00001720 26 (0x1a)
LogiLedSetLightingForKeyWithScanCode 0x0000000180001710 0x00001710 25 (0x19)
LogiLedSetLightingForKeyWithQuartzCode 0x0000000180001700 0x00001700 24 (0x18)
LogiLedSetLightingForKeyWithKeyName 0x00000001800016f0 0x000016f0 23 (0x17)
LogiLedSetLightingForKeyWithHidCode 0x00000001800016e0 0x000016e0 22 (0x16)
LogiLedSetLighting 0x00000001800016d0 0x000016d0 21 (0x15)
LogiLedSetConfigOptionLabel 0x00000001800016b0 0x000016b0 20 (0x14)
LogiLedSaveLightingForKey 0x00000001800016a0 0x000016a0 19 (0x13)
LogiLedSaveCurrentLighting 0x0000000180001690 0x00001690 18 (0x12)
LogiLedRestoreLightingForKey 0x0000000180001680 0x00001680 17 (0x11)
LogiLedRestoreLighting 0x0000000180001670 0x00001670 16 (0x10)
LogiLedPulseSingleKey 0x0000000180001650 0x00001650 15 (0xf)
LogiLedPulseLighting 0x0000000180001630 0x00001630 14 (0xe)
LogiLedInitWithName 0x0000000180001600 0x00001600 13 (0xd)
LogiLedInit 0x00000001800015d0 0x000015d0 12 (0xc)
LogiLedGetSdkVersion 0x0000000180001500 0x00001500 11 (0xb)
LogiLedGetConfigOptionSelect 0x00000001800014d0 0x000014d0 10 (0xa)
LogiLedGetConfigOptionRect 0x0000000180001490 0x00001490 9 (0x9)
LogiLedGetConfigOptionRange 0x0000000180001460 0x00001460 8 (0x8)
LogiLedGetConfigOptionNumber 0x0000000180001440 0x00001440 7 (0x7)
LogiLedGetConfigOptionKeyInput 0x0000000180001420 0x00001420 6 (0x6)
LogiLedGetConfigOptionColor 0x00000001800013f0 0x000013f0 5 (0x5)
LogiLedGetConfigOptionBool 0x00000001800013d0 0x000013d0 4 (0x4)
LogiLedFlashSingleKey 0x00000001800013b0 0x000013b0 3 (0x3)
LogiLedFlashLighting 0x0000000180001390 0x00001390 2 (0x2)
LogiLedExcludeKeysFromBitmap 0x0000000180001380 0x00001380 1 (0x1)


So I tried something like this:

Code: Select all

F12::
DllCall("LogitechLedEnginesWrapper\LogiLedPulseLighting", "Int", 1, "Int", 1, "Int", 1) ; 1 = Color wave, 1 = horizontal, 1 = Slowest speed - just a guess
return
It did not work (would have been too good), so my main question:
When choosing the effect directly inside of the Logitech Gaming Software, is there some tool (e.g. process explorer) where I could actually see
- what DLL file
- which function
- what arguments
it uses?

Otherwise I would try and guess till forever...

Then I searched and downloaded this PDF:
LogitechGamingLEDSDK.pdf
And there I found more information and could fix the code from above:

Code: Select all

F12::
DllCall("LogitechLedEnginesWrapper\LogiLedPulseLighting", "Int", 80, "Int", 30, "Int", 80, "Int", 5000, "Int", 5)
return
But as the name says it is only about Pulsing, no color wave effect.
In this PDF I could not find anything wave related either.

Any ideas?

Thanks for any help and best regards!
LGS_Color_Effects.png
LGS_Color_Effects.png (848.95 KiB) Viewed 199 times
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
mcl
Posts: 357
Joined: 04 May 2018, 16:35

Re: Finding out DLLCalls + parameters for LED?

15 Mar 2024, 18:13

Scr1pter wrote:
13 Mar 2024, 12:49
Then I searched and downloaded this PDF:
LogitechGamingLEDSDK.pdf

Any ideas?
As PDF name suggests, there must be SDK, with blackjack and code samples. And there is: https://www.logitechg.com/en-us/innovation/developer-lab.html
As for various effects, I suppose, you need to write an algorithm to light up and fade down certain keys in certain order to achieve desired effects all by yourself – quick looking into code made me doubt there are any LogiLedDoCoolStuff functions.
github://oGDIp - GDI+ wrapper for AHK v1.1

Return to “Other Utilities & Resources”

Who is online

Users browsing this forum: No registered users and 52 guests