|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
.lua Expert Cheater Reputation: 1
Joined: 13 Sep 2018 Posts: 189
|
Posted: Mon Jan 09, 2023 10:45 am Post subject: How does Lua declare C++ pointers and data structures |
|
|
POINT point; point.x = 100; point.y = 100;
As a parameter of c++, it should be:&point
Is the following declaration of lua correct
Code: | --Example 1
point={}
point.x=100
point.y=100
--Example 2
point=createMemoryStream()
point.writeDword(100)
point.writeDword(100) |
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 31
Joined: 16 Feb 2017 Posts: 1234
|
Posted: Mon Jan 09, 2023 11:18 am Post subject: |
|
|
I didn't quite understand what you wanted to do.
Sounds like you want to allocate memory for reading.
Here is a different (Similar) idea;
Code: | point=createMemoryStream() --{}
point.x=0x00000064
point.y=0x00000096
point.z=0x000000C8
print(point.z) --> 200
print(point.y) --> 150
print(point.x) --> 100 |
_________________
|
|
Back to top |
|
|
.lua Expert Cheater Reputation: 1
Joined: 13 Sep 2018 Posts: 189
|
Posted: Mon Jan 09, 2023 11:34 am Post subject: |
|
|
AylinCE wrote: | Sounds like you want to allocate memory for reading.
| This is an API function, where the parameters include pointer type and data structure
POINT point; point.x = 0; point.y = 0
SIZE size; size.cx = 500; size.cy = 500;
BLENDFUNCTION blend;
blend.BlendOp = AC_SRC_OVER;
blend.BlendFlags = 0;
blend.AlphaFormat = AC_SRC_ALPHA;
blend.SourceConstantAlpha = 255;
UpdateLayeredWindow(hwnd1, NULL, NULL, &size, mdc, &point, 0, &blend, ULW_ALPHA)
Refer to what the gods wrote,BLENDFUNCTION :(&blend)
Code: | function BLENDFUNCTION(alpha)
return byteTableToDword({0,0,alpha,0})
end |
The remaining parameters are pointer types(&size、&point), which I have a headache
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 31
Joined: 16 Feb 2017 Posts: 1234
|
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 138
Joined: 06 Jul 2014 Posts: 4275
|
Posted: Mon Jan 09, 2023 12:56 pm Post subject: |
|
|
Lua is a scripting language. It's not meant to be used as a low-level systems programming language.
You might be better off programming what you want in C using {$ccode} (autoAssemble w/ targetself = true)
https://forum.cheatengine.org/viewtopic.php?t=618134
Or write it in any language capable of building a dll and make a dll plugin.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Mon Jan 09, 2023 5:05 pm Post subject: Re: How does Lua declare C++ pointers and data structures |
|
|
.lua wrote: | POINT point; point.x = 100; point.y = 100;
As a parameter of c++, it should be:&point
Is the following declaration of lua correct
Code: | --Example 1
point={}
point.x=100
point.y=100
--Example 2
point=createMemoryStream()
point.writeDword(100)
point.writeDword(100) |
|
yes, that is correct. Point.Memory then contains the address of the point object
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
.lua Expert Cheater Reputation: 1
Joined: 13 Sep 2018 Posts: 189
|
Posted: Wed Jan 11, 2023 2:46 am Post subject: Re: How does Lua declare C++ pointers and data structures |
|
|
Dark Byte wrote: | yes, that is correct. Point.Memory then contains the address of the point object | I have written the parameters as required
The API function UpdateLayeredWindow still doesn't work
You can download the CT file and remove the suffix (.lua)
Description: |
|
Filesize: |
60.04 KB |
Viewed: |
2521 Time(s) |
|
Description: |
|
Download |
Filename: |
Test.CT.lua |
Filesize: |
275.27 KB |
Downloaded: |
76 Time(s) |
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Thu Jan 12, 2023 10:33 pm Post subject: |
|
|
Basic from your lua file attached. try this :
first, set this line "active'.
Code: | SetLayeredWindowAttributes(hWnd, 0xfffffff, 200, 1) |
execute the script, close your form and set this line to "non active"
Code: | ---SetLayeredWindowAttributes(hWnd, 0xfffffff, 200, 1) |
execute again the script.
script:
Code: | UDF1.FormStyle='fsSystemStayOnTop'
UDF1.Color = 0xfffffff
UDF1.OnMouseDown=function()
UDF1.DragNow()
end
function SetWindowLong(hWnd, nIndex, dwNewLong)
return executeCodeLocalEx("user32.SetWindowLongPtrA", hWnd, nIndex, dwNewLong)
end
function GetWindowLong(hWnd, GWL)
return executeCodeLocalEx("user32.GetWindowLongPtrA", hWnd, GWL)
end
function UpdateLayeredWindow(hwnd, hdcDst, pptDst, psize, hdcSrc, pptSrc, crKey, pblend, dwFlags)
return executeCodeLocalEx("user32.UpdateLayeredWindow", hwnd, hdcDst, pptDst, psize, hdcSrc, pptSrc, crKey, pblend, dwFlags)
end
function SetLayeredWindowAttributes(hwnd, crKey, bAlpha, dwFlags)
return executeCodeLocalEx("user32.SetLayeredWindowAttributes", hwnd, crKey, bAlpha, dwFlags)
end
---------------------------------------------------------------------------------
GWL_EXSTYLE = -20
GWL_STYLE = -16
WS_EX_LAYERED = 524288
ULW_COLORKEY = 1
ULW_ALPHA = 2
LWA_COLORKEY = 1
LWA_ALPHA = 2
LWA_BOTH = 3
hWnd=UDF1.Handle
HDC1=UDF1.Canvas.Handle
HDC2=UDF1.CEImage1.Canvas.Handle
function setBlend(alpha) return byteTableToDword({0,0,alpha,0}) end
pptDst = createMemoryStream()
pptDst.writeDword(UDF1.Left)
pptDst.writeDword(UDF1.Top)
psize = createMemoryStream()
psize.writeDword(200)
psize.writeDword(200)
pptSrc = createMemoryStream()
pptSrc.writeDword(0)
pptSrc.writeDword(0)
Attrib = GetWindowLong(UDF1.handle, GWL_EXSTYLE)
SetWindowLong(UDF1.handle, GWL_EXSTYLE, attrib or WS_EX_LAYERED)
--SetLayeredWindowAttributes(hWnd, 0xfffffff, 200, 1)
UpdateLayeredWindow(hWnd, HDC1, pptDst.Memory, psize.Memory, HDC2, pptSrc.Memory, 0, setBlend(200), ULW_ALPHA)
UDF1.Show()
|
So, according to MS, UpdateLayeredWindow only work to a form which the LAYERED has been SET.
Description: |
|
Filesize: |
59.51 KB |
Viewed: |
2399 Time(s) |
|
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
.lua Expert Cheater Reputation: 1
Joined: 13 Sep 2018 Posts: 189
|
Posted: Fri Jan 13, 2023 9:13 pm Post subject: |
|
|
Corroder wrote: | Basic from your lua file attached. try this :
first, set this line "active'.
Code: | SetLayeredWindowAttributes(hWnd, 0xfffffff, 200, 1) |
So, according to MS, UpdateLayeredWindow only work to a form which the LAYERED has been SET. | Once SetLayeredWindowAttributes is used, the UpdateLayeredWindow function cannot be used.
So before calling the function, I added the form style code.
Look at the picture:
But it only has transparency, not heteromorphic forms, and no shadow rendering((There seems to be something missing))
Description: |
|
Filesize: |
98.44 KB |
Viewed: |
2303 Time(s) |
|
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Sat Jan 14, 2023 6:40 am Post subject: |
|
|
this line :
Code: |
function GetWindowLong(hWnd, nIndex)
return executeCodeLocalEx("user32.GetWindowLongA", hWnd, X)
end
--- change nIndex to something...X, Blabla or what ever
-- and then
HDC2=UDF1.CEImage1.Canvas.Handle
--- should be --> HDC2=UDF1.CEImage1.Picture.Bitmap.Canvas.Handle
--- and then
psize = createMemoryStream()
psize.writeDword(300)
psize.writeDword(300)
--- should be
psize = createMemoryStream()
psize.writeDword(UDF1.CEImage1.Picture.Bitmap.Width)
psize.writeDword(UDF1.CEImage1.Picture.Bitmap.Height)
-- also try
UpdateLayeredWindow(hWnd, HDC1, pptDst.Memory, psize.Memory, HDC2, pptSrc.Memory, 0, setBlend(225), 2)
-- change that default ULW_ALPHA = 2, to 1 or 3, to see the effect
|
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
.lua Expert Cheater Reputation: 1
Joined: 13 Sep 2018 Posts: 189
|
Posted: Sat Jan 14, 2023 10:16 am Post subject: |
|
|
Corroder wrote: | this line : | God, I have succeeded. Thank you so much
1, 3 and 4 in the figure have been corrected successfully after being reminded by you.
Why can't the position of 2 in the figure be 0.
Since it is successful, it is naturally used as a background form, so how to move two forms at the same time
Description: |
|
Filesize: |
101.12 KB |
Viewed: |
2238 Time(s) |
|
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Sat Jan 14, 2023 7:41 pm Post subject: |
|
|
Quote: | Why can't the position of 2 in the figure be 0. |
According to MS ;
Code: | BOOL UpdateLayeredWindow(
[in] HWND hWnd,
[in, optional] HDC hdcDst,
[in, optional] POINT *pptDst,
[in, optional] SIZE *psize,
[in, optional] HDC hdcSrc,
[in, optional] POINT *pptSrc,
[in] COLORREF crKey,
[in, optional] BLENDFUNCTION *pblend,
[in] DWORD dwFlags
); |
Code: | [in, optional] pptSrc
Type: POINT*
A pointer to a structure that [b]specifies the location of the layer[/b] in the device context. If hdcSrc is NULL, pptSrc should be NULL. |
And this one is OPTIONAL
Quote: | so how to move two forms at the same time |
Try this :
Code: | if f1 or f2 then f1.Destroy() f2.Destroy() end
f1 = createForm()
f1.Caption = "Form1"
f2 = createForm()
f2.Caption = "Form2"
f2.Left = f1.Left + f1.Width + 5
function MoveTwoForms(Frm1, Frm2)
if (Frm1 == nil) or (Frm2 == nil) then return nil end
f2.Left = f1.Left + f1.Width + 5
f2.Top = f1.Top
end
function mv()
MoveTwoForms(f1, f2)
end
if t then t.destroy() end
t = createTimer()
t.Interval = 10
t.Enabled = false
t.OnTimer = mv
f1.OnMouseDown = function()
t.Enabled = true
f1.dragNow()
end
f1.OnMouseUp = function()
t.Enabled = false
end |
Try to modify the code. Add a sequence if the forms lost focus then set timer enabled to false to avoid error.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
.lua Expert Cheater Reputation: 1
Joined: 13 Sep 2018 Posts: 189
|
Posted: Sat Jan 14, 2023 11:11 pm Post subject: |
|
|
Corroder wrote: | Try to modify the code. Add a sequence if the forms lost focus then set timer enabled to false to avoid error. | I think this method is ideal (there is no trace when dragging at least two forms)
Description: |
|
Filesize: |
794.75 KB |
Viewed: |
2160 Time(s) |
|
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|