Jump to content

Warp speed in Space


trancexx
 Share

Recommended Posts

wow, that is really cool how you got alot of the hard work to use asm...very cool, it just shows how powerful autoit can become when paired with the right person :)

sadly, i dont know assembly so i cant use this newfound knowledge...kinda makes you wonder just how advanced opengl in autoit can become...

P.S nice unicode butterfly ;)

Random pet peeve of the day: people who say "AutoIT"

Link to comment
Share on other sites

Well, you are using assembly to do the job, so AutoIt isn't guiding you or doing anything.

What about e.g. WinAPI, OpenGL or GDI+ stuff? These are also not AutoIt codes! You just calling and using them like trancexx did it with his magic machine code!

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • 6 years later...

Here a very helpful tool for the SSE stuff written by Eukalyptus:

#AutoIt3Wrapper_Icon=Icon.ico

#AutoIt3Wrapper_UseX64=n
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <ButtonConstants.au3>
#include <GuiEdit.au3>


Global $tSSE = _Check_SSE()

Global $_hMSVCRT = DllOpen('msvcrt.dll')
Global Const $cPI = ATan(1) * 4
Global Const $cPI2 = ATan(1) * 2
Global Const $cRad2Deg = 180 / $cPI

Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
Opt("GUIEventOptions", 1)

Global $tXMM0 = DllStructCreate("byte[16];")
DllStructSetData($tXMM0, 1, "0x00112233445566778899AABBCCDDEEFF")
Global $tXMM1 = DllStructCreate("byte[16];")
DllStructSetData($tXMM1, 1, "0x000102030405060708090A0B0C0D0E0F")
Global $tXMM2 = DllStructCreate("byte[16];")


Global $aXMM[9]
$aXMM[0] = DllStructGetPtr($tXMM0)
$aXMM[1] = DllStructGetPtr($tXMM1)
$aXMM[2] = DllStructGetPtr($tXMM2)

$aXMM[6] = 2 ;Type xmm0
$aXMM[7] = 2 ;Type xmm1
$aXMM[8] = 2 ;Type xmm2
$aXMM[3] = 2 ;Signed xmm0
$aXMM[4] = 2 ;Signed xmm1
$aXMM[5] = 2 ;Signed xmm2


Global $iVal_Shift = 2
Global $iVal_Shuffle = 0x4B
Global $iShuffle_Mode = 2


Global $aShuf[30][20] = [[10, 0, 0, 0, 0, 0], ["movdqa", "SSE2"], ["movss", "SSE"], ["movsd", "SSE2"], ["movq", "SSE2"], ["movddup", "SSE3"], ["movlhps", "SSE"], ["movhlps", "SSE"], ["movsldup", "SSE3"], ["movshdup", "SSE3"], _
        ["pshufd", "SSE2"], ["pshuflw", "SSE2"], ["pshufhw", "SSE2"], ["pshufb", "SSSE3"], ["shufps", "SSE"], _
        ["pslldq", "SSE2"], ["psrldq", "SSE2"], ["palignr", "SSSE3"], _
        ["packssdw", "SSE2"], ["packsswb", "SSE2"], ["packuswb", "SSE2"], _
        ["punpcklbw", "SSE2"], ["punpckhbw", "SSE2"], ["punpcklwd", "SSE2"], ["punpckhwd", "SSE2"], ["punpckldq", "SSE2"], ["punpckhdq", "SSE2"]]

Global $aColor[17] = [0, 0xFFFF0000, 0xFF0000FF, 0xFF00FF00, 0xFFFFFF00, 0xFFFF00FF, 0xFF00FFFF, 0xFF0088FF, 0xFFFF8800, 0xFF660000, 0xFF000066, 0xFF006600, 0xFF666600, 0xFF660066, 0xFF006666, 0xFF003366, 0xFF663300]


Global Const $cBTN_W = 146 ;104
Global Const $cBTN_H = 80 ;44


Global $aMSrc[16][4], $aMDst[16][4]


Global $iWidth = 1530 ;1110
Global $iHeight = 800 ;580

_GDIPlus_Startup()
Global $hGui = GUICreate("SSE_Shuffle Explorer V2", $iWidth, $iHeight)
GUISetBkColor(0x445566)
GUISetFont(10, 800, 0, "Arial")
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
Global $hBmp_Buffer = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)
Global $hGfx_Buffer = _GDIPlus_ImageGetGraphicsContext($hBmp_Buffer)
_GDIPlus_GraphicsSetSmoothingMode($hGfx_Buffer, 2)
_GDIPlus_GraphicsClear($hGfx_Buffer, 0xFF445566)
Global $hBmp_BufferM = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)
Global $hGfx_BufferM = _GDIPlus_ImageGetGraphicsContext($hBmp_BufferM)
_GDIPlus_GraphicsSetSmoothingMode($hGfx_BufferM, 2)



Global $hRegion = _GDIPlus_RegionCreate()

Global $aBTN_Shuf[27]
For $i = 1 To 9
    $aBTN_Shuf[$i] = _Button_Create(10 + ($cBTN_W + 5) * ($i - 1), 10, $cBTN_W, $cBTN_H, $i)
    GUICtrlSetOnEvent(-1, "_Select_Shuffle")
Next
For $i = 10 To 14
    $aBTN_Shuf[$i] = _Button_Create(10 + ($cBTN_W + 5) * ($i - 10), 15 + $cBTN_H, $cBTN_W, $cBTN_H, $i)
    GUICtrlSetOnEvent(-1, "_Select_Shuffle")
Next
For $i = 15 To 17
    $aBTN_Shuf[$i] = _Button_Create(10 + ($cBTN_W + 5) * ($i - 9), 15 + $cBTN_H, $cBTN_W, $cBTN_H, $i)
    GUICtrlSetOnEvent(-1, "_Select_Shuffle")
Next
For $i = 18 To 20
    $aBTN_Shuf[$i] = _Button_Create(10 + ($cBTN_W + 5) * ($i - 18), 20 + $cBTN_H * 2, $cBTN_W, $cBTN_H, $i)
    GUICtrlSetOnEvent(-1, "_Select_Shuffle")
Next
For $i = 21 To 26
    $aBTN_Shuf[$i] = _Button_Create(10 + ($cBTN_W + 5) * ($i - 17), 20 + $cBTN_H * 2, $cBTN_W, $cBTN_H, $i)
    GUICtrlSetOnEvent(-1, "_Select_Shuffle")
Next


_Draw_XMMGroup($hGfx_Buffer, "XMM1 Source", 7, 35 + $cBTN_H * 3, $iWidth - 15, 38)
_Draw_XMMGroup($hGfx_Buffer, "XMM0 Destination", 7, 90 + $cBTN_H * 3, $iWidth - 15, 38)
_Draw_XMMGroup($hGfx_Buffer, "XMM0 Result", 7, 145 + $cBTN_H * 3, $iWidth - 15, 38)
_Draw_XMMGroup($hGfx_Buffer, "Shift", 7, 200 + $cBTN_H * 3, 150, 38)
_Draw_XMMGroup($hGfx_Buffer, "Shuffle", 167, 200 + $cBTN_H * 3, 450, 38)
_Draw_XMMGroup($hGfx_Buffer, "ASM", 627, 200 + $cBTN_H * 3, $iWidth - 635 - 160, 38)
_Draw_XMMGroup($hGfx_Buffer, "SSE", $iWidth - 158, 200 + $cBTN_H * 3, 150, 38)
Global $aBTN_XMM[32]
GUIStartGroup()
For $i = 6 To 1 Step -1
    $aBTN_XMM[$i] = _Button_Create($iWidth - 30 - 28 * ($i + 4), 42 + $cBTN_H * 3, 28, 25, $i + 26)
    GUICtrlSetOnEvent(-1, "_Select_View")
Next
GUIStartGroup()
For $i = 9 To 7 Step -1
    $aBTN_XMM[$i] = _Button_Create($iWidth - 25 - 28 * ($i - 5), 42 + $cBTN_H * 3, 28, 25, $i + 26)
    GUICtrlSetOnEvent(-1, "_Select_View")
Next
GUIStartGroup()
$aBTN_XMM[10] = _Button_Create($iWidth - 20 - 28, 42 + $cBTN_H * 3, 28, 25, 10 + 26)
GUICtrlSetOnEvent(-1, "_Select_View")
GUIStartGroup()
For $i = 16 To 11 Step -1
    $aBTN_XMM[$i] = _Button_Create($iWidth - 30 - 28 * ($i - 6), 97 + $cBTN_H * 3, 28, 25, $i + 16)
    GUICtrlSetOnEvent(-1, "_Select_View")
Next
GUIStartGroup()
For $i = 19 To 17 Step -1
    $aBTN_XMM[$i] = _Button_Create($iWidth - 25 - 28 * ($i - 15), 97 + $cBTN_H * 3, 28, 25, $i + 16)
    GUICtrlSetOnEvent(-1, "_Select_View")
Next
GUIStartGroup()
$aBTN_XMM[20] = _Button_Create($iWidth - 20 - 28, 97 + $cBTN_H * 3, 28, 25, 20 + 16)
GUICtrlSetOnEvent(-1, "_Select_View")
GUIStartGroup()
For $i = 26 To 21 Step -1
    $aBTN_XMM[$i] = _Button_Create($iWidth - 30 - 28 * ($i - 16), 152 + $cBTN_H * 3, 28, 25, $i + 6)
    GUICtrlSetOnEvent(-1, "_Select_View")
Next
GUIStartGroup()
For $i = 29 To 27 Step -1
    $aBTN_XMM[$i] = _Button_Create($iWidth - 25 - 28 * ($i - 25), 152 + $cBTN_H * 3, 28, 25, $i + 6)
    GUICtrlSetOnEvent(-1, "_Select_View")
Next
GUICtrlSetState($aBTN_XMM[4], $GUI_CHECKED)
GUICtrlSetState($aBTN_XMM[14], $GUI_CHECKED)
GUICtrlSetState($aBTN_XMM[24], $GUI_CHECKED)
GUICtrlSetState($aBTN_XMM[7], $GUI_CHECKED)
GUICtrlSetState($aBTN_XMM[17], $GUI_CHECKED)
GUICtrlSetState($aBTN_XMM[27], $GUI_CHECKED)

Global $aIP_XMM[4][16]
For $j = 0 To 2
    For $i = 15 To 0 Step -1
        $aIP_XMM[$j][$i] = GUICtrlCreateEdit("", 0, 0, 10, 22, 1, 0)
        GUICtrlSetFont(-1, 12, 500, 0, "Trebuchet MS")
        If $j = 2 Then
            GUICtrlSetStyle(-1, 0x0801) ;ReadOnly
            GUICtrlSetColor(-1, 0x00FF55)
            GUICtrlSetBkColor(-1, 0x000D00)
        Else
            GUICtrlSetColor(-1, 0x0088FF)
            GUICtrlSetBkColor(-1, 0x000014)
        EndIf
    Next
Next

