叠加在 3D 全屏应用程序上 [英] Overlaying on a 3D fullscreen application

查看:33
本文介绍了叠加在 3D 全屏应用程序上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在第 3 方全屏 Windows 应用程序之上显示一些自定义图形.

I want to display some custom graphics on top of a 3rd party fullscreen Windows application.

你玩过 Steam 游戏吗?它有一个可执行文件 GameOverlayUI.exe,可让您从游戏中访问 Steam 窗口.(GUI 元素看起来是自定义绘制的,我不知道这是否必要;但它们在游戏中的外观与在桌面上的完全相同.)它甚至可以将游戏图形变暗"背景.

Have you played any Steam games? It has an executable, GameOverlayUI.exe that lets you access Steam windows from within a game. (The GUI elements look custom-drawn, I don't know if that is a necessity; but they look exactly the same inside a game as they do on the desktop.) It even goes as far to 'dim' the game graphics in the background.

我想知道如何编写这样的应用程序.

I'm wondering how one could go about writing such an application.

我还想知道解决方案的范围有多大.您可以对所有 OpenGL 应用程序使用一种方法吗?对于所有 Direct3D 减去 DirectDraw 应用程序?适用于所有全屏 Windows 应用程序?

I'm also wondering how broad the scope of solutions would be. Could you use one method for all OpenGL applications? For all Direct3D minus DirectDraw applications? For all fullscreen Windows applications?

我正在寻找更多现代"和通用的解决方案 - 覆盖命令提示符或 320x240 索引颜色应用程序不是问题.

I'm looking for more 'modern' and generic solutions - overlaying a command prompt or a 320x240 indexed color application isn't a concern.

一些说明:全屏应用程序不是我的.它可以是任何东西.最有可能的是,这将是一款 3D 游戏.我想在游戏图形的顶部显示,比如屏幕右下角的数字时钟.如果可能,我想避免使用诸如注入代码或调试过程之类的技巧.

Some clarification: The fullscreen application isn't mine. It can be anything. Most probably, it will be a 3D game. I want to display, say a digital clock in the bottom right corner of the screen, on top of the game graphics. I would like to avoid tricks such as injecting code or debugging the process, if possible.

推荐答案

好吧,这是另一个例子.Xfire 是一个聊天程序,它将其界面覆盖到游戏中,因此您可以在玩游戏时接收消息.他们这样做的方法是在进程内存级别编辑 d3d/opengl DLL,例如注入程序集跳转.我知道这是因为他们的方法导致我的 mod 崩溃,而且我实际上看到了他们注入 d3d9.dll 的奇怪汇编代码.

Well, here's another example. Xfire is a chat program that overlays its interface into games so you can receive messages while playing. The way they do this is by editing the d3d/opengl DLL at the process memory level, like injecting assembly jumps. I know this because their method was causing my mod to crash, and I actually saw the strange assembly code they were injecting into the d3d9.dll.

Xfire 是如何做到这一点的:

So here's how Xfire does this:

  1. 针对游戏进程
  2. 在其进程内存中搜索 d3d.dll/opengl.dll
  3. 将包含自定义接口逻辑的 DLL 注入进程
  4. 通过在进程内存中找到的 d3d/opengl 函数中手动编写程序集跳转,将接口的函数连接到程序流

没有其他可以想象的方法,因为您需要劫持属于该游戏的图形设备.我敢打赌 Steam 的做法与 Xfire 相同.所以,是的,除非有人创建了一个有用的库来完成您在低级别需要做的所有事情,否则没有简单的方法可以做到这一点.

There's no other conceivable way since you need to hijack the graphics device that belongs to that game. I'm willing to bet that Steam does it the same way as Xfire. So yeah, no easy way to do this unless someone created a helpful library to do everything you need to do at the low level.

您还询问了如何将叠加层下的游戏图形调暗.这只是一个简单的 DrawPrimitive 调用,用于在屏幕上绘制一个填充的透明矩形.

You also asked about dimming the game graphics under your overlay. This is just a simple DrawPrimitive call to draw a filled transparent rectangle over the screen.

这篇关于叠加在 3D 全屏应用程序上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