View previous topic :: View next topic |
Author |
Message |
qazmlpok How do I cheat? Reputation: 0
Joined: 10 Jul 2016 Posts: 7
|
Posted: Sun Jul 10, 2016 11:47 am Post subject: How to draw text in-game (fullscreen) |
|
|
How do I go about drawing some simple text onto the game while it is running in fullscreen? This would require keeping the text visible at all times, and updating whenever the value changes.
I have the pointers dereferenced, both in the cheat engine window and in some simple LUA, but I can't find any concrete information on how to actually draw this text in-game. I found some info on a textOut function, but can't figure out how to actually use it (It's a nil reference).
Could I get help figuring out how to do this? Alternatively, if this is already done elsewhere, or a built-in feature of CE I just can't find, that'd work too. It seems like a common and simple enough operation that someone else must have done it first.
|
|
Back to top |
|
|
Redouane Master Cheater Reputation: 3
Joined: 05 Sep 2013 Posts: 363 Location: Algeria
|
Posted: Sun Jul 10, 2016 12:21 pm Post subject: Re: How to draw text in-game (fullscreen) |
|
|
qazmlpok wrote: | How do I go about drawing some simple text onto the game while it is running in fullscreen? This would require keeping the text visible at all times, and updating whenever the value changes.
I have the pointers dereferenced, both in the cheat engine window and in some simple LUA, but I can't find any concrete information on how to actually draw this text in-game. I found some info on a textOut function, but can't figure out how to actually use it (It's a nil reference).
Could I get help figuring out how to do this? Alternatively, if this is already done elsewhere, or a built-in feature of CE I just can't find, that'd work too. It seems like a common and simple enough operation that someone else must have done it first. |
If the game uses DirectX, then I believe that D3D Hooks are what you are looking for:
http://forum.cheatengine.org/viewtopic.php?t=552281
http://forum.cheatengine.org/viewtopic.php?t=553143
I've never used that feature, but I'll try to learn more about D3D soon (I'd like to know how it could be possible to record gameplay efficiently, to create in-game menus etc.)
[EDIT]
It works on some games, not on others: Tried it with:
Plague Inc Evolved : Working
Pro Evolution Soccer 2016 : Not Working (game freezes)
|
|
Back to top |
|
|
qazmlpok How do I cheat? Reputation: 0
Joined: 10 Jul 2016 Posts: 7
|
Posted: Sun Jul 10, 2016 6:54 pm Post subject: |
|
|
Can't get it to work. Trying it myself, removing most of the unneeded code (since I don't need an interactive menu) gives me:
Code: | d3dhook_initializeHook()
address = getAddress("DXHRDC.exe") + 0x1607B1C
address = readPointer(address)
address = readPointer(address)
address = readPointer(address + 0x44)
Option1=d3dhook_createTextContainer(fontmap,-1,50,'Value 1: ')
d3dhook_renderobject_setVisible(Option1, true)
function getValue()
local value1 = readInteger(address + 0x18)
local value2 = readInteger(address + 0x1c)
local font=createFont()
local fontmap=d3dhook_createFontmap(font)
-- print('Value 1 is ' .. value1)
d3dhook_textcontainer_setText(Option1,'Value 1: ' .. value1);
end
local t=createTimer(nil)
timer_onInterval(t, getValue)
timer_setInterval(t, 1000)
timer_setEnabled(t, true) |
Absolutely nothing happens when I try this. Trying without the timer doesn't change anything. The print confirms that the timer is running.
Running the example in the first link just gives me two rectangles in the center of the screen, with no text. So it has working image rendering, but the text is the only thing I really want.
That's from 4 years ago. Is it possible the text functions have changed since then?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Mon Jul 11, 2016 2:07 am Post subject: |
|
|
easiest to check if your game is supported is go to the d3d menu and set a custom crosshair.
if that one doesn't work then the game isn't supported.
also, sometimes it helps if you disable all extra graphics options like post filtering
_________________
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 |
|
|
qazmlpok How do I cheat? Reputation: 0
Joined: 10 Jul 2016 Posts: 7
|
Posted: Mon Jul 11, 2016 6:49 pm Post subject: |
|
|
Dark Byte wrote: | easiest to check if your game is supported is go to the d3d menu and set a custom crosshair.
if that one doesn't work then the game isn't supported.
also, sometimes it helps if you disable all extra graphics options like post filtering |
Crosshair shows up in-game.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Tue Jul 12, 2016 2:37 am Post subject: |
|
|
you are creating a textcontainer before you create a fontmap
the fontmap should come first
_________________
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 |
|
|
qazmlpok How do I cheat? Reputation: 0
Joined: 10 Jul 2016 Posts: 7
|
Posted: Tue Jul 12, 2016 9:56 pm Post subject: |
|
|
Code: | d3dhook_initializeHook()
address = getAddress("DXHRDC.exe") + 0x1607B1C
address = readPointer(address)
address = readPointer(address)
address = readPointer(address + 0x44)
font=createFont()
fontmap=d3dhook_createFontmap(font)
Option1=d3dhook_createTextContainer(fontmap,-1,50,'Value 1: ')
d3dhook_renderobject_setVisible(Option1, true)
function getValue()
local value1 = readInteger(address + 0x18)
local value2 = readInteger(address + 0x1c)
-- print('Value 1 is ' .. value1)
d3dhook_textcontainer_setText(Option1,'Value 1: ' .. value1);
end
local t=createTimer(nil)
timer_onInterval(t, getValue)
timer_setInterval(t, 1000)
timer_setEnabled(t, true)
|
Still nothing. Same if I remove the timer and call getValue() directly.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Wed Jul 13, 2016 5:06 am Post subject: |
|
|
Ok, there is an issue with fontmap generation in 6.5.1 which creates a fully transparent texture instead of a texture with text in it
_________________
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 |
|
|
qazmlpok How do I cheat? Reputation: 0
Joined: 10 Jul 2016 Posts: 7
|
Posted: Wed Jul 13, 2016 7:10 pm Post subject: |
|
|
So is this something I can change, or is it a problem with the current version of cheat engine?
I tried adding
Code: | Option1.Alphablend = 1.0
Option1.Visible = True |
but it didn't change anything. I honestly have no idea if those properties even exist.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Wed Jul 13, 2016 7:46 pm Post subject: |
|
|
it's an issue with the current ce version. (or more specifically lazarus) as every pixel in the fontmap has it's alpha value set to 0
you can use pictures where you write text and then use those as textures and show that on the screen, but they won't be translucent
_________________
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 |
|
|
qazmlpok How do I cheat? Reputation: 0
Joined: 10 Jul 2016 Posts: 7
|
Posted: Wed Jul 13, 2016 8:26 pm Post subject: |
|
|
Dark Byte wrote: | it's an issue with the current ce version. (or more specifically lazarus) as every pixel in the fontmap has it's alpha value set to 0
you can use pictures where you write text and then use those as textures and show that on the screen, but they won't be translucent |
That gives me dynamic text at least, right? How do I go about doing that?
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Thu Jul 14, 2016 6:23 am Post subject: |
|
|
This code will create a black box with blue text stating "My test message" at 100,100
Code: |
function setMessage(x,y,message, textColor, backgroundColor)
if h==nil then
h=createD3DHook()
end
if p then
p.destroy()
end
p=createPicture()
c=p.PNG.Canvas
c.Brush.Color=backgroundColor
c.Font.Color=textColor
p.PNG.Width=math.max(1,c.getTextWidth(message))
p.PNG.Height=math.max(1,c.getTextHeight(message))
c.textOut(0,0,message)
if not pt then
pt=h.createTexture(p)
else
pt.loadTextureByPicture(p)
end
if not ps then
ps=h.createSprite(pt)
else
ps.Width=pt.Width
ps.Height=pt.Height
end
ps.x=x
ps.y=y
ps.Visible=message~=""
end
setMessage(100,100,"My test message", 0xff0000, 0x000000)
|
_________________
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 |
|
|
qazmlpok How do I cheat? Reputation: 0
Joined: 10 Jul 2016 Posts: 7
|
Posted: Fri Jul 15, 2016 8:37 pm Post subject: |
|
|
That did it! Thank you!
|
|
Back to top |
|
|
|