Global $aIP_Val[10]
Global $aBTN_Val[20]
$aIP_Val[1] = _Input_Create(20, 209 + $cBTN_H * 3, 60, 22, 0xFFBB00, 0x141000)
GUICtrlSetData(-1, $iVal_Shift)
GUICtrlSetStyle(-1, 0x0801)
$aBTN_Val[1] = _Button_Create(90, 209 + $cBTN_H * 3, 26, 22, 100)
GUICtrlSetOnEvent(-1, "_Set_Shift")
$aBTN_Val[2] = _Button_Create(115, 209 + $cBTN_H * 3, 26, 22, 101)
GUICtrlSetOnEvent(-1, "_Set_Shift")

$aIP_Val[2] = _Input_Create(180, 209 + $cBTN_H * 3, 60, 22, 0xFFBB00, 0x141000)
For $i = 0 To 3
    $aIP_Val[3 + $i] = _Input_Create(260 + 90 * $i, 209 + $cBTN_H * 3, 20, 22, 0xFFBB00, 0x141000)
    GUICtrlSetStyle(-1, 0x0801)
    $aBTN_Val[3 + $i * 2] = _Button_Create(260 + 90 * $i + 25, 209 + $cBTN_H * 3, 26, 22, 100)
    GUICtrlSetOnEvent(-1, "_Set_Shuffle")
    $aBTN_Val[4 + $i * 2] = _Button_Create(260 + 90 * $i + 50, 209 + $cBTN_H * 3, 26, 22, 101)
    GUICtrlSetOnEvent(-1, "_Set_Shuffle")
Next

$aIP_Val[7] = _Input_Create(640, 209 + $cBTN_H * 3, $iWidth - 660 - 160, 22, 0xFFBB00, 0x141000)
GUICtrlSetStyle(-1, 0x0801)
$aIP_Val[8] = _Input_Create($iWidth - 145, 209 + $cBTN_H * 3, 125, 22, 0xFFBB00, 0x141000)
GUICtrlSetStyle(-1, 0x0801)

GUICtrlSetState($aBTN_Shuf[1], $GUI_CHECKED)


_GDIPlus_RegionCombineRect($hRegion, 20, 43 + $cBTN_H * 3, $iWidth - 19 - 320, 23, 3)
_GDIPlus_RegionCombineRect($hRegion, 20, 98 + $cBTN_H * 3, $iWidth - 19 - 320, 23, 3)
_GDIPlus_RegionCombineRect($hRegion, 20, 153 + $cBTN_H * 3, $iWidth - 19 - 320, 23, 3)
_GDIPlus_GraphicsSetClipRegion($hGraphics, $hRegion)
_GDIPlus_RegionDispose($hRegion)

_GDIPlus_GraphicsSetClipRect($hGfx_Buffer, 0, 200 + $cBTN_H * 4, $iWidth, $iHeight)

DllStructSetData($tXMM0, 1, "0x11111111222222223333333344444444")
DllStructSetData($tXMM1, 1, "0x55555555666666667777777788888888")

_Fill_Shuffle()
_Switch_Shuffle(1)
_Switch_View(0)
_Switch_View(1)
_Switch_View(2)

Global $iMSrc = -1, $iMSrcNew = -1
Global $iMDst = -1
Global $iMDX = -1, $iMDY = -1


GUIRegisterMsg($WM_PAINT, "WM_PAINT")
GUIRegisterMsg($WM_LBUTTONUP, "WM_LBUTTONUP")
GUIRegisterMsg($WM_MOUSEMOVE, "WM_MOUSEMOVE")
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUISetState()




While Sleep(10)
WEnd




Func _Draw_Mouse()
    Local $hPen = _GDIPlus_PenCreate(0xAAFF2222, 4)
    _GDIPlus_PenSetLineJoin($hPen, 2)
    _GDIPlus_GraphicsDrawImage($hGfx_BufferM, $hBmp_Buffer, 0, 0)

    If $iMDst > -1 Then
        _GDIPlus_PenSetColor($hPen, 0xAA22FF22)
        _GDIPlus_GraphicsDrawRect($hGfx_BufferM, $aMDst[$iMDst][0] - 4, $aMDst[$iMDst][1] - 4, $aMDst[$iMDst][2] + 8, $aMDst[$iMDst][3] + 8, $hPen)
        _GDIPlus_GraphicsDrawRect($hGfx_BufferM, $aMSrc[$iMSrc][0] - 4, $aMSrc[$iMSrc][1] - 4, $aMSrc[$iMSrc][2] + 8, $aMSrc[$iMSrc][3] + 8, $hPen)
        _GDIPlus_GraphicsDrawLine($hGfx_BufferM, $aMSrc[$iMSrc][0] + $aMSrc[$iMSrc][2] * 0.5, $aMSrc[$iMSrc][1] + $aMSrc[$iMSrc][3] * 0.5, $aMDst[$iMDst][0] + $aMDst[$iMDst][2] * 0.5, $aMDst[$iMDst][1] + $aMDst[$iMDst][3] * 0.5, $hPen)
    ElseIf $iMSrc > -1 Then
        _GDIPlus_GraphicsDrawRect($hGfx_BufferM, $aMSrc[$iMSrc][0] - 4, $aMSrc[$iMSrc][1] - 4, $aMSrc[$iMSrc][2] + 8, $aMSrc[$iMSrc][3] + 8, $hPen)
        If $iMDX > 0 And $iMDY > 0 Then _GDIPlus_GraphicsDrawLine($hGfx_BufferM, $aMSrc[$iMSrc][0] + $aMSrc[$iMSrc][2] * 0.5, $aMSrc[$iMSrc][1] + $aMSrc[$iMSrc][3] * 0.5, $iMDX, $iMDY, $hPen)
    EndIf

    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmp_BufferM, 0, 0)
EndFunc   ;==>_Draw_Mouse





Func WM_LBUTTONUP($hWnd, $iMsg, $wParam, $lParam)
    If $iShuffle_Mode > 9 And $iShuffle_Mode < 15 Then
        If $iMSrc > -1 And $iMDst > -1 Then
            Switch $iShuffle_Mode
                Case 10 To 12 ;pshufd /lw /hw
                    Switch $iMDst
                        Case 0
                            $iVal_Shuffle = BitOR(BitAND($iVal_Shuffle, 0xFC), BitAND($iMSrc, 3)) ;11111100
                            GUICtrlSetData($aIP_Val[6], $iMSrc)
                        Case 1
                            $iVal_Shuffle = BitOR(BitAND($iVal_Shuffle, 0xF3), BitShift(BitAND($iMSrc, 3), -2)) ;11110011
                            GUICtrlSetData($aIP_Val[5], $iMSrc)
                        Case 2
                            $iVal_Shuffle = BitOR(BitAND($iVal_Shuffle, 0xCF), BitShift(BitAND($iMSrc, 3), -4)) ;11001111
                            GUICtrlSetData($aIP_Val[4], $iMSrc)
                        Case 3
                            $iVal_Shuffle = BitOR(BitAND($iVal_Shuffle, 0x3F), BitShift(BitAND($iMSrc, 3), -6)) ;00111111
                            GUICtrlSetData($aIP_Val[3], $iMSrc)
                    EndSwitch
                    GUICtrlSetData($aIP_Val[2], "0x" & Hex($iVal_Shuffle, 2))
                    _Switch_Shuffle($iShuffle_Mode)

                Case 13 ;pshufb
                    DllStructSetData($tXMM1, 1, $iMSrc, $iMDst + 1)
                    _Fill_XMM(1)
                    _Switch_Shuffle(13)

                Case 14 ;shufps
                    Switch $iMDst
                        Case 0
                            $iVal_Shuffle = BitOR(BitAND($iVal_Shuffle, 0xFC), BitAND(Mod($iMSrc, 4), 3)) ;11111100
                            GUICtrlSetData($aIP_Val[6], Mod($iMSrc, 4))
                        Case 1
                            $iVal_Shuffle = BitOR(BitAND($iVal_Shuffle, 0xF3), BitShift(BitAND(Mod($iMSrc, 4), 3), -2)) ;11110011
                            GUICtrlSetData($aIP_Val[5], Mod($iMSrc, 4))
                        Case 2
                            $iVal_Shuffle = BitOR(BitAND($iVal_Shuffle, 0xCF), BitShift(BitAND(Mod($iMSrc, 4), 3), -4)) ;11001111
                            GUICtrlSetData($aIP_Val[4], Mod($iMSrc, 4))
                        Case 3
                            $iVal_Shuffle = BitOR(BitAND($iVal_Shuffle, 0x3F), BitShift(BitAND(Mod($iMSrc, 4), 3), -6)) ;00111111
                            GUICtrlSetData($aIP_Val[3], Mod($iMSrc, 4))
                    EndSwitch
                    GUICtrlSetData($aIP_Val[2], "0x" & Hex($iVal_Shuffle, 2))
                    _Switch_Shuffle($iShuffle_Mode)
            EndSwitch
        EndIf

        $iMSrc = -1
        $iMDst = -1
        _Draw_Mouse()
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_LBUTTONUP



