Beiträge von UEZ
-
-
Scheint eventuell ein Bug zu sein, denn die globale Variable $mUnit ist nicht vollständig in der Funktion _WM_DRAWITEM sichtbar, selbst wann man aus der _WM_DRAWITEM Funktion eine andere Function aufruft.
Kanashius die Farbe wird dann für alle gesetzt und nicht nach "Access".
-
Ich denke, dass Musashi recht hat für MP3 Dateien, denn laut ChatGPT
Zitatwenn du mehrere MP3-Dateien programmatisch zu einer einzigen Datei zusammenfügen möchtest, gibt es einige Dinge zu beachten:
1. Gleiche Audioeigenschaften
- Alle MP3-Dateien sollten dieselbe Bitrate, Sample-Rate und Kanäle (Mono/Stereo) haben, um Qualitätsverluste oder unerwartete Verzerrungen zu vermeiden.
- Falls die Dateien unterschiedliche Formate haben, musst du sie zuerst umwandeln (z. B. mit ffmpeg).
2. Metadaten & ID3-Tags
- Beim Zusammenfügen können ID3-Tags verloren gehen oder vermischt werden. Es ist ratsam, die Metadaten nach dem Zusammenfügen neu zu setzen.
3. Frames korrekt verbinden
- MP3-Dateien bestehen aus Frames. Ein einfaches Aneinanderhängen von Dateien kann zu hörbaren Störungen führen, falls nicht sauber geschnitten wird.
- Programme wie ffmpeg oder sox können die Dateien korrekt ohne Fehler zusammenführen.
4. Korrekte Methoden zum Zusammenfügen
- Mit ffmpeg (empfohlen):
- Falls das nicht funktioniert, kann man die Dateien erst in eine Textdatei schreiben:
was plausibel klingt.
-
Scheint so zu funzen:
AutoIt
Alles anzeigen;Coded by UEZ build 2025-27-02 beta #include <WinAPIFiles.au3> #include <WinAPIHObj.au3> #include <Array.au3> #include <File.au3> Global $aMP3Files = _FileListToArray("c:\Audio Files\MP3\", "*.mp3", $FLTA_FILES, True) ;Pfad anpassen! MergeFiles($aMP3Files, "c:\Temp\Test.mp3") ;Pfad anpassen! Func MergeFiles($aFiles, $sOutputFilename) Local $aFileSizes[$aFiles[0]][2], $i, $iTotalSize = 0 For $i = 0 To UBound($aFileSizes) - 1 $aFileSizes[$i][0] = FileGetSize($aFiles[$i + 1]) $iTotalSize += $aFileSizes[$i][0] Next Local $hFile = _WinAPI_CreateFile($sOutputFilename, 1, 4), $hFileChunk, $iRead, $iBytes, $pos Local $tMem = DllStructCreate("ubyte data[" & $iTotalSize & "]") $aFileSizes[0][1] = DllStructCreate("ubyte part[" & $aFileSizes[0][0] & "]", DllStructGetPtr($tMem)) $hFileChunk = _WinAPI_CreateFile($aFiles[1], 2, 2) _WinAPI_ReadFile($hFileChunk, $aFileSizes[0][1], $aFileSizes[0][0], $iRead) _WinAPI_CloseHandle($hFileChunk) $pos = $aFileSizes[0][0] For $i = 1 To UBound($aFileSizes) - 1 $aFileSizes[$i][1] = DllStructCreate("ubyte part[" & $aFileSizes[$i][0] & "]", DllStructGetPtr($tMem) + $pos + 1) $pos += $aFileSizes[$i][0] $hFileChunk = _WinAPI_CreateFile($aFiles[$i + 1], 2, 2) _WinAPI_ReadFile($hFileChunk, $aFileSizes[$i][1], $aFileSizes[$i][0], $iRead) _WinAPI_CloseHandle($hFileChunk) Next _WinAPI_WriteFile($hFile, $tMem, $iTotalSize, $iBytes) _WinAPI_CloseHandle($hFile) EndFuncNatürlich sollte das Array mit den Files entsprechend sortiert sein, aber das überlasse ich Moombas.

