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 


Calling DirectX Functions

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Sat Feb 04, 2017 2:11 pm    Post subject: Calling DirectX Functions Reply with quote

I have a doubt.
To call directX functions within a game, The hack needs to be an inject DLL in the game, or need not be injected into the game.
I want to start creating chams, Wireframe. But I have not much idea nor looking at tutorials.

_________________
...
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Sat Feb 04, 2017 3:40 pm    Post subject: Reply with quote

Your best bet is hooking things to do stuff like this.

For wireframe, if you just want to make the entire game wireframed, then you just mainly need to hook SetRenderState and override/force D3DRS_FILLMODE to the wireframe value.

For chams, or if you want to apply wireframe to models (players/enemies/etc.) only, then you are going to need to do more. You will need to hook the drawing commands such as:
- DrawIndexedPrimitive
- DrawIndexedPrimitiveUP
- DrawPrimitive
- DrawPrimitiveUP

Depending on which the game uses to draw its things. You will need to compare info based on the call to determine what is what as well, such as the number of primitives and stride.

There are thousands of examples of doing things like this around the net, plenty of open source information for D3D hooking and doing chams/wireframe/etc.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Sat Feb 04, 2017 4:25 pm    Post subject: Reply with quote

Tell me exactly, the hack should be a dll, or an application.
Wireframe would be:
Code:
SetRenderState(D3DRS_FILLMODE, true);

Or how it would be.

_________________
...
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Sat Feb 04, 2017 5:17 pm    Post subject: Reply with quote

It would be an injected DLL.

You can read up on the values for fill mode here:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb172556(v=vs.85).aspx

Wireframe being:
Code:
D3DFILL_WIREFRAME    = 2

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Sat Feb 04, 2017 5:43 pm    Post subject: Reply with quote

I can never compile a script, I follow several tutorials and always error.
_________________
...
Back to top
View user's profile Send private message
SunBeam
I post too much
Reputation: 65

Joined: 25 Feb 2005
Posts: 4022
Location: Romania

PostPosted: Sat Feb 04, 2017 5:46 pm    Post subject: Reply with quote

we'd like to provide help, but you've not explained at all what you're trying to do (screenshots, or videos of your work, or detailed explanation would help). Then again, if you say you can never compile something, then it means you're trying to compile someone's source to obtain a DLL you can inject into a game. That game being an online game. Correct?
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Sat Feb 04, 2017 6:10 pm    Post subject: Reply with quote

Filipe_Br wrote:
I can never compile a script, I follow several tutorials and always error.


I wrote a fairly lengthy tutorial explaining the basics of hooking and wrapping Direct3D here:
http://forum.cheatengine.org/viewtopic.php?t=161045

While the code is old and somewhat messy the general idea applies still. The method covered in that topic would apply to Direct3D8 and Direct3D9. If your target is Direct3D10/11/12 the things required to be hooked/wrapped change because of the API has changed greatly since v9.

You can also do the hooks in multiple other ways rather than doing a full wrapper:
- You could use VMT hooks after finding the device pointer.
- You could create a proxy DLL.
- You could hook a games rendering function directly and just add onto it.

And so on. The way you approach it is best up to you and how it would best suit the target. (Things to factor in would be if there is an anti-cheat etc.)

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Sat Feb 04, 2017 6:11 pm    Post subject: Reply with quote

SunBeam I am asking about this is because I have a doubt. I do not know how to speak English, the tutorials are always in English, and the translations sometimes get wrong interpretations.
What matters is what I want to do, if you want to help me, thank you, if I can help someone, I'll help.
The only thing I asked is if to create these hacks as "chams" I have to create a dll or application, do you need an image to answer a question like this??

Since it is so interested, yes it is a source code that someone created. I do not know anything about directX, and I do not intend to learn about it if I can not compile a script that uses directX function.

If I just wanted the dll for a game, I would not be downloading a source code, I would download it to the dll itself.

I want to learn about this, unfortunately without being able to compile any script that involves directX has no way.

_________________
...
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Sat Feb 04, 2017 6:19 pm    Post subject: Reply with quote

Filipe_Br wrote:
SunBeam What is your problem, if I am asking about this is because I have a doubt. I do not know how to speak English, the tutorials are always in English, and the translations sometimes get wrong interpretations.
What matters is what I want to do, if you want to help me, thank you, if I can help someone, I'll help.
The only thing I asked is if to create these hacks as "chams" I have to create a dll or application, do you need an image to answer a question like this??

Since it is so interested, yes it is a source code that someone created. I do not know anything about directX, and I do not intend to learn about it if I can not compile a script that uses directX function.

If I just wanted the dll for a game, I would not be downloading a source code, I would download it to the dll itself.

I want to learn about this, unfortunately without being able to compile any script that involves directX has no way.[/b]