Func WM_MOUSEMOVE($hWnd, $iMsg, $wParam, $lParam)
    If $iShuffle_Mode > 9 And $iShuffle_Mode < 15 Then
        Local $iX = BitAND($lParam, 0x0000FFFF)
        Local $iY = BitShift($lParam, 16)

        Local $iVal = -1

        Switch BitAND($wParam, 0x0000FFFF)
            Case 0 ;No Button
                Switch $iShuffle_Mode
                    Case 10 To 12 ;pshufd/lw/hw
                        For $i = 0 To 3
                            If $iY > $aMSrc[$i][1] And $iY < $aMSrc[$i][1] + $aMSrc[$i][3] Then
                                If $iX > $aMSrc[$i][0] And $iX < $aMSrc[$i][0] + $aMSrc[$i][2] Then
                                    $iVal = $i
                                    ExitLoop
                                EndIf
                            EndIf
                        Next

                    Case 13 ;pshufb
                        For $i = 0 To 15
                            If $iY > $aMSrc[$i][1] And $iY < $aMSrc[$i][1] + $aMSrc[$i][3] Then
                                If $iX > $aMSrc[$i][0] And $iX < $aMSrc[$i][0] + $aMSrc[$i][2] Then
                                    $iVal = $i
                                    ExitLoop
                                EndIf
                            EndIf
                        Next

                    Case 14 ;Y = xmm0 / xmm1
                        For $i = 0 To 7
                            If $iY > $aMSrc[$i][1] And $iY < $aMSrc[$i][1] + $aMSrc[$i][3] Then
                                If $iX > $aMSrc[$i][0] And $iX < $aMSrc[$i][0] + $aMSrc[$i][2] Then
                                    $iVal = $i
                                    ExitLoop
                                EndIf
                            EndIf
                        Next

                EndSwitch

                If $iVal <> $iMSrc Then
                    $iMDX = -1
                    $iMDY = -1
                    $iMSrc = $iVal
                    _Draw_Mouse()
                EndIf

            Case 1 ;Left Button
                If $iMSrc > -1 Then
                    Switch $iShuffle_Mode
                        Case 10 To 12 ;pshufd/lw/hw
                            For $i = 0 To 3
                                If $iY > $aMDst[$i][1] And $iY < $aMDst[$i][1] + $aMDst[$i][3] Then
                                    If $iX > $aMDst[$i][0] And $iX < $aMDst[$i][0] + $aMDst[$i][2] Then
                                        $iVal = $i
                                        ExitLoop
                                    EndIf
                                EndIf
                            Next

                        Case 13 ;pshufb
                            For $i = 0 To 15
                                If $iY > $aMDst[$i][1] And $iY < $aMDst[$i][1] + $aMDst[$i][3] Then
                                    If $iX > $aMDst[$i][0] And $iX < $aMDst[$i][0] + $aMDst[$i][2] Then
                                        $iVal = $i
                                        ExitLoop
                                    EndIf
                                EndIf
                            Next

                        Case 14 ;shufps
                            For $i = 0 To 3
                                If $iY > $aMDst[$i][1] And $iY < $aMDst[$i][1] + $aMDst[$i][3] Then
                                    If $iX > $aMDst[$i][0] And $iX < $aMDst[$i][0] + $aMDst[$i][2] Then
                                        $iVal = $i
                                        ExitLoop
                                    EndIf
                                EndIf
                            Next

                            Switch $iMSrc
                                Case 0 To 3
                                    If $iVal > 1 Then $iVal = -1
                                Case Else
                                    If $iVal < 2 Then $iVal = -1
                            EndSwitch

                    EndSwitch

                    If $iVal <> $iMDst Or $iX <> $iMDX Or $iY <> $iMDY Then
                        $iMDst = $iVal
                        $iMDX = $iX
                        $iMDY = $iY
                        _Draw_Mouse()
                    EndIf

                EndIf


        EndSwitch

    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_MOUSEMOVE





Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $nNotifyCode = BitShift($wParam, 16)
    Local $hCtrl = $lParam
    Local $iCtrl = BitAND($wParam, 0xFFFF)

    Switch $nNotifyCode
        Case 256 ;Focus

        Case 512 ;KillFocus
            Switch $iCtrl
                Case $aIP_XMM[0][15] To $aIP_XMM[0][0]
                    _Fill_XMM(0, 15 - ($iCtrl - $aIP_XMM[0][15]))
                    GUICtrlSetColor($iCtrl, 0x0088FF)
                    GUICtrlSetBkColor($iCtrl, 0x000014)

                Case $aIP_XMM[1][15] To $aIP_XMM[1][0]
                    _Fill_XMM(1, 15 - ($iCtrl - $aIP_XMM[1][15]))
                    GUICtrlSetColor($iCtrl, 0x0088FF)
                    GUICtrlSetBkColor($iCtrl, 0x000014)
            EndSwitch


        Case 0x400 ;EN_UPDATE
            Switch $iCtrl
                Case $aIP_Val[2] ;Shuffle
                    Local $sVal = GUICtrlRead($iCtrl)
                    Local $tVal = DllStructCreate("byte")
                    DllStructSetData($tVal, 1, $sVal)
                    Local $iVal = DllStructGetData($tVal, 1)
                    GUICtrlSetData($iCtrl, "0x" & Hex($iVal, 2))
                    $iVal_Shuffle = $iVal
                    If $sVal <> "0x" & Hex($iVal, 2) Then
                        _Fill_Shuffle()
                        _Switch_Shuffle($iShuffle_Mode)
                    EndIf

                Case $aIP_XMM[0][15] To $aIP_XMM[0][0]
                    If _FilterIP($hCtrl, 0, 16 - ($iCtrl - $aIP_XMM[0][15])) Then
                        GUICtrlSetColor($iCtrl, 0x0088FF)
                        GUICtrlSetBkColor($iCtrl, 0x000014)
                        _Switch_Shuffle($iShuffle_Mode)
                    Else
                        GUICtrlSetColor($iCtrl, 0xFF3300)
                        GUICtrlSetBkColor($iCtrl, 0x140000)
                    EndIf


                Case $aIP_XMM[1][15] To $aIP_XMM[1][0]
                    If _FilterIP($hCtrl, 1, 16 - ($iCtrl - $aIP_XMM[1][15])) Then
                        GUICtrlSetColor($iCtrl, 0x0088FF)
                        GUICtrlSetBkColor($iCtrl, 0x000014)
                        _Switch_Shuffle($iShuffle_Mode)
                    Else
                        GUICtrlSetColor($iCtrl, 0xFF3300)
                        GUICtrlSetBkColor($iCtrl, 0x140000)
                    EndIf

            EndSwitch

    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND


Func _FilterIP($hCtrl, $iXMM, $iIdx)

    Local $sVal = _GUICtrlEdit_GetText($hCtrl)

    Local $tVal, $tSet
    Switch $aXMM[3 + $iXMM]
        Case 0 ;Signed
            Switch $aXMM[6 + $iXMM]
                Case 0 ;Byte
                    $tVal = DllStructCreate("byte")
                    $tSet = DllStructCreate("byte[16]", $aXMM[$iXMM])
                Case 1 ;Word
                    $tVal = DllStructCreate("short")
                    $tSet = DllStructCreate("short[8]", $aXMM[$iXMM])
                Case 2 ;DWord
                    $tVal = DllStructCreate("int")
                    $tSet = DllStructCreate("int[4]", $aXMM[$iXMM])
                Case 3 ;QWord
                    $tVal = DllStructCreate("int64")
                    $tSet = DllStructCreate("int64[2]", $aXMM[$iXMM])
                Case 4 ;Single
                    $tVal = DllStructCreate("float")
                    $tSet = DllStructCreate("float[4]", $aXMM[$iXMM])
                Case 5 ;Double
                    $tVal = DllStructCreate("double")
                    $tSet = DllStructCreate("double[2]", $aXMM[$iXMM])
            EndSwitch
            If Not DllStructSetData($tVal, 1, $sVal) And $sVal <> "0" Then Return False
            DllStructSetData($tSet, 1, $sVal, $iIdx)

        Case 1 ;UnSigned
            Switch $aXMM[6 + $iXMM]
                Case 0 ;Byte
                    $tVal = DllStructCreate("byte")
                    $tSet = DllStructCreate("byte[16]", $aXMM[$iXMM])
                Case 1 ;Word
                    $tVal = DllStructCreate("ushort")
                    $tSet = DllStructCreate("ushort[8]", $aXMM[$iXMM])
                Case 2 ;DWord
                    $tVal = DllStructCreate("uint")
                    $tSet = DllStructCreate("uint[4]", $aXMM[$iXMM])
                Case 3 ;QWord
                    $tVal = DllStructCreate("uint64")
                    $tSet = DllStructCreate("uint64[2]", $aXMM[$iXMM])
                Case 4 ;Single
                    $tVal = DllStructCreate("float")
                    $tSet = DllStructCreate("float[4]", $aXMM[$iXMM])
                Case 5 ;Double
                    $tVal = DllStructCreate("double")
                    $tSet = DllStructCreate("double[2]", $aXMM[$iXMM])
            EndSwitch
            If Not DllStructSetData($tVal, 1, $sVal) And $sVal <> "0" Then Return False
            DllStructSetData($tSet, 1, $sVal, $iIdx)

        Case 2 ;Hex
            $sVal = StringRegExpReplace($sVal, "(?mi)^0x", "")
            If StringRegExp($sVal, "[^[:xdigit:]]") Then Return False
            Switch $aXMM[6 + $iXMM]
                Case 0 ;Byte
                    $tVal = DllStructCreate("byte")
                    $tSet = DllStructCreate("byte[16]", $aXMM[$iXMM])
                Case 1 ;Word
                    $tVal = DllStructCreate("ushort")
                    $tSet = DllStructCreate("ushort[8]", $aXMM[$iXMM])
                Case 2 ;DWord
                    $tVal = DllStructCreate("uint")
                    $tSet = DllStructCreate("uint[4]", $aXMM[$iXMM])
                Case 3 ;QWord
                    $tVal = DllStructCreate("uint64")
                    $tSet = DllStructCreate("uint64[2]", $aXMM[$iXMM])
                Case 4 ;Single
                    $tVal = DllStructCreate("uint")
                    $tSet = DllStructCreate("uint[4]", $aXMM[$iXMM])
                Case 5 ;Double
                    $tVal = DllStructCreate("uint64")
                    $tSet = DllStructCreate("uint64[2]", $aXMM[$iXMM])
            EndSwitch
            If DllStructSetData($tVal, 1, Dec($sVal)) <> Dec($sVal) Then Return False
            DllStructSetData($tSet, 1, Dec($sVal), $iIdx)

    EndSwitch


    Return True
EndFunc   ;==>_FilterIP






Func _Set_Shuffle()
    Switch $iShuffle_Mode
        Case 10 To 14
        Case Else
            Return
    EndSwitch

    Local $iV1 = BitAND($iVal_Shuffle, 0x3)
    Local $iV2 = BitAND(BitShift($iVal_Shuffle, 2), 0x3)
    Local $iV3 = BitAND(BitShift($iVal_Shuffle, 4), 0x3)
    Local $iV4 = BitAND(BitShift($iVal_Shuffle, 6), 0x3)

    Local $iIdx = @GUI_CtrlId - $aBTN_Val[3]

    Local $iV = 3 - Floor($iIdx / 3)
    Local $iM = 1 - Mod($iIdx, 3) * 2

    Switch $iV
        Case 0 ;Dst1
            $iV1 += $iM
            $iV1 = $iV1 > 3 ? 3 : ($iV1 < 0 ? 0 : $iV1)
        Case 1 ;Dst2
            $iV2 += $iM
            $iV2 = $iV2 > 3 ? 3 : ($iV2 < 0 ? 0 : $iV2)
        Case 2 ;Dst3
            $iV3 += $iM
            $iV3 = $iV3 > 3 ? 3 : ($iV3 < 0 ? 0 : $iV3)
        Case 3 ;Dst4
            $iV4 += $iM
            $iV4 = $iV4 > 3 ? 3 : ($iV4 < 0 ? 0 : $iV4)
    EndSwitch

    $iVal_Shuffle = BitOR(BitShift($iV4, -6), BitShift($iV3, -4), BitShift($iV2, -2), $iV1)
    _Fill_Shuffle()

    _Switch_Shuffle($iShuffle_Mode)
EndFunc   ;==>_Set_Shuffle




Func _Set_Shift()
    Switch $iShuffle_Mode
        Case 15 To 17
        Case Else
            Return
    EndSwitch

    If @GUI_CtrlId = $aBTN_Val[1] Then
        $iVal_Shift += 1
    Else
        $iVal_Shift -= 1
    EndIf

    $iVal_Shift = $iVal_Shift > 16 ? 16 : ($iVal_Shift < 0 ? 0 : $iVal_Shift)
    GUICtrlSetData($aIP_Val[1], $iVal_Shift)

    _Switch_Shuffle($iShuffle_Mode)
EndFunc   ;==>_Set_Shift








Func _Fill_Shuffle()
    GUICtrlSetData($aIP_Val[2], "0x" & Hex($iVal_Shuffle, 2))
    GUICtrlSetData($aIP_Val[6], BitAND($iVal_Shuffle, 0x3))
    GUICtrlSetData($aIP_Val[5], BitAND(BitShift($iVal_Shuffle, 2), 0x3))
    GUICtrlSetData($aIP_Val[4], BitAND(BitShift($iVal_Shuffle, 4), 0x3))
    GUICtrlSetData($aIP_Val[3], BitAND(BitShift($iVal_Shuffle, 6), 0x3))
