Jump to content
Corsair Community

[WIP] GTA V dynamic lighting


Recommended Posts

Ever since i learned that GTAV has support for the Logitech gaming keyboards to provide dynamic lighting, i have been determined to bring the same functionality to my Corsair K70 RGB.

After some messing around (and a tiny bit of reverse engineering) i finally have a working prototype!

 

[ame=

]
[/ame]

 

How?

Rockstar was kind enough to build support for RGB keyboards directly into GTAV. Unfortunately the only keyboard they support is Logitech as they provide a nice API (hint hint corsair ;):)

 

This mod is a simple DLL which makes use of the built in functionality by processing the lighting calls and translating them to Corsair-friendly ones.

 

Is it online-safe?

Theoretically it should be safe to play online with due to how it works. If the anticheat measures work like every other AC then this won't get flagged as a cheat and therefor won't get you banned (i'm not responsible if this does however)

This DLL does not read or write any of the internal GTA memory and doesn't use commonly blacklisted API calls such as Read/WriteProcessMemory. It also doesn't inject itself in as GTA is friendly enough to ask to load the DLL rather than being told to :biggrin:

 

What keyboard does this work with?

Now that it uses the CUESDK, it should work with all devices

 

Where can i get this?

Check the attachments to this post :sunglasse

 

Where can i get the source code?

I have uploaded the source code to GitHub or you all to enjoy! https://github.com/VRocker/LogiLed2Corsair

 

Update: This now works with the M65 RGB mouse too! :o

Update 2: When modifying the registrypatch file, put double backslahes in the path. E.G. C:\\Games\\GTAV\\LogitechLED.dll else it won't work

Update 3: Seems Rockstar updated their Logitech SDK in the last patch which broke this DLL. I have adapted it to work with GTA but police lights don't seem to work anymore. I'm not sure if Rockstar removed them or they're calling some other function

Update 4: Updated the DLL to use the CUESDK. Also made it work for The Division Beta :o

LogiLed2Corsair.zip

Link to comment
Share on other sites

  • Replies 67
  • Created
  • Last Reply
Ever since i learned that GTAV has support for the Logitech gaming keyboards to provide dynamic lighting, i have been determined to bring the same functionality to my Corsair K70 RGB.

After some messing around (and a tiny bit of reverse engineering) i finally have a working prototype!

 

 

How?

Rockstar was kind enough to build support for RGB keyboards directly into GTAV. Unfortunately the only keyboard they support is Logitech as they provide a nice API (hint hint corsair ;):)

 

This mod is a simple DLL which makes use of the built in functionality by processing the lighting calls and translating them to Corsair-friendly ones.

This was possible thanks to LibCorsairRGB (although i did modify it to remove the libusb dependancy and use native Windows APIs)

 

Is it online-safe?

Theoretically it should be safe to play online with due to how it works. If the anticheat measures work like every other AC then this won't get flagged as a cheat and therefor won't get me banned.

This DLL does not read or write any of the internal GTA memory and doesn't use commonly blacklisted API calls such as Read/WriteProcessMemory. It also doesn't inject itself in as GTA is friendly enough to ask to load the DLL rather than being told to :biggrin:

 

Why are only the F keys lit?

I haven't had much time to dedicate to this project lately and only got it working 5 minutes before i was due to leave for work this morning so the F keys were the easiest to hook up. Once i've written the full keymap translator (to change from logitech to corsair) then all keys will be lit and reactive exactly how Rockstar intended it to be

 

Does CUE need to be closed?

Currently yes, i am investigating methods on how to make this work alongside CUE. All of the methods i can think of involve injecting into CUE and either nullifying the calls that send the data to the keyboard while GTA is running or using CUE to change the lighting. I'm not sure if this will upset the anticheat in GTA though so i'm hesitant to try...

 

What keyboard does this work with?

Currently I am testing this on my K70 RGB but it should also work with the K95 and possibly the K65. Only time will tell!

I am also looking into the possibility of hooking up mouse lighting as i have an M65 RGB which I really want flashing when the cops chase me :biggrin:

 

Where can i get this?

When i have the full keyboard lighting hooked up and i'm happy with the stability, i will be releasing this DLL for everybody to enjoy! So stay posted :cool:

 

Will this be open-sourced?

My plan is to eventually open-source this project so people can see how I got this working and hopefully port it to other games. Theoretically this DLL could work with other games that utilise the Logitech API (such as LoL) but I don't have these games to test with.

 

 

Good job, if I may ask how are you actually getting the data without using readprocessmemory, any chance you could release the source code :)?

Link to comment
Share on other sites

Good job, if I may ask how are you actually getting the data without using readprocessmemory, any chance you could release the source code :)?

 

"Will this be open-sourced?

My plan is to eventually open-source this project so people can see how I got this working and hopefully port it to other games. Theoretically this DLL could work with other games that utilise the Logitech API (such as LoL) but I don't have these games to test with."

Link to comment
Share on other sites

"Will this be open-sourced?

My plan is to eventually open-source this project so people can see how I got this working and hopefully port it to other games. Theoretically this DLL could work with other games that utilise the Logitech API (such as LoL) but I don't have these games to test with."

 

Sorry; I meant like tell me / post his source for the bit on his reading the game data part

Link to comment
Share on other sites

Sorry; I meant like tell me / post his source for the bit on his reading the game data part

 

I created a DLL which mimics the LogitechLED API and tell the game to load this rather than Logitechs. GTA then calls these functions and i translate to Corsair.

 

The source is now on GitHub if you want a mooch :)

Link to comment
Share on other sites

