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 


D3D Text Color

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
AntonVit
Advanced Cheater
Reputation: 0

Joined: 25 Jan 2014
Posts: 73

PostPosted: Thu Dec 08, 2016 5:22 am    Post subject: D3D Text Color Reply with quote

Hi All
There is some probllem with D3D color of text in Dirt Rally Game

In CE 6.4 look fine


D3D in 6.4 used this lua code
Code:

font=createFont()
font.Color=("0x062602")
font.Size=13
fontmap=d3dhook_createFontmap(font)
Option1=d3dhook_createTextContainer(fontmap,26,15,'some text')
d3dhook_renderobject_setVisible(Option1, true)


In CE 6.6 D3D color of text look like in this picture


Left D3D used this lua code
Code:

font=createFont()
font.Color=("0x062602")
font.Size=13
fontmap=d3dhook_createFontmap(font)
Option1=d3dhook_createTextContainer(fontmap,26,15,'some text')
d3dhook_renderobject_setVisible(Option1, true)


Right D3D used this lua code
Code:

font=createFont()

font.Size=13
fontmap=d3dhook_createFontmap(font)
Option1=d3dhook_createTextContainer(fontmap,26,15,'some text')
d3dhook_renderobject_setVisible(Option1, true)



How can i use text color like in CE 6.4?
Back to top
View user's profile Send private message
Kavvman
Master Cheater
Reputation: 2

Joined: 17 Apr 2004
Posts: 316

PostPosted: Thu Dec 08, 2016 10:51 am    Post subject: Reply with quote

Remove this then try?

font.Color=("0x062602")

_________________
...
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Dec 08, 2016 11:09 am    Post subject: Reply with quote

I remember it was Lazarus 1.6 issue. It makes 32bit png's 100% transparent.

DB reported it here:
http://bugs.freepascal.org/view.php?id=20774#c93688


This Lazarus bug caused D3D Fontmaps and Textures to not work properly (always invisible). So, DB added a function which fix this:
https://github.com/cheat-engine/cheat-engine/blob/ad795999e3b8c27af4ad58d7dea866e078a693b9/Cheat%20Engine/d3dhookUnit.pas#L1086



It looks like no one tested beta CE builds and CE release candidates builds with fontmaps generated from fonts with different color than black.

_________________
Back to top
View user's profile Send private message MSN Messenger
AntonVit
Advanced Cheater
Reputation: 0

Joined: 25 Jan 2014
Posts: 73

PostPosted: Thu Dec 08, 2016 1:29 pm    Post subject: Reply with quote

ViZZion wrote:
Remove this then try?

font.Color=("0x062602")


I tryed and without it look like on second picture (right text) just black text. But i need colored text like on first picture

mgr.inz.Player wrote:
This Lazarus bug caused D3D Fontmaps and Textures to not work properly (always invisible). So, DB added a function which fix this:

So i can recompiled CE with this "pas" on githab, or i can use only 6.4 CE?
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Dec 08, 2016 1:35 pm    Post subject: Reply with quote

This Lazarus (or maybe FreePascal) bug is bigger than DB thought.

His procedure "FixAlpha(aPNG: TPortableNetworkGraphic)" is not enough.

Just wait for a fix.



@DB, probably patch from this issue broke something:
http://bugs.freepascal.org/view.php?id=27926

_________________
Back to top
View user's profile Send private message MSN Messenger
AntonVit
Advanced Cheater
Reputation: 0

Joined: 25 Jan 2014
Posts: 73

PostPosted: Thu Dec 08, 2016 1:56 pm    Post subject: Reply with quote

mgr.inz.Player wrote:
This Lazarus (or maybe FreePascal) bug is bigger than DB thought.

His procedure "FixAlpha(aPNG: TPortableNetworkGraphic)" is not enough.

Just wait for a fix.



@DB, probably patch from this issue broke something:
http://bugs.freepascal.org/view.php?id=27926


Ok, thank you.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Dec 08, 2016 5:09 pm    Post subject: Reply with quote

Maybe I will be able to make working autoassembleSelf script (CE will patch itself). Give me a while.


EDIT:
I found a bug inside fixAlpha procedure.


Here Lua script with AA self patch for CE6.6.
Create Lua file inside autorun folder and paste those lines.
Code:
if not cheatEngineIs64Bit() then
  local a=autoAssemble([[define(address,"cheatengine-i386.exe"+1D8853)
define(bytes,89 44 24 08 89 5C 24 04)
assert(address,bytes)
alloc(newmem,$1000)
label(return)

newmem:
  mov [esp+08],eax
  mov al,[esp+08]
  mov ah,[esp+0A]
  xchg al,ah
  mov [esp+08],al
  mov [esp+0A],ah
  mov [esp+04],ebx
  jmp return
address:
  jmp newmem
  nop
  nop
  nop
return:]],true)
  if not a then print'fixFixPNGAlpha: only CE6.6 (installer ver.6.6.0.1) supported' end

else
  local a=autoAssemble([[define(address,"cheatengine-x86_64.exe"+23732D)
define(bytes,89 C6 48 89 D9 48 89 D8 48 8B 00)
assert(address,bytes)
alloc(newmem,$1000,cheatengine-x86_64.exe)
label(return)

newmem:
  mov esi,eax
  and esi,ff00
  mov ecx,eax
  shr eax,10
  shl ecx,10
  movzx eax,al
  and ecx,ff0000
  or esi,eax
  or esi,ecx
  mov rcx,rbx
  jmp return

address:
  jmp newmem
return:]],true)
  if not a then print'fixFixPNGAlpha: only CE6.6 (installer ver.6.6.0.1) supported' end

end

_________________
Back to top
View user's profile Send private message MSN Messenger
AntonVit
Advanced Cheater
Reputation: 0