-
Wenn die Dateien, die zusammengesetzt werden sollen, nicht riesig sind, dann kannst du doch die Dateien in eine Struct laden und dann die Struct in einer Datei speichern.
Du müsstest dann n Pointer auf die gesamte Struct erstellen und sie dann mit _WinAPI_ReadFile() für die n Dateien nutzen.
Zumindest so die Theorie...
-
Egal wie ausgeklügelt man da heran geht, umso mehr Malware mit AutoIt-Code geschrieben und genutzt wird (sei es nur Spiele-Cracks), umso häufiger werden die Virenscan-Hersteller diese Signaturen auch in ihre Datenbanken mit aufnehmen.
Genau auch meine Meinung, falls diese Möglichkeit besser funktioniert, dauert es bestimmt nicht lange, bis sie Kriminelle für ihre eigene Zwecke missbrauchen und die Mühe war umsonst.
Ich weiß nicht seit wann, aber Windows Defender klassifiziert auch *.au3 Files als Trojaner!
Code
Alles anzeigenMicrosoft Defender Antivirus has detected malware or other potentially unwanted software. For more information please see the following: https://go.microsoft.com/fwlink/?linkid=37020&name=Trojan:AutoIt/Prcablt.SD!MTB&threatid=2147740918&enterprise=1 Name: Trojan:AutoIt/Prcablt.SD!MTB ID: 2147740918 Severity: Severe Category: Trojan Path: containerfile:_C:\Coding\AU3\Internet\Mp3SearchEngine\Mp3SearchEngine v1.0.8.8.au3; containerfile:_C:\Coding\AU3\Tools\WallpaperBank\WallpaperBank v1.0.2.0.au3; file:_C:\Coding\AU3\Internet\Mp3SearchEngine2\Mp3SearchEngine_v2.0.1.1.au3; file:_C:\Coding\AU3\Internet\Mp3SearchEngine\Mp3SearchEngine v1.0.8.8.au3->(UTF-8); file:_C:\Coding\AU3\SystemInfo\CompStats\Computer Stats Utility 2.0.2.0.au3; file:_C:\Coding\AU3\Tools\HTML Imager\HTML Imager v1.0.1.1.au3; file:_C:\Coding\AU3\Tools\HTML Imager\HTML Imager v1.0.1.2.au3; file:_C:\Coding\AU3\Tools\HTML Imager\HTML Imager v1.0.1.3.au3; file:_C:\Coding\AU3\Tools\ImageSplitter\ImageSplitter v1.0.0.7.au3; file:_C:\Coding\AU3\Tools\Mp3SearchEngine\Mp3SearchEngine v1.0.9.2.au3; file:_C:\Coding\AU3\Tools\WallpaperBank\WallpaperBank v1.0.2.0.au3->(UTF-8); file:_C:\Coding\AU3\Video\XvidCapture\BackUp\XvidCapture v1.0.1.6_old1.au3; file:_C:\Coding\AU3\Video\XvidCaptur Detection Origin: Local machine Detection Type: Concrete Detection Source: System User: NT AUTHORITY\SYSTEM Process Name: C:\Programme\Editor\Notepad3\Notepad3.exe Security intelligence Version: AV: 1.421.1531.0, AS: 1.421.1531.0, NIS: 1.421.1531.0 Engine Version: AM: 1.1.24090.11, NIS: 1.1.24090.11Bin gespannt, wann *.a3x als Malware erkannt werden...
-
Versuche es mal damit:
AutoIt;Kontextmenü - benutzerdefiniert Global $w_editBoxProcNew = DllCallbackRegister("_MyWindowProc", "ptr", "hwnd;uint;wparam;lparam") Global $w_editBoxProcOld = _WinAPI_SetWindowLong(GUICtrlGetHandle($idEdit_notiz), $GWL_WNDPROC, DllCallbackGetPtr($w_editBoxProcNew)) ;_WinAPI_SetWindowLong(GUICtrlGetHandle($idEdit_notiz), $GWL_WNDPROC, DllCallbackGetPtr($w_editBoxProcNew))Frohes Neues!
-
Ein in AutoIt eingebauter C-Compiler wäre schon fein wenn das als "Abfallprodukt" hinten raus fällt.
Das gibt es auch - ein Inline C Compiler von Ward -> https://www.autoitscript.com/forum/topic/16…-call-in-autoit
-
Man kann auch die DLLs in das Skript integrieren (Base64) und per MemCall() aufrufen, somit würde das Weitergeben der DLL entfallen. Rust scheint ja echt kleine DLLs im Gegensatz zu Freebasic zu generieren, sodass das Integrieren nicht unnötig den Code aufbläht. Freebasic ist anscheinden wie mein Bauch...

Das Aktualisieren wäre sicherlich auch einfacher, als mit dem ASM Code.
Andy kleine Doktorarbeit zum Thema Assembler gepostet

Ich persönlich vergesse sehr schnell das Programmieren in ASM und mir fällt es schwer wieder rein zu kommen. Bei dir ist das anscheinend in Fleisch und Blut übergegangen.