Strange, did you modify and run the RegistryPatch file? What is the path you added to it?

Yeah, I modified and ran the file. Path is D:\SteamLibrary\steamapps\common\Grand Theft Auto V\LogitechLED.dll

 

Not sure if this has any relevance, but my keyboard's connected via USB 2.0.

Link to comment
Share on other sites

Nope for me either. I just have the doubt of inserting path in the right way in the REG file.

Is this right?

 

Windows Registry Editor Version 5.00

 

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{a6519e67-7632-4375-afdf-caa889744403}\ServerBinary]

@="C:\Games\Grand Theft Auto V\LogitechLed.dll"

 

Thanks! Oh, I have the visual C++ installed...

EDIT: manually checking the registry doesn't show anything in that registry. Shouldn't be 2 different versions for 32 and 64 bits?

Link to comment
Share on other sites

The only thing i can think of with the registry key is try with double backslashes, so C:\Games\Grand Theft Auto V\LogitechLed.dll would become C:\\Games\\Grand Theft Auto V\\LogitechLed.dll

 

I'm stumped as to why this isn't working for others :/

Link to comment
Share on other sites

The only thing i can think of with the registry key is try with double backslashes, so C:\Games\Grand Theft Auto V\LogitechLed.dll would become C:\\Games\\Grand Theft Auto V\\LogitechLed.dll

 

I'm stumped as to why this isn't working for others :/

 

It was the registry patch. This should fix it for those with issues. Just fix your path. Tip - ctrl+shift & right click > select copy as path > paste correct path below > adding an extra \ for each directory change yielded the correct script. You can just dl the .reg below as a example OR just add the (\s) to your corrected directory just as direction stated in the first file.

 

https://www.dropbox.com/s/usnnk96sd10bdn9/RegistryPatchB5112015.reg?dl=0

 

Windows Registry Editor Version 5.00 -- ctrl+shift & right click > copy as path > paste correct path below adding an extra \ for each directory change.

 

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{a6519e67-7632-4375-afdf-caa889744403}\ServerBinary]

@="C:\\Program Files (x86)\\Steam\\steamapps\\common\\GTAV\\LogitechLED.dll"

 

the above works

 

Windows Registry Editor Version 5.00

 

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{a6519e67-7632-4375-afdf-caa889744403}\ServerBinary]

@="C:\Program Files (x86)\Steam\steamapps\common\GTAV\LogitechLED.dll"

 

did not work

 

hope this helps you guys

Link to comment
Share on other sites

Great to hear that it was the registry patch! I'll add a note to the original post so everybody else knows about it.

 

https://github.com/Archomeda/lightfx-extender we could also add this. It will further increase the amt of games to get effects from.

 

Aha! I was looking for this as i found it when i was researching the logitech API. I'll see about contributing towards that project this weekend when i have some spare time :)

Link to comment
Share on other sites

Awesome man!!!

 

I just tried in on my K95 and it is working without issues for me, CUE is on and auto-switching profiles is working as well.

 

If I understand it correctly, GTAV is controlling which buttons to interfere with on keyboard, and this cannot be changed anywhere, somehow?

I mean, I would like to customize e.g. how many buttons will flash upon obtaining stars.

 

Well, nice work anyway!

Link to comment
Share on other sites

Awesome man!!!

If I understand it correctly, GTAV is controlling which buttons to interfere with on keyboard, and this cannot be changed anywhere, somehow?

I mean, I would like to customize e.g. how many buttons will flash upon obtaining stars.

 

Good to hear that it's working on the K95! And you are correct, GTAV is deciding what buttons to light up but you could modify my source code to map different keys to different lights (if you're comfortable modifying C++ and have Visual Studio 2013 installed)

 

For example, if you want the number keys to flash when the cops come after you you can add another for loop in the LogiLedSetLightingFromBitmap function.

 

for (unsigned int i = 22; i < 32; ++i)
	CorsairRGB::Keyboard::SetKey(g_CorsairKeyFromLogi[i], bitmap[((i - 21) * LOGI_LED_BITMAP_BYTES_PER_KEY)], bitmap[((i - 21) * LOGI_LED_BITMAP_BYTES_PER_KEY) + 1], bitmap[((i - 21) * LOGI_LED_BITMAP_BYTES_PER_KEY) + 2]);

 

This code will go from Key ID 22 to Key 32 (1-0 number keys) and set their lighting state to the F1-F12 keys.

 

You can change the colour of any keys on the keyboard usiung a similar method to how i do the mouse lighting as that grabs colour info from Escape, F1 and F7 keys and maps them to the mouse lights. This can easily be done for other keys

 

CorsairRGB::Keyboard::SetKey(CorsairRGB::Keys::space, bitmap[(7 * LOGI_LED_BITMAP_BYTES_PER_KEY)], bitmap[(7 * LOGI_LED_BITMAP_BYTES_PER_KEY) + 1], bitmap[(7 * LOGI_LED_BITMAP_BYTES_PER_KEY) + 2]);

 

That line will maps the space bar to the colour of the F7 key. The 7 in bitmap[(7 refers to the logitech Key ID and you can see what key this usually refers to by reading the InitCorsairToLogiMap function.

Link to comment
Share on other sites

I'd like to use it but I'm afraid it will get me banned in GTA Online :(:

 

I've been playing online every night since i made this DLL. I haven't been banned.

It's extremely unlikely that rockstar would ban for this as it just emulates the standard LogitechLED.dll. GTAV doesn't verify this DLL in any way and as it doesn't touch the internal memory of the game, any anticheat implemented won't look at it.

It's basically the same as having an overlay dll injected in, such as mumble.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...