Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
#pragma once #include <windows.h> #include <cstdio> #include <d3d9.h> #include <d3dx9.h> #include <detours.h> #pragma comment( lib, "detours.lib" ) typedef HRESULT(__stdcall* EndScene_t)(LPDIRECT3DDEVICE9); EndScene_t pEndScene; void DrawRect (LPDIRECT3DDEVICE9 Device_t, int X, int Y, int L, int H, D3DCOLOR color) { D3DRECT rect = {X, Y, X+L, Y+H}; Device_t->Clear(1, &rect, D3DCLEAR_TARGET, color, 0, 0); } HRESULT _stdcall mEndScene( LPDIRECT3DDEVICE9 pDevice ){ DrawRect( pDevice, 10, 10, 10, 10, D3DCOLOR_ARGB( 255, 0, 255, 0 ) ); return pEndScene( pDevice ); } void InitHook(){ HMODULE module = NULL; while( !module ){ module = GetModuleHandleA( "d3d9.dll" ); Sleep( 100 ); } // Bis Hierhin funktioniert es pEndScene = ( EndScene_t )DetourFunction((PBYTE)0x7543279F, (PBYTE) mEndScene ); } int WINAPI DllMain(HINSTANCE hInst,DWORD reason,LPVOID reserved) { switch(reason) { case DLL_PROCESS_ATTACH: CreateThread( 0, 0, (LPTHREAD_START_ROUTINE) InitHook, 0, 0, 0 ); break; } return true; } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
/* Credits an: Julian_ Youtube: /user/IceT3e3a */ #pragma comment(lib, "Psapi.lib") #pragma comment(lib, "d3d9.lib") #pragma comment(lib, "d3dx9.lib") #include <Windows.h> #include <Psapi.h> #include <d3d9.h> #include <d3dx9.h> #include "detours.h" typedef int (__stdcall* EndScene)(LPDIRECT3DDEVICE9 Device); EndScene oEndScene; ID3DXFont* dx_Font = NULL; RECT pos; int WINAPI mEndScene(LPDIRECT3DDEVICE9 Device) { if(dx_Font == 0) { D3DXCreateFont(Device, 14, 0, 4, 0, false, 1, 0, 0, 0, "Arial", &dx_Font); pos.bottom = 0; pos.left = 100; pos.right = 0; pos.top = 100; } dx_Font->DrawTextA(NULL, "EndScene detoured!", strlen("EndScene detoured!"), &pos, DT_NOCLIP, D3DCOLOR_XRGB(255, 0, 255)); return oEndScene(Device); } int WINAPI DllThread() { HMODULE hd3d9 = NULL; MODULEINFO Info; DWORD EndScene_Addr = NULL; while(hd3d9 == NULL) { hd3d9 = GetModuleHandle("d3d9.dll"); } GetModuleInformation(GetCurrentProcess(), hd3d9, &Info, sizeof(MODULEINFO)); EndScene_Addr = (int)Info.EntryPoint + 0x20D5A; oEndScene = (EndScene)DetourFunction((PBYTE)EndScene_Addr, (PBYTE)mEndScene); return 0; } bool WINAPI DllMain(HINSTANCE hDll, DWORD reason, LPVOID reserved) { switch(reason) { case DLL_PROCESS_ATTACH: CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE) DllThread, NULL, NULL, NULL); break; } return true; } |
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Community-Fossil
Beruf: Teamleiter Mobile Applikationen & Senior Software Engineer
Werbeanzeige