What game are you looking to alter and test things with? What version of Direct3D does it use if you know off hand? If not it can usually be found via Google pretty easily. For stuff like this, I would suggest targeting a single player game first, that has no protections so you can get an understanding of the basics of how Direct3D works and understand what is going on in the code you plan to work with.

As a means of good examples, UnknownCheats has a ton of Direct3D related code and information for game hacking that would help with the varying versions of Direct3D you may encounter.

Newer games today mostly make use of DX11 or 12. Some still use DX9 while 10 is not used too much. So if you do decide to start learning pick which version you want to focus on and if your target starting point is going to be older games or newer ones.

Keep in mind discussion for online game hacking is not allowed here so if your target is multiplayer I'd suggest looking at a different target to start with.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
SunBeam
I post too much
Reputation: 65

Joined: 25 Feb 2005
Posts: 4022
Location: Romania

PostPosted: Sat Feb 04, 2017 6:25 pm    Post subject: Reply with quote

Filipe_Br: "Chams" is usually a term used in online shooters, where the DirectX hack allows you to see through solid walls. This term has later on been widely spread, denoting DX injectable DLLs where you could do more than just seeing through walls. As you're saying even yourself, it's someone else's source code (and you've probably watched a video or two, where the author shows what to do and how it works for him; but not for you, cuz, as you put it, it didn't compile for you, even though you followed a tutorial). And you clearly saw ALL DirectX hacks are wrappers, thus DLLs. And the only way you'd work with a DLL for DirectX hooking is injecting it in the game's process (so it can do the HOOKING).
Back to top
View user's profile Send private message
Filipe_Br
Master Cheater
Reputation: 3

Joined: 07 Jan 2016
Posts: 272
Location: My house

PostPosted: Sat Feb 04, 2017 6:41 pm    Post subject: Reply with quote

Yes "chams" is usually created for online games. "Usually" not always.
I know how to generate a .dll and .exe applications.
How can I tweak the features if I do not know how to compile script that uses "directX", and what good is studying the documentation, unmotivated because it can not compile a ready code.

_________________
...
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Sat Feb 04, 2017 6:45 pm    Post subject: Reply with quote

I was referring to the other thread I just locked because you wouldn't drop things and kept going off topic like you are now doing here (partially). No idea how STN landed up getting brought into this.


This is a programming section where people are free to ask questions pertaining to programming. Which is exactly what Filipe_Br did. His topic is related to Direct3D programming / hacking. Simply because the general purpose of chams is seen and done in multiplayer does not automatically deem his topic invalid.

Plenty of people do multiplayer style FPS cheats in single player aspects. Not everything that involves Direct3D hacking is done for the sole purpose of online games.

Not everyone grasps things instantly either so him asking questions and getting some assistance to help him is nothing wrong and completely valid for this section. I have no plans on handing him code outside of the link I gave above which is a tutorial explaining things to some degree. The intention here is to help him understand Direct3D and what needs to be done to do what he wants to do regardless of the context of the game being single player or multiplayer.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
SunBeam
I post too much
Reputation: 65

Joined: 25 Feb 2005
Posts: 4022
Location: Romania

PostPosted: Sat Feb 04, 2017 6:51 pm    Post subject: Reply with quote

Here's some food for thought:

Using Cheat Engine I was able to create this menu for Assassin's Creed: Black Flag. It's not my code, it's mostly Dark Byte's and many other people I've seen posting in the LUA section. Keep in mind I DON'T KNOW LUA CODING AT ALL (I didn't at the time I had the idea of using it in tables; I partially do now). I've simply taken snippets off, studied what they do, decided if they're useful or not for what I plan to do and then compiled the huge ass script that is called a "d3dhook menu" that does the below:


Link

(Scroll through, or start at 00:45)

Then I attempted to do the same thing in Assassin's Creed 2 (Black Flag is Assassin's Cred 4). Now, 2 uses DirectX 9 and simply put, game crashes when you attempt to hook DX via Cheat Engine. I then asked Dark Byte about it and he said I should start from the SVN (where the C++ code for the DX hook is) and compile it in debug-mode, then study why and where it crashes.

He didn't say anything extra, but that. I did what he said, got the stuff, downloaded DirectX SDK (you need this as well, in case you wonder why compiling fails) and attempted to compile the source. Well, guess what: it didn't work. All errors and warnings. Not to mention the project was built with a different version of Visual Studio I didn't have, so I ended up getting/using that instead.

I was later on able to get it to compile (same as you, without much knowledge, but some rudimentary logic) and to this day I still don't know why a DX9 game crashes when Cheat Engine attempts to hook Direct3D. And I've not posted it here "cuz I had a doubt", but I did explain the whole process above, as you should've done yourself to begin with: I did this, that, didn't work; I even tried this and that, here's proof; then ask us to help.

Another off-topic to make a point.

BR,
Sun

P.S.: atom0s, then I apologize. The phrasing led me to believe you're thinking of a specific someone that instigated me to pick at you Smile I just remembered an old beef you might still have with him even today. My bad.
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 programming 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