Bentschi,
Previously you posted a link to the .ahk file. Is that pointing to your most recent changes? I like to see the underlying code.
Relayer
Bentschi,
Previously you posted a link to the .ahk file. Is that pointing to your most recent changes? I like to see the underlying code.
Relayer
thanks Bentschi, i ran a few quick tests with different C code inputs and it looks like it works. if i find any more problems, i'll let you know.Update:
- fixed parse-errors in the generator (thanks guest3456 and Lexicos)
- Added Optimization "None" and "Default" in the generator
i've removed index2.php and replaced index.php with it.
Now the working generator is at http://bentschi.no-ip.org/mcode/ like before
;// new MCode function, modified to work with both AHK_L and AHK_Basic ;// http://www.autohotkey.com/board/topic/89283-mcode-function-onlinegenerator-x86-and-x64 MCode(mcode) { static e1 := 4, e2 := 1 static c c := (A_PtrSize=8) ? "x64" : "x86" ptr := A_PtrSize ? "Ptr" : "UInt" if (!regexmatch(mcode, "^([0-9]+),(" c ":|.*?," c ":)([^,]+)", m)) return if (!DllCall("crypt32\CryptStringToBinary", "str", m3, "uint", 0, "uint", e%m1%, ptr, 0, "uint*", s, ptr, 0, ptr, 0)) return p := DllCall("GlobalAlloc", "uint", 0, ptr, s, ptr) if (c="x64") DllCall("VirtualProtect", ptr, p, ptr, s, "uint", 0x40, "uint*", op) if (DllCall("crypt32\CryptStringToBinary", "str", m3, "uint", 0, "uint", e%m1%, ptr, p, "uint*", s, ptr, 0, ptr, 0)) return p DllCall("GlobalFree", ptr, p) }edit/
Bentschi,
Previously you posted a link to the .ahk file. Is that pointing to your most recent changes? I like to see the underlying code.
Relayer
The actual code can be found here: http://bentschi.no-i...e/mcodegen2.ahk
BTW: 542 MCodes are generated since the first post
Does the generator support includes? I am working on a function that used a CDC object. When I simply use, #include "afkwin.h" The generated output gets all garbled. Example:
Generated output:
A DllCall on either function will return A_Blank
Scripts are written and tested using AHK_H 64w (unless otherwise specified).
CFlyout. EasyIni. Dynamic Label Execution (No Reload). Word Lookup.
Like guest3456 said, it's more or less only for fast math calcs.
You cannot create a whole MFC app using this generator, but you can use allmost all WinAPI functions if the required DLLs are loaded.
If you compile your code, you get an error in the log.
I have no idea how to get this to work.
Edit: Statistics: 1053 codes are generated with the generator since the first post
BTW, I'd like to thank you Bentschi for such great work.
I suppose I have myself generated ~50 codes. hehe
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Antonio França -- git.io -- github.com -- ahk4.net -- sites.google.com -- ahkscript.org
Member of the AHK community since 08/Apr/2009. Moderator since mid-2012.
Thank you, but i have to say, that the generator would not be what it is without...
http://www.autohotke...ode-into-mcode/
...and all who helped (also in this thread).
Like guest3456 said, it's more or less only for fast math calcs.
You cannot create a whole MFC app using this generator, but you can use allmost all WinAPI functions if the required DLLs are loaded.
If you compile your code, you get an error in the log.
I have no idea how to get this to work.
Edit: Statistics: 1053 codes are generated with the generator since the first post
Understood. Thanks for the help, and great work!
Scripts are written and tested using AHK_H 64w (unless otherwise specified).
CFlyout. EasyIni. Dynamic Label Execution (No Reload). Word Lookup.
Something odd is going on here...
I'm entering this C code into the generator and it outputs results different from when I run it through my offline generator (the one you based this off). They're using identical switches but the output's different.
C code:
int Gdip_PixelSearch(int * Foundx, int * Foundy, unsigned char * hScan, unsigned char * NeedleColors, int NumColors, int hStride, int sx1, int sy1, int sx2, int sy2, int v, int sd) { int y1, x1, idxH, idxColor, idxN; if ( sd == 1 ) { // [default] top->left->right->bottom (vertical preference) for (y1 = sy1; y1 < sy2; y1++) { for (x1 = sx1; x1 < sx2; x1++) { idxH = (4*x1)+(y1*hStride); // haystack index offset for (idxColor = 0; idxColor < NumColors; idxColor++) { idxN = idxColor * 4; if ( ( NeedleColors[idxN+2] <= hScan[idxH+2]+v && NeedleColors[idxN+2] >= hScan[idxH+2]-v && NeedleColors[idxN+1] <= hScan[idxH+1]+v && NeedleColors[idxN+1] >= hScan[idxH+1]-v && NeedleColors[idxN+0] <= hScan[idxH+0]+v && NeedleColors[idxN+0] >= hScan[idxH+0]-v ) ) { Foundx[0] = x1; Foundy[0] = y1; return 0; } } } } } Foundx[0] = -1; Foundy[0] = -1; return -7001; }
It wouldn't let me add it but this is the results from the online/offline generation: https://ahknet.autoh...om/paste/trsu4d
RSeding, are you sure the optimization switches are correct in your offline generator? when i tried to use your offline generator the /O switches were broken, i mentioned it in a post here:
http://www.autohotke...mcode/?p=572690
if i remember correctly, your generator always used /Ox switch regardless of which radio was chosen. and i believe /Ox corresponds to 'Default' optimization on the online generator. whereas /O1 and /O2 are for size and speed respectively (but in some cases, those switches over-optimize for me and result in non working code)
Yeah I used the default optimization for the online one as well as the offline one.
what i'm saying is that the optimizations for the offline one were broken iirc
It's hardcoded to default "/Ox". It's still not the same as the online one when set to default (/Ox).