EndFunc   ;==>_Fill_Shuffle





Func _Input_Create($iX, $iY, $iW, $iH, $iC, $iBG)
    Local $cCtrl = GUICtrlCreateEdit("", $iX, $iY, $iW, $iH, 1, 0)
    _GDIPlus_RegionCombineRect($hRegion, $iX, $iY, $iW, $iH, 3)
    GUICtrlSetFont(-1, 12, 500, 0, "Trebuchet MS")
    GUICtrlSetColor(-1, $iC)
    GUICtrlSetBkColor(-1, $iBG)
    Return $cCtrl
EndFunc   ;==>_Input_Create


Func _Select_View()
    Local $iIdx = @GUI_CtrlId - $aBTN_XMM[6] + 1
    Switch $iIdx
        Case 7 To 9
            $aXMM[4] = $iIdx - 7
            _Fill_XMM(1)
        Case 17 To 19
            $aXMM[3] = $iIdx - 17
            _Fill_XMM(0)
        Case 27 To 29
            $aXMM[5] = $iIdx - 27
            _Fill_XMM(2)
        Case 1 To 6
            $aXMM[7] = $iIdx - 1
            _Switch_View(1)
        Case 11 To 16
            $aXMM[6] = $iIdx - 11
            _Switch_View(0)
        Case 21 To 26
            $aXMM[8] = $iIdx - 21
            _Switch_View(2)
        Case 10
            Switch $iShuffle_Mode
                Case 13 ;pshufb
                    DllStructSetData($tXMM1, 1, "0x000102030405060708090A0B0C0D0E0F")
                Case Else
                    DllStructSetData($tXMM1, 1, "0x00000000000000000000000000000000")
            EndSwitch
            _Fill_XMM(1)
            _Switch_Shuffle($iShuffle_Mode)
        Case 20
            DllStructSetData($tXMM0, 1, "0x00000000000000000000000000000000")
            _Fill_XMM(0)
            _Switch_Shuffle($iShuffle_Mode)
    EndSwitch
EndFunc   ;==>_Select_View




Func _Fill_XMM($iXMM, $iIdx = -1)
    Local $tVal, $iVal

    Local $iType = $aXMM[6 + $iXMM]
    Local $iSigned = $aXMM[3 + $iXMM]

    Switch $iType
        Case 0 ;Byte
            $tVal = DllStructCreate("byte[16]", $aXMM[$iXMM])
            For $i = 0 To 15
                If $iIdx >= 0 And $i <> $iIdx Then ContinueLoop
                $iVal = DllStructGetData($tVal, 1, $i + 1)
                If $iSigned = 0 Then
                    If $iVal > 127 Then $iVal -= 256
                ElseIf $iSigned = 2 Then
                    $iVal = "0x" & Hex($iVal, 2)
                EndIf
                GUICtrlSetData($aIP_XMM[$iXMM][$i], $iVal)
            Next

        Case 1 ;Word
            If $iSigned = 0 Then
                $tVal = DllStructCreate("short[8]", $aXMM[$iXMM])
            Else
                $tVal = DllStructCreate("ushort[8]", $aXMM[$iXMM])
            EndIf
            For $i = 0 To 7
                If $iIdx >= 0 And $i <> $iIdx Then ContinueLoop
                $iVal = DllStructGetData($tVal, 1, $i + 1)
                If $iSigned = 2 Then $iVal = "0x" & Hex($iVal, 4)
                GUICtrlSetData($aIP_XMM[$iXMM][$i], $iVal)
            Next

        Case 2 ;DWord
            If $iSigned = 0 Then
                $tVal = DllStructCreate("int[4]", $aXMM[$iXMM])
            Else
                $tVal = DllStructCreate("uint[4]", $aXMM[$iXMM])
            EndIf
            For $i = 0 To 3
                If $iIdx >= 0 And $i <> $iIdx Then ContinueLoop
                $iVal = DllStructGetData($tVal, 1, $i + 1)
                If $iSigned = 2 Then $iVal = "0x" & Hex($iVal, 8)
                GUICtrlSetData($aIP_XMM[$iXMM][$i], $iVal)
            Next

        Case 3 ;QWord
            Local $tChr = DllStructCreate("char[64];")
            If $iSigned = 1 Then
                $tVal = DllStructCreate("int64[2];", $aXMM[$iXMM])
            Else
                $tVal = DllStructCreate("uint64[2];", $aXMM[$iXMM])
            EndIf
            For $i = 0 To 1
                If $iIdx >= 0 And $i <> $iIdx Then ContinueLoop
                $iVal = DllStructGetData($tVal, 1, $i + 1)
                If $iSigned = 2 Then
                    $iVal = "0x" & Hex($iVal, 16)
                ElseIf $iSigned = 1 Then
                    DllCall("msvcrt.dll", "ptr:cdecl", "_ui64toa", "uint64", $iVal, "ptr", DllStructGetPtr($tChr), "int", 10)
                    $iVal = DllStructGetData($tChr, 1)
                EndIf
                GUICtrlSetData($aIP_XMM[$iXMM][$i], $iVal)
            Next

        Case 4 ;Single
            If $iSigned = 2 Then
                $tVal = DllStructCreate("uint[4]", $aXMM[$iXMM])
            Else
                $tVal = DllStructCreate("float[4]", $aXMM[$iXMM])
            EndIf
            For $i = 0 To 3
                If $iIdx >= 0 And $i <> $iIdx Then ContinueLoop
                $iVal = DllStructGetData($tVal, 1, $i + 1)
                If $iSigned = 2 Then
                    $iVal = "0x" & Hex($iVal, 8)
                Else
                    ;$iVal = StringFormat("%.15f", $iVal)
                    ;$iVal = Round($iVal, 15)
                EndIf
                GUICtrlSetData($aIP_XMM[$iXMM][$i], $iVal)
            Next

        Case Else ;Double
            If $iSigned = 2 Then
                $tVal = DllStructCreate("uint64[2]", $aXMM[$iXMM])
            Else
                $tVal = DllStructCreate("double[2]", $aXMM[$iXMM])
            EndIf
            For $i = 0 To 1
                If $iIdx >= 0 And $i <> $iIdx Then ContinueLoop
                $iVal = DllStructGetData($tVal, 1, $i + 1)
                If $iSigned = 2 Then
                    $iVal = "0x" & Hex($iVal, 16)
                Else
                    ;$iVal = StringFormat("%.30f", $iVal)
                    ;$iVal = Round($iVal, 30)
                EndIf
                GUICtrlSetData($aIP_XMM[$iXMM][$i], $iVal)
            Next

    EndSwitch

EndFunc   ;==>_Fill_XMM





Func _Switch_View($iXMM = 0)
    Local $iY = 44 + $cBTN_H * 3
    If $iXMM = 0 Then $iY += 55
    If $iXMM = 2 Then $iY += 110
    Local $iW = $iWidth - 20 - 320

    Local $iType = $aXMM[6 + $iXMM]

    _SendMessage($hGui, $WM_SETREDRAW, False, 0)

    Local $iX = 20 + $iW, $iOff
    Switch $iType
        Case 0 ;Byte
            $iOff = Floor($iW / 16)

            Local $iStyle, $iExStyle
            For $i = 0 To 15
                $iX -= $iOff
                GUICtrlSetPos($aIP_XMM[$iXMM][$i], $iX, $iY, $iOff - 2, 22)
                GUICtrlSetState($aIP_XMM[$iXMM][$i], $GUI_SHOW)
            Next

        Case 1 ;Word
            $iOff = Floor($iW / 8)
            For $i = 0 To 7
                $iX -= $iOff
                GUICtrlSetPos($aIP_XMM[$iXMM][$i], $iX, $iY, $iOff - 2, 22)
                GUICtrlSetState($aIP_XMM[$iXMM][$i], $GUI_SHOW)
            Next
            For $i = 8 To 15
                GUICtrlSetState($aIP_XMM[$iXMM][$i], $GUI_HIDE)
            Next

        Case 2, 4 ;DWord, Single
            $iOff = Floor($iW / 4)
            For $i = 0 To 3
                $iX -= $iOff
                GUICtrlSetPos($aIP_XMM[$iXMM][$i], $iX, $iY, $iOff - 2, 22)
                GUICtrlSetState($aIP_XMM[$iXMM][$i], $GUI_SHOW)
            Next
            For $i = 4 To 15
                GUICtrlSetState($aIP_XMM[$iXMM][$i], $GUI_HIDE)
            Next

        Case Else ;QWord, Double
            $iOff = Floor($iW / 2)
            For $i = 0 To 1
                $iX -= $iOff
                GUICtrlSetPos($aIP_XMM[$iXMM][$i], $iX, $iY, $iOff - 2, 22)
                GUICtrlSetState($aIP_XMM[$iXMM][$i], $GUI_SHOW)
            Next
            For $i = 2 To 15
                GUICtrlSetState($aIP_XMM[$iXMM][$i], $GUI_HIDE)
            Next

    EndSwitch

    _Fill_XMM($iXMM)

    _SendMessage($hGui, $WM_SETREDRAW, True, 0)

    Local $tRect = DllStructCreate("int Left; int Top; int Right; int Bottom")
    DllStructSetData($tRect, "Left", 10)
    DllStructSetData($tRect, "Top", $iY - 2)
    DllStructSetData($tRect, "Right", 30 + $iW)
    DllStructSetData($tRect, "Bottom", $iY + 26)

    _WinAPI_RedrawWindow($hGui, $tRect, 0, BitOR($RDW_ERASE, $RDW_FRAME, $RDW_INVALIDATE, $RDW_ALLCHILDREN, $RDW_INTERNALPAINT * 0))

EndFunc   ;==>_Switch_View












