AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Delphi In ein (exsistierendes) Spiel Text ausgeben

In ein (exsistierendes) Spiel Text ausgeben

Ein Thema von c113plpbr · begonnen am 18. Nov 2003 · letzter Beitrag vom 9. Jan 2013
Antwort Antwort
Seite 1 von 4  1 23     Letzte » 
Benutzerbild von c113plpbr
c113plpbr

Registriert seit: 18. Nov 2003
Ort: localhost
674 Beiträge
 
Delphi 2005 Professional
 
#1

In ein (exsistierendes) Spiel Text ausgeben

  Alt 18. Nov 2003, 13:13
Ich bin neu hier und weis nicht ob diese Frage schon einmal gestellt wurde:

Wie kann ich in ein DirectX oder OpenGl Spiel/Programm (z.B. Counter Strike, Command and Conquer, Splinter Cell) Text ausgeben? Ich hab mal was von DX Overlays mit welchen das machbar wäre gehort, und auch von API Hooking, aber ich weis immer noch nicht wie das möglich sein soll.
Für alle die einen Beweis brauchen dass dies möglich ist: geht auf http://www.fraps.com/ und ladet euch eine demo des programms runter, welches die FrameRate eines Spiels in selbiges einblendet.

Hat jemand eine idee wie dies zu bewältigen ist?
Danke im voraus!
Philipp
  Mit Zitat antworten Zitat
WtF

Registriert seit: 24. Nov 2003
Ort: Nähe München
72 Beiträge
 
FreePascal / Lazarus
 
#2

Re: In ein (exsistierendes) Spiel Text ausgeben

  Alt 27. Nov 2003, 10:49
Normalerweise bin ICH ja immer der Blinde, aber diesmal wohl nicht
Hier guck dir das mal an, wo du schon auf www.fraps.com verweist:
Frequently Asked Questions
Ach und es ist sogar beschrieben wie man die Fraps.dll in den Delphi Quellcode einbindet
Also viel spaß damit,
Mfg
Steffen
Was meinst du als unbeteiligter eigentlich zum Thema Intelligenz ? Keep it real, Respect!
  Mit Zitat antworten Zitat
Benutzerbild von c113plpbr
c113plpbr

Registriert seit: 18. Nov 2003
Ort: localhost
674 Beiträge
 
Delphi 2005 Professional
 
#3

Re: In ein (exsistierendes) Spiel Text ausgeben

  Alt 27. Nov 2003, 14:04
Nun, gewissermaßen hast du recht, aber lies dir mal meine Frage und das was im Fraps FAQ steht durch: Laut Fraps FAQ kann man zwar die framerate (usw.) von einem Spiel über diese DLL herausfinden, aber (außer ich bin wirklich blind) man kann mit ihr keinen Text in ein Spiel einblenden, was ich eigentlich will.
Dumm gelaufen ...
Philipp
  Mit Zitat antworten Zitat
WtF

Registriert seit: 24. Nov 2003
Ort: Nähe München
72 Beiträge
 
FreePascal / Lazarus
 
#4

Re: In ein (exsistierendes) Spiel Text ausgeben

  Alt 27. Nov 2003, 19:01
"dumm gelaufen..."->Ja, für dich. ach was junge, ich will mal nicht so sein. Hier ist der Text wie du es anstellen kannst:

Zitat:
I'm trying to draw on the screen using GDI calls. I can see my text but it flickers badly. How can I fix this?
This is a common problem that people encounter. It is quite easy to retrieve a handle to the active window and obtain a device context for the screen. You can then issue standard GDI calls and expect them to be drawn accordingly on the screen.

Unfortunately the flickering problem can’t be avoided. The issue is caused by the fact that most games are double-buffered and GDI only supports single-buffered devices. Whenever you issue GDI calls they are always affecting the same buffer. If the game is double buffered you will see your text half the time, if it’s triple buffered only a third. As far as I know there is no way to obtain a unique device context for the back buffers.

How can I draw my own graphics on the screen?

Unfortunately there is no simple way to draw graphics on screen. This part is therefore fairly technical. If you don’t understand some of the terms I’d recommend doing a search for the keywords on google.

Fraps works by patching directly into the underlying graphics API. Doing things this way allows Fraps to issue graphics commands as if it were the game itself, avoiding having to do a large amount of setup beforehand. There are two techniques that can be used to hook into the API.

The first method is referred to as “API hooking”. Basically you want to obtain the address of the graphics function in memory, and patch this such that your code will get called whenever the game tries to use this function.

The other method is to write a “DLL wrapper”. Here you want to write your own DLL that exports the same functions as the graphics DLL. The idea is to rename the original DLL and put your DLL in its place. Then when your DLL is loaded, you proceed to load the original DLL and pass any function that is called through to it. Creating a DLL wrapper for DirectX is reasonably easy because there are only a few functions exported from the DLL. OpenGL however exports ALL of its API calls, which means that it can be very time consuming to build the stubs for all of the functions. If you want to pursue this method it may be easier to download and modify an existing OpenGL wrapper such as GLtrace.

When you have successfully hooked into the graphics API it is simply a matter of saving and restoring the state before and after you have issued your graphics commands. To learn how to draw graphics you should consult the DirectX and OpenGL SDK’s.

Other ideas that you might want to pursue if you want something up and running quickly:

If it’s only for one game, search through the game code for a function that displays text on screen. Most games have to output text at some stage, so utilising their routine may save you the hassle of implementing your own.

You could also try forcing the game to run in windowed mode. As an example, you could hook the CreateDevice function in DirectX8 and ensure that the Windowed flag is always set TRUE. With the game running in a window, you can draw in your own application alongside.

I have heard (but not verified) that it is possible to use DirectX overlays to draw on top of the game screen. This may be an easy option if performance is not an issue. Overlay documentation can be found in the DirectX SDK.

How do I know when a new frame has been drawn? What functions must I hook?

Hooking is currently performed on separate functions for DirectDraw, Direct3D8, and OpenGL. These are:



Flip (for DirectX 7 and earlier - DDRAW.DLL)
Present (for DirectX 8 – D3D8.DLL)
wglSwapBuffers (for OpenGL)
Note that DirectX is class based. This means that Flip and Present are not exported from the DLL directly. You must take the parent class and obtain the function pointers directly from an offset within the class (or subclasses). Consult the header files in the DX SDK in order to determine the offsets of the function pointers.

Ach und änder doch mal deinen Titel z.b. in : OpenGL+DirectX Overlays oder sowas,dann wissen die Leute auch was gemeint ist
Mensch dauernd dieses ständige editieren. Sorry aber den quelltext dafür konnt ich leider nicht finden. Aber sicher wirst du hier im Forum einiges zusammensuchen können.

Nix für ungut
Mfg
Steffen
Was meinst du als unbeteiligter eigentlich zum Thema Intelligenz ? Keep it real, Respect!
  Mit Zitat antworten Zitat
Benutzerbild von c113plpbr
c113plpbr

Registriert seit: 18. Nov 2003
Ort: localhost
674 Beiträge
 
Delphi 2005 Professional
 
#5

Re: In ein (exsistierendes) Spiel Text ausgeben

  Alt 29. Nov 2003, 18:48
tja die sache hat nur einen haken: ich brauch mal nun den code und nicht ne beschreibung wie ich das anstellen kann ... sowas is zwar meist auch hilfreich, aber so wie es aussieht nicht in diesem fall: nen dll wrapper is nun wirklich das blödste was ich mir vorstellen kann und zum thema api hooking hab ich zu meinem problem hab ich nix direktes oder auch indirektes gefunden ... deshalb: problem! Aber ein code wäre hilfreich ...
Danke für den Tipp mit dem umbenennen
Philipp
  Mit Zitat antworten Zitat
Benutzerbild von c113plpbr
c113plpbr

Registriert seit: 18. Nov 2003
Ort: localhost
674 Beiträge
 
Delphi 2005 Professional
 
#6

Re: In ein (exsistierendes) Spiel Text ausgeben

  Alt 29. Dez 2003, 14:25
zur erinnerung nochmal hervorgekramt ... hat jemand ne idee? wäre sehr praktisch

thx by c113plpbr
Philipp
  Mit Zitat antworten Zitat
kurtm1

Registriert seit: 12. Dez 2003
348 Beiträge
 
#7

Re: In ein (exsistierendes) Spiel Text ausgeben

  Alt 29. Dez 2003, 15:12
Ich suche schon seit einiger Zeit genau das gleiche habe allerdings noch nichts gefunden. Vielleicht können wir uns ja ergänzen
  Mit Zitat antworten Zitat
Benutzerbild von c113plpbr
c113plpbr

Registriert seit: 18. Nov 2003
Ort: localhost
674 Beiträge
 
Delphi 2005 Professional
 
#8

Re: In ein (exsistierendes) Spiel Text ausgeben

  Alt 29. Dez 2003, 15:19
Da war in letzter zeit nen beitrag mit nem link zu ner delphi komponente auf torrys pages, hieß OSD oder so, aber ich finde das thema nichtmehr, und ich weis auch nicht ob das in ein spiel eingeblendet wird, denn ich habe im moment kein richtig funktionierendes system auf dem ich das testen könnte ... wenn jemand so nett wäre ...
Philipp
  Mit Zitat antworten Zitat
kurtm1

Registriert seit: 12. Dez 2003
348 Beiträge
 
#9

Re: In ein (exsistierendes) Spiel Text ausgeben

  Alt 29. Dez 2003, 15:29
Wenn du mir sagst wo ich es finden könnte kann ich es testen
  Mit Zitat antworten Zitat
Benutzerbild von c113plpbr
c113plpbr

Registriert seit: 18. Nov 2003
Ort: localhost
674 Beiträge
 
Delphi 2005 Professional
 
#10

Re: In ein (exsistierendes) Spiel Text ausgeben

  Alt 29. Dez 2003, 15:39
@ kurtm1:

Hab nachgeschaut: Das war deine Frage ... http://www.delphipraxis.net/internal...ct.php?t=15542 ...

canvas funzt zwar, aber leider nicht allzugut (blinkt), hast du das osd beispiel schon probiert?
Philipp
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:27 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz