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 


DirectX hook in exe trainer exported

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Phenax
Newbie cheater
Reputation: 0

Joined: 29 Mar 2009
Posts: 16

PostPosted: Sun Dec 23, 2012 11:47 pm    Post subject: DirectX hook in exe trainer exported Reply with quote

Hello,

My DirectX hook code runs fine when I run it through Lua Engine
But if I export an EXE with the code, it gives Error: Access Violation.

Exporting with DirectX isn't in yet? Or what. Also, any way to detect if DirectX has alreayd been hooked?

Code:

function hookD3D()
   reinitializeSymbolhandler()
   d3dhook_initializeHook()
end

function showMsg(color, size, message)
   cleanupMsg()
   font = createFont()
   font_setSize(font, size)
   font_setColor(font, color)
   fontmap = d3dhook_createFontmap(font)
   local textWidth = d3dhook_fontmap_getTextWidth(fontmap, message)

   displayText = d3dhook_createTextContainer(fontmap, textWidth, size, message)

   d3dhook_renderobject_setX(displayText, 0)
   d3dhook_renderobject_setY(displayText, -1)
end

function cleanupMsg()
   object_destroy(displayText)
   object_destroy(fontmap)
   object_destroy(font)
end

function testGfx()
   hookD3D()
   showMsg(0xffffff, 32, 'Test')
end

testGfx()
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25288
Location: The netherlands

PostPosted: Mon Dec 24, 2012 5:35 am    Post subject: Reply with quote

Is it a tiny trainer, ce trainer, or gigantic trainer?
If gigantic, make sure you have added the d3dhook dll's to the package

And you can call d3dhook_initializeHook() as often as you wish, it automatically detects if it's already hooked or not

_________________
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
View user's profile Send private message MSN Messenger
Phenax
Newbie cheater
Reputation: 0

Joined: 29 Mar 2009
Posts: 16

PostPosted: Mon Dec 24, 2012 5:37 am    Post subject: Reply with quote

Dark Byte wrote:
Is it a tiny trainer, ce trainer, or gigantic trainer?
If gigantic, make sure you have added the d3dhook dll's to the package

And you can call d3dhook_initializeHook() as often as you wish, it automatically detects if it's already hooked or not


Much appreciated, dark_byte. I'm using the gigantic trainer, and I wasn't adding the d3dhook dll's to the package.

Regards
Back to top
View user's profile Send private message
Phenax
Newbie cheater
Reputation: 0

Joined: 29 Mar 2009
Posts: 16

PostPosted: Thu Dec 27, 2012 3:34 pm    Post subject: Reply with quote

Dark Byte wrote:

And you can call d3dhook_initializeHook() as often as you wish, it automatically detects if it's already hooked or not


For me, Cheat Engine goes unresponsive (thus I must end it) when I try to initialize a hook after it's already hooked.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25288
Location: The netherlands

PostPosted: Thu Dec 27, 2012 4:15 pm    Post subject: Reply with quote

Do you mean when it's hooked by another instance of a trainer ? Or in the same session ?
_________________
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
View user's profile Send private message MSN Messenger
Phenax
Newbie cheater
Reputation: 0

Joined: 29 Mar 2009
Posts: 16

PostPosted: Fri Dec 28, 2012 12:45 am    Post subject: Reply with quote

Dark Byte wrote:
Do you mean when it's hooked by another instance of a trainer ? Or in the same session ?


In the same session - but I just misinterpreted I think, I can obviously just use a variable to control this. It seems to work fine in another instance of a trainer, I assumed that it wouldn't from these results. I think I'm fine now.

Regards,
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 Lua Scripting 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