Func _Button_Create($iX, $iY, $iW, $iH, $iIdx)
    Local $cCtrl
    Switch $iIdx
        Case 1 To 26
            $cCtrl = GUICtrlCreateRadio("", $iX, $iY, $iW, $iH, BitOR(0x1000, $BS_BITMAP))
            _GDIPlus_RegionCombineRect($hRegion, $iX, $iY, $iW, $iH, 3)
        Case 27 To 35
            $cCtrl = GUICtrlCreateRadio("", $iX, $iY, $iW, $iH, BitOR(0x1000, $BS_BITMAP))
            _GDIPlus_RegionCombineRect($hRegion, $iX, $iY, $iW, $iH, 3)
        Case 36, 100, 101
            $cCtrl = GUICtrlCreateButton("", $iX, $iY, $iW, $iH, $BS_BITMAP)
            _GDIPlus_RegionCombineRect($hRegion, $iX, $iY, $iW, $iH, 3)
    EndSwitch

    Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH)
    Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hContext, 2)

    Switch $iIdx
        Case 1 To 26
            _Draw_Shuffle($hContext, $iW * 0.1, $iH * 0.4, $iW * 0.8, $iH * 0.44, $iIdx)
    EndSwitch


    Local $hPen = _GDIPlus_PenCreate(0x44220000, 2)
    Local $hBrush = _GDIPlus_BrushCreateSolid(0xFF000044)
    Local $hPath = _GDIPlus_PathCreate()
    Local $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    Local $hFormat = _GDIPlus_StringFormatCreate()
    _GDIPlus_StringFormatSetLineAlign($hFormat, 1)
    _GDIPlus_StringFormatSetAlign($hFormat, 1)
    Local $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH)

    Switch $iIdx
        Case 1 To 26
            $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH * 0.5)
            _GDIPlus_PathAddString($hPath, $aShuf[$i][0], $tLayout, $hFamily, 0, $iH * 0.22, $hFormat)
        Case 32
            _GDIPlus_PathAddString($hPath, "B", $tLayout, $hFamily, 0, $iW * 0.36, $hFormat)
        Case 31
            _GDIPlus_PathAddString($hPath, "W", $tLayout, $hFamily, 0, $iW * 0.36, $hFormat)
        Case 30
            _GDIPlus_PathAddString($hPath, "DW", $tLayout, $hFamily, 0, $iW * 0.36, $hFormat)
        Case 29
            _GDIPlus_PathAddString($hPath, "QW", $tLayout, $hFamily, 0, $iW * 0.36, $hFormat)
        Case 28
            _GDIPlus_PathAddString($hPath, "SP", $tLayout, $hFamily, 0, $iW * 0.36, $hFormat)
        Case 27
            _GDIPlus_PathAddString($hPath, "DP", $tLayout, $hFamily, 0, $iW * 0.36, $hFormat)
        Case 35
            _GDIPlus_PathAddString($hPath, "S", $tLayout, $hFamily, 0, $iW * 0.36, $hFormat)
        Case 34
            _GDIPlus_PathAddString($hPath, "U", $tLayout, $hFamily, 0, $iW * 0.36, $hFormat)
        Case 33
            _GDIPlus_PathAddString($hPath, "H", $tLayout, $hFamily, 0, $iW * 0.36, $hFormat)
        Case 36
            _GDIPlus_PathAddString($hPath, "R", $tLayout, $hFamily, 0, $iW * 0.36, $hFormat)
        Case 100
            _GDIPlus_PathAddString($hPath, "+", $tLayout, $hFamily, 0, $iW * 0.6, $hFormat)
        Case 101
            _GDIPlus_PathAddString($hPath, "-", $tLayout, $hFamily, 0, $iW * 0.6, $hFormat)
    EndSwitch


    _GDIPlus_GraphicsDrawPath($hContext, $hPath, $hPen)
    _GDIPlus_GraphicsFillPath($hContext, $hPath, $hBrush)

    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)


    _GDIPlus_GraphicsDispose($hContext)


    Local $hBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
    _GDIPlus_BitmapDispose($hBitmap)
    _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($cCtrl), 0xF7, $IMAGE_BITMAP, $hBMP))

    _GDIPlus_BitmapDispose($hBitmap)
    Return $cCtrl
EndFunc   ;==>_Button_Create












Func _Draw_XMMGroup($hContext, $sStr, $iX, $iY, $iW, $iH, $iR = 10)
    Local $hPen = _GDIPlus_PenCreate(0x220000FF, 4)
    _GDIPlus_PenSetLineJoin($hPen, 2)
    Local $hBrush = _GDIPlus_BrushCreateSolid(0xCCFFFFFF)
    Local $hPath = _GDIPlus_PathCreate()
    Local $iTextOffset = 20


    Local $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    Local $hFormat = _GDIPlus_StringFormatCreate()
    _GDIPlus_StringFormatSetLineAlign($hFormat, 1)
    Local $tLayout = _GDIPlus_RectFCreate($iX + $iR * 4, $iY - $iH * 0.23, $iW * 0.2, $iH * 0.4)
    _GDIPlus_PathAddString($hPath, $sStr, $tLayout, $hFamily, 1, $iH * 0.3, $hFormat)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_FontFamilyDispose($hFamily)

    Local $aBounds = _GDIPlus_PathGetWorldBounds($hPath)

    _GDIPlus_GraphicsDrawPath($hContext, $hPath, $hPen)
    _GDIPlus_GraphicsFillPath($hContext, $hPath, $hBrush)


    _GDIPlus_PathReset($hPath)


    _GDIPlus_PathAddLine($hPath, $aBounds[0] + $aBounds[2] + 10, $iY, $iX + $iW - $iR * 1.5, $iY)
    _GDIPlus_PathAddArc($hPath, $iX + $iW - $iR, $iY, $iR, $iR, 270, 90)
    _GDIPlus_PathAddArc($hPath, $iX + $iW - $iR, $iY + $iH - $iR, $iR, $iR, 0, 90)
    _GDIPlus_PathAddArc($hPath, $iX, $iY + $iH - $iR, $iR, $iR, 90, 90)
    _GDIPlus_PathAddArc($hPath, $iX, $iY, $iR, $iR, 180, 90)
    _GDIPlus_PathAddLine($hPath, $iX + $iR * 1.5, $iY, $aBounds[0] - 10, $iY)

    _GDIPlus_GraphicsDrawPath($hContext, $hPath, $hPen)
    _GDIPlus_PenSetWidth($hPen, 2)
    _GDIPlus_PenSetColor($hPen, 0xCCFFFFFF)
    _GDIPlus_GraphicsDrawPath($hContext, $hPath, $hPen)

    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
EndFunc   ;==>_Draw_XMMGroup




Func _Select_Shuffle()
    Local $iIdx = @GUI_CtrlId - $aBTN_Shuf[1] + 1
    _Switch_Shuffle($iIdx)
EndFunc   ;==>_Select_Shuffle



Func _Switch_Shuffle($iIdx)

    If $iShuffle_Mode <> $iIdx Then

        _SendMessage($hGui, $WM_SETREDRAW, False, 0)

        Local $bSSE_OK = True
        GUICtrlSetData($aIP_Val[8], $aShuf[$iIdx][1])
        Switch $aShuf[$iIdx][1]
            Case "SSE"
                If Not $tSSE.SSE Then $bSSE_OK = False
            Case "SSE2"
                If Not $tSSE.SSE2 Then $bSSE_OK = False
            Case "SSE3"
                If Not $tSSE.SSE3 Then $bSSE_OK = False
            Case "SSSE3"
                If Not $tSSE.SSSE3 Then $bSSE_OK = False
        EndSwitch

        If $bSSE_OK Then
            GUICtrlSetColor($aIP_Val[8], 0x00FF55)
            GUICtrlSetBkColor($aIP_Val[8], 0x000D00)
        Else
            GUICtrlSetColor($aIP_Val[8], 0xFF3300)
            GUICtrlSetBkColor($aIP_Val[8], 0x140000)
        EndIf



        Switch $iIdx
            Case 10 To 12, 14
                GUICtrlSetState($aIP_Val[2], $GUI_ENABLE)
                For $i = 0 To 3
                    GUICtrlSetState($aIP_Val[3 + $i], $GUI_ENABLE)
                    GUICtrlSetState($aBTN_Val[3 + $i * 2], $GUI_ENABLE)
                    GUICtrlSetState($aBTN_Val[4 + $i * 2], $GUI_ENABLE)
                Next

            Case Else
                GUICtrlSetState($aIP_Val[2], $GUI_DISABLE)
                For $i = 0 To 3
                    GUICtrlSetState($aIP_Val[3 + $i], $GUI_DISABLE)
                    GUICtrlSetState($aBTN_Val[3 + $i * 2], $GUI_DISABLE)
                    GUICtrlSetState($aBTN_Val[4 + $i * 2], $GUI_DISABLE)
                Next

        EndSwitch

        Switch $iIdx
            Case 15 To 17
                GUICtrlSetState($aIP_Val[1], $GUI_ENABLE)
                GUICtrlSetState($aBTN_Val[1], $GUI_ENABLE)
                GUICtrlSetState($aBTN_Val[2], $GUI_ENABLE)
            Case Else
                GUICtrlSetState($aIP_Val[1], $GUI_DISABLE)
                GUICtrlSetState($aBTN_Val[1], $GUI_DISABLE)
                GUICtrlSetState($aBTN_Val[2], $GUI_DISABLE)
        EndSwitch

        _SendMessage($hGui, $WM_SETREDRAW, True, 0)
        _WinAPI_RedrawWindow($hGui, 0, 0, 1)
    EndIf


    $iShuffle_Mode = $iIdx

    _GDIPlus_GraphicsClear($hGfx_Buffer, 0xFF445566)

    _Draw_Shuffle($hGfx_Buffer, $iWidth * 0.1, 200 + $cBTN_H * 4.7, $iWidth * 0.8, $iHeight * 0.24, $iIdx)

    Switch $iIdx
        Case 13
            _ASM_Shuf($tXMM0, $tXMM1, $tXMM2, $iIdx)
            GUICtrlSetData($aIP_Val[7], $aShuf[$iIdx][0] & " xmm0, xmm1")
        Case 10 To 14 ;pshufx shufps
            _ASM_Shuf($tXMM0, $tXMM1, $tXMM2, $iIdx, $iVal_Shuffle)
            GUICtrlSetData($aIP_Val[7], $aShuf[$iIdx][0] & " xmm0, xmm1, 0x" & Hex($iVal_Shuffle, 2))
        Case 15 To 17
            _ASM_Shuf($tXMM0, $tXMM1, $tXMM2, $iIdx, $iVal_Shift)
            GUICtrlSetData($aIP_Val[7], $aShuf[$iIdx][0] & " xmm0, " & $iVal_Shift)
        Case Else
            _ASM_Shuf($tXMM0, $tXMM1, $tXMM2, $iIdx)
            GUICtrlSetData($aIP_Val[7], $aShuf[$iIdx][0] & " xmm0, xmm1")
    EndSwitch

    _Fill_XMM(2)

    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmp_Buffer, 0, 0)
EndFunc   ;==>_Switch_Shuffle






Func _Draw_Shuffle($hContext, $iX, $iY, $iW, $iH, $iIdx)

    If $iH > 100 Then
        Local $hPen = _GDIPlus_PenCreate(0x220000FF, 4)
        _GDIPlus_PenSetLineJoin($hPen, 2)
        Local $hPath = _GDIPlus_PathCreate()
        Local $hBrush = _GDIPlus_BrushCreateSolid(0xCCFFFFFF)
        Local $hFamily = _GDIPlus_FontFamilyCreate("Arial")
        Local $hFormat = _GDIPlus_StringFormatCreate(0x1000)
        _GDIPlus_StringFormatSetLineAlign($hFormat, 1)
        _GDIPlus_StringFormatSetAlign($hFormat, 2)
        Local $tLayout = _GDIPlus_RectFCreate($iX - 100, $iY, 90, $iH * 0.2)

        Switch $iIdx
            Case 14, 17 To 26
                _GDIPlus_PathAddString($hPath, "xmm0", $tLayout, $hFamily, 1, $iH * 0.08, $hFormat)
                $tLayout = _GDIPlus_RectFCreate($iX - 100, $iY + $iH * 0.3, 90, $iH * 0.2)
                _GDIPlus_PathAddString($hPath, "xmm1", $tLayout, $hFamily, 1, $iH * 0.08, $hFormat)
            Case 13, 15, 16
                _GDIPlus_PathAddString($hPath, "xmm0", $tLayout, $hFamily, 1, $iH * 0.08, $hFormat)
            Case Else
                _GDIPlus_PathAddString($hPath, "xmm1", $tLayout, $hFamily, 1, $iH * 0.08, $hFormat)
        EndSwitch

        $tLayout = _GDIPlus_RectFCreate($iX - 100, $iY + $iH * 0.8, 90, $iH * 0.2)
        _GDIPlus_PathAddString($hPath, "xmm0", $tLayout, $hFamily, 1, $iH * 0.08, $hFormat)


        Switch $iIdx
            Case 3 To 5
                For $i = 0 To 1
                    $tLayout = _GDIPlus_RectFCreate($iX + ($iW / 2 * (1 - $i)) + 5, $iY - $iH * 0.1, $iW / 2 - 10, $iH * 0.1)
                    _GDIPlus_StringFormatSetAlign($hFormat, 2)
                    _GDIPlus_PathAddString($hPath, $i * 64 & " ]", $tLayout, $hFamily, 1, $iH * 0.06, $hFormat)
                    _GDIPlus_StringFormatSetAlign($hFormat, 0)
                    _GDIPlus_PathAddString($hPath, "[ " & $i * 64 + 63, $tLayout, $hFamily, 1, $iH * 0.06, $hFormat)
                Next

            Case 1 To 10, 14, 18, 25, 26
                For $i = 0 To 3
                    $tLayout = _GDIPlus_RectFCreate($iX + ($iW / 4 * (3 - $i)) + 5, $iY - $iH * 0.1, $iW / 4 - 10, $iH * 0.1)
                    _GDIPlus_StringFormatSetAlign($hFormat, 2)
                    _GDIPlus_PathAddString($hPath, $i * 32 & " ]", $tLayout, $hFamily, 1, $iH * 0.06, $hFormat)
                    _GDIPlus_StringFormatSetAlign($hFormat, 0)
                    _GDIPlus_PathAddString($hPath, "[ " & $i * 32 + 31, $tLayout, $hFamily, 1, $iH * 0.06, $hFormat)
                Next

            Case 11, 12, 19, 20, 23, 24
                For $i = 0 To 7
                    $tLayout = _GDIPlus_RectFCreate($iX + ($iW / 8 * (7 - $i)) + 5, $iY - $iH * 0.1, $iW / 8 - 10, $iH * 0.1)
                    _GDIPlus_StringFormatSetAlign($hFormat, 2)
                    _GDIPlus_PathAddString($hPath, $i * 16 & " ]", $tLayout, $hFamily, 1, $iH * 0.06, $hFormat)
                    _GDIPlus_StringFormatSetAlign($hFormat, 0)
                    _GDIPlus_PathAddString($hPath, "[ " & $i * 16 + 15, $tLayout, $hFamily, 1, $iH * 0.06, $hFormat)
                Next

            Case 13, 15 To 17, 21, 22
                For $i = 0 To 15
                    $tLayout = _GDIPlus_RectFCreate($iX + ($iW / 16 * (15 - $i)) + 5, $iY - $iH * 0.1, $iW / 16 - 10, $iH * 0.1)
                    _GDIPlus_StringFormatSetAlign($hFormat, 2)
                    _GDIPlus_PathAddString($hPath, $i * 8 & " ]", $tLayout, $hFamily, 1, $iH * 0.06, $hFormat)
                    _GDIPlus_StringFormatSetAlign($hFormat, 0)
                    _GDIPlus_PathAddString($hPath, "[ " & $i * 8 + 7, $tLayout, $hFamily, 1, $iH * 0.06, $hFormat)
                Next
        EndSwitch


        Switch $iIdx
            Case 3 To 5, 25, 26
                For $i = 0 To 1
                    $tLayout = _GDIPlus_RectFCreate($iX + ($iW / 2 * (1 - $i)) + 5, $iY + $iH, $iW / 2 - 10, $iH * 0.1)
                    _GDIPlus_StringFormatSetAlign($hFormat, 2)
                    _GDIPlus_PathAddString($hPath, $i * 64 & " ]", $tLayout, $hFamily, 1, $iH * 0.06, $hFormat)
                    _GDIPlus_StringFormatSetAlign($hFormat, 0)
                    _GDIPlus_PathAddString($hPath, "[ " & $i * 64 + 63, $tLayout, $hFamily, 1, $iH * 0.06, $hFormat)
                Next

            Case 1 To 10, 14, 23, 24
                For $i = 0 To 3
                    $tLayout = _GDIPlus_RectFCreate($iX + ($iW / 4 * (3 - $i)) + 5, $iY + $iH, $iW / 4 - 10, $iH * 0.1)
                    _GDIPlus_StringFormatSetAlign($hFormat, 2)
                    _GDIPlus_PathAddString($hPath, $i * 32 & " ]", $tLayout, $hFamily, 1, $iH * 0.06, $hFormat)
                    _GDIPlus_StringFormatSetAlign($hFormat, 0)
                    _GDIPlus_PathAddString($hPath, "[ " & $i * 32 + 31, $tLayout, $hFamily, 1, $iH * 0.06, $hFormat)
                Next

            Case 11, 12, 18, 21, 22
                For $i = 0 To 7
                    $tLayout = _GDIPlus_RectFCreate($iX + ($iW / 8 * (7 - $i)) + 5, $iY + $iH, $iW / 8 - 10, $iH * 0.1)
                    _GDIPlus_StringFormatSetAlign($hFormat, 2)
                    _GDIPlus_PathAddString($hPath, $i * 16 & " ]", $tLayout, $hFamily, 1, $iH * 0.06, $hFormat)
                    _GDIPlus_StringFormatSetAlign($hFormat, 0)
                    _GDIPlus_PathAddString($hPath, "[ " & $i * 16 + 15, $tLayout, $hFamily, 1, $iH * 0.06, $hFormat)
                Next

            Case 13, 15 To 17, 19, 20
                For $i = 0 To 15
                    $tLayout = _GDIPlus_RectFCreate($iX + ($iW / 16 * (15 - $i)) + 5, $iY + $iH, $iW / 16 - 10, $iH * 0.1)
                    _GDIPlus_StringFormatSetAlign($hFormat, 2)
                    _GDIPlus_PathAddString($hPath, $i * 8 & " ]", $tLayout, $hFamily, 1, $iH * 0.06, $hFormat)
                    _GDIPlus_StringFormatSetAlign($hFormat, 0)
                    _GDIPlus_PathAddString($hPath, "[ " & $i * 8 + 7, $tLayout, $hFamily, 1, $iH * 0.06, $hFormat)
                Next

        EndSwitch


        _GDIPlus_StringFormatDispose($hFormat)
        _GDIPlus_FontFamilyDispose($hFamily)
        _GDIPlus_GraphicsDrawPath($hContext, $hPath, $hPen)
        _GDIPlus_GraphicsFillPath($hContext, $hPath, $hBrush)
        _GDIPlus_PathDispose($hPath)
        _GDIPlus_BrushDispose($hBrush)
        _GDIPlus_PenDispose($hPen)
    EndIf



    Local $tSrc = DllStructCreate("byte Src[16]; byte Color[16];")
    DllStructSetData($tSrc, "Color", "0x0102030405060708090A0B0C0D0E0F10")

    Switch $iIdx
        Case 10 ;pshufd
            For $i = 0 To 3
                $aMSrc[$i][0] = $iX + ($iW / 4 * (3 - $i))
                $aMSrc[$i][1] = $iY
                $aMSrc[$i][2] = $iW / 4
                $aMSrc[$i][3] = $iH * 0.2
                $aMDst[$i][0] = $aMSrc[$i][0]
                $aMDst[$i][1] = $iY + $iH * 0.8
                $aMDst[$i][2] = $aMSrc[$i][2]
                $aMDst[$i][3] = $aMSrc[$i][3]
            Next
        Case 11 ;pshuflw
            For $i = 0 To 3
                $aMSrc[$i][0] = $iX + ($iW / 8 * (7 - $i))
                $aMSrc[$i][1] = $iY
                $aMSrc[$i][2] = $iW / 8
                $aMSrc[$i][3] = $iH * 0.2
                $aMDst[$i][0] = $aMSrc[$i][0]
                $aMDst[$i][1] = $iY + $iH * 0.8
                $aMDst[$i][2] = $aMSrc[$i][2]
                $aMDst[$i][3] = $aMSrc[$i][3]
            Next
        Case 12 ;pshufhw
            For $i = 0 To 3
                $aMSrc[$i][0] = $iX + ($iW / 8 * (3 - $i))
                $aMSrc[$i][1] = $iY
                $aMSrc[$i][2] = $iW / 8
                $aMSrc[$i][3] = $iH * 0.2
                $aMDst[$i][0] = $aMSrc[$i][0]
                $aMDst[$i][1] = $iY + $iH * 0.8
                $aMDst[$i][2] = $aMSrc[$i][2]
                $aMDst[$i][3] = $aMSrc[$i][3]
            Next
        Case 13 ;pshufb
            For $i = 0 To 15
                $aMSrc[$i][0] = $iX + ($iW / 16 * (15 - $i))
                $aMSrc[$i][1] = $iY
                $aMSrc[$i][2] = $iW / 16
                $aMSrc[$i][3] = $iH * 0.2
                $aMDst[$i][0] = $aMSrc[$i][0]
                $aMDst[$i][1] = $iY + $iH * 0.8
                $aMDst[$i][2] = $aMSrc[$i][2]
                $aMDst[$i][3] = $aMSrc[$i][3]
            Next
        Case 14 ;shufps
            For $i = 0 To 3
                $aMSrc[$i][0] = $iX + ($iW / 4 * (3 - $i))
                $aMSrc[$i][1] = $iY
                $aMSrc[$i][2] = $iW / 4
                $aMSrc[$i][3] = $iH * 0.2
                $aMSrc[$i + 4][0] = $aMSrc[$i][0]
                $aMSrc[$i + 4][1] = $iY + $iH * 0.3
                $aMSrc[$i + 4][2] = $aMSrc[$i][2]
                $aMSrc[$i + 4][3] = $aMSrc[$i][3]
                $aMDst[$i][0] = $aMSrc[$i][0]
                $aMDst[$i][1] = $iY + $iH * 0.8
                $aMDst[$i][2] = $aMSrc[$i][2]
                $aMDst[$i][3] = $aMSrc[$i][3]
            Next
    EndSwitch




    Switch $iIdx
        Case 1 To 10, 14, 18
            _Draw_XMM($hContext, $tSrc, $iX, $iY, $iW, $iH * 0.2)
        Case 11, 12, 19, 20
            _Draw_XMM($hContext, $tSrc, $iX, $iY, $iW, $iH * 0.2, 8)
        Case 13, 15 To 17
            _Draw_XMM($hContext, $tSrc, $iX, $iY, $iW, $iH * 0.2, 16)
        Case 21 ;punpcklbw
            _Draw_XMM($hContext, $tSrc, $iX, $iY, $iW, $iH * 0.2, 16, 1, 8)
            _Draw_XMM($hContext, $tSrc, $iX, $iY + $iH * 0.3, $iW, $iH * 0.2, 16, 1, 8, 8)
        Case 22 ;punpckhbw
            _Draw_XMM($hContext, $tSrc, $iX, $iY, $iW, $iH * 0.2, 16, 9, 16, -8)
            _Draw_XMM($hContext, $tSrc, $iX, $iY + $iH * 0.3, $iW, $iH * 0.2, 16, 9)
        Case 23 ;punpcklwd
            _Draw_XMM($hContext, $tSrc, $iX, $iY, $iW, $iH * 0.2, 8, 1, 4)
            _Draw_XMM($hContext, $tSrc, $iX, $iY + $iH * 0.3, $iW, $iH * 0.2, 8, 1, 4, 8)
        Case 24 ;punpckhwd
            _Draw_XMM($hContext, $tSrc, $iX, $iY, $iW, $iH * 0.2, 8, 5, 16, -4)
            _Draw_XMM($hContext, $tSrc, $iX, $iY + $iH * 0.3, $iW, $iH * 0.2, 8, 5, 16, 4)
        Case 25 ;punpckldq
            _Draw_XMM($hContext, $tSrc, $iX, $iY, $iW, $iH * 0.2, 4, 1, 2)
            _Draw_XMM($hContext, $tSrc, $iX, $iY + $iH * 0.3, $iW, $iH * 0.2, 4, 1, 2, 8)
        Case 26 ;punpckhdq
            _Draw_XMM($hContext, $tSrc, $iX, $iY, $iW, $iH * 0.2, 4, 3, 16, -2)
            _Draw_XMM($hContext, $tSrc, $iX, $iY + $iH * 0.3, $iW, $iH * 0.2, 4, 3, 16, 6)
    EndSwitch

    Switch $iIdx
        Case 14 ;shufps
            _Draw_XMM($hContext, $tSrc, $iX, $iY + $iH * 0.3, $iW, $iH * 0.2, 4, 0, 16, 8)
        Case 17 ;palignr
            _Draw_XMM($hContext, $tSrc, $iX, $iY + $iH * 0.3, $iW, $iH * 0.2, 16)
        Case 18 ;packssdw
            _Draw_XMM($hContext, $tSrc, $iX, $iY + $iH * 0.3, $iW, $iH * 0.2, 4, 0, 16, 8)
        Case 19, 20 ;packs/uswb
            _Draw_XMM($hContext, $tSrc, $iX, $iY + $iH * 0.3, $iW, $iH * 0.2, 8, 0, 16, 8)
    EndSwitch



    Local $t_XMM0 = DllStructCreate("byte[16]")
    Local $t_XMM1 = DllStructCreate("byte[16]")
    Local $t_XMM2 = DllStructCreate("byte[16]")

    Switch $iIdx
        Case 1 To 10 ;DWord move
            DllStructSetData($t_XMM0, 1, "0x11000000120000001300000014000000")
            DllStructSetData($t_XMM1, 1, "0x01000000020000000300000004000000")

        Case 14, 18, 25 ;Dword + xmm1
            DllStructSetData($t_XMM0, 1, "0x01000000020000000300000004000000")
            DllStructSetData($t_XMM1, 1, "0x11000000120000001300000014000000")

        Case 26
            DllStructSetData($t_XMM0, 1, "0x03000000040000000100000002000000")
            DllStructSetData($t_XMM1, 1, "0x13000000140000001100000012000000")

        Case 24
            DllStructSetData($t_XMM0, 1, "0x05000600070008000100020003000400")
            DllStructSetData($t_XMM1, 1, "0x15001600170018001100120013001400")

        Case 11 To 12 ;Word move
            DllStructSetData($t_XMM1, 1, "0x01000200030004000500060007000800")

        Case 19, 20, 23 ;Word + xmm1
            DllStructSetData($t_XMM0, 1, "0x01000200030004000500060007000800")
            DllStructSetData($t_XMM1, 1, "0x11001200130014001500160017001800")

        Case 13 ;pshufb
            DllStructSetData($t_XMM0, 1, "0x0102030405060708090A0B0C0D0E0F10")
            DllStructSetData($t_XMM1, 1, DllStructGetData($tXMM1, 1))

        Case 13, 15 To 17, 21 ;Byte
            DllStructSetData($t_XMM0, 1, "0x0102030405060708090A0B0C0D0E0F10")
            DllStructSetData($t_XMM1, 1, "0x1112131415161718191A1B1C1D1E1F20")

        Case 22
            DllStructSetData($t_XMM0, 1, "0x01020304050607080102030405060708")
            DllStructSetData($t_XMM1, 1, "0x11121314151617181112131415161718")

    EndSwitch

    Switch $iIdx
        Case 10 To 14 ;pshufx shufps
            _ASM_Shuf($t_XMM0, $t_XMM1, $t_XMM2, $iIdx, $iVal_Shuffle)
        Case 15 To 17
            _ASM_Shuf($t_XMM0, $t_XMM1, $t_XMM2, $iIdx, $iVal_Shift)
        Case Else
            _ASM_Shuf($t_XMM0, $t_XMM1, $t_XMM2, $iIdx)
    EndSwitch
    _Calc_Src($tSrc, $t_XMM2, $iIdx)

    Switch $iIdx
        Case 1 To 10, 14, 25, 26 ;DWord
            _Draw_XMM($hContext, $tSrc, $iX, $iY + $iH * 0.8, $iW, $iH * 0.2, 4)
            _Draw_Move($hContext, $tSrc, $iX, $iW, $iY + $iH * 0.1, $iY + $iH * 0.4, $iY + $iH * 0.9, $iIdx)

        Case 11 To 12, 23, 24 ;Word
            _Draw_XMM($hContext, $tSrc, $iX, $iY + $iH * 0.8, $iW, $iH * 0.2, 8)
            _Draw_Move($hContext, $tSrc, $iX, $iW, $iY + $iH * 0.1, $iY + $iH * 0.4, $iY + $iH * 0.9, $iIdx, 8)

        Case 18 ;Word->Dword
            _Draw_XMM($hContext, $tSrc, $iX, $iY + $iH * 0.8, $iW, $iH * 0.2, 8)
            _Draw_Move($hContext, $tSrc, $iX, $iW, $iY + $iH * 0.1, $iY + $iH * 0.4, $iY + $iH * 0.9, $iIdx, 8, 2)

        Case 13, 15 To 17, 21, 22 ;Byte
            _Draw_XMM($hContext, $tSrc, $iX, $iY + $iH * 0.8, $iW, $iH * 0.2, 16)
            _Draw_Move($hContext, $tSrc, $iX, $iW, $iY + $iH * 0.1, $iY + $iH * 0.4, $iY + $iH * 0.9, $iIdx, 16)

        Case 19, 20 ;Byte -> Word
            _Draw_XMM($hContext, $tSrc, $iX, $iY + $iH * 0.8, $iW, $iH * 0.2, 16)
            _Draw_Move($hContext, $tSrc, $iX, $iW, $iY + $iH * 0.1, $iY + $iH * 0.4, $iY + $iH * 0.9, $iIdx, 16, 2)

    EndSwitch

