Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;BitByteBit
- ;AlienFX UDF.
- ;AutoIt ;]
- Global $hLightFX = @ScriptDir & '\LightFX 64x.dll', $aDefcon, $LFX_GRILL = BitAND(0x001C0E07, 0x000001FF), $aOrig[5]
- $SYSTEM_POWER_STATUS = DllStructCreate("byte;byte;byte;byte;int;int")
- $PTR = DllStructGetPtr($SYSTEM_POWER_STATUS)
- OnAutoItExitRegister('_AlienClose')
- _AlienStart()
- Func _AlienClose()
- DllCall($hLightFX, 'uint', 'LFX_Reset')
- DllCall($hLightFX, 'uint', 'LFX_Release')
- DllClose($hLightFX)
- EndFunc ;==>_AlienClose
- Func _AlienDisco($T = 10)
- Global $Dance = 1
- While $Dance
- $Random = StringReplace(Hex(String(Random(0, 255, 1) & Random(0, 255, 1) & Random(0, 255, 1))), '00', '0xFF')
- _AlienSetColour($Random)
- Sleep(1000)
- WEnd
- EndFunc ;==>_AlienDisco
- Func _AlienGetAll()
- For $i = 0 To 3
- $aOrig[$i] = _AlienGetLightColour($i)
- ConsoleWrite($aOrig[$i] & @CRLF)
- Next
- EndFunc ;==>_AlienGetAll
- Func _AlienGetLightColour($iLight)
- ;~ LFX_GetLightColor(const unsigned int devIndex,const unsigned int lightIndex,PLFX_COLOR const lightCol);
- $Strut = DllStructCreate('UINT')
- DllCall($hLightFX, 'uint', 'LFX_GetLightColor', 'uint', 0, 'uint', $iLight, 'ptr', DllStructGetPtr($Strut))
- DllStructGetData($Strut, 1)
- $iColour = Hex(DllStructGetData($Strut, 1), 8)
- $iColour = '0x' & StringMid($iColour, 1, 2) & StringMid($iColour, 7, 2) & StringMid($iColour, 5, 2) & StringMid($iColour, 3, 2)
- Return $iColour
- EndFunc ;==>_AlienGetLightColour
- Func _AlienGetNumLights()
- ;~ LFX_GetNumLights(const unsigned int devIndex,unsigned int* const numLights);
- $Strut = DllStructCreate('UINT')
- DllCall($hLightFX, 'uint', 'LFX_GetNumLights', 'uint', 0, 'ptr', DllStructGetPtr($Strut))
- $iNum = DllStructGetData($Strut, 1)
- ConsoleWrite($iNum & @CRLF)
- Return $iNum
- EndFunc ;==>_AlienGetNumLights
- Func _AlienSetColour($iColour, $iLocation = 0x07FFFFFF)
- ;~ LFX_Light(const unsigned int locationMask, const unsigned int colorVal);
- DllCall($hLightFX, 'uint', 'LFX_Light', 'uint', $iLocation, 'uint', $iColour)
- DllCall($hLightFX, 'uint', 'LFX_Update')
- EndFunc ;==>_AlienSetColour
- Func _AlienSetLightColour($iColour = 0xFF0000FF, $iLight = 0, $iLocation = 0)
- ;0 - Keyboard.
- ;1 - Left Grill.
- ;2 - Right Grill.
- ;3 - Logo.
- ;4 - Status.
- ;LFX_SetLightColor(const unsigned int devIndex, const unsigned int lightIndex, const PLFX_COLOR lightCol);
- $Strut = DllStructCreate('char red;char green;char blue;char brightness')
- Local $PTR1 = DllStructGetPtr($Strut)
- DllStructSetData($Strut, 1, Number('0x' & StringMid($iColour, 5, 2)))
- DllStructSetData($Strut, 2, Number('0x' & StringMid($iColour, 7, 2)))
- DllStructSetData($Strut, 3, Number('0x' & StringMid($iColour, 9, 2)))
- DllStructSetData($Strut, 4, Number('0x' & StringMid($iColour, 3, 2)))
- $A = DllCall($hLightFX, 'uint', 'LFX_SetLightColor', 'uint', $iLocation, 'uint', $iLight, 'ptr', $PTR1)
- EndFunc ;==>_AlienSetLightColour
- Func _AlienUpdate()
- DllCall($hLightFX, 'uint', 'LFX_Update')
- EndFunc
- Func _AlienStart()
- $hLightFX = DllOpen($hLightFX)
- If $hLightFX = -1 Then Exit MsgBox(48,'FATALITY!', 'Failed to find: "LightFX 64x.dll".')
- DllCall($hLightFX, 'uint', 'LFX_Initialize')
- DllCall($hLightFX, 'uint', 'LFX_Reset')
- EndFunc ;==>_AlienStart
- Func _AlienCenter($iDefcon, $iDevice)
- ;0 - Keyboard.
- ;1 - Grills
- ;2 - Logo.
- ;3 - Status.
- ;4 - All.
- Opt('GuiOnEventMode', 0)
- ;~ DllCall($hLightFX, 'uint', 'LFX_Reset')
- ConsoleWrite('Defcon - ' & $iDefcon & @CRLF)
- ConsoleWrite('Device - ' & $iDevice & @CRLF)
- ConsoleWrite('Colour - ' & $aDefcon[$iDefcon][1] & @CRLF)
- Switch $iDevice
- Case 0
- _AlienSetLightColour($aDefcon[$iDefcon][1], 0)
- Case 1
- _AlienSetLightColour($aDefcon[$iDefcon][1], 1)
- _AlienSetLightColour($aDefcon[$iDefcon][1], 2)
- Case 2
- _AlienSetLightColour($aDefcon[$iDefcon][1], 3)
- Case 3
- _AlienSetLightColour($aDefcon[$iDefcon][1], 4)
- Case 4
- _AlienSetColour($aDefcon[$iDefcon][1])
- EndSwitch
- Opt('GuiOnEventMode', 1)
- EndFunc ;==>_AlienCenter
- Func _GetBattery()
- DllCall("kernel32.dll", "int", "GetSystemPowerStatus", "ptr", $PTR)
- Return DllStructGetData($SYSTEM_POWER_STATUS, 3)
- EndFunc ;==>_GetBattery
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement