- Sponsored Advertisement -
Welcome to the UnKnoWnCheaTs - Multiplayer Game Hacks and Cheats.
You have to register before you can post and see and access any of the advanced forum features, please click the register link to proceed to the registration form. To start viewing threads or posts, select a forum that you want to visit from the selection below.
Direct3D hacking programming reversing
You are Unregistered, please register to gain Full access.
FPS dont want be shown.....
09-01-2010, 05:52 PM
#1 n00bie Join Date: Aug 2010
Posts: 18
Reputation: 10 Rep Power: 18
FPS dont want be shown.....
Hey,
@first: Sorry for my bad english im german.
Ok, an now on my Coding-Problem. My Code, dont want show me my FPS^^
This is my main.cpp:
Code:
#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
#include <time.h> // header file for time functions
#include <stdio.h> //header file for (sprintf)
#include <d3d9.h>
#pragma comment(lib, "d3d9.lib")
#include <d3dx9.h>
#pragma comment(lib, "d3dx9.lib")
#include "detours.h"
#include "../../include/dx9hook.h"
#include "../../include/dx9table.h"
#pragma warning( disable : 4996 )
#pragma warning( disable : 4244 )
#pragma warning( disable : 4129 )
//vars for framerate
float fFps = 0.0f;
float fLastTickCount = 0.0f;
float fCurrentTickCount;
char cFrameRate[50] = {0};
HRESULT (APIENTRY *pfnEndScene)( IDirect3DDevice9 *pDevice );
HRESULT APIENTRY hook_EndScene(IDirect3DDevice9 *pDevice){
fCurrentTickCount = clock() * 0.001f;
++fFps;
if((fCurrentTickCount - fLastTickCount) > 1.0f)
{
fLastTickCount = fCurrentTickCount;
sprintf(cFrameRate, "[ FPS: %d ]", int(fFps)); //print framerate
fFps = 0;
}
return pfnEndScene(pDevice);
}
BOOL APIENTRY DllMain( HMODULE hInstance, DWORD dwReason, LPVOID lpReserved )
{
switch(dwReason) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls((HMODULE)hInstance);
if(!DirectX9Detour(DX9_ENDSCENE, (FARPROC)&hook_EndScene, (FARPROC)&pfnEndScene)) {
MessageBoxA(HWND_DESKTOP, "DirectX9Detour failed.", "DirectX9Detour", MB_ICONERROR);
return FALSE;
}
break;
case DLL_PROCESS_DETACH:
DirectX9Cleanup();
break;
}
return TRUE;
} This Code worked befor on all games, it displayed an whit quadrat. then i changed the code to the fps display, and it dont work.... i dont know what to do...
i hope someone of you can help me
i like this forum
Last edited by DJ_Mic; 09-01-2010 at 06:06 PM .
DJ_Mic is offline
09-01-2010, 05:56 PM
#2 :3 1337 :3
Join Date: Nov 2008
Location: The Netherlands
Posts: 979
Reputation: 14563 Rep Power: 204
Points: 13,900, Level: 15
Last Achievements first off, dont wanna be a back seat moderator but i suggest you remove those offsite links...
and second..
you should learn some coding?
how is it gonna be displaying the FPS if you dont even draw it...
all i see is u puting the fps in to the cFrameRate char..
__________________
hai
Wieter20 is offline
09-01-2010, 06:09 PM
#3 n00bie
Threadstarter Join Date: Aug 2010
Posts: 18
Reputation: 10 Rep Power: 18
Roverturbo make this same??
Look here!
Displaying the framerate
I now its a long time ago, he writes this. I think it must work, or not?
Please dont be so hard to me, i want to learn it.
DJ_Mic is offline
09-01-2010, 06:16 PM
#4 Join Date: Jul 2009
Location: California
Posts: 2,330
Reputation: 33489 Rep Power: 412
Quote:
Originally Posted by
DJ_Mic Roverturbo make this same??
Look here!
Displaying the framerate
I now its a long time ago, he writes this. I think it must work, or not?
Please dont be so hard to me, i want to learn it.
your not listening.. you are NOT DRAWING anything.. what are you expecting to see..
__________________
(12 17 AM) uNrEaL: One man's slap in the face is another man's slit throat
CallMeEclipse is offline
09-01-2010, 06:19 PM
#5 *_*
Join Date: Apr 2008
Location: H.M.P
Posts: 5,438
Reputation: 92853 Rep Power: 1083
notice the difference yet???
Code:
void FPS(LPDIRECT3DDEVICE9 Device_Interface)
{
////FPS////
CurrentTickCount = clock() * 0.001f;
Fps++;
if((CurrentTickCount - LastTickCount) > 1.0f)
{
LastTickCount = CurrentTickCount;
sprintf(FrameRate, "[ FPS: %d ]", Fps);
Fps = 0;
}
PrintText(m_font, 1, 1, 255, 0, 50, 255, FrameRate); /// im drawing it here
}
////END OF FPS//// really strange how you said it worked on all games :O
__________________
┌∩ ┐(◕ _ ◕ ) ┌∩ ┐
°º¤ø„¸ ¨°º¤ø„¸¸„ø¤º°¨ ¸„ø¤º°¨ ¨°º¤ø„¸ MONKEY „ø¤º°¨ „ø¤º°¨ FOREVER `°º¤ø.. .
xTc charging me up like a battery, Like 1000 volts rushing through my body
HOOAH07 is online now
09-01-2010, 06:24 PM
#6 n00bie
Threadstarter Join Date: Aug 2010
Posts: 18
Reputation: 10 Rep Power: 18
Sorry, im listening, but i thought that the printf displayed it too....
Ok sorry, an why this code want work?
Code:
class CDX9DrawUtils {
private:
bool bInit;
ID3DXFont* m_pFont;
public:
void init(IDirect3DDevice9* pDevice) {
if(!bInit) {
D3DXCreateFont(pDevice, 15, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &m_pFont);
bInit = true;
}
}
void drawText(int x, int y, int red, int green, int blue, int alpha, const char *text,...) {
D3DCOLOR fontColor = D3DCOLOR_ARGB(alpha, red, green, blue);
RECT rct;
rct.left=x;
rct.top=y;
rct.right=rct.left+350;
rct.bottom=rct.top+350;
va_list va_alist;
char logbuf[100] = {0};
va_start(va_alist, text);
_vsnprintf(logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), text, va_alist);
va_end(va_alist);
m_pFont->DrawText(NULL, logbuf, -1, &rct, 0, fontColor);
}
};
CDX9DrawUtils DX9DrawUtils;
HRESULT (APIENTRY *pfnEndScene)( IDirect3DDevice9 *pDevice );
HRESULT APIENTRY hook_EndScene(IDirect3DDevice9 *pDevice){
int myNumber = 10;
float myFloat = 10.5f;
DX9DrawUtils.init(pDevice);
DX9DrawUtils.drawText(100, 200, 255, 0, 0, 255, "Hallo Welt");
DX9DrawUtils.drawText(100, 200, 255, 0, 0, 255, "MyNumber %i", myNumber);
DX9DrawUtils.drawText(100, 200, 255, 0, 0, 255, "MyFloat %f", myFloat);
return pfnEndScene(pDevice); //return zum codecave wo die überschriebenen bytes stehen (funktionsprolog) und ein jump zurück zum orginalcode
} @
HOOAH07 : Sorry, i mean the original Base Dx9 Hook. That have an quadrat, and this worked on GTA San Andreas and Mafia2.
//EDIT:
I also tried this code: Code:
ID3DXFont *m_font;
HRESULT (APIENTRY *pfnEndScene)( IDirect3DDevice9 *pDevice );
HRESULT APIENTRY hook_EndScene(IDirect3DDevice9 *pDevice){
// Create a D3DX font object
D3DXCreateFont( pDevice, 20, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial"), &m_font );
// Create a colour for the text - in this case blue
D3DCOLOR fontColor = D3DCOLOR_ARGB(255,0,0,255);
// Create a rectangle to indicate where on the screen it should be drawn
RECT rct;
rct.left=2;
rct.right=780;
rct.top=10;
rct.bottom=rct.top+20;
////FPS////
CurrentTickCount = clock() * 0.001f;
++Fps;
if((CurrentTickCount - LastTickCount) > 1.0f)
{
LastTickCount = CurrentTickCount;
sprintf(FrameRate, "[ FPS: %d ]", Fps);
Fps = 0;
}
m_font->DrawText(NULL, FrameRate, -1, &rct, 0, fontColor ); // Draw some text
/* int myNumber = 10;
float myFloat = 10.5f;*/
// DX9DrawUtils.init(pDevice);
//DX9DrawUtils.FPS();
/*DX9DrawUtils.drawText(100, 200, 255, 0, 0, 255, "MyNumber %i", myNumber);
DX9DrawUtils.drawText(100, 200, 255, 0, 0, 255, "MyFloat %f", myFloat);*/
return pfnEndScene(pDevice); //return zum codecave wo die überschriebenen bytes stehen (funktionsprolog) und ein jump zurück zum orginalcode
} And this dont work....
Last edited by DJ_Mic; 09-01-2010 at 06:53 PM .
DJ_Mic is offline
09-01-2010, 07:30 PM
#7 Retired Admin Join Date: Sep 2006
Posts: 5,249
Reputation: 93628 Rep Power: 1106
maybe you should stop pasting random code together, and try to actually learn what you are doing...
learn_more is offline
09-01-2010, 07:35 PM
#8 n00bie
Threadstarter Join Date: Aug 2010
Posts: 18
Reputation: 10 Rep Power: 18
Mh, i only want to show you what i test.
The "CDX9DrawUtils" class is from a guy. And the second is my self code.
And nothing work. I hope somebody could tell me, why. Ok sorry, if im posting bull****
DJ_Mic is offline
09-01-2010, 07:55 PM
#9 ◄ Super Moderator ►
Join Date: Dec 2009
Posts: 3,197
Reputation: 81923 Rep Power: 909
I got it working in 10minutes :P First just "print" the fps with messagebox after you get that look at your drawing funcs.
Hanoi22 is offline
09-01-2010, 09:39 PM
#10 Join Date: Nov 2009
Location: Box.
Posts: 190
Reputation: 1978 Rep Power: 49
Last Achievements Quote:
Originally Posted by
DJ_Mic Mh, i only want to show you what i test.
The "CDX9DrawUtils" class is from a guy. And the second is my self code.
And nothing work. I hope somebody could tell me, why. Ok sorry, if im posting bull****
If you genuinely wrote it, it would work for you. I remember seeing this code on another development site, which will remain nameless.
Point being, you need to learn to program, because evidently you can't.
We don't appreciate your kind here sir, take your business elsewhere.
Brb, just made some COPY PASTA! Yum.
rev0lt is offline
09-01-2010, 09:40 PM
#11 n00bie
Threadstarter Join Date: Aug 2010
Posts: 18
Reputation: 10 Rep Power: 18
Yeah but an messagebox is not the key for my project. And i dont really understand how do you mean this. If you maybe can explain this for me please?
//EDIT: C&P is not my stile!!! And i learned Vb.net on this way, too. If nobody want to help me, ok, sorry that i waste youre time .
Last edited by DJ_Mic; 09-01-2010 at 09:42 PM .
DJ_Mic is offline
09-01-2010, 10:09 PM
#12 ◄ Super Moderator ►
Join Date: Dec 2009
Posts: 3,197
Reputation: 81923 Rep Power: 909
Messagebox is a easy and fast way to test does the fps work without messing with drawing. Too easy just CP it
above Fps =0..
Code:
MessageBox( NULL, FrameRate, "FPS", NULL); Have fun with it.
Hanoi22 is offline
09-01-2010, 11:14 PM
#13 Join Date: Jul 2009
Location: California
Posts: 2,330
Reputation: 33489 Rep Power: 412
Quote:
Originally Posted by
DJ_Mic Mh, i only want to show you what i test.
The "CDX9DrawUtils" class is from a guy. And the second is my self code.
And nothing work. I hope somebody could tell me, why. Ok sorry, if im posting bull****
If you want help, post your whole code, not bits and pieces of random shit.
You need to actually learn C++ to be able to code, little known fact..
__________________
(12 17 AM) uNrEaL: One man's slap in the face is another man's slit throat
CallMeEclipse is offline
09-01-2010, 11:28 PM
#14 Join Date: Jul 2010
Posts: 95
Reputation: 1050 Rep Power: 31
Last Achievements You can ask for help here but i think that copy and pasting stuff from different sources won't help you..better thing should be starting to learn c++ and then you'll make your own source..drawing fps it's easy if you start learning c++
thelick is offline
09-02-2010, 12:54 AM
#15 Join Date: Jul 2009
Posts: 1,069
Reputation: 49844 Rep Power: 551
'sprintf' is not a drawing function.
Quote:
Originally Posted by
hanoi22 Messagebox is a easy and fast way to test does the fps work without messing with drawing. Too easy just CP it
above Fps =0..
Code:
MessageBox( NULL, FrameRate, "FPS", NULL); Have fun with it.
Calling a Messagebox function like this in endscene for FPS clocking would be retarded.
__________________
Shad0w_'s Alter Ego
disavow is online now
09-02-2010, 01:20 AM
#16 Level 3
Join Date: Jan 2009
Location: This Post
Posts: 328
Reputation: 9770 Rep Power: 140
Last Achievements Lawl,
Global Declares:
Code:
float fFps = 0.0f;
float fLastTickCount = 0.0f;
float fCurrentTickCount;
char cFrameRate[50] = {0};
LPD3DXFONT g_pFont = NULL; Print Function:
Code:
void DrawString(int x, int y, DWORD color, const char *fmt, ...)
{
RECT FontPos = { x, y, x + 120, y + 16 };
char buf[1024] = {'\0'};
va_list va_alist;
va_start(va_alist, fmt);
vsprintf(buf, fmt, va_alist);
va_end(va_alist);
g_pFont->DrawText(NULL, buf, -1, &FontPos, DT_NOCLIP, color);
} Code:
HRESULT (APIENTRY *pfnEndScene)( IDirect3DDevice9 *pDevice );
HRESULT APIENTRY hook_EndScene(IDirect3DDevice9 *pDevice){
if(g_pFont == NULL) D3DXCreateFont(pDevice, 15, 0, FW_BOLD, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Verdana", &g_pFont);
fCurrentTickCount = clock() * 0.001f;
++fFps;
if((fCurrentTickCount - fLastTickCount) > 1.0f)
{
fLastTickCount = fCurrentTickCount;
sprintf(cFrameRate, "[ FPS: %d ]", int(fFps)); //print framerate
fFps = 0;
}
DrawString(10,10,D3DCOLOR_ARGB(255,255,0,0),cFrameRate);
return pfnEndScene(pDevice);
} DrawText Function is out of Strifes
D3D9 Model Recognition Logger
GLHF, Also please don't ask how to use it. k thx
.
__________________
"Love for All and Sharing is the first step to solving all the problems of humanity. "
''The art of Wuju lives on in Master Yi, and is plunged through the hearts of his foes.'' -- Soraka, the Starchild ---------------------------------------------------------------------------- Anti-Cheat Software & Programming - Other FPS Games ---------------------------------------------------------------------------- SimPle01 is online now
09-02-2010, 10:53 AM
#17 n00bie
Threadstarter Join Date: Aug 2010
Posts: 18
Reputation: 10 Rep Power: 18
@
SimPle01 : I tried it, and it doenst work!
@all: i dont want an c&p code! i only want a sample how to display/draw a text ingame, and the rest i want to learn. You mustnt show me a sample of the frames. Only how to display any text ingame and the rest, i want to test myself. to learn it.
DJ_Mic is offline
09-02-2010, 11:32 AM
#18 ◄ Super Moderator ►
Join Date: Dec 2009
Posts: 3,197
Reputation: 81923 Rep Power: 909
Quote:
Originally Posted by
Shad0w_ 'sprintf' is not a drawing function.
Calling a Messagebox function like this in endscene for FPS clocking would be retarded.
Indeed but easy to check out if the fps works wihout drawtext.
But anyway simple posted whole code so read that and try to understand it, and you get it, good luck.
Hanoi22 is offline
09-02-2010, 12:50 PM
#19 Retired Admin Join Date: Sep 2006
Posts: 5,249
Reputation: 93628 Rep Power: 1106
Tatez, this is an international forum, please stick to english.
ps: your dutch is really bad....
learn_more is offline
09-02-2010, 02:41 PM
#20 Donator
Join Date: May 2008
Location: Germany
Posts: 251
Reputation: 18729 Rep Power: 239
Points: 13,610, Level: 15
Last Achievements Quote:
Originally Posted by
DJ_Mic @
SimPle01 : I tried it, and it doenst work!
@all: i dont want an c&p code! i only want a sample how to display/draw a text ingame, and the rest i want to learn. You mustnt show me a sample of the frames. Only how to display any text ingame and the rest, i want to test myself. to learn it.
are you sure that you're hooking correctly? or checked if the anticheat removed your hook? check the bytes or add a messagebox and test it
ZeaS is online now
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT +1. The time now is 09:08 AM .