EndFunc   ;==>_Draw_Shuffle




Func _Draw_Move($hContext, $tSrc, $iX, $iW, $iY1, $iY2, $iY3, $iIdx, $iCnt = 4, $iCntM = 1)
    Local $fArrowW = Ceiling($iW * 0.0025)
    If $iW < 200 Then $fArrowW = 0.1
    Local $hPen = _GDIPlus_PenCreate(0x88000022, 1)
    Local $hBrush = _GDIPlus_BrushCreateSolid(0x55FFFFFF)
    Local $hPath = _GDIPlus_PathCreate()

    Local $fX1, $fX2, $fY, $iSrc, $iI
    For $i = $iCnt - 1 To 0 Step -1
        $fY = $iY1
        $iI = ($iCnt - $i)
        $fX2 = $iX + $iW / $iCnt * ($i + 0.5)

        $iSrc = DllStructGetData($tSrc, "Src", $iI) - 1
        If $iSrc < 0 Then ContinueLoop
        $fX1 = $iX + $iW / $iCnt * ($iCnt - (BitAND($iSrc, 0xF) * $iCntM + 0.5 * $iCntM))

        Switch $iIdx
            Case 1 To 13, 15, 16
                If BitAND($iSrc, 0xF0) Then ContinueLoop
            Case 14, 17 To 26 ;shufps
                If BitAND($iSrc, 0xF0) Then $fY = $iY2
        EndSwitch

        _GDIPlus_PathReset($hPath)
        _PathAddLine($hPath, $fX1, $fY, $fX2, $iY3, $fArrowW)
        _GDIPlus_GraphicsFillPath($hContext, $hPath, $hBrush)
        _GDIPlus_GraphicsDrawPath($hContext, $hPath, $hPen)
    Next

    _GDIPlus_PathDispose($hPath)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_PenDispose($hPen)
EndFunc   ;==>_Draw_Move




Func _PathAddLine($hPath, $iX1, $iY1, $iX2, $iY2, $fW = 1)
    Local $aResult = DllCall($_hMSVCRT, "double:cdecl", "atan2", "double", $iY2 - $iY1, "double", $iX2 - $iX1)
    Local $fA = $aResult[0]
    Local $iLen = Sqrt(($iX2 - $iX1) ^ 2 + ($iY2 - $iY1) ^ 2) - $fW * 3.6

    _GDIPlus_PathAddEllipse($hPath, $iX1 - $fW * 1.8, $iY1 - $fW * 1.8, $fW * 3.6, $fW * 3.6)

    _GDIPlus_PathAddLine($hPath, $iX1 + Cos($fA - $cPI2) * $fW, $iY1 + Sin($fA - $cPI2) * $fW, $iX1 + Cos($fA) * $iLen + Cos($fA - $cPI2) * $fW, $iY1 + Sin($fA) * $iLen + Sin($fA - $cPI2) * $fW)
    _GDIPlus_PathAddLine($hPath, $iX2 - Cos($fA + $cPI2 * 0.34) * $fW * 4.2, $iY2 - Sin($fA + $cPI2 * 0.34) * $fW * 4.2, $iX2, $iY2)
    _GDIPlus_PathAddLine($hPath, $iX2, $iY2, $iX2 - Cos($fA - $cPI2 * 0.34) * $fW * 4.2, $iY2 - Sin($fA - $cPI2 * 0.34) * $fW * 4.2)
    _GDIPlus_PathAddLine($hPath, $iX1 + Cos($fA) * $iLen + Cos($fA + $cPI2) * $fW, $iY1 + Sin($fA) * $iLen + Sin($fA + $cPI2) * $fW, $iX1 + Cos($fA + $cPI2) * $fW, $iY1 + Sin($fA + $cPI2) * $fW)

    _GDIPlus_PathWindingModeOutline($hPath)
EndFunc   ;==>_PathAddLine