-
Cool, bin nur drübergeflogen, aber wie das aussieht, ist der "clevere" Teil von dir geschrieben. Zeig mal bitte den Freebasic-code.
Den ASM Code hat der Compiler gebastelt - der FB Code ist simpel:
Code
Alles anzeigen#ifdef __FB_64BIT__ #cmdline "-RR -m Sum64 -dll -export -gen gcc -Wc -Ofast -Wc -march=native -Wc -funroll-loops -Wc -mfpmath=sse" #else #cmdline "-RR -m Sum -dll -export -gen gcc -Wc -Ofast -Wc -march=native -Wc -funroll-loops -Wc -mfpmath=sse" #endif Extern "Windows-MS" Function SumF(tStruct As Double Ptr, iLen As ULong) As Single Export Dim As Single fSum = 0 For i As ULong = 0 To iLen - 1 fSum += tStruct[i] Next Return fSum End Function Function SumD(tStruct As Double Ptr, iLen As ULong) As Double Export Dim As Double fSum = 0 For i As ULong = 0 To iLen - 1 fSum += tStruct[i] Next Return fSum End Function End ExternMan kann auch die Optimierung ausschalten, damit mehr Kompatibilität ensteht, aber zugunsten der Geschwindigkeit.
Hui und wie mache ich daraus einen in AutoIt verwendbaren Binärcode?
Gar nicht. Wenn ich ein Float-array habe dann soll der Float-Code verwendet werden. Gemischt wird natürlich nicht.
Ansonsten möchte ich ja eben keine Dlls dazulegen, sondern das bewusst intern im AutoIt-Code selbst mitliefern.
Aber danke schonmal Jungs. Wusste doch, dass ich die Spezis damit anfixe.
Ich muss mal checken, wie man aus dem Code ein Binär Code erstellt, sodass man ihn einfach per DLLCallAddress aufruft.
Wie du in der Funktion SumF sehen kannst, ist innerhalb der Funktion die Variable fSum als Single (Float) definiert, d.h. die Summe ist anders als mit Double, deshalb meine Nachfrage.
-
Das ist der optimierte x64 ASM Output vom Compiler:
Code
Alles anzeigen.file "Sum.c" .intel_syntax noprefix .text /APP .section .drectve .ascii " -export:\"SumF\"" .ascii " -export:\"SumD\"" .text /NO_APP .p2align 4 .globl SumF .def SumF; .scl 2; .type 32; .endef .seh_proc SumF SumF: .seh_endprologue vxorps xmm0, xmm0, xmm0 mov eax, 1 dec edx vcvtsd2ss xmm0, xmm0, QWORD PTR [rcx] mov r8d, edx and r8d, 7 cmp edx, 1 jb .L42 test r8d, r8d je .L2 cmp r8d, 1 je .L28 cmp r8d, 2 je .L29 cmp r8d, 3 je .L30 cmp r8d, 4 je .L31 cmp r8d, 5 je .L32 cmp r8d, 6 jne .L44 .L33: mov r9d, eax vcvtss2sd xmm3, xmm0, xmm0 inc eax vaddsd xmm4, xmm3, QWORD PTR [rcx+r9*8] vcvtsd2ss xmm0, xmm4, xmm4 .L32: mov r10d, eax vcvtss2sd xmm5, xmm0, xmm0 inc eax vaddsd xmm0, xmm5, QWORD PTR [rcx+r10*8] vcvtsd2ss xmm0, xmm0, xmm0 .L31: mov r11d, eax vcvtss2sd xmm1, xmm0, xmm0 inc eax vaddsd xmm2, xmm1, QWORD PTR [rcx+r11*8] vcvtsd2ss xmm0, xmm2, xmm2 .L30: mov r8d, eax vcvtss2sd xmm3, xmm0, xmm0 inc eax vaddsd xmm4, xmm3, QWORD PTR [rcx+r8*8] vcvtsd2ss xmm0, xmm4, xmm4 .L29: mov r9d, eax vcvtss2sd xmm5, xmm0, xmm0 inc eax vaddsd xmm0, xmm5, QWORD PTR [rcx+r9*8] vcvtsd2ss xmm0, xmm0, xmm0 .L28: mov r10d, eax vcvtss2sd xmm1, xmm0, xmm0 inc eax vaddsd xmm2, xmm1, QWORD PTR [rcx+r10*8] vcvtsd2ss xmm0, xmm2, xmm2 cmp edx, eax jb .L42 .L2: mov r11d, eax vcvtss2sd xmm3, xmm0, xmm0 lea r8d, 1[rax] lea r9d, 2[rax] vaddsd xmm4, xmm3, QWORD PTR [rcx+r11*8] lea r10d, 3[rax] lea r11d, 4[rax] vcvtsd2ss xmm5, xmm4, xmm4 vcvtss2sd xmm0, xmm5, xmm5 vaddsd xmm1, xmm0, QWORD PTR [rcx+r8*8] lea r8d, 5[rax] vcvtsd2ss xmm2, xmm1, xmm1 vcvtss2sd xmm3, xmm2, xmm2 vaddsd xmm4, xmm3, QWORD PTR [rcx+r9*8] lea r9d, 6[rax] vcvtsd2ss xmm5, xmm4, xmm4 vcvtss2sd xmm0, xmm5, xmm5 vaddsd xmm1, xmm0, QWORD PTR [rcx+r10*8] lea r10d, 7[rax] add eax, 8 vcvtsd2ss xmm2, xmm1, xmm1 vcvtss2sd xmm3, xmm2, xmm2 vaddsd xmm4, xmm3, QWORD PTR [rcx+r11*8] vcvtsd2ss xmm5, xmm4, xmm4 vcvtss2sd xmm0, xmm5, xmm5 vaddsd xmm1, xmm0, QWORD PTR [rcx+r8*8] vcvtsd2ss xmm2, xmm1, xmm1 vcvtss2sd xmm3, xmm2, xmm2 vaddsd xmm4, xmm3, QWORD PTR [rcx+r9*8] vcvtsd2ss xmm5, xmm4, xmm4 vcvtss2sd xmm0, xmm5, xmm5 vaddsd xmm1, xmm0, QWORD PTR [rcx+r10*8] vcvtsd2ss xmm0, xmm1, xmm1 cmp edx, eax jnb .L2 .L3: .L42: ret .p2align 4 .p2align 3 .L44: vcvtss2sd xmm1, xmm0, xmm0 vaddsd xmm2, xmm1, QWORD PTR 8[rcx] mov eax, 2 vcvtsd2ss xmm0, xmm2, xmm2 jmp .L33 .seh_endproc .p2align 4 .globl SumD .def SumD; .scl 2; .type 32; .endef .seh_proc SumD SumD: .seh_endprologue lea r8d, -1[rdx] cmp edx, 6 jbe .L50 lea r9d, -2[rdx] vmovups xmm1, XMMWORD PTR [rcx] mov r10d, 1 shr r9d lea eax, 1[r9] and r9d, 7 cmp eax, 1 jbe .L125 test r9d, r9d je .L47 cmp r9d, 1 je .L105 cmp r9d, 2 je .L106 cmp r9d, 3 je .L107 cmp r9d, 4 je .L108 cmp r9d, 5 je .L109 cmp r9d, 6 je .L110 vaddpd xmm1, xmm1, XMMWORD PTR 16[rcx] mov r10d, 2 .L110: mov r11, r10 inc r10 sal r11, 4 vaddpd xmm1, xmm1, XMMWORD PTR [rcx+r11] .L109: mov r8, r10 inc r10 sal r8, 4 vaddpd xmm1, xmm1, XMMWORD PTR [rcx+r8] .L108: mov r9, r10 inc r10 sal r9, 4 vaddpd xmm1, xmm1, XMMWORD PTR [rcx+r9] .L107: mov r11, r10 inc r10 sal r11, 4 vaddpd xmm1, xmm1, XMMWORD PTR [rcx+r11] .L106: mov r8, r10 inc r10 sal r8, 4 vaddpd xmm1, xmm1, XMMWORD PTR [rcx+r8] .L105: mov r9, r10 inc r10 sal r9, 4 vaddpd xmm1, xmm1, XMMWORD PTR [rcx+r9] cmp eax, r10d jbe .L125 .L47: mov r11, r10 mov r8, r10 mov r9, r10 sal r11, 4 sal r8, 4 sal r9, 4 vaddpd xmm0, xmm1, XMMWORD PTR [rcx+r11] mov r11, r10 sal r11, 4 vaddpd xmm2, xmm0, XMMWORD PTR 16[rcx+r8] mov r8, r10 sal r8, 4 vaddpd xmm3, xmm2, XMMWORD PTR 32[rcx+r9] mov r9, r10 sal r9, 4 vaddpd xmm4, xmm3, XMMWORD PTR 48[rcx+r11] mov r11, r10 sal r11, 4 vaddpd xmm5, xmm4, XMMWORD PTR 64[rcx+r8] mov r8, r10 add r10, 8 sal r8, 4 vaddpd xmm1, xmm5, XMMWORD PTR 80[rcx+r9] vaddpd xmm0, xmm1, XMMWORD PTR 96[rcx+r11] vaddpd xmm1, xmm0, XMMWORD PTR 112[rcx+r8] cmp eax, r10d ja .L47 .L125: vunpckhpd xmm2, xmm1, xmm1 add eax, eax vaddpd xmm0, xmm2, xmm1 cmp edx, eax je .L126 vaddsd xmm0, xmm0, QWORD PTR [rcx+rax*8] .L49: .L126: ret .p2align 4 .p2align 3 .L50: mov edx, r8d vmovsd xmm0, QWORD PTR [rcx] mov r10d, 1 and edx, 7 cmp r8d, 1 jb .L126 test edx, edx je .L46 cmp edx, 1 je .L99 cmp edx, 2 je .L100 cmp edx, 3 je .L101 cmp edx, 4 je .L102 cmp edx, 5 je .L103 cmp edx, 6 je .L104 vaddsd xmm0, xmm0, QWORD PTR 8[rcx] mov r10d, 2 .L104: mov eax, r10d inc r10d vaddsd xmm0, xmm0, QWORD PTR [rcx+rax*8] .L103: mov r9d, r10d inc r10d vaddsd xmm0, xmm0, QWORD PTR [rcx+r9*8] .L102: mov r11d, r10d inc r10d vaddsd xmm0, xmm0, QWORD PTR [rcx+r11*8] .L101: mov edx, r10d inc r10d vaddsd xmm0, xmm0, QWORD PTR [rcx+rdx*8] .L100: mov eax, r10d inc r10d vaddsd xmm0, xmm0, QWORD PTR [rcx+rax*8] .L99: mov r9d, r10d inc r10d vaddsd xmm0, xmm0, QWORD PTR [rcx+r9*8] cmp r8d, r10d jb .L126 .L46: mov r11d, r10d lea edx, 1[r10] lea eax, 2[r10] lea r9d, 3[r10] vaddsd xmm3, xmm0, QWORD PTR [rcx+r11*8] lea r11d, 4[r10] vaddsd xmm4, xmm3, QWORD PTR [rcx+rdx*8] lea edx, 5[r10] vaddsd xmm5, xmm4, QWORD PTR [rcx+rax*8] lea eax, 6[r10] vaddsd xmm1, xmm5, QWORD PTR [rcx+r9*8] lea r9d, 7[r10] add r10d, 8 vaddsd xmm0, xmm1, QWORD PTR [rcx+r11*8] vaddsd xmm2, xmm0, QWORD PTR [rcx+rdx*8] vaddsd xmm3, xmm2, QWORD PTR [rcx+rax*8] vaddsd xmm0, xmm3, QWORD PTR [rcx+r9*8] cmp r8d, r10d jnb .L46 jmp .L126 .seh_endprocx86:
Code
Alles anzeigen.intel_syntax noprefix .section .text .balign 16 .globl _DllMain@12 _DllMain@12: push ebp mov ebp, esp sub esp, 4 mov dword ptr [ebp-4], 0 .L_0004: mov dword ptr [ebp-4], 1 cmp dword ptr [ebp+12], 1 jne .L_0006 push 0 push 0 call _main add esp, 8 .L_0006: .L_0005: mov eax, dword ptr [ebp-4] mov esp, ebp pop ebp ret 12 .balign 16 .globl _SumF _SumF: push ebp mov ebp, esp sub esp, 16 push ebx mov dword ptr [ebp-4], 0 .L_0007: push dword ptr [_Lt_000E] pop dword ptr [ebp-8] mov dword ptr [ebp-12], 0 mov eax, dword ptr [ebp+12] add eax, 4294967295 mov dword ptr [ebp-16], eax jmp .L_000A .L_000D: fld dword ptr [ebp-8] mov eax, dword ptr [ebp-12] sal eax, 3 mov ebx, dword ptr [ebp+8] add ebx, eax fadd qword ptr [ebx] fstp dword ptr [ebp-8] .L_000B: inc dword ptr [ebp-12] .L_000A: mov ebx, dword ptr [ebp-16] cmp dword ptr [ebp-12], ebx jbe .L_000D .L_000C: push dword ptr [ebp-8] pop dword ptr [ebp-4] .L_0008: fld dword ptr [ebp-4] pop ebx mov esp, ebp pop ebp ret 8 .balign 16 .globl _SumD _SumD: push ebp mov ebp, esp sub esp, 24 push ebx mov dword ptr [ebp-8], 0 mov dword ptr [ebp-4], 0 .L_000F: push dword ptr [_Lt_0016] push dword ptr [_Lt_0016+4] pop dword ptr [ebp-12] pop dword ptr [ebp-16] mov dword ptr [ebp-20], 0 mov eax, dword ptr [ebp+12] add eax, 4294967295 mov dword ptr [ebp-24], eax jmp .L_0012 .L_0015: mov eax, dword ptr [ebp-20] sal eax, 3 mov ebx, dword ptr [ebp+8] add ebx, eax fld qword ptr [ebx] fadd qword ptr [ebp-16] fstp qword ptr [ebp-16] .L_0013: inc dword ptr [ebp-20] .L_0012: mov ebx, dword ptr [ebp-24] cmp dword ptr [ebp-20], ebx jbe .L_0015 .L_0014: push dword ptr [ebp-16] push dword ptr [ebp-12] pop dword ptr [ebp-4] pop dword ptr [ebp-8] .L_0010: fld qword ptr [ebp-8] pop ebx mov esp, ebp pop ebp ret 8 .balign 16 _main: push ebp mov ebp, esp and esp, 0xFFFFFFF0 sub esp, 12 mov dword ptr [ebp-4], 0 call ___main push 0 push dword ptr [ebp+12] push dword ptr [ebp+8] call _fb_Init@12 .L_0002: .L_0003: mov eax, dword ptr [ebp-4] mov esp, ebp pop ebp ret .section .data .balign 4 _Lt_000E: .long 0x00000000 .balign 8 _Lt_0016: .quad 0x0000000000000000 .section .drectve .ascii " -export:SumF" .ascii " -export:SumD"x64:
Code
Alles anzeigen.file "Sum.c" .intel_syntax noprefix .text .globl SumF .def SumF; .scl 2; .type 32; .endef .seh_proc SumF SumF: push rbp .seh_pushreg rbp mov rbp, rsp .seh_setframe rbp, 0 sub rsp, 16 .seh_stackalloc 16 .seh_endprologue mov QWORD PTR 16[rbp], rcx mov DWORD PTR 24[rbp], edx lea rax, -16[rbp] mov DWORD PTR [rax], 0 .L2: pxor xmm0, xmm0 movss DWORD PTR -4[rbp], xmm0 mov DWORD PTR -8[rbp], 0 mov eax, DWORD PTR 24[rbp] sub eax, 1 mov DWORD PTR -12[rbp], eax jmp .L3 .L10: nop .L4: cvtss2sd xmm1, DWORD PTR -4[rbp] mov eax, DWORD PTR -8[rbp] sal rax, 3 mov rdx, rax mov rax, QWORD PTR 16[rbp] add rax, rdx movsd xmm0, QWORD PTR [rax] addsd xmm0, xmm1 cvtsd2ss xmm0, xmm0 movss DWORD PTR -4[rbp], xmm0 .L5: mov eax, DWORD PTR -8[rbp] add eax, 1 mov DWORD PTR -8[rbp], eax .L3: mov eax, DWORD PTR -8[rbp] cmp eax, DWORD PTR -12[rbp] jbe .L10 nop .L6: movss xmm0, DWORD PTR -4[rbp] movss DWORD PTR -16[rbp], xmm0 nop .L7: movss xmm0, DWORD PTR -16[rbp] add rsp, 16 pop rbp ret .seh_endproc .globl SumD .def SumD; .scl 2; .type 32; .endef .seh_proc SumD SumD: push rbp .seh_pushreg rbp mov rbp, rsp .seh_setframe rbp, 0 sub rsp, 32 .seh_stackalloc 32 .seh_endprologue mov QWORD PTR 16[rbp], rcx mov DWORD PTR 24[rbp], edx lea rax, -24[rbp] mov QWORD PTR [rax], 0 .L12: pxor xmm0, xmm0 movsd QWORD PTR -8[rbp], xmm0 mov DWORD PTR -12[rbp], 0 mov eax, DWORD PTR 24[rbp] sub eax, 1 mov DWORD PTR -16[rbp], eax jmp .L13 .L20: nop .L14: mov eax, DWORD PTR -12[rbp] sal rax, 3 mov rdx, rax mov rax, QWORD PTR 16[rbp] add rax, rdx movsd xmm0, QWORD PTR [rax] movsd xmm1, QWORD PTR -8[rbp] addsd xmm0, xmm1 movsd QWORD PTR -8[rbp], xmm0 .L15: mov eax, DWORD PTR -12[rbp] add eax, 1 mov DWORD PTR -12[rbp], eax .L13: mov eax, DWORD PTR -12[rbp] cmp eax, DWORD PTR -16[rbp] jbe .L20 nop .L16: movsd xmm0, QWORD PTR -8[rbp] movsd QWORD PTR -24[rbp], xmm0 nop .L17: movsd xmm0, QWORD PTR -24[rbp] add rsp, 32 pop rbp ret .seh_endproc /APP .section .drectve .ascii " -export:\"SumF\"" .ascii " -export:\"SumD\"" .text -
Da ich mich erst stundenlang in ASM einarbeiten muss, um eine simple Addition durchzuführen, lasse ich Andy den Vorrang, zumal das Ergebnis wesentlich besser sein dürfte, aber hier die DLL Version, falls Interesse besteht:
Code
Alles anzeigen#AutoIt3Wrapper_UseX64=n $hDLL = DllOpen(@AutoItX64 ? "Sum64.dll" : "Sum.dll") $len = 900000 Global $tData = DllStructCreate("DOUBLE x[" & $len & "]") $sum = 0 ; füllen For $i = 1 To $len $tData.x(($i)) = 1 / $i $sum += $tData.x(($i)) Next ConsoleWrite("AutoIt sum: " & $sum & @CRLF) ConsoleWrite("----------------" & @CRLF) $aReturnF = DllCall($hDll, "float", "SumF", "struct*", $tData, "ulong", $len) ConsoleWrite("DLL sum float: " & $aReturnF[0] & @CRLF) $aReturnD = DllCall($hDll, "double", "SumD", "struct*", $tData, "ulong", $len) ConsoleWrite("DLL sum double: " & $aReturnD[0] & @CRLF) DllClose($hDLL)Im Anhang die zwei DLLs.
Die DLL habe ich in Freebasic geschrieben.
Btw, wie soll bei der Float summiert werden, wenn du ein Double Array übergibst? Soll Float summiert werden oder Double? Das Ergebnis ist natürlich Float.
-
-
Glückwunsch an Tweaky

