mirror of
https://github.com/gwdevhub/gMod.git
synced 2026-07-15 15:09:30 +00:00
BugFix: In single save texture mode, the string in the left upper corner is now only rendered on backbuffers.
This commit is contained in:
@@ -38,6 +38,9 @@ There exist two makefiles, one for the mingw32-make.exe (makefile.gcc) which cal
|
||||
|
||||
You have to compile the 3 dll's separately (one for each injection method). The dll will be copied after successful compilation in the uMod_GUI/bin directory.
|
||||
|
||||
If you want to use the logging mode of the dll you have to parse LOG_MESSAGE=1
|
||||
|
||||
|
||||
2.2) Using gcc (BUT you need the vc compiler!):
|
||||
change in the uMod_DX9 Directory and type:
|
||||
mingw32-make -f makefile.gcc
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
ifdef NI
|
||||
|
||||
ifdef ALPHA
|
||||
precompiler_flag = /D "ALPHA" /D "NO_INJECTION"
|
||||
ifdef LOG_MESSAGE
|
||||
precompiler_flag = /D "LOG_MESSAGE" /D "NO_INJECTION"
|
||||
else
|
||||
precompiler_flag = /D "NO_INJECTION"
|
||||
endif
|
||||
|
||||
def_file = /DEF:"uMod_DX9_dll_NO_INJECTION.def"
|
||||
obj_suff = NO_INJECTION.obj
|
||||
obj_suff = NI.obj
|
||||
dll = d3d9.dll
|
||||
|
||||
else
|
||||
|
||||
ifdef DI
|
||||
ifdef ALPHA
|
||||
precompiler_flag = /D "ALPHA" /D "DIRECT_INJECTION"
|
||||
ifdef LOG_MESSAGE
|
||||
precompiler_flag = /D "LOG_MESSAGE" /D "DIRECT_INJECTION"
|
||||
else
|
||||
precompiler_flag = /D "DIRECT_INJECTION"
|
||||
endif
|
||||
@@ -25,8 +25,8 @@ dll = uMod_d3d9_DI.dll
|
||||
|
||||
else
|
||||
|
||||
ifdef ALPHA
|
||||
precompiler_flag = /D "ALPHA" /D "HOOK_INJECTION"
|
||||
ifdef LOG_MESSAGE
|
||||
precompiler_flag = /D "LOG_MESSAGE" /D "HOOK_INJECTION"
|
||||
else
|
||||
precompiler_flag = /D "HOOK_INJECTION"
|
||||
endif
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
!IFDEF NI
|
||||
|
||||
!IFDEF ALPHA
|
||||
precompiler_flag = /D "ALPHA" /D "NO_INJECTION"
|
||||
!IFDEF LOG_MESSAGE
|
||||
precompiler_flag = /D "LOG_MESSAGE" /D "NO_INJECTION"
|
||||
!ELSE
|
||||
precompiler_flag = /D "NO_INJECTION"
|
||||
!ENDIF
|
||||
|
||||
def_file = /DEF:"uMod_DX9_dll_NO_INJECTION.def"
|
||||
obj_suff = NO_INJECTION.obj
|
||||
obj_suff = NI.obj
|
||||
dll = d3d9.dll
|
||||
|
||||
!ELSE
|
||||
|
||||
!IFDEF DI
|
||||
!IFDEF ALPHA
|
||||
precompiler_flag = /D "ALPHA" /D "DIRECT_INJECTION"
|
||||
!IFDEF LOG_MESSAGE
|
||||
precompiler_flag = /D "LOG_MESSAGE" /D "DIRECT_INJECTION"
|
||||
!ELSE
|
||||
precompiler_flag = /D "DIRECT_INJECTION"
|
||||
!ENDIF
|
||||
@@ -25,8 +25,8 @@ dll = uMod_d3d9_DI.dll
|
||||
|
||||
!ELSE
|
||||
|
||||
!IFDEF ALPHA
|
||||
precompiler_flag = /D "ALPHA" /D "HOOK_INJECTION"
|
||||
!IFDEF LOG_MESSAGE
|
||||
precompiler_flag = /D "LOG_MESSAGE" /D "HOOK_INJECTION"
|
||||
!ELSE
|
||||
precompiler_flag = /D "HOOK_INJECTION"
|
||||
!ENDIF
|
||||
|
||||
@@ -22,22 +22,21 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
#define uMod_DEFINES_H_
|
||||
|
||||
|
||||
#ifdef ALPHA
|
||||
|
||||
#define LOG_MESSAGE
|
||||
#ifdef LOG_MESSAGE
|
||||
extern FILE *gl_File;
|
||||
|
||||
#define Message(...) {if (gl_File!=NULL) {fprintf( gl_File, __VA_ARGS__); fflush(gl_File);}}
|
||||
#ifdef HOOK_INJECTION
|
||||
#define OpenMessage(...) {if (fopen_s( &gl_File, "uMod_log.txt", "wt")) gl_File=NULL; else fprintf( gl_File, "HI R23: 0000000\n");}
|
||||
#define OpenMessage(...) {if (fopen_s( &gl_File, "uMod_log.txt", "wt")) gl_File=NULL; else fprintf( gl_File, "HI R25: 0000000\n");}
|
||||
#endif
|
||||
|
||||
#ifdef DIRECT_INJECTION
|
||||
#define OpenMessage(...) {if (fopen_s( &gl_File, "uMod_log.txt", "wt")) gl_File=NULL; else fprintf( gl_File, "DI R23: 0000000\n");}
|
||||
#define OpenMessage(...) {if (fopen_s( &gl_File, "uMod_log.txt", "wt")) gl_File=NULL; else fprintf( gl_File, "DI R25: 0000000\n");}
|
||||
#endif
|
||||
|
||||
#ifdef NO_INJECTION
|
||||
#define OpenMessage(...) {if (fopen_s( &gl_File, "uMod_log.txt", "wt")) gl_File=NULL; else fprintf( gl_File, "NI R23: 0000000\n");}
|
||||
#define OpenMessage(...) {if (fopen_s( &gl_File, "uMod_log.txt", "wt")) gl_File=NULL; else fprintf( gl_File, "NI R25: 0000000\n");}
|
||||
#endif
|
||||
|
||||
#define CloseMessage(...) {if (gl_File!=NULL) fclose(gl_File);}
|
||||
|
||||
@@ -145,7 +145,9 @@ HRESULT __stdcall uMod_IDirect3D9::CreateDevice(UINT Adapter,D3DDEVTYPE DeviceTy
|
||||
// we intercept this call and provide our own "fake" Device Object
|
||||
HRESULT hres = m_pIDirect3D9->CreateDevice( Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface);
|
||||
|
||||
uMod_IDirect3DDevice9 *pIDirect3DDevice9 = new uMod_IDirect3DDevice9(*ppReturnedDeviceInterface, uMod_Server);
|
||||
int count = 1;
|
||||
if (pPresentationParameters!=NULL) count = pPresentationParameters->BackBufferCount;
|
||||
uMod_IDirect3DDevice9 *pIDirect3DDevice9 = new uMod_IDirect3DDevice9(*ppReturnedDeviceInterface, uMod_Server, count);
|
||||
|
||||
// store our pointer (the fake one) for returning it to the calling program
|
||||
*ppReturnedDeviceInterface = pIDirect3DDevice9;
|
||||
|
||||
@@ -38,7 +38,9 @@ HRESULT __stdcall uMod_IDirect3D9Ex::CreateDeviceEx( UINT Adapter, D3DDEVTYPE De
|
||||
// we intercept this call and provide our own "fake" Device Object
|
||||
HRESULT hres = m_pIDirect3D9Ex->CreateDeviceEx( Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, pFullscreenDisplayMode, ppReturnedDeviceInterface);
|
||||
|
||||
uMod_IDirect3DDevice9Ex *pIDirect3DDevice9Ex = new uMod_IDirect3DDevice9Ex(*ppReturnedDeviceInterface, uMod_Server);
|
||||
int count = 1;
|
||||
if (pPresentationParameters!=NULL) count = pPresentationParameters->BackBufferCount;
|
||||
uMod_IDirect3DDevice9Ex *pIDirect3DDevice9Ex = new uMod_IDirect3DDevice9Ex(*ppReturnedDeviceInterface, uMod_Server, count);
|
||||
|
||||
// store our pointer (the fake one) for returning it to the calling program
|
||||
*ppReturnedDeviceInterface = pIDirect3DDevice9Ex;
|
||||
|
||||
@@ -128,10 +128,13 @@ int uMod_IDirect3DDevice9::CreateSingleTexture(void)
|
||||
return (RETURN_OK);
|
||||
}
|
||||
|
||||
uMod_IDirect3DDevice9::uMod_IDirect3DDevice9( IDirect3DDevice9* pOriginal, uMod_TextureServer* server)
|
||||
uMod_IDirect3DDevice9::uMod_IDirect3DDevice9( IDirect3DDevice9* pOriginal, uMod_TextureServer* server, int back_buffer_count)
|
||||
{
|
||||
Message( PRE_MESSAGE "::" PRE_MESSAGE "( %lu, %lu): %lu\n", pOriginal, server, this);
|
||||
|
||||
BackBufferCount = back_buffer_count;
|
||||
NormalRendering = true;
|
||||
|
||||
uMod_Server = server;
|
||||
uMod_Client = new uMod_TextureClient( uMod_Server, this); //get a new texture client for this device
|
||||
|
||||
@@ -574,12 +577,22 @@ HRESULT uMod_IDirect3DDevice9::CreateOffscreenPlainSurface(UINT Width,UINT Heigh
|
||||
|
||||
HRESULT uMod_IDirect3DDevice9::SetRenderTarget(DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget)
|
||||
{
|
||||
return(m_pIDirect3DDevice9->SetRenderTarget(RenderTargetIndex,pRenderTarget));
|
||||
{
|
||||
IDirect3DSurface9 *back_buffer;
|
||||
NormalRendering = false;
|
||||
for (int i=0; !NormalRendering && i<BackBufferCount; i++)
|
||||
{
|
||||
m_pIDirect3DDevice9->GetBackBuffer( 0, i, D3DBACKBUFFER_TYPE_MONO, &back_buffer);
|
||||
if (back_buffer == pRenderTarget) NormalRendering = true;
|
||||
back_buffer->Release();
|
||||
}
|
||||
}
|
||||
return (m_pIDirect3DDevice9->SetRenderTarget(RenderTargetIndex,pRenderTarget));
|
||||
}
|
||||
|
||||
HRESULT uMod_IDirect3DDevice9::GetRenderTarget(DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget)
|
||||
{
|
||||
return(m_pIDirect3DDevice9->GetRenderTarget(RenderTargetIndex,ppRenderTarget));
|
||||
return (m_pIDirect3DDevice9->GetRenderTarget(RenderTargetIndex,ppRenderTarget));
|
||||
}
|
||||
|
||||
HRESULT uMod_IDirect3DDevice9::SetDepthStencilSurface(IDirect3DSurface9* pNewZStencil)
|
||||
@@ -594,7 +607,7 @@ HRESULT uMod_IDirect3DDevice9::GetDepthStencilSurface(IDirect3DSurface9** ppZSte
|
||||
|
||||
HRESULT uMod_IDirect3DDevice9::BeginScene(void)
|
||||
{
|
||||
//if ( uMod_Client!=NULL) // this if condition is senseless, since an exception is raised if the client could not be created
|
||||
if ( NormalRendering )
|
||||
{
|
||||
if (LastCreatedTexture!=NULL) // add the last created texture
|
||||
{
|
||||
@@ -742,7 +755,7 @@ HRESULT uMod_IDirect3DDevice9::BeginScene(void)
|
||||
|
||||
HRESULT uMod_IDirect3DDevice9::EndScene(void)
|
||||
{
|
||||
if ( /*uMod_Client!=NULL &&*/ uMod_Client->BoolSaveSingleTexture && SingleTexture!=NULL && SingleVolumeTexture!=NULL && SingleCubeTexture!=NULL)
|
||||
if ( NormalRendering && uMod_Client->BoolSaveSingleTexture && SingleTexture!=NULL && SingleVolumeTexture!=NULL && SingleCubeTexture!=NULL)
|
||||
{
|
||||
if (OSD_Font==NULL) // create the font
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
class uMod_IDirect3DDevice9 : public IDirect3DDevice9
|
||||
{
|
||||
public:
|
||||
uMod_IDirect3DDevice9(IDirect3DDevice9* pOriginal, uMod_TextureServer* server);
|
||||
uMod_IDirect3DDevice9(IDirect3DDevice9* pOriginal, uMod_TextureServer* server, int back_buffer_count);
|
||||
virtual ~uMod_IDirect3DDevice9(void);
|
||||
|
||||
// START: The original DX9 function definitions
|
||||
@@ -195,6 +195,8 @@ public:
|
||||
D3DCOLOR TextureColour;
|
||||
ID3DXFont *OSD_Font;
|
||||
//D3DCOLOR FontColour;
|
||||
int BackBufferCount;
|
||||
bool NormalRendering;
|
||||
|
||||
int uMod_Reference;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
class uMod_IDirect3DDevice9Ex : public IDirect3DDevice9Ex
|
||||
{
|
||||
public:
|
||||
uMod_IDirect3DDevice9Ex( IDirect3DDevice9Ex* pOriginal, uMod_TextureServer* server);
|
||||
uMod_IDirect3DDevice9Ex( IDirect3DDevice9Ex* pOriginal, uMod_TextureServer* server, int back_buffer_count);
|
||||
virtual ~uMod_IDirect3DDevice9Ex(void);
|
||||
|
||||
// START: The original DX9 function definitions
|
||||
@@ -208,6 +208,8 @@ public:
|
||||
D3DCOLOR TextureColour;
|
||||
ID3DXFont *OSD_Font;
|
||||
//D3DCOLOR FontColour;
|
||||
int BackBufferCount;
|
||||
bool NormalRendering;
|
||||
|
||||
int uMod_Reference;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user