Bind AlienFX to UE4 c++ ?

Hi there !

I was wondering if there were a way to gather info from Google Code Archive - Long-term storage for Google Code Project Hosting. to bind alienware lights in ue4 code … :wink:
I’m far from being able to do that myself but do you think it’d be possible ?

It’d absolutely be possible, but the difficulty will be dependent on the implementation of the linked software itself :slight_smile:

oO you mean the whole software ? I was more modest :wink: thinking about setting a simple variable to acces memory
Edit: I found the SDK, it will probably be better as I just want to have basic acces to lights
I’ll give it a try x)

SDK implementation is pretty straightforward, I was able to crash my lights after a few hours :smiley:

it just needs some fine tuning I guess, let’s try to get something from this new toy !

little update

everyhting works great, but game process freeze while lights are modified
the dll is loaded on the fly with
HINSTANCE hLibrary = LoadLibrary(_T(LFX_DLL_NAME));
The main init function takes a few seconds to be ready, I’m unsure about where to call it from, maybe the HUD, or somewhere in a begin play?. Same for the dll, I don’t understand the way to load it the correct way, I’m sure this is a 2 step process but I don’t get it.

any ideas ?

I thought a little step-throught may be usefull for some

_get the SDK in the command center directory (C:\Program Files\Alienware\Command Center\AlienFX SDK\Unmanaged\includes)
_create 2 new headers and copy paste the code in it
_copy the dll from C:\Program Files\Alienware\Command Center\AlienFX SDK\Unmanaged\dll\x64 to your project’s binaries directory
_open on of the .cpp examples and get your way through it :wink:

Mine looks like this

void APickupAmmo::Alien(/** int argc, _TCHAR* argv] */)
{
// Things
LFX2INITIALIZE InitFunction;
LFX2RELEASE ReleaseFunction;
LFX2RESET ResetFunction;
LFX2UPDATE UpdateFunction;
LFX2UPDATEDEFAULT UpdatedefaultFunction;
// Devices
LFX2GETNUMDEVICES GetNumDevicesFunction;
LFX2GETDEVDESC GetDeviceDescriptionFunction;
// Lights
LFX2GETNUMLIGHTS GetNumLightsFunction;
LFX2GETLIGHTDESC GetLightDescriptionFunction;
LFX2GETLIGHTLOC GetLightLocationFunction;
LFX2GETLIGHTCOL GetLightColorFunction;
LFX2SETLIGHTCOL SetLightColorFunction;
LFX2LIGHT LightFunction;
// Light again
LFX2SETLIGHTACTIONCOLOR SetLightActionColor;
LFX2SETLIGHTACTIONCOLOREX SetLightActionColorEx;
// More lights
LFX2ACTIONCOLOR LightActionColorFunction;
LFX2ACTIONCOLOREX LightActionColorExFunction;
LFX2SETTIMING SetTiming;

HINSTANCE hLibrary = LoadLibrary(_T(LFX_DLL_NAME));
if (hLibrary)
{
	//Things
	InitFunction =				(LFX2INITIALIZE)	GetProcAddress(hLibrary, LFX_DLL_INITIALIZE);
	ReleaseFunction =			(LFX2RELEASE)		GetProcAddress(hLibrary, LFX_DLL_RELEASE);
	ResetFunction =				(LFX2RESET)			GetProcAddress(hLibrary, LFX_DLL_RESET);
	UpdateFunction =			(LFX2UPDATE)		GetProcAddress(hLibrary, LFX_DLL_UPDATE);
	UpdatedefaultFunction =		(LFX2UPDATEDEFAULT)	GetProcAddress(hLibrary, LFX_DLL_UPDATEDEFAULT);
	//	Devices
	GetNumDevicesFunction =		(LFX2GETNUMDEVICES)	GetProcAddress(hLibrary, LFX_DLL_GETNUMDEVICES);
	GetDeviceDescriptionFunction =  (LFX2GETDEVDESC)	GetProcAddress(hLibrary, LFX_DLL_GETDEVDESC);

	//	Lights
	GetNumLightsFunction =		(LFX2GETNUMLIGHTS)	GetProcAddress(hLibrary, LFX_DLL_GETNUMLIGHTS);
	GetLightDescriptionFunction =	(LFX2GETLIGHTDESC)	GetProcAddress(hLibrary, LFX_DLL_GETLIGHTDESC);
	GetLightLocationFunction =		(LFX2GETLIGHTLOC)	GetProcAddress(hLibrary, LFX_DLL_GETLIGHTLOC);
	//	Get & Set
	GetLightColorFunction =		(LFX2SETLIGHTCOL)	GetProcAddress(hLibrary, LFX_DLL_SETLIGHTCOL);
	GetLightColorFunction =		(LFX2GETLIGHTCOL)	GetProcAddress(hLibrary, LFX_DLL_GETLIGHTCOL);
	//	Light again
	LightFunction =				(LFX2LIGHT)			GetProcAddress(hLibrary, LFX_DLL_LIGHT);
	SetLightActionColor =			(LFX2SETLIGHTACTIONCOLOR)GetProcAddress(hLibrary, LFX_DLL_SETLIGHTACTIONCOLOR);
	SetLightActionColorEx =		(LFX2SETLIGHTACTIONCOLOREX) GetProcAddress(hLibrary, LFX_DLL_SETLIGHTACTIONCOLOREX);
	//	More lights
	LightActionColorFunction =		(LFX2ACTIONCOLOR)	GetProcAddress(hLibrary, LFX_DLL_ACTIONCOLOR);
	LightActionColorExFunction =	(LFX2ACTIONCOLOREX)	GetProcAddress(hLibrary, LFX_DLL_ACTIONCOLOREX);
	SetTiming =				(LFX2SETTIMING)		GetProcAddress(hLibrary, LFX_DLL_SETTIMING);


	LFX_RESULT result = InitFunction();
	if (result == LFX_SUCCESS)
	{ 
		result = SetTiming(100);
		//Set all blue
		result = ResetFunction();
		result = LightFunction(LFX_ALL, LFX_BLUE | LFX_FULL_BRIGHTNESS);
		result = UpdateFunction();
		Sleep(5000);
		//set blinking red
		result = ResetFunction();
		result = LightActionColorFunction(LFX_ALL, LFX_ACTION_PULSE, LFX_RED | LFX_FULL_BRIGHTNESS);
		result = UpdateFunction();
		Sleep(5000);
		//go from red to blue
		result = ResetFunction();
		result = LightActionColorExFunction(LFX_ALL, LFX_ACTION_MORPH, LFX_RED | LFX_FULL_BRIGHTNESS, LFX_BLUE | LFX_FULL_BRIGHTNESS);
		result = UpdateFunction();

		result = ReleaseFunction();
	}
}

functions are fully documented

BE CAREFULL: you are messing with a physical chip, anticipate about initialisation and correct memory cleaning, eventuals loops and stuff like that. I don’t really know if you can brick it this way, but I was due for at least one power drain to restore it