-
Nice. Danke fürs Teilen.
Hast du den DLL Code in Rust geschrieben?
-
Die nächste Tipprunde (Europameisterschaft) ist nun am Start. Wer will kann hier mitmachen: https://www.kicktipp.de/autoit-em-wm/. Einfach kostenlos registrieren, tippen und Spaß haben.

Am 14.6. geht's los.
Viel Glück!

-
Man(n) kann auch GDI+ benutzen, um die Textur auf die Kugel zu projizieren.
Beispiel:
C
Alles anzeigen#include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit Global Const $iW = @DesktopWidth * 0.75, $iH = $iW * 10 / 16, $fRad = ACos(-1) / 180, $sTitle = "GDI+ Test" AutoItSetOption("GUIOnEventMode", 1) GDIPlus_BallTest() AutoItSetOption("GUIOnEventMode", 0) _GDIPlus_Shutdown() Func GDIPlus_BallTest() $bExit = False $hGUI = GUICreate($sTitle, $iW, $iH) GUISetState(@SW_SHOW, $hGUI) ;create canvas elements Local Const $hDC = _WinAPI_GetDC($hGUI) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) _GDIPlus_GraphicsSetInterpolationMode($hCanvas, $GDIP_INTERPOLATIONMODE_NEARESTNEIGHBOR) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HALF) Local Const $hBrush_Clr = _GDIPlus_BrushCreateSolid(0xFF000000), _ $hBrush_FPS = _GDIPlus_BrushCreateSolid(0xFFF0F0F0), _ $hFormat_FPS = _GDIPlus_StringFormatCreate(), _ $hFamily_FPS = _GDIPlus_FontFamilyCreate("Arial"), _ $hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 8), _ $tLayout_FPS = _GDIPlus_RectFCreate(0, 0, 60, 16), _ $hImage_Ball = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\13h_310x156.bmp") , _ $hMatrix = _GDIPlus_MatrixCreate() Local $aDim = _GDIPlus_ImageGetDimension($hImage_Ball) Local Const $hTexture_Ball = _GDIPlus_TextureCreate($hImage_Ball) Local $iDiameter = $aDim[0] < $aDim[1] ? $aDim[0] : $aDim[1], _ $fDiameter2 = $iDiameter / 2, _ $fDX = 0, $fDY = 0 $iFPS = 0 GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") AdlibRegister("CalcFPS", 1000) Local $iStep = 5, $vx = Random(), $vy = Random() Do _GDIPlus_GraphicsClear($hCanvas, 0xFF006600) DllCall($__g_hGDIPDll, "int", "GdipTranslateTextureTransform", "ptr", $hTexture_Ball, "float", $vx * 1.57, "float", $vy * 1.57, "long", 0) For $i = 1 To $fDiameter2 Step $iStep $fScale = 1 + $i / $fDiameter2 DllCall($__g_hGDIPDll, "int", "GdipSetMatrixElements", "handle", $hMatrix, "float", 1.0, "float", 0.0, "float", 0.0, "float", 1.0, "float", 0.0, "float", 0.0) DllCall($__g_hGDIPDll, "int", "GdipTranslateMatrix", "handle", $hMatrix, "float", $fDX + $fDiameter2, "float", $fDY + $fDiameter2, "int", 0) DllCall($__g_hGDIPDll, "int", "GdipScaleMatrix", "handle", $hMatrix, "float", $fScale, "float", $fScale, "int", 0) DllCall($__g_hGDIPDll, "int", "GdipTranslateMatrix", "handle", $hMatrix, "float", -$fDiameter2, "float", -$fDiameter2, "int", 0) DllCall($__g_hGDIPDll, "int", "GdipSetWorldTransform", "handle", $hCanvas, "handle", $hMatrix) DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hCanvas, "handle", $hTexture_Ball, _ "float", $i, "float", $i, "float", $iDiameter -2 * $i, "float", $iDiameter - 2 * $i) Next $fDX += $vx $fDY += $vy If $fDX + $iDiameter > $iW Or $fDX < 0 Then $vx = -$vx If $fDY + $iDiameter > $iH Or $fDY < 0 Then $vy = -$vy DllCall($__g_hGDIPDll, "int", "GdipSetMatrixElements", "handle", $hMatrix, "float", 1.0, "float", 0.0, "float", 0.0, "float", 1.0, "float", 0.0, "float", 0.0) DllCall($__g_hGDIPDll, "int", "GdipSetWorldTransform", "handle", $hCanvas, "handle", $hMatrix) _GDIPlus_GraphicsDrawStringEx($hCanvas, "FPS: " & $iShowFPS, $hFont_FPS, $tLayout_FPS, $hFormat_FPS, $hBrush_FPS) ;draw background message text _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hDC_backbuffer, 0, 0, $SRCCOPY) ;blit drawn bitmap to GUI $iFPS += 1 If $bExit Then ExitLoop Until False ;Not Sleep(10) AdlibUnRegister("CalcFPS") ;release resources _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_ImageDispose($hImage_Ball) _GDIPlus_BrushDispose($hTexture_Ball) _GDIPlus_FontDispose($hFont_FPS) _GDIPlus_FontFamilyDispose($hFamily_FPS) _GDIPlus_StringFormatDispose($hFormat_FPS) _GDIPlus_BrushDispose($hBrush_Clr) _GDIPlus_BrushDispose($hBrush_FPS) _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hGUI, $hDC) GUIDelete($hGUI) EndFunc ;==>GDIPlus_BallTest Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func CalcFPS() ;display FPS $iShowFPS = $iFPS $iFPS = 0 EndFunc ;==>CalcFPSDer Kern des Codes ist aus dem "Rotating Earth" Beispiel, irgendwann hier im Forum gepostet...
Hier der FB Code + Exe.
-
Vielen Dank AspirinJunkie