Func _Calc_Src($tSrc, $tXMM2, $iIdx)
    Local $iVal

    Switch $iIdx
        Case 1 To 10, 14, 25 ;DWord
            For $i = 1 To 4
                $iVal = DllStructGetData($tXMM2, 1, ($i - 1) * 4 + 1) - 1
                DllStructSetData($tSrc, "Src", $iVal + 1, $i)
                DllStructSetData($tSrc, "Color", Mod($iVal, 16) + 1 + Floor($iVal / 16) * 8, $i)
            Next

        Case 26 ;punpckhdq
            For $i = 1 To 4
                $iVal = DllStructGetData($tXMM2, 1, ($i - 1) * 4 + 1) - 1
                DllStructSetData($tSrc, "Src", $iVal + 3, $i)
                DllStructSetData($tSrc, "Color", Mod($iVal, 16) + 1 + Floor($iVal / 16) * 8, $i)
            Next

        Case 24 ;punpckhwd
            For $i = 1 To 8
                $iVal = DllStructGetData($tXMM2, 1, ($i - 1) * 2 + 1) - 1
                DllStructSetData($tSrc, "Src", $iVal + 5, $i)
                DllStructSetData($tSrc, "Color", Mod($iVal, 16) + 1 + Floor($iVal / 16) * 8, $i)
            Next

        Case 11, 12, 18, 23, 24 ;Word
            For $i = 1 To 8
                $iVal = DllStructGetData($tXMM2, 1, ($i - 1) * 2 + 1) - 1
                DllStructSetData($tSrc, "Src", $iVal + 1, $i)
                DllStructSetData($tSrc, "Color", Mod($iVal, 16) + 1 + Floor($iVal / 16) * 8, $i)
            Next

        Case 13, 17 ;pshufb, palignr
            For $i = 1 To 16
                $iVal = DllStructGetData($tXMM2, 1, $i) - 1
                DllStructSetData($tSrc, "Src", $iVal + 1, $i)
                DllStructSetData($tSrc, "Color", Mod($iVal, 16) + 1, $i)
            Next

        Case 15, 16, 19, 20, 21 ;Byte
            For $i = 1 To 16
                $iVal = DllStructGetData($tXMM2, 1, $i) - 1
                DllStructSetData($tSrc, "Src", $iVal + 1, $i)
                DllStructSetData($tSrc, "Color", Mod($iVal, 16) + 1 + Floor($iVal / 16) * 8, $i)
            Next

        Case 22 ;Byte
            For $i = 1 To 16
                $iVal = DllStructGetData($tXMM2, 1, $i) - 1
                DllStructSetData($tSrc, "Src", $iVal + 9, $i)
                DllStructSetData($tSrc, "Color", Mod($iVal, 16) + 1 + Floor($iVal / 16) * 8, $i)
            Next

    EndSwitch


EndFunc   ;==>_Calc_Src




Func _Draw_XMM($hContext, $tSrc, $iX, $iY, $iW, $iH, $iCnt = 4, $iMin = 0, $iMax = 16, $iColorOff = 0)
    Local $hPen = _GDIPlus_PenCreate(0xFF000022, Ceiling($iH * 0.05))
    Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFFF0000)
    Local $hBrush2 = _GDIPlus_LineBrushCreate(0, $iY, 0, $iY + $iH, 0xCCFFFFFF, 0x00FFFFFF)

    Local $iI, $iColor
    For $i = $iCnt - 1 To 0 Step -1
        $iI = ($iCnt - $i)
        If $iI >= $iMin And $iI <= $iMax Then
            $iColor = DllStructGetData($tSrc, "Color", $iI + $iColorOff)
            If $iColor > 0 And $iColor < 17 Then
                _GDIPlus_BrushSetSolidColor($hBrush, $aColor[$iColor])
                _GDIPlus_GraphicsFillRect($hContext, $iX + ($iW / $iCnt * $i), $iY, $iW / $iCnt, $iH, $hBrush)
                _GDIPlus_GraphicsFillRect($hContext, $iX + ($iW / $iCnt * $i), $iY, $iW / $iCnt, $iH, $hBrush2)
            EndIf
        EndIf
        _GDIPlus_GraphicsDrawRect($hContext, $iX + ($iW / $iCnt * $i), $iY, $iW / $iCnt, $iH, $hPen)
    Next

    _GDIPlus_BrushDispose($hBrush2)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_PenDispose($hPen)
EndFunc   ;==>_Draw_XMM








Func _ASM_Shuf($tXMM0, $tXMM1, $tXMM2, $iMode, $iVal = 0)
    Local $bOPCode = "0x538B4424088B5C240C8B542410F30F6F00F30F6F0B"
    Switch $iMode
        Case 1
            $bOPCode &= "660F6FC1" ;movdqa
        Case 2
            $bOPCode &= "F30F10C1" ;movss
        Case 3
            $bOPCode &= "F20F10C1" ;movsd
        Case 4
            $bOPCode &= "F30F7EC1" ;movq
        Case 5
            If $tSSE.SSE3 Then
                $bOPCode &= "F20F12C1" ;MOVDDUP
            Else
                $bOPCode &= "660F70C144"
            EndIf
        Case 6
            $bOPCode &= "0F16C1" ;MOVLHPS
        Case 7
            $bOPCode &= "0F12C1" ;MOVHLPS
        Case 8
            If $tSSE.SSE3 Then
                $bOPCode &= "F30F12C1" ;MOVSLDUP
            Else
                $bOPCode &= "660F70C1A0"
            EndIf
        Case 9
            If $tSSE.SSE3 Then
                $bOPCode &= "F30F16C1" ;MOVSHDUP
            Else
                $bOPCode &= "660F70C1F5"
            EndIf
        Case 10
            $bOPCode &= "660F70C1" & Hex($iVal, 2) ;PSHUFD
        Case 11
            $bOPCode &= "F20F70C1" & Hex($iVal, 2) ;PSHUFLW
        Case 12
            $bOPCode &= "F30F70C1" & Hex($iVal, 2) ;PSHUFHW
        Case 13
            If $tSSE.SSSE3 Then
                $bOPCode &= "660F3800C1" ;PSHUFB
            Else
                For $i = 1 To 16
                    If DllStructGetData($tXMM1, 1, $i) <= 0x7F Then
                        DllStructSetData($tXMM2, 1, DllStructGetData($tXMM0, 1, BitAND(DllStructGetData($tXMM1, 1, $i), 0xF) + 1), $i)
                    Else
                        DllStructSetData($tXMM2, 1, 0, $i)
                    EndIf
                Next
                Return
            EndIf
        Case 14
            $bOPCode &= "0FC6C1" & Hex($iVal, 2) ;SHUFPS
        Case 15
            $bOPCode &= "660F73F8" & Hex($iVal, 2) ;PSLLDQ
        Case 16
            $bOPCode &= "660F73D8" & Hex($iVal, 2) ;PSRLDQ
        Case 17
            If $tSSE.SSSE3 Then
                $bOPCode &= "660F3A0FC1" & Hex($iVal, 2) ;PALIGNR
            Else
                $bOPCode &= "660F73D9" & Hex($iVal, 2) & "660F73F8" & Hex(16 - $iVal, 2) & "660FEBC1"
            EndIf
        Case 18
            $bOPCode &= "660F6BC1" ;PACKSSDW
        Case 19
            $bOPCode &= "660F63C1" ;PACKSSWB
        Case 20
            $bOPCode &= "660F67C1" ;PACKUSWB
        Case 21
            $bOPCode &= "660F60C1" ;PUNPCKLBW
        Case 22
            $bOPCode &= "660F68C1" ;PUNPCKHBW
        Case 23
            $bOPCode &= "660F61C1" ;PUNPCKLWD
        Case 24
            $bOPCode &= "660F69C1" ;PUNPCKHWD
        Case 25
            $bOPCode &= "660F62C1" ;PUNPCKLDQ
        Case 26
            $bOPCode &= "660F6AC1" ;PUNPCKHDQ
    EndSwitch
    $bOPCode &= "F30F7F025BC20C00"

    Local $iSize = BinaryLen($bOPCode)
    Local $tMem = DllStructCreate("byte[" & $iSize & "]; byte[16];")
    Local $pASM = Number(DllStructGetPtr($tMem))
    If Mod($pASM, 16) Then $pASM += 16 - Mod($pASM, 16)
    Local $tASM = DllStructCreate("byte[" & $iSize & "];", $pASM)
    DllStructSetData($tASM, 1, $bOPCode)
    DllCallAddress("none", $pASM, "struct*", $tXMM0, "struct*", $tXMM1, "struct*", $tXMM2)

EndFunc   ;==>_ASM_Shuf


Func _Check_SSE()
    Local $bOPCode = "0x539C5989C83500002000509D9C5831C87456B8010000000FA231C089D381E300000002C1EB1909D889D381E300000004C1EB1909D889CB83E301C1E30209D889CB81E300020000C1EB0609D889CB81E300000800C1EB0F09D889CB81E300001000C1EB0F09D8EB05B8FFFFFFFF5BC3"

    Local $iSize = BinaryLen($bOPCode)
    Local $tMem = DllStructCreate("byte[" & $iSize & "]; byte[16];")
    Local $pASM = Number(DllStructGetPtr($tMem))
    If Mod($pASM, 16) Then $pASM += 16 - Mod($pASM, 16)
    Local $tASM = DllStructCreate("byte[" & $iSize & "];", $pASM)
    DllStructSetData($tASM, 1, $bOPCode)

    Local $aResult = DllCallAddress("int", $pASM)

    Local $tSSE = DllStructCreate("byte SSE; byte SSE2; byte SSE3; byte SSSE3; byte SSE41; byte SSE42;")
    If $aResult[0] > 1 Then
        If BitAND($aResult[0], 0x1) Then $tSSE.SSE = 1
        If BitAND($aResult[0], 0x2) Then $tSSE.SSE2 = 1
        If BitAND($aResult[0], 0x4) Then $tSSE.SSE3 = 1
        If BitAND($aResult[0], 0x8) Then $tSSE.SSSE3 = 1
        If BitAND($aResult[0], 0x10) Then $tSSE.SSE41 = 1
        If BitAND($aResult[0], 0x20) Then $tSSE.SSE42 = 1
    EndIf

    Return $tSSE
EndFunc   ;==>_Check_SSE


Func WM_PAINT($hWnd, $iMsg, $wParam, $lParam)
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmp_Buffer, 0, 0)
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_PAINT


Func _Exit()
    _GDIPlus_GraphicsDispose($hGfx_BufferM)
    _GDIPlus_BitmapDispose($hBmp_BufferM)
    _GDIPlus_GraphicsDispose($hGfx_Buffer)
    _GDIPlus_BitmapDispose($hBmp_Buffer)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    GUIDelete($hGui)
    Exit
EndFunc   ;==>_Exit

 

Have fun with ASM respectively SSE / MMX. :D

 

Waiting for the result...

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • Moderators

I missed this topic back when it first came out, but wow what an effort. Highly impressed as always.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Yep, this version works on my Win10 x64 system as x64 / x86 but the older version from post#1 doesn't.

 

Looks cool with 500.000 stars / 15% CPU usage (4 cores) / @~35 fps... :thumbsup:

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...