Joined: 25 Jan 2014
Posts: 73

PostPosted: Fri Dec 09, 2016 5:46 am    Post subject: Reply with quote

mgr.inz.Player wrote:
Maybe I will be able to make working autoassembleSelf script (CE will patch itself). Give me a while.


EDIT:
I found a bug inside fixAlpha procedure.


Here Lua script with AA self patch for CE6.6.
Create Lua file inside autorun folder and paste those lines.
Code:
if not cheatEngineIs64Bit() then
  local a=autoAssemble([[define(address,"cheatengine-i386.exe"+1D8853)
define(bytes,89 44 24 08 89 5C 24 04)
assert(address,bytes)
alloc(newmem,$1000)
label(return)

newmem:
  mov [esp+08],eax
  mov al,[esp+08]
  mov ah,[esp+0A]
  xchg al,ah
  mov [esp+08],al
  mov [esp+0A],ah
  mov [esp+04],ebx
  jmp return
address:
  jmp newmem
  nop
  nop
  nop
return:]],true)
  if not a then print'fixFixPNGAlpha: only CE6.6 (installer ver.6.6.0.1) supported' end

else
  local a=autoAssemble([[define(address,"cheatengine-x86_64.exe"+23732D)
define(bytes,89 C6 48 89 D9 48 89 D8 48 8B 00)
assert(address,bytes)
alloc(newmem,$1000,cheatengine-x86_64.exe)
label(return)

newmem:
  mov esi,eax
  and esi,ff00
  mov ecx,eax
  shr eax,10
  shl ecx,10
  movzx eax,al
  and ecx,ff0000
  or esi,eax
  or esi,ecx
  mov rcx,rbx
  jmp return

address:
  jmp newmem
return:]],true)
  if not a then print'fixFixPNGAlpha: only CE6.6 (installer ver.6.6.0.1) supported' end

end


Thank
Now work fine, but if i try to create trainer, and after i try to activate in trainer d3d - it get error - accese violation
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Fri Dec 09, 2016 10:53 am    Post subject: Reply with quote

32bit trainer? 64bit trainer? Tiny trainer?
_________________
Back to top
View user's profile Send private message MSN Messenger
AntonVit
Advanced Cheater
Reputation: 0

Joined: 25 Jan 2014
Posts: 73

PostPosted: Fri Dec 09, 2016 12:17 pm    Post subject: Reply with quote

mgr.inz.Player wrote:
32bit trainer? 64bit trainer? Tiny trainer?


32bit trainer. Dirt Rally 32 bits game. Tryed on CE 6.6 which i get from oficial CE site today or yestarday (i forgot)

I tryed include it script to lua in trainer on begining of all lua script.
When i start trainer it tell me
Code:
fixFixPNGAlpha: only CE6.6 (installer ver.6.6.0.1)

and after tell that d3d object not create yet
I create button for attach and open dirt rally process but when i press - it not help, still tell -d3d object not create yet

Trainer 32 bit gigantic

If not create trainer, just use ce - all fine
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Fri Dec 09, 2016 12:50 pm    Post subject: Reply with quote

My script will not work with gigantic trainers.

But hey, here CE6.6 with fixed "fixAlpha" procedure.
https://docs.google.com/uc?authuser=0&id=0BwMAnE6mjogMNVdwUmNSY0RaejQ&export=download


Quote:
d3d object not create yet

I have this problem even with CE6.4.
The workaround is to create a timer which checks createD3DHook() status.

Code:
function createD3DObjects()
  local font=createFont()
  font.Color=0x062602
  font.Size=13
  fontmap=D3DHook.createFontmap(font)
  Option1=D3DHook.createTextContainer(fontmap,26,15,'some text')
  Option1.Visible = true
end



TryCreatingD3DHook_Timer = createTimer(nil,false)
TryCreatingD3DHook_Timer.Interval = 1000
TryCreatingD3DHook_Timer.OnTimer =
  function (timer)
    D3DHook = createD3DHook()
    if D3DHook then
      TryCreatingD3DHook_Timer.Enabled = false
      createD3DObjects()
    end
  end

TryCreatingD3DHook_Timer.Enabled = true


Edit:
Forgot one line.

_________________


Last edited by mgr.inz.Player on Sat Dec 10, 2016 6:29 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
AntonVit
Advanced Cheater
Reputation: 0

Joined: 25 Jan 2014
Posts: 73

PostPosted: Sat Dec 10, 2016 3:04 am    Post subject: Reply with quote

mgr.inz.Player wrote:
My script will not work with gigantic trainers.

But hey, here CE6.6 with fixed "fixAlpha" procedure.
https://docs.google.com/uc?authuser=0&id=0BwMAnE6mjogMNVdwUmNSY0RaejQ&export=download


Quote:
d3d object not create yet

I have this problem even with CE6.4.
The workaround is to create a timer which checks createD3DHook() status.

Code:
function createD3DObjects()
  local font=createFont()
  font.Color=0x062602
  font.Size=13
  fontmap=D3DHook.createFontmap(font)
  Option1=D3DHook.createTextContainer(fontmap,26,15,'some text')
  Option1.Visible = true
end



TryCreatingD3DHook_Timer = createTimer(nil,false)
TryCreatingD3DHook_Timer.Interval = 1000
TryCreatingD3DHook_Timer.OnTimer =
  function (timer)
    D3DHook = createD3DHook()
    if D3DHook then
      TryCreatingD3DHook_Timer.Enabled = false
      createD3DObjects()
    end
  end




Thank for help.
Now work fine.
And 1 thing yet i forgot set active d3d when use trainer generator. Now CE dont tell me that d3d not create yet

Now look colored
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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