Das Ganze läuft in Autoit ziemlich langsam ab (liegt in der Natur von Autoit) und mir kommt es vor, dass die Projektion des Bildes auf die Kugel nicht richtig aussieht, aber ich ziehe mir mal deine Mathematik rein. Bin sehr eingerostet, was Vektoren angeht.
Ich habe den FB Code ein wenig frisiert und allen 15 Kugeln Texturen verpasst, die entsprechend dem Bewegungsvektor angezeigt werden, leider nicht physikalisch immer korrekt. Ich habe eukalyptus ' ASM Sinus / Cosinus verwendet, was zu einem echten Performance Boost gebracht hat. Der Flaschenhals waren Trigonometrie aufrufe in der MapImage2Sphere() Funktion.
OneDrive: https://1drv.ms/f/s!AiLeZOpaFqSayCvkcMeBwRcp9ySN?e=qYN7qU (Simple 2D Ball Collision - Billiard Opening5.bas / .exe + die Bitmap Dateien 1-15).
Schade, dass du dich nicht mit FB anfreunden wirst / kannst / willst! Irgendwie gefällt mir die Sprache besser als Autoit.
-
Wenn es um die Windows API geht, kannst du bei MS die Informationen finden: https://learn.microsoft.com/en-us/windows/…parametersinfow
Dort ist im Prinzip alles dokumentiert und kann auch in Autoit angewendet werden. C Kenntnisse sind von Vorteil.
Einfach mit dem Thema beschäftigen und man bekommt langsam ein Gefühl dafür.
-
Ich habe weitere Funktionen portiert (siehe Anhang).
Hier ein weiteres Beispiel.
AutoIt
Alles anzeigen;Coded by UEZ build 2024-03-29 beta #AutoIt3Wrapper_UseX64=y #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPIGdi.au3> #include "Cairo.au3" AutoItSetOption('MustDeclareVars', 1) Global Const $fPi = ACos(-1), $fRad = $fPi / 180, $fDeg = 180 / $fPi, $f2PI = $fPi * 2 Global Const $iW = 960, $iH = 540, $sTitle = "Cairo Test (" & (@AutoItX64 ? "64" : "32") & " Bit) / FPS: " Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit AutoItSetOption("GUIOnEventMode", 1) Cairo_Example() AutoItSetOption("GUIOnEventMode", 0) Func Cairo_Example() If Not Cairo_Init() Then ConsoleWrite(@error & @CRLF) Exit EndIf Local $iStride = Cairo_GetStride($iW) $hGUI = GUICreate($sTitle & "0", $iW, $iH) Local Const $hDC = _WinAPI_GetDC($hGUI) Local Const $hGfxDC = _WinAPI_CreateCompatibleDC($hDC) Local $tBIV5HDR = DllStructCreate($tagBITMAPV5HEADER) DllStructSetData($tBIV5HDR, 'bV5Size', DllStructGetSize($tBIV5HDR)) DllStructSetData($tBIV5HDR, 'bV5Width', $iW) DllStructSetData($tBIV5HDR, 'bV5Height', -$iH) DllStructSetData($tBIV5HDR, 'bV5Planes', 1) DllStructSetData($tBIV5HDR, 'bV5BitCount', 32) DllStructSetData($tBIV5HDR, 'biCompression', $BI_RGB) Local $pBits Local $hBitmapGDI = _WinAPI_CreateDIBSection($hGfxDC, $tBIV5HDR, $DIB_RGB_COLORS, $pBits) Local Const $hObjOld = _WinAPI_SelectObject($hGfxDC, $hBitmapGDI) GUISetState(@SW_SHOW, $hGUI) $bExit = False GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") AdlibRegister("CalcFPS", 1000) Local $pSurface = Cairo_Image_CreateForData($pBits, $iW, $iH, $iStride) Local $pContext = Cairo_Context_Create($pSurface) Local $tMatrix = DllStructCreate($tagCairo_matrix) $tMatrix.x0 = $iW / 2 $tMatrix.y0 = $iH / 2 Local $t, $tt = 1 / 15, $b, $i, $q, $t1 Do For $i = 50 To 1 Step -1 $q = $i / 3 $b = Sin($i / 9 - $t) $t1 = $q * Sin($b) $tMatrix.xx = $q * Cos($b) $tMatrix.yx = $t1 $tMatrix.xy = -$t1 $tMatrix.yy = $tMatrix.xx Cairo_Context_Transform($pContext, $tMatrix) Cairo_SetColor($pContext, 1 - 1 / ($i / 4)) Cairo_FillRectangle($pContext, -48, -48, 96, 96) Cairo_Context_ResetIdentity($pContext) Next _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hGfxDC, 0, 0, $SRCCOPY) $t += $tt $iFPS += 1 If $bExit Then ExitLoop Until Not Sleep(10) Cairo_Context_Destroy($pContext) Cairo_Surface_Destroy($pSurface) _WinAPI_SelectObject($hGfxDC, $hObjOld) _WinAPI_ReleaseDC($hGUI, $hDC) _WinAPI_DeleteDC($hGfxDC) _WinAPI_DeleteObject($hBitmapGDI) GUIDelete($hGUI) Cairo_Close() EndFunc Func _Exit() $bExit = True EndFunc ;==>_Exit_About Func CalcFPS() ;display FPS $iShowFPS = $iFPS $iFPS = 0 WinSetTitle($hGUI, "", $sTitle & $iShowFPS) EndFunc ;==>CalcFPSIch habe massiv die UDF geändert, d.h. die UDF im 1. Post wird nicht funktionieren und die UDF im Anhang unten kann noch viele Copy/Paste oder andere Fehler beinhalten! Die DLL kann im 1. Post heruntergeladen werden.
Habt ihr Lust Beispiele zu erstellen? Dann bitte hier Posten.

Etliche Funktionen sind noch nicht portiert, aber ich arbeite daran...
Happy Ostern!