Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Background image... again...

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions
View previous topic :: View next topic  
Author Message
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 206

PostPosted: Sun Oct 11, 2020 7:18 am    Post subject: Background image... again... Reply with quote

This has been asked a few times already in this forum; just trying to 'extend' this further more.
Goal is to achieve this: [ https://imgur.com/a/YICRitP ].

I came this far by combining following:
a. Compact view mode: [ https://forum.cheatengine.org/viewtopic.php?t=570055 ]
b. Adding background pic: [ https://www.cheatengine.org/forum/viewtopic.php?p=5580329&sid=fcb8285bdd7601456cc41d29aca09531 ]

At first, I tried to tackle the issue, using feedback pt b.; but was not getting anywhere. So I took on another item from my todo-list: compact view (something I've seen other authors using in their tables), which evt brought me to pt a.
This weekend I decided to give this another go, and realised I could probably build on top of the 'compact view' info. So after some experimenting, I learned 'trial& error'-wise that:
1. most of the objects in the CE gui seem to be Panel objects; with the 'addresslist' being 'Panel1'.
2. It does work with a bckgrnImage, apart from the fact that we probably have a 'transparancy' issue here. I found in a Stackoverflow topic, that you can not "edit/change" that property in the Panel object, but must do it in the Form object.
As for the transparancy issue: notice the "light-blue-ish" lines at top/bottom of addresslist; and image partly showing in the 'memory scan options' panel (?).

Anyways: I seem to be moving in the right direction, but currently lack experience (and time) to dig further...

ps: ignore the "crappy" fontstyle; this is a pure/quick photoshop editing job (in order to remove the white background)
ps2: if it would ever come to a 'wish/optionlist':
a. fields transparent, or not
b. only specific memoryrecord(s): i'm thinking here about a "header/footer" image only.
c. autofill/resize: adapts to gui-resizing.
Back to top
View user's profile Send private message
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Sun Oct 11, 2020 12:13 pm    Post subject: Reply with quote

Review this to get started;

https://forum.cheatengine.org/viewtopic.php?t=615397


Last edited by ByTransient on Fri Oct 30, 2020 8:46 am; edited 1 time in total
Back to top
View user's profile Send private message
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 206

PostPosted: Tue Oct 13, 2020 12:52 am    Post subject: fyi Reply with quote

^ thx for that; it will be helpfull... eventually.
Back to top
View user's profile Send private message
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 206

PostPosted: Sat Oct 17, 2020 2:49 am    Post subject: some progress... Reply with quote

got this far now: [ https://imgur.com/a/LKXQGsQ ]

pic1:
I could not immediately get a grasp on what was what in the ce gui, so did a print-out of all its components (window left). since the addresslist (al) had my focus, the last 2 entries gave me its component list...
basically: the next (final ?) objective would be to get the 'List' transparent somehow...
note: in order to "remove" the 'al', I did a 'al.Destroy()' (which makes the table unsaveable thereafter, fyi)

pic2: as I was researching this, I realised I could add a footer banner (of sorts). but rather then using 'panel 4' for this purpose, I added a new panel at the bottom to achieve that goal (which is the one right above CE's footer)

ps: you can have a look at the code below; or download my AC BF table @FRF (you do not need that game to see its effect; and it also makes use of the 'Compact View mode' routine ~ which basically initiated this little project)
ps2: do not forget to check out the links in the 1st post; as it explains - among others - how to add the image(s) to your table. keep in mind that these will be added "physically" to the table, so keep them as small-sized as possible ! fe: the original footer image is around 45 Kb; but then 'saved for web ~ photoshop-ed' to get a 9 Kb pic... and btw: i'm planning to get its height reduced to 30px to make it even smaller...
ps3: anyone happens to know if there is a visual representation of the gui out there, "linking" its respective components/objects?! I'm getting the feeling that this would be very handy...


[code]
-- adding image footer to gui...
-- google: "cheat engine Adding a background picture"
local sImgName = 'FearlessRev_Footer.png'
local sImgName2 = 'ACBF_reg_ed_Cover.jpg'

local ceForm = getMainForm()
local compCount = ceForm.getComponentCount()

for i=0,compCount-1 do
print(string.format('[%03d]: %s',i,ceForm.getComponent(i).getName()))
end

local al = getAddressList()
print(al.getOwner())
print(al.getParent())
print(al.getName())
local alCount = al.getComponentCount()
for i=0,alCount-1 do
print(string.format('[%03d]: %s',i,al.getComponent(i).getName()))
end

setProperty(ceForm,'AlphaBlendValue','240')

function attachBackground(wc,tblFile)
local p = createPicture()
p.loadFromStream(findTableFile(tblFile).Stream)
wc.OnPaint = function(sender)
local c = sender.getCanvas()
local bitmap = p.getBitmap()
local width = wc.width
-- centering image...
width = (width /2) - (bitmap.Width /2) -- image width
c.draw(width,0,bitmap)
end
end

function addImgFooter(tblFile)
if ImgFooter then return end
local p = createPicture()
p.loadFromStream(findTableFile(tblFile).Stream)
local bitmap = p.getBitmap()
MPanelImg = createPanel(getMainForm())
MPanelImg.width,MPanelImg.top,MPanelImg.left = 10,0,10
-- get panel height based on img_height...
MPanelImg.Height = bitmap.Height + 2
MPanelImg.Align = alBottom
MPanelImg.Caption = 'FearlessRevolution'
ImgFooter = 'yes'
end

addImgFooter(sImgName)
attachBackground(MPanelImg,sImgName)
attachBackground(getMainForm().Panel1,sImgName2)
[/code]
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sat Oct 17, 2020 5:14 am    Post subject: Reply with quote

My simple style:

Code:
List = getAddressList()
control_setColor(wincontrol_getControl(List), 16436871)
xlist = wincontrol_getControl(List)
if bg then bg.Destroy() end
bg = createImage(xlist)
bg.setSize(150,150)
bg.Left = 380
bg.Top = 20
bg.Stretch = true
bg.Picture.loadFromStream(findTableFile('bg1.png').Stream)
bg.Anchors = 'akRight, akBottom'


Result as attached image



Capture.JPG
 Description:
Batman on CE Addresslist
 Filesize:  70.21 KB
 Viewed:  4925 Time(s)

Capture.JPG



_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 206

PostPosted: Sat Oct 17, 2020 6:34 am    Post subject: bingo... batman Reply with quote

^ that's more like it Cool

I also like the color-pic combo; which can reduce "table-size" increase considerably. I have not tried it out yet, but will be working on this in the next couple of days. big thx !
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Sat Oct 17, 2020 7:07 am    Post subject: This post has 1 review(s) Reply with quote

Corroder wrote:
My simple style:

Code:
List = getAddressList()
control_setColor(wincontrol_getControl(List), 16436871)
xlist = wincontrol_getControl(List)
if bg then bg.Destroy() end
bg = createImage(xlist)
bg.setSize(150,150)
bg.Left = 380
bg.Top = 20
bg.Stretch = true
bg.Picture.loadFromStream(findTableFile('bg1.png').Stream)
bg.Anchors = 'akRight, akBottom'


Result as attached image


Try anchor the image on [akTop,akLeft]
First ever see your cheat running ;P ie. the image is not the list actual bg.

_________________
- Retarded.
Back to top
View user's profile Send private message
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 206

PostPosted: Sat Oct 17, 2020 9:07 am    Post subject: feedback... Reply with quote

@Corroder: my bad, but not quite there... yet. the image in question sits at the front; meaning as soon as one expands the cheat table (options), they'll "sit/show" behind the picture. I tried also with SendToBack() and some transparency 'options' I had found in other articles; but still no cigar...

btw: another option I will now look into as well, is adding a panel on the left (or right) side (in analogy with 'footer') as done by some trainers. not my preference as it will also increase the gui's window size.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Sat Oct 17, 2020 10:16 am    Post subject: This post has 1 review(s) Reply with quote

Here, put script on AA script. I added a button to control the bg image. You can set the transparency too.

Code:
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
{$lua}

function TBlendFunction(SourceConstantAlpha)
  return byteTableToDword({0,0,SourceConstantAlpha,1})
end

function getCanvasHandle(canvas)
  canvas.getPixel(0,0)
  return readPointerLocal(userDataToInteger(canvas)+0xc8)
end


function setAlphaBlend(hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest,
                       hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, blendFunction)
 return executeCodeLocalEx("msimg32.AlphaBlend",
                            hdcDest, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest,
                            hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, blendFunction)
end

function setOpacity(src, alpha, tblfile)
 if pngImage or tmpImage then
    pngImage.destroy()
    tmpImage.destroy()
  end
 pngImage = createImage(nil)
 ch = string.sub(tblfile, -4)
 if ch == '.jpg' or ch == '.JPG' or ch == '.Jpg' then
    pngImage.Picture.Jpeg.loadFromStream(findTableFile(tblfile).Stream)
 else
    pngImage.Picture.PNG.loadFromStream(findTableFile(tblfile).Stream)
 end

 tmpImage = createImage(nil)
 local width  = pngImage.Picture.Bitmap.Width
 local height = pngImage.Picture.Bitmap.Height
 tmpImage.Picture.Bitmap.PixelFormat = pf32bit
 tmpImage.Picture.Bitmap.Width  = width
 tmpImage.Picture.Bitmap.Height = height

 setAlphaBlend(getCanvasHandle(tmpImage.Picture.Bitmap.Canvas), 0, 0, width, height,
               getCanvasHandle(pngImage.Picture.Bitmap.Canvas), 0, 0, width, height,
               TBlendFunction(alpha))

 src.Picture.assign(tmpImage.Picture)
 src.repaint()
 pngImage.destroy()
 tmpImage.destroy()
end


function bg_Toggle(sender)
 bg.Visible = false
 control_onClick(btn1, bg_Toggle_Off)
end

function bg_Toggle_Off(sender)
 bg.Visible = true
 control_onClick(btn1, bg_Toggle)
end

---------------------------------------------------------------------
Main = getMainForm()
List = getAddressList()
--control_setColor(wincontrol_getControl(List), 16436871)

xlist = wincontrol_getControl(List)
ListFont = control_getFont(List);
ListFont.Color = 0xffffff
ListFont.Size = 10

bg = createImage(xlist)
bg.Align = 'alClient'
bg.Stretch = true
bg.Picture.loadFromStream(findTableFile('bg1.jpg').Stream)
bg.Anchors = 'akLeft, akTop, akRight, akBottom'
setOpacity(bg, 180, 'bg1.jpg')

bpnl = createPanel(Main)
bpnl.Height = 13
bpnl.Caption = ''
bpnl.Align = 'alBottom'

btn1 = createButton(bpnl)
btn1.Width = 80
btn1.Height = 22
btn1.Top = -5
btn1.Left = 10
btn1.Caption = 'BG Control'
btn1.onClick = bg_Toggle

{$asm}

[DISABLE]
//code from here till the end of the code will be used to disable the cheat

{$lua}
bpnl.Destroy()
bg.Destroy()
btn1.Destroy()
{$asm}


@Panraven, I have changed the script



Capture.JPG
 Description:
BG on address list with control
 Filesize:  41.36 KB
 Viewed:  4882 Time(s)

Capture.JPG



_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 206

PostPosted: Sun Oct 18, 2020 7:15 am    Post subject: image still in front? Reply with quote

^ unless I'm doing something wrong here, the image still sits in front of the addresslist. and opacity is applied to the image itself. even more: the image itself "blocks" access to the cheat_entries (in the back); I suppose that is the reason why you've added the button.
while the code is quite impressive, the solution is not practical from a user perspective. I'm looking for a "solid" (non-obstructive) image in the background, with obviously the addresslist/cheats sitting on top...

fyi: this feature has hardly any added value (cheat-wise), just trying to make it more "appealing" to the user. i'm also active on another gaming forum; and when I suggest to go for a CE table, quite a few of them gamers are reluctant to use it "for it being intimidating" (and I dig that). The CompactView mode (see above link) is already an excellent "appetizer"; the Footer banner great for branding oneself - as I call it Cool - and a background image would be the icing on the cake.
or iow: unless you want to take this on as a challenge, do not go overboard for me. what I'll be doing in the coming weeks - months probably - is revisiting CEF, and reading anything I can find on transparency. and obviously, suggestions are always welcome.
(I'm obviously referring to the amount of code you've presented sofar; can't even imagine the time - research, coding & testing - you've spent on this)
Back to top
View user's profile Send private message
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 206

PostPosted: Mon Oct 19, 2020 5:14 am    Post subject: white color transparency... Reply with quote

see post midpage: [ https://forum.cheatengine.org/viewtopic.php?p=5638711#5638711 ]

no idea how to try this out (and no ambition nor inclination to learn pascal)... ? that said: addresslist seems to have white background... always...?

ps: tried out referenced examples, but these all apply to the UDF1 form
(stands for...: UserDataForm1 ? <- just guession here)

-EDIT-
evt found '.ClassName' property for each object, starting from main form:
TMainForm ~ ceForm window
TPanel ~ panel1
TAddresslist ~ addresslist
TTreeviewWithScroll ~ addresslist.List
THeaderControl ~ addresslist.Header

Googled for 'TreeviewWithScroll' (which evt gave me 'TreeView Styles and Templates'): .Net stuff; and no idea how this could be "translated" back to CE...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites