mirror of
https://github.com/gwdevhub/gMod.git
synced 2026-07-15 15:09:30 +00:00
uMod2 Alpha Version: known bugs: I disabled the remove device function inside the gui, because something in the event handling goes terrible wrong.
Implemented a some new features.
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
<tool id="org.eclipse.cdt.msvc.cl.dll.debug.971252395" name="C/C++ Compiler (cl)" superClass="org.eclipse.cdt.msvc.cl.dll.debug">
|
||||
<option id="org.eclipse.cdt.msvc.cl.option.includes.1468714055" name="Include Path (/I)" superClass="org.eclipse.cdt.msvc.cl.option.includes" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include""/>
|
||||
<listOptionValue builtIn="false" value=""D:\Programme\wxWidgets-2.9.2\include""/>
|
||||
<listOptionValue builtIn="false" value=""D:\Programme\wxWidgets-2.9.3\include""/>
|
||||
<listOptionValue builtIn="false" value=""C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include""/>
|
||||
</option>
|
||||
<inputType id="org.eclipse.cdt.msvc.cl.inputType.370712665" superClass="org.eclipse.cdt.msvc.cl.inputType"/>
|
||||
|
||||
+21
-1
@@ -5,6 +5,19 @@
|
||||
/README.txt -text
|
||||
uMod_DX10/uMod_DX10_dll.cpp -text
|
||||
uMod_DX10/uMod_DX10_dll.h -text
|
||||
uMod_DX10/uMod_ID3D10Device.cpp -text
|
||||
uMod_DX10/uMod_ID3D10Device.h -text
|
||||
uMod_DX10/uMod_ID3D10Device1.cpp -text
|
||||
uMod_DX10/uMod_ID3D10Device1.h -text
|
||||
uMod_DX10/uMod_ID3D10Texture1D.cpp -text
|
||||
uMod_DX10/uMod_ID3D10Texture1D.h -text
|
||||
uMod_DX10/uMod_ID3D10Texture2D.cpp -text
|
||||
uMod_DX10/uMod_ID3D10Texture2D.h -text
|
||||
uMod_DX10/uMod_ID3D10Texture3D.cpp -text
|
||||
uMod_DX10/uMod_ID3D10Texture3D.h -text
|
||||
uMod_DX10/uMod_IDXGISwapChain.cpp -text
|
||||
uMod_DX10/uMod_IDXGISwapChain.h -text
|
||||
uMod_DX10/uMod_TextureClient_DX10.h -text
|
||||
uMod_DX9/uMod_DX9_dll.cpp -text
|
||||
uMod_DX9/uMod_DX9_dll.h -text
|
||||
uMod_DX9/uMod_IDirect3D9.cpp -text
|
||||
@@ -27,6 +40,7 @@ uMod_DXMain/makefile.gcc -text
|
||||
uMod_DXMain/makefile.vc -text
|
||||
uMod_DXMain/uMod_ArrayHandler.cpp -text
|
||||
uMod_DXMain/uMod_ArrayHandler.h -text
|
||||
uMod_DXMain/uMod_DX10_dll_DIRECT_INJECTION.def -text
|
||||
uMod_DXMain/uMod_DX10_dll_HOOK_INJECTION.def -text
|
||||
uMod_DXMain/uMod_DX9_dll_DIRECT_INJECTION.def -text
|
||||
uMod_DXMain/uMod_DX9_dll_HOOK_INJECTION.def -text
|
||||
@@ -52,7 +66,6 @@ uMod_GUI/bin/languages/uMod_LanguagePackU_Russian.txt -text
|
||||
uMod_GUI/bin/languages/uMod_LanguagePack_Italian.txt -text
|
||||
uMod_GUI/config.gcc -text
|
||||
uMod_GUI/config.vc -text
|
||||
uMod_GUI/makefile.gcc -text
|
||||
uMod_GUI/makefile.vc -text
|
||||
uMod_GUI/uMod.ico -text
|
||||
uMod_GUI/uMod.rc -text
|
||||
@@ -75,14 +88,21 @@ uMod_GUI/uMod_GamePage.h -text
|
||||
uMod_GUI/uMod_Language.cpp -text
|
||||
uMod_GUI/uMod_Language.h -text
|
||||
uMod_GUI/uMod_Main.h -text
|
||||
uMod_GUI/uMod_MiniPanels.cpp -text
|
||||
uMod_GUI/uMod_MiniPanels.h -text
|
||||
uMod_GUI/uMod_ModElement.cpp -text
|
||||
uMod_GUI/uMod_ModElement.h -text
|
||||
uMod_GUI/uMod_Sender.cpp -text
|
||||
uMod_GUI/uMod_Sender.h -text
|
||||
uMod_GUI/uMod_Server.cpp -text
|
||||
uMod_GUI/uMod_Server.h -text
|
||||
uMod_GUI/uMod_Settings.cpp -text
|
||||
uMod_GUI/uMod_Settings.h -text
|
||||
uMod_GUI/uMod_TreeView.cpp -text
|
||||
uMod_GUI/uMod_TreeView.h -text
|
||||
uMod_GUI/unzip.cpp -text
|
||||
uMod_GUI/unzip.h -text
|
||||
uMod_GUI/zip.cpp -text
|
||||
uMod_GUI/zip.h -text
|
||||
/uMod_GlobalDefines.h -text
|
||||
/uMod_Utils.h -text
|
||||
|
||||
+39
-133
@@ -27,26 +27,10 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
#define number_of_byte 5
|
||||
|
||||
#include "uMod_DX10_dll.h"
|
||||
#include "uMod_ID3D10Device.h"
|
||||
#include "uMod_ID3D10Device1.h"
|
||||
#include "uMod_IDXGISwapChain.h"
|
||||
|
||||
//#include "disasm-lib/cpu.c"
|
||||
//#include "disasm-lib/disasm.c"
|
||||
//#include "disasm-lib/disasm_x86.c"
|
||||
|
||||
//#include "disasm-lib/misc.c"
|
||||
//#include "mhook-lib/mhook.cpp"
|
||||
//#include "mhook-lib/mhook.h"
|
||||
|
||||
//#include "uMod_ID3D10Device.h"
|
||||
//#include "uMod_ID3D10Device1.h"
|
||||
//#include "uMod_IDXGISwapChain.h"
|
||||
|
||||
//#include "detours.h"
|
||||
//#include "detourxs/detourxs/detourxs.h"
|
||||
|
||||
/*
|
||||
#include "detourxs/detourxs/ADE32.cpp"
|
||||
#include "detourxs/detourxs/detourxs.cpp"
|
||||
*/
|
||||
/*
|
||||
* global variable which are not linked external
|
||||
*/
|
||||
@@ -56,7 +40,7 @@ HINSTANCE gl_hOriginal_DX101_Dll = NULL;
|
||||
typedef HRESULT (APIENTRY *D3D10CreateDeviceAndSwapChain_type)( IDXGIAdapter*, D3D10_DRIVER_TYPE, HMODULE, UINT, UINT, DXGI_SWAP_CHAIN_DESC*, IDXGISwapChain**, ID3D10Device**);
|
||||
typedef HRESULT (APIENTRY *D3D10CreateDeviceAndSwapChain1_type)( IDXGIAdapter*, D3D10_DRIVER_TYPE, HMODULE, UINT, D3D10_FEATURE_LEVEL1, UINT, DXGI_SWAP_CHAIN_DESC*, IDXGISwapChain**, ID3D10Device1**);
|
||||
|
||||
#ifndef NO_INJECTION
|
||||
#if INJECTION_METHOD==DIRECT_INJECTION || INJECTION_METHOD==HOOK_INJECTION
|
||||
D3D10CreateDeviceAndSwapChain_type D3D10CreateDeviceAndSwapChain_fn = NULL;
|
||||
D3D10CreateDeviceAndSwapChain1_type D3D10CreateDeviceAndSwapChain1_fn = NULL;
|
||||
#endif
|
||||
@@ -71,39 +55,9 @@ D3D10CreateDeviceAndSwapChain1_type D3D10CreateDeviceAndSwapChain1_fn = NULL;
|
||||
void InitDX10(void)
|
||||
{
|
||||
LoadOriginal_DX10_Dll();
|
||||
/*
|
||||
HRESULT ret = E_OUTOFMEMORY;
|
||||
//IDXGIAdapter Adap;#
|
||||
|
||||
D3D10CreateDeviceAndSwapChain_fn = (D3D10CreateDeviceAndSwapChain_type) GetProcAddress( gl_hOriginal_DX10_Dll, "D3D10CreateDeviceAndSwapChain");
|
||||
#if INJECTION_METHOD==DIRECT_INJECTION || INJECTION_METHOD==HOOK_INJECTION
|
||||
|
||||
IDXGISwapChain *pIDXGISwapChain_orig = NULL;
|
||||
ID3D10Device *pID3D10Device_orig = NULL;
|
||||
if (D3D10CreateDeviceAndSwapChain_fn!=NULL)
|
||||
{
|
||||
Message("PRE: create original device\n");
|
||||
ret = D3D10CreateDeviceAndSwapChain_fn( NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, D3D10_CREATE_DEVICE_SINGLETHREADED,
|
||||
D3D10_SDK_VERSION, NULL, &pIDXGISwapChain_orig, &pID3D10Device_orig);
|
||||
if (ret == S_OK )
|
||||
{
|
||||
Message("PRE: created\n");
|
||||
pIDXGISwapChain_orig->Release();
|
||||
pID3D10Device_orig->Release();
|
||||
Message("PRE: released\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
Message("PRE: failed\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Message("PRE: no function\n");
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
#ifndef NO_INJECTION
|
||||
// we detour the original D3D10CreateDeviceAndSwapChain to our uMod_D3D10CreateDeviceAndSwapChain
|
||||
if (gl_hOriginal_DX10_Dll!=NULL)
|
||||
{
|
||||
@@ -111,21 +65,12 @@ void InitDX10(void)
|
||||
if (D3D10CreateDeviceAndSwapChain_fn!=NULL)
|
||||
{
|
||||
Message("Detour: D3D10CreateDeviceAndSwapChain\n");
|
||||
//D3D10CreateDeviceAndSwapChain_fn = (D3D10CreateDeviceAndSwapChain_type)DetourFunc( (BYTE*)D3D10CreateDeviceAndSwapChain_fn, (BYTE*)uMod_D3D10CreateDeviceAndSwapChain, number_of_byte);
|
||||
|
||||
|
||||
//Mhook_SetHook((PVOID*)&D3D10CreateDeviceAndSwapChain_fn, uMod_D3D10CreateDeviceAndSwapChain);
|
||||
D3D10CreateDeviceAndSwapChain_fn = (D3D10CreateDeviceAndSwapChain_type) DetourFunction( (BYTE*)D3D10CreateDeviceAndSwapChain_fn, (BYTE*)uMod_D3D10CreateDeviceAndSwapChain);
|
||||
|
||||
//DetourTransactionBegin();
|
||||
//Messagebox_orig = (Messagebox_typ)DetourAttach(&(PVOID&)MessageBoxA, (PVOID)MyMessageBox);
|
||||
//D3D10CreateDeviceAndSwapChain_fn = (D3D10CreateDeviceAndSwapChain_type) DetourAttach( (BYTE*)D3D10CreateDeviceAndSwapChain_fn, (BYTE*)uMod_D3D10CreateDeviceAndSwapChain);
|
||||
//DetourTransactionCommit();
|
||||
D3D10CreateDeviceAndSwapChain_fn = (D3D10CreateDeviceAndSwapChain_type)DetourFunc( (BYTE*)D3D10CreateDeviceAndSwapChain_fn, (BYTE*)uMod_D3D10CreateDeviceAndSwapChain, number_of_byte);
|
||||
}
|
||||
}
|
||||
if (gl_hOriginal_DX101_Dll!=NULL)
|
||||
{
|
||||
//D3D10CreateDeviceAndSwapChain1_fn = (D3D10CreateDeviceAndSwapChain1_type) GetProcAddress(gl_hOriginal_DX101_Dll, "D3D10CreateDeviceAndSwapChain1");
|
||||
D3D10CreateDeviceAndSwapChain1_fn = (D3D10CreateDeviceAndSwapChain1_type) GetProcAddress(gl_hOriginal_DX101_Dll, "D3D10CreateDeviceAndSwapChain1");
|
||||
if (D3D10CreateDeviceAndSwapChain1_fn!=NULL)
|
||||
{
|
||||
Message("Detour: D3D10CreateDeviceAndSwapChain1\n");
|
||||
@@ -175,7 +120,7 @@ void LoadOriginal_DX10_Dll(void)
|
||||
}
|
||||
|
||||
|
||||
#ifdef NO_INJECTION
|
||||
#if INJECTION_METHOD==NO_INJECTION
|
||||
/*
|
||||
* We do not inject, the game loads this dll by itself thus we must include the Direct3DCreate9 function
|
||||
*/
|
||||
@@ -289,13 +234,16 @@ DWORD WINAPI D3DPERF_GetStatus( void )
|
||||
}
|
||||
|
||||
*/
|
||||
#else
|
||||
#endif
|
||||
|
||||
|
||||
#if INJECTION_METHOD==DIRECT_INJECTION || INJECTION_METHOD==HOOK_INJECTION
|
||||
|
||||
/*
|
||||
* We inject the dll into the game, thus we retour the original Direct3DCreate9 function to our MyDirect3DCreate9 function
|
||||
*/
|
||||
|
||||
HRESULT uMod_D3D10CreateDeviceAndSwapChain(
|
||||
HRESULT APIENTRY uMod_D3D10CreateDeviceAndSwapChain(
|
||||
IDXGIAdapter *pAdapter,
|
||||
D3D10_DRIVER_TYPE DriverType,
|
||||
HMODULE Software,
|
||||
@@ -306,53 +254,27 @@ HRESULT uMod_D3D10CreateDeviceAndSwapChain(
|
||||
ID3D10Device **ppDevice
|
||||
)
|
||||
{
|
||||
Message("uMod_D3D10CreateDeviceAndSwapChain: bla original %lu, uMod %lu\n", D3D10CreateDeviceAndSwapChain_fn, uMod_D3D10CreateDeviceAndSwapChain);
|
||||
|
||||
// in the Internet are many tutorials for detouring functions and all of them will work without the following 5 marked lines
|
||||
// but somehow, for me it only works, if I retour the function and calling afterward the original function
|
||||
|
||||
// BEGIN
|
||||
|
||||
//LoadOriginal_DX10_Dll();
|
||||
|
||||
//RetourFunc((BYTE*) GetProcAddress( gl_hOriginal_DX9_Dll, "Direct3DCreate9"), (BYTE*)Direct3DCreate9_fn, 5);
|
||||
//Direct3DCreate9_fn = (Direct3DCreate9_type) GetProcAddress( gl_hOriginal_DX9_Dll, "Direct3DCreate9");
|
||||
|
||||
RetourFunc((BYTE*) GetProcAddress( gl_hOriginal_DX10_Dll, "D3D10CreateDeviceAndSwapChain"), (BYTE*)D3D10CreateDeviceAndSwapChain_fn, number_of_byte);
|
||||
D3D10CreateDeviceAndSwapChain_fn = (D3D10CreateDeviceAndSwapChain_type) GetProcAddress( gl_hOriginal_DX10_Dll, "D3D10CreateDeviceAndSwapChain");
|
||||
// END
|
||||
|
||||
//DetourRemove( (BYTE*) GetProcAddress( gl_hOriginal_DX10_Dll, "D3D10CreateDeviceAndSwapChain"), (BYTE*)D3D10CreateDeviceAndSwapChain_fn);
|
||||
//D3D10CreateDeviceAndSwapChain_fn = (D3D10CreateDeviceAndSwapChain_type) GetProcAddress( gl_hOriginal_DX10_Dll, "D3D10CreateDeviceAndSwapChain");
|
||||
|
||||
HRESULT ret = E_OUTOFMEMORY;
|
||||
IDXGISwapChain *pIDXGISwapChain_orig = NULL;
|
||||
ID3D10Device *pID3D10Device_orig = NULL;
|
||||
if (D3D10CreateDeviceAndSwapChain_fn)
|
||||
HRESULT ret = D3D10CreateDeviceAndSwapChain_fn(pAdapter,DriverType,Software,Flags,SDKVersion,pSwapChainDesc, ppSwapChain, ppDevice);
|
||||
if (ret==S_OK)
|
||||
{
|
||||
Message("create original device\n");
|
||||
ret = D3D10CreateDeviceAndSwapChain_fn(pAdapter,DriverType,Software,Flags,SDKVersion,pSwapChainDesc, &pIDXGISwapChain_orig, &pID3D10Device_orig);
|
||||
uMod_ID3D10Device *dev = new uMod_ID3D10Device( *ppDevice, gl_TextureServer);
|
||||
*ppDevice = (ID3D10Device*) dev;
|
||||
|
||||
if (ppSwapChain!=NULL)
|
||||
{
|
||||
uMod_IDXGISwapChain *swap = new uMod_IDXGISwapChain( *ppSwapChain, dev);
|
||||
*ppSwapChain = swap;
|
||||
}
|
||||
}
|
||||
/*
|
||||
uMod_IDirect3D9 *pIDirect3D9;
|
||||
if (pIDirect3D9_orig)
|
||||
{
|
||||
pIDirect3D9 = new uMod_IDirect3D9( pIDirect3D9_orig, gl_TextureServer); //creating our uMod_IDirect3D9 object
|
||||
}
|
||||
*/
|
||||
|
||||
// we detour again
|
||||
Message("detour again\n");
|
||||
//D3D10CreateDeviceAndSwapChain_fn = (D3D10CreateDeviceAndSwapChain_type)DetourFunc( (BYTE*)D3D10CreateDeviceAndSwapChain_fn, (BYTE*)uMod_D3D10CreateDeviceAndSwapChain, number_of_byte);
|
||||
|
||||
|
||||
//*ppSwapChain = pIDXGISwapChain_orig;
|
||||
//*ppDevice = pID3D10Device_orig;
|
||||
Message("Fine\n");
|
||||
return (ret);
|
||||
else Message("D3D10CreateDeviceAndSwapChain: Failed\n");
|
||||
D3D10CreateDeviceAndSwapChain_fn = (D3D10CreateDeviceAndSwapChain_type)DetourFunc( (BYTE*)D3D10CreateDeviceAndSwapChain_fn, (BYTE*)uMod_D3D10CreateDeviceAndSwapChain, number_of_byte);
|
||||
return ret;
|
||||
}
|
||||
|
||||
HRESULT uMod_D3D10CreateDeviceAndSwapChain1(
|
||||
HRESULT APIENTRY uMod_D3D10CreateDeviceAndSwapChain1(
|
||||
IDXGIAdapter *pAdapter,
|
||||
D3D10_DRIVER_TYPE DriverType,
|
||||
HMODULE Software,
|
||||
@@ -364,41 +286,25 @@ HRESULT uMod_D3D10CreateDeviceAndSwapChain1(
|
||||
ID3D10Device1 **ppDevice
|
||||
)
|
||||
{
|
||||
Message("uMod_D3D10CreateDeviceAndSwapChain1: original %lu, uMod %lu\n", D3D10CreateDeviceAndSwapChain1_fn, uMod_D3D10CreateDeviceAndSwapChain1);
|
||||
|
||||
// in the Internet are many tutorials for detouring functions and all of them will work without the following 5 marked lines
|
||||
// but somehow, for me it only works, if I retour the function and calling afterward the original function
|
||||
|
||||
// BEGIN
|
||||
|
||||
//LoadOriginal_DX10_Dll();
|
||||
|
||||
RetourFunc((BYTE*) GetProcAddress( gl_hOriginal_DX101_Dll, "D3D10CreateDeviceAndSwapChain1"), (BYTE*)D3D10CreateDeviceAndSwapChain1_fn, 5);
|
||||
D3D10CreateDeviceAndSwapChain1_fn = (D3D10CreateDeviceAndSwapChain1_type) GetProcAddress( gl_hOriginal_DX101_Dll, "D3D10CreateDeviceAndSwapChain1");
|
||||
// END
|
||||
|
||||
HRESULT ret = E_OUTOFMEMORY;
|
||||
IDXGISwapChain *pIDXGISwapChain_orig = NULL;
|
||||
ID3D10Device1 *pID3D10Device1_orig = NULL;
|
||||
if (D3D10CreateDeviceAndSwapChain1_fn)
|
||||
HRESULT ret = D3D10CreateDeviceAndSwapChain1_fn(pAdapter,DriverType,Software,Flags,HardwareLevel,SDKVersion,pSwapChainDesc, ppSwapChain, ppDevice);
|
||||
if (ret==S_OK)
|
||||
{
|
||||
ret = D3D10CreateDeviceAndSwapChain1_fn(pAdapter,DriverType,Software,Flags,HardwareLevel,SDKVersion,pSwapChainDesc, &pIDXGISwapChain_orig, &pID3D10Device1_orig);
|
||||
}
|
||||
/*
|
||||
uMod_IDirect3D9 *pIDirect3D9;
|
||||
if (pIDirect3D9_orig)
|
||||
{
|
||||
pIDirect3D9 = new uMod_IDirect3D9( pIDirect3D9_orig, gl_TextureServer); //creating our uMod_IDirect3D9 object
|
||||
}
|
||||
*/
|
||||
uMod_ID3D10Device1 *dev = new uMod_ID3D10Device1( *ppDevice, gl_TextureServer);
|
||||
*ppDevice = (ID3D10Device1*) dev;
|
||||
|
||||
if (ppSwapChain!=NULL)
|
||||
{
|
||||
uMod_IDXGISwapChain *swap = new uMod_IDXGISwapChain( *ppSwapChain, (uMod_ID3D10Device*)dev);
|
||||
*ppSwapChain = swap;
|
||||
}
|
||||
}
|
||||
else Message("D3D10CreateDeviceAndSwapChain1: Failed\n");
|
||||
|
||||
// we detour again
|
||||
D3D10CreateDeviceAndSwapChain1_fn = (D3D10CreateDeviceAndSwapChain1_type)DetourFunc( (BYTE*)D3D10CreateDeviceAndSwapChain1_fn, (BYTE*)uMod_D3D10CreateDeviceAndSwapChain1, 5);
|
||||
//D3D10CreateDeviceAndSwapChain1_fn = (D3D10CreateDeviceAndSwapChain1_type)DetourFunc( (BYTE*)D3D10CreateDeviceAndSwapChain1_fn, (BYTE*)uMod_D3D10CreateDeviceAndSwapChain1, 5);
|
||||
|
||||
|
||||
*ppSwapChain = pIDXGISwapChain_orig;
|
||||
*ppDevice = pID3D10Device1_orig;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ void LoadOriginal_DX10_Dll(void);
|
||||
void InitDX10();
|
||||
void ExitDX10();
|
||||
|
||||
#ifndef NO_INJECTION
|
||||
#if INJECTION_METHOD==DIRECT_INJECTION || INJECTION_METHOD==HOOK_INJECTION
|
||||
|
||||
HRESULT uMod_D3D10CreateDeviceAndSwapChain(
|
||||
HRESULT APIENTRY uMod_D3D10CreateDeviceAndSwapChain(
|
||||
IDXGIAdapter *pAdapter,
|
||||
D3D10_DRIVER_TYPE DriverType,
|
||||
HMODULE Software,
|
||||
@@ -40,7 +40,7 @@ HRESULT uMod_D3D10CreateDeviceAndSwapChain(
|
||||
ID3D10Device **ppDevice
|
||||
);
|
||||
|
||||
HRESULT uMod_D3D10CreateDeviceAndSwapChain1(
|
||||
HRESULT APIENTRY uMod_D3D10CreateDeviceAndSwapChain1(
|
||||
IDXGIAdapter *pAdapter,
|
||||
D3D10_DRIVER_TYPE DriverType,
|
||||
HMODULE Software,
|
||||
|
||||
@@ -0,0 +1,573 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine.If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../uMod_DXMain/uMod_Main.h"
|
||||
#include "uMod_ID3D10Device.h"
|
||||
|
||||
#ifndef PRE_MESSAGE
|
||||
#define PRE_MESSAGE "uMod_ID3D10Device"
|
||||
#endif
|
||||
|
||||
|
||||
uMod_ID3D10Device::uMod_ID3D10Device( ID3D10Device* pOriginal, uMod_TextureServer* server)
|
||||
{
|
||||
Message( PRE_MESSAGE "::" PRE_MESSAGE "( %lu, %lu): %lu\n", pOriginal, server, this);
|
||||
m_ID3D10Device = pOriginal;
|
||||
uMod_Server = server;
|
||||
RefCounter = 1;
|
||||
}
|
||||
|
||||
uMod_ID3D10Device::~uMod_ID3D10Device()
|
||||
{
|
||||
Message( PRE_MESSAGE "::~" PRE_MESSAGE "(): %lu\n", this);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::QueryInterface( REFIID riid, void** ppvObject)
|
||||
{
|
||||
*ppvObject = NULL;
|
||||
Message( PRE_MESSAGE "::QueryInterface(): %lu\n", this);
|
||||
HRESULT hRes = m_ID3D10Device->QueryInterface(riid, ppvObject);
|
||||
|
||||
if (ppvObject!=NULL)
|
||||
{if (*ppvObject == m_ID3D10Device)// && (riid==IID_ID3D10Device || riid==IID_ID3D10Device1))
|
||||
{
|
||||
RefCounter++; //increasing our counter
|
||||
//*ppvObject = this;
|
||||
Message("hit: %lu, %lu, %lu, %lu %lu\n", riid, IID_ID3D10Device, IID_ID3D10Device1, *ppvObject, this)
|
||||
}}
|
||||
|
||||
return (hRes);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE uMod_ID3D10Device::AddRef(void)
|
||||
{
|
||||
Message( PRE_MESSAGE "::AddRef(): %lu\n", this);
|
||||
RefCounter++;
|
||||
return m_ID3D10Device->AddRef();
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE uMod_ID3D10Device::Release( void)
|
||||
{
|
||||
Message( PRE_MESSAGE "::Release(): (%d) %lu\n", RefCounter, this);
|
||||
if (--RefCounter==0) //if our counter drops to zero, the real device will be deleted, so we clean up before
|
||||
{
|
||||
// we must not release the fake textures, cause they are released if the target textures are released
|
||||
// and the target textures are released by the game.
|
||||
}
|
||||
|
||||
// call original routine
|
||||
ULONG count = m_ID3D10Device->Release();
|
||||
|
||||
// in case no further Ref is there, the Original Object has deleted itself
|
||||
if (count == 0)
|
||||
{
|
||||
delete(this);
|
||||
}
|
||||
|
||||
return(count);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::VSSetConstantBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer *const *ppConstantBuffers)
|
||||
{
|
||||
return m_ID3D10Device->VSSetConstantBuffers( StartSlot, NumBuffers, ppConstantBuffers);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::PSSetShaderResources( UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView *const *ppShaderResourceViews)
|
||||
{
|
||||
return m_ID3D10Device->PSSetShaderResources( StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::PSSetShader( ID3D10PixelShader *pPixelShader)
|
||||
{
|
||||
return m_ID3D10Device->PSSetShader( pPixelShader);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::PSSetSamplers( UINT StartSlot, UINT NumSamplers, ID3D10SamplerState *const *ppSamplers)
|
||||
{
|
||||
return m_ID3D10Device->PSSetSamplers( StartSlot, NumSamplers, ppSamplers);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::VSSetShader( ID3D10VertexShader *pVertexShader)
|
||||
{
|
||||
return m_ID3D10Device->VSSetShader( pVertexShader);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::DrawIndexed( UINT IndexCount,UINT StartIndexLocation, INT BaseVertexLocation)
|
||||
{
|
||||
return m_ID3D10Device->DrawIndexed( IndexCount, StartIndexLocation, BaseVertexLocation);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::Draw( UINT VertexCount, UINT StartVertexLocation)
|
||||
{
|
||||
return m_ID3D10Device->Draw( VertexCount, StartVertexLocation);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::PSSetConstantBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer *const *ppConstantBuffers)
|
||||
{
|
||||
return m_ID3D10Device->PSSetConstantBuffers( StartSlot, NumBuffers, ppConstantBuffers);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::IASetInputLayout( ID3D10InputLayout *pInputLayout)
|
||||
{
|
||||
return m_ID3D10Device->IASetInputLayout( pInputLayout);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::IASetVertexBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer *const *ppVertexBuffers, const UINT *pStrides, const UINT *pOffsets)
|
||||
{
|
||||
return m_ID3D10Device->IASetVertexBuffers( StartSlot, NumBuffers, ppVertexBuffers, pStrides, pOffsets);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::IASetIndexBuffer( ID3D10Buffer *pIndexBuffer, DXGI_FORMAT Format, UINT Offset)
|
||||
{
|
||||
return m_ID3D10Device->IASetIndexBuffer( pIndexBuffer, Format, Offset);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::DrawIndexedInstanced(UINT IndexCountPerInstance, UINT InstanceCount, UINT StartIndexLocation, INT BaseVertexLocation, UINT StartInstanceLocation)
|
||||
{
|
||||
return m_ID3D10Device->DrawIndexedInstanced( IndexCountPerInstance, InstanceCount, StartIndexLocation, BaseVertexLocation, StartInstanceLocation);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::DrawInstanced( UINT VertexCountPerInstance, UINT InstanceCount, UINT StartVertexLocation, UINT StartInstanceLocation)
|
||||
{
|
||||
return m_ID3D10Device->DrawInstanced( VertexCountPerInstance, InstanceCount, StartVertexLocation, StartInstanceLocation);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::GSSetConstantBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer *const *ppConstantBuffers)
|
||||
{
|
||||
return m_ID3D10Device->GSSetConstantBuffers( StartSlot, NumBuffers, ppConstantBuffers);
|
||||
}
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::GSSetShader( ID3D10GeometryShader *pShader)
|
||||
{
|
||||
return m_ID3D10Device->GSSetShader( pShader);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY Topology)
|
||||
{
|
||||
return m_ID3D10Device->IASetPrimitiveTopology( Topology);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::VSSetShaderResources(UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView *const *ppShaderResourceViews)
|
||||
{
|
||||
return m_ID3D10Device->VSSetShaderResources( StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::VSSetSamplers( UINT StartSlot, UINT NumSamplers, ID3D10SamplerState *const *ppSamplers)
|
||||
{
|
||||
return m_ID3D10Device->VSSetSamplers( StartSlot, NumSamplers, ppSamplers);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::SetPredication( ID3D10Predicate *pPredicate, BOOL PredicateValue)
|
||||
{
|
||||
return m_ID3D10Device->SetPredication( pPredicate, PredicateValue);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::GSSetShaderResources( UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView *const *ppShaderResourceViews)
|
||||
{
|
||||
return m_ID3D10Device->GSSetShaderResources( StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::GSSetSamplers(UINT StartSlot, UINT NumSamplers, ID3D10SamplerState *const *ppSamplers)
|
||||
{
|
||||
return m_ID3D10Device->GSSetSamplers( StartSlot, NumSamplers, ppSamplers);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::OMSetRenderTargets( UINT NumViews, ID3D10RenderTargetView *const *ppRenderTargetViews, ID3D10DepthStencilView *pDepthStencilView)
|
||||
{
|
||||
return m_ID3D10Device->OMSetRenderTargets( NumViews, ppRenderTargetViews, pDepthStencilView);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::OMSetBlendState( ID3D10BlendState *pBlendState, const FLOAT BlendFactor[ 4 ], UINT SampleMask)
|
||||
{
|
||||
return m_ID3D10Device->OMSetBlendState( pBlendState, BlendFactor, SampleMask);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::OMSetDepthStencilState( ID3D10DepthStencilState *pDepthStencilState, UINT StencilRef)
|
||||
{
|
||||
return m_ID3D10Device->OMSetDepthStencilState( pDepthStencilState, StencilRef);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::SOSetTargets(UINT NumBuffers, ID3D10Buffer *const *ppSOTargets, const UINT *pOffsets)
|
||||
{
|
||||
return m_ID3D10Device->SOSetTargets( NumBuffers, ppSOTargets, pOffsets);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::DrawAuto(void)
|
||||
{
|
||||
return m_ID3D10Device->DrawAuto();
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::RSSetState( ID3D10RasterizerState *pRasterizerState)
|
||||
{
|
||||
return m_ID3D10Device->RSSetState( pRasterizerState);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::RSSetViewports( UINT NumViewports, const D3D10_VIEWPORT *pViewports)
|
||||
{
|
||||
return m_ID3D10Device->RSSetViewports( NumViewports, pViewports);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::RSSetScissorRects( UINT NumRects, const D3D10_RECT *pRects)
|
||||
{
|
||||
return m_ID3D10Device->RSSetScissorRects( NumRects, pRects);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::CopySubresourceRegion( ID3D10Resource *pDstResource, UINT DstSubresource, UINT DstX, UINT DstY, UINT DstZ, ID3D10Resource *pSrcResource, UINT SrcSubresource, const D3D10_BOX *pSrcBox)
|
||||
{
|
||||
return m_ID3D10Device->CopySubresourceRegion( pDstResource, DstSubresource, DstX, DstY, DstZ, pSrcResource, SrcSubresource, pSrcBox);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::CopyResource( ID3D10Resource *pDstResource, ID3D10Resource *pSrcResource)
|
||||
{
|
||||
return m_ID3D10Device->CopyResource( pDstResource, pSrcResource);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::UpdateSubresource( ID3D10Resource *pDstResource, UINT DstSubresource, const D3D10_BOX *pDstBox, const void *pSrcData, UINT SrcRowPitch, UINT SrcDepthPitch)
|
||||
{
|
||||
return m_ID3D10Device->UpdateSubresource( pDstResource, DstSubresource, pDstBox, pSrcData, SrcRowPitch, SrcDepthPitch);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::ClearRenderTargetView( ID3D10RenderTargetView *pRenderTargetView, const FLOAT ColorRGBA[ 4 ])
|
||||
{
|
||||
return m_ID3D10Device->ClearRenderTargetView( pRenderTargetView, ColorRGBA);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::ClearDepthStencilView( ID3D10DepthStencilView *pDepthStencilView, UINT ClearFlags, FLOAT Depth, UINT8 Stencil)
|
||||
{
|
||||
return m_ID3D10Device->ClearDepthStencilView( pDepthStencilView, ClearFlags, Depth, Stencil);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::GenerateMips( ID3D10ShaderResourceView *pShaderResourceView)
|
||||
{
|
||||
return m_ID3D10Device->GenerateMips( pShaderResourceView);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::ResolveSubresource( ID3D10Resource *pDstResource, UINT DstSubresource, ID3D10Resource *pSrcResource, UINT SrcSubresource, DXGI_FORMAT Format)
|
||||
{
|
||||
return m_ID3D10Device->ResolveSubresource( pDstResource, DstSubresource, pSrcResource, SrcSubresource, Format);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::VSGetConstantBuffers( UINT StartSlot,UINT NumBuffers, ID3D10Buffer **ppConstantBuffers)
|
||||
{
|
||||
return m_ID3D10Device->VSGetConstantBuffers( StartSlot, NumBuffers, ppConstantBuffers);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::PSGetShaderResources( UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView **ppShaderResourceViews)
|
||||
{
|
||||
return m_ID3D10Device->PSGetShaderResources( StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::PSGetShader( ID3D10PixelShader **ppPixelShader)
|
||||
{
|
||||
return m_ID3D10Device->PSGetShader( ppPixelShader);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::PSGetSamplers( UINT StartSlot, UINT NumSamplers, ID3D10SamplerState **ppSamplers)
|
||||
{
|
||||
return m_ID3D10Device->PSGetSamplers( StartSlot, NumSamplers, ppSamplers);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::VSGetShader( ID3D10VertexShader **ppVertexShader)
|
||||
{
|
||||
return m_ID3D10Device->VSGetShader( ppVertexShader);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::PSGetConstantBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer **ppConstantBuffers)
|
||||
{
|
||||
return m_ID3D10Device->PSGetConstantBuffers( StartSlot, NumBuffers, ppConstantBuffers);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::IAGetInputLayout( ID3D10InputLayout **ppInputLayout)
|
||||
{
|
||||
return m_ID3D10Device->IAGetInputLayout( ppInputLayout);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::IAGetVertexBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer **ppVertexBuffers, UINT *pStrides, UINT *pOffsets)
|
||||
{
|
||||
return m_ID3D10Device->IAGetVertexBuffers( StartSlot, NumBuffers, ppVertexBuffers, pStrides, pOffsets);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::IAGetIndexBuffer( ID3D10Buffer **pIndexBuffer, DXGI_FORMAT *Format, UINT *Offset)
|
||||
{
|
||||
return m_ID3D10Device->IAGetIndexBuffer( pIndexBuffer, Format, Offset);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::GSGetConstantBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer **ppConstantBuffers)
|
||||
{
|
||||
return m_ID3D10Device->GSGetConstantBuffers( StartSlot, NumBuffers, ppConstantBuffers);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::GSGetShader( ID3D10GeometryShader **ppGeometryShader)
|
||||
{
|
||||
return m_ID3D10Device->GSGetShader( ppGeometryShader);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::IAGetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY *pTopology)
|
||||
{
|
||||
return m_ID3D10Device->IAGetPrimitiveTopology( pTopology);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::VSGetShaderResources( UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView **ppShaderResourceViews)
|
||||
{
|
||||
return m_ID3D10Device->VSGetShaderResources( StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::VSGetSamplers( UINT StartSlot, UINT NumSamplers, ID3D10SamplerState **ppSamplers)
|
||||
{
|
||||
return m_ID3D10Device->VSGetSamplers( StartSlot, NumSamplers, ppSamplers);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::GetPredication( ID3D10Predicate **ppPredicate, BOOL *pPredicateValue)
|
||||
{
|
||||
return m_ID3D10Device->GetPredication( ppPredicate, pPredicateValue);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::GSGetShaderResources( UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView **ppShaderResourceViews)
|
||||
{
|
||||
return m_ID3D10Device->GSGetShaderResources( StartSlot, NumViews, ppShaderResourceViews);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::GSGetSamplers( UINT StartSlot, UINT NumSamplers, ID3D10SamplerState **ppSamplers)
|
||||
{
|
||||
return m_ID3D10Device->GSGetSamplers( StartSlot, NumSamplers, ppSamplers);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::OMGetRenderTargets( UINT NumViews, ID3D10RenderTargetView **ppRenderTargetViews, ID3D10DepthStencilView **ppDepthStencilView)
|
||||
{
|
||||
return m_ID3D10Device->OMGetRenderTargets( NumViews, ppRenderTargetViews, ppDepthStencilView);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::OMGetBlendState( ID3D10BlendState **ppBlendState, FLOAT BlendFactor[ 4 ], UINT *pSampleMask)
|
||||
{
|
||||
return m_ID3D10Device->OMGetBlendState( ppBlendState, BlendFactor, pSampleMask);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::OMGetDepthStencilState( ID3D10DepthStencilState **ppDepthStencilState, UINT *pStencilRef)
|
||||
{
|
||||
return m_ID3D10Device->OMGetDepthStencilState( ppDepthStencilState, pStencilRef);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::SOGetTargets( UINT NumBuffers, ID3D10Buffer **ppSOTargets, UINT *pOffsets)
|
||||
{
|
||||
return m_ID3D10Device->SOGetTargets( NumBuffers, ppSOTargets, pOffsets);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::RSGetState( ID3D10RasterizerState **ppRasterizerState)
|
||||
{
|
||||
return m_ID3D10Device->RSGetState( ppRasterizerState);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::RSGetViewports( UINT *NumViewports, D3D10_VIEWPORT *pViewports)
|
||||
{
|
||||
return m_ID3D10Device->RSGetViewports( NumViewports, pViewports);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::RSGetScissorRects( UINT *NumRects, D3D10_RECT *pRects)
|
||||
{
|
||||
return m_ID3D10Device->RSGetScissorRects( NumRects, pRects);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::GetDeviceRemovedReason(void)
|
||||
{
|
||||
return m_ID3D10Device->GetDeviceRemovedReason();
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::SetExceptionMode( UINT RaiseFlags)
|
||||
{
|
||||
return m_ID3D10Device->SetExceptionMode( RaiseFlags);
|
||||
}
|
||||
|
||||
UINT STDMETHODCALLTYPE uMod_ID3D10Device::GetExceptionMode(void)
|
||||
{
|
||||
return m_ID3D10Device->GetExceptionMode();
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::GetPrivateData( REFGUID guid, UINT *pDataSize, void *pData)
|
||||
{
|
||||
return m_ID3D10Device->GetPrivateData( guid, pDataSize, pData);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::SetPrivateData( REFGUID guid, UINT DataSize, const void *pData)
|
||||
{
|
||||
return m_ID3D10Device->SetPrivateData( guid, DataSize, pData);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::SetPrivateDataInterface( REFGUID guid, const IUnknown *pData)
|
||||
{
|
||||
return m_ID3D10Device->SetPrivateDataInterface( guid, pData);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::ClearState( void)
|
||||
{
|
||||
return m_ID3D10Device->ClearState();
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::Flush( void)
|
||||
{
|
||||
return m_ID3D10Device->Flush();
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreateBuffer( const D3D10_BUFFER_DESC *pDesc, const D3D10_SUBRESOURCE_DATA *pInitialData, ID3D10Buffer **ppBuffer)
|
||||
{
|
||||
return m_ID3D10Device->CreateBuffer( pDesc, pInitialData, ppBuffer);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreateTexture1D( const D3D10_TEXTURE1D_DESC *pDesc, const D3D10_SUBRESOURCE_DATA *pInitialData, ID3D10Texture1D **ppTexture1D)
|
||||
{
|
||||
HRESULT hRes = m_ID3D10Device->CreateTexture1D( pDesc, pInitialData, ppTexture1D);
|
||||
if( SUCCEEDED( hRes ) )
|
||||
{
|
||||
*ppTexture1D = new uMod_ID3D10Texture1D( *ppTexture1D);
|
||||
}
|
||||
return hRes;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreateTexture2D( const D3D10_TEXTURE2D_DESC *pDesc, const D3D10_SUBRESOURCE_DATA *pInitialData, ID3D10Texture2D **ppTexture2D)
|
||||
{
|
||||
HRESULT hRes = m_ID3D10Device->CreateTexture2D( pDesc, pInitialData, ppTexture2D);
|
||||
if( SUCCEEDED( hRes ) )
|
||||
{
|
||||
*ppTexture2D = new uMod_ID3D10Texture2D( *ppTexture2D);
|
||||
}
|
||||
return hRes;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreateTexture3D( const D3D10_TEXTURE3D_DESC *pDesc, const D3D10_SUBRESOURCE_DATA *pInitialData, ID3D10Texture3D **ppTexture3D)
|
||||
{
|
||||
HRESULT hRes = m_ID3D10Device->CreateTexture3D( pDesc, pInitialData, ppTexture3D);
|
||||
if( SUCCEEDED( hRes ) )
|
||||
{
|
||||
*ppTexture3D = new uMod_ID3D10Texture3D( *ppTexture3D);
|
||||
}
|
||||
return hRes;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreateShaderResourceView( ID3D10Resource *pResource, const D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc, ID3D10ShaderResourceView **ppSRView)
|
||||
{
|
||||
return m_ID3D10Device->CreateShaderResourceView( pResource, pDesc, ppSRView);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreateRenderTargetView( ID3D10Resource *pResource, const D3D10_RENDER_TARGET_VIEW_DESC *pDesc, ID3D10RenderTargetView **ppRTView)
|
||||
{
|
||||
return m_ID3D10Device->CreateRenderTargetView( pResource, pDesc, ppRTView);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreateDepthStencilView( ID3D10Resource *pResource, const D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc, ID3D10DepthStencilView **ppDepthStencilView)
|
||||
{
|
||||
return m_ID3D10Device->CreateDepthStencilView( pResource, pDesc, ppDepthStencilView);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreateInputLayout( const D3D10_INPUT_ELEMENT_DESC *pInputElementDescs, UINT NumElements, const void *pShaderBytecodeWithInputSignature, SIZE_T BytecodeLength, ID3D10InputLayout **ppInputLayout)
|
||||
{
|
||||
return m_ID3D10Device->CreateInputLayout( pInputElementDescs, NumElements, pShaderBytecodeWithInputSignature, BytecodeLength, ppInputLayout);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreateVertexShader( const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10VertexShader **ppVertexShader)
|
||||
{
|
||||
return m_ID3D10Device->CreateVertexShader( pShaderBytecode, BytecodeLength, ppVertexShader);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreateGeometryShader( const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10GeometryShader **ppGeometryShader)
|
||||
{
|
||||
return m_ID3D10Device->CreateGeometryShader( pShaderBytecode, BytecodeLength, ppGeometryShader);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreateGeometryShaderWithStreamOutput( const void *pShaderBytecode, SIZE_T BytecodeLength, const D3D10_SO_DECLARATION_ENTRY *pSODeclaration, UINT NumEntries, UINT OutputStreamStride, ID3D10GeometryShader **ppGeometryShader)
|
||||
{
|
||||
return m_ID3D10Device->CreateGeometryShaderWithStreamOutput( pShaderBytecode, BytecodeLength, pSODeclaration, NumEntries, OutputStreamStride, ppGeometryShader);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreatePixelShader( const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10PixelShader **ppPixelShader)
|
||||
{
|
||||
return m_ID3D10Device->CreatePixelShader( pShaderBytecode, BytecodeLength, ppPixelShader);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreateBlendState( const D3D10_BLEND_DESC *pBlendStateDesc, ID3D10BlendState **ppBlendState)
|
||||
{
|
||||
return m_ID3D10Device->CreateBlendState( pBlendStateDesc, ppBlendState);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreateDepthStencilState( const D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc, ID3D10DepthStencilState **ppDepthStencilState)
|
||||
{
|
||||
return m_ID3D10Device->CreateDepthStencilState( pDepthStencilDesc, ppDepthStencilState);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreateRasterizerState( const D3D10_RASTERIZER_DESC *pRasterizerDesc, ID3D10RasterizerState **ppRasterizerState)
|
||||
{
|
||||
return m_ID3D10Device->CreateRasterizerState( pRasterizerDesc, ppRasterizerState);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreateSamplerState( const D3D10_SAMPLER_DESC *pSamplerDesc, ID3D10SamplerState **ppSamplerState)
|
||||
{
|
||||
return m_ID3D10Device->CreateSamplerState( pSamplerDesc, ppSamplerState);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreateQuery( const D3D10_QUERY_DESC *pQueryDesc, ID3D10Query **ppQuery)
|
||||
{
|
||||
return m_ID3D10Device->CreateQuery( pQueryDesc, ppQuery);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreatePredicate( const D3D10_QUERY_DESC *pPredicateDesc, ID3D10Predicate **ppPredicate)
|
||||
{
|
||||
return m_ID3D10Device->CreatePredicate( pPredicateDesc, ppPredicate);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CreateCounter( const D3D10_COUNTER_DESC *pCounterDesc, ID3D10Counter **ppCounter)
|
||||
{
|
||||
return m_ID3D10Device->CreateCounter( pCounterDesc, ppCounter);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CheckFormatSupport( DXGI_FORMAT Format, UINT *pFormatSupport)
|
||||
{
|
||||
return m_ID3D10Device->CheckFormatSupport( Format, pFormatSupport);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CheckMultisampleQualityLevels( DXGI_FORMAT Format, UINT SampleCount, UINT *pNumQualityLevels)
|
||||
{
|
||||
return m_ID3D10Device->CheckMultisampleQualityLevels( Format, SampleCount, pNumQualityLevels);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::CheckCounterInfo( D3D10_COUNTER_INFO *pCounterInfo)
|
||||
{
|
||||
return m_ID3D10Device->CheckCounterInfo( pCounterInfo);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::CheckCounter( const D3D10_COUNTER_DESC *pDesc, D3D10_COUNTER_TYPE *pType, UINT *pActiveCounters, LPSTR szName, UINT *pNameLength, LPSTR szUnits, UINT *pUnitsLength, LPSTR szDescription, UINT *pDescriptionLength)
|
||||
{
|
||||
return m_ID3D10Device->CheckCounter( pDesc, pType, pActiveCounters, szName, pNameLength, szUnits, pUnitsLength, szDescription, pDescriptionLength);
|
||||
}
|
||||
|
||||
UINT STDMETHODCALLTYPE uMod_ID3D10Device::GetCreationFlags( void)
|
||||
{
|
||||
return m_ID3D10Device->GetCreationFlags();
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device::OpenSharedResource( HANDLE hResource, REFIID ReturnedInterface, void **ppResource)
|
||||
{
|
||||
return m_ID3D10Device->OpenSharedResource( hResource, ReturnedInterface, ppResource);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::SetTextFilterSize( UINT Width, UINT Height)
|
||||
{
|
||||
return m_ID3D10Device->SetTextFilterSize( Width, Height);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Device::GetTextFilterSize( UINT *pWidth, UINT *pHeight)
|
||||
{
|
||||
return m_ID3D10Device->GetTextFilterSize( pWidth, pHeight);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,251 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __CDT_PARSER__
|
||||
#undef UMOD_ID3D10DEVICE_H_
|
||||
#endif
|
||||
|
||||
#ifndef UMOD_ID3D10DEVICE_H_
|
||||
#define UMOD_ID3D10DEVICE_H_
|
||||
|
||||
|
||||
#include <d3d10_1.h>
|
||||
#include <d3d10.h>
|
||||
#include <D3D10Misc.h>
|
||||
#include <d3dx10.h>
|
||||
#include "..\uMod_DXMain\uMod_TextureServer.h"
|
||||
#include "uMod_TextureClient_DX10.h"
|
||||
#include "uMod_ID3D10Texture1D.h"
|
||||
#include "uMod_ID3D10Texture2D.h"
|
||||
#include "uMod_ID3D10Texture3D.h"
|
||||
|
||||
|
||||
|
||||
|
||||
class uMod_ID3D10Device : public ID3D10Device
|
||||
{
|
||||
public:
|
||||
uMod_ID3D10Device(ID3D10Device* pOriginal, uMod_TextureServer* server);
|
||||
virtual ~uMod_ID3D10Device();
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, void** ppvObject);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void);
|
||||
ULONG STDMETHODCALLTYPE Release( void);
|
||||
|
||||
void STDMETHODCALLTYPE VSSetConstantBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer *const *ppConstantBuffers);
|
||||
|
||||
void STDMETHODCALLTYPE PSSetShaderResources( UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView *const *ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE PSSetShader( ID3D10PixelShader *pPixelShader);
|
||||
|
||||
void STDMETHODCALLTYPE PSSetSamplers( UINT StartSlot, UINT NumSamplers, ID3D10SamplerState *const *ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE VSSetShader( ID3D10VertexShader *pVertexShader);
|
||||
|
||||
void STDMETHODCALLTYPE DrawIndexed( UINT IndexCount, UINT StartIndexLocation, INT BaseVertexLocation);
|
||||
|
||||
void STDMETHODCALLTYPE Draw( UINT VertexCount, UINT StartVertexLocation);
|
||||
|
||||
void STDMETHODCALLTYPE PSSetConstantBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer *const *ppConstantBuffers);
|
||||
|
||||
void STDMETHODCALLTYPE IASetInputLayout( ID3D10InputLayout *pInputLayout);
|
||||
|
||||
void STDMETHODCALLTYPE IASetVertexBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer *const *ppVertexBuffers, const UINT *pStrides, const UINT *pOffsets);
|
||||
|
||||
void STDMETHODCALLTYPE IASetIndexBuffer( ID3D10Buffer *pIndexBuffer, DXGI_FORMAT Format, UINT Offset);
|
||||
|
||||
void STDMETHODCALLTYPE DrawIndexedInstanced( UINT IndexCountPerInstance, UINT InstanceCount, UINT StartIndexLocation, INT BaseVertexLocation, UINT StartInstanceLocation);
|
||||
|
||||
void STDMETHODCALLTYPE DrawInstanced( UINT VertexCountPerInstance, UINT InstanceCount, UINT StartVertexLocation, UINT StartInstanceLocation);
|
||||
|
||||
void STDMETHODCALLTYPE GSSetConstantBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer *const *ppConstantBuffers);
|
||||
|
||||
void STDMETHODCALLTYPE GSSetShader( ID3D10GeometryShader *pShader);
|
||||
|
||||
void STDMETHODCALLTYPE IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY Topology);
|
||||
|
||||
void STDMETHODCALLTYPE VSSetShaderResources( UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView *const *ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE VSSetSamplers( UINT StartSlot, UINT NumSamplers, ID3D10SamplerState *const *ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE SetPredication( ID3D10Predicate *pPredicate, BOOL PredicateValue);
|
||||
|
||||
void STDMETHODCALLTYPE GSSetShaderResources( UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView *const *ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE GSSetSamplers( UINT StartSlot, UINT NumSamplers, ID3D10SamplerState *const *ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE OMSetRenderTargets( UINT NumViews, ID3D10RenderTargetView *const *ppRenderTargetViews, ID3D10DepthStencilView *pDepthStencilView);
|
||||
|
||||
void STDMETHODCALLTYPE OMSetBlendState( ID3D10BlendState *pBlendState, const FLOAT BlendFactor[ 4 ], UINT SampleMask);
|
||||
|
||||
void STDMETHODCALLTYPE OMSetDepthStencilState( ID3D10DepthStencilState *pDepthStencilState, UINT StencilRef);
|
||||
|
||||
void STDMETHODCALLTYPE SOSetTargets( UINT NumBuffers, ID3D10Buffer *const *ppSOTargets, const UINT *pOffsets);
|
||||
|
||||
void STDMETHODCALLTYPE DrawAuto(void);
|
||||
|
||||
void STDMETHODCALLTYPE RSSetState( ID3D10RasterizerState *pRasterizerState);
|
||||
|
||||
void STDMETHODCALLTYPE RSSetViewports( UINT NumViewports, const D3D10_VIEWPORT *pViewports);
|
||||
|
||||
void STDMETHODCALLTYPE RSSetScissorRects( UINT NumRects, const D3D10_RECT *pRects);
|
||||
|
||||
void STDMETHODCALLTYPE CopySubresourceRegion( ID3D10Resource *pDstResource, UINT DstSubresource, UINT DstX, UINT DstY, UINT DstZ, ID3D10Resource *pSrcResource, UINT SrcSubresource, const D3D10_BOX *pSrcBox);
|
||||
|
||||
void STDMETHODCALLTYPE CopyResource( ID3D10Resource *pDstResource, ID3D10Resource *pSrcResource);
|
||||
|
||||
void STDMETHODCALLTYPE UpdateSubresource( ID3D10Resource *pDstResource, UINT DstSubresource, const D3D10_BOX *pDstBox, const void *pSrcData, UINT SrcRowPitch, UINT SrcDepthPitch);
|
||||
|
||||
void STDMETHODCALLTYPE ClearRenderTargetView( ID3D10RenderTargetView *pRenderTargetView, const FLOAT ColorRGBA[ 4 ]);
|
||||
|
||||
void STDMETHODCALLTYPE ClearDepthStencilView( ID3D10DepthStencilView *pDepthStencilView, UINT ClearFlags, FLOAT Depth, UINT8 Stencil);
|
||||
|
||||
void STDMETHODCALLTYPE GenerateMips( ID3D10ShaderResourceView *pShaderResourceView);
|
||||
|
||||
void STDMETHODCALLTYPE ResolveSubresource( ID3D10Resource *pDstResource, UINT DstSubresource, ID3D10Resource *pSrcResource, UINT SrcSubresource, DXGI_FORMAT Format);
|
||||
|
||||
void STDMETHODCALLTYPE VSGetConstantBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer **ppConstantBuffers);
|
||||
|
||||
void STDMETHODCALLTYPE PSGetShaderResources( UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView **ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE PSGetShader( ID3D10PixelShader **ppPixelShader);
|
||||
|
||||
void STDMETHODCALLTYPE PSGetSamplers( UINT StartSlot, UINT NumSamplers, ID3D10SamplerState **ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE VSGetShader( ID3D10VertexShader **ppVertexShader);
|
||||
|
||||
void STDMETHODCALLTYPE PSGetConstantBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer **ppConstantBuffers);
|
||||
|
||||
void STDMETHODCALLTYPE IAGetInputLayout( ID3D10InputLayout **ppInputLayout);
|
||||
|
||||
void STDMETHODCALLTYPE IAGetVertexBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer **ppVertexBuffers, UINT *pStrides, UINT *pOffsets);
|
||||
|
||||
void STDMETHODCALLTYPE IAGetIndexBuffer( ID3D10Buffer **pIndexBuffer, DXGI_FORMAT *Format, UINT *Offset);
|
||||
|
||||
void STDMETHODCALLTYPE GSGetConstantBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer **ppConstantBuffers);
|
||||
|
||||
void STDMETHODCALLTYPE GSGetShader( ID3D10GeometryShader **ppGeometryShader);
|
||||
|
||||
void STDMETHODCALLTYPE IAGetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY *pTopology);
|
||||
|
||||
void STDMETHODCALLTYPE VSGetShaderResources( UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView **ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE VSGetSamplers( UINT StartSlot, UINT NumSamplers, ID3D10SamplerState **ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE GetPredication( ID3D10Predicate **ppPredicate, BOOL *pPredicateValue);
|
||||
|
||||
void STDMETHODCALLTYPE GSGetShaderResources( UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView **ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE GSGetSamplers( UINT StartSlot, UINT NumSamplers, ID3D10SamplerState **ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE OMGetRenderTargets( UINT NumViews, ID3D10RenderTargetView **ppRenderTargetViews, ID3D10DepthStencilView **ppDepthStencilView);
|
||||
|
||||
void STDMETHODCALLTYPE OMGetBlendState( ID3D10BlendState **ppBlendState, FLOAT BlendFactor[ 4 ], UINT *pSampleMask);
|
||||
|
||||
void STDMETHODCALLTYPE OMGetDepthStencilState( ID3D10DepthStencilState **ppDepthStencilState, UINT *pStencilRef);
|
||||
|
||||
void STDMETHODCALLTYPE SOGetTargets( UINT NumBuffers, ID3D10Buffer **ppSOTargets, UINT *pOffsets);
|
||||
|
||||
void STDMETHODCALLTYPE RSGetState( ID3D10RasterizerState **ppRasterizerState);
|
||||
|
||||
void STDMETHODCALLTYPE RSGetViewports( UINT *NumViewports, D3D10_VIEWPORT *pViewports);
|
||||
|
||||
void STDMETHODCALLTYPE RSGetScissorRects( UINT *NumRects, D3D10_RECT *pRects);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetDeviceRemovedReason(void);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetExceptionMode( UINT RaiseFlags);
|
||||
|
||||
UINT STDMETHODCALLTYPE GetExceptionMode(void);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetPrivateData( REFGUID guid,UINT *pDataSize, void *pData);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateData( REFGUID guid, UINT DataSize, const void *pData);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( REFGUID guid, const IUnknown *pData);
|
||||
|
||||
void STDMETHODCALLTYPE ClearState( void);
|
||||
|
||||
void STDMETHODCALLTYPE Flush( void);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateBuffer( const D3D10_BUFFER_DESC *pDesc, const D3D10_SUBRESOURCE_DATA *pInitialData, ID3D10Buffer **ppBuffer);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateTexture1D( const D3D10_TEXTURE1D_DESC *pDesc, const D3D10_SUBRESOURCE_DATA *pInitialData, ID3D10Texture1D **ppTexture1D);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateTexture2D( const D3D10_TEXTURE2D_DESC *pDesc, const D3D10_SUBRESOURCE_DATA *pInitialData, ID3D10Texture2D **ppTexture2D);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateTexture3D( const D3D10_TEXTURE3D_DESC *pDesc, const D3D10_SUBRESOURCE_DATA *pInitialData, ID3D10Texture3D **ppTexture3D);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateShaderResourceView( ID3D10Resource *pResource, const D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc, ID3D10ShaderResourceView **ppSRView);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateRenderTargetView( ID3D10Resource *pResource, const D3D10_RENDER_TARGET_VIEW_DESC *pDesc, ID3D10RenderTargetView **ppRTView);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateDepthStencilView( ID3D10Resource *pResource, const D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc, ID3D10DepthStencilView **ppDepthStencilView);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateInputLayout( const D3D10_INPUT_ELEMENT_DESC *pInputElementDescs, UINT NumElements, const void *pShaderBytecodeWithInputSignature, SIZE_T BytecodeLength, ID3D10InputLayout **ppInputLayout);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateVertexShader( const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10VertexShader **ppVertexShader);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateGeometryShader( const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10GeometryShader **ppGeometryShader);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateGeometryShaderWithStreamOutput( const void *pShaderBytecode, SIZE_T BytecodeLength, const D3D10_SO_DECLARATION_ENTRY *pSODeclaration, UINT NumEntries, UINT OutputStreamStride, ID3D10GeometryShader **ppGeometryShader);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreatePixelShader( const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10PixelShader **ppPixelShader);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateBlendState( const D3D10_BLEND_DESC *pBlendStateDesc, ID3D10BlendState **ppBlendState);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateDepthStencilState( const D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc, ID3D10DepthStencilState **ppDepthStencilState);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateRasterizerState( const D3D10_RASTERIZER_DESC *pRasterizerDesc, ID3D10RasterizerState **ppRasterizerState);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateSamplerState( const D3D10_SAMPLER_DESC *pSamplerDesc, ID3D10SamplerState **ppSamplerState);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateQuery( const D3D10_QUERY_DESC *pQueryDesc, ID3D10Query **ppQuery);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreatePredicate( const D3D10_QUERY_DESC *pPredicateDesc, ID3D10Predicate **ppPredicate);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateCounter( const D3D10_COUNTER_DESC *pCounterDesc, ID3D10Counter **ppCounter);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CheckFormatSupport( DXGI_FORMAT Format, UINT *pFormatSupport);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CheckMultisampleQualityLevels( DXGI_FORMAT Format, UINT SampleCount, UINT *pNumQualityLevels);
|
||||
|
||||
void STDMETHODCALLTYPE CheckCounterInfo( D3D10_COUNTER_INFO *pCounterInfo);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CheckCounter( const D3D10_COUNTER_DESC *pDesc, D3D10_COUNTER_TYPE *pType, UINT *pActiveCounters, LPSTR szName, UINT *pNameLength, LPSTR szUnits, UINT *pUnitsLength, LPSTR szDescription, UINT *pDescriptionLength);
|
||||
|
||||
UINT STDMETHODCALLTYPE GetCreationFlags( void);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OpenSharedResource( HANDLE hResource, REFIID ReturnedInterface, void **ppResource);
|
||||
|
||||
void STDMETHODCALLTYPE SetTextFilterSize( UINT Width, UINT Height);
|
||||
|
||||
void STDMETHODCALLTYPE GetTextFilterSize( UINT *pWidth, UINT *pHeight);
|
||||
|
||||
|
||||
ID3D10Device* m_ID3D10Device;
|
||||
uMod_TextureServer* uMod_Server;
|
||||
uMod_TextureClient_DX10* uMod_Client;
|
||||
|
||||
private:
|
||||
unsigned int RefCounter;
|
||||
};
|
||||
|
||||
|
||||
#endif /* UMOD_ID3D10DEVICE_H_ */
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#define UMOD_ID3D10DEVICE_H_
|
||||
|
||||
#include "..\uMod_DXMain\uMod_Main.h"
|
||||
#include "uMod_ID3D10Device1.h"
|
||||
|
||||
#define uMod_ID3D10Device uMod_ID3D10Device1
|
||||
#define ID3D10Device ID3D10Device1
|
||||
#define m_ID3D10Device m_ID3D10Device1
|
||||
|
||||
//#define RETURN_QueryInterface 0x01000001L
|
||||
#define PRE_MESSAGE "uMod_ID3D10Device1"
|
||||
#define DEF_DX_VERSION VERSION_DX101
|
||||
|
||||
|
||||
#include "uMod_ID3D10Device.cpp"
|
||||
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device1::CreateShaderResourceView1( ID3D10Resource *pResource, const D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc, ID3D10ShaderResourceView1 **ppSRView)
|
||||
{
|
||||
return m_ID3D10Device1->CreateShaderResourceView1( pResource, pDesc, ppSRView);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Device1::CreateBlendState1( const D3D10_BLEND_DESC1 *pBlendStateDesc, ID3D10BlendState1 **ppBlendState)
|
||||
{
|
||||
return m_ID3D10Device1->CreateBlendState1( pBlendStateDesc, ppBlendState);
|
||||
}
|
||||
|
||||
D3D10_FEATURE_LEVEL1 STDMETHODCALLTYPE uMod_ID3D10Device1::GetFeatureLevel(void)
|
||||
{
|
||||
return m_ID3D10Device1->GetFeatureLevel();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,258 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef UMOD_ID3D10DEVICE1_H_
|
||||
#define UMOD_ID3D10DEVICE1_H_
|
||||
|
||||
|
||||
#include <d3d10_1.h>
|
||||
#include <d3d10.h>
|
||||
#include <D3D10Misc.h>
|
||||
#include <d3dx10.h>
|
||||
#include "..\uMod_DXMain\uMod_TextureServer.h"
|
||||
#include "uMod_TextureClient_DX10.h"
|
||||
#include "uMod_ID3D10Texture1D.h"
|
||||
#include "uMod_ID3D10Texture2D.h"
|
||||
#include "uMod_ID3D10Texture3D.h"
|
||||
|
||||
|
||||
|
||||
|
||||
class uMod_ID3D10Device1 : public ID3D10Device1
|
||||
{
|
||||
public:
|
||||
uMod_ID3D10Device1(ID3D10Device1* pOriginal, uMod_TextureServer* server);
|
||||
virtual ~uMod_ID3D10Device1();
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, void** ppvObject);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void);
|
||||
ULONG STDMETHODCALLTYPE Release( void);
|
||||
|
||||
void STDMETHODCALLTYPE VSSetConstantBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer *const *ppConstantBuffers);
|
||||
|
||||
void STDMETHODCALLTYPE PSSetShaderResources( UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView *const *ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE PSSetShader( ID3D10PixelShader *pPixelShader);
|
||||
|
||||
void STDMETHODCALLTYPE PSSetSamplers( UINT StartSlot, UINT NumSamplers, ID3D10SamplerState *const *ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE VSSetShader( ID3D10VertexShader *pVertexShader);
|
||||
|
||||
void STDMETHODCALLTYPE DrawIndexed( UINT IndexCount, UINT StartIndexLocation, INT BaseVertexLocation);
|
||||
|
||||
void STDMETHODCALLTYPE Draw( UINT VertexCount, UINT StartVertexLocation);
|
||||
|
||||
void STDMETHODCALLTYPE PSSetConstantBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer *const *ppConstantBuffers);
|
||||
|
||||
void STDMETHODCALLTYPE IASetInputLayout( ID3D10InputLayout *pInputLayout);
|
||||
|
||||
void STDMETHODCALLTYPE IASetVertexBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer *const *ppVertexBuffers, const UINT *pStrides, const UINT *pOffsets);
|
||||
|
||||
void STDMETHODCALLTYPE IASetIndexBuffer( ID3D10Buffer *pIndexBuffer, DXGI_FORMAT Format, UINT Offset);
|
||||
|
||||
void STDMETHODCALLTYPE DrawIndexedInstanced( UINT IndexCountPerInstance, UINT InstanceCount, UINT StartIndexLocation, INT BaseVertexLocation, UINT StartInstanceLocation);
|
||||
|
||||
void STDMETHODCALLTYPE DrawInstanced( UINT VertexCountPerInstance, UINT InstanceCount, UINT StartVertexLocation, UINT StartInstanceLocation);
|
||||
|
||||
void STDMETHODCALLTYPE GSSetConstantBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer *const *ppConstantBuffers);
|
||||
|
||||
void STDMETHODCALLTYPE GSSetShader( ID3D10GeometryShader *pShader);
|
||||
|
||||
void STDMETHODCALLTYPE IASetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY Topology);
|
||||
|
||||
void STDMETHODCALLTYPE VSSetShaderResources( UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView *const *ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE VSSetSamplers( UINT StartSlot, UINT NumSamplers, ID3D10SamplerState *const *ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE SetPredication( ID3D10Predicate *pPredicate, BOOL PredicateValue);
|
||||
|
||||
void STDMETHODCALLTYPE GSSetShaderResources( UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView *const *ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE GSSetSamplers( UINT StartSlot, UINT NumSamplers, ID3D10SamplerState *const *ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE OMSetRenderTargets( UINT NumViews, ID3D10RenderTargetView *const *ppRenderTargetViews, ID3D10DepthStencilView *pDepthStencilView);
|
||||
|
||||
void STDMETHODCALLTYPE OMSetBlendState( ID3D10BlendState *pBlendState, const FLOAT BlendFactor[ 4 ], UINT SampleMask);
|
||||
|
||||
void STDMETHODCALLTYPE OMSetDepthStencilState( ID3D10DepthStencilState *pDepthStencilState, UINT StencilRef);
|
||||
|
||||
void STDMETHODCALLTYPE SOSetTargets( UINT NumBuffers, ID3D10Buffer *const *ppSOTargets, const UINT *pOffsets);
|
||||
|
||||
void STDMETHODCALLTYPE DrawAuto(void);
|
||||
|
||||
void STDMETHODCALLTYPE RSSetState( ID3D10RasterizerState *pRasterizerState);
|
||||
|
||||
void STDMETHODCALLTYPE RSSetViewports( UINT NumViewports, const D3D10_VIEWPORT *pViewports);
|
||||
|
||||
void STDMETHODCALLTYPE RSSetScissorRects( UINT NumRects, const D3D10_RECT *pRects);
|
||||
|
||||
void STDMETHODCALLTYPE CopySubresourceRegion( ID3D10Resource *pDstResource, UINT DstSubresource, UINT DstX, UINT DstY, UINT DstZ, ID3D10Resource *pSrcResource, UINT SrcSubresource, const D3D10_BOX *pSrcBox);
|
||||
|
||||
void STDMETHODCALLTYPE CopyResource( ID3D10Resource *pDstResource, ID3D10Resource *pSrcResource);
|
||||
|
||||
void STDMETHODCALLTYPE UpdateSubresource( ID3D10Resource *pDstResource, UINT DstSubresource, const D3D10_BOX *pDstBox, const void *pSrcData, UINT SrcRowPitch, UINT SrcDepthPitch);
|
||||
|
||||
void STDMETHODCALLTYPE ClearRenderTargetView( ID3D10RenderTargetView *pRenderTargetView, const FLOAT ColorRGBA[ 4 ]);
|
||||
|
||||
void STDMETHODCALLTYPE ClearDepthStencilView( ID3D10DepthStencilView *pDepthStencilView, UINT ClearFlags, FLOAT Depth, UINT8 Stencil);
|
||||
|
||||
void STDMETHODCALLTYPE GenerateMips( ID3D10ShaderResourceView *pShaderResourceView);
|
||||
|
||||
void STDMETHODCALLTYPE ResolveSubresource( ID3D10Resource *pDstResource, UINT DstSubresource, ID3D10Resource *pSrcResource, UINT SrcSubresource, DXGI_FORMAT Format);
|
||||
|
||||
void STDMETHODCALLTYPE VSGetConstantBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer **ppConstantBuffers);
|
||||
|
||||
void STDMETHODCALLTYPE PSGetShaderResources( UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView **ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE PSGetShader( ID3D10PixelShader **ppPixelShader);
|
||||
|
||||
void STDMETHODCALLTYPE PSGetSamplers( UINT StartSlot, UINT NumSamplers, ID3D10SamplerState **ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE VSGetShader( ID3D10VertexShader **ppVertexShader);
|
||||
|
||||
void STDMETHODCALLTYPE PSGetConstantBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer **ppConstantBuffers);
|
||||
|
||||
void STDMETHODCALLTYPE IAGetInputLayout( ID3D10InputLayout **ppInputLayout);
|
||||
|
||||
void STDMETHODCALLTYPE IAGetVertexBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer **ppVertexBuffers, UINT *pStrides, UINT *pOffsets);
|
||||
|
||||
void STDMETHODCALLTYPE IAGetIndexBuffer( ID3D10Buffer **pIndexBuffer, DXGI_FORMAT *Format, UINT *Offset);
|
||||
|
||||
void STDMETHODCALLTYPE GSGetConstantBuffers( UINT StartSlot, UINT NumBuffers, ID3D10Buffer **ppConstantBuffers);
|
||||
|
||||
void STDMETHODCALLTYPE GSGetShader( ID3D10GeometryShader **ppGeometryShader);
|
||||
|
||||
void STDMETHODCALLTYPE IAGetPrimitiveTopology( D3D10_PRIMITIVE_TOPOLOGY *pTopology);
|
||||
|
||||
void STDMETHODCALLTYPE VSGetShaderResources( UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView **ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE VSGetSamplers( UINT StartSlot, UINT NumSamplers, ID3D10SamplerState **ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE GetPredication( ID3D10Predicate **ppPredicate, BOOL *pPredicateValue);
|
||||
|
||||
void STDMETHODCALLTYPE GSGetShaderResources( UINT StartSlot, UINT NumViews, ID3D10ShaderResourceView **ppShaderResourceViews);
|
||||
|
||||
void STDMETHODCALLTYPE GSGetSamplers( UINT StartSlot, UINT NumSamplers, ID3D10SamplerState **ppSamplers);
|
||||
|
||||
void STDMETHODCALLTYPE OMGetRenderTargets( UINT NumViews, ID3D10RenderTargetView **ppRenderTargetViews, ID3D10DepthStencilView **ppDepthStencilView);
|
||||
|
||||
void STDMETHODCALLTYPE OMGetBlendState( ID3D10BlendState **ppBlendState, FLOAT BlendFactor[ 4 ], UINT *pSampleMask);
|
||||
|
||||
void STDMETHODCALLTYPE OMGetDepthStencilState( ID3D10DepthStencilState **ppDepthStencilState, UINT *pStencilRef);
|
||||
|
||||
void STDMETHODCALLTYPE SOGetTargets( UINT NumBuffers, ID3D10Buffer **ppSOTargets, UINT *pOffsets);
|
||||
|
||||
void STDMETHODCALLTYPE RSGetState( ID3D10RasterizerState **ppRasterizerState);
|
||||
|
||||
void STDMETHODCALLTYPE RSGetViewports( UINT *NumViewports, D3D10_VIEWPORT *pViewports);
|
||||
|
||||
void STDMETHODCALLTYPE RSGetScissorRects( UINT *NumRects, D3D10_RECT *pRects);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetDeviceRemovedReason(void);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetExceptionMode( UINT RaiseFlags);
|
||||
|
||||
UINT STDMETHODCALLTYPE GetExceptionMode(void);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetPrivateData( REFGUID guid,UINT *pDataSize, void *pData);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateData( REFGUID guid, UINT DataSize, const void *pData);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( REFGUID guid, const IUnknown *pData);
|
||||
|
||||
void STDMETHODCALLTYPE ClearState( void);
|
||||
|
||||
void STDMETHODCALLTYPE Flush( void);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateBuffer( const D3D10_BUFFER_DESC *pDesc, const D3D10_SUBRESOURCE_DATA *pInitialData, ID3D10Buffer **ppBuffer);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateTexture1D( const D3D10_TEXTURE1D_DESC *pDesc, const D3D10_SUBRESOURCE_DATA *pInitialData, ID3D10Texture1D **ppTexture1D);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateTexture2D( const D3D10_TEXTURE2D_DESC *pDesc, const D3D10_SUBRESOURCE_DATA *pInitialData, ID3D10Texture2D **ppTexture2D);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateTexture3D( const D3D10_TEXTURE3D_DESC *pDesc, const D3D10_SUBRESOURCE_DATA *pInitialData, ID3D10Texture3D **ppTexture3D);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateShaderResourceView( ID3D10Resource *pResource, const D3D10_SHADER_RESOURCE_VIEW_DESC *pDesc, ID3D10ShaderResourceView **ppSRView);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateRenderTargetView( ID3D10Resource *pResource, const D3D10_RENDER_TARGET_VIEW_DESC *pDesc, ID3D10RenderTargetView **ppRTView);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateDepthStencilView( ID3D10Resource *pResource, const D3D10_DEPTH_STENCIL_VIEW_DESC *pDesc, ID3D10DepthStencilView **ppDepthStencilView);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateInputLayout( const D3D10_INPUT_ELEMENT_DESC *pInputElementDescs, UINT NumElements, const void *pShaderBytecodeWithInputSignature, SIZE_T BytecodeLength, ID3D10InputLayout **ppInputLayout);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateVertexShader( const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10VertexShader **ppVertexShader);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateGeometryShader( const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10GeometryShader **ppGeometryShader);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateGeometryShaderWithStreamOutput( const void *pShaderBytecode, SIZE_T BytecodeLength, const D3D10_SO_DECLARATION_ENTRY *pSODeclaration, UINT NumEntries, UINT OutputStreamStride, ID3D10GeometryShader **ppGeometryShader);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreatePixelShader( const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D10PixelShader **ppPixelShader);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateBlendState( const D3D10_BLEND_DESC *pBlendStateDesc, ID3D10BlendState **ppBlendState);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateDepthStencilState( const D3D10_DEPTH_STENCIL_DESC *pDepthStencilDesc, ID3D10DepthStencilState **ppDepthStencilState);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateRasterizerState( const D3D10_RASTERIZER_DESC *pRasterizerDesc, ID3D10RasterizerState **ppRasterizerState);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateSamplerState( const D3D10_SAMPLER_DESC *pSamplerDesc, ID3D10SamplerState **ppSamplerState);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateQuery( const D3D10_QUERY_DESC *pQueryDesc, ID3D10Query **ppQuery);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreatePredicate( const D3D10_QUERY_DESC *pPredicateDesc, ID3D10Predicate **ppPredicate);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateCounter( const D3D10_COUNTER_DESC *pCounterDesc, ID3D10Counter **ppCounter);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CheckFormatSupport( DXGI_FORMAT Format, UINT *pFormatSupport);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CheckMultisampleQualityLevels( DXGI_FORMAT Format, UINT SampleCount, UINT *pNumQualityLevels);
|
||||
|
||||
void STDMETHODCALLTYPE CheckCounterInfo( D3D10_COUNTER_INFO *pCounterInfo);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CheckCounter( const D3D10_COUNTER_DESC *pDesc, D3D10_COUNTER_TYPE *pType, UINT *pActiveCounters, LPSTR szName, UINT *pNameLength, LPSTR szUnits, UINT *pUnitsLength, LPSTR szDescription, UINT *pDescriptionLength);
|
||||
|
||||
UINT STDMETHODCALLTYPE GetCreationFlags( void);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE OpenSharedResource( HANDLE hResource, REFIID ReturnedInterface, void **ppResource);
|
||||
|
||||
void STDMETHODCALLTYPE SetTextFilterSize( UINT Width, UINT Height);
|
||||
|
||||
void STDMETHODCALLTYPE GetTextFilterSize( UINT *pWidth, UINT *pHeight);
|
||||
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateShaderResourceView1( ID3D10Resource *pResource, const D3D10_SHADER_RESOURCE_VIEW_DESC1 *pDesc, ID3D10ShaderResourceView1 **ppSRView);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CreateBlendState1( const D3D10_BLEND_DESC1 *pBlendStateDesc, ID3D10BlendState1 **ppBlendState);
|
||||
|
||||
D3D10_FEATURE_LEVEL1 STDMETHODCALLTYPE GetFeatureLevel(void);
|
||||
|
||||
|
||||
|
||||
ID3D10Device1* m_ID3D10Device1;
|
||||
uMod_TextureServer* uMod_Server;
|
||||
uMod_TextureClient_DX10* uMod_Client;
|
||||
|
||||
private:
|
||||
unsigned int RefCounter;
|
||||
};
|
||||
|
||||
|
||||
#endif /* UMOD_ID3D10DEVICE1_H_ */
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../uMod_DXMain/uMod_Main.h"
|
||||
#include "uMod_ID3D10Texture1D.h"
|
||||
|
||||
|
||||
uMod_ID3D10Texture1D::uMod_ID3D10Texture1D(ID3D10Texture1D *pOriginal)
|
||||
{
|
||||
Message( "uMod_ID3D10Texture1D::uMod_ID3D10Texture1D( %lu): %lu\n", pOriginal, this);
|
||||
m_ID3D10Texture1D = pOriginal;
|
||||
}
|
||||
uMod_ID3D10Texture1D::~uMod_ID3D10Texture1D()
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Texture1D::QueryInterface( REFIID riid, void** ppvObject)
|
||||
{
|
||||
return m_ID3D10Texture1D->QueryInterface( riid, ppvObject);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE uMod_ID3D10Texture1D::AddRef(void)
|
||||
{
|
||||
return m_ID3D10Texture1D->AddRef();
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE uMod_ID3D10Texture1D::Release( void)
|
||||
{
|
||||
ULONG count = m_ID3D10Texture1D->Release();
|
||||
|
||||
// in case no further Ref is there, the Original Object has deleted itself
|
||||
if (count == 0)
|
||||
{
|
||||
delete(this);
|
||||
}
|
||||
return(count);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Texture1D::GetDevice( ID3D10Device **ppDevice)
|
||||
{
|
||||
return m_ID3D10Texture1D->GetDevice( ppDevice);
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Texture1D::GetPrivateData( REFGUID guid, UINT *pDataSize, void *pData)
|
||||
{
|
||||
return m_ID3D10Texture1D->GetPrivateData( guid, pDataSize, pData);
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Texture1D::SetPrivateData( REFGUID guid, UINT DataSize, const void *pData)
|
||||
{
|
||||
return m_ID3D10Texture1D->SetPrivateData( guid, DataSize, pData);
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Texture1D::SetPrivateDataInterface( REFGUID guid, const IUnknown *pData)
|
||||
{
|
||||
return m_ID3D10Texture1D->SetPrivateDataInterface( guid, pData);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Texture1D::GetType( D3D10_RESOURCE_DIMENSION *rType)
|
||||
{
|
||||
return m_ID3D10Texture1D->GetType( rType);
|
||||
}
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Texture1D::SetEvictionPriority( UINT EvictionPriority)
|
||||
{
|
||||
return m_ID3D10Texture1D->SetEvictionPriority( EvictionPriority);
|
||||
}
|
||||
UINT STDMETHODCALLTYPE uMod_ID3D10Texture1D::GetEvictionPriority(void)
|
||||
{
|
||||
return m_ID3D10Texture1D->GetEvictionPriority();
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Texture1D::Map( UINT Subresource, D3D10_MAP MapType, UINT MapFlags, void **ppData)
|
||||
{
|
||||
return m_ID3D10Texture1D->Map( Subresource, MapType, MapFlags, ppData);
|
||||
}
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Texture1D::Unmap( UINT Subresource)
|
||||
{
|
||||
return m_ID3D10Texture1D->Unmap( Subresource);
|
||||
}
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Texture1D::GetDesc( D3D10_TEXTURE1D_DESC *pDesc)
|
||||
{
|
||||
return m_ID3D10Texture1D->GetDesc( pDesc);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef UMOD_ID3D10TEXTURE1D_H_
|
||||
#define UMOD_ID3D10TEXTURE1D_H_
|
||||
|
||||
#include <d3d10_1.h>
|
||||
#include <d3d10.h>
|
||||
#include <D3D10Misc.h>
|
||||
#include <d3dx10.h>
|
||||
|
||||
class uMod_ID3D10Texture1D : public ID3D10Texture1D
|
||||
{
|
||||
public:
|
||||
uMod_ID3D10Texture1D(ID3D10Texture1D *pOriginal);
|
||||
virtual ~uMod_ID3D10Texture1D();
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, void** ppvObject);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void);
|
||||
ULONG STDMETHODCALLTYPE Release( void);
|
||||
|
||||
void STDMETHODCALLTYPE GetDevice( ID3D10Device **ppDevice);
|
||||
HRESULT STDMETHODCALLTYPE GetPrivateData( REFGUID guid, UINT *pDataSize, void *pData);
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateData( REFGUID guid, UINT DataSize, const void *pData);
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( REFGUID guid, const IUnknown *pData);
|
||||
|
||||
void STDMETHODCALLTYPE GetType( D3D10_RESOURCE_DIMENSION *rType);
|
||||
void STDMETHODCALLTYPE SetEvictionPriority( UINT EvictionPriority);
|
||||
UINT STDMETHODCALLTYPE GetEvictionPriority(void);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE Map( UINT Subresource, D3D10_MAP MapType, UINT MapFlags, void **ppData);
|
||||
void STDMETHODCALLTYPE Unmap( UINT Subresource);
|
||||
void STDMETHODCALLTYPE GetDesc( D3D10_TEXTURE1D_DESC *pDesc);
|
||||
|
||||
ID3D10Texture1D *m_ID3D10Texture1D;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* UMOD_ID3D10TEXTURE1D_H_ */
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../uMod_DXMain/uMod_Main.h"
|
||||
#include "uMod_ID3D10Texture2D.h"
|
||||
|
||||
|
||||
uMod_ID3D10Texture2D::uMod_ID3D10Texture2D(ID3D10Texture2D *pOriginal)
|
||||
{
|
||||
Message( "uMod_ID3D10Texture1D::uMod_ID3D10Texture1D( %lu): %lu\n", pOriginal, this);
|
||||
m_ID3D10Texture2D = pOriginal;
|
||||
}
|
||||
uMod_ID3D10Texture2D::~uMod_ID3D10Texture2D()
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Texture2D::QueryInterface( REFIID riid, void** ppvObject)
|
||||
{
|
||||
return m_ID3D10Texture2D->QueryInterface( riid, ppvObject);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE uMod_ID3D10Texture2D::AddRef(void)
|
||||
{
|
||||
return m_ID3D10Texture2D->AddRef();
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE uMod_ID3D10Texture2D::Release( void)
|
||||
{
|
||||
ULONG count = m_ID3D10Texture2D->Release();
|
||||
|
||||
// in case no further Ref is there, the Original Object has deleted itself
|
||||
if (count == 0)
|
||||
{
|
||||
delete(this);
|
||||
}
|
||||
return(count);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Texture2D::GetDevice( ID3D10Device **ppDevice)
|
||||
{
|
||||
return m_ID3D10Texture2D->GetDevice( ppDevice);
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Texture2D::GetPrivateData( REFGUID guid, UINT *pDataSize, void *pData)
|
||||
{
|
||||
return m_ID3D10Texture2D->GetPrivateData( guid, pDataSize, pData);
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Texture2D::SetPrivateData( REFGUID guid, UINT DataSize, const void *pData)
|
||||
{
|
||||
return m_ID3D10Texture2D->SetPrivateData( guid, DataSize, pData);
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Texture2D::SetPrivateDataInterface( REFGUID guid, const IUnknown *pData)
|
||||
{
|
||||
return m_ID3D10Texture2D->SetPrivateDataInterface( guid, pData);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Texture2D::GetType( D3D10_RESOURCE_DIMENSION *rType)
|
||||
{
|
||||
return m_ID3D10Texture2D->GetType( rType);
|
||||
}
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Texture2D::SetEvictionPriority( UINT EvictionPriority)
|
||||
{
|
||||
return m_ID3D10Texture2D->SetEvictionPriority( EvictionPriority);
|
||||
}
|
||||
UINT STDMETHODCALLTYPE uMod_ID3D10Texture2D::GetEvictionPriority(void)
|
||||
{
|
||||
return m_ID3D10Texture2D->GetEvictionPriority();
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Texture2D::Map( UINT Subresource, D3D10_MAP MapType, UINT MapFlags, D3D10_MAPPED_TEXTURE2D *pMappedTex2D)
|
||||
{
|
||||
return m_ID3D10Texture2D->Map( Subresource, MapType, MapFlags, pMappedTex2D);
|
||||
}
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Texture2D::Unmap( UINT Subresource)
|
||||
{
|
||||
return m_ID3D10Texture2D->Unmap( Subresource);
|
||||
}
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Texture2D::GetDesc( D3D10_TEXTURE2D_DESC *pDesc)
|
||||
{
|
||||
return m_ID3D10Texture2D->GetDesc( pDesc);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef UMOD_ID3D10TEXTURE2D_H_
|
||||
#define UMOD_ID3D10TEXTURE2D_H_
|
||||
|
||||
#include <d3d10_1.h>
|
||||
#include <d3d10.h>
|
||||
#include <D3D10Misc.h>
|
||||
#include <d3dx10.h>
|
||||
|
||||
class uMod_ID3D10Texture2D : public ID3D10Texture2D
|
||||
{
|
||||
public:
|
||||
uMod_ID3D10Texture2D(ID3D10Texture2D *pOriginal);
|
||||
virtual ~uMod_ID3D10Texture2D();
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, void** ppvObject);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void);
|
||||
ULONG STDMETHODCALLTYPE Release( void);
|
||||
|
||||
void STDMETHODCALLTYPE GetDevice( ID3D10Device **ppDevice);
|
||||
HRESULT STDMETHODCALLTYPE GetPrivateData( REFGUID guid, UINT *pDataSize, void *pData);
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateData( REFGUID guid, UINT DataSize, const void *pData);
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( REFGUID guid, const IUnknown *pData);
|
||||
|
||||
void STDMETHODCALLTYPE GetType( D3D10_RESOURCE_DIMENSION *rType);
|
||||
void STDMETHODCALLTYPE SetEvictionPriority( UINT EvictionPriority);
|
||||
UINT STDMETHODCALLTYPE GetEvictionPriority(void);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE Map( UINT Subresource, D3D10_MAP MapType, UINT MapFlags, D3D10_MAPPED_TEXTURE2D *ppData);
|
||||
void STDMETHODCALLTYPE Unmap( UINT Subresource);
|
||||
void STDMETHODCALLTYPE GetDesc( D3D10_TEXTURE2D_DESC *pDesc);
|
||||
|
||||
ID3D10Texture2D *m_ID3D10Texture2D;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* UMOD_ID3D10TEXTURE2D_H_ */
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../uMod_DXMain/uMod_Main.h"
|
||||
#include "uMod_ID3D10Texture3D.h"
|
||||
|
||||
|
||||
uMod_ID3D10Texture3D::uMod_ID3D10Texture3D(ID3D10Texture3D *pOriginal)
|
||||
{
|
||||
Message( "uMod_ID3D10Texture1D::uMod_ID3D10Texture1D( %lu): %lu\n", pOriginal, this);
|
||||
m_ID3D10Texture3D = pOriginal;
|
||||
}
|
||||
uMod_ID3D10Texture3D::~uMod_ID3D10Texture3D()
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Texture3D::QueryInterface( REFIID riid, void** ppvObject)
|
||||
{
|
||||
return m_ID3D10Texture3D->QueryInterface( riid, ppvObject);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE uMod_ID3D10Texture3D::AddRef(void)
|
||||
{
|
||||
return m_ID3D10Texture3D->AddRef();
|
||||
}
|
||||
ULONG STDMETHODCALLTYPE uMod_ID3D10Texture3D::Release( void)
|
||||
{
|
||||
ULONG count = m_ID3D10Texture3D->Release();
|
||||
|
||||
// in case no further Ref is there, the Original Object has deleted itself
|
||||
if (count == 0)
|
||||
{
|
||||
delete(this);
|
||||
}
|
||||
return(count);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Texture3D::GetDevice( ID3D10Device **ppDevice)
|
||||
{
|
||||
return m_ID3D10Texture3D->GetDevice( ppDevice);
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Texture3D::GetPrivateData( REFGUID guid, UINT *pDataSize, void *pData)
|
||||
{
|
||||
return m_ID3D10Texture3D->GetPrivateData( guid, pDataSize, pData);
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Texture3D::SetPrivateData( REFGUID guid, UINT DataSize, const void *pData)
|
||||
{
|
||||
return m_ID3D10Texture3D->SetPrivateData( guid, DataSize, pData);
|
||||
}
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Texture3D::SetPrivateDataInterface( REFGUID guid, const IUnknown *pData)
|
||||
{
|
||||
return m_ID3D10Texture3D->SetPrivateDataInterface( guid, pData);
|
||||
}
|
||||
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Texture3D::GetType( D3D10_RESOURCE_DIMENSION *rType)
|
||||
{
|
||||
return m_ID3D10Texture3D->GetType( rType);
|
||||
}
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Texture3D::SetEvictionPriority( UINT EvictionPriority)
|
||||
{
|
||||
return m_ID3D10Texture3D->SetEvictionPriority( EvictionPriority);
|
||||
}
|
||||
UINT STDMETHODCALLTYPE uMod_ID3D10Texture3D::GetEvictionPriority(void)
|
||||
{
|
||||
return m_ID3D10Texture3D->GetEvictionPriority();
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_ID3D10Texture3D::Map( UINT Subresource, D3D10_MAP MapType, UINT MapFlags, D3D10_MAPPED_TEXTURE3D *pMappedTex3D)
|
||||
{
|
||||
return m_ID3D10Texture3D->Map( Subresource, MapType, MapFlags, pMappedTex3D);
|
||||
}
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Texture3D::Unmap( UINT Subresource)
|
||||
{
|
||||
return m_ID3D10Texture3D->Unmap( Subresource);
|
||||
}
|
||||
void STDMETHODCALLTYPE uMod_ID3D10Texture3D::GetDesc( D3D10_TEXTURE3D_DESC *pDesc)
|
||||
{
|
||||
return m_ID3D10Texture3D->GetDesc( pDesc);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef UMOD_ID3D10TEXTURE3D_H_
|
||||
#define UMOD_ID3D10TEXTURE3D_H_
|
||||
|
||||
#include <d3d10_1.h>
|
||||
#include <d3d10.h>
|
||||
#include <D3D10Misc.h>
|
||||
#include <d3dx10.h>
|
||||
|
||||
class uMod_ID3D10Texture3D : public ID3D10Texture3D
|
||||
{
|
||||
public:
|
||||
uMod_ID3D10Texture3D(ID3D10Texture3D *pOriginal);
|
||||
virtual ~uMod_ID3D10Texture3D();
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, void** ppvObject);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void);
|
||||
ULONG STDMETHODCALLTYPE Release( void);
|
||||
|
||||
void STDMETHODCALLTYPE GetDevice( ID3D10Device **ppDevice);
|
||||
HRESULT STDMETHODCALLTYPE GetPrivateData( REFGUID guid, UINT *pDataSize, void *pData);
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateData( REFGUID guid, UINT DataSize, const void *pData);
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( REFGUID guid, const IUnknown *pData);
|
||||
|
||||
void STDMETHODCALLTYPE GetType( D3D10_RESOURCE_DIMENSION *rType);
|
||||
void STDMETHODCALLTYPE SetEvictionPriority( UINT EvictionPriority);
|
||||
UINT STDMETHODCALLTYPE GetEvictionPriority(void);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE Map( UINT Subresource, D3D10_MAP MapType, UINT MapFlags, D3D10_MAPPED_TEXTURE3D *ppData);
|
||||
void STDMETHODCALLTYPE Unmap( UINT Subresource);
|
||||
void STDMETHODCALLTYPE GetDesc( D3D10_TEXTURE3D_DESC *pDesc);
|
||||
|
||||
ID3D10Texture3D *m_ID3D10Texture3D;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* UMOD_ID3D10TEXTURE3D_H_ */
|
||||
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine.If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../uMod_DXMain/uMod_Main.h"
|
||||
#include "uMod_IDXGISwapChain.h"
|
||||
#include "uMod_ID3D10Device.h"
|
||||
|
||||
|
||||
uMod_IDXGISwapChain::uMod_IDXGISwapChain(IDXGISwapChain *pOriginal, uMod_ID3D10Device *dev)
|
||||
{
|
||||
Message( "IDXGISwapChain::IDXGISwapChain( %lu, %lu): %lu\n", pOriginal, dev, this);
|
||||
m_IDXGISwapChain = pOriginal;
|
||||
u_ID3D10Device = dev;
|
||||
RefCounter = 1;
|
||||
}
|
||||
|
||||
uMod_IDXGISwapChain::~uMod_IDXGISwapChain()
|
||||
{
|
||||
Message( "IDXGISwapChain::~IDXGISwapChain(): %lu\n", this);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_IDXGISwapChain::QueryInterface( REFIID riid, void** ppvObject)
|
||||
{
|
||||
*ppvObject = NULL;
|
||||
Message( "IDXGISwapChain::QueryInterface(): %lu\n", this);
|
||||
HRESULT hRes = m_IDXGISwapChain->QueryInterface(riid, ppvObject);
|
||||
|
||||
if (*ppvObject == m_IDXGISwapChain)
|
||||
{
|
||||
RefCounter++; //increasing our counter
|
||||
*ppvObject = this;
|
||||
}
|
||||
|
||||
return (hRes);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE uMod_IDXGISwapChain::AddRef(void)
|
||||
{
|
||||
RefCounter++;
|
||||
return m_IDXGISwapChain->AddRef();
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE uMod_IDXGISwapChain::Release( void)
|
||||
{
|
||||
if (--RefCounter==0) //if our counter drops to zero, the real device will be deleted, so we clean up before
|
||||
{
|
||||
// we must not release the fake textures, cause they are released if the target textures are released
|
||||
// and the target textures are released by the game.
|
||||
}
|
||||
|
||||
// call original routine
|
||||
ULONG count = m_IDXGISwapChain->Release();
|
||||
|
||||
// in case no further Ref is there, the Original Object has deleted itself
|
||||
if (count == 0)
|
||||
{
|
||||
delete(this);
|
||||
}
|
||||
|
||||
return(count);
|
||||
}
|
||||
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_IDXGISwapChain::SetPrivateData(REFGUID Name, UINT DataSize, const void *pData)
|
||||
{
|
||||
return m_IDXGISwapChain->SetPrivateData( Name, DataSize, pData);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_IDXGISwapChain::SetPrivateDataInterface( REFGUID Name, const IUnknown *pUnknown)
|
||||
{
|
||||
return m_IDXGISwapChain->SetPrivateDataInterface( Name, pUnknown);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_IDXGISwapChain::GetPrivateData( REFGUID Name, UINT *pDataSize, void *pData)
|
||||
{
|
||||
return m_IDXGISwapChain->GetPrivateData( Name, pDataSize, pData);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_IDXGISwapChain::GetParent( REFIID riid, void **ppParent)
|
||||
{
|
||||
return m_IDXGISwapChain->GetParent( riid, ppParent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_IDXGISwapChain::GetDevice( REFIID riid, void **ppDevice)
|
||||
{
|
||||
// ToDO:
|
||||
// Increas RefCounter from u_ID3D10Device but not from u_ID3D10Device->m_ID3D10Device ? ? ? ? ?
|
||||
HRESULT hRes = m_IDXGISwapChain->GetDevice( riid, ppDevice);
|
||||
if (*ppDevice == u_ID3D10Device->m_ID3D10Device) *ppDevice = u_ID3D10Device;
|
||||
return hRes;
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_IDXGISwapChain::Present( UINT SyncInterval, UINT Flags)
|
||||
{
|
||||
return m_IDXGISwapChain->Present( SyncInterval, Flags);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_IDXGISwapChain::GetBuffer( UINT Buffer, REFIID riid, void **ppSurface)
|
||||
{
|
||||
return m_IDXGISwapChain->GetBuffer( Buffer, riid, ppSurface);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_IDXGISwapChain::SetFullscreenState( BOOL Fullscreen, IDXGIOutput *pTarget)
|
||||
{
|
||||
return m_IDXGISwapChain->SetFullscreenState( Fullscreen, pTarget);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_IDXGISwapChain::GetFullscreenState( BOOL *pFullscreen, IDXGIOutput **ppTarget)
|
||||
{
|
||||
return m_IDXGISwapChain->GetFullscreenState( pFullscreen, ppTarget);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_IDXGISwapChain::GetDesc( DXGI_SWAP_CHAIN_DESC *pDesc)
|
||||
{
|
||||
return m_IDXGISwapChain->GetDesc( pDesc);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_IDXGISwapChain::ResizeBuffers( UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags)
|
||||
{
|
||||
return m_IDXGISwapChain->ResizeBuffers( BufferCount, Width, Height, NewFormat, SwapChainFlags);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_IDXGISwapChain::ResizeTarget( const DXGI_MODE_DESC *pNewTargetParameters)
|
||||
{
|
||||
return m_IDXGISwapChain->ResizeTarget( pNewTargetParameters);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_IDXGISwapChain::GetContainingOutput( IDXGIOutput **ppOutput)
|
||||
{
|
||||
return m_IDXGISwapChain->GetContainingOutput( ppOutput);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_IDXGISwapChain::GetFrameStatistics( DXGI_FRAME_STATISTICS *pStats)
|
||||
{
|
||||
return m_IDXGISwapChain->GetFrameStatistics( pStats);
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE uMod_IDXGISwapChain::GetLastPresentCount( UINT *pLastPresentCount)
|
||||
{
|
||||
return m_IDXGISwapChain->GetLastPresentCount( pLastPresentCount);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef UMOD_IDXGISWAPCHAIN_H_
|
||||
#define UMOD_IDXGISWAPCHAIN_H_
|
||||
|
||||
#include <d3d10_1.h>
|
||||
#include <d3d10.h>
|
||||
#include <D3D10Misc.h>
|
||||
#include <d3dx10.h>
|
||||
|
||||
class uMod_ID3D10Device;
|
||||
|
||||
class uMod_IDXGISwapChain : public IDXGISwapChain
|
||||
{
|
||||
public:
|
||||
uMod_IDXGISwapChain(IDXGISwapChain *pOriginal, uMod_ID3D10Device *dev);
|
||||
virtual ~uMod_IDXGISwapChain();
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, void** ppvObject);
|
||||
ULONG STDMETHODCALLTYPE AddRef(void);
|
||||
ULONG STDMETHODCALLTYPE Release( void);
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateData( REFGUID Name, UINT DataSize, const void *pData);
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface( REFGUID Name, const IUnknown *pUnknown);
|
||||
HRESULT STDMETHODCALLTYPE GetPrivateData( REFGUID Name, UINT *pDataSize, void *pData);
|
||||
HRESULT STDMETHODCALLTYPE GetParent( REFIID riid, void **ppParent);
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetDevice( REFIID riid, void **ppDevice);
|
||||
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE Present( UINT SyncInterval, UINT Flags);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetBuffer( UINT Buffer, REFIID riid, void **ppSurface);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetFullscreenState( BOOL Fullscreen, IDXGIOutput *pTarget);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetFullscreenState( BOOL *pFullscreen, IDXGIOutput **ppTarget);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetDesc( DXGI_SWAP_CHAIN_DESC *pDesc);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE ResizeBuffers( UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE ResizeTarget( const DXGI_MODE_DESC *pNewTargetParameters);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetContainingOutput( IDXGIOutput **ppOutput);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetFrameStatistics( DXGI_FRAME_STATISTICS *pStats);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetLastPresentCount( UINT *pLastPresentCount);
|
||||
|
||||
|
||||
IDXGISwapChain *m_IDXGISwapChain;
|
||||
uMod_ID3D10Device *u_ID3D10Device;
|
||||
|
||||
private:
|
||||
unsigned int RefCounter;
|
||||
};
|
||||
|
||||
|
||||
#endif /* UMOD_IDXGISWAPCHAIN_H_ */
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef uMod_TEXTURECLIENT_DX10_HPP
|
||||
#define uMod_TEXTURECLIENT_DX10_HPP
|
||||
|
||||
#include "..\uMod_Error.h"
|
||||
#include "..\uMod_DXMain\uMod_TextureClient.h"
|
||||
|
||||
class uMod_TextureServer;
|
||||
class uMod_ID3D10Device;
|
||||
|
||||
/*
|
||||
* An object of this class is owned by each d3d10 device.
|
||||
* functions called by the Server are called from the server thread instance.
|
||||
* All other functions are called from the render thread instance of the game itself.
|
||||
*/
|
||||
|
||||
class uMod_TextureClient_DX10 : public uMod_TextureClient
|
||||
{
|
||||
public:
|
||||
uMod_TextureClient_DX10( uMod_ID3D10Device* device, const int version);
|
||||
virtual ~uMod_TextureClient_DX10(void);
|
||||
/*
|
||||
int AddTexture( uMod_IDirect3DTexture9* tex); //called from uMod_IDirect3DDevice9::CreateTexture(...) or uMod_IDirect3DDevice9::BeginScene()
|
||||
int AddTexture( uMod_IDirect3DVolumeTexture9* tex); //called from uMod_IDirect3DVolumeTexture9::CreateTexture(...) or uMod_IDirect3DDevice9::BeginScene()
|
||||
int AddTexture( uMod_IDirect3DCubeTexture9* tex); //called from uMod_IDirect3DCubeTexture9::CreateTexture(...) or uMod_IDirect3DDevice9::BeginScene()
|
||||
|
||||
int RemoveTexture( uMod_IDirect3DTexture9* tex); //called from uMod_IDirect3DTexture9::Release()
|
||||
int RemoveTexture( uMod_IDirect3DVolumeTexture9* tex); //called from uMod_IDirect3DVolumeTexture9::Release()
|
||||
int RemoveTexture( uMod_IDirect3DCubeTexture9* tex); //called from uMod_IDirect3DCubeTexture9::Release()
|
||||
|
||||
int SaveAllTextures(bool val); //called from the Server
|
||||
int SaveSingleTexture(bool val); //called from the Server
|
||||
|
||||
int SaveTexture(uMod_IDirect3DTexture9* pTexture); //called from uMod_IDirect3DDevice9::BeginScene() (save button) or from AddTexture(...) (SaveAllTextures)
|
||||
int SaveTexture(uMod_IDirect3DVolumeTexture9* pTexture); //called from uMod_IDirect3DDevice9::BeginScene() (save button) or from AddTexture(...) (SaveAllTextures)
|
||||
int SaveTexture(uMod_IDirect3DCubeTexture9* pTexture); //called from uMod_IDirect3DDevice9::BeginScene() (save button) or from AddTexture(...) (SaveAllTextures)
|
||||
|
||||
int MergeUpdate(void); //called from uMod_IDirect3DDevice9::BeginScene()
|
||||
|
||||
|
||||
|
||||
int LookUpToMod( uMod_IDirect3DTexture9* pTexture, int num_index_list=0, int *index_list=(int*)0); // called at the end AddTexture(...) and from Device->UpdateTexture(...)
|
||||
|
||||
int LookUpToMod( uMod_IDirect3DVolumeTexture9* pTexture, int num_index_list=0, int *index_list=(int*)0); // called at the end AddTexture(...) and from Device->UpdateTexture(...)
|
||||
|
||||
int LookUpToMod( uMod_IDirect3DCubeTexture9* pTexture, int num_index_list=0, int *index_list=(int*)0); // called at the end AddTexture(...) and from Device->UpdateTexture(...)
|
||||
|
||||
uMod_TextureHandler<uMod_IDirect3DTexture9> OriginalTextures; // stores the pointer to the uMod_IDirect3DTexture9 objects created by the game
|
||||
uMod_TextureHandler<uMod_IDirect3DVolumeTexture9> OriginalVolumeTextures; // stores the pointer to the uMod_IDirect3DVolumeTexture9 objects created by the game
|
||||
uMod_TextureHandler<uMod_IDirect3DCubeTexture9> OriginalCubeTextures; // stores the pointer to the uMod_IDirect3DCubeTexture9 objects created by the game
|
||||
|
||||
|
||||
// if the has could not be calculated for a texture it is not considered in the original texture list,
|
||||
// but it is now added into the following lists and we try to calculate the hash once again later
|
||||
int CheckAgainNonAdded(void);
|
||||
bool Bool_CheckAgainNonAdded;
|
||||
uMod_TextureHandler<uMod_IDirect3DTexture9> NonAdded_OriginalTextures; // stores the pointer to the uMod_IDirect3DTexture9 objects created by the game
|
||||
uMod_TextureHandler<uMod_IDirect3DVolumeTexture9> NonAdded_OriginalVolumeTextures; // stores the pointer to the uMod_IDirect3DVolumeTexture9 objects created by the game
|
||||
uMod_TextureHandler<uMod_IDirect3DCubeTexture9> NonAdded_OriginalCubeTextures; // stores the pointer to the uMod_IDirect3DCubeTexture9 objects created by the game
|
||||
|
||||
private:
|
||||
IDirect3DDevice9* D3D9Device;
|
||||
|
||||
int LoadTexture( TextureFileStruct* file_in_memory, uMod_IDirect3DTexture9 **ppTexture); // called if a target texture is found
|
||||
int LoadTexture( TextureFileStruct* file_in_memory, uMod_IDirect3DVolumeTexture9 **ppTexture); // called if a target texture is found
|
||||
int LoadTexture( TextureFileStruct* file_in_memory, uMod_IDirect3DCubeTexture9 **ppTexture); // called if a target texture is found
|
||||
|
||||
// and the corresponding fake texture should be loaded
|
||||
|
||||
//MyTypeHash GetHash(unsigned char *str, int len);
|
||||
//unsigned int GetCRC32(char *pcDatabuf, unsigned int ulDatalen);
|
||||
*
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* uMod_TEXTUREHANDLER_HPP_ */
|
||||
@@ -28,13 +28,8 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
#include "uMod_DX9_dll.h"
|
||||
#include "uMod_IDirect3D9.h"
|
||||
#include "uMod_IDirect3D9Ex.h"
|
||||
//#include "detours.h"
|
||||
//#include "detourxs/detourxs/detourxs.h"
|
||||
|
||||
/*
|
||||
#include "detourxs/detourxs/ADE32.cpp"
|
||||
#include "detourxs/detourxs/detourxs.cpp"
|
||||
*/
|
||||
|
||||
/*
|
||||
* global variable which are not linked external
|
||||
*/
|
||||
@@ -43,7 +38,7 @@ HINSTANCE gl_hOriginal_DX9_Dll = NULL;
|
||||
typedef IDirect3D9 *(APIENTRY *Direct3DCreate9_type)(UINT);
|
||||
typedef HRESULT (APIENTRY *Direct3DCreate9Ex_type)(UINT SDKVersion, IDirect3D9Ex **ppD3D);
|
||||
|
||||
#ifndef NO_INJECTION
|
||||
#if INJECTION_METHOD==DIRECT_INJECTION || INJECTION_METHOD==HOOK_INJECTION
|
||||
Direct3DCreate9_type Direct3DCreate9_fn = NULL; // we need to store the pointer to the original Direct3DCreate9 function after we have done a detour
|
||||
Direct3DCreate9Ex_type Direct3DCreate9Ex_fn = NULL; // we need to store the pointer to the original Direct3DCreate9 function after we have done a detour
|
||||
#endif
|
||||
@@ -59,7 +54,7 @@ void InitDX9(void)
|
||||
{
|
||||
LoadOriginal_DX9_Dll();
|
||||
|
||||
#ifndef NO_INJECTION
|
||||
#if INJECTION_METHOD==DIRECT_INJECTION || INJECTION_METHOD==HOOK_INJECTION
|
||||
// we detour the original Direct3DCreate9 to our MyDirect3DCreate9
|
||||
if (gl_hOriginal_DX9_Dll!=NULL)
|
||||
{
|
||||
@@ -89,6 +84,7 @@ void ExitDX9(void)
|
||||
gl_hOriginal_DX9_Dll = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void LoadOriginal_DX9_Dll(void)
|
||||
{
|
||||
char buffer[MAX_PATH];
|
||||
@@ -105,7 +101,7 @@ void LoadOriginal_DX9_Dll(void)
|
||||
}
|
||||
|
||||
|
||||
#ifdef NO_INJECTION
|
||||
#if INJECTION_METHOD==NO_INJECTION
|
||||
/*
|
||||
* We do not inject, the game loads this dll by itself thus we must include the Direct3DCreate9 function
|
||||
*/
|
||||
@@ -220,8 +216,9 @@ DWORD WINAPI D3DPERF_GetStatus( void )
|
||||
return fn( );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
#if INJECTION_METHOD==DIRECT_INJECTION || INJECTION_METHOD==HOOK_INJECTION
|
||||
|
||||
/*
|
||||
* We inject the dll into the game, thus we retour the original Direct3DCreate9 function to our MyDirect3DCreate9 function
|
||||
|
||||
+19
-1
@@ -23,13 +23,31 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
#include "../uMod_DXMain/uMod_Main.h"
|
||||
|
||||
/**
|
||||
* Load the official d3d9.dll from the system path.
|
||||
*/
|
||||
void LoadOriginal_DX9_Dll(void);
|
||||
|
||||
/**
|
||||
* Initialize dx9 -> loads d3d9.dll and set detour if this dll is compiled for "Direct Injection" or "Hook Injection"
|
||||
*/
|
||||
void InitDX9();
|
||||
|
||||
/**
|
||||
* Unload the d3d9.dll
|
||||
*/
|
||||
void ExitDX9();
|
||||
|
||||
#ifndef NO_INJECTION
|
||||
#if INJECTION_METHOD==DIRECT_INJECTION || INJECTION_METHOD==HOOK_INJECTION
|
||||
|
||||
/**
|
||||
* Direct3DCreate9 function must be exported if compiled for "No Injection"
|
||||
*/
|
||||
IDirect3D9 *APIENTRY uMod_Direct3DCreate9(UINT SDKVersion);
|
||||
|
||||
/**
|
||||
* Direct3DCreate9Ex function must be exported if compiled for "No Injection"
|
||||
*/
|
||||
HRESULT APIENTRY uMod_Direct3DCreate9Ex( UINT SDKVersion, IDirect3D9Ex **ppD3D);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -239,15 +239,12 @@ HRESULT APIENTRY uMod_IDirect3DCubeTexture9::UnlockRect( D3DCUBEMAP_FACES FaceTy
|
||||
|
||||
|
||||
|
||||
int uMod_IDirect3DCubeTexture9::GetHash(MyTypeHash &hash)
|
||||
int uMod_IDirect3DCubeTexture9::ComputetHash( bool compute_crc)
|
||||
{
|
||||
hash=0u;
|
||||
if (FAKE) return (RETURN_BAD_ARGUMENT);
|
||||
IDirect3DCubeTexture9 *pTexture = m_D3Dtex;
|
||||
if (CrossRef_D3Dtex!=NULL) pTexture = CrossRef_D3Dtex->m_D3Dtex;
|
||||
|
||||
//IDirect3DSurface9 *pOffscreenSurface = NULL;
|
||||
//IDirect3DCubeTexture9 *pOffscreenTexture = NULL;
|
||||
IDirect3DSurface9 *pResolvedSurface = NULL;
|
||||
D3DLOCKED_RECT d3dlr;
|
||||
D3DSURFACE_DESC desc;
|
||||
@@ -257,110 +254,72 @@ int uMod_IDirect3DCubeTexture9::GetHash(MyTypeHash &hash)
|
||||
Message("uMod_IDirect3DCubeTexture9::GetHash() Failed: GetLevelDesc \n");
|
||||
return (RETURN_GetLevelDesc_FAILED);
|
||||
}
|
||||
int bits_per_pixel = GetBitsFromFormat( desc.Format);
|
||||
unsigned int size;
|
||||
unsigned int h_max = desc.Height;
|
||||
if (desc.Format == D3DFMT_DXT1) // 8 bytes per block
|
||||
{
|
||||
h_max /= 4; // divided by block size
|
||||
size = desc.Width*2; // desc.Width/4 * 8
|
||||
}
|
||||
else if ( desc.Format==D3DFMT_DXT2 || desc.Format==D3DFMT_DXT3 || desc.Format==D3DFMT_DXT4 || desc.Format==D3DFMT_DXT5 ) // 16 bytes per block
|
||||
{
|
||||
h_max /= 4; // divided by block size
|
||||
size = desc.Width*4; // desc.Width/4 * 16
|
||||
}
|
||||
else size = (bits_per_pixel * desc.Width)/8;
|
||||
|
||||
Hash = HASH_INIT_VALUE;
|
||||
|
||||
Message("uMod_IDirect3DCubeTexture9::GetHash() (%d %d) %d\n", desc.Width, desc.Height, desc.Format);
|
||||
|
||||
/*
|
||||
if (desc.Pool==D3DPOOL_DEFAULT) //get the raw data of the texture
|
||||
for (int site = 0; site<6; site++)
|
||||
{
|
||||
//Message("uMod_IDirect3DCubeTexture9::GetHash() (D3DPOOL_DEFAULT)\n");
|
||||
|
||||
IDirect3DSurface9 *pSurfaceLevel_orig = NULL;
|
||||
if (pTexture->GetSurfaceLevel( 0, &pSurfaceLevel_orig)!=D3D_OK)
|
||||
if (pTexture->LockRect( ( _D3DCUBEMAP_FACES) site, 0, &d3dlr, NULL, D3DLOCK_READONLY)!=D3D_OK)
|
||||
{
|
||||
Message("uMod_IDirect3DCubeTexture9::GetHash() Failed: GetSurfaceLevel 1 (D3DPOOL_DEFAULT)\n");
|
||||
return (RETURN_LockRect_FAILED);
|
||||
}
|
||||
|
||||
if (desc.MultiSampleType != D3DMULTISAMPLE_NONE)
|
||||
{
|
||||
//Message("uMod_IDirect3DCubeTexture9::GetHash() MultiSampleType\n");
|
||||
if (D3D_OK!=m_D3Ddev->CreateRenderTarget( desc.Width, desc.Height, desc.Format, D3DMULTISAMPLE_NONE, 0, FALSE, &pResolvedSurface, NULL ))
|
||||
Message("uMod_IDirect3DCubeTexture9::GetHash() Failed: LockRect 1\n");
|
||||
if (pTexture->GetCubeMapSurface( ( _D3DCUBEMAP_FACES) site, 0, &pResolvedSurface)!=D3D_OK)
|
||||
{
|
||||
pSurfaceLevel_orig->Release();
|
||||
Message("uMod_IDirect3DCubeTexture9::GetHash() Failed: CreateRenderTarget (D3DPOOL_DEFAULT)\n");
|
||||
Message("uMod_IDirect3DCubeTexture9::GetHash() Failed: GetSurfaceLevel\n");
|
||||
return (RETURN_LockRect_FAILED);
|
||||
}
|
||||
if (D3D_OK!=m_D3Ddev->StretchRect( pSurfaceLevel_orig, NULL, pResolvedSurface, NULL, D3DTEXF_NONE ))
|
||||
if (pResolvedSurface->LockRect( &d3dlr, NULL, D3DLOCK_READONLY)!=D3D_OK)
|
||||
{
|
||||
pSurfaceLevel_orig->Release();
|
||||
Message("uMod_IDirect3DCubeTexture9::GetHash() Failed: StretchRect (D3DPOOL_DEFAULT)\n");
|
||||
pResolvedSurface->Release();
|
||||
Message("uMod_IDirect3DCubeTexture9::GetHash() Failed: LockRect 2\n");
|
||||
return (RETURN_LockRect_FAILED);
|
||||
}
|
||||
|
||||
pSurfaceLevel_orig = pResolvedSurface;
|
||||
}
|
||||
|
||||
|
||||
if (D3D_OK!=m_D3Ddev->CreateOffscreenPlainSurface( desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &pOffscreenSurface, NULL))
|
||||
{
|
||||
pSurfaceLevel_orig->Release();
|
||||
if (pResolvedSurface!=NULL) pResolvedSurface->Release();
|
||||
Message("uMod_IDirect3DCubeTexture9::GetHash() Failed: CreateOffscreenPlainSurface (D3DPOOL_DEFAULT)\n");
|
||||
return (RETURN_TEXTURE_NOT_LOADED);
|
||||
unsigned char *data = (unsigned char*) d3dlr.pBits;
|
||||
|
||||
for (unsigned int h=0; h<h_max; h++)
|
||||
{
|
||||
GetHash( data, size, Hash);
|
||||
data += d3dlr.Pitch;
|
||||
}
|
||||
}
|
||||
|
||||
if (D3D_OK!=m_D3Ddev->GetRenderTargetData( pSurfaceLevel_orig, pOffscreenSurface))
|
||||
if (compute_crc && site==0)
|
||||
{
|
||||
pSurfaceLevel_orig->Release();
|
||||
if (pResolvedSurface!=NULL) pResolvedSurface->Release();
|
||||
pOffscreenSurface->Release();
|
||||
Message("uMod_IDirect3DCubeTexture9::GetHash() Failed: GetRenderTargetData (D3DPOOL_DEFAULT)\n");
|
||||
return (RETURN_LockRect_FAILED);
|
||||
int size = (bits_per_pixel * desc.Width*desc.Height)/8;
|
||||
CRC = GetCRC32( (char*) d3dlr.pBits, size); //calculate the crc32 of the texture
|
||||
}
|
||||
pSurfaceLevel_orig->Release();
|
||||
|
||||
if (pOffscreenSurface->LockRect( &d3dlr, NULL, D3DLOCK_READONLY)!=D3D_OK)
|
||||
{
|
||||
if (pResolvedSurface!=NULL) pResolvedSurface->Release();
|
||||
pOffscreenSurface->Release();
|
||||
Message("uMod_IDirect3DCubeTexture9::GetHash() Failed: LockRect (D3DPOOL_DEFAULT)\n");
|
||||
return (RETURN_LockRect_FAILED);
|
||||
}
|
||||
}
|
||||
else
|
||||
*/
|
||||
if (pTexture->LockRect( D3DCUBEMAP_FACE_POSITIVE_X, 0, &d3dlr, NULL, D3DLOCK_READONLY)!=D3D_OK)
|
||||
{
|
||||
Message("uMod_IDirect3DCubeTexture9::GetHash() Failed: LockRect 1\n");
|
||||
if (pTexture->GetCubeMapSurface( D3DCUBEMAP_FACE_POSITIVE_X, 0, &pResolvedSurface)!=D3D_OK)
|
||||
{
|
||||
Message("uMod_IDirect3DCubeTexture9::GetHash() Failed: GetSurfaceLevel\n");
|
||||
return (RETURN_LockRect_FAILED);
|
||||
}
|
||||
if (pResolvedSurface->LockRect( &d3dlr, NULL, D3DLOCK_READONLY)!=D3D_OK)
|
||||
if (pResolvedSurface!=NULL)
|
||||
{
|
||||
pResolvedSurface->UnlockRect();
|
||||
pResolvedSurface->Release();
|
||||
Message("uMod_IDirect3DCubeTexture9::GetHash() Failed: LockRect 2\n");
|
||||
return (RETURN_LockRect_FAILED);
|
||||
pResolvedSurface=NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
pTexture->UnlockRect( ( _D3DCUBEMAP_FACES) site, 0); //unlock the raw data
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int size = (GetBitsFromFormat( desc.Format) * desc.Width*desc.Height)/8;
|
||||
|
||||
hash = GetCRC32( (char*) d3dlr.pBits, size); //calculate the crc32 of the texture
|
||||
/*
|
||||
if (pOffscreenSurface!=NULL)
|
||||
{
|
||||
pOffscreenSurface->UnlockRect();
|
||||
pOffscreenSurface->Release();
|
||||
//pOffscreenTexture->Release();
|
||||
if (pResolvedSurface!=NULL) pResolvedSurface->Release();
|
||||
}
|
||||
else
|
||||
*/
|
||||
if (pResolvedSurface!=NULL)
|
||||
{
|
||||
pResolvedSurface->UnlockRect();
|
||||
pResolvedSurface->Release();
|
||||
}
|
||||
else
|
||||
{
|
||||
pTexture->UnlockRect( D3DCUBEMAP_FACE_POSITIVE_X, 0); //unlock the raw data
|
||||
}
|
||||
|
||||
Message("uMod_IDirect3DCubeTexture9::GetHash() %#lX (%d %d) %d = %d\n", hash, desc.Width, desc.Height, desc.Format, size);
|
||||
Message("uMod_IDirect3DCubeTexture9::GetHash() %#llX %#LX (%d %d) %d\n", Hash, CRC, desc.Width, desc.Height, desc.Format);
|
||||
return (RETURN_OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
#include "..\uMod_DXMain\uMod_Defines.h"
|
||||
|
||||
|
||||
|
||||
interface uMod_IDirect3DCubeTexture9 : public IDirect3DCubeTexture9
|
||||
class uMod_IDirect3DCubeTexture9 : public IDirect3DCubeTexture9
|
||||
{
|
||||
public:
|
||||
uMod_IDirect3DCubeTexture9(IDirect3DCubeTexture9 **ppTex, IDirect3DDevice9 *pIDirect3DDevice9)
|
||||
{
|
||||
m_D3Dtex = *ppTex; //Texture which will be displayed and will be passed to the game
|
||||
@@ -47,16 +47,17 @@ interface uMod_IDirect3DCubeTexture9 : public IDirect3DCubeTexture9
|
||||
// thus the fake texture can also be deleted
|
||||
Reference = -1; //need for fast deleting
|
||||
Hash = 0u;
|
||||
CRC = 0u;
|
||||
FAKE = false;
|
||||
}
|
||||
|
||||
// callback interface
|
||||
IDirect3DCubeTexture9 *m_D3Dtex;
|
||||
uMod_IDirect3DCubeTexture9 *CrossRef_D3Dtex;
|
||||
IDirect3DDevice9 *m_D3Ddev;
|
||||
int Reference;
|
||||
MyTypeHash Hash;
|
||||
bool FAKE;
|
||||
IDirect3DCubeTexture9 *m_D3Dtex; //!< pointer to the real IDirect3DCubeTexture9 object
|
||||
uMod_IDirect3DCubeTexture9 *CrossRef_D3Dtex; //!< cross reference from the fake texture to the game texture and vice versa
|
||||
IDirect3DDevice9 *m_D3Ddev; //!< pointer to the device
|
||||
int Reference; //!< Index in the vector (needed for a fast delete).
|
||||
DWORD64 Hash; //!< computed hash value for this game texture.
|
||||
DWORD32 CRC; //!< computed crc32 value for this game texture.
|
||||
bool FAKE; //!< True if this texture is was loaded by uMod (fake texture)
|
||||
|
||||
// original interface
|
||||
STDMETHOD(QueryInterface) (REFIID riid, void** ppvObj);
|
||||
@@ -84,7 +85,7 @@ interface uMod_IDirect3DCubeTexture9 : public IDirect3DCubeTexture9
|
||||
STDMETHOD(UnlockRect)(D3DCUBEMAP_FACES FaceType, UINT Level);
|
||||
|
||||
|
||||
int GetHash(MyTypeHash &hash);
|
||||
int ComputetHash( bool compute_crc);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -62,9 +62,15 @@ int uMod_IDirect3DDevice9::CreateSingleTexture(void)
|
||||
SingleTexture=NULL;
|
||||
return (RETURN_TEXTURE_NOT_LOADED);
|
||||
}
|
||||
DWORD *pDst = (DWORD*)d3dlr.pBits;
|
||||
|
||||
for (int i=0; i<8*8; i++) pDst[i] = TextureColour;
|
||||
Message( PRE_MESSAGE "::CreateSingleTexture(): Set IDirect3DTexture9 Colour to %#X\n", TextureColour);
|
||||
BYTE *pImage = (BYTE*)d3dlr.pBits;
|
||||
for (int i=0; i<8; i++)
|
||||
{
|
||||
DWORD *pDst = (DWORD*)pImage;
|
||||
for (int j=0;j<8; j++) pDst[j] = TextureColour;
|
||||
pImage += d3dlr.Pitch;
|
||||
}
|
||||
pD3Dtex->UnlockRect(0);
|
||||
}
|
||||
|
||||
@@ -92,9 +98,14 @@ int uMod_IDirect3DDevice9::CreateSingleTexture(void)
|
||||
SingleVolumeTexture=NULL;
|
||||
return (RETURN_TEXTURE_NOT_LOADED);
|
||||
}
|
||||
DWORD *pDst = (DWORD*)d3dlr.pBits;
|
||||
|
||||
for (int i=0; i<8*8*8; i++) pDst[i] = TextureColour;
|
||||
Message( PRE_MESSAGE "::CreateSingleTexture(): Set IDirect3DVolumeTexture9 Colour to %#X\n", TextureColour);
|
||||
DWORD *pDst = (DWORD*)d3dlr.pBits;
|
||||
for (int i=0; i<8; i++) for (int ii=0; ii<8; ii++)
|
||||
{
|
||||
DWORD *pDst = (DWORD*) ((char*) d3dlr.pBits)[ i*d3dlr.SlicePitch + ii*d3dlr.RowPitch];
|
||||
//for (int j=0;j<8; j++) pDst[j] = TextureColour;
|
||||
}
|
||||
pD3Dtex->UnlockBox(0);
|
||||
}
|
||||
if (SingleCubeTexture==NULL) //create texture
|
||||
@@ -114,6 +125,7 @@ int uMod_IDirect3DDevice9::CreateSingleTexture(void)
|
||||
D3DLOCKED_RECT d3dlr;
|
||||
IDirect3DCubeTexture9 *pD3Dtex = SingleCubeTexture->m_D3Dtex;
|
||||
|
||||
Message( PRE_MESSAGE "::CreateSingleTexture(): Set IDirect3DCubeTexture9 Colour to %#X\n", TextureColour);
|
||||
for (int c=0; c<6; c++)
|
||||
{
|
||||
if (D3D_OK!=pD3Dtex->LockRect( (D3DCUBEMAP_FACES) c, 0, &d3dlr, 0, 0))
|
||||
@@ -123,9 +135,14 @@ int uMod_IDirect3DDevice9::CreateSingleTexture(void)
|
||||
SingleCubeTexture=NULL;
|
||||
return (RETURN_TEXTURE_NOT_LOADED);
|
||||
}
|
||||
DWORD *pDst = (DWORD*)d3dlr.pBits;
|
||||
|
||||
for (int i=0; i<8*8; i++) pDst[i] = TextureColour;
|
||||
BYTE *pImage = (BYTE*)d3dlr.pBits;
|
||||
for (int i=0; i<8; i++)
|
||||
{
|
||||
DWORD *pDst = (DWORD*)pImage;
|
||||
for (int j=0;j<8; j++) pDst[j] = TextureColour;
|
||||
pImage += d3dlr.Pitch;
|
||||
}
|
||||
pD3Dtex->UnlockRect((D3DCUBEMAP_FACES)c, 0);
|
||||
}
|
||||
}
|
||||
@@ -148,7 +165,6 @@ uMod_IDirect3DDevice9::uMod_IDirect3DDevice9( IDirect3DDevice9* pOriginal, uMod_
|
||||
LastCreatedVolumeTexture = NULL;
|
||||
LastCreatedCubeTexture = NULL;
|
||||
m_pIDirect3DDevice9 = pOriginal; // store the pointer to original object
|
||||
TextureColour = D3DCOLOR_ARGB(255,0,255,0);
|
||||
|
||||
CounterSaveSingleTexture = -20;
|
||||
|
||||
@@ -425,13 +441,13 @@ HRESULT uMod_IDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9* pSourceTextu
|
||||
{
|
||||
case 0x01000000L:
|
||||
{
|
||||
MyTypeHash hash;
|
||||
pSource = (uMod_IDirect3DTexture9*)(pSourceTexture);
|
||||
if (pSource->GetHash( hash) == RETURN_OK)
|
||||
DWORD64 hash = pSource->Hash;
|
||||
DWORD32 crc = pSource->CRC;
|
||||
if (pSource->ComputetHash( crc>0 ) == RETURN_OK)
|
||||
{
|
||||
if (hash != pSource->Hash) // this hash has changed !!
|
||||
if (hash != pSource->Hash || (crc>0 && crc != pSource->CRC) ) // this hash has changed !!
|
||||
{
|
||||
pSource->Hash = hash;
|
||||
if (pSource->CrossRef_D3Dtex!=NULL) UnswitchTextures(pSource);
|
||||
uMod_Client->LookUpToMod( pSource);
|
||||
}
|
||||
@@ -445,11 +461,12 @@ HRESULT uMod_IDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9* pSourceTextu
|
||||
}
|
||||
case 0x01000001L:
|
||||
{
|
||||
MyTypeHash hash;
|
||||
pSourceVolume = (uMod_IDirect3DVolumeTexture9*)(pSourceTexture);
|
||||
if (pSourceVolume->GetHash( hash) == RETURN_OK)
|
||||
DWORD64 hash = pSourceVolume->Hash;
|
||||
DWORD32 crc = pSourceVolume->CRC;
|
||||
if (pSourceVolume->ComputetHash( crc>0 ) == RETURN_OK)
|
||||
{
|
||||
if (hash != pSourceVolume->Hash) // this hash has changed !!
|
||||
if (hash != pSourceVolume->Hash || (crc>0 && crc != pSource->CRC) ) // this hash has changed !!
|
||||
{
|
||||
pSourceVolume->Hash = hash;
|
||||
if (pSourceVolume->CrossRef_D3Dtex!=NULL) UnswitchTextures(pSourceVolume);
|
||||
@@ -465,11 +482,12 @@ HRESULT uMod_IDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9* pSourceTextu
|
||||
}
|
||||
case 0x01000002L:
|
||||
{
|
||||
MyTypeHash hash;
|
||||
pSourceCube = (uMod_IDirect3DCubeTexture9*)(pSourceTexture);
|
||||
if (pSourceCube->GetHash( hash) == RETURN_OK)
|
||||
DWORD64 hash = pSourceCube->Hash;
|
||||
DWORD32 crc = pSourceCube->CRC;
|
||||
if (pSourceCube->ComputetHash( crc>0 ) == RETURN_OK)
|
||||
{
|
||||
if (hash != pSourceCube->Hash) // this hash has changed !!
|
||||
if (hash != pSourceCube->Hash || (crc>0 && crc != pSource->CRC) ) // this hash has changed !!
|
||||
{
|
||||
pSourceCube->Hash = hash;
|
||||
if (pSourceCube->CrossRef_D3Dtex!=NULL) UnswitchTextures(pSourceCube);
|
||||
@@ -491,7 +509,7 @@ HRESULT uMod_IDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9* pSourceTextu
|
||||
|
||||
if (pDestinationTexture != NULL)
|
||||
{
|
||||
long int ret = pSourceTexture->QueryInterface( IID_IDirect3D9, (void**) &cpy);
|
||||
long int ret = pDestinationTexture->QueryInterface( IID_IDirect3D9, (void**) &cpy);
|
||||
switch (ret)
|
||||
{
|
||||
case 0x01000000L:
|
||||
@@ -763,7 +781,7 @@ HRESULT uMod_IDirect3DDevice9::BeginScene(void)
|
||||
|
||||
HRESULT uMod_IDirect3DDevice9::EndScene(void)
|
||||
{
|
||||
if ( NormalRendering && uMod_Client->BoolSaveSingleTexture && SingleTexture!=NULL && SingleVolumeTexture!=NULL && SingleCubeTexture!=NULL)
|
||||
if ( NormalRendering && uMod_Client->BoolShowTextureString && uMod_Client->BoolSaveSingleTexture && SingleTexture!=NULL && SingleVolumeTexture!=NULL && SingleCubeTexture!=NULL)
|
||||
{
|
||||
if (OSD_Font==NULL) // create the font
|
||||
{
|
||||
@@ -780,7 +798,7 @@ HRESULT uMod_IDirect3DDevice9::EndScene(void)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if (SingleTexture->CrossRef_D3Dtex!=NULL) sprintf_s( buffer, 100, "normal texture: %4d (1..%d): %#lX", CounterSaveSingleTexture+1, uMod_Client->OriginalTextures.GetNumber(), SingleTexture->Hash);
|
||||
if (SingleTexture->CrossRef_D3Dtex!=NULL) sprintf_s( buffer, 100, "normal texture: %4d (1..%d): %#llX", CounterSaveSingleTexture+1, uMod_Client->OriginalTextures.GetNumber(), SingleTexture->Hash);
|
||||
else
|
||||
{
|
||||
if (uMod_Client->OriginalTextures.GetNumber()>0) sprintf_s( buffer, 100, "normal texture: nothing selected (1..%d)", uMod_Client->OriginalTextures.GetNumber());
|
||||
@@ -790,7 +808,7 @@ HRESULT uMod_IDirect3DDevice9::EndScene(void)
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (SingleVolumeTexture->CrossRef_D3Dtex!=NULL) sprintf_s( buffer, 100, "volume texture: %4d (1..%d): %#lX", CounterSaveSingleTexture+1, uMod_Client->OriginalVolumeTextures.GetNumber(), SingleVolumeTexture->Hash);
|
||||
if (SingleVolumeTexture->CrossRef_D3Dtex!=NULL) sprintf_s( buffer, 100, "volume texture: %4d (1..%d): %#llX", CounterSaveSingleTexture+1, uMod_Client->OriginalVolumeTextures.GetNumber(), SingleVolumeTexture->Hash);
|
||||
else
|
||||
{
|
||||
if (uMod_Client->OriginalVolumeTextures.GetNumber()>0) sprintf_s( buffer, 100, "volume texture: nothing selected (1..%d)", uMod_Client->OriginalVolumeTextures.GetNumber());
|
||||
@@ -800,7 +818,7 @@ HRESULT uMod_IDirect3DDevice9::EndScene(void)
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if (SingleCubeTexture->CrossRef_D3Dtex!=NULL) sprintf_s( buffer, 100, "cube texture: %4d (1..%d): %#lX", CounterSaveSingleTexture+1, uMod_Client->OriginalCubeTextures.GetNumber(), SingleCubeTexture->Hash);
|
||||
if (SingleCubeTexture->CrossRef_D3Dtex!=NULL) sprintf_s( buffer, 100, "cube texture: %4d (1..%d): %#llX", CounterSaveSingleTexture+1, uMod_Client->OriginalCubeTextures.GetNumber(), SingleCubeTexture->Hash);
|
||||
else
|
||||
{
|
||||
if (uMod_Client->OriginalCubeTextures.GetNumber()>0) sprintf_s( buffer, 100, "cube texture: nothing selected (1..%d)", uMod_Client->OriginalCubeTextures.GetNumber());
|
||||
|
||||
@@ -240,9 +240,8 @@ HRESULT APIENTRY uMod_IDirect3DTexture9::AddDirtyRect(CONST RECT* pDirtyRect)
|
||||
}
|
||||
|
||||
|
||||
int uMod_IDirect3DTexture9::GetHash(MyTypeHash &hash)
|
||||
int uMod_IDirect3DTexture9::ComputetHash( bool compute_crc)
|
||||
{
|
||||
hash=0u;
|
||||
if (FAKE) return (RETURN_BAD_ARGUMENT);
|
||||
IDirect3DTexture9 *pTexture = m_D3Dtex;
|
||||
if (CrossRef_D3Dtex!=NULL) pTexture = CrossRef_D3Dtex->m_D3Dtex;
|
||||
@@ -342,9 +341,37 @@ int uMod_IDirect3DTexture9::GetHash(MyTypeHash &hash)
|
||||
}
|
||||
}
|
||||
|
||||
int size = (GetBitsFromFormat( desc.Format) * desc.Width*desc.Height)/8;
|
||||
int bits_per_pixel = GetBitsFromFormat( desc.Format);
|
||||
|
||||
hash = GetCRC32( (char*) d3dlr.pBits, size); //calculate the crc32 of the texture
|
||||
{
|
||||
Hash = HASH_INIT_VALUE;
|
||||
unsigned char *data = (unsigned char*) d3dlr.pBits;
|
||||
unsigned int size;
|
||||
unsigned int h_max = desc.Height;
|
||||
if (desc.Format == D3DFMT_DXT1) // 8 bytes per block
|
||||
{
|
||||
h_max /= 4; // divided by block size
|
||||
size = desc.Width*2; // desc.Width/4 * 8
|
||||
}
|
||||
else if ( desc.Format==D3DFMT_DXT2 || desc.Format==D3DFMT_DXT3 || desc.Format==D3DFMT_DXT4 || desc.Format==D3DFMT_DXT5 ) // 16 bytes per block
|
||||
{
|
||||
h_max /= 4; // divided by block size
|
||||
size = desc.Width*4; // desc.Width/4 * 16
|
||||
}
|
||||
else size = (bits_per_pixel * desc.Width)/8;
|
||||
|
||||
for (unsigned int h=0; h<h_max; h++)
|
||||
{
|
||||
GetHash( data, size, Hash);
|
||||
data += d3dlr.Pitch;
|
||||
}
|
||||
}
|
||||
|
||||
if (compute_crc)
|
||||
{
|
||||
int size = (bits_per_pixel * desc.Width*desc.Height)/8;
|
||||
CRC = GetCRC32( (char*) d3dlr.pBits, size); //calculate the crc32 of the texture
|
||||
}
|
||||
|
||||
if (pOffscreenSurface!=NULL)
|
||||
{
|
||||
@@ -359,6 +386,6 @@ int uMod_IDirect3DTexture9::GetHash(MyTypeHash &hash)
|
||||
}
|
||||
else pTexture->UnlockRect(0);
|
||||
|
||||
Message("uMod_IDirect3DTexture9::GetHash() %#lX (%d %d) %d = %d\n", hash, desc.Width, desc.Height, desc.Format, size);
|
||||
Message("uMod_IDirect3DTexture9::GetHash() %#llX %#LX (%d %d) %d\n", Hash, CRC, desc.Width, desc.Height, desc.Format);
|
||||
return (RETURN_OK);
|
||||
}
|
||||
|
||||
@@ -35,8 +35,9 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
|
||||
|
||||
interface uMod_IDirect3DTexture9 : public IDirect3DTexture9
|
||||
class uMod_IDirect3DTexture9 : public IDirect3DTexture9
|
||||
{
|
||||
public:
|
||||
uMod_IDirect3DTexture9(IDirect3DTexture9 **ppTex, IDirect3DDevice9 *pIDirect3DDevice9)
|
||||
{
|
||||
m_D3Dtex = *ppTex; //Texture which will be displayed and will be passed to the game
|
||||
@@ -47,16 +48,17 @@ interface uMod_IDirect3DTexture9 : public IDirect3DTexture9
|
||||
// thus the fake texture can also be deleted
|
||||
Reference = -1; //need for fast deleting
|
||||
Hash = 0u;
|
||||
CRC = 0u;
|
||||
FAKE = false;
|
||||
}
|
||||
|
||||
// callback interface
|
||||
IDirect3DTexture9 *m_D3Dtex;
|
||||
uMod_IDirect3DTexture9 *CrossRef_D3Dtex;
|
||||
IDirect3DDevice9 *m_D3Ddev;
|
||||
int Reference;
|
||||
MyTypeHash Hash;
|
||||
bool FAKE;
|
||||
IDirect3DTexture9 *m_D3Dtex; //!< pointer to the real IDirect3DCubeTexture9 object
|
||||
uMod_IDirect3DTexture9 *CrossRef_D3Dtex; //!< cross reference from the fake texture to the game texture and vice versa
|
||||
IDirect3DDevice9 *m_D3Ddev; //!< pointer to the device
|
||||
int Reference; //!< Index in the vector (needed for a fast delete).
|
||||
DWORD64 Hash; //!< computed hash value for this game texture.
|
||||
DWORD32 CRC; //!< computed crc32 value for this game texture.
|
||||
bool FAKE; //!< True if this texture is was loaded by uMod (fake texture)
|
||||
|
||||
// original interface
|
||||
STDMETHOD(QueryInterface) (REFIID riid, void** ppvObj);
|
||||
@@ -82,7 +84,7 @@ interface uMod_IDirect3DTexture9 : public IDirect3DTexture9
|
||||
STDMETHOD(UnlockRect)(UINT Level);
|
||||
STDMETHOD(AddDirtyRect)(CONST RECT* pDirtyRect);
|
||||
|
||||
int GetHash(MyTypeHash &hash);
|
||||
int ComputetHash( bool compute_crc);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -239,9 +239,8 @@ HRESULT APIENTRY uMod_IDirect3DVolumeTexture9::UnlockBox(UINT Level)
|
||||
}
|
||||
|
||||
|
||||
int uMod_IDirect3DVolumeTexture9::GetHash(MyTypeHash &hash)
|
||||
int uMod_IDirect3DVolumeTexture9::ComputetHash( bool compute_crc)
|
||||
{
|
||||
hash=0u;
|
||||
if (FAKE) return (RETURN_BAD_ARGUMENT);
|
||||
IDirect3DVolumeTexture9 *pTexture = m_D3Dtex;
|
||||
if (CrossRef_D3Dtex!=NULL) pTexture = CrossRef_D3Dtex->m_D3Dtex;
|
||||
@@ -260,101 +259,7 @@ int uMod_IDirect3DVolumeTexture9::GetHash(MyTypeHash &hash)
|
||||
|
||||
Message("uMod_IDirect3DVolumeTexture9::GetHash() (%d %d %d) %d\n", desc.Width, desc.Height, desc.Depth, desc.Format);
|
||||
|
||||
/*
|
||||
if (desc.Pool==D3DPOOL_DEFAULT) //get the raw data of the texture
|
||||
{
|
||||
//Message("uMod_IDirect3DVolumeTexture9::GetHash() (D3DPOOL_DEFAULT)\n");
|
||||
|
||||
IDirect3DSurface9 *pSurfaceLevel_orig = NULL;
|
||||
if (pTexture->GetSurfaceLevel( 0, &pSurfaceLevel_orig)!=D3D_OK)
|
||||
{
|
||||
Message("uMod_IDirect3DVolumeTexture9::GetHash() Failed: GetSurfaceLevel 1 (D3DPOOL_DEFAULT)\n");
|
||||
return (RETURN_LockRect_FAILED);
|
||||
}
|
||||
/*
|
||||
if (desc.MultiSampleType != D3DMULTISAMPLE_NONE)
|
||||
{
|
||||
//Message("uMod_IDirect3DVolumeTexture9::GetHash() MultiSampleType\n");
|
||||
if (D3D_OK!=m_D3Ddev->CreateRenderTarget( desc.Width, desc.Height, desc.Format, D3DMULTISAMPLE_NONE, 0, FALSE, &pResolvedSurface, NULL ))
|
||||
{
|
||||
pSurfaceLevel_orig->Release();
|
||||
Message("uMod_IDirect3DVolumeTexture9::GetHash() Failed: CreateRenderTarget (D3DPOOL_DEFAULT)\n");
|
||||
return (RETURN_LockRect_FAILED);
|
||||
}
|
||||
if (D3D_OK!=m_D3Ddev->StretchRect( pSurfaceLevel_orig, NULL, pResolvedSurface, NULL, D3DTEXF_NONE ))
|
||||
{
|
||||
pSurfaceLevel_orig->Release();
|
||||
Message("uMod_IDirect3DVolumeTexture9::GetHash() Failed: StretchRect (D3DPOOL_DEFAULT)\n");
|
||||
return (RETURN_LockRect_FAILED);
|
||||
}
|
||||
|
||||
pSurfaceLevel_orig = pResolvedSurface;
|
||||
}
|
||||
*/
|
||||
//CreateTexture(8, 8, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, (IDirect3DVolumeTexture9**) &SingleTexture, NULL)
|
||||
/*
|
||||
if (D3D_OK!=m_D3Ddev->CreateTexture( desc.Width, desc.Height, 1, 0, desc.Format, D3DPOOL_SYSTEMMEM, &pOffscreenTexture, NULL))
|
||||
{
|
||||
pSurfaceLevel_orig->Release();
|
||||
if (pResolvedSurface!=NULL) pResolvedSurface->Release();
|
||||
Message("uMod_IDirect3DVolumeTexture9::GetHash() Failed: CreateTexture (D3DPOOL_DEFAULT)\n");
|
||||
return (RETURN_TEXTURE_NOT_LOADED);
|
||||
}
|
||||
if (pOffscreenTexture->GetSurfaceLevel( 0, &pOffscreenSurface)!=D3D_OK)
|
||||
{
|
||||
Message("uMod_IDirect3DVolumeTexture9::GetHash() Failed: GetSurfaceLevel 2 (D3DPOOL_DEFAULT)\n");
|
||||
return (RETURN_LockRect_FAILED);
|
||||
}
|
||||
|
||||
if (D3D_OK!=m_D3Ddev->GetRenderTargetData( pSurfaceLevel_orig, pOffscreenSurface))
|
||||
{
|
||||
pSurfaceLevel_orig->Release();
|
||||
if (pResolvedSurface!=NULL) pResolvedSurface->Release();
|
||||
pOffscreenSurface->Release();
|
||||
pOffscreenTexture->Release();
|
||||
Message("uMod_IDirect3DVolumeTexture9::GetHash() Failed: GetRenderTargetData (D3DPOOL_DEFAULT)\n");
|
||||
return (RETURN_LockRect_FAILED);
|
||||
}
|
||||
pSurfaceLevel_orig->Release();
|
||||
|
||||
if (pOffscreenSurface->LockRect( &d3dlr, NULL, D3DLOCK_READONLY)!=D3D_OK)
|
||||
{
|
||||
if (pResolvedSurface!=NULL) pResolvedSurface->Release();
|
||||
pOffscreenSurface->Release();
|
||||
pOffscreenTexture->Release();
|
||||
Message("uMod_IDirect3DVolumeTexture9::GetHash() Failed: LockRect (D3DPOOL_DEFAULT)\n");
|
||||
return (RETURN_LockRect_FAILED);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
if (D3D_OK!=m_D3Ddev->CreateOffscreenPlainSurface( desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &pOffscreenSurface, NULL))
|
||||
{
|
||||
pSurfaceLevel_orig->Release();
|
||||
if (pResolvedSurface!=NULL) pResolvedSurface->Release();
|
||||
Message("uMod_IDirect3DVolumeTexture9::GetHash() Failed: CreateOffscreenPlainSurface (D3DPOOL_DEFAULT)\n");
|
||||
return (RETURN_TEXTURE_NOT_LOADED);
|
||||
}
|
||||
|
||||
if (D3D_OK!=m_D3Ddev->GetRenderTargetData( pSurfaceLevel_orig, pOffscreenSurface))
|
||||
{
|
||||
pSurfaceLevel_orig->Release();
|
||||
if (pResolvedSurface!=NULL) pResolvedSurface->Release();
|
||||
pOffscreenSurface->Release();
|
||||
Message("uMod_IDirect3DVolumeTexture9::GetHash() Failed: GetRenderTargetData (D3DPOOL_DEFAULT)\n");
|
||||
return (RETURN_LockRect_FAILED);
|
||||
}
|
||||
pSurfaceLevel_orig->Release();
|
||||
|
||||
if (pOffscreenSurface->LockRect( &d3dlr, NULL, D3DLOCK_READONLY)!=D3D_OK)
|
||||
{
|
||||
if (pResolvedSurface!=NULL) pResolvedSurface->Release();
|
||||
pOffscreenSurface->Release();
|
||||
Message("uMod_IDirect3DVolumeTexture9::GetHash() Failed: LockRect (D3DPOOL_DEFAULT)\n");
|
||||
return (RETURN_LockRect_FAILED);
|
||||
}
|
||||
}
|
||||
else
|
||||
*/
|
||||
if (pTexture->LockBox( 0, &d3dlr, NULL, D3DLOCK_READONLY)!=D3D_OK)
|
||||
{
|
||||
Message("uMod_IDirect3DVolumeTexture9::GetHash() Failed: LockRect 1\n");
|
||||
@@ -371,9 +276,45 @@ int uMod_IDirect3DVolumeTexture9::GetHash(MyTypeHash &hash)
|
||||
}
|
||||
}
|
||||
|
||||
int size = (GetBitsFromFormat( desc.Format) * desc.Width*desc.Height*desc.Depth)/8;
|
||||
|
||||
hash = GetCRC32( (char*) d3dlr.pBits, size); //calculate the crc32 of the texture
|
||||
int bits_per_pixel = GetBitsFromFormat( desc.Format);
|
||||
|
||||
{
|
||||
Hash = HASH_INIT_VALUE;
|
||||
unsigned char *data = (unsigned char*) d3dlr.pBits;
|
||||
|
||||
unsigned int size;
|
||||
unsigned int h_max = desc.Height;
|
||||
if (desc.Format == D3DFMT_DXT1) // 8 bytes per block
|
||||
{
|
||||
h_max /= 4; // divide by block size
|
||||
size = desc.Width*2; // desc.Width/4 * 8
|
||||
}
|
||||
else if ( desc.Format==D3DFMT_DXT2 || desc.Format==D3DFMT_DXT3 || desc.Format==D3DFMT_DXT4 || desc.Format==D3DFMT_DXT5 ) // 16 bytes per block
|
||||
{
|
||||
h_max /= 4; // divide by block size
|
||||
size = desc.Width*4; // desc.Width/4 * 16
|
||||
}
|
||||
else size = (bits_per_pixel * desc.Width)/8;
|
||||
|
||||
//int size = (bits_per_pixel * desc.Width)/8;
|
||||
for (unsigned int d=0; d<desc.Depth; d++)
|
||||
{
|
||||
unsigned char* data_inner_loop = data;
|
||||
for (unsigned int h=0; h<h_max; h++)
|
||||
{
|
||||
GetHash( data_inner_loop, size, Hash);
|
||||
data_inner_loop += d3dlr.RowPitch;
|
||||
}
|
||||
data += d3dlr.SlicePitch;
|
||||
}
|
||||
}
|
||||
|
||||
if (compute_crc)
|
||||
{
|
||||
int size = (bits_per_pixel * desc.Width*desc.Height*desc.Depth)/8;
|
||||
CRC = GetCRC32( (char*) d3dlr.pBits, size); //calculate the crc32 of the texture
|
||||
}
|
||||
|
||||
|
||||
if (pResolvedSurface!=NULL)
|
||||
@@ -383,6 +324,6 @@ int uMod_IDirect3DVolumeTexture9::GetHash(MyTypeHash &hash)
|
||||
}
|
||||
else pTexture->UnlockBox(0);
|
||||
|
||||
Message("uMod_IDirect3DVolumeTexture9::GetHash() %#lX (%d %d) %d = %d\n", hash, desc.Width, desc.Height, desc.Format, size);
|
||||
Message("uMod_IDirect3DVolumeTexture9::GetHash() %#llX %#LX (%d %d %d) %d\n", Hash, CRC, desc.Width, desc.Height, desc.Depth, desc.Format);
|
||||
return (RETURN_OK);
|
||||
}
|
||||
|
||||
@@ -35,8 +35,9 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
|
||||
|
||||
interface uMod_IDirect3DVolumeTexture9 : public IDirect3DVolumeTexture9
|
||||
class uMod_IDirect3DVolumeTexture9 : public IDirect3DVolumeTexture9
|
||||
{
|
||||
public:
|
||||
uMod_IDirect3DVolumeTexture9(IDirect3DVolumeTexture9 **ppTex, IDirect3DDevice9 *pIDirect3DDevice9)
|
||||
{
|
||||
m_D3Dtex = *ppTex; //Texture which will be displayed and will be passed to the game
|
||||
@@ -47,16 +48,17 @@ interface uMod_IDirect3DVolumeTexture9 : public IDirect3DVolumeTexture9
|
||||
// thus the fake texture can also be deleted
|
||||
Reference = -1; //need for fast deleting
|
||||
Hash = 0u;
|
||||
CRC = 0u;
|
||||
FAKE = false;
|
||||
}
|
||||
|
||||
// callback interface
|
||||
IDirect3DVolumeTexture9 *m_D3Dtex;
|
||||
uMod_IDirect3DVolumeTexture9 *CrossRef_D3Dtex;
|
||||
IDirect3DDevice9 *m_D3Ddev;
|
||||
int Reference;
|
||||
MyTypeHash Hash;
|
||||
bool FAKE;
|
||||
IDirect3DVolumeTexture9 *m_D3Dtex; //!< pointer to the real IDirect3DCubeTexture9 object
|
||||
uMod_IDirect3DVolumeTexture9 *CrossRef_D3Dtex; //!< cross reference from the fake texture to the game texture and vice versa
|
||||
IDirect3DDevice9 *m_D3Ddev; //!< pointer to the device
|
||||
int Reference; //!< Index in the vector (needed for a fast delete).
|
||||
DWORD64 Hash; //!< computed hash value for this game texture.
|
||||
DWORD32 CRC; //!< computed crc32 value for this game texture.
|
||||
bool FAKE; //!< True if this texture is was loaded by uMod (fake texture)
|
||||
|
||||
// original interface
|
||||
STDMETHOD(QueryInterface) (REFIID riid, void** ppvObj);
|
||||
@@ -83,7 +85,7 @@ interface uMod_IDirect3DVolumeTexture9 : public IDirect3DVolumeTexture9
|
||||
STDMETHOD(UnlockBox)(UINT Level);
|
||||
|
||||
|
||||
int GetHash(MyTypeHash &hash);
|
||||
int ComputetHash( bool compute_crc);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -33,16 +33,6 @@ uMod_TextureClient_DX9::uMod_TextureClient_DX9( IDirect3DDevice9* device, const
|
||||
uMod_TextureClient_DX9::~uMod_TextureClient_DX9(void)
|
||||
{
|
||||
Message("uMod_TextureClient_DX9::~uMod_TextureClient(void): %lu\n", this);
|
||||
if (Server!=NULL) Server->RemoveClient( this, Version);
|
||||
|
||||
if (Mutex!=NULL) CloseHandle(Mutex);
|
||||
|
||||
if (Update!=NULL) delete [] Update;
|
||||
if (FileToMod!=NULL)
|
||||
{
|
||||
for (int i=0; i<NumberToMod; i++) if (FileToMod[i].Textures!=NULL) delete [] FileToMod[i].Textures;
|
||||
delete [] FileToMod;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,17 +47,14 @@ int uMod_TextureClient_DX9::AddTexture( uMod_IDirect3DTexture9* pTexture)
|
||||
|
||||
Message("uMod_TextureClient_DX9::AddTexture( %lu): %lu (thread: %lu)\n", pTexture, this, GetCurrentThreadId());
|
||||
|
||||
MyTypeHash hash;
|
||||
if (int ret = pTexture->GetHash( hash))
|
||||
if (int ret = pTexture->ComputetHash( BoolComputeCRC))
|
||||
{
|
||||
Bool_CheckAgainNonAdded = true;
|
||||
NonAdded_OriginalTextures.Add( pTexture);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
pTexture->Hash = hash;
|
||||
|
||||
if (BoolSaveAllTextures) SaveTexture(pTexture);
|
||||
if (BoolSaveAllTextures) SaveTexture(pTexture, true);
|
||||
|
||||
if (gl_ErrorState & uMod_ERROR_FATAL) return (RETURN_FATAL_ERROR);
|
||||
|
||||
@@ -87,17 +74,14 @@ int uMod_TextureClient_DX9::AddTexture( uMod_IDirect3DVolumeTexture9* pTexture)
|
||||
|
||||
Message("uMod_TextureClient_DX9::AddTexture( Volume: %lu): %lu (thread: %lu)\n", pTexture, this, GetCurrentThreadId());
|
||||
|
||||
MyTypeHash hash;
|
||||
if (int ret = pTexture->GetHash( hash))
|
||||
if (int ret = pTexture->ComputetHash( BoolComputeCRC))
|
||||
{
|
||||
Bool_CheckAgainNonAdded = true;
|
||||
NonAdded_OriginalVolumeTextures.Add( pTexture);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
pTexture->Hash = hash;
|
||||
|
||||
if (BoolSaveAllTextures) SaveTexture(pTexture);
|
||||
if (BoolSaveAllTextures) SaveTexture(pTexture, true);
|
||||
|
||||
if (gl_ErrorState & uMod_ERROR_FATAL) return (RETURN_FATAL_ERROR);
|
||||
|
||||
@@ -117,17 +101,14 @@ int uMod_TextureClient_DX9::AddTexture( uMod_IDirect3DCubeTexture9* pTexture)
|
||||
|
||||
Message("uMod_TextureClient_DX9::AddTexture( Cube: %lu): %lu (thread: %lu)\n", pTexture, this, GetCurrentThreadId());
|
||||
|
||||
MyTypeHash hash;
|
||||
if (int ret = pTexture->GetHash( hash))
|
||||
if (int ret = pTexture->ComputetHash( BoolComputeCRC))
|
||||
{
|
||||
Bool_CheckAgainNonAdded = true;
|
||||
NonAdded_OriginalCubeTextures.Add( pTexture);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
pTexture->Hash = hash;
|
||||
|
||||
if (BoolSaveAllTextures) SaveTexture(pTexture);
|
||||
if (BoolSaveAllTextures) SaveTexture(pTexture, true);
|
||||
|
||||
if (gl_ErrorState & uMod_ERROR_FATAL) return (RETURN_FATAL_ERROR);
|
||||
|
||||
@@ -149,8 +130,7 @@ int uMod_TextureClient_DX9::CheckAgainNonAdded(void)
|
||||
{
|
||||
uMod_IDirect3DTexture9* pTexture = NonAdded_OriginalTextures[i];
|
||||
|
||||
MyTypeHash hash;
|
||||
if (pTexture->GetHash( hash) == 0)
|
||||
if (pTexture->ComputetHash( BoolComputeCRC) == RETURN_OK)
|
||||
{
|
||||
NonAdded_OriginalTextures.Remove(pTexture);
|
||||
OriginalTextures.Add( pTexture); // add the texture to the list of original texture
|
||||
@@ -163,8 +143,7 @@ int uMod_TextureClient_DX9::CheckAgainNonAdded(void)
|
||||
{
|
||||
uMod_IDirect3DVolumeTexture9* pTexture = NonAdded_OriginalVolumeTextures[i];
|
||||
|
||||
MyTypeHash hash;
|
||||
if (pTexture->GetHash( hash) == 0)
|
||||
if (pTexture->ComputetHash( BoolComputeCRC) == RETURN_OK)
|
||||
{
|
||||
NonAdded_OriginalVolumeTextures.Remove(pTexture);
|
||||
OriginalVolumeTextures.Add( pTexture); // add the texture to the list of original texture
|
||||
@@ -177,8 +156,7 @@ int uMod_TextureClient_DX9::CheckAgainNonAdded(void)
|
||||
{
|
||||
uMod_IDirect3DCubeTexture9* pTexture = NonAdded_OriginalCubeTextures[i];
|
||||
|
||||
MyTypeHash hash;
|
||||
if (pTexture->GetHash( hash) == 0)
|
||||
if (pTexture->ComputetHash( BoolComputeCRC) == RETURN_OK)
|
||||
{
|
||||
NonAdded_OriginalCubeTextures.Remove(pTexture);
|
||||
OriginalCubeTextures.Add( pTexture); // add the texture to the list of original texture
|
||||
@@ -299,49 +277,248 @@ int uMod_TextureClient_DX9::SaveSingleTexture(bool val)
|
||||
}
|
||||
|
||||
|
||||
int uMod_TextureClient_DX9::SaveTexture(uMod_IDirect3DTexture9* pTexture)
|
||||
int uMod_TextureClient_DX9::SaveTexture(uMod_IDirect3DTexture9* pTexture, bool save_all)
|
||||
{
|
||||
if (pTexture==NULL) return (RETURN_BAD_ARGUMENT);
|
||||
if (SavePath[0]==0)
|
||||
{
|
||||
Message("uMod_TextureClient_DX9::SaveTexture( %#lX, %lu): %lu, SavePath not set\n", pTexture->Hash, pTexture->m_D3Dtex, this);
|
||||
return (RETURN_TEXTURE_NOT_SAVED);
|
||||
}
|
||||
D3DSURFACE_DESC desc;
|
||||
if (pTexture->m_D3Dtex->GetLevelDesc(0, &desc)!=D3D_OK) //get the format and the size of the texture
|
||||
{
|
||||
Message("uMod_TextureClient_DX9::SaveTexture() Failed: GetLevelDesc \n");
|
||||
return (RETURN_GetLevelDesc_FAILED);
|
||||
}
|
||||
|
||||
if (save_all)
|
||||
{
|
||||
if (WidthFilter)
|
||||
{
|
||||
unsigned int min = WidthFilter >> 32;
|
||||
unsigned int max = (WidthFilter<<32) >> 32;
|
||||
if (desc.Width<min || desc.Width> max) return (RETURN_OK);
|
||||
}
|
||||
if (HeightFilter)
|
||||
{
|
||||
unsigned int min = HeightFilter >> 32;
|
||||
unsigned int max = (HeightFilter<<32) >> 32;
|
||||
if (desc.Height<min || desc.Height> max) return (RETURN_OK);
|
||||
}
|
||||
if (!SaveTextureFilterFormat(desc.Format)) return (RETURN_OK);
|
||||
}
|
||||
|
||||
|
||||
wchar_t file[MAX_PATH];
|
||||
if (GameName[0]) swprintf_s( file, MAX_PATH, L"%ls\\%ls_W%u_H%u_F%u_T_%#llX", SavePath, GameName, desc.Width, desc.Height,desc.Format, pTexture->Hash);
|
||||
else swprintf_s( file, MAX_PATH, L"%ls\\W%u_H%u_F%u_T_%#llX", SavePath, desc.Width, desc.Height, desc.Format, pTexture->Hash);
|
||||
Message("uMod_TextureClient_DX9::SaveTexture( %ls): %lu\n", file, this);
|
||||
|
||||
return (SaveTexture( pTexture->m_D3Dtex, file));
|
||||
}
|
||||
|
||||
int uMod_TextureClient_DX9::SaveTexture(uMod_IDirect3DVolumeTexture9* pTexture, bool save_all)
|
||||
{
|
||||
if (pTexture==NULL) return (RETURN_BAD_ARGUMENT);
|
||||
if (SavePath[0]==0) {Message("uMod_TextureClient_DX9::SaveTexture( %#lX, %lu): %lu, SavePath not set\n", pTexture->Hash, pTexture->m_D3Dtex, this); return (RETURN_TEXTURE_NOT_SAVED);}
|
||||
|
||||
D3DVOLUME_DESC desc;
|
||||
if (pTexture->m_D3Dtex->GetLevelDesc(0, &desc)!=D3D_OK) //get the format and the size of the texture
|
||||
{
|
||||
Message("uMod_TextureClient_DX9::SaveTexture() Failed: GetLevelDesc \n");
|
||||
return (RETURN_GetLevelDesc_FAILED);
|
||||
}
|
||||
|
||||
if (save_all)
|
||||
{
|
||||
if (WidthFilter)
|
||||
{
|
||||
unsigned int min = WidthFilter >> 32;
|
||||
unsigned int max = (WidthFilter<<32) >> 32;
|
||||
if (desc.Width<min || desc.Width> max) return (RETURN_OK);
|
||||
}
|
||||
if (HeightFilter)
|
||||
{
|
||||
unsigned int min = HeightFilter >> 32;
|
||||
unsigned int max = (HeightFilter<<32) >> 32;
|
||||
if (desc.Height<min || desc.Height> max) return (RETURN_OK);
|
||||
}
|
||||
if (DepthFilter)
|
||||
{
|
||||
unsigned int min = DepthFilter >> 32;
|
||||
unsigned int max = (DepthFilter<<32) >> 32;
|
||||
if (desc.Depth<min || desc.Depth> max) return (RETURN_OK);
|
||||
}
|
||||
if (!SaveTextureFilterFormat(desc.Format)) return (RETURN_OK);
|
||||
}
|
||||
|
||||
wchar_t file[MAX_PATH];
|
||||
if (GameName[0]) swprintf_s( file, MAX_PATH, L"%ls\\%ls_T_%#lX.dds", SavePath, GameName, pTexture->Hash);
|
||||
else swprintf_s( file, MAX_PATH, L"%ls\\T_%#lX.dds", SavePath, pTexture->Hash);
|
||||
if (GameName[0]) swprintf_s( file, MAX_PATH, L"%ls\\%ls_W%u_H%u_D%u_F%u_V_%#llX", SavePath, GameName, desc.Width, desc.Height, desc.Depth, desc.Format, pTexture->Hash);
|
||||
else swprintf_s( file, MAX_PATH, L"%ls\\W%u_H%u_D%u_F%u_V_%#llX", SavePath, desc.Width, desc.Height, desc.Depth, desc.Format, pTexture->Hash);
|
||||
Message("uMod_TextureClient_DX9::SaveTexture( %ls): %lu\n", file, this);
|
||||
|
||||
if (D3D_OK!=D3DXSaveTextureToFileW( file, D3DXIFF_DDS, pTexture->m_D3Dtex, NULL)) return (RETURN_TEXTURE_NOT_SAVED);
|
||||
return (RETURN_OK);
|
||||
return (SaveTexture( pTexture->m_D3Dtex, file));
|
||||
}
|
||||
|
||||
int uMod_TextureClient_DX9::SaveTexture(uMod_IDirect3DVolumeTexture9* pTexture)
|
||||
int uMod_TextureClient_DX9::SaveTexture(uMod_IDirect3DCubeTexture9* pTexture, bool save_all)
|
||||
{
|
||||
if (pTexture==NULL) return (RETURN_BAD_ARGUMENT);
|
||||
if (SavePath[0]==0) {Message("uMod_TextureClient_DX9::SaveTexture( %#lX, %lu): %lu, SavePath not set\n", pTexture->Hash, pTexture->m_D3Dtex, this); return (RETURN_TEXTURE_NOT_SAVED);}
|
||||
|
||||
D3DSURFACE_DESC desc;
|
||||
if (pTexture->m_D3Dtex->GetLevelDesc(0, &desc)!=D3D_OK) //get the format and the size of the texture
|
||||
{
|
||||
Message("uMod_TextureClient_DX9::SaveTexture() Failed: GetLevelDesc \n");
|
||||
return (RETURN_GetLevelDesc_FAILED);
|
||||
}
|
||||
|
||||
if (save_all)
|
||||
{
|
||||
if (WidthFilter)
|
||||
{
|
||||
unsigned int min = WidthFilter >> 32;
|
||||
unsigned int max = (WidthFilter<<32) >> 32;
|
||||
if (desc.Width<min || desc.Width> max) return (RETURN_OK);
|
||||
}
|
||||
if (!SaveTextureFilterFormat(desc.Format)) return (RETURN_OK);
|
||||
}
|
||||
|
||||
wchar_t file[MAX_PATH];
|
||||
if (GameName[0]) swprintf_s( file, MAX_PATH, L"%ls\\%ls_V_%#lX.dds", SavePath, GameName, pTexture->Hash);
|
||||
else swprintf_s( file, MAX_PATH, L"%ls\\V_%#lX.dds", SavePath, pTexture->Hash);
|
||||
if (GameName[0]) swprintf_s( file, MAX_PATH, L"%ls\\%ls_W%u_F%u_C_%#llX.dds", SavePath, GameName, desc.Width, desc.Format, pTexture->Hash);
|
||||
else swprintf_s( file, MAX_PATH, L"%ls\\W%u_F%u_C_%#llX.dds", SavePath, desc.Width, desc.Format, pTexture->Hash);
|
||||
Message("uMod_TextureClient_DX9::SaveTexture( %ls): %lu\n", file, this);
|
||||
|
||||
if (D3D_OK!=D3DXSaveTextureToFileW( file, D3DXIFF_DDS, pTexture->m_D3Dtex, NULL)) return (RETURN_TEXTURE_NOT_SAVED);
|
||||
return (RETURN_OK);
|
||||
|
||||
return (SaveTexture( pTexture->m_D3Dtex, file));
|
||||
}
|
||||
|
||||
int uMod_TextureClient_DX9::SaveTexture(uMod_IDirect3DCubeTexture9* pTexture)
|
||||
|
||||
int uMod_TextureClient_DX9::SaveTexture(IDirect3DBaseTexture9* pTexture, wchar_t *file)
|
||||
{
|
||||
if (pTexture==NULL) return (RETURN_BAD_ARGUMENT);
|
||||
if (SavePath[0]==0) {Message("uMod_TextureClient_DX9::SaveTexture( %#lX, %lu): %lu, SavePath not set\n", pTexture->Hash, pTexture->m_D3Dtex, this); return (RETURN_TEXTURE_NOT_SAVED);}
|
||||
|
||||
wchar_t file[MAX_PATH];
|
||||
if (GameName[0]) swprintf_s( file, MAX_PATH, L"%ls\\%ls_C_%#lX.dds", SavePath, GameName, pTexture->Hash);
|
||||
else swprintf_s( file, MAX_PATH, L"%ls\\C_%#lX.dds", SavePath, pTexture->Hash);
|
||||
Message("uMod_TextureClient_DX9::SaveTexture( %ls): %lu\n", file, this);
|
||||
|
||||
if (D3D_OK!=D3DXSaveTextureToFileW( file, D3DXIFF_DDS, pTexture->m_D3Dtex, NULL)) return (RETURN_TEXTURE_NOT_SAVED);
|
||||
unsigned int len=0;
|
||||
while (file[len]) len++;
|
||||
if (FileFormat & uMod_D3DXIFF_BMP)
|
||||
{
|
||||
file[len] = '.';file[len+1] = 'b';file[len+2] = 'm';file[len+3] = 'p';file[len+4] = '\0';
|
||||
if (D3D_OK!=D3DXSaveTextureToFileW( file, D3DXIFF_BMP, pTexture, NULL)) return (RETURN_TEXTURE_NOT_SAVED);
|
||||
}
|
||||
if (FileFormat & uMod_D3DXIFF_JPG)
|
||||
{
|
||||
file[len] = '.';file[len+1] = 'j';file[len+2] = 'p';file[len+3] = 'g';file[len+4] = '\0';
|
||||
if (D3D_OK!=D3DXSaveTextureToFileW( file, D3DXIFF_JPG, pTexture, NULL)) return (RETURN_TEXTURE_NOT_SAVED);
|
||||
}
|
||||
if (FileFormat & uMod_D3DXIFF_TGA)
|
||||
{
|
||||
file[len] = '.';file[len+1] = 't';file[len+2] = 'g';file[len+3] = 'a';file[len+4] = '\0';
|
||||
if (D3D_OK!=D3DXSaveTextureToFileW( file, D3DXIFF_TGA, pTexture, NULL)) return (RETURN_TEXTURE_NOT_SAVED);
|
||||
}
|
||||
if (FileFormat & uMod_D3DXIFF_PNG)
|
||||
{
|
||||
file[len] = '.';file[len+1] = 'p';file[len+2] = 'n';file[len+3] = 'g';file[len+4] = '\0';
|
||||
if (D3D_OK!=D3DXSaveTextureToFileW( file, D3DXIFF_PNG, pTexture, NULL)) return (RETURN_TEXTURE_NOT_SAVED);
|
||||
}
|
||||
if (FileFormat & uMod_D3DXIFF_DDS)
|
||||
{
|
||||
file[len] = '.';file[len+1] = 'd';file[len+2] = 'd';file[len+3] = 's';file[len+4] = '\0';
|
||||
if (D3D_OK!=D3DXSaveTextureToFileW( file, D3DXIFF_DDS, pTexture, NULL)) return (RETURN_TEXTURE_NOT_SAVED);
|
||||
}
|
||||
if (FileFormat & uMod_D3DXIFF_PPM)
|
||||
{
|
||||
file[len] = '.';file[len+1] = 'p';file[len+2] = 'p';file[len+3] = 'm';file[len+4] = '\0';
|
||||
if (D3D_OK!=D3DXSaveTextureToFileW( file, D3DXIFF_PPM, pTexture, NULL)) return (RETURN_TEXTURE_NOT_SAVED);
|
||||
}
|
||||
return (RETURN_OK);
|
||||
}
|
||||
|
||||
#define DEF_FormatCheck( format ) \
|
||||
case format: \
|
||||
{ \
|
||||
if (FormatFilter & uMod_ ## format) return (true); \
|
||||
else return (false); \
|
||||
}
|
||||
|
||||
|
||||
bool uMod_TextureClient_DX9::SaveTextureFilterFormat(D3DFORMAT format)
|
||||
{
|
||||
if (FormatFilter == 0u) return (true);
|
||||
switch(format) //switch trough the formats to calculate the size of the raw data
|
||||
{
|
||||
DEF_FormatCheck( D3DFMT_A1) // 1-bit monochrome.
|
||||
DEF_FormatCheck( D3DFMT_R3G3B2) // 8-bit RGB texture format using 3 bits for red, 3 bits for green, and 2 bits for blue.
|
||||
DEF_FormatCheck( D3DFMT_A8) // 8-bit alpha only.
|
||||
|
||||
DEF_FormatCheck( D3DFMT_A8P8) // 8-bit color indexed with 8 bits of alpha.
|
||||
DEF_FormatCheck( D3DFMT_P8) // 8-bit color indexed.
|
||||
DEF_FormatCheck( D3DFMT_L8) // 8-bit luminance only.
|
||||
DEF_FormatCheck( D3DFMT_A4L4) // 8-bit using 4 bits each for alpha and luminance.
|
||||
|
||||
//DEF_FormatCheck( D3DFMT_FORCE_DWORD)
|
||||
DEF_FormatCheck( D3DFMT_S8_LOCKABLE) // A lockable 8-bit stencil buffer.
|
||||
|
||||
DEF_FormatCheck( D3DFMT_D16_LOCKABLE) //16-bit z-buffer bit depth.
|
||||
DEF_FormatCheck( D3DFMT_D15S1) // 16-bit z-buffer bit depth where 15 bits are reserved for the depth channel and 1 bit is reserved for the stencil channel.
|
||||
DEF_FormatCheck( D3DFMT_L6V5U5) // 16-bit bump-map format with luminance using 6 bits for luminance, and 5 bits each for v and u.
|
||||
DEF_FormatCheck( D3DFMT_V8U8) // 16-bit bump-map format using 8 bits each for u and v data.
|
||||
DEF_FormatCheck( D3DFMT_CxV8U8) // 16-bit normal compression format. The texture sampler computes the C channel from) C = sqrt(1 - U2 - V2).
|
||||
DEF_FormatCheck( D3DFMT_R5G6B5) // 16-bit RGB pixel format with 5 bits for red, 6 bits for green, and 5 bits for blue.
|
||||
DEF_FormatCheck( D3DFMT_X1R5G5B5) // 16-bit pixel format where 5 bits are reserved for each color.
|
||||
DEF_FormatCheck( D3DFMT_A1R5G5B5) // 16-bit pixel format where 5 bits are reserved for each color and 1 bit is reserved for alpha.
|
||||
DEF_FormatCheck( D3DFMT_A4R4G4B4) // 16-bit ARGB pixel format with 4 bits for each channel.
|
||||
DEF_FormatCheck( D3DFMT_A8R3G3B2) // 16-bit ARGB texture format using 8 bits for alpha, 3 bits each for red and green, and 2 bits for blue.
|
||||
DEF_FormatCheck( D3DFMT_X4R4G4B4) // 16-bit RGB pixel format using 4 bits for each color.
|
||||
DEF_FormatCheck( D3DFMT_L16) // 16-bit luminance only.
|
||||
DEF_FormatCheck( D3DFMT_R16F) // 16-bit float format using 16 bits for the red channel.
|
||||
DEF_FormatCheck( D3DFMT_A8L8) // 16-bit using 8 bits each for alpha and luminance.
|
||||
DEF_FormatCheck( D3DFMT_D16) // 16-bit z-buffer bit depth.
|
||||
DEF_FormatCheck( D3DFMT_INDEX16) // 16-bit index buffer bit depth.
|
||||
DEF_FormatCheck( D3DFMT_G8R8_G8B8) // ??
|
||||
DEF_FormatCheck( D3DFMT_R8G8_B8G8) // ??
|
||||
DEF_FormatCheck( D3DFMT_UYVY) // ??
|
||||
DEF_FormatCheck( D3DFMT_YUY2) // ??
|
||||
|
||||
DEF_FormatCheck( D3DFMT_R8G8B8) //24-bit RGB pixel format with 8 bits per channel.
|
||||
|
||||
DEF_FormatCheck( D3DFMT_R32F) // 32-bit float format using 32 bits for the red channel.
|
||||
DEF_FormatCheck( D3DFMT_X8L8V8U8) // 32-bit bump-map format with luminance using 8 bits for each channel.
|
||||
DEF_FormatCheck( D3DFMT_A2W10V10U10) // 32-bit bump-map format using 2 bits for alpha and 10 bits each for w, v, and u.
|
||||
DEF_FormatCheck( D3DFMT_Q8W8V8U8) // 32-bit bump-map format using 8 bits for each channel.
|
||||
DEF_FormatCheck( D3DFMT_V16U16) // 32-bit bump-map format using 16 bits for each channel.
|
||||
DEF_FormatCheck( D3DFMT_A8R8G8B8) // 32-bit ARGB pixel format with alpha, using 8 bits per channel.
|
||||
DEF_FormatCheck( D3DFMT_X8R8G8B8) // 32-bit RGB pixel format, where 8 bits are reserved for each color.
|
||||
DEF_FormatCheck( D3DFMT_A2B10G10R10) // 32-bit pixel format using 10 bits for each color and 2 bits for alpha.
|
||||
DEF_FormatCheck( D3DFMT_A8B8G8R8) // 32-bit ARGB pixel format with alpha, using 8 bits per channel.
|
||||
DEF_FormatCheck( D3DFMT_X8B8G8R8) // 32-bit RGB pixel format, where 8 bits are reserved for each color.
|
||||
DEF_FormatCheck( D3DFMT_G16R16) // 32-bit pixel format using 16 bits each for green and red.
|
||||
DEF_FormatCheck( D3DFMT_G16R16F) // 32-bit float format using 16 bits for the red channel and 16 bits for the green channel.
|
||||
DEF_FormatCheck( D3DFMT_A2R10G10B10) // 32-bit pixel format using 10 bits each for red, green, and blue, and 2 bits for alpha.
|
||||
DEF_FormatCheck( D3DFMT_D32) // 32-bit z-buffer bit depth.
|
||||
DEF_FormatCheck( D3DFMT_D24S8) // 32-bit z-buffer bit depth using 24 bits for the depth channel and 8 bits for the stencil channel.
|
||||
DEF_FormatCheck( D3DFMT_D24X8) //32-bit z-buffer bit depth using 24 bits for the depth channel.
|
||||
DEF_FormatCheck( D3DFMT_D24X4S4) // 32-bit z-buffer bit depth using 24 bits for the depth channel and 4 bits for the stencil channel.
|
||||
DEF_FormatCheck( D3DFMT_D32F_LOCKABLE) // A lockable format where the depth value is represented as a standard IEEE floating-point number.
|
||||
DEF_FormatCheck( D3DFMT_D24FS8) // A non-lockable format that contains 24 bits of depth (in a 24-bit floating point format - 20e4) and 8 bits of stencil.
|
||||
DEF_FormatCheck( D3DFMT_D32_LOCKABLE) // A lockable 32-bit depth buffer.
|
||||
DEF_FormatCheck( D3DFMT_INDEX32) // 32-bit index buffer bit depth.
|
||||
|
||||
DEF_FormatCheck( D3DFMT_G32R32F) // 64-bit float format using 32 bits for the red channel and 32 bits for the green channel.
|
||||
DEF_FormatCheck( D3DFMT_Q16W16V16U16) // 64-bit bump-map format using 16 bits for each component.
|
||||
DEF_FormatCheck( D3DFMT_A16B16G16R16) // 64-bit pixel format using 16 bits for each component.
|
||||
DEF_FormatCheck( D3DFMT_A16B16G16R16F) // 64-bit float format using 16 bits for the each channel (alpha, blue, green, red).
|
||||
|
||||
DEF_FormatCheck( D3DFMT_A32B32G32R32F) // 128-bit float format using 32 bits for the each channel (alpha, blue, green, red).
|
||||
DEF_FormatCheck( D3DFMT_DXT2)
|
||||
DEF_FormatCheck( D3DFMT_DXT3)
|
||||
DEF_FormatCheck( D3DFMT_DXT4)
|
||||
DEF_FormatCheck( D3DFMT_DXT5)
|
||||
DEF_FormatCheck( D3DFMT_DXT1)
|
||||
default: //compressed formats
|
||||
{
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
return (false);
|
||||
}
|
||||
int uMod_TextureClient_DX9::MergeUpdate(void)
|
||||
{
|
||||
if (NumberOfUpdate<0) {return (RETURN_OK);}
|
||||
@@ -548,7 +725,7 @@ int uMod_TextureClient_DX9::MergeUpdate(void)
|
||||
|
||||
if (to_lookup != NULL) delete [] to_lookup;
|
||||
|
||||
Message("uMod_TextureClient_DX9::MergeUpdate() END: %lu\n", this);
|
||||
Message("uMod_TextureClient_DX9::MergeUpdate() END: %p\n", this);
|
||||
|
||||
CheckAgainNonAdded();
|
||||
return (UnlockMutex());
|
||||
@@ -558,7 +735,7 @@ int uMod_TextureClient_DX9::MergeUpdate(void)
|
||||
|
||||
int uMod_TextureClient_DX9::LookUpToMod( uMod_IDirect3DTexture9* pTexture, int num_index_list, int *index_list) // should only be called for original textures
|
||||
{
|
||||
Message("uMod_TextureClient_DX9::LookUpToMod( %lu): hash: %#lX, %lu\n", pTexture, pTexture->Hash, this);
|
||||
Message("uMod_TextureClient_DX9::LookUpToMod( %p): hash: %#llX, %p\n", pTexture, pTexture->Hash, this);
|
||||
if (pTexture->CrossRef_D3Dtex!=NULL) return (RETURN_OK); // bug, this texture is already switched
|
||||
int index = GetIndex( pTexture->Hash, num_index_list, index_list);
|
||||
if (index>=0)
|
||||
@@ -582,12 +759,37 @@ int uMod_TextureClient_DX9::LookUpToMod( uMod_IDirect3DTexture9* pTexture, int n
|
||||
fake_Texture->Reference = index;
|
||||
}
|
||||
}
|
||||
else if (BoolComputeCRC && pTexture->CRC>0)
|
||||
{
|
||||
index = GetIndex( pTexture->CRC, num_index_list, index_list);
|
||||
if (index>=0)
|
||||
{
|
||||
uMod_IDirect3DTexture9 *fake_Texture;
|
||||
if (int ret = LoadTexture( & (FileToMod[index]), &fake_Texture)) return (ret);
|
||||
if (SwitchTextures( fake_Texture, pTexture))
|
||||
{
|
||||
Message("uMod_TextureClient_DX9::LookUpToMod(): textures not switched %#lX\n", FileToMod[index].Hash);
|
||||
fake_Texture->Release();
|
||||
}
|
||||
else
|
||||
{
|
||||
IDirect3DBaseTexture9 **temp = new IDirect3DBaseTexture9*[FileToMod[index].NumberOfTextures+1];
|
||||
for (int j=0; j<FileToMod[index].NumberOfTextures; j++) temp[j] = (IDirect3DBaseTexture9*) FileToMod[index].Textures[j];
|
||||
|
||||
if (FileToMod[index].Textures!=NULL) delete [] FileToMod[index].Textures;
|
||||
FileToMod[index].Textures = (void**) temp;
|
||||
|
||||
FileToMod[index].Textures[FileToMod[index].NumberOfTextures++] = fake_Texture;
|
||||
fake_Texture->Reference = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (RETURN_OK);
|
||||
}
|
||||
|
||||
int uMod_TextureClient_DX9::LookUpToMod( uMod_IDirect3DVolumeTexture9* pTexture, int num_index_list, int *index_list) // should only be called for original textures
|
||||
{
|
||||
Message("uMod_TextureClient_DX9::LookUpToMod( Volume %lu): hash: %#lX, %lu\n", pTexture, pTexture->Hash, this);
|
||||
Message("uMod_TextureClient_DX9::LookUpToMod( Volume %p): hash: %#llX, %p\n", pTexture, pTexture->Hash, this);
|
||||
if (pTexture->CrossRef_D3Dtex!=NULL) return (RETURN_OK); // bug, this texture is already switched
|
||||
int index = GetIndex( pTexture->Hash, num_index_list, index_list);
|
||||
if (index>=0)
|
||||
@@ -611,12 +813,37 @@ int uMod_TextureClient_DX9::LookUpToMod( uMod_IDirect3DVolumeTexture9* pTexture,
|
||||
fake_Texture->Reference = index;
|
||||
}
|
||||
}
|
||||
else if (BoolComputeCRC && pTexture->CRC>0)
|
||||
{
|
||||
index = GetIndex( pTexture->CRC, num_index_list, index_list);
|
||||
if (index>=0)
|
||||
{
|
||||
uMod_IDirect3DVolumeTexture9 *fake_Texture;
|
||||
if (int ret = LoadTexture( & (FileToMod[index]), &fake_Texture)) return (ret);
|
||||
if (SwitchTextures( fake_Texture, pTexture))
|
||||
{
|
||||
Message("uMod_TextureClient_DX9::LookUpToMod(): textures not switched %#lX\n", FileToMod[index].Hash);
|
||||
fake_Texture->Release();
|
||||
}
|
||||
else
|
||||
{
|
||||
IDirect3DBaseTexture9 **temp = new IDirect3DBaseTexture9*[FileToMod[index].NumberOfTextures+1];
|
||||
for (int j=0; j<FileToMod[index].NumberOfTextures; j++) temp[j] = (IDirect3DBaseTexture9*) FileToMod[index].Textures[j];
|
||||
|
||||
if (FileToMod[index].Textures!=NULL) delete [] FileToMod[index].Textures;
|
||||
FileToMod[index].Textures = (void**) temp;
|
||||
|
||||
FileToMod[index].Textures[FileToMod[index].NumberOfTextures++] = fake_Texture;
|
||||
fake_Texture->Reference = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (RETURN_OK);
|
||||
}
|
||||
|
||||
int uMod_TextureClient_DX9::LookUpToMod( uMod_IDirect3DCubeTexture9* pTexture, int num_index_list, int *index_list) // should only be called for original textures
|
||||
{
|
||||
Message("uMod_TextureClient_DX9::LookUpToMod( Cube %lu): hash: %#lX, %lu\n", pTexture, pTexture->Hash, this);
|
||||
Message("uMod_TextureClient_DX9::LookUpToMod( Cube %p): hash: %#llX, %p\n", pTexture, pTexture->Hash, this);
|
||||
if (pTexture->CrossRef_D3Dtex!=NULL) return (RETURN_OK); // bug, this texture is already switched
|
||||
int index = GetIndex( pTexture->Hash, num_index_list, index_list);
|
||||
if (index>=0)
|
||||
@@ -640,6 +867,31 @@ int uMod_TextureClient_DX9::LookUpToMod( uMod_IDirect3DCubeTexture9* pTexture, i
|
||||
fake_Texture->Reference = index;
|
||||
}
|
||||
}
|
||||
else if (BoolComputeCRC && pTexture->CRC>0)
|
||||
{
|
||||
index = GetIndex( pTexture->CRC, num_index_list, index_list);
|
||||
if (index>=0)
|
||||
{
|
||||
uMod_IDirect3DCubeTexture9 *fake_Texture;
|
||||
if (int ret = LoadTexture( & (FileToMod[index]), &fake_Texture)) return (ret);
|
||||
if (SwitchTextures( fake_Texture, pTexture))
|
||||
{
|
||||
Message("uMod_TextureClient_DX9::LookUpToMod(): textures not switched %#lX\n", FileToMod[index].Hash);
|
||||
fake_Texture->Release();
|
||||
}
|
||||
else
|
||||
{
|
||||
IDirect3DBaseTexture9 **temp = new IDirect3DBaseTexture9*[FileToMod[index].NumberOfTextures+1];
|
||||
for (int j=0; j<FileToMod[index].NumberOfTextures; j++) temp[j] = (IDirect3DBaseTexture9*) FileToMod[index].Textures[j];
|
||||
|
||||
if (FileToMod[index].Textures!=NULL) delete [] FileToMod[index].Textures;
|
||||
FileToMod[index].Textures = (void**) temp;
|
||||
|
||||
FileToMod[index].Textures[FileToMod[index].NumberOfTextures++] = fake_Texture;
|
||||
fake_Texture->Reference = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (RETURN_OK);
|
||||
}
|
||||
|
||||
@@ -648,7 +900,7 @@ int uMod_TextureClient_DX9::LookUpToMod( uMod_IDirect3DCubeTexture9* pTexture, i
|
||||
|
||||
int uMod_TextureClient_DX9::LoadTexture( TextureFileStruct* file_in_memory, uMod_IDirect3DTexture9 **ppTexture) // to load fake texture from a file in memory
|
||||
{
|
||||
Message("LoadTexture( %lu, %lu, %#lX): %lu\n", file_in_memory, ppTexture, file_in_memory->Hash, this);
|
||||
Message("LoadTexture( %p, %p, %#llX): %p\n", file_in_memory, ppTexture, file_in_memory->Hash, this);
|
||||
if (D3D_OK != D3DXCreateTextureFromFileInMemoryEx( D3D9Device, file_in_memory->pData, file_in_memory->Size, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, (IDirect3DTexture9 **) ppTexture))
|
||||
//if (D3D_OK != D3DXCreateTextureFromFileInMemory( D3D9Device, file_in_memory->pData, file_in_memory->Size, (IDirect3DTexture9 **) ppTexture))
|
||||
{
|
||||
@@ -662,13 +914,13 @@ int uMod_TextureClient_DX9::LoadTexture( TextureFileStruct* file_in_memory, uMod
|
||||
if (ret == 0x01000000L) ((uMod_IDirect3DDevice9*)D3D9Device)->SetLastCreatedTexture(NULL); //this texture must no be added twice
|
||||
else ((uMod_IDirect3DDevice9Ex*) D3D9Device)->SetLastCreatedTexture(NULL); //this texture must no be added twice
|
||||
|
||||
Message("LoadTexture( %lu, %#lX): DONE\n", *ppTexture, file_in_memory->Hash);
|
||||
Message("LoadTexture( %p, %#llX): DONE\n", *ppTexture, file_in_memory->Hash);
|
||||
return (RETURN_OK);
|
||||
}
|
||||
|
||||
int uMod_TextureClient_DX9::LoadTexture( TextureFileStruct* file_in_memory, uMod_IDirect3DVolumeTexture9 **ppTexture) // to load fake texture from a file in memory
|
||||
{
|
||||
Message("LoadTexture( Volume %lu, %lu, %#lX): %lu\n", file_in_memory, ppTexture, file_in_memory->Hash, this);
|
||||
Message("LoadTexture( Volume %p, %p, %#llX): %p\n", file_in_memory, ppTexture, file_in_memory->Hash, this);
|
||||
if (D3D_OK != D3DXCreateVolumeTextureFromFileInMemoryEx( D3D9Device, file_in_memory->pData, file_in_memory->Size, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, (IDirect3DVolumeTexture9 **) ppTexture))
|
||||
//if (D3D_OK != D3DXCreateVolumeTextureFromFileInMemory( D3D9Device, file_in_memory->pData, file_in_memory->Size, (IDirect3DVolumeTexture9 **) ppTexture))
|
||||
{
|
||||
@@ -682,13 +934,13 @@ int uMod_TextureClient_DX9::LoadTexture( TextureFileStruct* file_in_memory, uMod
|
||||
if (ret == 0x01000000L) ((uMod_IDirect3DDevice9*)D3D9Device)->SetLastCreatedVolumeTexture(NULL); //this texture must no be added twice
|
||||
else ((uMod_IDirect3DDevice9Ex*) D3D9Device)->SetLastCreatedVolumeTexture(NULL); //this texture must no be added twice
|
||||
|
||||
Message("LoadTexture( Volume %lu, %#lX): DONE\n", *ppTexture, file_in_memory->Hash);
|
||||
Message("LoadTexture( Volume %p, %#llX): DONE\n", *ppTexture, file_in_memory->Hash);
|
||||
return (RETURN_OK);
|
||||
}
|
||||
|
||||
int uMod_TextureClient_DX9::LoadTexture( TextureFileStruct* file_in_memory, uMod_IDirect3DCubeTexture9 **ppTexture) // to load fake texture from a file in memory
|
||||
{
|
||||
Message("LoadTexture( Cube %lu, %lu, %#lX): %lu\n", file_in_memory, ppTexture, file_in_memory->Hash, this);
|
||||
Message("LoadTexture( Cube %p, %p, %#llX): %p\n", file_in_memory, ppTexture, file_in_memory->Hash, this);
|
||||
if (D3D_OK != D3DXCreateCubeTextureFromFileInMemoryEx( D3D9Device, file_in_memory->pData, file_in_memory->Size, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, (IDirect3DCubeTexture9 **) ppTexture))
|
||||
//if (D3D_OK != D3DXCreateCubeTextureFromFileInMemory( D3D9Device, file_in_memory->pData, file_in_memory->Size, (IDirect3DCubeTexture9 **) ppTexture))
|
||||
{
|
||||
@@ -702,7 +954,7 @@ int uMod_TextureClient_DX9::LoadTexture( TextureFileStruct* file_in_memory, uMod
|
||||
if (ret == 0x01000000L) ((uMod_IDirect3DDevice9*)D3D9Device)->SetLastCreatedCubeTexture(NULL); //this texture must no be added twice
|
||||
else ((uMod_IDirect3DDevice9Ex*) D3D9Device)->SetLastCreatedCubeTexture(NULL); //this texture must no be added twice
|
||||
|
||||
Message("LoadTexture( Cube %lu, %#lX): DONE\n", *ppTexture, file_in_memory->Hash);
|
||||
Message("LoadTexture( Cube %p, %#llX): DONE\n", *ppTexture, file_in_memory->Hash);
|
||||
return (RETURN_OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,20 +44,74 @@ public:
|
||||
uMod_TextureClient_DX9( IDirect3DDevice9* device, const int version);
|
||||
virtual ~uMod_TextureClient_DX9(void);
|
||||
|
||||
int AddTexture( uMod_IDirect3DTexture9* tex); //called from uMod_IDirect3DDevice9::CreateTexture(...) or uMod_IDirect3DDevice9::BeginScene()
|
||||
int AddTexture( uMod_IDirect3DVolumeTexture9* tex); //called from uMod_IDirect3DVolumeTexture9::CreateTexture(...) or uMod_IDirect3DDevice9::BeginScene()
|
||||
int AddTexture( uMod_IDirect3DCubeTexture9* tex); //called from uMod_IDirect3DCubeTexture9::CreateTexture(...) or uMod_IDirect3DDevice9::BeginScene()
|
||||
/**
|
||||
* called from uMod_IDirect3DDevice9::CreateTexture(...) or uMod_IDirect3DDevice9::BeginScene()
|
||||
* @param[in] tex texture to be added
|
||||
* @return
|
||||
*/
|
||||
int AddTexture( uMod_IDirect3DTexture9* tex);
|
||||
|
||||
int RemoveTexture( uMod_IDirect3DTexture9* tex); //called from uMod_IDirect3DTexture9::Release()
|
||||
int RemoveTexture( uMod_IDirect3DVolumeTexture9* tex); //called from uMod_IDirect3DVolumeTexture9::Release()
|
||||
int RemoveTexture( uMod_IDirect3DCubeTexture9* tex); //called from uMod_IDirect3DCubeTexture9::Release()
|
||||
/**
|
||||
* called from uMod_IDirect3DVolumeTexture9::CreateTexture(...) or uMod_IDirect3DDevice9::BeginScene()
|
||||
* @param[in] tex texture to be added
|
||||
* @return
|
||||
*/
|
||||
int AddTexture( uMod_IDirect3DVolumeTexture9* tex);
|
||||
|
||||
/**
|
||||
* called from uMod_IDirect3DCubeTexture9::CreateTexture(...) or uMod_IDirect3DDevice9::BeginScene()
|
||||
* @param[in] tex texture to be added
|
||||
* @return
|
||||
*/
|
||||
int AddTexture( uMod_IDirect3DCubeTexture9* tex);
|
||||
|
||||
/**
|
||||
* called from uMod_IDirect3DTexture9::Release()
|
||||
* @param[in] tex
|
||||
* @return
|
||||
*/
|
||||
int RemoveTexture( uMod_IDirect3DTexture9* tex);
|
||||
|
||||
/**
|
||||
* called from uMod_IDirect3DVolumeTexture9::Release()
|
||||
* @param[in] tex
|
||||
* @return
|
||||
*/
|
||||
int RemoveTexture( uMod_IDirect3DVolumeTexture9* tex);
|
||||
|
||||
/**
|
||||
* called from uMod_IDirect3DCubeTexture9::Release()
|
||||
* @param[in] tex
|
||||
* @return
|
||||
*/
|
||||
int RemoveTexture( uMod_IDirect3DCubeTexture9* tex);
|
||||
|
||||
int SaveAllTextures(bool val); //called from the Server
|
||||
int SaveSingleTexture(bool val); //called from the Server
|
||||
|
||||
int SaveTexture(uMod_IDirect3DTexture9* pTexture); //called from uMod_IDirect3DDevice9::BeginScene() (save button) or from AddTexture(...) (SaveAllTextures)
|
||||
int SaveTexture(uMod_IDirect3DVolumeTexture9* pTexture); //called from uMod_IDirect3DDevice9::BeginScene() (save button) or from AddTexture(...) (SaveAllTextures)
|
||||
int SaveTexture(uMod_IDirect3DCubeTexture9* pTexture); //called from uMod_IDirect3DDevice9::BeginScene() (save button) or from AddTexture(...) (SaveAllTextures)
|
||||
/**
|
||||
* called from uMod_IDirect3DDevice9::BeginScene() (save button) or from AddTexture(...) (SaveAllTextures)
|
||||
* @param[in] pTexture
|
||||
* @param[in] save_all true if called from AddTexture(...) -> (SaveAllTextures is true)
|
||||
* @return
|
||||
*/
|
||||
int SaveTexture(uMod_IDirect3DTexture9* pTexture, bool save_all=false); //
|
||||
|
||||
/**
|
||||
* called from uMod_IDirect3DDevice9::BeginScene() (save button) or from AddTexture(...) (SaveAllTextures)
|
||||
* @param[in] pTexture
|
||||
* @param[in] save_all true if called from AddTexture(...) -> (SaveAllTextures is true)
|
||||
* @return
|
||||
*/
|
||||
int SaveTexture(uMod_IDirect3DVolumeTexture9* pTexture, bool save_all=false);
|
||||
|
||||
/**
|
||||
* called from uMod_IDirect3DDevice9::BeginScene() (save button) or from AddTexture(...) (SaveAllTextures)
|
||||
* @param[in] pTexture
|
||||
* @param[in] save_all true if called from AddTexture(...) -> (SaveAllTextures is true)
|
||||
* @return
|
||||
*/
|
||||
int SaveTexture(uMod_IDirect3DCubeTexture9* pTexture, bool save_all=false);
|
||||
|
||||
int MergeUpdate(void); //called from uMod_IDirect3DDevice9::BeginScene()
|
||||
|
||||
@@ -85,6 +139,22 @@ public:
|
||||
private:
|
||||
IDirect3DDevice9* D3D9Device;
|
||||
|
||||
|
||||
/**
|
||||
* Save the texture into a file (reagrding the various file formats.
|
||||
* @param[in] pTexture
|
||||
* @param[inout] file name without trailing format extension
|
||||
* @return
|
||||
*/
|
||||
int SaveTexture(IDirect3DBaseTexture9* pTexture, wchar_t *file);
|
||||
|
||||
/**
|
||||
* Return true if this texture has the right format to pass the FormatFilter and thus it is saved
|
||||
* @param format
|
||||
* @return
|
||||
*/
|
||||
bool SaveTextureFilterFormat(D3DFORMAT format);
|
||||
|
||||
int LoadTexture( TextureFileStruct* file_in_memory, uMod_IDirect3DTexture9 **ppTexture); // called if a target texture is found
|
||||
int LoadTexture( TextureFileStruct* file_in_memory, uMod_IDirect3DVolumeTexture9 **ppTexture); // called if a target texture is found
|
||||
int LoadTexture( TextureFileStruct* file_in_memory, uMod_IDirect3DCubeTexture9 **ppTexture); // called if a target texture is found
|
||||
|
||||
+49
-17
@@ -19,9 +19,9 @@ endif
|
||||
ifdef NI
|
||||
|
||||
ifdef LOG_MESSAGE
|
||||
precompiler_flag = /D "LOG_MESSAGE" /D "NO_INJECTION"
|
||||
precompiler_flag = /D "LOG_MESSAGE" /D "INJECTION_METHOD=3"
|
||||
else
|
||||
precompiler_flag = /D "NO_INJECTION"
|
||||
precompiler_flag = /D "INJECTION_METHOD=3"
|
||||
endif
|
||||
|
||||
def_file = /DEF:"uMod_DX$(DX_XX_File)_dll_NO_INJECTION.def"
|
||||
@@ -32,9 +32,9 @@ else
|
||||
|
||||
ifdef DI
|
||||
ifdef LOG_MESSAGE
|
||||
precompiler_flag = /D "LOG_MESSAGE" /D "DIRECT_INJECTION"
|
||||
precompiler_flag = /D "LOG_MESSAGE" /D "INJECTION_METHOD=2"
|
||||
else
|
||||
precompiler_flag = /D "DIRECT_INJECTION"
|
||||
precompiler_flag = /D "INJECTION_METHOD=2"
|
||||
endif
|
||||
|
||||
def_file = /DEF:"uMod_DX$(DX_XX_File)_dll_DIRECT_INJECTION.def"
|
||||
@@ -44,9 +44,9 @@ dll = uMod_d3d$(DX_XX_File)_DI.dll
|
||||
else
|
||||
|
||||
ifdef LOG_MESSAGE
|
||||
precompiler_flag = /D "LOG_MESSAGE" /D "HOOK_INJECTION"
|
||||
precompiler_flag = /D "LOG_MESSAGE" /D "INJECTION_METHOD=1"
|
||||
else
|
||||
precompiler_flag = /D "HOOK_INJECTION"
|
||||
precompiler_flag = /D "INJECTION_METHOD=1"
|
||||
endif
|
||||
|
||||
def_file = /DEF:"uMod_DX$(DX_XX_File)_dll_HOOK_INJECTION.def"
|
||||
@@ -58,11 +58,19 @@ endif
|
||||
|
||||
CXX = cl
|
||||
CLINK = link.exe
|
||||
DEFINES = /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "_WINDLL" /D "_MBCS" $(DX_XX_Flag)
|
||||
DEFINES = /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_WINDLL" /D "_MBCS" /D "_UNICODE" "/D UNICODE" $(DX_XX_Flag)
|
||||
#CFLAGS = /I "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include" /nologo /W3 /WX- /O2 ${DEFINES} ${precompiler_flag} /Gm- /EHsc /MT /GS /fp:precise /Zc:wchar_t
|
||||
CFLAGS = /I "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include" /nologo /W3 /WX- /O2 /Oi /Oy- /GL ${DEFINES} ${precompiler_flag} /Gm- /EHsc /MT /Gy- /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TP /analyze-
|
||||
LFLAGS = /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86" /DLL "Winmm.lib" "d3dx9.lib" "d3dx10.lib" "dxguid.lib" "user32.lib" "Kernel32.lib" ${def_file} /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /TLBID:1 /DYNAMICBASE:NO /NXCOMPAT:NO /MACHINE:X86
|
||||
|
||||
CFLAGS = /I "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include" /nologo /W3 /WX- /O2 /Oi /Oy- /GL \
|
||||
${DEFINES} ${precompiler_flag} /Gm- /EHsc /MT /GS- /Gy- /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TP /analyze-
|
||||
|
||||
LFLAGS = /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86" \
|
||||
/DLL "Winmm.lib" "d3dx9.lib" "d3dx10.lib" "dxguid.lib" "user32.lib" "Kernel32.lib" ${def_file} /MANIFEST:NO \
|
||||
/SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86
|
||||
|
||||
|
||||
#/nologo /W3 /WX- /O2 /Oi /Oy- /GL /D WIN32 /D NDEBUG /D _WINDOWS /D _USRDLL /D D3DSTARTERKIT_EXPORTS /D _WINDLL /D _UNICODE /D UNICODE /Gm- /EHsc /MT /GS- /Gy- /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Release\\" /Fd"Release\vc100.pdb" /Gd /TP /analyze-
|
||||
|
||||
obj = obj
|
||||
bin = bin
|
||||
|
||||
@@ -83,13 +91,13 @@ objects = \
|
||||
${obj}\uMod_IDirect3DVolumeTexture9.${obj_suff} \
|
||||
${obj}\uMod_IDirect3DCubeTexture9.${obj_suff} \
|
||||
\
|
||||
${obj}\uMod_DX10_dll.${obj_suff}
|
||||
#\
|
||||
#${obj}\cpu.obj \
|
||||
#${obj}\disasm.obj \
|
||||
#${obj}\disasm_x86.obj \
|
||||
#${obj}\mhook.obj \
|
||||
#${obj}\misc.obj
|
||||
${obj}\uMod_DX10_dll.${obj_suff} \
|
||||
${obj}\uMod_ID3D10Device.${obj_suff} \
|
||||
${obj}\uMod_ID3D10Device1.${obj_suff} \
|
||||
${obj}\uMod_ID3D10Texture1D.${obj_suff} \
|
||||
${obj}\uMod_ID3D10Texture2D.${obj_suff} \
|
||||
${obj}\uMod_ID3D10Texture3D.${obj_suff} \
|
||||
${obj}\uMod_IDXGISwapChain.${obj_suff}
|
||||
|
||||
|
||||
headers = uMod_Main.h \
|
||||
@@ -110,7 +118,13 @@ DX9_headers = \
|
||||
..\uMod_DX9\uMod_IDirect3DCubeTexture9.h
|
||||
|
||||
DX10_headers = \
|
||||
..\uMod_DX10\uMod_DX10_dll.h
|
||||
..\uMod_DX10\uMod_DX10_dll.h \
|
||||
..\uMod_DX10\uMod_ID3D10Device.h \
|
||||
..\uMod_DX10\uMod_ID3D10Device1.h \
|
||||
..\uMod_DX10\uMod_ID3D10Texture1D.h \
|
||||
..\uMod_DX10\uMod_ID3D10Texture2D.h \
|
||||
..\uMod_DX10\uMod_ID3D10Texture3D.h \
|
||||
..\uMod_DX10\uMod_IDXGISwapChain.h
|
||||
|
||||
${bin}\d3d9.dll: ${objects}
|
||||
${CLINK} ${LFLAGS} ${objects} /OUT:${bin}\${dll}
|
||||
@@ -164,5 +178,23 @@ ${obj}\uMod_IDirect3DCubeTexture9.${obj_suff}: ..\uMod_DX9\uMod_IDirect3DCubeTex
|
||||
${obj}\uMod_DX10_dll.${obj_suff}: ..\uMod_DX10\uMod_DX10_dll.cpp ${headers} ${DX10_headers}
|
||||
${CXX} ${CFLAGS} /c $< /Fo$@
|
||||
|
||||
${obj}\uMod_ID3D10Device.${obj_suff}: ..\uMod_DX10\uMod_ID3D10Device.cpp ${headers} ${DX10_headers}
|
||||
${CXX} ${CFLAGS} /c $< /Fo$@
|
||||
|
||||
${obj}\uMod_ID3D10Device1.${obj_suff}: ..\uMod_DX10\uMod_ID3D10Device1.cpp ${headers} ${DX10_headers} ..\uMod_DX10\uMod_ID3D10Device.cpp
|
||||
${CXX} ${CFLAGS} /c $< /Fo$@
|
||||
|
||||
${obj}\uMod_ID3D10Texture1D.${obj_suff}: ..\uMod_DX10\uMod_ID3D10Texture1D.cpp ${headers} ${DX10_headers}
|
||||
${CXX} ${CFLAGS} /c $< /Fo$@
|
||||
|
||||
${obj}\uMod_ID3D10Texture2D.${obj_suff}: ..\uMod_DX10\uMod_ID3D10Texture2D.cpp ${headers} ${DX10_headers}
|
||||
${CXX} ${CFLAGS} /c $< /Fo$@
|
||||
|
||||
${obj}\uMod_ID3D10Texture3D.${obj_suff}: ..\uMod_DX10\uMod_ID3D10Texture3D.cpp ${headers} ${DX10_headers}
|
||||
${CXX} ${CFLAGS} /c $< /Fo$@
|
||||
|
||||
${obj}\uMod_IDXGISwapChain.${obj_suff}: ..\uMod_DX10\uMod_IDXGISwapChain.cpp ${headers} ${DX10_headers}
|
||||
${CXX} ${CFLAGS} /c $< /Fo$@
|
||||
|
||||
clean:
|
||||
del ${objects} ${bin}\${dll}
|
||||
+159
-76
@@ -1,117 +1,200 @@
|
||||
!IFDEF NI
|
||||
|
||||
!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"
|
||||
!ifdef DX10
|
||||
!ifdef DX9
|
||||
DX_XX_Flag = /D DEF_USE_DX9 /D DEF_USE_DX10
|
||||
DX_XX_File = 9_10
|
||||
!else
|
||||
DX_XX_Flag = /D DEF_USE_DX10
|
||||
DX_XX_File = 10
|
||||
!endif
|
||||
|
||||
!else
|
||||
DX_XX_Flag = /D DEF_USE_DX9
|
||||
DX_XX_File = 9
|
||||
!endif
|
||||
|
||||
|
||||
|
||||
!ifdef NI
|
||||
|
||||
!ifdef LOG_MESSAGE
|
||||
precompiler_flag = /D "LOG_MESSAGE" /D "INJECTION_METHOD=3"
|
||||
!else
|
||||
precompiler_flag = /D "INJECTION_METHOD=3"
|
||||
!endif
|
||||
|
||||
def_file = /DEF:"uMod_DX$(DX_XX_File)_dll_NO_INJECTION.def"
|
||||
obj_suff = NI.obj
|
||||
dll = d3d9.dll
|
||||
dll = d3d$(DX_XX_File).dll
|
||||
|
||||
!ELSE
|
||||
!else
|
||||
|
||||
!IFDEF DI
|
||||
!IFDEF LOG_MESSAGE
|
||||
precompiler_flag = /D "LOG_MESSAGE" /D "DIRECT_INJECTION"
|
||||
!ELSE
|
||||
precompiler_flag = /D "DIRECT_INJECTION"
|
||||
!ENDIF
|
||||
!ifdef DI
|
||||
!ifdef LOG_MESSAGE
|
||||
precompiler_flag = /D "LOG_MESSAGE" /D "INJECTION_METHOD=2"
|
||||
!else
|
||||
precompiler_flag = /D "INJECTION_METHOD=2"
|
||||
!endif
|
||||
|
||||
def_file = /DEF:"uMod_DX9_dll_DIRECT_INJECTION.def"
|
||||
def_file = /DEF:"uMod_DX$(DX_XX_File)_dll_DIRECT_INJECTION.def"
|
||||
obj_suff = DI.obj
|
||||
dll = uMod_d3d9_DI.dll
|
||||
dll = uMod_d3d$(DX_XX_File)_DI.dll
|
||||
|
||||
!ELSE
|
||||
!else
|
||||
|
||||
!IFDEF LOG_MESSAGE
|
||||
precompiler_flag = /D "LOG_MESSAGE" /D "HOOK_INJECTION"
|
||||
!ELSE
|
||||
precompiler_flag = /D "HOOK_INJECTION"
|
||||
!ENDIF
|
||||
!ifdef LOG_MESSAGE
|
||||
precompiler_flag = /D "LOG_MESSAGE" /D "INJECTION_METHOD=1"
|
||||
!else
|
||||
precompiler_flag = /D "INJECTION_METHOD=1"
|
||||
!endif
|
||||
|
||||
def_file = /DEF:"uMod_DX9_dll_HOOK_INJECTION.def"
|
||||
def_file = /DEF:"uMod_DX$(DX_XX_File)_dll_HOOK_INJECTION.def"
|
||||
obj_suff = HI.obj
|
||||
dll = uMod_d3d9_HI.dll
|
||||
|
||||
!ENDIF
|
||||
dll = uMod_d3d$(DX_XX_File)_HI.dll
|
||||
!endif
|
||||
!endif
|
||||
|
||||
|
||||
CXX = cl
|
||||
CLINK = link.exe
|
||||
DEFINES = /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "_WINDLL" /D "_MBCS"
|
||||
CFLAGS = /I "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include" /nologo /W3 /WX- /O2 $(DEFINES) $(precompiler_flag) /Gm- /EHsc /MT /GS /fp:precise /Zc:wchar_t
|
||||
LFLAGS = /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86" /DLL "Winmm.lib" "d3dx9.lib" "dxguid.lib" "user32.lib" "Kernel32.lib" $(def_file) /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /TLBID:1 /DYNAMICBASE:NO /NXCOMPAT:NO /MACHINE:X86
|
||||
DEFINES = /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_WINDLL" /D "_MBCS" /D "_UNICODE" "/D UNICODE" $(DX_XX_Flag)
|
||||
#CFLAGS = /I "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include" /nologo /W3 /WX- /O2 $(DEFINES) $(precompiler_flag) /Gm- /EHsc /MT /GS /fp:precise /Zc:wchar_t
|
||||
|
||||
CFLAGS = /I "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include" /nologo /W3 /WX- /O2 /Oi /Oy- /GL \
|
||||
$(DEFINES) $(precompiler_flag) /Gm- /EHsc /MT /GS- /Gy- /fp:precise /Zc:wchar_t /Zc:forScope /Gd /TP /analyze-
|
||||
|
||||
LFLAGS = /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86" \
|
||||
/DLL "Winmm.lib" "d3dx9.lib" "d3dx10.lib" "dxguid.lib" "user32.lib" "Kernel32.lib" $(def_file) /MANIFEST:NO \
|
||||
/SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86
|
||||
|
||||
|
||||
#/nologo /W3 /WX- /O2 /Oi /Oy- /GL /D WIN32 /D NDEBUG /D _WINDOWS /D _USRDLL /D D3DSTARTERKIT_EXPORTS /D _WINDLL /D _UNICODE /D UNICODE /Gm- /EHsc /MT /GS- /Gy- /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Release\\" /Fd"Release\vc100.pdb" /Gd /TP /analyze-
|
||||
|
||||
obj = obj
|
||||
bin = bin
|
||||
|
||||
objects = $(obj)\uMod_DX9_dll.$(obj_suff) \
|
||||
objects = \
|
||||
$(obj)\uMod_TextureFunction.$(DX_XX_File).$(obj_suff) \
|
||||
$(obj)\uMod_ArrayHandler.$(DX_XX_File).$(obj_suff) \
|
||||
$(obj)\uMod_TextureClient.$(DX_XX_File).$(obj_suff) \
|
||||
$(obj)\uMod_TextureServer.$(DX_XX_File).$(obj_suff) \
|
||||
$(obj)\uMod_DXMain_dll.$(DX_XX_File).$(obj_suff) \
|
||||
\
|
||||
$(obj)\uMod_DX9_dll.$(obj_suff) \
|
||||
$(obj)\uMod_TextureClient_DX9.$(obj_suff) \
|
||||
$(obj)\uMod_IDirect3D9.$(obj_suff) \
|
||||
$(obj)\uMod_IDirect3D9Ex.$(obj_suff) \
|
||||
$(obj)\uMod_IDirect3DDevice9.$(obj_suff) \
|
||||
$(obj)\uMod_IDirect3DDevice9Ex.$(obj_suff) \
|
||||
$(obj)\uMod_TextureFunction.$(obj_suff) \
|
||||
$(obj)\uMod_IDirect3DTexture9.$(obj_suff) \
|
||||
$(obj)\uMod_IDirect3DVolumeTexture9.$(obj_suff) \
|
||||
$(obj)\uMod_IDirect3DCubeTexture9.$(obj_suff) \
|
||||
$(obj)\uMod_ArrayHandler.$(obj_suff) \
|
||||
$(obj)\uMod_TextureClient.$(obj_suff) \
|
||||
$(obj)\uMod_TextureServer.$(obj_suff)
|
||||
\
|
||||
$(obj)\uMod_DX10_dll.$(obj_suff) \
|
||||
$(obj)\uMod_ID3D10Device.$(obj_suff) \
|
||||
$(obj)\uMod_ID3D10Device1.$(obj_suff) \
|
||||
$(obj)\uMod_ID3D10Texture1D.$(obj_suff) \
|
||||
$(obj)\uMod_ID3D10Texture2D.$(obj_suff) \
|
||||
$(obj)\uMod_ID3D10Texture3D.$(obj_suff) \
|
||||
$(obj)\uMod_IDXGISwapChain.$(obj_suff)
|
||||
|
||||
|
||||
headers = uMod_Main.h \
|
||||
uMod_DXMain_dll.h \
|
||||
uMod_Defines.h \
|
||||
uMod_DX9_dll.h \
|
||||
uMod_IDirect3D9.h \
|
||||
uMod_IDirect3DDevice9.h \
|
||||
uMod_TextureFunction.h \
|
||||
uMod_IDirect3DTexture9.h \
|
||||
uMod_IDirect3DVolumeTexture9.h \
|
||||
uMod_IDirect3DCubeTexture9.h \
|
||||
uMod_ArrayHandler.h \
|
||||
uMod_TextureClient.h \
|
||||
uMod_TextureServer.h
|
||||
|
||||
DX9_headers = \
|
||||
..\uMod_DX9\uMod_DX9_dll.h \
|
||||
..\uMod_DX9\uMod_TextureClient_DX9.h \
|
||||
..\uMod_DX9\uMod_IDirect3D9.h \
|
||||
..\uMod_DX9\uMod_IDirect3DDevice9.h \
|
||||
..\uMod_DX9\uMod_IDirect3DTexture9.h \
|
||||
..\uMod_DX9\uMod_IDirect3DVolumeTexture9.h \
|
||||
..\uMod_DX9\uMod_IDirect3DCubeTexture9.h
|
||||
|
||||
DX10_headers = \
|
||||
..\uMod_DX10\uMod_DX10_dll.h \
|
||||
..\uMod_DX10\uMod_ID3D10Device.h \
|
||||
..\uMod_DX10\uMod_ID3D10Device1.h \
|
||||
..\uMod_DX10\uMod_ID3D10Texture1D.h \
|
||||
..\uMod_DX10\uMod_ID3D10Texture2D.h \
|
||||
..\uMod_DX10\uMod_ID3D10Texture3D.h \
|
||||
..\uMod_DX10\uMod_IDXGISwapChain.h
|
||||
|
||||
$(bin)\d3d9.dll: $(objects)
|
||||
$(CLINK) $(LFLAGS) $(objects) /OUT:$(bin)\$(dll)
|
||||
copy $(bin)\$(dll) ..\uMod_GUI\bin\$(dll)
|
||||
|
||||
$(obj)\uMod_DX9_dll.$(obj_suff): uMod_DX9_dll.cpp $(headers)
|
||||
$(CXX) $(CFLAGS) /c /Fo$@ uMod_DX9_dll.cpp
|
||||
|
||||
$(obj)\uMod_IDirect3D9.$(obj_suff): uMod_IDirect3D9.cpp $(headers)
|
||||
$(CXX) $(CFLAGS) /c /Fo$@ uMod_IDirect3D9.cpp
|
||||
|
||||
$(obj)\uMod_IDirect3D9Ex.$(obj_suff): uMod_IDirect3D9Ex.cpp $(headers)
|
||||
$(CXX) $(CFLAGS) /c /Fo$@ uMod_IDirect3D9Ex.cpp
|
||||
|
||||
$(obj)\uMod_IDirect3DDevice9.$(obj_suff): uMod_IDirect3DDevice9.cpp $(headers)
|
||||
$(CXX) $(CFLAGS) /c /Fo$@ uMod_IDirect3DDevice9.cpp
|
||||
|
||||
$(obj)\uMod_IDirect3DDevice9Ex.$(obj_suff): uMod_IDirect3DDevice9Ex.cpp $(headers)
|
||||
$(CXX) $(CFLAGS) /c /Fo$@ uMod_IDirect3DDevice9Ex.cpp
|
||||
|
||||
$(obj)\uMod_TextureFunction.$(obj_suff): uMod_TextureFunction.cpp $(headers)
|
||||
$(CXX) $(CFLAGS) /c /Fo$@ uMod_TextureFunction.cpp
|
||||
|
||||
$(obj)\uMod_IDirect3DTexture9.$(obj_suff): uMod_IDirect3DTexture9.cpp $(headers)
|
||||
$(CXX) $(CFLAGS) /c /Fo$@ uMod_IDirect3DTexture9.cpp
|
||||
|
||||
$(obj)\uMod_IDirect3DVolumeTexture9.$(obj_suff): uMod_IDirect3DVolumeTexture9.cpp $(headers)
|
||||
$(CXX) $(CFLAGS) /c /Fo$@ uMod_IDirect3DVolumeTexture9.cpp
|
||||
|
||||
$(obj)\uMod_IDirect3DCubeTexture9.$(obj_suff): uMod_IDirect3DCubeTexture9.cpp $(headers)
|
||||
$(CXX) $(CFLAGS) /c /Fo$@ uMod_IDirect3DCubeTexture9.cpp
|
||||
|
||||
$(obj)\uMod_ArrayHandler.$(obj_suff): uMod_ArrayHandler.cpp $(headers)
|
||||
$(CXX) $(CFLAGS) /c /Fo$@ uMod_ArrayHandler.cpp
|
||||
|
||||
$(obj)\uMod_TextureClient.$(obj_suff): uMod_TextureClient.cpp $(headers)
|
||||
$(CXX) $(CFLAGS) /c /Fo$@ uMod_TextureClient.cpp
|
||||
|
||||
$(obj)\uMod_TextureServer.$(obj_suff): uMod_TextureServer.cpp $(headers)
|
||||
$(CXX) $(CFLAGS) /c /Fo$@ uMod_TextureServer.cpp
|
||||
|
||||
$(obj)\uMod_DXMain_dll.$(DX_XX_File).$(obj_suff): uMod_DXMain_dll.cpp $(headers)
|
||||
$(CXX) $(CFLAGS) /c uMod_DXMain_dll.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_ArrayHandler.$(DX_XX_File).$(obj_suff): uMod_ArrayHandler.cpp $(headers)
|
||||
$(CXX) $(CFLAGS) /c uMod_ArrayHandler.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_TextureClient.$(DX_XX_File).$(obj_suff): uMod_TextureClient.cpp $(headers)
|
||||
$(CXX) $(CFLAGS) /c uMod_TextureClient.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_TextureServer.$(DX_XX_File).$(obj_suff): uMod_TextureServer.cpp $(headers)
|
||||
$(CXX) $(CFLAGS) /c uMod_TextureServer.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_TextureFunction.$(DX_XX_File).$(obj_suff): uMod_TextureFunction.cpp $(headers) $(DX9_headers)
|
||||
$(CXX) $(CFLAGS) /c uMod_TextureFunction.cpp /Fo$@
|
||||
|
||||
|
||||
$(obj)\uMod_DX9_dll.$(obj_suff): ..\uMod_DX9\uMod_DX9_dll.cpp $(headers) $(DX9_headers)
|
||||
$(CXX) $(CFLAGS) /c ..\uMod_DX9\uMod_DX9_dll.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_TextureClient_DX9.$(obj_suff): ..\uMod_DX9\uMod_TextureClient_DX9.cpp $(headers) $(DX9_headers)
|
||||
$(CXX) $(CFLAGS) /c ..\uMod_DX9\uMod_TextureClient_DX9.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_IDirect3D9.$(obj_suff): ..\uMod_DX9\uMod_IDirect3D9.cpp $(headers) $(DX9_headers)
|
||||
$(CXX) $(CFLAGS) /c ..\uMod_DX9\uMod_IDirect3D9.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_IDirect3D9Ex.$(obj_suff): ..\uMod_DX9\uMod_IDirect3D9Ex.cpp $(headers) $(DX9_headers)
|
||||
$(CXX) $(CFLAGS) /c ..\uMod_DX9\uMod_IDirect3D9Ex.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_IDirect3DDevice9.$(obj_suff): ..\uMod_DX9\uMod_IDirect3DDevice9.cpp $(headers) $(DX9_headers)
|
||||
$(CXX) $(CFLAGS) /c ..\uMod_DX9\uMod_IDirect3DDevice9.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_IDirect3DDevice9Ex.$(obj_suff): ..\uMod_DX9\uMod_IDirect3DDevice9Ex.cpp $(headers) $(DX9_headers)
|
||||
$(CXX) $(CFLAGS) /c ..\uMod_DX9\uMod_IDirect3DDevice9Ex.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_IDirect3DTexture9.$(obj_suff): ..\uMod_DX9\uMod_IDirect3DTexture9.cpp $(headers) $(DX9_headers)
|
||||
$(CXX) $(CFLAGS) /c ..\uMod_DX9\uMod_IDirect3DTexture9.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_IDirect3DVolumeTexture9.$(obj_suff): ..\uMod_DX9\uMod_IDirect3DVolumeTexture9.cpp $(headers) $(DX9_headers)
|
||||
$(CXX) $(CFLAGS) /c ..\uMod_DX9\uMod_IDirect3DVolumeTexture9.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_IDirect3DCubeTexture9.$(obj_suff): ..\uMod_DX9\uMod_IDirect3DCubeTexture9.cpp $(headers)
|
||||
$(CXX) $(CFLAGS) /c ..\uMod_DX9\uMod_IDirect3DCubeTexture9.cpp /Fo$@
|
||||
|
||||
|
||||
$(obj)\uMod_DX10_dll.$(obj_suff): ..\uMod_DX10\uMod_DX10_dll.cpp $(headers) $(DX10_headers)
|
||||
$(CXX) $(CFLAGS) /c ..\uMod_DX10\uMod_DX10_dll.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_ID3D10Device.$(obj_suff): ..\uMod_DX10\uMod_ID3D10Device.cpp $(headers) $(DX10_headers)
|
||||
$(CXX) $(CFLAGS) /c ..\uMod_DX10\uMod_ID3D10Device.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_ID3D10Device1.$(obj_suff): ..\uMod_DX10\uMod_ID3D10Device1.cpp $(headers) $(DX10_headers) ..\uMod_DX10\uMod_ID3D10Device.cpp
|
||||
$(CXX) $(CFLAGS) /c ..\uMod_DX10\uMod_ID3D10Device1.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_ID3D10Texture1D.$(obj_suff): ..\uMod_DX10\uMod_ID3D10Texture1D.cpp $(headers) $(DX10_headers)
|
||||
$(CXX) $(CFLAGS) /c ..\uMod_DX10\uMod_ID3D10Texture1D.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_ID3D10Texture2D.$(obj_suff): ..\uMod_DX10\uMod_ID3D10Texture2D.cpp $(headers) $(DX10_headers)
|
||||
$(CXX) $(CFLAGS) /c ..\uMod_DX10\uMod_ID3D10Texture2D.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_ID3D10Texture3D.$(obj_suff): ..\uMod_DX10\uMod_ID3D10Texture3D.cpp $(headers) $(DX10_headers)
|
||||
$(CXX) $(CFLAGS) /c ..\uMod_DX10\uMod_ID3D10Texture3D.cpp /Fo$@
|
||||
|
||||
$(obj)\uMod_IDXGISwapChain.$(obj_suff): ..\uMod_DX10\uMod_IDXGISwapChain.cpp $(headers) $(DX10_headers)
|
||||
$(CXX) $(CFLAGS) /c ..\uMod_DX10\uMod_IDXGISwapChain.cpp /Fo$@
|
||||
|
||||
clean:
|
||||
del $(objects) $(bin)\$(dll)
|
||||
@@ -23,61 +23,66 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
#include "..\uMod_GlobalDefines.h"
|
||||
|
||||
|
||||
/**
|
||||
* On entry hold the pointer to the fake texture data (file content)
|
||||
* and the pointer to all game texture which are replaced by this texture.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
bool ForceReload; // to force a reload of the texture (if it is already modded)
|
||||
char* pData; // store texture file as file in memory
|
||||
unsigned int Size; // size of file
|
||||
int NumberOfTextures;
|
||||
int Reference; // for a fast delete in the FileHandler
|
||||
void **Textures; // pointer to the fake textures
|
||||
MyTypeHash Hash; // hash value
|
||||
bool ForceReload; //!< to force a reload of the texture (only important, if it is already modded)
|
||||
char* pData; //!< store texture file as file in memory
|
||||
unsigned int Size; //!< size of file (\a pData)
|
||||
int NumberOfTextures; //!< Number of textures loaded by the game, which match the hash and thus are switched
|
||||
int Reference; //!< for a fast delete in the FileHandler
|
||||
void **Textures; //!< pointer to all texture loade by the game, which match the hash and thus are switched
|
||||
DWORD64 Hash; //!< hash value
|
||||
} TextureFileStruct;
|
||||
|
||||
/*
|
||||
|
||||
class uMod_FileHandler // array to store TextureFileStruct
|
||||
{
|
||||
public:
|
||||
uMod_FileHandler(void);
|
||||
~uMod_FileHandler(void);
|
||||
|
||||
int Add( TextureFileStruct* file);
|
||||
int Remove( TextureFileStruct* file);
|
||||
|
||||
int GetNumber(void) {return (Number);}
|
||||
|
||||
TextureFileStruct *operator [] (int i) {if (i<0||i>=Number) return (NULL); else return (Files[i/FieldLength][i%FieldLength]);}
|
||||
|
||||
protected:
|
||||
static const int FieldLength = 1024;
|
||||
long Number;
|
||||
int FieldCounter;
|
||||
TextureFileStruct*** Files;
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A simple vector class for pointers. The Object or struct must have a member variable \a int \a Reference.
|
||||
* This class stores the entries in chunks of memory. The address of each chunk is stored in \a Content.
|
||||
*/
|
||||
template <class T>
|
||||
class uMod_TextureHandler // array to store uMod_IDirect3DTexture9, uMod_IDirect3DVolumeTexture9 or uMod_IDirect3DCubeTexture9
|
||||
class uMod_TextureHandler
|
||||
{
|
||||
public:
|
||||
uMod_TextureHandler(void);
|
||||
~uMod_TextureHandler(void);
|
||||
|
||||
int Add( T* texture);
|
||||
int Remove( T* texture);
|
||||
/**
|
||||
* Append an entry at the end of the vector
|
||||
* @param entry
|
||||
* @return RETURN_OK on success
|
||||
*/
|
||||
int Add( T* entry);
|
||||
|
||||
/**
|
||||
* Remove this entry from the vector
|
||||
* @param entry
|
||||
* @return RETURN_OK on success
|
||||
*/
|
||||
int Remove( T* entry);
|
||||
|
||||
/**
|
||||
* Returns the number of entries.
|
||||
* @return
|
||||
*/
|
||||
int GetNumber(void) {return (Number);}
|
||||
T *operator [] (int i) {if (i<0||i>=Number) return (NULL); else return (Textures[i/FieldLength][i%FieldLength]);}
|
||||
|
||||
/**
|
||||
* Return the pointer to the \a i the object
|
||||
* @param i index
|
||||
* @return
|
||||
*/
|
||||
T *operator [] (int i) {if (i<0||i>=Number) return (NULL); else return (Content[i/FieldLength][i%FieldLength]);}
|
||||
|
||||
private:
|
||||
static const int FieldLength = 1024;
|
||||
long Number;
|
||||
int FieldCounter;
|
||||
T*** Textures;
|
||||
static const int FieldLength = 1024; //!< size of one chunk of memory
|
||||
long Number; //!< Number of entries.
|
||||
int FieldCounter; //!< Number of allocated chunks.
|
||||
T*** Content;//!< vector of pointers, which point to the chunks
|
||||
};
|
||||
|
||||
|
||||
@@ -100,27 +105,27 @@ uMod_TextureHandler<T>::uMod_TextureHandler(void)
|
||||
Number = 0;
|
||||
FieldCounter = 0;
|
||||
|
||||
Textures = NULL;
|
||||
Content = NULL;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
uMod_TextureHandler<T>::~uMod_TextureHandler(void)
|
||||
{
|
||||
Message("~uMod_TextureHandler(void): %lu\n", this);
|
||||
if (Textures!=NULL)
|
||||
if (Content!=NULL)
|
||||
{
|
||||
for (int i=0; i<FieldCounter; i++) if (Textures[i] != NULL) delete [] Textures[i];
|
||||
delete [] Textures;
|
||||
for (int i=0; i<FieldCounter; i++) if (Content[i] != NULL) delete [] Content[i];
|
||||
delete [] Content;
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
int uMod_TextureHandler<T>::Add(T* pTexture)
|
||||
int uMod_TextureHandler<T>::Add(T* entry)
|
||||
{
|
||||
Message("uMod_TextureHandler::Add( %lu): %lu\n", pTexture, this);
|
||||
Message("uMod_TextureHandler::Add( %lu): %lu\n", entry, this);
|
||||
if (gl_ErrorState & uMod_ERROR_FATAL) return (RETURN_FATAL_ERROR);
|
||||
|
||||
if (pTexture->Reference>=0) return (RETURN_TEXTURE_ALLREADY_ADDED);
|
||||
if (entry->Reference>=0) return (RETURN_TEXTURE_ALLREADY_ADDED);
|
||||
|
||||
if (Number/FieldLength==FieldCounter)
|
||||
{
|
||||
@@ -132,50 +137,50 @@ int uMod_TextureHandler<T>::Add(T* pTexture)
|
||||
return (RETURN_NO_MEMORY);
|
||||
}
|
||||
|
||||
for (int i=0; i<FieldCounter; i++) temp[i] = Textures[i];
|
||||
for (int i=0; i<FieldCounter; i++) temp[i] = Content[i];
|
||||
|
||||
for (int i=FieldCounter; i<FieldCounter+10; i++) temp[i] = NULL;
|
||||
|
||||
FieldCounter += 10;
|
||||
|
||||
if (Textures!=NULL) delete [] Textures;
|
||||
if (Content!=NULL) delete [] Content;
|
||||
|
||||
Textures = temp;
|
||||
Content = temp;
|
||||
}
|
||||
if (Number%FieldLength==0)
|
||||
{
|
||||
try {if (Textures[Number/FieldLength]==NULL) Textures[Number/FieldLength] = new T*[FieldLength];}
|
||||
try {if (Content[Number/FieldLength]==NULL) Content[Number/FieldLength] = new T*[FieldLength];}
|
||||
catch (...)
|
||||
{
|
||||
Textures[Number/FieldLength]=NULL;
|
||||
Content[Number/FieldLength]=NULL;
|
||||
gl_ErrorState |= uMod_ERROR_MEMORY | uMod_ERROR_TEXTURE;
|
||||
return (RETURN_NO_MEMORY);
|
||||
}
|
||||
}
|
||||
|
||||
Textures[Number/FieldLength][Number%FieldLength] = pTexture;
|
||||
pTexture->Reference = Number++;
|
||||
Content[Number/FieldLength][Number%FieldLength] = entry;
|
||||
entry->Reference = Number++;
|
||||
|
||||
return (RETURN_OK);
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
int uMod_TextureHandler<T>::Remove(T* pTexture) //will be called, if a texture is completely released
|
||||
int uMod_TextureHandler<T>::Remove(T* entry) //will be called, if a texture is completely released
|
||||
{
|
||||
Message("uMod_TextureHandler::Remove( %lu): %lu\n", pTexture, this);
|
||||
Message("uMod_TextureHandler::Remove( %lu): %lu\n", entry, this);
|
||||
if (gl_ErrorState & uMod_ERROR_FATAL) return (RETURN_FATAL_ERROR);
|
||||
|
||||
int ref = pTexture->Reference;
|
||||
int ref = entry->Reference;
|
||||
if (ref<0|| ref>=Number) return (RETURN_OK); // it is not in this list
|
||||
if (Textures[ref/FieldLength][ref%FieldLength]!=pTexture) return (RETURN_OK); // it is not in this list
|
||||
if (Content[ref/FieldLength][ref%FieldLength]!=entry) return (RETURN_OK); // it is not in this list
|
||||
|
||||
if (ref<(--Number))
|
||||
{
|
||||
Textures[ref/FieldLength][ref%FieldLength] = Textures[Number/FieldLength][Number%FieldLength];
|
||||
Textures[ref/FieldLength][ref%FieldLength]->Reference = ref;
|
||||
Content[ref/FieldLength][ref%FieldLength] = Content[Number/FieldLength][Number%FieldLength];
|
||||
Content[ref/FieldLength][ref%FieldLength]->Reference = ref;
|
||||
}
|
||||
pTexture->Reference = -1;
|
||||
entry->Reference = -1;
|
||||
return (RETURN_OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
LIBRARY "uMod_d3d10_DI"
|
||||
EXPORTS
|
||||
uMod_D3D10CreateDeviceAndSwapChain @1
|
||||
uMod_D3D10CreateDeviceAndSwapChain1 @2
|
||||
Nothing @3
|
||||
@@ -24,16 +24,13 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
*/
|
||||
|
||||
#ifdef __CDT_PARSER__
|
||||
#define INJECTION_METHOD 0
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#include "uMod_Main.h"
|
||||
|
||||
//#include "detours.h"
|
||||
//#include "detourxs/detourxs/detourxs.h"
|
||||
|
||||
/*
|
||||
#include "detourxs/detourxs/ADE32.cpp"
|
||||
#include "detourxs/detourxs/detourxs.cpp"
|
||||
*/
|
||||
/*
|
||||
* global variable which are not linked external
|
||||
*/
|
||||
@@ -52,10 +49,11 @@ unsigned int gl_ErrorState = 0u;
|
||||
FILE* gl_File = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DIRECT_INJECTION
|
||||
#if INJECTION_METHOD == DIRECT_INJECTION
|
||||
void Nothing(void) {(void)NULL;}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* dll entry routine, here we initialize or clean up
|
||||
*/
|
||||
@@ -96,11 +94,11 @@ void InitInstance(HINSTANCE hModule)
|
||||
|
||||
gl_hThisInstance = (HINSTANCE) hModule;
|
||||
|
||||
wchar_t game[MAX_PATH];
|
||||
if (HookThisProgram( game, MAX_PATH)) //ask if we need to hook this program
|
||||
wchar_t game[10*MAX_PATH];
|
||||
if (HookThisProgram( game, 10*MAX_PATH)) //ask if we need to hook this program
|
||||
{
|
||||
OpenMessage();
|
||||
Message("InitInstance: %lu\n", hModule);
|
||||
Message("InitInstance: %lu (%ls)\n", hModule, game);
|
||||
|
||||
gl_TextureServer = new uMod_TextureServer(game); //create the server which listen on the pipe and prepare the update for the texture clients
|
||||
|
||||
@@ -112,7 +110,7 @@ void InitInstance(HINSTANCE hModule)
|
||||
#endif
|
||||
|
||||
|
||||
if (gl_TextureServer->OpenPipe(game)) //open the pipe and send the name+path of this executable
|
||||
if (gl_TextureServer->OpenPipe(game, INJECTION_METHOD)) //open the pipe and send the name+path of this executable
|
||||
{
|
||||
Message("InitInstance: Pipe not opened\n");
|
||||
return;
|
||||
@@ -152,27 +150,35 @@ void ExitInstance()
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool HookThisProgram( wchar_t *ret, const int ret_len)
|
||||
{
|
||||
const unsigned int max_len = ret_len < MAX_PATH ? MAX_PATH : ret_len;
|
||||
const int max_len = ret_len < MAX_PATH ? MAX_PATH : ret_len;
|
||||
wchar_t *Executable = NULL;
|
||||
wchar_t *Game = NULL;
|
||||
if (GetMemory( Executable, max_len))
|
||||
{
|
||||
ret[0]=0;
|
||||
return false;
|
||||
}
|
||||
GetModuleFileNameW( GetModuleHandle( NULL ), Executable, max_len ); //ask for name and path of this executable
|
||||
|
||||
#if INJECTION_METHOD==DIRECT_INJECTION || INJECTION_METHOD==NO_INJECTION
|
||||
// we inject directly
|
||||
int i=0;
|
||||
while (i<max_len && i<ret_len-1 && Executable[i]) {ret[i]=Executable[i]; i++;}
|
||||
ret[i]=0;
|
||||
delete [] Executable;
|
||||
return true;
|
||||
|
||||
#elif INJECTION_METHOD==HOOK_INJECTION
|
||||
//we use the gloabal hook
|
||||
|
||||
wchar_t *Game = NULL;
|
||||
if (GetMemory( Game, max_len))
|
||||
{
|
||||
delete [] Executable;
|
||||
ret[0]=0;
|
||||
return false;
|
||||
}
|
||||
GetModuleFileNameW( GetModuleHandle( NULL ), Executable, max_len ); //ask for name and path of this executable
|
||||
|
||||
#ifdef HOOK_INJECTION
|
||||
//we use the gloabal hook
|
||||
|
||||
FILE* file;
|
||||
wchar_t *app_path = _wgetenv( L"APPDATA"); //asc for the user application directory
|
||||
@@ -186,14 +192,12 @@ bool HookThisProgram( wchar_t *ret, const int ret_len)
|
||||
}
|
||||
swprintf_s( file_name, max_len, L"%ls\\%ls\\%ls", app_path, uMod_APP_DIR, uMod_APP_DX9);
|
||||
if (_wfopen_s( &file, file_name, L"rt,ccs=UTF-16LE")) return (false); // open the file in utf-16 LE mode
|
||||
delete [] file_name;
|
||||
|
||||
|
||||
//MessageBoxW( NULL, Executable, L"test", 0);
|
||||
while (!feof(file))
|
||||
{
|
||||
if ( fgetws( Game, MAX_PATH, file) != NULL ) //get each line of the file
|
||||
{
|
||||
//MessageBoxW( NULL, Game, L"test", 0);
|
||||
int len = 0;
|
||||
while (len<max_len-1 &&Game[len])
|
||||
{
|
||||
@@ -216,54 +220,18 @@ bool HookThisProgram( wchar_t *ret, const int ret_len)
|
||||
fclose(file);
|
||||
return (false);
|
||||
#else
|
||||
// we inject directly
|
||||
int i=0;
|
||||
while (i<max_len && i<ret_len-1 && Game[i]) {ret[i]=Game[i]; i++;}
|
||||
ret[i]=0;
|
||||
delete [] Executable;
|
||||
delete [] Game;
|
||||
return true;
|
||||
#error No injection method was set.
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NO_INJECTION
|
||||
|
||||
|
||||
/*
|
||||
void *DetourFunc(BYTE *src, const BYTE *dst, const int len)
|
||||
{
|
||||
BYTE *jmp = (BYTE*)malloc(len+5);
|
||||
DWORD dwback;
|
||||
VirtualProtect(src, len, PAGE_READWRITE, &dwback);
|
||||
memcpy(jmp, src, len); jmp += len;
|
||||
jmp[0] = 0xE9;
|
||||
*(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;
|
||||
src[0] = 0xE9;
|
||||
*(DWORD*)(src+1) = (DWORD)(dst - src) - 5;
|
||||
VirtualProtect(src, len, dwback, &dwback);
|
||||
return (jmp-len);
|
||||
}
|
||||
void *DetourFunc(BYTE *src, const BYTE *dst, const int len)
|
||||
{
|
||||
BYTE *jmp = (BYTE*)malloc(len+5);
|
||||
DWORD dwback;
|
||||
VirtualProtect(src, len, PAGE_READWRITE, &dwback);
|
||||
memcpy(jmp, src, len); jmp += len;
|
||||
jmp[0] = 0xE9;
|
||||
*(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;
|
||||
src[0] = 0xE9;
|
||||
*(DWORD*)(src+1) = (DWORD)(dst - src) - 5;
|
||||
VirtualProtect(src, len, dwback, &dwback);
|
||||
return (jmp-len);
|
||||
}
|
||||
*/
|
||||
|
||||
#if INJECTION_METHOD==DIRECT_INJECTION || INJECTION_METHOD==HOOK_INJECTION
|
||||
|
||||
void *DetourFunc(BYTE *src, const BYTE *dst, const int len)
|
||||
{
|
||||
BYTE *jmp = (BYTE*)malloc(len+5);
|
||||
DWORD dwback = 0;
|
||||
//VirtualProtect(jmp, len+5, PAGE_EXECUTE_READWRITE, &dwback); //This is the addition needed for Windows 7 RC
|
||||
//(jmp, len+5, PAGE_EXECUTE_READWRITE, &dwback); //This is the addition needed for Windows 7 RC
|
||||
VirtualProtect(src, len, PAGE_READWRITE, &dwback);
|
||||
memcpy(jmp, src, len); jmp += len;
|
||||
jmp[0] = 0xE9;
|
||||
@@ -274,18 +242,7 @@ void *DetourFunc(BYTE *src, const BYTE *dst, const int len)
|
||||
VirtualProtect(src, len, dwback, &dwback);
|
||||
return (jmp-len);
|
||||
}
|
||||
/*
|
||||
bool RetourFunc( BYTE *src, BYTE *restore, const int len )
|
||||
{
|
||||
DWORD dwback;
|
||||
if(!VirtualProtect(src, len, PAGE_READWRITE, &dwback)) { return false; }
|
||||
if(!memcpy(src, restore, len)) { return false; }
|
||||
restore[0] = 0xE9;
|
||||
*(DWORD*)(restore+1) = (DWORD)(src - restore) - 5;
|
||||
if(!VirtualProtect(src, len, dwback, &dwback)) { return false; }
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
bool RetourFunc(BYTE *src, BYTE *restore, const int len)
|
||||
{
|
||||
DWORD dwback;
|
||||
@@ -296,8 +253,10 @@ bool RetourFunc(BYTE *src, BYTE *restore, const int len)
|
||||
if(!VirtualProtect(src, len, dwback, &dwback)) { return (false); }
|
||||
return (true);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HOOK_INJECTION
|
||||
|
||||
#if INJECTION_METHOD==HOOK_INJECTION
|
||||
/*
|
||||
* We do not change something, if our hook function is called.
|
||||
* We need this hook only to get our dll loaded into a starting program.
|
||||
@@ -319,4 +278,4 @@ void RemoveHook(void)
|
||||
UnhookWindowsHookEx( gl_hHook );
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -29,31 +29,77 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
#include "../uMod_DX10/uMod_DX10_dll.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This function is called during the dll load sequence (dll entry)
|
||||
* @param[in] hModule
|
||||
*/
|
||||
void InitInstance(HINSTANCE hModule);
|
||||
|
||||
/**
|
||||
* This function is called, when the dll gets unloaded.
|
||||
*/
|
||||
void ExitInstance(void);
|
||||
|
||||
/**
|
||||
* Returns true if this game shall be injected (DirectX hook). It returns also the name and path of the game executable.
|
||||
* This function always return true, when compiled for "Direct Injection" of for "No Injection".
|
||||
* @param[out] ret buffer where the name and path of the game executable should be stored
|
||||
* @param[in] max_len length of the buffer
|
||||
* @return
|
||||
*/
|
||||
bool HookThisProgram( wchar_t *ret, const int max_len);
|
||||
|
||||
/**
|
||||
* This function is called, when the server thread is created. It only calls the mainloop function of the \a TextureServer.
|
||||
* @param[in] lpParam Pointer to the \a TextureServer.
|
||||
*/
|
||||
DWORD WINAPI ServerThread( LPVOID lpParam);
|
||||
|
||||
|
||||
|
||||
#ifndef NO_INJECTION
|
||||
|
||||
#if INJECTION_METHOD==DIRECT_INJECTION || INJECTION_METHOD==HOOK_INJECTION
|
||||
/**
|
||||
* Detour a function to another function.
|
||||
* @param[in] src pointer to function which shall be detoured
|
||||
* @param[in] dst pointer to function which shall be called instead
|
||||
* @param[in] len number of byte to be stored
|
||||
* @return trampoline = pointer to detoured function
|
||||
*/
|
||||
void *DetourFunc(BYTE *src, const BYTE *dst, const int len);
|
||||
|
||||
/**
|
||||
* Retour the function.
|
||||
* @param src pointer to the detoured function
|
||||
* @param restore trampoline = pointer to the detoured function
|
||||
* @param len number of saved bytes
|
||||
* @return
|
||||
*/
|
||||
bool RetourFunc(BYTE *src, BYTE *restore, const int len);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HOOK_INJECTION
|
||||
#if INJECTION_METHOD==HOOK_INJECTION
|
||||
/**
|
||||
* This function is insert into the hook.
|
||||
*/
|
||||
LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam);
|
||||
/**
|
||||
* This function install the hook, our dll will be loaded into each running process (if we have sufficient permission).
|
||||
*/
|
||||
void InstallHook(void);
|
||||
/**
|
||||
* This function remove the hook, our dll will get unloaded from each process.
|
||||
*/
|
||||
void RemoveHook(void);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DIRECT_INJECTION
|
||||
#if INJECTION_METHOD==DIRECT_INJECTION
|
||||
/**
|
||||
* Dummy function need for the "Direct Injection" mehtod.
|
||||
*/
|
||||
void Nothing(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,15 +26,15 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
extern FILE *gl_File;
|
||||
|
||||
#define Message(...) {if (gl_File!=NULL) {fprintf( gl_File, __VA_ARGS__); fflush(gl_File);}}
|
||||
#ifdef HOOK_INJECTION
|
||||
#if INJECTION_METHOD == HOOK_INJECTION
|
||||
#define OpenMessage(...) {if (fopen_s( &gl_File, "uMod_log.txt", "wt")) gl_File=NULL; else fprintf( gl_File, "HI R40: 0000002\n");}
|
||||
#endif
|
||||
|
||||
#ifdef DIRECT_INJECTION
|
||||
#if INJECTION_METHOD == DIRECT_INJECTION
|
||||
#define OpenMessage(...) {if (fopen_s( &gl_File, "uMod_log.txt", "wt")) gl_File=NULL; else fprintf( gl_File, "DI R40: 0000002\n");}
|
||||
#endif
|
||||
|
||||
#ifdef NO_INJECTION
|
||||
#if INJECTION_METHOD == NO_INJECTION
|
||||
#define OpenMessage(...) {if (fopen_s( &gl_File, "uMod_log.txt", "wt")) gl_File=NULL; else fprintf( gl_File, "NI R40: 0000002\n");}
|
||||
#endif
|
||||
|
||||
@@ -42,8 +42,17 @@ extern FILE *gl_File;
|
||||
|
||||
|
||||
#else
|
||||
/**
|
||||
* Open the file for logging (if LOG_MESSAGE=1 was passed during compilation)
|
||||
*/
|
||||
#define OpenMessage(...)
|
||||
/**
|
||||
* Print a message (like printf) into the file ant flush the content to disk (if LOG_MESSAGE=1 was passed during compilation)
|
||||
*/
|
||||
#define Message(...)
|
||||
/**
|
||||
* Close the file for logging (if LOG_MESSAGE=1 was passed during compilation)
|
||||
*/
|
||||
#define CloseMessage(...)
|
||||
#endif
|
||||
|
||||
|
||||
+15
-13
@@ -50,28 +50,30 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
#include "uMod_Defines.h"
|
||||
#include "uMod_DXMain_dll.h"
|
||||
//#include "uMod_TextureFunction.h"
|
||||
|
||||
/*
|
||||
#include "uMod_IDirect3D9.h"
|
||||
#include "uMod_IDirect3D9Ex.h"
|
||||
|
||||
#include "uMod_IDirect3DDevice9.h"
|
||||
#include "uMod_IDirect3DDevice9Ex.h"
|
||||
|
||||
#include "uMod_IDirect3DCubeTexture9.h"
|
||||
#include "uMod_IDirect3DTexture9.h"
|
||||
#include "uMod_IDirect3DVolumeTexture9.h"
|
||||
*/
|
||||
|
||||
#include "uMod_ArrayHandler.h"
|
||||
#include "uMod_TextureServer.h"
|
||||
#include "uMod_TextureClient.h"
|
||||
|
||||
|
||||
/**
|
||||
* global variable: HINSTANCE
|
||||
*/
|
||||
extern HINSTANCE gl_hThisInstance;
|
||||
|
||||
/**
|
||||
* gloabal variable: pointer to TextureServer
|
||||
*/
|
||||
extern uMod_TextureServer* gl_TextureServer;
|
||||
|
||||
/**
|
||||
* gloabal variable: pointer to the server thread
|
||||
*/
|
||||
extern HANDLE gl_ServerThread;
|
||||
|
||||
/**
|
||||
* gloabal variable: error state. This is not supported at the moment.
|
||||
*/
|
||||
extern unsigned int gl_ErrorState;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,6 +27,9 @@ uMod_TextureClient::uMod_TextureClient(const int version) : Version(version)
|
||||
Server = NULL;
|
||||
BoolSaveAllTextures = false;
|
||||
BoolSaveSingleTexture = false;
|
||||
BoolShowTextureString = false;
|
||||
BoolComputeCRC = false;
|
||||
|
||||
KeyBack = 0;
|
||||
KeySave = 0;
|
||||
KeyNext = 0;
|
||||
@@ -42,6 +45,14 @@ uMod_TextureClient::uMod_TextureClient(const int version) : Version(version)
|
||||
NumberOfUpdate = -1;
|
||||
FontColour = D3DCOLOR_ARGB(255,255,0,0);
|
||||
TextureColour = D3DCOLOR_ARGB(255,0,255,0);
|
||||
|
||||
WidthFilter = 0u;
|
||||
HeightFilter = 0u;
|
||||
DepthFilter = 0u;
|
||||
|
||||
FormatFilter = 0u;
|
||||
|
||||
FileFormat = uMod_D3DXIFF_DDS;
|
||||
}
|
||||
|
||||
uMod_TextureClient::~uMod_TextureClient(void)
|
||||
@@ -135,7 +146,7 @@ int uMod_TextureClient::UnlockMutex(void)
|
||||
}
|
||||
|
||||
|
||||
int uMod_TextureClient::GetIndex( MyTypeHash hash, int num_index_list, int *index_list)
|
||||
int uMod_TextureClient::GetIndex( DWORD64 hash, int num_index_list, int *index_list)
|
||||
{
|
||||
if(NumberToMod>0)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
class uMod_TextureServer;
|
||||
|
||||
/*
|
||||
/**
|
||||
* An object of this class is owned by each d3dXX device.
|
||||
* functions called by the Server are called from the server thread instance.
|
||||
* All other functions are called from the render thread instance of the game itself.
|
||||
@@ -61,6 +61,21 @@ public:
|
||||
*/
|
||||
virtual int SaveSingleTexture(bool val) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Enable/Disable the string in the left upper corner during save single texture mode (called from the mainloop).
|
||||
* @param[in] val
|
||||
* @return
|
||||
*/
|
||||
int ShowTextureString(bool val) {BoolShowTextureString = val; return (RETURN_OK);}
|
||||
|
||||
/**
|
||||
* Enable/Disable the hashing with CRC32, which is needed to support also tpf mods (called from the mainloop).
|
||||
* @param[in] val
|
||||
* @return
|
||||
*/
|
||||
int SupportTPF(bool val) {BoolComputeCRC = val; return (RETURN_OK);}
|
||||
|
||||
/**
|
||||
* Set the directory, wher the texture should be stored (called from the server)
|
||||
* @param dir
|
||||
@@ -96,21 +111,47 @@ public:
|
||||
|
||||
/**
|
||||
* Set the font color "during save single" texture mode. (called from the server)
|
||||
* @param r red value (0..255)
|
||||
* @param g green value (0..255)
|
||||
* @param b blue value (0..255)
|
||||
* @param colour
|
||||
* @return
|
||||
*/
|
||||
int SetFontColour( DWORD r, DWORD g, DWORD b) {FontColour = D3DCOLOR_ARGB(255, r,g,b); return (RETURN_OK);}
|
||||
int SetFontColour( DWORD64 colour) {FontColour = (D3DCOLOR) colour; return (RETURN_OK);}
|
||||
|
||||
/**
|
||||
* Set the texture color "during save single" texture mode. (called from the server)
|
||||
* @param r red value (0..255)
|
||||
* @param g green value (0..255)
|
||||
* @param b blue value (0..255)
|
||||
* @param colour
|
||||
* @return RETURN_OK
|
||||
*/
|
||||
int SetTextureColour( DWORD r, DWORD g, DWORD b) {TextureColour = D3DCOLOR_ARGB(255, r,g,b); return (RETURN_OK);}
|
||||
int SetTextureColour( DWORD64 colour) {TextureColour = (D3DCOLOR) colour; return (RETURN_OK);}
|
||||
|
||||
/**
|
||||
* @param[in] format
|
||||
* @return
|
||||
*/
|
||||
int SetFileFormat(DWORD64 format) {FileFormat = format; return (RETURN_OK);}
|
||||
|
||||
/**
|
||||
* @param[in] format
|
||||
* @return
|
||||
*/
|
||||
int SetFormatFilter(DWORD64 format) {FormatFilter = format; return (RETURN_OK);}
|
||||
|
||||
/**
|
||||
* @param[in] size
|
||||
* @return
|
||||
*/
|
||||
int SetWidthFilter(DWORD64 size) {WidthFilter = size; return (RETURN_OK);}
|
||||
|
||||
/**
|
||||
* @param[in] size
|
||||
* @return
|
||||
*/
|
||||
int SetHeightFilter(DWORD64 size) {HeightFilter = size; return (RETURN_OK);}
|
||||
|
||||
/**
|
||||
* @param[in] size
|
||||
* @return
|
||||
*/
|
||||
int SetDepthFilter(DWORD64 size) {DepthFilter = size; return (RETURN_OK);}
|
||||
|
||||
/**
|
||||
* The server add an update to the client.(called from server)
|
||||
@@ -128,23 +169,32 @@ public:
|
||||
virtual int MergeUpdate(void) = 0;
|
||||
|
||||
|
||||
bool BoolSaveAllTextures; //< true if all textures should be saved
|
||||
bool BoolSaveSingleTexture; //< true if "save single texture" mode is enabled
|
||||
int KeyBack; //< key value for going to the previous texture
|
||||
int KeySave; //< key value for saving the current texture
|
||||
int KeyNext; //< key value for going to the next texture
|
||||
bool BoolSaveAllTextures; //!< true if all textures should be saved
|
||||
bool BoolSaveSingleTexture; //!< true if "save single texture" mode is enabled
|
||||
bool BoolShowTextureString; //!< true if a string should be displayed during "save single texture" mode is enabled
|
||||
bool BoolComputeCRC; //!< if true also the crc32 is calculated, which is need to support tpf
|
||||
|
||||
D3DCOLOR FontColour; //< color of the message ("save single texture" mode)
|
||||
D3DCOLOR TextureColour; //< color of the texture ("save single texture" mode)
|
||||
int KeyBack; //!< key value for going to the previous texture
|
||||
int KeySave; //!< key value for saving the current texture
|
||||
int KeyNext; //!< key value for going to the next texture
|
||||
|
||||
D3DCOLOR FontColour; //!< color of the message ("save single texture" mode)
|
||||
D3DCOLOR TextureColour; //!< color of the texture ("save single texture" mode)
|
||||
|
||||
|
||||
DWORD64 FileFormat; //!< file format to which the texture should be saved
|
||||
DWORD64 FormatFilter; //!< texture format which should be saved (all==0, else bitwise 1=save,0=don't save)
|
||||
DWORD64 WidthFilter; //!< filter min<<32 max, texture size must be min<=size<=max
|
||||
DWORD64 HeightFilter; //!< filter min<<32 max, texture size must be min<=size<=max
|
||||
DWORD64 DepthFilter; //!< filter min<<32 max, texture size must be min<=size<=max
|
||||
|
||||
const int Version;
|
||||
uMod_TextureServer* Server; //< Pointer to the server
|
||||
wchar_t SavePath[MAX_PATH]; //< saving directory
|
||||
wchar_t GameName[MAX_PATH]; //< game name
|
||||
uMod_TextureServer* Server; //!< Pointer to the server
|
||||
wchar_t SavePath[MAX_PATH]; //!< saving directory
|
||||
wchar_t GameName[MAX_PATH]; //!< game name
|
||||
|
||||
TextureFileStruct* Update; //< array which stores the file in memory and the hash of each texture to be modded
|
||||
int NumberOfUpdate; //< number of texture to be modded
|
||||
TextureFileStruct* Update; //!< array which stores the file in memory and the hash of each texture to be modded
|
||||
int NumberOfUpdate; //!< number of texture to be modded
|
||||
|
||||
/**
|
||||
* Lock the mutex. The mutex protect the AddUpdate and MergeUpdate function to be called simultaneously.
|
||||
@@ -156,12 +206,19 @@ public:
|
||||
* @return RETURN_OK on success
|
||||
*/
|
||||
int UnlockMutex();
|
||||
HANDLE Mutex; //< The mutex protect the AddUpdate and MergeUpdate function to be called simultaneously.
|
||||
HANDLE Mutex; //!< The mutex protect the AddUpdate and MergeUpdate function to be called simultaneously.
|
||||
|
||||
int NumberToMod; //< number of texture to be modded
|
||||
TextureFileStruct* FileToMod; //< array which stores the file in memory and the hash of each texture to be modded
|
||||
int NumberToMod; //!< number of texture to be modded
|
||||
TextureFileStruct* FileToMod; //!< array which stores the file in memory and the hash of each texture to be modded
|
||||
|
||||
int GetIndex( MyTypeHash hash, int num_index_list=0, int *index_list=(int*)0); // called from LookUpToMod(...);
|
||||
/**
|
||||
* Find the given hash value in the \a FileToMod list. A vector with index can be passed. If so, only these index are considered in the search
|
||||
* @param hash hash value
|
||||
* @param num_index_list number of index vector
|
||||
* @param index_list pointer to the index vector
|
||||
* @return index or a negative value if the hash value was not found
|
||||
*/
|
||||
int GetIndex( DWORD64 hash, int num_index_list=0, int *index_list=(int*)0); // called from LookUpToMod(...);
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -19,14 +19,23 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
#include "uMod_Main.h"
|
||||
|
||||
/*
|
||||
MyTypeHash GetHash(unsigned char *str, int len) // estimate the hash
|
||||
|
||||
void GetHash( unsigned char *str, unsigned int len, DWORD64 &hash) // estimate the hash
|
||||
{
|
||||
MyTypeHash hash = 0;
|
||||
for (int i=0; i<len; i++) hash = str[i] + (hash << 6) + (hash << 16) - hash;
|
||||
return (hash);
|
||||
DWORD32 hash1 = hash & 0xFFFFFFFF;
|
||||
DWORD32 hash2 = hash>>32 & 0xFFFFFFFF;
|
||||
|
||||
for (int i=0; i<len; i++)
|
||||
{
|
||||
hash1 = ((hash1 << 5) + hash1) + *str; // D.J. Bernsteins algorithm (djb2)
|
||||
hash2 = *str + (hash2<< 6) + (hash2 << 16) - hash2; // SDBM algorithm
|
||||
str++;
|
||||
}
|
||||
hash = hash2;
|
||||
hash<<=32;
|
||||
hash |= hash1;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -43,10 +52,13 @@ The problem is that it doesn't take the pitch into account and BytesPerPixel may
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define CRC32POLY 0xEDB88320u /* CRC-32 Polynom */
|
||||
#define ulCrc_in 0xffffffff
|
||||
|
||||
unsigned int GetCRC32( char *pcDatabuf, unsigned int ulDatalen)
|
||||
DWORD32 GetCRC32( char *pcDatabuf, unsigned int ulDatalen)
|
||||
{
|
||||
unsigned int crc = ulCrc_in;
|
||||
for (unsigned int idx = 0u; idx<ulDatalen; idx++)
|
||||
|
||||
@@ -19,11 +19,43 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
#define uMod_TEXTUREFUNCTION_H_
|
||||
|
||||
|
||||
unsigned int GetCRC32( char *pcDatabuf, unsigned int ulDatalen);
|
||||
|
||||
// this value is simply the init value for the D.J. Bernsteins algorithm (djb2)
|
||||
#define HASH_INIT_VALUE 5381
|
||||
|
||||
/**
|
||||
* This hash function combines the djb2 and sdbm algorithm. Both are designed for hashing strings,
|
||||
* but compared to many others they don't include a Hash*data[i] operation, which would reset the hash
|
||||
* if data[i]==0. This is never the case while hashing text, but it is very often the case when hashing
|
||||
* textures. Therefore many good algorithm cannot be used at this point.
|
||||
*
|
||||
* Here are two algorithm used to reduce the number of collision (collision == two different textures have
|
||||
* the same hash value)
|
||||
*
|
||||
* @param[in] data pointer to the buffer
|
||||
* @param[in] len length of buffer in bytes
|
||||
* @param[in,out] hash in = initial value of the hash; out = returned hash
|
||||
*/
|
||||
void GetHash( unsigned char *str, unsigned int len, DWORD64 &hash); // estimate the hash
|
||||
|
||||
|
||||
/**
|
||||
* Caluclate the CRC32 value over a buffer. This function is used in texmod. Thanks to RS for given me this information!
|
||||
* @param[in] data pointer to the buffer
|
||||
* @param[in] len length of buffer in bytes
|
||||
* @return CRC32 value
|
||||
*/
|
||||
DWORD32 GetCRC32( char *data, unsigned int len);
|
||||
/*
|
||||
case D3DFMT_MULTI2_ARGB8:
|
||||
case D3DFMT_VERTEXDATA:
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns the number of bits used per pixel.
|
||||
* @param[in] format DX format.
|
||||
* @return
|
||||
*/
|
||||
inline int GetBitsFromFormat(D3DFORMAT format)
|
||||
{
|
||||
switch(format) //switch trough the formats to calculate the size of the raw data
|
||||
|
||||
@@ -31,6 +31,9 @@ uMod_TextureServer::uMod_TextureServer(wchar_t *game)
|
||||
LenghtOfClients = 0;
|
||||
BoolSaveAllTextures = false;
|
||||
BoolSaveSingleTexture = false;
|
||||
BoolShowTextureString = false;
|
||||
BoolSupportTPF = false;
|
||||
|
||||
SavePath[0] = 0;
|
||||
|
||||
int len=0;
|
||||
@@ -54,8 +57,16 @@ uMod_TextureServer::uMod_TextureServer(wchar_t *game)
|
||||
KeySave = 0;
|
||||
KeyNext = 0;
|
||||
|
||||
FontColour = 0u;
|
||||
TextureColour = 0u;
|
||||
WidthFilter = 0u;
|
||||
HeightFilter = 0u;
|
||||
DepthFilter = 0u;
|
||||
|
||||
FormatFilter = 0u;
|
||||
|
||||
FileFormat = uMod_D3DXIFF_DDS;
|
||||
|
||||
FontColour = D3DCOLOR_ARGB(255,255,0,0);
|
||||
TextureColour = D3DCOLOR_ARGB(255,0,255,0);
|
||||
|
||||
Pipe.In = INVALID_HANDLE_VALUE;
|
||||
Pipe.Out = INVALID_HANDLE_VALUE;
|
||||
@@ -94,27 +105,24 @@ int uMod_TextureServer::AddClient(uMod_TextureClient *client, TextureFileStruct*
|
||||
client->SetGameName(GameName);
|
||||
client->SaveAllTextures(BoolSaveAllTextures);
|
||||
client->SaveSingleTexture(BoolSaveSingleTexture);
|
||||
client->ShowTextureString(BoolShowTextureString);
|
||||
client->SupportTPF(BoolSupportTPF);
|
||||
client->SetSaveDirectory(SavePath);
|
||||
|
||||
if (KeyBack > 0) client->SetKeyBack(KeyBack);
|
||||
if (KeySave > 0) client->SetKeySave(KeySave);
|
||||
if (KeyNext > 0) client->SetKeyNext(KeyNext);
|
||||
client->SetKeyBack(KeyBack);
|
||||
client->SetKeySave(KeySave);
|
||||
client->SetKeyNext(KeyNext);
|
||||
|
||||
if (FontColour>0u)
|
||||
{
|
||||
DWORD r = (FontColour>>16)&0xFF;
|
||||
DWORD g = (FontColour>>8)&0xFF;
|
||||
DWORD b = (FontColour)&0xFF;
|
||||
client->SetFontColour( r, g, b);
|
||||
}
|
||||
if (TextureColour>0u)
|
||||
{
|
||||
DWORD r = (TextureColour>>16)&0xFF;
|
||||
DWORD g = (TextureColour>>8)&0xFF;
|
||||
DWORD b = (TextureColour)&0xFF;
|
||||
client->SetTextureColour( r, g, b);
|
||||
}
|
||||
client->SetFontColour( FontColour);
|
||||
client->SetTextureColour( TextureColour);
|
||||
|
||||
client->SetWidthFilter( WidthFilter);
|
||||
client->SetHeightFilter( HeightFilter);
|
||||
client->SetDepthFilter( DepthFilter);
|
||||
client->SetFormatFilter(FormatFilter);
|
||||
|
||||
|
||||
client->SetFileFormat(FileFormat);
|
||||
|
||||
if (int ret = PrepareUpdate( update, number)) return (ret); // get a copy of all texture to be modded
|
||||
|
||||
@@ -161,14 +169,17 @@ int uMod_TextureServer::RemoveClient(uMod_TextureClient *client, const int versi
|
||||
return (ret);
|
||||
}
|
||||
|
||||
bool hit = false;
|
||||
for (int i = 0; i < NumberOfClients; i++) if (client == Clients[i])
|
||||
{
|
||||
hit = true;
|
||||
NumberOfClients--;
|
||||
Clients[i] = Clients[NumberOfClients];
|
||||
break;
|
||||
}
|
||||
|
||||
int ret = UnlockMutex();
|
||||
if (!hit) return ret;
|
||||
if (ret!=RETURN_OK) return (ret);
|
||||
|
||||
|
||||
@@ -187,9 +198,9 @@ int uMod_TextureServer::RemoveClient(uMod_TextureClient *client, const int versi
|
||||
return (RETURN_OK);
|
||||
}
|
||||
|
||||
int uMod_TextureServer::AddFile( char* buffer, unsigned int size, MyTypeHash hash, bool force) // called from Mainloop()
|
||||
int uMod_TextureServer::AddFile( char* buffer, DWORD64 size, DWORD64 hash, bool force) // called from Mainloop()
|
||||
{
|
||||
Message("uMod_TextureServer::AddFile( %lu %lu, %#lX, %d): %lu\n", buffer, size, hash, force, this);
|
||||
Message("uMod_TextureServer::AddFile( %p %llu, %#llX, %d): %lu\n", buffer, size, hash, force, this);
|
||||
|
||||
TextureFileStruct* temp = NULL;
|
||||
|
||||
@@ -236,23 +247,9 @@ int uMod_TextureServer::AddFile( char* buffer, unsigned int size, MyTypeHash ha
|
||||
|
||||
temp->pData = buffer;
|
||||
|
||||
/*
|
||||
try
|
||||
{
|
||||
temp->pData = new char[size];
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (!new_file) CurrentMod.Remove( temp); // if this is a not a new file it is in the list of the CurrentMod
|
||||
delete temp;
|
||||
gl_ErrorState |= uMod_ERROR_MEMORY | uMod_ERROR_SERVER;
|
||||
return (RETURN_NO_MEMORY);
|
||||
}
|
||||
*/
|
||||
|
||||
for (unsigned int i=0; i<size; i++) temp->pData[i] = buffer[i];
|
||||
|
||||
temp->Size = size;
|
||||
temp->Size = (unsigned int) size;
|
||||
temp->NumberOfTextures = 0;
|
||||
temp->Textures = NULL;
|
||||
temp->Hash = hash;
|
||||
@@ -261,7 +258,7 @@ int uMod_TextureServer::AddFile( char* buffer, unsigned int size, MyTypeHash ha
|
||||
//else
|
||||
temp->ForceReload = force;
|
||||
|
||||
Message("End AddFile(%#lX)\n", hash);
|
||||
Message("uMod_TextureServer::End AddFile(%#lX)\n", hash);
|
||||
if (new_file) return (CurrentMod.Add(temp)); // new files must be added to the list of the CurrentMod
|
||||
else return (RETURN_OK);
|
||||
}
|
||||
@@ -352,7 +349,7 @@ int uMod_TextureServer::AddFile(wchar_t* file_name, MyTypeHash hash, bool force)
|
||||
}
|
||||
*/
|
||||
|
||||
int uMod_TextureServer::RemoveFile(MyTypeHash hash) // called from Mainloop()
|
||||
int uMod_TextureServer::RemoveFile(DWORD64 hash) // called from Mainloop()
|
||||
{
|
||||
Message("RemoveFile( %lu): %lu\n", hash, this);
|
||||
|
||||
@@ -400,6 +397,40 @@ int uMod_TextureServer::SaveSingleTexture(bool val) // called from Mainloop()
|
||||
return (UnlockMutex());
|
||||
}
|
||||
|
||||
int uMod_TextureServer::ShowTextureString(bool val) // called from Mainloop()
|
||||
{
|
||||
if (BoolShowTextureString == val) return (RETURN_OK);
|
||||
BoolShowTextureString = val;
|
||||
|
||||
if (int ret = LockMutex())
|
||||
{
|
||||
gl_ErrorState |= uMod_ERROR_SERVER;
|
||||
return (ret);
|
||||
}
|
||||
for (int i = 0; i < NumberOfClients; i++)
|
||||
{
|
||||
Clients[i]->ShowTextureString(BoolShowTextureString);
|
||||
}
|
||||
return (UnlockMutex());
|
||||
}
|
||||
|
||||
int uMod_TextureServer::SupportTPF(bool val) // called from Mainloop()
|
||||
{
|
||||
if (BoolSupportTPF == val) return (RETURN_OK);
|
||||
BoolSupportTPF = val;
|
||||
|
||||
if (int ret = LockMutex())
|
||||
{
|
||||
gl_ErrorState |= uMod_ERROR_SERVER;
|
||||
return (ret);
|
||||
}
|
||||
for (int i = 0; i < NumberOfClients; i++)
|
||||
{
|
||||
Clients[i]->SupportTPF(BoolSupportTPF);
|
||||
}
|
||||
return (UnlockMutex());
|
||||
}
|
||||
|
||||
int uMod_TextureServer::SetSaveDirectory(wchar_t *dir) // called from Mainloop()
|
||||
{
|
||||
Message("uMod_TextureServer::SetSaveDirectory( %ls): %lu\n", dir, this);
|
||||
@@ -472,7 +503,7 @@ int uMod_TextureServer::SetKeyNext(int key) // called from Mainloop()
|
||||
return (UnlockMutex());
|
||||
}
|
||||
|
||||
int uMod_TextureServer::SetFontColour(DWORD colour) // called from Mainloop()
|
||||
int uMod_TextureServer::SetFontColour(DWORD64 colour) // called from Mainloop()
|
||||
{
|
||||
if (colour==0u) return (RETURN_OK);
|
||||
if (int ret = LockMutex())
|
||||
@@ -481,18 +512,15 @@ int uMod_TextureServer::SetFontColour(DWORD colour) // called from Mainloop()
|
||||
return (ret);
|
||||
}
|
||||
FontColour = colour;
|
||||
DWORD r = (FontColour>>16)&0xFF;
|
||||
DWORD g = (FontColour>>8)&0xFF;
|
||||
DWORD b = (FontColour)&0xFF;
|
||||
Message("uMod_TextureServer::SetFontColour( %u %u %u): %lu\n", r ,g ,b, this);
|
||||
Message("uMod_TextureServer::SetFontColour( %#lX): %lu\n",colour, this);
|
||||
for (int i = 0; i < NumberOfClients; i++)
|
||||
{
|
||||
Clients[i]->SetFontColour( r, g, b);
|
||||
Clients[i]->SetFontColour( colour);
|
||||
}
|
||||
return (UnlockMutex());
|
||||
}
|
||||
|
||||
int uMod_TextureServer::SetTextureColour(DWORD colour) // called from Mainloop()
|
||||
int uMod_TextureServer::SetTextureColour(DWORD64 colour) // called from Mainloop()
|
||||
{
|
||||
if (colour==0u) return (RETURN_OK);
|
||||
if (int ret = LockMutex())
|
||||
@@ -501,13 +529,90 @@ int uMod_TextureServer::SetTextureColour(DWORD colour) // called from Mainloop()
|
||||
return (ret);
|
||||
}
|
||||
TextureColour = colour;
|
||||
DWORD r = (TextureColour>>16)&0xFF;
|
||||
DWORD g = (TextureColour>>8)&0xFF;
|
||||
DWORD b = (TextureColour)&0xFF;
|
||||
Message("uMod_TextureServer::SetTextureColour( %u %u %u): %lu\n", r ,g ,b, this);
|
||||
Message("uMod_TextureServer::SetTextureColour( %#lX): %lu\n", colour, this);
|
||||
for (int i = 0; i < NumberOfClients; i++)
|
||||
{
|
||||
Clients[i]->SetTextureColour( r, g, b);
|
||||
Clients[i]->SetTextureColour( colour);
|
||||
}
|
||||
return (UnlockMutex());
|
||||
}
|
||||
|
||||
int uMod_TextureServer::SetFileFormat(DWORD64 format) // called from Mainloop()
|
||||
{
|
||||
if (int ret = LockMutex())
|
||||
{
|
||||
gl_ErrorState |= uMod_ERROR_SERVER;
|
||||
return (ret);
|
||||
}
|
||||
FileFormat = format;
|
||||
Message("uMod_TextureServer::SetFileFormat( %lu): %lu\n", format, this);
|
||||
for (int i = 0; i < NumberOfClients; i++)
|
||||
{
|
||||
Clients[i]->SetFileFormat( format);
|
||||
}
|
||||
return (UnlockMutex());
|
||||
}
|
||||
|
||||
int uMod_TextureServer::SetFormatFilter(DWORD64 format) // called from Mainloop()
|
||||
{
|
||||
if (int ret = LockMutex())
|
||||
{
|
||||
gl_ErrorState |= uMod_ERROR_SERVER;
|
||||
return (ret);
|
||||
}
|
||||
FormatFilter = format;
|
||||
Message("uMod_TextureServer::SetFormatFilter( %lu): %lu\n", format, this);
|
||||
for (int i = 0; i < NumberOfClients; i++)
|
||||
{
|
||||
Clients[i]->SetFormatFilter( format);
|
||||
}
|
||||
return (UnlockMutex());
|
||||
}
|
||||
|
||||
int uMod_TextureServer::SetWidthFilter(DWORD64 size) // called from Mainloop()
|
||||
{
|
||||
if (int ret = LockMutex())
|
||||
{
|
||||
gl_ErrorState |= uMod_ERROR_SERVER;
|
||||
return (ret);
|
||||
}
|
||||
WidthFilter = size;
|
||||
Message("uMod_TextureServer::SetWidthFilter( %lu): %lu\n", size, this);
|
||||
for (int i = 0; i < NumberOfClients; i++)
|
||||
{
|
||||
Clients[i]->SetWidthFilter( size);
|
||||
}
|
||||
return (UnlockMutex());
|
||||
}
|
||||
|
||||
int uMod_TextureServer::SetHeightFilter(DWORD64 size) // called from Mainloop()
|
||||
{
|
||||
if (int ret = LockMutex())
|
||||
{
|
||||
gl_ErrorState |= uMod_ERROR_SERVER;
|
||||
return (ret);
|
||||
}
|
||||
HeightFilter = size;
|
||||
Message("uMod_TextureServer::SetHeightFilter( %lu): %lu\n", size, this);
|
||||
for (int i = 0; i < NumberOfClients; i++)
|
||||
{
|
||||
Clients[i]->SetHeightFilter( size);
|
||||
}
|
||||
return (UnlockMutex());
|
||||
}
|
||||
|
||||
int uMod_TextureServer::SetDepthFilter(DWORD64 size) // called from Mainloop()
|
||||
{
|
||||
if (int ret = LockMutex())
|
||||
{
|
||||
gl_ErrorState |= uMod_ERROR_SERVER;
|
||||
return (ret);
|
||||
}
|
||||
DepthFilter = size;
|
||||
Message("uMod_TextureServer::SetDepthFilter( %lu): %lu\n", size, this);
|
||||
for (int i = 0; i < NumberOfClients; i++)
|
||||
{
|
||||
Clients[i]->SetDepthFilter( size);
|
||||
}
|
||||
return (UnlockMutex());
|
||||
}
|
||||
@@ -610,11 +715,11 @@ int uMod_TextureServer::MainLoop(void) // run as a separated thread
|
||||
unsigned long num = 0u;
|
||||
bool update_textures = false;
|
||||
|
||||
unsigned int texture_size = 0u;
|
||||
unsigned int texture_received = 0u;
|
||||
DWORD64 texture_size = 0u;
|
||||
DWORD64 texture_received = 0u;
|
||||
char *texture_data = (char*)0;
|
||||
bool texture_force = false;
|
||||
MyTypeHash texture_hash = 0u;
|
||||
DWORD64 texture_hash = 0u;
|
||||
|
||||
Message("MainLoop: started\n");
|
||||
while (1)
|
||||
@@ -629,9 +734,9 @@ int uMod_TextureServer::MainLoop(void) // run as a separated thread
|
||||
Message("MainLoop: read something (%lu)\n", num);
|
||||
if (ret || GetLastError() == ERROR_MORE_DATA)
|
||||
{
|
||||
unsigned int pos = 0;
|
||||
DWORD64 pos = 0;
|
||||
MsgStruct *commands;
|
||||
unsigned int size=0u;
|
||||
DWORD64 size=0u;
|
||||
while (pos < num)
|
||||
{
|
||||
if (texture_received<texture_size)
|
||||
@@ -653,7 +758,7 @@ int uMod_TextureServer::MainLoop(void) // run as a separated thread
|
||||
{
|
||||
case CONTROL_END_TEXTURES:
|
||||
{
|
||||
Message("MainLoop: CONTROL_END_TEXTURES (): %lu\n", this);
|
||||
Message("MainLoop: CONTROL_END_TEXTURES (): %p\n", this);
|
||||
update_textures=true;
|
||||
break;
|
||||
}
|
||||
@@ -677,7 +782,7 @@ int uMod_TextureServer::MainLoop(void) // run as a separated thread
|
||||
texture_force=true;
|
||||
try
|
||||
{
|
||||
texture_data = new char[texture_size];
|
||||
texture_data = new char[(unsigned int) texture_size];
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -685,7 +790,7 @@ int uMod_TextureServer::MainLoop(void) // run as a separated thread
|
||||
texture_data = (char*)0;
|
||||
gl_ErrorState |= uMod_ERROR_MEMORY | uMod_ERROR_SERVER;
|
||||
}
|
||||
Message("MainLoop: CONTROL_FORCE_RELOAD_TEXTURE_DATA (%#lX %u, %u): %lu\n", texture_hash, texture_size, texture_data, this);
|
||||
Message("MainLoop: CONTROL_FORCE_RELOAD_TEXTURE_DATA (%#llX %llu, %p): %p\n", texture_hash, texture_size, texture_data, this);
|
||||
break;
|
||||
}
|
||||
case CONTROL_ADD_TEXTURE_DATA:
|
||||
@@ -696,7 +801,7 @@ int uMod_TextureServer::MainLoop(void) // run as a separated thread
|
||||
texture_force=true;
|
||||
try
|
||||
{
|
||||
texture_data = new char[texture_size];
|
||||
texture_data = new char[(unsigned int) texture_size];
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
@@ -704,29 +809,43 @@ int uMod_TextureServer::MainLoop(void) // run as a separated thread
|
||||
texture_data = (char*)0;
|
||||
gl_ErrorState |= uMod_ERROR_MEMORY | uMod_ERROR_SERVER;
|
||||
}
|
||||
Message("MainLoop: CONTROL_ADD_TEXTURE_DATA (%#lX %u, %u): %lu\n", texture_hash, texture_size, texture_data, this);
|
||||
Message("MainLoop: CONTROL_ADD_TEXTURE_DATA (%#llX %llu, %p): %p\n", texture_hash, texture_size, texture_data, this);
|
||||
break;
|
||||
}
|
||||
case CONTROL_REMOVE_TEXTURE:
|
||||
{
|
||||
Message("MainLoop: CONTROL_REMOVE_TEXTURE (%#lX): %lu\n", commands->Hash, this);
|
||||
Message("MainLoop: CONTROL_REMOVE_TEXTURE (%#llX): %p\n", commands->Hash, this);
|
||||
RemoveFile(commands->Hash);
|
||||
//update_textures = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case CONTROL_SAVE_ALL:
|
||||
{
|
||||
Message("MainLoop: CONTROL_SAVE_ALL (%#llX): %p\n", commands->Value, this);
|
||||
if (commands->Value == 0) SaveAllTextures(false);
|
||||
else SaveAllTextures(true);
|
||||
break;
|
||||
}
|
||||
case CONTROL_SAVE_SINGLE:
|
||||
{
|
||||
Message("MainLoop: CONTROL_SAVE_SINGLE (%d): %lu\n", commands->Value, this);
|
||||
Message("MainLoop: CONTROL_SAVE_SINGLE (%#llX): %p\n", commands->Value, this);
|
||||
if (commands->Value == 0) SaveSingleTexture(false);
|
||||
else SaveSingleTexture(true);
|
||||
break;
|
||||
}
|
||||
case CONTROL_SAVE_ALL:
|
||||
case CONTROL_SHOW_STRING:
|
||||
{
|
||||
Message("MainLoop: CONTROL_SAVE_ALL (%d): %lu\n", commands->Value, this);
|
||||
if (commands->Value == 0) SaveAllTextures(false);
|
||||
else SaveAllTextures(true);
|
||||
Message("MainLoop: CONTROL_SHOW_STRING (%#llX): %p\n", commands->Value, this);
|
||||
if (commands->Value == 0) ShowTextureString(false);
|
||||
else ShowTextureString(true);
|
||||
break;
|
||||
}
|
||||
case CONTROL_SUPPORT_TPF:
|
||||
{
|
||||
Message("MainLoop: CONTROL_SUPPORT_TPF (%#llX): %p\n", commands->Value, this);
|
||||
if (commands->Value == 0) SupportTPF(false);
|
||||
else SupportTPF(true);
|
||||
break;
|
||||
}
|
||||
case CONTROL_SET_DIR:
|
||||
@@ -738,37 +857,68 @@ int uMod_TextureServer::MainLoop(void) // run as a separated thread
|
||||
|
||||
case CONTROL_KEY_BACK:
|
||||
{
|
||||
Message("MainLoop: CONTROL_KEY_BACK (%#X): %lu\n", commands->Value, this);
|
||||
SetKeyBack(commands->Value);
|
||||
Message("MainLoop: CONTROL_KEY_BACK (%#llX): %p\n", commands->Value, this);
|
||||
SetKeyBack((int) commands->Value);
|
||||
break;
|
||||
}
|
||||
case CONTROL_KEY_SAVE:
|
||||
{
|
||||
Message("MainLoop: CONTROL_KEY_SAVE (%#X): %lu\n", commands->Value, this);
|
||||
SetKeySave(commands->Value);
|
||||
Message("MainLoop: CONTROL_KEY_SAVE (%#llX): %p\n", commands->Value, this);
|
||||
SetKeySave((int) commands->Value);
|
||||
break;
|
||||
}
|
||||
case CONTROL_KEY_NEXT:
|
||||
{
|
||||
Message("MainLoop: CONTROL_KEY_NEXT (%#X): %lu\n", commands->Value, this);
|
||||
SetKeyNext(commands->Value);
|
||||
Message("MainLoop: CONTROL_KEY_NEXT (%#llX): %p\n", commands->Value, this);
|
||||
SetKeyNext((int) commands->Value);
|
||||
break;
|
||||
}
|
||||
case CONTROL_FONT_COLOUR:
|
||||
{
|
||||
Message("MainLoop: CONTROL_FONT_COLOUR (%#X): %lu\n", commands->Value, this);
|
||||
Message("MainLoop: CONTROL_FONT_COLOUR (%#llX): %p\n", commands->Value, this);
|
||||
SetFontColour(commands->Value);
|
||||
break;
|
||||
}
|
||||
case CONTROL_TEXTURE_COLOUR:
|
||||
{
|
||||
Message("MainLoop: CONTROL_TEXTURE_COLOUR (%#X): %lu\n", commands->Value, this);
|
||||
Message("MainLoop: CONTROL_TEXTURE_COLOUR (%#llX): %p\n", commands->Value, this);
|
||||
SetTextureColour(commands->Value);
|
||||
break;
|
||||
}
|
||||
case CONTROL_WIDTH_FILTER:
|
||||
{
|
||||
Message("MainLoop: CONTROL_WIDTH_FILTER (%#llX): %p\n", commands->Value, this);
|
||||
SetWidthFilter(commands->Value);
|
||||
break;
|
||||
}
|
||||
case CONTROL_HEIGHT_FILTER:
|
||||
{
|
||||
Message("MainLoop: CONTROL_HEIGHT_FILTER (%#llX): %p\n", commands->Value, this);
|
||||
SetHeightFilter(commands->Value);
|
||||
break;
|
||||
}
|
||||
case CONTROL_DEPTH_FILTER:
|
||||
{
|
||||
Message("MainLoop: CONTROL_DEPTH_FILTER (%#llX): %p\n", commands->Value, this);
|
||||
SetDepthFilter(commands->Value);
|
||||
break;
|
||||
}
|
||||
case CONTROL_FORMAT_FILTER:
|
||||
{
|
||||
Message("MainLoop: CONTROL_FORMAT_FILTER (%#llX): %p\n", commands->Value, this);
|
||||
SetFormatFilter(commands->Value);
|
||||
break;
|
||||
}
|
||||
case CONTROL_SAVE_FORMAT:
|
||||
{
|
||||
Message("MainLoop: CONTROL_SAVE_FORMAT (%#llX): %p\n", commands->Value, this);
|
||||
SetFileFormat(commands->Value);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
Message("MainLoop: DEFAULT: %lu %lu %#lX\n", commands->Control, commands->Value, commands->Hash, this);
|
||||
Message("MainLoop: DEFAULT: %lu %#llX %#llX\n", commands->Control, commands->Value, commands->Hash, this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -790,7 +940,7 @@ int uMod_TextureServer::MainLoop(void) // run as a separated thread
|
||||
return (RETURN_OK);
|
||||
}
|
||||
|
||||
int uMod_TextureServer::OpenPipe(wchar_t *game) // called from InitInstance()
|
||||
int uMod_TextureServer::OpenPipe(wchar_t *game, int injection_method) // called from InitInstance()
|
||||
{
|
||||
Message("OpenPipe: Out\n")
|
||||
// open first outgoing pipe !!
|
||||
@@ -810,7 +960,17 @@ int uMod_TextureServer::OpenPipe(wchar_t *game) // called from InitInstance()
|
||||
len++; //to send also the zero
|
||||
unsigned long num;
|
||||
//send name of this game to uMod_GUI
|
||||
WriteFile(Pipe.Out, (const void*) game, len * sizeof(wchar_t), &num, NULL);
|
||||
|
||||
char *buffer=(char*)0;
|
||||
GetMemory(buffer, sizeof(int) + len * sizeof(wchar_t));
|
||||
*((int*) buffer) = injection_method;
|
||||
char *p_game = (char*) game;
|
||||
|
||||
for (unsigned int i=0; i<len*sizeof(wchar_t); i++) buffer[i+sizeof(int)] = p_game[i];
|
||||
//WriteFile(Pipe.Out, (const void*) &injection_method, sizeof(int), &num, NULL);
|
||||
//WriteFile(Pipe.Out, (const void*) game, len * sizeof(wchar_t), &num, NULL);
|
||||
WriteFile(Pipe.Out, (const void*) buffer, len * sizeof(wchar_t) + sizeof(int), &num, NULL);
|
||||
delete [] buffer;
|
||||
|
||||
// now we can open the pipe for reading
|
||||
Message("OpenPipe: In\n");
|
||||
|
||||
@@ -24,7 +24,7 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
#include "uMod_ArrayHandler.h"
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* An object of this class is created only once.
|
||||
* The Mainloop functions is executed by a server thread,
|
||||
* which listen on a pipe.
|
||||
@@ -41,34 +41,36 @@ class uMod_TextureServer
|
||||
public:
|
||||
/**
|
||||
* The server is created from the dll entry routine.
|
||||
* @param name Name of the game executable (without the extension)
|
||||
* @param[in] name Name of the game executable (without the extension)
|
||||
*/
|
||||
uMod_TextureServer(wchar_t *name);
|
||||
~uMod_TextureServer(void);
|
||||
|
||||
/**
|
||||
* Each client connect itself to the server via this function.
|
||||
* @param client This-pointer of the client
|
||||
* @param update Current texture to be modded
|
||||
* @param number Number of modded textures
|
||||
* @param Version Version of DirectX.
|
||||
* @param[in] client This-pointer of the client
|
||||
* @param[out] update Current texture to be modded
|
||||
* @param[out] number Number of modded textures
|
||||
* @param[in] version The device version (DX9, DX9EX, DX10, or DX101)
|
||||
* @return RETURN_OK on success
|
||||
*/
|
||||
int AddClient(uMod_TextureClient *client, TextureFileStruct* &update, int &number, const int version); // called from a Client
|
||||
|
||||
/**
|
||||
* On destruction of client, it disconnect from the server.
|
||||
* @param client This-pointer of the client
|
||||
* @param[in] client This-pointer of the client
|
||||
* @param[in] version The device version (DX9, DX9EX, DX10, or DX101)
|
||||
* @return RETURN_OK on success
|
||||
*/
|
||||
int RemoveClient(uMod_TextureClient *client, const int version); // called from a Client
|
||||
|
||||
/**
|
||||
* Opens the pipe to the GUI (called from the dll entry routine)
|
||||
* @param name Name of the game
|
||||
* @param[in] name Name of the game
|
||||
* @param[in] injection_method global hook=1, direct injection=2, no injection=3
|
||||
* @return RETURN_OK on success
|
||||
*/
|
||||
int OpenPipe(wchar_t *name); // called on initialization of our d3d9 fake dll
|
||||
int OpenPipe(wchar_t *name, int injection_method); // called on initialization of our d3d9 fake dll
|
||||
|
||||
/**
|
||||
* Close the Pipe to the GUI (called if dll entry is called to attach from the game)
|
||||
@@ -87,121 +89,184 @@ public:
|
||||
private:
|
||||
/**
|
||||
* Add a file to the list of texture to be modded (called from the mainloop).
|
||||
* @param buffer hold the file content of the texture
|
||||
* @param size size of the file content
|
||||
* @param hash hash of the texture to be replaced
|
||||
* @param force set to TRUE to force a reload of the texture
|
||||
* @param[in] buffer hold the file content of the texture
|
||||
* @param[in] size size of the file content
|
||||
* @param[in] hash hash of the texture to be replaced
|
||||
* @param[in] force set to TRUE to force a reload of the texture
|
||||
* @return RETURN_OK on success
|
||||
*/
|
||||
int AddFile( char* buffer, unsigned int size, MyTypeHash hash, bool force); // called from Mainloop(), if the content of the texture is sent
|
||||
int AddFile( char* buffer, DWORD64 size, DWORD64 hash, bool force); // called from Mainloop(), if the content of the texture is sent
|
||||
|
||||
/**
|
||||
* Add a file to the list of texture to be modded (called from the mainloop).
|
||||
* @param file_name Name and path to the file to be loaded.
|
||||
* @param hash hash of the texture to be replaced
|
||||
* @param force set to TRUE to force a reload of the texture
|
||||
* Add a file to the list of texture to be modded (called from the mainloop). Not supported anymore!
|
||||
* @param[in] file_name Name and path to the file to be loaded.
|
||||
* @param[in] hash hash of the texture to be replaced
|
||||
* @param[in] force set to TRUE to force a reload of the texture
|
||||
* @return RETURN_OK on success
|
||||
*/
|
||||
int AddFile( wchar_t* file_name, MyTypeHash hash, bool force); // called from Mainloop(), if the name and the path to the file is sent
|
||||
int AddFile( wchar_t* file_name, DWORD64 hash, bool force); // called from Mainloop(), if the name and the path to the file is sent
|
||||
|
||||
/**
|
||||
* Remove a texture (called from the mainloop).
|
||||
* @param hash Hash of the target texture.
|
||||
* @param[in] hash Hash of the target texture.
|
||||
* @return RETURN_OK on success
|
||||
*/
|
||||
int RemoveFile( MyTypeHash hash); // called from Mainloop()
|
||||
int RemoveFile( DWORD64 hash); // called from Mainloop()
|
||||
|
||||
/**
|
||||
* Save all texture, which are loade by the game (called from the mainloop).
|
||||
* @param val Set TRUE to enable the mode.
|
||||
* @param[in] val Set TRUE to enable the mode.
|
||||
* @return
|
||||
*/
|
||||
int SaveAllTextures(bool val); // called from Mainloop()
|
||||
|
||||
/**
|
||||
* (called from the mainloop).
|
||||
* @param val
|
||||
* Enable/Disable the save single texture mode (called from the mainloop).
|
||||
* @param[in] val
|
||||
* @return
|
||||
*/
|
||||
int SaveSingleTexture(bool val); // called from Mainloop()
|
||||
|
||||
/**
|
||||
* (called from the mainloop).
|
||||
* @param dir
|
||||
* Enable/Disable the string in the left upper corner during save single texture mode (called from the mainloop).
|
||||
* @param[in] val
|
||||
* @return
|
||||
*/
|
||||
int ShowTextureString(bool val); // called from Mainloop()
|
||||
|
||||
/**
|
||||
* Enable/Disable the hashing with CRC32, which is needed to support tpf mods (called from the mainloop).
|
||||
* @param[in] val
|
||||
* @return
|
||||
*/
|
||||
int SupportTPF(bool val); // called from Mainloop()
|
||||
|
||||
/**
|
||||
* Set saving directory (called from the mainloop).
|
||||
* @param[in] dir
|
||||
* @return
|
||||
*/
|
||||
int SetSaveDirectory( wchar_t *dir); // called from Mainloop()
|
||||
|
||||
/**
|
||||
* (called from the mainloop).
|
||||
* @param key
|
||||
* @param[in] key
|
||||
* @return
|
||||
*/
|
||||
int SetKeyBack( int key); // called from Mainloop()
|
||||
|
||||
/**
|
||||
* (called from the mainloop).
|
||||
* @param key
|
||||
* @param[in] key
|
||||
* @return
|
||||
*/
|
||||
int SetKeySave( int key); // called from Mainloop()
|
||||
|
||||
/**
|
||||
* (called from the mainloop).
|
||||
* @param key
|
||||
* @param[in] key
|
||||
* @return
|
||||
*/
|
||||
int SetKeyNext( int key); // called from Mainloop()
|
||||
|
||||
/**
|
||||
* (called from the mainloop).
|
||||
* @param colour
|
||||
* @param[in] colour
|
||||
* @return
|
||||
*/
|
||||
int SetFontColour(DWORD colour); // called from Mainloop()
|
||||
int SetFontColour(DWORD64 colour); // called from Mainloop()
|
||||
|
||||
/**
|
||||
* (called from the mainloop).
|
||||
* @param colour
|
||||
* @param[in] colour
|
||||
* @return
|
||||
*/
|
||||
int SetTextureColour(DWORD colour); // called from Mainloop()
|
||||
int SetTextureColour(DWORD64 colour); // called from Mainloop()
|
||||
|
||||
bool BoolSaveAllTextures;
|
||||
bool BoolSaveSingleTexture;
|
||||
wchar_t SavePath[MAX_PATH];
|
||||
wchar_t GameName[MAX_PATH];
|
||||
/**
|
||||
* (called from the mainloop).
|
||||
* @param[in] format
|
||||
* @return
|
||||
*/
|
||||
int SetFileFormat(DWORD64 format);
|
||||
|
||||
/**
|
||||
* (called from the mainloop).
|
||||
* @param[in] format
|
||||
* @return
|
||||
*/
|
||||
int SetFormatFilter(DWORD64 format);
|
||||
|
||||
/**
|
||||
* (called from the mainloop).
|
||||
* @param[in] size
|
||||
* @return
|
||||
*/
|
||||
int SetWidthFilter(DWORD64 size);
|
||||
|
||||
/**
|
||||
* (called from the mainloop).
|
||||
* @param[in] size
|
||||
* @return
|
||||
*/
|
||||
int SetHeightFilter(DWORD64 size);
|
||||
|
||||
/**
|
||||
* (called from the mainloop).
|
||||
* @param[in] size
|
||||
* @return
|
||||
*/
|
||||
int SetDepthFilter(DWORD64 size);
|
||||
|
||||
/**
|
||||
* Send the files to be modded (Update) to a client (called from the mainloop).
|
||||
* @param client Pointer to a client (if NULL is passed, the data is send to all clients)
|
||||
* @param[in] client Pointer to a client (if NULL is passed, the data is send to all clients)
|
||||
* @return
|
||||
*/
|
||||
int PropagateUpdate(uMod_TextureClient* client=NULL); // called from Mainloop() if texture are loaded or removed
|
||||
|
||||
/**
|
||||
* Prepare the texture data for the clients (e.g. Load the texture from disk, sort the texture according the hash values) (called from the mainloop).
|
||||
* @param update
|
||||
* @param number
|
||||
* @param[out] update
|
||||
* @param[out] number
|
||||
* @return
|
||||
*/
|
||||
int PrepareUpdate(TextureFileStruct* &update, int &number); // called from PropagateUpdate() and AddClient()
|
||||
// generate a copy of the current texture to be modded
|
||||
// the file content of the textures are not copied, the clients get the pointer to the file content
|
||||
// but the arrays allocate by this function, must be deleted by the client
|
||||
int PrepareUpdate(TextureFileStruct* &update, int &number);
|
||||
|
||||
/**
|
||||
* Locks the mutex.
|
||||
* @return
|
||||
*/
|
||||
int LockMutex();
|
||||
/**
|
||||
* Locks the mutex.
|
||||
* @return
|
||||
*/
|
||||
int UnlockMutex();
|
||||
HANDLE Mutex;
|
||||
HANDLE Mutex; //!< Mutex protects the simultaneously add or remove of multiple clients.
|
||||
|
||||
|
||||
bool BoolSaveAllTextures;
|
||||
bool BoolSaveSingleTexture;
|
||||
bool BoolShowTextureString;
|
||||
bool BoolSupportTPF;
|
||||
|
||||
wchar_t SavePath[MAX_PATH];
|
||||
wchar_t GameName[MAX_PATH];
|
||||
|
||||
|
||||
int KeyBack;
|
||||
int KeySave;
|
||||
int KeyNext;
|
||||
|
||||
DWORD FontColour;
|
||||
DWORD TextureColour;
|
||||
DWORD64 FontColour;
|
||||
DWORD64 TextureColour;
|
||||
|
||||
DWORD64 FileFormat;
|
||||
DWORD64 FormatFilter;
|
||||
DWORD64 WidthFilter;
|
||||
DWORD64 HeightFilter;
|
||||
DWORD64 DepthFilter;
|
||||
|
||||
PipeStruct Pipe;
|
||||
|
||||
|
||||
@@ -1,284 +0,0 @@
|
||||
# =========================================================================
|
||||
# This makefile was generated by
|
||||
# Bakefile 0.2.1 (http://bakefile.sourceforge.net)
|
||||
# Do not modify, all changes will be overwritten!
|
||||
# =========================================================================
|
||||
|
||||
include config.gcc
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Do not modify the rest of this file!
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
### Variables: ###
|
||||
|
||||
CPPDEPS = -MT$@ -MF$@.d -MD
|
||||
WX_RELEASE_NODOT = 29
|
||||
OBJS = \
|
||||
obj
|
||||
OBJS_exe = \
|
||||
bin
|
||||
WX_DIR = D:\Programme\wxWidgets-2.9.2
|
||||
LIBDIRNAME = $(WX_DIR)\lib\gcc_$(LIBTYPE_SUFFIX)$(CFG)
|
||||
SETUPHDIR = \
|
||||
$(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)
|
||||
MINIMAL_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG_2) $(__THREADSFLAG) \
|
||||
$(GCCFLAGS) -DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
|
||||
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
|
||||
$(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) $(__MSLU_DEFINE_p) \
|
||||
$(__GFXCTX_DEFINE_p) -I$(SETUPHDIR) -I$(WX_DIR)\include -W -Wall -Wextra -I. \
|
||||
$(__DLLFLAG_p) -DNOPCH $(__RTTIFLAG_5) \
|
||||
$(__EXCEPTIONSFLAG_6) -Wno-ctor-dtor-privacy $(CPPFLAGS) $(CXXFLAGS)
|
||||
MINIMAL_OBJECTS = \
|
||||
$(OBJS)\uMod_rc.o \
|
||||
$(OBJS)\unzip.o \
|
||||
$(OBJS)\uMod_DirectInjection.o \
|
||||
$(OBJS)\uMod_GUI.o \
|
||||
$(OBJS)\uMod_GameInfo.o \
|
||||
$(OBJS)\uMod_GamePage.o \
|
||||
$(OBJS)\uMod_Server.o \
|
||||
$(OBJS)\uMod_Client.o \
|
||||
$(OBJS)\uMod_File.o \
|
||||
$(OBJS)\uMod_Sender.o \
|
||||
$(OBJS)\uMod_Settings.o \
|
||||
$(OBJS)\uMod_AddTexture.o \
|
||||
$(OBJS)\uMod_Language.o
|
||||
|
||||
### Conditionally set variables: ###
|
||||
|
||||
ifeq ($(GCC_VERSION),2.95)
|
||||
GCCFLAGS = -fvtable-thunks
|
||||
endif
|
||||
ifeq ($(USE_GUI),0)
|
||||
PORTNAME = base
|
||||
endif
|
||||
ifeq ($(USE_GUI),1)
|
||||
PORTNAME = msw
|
||||
endif
|
||||
ifeq ($(BUILD),debug)
|
||||
ifeq ($(DEBUG_FLAG),default)
|
||||
WXDEBUGFLAG = d
|
||||
endif
|
||||
endif
|
||||
ifeq ($(DEBUG_FLAG),1)
|
||||
WXDEBUGFLAG = d
|
||||
endif
|
||||
ifeq ($(UNICODE),1)
|
||||
WXUNICODEFLAG = u
|
||||
endif
|
||||
ifeq ($(WXUNIV),1)
|
||||
WXUNIVNAME = univ
|
||||
endif
|
||||
ifeq ($(SHARED),1)
|
||||
WXDLLFLAG = dll
|
||||
endif
|
||||
ifeq ($(SHARED),0)
|
||||
LIBTYPE_SUFFIX = lib
|
||||
endif
|
||||
ifeq ($(SHARED),1)
|
||||
LIBTYPE_SUFFIX = dll
|
||||
endif
|
||||
ifeq ($(MONOLITHIC),0)
|
||||
EXTRALIBS_FOR_BASE =
|
||||
endif
|
||||
ifeq ($(MONOLITHIC),1)
|
||||
EXTRALIBS_FOR_BASE =
|
||||
endif
|
||||
ifeq ($(BUILD),debug)
|
||||
__OPTIMIZEFLAG_2 = -O0 -g
|
||||
endif
|
||||
ifeq ($(BUILD),release)
|
||||
__OPTIMIZEFLAG_2 = -O2
|
||||
endif
|
||||
ifeq ($(USE_RTTI),0)
|
||||
__RTTIFLAG_5 = -fno-rtti
|
||||
endif
|
||||
ifeq ($(USE_RTTI),1)
|
||||
__RTTIFLAG_5 =
|
||||
endif
|
||||
ifeq ($(USE_EXCEPTIONS),0)
|
||||
__EXCEPTIONSFLAG_6 = -fno-exceptions
|
||||
endif
|
||||
ifeq ($(USE_EXCEPTIONS),1)
|
||||
__EXCEPTIONSFLAG_6 =
|
||||
endif
|
||||
ifeq ($(WXUNIV),1)
|
||||
__WXUNIV_DEFINE_p = -D__WXUNIVERSAL__
|
||||
endif
|
||||
ifeq ($(WXUNIV),1)
|
||||
__WXUNIV_DEFINE_p_1 = --define __WXUNIVERSAL__
|
||||
endif
|
||||
ifeq ($(BUILD),debug)
|
||||
ifeq ($(DEBUG_FLAG),default)
|
||||
__DEBUG_DEFINE_p = -D__WXDEBUG__
|
||||
endif
|
||||
endif
|
||||
ifeq ($(DEBUG_FLAG),1)
|
||||
__DEBUG_DEFINE_p = -D__WXDEBUG__
|
||||
endif
|
||||
ifeq ($(BUILD),debug)
|
||||
ifeq ($(DEBUG_FLAG),default)
|
||||
__DEBUG_DEFINE_p_1 = --define __WXDEBUG__
|
||||
endif
|
||||
endif
|
||||
ifeq ($(DEBUG_FLAG),1)
|
||||
__DEBUG_DEFINE_p_1 = --define __WXDEBUG__
|
||||
endif
|
||||
ifeq ($(USE_EXCEPTIONS),0)
|
||||
__EXCEPTIONS_DEFINE_p = -DwxNO_EXCEPTIONS
|
||||
endif
|
||||
ifeq ($(USE_EXCEPTIONS),0)
|
||||
__EXCEPTIONS_DEFINE_p_1 = --define wxNO_EXCEPTIONS
|
||||
endif
|
||||
ifeq ($(USE_RTTI),0)
|
||||
__RTTI_DEFINE_p = -DwxNO_RTTI
|
||||
endif
|
||||
ifeq ($(USE_RTTI),0)
|
||||
__RTTI_DEFINE_p_1 = --define wxNO_RTTI
|
||||
endif
|
||||
ifeq ($(USE_THREADS),0)
|
||||
__THREAD_DEFINE_p = -DwxNO_THREADS
|
||||
endif
|
||||
ifeq ($(USE_THREADS),0)
|
||||
__THREAD_DEFINE_p_1 = --define wxNO_THREADS
|
||||
endif
|
||||
ifeq ($(UNICODE),1)
|
||||
__UNICODE_DEFINE_p = -D_UNICODE
|
||||
endif
|
||||
ifeq ($(UNICODE),1)
|
||||
__UNICODE_DEFINE_p_1 = --define _UNICODE
|
||||
endif
|
||||
ifeq ($(MSLU),1)
|
||||
__MSLU_DEFINE_p = -DwxUSE_UNICODE_MSLU=1
|
||||
endif
|
||||
ifeq ($(MSLU),1)
|
||||
__MSLU_DEFINE_p_1 = --define wxUSE_UNICODE_MSLU=1
|
||||
endif
|
||||
ifeq ($(USE_GDIPLUS),1)
|
||||
__GFXCTX_DEFINE_p = -DwxUSE_GRAPHICS_CONTEXT=1
|
||||
endif
|
||||
ifeq ($(USE_GDIPLUS),1)
|
||||
__GFXCTX_DEFINE_p_1 = --define wxUSE_GRAPHICS_CONTEXT=1
|
||||
endif
|
||||
ifeq ($(SHARED),1)
|
||||
__DLLFLAG_p = -DWXUSINGDLL
|
||||
endif
|
||||
ifeq ($(SHARED),1)
|
||||
__DLLFLAG_p_1 = --define WXUSINGDLL
|
||||
endif
|
||||
ifeq ($(MONOLITHIC),0)
|
||||
__WXLIB_CORE_p = \
|
||||
-lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core
|
||||
endif
|
||||
ifeq ($(MONOLITHIC),0)
|
||||
__WXLIB_BASE_p = \
|
||||
-lwxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)
|
||||
endif
|
||||
ifeq ($(MONOLITHIC),1)
|
||||
__WXLIB_MONO_p = \
|
||||
-lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)
|
||||
endif
|
||||
ifeq ($(USE_GUI),1)
|
||||
__LIB_TIFF_p = -lwxtiff$(WXDEBUGFLAG)
|
||||
endif
|
||||
ifeq ($(USE_GUI),1)
|
||||
__LIB_JPEG_p = -lwxjpeg$(WXDEBUGFLAG)
|
||||
endif
|
||||
ifeq ($(USE_GUI),1)
|
||||
__LIB_PNG_p = -lwxpng$(WXDEBUGFLAG)
|
||||
endif
|
||||
ifeq ($(MSLU),1)
|
||||
__UNICOWS_LIB_p = -lunicows
|
||||
endif
|
||||
ifeq ($(USE_GDIPLUS),1)
|
||||
__GDIPLUS_LIB_p = -lgdiplus
|
||||
endif
|
||||
ifeq ($(BUILD),debug)
|
||||
ifeq ($(DEBUG_INFO),default)
|
||||
__DEBUGINFO = -g
|
||||
endif
|
||||
endif
|
||||
ifeq ($(BUILD),release)
|
||||
ifeq ($(DEBUG_INFO),default)
|
||||
__DEBUGINFO =
|
||||
endif
|
||||
endif
|
||||
ifeq ($(DEBUG_INFO),0)
|
||||
__DEBUGINFO =
|
||||
endif
|
||||
ifeq ($(DEBUG_INFO),1)
|
||||
__DEBUGINFO = -g
|
||||
endif
|
||||
ifeq ($(USE_THREADS),0)
|
||||
__THREADSFLAG =
|
||||
endif
|
||||
ifeq ($(USE_THREADS),1)
|
||||
__THREADSFLAG = -mthreads
|
||||
endif
|
||||
|
||||
|
||||
all: $(OBJS)
|
||||
$(OBJS):
|
||||
-if not exist $(OBJS) mkdir $(OBJS)
|
||||
|
||||
all: $(OBJS_exe)
|
||||
$(OBJS_exe):
|
||||
-if not exist $(OBJS_exe) mkdir $(OBJS_exe)
|
||||
|
||||
### Targets: ###
|
||||
|
||||
all: $(OBJS_exe)\uMod.exe
|
||||
|
||||
clean:
|
||||
-if exist $(OBJS)\*.o del $(OBJS)\*.o
|
||||
-if exist $(OBJS)\*.d del $(OBJS)\*.d
|
||||
-if exist $(OBJS_exe)\uMod.exe del $(OBJS_exe)\uMod.exe
|
||||
|
||||
$(OBJS_exe)\uMod.exe: $(MINIMAL_OBJECTS) $(OBJS)\uMod_rc.o
|
||||
$(CXX) -o $@ $(MINIMAL_OBJECTS) $(LDFLAGS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lodbc32
|
||||
|
||||
$(OBJS)\uMod_rc.o: uMod.rc uMod.ico
|
||||
windres --use-temp-file -i $< -o $@
|
||||
|
||||
$(OBJS)\unzip.o: ./unzip.cpp
|
||||
$(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\uMod_DirectInjection.o: ./uMod_DirectInjection.cpp
|
||||
$(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\uMod_GUI.o: ./uMod_GUI.cpp
|
||||
$(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\uMod_GameInfo.o: ./uMod_GameInfo.cpp
|
||||
$(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\uMod_GamePage.o: ./uMod_GamePage.cpp
|
||||
$(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\uMod_Server.o: ./uMod_Server.cpp
|
||||
$(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\uMod_Client.o: ./uMod_Client.cpp
|
||||
$(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\uMod_File.o: ./uMod_File.cpp
|
||||
$(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\uMod_Sender.o: ./uMod_Sender.cpp
|
||||
$(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\uMod_Settings.o: ./uMod_Settings.cpp
|
||||
$(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\uMod_AddTexture.o: ./uMod_AddTexture.cpp
|
||||
$(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
$(OBJS)\uMod_Language.o: ./uMod_Language.cpp
|
||||
$(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
|
||||
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
|
||||
# Dependencies tracking:
|
||||
-include $(OBJS)/*.d
|
||||
+47
-15
@@ -18,7 +18,7 @@ OBJS = \
|
||||
obj
|
||||
OBJS_exe = \
|
||||
bin
|
||||
WX_DIR = D:\Programme\wxWidgets-2.9.2
|
||||
WX_DIR = D:\Programme\wxWidgets-2.9.3
|
||||
LIBDIRNAME = \
|
||||
$(WX_DIR)\lib\$(COMPILER_PREFIX)$(DIR_SUFFIX_CPU)_$(LIBTYPE_SUFFIX)$(CFG)
|
||||
SETUPHDIR = \
|
||||
@@ -37,6 +37,7 @@ MINIMAL_OBJECTS = \
|
||||
$(OBJS)\uMod_DirectInjection.obj \
|
||||
$(OBJS)\uMod_GUI.obj \
|
||||
$(OBJS)\uMod_GameInfo.obj \
|
||||
$(OBJS)\uMod_MiniPanels.obj \
|
||||
$(OBJS)\uMod_GamePage.obj \
|
||||
$(OBJS)\uMod_Server.obj \
|
||||
$(OBJS)\uMod_Client.obj \
|
||||
@@ -44,10 +45,30 @@ MINIMAL_OBJECTS = \
|
||||
$(OBJS)\uMod_Sender.obj \
|
||||
$(OBJS)\uMod_Settings.obj \
|
||||
$(OBJS)\uMod_AddTexture.obj \
|
||||
$(OBJS)\uMod_TreeView.obj \
|
||||
$(OBJS)\uMod_ModElement.obj \
|
||||
$(OBJS)\uMod_Language.obj
|
||||
MINIMAL_RESOURCES = \
|
||||
$(OBJS)\uMod_GUI.res
|
||||
|
||||
HEADERS = \
|
||||
uMod_AddTexture.h \
|
||||
uMod_Client.h \
|
||||
uMod_DirectInjection.h \
|
||||
uMod_Event.h \
|
||||
uMod_File.h \
|
||||
uMod_GameInfo.h \
|
||||
uMod_MiniPanels.h \
|
||||
uMod_GamePage.h \
|
||||
uMod_GUI.h \
|
||||
uMod_Language.h \
|
||||
uMod_Main.h \
|
||||
uMod_ModElement.h \
|
||||
uMod_Sender.h \
|
||||
uMod_Server.h \
|
||||
uMod_Settings.h \
|
||||
uMod_TreeView.h
|
||||
|
||||
### Conditionally set variables: ###
|
||||
|
||||
!if "$(USE_GUI)" == "0"
|
||||
@@ -306,6 +327,10 @@ __DLLFLAG_p = /DWXUSINGDLL
|
||||
__DLLFLAG_p_1 = /d WXUSINGDLL
|
||||
!endif
|
||||
!if "$(MONOLITHIC)" == "0"
|
||||
__WXLIB_ADV_p = \
|
||||
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_adv.lib
|
||||
!endif
|
||||
!if "$(MONOLITHIC)" == "0"
|
||||
__WXLIB_CORE_p = \
|
||||
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core.lib
|
||||
!endif
|
||||
@@ -355,47 +380,54 @@ clean:
|
||||
|
||||
$(OBJS_exe)\uMod.exe: $(MINIMAL_OBJECTS) $(OBJS)\uMod_GUI.res
|
||||
link /NOLOGO /OUT:$@ $(__DEBUGINFO_1) /pdb:"$(OBJS)\uMod_GUI.pdb" $(__DEBUGINFO_2) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
|
||||
$(MINIMAL_OBJECTS) $(MINIMAL_RESOURCES) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib
|
||||
$(MINIMAL_OBJECTS) $(MINIMAL_RESOURCES) $(__WXLIB_ADV_p) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib
|
||||
<<
|
||||
|
||||
$(OBJS)\uMod_GUI.res: uMod.rc
|
||||
rc /fo$@ /d WIN32 $(____DEBUGRUNTIME_3_p_1) $(__NO_VC_CRTDBG_p_1) /d __WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__NDEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) $(__MSLU_DEFINE_p_1) /i $(SETUPHDIR) /i . $(__DLLFLAG_p_1) /d _WINDOWS /d NOPCH uMod.rc
|
||||
|
||||
#$(OBJS)\display_display.obj: .\display.cpp
|
||||
# $(CXX) /c /nologo /TP /Fo$@ $(DISPLAY_CXXFLAGS) .\display.cpp
|
||||
|
||||
$(OBJS)\unzip.obj: .\unzip.cpp
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\unzip.cpp
|
||||
|
||||
$(OBJS)\uMod_DirectInjection.obj: .\uMod_DirectInjection.cpp
|
||||
$(OBJS)\uMod_DirectInjection.obj: .\uMod_DirectInjection.cpp $(HEADERS)
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\uMod_DirectInjection.cpp
|
||||
|
||||
$(OBJS)\uMod_GUI.obj: .\uMod_GUI.cpp
|
||||
$(OBJS)\uMod_GUI.obj: .\uMod_GUI.cpp $(HEADERS)
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\uMod_GUI.cpp
|
||||
|
||||
$(OBJS)\uMod_GameInfo.obj: .\uMod_GameInfo.cpp
|
||||
$(OBJS)\uMod_GameInfo.obj: .\uMod_GameInfo.cpp $(HEADERS)
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\uMod_GameInfo.cpp
|
||||
|
||||
$(OBJS)\uMod_GamePage.obj: .\uMod_GamePage.cpp
|
||||
$(OBJS)\uMod_MiniPanels.obj: .\uMod_MiniPanels.cpp $(HEADERS)
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\uMod_MiniPanels.cpp
|
||||
|
||||
$(OBJS)\uMod_GamePage.obj: .\uMod_GamePage.cpp $(HEADERS)
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\uMod_GamePage.cpp
|
||||
|
||||
$(OBJS)\uMod_Server.obj: .\uMod_Server.cpp
|
||||
$(OBJS)\uMod_Server.obj: .\uMod_Server.cpp $(HEADERS)
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\uMod_Server.cpp
|
||||
|
||||
$(OBJS)\uMod_Client.obj: .\uMod_Client.cpp
|
||||
$(OBJS)\uMod_Client.obj: .\uMod_Client.cpp $(HEADERS)
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\uMod_Client.cpp
|
||||
|
||||
$(OBJS)\uMod_File.obj: .\uMod_File.cpp
|
||||
$(OBJS)\uMod_File.obj: .\uMod_File.cpp $(HEADERS)
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\uMod_File.cpp
|
||||
|
||||
$(OBJS)\uMod_Sender.obj: .\uMod_Sender.cpp
|
||||
$(OBJS)\uMod_Sender.obj: .\uMod_Sender.cpp $(HEADERS)
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\uMod_Sender.cpp
|
||||
|
||||
$(OBJS)\uMod_Settings.obj: .\uMod_Settings.cpp
|
||||
$(OBJS)\uMod_Settings.obj: .\uMod_Settings.cpp $(HEADERS)
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\uMod_Settings.cpp
|
||||
|
||||
$(OBJS)\uMod_AddTexture.obj: .\uMod_AddTexture.cpp
|
||||
$(OBJS)\uMod_AddTexture.obj: .\uMod_AddTexture.cpp $(HEADERS)
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\uMod_AddTexture.cpp
|
||||
|
||||
$(OBJS)\uMod_Language.obj: .\uMod_Language.cpp
|
||||
$(OBJS)\uMod_TreeView.obj: .\uMod_TreeView.cpp $(HEADERS)
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\uMod_TreeView.cpp
|
||||
|
||||
$(OBJS)\uMod_ModElement.obj: .\uMod_ModElement.cpp $(HEADERS)
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\uMod_ModElement.cpp
|
||||
|
||||
$(OBJS)\uMod_Language.obj: .\uMod_Language.cpp $(HEADERS)
|
||||
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\uMod_Language.cpp
|
||||
|
||||
+15
-12
@@ -61,7 +61,7 @@ void* uMod_Client::Entry(void)
|
||||
{
|
||||
unsigned int pos=0;
|
||||
MsgStruct *commands;
|
||||
bool update_textures = false;
|
||||
//bool update_textures = false;
|
||||
|
||||
while (pos<=size-sizeof(MsgStruct))
|
||||
{
|
||||
@@ -72,18 +72,20 @@ void* uMod_Client::Entry(void)
|
||||
{
|
||||
case CONTROL_ADD_CLIENT:
|
||||
{
|
||||
uMod_Event event( uMod_EVENT_TYPE, ID_Add_Device);
|
||||
event.SetValue(commands->Value);
|
||||
event.SetClient(this);
|
||||
wxPostEvent( MainFrame, event);
|
||||
uMod_Event *event = new uMod_Event( uMod_EVENT_TYPE, ID_Add_Device);
|
||||
event->SetValue(commands->Value);
|
||||
event->SetClient(this);
|
||||
wxQueueEvent( MainFrame, (wxEvent*) event);
|
||||
//wxPostEvent( MainFrame, event);
|
||||
break;
|
||||
}
|
||||
case CONTROL_REMOVE_CLIENT:
|
||||
{
|
||||
uMod_Event event( uMod_EVENT_TYPE, ID_Delete_Device);
|
||||
event.SetValue(commands->Value);
|
||||
event.SetClient(this);
|
||||
wxPostEvent( MainFrame, event);
|
||||
uMod_Event *event = new uMod_Event( uMod_EVENT_TYPE, ID_Delete_Device);
|
||||
event->SetValue(commands->Value);
|
||||
event->SetClient(this);
|
||||
wxQueueEvent( MainFrame, (wxEvent*) event);
|
||||
//wxPostEvent( MainFrame, event);
|
||||
break;
|
||||
}
|
||||
case CONTROL_GAME_EXIT:
|
||||
@@ -105,9 +107,10 @@ void* uMod_Client::Entry(void)
|
||||
CloseHandle(Pipe.Out);
|
||||
Pipe.Out = INVALID_HANDLE_VALUE;
|
||||
|
||||
uMod_Event event( uMod_EVENT_TYPE, ID_Delete_Game);
|
||||
event.SetClient(this);
|
||||
wxPostEvent( MainFrame, event);
|
||||
uMod_Event *event = new uMod_Event( uMod_EVENT_TYPE, ID_Delete_Game);
|
||||
event->SetClient(this);
|
||||
wxQueueEvent( MainFrame, (wxEvent*) event);
|
||||
//wxPostEvent( MainFrame, event);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -29,20 +29,20 @@ BEGIN_DECLARE_EVENT_TYPES()
|
||||
DECLARE_EVENT_TYPE( uMod_EVENT_TYPE, -1)
|
||||
END_DECLARE_EVENT_TYPES()
|
||||
|
||||
class uMod_Event : public wxCommandEvent
|
||||
class uMod_Event : public wxThreadEvent
|
||||
{
|
||||
public:
|
||||
uMod_Event( wxEventType commandType = uMod_EVENT_TYPE, int id = 0 )
|
||||
: wxCommandEvent(commandType, id) { }
|
||||
: wxThreadEvent(commandType, id) { }
|
||||
virtual ~uMod_Event(void) {}
|
||||
|
||||
// You *must* copy here the data to be transported
|
||||
uMod_Event( const uMod_Event &event )
|
||||
: wxCommandEvent(event)
|
||||
{ this->SetText( event.GetText());
|
||||
: wxThreadEvent(event)
|
||||
{ this->SetText( event.GetText().c_str());
|
||||
Value=((uMod_Event&)event).GetValue();
|
||||
PipeIn=((uMod_Event&)event).GetPipeIn(); PipeOut=((uMod_Event&)event).GetPipeOut();
|
||||
Name=((uMod_Event&)event).GetName();
|
||||
Name=((uMod_Event&)event).GetName().c_str();
|
||||
Client=((uMod_Event&)event).GetClient();
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
uMod_Client * GetClient(void) {return Client;}
|
||||
|
||||
void SetValue(int value) {Value=value;}
|
||||
void SetName( wxString name) {Name=name;}
|
||||
void SetName( wxString name) {Name=name.c_str();}
|
||||
void SetPipeIn( HANDLE pipe) {PipeIn=pipe;}
|
||||
void SetPipeOut( HANDLE pipe) {PipeOut=pipe;}
|
||||
void SetClient( uMod_Client *client) {Client=client;}
|
||||
|
||||
+474
-159
@@ -20,11 +20,19 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
#include "unzip.h"
|
||||
|
||||
|
||||
#ifdef __CDT_PARSER__
|
||||
#define FindZipItem(...) 0
|
||||
#define UnzipItem(...) 0
|
||||
#define CloseZip(...) 0
|
||||
#define GetZipItem(...) 0
|
||||
#endif
|
||||
|
||||
|
||||
uMod_File::uMod_File(void)
|
||||
{
|
||||
Loaded=false;
|
||||
XORed=false;
|
||||
FileInMemory=NULL;
|
||||
FileInMemory=(char*)0;
|
||||
MemoryLength=0u;
|
||||
FileLen=0u;
|
||||
}
|
||||
@@ -33,7 +41,7 @@ uMod_File::uMod_File(const wxString &file)
|
||||
{
|
||||
Loaded=false;
|
||||
XORed=false;
|
||||
FileInMemory=NULL;
|
||||
FileInMemory=(char*)0;
|
||||
MemoryLength=0u;
|
||||
FileLen=0u;
|
||||
SetFile(file);
|
||||
@@ -42,7 +50,7 @@ uMod_File::uMod_File(const wxString &file)
|
||||
|
||||
uMod_File::~uMod_File(void)
|
||||
{
|
||||
if (FileInMemory!=NULL) delete [] FileInMemory;
|
||||
if (FileInMemory!=(char*)0) delete [] FileInMemory;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +65,14 @@ bool uMod_File::FileSupported(void)
|
||||
}
|
||||
|
||||
|
||||
bool uMod_File::SingleFile(void)
|
||||
{
|
||||
wxString file_type = FileName.AfterLast( '.');
|
||||
if (file_type == L"dds") return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
int uMod_File::GetComment( wxString &tool_tip)
|
||||
{
|
||||
wxString file_type = FileName.AfterLast( '.');
|
||||
@@ -103,6 +119,32 @@ int uMod_File::GetContent( AddTextureClass &tex, bool add)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
int uMod_File::GetContent( uMod_TreeViewNode* node)
|
||||
{
|
||||
wxString file_type = FileName.AfterLast( '.');
|
||||
if (file_type == L"zip")
|
||||
{
|
||||
AddZip( node);
|
||||
}
|
||||
else if (file_type == L"tpf")
|
||||
{
|
||||
AddTpf( node);
|
||||
}
|
||||
else if (file_type == L"dds")
|
||||
{
|
||||
AddFile( node);
|
||||
}
|
||||
else
|
||||
{
|
||||
LastError << Language->Error_FileNotSupported;
|
||||
LastError << "\n" << FileName;
|
||||
}
|
||||
if (LastError.Len()>0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int uMod_File::ReadFile(void)
|
||||
{
|
||||
@@ -118,9 +160,9 @@ int uMod_File::ReadFile(void)
|
||||
|
||||
if (FileLen>=MemoryLength)
|
||||
{
|
||||
if (FileInMemory!=NULL) delete [] FileInMemory;
|
||||
if (FileInMemory!=(char*)0) delete [] FileInMemory;
|
||||
try {FileInMemory = new char [FileLen+1];}
|
||||
catch (...) {FileInMemory=NULL; MemoryLength=0; FileLen=0; LastError << Language->Error_Memory; return -1;}
|
||||
catch (...) {FileInMemory=(char*)0; MemoryLength=0; FileLen=0; LastError << Language->Error_Memory; return -1;}
|
||||
MemoryLength = FileLen+1;
|
||||
}
|
||||
unsigned int result = dat.Read( FileInMemory, FileLen);
|
||||
@@ -178,103 +220,244 @@ int uMod_File::UnXOR(void)
|
||||
|
||||
|
||||
|
||||
int uMod_File::GetCommentZip( wxString &tool_tip)
|
||||
/*
|
||||
int uMod_File::AddFile( uMod_TreeViewNode* node)
|
||||
{
|
||||
DWORD64 temp_hash;
|
||||
|
||||
wxString name = FileName.AfterLast( '_');
|
||||
name = name.BeforeLast( '.');
|
||||
if (!name.ToULongLong( &temp_hash, 16)) {LastError << Language->Error_Hash <<"\n" << FileName << "\n"; return -1;} // return if hash could not be extracted
|
||||
|
||||
if (int ret = ReadFile()) return ret;
|
||||
|
||||
HZIP ZIP_Handle = OpenZip( FileInMemory, FileLen, NULL);
|
||||
if (ZIP_Handle==NULL) {tool_tip = Language->NoComment; LastError << Language->Error_Unzip; return -1;}
|
||||
uMod_TextureElement *texture = new uMod_TextureElement();
|
||||
|
||||
ZIPENTRY ze;
|
||||
int index;
|
||||
FindZipItem( ZIP_Handle, L"Comment.txt", false, &index, &ze);
|
||||
if (index>=0) //if Comment.txt is present in the zip file
|
||||
if (texture->Content().SetSize(FileLen))
|
||||
{
|
||||
char* comment;
|
||||
int len = ze.unc_size;
|
||||
try {comment=new char[len+1];}
|
||||
catch(...) {tool_tip = Language->NoComment; LastError << Language->Error_Memory; return -1;}
|
||||
ZRESULT zr = UnzipItem( ZIP_Handle, index, comment, len);
|
||||
|
||||
if (zr!=ZR_OK && zr!=ZR_MORE) {delete [] comment; tool_tip = Language->NoComment; LastError << Language->Error_Unzip <<"\nZIP:" << L"Comment.txt"; return -1;}
|
||||
comment[len]=0;
|
||||
tool_tip = comment;
|
||||
delete [] comment;
|
||||
LastError << Language->Error_Memory;
|
||||
texture->Release();
|
||||
return -1;
|
||||
}
|
||||
else tool_tip = Language->NoComment;
|
||||
char *data = texture->Content().Data();
|
||||
|
||||
CloseZip(ZIP_Handle);
|
||||
for (unsigned int i=0; i<FileLen; i++) data[i] = FileInMemory[i];
|
||||
|
||||
texture->Hash() = temp_hash;
|
||||
texture->Title() = FileName;
|
||||
texture->Status() = uMod_TextureElement::Activate;
|
||||
|
||||
uMod_ModElement *element = new uMod_ModElement(uMod_ModElement::Group, uMod_ModElement::NONE);
|
||||
element->Title() = FileName;
|
||||
node = new uMod_TreeViewNode( (uMod_TreeViewNode*)0, element);
|
||||
uMod_TreeViewNode *texture_node = new uMod_TreeViewNode( node, texture);
|
||||
node->Append(texture_node);
|
||||
|
||||
texture->Release();
|
||||
element->Release();
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
int uMod_File::AddFile( uMod_TreeViewNode* node)
|
||||
{
|
||||
DWORD64 temp_hash;
|
||||
|
||||
wxString name = FileName.AfterLast( '_');
|
||||
name = name.BeforeLast( '.');
|
||||
if (!name.ToULongLong( &temp_hash, 16)) {LastError << Language->Error_Hash <<"\n" << FileName << "\n"; return -1;} // return if hash could not be extracted
|
||||
|
||||
if (int ret = ReadFile()) return ret;
|
||||
|
||||
uMod_TextureElement *texture = new uMod_TextureElement();
|
||||
|
||||
if (texture->Content().SetSize(FileLen))
|
||||
{
|
||||
LastError << Language->Error_Memory;
|
||||
texture->Release();
|
||||
return -1;
|
||||
}
|
||||
char *data = texture->Content().Data();
|
||||
|
||||
for (unsigned int i=0; i<FileLen; i++) data[i] = FileInMemory[i];
|
||||
|
||||
texture->Hash() = temp_hash;
|
||||
texture->File() = FileName;
|
||||
texture->Status() = uMod_TextureElement::Activate;
|
||||
|
||||
|
||||
uMod_TreeViewNode *texture_node = new uMod_TreeViewNode( node, texture);
|
||||
node->Append(texture_node);
|
||||
|
||||
texture->Release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int uMod_File::GetCommentTpf( wxString &tool_tip)
|
||||
|
||||
int uMod_File::GetContentTemplate(const wxString &content, uMod_TreeViewNode* node)
|
||||
{
|
||||
uMod_TreeViewNode_ArrayPtr list_node;
|
||||
|
||||
if (uMod_TreeViewModel::String2Node( content, node, &list_node))
|
||||
{
|
||||
LastError << uMod_TreeViewModel::LastError << "\n" << FileName << "\n";
|
||||
uMod_TreeViewModel::LastError.Empty();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (node->myElement->File().IsEmpty())
|
||||
return GetContentTemplate_SF( list_node, node);
|
||||
else
|
||||
return GetContentTemplate_ZIP( list_node, node);
|
||||
}
|
||||
|
||||
int uMod_File::GetContentTemplate_ZIP( const uMod_TreeViewNode_ArrayPtr &list_node, uMod_TreeViewNode* node)
|
||||
{
|
||||
SetFile(node->myElement->File());
|
||||
if (!FileSupported())
|
||||
{
|
||||
LastError << Language->Error_FileNotSupported <<"\n" << FileName;
|
||||
return -1;
|
||||
}
|
||||
if (int ret = ReadFile()) return ret;
|
||||
wxString file_type = FileName.AfterLast( '.');
|
||||
bool tpf = false;
|
||||
if (file_type == L"tpf")
|
||||
{
|
||||
tpf = true;
|
||||
UnXOR();
|
||||
}
|
||||
|
||||
const char pw[] = {0x73, 0x2A, 0x63, 0x7D, 0x5F, 0x0A, 0xA6, 0xBD,
|
||||
0x7D, 0x65, 0x7E, 0x67, 0x61, 0x2A, 0x7F, 0x7F,
|
||||
0x74, 0x61, 0x67, 0x5B, 0x60, 0x70, 0x45, 0x74,
|
||||
0x5C, 0x22, 0x74, 0x5D, 0x6E, 0x6A, 0x73, 0x41,
|
||||
0x77, 0x6E, 0x46, 0x47, 0x77, 0x49, 0x0C, 0x4B,
|
||||
0x46, 0x6F, '\0'};
|
||||
|
||||
ZIPENTRY ze;
|
||||
int index = -1;
|
||||
HZIP ZIP_Handle;
|
||||
if (tpf) ZIP_Handle= OpenZip( FileInMemory, FileLen, pw);
|
||||
else ZIP_Handle= OpenZip( FileInMemory, FileLen, (const char*)0);
|
||||
|
||||
if (ZIP_Handle==(HZIP)0)
|
||||
{
|
||||
LastError << Language->Error_Unzip <<"\n" << FileName;
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (unsigned int i=0; i<list_node.GetCount(); i++)
|
||||
{
|
||||
if (list_node[i]->myElement->Type() == uMod_ModElement::Texture)
|
||||
{
|
||||
uMod_TextureElement *texture = (uMod_TextureElement*) list_node[i]->myElement;
|
||||
|
||||
wxString file = texture->File();
|
||||
while ( (file[0]=='.' && (file[1]=='/' || file[1]=='\\')) || file[0]=='/' || file[0]=='\\') file.Remove(0,1);
|
||||
|
||||
FindZipItem( ZIP_Handle, file.wc_str(), false, &index, &ze); // look for texture
|
||||
if (index>=0)
|
||||
{
|
||||
if (texture->Content().SetSize(ze.unc_size))
|
||||
{
|
||||
texture->Comment() = Language->Error_Memory;
|
||||
continue;
|
||||
}
|
||||
char *data = texture->Content().Data();
|
||||
|
||||
ZRESULT rz = UnzipItem( ZIP_Handle, index, data, ze.unc_size);
|
||||
if (rz!=ZR_OK && rz!=ZR_MORE)
|
||||
{
|
||||
texture->Content().SetSize(0);
|
||||
texture->Comment() = Language->Error_Unzip;
|
||||
texture->Comment() <<" : " << FileName << " ==>> " << file;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
texture->Content().SetSize(0);
|
||||
texture->Comment() = Language->Error_Unzip;
|
||||
texture->Comment() << " : " << FileName << " -> " << file;
|
||||
CloseZip(ZIP_Handle); //somehow we need to close and to reopen the zip handle, otherwise the program crashes
|
||||
if (tpf) ZIP_Handle= OpenZip( FileInMemory, FileLen, pw);
|
||||
else ZIP_Handle= OpenZip( FileInMemory, FileLen, (const char*)0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CloseZip(ZIP_Handle);
|
||||
if (node->myChildren.GetCount()==0)
|
||||
{
|
||||
LastError << Language->Error_FileIsEmpty << FileName << "\n";
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int uMod_File::GetContentTemplate_SF( const uMod_TreeViewNode_ArrayPtr &list_node, uMod_TreeViewNode* node)
|
||||
{
|
||||
DWORD64 temp_hash;
|
||||
wxString name;
|
||||
|
||||
for (unsigned int i=0; i<list_node.GetCount(); i++)
|
||||
{
|
||||
if (list_node[i]->myElement->Type() != uMod_ModElement::Texture) continue;
|
||||
|
||||
uMod_TextureElement *texture = (uMod_TextureElement*) list_node[i]->myElement;
|
||||
|
||||
SetFile( texture->File());
|
||||
if (int ret = ReadFile())
|
||||
{
|
||||
texture->Comment() = Language->Error_FileRead;
|
||||
texture->Comment() << " : " << texture->File();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (texture->Content().SetSize(FileLen))
|
||||
{
|
||||
texture->Comment() = Language->Error_Memory;
|
||||
texture->Comment() << " : " << texture->File();
|
||||
continue;
|
||||
}
|
||||
char *data = texture->Content().Data();
|
||||
|
||||
for (unsigned int i=0; i<FileLen; i++) data[i] = FileInMemory[i];
|
||||
|
||||
texture->Hash() = temp_hash;
|
||||
texture->Status() = uMod_TextureElement::Activate;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int uMod_File::AddZip( uMod_TreeViewNode* node)
|
||||
{
|
||||
if (int ret = ReadFile()) return ret;
|
||||
return AddContent( (char*)0, node);
|
||||
}
|
||||
|
||||
int uMod_File::AddTpf( uMod_TreeViewNode* node)
|
||||
{
|
||||
if (int ret = ReadFile()) return ret;
|
||||
|
||||
UnXOR();
|
||||
tool_tip = &FileInMemory[FileLen];
|
||||
tool_tip.Prepend( Language->Author);
|
||||
return 0;
|
||||
|
||||
const char pw[] = {0x73, 0x2A, 0x63, 0x7D, 0x5F, 0x0A, 0xA6, 0xBD,
|
||||
0x7D, 0x65, 0x7E, 0x67, 0x61, 0x2A, 0x7F, 0x7F,
|
||||
0x74, 0x61, 0x67, 0x5B, 0x60, 0x70, 0x45, 0x74,
|
||||
0x5C, 0x22, 0x74, 0x5D, 0x6E, 0x6A, 0x73, 0x41,
|
||||
0x77, 0x6E, 0x46, 0x47, 0x77, 0x49, 0x0C, 0x4B,
|
||||
0x46, 0x6F, '\0'};
|
||||
|
||||
return AddContent( pw, node);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int uMod_File::AddFile( AddTextureClass &tex, bool add)
|
||||
{
|
||||
tex.SetSize(1);
|
||||
unsigned long temp_hash;
|
||||
|
||||
wxString name = FileName.AfterLast( '_');
|
||||
name = name.BeforeLast( '.');
|
||||
if (!name.ToULong( &temp_hash, 16)) {LastError << Language->Error_Hash <<"\n" << FileName << "\n"; return -1;} // return if hash could not be extracted
|
||||
|
||||
if (add)
|
||||
{
|
||||
if (int ret = ReadFile()) return ret;
|
||||
|
||||
try {tex.Textures[0] = new char[FileLen];}
|
||||
catch (...) {tex.Textures[0]=NULL; LastError << Language->Error_Memory; return -1;}
|
||||
for (unsigned int i=0; i<FileLen; i++) tex.Textures[0][i] = FileInMemory[i];
|
||||
tex.Size[0] = FileLen;
|
||||
}
|
||||
else {tex.Size[0] = 0; tex.Textures[0] = NULL;}
|
||||
|
||||
tex.Num = 1;
|
||||
tex.Hash[0] = temp_hash;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int uMod_File::AddZip( AddTextureClass &tex, bool add, bool tpf)
|
||||
{
|
||||
if (int ret = ReadFile()) return ret;
|
||||
|
||||
if (tpf)
|
||||
{
|
||||
UnXOR();
|
||||
|
||||
const char pw[] = {0x73, 0x2A, 0x63, 0x7D, 0x5F, 0x0A, 0xA6, 0xBD,
|
||||
0x7D, 0x65, 0x7E, 0x67, 0x61, 0x2A, 0x7F, 0x7F,
|
||||
0x74, 0x61, 0x67, 0x5B, 0x60, 0x70, 0x45, 0x74,
|
||||
0x5C, 0x22, 0x74, 0x5D, 0x6E, 0x6A, 0x73, 0x41,
|
||||
0x77, 0x6E, 0x46, 0x47, 0x77, 0x49, 0x0C, 0x4B,
|
||||
0x46, 0x6F, '\0'};
|
||||
|
||||
return AddContent( pw, tex, add);
|
||||
}
|
||||
else
|
||||
{
|
||||
return AddContent( NULL, tex, add);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int uMod_File::AddContent( const char* pw, AddTextureClass &tex, bool add)
|
||||
int uMod_File::AddContent( const char* pw, uMod_TreeViewNode* node)
|
||||
{
|
||||
// Thats is really nasty code, but atm I am happy that it works. I should try an other unzip api,
|
||||
// This one seems to behave very strange.
|
||||
@@ -288,7 +471,9 @@ int uMod_File::AddContent( const char* pw, AddTextureClass &tex, bool add)
|
||||
//
|
||||
|
||||
HZIP ZIP_Handle = OpenZip( FileInMemory, FileLen, pw);
|
||||
if (ZIP_Handle==NULL) {LastError << Language->Error_Unzip; return -1;}
|
||||
if (ZIP_Handle==(HZIP)0) {LastError << Language->Error_Unzip; return -1;}
|
||||
|
||||
node->myElement->File() = FileName;
|
||||
|
||||
ZIPENTRY ze;
|
||||
int index;
|
||||
@@ -308,11 +493,7 @@ int uMod_File::AddContent( const char* pw, AddTextureClass &tex, bool add)
|
||||
|
||||
int num = token.CountTokens();
|
||||
|
||||
|
||||
tex.SetSize(num);
|
||||
|
||||
unsigned long temp_hash;
|
||||
int count = 0;
|
||||
DWORD64 temp_hash;
|
||||
wxString entry;
|
||||
wxString file;
|
||||
|
||||
@@ -320,122 +501,256 @@ int uMod_File::AddContent( const char* pw, AddTextureClass &tex, bool add)
|
||||
{
|
||||
entry = token.GetNextToken();
|
||||
file = entry.BeforeFirst( '|');
|
||||
if (!file.ToULong( &temp_hash, 16)) {LastError << Language->Error_Hash <<"\nTPF:" << entry << "\n"; continue;}
|
||||
if (!file.ToULongLong( &temp_hash, 16)) {LastError << Language->Error_Hash <<"\nTPF:" << entry << "\n"; continue;}
|
||||
|
||||
file = entry.AfterFirst( '|');
|
||||
file.Replace( "\r", "");
|
||||
|
||||
while ( (file[0]=='.' && (file[1]=='/' || file[1]=='\\')) || file[0]=='/' || file[0]=='\\') file.Remove(0,1);
|
||||
|
||||
if (add)
|
||||
FindZipItem( ZIP_Handle, file.wc_str(), false, &index, &ze); // look for texture
|
||||
if (index>=0)
|
||||
{
|
||||
FindZipItem( ZIP_Handle, file.wc_str(), false, &index, &ze); // look for texture
|
||||
if (index>=0)
|
||||
{
|
||||
try {tex.Textures[count] = new char[ze.unc_size];}
|
||||
catch(...)
|
||||
{
|
||||
tex.Textures[count] = NULL;
|
||||
LastError << Language->Error_Memory;
|
||||
continue;
|
||||
}
|
||||
uMod_TextureElement *texture = new uMod_TextureElement();
|
||||
|
||||
ZRESULT rz = UnzipItem( ZIP_Handle, index, tex.Textures[count], ze.unc_size);
|
||||
if (rz!=ZR_OK && rz!=ZR_MORE)
|
||||
{
|
||||
delete [] tex.Textures[count];
|
||||
LastError << Language->Error_Unzip <<"\nTPF:" << file << "\n";
|
||||
tex.Textures[count] = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
tex.Hash[count] = temp_hash;
|
||||
tex.Size[count] = ze.unc_size;
|
||||
count++;
|
||||
}
|
||||
if (texture->Content().SetSize(ze.unc_size))
|
||||
{
|
||||
LastError << Language->Error_Memory;
|
||||
texture->Release();
|
||||
continue;
|
||||
}
|
||||
char *data = texture->Content().Data();
|
||||
|
||||
ZRESULT rz = UnzipItem( ZIP_Handle, index, data, ze.unc_size);
|
||||
if (rz!=ZR_OK && rz!=ZR_MORE)
|
||||
{
|
||||
texture->Release();
|
||||
LastError << Language->Error_Unzip <<"\nTPF:" << file << "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
LastError << Language->Error_Unzip <<"\nTPF:" << file << "\n";
|
||||
CloseZip(ZIP_Handle); //somehow we need to close and to reopen the zip handle, otherwise the program crashes
|
||||
ZIP_Handle = OpenZip( FileInMemory, FileLen, pw);
|
||||
texture->Hash() = temp_hash;
|
||||
texture->Title() = file;
|
||||
texture->File() = file;
|
||||
texture->Status() = uMod_TextureElement::Activate;
|
||||
|
||||
uMod_TreeViewNode *node_texture = new uMod_TreeViewNode( node, texture);
|
||||
node->Append(node_texture);
|
||||
texture->Release();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tex.Hash[count] = temp_hash;
|
||||
tex.Size[count] = 0;
|
||||
count++;
|
||||
LastError << Language->Error_Unzip <<"\nTPF:" << file << "\n";
|
||||
CloseZip(ZIP_Handle); //somehow we need to close and to reopen the zip handle, otherwise the program crashes
|
||||
ZIP_Handle = OpenZip( FileInMemory, FileLen, pw);
|
||||
}
|
||||
}
|
||||
delete [] def;
|
||||
tex.Num = count;
|
||||
|
||||
wxString temp = &FileInMemory[FileLen];
|
||||
node->myElement->Author() = temp.BeforeFirst('\n');
|
||||
node->myElement->Author().Replace("\r", "", true);
|
||||
node->myElement->Author().Replace("\n", "", true);
|
||||
|
||||
node->myElement->Comment() = temp.AfterFirst('\n');
|
||||
node->myElement->Comment().Replace("\r\n", " ; ", true);
|
||||
node->myElement->Comment().Replace("\n", " ; ", true);
|
||||
|
||||
CloseZip(ZIP_Handle);
|
||||
|
||||
if (node->myChildren.GetCount()==0)
|
||||
{
|
||||
LastError << Language->Error_FileIsEmpty << FileName << "\n";
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else // texmod.def is not present in the zip file
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CloseZip(ZIP_Handle); //somehow we need to close and to reopen the zip handle, otherwise the program crashes
|
||||
ZIP_Handle = OpenZip( FileInMemory, FileLen, pw);
|
||||
if (ZIP_Handle==(HZIP)0) {LastError << Language->Error_Unzip; return -1;}
|
||||
FindZipItem( ZIP_Handle, L"content.txt", false, &index, &ze);
|
||||
|
||||
|
||||
|
||||
|
||||
if (index>=0) //if content.txt is present in the zip file
|
||||
{
|
||||
char* def;
|
||||
int len = ze.unc_size;
|
||||
try {def=new char[len+1];}
|
||||
catch(...) {LastError << Language->Error_Memory; return -1;}
|
||||
ZRESULT zr = UnzipItem( ZIP_Handle, index, def, len);
|
||||
|
||||
if (zr!=ZR_OK && zr!=ZR_MORE) {delete [] def; return -1;}
|
||||
def[len]=0;
|
||||
|
||||
wxString content = def;
|
||||
|
||||
uMod_TreeViewNode_ArrayPtr list_node;
|
||||
|
||||
if (uMod_TreeViewModel::String2Node( content, node, &list_node))
|
||||
{
|
||||
LastError << uMod_TreeViewModel::LastError << "\n" << FileName << "\n";
|
||||
uMod_TreeViewModel::LastError.Empty();
|
||||
return -1;
|
||||
}
|
||||
|
||||
// overwrite file information
|
||||
node->myElement->File() = FileName;
|
||||
|
||||
for (unsigned int i=0; i< list_node.GetCount(); i++)
|
||||
{
|
||||
if (list_node[i]->myElement->Type() == uMod_ModElement::Texture)
|
||||
{
|
||||
uMod_TextureElement *texture = (uMod_TextureElement*) list_node[i]->myElement;
|
||||
|
||||
wxString file = texture->File();
|
||||
while ( (file[0]=='.' && (file[1]=='/' || file[1]=='\\')) || file[0]=='/' || file[0]=='\\') file.Remove(0,1);
|
||||
|
||||
FindZipItem( ZIP_Handle, file.wc_str(), false, &index, &ze); // look for texture
|
||||
if (index>=0)
|
||||
{
|
||||
if (texture->Content().SetSize(ze.unc_size))
|
||||
{
|
||||
texture->Comment() = Language->Error_Memory;
|
||||
continue;
|
||||
}
|
||||
char *data = texture->Content().Data();
|
||||
|
||||
ZRESULT rz = UnzipItem( ZIP_Handle, index, data, ze.unc_size);
|
||||
if (rz!=ZR_OK && rz!=ZR_MORE)
|
||||
{
|
||||
texture->Content().SetSize(0);
|
||||
texture->Comment() = Language->Error_Unzip;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
texture->Content().SetSize(0);
|
||||
texture->Comment() = Language->Error_Unzip;
|
||||
CloseZip(ZIP_Handle); //somehow we need to close and to reopen the zip handle, otherwise the program crashes
|
||||
ZIP_Handle = OpenZip( FileInMemory, FileLen, pw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CloseZip(ZIP_Handle);
|
||||
if (node->myChildren.GetCount()==0)
|
||||
{
|
||||
LastError << Language->Error_FileIsEmpty << FileName << "\n";
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//we load each dds file
|
||||
{
|
||||
CloseZip(ZIP_Handle); //somehow we need to close and to reopen the zip handle, otherwise the program crashes
|
||||
ZIP_Handle = OpenZip( FileInMemory, FileLen, pw);
|
||||
if (ZIP_Handle==NULL) {LastError << Language->Error_Unzip; return -1;}
|
||||
if (ZIP_Handle==(HZIP)0) {LastError << Language->Error_Unzip; return -1;}
|
||||
wxString name;
|
||||
wxString file;
|
||||
GetZipItem( ZIP_Handle, -1, &ze); //ask for number of entries
|
||||
int num = ze.index;
|
||||
|
||||
tex.SetSize(num);
|
||||
int count = 0;
|
||||
unsigned long temp_hash;
|
||||
DWORD64 temp_hash;
|
||||
for (int i=0; i<num; i++)
|
||||
{
|
||||
if (GetZipItem( ZIP_Handle, i, &ze)!=ZR_OK) continue; //ask for name and size
|
||||
int len = ze.unc_size;
|
||||
|
||||
char *buffer;
|
||||
try {buffer = new char[len+1];}
|
||||
catch(...)
|
||||
uMod_TextureElement *texture = new uMod_TextureElement();
|
||||
|
||||
if (texture->Content().SetSize(ze.unc_size))
|
||||
{
|
||||
LastError << Language->Error_Memory;
|
||||
texture->Release();
|
||||
continue;
|
||||
}
|
||||
char *data = texture->Content().Data();
|
||||
|
||||
ZRESULT rz = UnzipItem( ZIP_Handle, i, data, len);
|
||||
if (rz!=ZR_OK && rz!=ZR_MORE)
|
||||
{
|
||||
texture->Release();
|
||||
LastError << Language->Error_Unzip <<"\nZIP:" << FileName << "\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
ZRESULT rz = UnzipItem( ZIP_Handle, i, buffer, len);
|
||||
if (rz!=ZR_OK && rz!=ZR_MORE)
|
||||
file = ze.name;
|
||||
if (file.Len()==0)
|
||||
{
|
||||
delete [] buffer;
|
||||
buffer = NULL;
|
||||
LastError << Language->Error_Unzip <<"\nZIP:" << file << "\n";
|
||||
texture->Release();
|
||||
continue;
|
||||
}
|
||||
|
||||
file = ze.name;
|
||||
if (file.Len()==0) continue;
|
||||
if (file == "Comment.txt") // load comment
|
||||
{
|
||||
char *buffer;
|
||||
try {buffer = new char [len+1];}
|
||||
catch (...)
|
||||
{
|
||||
LastError << Language->Error_Memory;
|
||||
texture->Release();
|
||||
continue;
|
||||
}
|
||||
for (int i=0; i<len; i++) buffer[i] = data[i];
|
||||
buffer[len]=0;
|
||||
|
||||
node->myElement->Comment() = buffer;
|
||||
|
||||
node->myElement->Comment().Replace("\r\n", " ; ", true);
|
||||
node->myElement->Comment().Replace("\n", " ; ", true);
|
||||
|
||||
delete [] buffer;
|
||||
texture->Release();
|
||||
continue;
|
||||
}
|
||||
|
||||
name = file.AfterLast( '.');
|
||||
if (name!="dds") continue; //if this is not texture file, continue
|
||||
if (name!="dds")
|
||||
{
|
||||
texture->Release();
|
||||
continue;
|
||||
}
|
||||
|
||||
name = file.AfterLast( '_');
|
||||
name = name.BeforeLast( '.');
|
||||
|
||||
if (!name.ToULong( &temp_hash, 16)) {LastError << Language->Error_Hash <<"\nZIP:" << file << "\n"; continue;} //if hash could not be extracted
|
||||
|
||||
if (add)
|
||||
if (!name.ToULongLong( &temp_hash, 16))
|
||||
{
|
||||
if (buffer==NULL) continue;
|
||||
texture->Release();
|
||||
LastError << Language->Error_Hash <<"\nZIP:" << file << "\n";
|
||||
continue;
|
||||
} //if hash could not be extracted
|
||||
|
||||
tex.Textures[count] = buffer;
|
||||
tex.Hash[count] = temp_hash;
|
||||
tex.Size[count] = len;//ze.unc_size;
|
||||
count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (buffer!=NULL) delete [] buffer;
|
||||
tex.Hash[count] = temp_hash;
|
||||
tex.Size[count] = 0;
|
||||
count++;
|
||||
}
|
||||
|
||||
texture->Hash() = temp_hash;
|
||||
texture->Title() = ze.name;
|
||||
texture->File() = ze.name;
|
||||
texture->Status() = uMod_TextureElement::Activate;
|
||||
|
||||
uMod_TreeViewNode *node_texture = new uMod_TreeViewNode( node, texture);
|
||||
node->Append(node_texture);
|
||||
texture->Release();
|
||||
}
|
||||
tex.Num = count;
|
||||
}
|
||||
|
||||
CloseZip(ZIP_Handle);
|
||||
CloseZip(ZIP_Handle);
|
||||
|
||||
if (node->myChildren.GetCount()==0)
|
||||
{
|
||||
LastError << Language->Error_FileIsEmpty << FileName << "\n";
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
+15
-3
@@ -29,9 +29,15 @@ public:
|
||||
~uMod_File(void);
|
||||
|
||||
bool FileSupported(void);
|
||||
bool SingleFile(void);
|
||||
//int AddSingleFileToNode( uMod_TreeViewNode* node);
|
||||
int GetContentTemplate(const wxString &content, uMod_TreeViewNode* node);
|
||||
|
||||
/*
|
||||
int GetComment( wxString &tool_tip);
|
||||
int GetContent( AddTextureClass &tex, bool add);
|
||||
*/
|
||||
int GetContent( uMod_TreeViewNode* node);
|
||||
|
||||
int SetFile(const wxString &file) {FileName=file;Loaded=false; return 0;}
|
||||
wxString GetFile(void) {return FileName;}
|
||||
@@ -43,12 +49,18 @@ private:
|
||||
int ReadFile(void);
|
||||
|
||||
int UnXOR(void);
|
||||
/*
|
||||
int GetCommentZip( wxString &tool_tip);
|
||||
int GetCommentTpf( wxString &tool_tip);
|
||||
*/
|
||||
int AddFile( uMod_TreeViewNode* node);
|
||||
int AddZip( uMod_TreeViewNode* node);
|
||||
int AddTpf( uMod_TreeViewNode* node);
|
||||
|
||||
int AddFile( AddTextureClass &tex, bool add);
|
||||
int AddZip( AddTextureClass &tex, bool add, bool tpf);
|
||||
int AddContent( const char* pw, AddTextureClass &tex, bool add);
|
||||
int AddContent( const char* pw, uMod_TreeViewNode* node);
|
||||
|
||||
int GetContentTemplate_ZIP( const uMod_TreeViewNode_ArrayPtr &list_node, uMod_TreeViewNode* node);
|
||||
int GetContentTemplate_SF( const uMod_TreeViewNode_ArrayPtr &list_node, uMod_TreeViewNode* node);
|
||||
|
||||
wxString FileName;
|
||||
bool Loaded;
|
||||
|
||||
+64
-51
@@ -33,10 +33,10 @@ DEFINE_EVENT_TYPE(uMod_EVENT_TYPE)
|
||||
BEGIN_EVENT_TABLE(uMod_Frame, wxFrame)
|
||||
EVT_CLOSE(uMod_Frame::OnClose)
|
||||
|
||||
EVT_BUTTON(ID_Button_Open, uMod_Frame::OnButtonOpen)
|
||||
EVT_BUTTON(ID_Button_Path, uMod_Frame::OnButtonPath)
|
||||
EVT_BUTTON(ID_Button_Update, uMod_Frame::OnButtonUpdate)
|
||||
EVT_BUTTON(ID_Button_Reload, uMod_Frame::OnButtonReload)
|
||||
//EVT_BUTTON(ID_Button_Open, uMod_Frame::OnButtonOpen)
|
||||
//EVT_BUTTON(ID_Button_Path, uMod_Frame::OnButtonPath)
|
||||
//EVT_BUTTON(ID_Button_Update, uMod_Frame::OnButtonUpdate)
|
||||
//EVT_BUTTON(ID_Button_Reload, uMod_Frame::OnButtonReload)
|
||||
|
||||
EVT_MENU(ID_Menu_Help, uMod_Frame::OnMenuHelp)
|
||||
EVT_MENU(ID_Menu_About, uMod_Frame::OnMenuAbout)
|
||||
@@ -137,23 +137,18 @@ uMod_Frame::uMod_Frame(const wxString& title, uMod_Settings &set)
|
||||
|
||||
MainSizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
Notebook = new wxNotebook( this, wxID_ANY);
|
||||
Notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE);
|
||||
Notebook->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENU));
|
||||
MainSizer->Add( (wxWindow*) Notebook, 1, wxEXPAND , 0 );
|
||||
|
||||
ButtonSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
OpenButton = new wxButton( this, ID_Button_Open, Language->ButtonOpen, wxDefaultPosition, wxSize(100,24));
|
||||
DirectoryButton = new wxButton( this, ID_Button_Path, Language->ButtonDirectory, wxDefaultPosition, wxSize(100,24));
|
||||
UpdateButton = new wxButton( this, ID_Button_Update, Language->ButtonUpdate, wxDefaultPosition, wxSize(100,24));
|
||||
ReloadButton = new wxButton( this, ID_Button_Reload, Language->ButtonReload, wxDefaultPosition, wxSize(100,24));
|
||||
|
||||
ButtonSizer->Add( (wxWindow*) OpenButton, 1, wxEXPAND, 0);
|
||||
ButtonSizer->Add( (wxWindow*) DirectoryButton, 1, wxEXPAND, 0);
|
||||
ButtonSizer->Add( (wxWindow*) UpdateButton, 1, wxEXPAND, 0);
|
||||
ButtonSizer->Add( (wxWindow*) ReloadButton, 1, wxEXPAND, 0);
|
||||
MainSizer->Add( ButtonSizer, 0, wxEXPAND , 0 );
|
||||
|
||||
PipeStruct pipe = {INVALID_HANDLE_VALUE,INVALID_HANDLE_VALUE};
|
||||
uMod_GamePage *page = new uMod_GamePage( Notebook, "uMod", INVALID_GAME_PAGE, "templates/uMod.txt", pipe);
|
||||
if (page->LastError.Len()>0)
|
||||
{
|
||||
wxMessageBox(page->LastError, "ERROR", wxOK|wxICON_ERROR);
|
||||
delete page;
|
||||
}
|
||||
else Notebook->AddPage( page, page->GetPageName(), true);
|
||||
|
||||
SetSizer( MainSizer);
|
||||
|
||||
@@ -213,12 +208,22 @@ int uMod_Frame::KillServer(void)
|
||||
|
||||
if (pipe == INVALID_HANDLE_VALUE) return -1;
|
||||
|
||||
// prepend a zero int value as dummy injection method
|
||||
const wchar_t *str = ABORT_SERVER;
|
||||
unsigned int len=0u;
|
||||
while (str[len]) len++;
|
||||
len++; //to send also the zero
|
||||
|
||||
char *buffer=(char*)0;
|
||||
GetMemory(buffer, sizeof(int) + len * sizeof(wchar_t));
|
||||
*((int*) buffer) = 0;
|
||||
char *p_game = (char*) str;
|
||||
|
||||
for (unsigned int i=0; i<len*sizeof(wchar_t); i++) buffer[i+sizeof(int)] = p_game[i];
|
||||
unsigned long num;
|
||||
WriteFile( pipe, (const void*) str, len*sizeof(wchar_t), &num, NULL);
|
||||
//WriteFile( pipe, (const void*) &len, sizeof(int), &num, NULL); //dummy injection method
|
||||
WriteFile( pipe, (const void*) buffer, len*sizeof(wchar_t)+sizeof(int), &num, NULL);
|
||||
delete [] buffer;
|
||||
CloseHandle(pipe);
|
||||
return 0;
|
||||
}
|
||||
@@ -242,6 +247,7 @@ void uMod_Frame::OnAddGame( wxCommandEvent &event)
|
||||
|
||||
pipe.In = ((uMod_Event&)event).GetPipeIn();
|
||||
pipe.Out = ((uMod_Event&)event).GetPipeOut();
|
||||
int injection_method = ((uMod_Event&)event).GetValue();
|
||||
|
||||
uMod_Client *client = new uMod_Client( pipe, this);
|
||||
client->Create();
|
||||
@@ -255,7 +261,7 @@ void uMod_Frame::OnAddGame( wxCommandEvent &event)
|
||||
break;
|
||||
}
|
||||
|
||||
uMod_GamePage *page = new uMod_GamePage( Notebook, name, save_file, client->Pipe);
|
||||
uMod_GamePage *page = new uMod_GamePage( Notebook, name, injection_method, save_file, client->Pipe);
|
||||
if (page->LastError.Len()>0)
|
||||
{
|
||||
wxMessageBox(page->LastError, "ERROR", wxOK|wxICON_ERROR);
|
||||
@@ -274,7 +280,7 @@ void uMod_Frame::OnDeleteGame( wxCommandEvent &event)
|
||||
uMod_Client *client = ((uMod_Event&)event).GetClient();
|
||||
for (int i=0; i<NumberOfGames; i++) if (Clients[i]==client)
|
||||
{
|
||||
Notebook->DeletePage(i);
|
||||
Notebook->DeletePage(i+1);
|
||||
Clients[i]->Wait();
|
||||
delete Clients[i];
|
||||
NumberOfGames--;
|
||||
@@ -287,45 +293,60 @@ void uMod_Frame::OnDeleteGame( wxCommandEvent &event)
|
||||
|
||||
void uMod_Frame::OnAddDevice( wxCommandEvent &event)
|
||||
{
|
||||
|
||||
uMod_Client *client = ((uMod_Event&)event).GetClient();
|
||||
for (int i=0; i<NumberOfGames; i++) if (Clients[i]==client)
|
||||
{
|
||||
uMod_GamePage *page = (uMod_GamePage*) Notebook->GetPage(i);
|
||||
uMod_GamePage *page = (uMod_GamePage*) Notebook->GetPage(i+1);
|
||||
page->AddDXDevice(((uMod_Event&)event).GetValue());
|
||||
Notebook->SetPageText( i, page->GetPageName());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void uMod_Frame::OnRemoveDevice( wxCommandEvent &event)
|
||||
{
|
||||
/*
|
||||
uMod_Client *client = ((uMod_Event&)event).GetClient();
|
||||
for (int i=0; i<NumberOfGames; i++) if (Clients[i]==client)
|
||||
{
|
||||
uMod_GamePage *page = (uMod_GamePage*) Notebook->GetPage(i);
|
||||
wxMessageBox("removed");
|
||||
uMod_GamePage *page = (uMod_GamePage*) Notebook->GetPage(i+1);
|
||||
page->RemoveDXDevice(((uMod_Event&)event).GetValue());
|
||||
Notebook->SetPageText( i, page->GetPageName());
|
||||
return;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void uMod_Frame::OnClose(wxCloseEvent& event)
|
||||
{
|
||||
if (event.CanVeto() && NumberOfGames>0)
|
||||
{
|
||||
if (wxMessageBox(Language->ExitGameAnyway, "ERROR", wxYES_NO|wxICON_ERROR)!=wxYES) {event.Veto(); return;}
|
||||
if (wxMessageBox(Language->ExitGameAnyway, "ERROR", wxYES_NO|wxICON_ERROR)!=wxYES)
|
||||
{
|
||||
event.Veto();
|
||||
return;
|
||||
}
|
||||
}
|
||||
event.Skip();
|
||||
//event.Skip();
|
||||
Destroy();
|
||||
}
|
||||
|
||||
/*
|
||||
void uMod_Frame::OnButtonOpen(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if (Notebook->GetPageCount()==0) return;
|
||||
uMod_GamePage *page = (uMod_GamePage*) Notebook->GetCurrentPage();
|
||||
if (page==NULL) return;
|
||||
|
||||
wxString temp = "D:\\Code\\uMod\\temp\\bf.tpf";
|
||||
if (page->AddTexture( temp)) wxMessageBox(page->LastError);
|
||||
|
||||
temp = "D:\\Code\\uMod\\temp\\tex.zip";
|
||||
if (page->AddTexture( temp)) wxMessageBox(page->LastError);
|
||||
|
||||
temp = "D:\\Code\\uMod\\temp\\test.zip";
|
||||
if (page->AddTexture( temp)) wxMessageBox(page->LastError);
|
||||
|
||||
return;
|
||||
//wxString file_name = wxFileSelector( Language->ChooseFile, page->GetOpenPath(), "", "*.*", "textures (*.dds)|*.dds|zip (*.zip)|*.zip|tpf (*.tpf)|*.tpf", wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
|
||||
wxString file_name = wxFileSelector( Language->ChooseFile, page->GetOpenPath(), "", "", "", wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
|
||||
if ( !file_name.empty() )
|
||||
@@ -375,7 +396,7 @@ void uMod_Frame::OnButtonReload(wxCommandEvent& WXUNUSED(event))
|
||||
page->LastError.Empty();
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -431,7 +452,6 @@ void uMod_Frame::OnMenuSaveTemplateAs(wxCommandEvent& WXUNUSED(event))
|
||||
uMod_GamePage *page = (uMod_GamePage*) Notebook->GetCurrentPage();
|
||||
if (page==NULL) return;
|
||||
|
||||
|
||||
wxString dir = wxGetCwd();
|
||||
dir << "/templates";
|
||||
wxString file_name = wxFileSelector( Language->ChooseFile, dir, "", "*.txt", "text (*.txt)|*.txt", wxFD_SAVE | wxFD_OVERWRITE_PROMPT, this);
|
||||
@@ -450,6 +470,7 @@ void uMod_Frame::OnMenuSetDefaultTemplate(wxCommandEvent& WXUNUSED(event))
|
||||
if (Notebook->GetPageCount()==0) return;
|
||||
uMod_GamePage *page = (uMod_GamePage*) Notebook->GetCurrentPage();
|
||||
if (page==NULL) return;
|
||||
if (page == (uMod_GamePage*) Notebook->GetPage(0)) return;
|
||||
|
||||
wxString exe = page->GetExeName();
|
||||
wxString file = page->GetTemplateName();
|
||||
@@ -508,12 +529,12 @@ void uMod_Frame::OnMenuLanguage(wxCommandEvent& WXUNUSED(event))
|
||||
MenuHelp->SetLabel( ID_Menu_About, Language->MenuAbout);
|
||||
MenuHelp->SetLabel( ID_Menu_Acknowledgement, Language->MenuAcknowledgement);
|
||||
|
||||
|
||||
/*
|
||||
OpenButton->SetLabel( Language->ButtonOpen);
|
||||
DirectoryButton->SetLabel( Language->ButtonDirectory);
|
||||
UpdateButton->SetLabel( Language->ButtonUpdate);
|
||||
ReloadButton->SetLabel( Language->ButtonReload);
|
||||
|
||||
*/
|
||||
int num = Notebook->GetPageCount();
|
||||
for (int i=0; i<num; i++)
|
||||
{
|
||||
@@ -544,23 +565,25 @@ void uMod_Frame::OnMenuHelp(wxCommandEvent& WXUNUSED(event))
|
||||
void uMod_Frame::OnMenuAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString msg;
|
||||
msg << uMod_VERSION << "\n\nProject members:\n\nROTA (developer)\nKing Brace Blane (PR)\n\nhttp://code.google.com/p/texmod/";
|
||||
msg << uMod_VERSION << "\n\nProject members:\n\nROTA (developer)\n\nKing Brace Blane (PR)\n\nhttp://code.google.com/p/texmod/";
|
||||
wxMessageBox( msg, "Info", wxOK);
|
||||
}
|
||||
|
||||
void uMod_Frame::OnMenuAcknowledgement(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString msg;
|
||||
msg << "King Brace Blane and ROTA thank:\n\n";
|
||||
msg << "ROTA thanks:\n\n";
|
||||
msg << "RS for coding the original TexMod and for information about the used hashing algorithm\n\n";
|
||||
msg << "EvilAlex for translation into Russian and bug fixing\n";
|
||||
msg << "ReRRemi for translation into French";
|
||||
msg << "\n\n";
|
||||
//msg << "King Brace Blane for a tutorial video on YouTube and bug fixing";
|
||||
wxMessageBox( msg, Language->MenuAcknowledgement, wxOK);
|
||||
}
|
||||
|
||||
void uMod_Frame::OnMenuStartGame(wxCommandEvent& event)
|
||||
{
|
||||
|
||||
bool use_cmd = false;
|
||||
if (event.GetId() == ID_Menu_StartGameCMD) use_cmd = true;
|
||||
|
||||
@@ -636,8 +659,8 @@ void uMod_Frame::OnMenuStartGame(wxCommandEvent& event)
|
||||
|
||||
|
||||
wxString dll = wxGetCwd();
|
||||
//dll.Append( L"\\" uMod_d3d9_DI_dll);
|
||||
dll.Append( L"\\uMod_d3d10_DI.dll");
|
||||
dll.Append( L"\\" uMod_d3d9_DI_dll);
|
||||
//dll.Append( L"\\uMod_d3d10_DI.dll");
|
||||
|
||||
Inject(pi.hProcess, dll.wc_str(), "Nothing");
|
||||
ResumeThread(pi.hThread);
|
||||
@@ -720,32 +743,23 @@ void uMod_Frame::OnMenuDeleteGame(wxCommandEvent& WXUNUSED(event))
|
||||
|
||||
int uMod_Frame::ActivateGamesControl(void)
|
||||
{
|
||||
/*
|
||||
MenuMain->Enable( ID_Menu_LoadTemplate, true);
|
||||
MenuMain->Enable( ID_Menu_SaveTemplate, true);
|
||||
MenuMain->Enable( ID_Menu_SaveTemplateAs, true);
|
||||
*/
|
||||
MenuMain->Enable( ID_Menu_SetDefaultTemplate, true);
|
||||
|
||||
|
||||
OpenButton->Enable( true);
|
||||
DirectoryButton->Enable( true);
|
||||
UpdateButton->Enable( true);
|
||||
ReloadButton->Enable( true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int uMod_Frame::DeactivateGamesControl(void)
|
||||
{
|
||||
/*
|
||||
MenuMain->Enable( ID_Menu_LoadTemplate, false);
|
||||
MenuMain->Enable( ID_Menu_SaveTemplate, false);
|
||||
MenuMain->Enable( ID_Menu_SaveTemplateAs, false);
|
||||
*/
|
||||
MenuMain->Enable( ID_Menu_SetDefaultTemplate, false);
|
||||
|
||||
|
||||
OpenButton->Enable( false);
|
||||
DirectoryButton->Enable( false);
|
||||
UpdateButton->Enable( false);
|
||||
ReloadButton->Enable( false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -963,8 +977,7 @@ void uMod_Frame::InstallHook(void)
|
||||
{
|
||||
if (H_DX9_DLL==NULL)
|
||||
{
|
||||
//H_DX9_DLL = LoadLibraryW(uMod_d3d9_Hook_dll);
|
||||
H_DX9_DLL = LoadLibraryW(L"uMod_d3d10_HI.dll");
|
||||
H_DX9_DLL = LoadLibraryW(uMod_d3d9_Hook_dll);
|
||||
if (H_DX9_DLL!=NULL)
|
||||
{
|
||||
typedef void (*fkt_typ)(void);
|
||||
|
||||
+5
-5
@@ -60,12 +60,12 @@ public:
|
||||
*/
|
||||
void OnClose(wxCloseEvent& WXUNUSED(event));
|
||||
|
||||
|
||||
/*
|
||||
void OnButtonOpen(wxCommandEvent& WXUNUSED(event));
|
||||
void OnButtonPath(wxCommandEvent& WXUNUSED(event));
|
||||
void OnButtonUpdate(wxCommandEvent& WXUNUSED(event));
|
||||
void OnButtonReload(wxCommandEvent& WXUNUSED(event));
|
||||
|
||||
*/
|
||||
void OnMenuStartGame( wxCommandEvent &event);
|
||||
|
||||
void OnMenuUseHook( wxCommandEvent &event);
|
||||
@@ -101,19 +101,19 @@ private:
|
||||
|
||||
wxNotebook *Notebook;
|
||||
|
||||
|
||||
/*
|
||||
wxButton *OpenButton;
|
||||
wxButton *DirectoryButton;
|
||||
wxButton *UpdateButton;
|
||||
wxButton *ReloadButton;
|
||||
|
||||
*/
|
||||
|
||||
wxMenuBar *MenuBar;
|
||||
wxMenu *MenuMain;
|
||||
wxMenu *MenuHelp;
|
||||
|
||||
wxBoxSizer *MainSizer;
|
||||
wxBoxSizer *ButtonSizer;
|
||||
//wxBoxSizer *ButtonSizer;
|
||||
|
||||
|
||||
int NumberOfGames;
|
||||
|
||||
+202
-173
@@ -24,263 +24,296 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
uMod_GameInfo::uMod_GameInfo(void)
|
||||
{
|
||||
Checked = NULL;
|
||||
NumberOfChecked = 0;
|
||||
LengthOfChecked = 0;
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
uMod_GameInfo::~uMod_GameInfo(void)
|
||||
{
|
||||
if (Checked!=NULL) delete [] Checked;
|
||||
}
|
||||
|
||||
void uMod_GameInfo::Init(void)
|
||||
{
|
||||
myShowCollPane = false;
|
||||
|
||||
SaveSingleTexture = false;
|
||||
SaveAllTextures = false;
|
||||
myShowSingleTextureString = false;
|
||||
mySupportTPF = false;
|
||||
|
||||
KeyBack = -1;
|
||||
KeySave = -1;
|
||||
KeyNext = -1;
|
||||
FontColour[0]=255;FontColour[1]=0;FontColour[2]=0;
|
||||
TextureColour[0]=0;TextureColour[1]=255;TextureColour[2]=0;
|
||||
NumberOfChecked = 0;
|
||||
FontColour[0]=255;FontColour[1]=0;FontColour[2]=0;FontColour[3]=255;
|
||||
TextureColour[0]=0;TextureColour[1]=255;TextureColour[2]=0;TextureColour[3]=255;
|
||||
|
||||
myUseSizeFilter = false;
|
||||
myHeightMin = 1;
|
||||
myHeightMax = 1;
|
||||
myWidthMin = 1;
|
||||
myWidthMax = 1;
|
||||
myDepthMin = 1;
|
||||
myDepthMax = 1;
|
||||
|
||||
myUseFormatFilter = false;
|
||||
myFormatFilter = 0u;
|
||||
myFileFormat = uMod_D3DXIFF_DDS;
|
||||
|
||||
SavePath.Empty();
|
||||
OpenPath.Empty();
|
||||
Files.Empty();
|
||||
}
|
||||
|
||||
int uMod_GameInfo::SaveToFile( const wxString &file_name)
|
||||
int uMod_GameInfo::SaveToString( wxString &content )
|
||||
{
|
||||
wxFile file;
|
||||
content.Empty();
|
||||
|
||||
//if (!file.Access(name, wxFile::write)) return -1;
|
||||
file.Open(file_name, wxFile::write);
|
||||
if (!file.IsOpened()) {return -1;}
|
||||
wxString temp;
|
||||
|
||||
temp.Printf( "ShowCollPane:%d\n", myShowCollPane);
|
||||
content << temp;
|
||||
|
||||
wxString content;
|
||||
if (SavePath.Len()>0)
|
||||
{
|
||||
content.Printf( L"SavePath:%ls\n", SavePath.wc_str());
|
||||
file.Write( content.char_str(), content.Len());
|
||||
temp.Printf( "SavePath:%ls\n", SavePath.wc_str());
|
||||
content << temp;
|
||||
}
|
||||
|
||||
if (OpenPath.Len()>0)
|
||||
{
|
||||
content.Printf( L"OpenPath:%ls\n", OpenPath.wc_str());
|
||||
file.Write( content.char_str(), content.Len());
|
||||
temp.Printf( "OpenPath:%ls\n", OpenPath.wc_str());
|
||||
content << temp;
|
||||
}
|
||||
|
||||
content.Printf( L"SaveAllTextures:%d\nSaveSingleTexture:%d\n", SaveAllTextures, SaveSingleTexture);
|
||||
file.Write( content.char_str(), content.Len());
|
||||
temp.Printf( "SaveAllTextures:%d\nSaveSingleTexture:%d\n", SaveAllTextures, SaveSingleTexture);
|
||||
content << temp;
|
||||
|
||||
temp.Printf( "ShowSingleTextureString:%d\n", myShowSingleTextureString);
|
||||
content << temp;
|
||||
|
||||
temp.Printf( "SupportTPF:%d\n", mySupportTPF);
|
||||
content << temp;
|
||||
|
||||
if (KeyBack>=0)
|
||||
{
|
||||
content.Printf( L"KeyBack:%d\n", KeyBack);
|
||||
file.Write( content.char_str(), content.Len());
|
||||
temp.Printf( "KeyBack:%d\n", KeyBack);
|
||||
content << temp;
|
||||
}
|
||||
if (KeySave>=0)
|
||||
{
|
||||
content.Printf( L"KeySave:%d\n", KeySave);
|
||||
file.Write( content.char_str(), content.Len());
|
||||
temp.Printf( "KeySave:%d\n", KeySave);
|
||||
content << temp;
|
||||
}
|
||||
if (KeyNext>=0)
|
||||
{
|
||||
content.Printf( L"KeyNext:%d\n", KeyNext);
|
||||
file.Write( content.char_str(), content.Len());
|
||||
temp.Printf( "KeyNext:%d\n", KeyNext);
|
||||
content << temp;
|
||||
}
|
||||
temp.Printf("UseSizeFilter:%d\n", myUseSizeFilter);
|
||||
content << temp;
|
||||
temp.Printf( "Height:%d,%d\n", myHeightMin, myHeightMax);
|
||||
content << temp;
|
||||
temp.Printf( "Width:%d,%d\n", myWidthMin, myWidthMax);
|
||||
content << temp;
|
||||
temp.Printf( "Depth:%d,%d\n", myDepthMin, myDepthMax);
|
||||
content << temp;
|
||||
|
||||
content.Printf( L"FontColour:%d,%d,%d\n", FontColour[0], FontColour[1], FontColour[2]);
|
||||
file.Write( content.char_str(), content.Len());
|
||||
content.Printf( L"TextureColour:%d,%d,%d\n", TextureColour[0], TextureColour[1], TextureColour[2]);
|
||||
file.Write( content.char_str(), content.Len());
|
||||
|
||||
int num = Files.GetCount();
|
||||
|
||||
for (int i=0; i<num; i++)
|
||||
temp.Printf("UseFormatFilter:%d\n", myUseFormatFilter);
|
||||
content << temp;
|
||||
if (myFormatFilter>0u)
|
||||
{
|
||||
if (i<NumberOfChecked)
|
||||
{
|
||||
if (Checked[i]) content.Printf( L"Add_true:%ls\n", Files[i].wc_str());
|
||||
else content.Printf( L"Add_false:%ls\n", Files[i].wc_str());
|
||||
}
|
||||
else content.Printf( L"Add_true:%ls\n", Files[i].wc_str());
|
||||
file.Write( content.char_str(), content.Len());
|
||||
temp.Printf( "FormatFilter:%lu\n", myFormatFilter);
|
||||
content << temp;
|
||||
}
|
||||
if (myFileFormat>0u)
|
||||
{
|
||||
temp.Printf( "FileFormat:%lu\n", myFileFormat);
|
||||
content << temp;
|
||||
}
|
||||
|
||||
file.Close();
|
||||
temp.Printf( L"FontColour:%u,%u,%u,%u\n", FontColour[0], FontColour[1], FontColour[2],FontColour[3]);
|
||||
content << temp;
|
||||
temp.Printf( L"TextureColour:%u,%u,%u,%u\n", TextureColour[0], TextureColour[1], TextureColour[2], TextureColour[3]);
|
||||
content << temp;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int uMod_GameInfo::LoadFromFile( const wxString &file_name)
|
||||
int uMod_GameInfo::LoadFromString( const wxString &content)
|
||||
{
|
||||
Init();
|
||||
if (file_name.Len()==0) return -1;
|
||||
|
||||
wxFile file;
|
||||
if (!file.Access(file_name, wxFile::read)) return -1;
|
||||
file.Open(file_name, wxFile::read);
|
||||
if (!file.IsOpened()) {return -1;}
|
||||
|
||||
unsigned len = file.Length();
|
||||
|
||||
unsigned char* buffer;
|
||||
try {buffer = new unsigned char [len+1];}
|
||||
catch (...) {return -1;}
|
||||
|
||||
unsigned int result = file.Read( buffer, len);
|
||||
file.Close();
|
||||
|
||||
if (result != len) {delete [] buffer; return -1;}
|
||||
|
||||
buffer[len]=0;
|
||||
|
||||
wxString content;
|
||||
content = buffer;
|
||||
delete [] buffer;
|
||||
|
||||
wxStringTokenizer token( content, "\n");
|
||||
|
||||
int num = token.CountTokens();
|
||||
|
||||
if (LengthOfChecked<num)
|
||||
{
|
||||
if (Checked!=NULL) delete [] Checked;
|
||||
try {Checked = new bool [num+100];}
|
||||
catch (...) {Checked=NULL;LengthOfChecked=0; return -1;}
|
||||
LengthOfChecked = num+100;
|
||||
}
|
||||
|
||||
wxString line;
|
||||
wxString command;
|
||||
wxString temp;
|
||||
Files.Alloc(num);
|
||||
//Files.Alloc(num);
|
||||
for (int i=0; i<num; i++)
|
||||
{
|
||||
line = token.GetNextToken();
|
||||
command = line.BeforeFirst(':');
|
||||
|
||||
|
||||
if (command == L"Add_true")
|
||||
{
|
||||
Checked[NumberOfChecked++] = true;
|
||||
Files.Add(line.AfterFirst(':'));
|
||||
}
|
||||
else if (command == L"Add_false")
|
||||
{
|
||||
Checked[NumberOfChecked++] = false;
|
||||
Files.Add(line.AfterFirst(':'));
|
||||
}
|
||||
else if (command == L"SavePath") SavePath = line.AfterFirst(':');
|
||||
else if (command == L"OpenPath") OpenPath = line.AfterFirst(':');
|
||||
else if (command == L"SaveAllTextures")
|
||||
if (command == "ShowCollPane")
|
||||
{
|
||||
temp = line.AfterFirst(':');
|
||||
if (temp[0]=='0') SaveAllTextures = false;
|
||||
if (temp.Len()>0 && temp[0]=='0') myShowCollPane = false;
|
||||
else myShowCollPane = true;
|
||||
}
|
||||
else if (command == "SavePath") SavePath = line.AfterFirst(':');
|
||||
else if (command == "OpenPath") OpenPath = line.AfterFirst(':');
|
||||
else if (command == "SaveAllTextures")
|
||||
{
|
||||
temp = line.AfterFirst(':');
|
||||
if (temp.Len()>0 && temp[0]=='0') SaveAllTextures = false;
|
||||
else SaveAllTextures = true;
|
||||
}
|
||||
else if (command == L"SaveSingleTexture")
|
||||
else if (command == "SaveSingleTexture")
|
||||
{
|
||||
temp = line.AfterFirst(':');
|
||||
if (temp[0]=='0') SaveSingleTexture = false;
|
||||
if (temp.Len()>0 && temp[0]=='0') SaveSingleTexture = false;
|
||||
else SaveSingleTexture = true;
|
||||
}
|
||||
else if (command == L"KeyBack")
|
||||
else if (command == "ShowSingleTextureString")
|
||||
{
|
||||
temp = line.AfterFirst(':');
|
||||
if (temp.Len()>0 && temp[0]=='0') myShowSingleTextureString = false;
|
||||
else myShowSingleTextureString = true;
|
||||
}
|
||||
else if (command == "SupportTPF")
|
||||
{
|
||||
temp = line.AfterFirst(':');
|
||||
if (temp.Len()>0 && temp[0]=='0') mySupportTPF = false;
|
||||
else mySupportTPF = true;
|
||||
}
|
||||
else if (command == "KeyBack")
|
||||
{
|
||||
temp = line.AfterFirst(':');
|
||||
long key;
|
||||
if (temp.ToLong( &key)) KeyBack = key;
|
||||
else KeyBack = -1;
|
||||
}
|
||||
else if (command == L"KeySave")
|
||||
else if (command == "KeySave")
|
||||
{
|
||||
temp = line.AfterFirst(':');
|
||||
long key;
|
||||
if (temp.ToLong( &key)) KeySave = key;
|
||||
else KeySave = -1;
|
||||
}
|
||||
else if (command == L"KeyNext")
|
||||
else if (command == "KeyNext")
|
||||
{
|
||||
temp = line.AfterFirst(':');
|
||||
long key;
|
||||
if (temp.ToLong( &key)) KeyNext = key;
|
||||
else KeyNext = -1;
|
||||
}
|
||||
else if (command == L"FontColour")
|
||||
else if (command == "UseSizeFilter")
|
||||
{
|
||||
temp = line.AfterFirst(':');
|
||||
temp = temp.BeforeFirst(',');
|
||||
long colour;
|
||||
if (temp.ToLong( &colour)) FontColour[0] = colour;
|
||||
else FontColour[0] = 255;
|
||||
temp = line.AfterFirst(':');
|
||||
temp = temp.AfterFirst(',');
|
||||
temp = temp.BeforeFirst(',');
|
||||
if (temp.ToLong( &colour)) FontColour[1] = colour;
|
||||
else FontColour[1] = 0;
|
||||
temp = line.AfterFirst(':');
|
||||
temp = temp.AfterLast(',');
|
||||
if (temp.ToLong( &colour)) FontColour[2] = colour;
|
||||
else FontColour[2] = 0;
|
||||
if (temp.Len()>0 && temp[0]=='0') myUseSizeFilter = false;
|
||||
else myUseSizeFilter = true;
|
||||
}
|
||||
else if (command == L"TextureColour")
|
||||
else if (command == "Height")
|
||||
{
|
||||
line = line.AfterFirst(':');
|
||||
temp = line.Before(',');
|
||||
long val;
|
||||
if (temp.ToLong( &val)) myHeightMin = val;
|
||||
else myHeightMin = 1;
|
||||
temp = line.After(',');
|
||||
if (temp.ToLong( &val)) myHeightMax = val;
|
||||
else myHeightMax = 1;
|
||||
}
|
||||
else if (command == "Width")
|
||||
{
|
||||
line = line.AfterFirst(':');
|
||||
temp = line.Before(',');
|
||||
long val;
|
||||
if (temp.ToLong( &val)) myWidthMin = val;
|
||||
else myWidthMin = 1;
|
||||
temp = line.After(',');
|
||||
if (temp.ToLong( &val)) myWidthMax = val;
|
||||
else myWidthMax = 1;
|
||||
}
|
||||
else if (command == "Depth")
|
||||
{
|
||||
line = line.AfterFirst(':');
|
||||
temp = line.Before(',');
|
||||
long val;
|
||||
if (temp.ToLong( &val)) myDepthMin = val;
|
||||
else myDepthMin = 1;
|
||||
temp = line.After(',');
|
||||
if (temp.ToLong( &val)) myDepthMax = val;
|
||||
else myDepthMax = 1;
|
||||
}
|
||||
else if (command == "UseFormatFilter")
|
||||
{
|
||||
temp = line.AfterFirst(':');
|
||||
temp = temp.BeforeFirst(',');
|
||||
long colour;
|
||||
if (temp.ToLong( &colour)) TextureColour[0] = colour;
|
||||
else TextureColour[0] = 0;
|
||||
temp = line.AfterFirst(':');
|
||||
temp = temp.AfterFirst(',');
|
||||
temp = temp.BeforeFirst(',');
|
||||
if (temp.ToLong( &colour)) TextureColour[1] = colour;
|
||||
else TextureColour[1] = 255;
|
||||
temp = line.AfterFirst(':');
|
||||
temp = temp.AfterLast(',');
|
||||
if (temp.ToLong( &colour)) TextureColour[2] = colour;
|
||||
else TextureColour[2] = 0;
|
||||
if (temp.Len()>0 && temp[0]=='0') myUseFormatFilter = false;
|
||||
else myUseFormatFilter = true;
|
||||
}
|
||||
else if (command == "FormatFilter")
|
||||
{
|
||||
temp = line.AfterFirst(':');
|
||||
unsigned long val;
|
||||
if (temp.ToULong( &val)) myFormatFilter = val;
|
||||
else myFormatFilter = 0u;
|
||||
}
|
||||
else if (command == "FileFormat")
|
||||
{
|
||||
temp = line.AfterFirst(':');
|
||||
unsigned long val;
|
||||
if (temp.ToULong( &val)) myFileFormat = val;
|
||||
else myFileFormat = 0u;
|
||||
}
|
||||
else if (command == "ShowSingleTextureString")
|
||||
{
|
||||
temp = line.AfterFirst(':');
|
||||
if (temp.Len()>0 && temp[0]=='0') myShowSingleTextureString = false;
|
||||
else myShowSingleTextureString = true;
|
||||
}
|
||||
else if (command == "FontColour")
|
||||
{
|
||||
temp = line.AfterFirst(':');
|
||||
|
||||
/*
|
||||
if (NumberOfChecked>=LengthOfChecked)
|
||||
{
|
||||
bool *t_bool;
|
||||
try {t_bool = new bool [LengthOfChecked+100];}
|
||||
catch (...) {return -1;}
|
||||
for (int i=0; i<LengthOfChecked; i++) t_bool[i]=Checked[i];
|
||||
delete [] Checked;
|
||||
Checked = t_bool;
|
||||
LengthOfChecked +=100;
|
||||
wxStringTokenizer col( temp, ",");
|
||||
|
||||
int num_col = col.CountTokens();
|
||||
for (int i=0; i<num_col && i<4; i++)
|
||||
{
|
||||
temp = col.GetNextToken();
|
||||
long colour;
|
||||
if (temp.ToLong( &colour)) FontColour[i] = colour;
|
||||
}
|
||||
}
|
||||
else if (command == "TextureColour")
|
||||
{
|
||||
temp = line.AfterFirst(':');
|
||||
|
||||
wxStringTokenizer col( temp, ",");
|
||||
|
||||
int num_col = col.CountTokens();
|
||||
for (int i=0; i<num_col && i<4; i++)
|
||||
{
|
||||
temp = col.GetNextToken();
|
||||
long colour;
|
||||
if (temp.ToLong( &colour)) TextureColour[i] = colour;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int uMod_GameInfo::GetChecked( bool* array, int num) const
|
||||
{
|
||||
for (int i=0; i<num && i<NumberOfChecked; i++) array[i] = Checked[i];
|
||||
return 0;
|
||||
}
|
||||
|
||||
int uMod_GameInfo::SetChecked( bool* array, int num)
|
||||
{
|
||||
if (num>LengthOfChecked)
|
||||
if (SaveAllTextures && SaveSingleTexture)
|
||||
{
|
||||
if (Checked!=NULL) delete [] Checked;
|
||||
try {Checked = new bool [num+100];}
|
||||
catch (...) {Checked=NULL; LengthOfChecked = 0; return -1;}
|
||||
LengthOfChecked = num+100;
|
||||
SaveAllTextures = false;
|
||||
SaveSingleTexture = false;
|
||||
}
|
||||
for (int i=0; i<num; i++) Checked[i] = array[i];
|
||||
NumberOfChecked = num;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int uMod_GameInfo::SetSaveSingleTexture(bool val)
|
||||
{
|
||||
SaveSingleTexture = val;
|
||||
@@ -293,18 +326,10 @@ int uMod_GameInfo::SetSaveAllTextures(bool val)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void uMod_GameInfo::SetFiles(const wxArrayString &files)
|
||||
{
|
||||
Files = files;
|
||||
}
|
||||
|
||||
void uMod_GameInfo::GetFiles( wxArrayString &files) const
|
||||
{
|
||||
files = Files;
|
||||
}
|
||||
|
||||
uMod_GameInfo& uMod_GameInfo::operator = (const uMod_GameInfo &rhs)
|
||||
{
|
||||
myShowCollPane = rhs.myShowCollPane;
|
||||
|
||||
SaveSingleTexture = rhs.SaveSingleTexture;
|
||||
SaveAllTextures = rhs.SaveAllTextures;
|
||||
|
||||
@@ -312,21 +337,25 @@ uMod_GameInfo& uMod_GameInfo::operator = (const uMod_GameInfo &rhs)
|
||||
KeySave = rhs.KeySave;
|
||||
KeyNext = rhs.KeyNext;
|
||||
|
||||
if (LengthOfChecked<rhs.LengthOfChecked)
|
||||
{
|
||||
if (Checked!=NULL) delete [] Checked;
|
||||
Checked = new bool [rhs.LengthOfChecked];
|
||||
LengthOfChecked = rhs.LengthOfChecked;
|
||||
}
|
||||
NumberOfChecked = rhs.NumberOfChecked;
|
||||
for (int i=0; i<NumberOfChecked; i++) Checked[i] = rhs.Checked[i];
|
||||
myUseSizeFilter = rhs.myUseSizeFilter;
|
||||
myHeightMin = rhs.myHeightMin;
|
||||
myHeightMax = rhs.myHeightMax;
|
||||
myWidthMin = rhs.myWidthMin;
|
||||
myWidthMax = rhs.myWidthMax;
|
||||
myDepthMin = rhs.myDepthMin;
|
||||
myDepthMax = rhs.myDepthMax;
|
||||
|
||||
myUseFormatFilter = rhs.myUseFormatFilter;
|
||||
myFormatFilter = rhs.myFormatFilter;
|
||||
myFileFormat = rhs.myFileFormat;
|
||||
|
||||
myShowSingleTextureString = rhs.myShowSingleTextureString;
|
||||
|
||||
for (int i=0; i<4; i++) FontColour[i]=rhs.FontColour[i];
|
||||
for (int i=0; i<4; i++) TextureColour[i]=rhs.TextureColour[i];
|
||||
|
||||
SavePath = rhs.SavePath;
|
||||
OpenPath = rhs.OpenPath;
|
||||
Files = rhs.Files;
|
||||
|
||||
for (int i=0; i<3; i++) FontColour[i]=rhs.FontColour[i];
|
||||
for (int i=0; i<3; i++) TextureColour[i]=rhs.TextureColour[i];
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
+67
-22
@@ -20,6 +20,8 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
#ifndef uMod_GAME_H_
|
||||
#define uMod_GAME_H_
|
||||
|
||||
#include "uMod_TreeView.h"
|
||||
#include "uMod_Main.h"
|
||||
|
||||
//this class is intended as a storing object for each game
|
||||
@@ -32,11 +34,19 @@ public:
|
||||
void Init(void);
|
||||
|
||||
|
||||
int SaveToFile( const wxString &file_name);
|
||||
int LoadFromFile( const wxString &file_name);
|
||||
int SaveToString( wxString &content);
|
||||
int LoadFromString( const wxString &content);
|
||||
|
||||
//int GetActiveTexture( uMod_TextureElement_SortedArrayPtr &texture);
|
||||
|
||||
|
||||
|
||||
bool &ShowCollPane(void) {return myShowCollPane;}
|
||||
|
||||
|
||||
bool &SupportTPF(void) {return mySupportTPF;}
|
||||
const bool &SupportTPF(void) const {return mySupportTPF;}
|
||||
|
||||
int GetChecked( bool* array, int num) const;
|
||||
int SetChecked( bool* array, int num);
|
||||
|
||||
int SetSaveSingleTexture(bool val);
|
||||
bool GetSaveSingleTexture(void) const {return SaveSingleTexture;}
|
||||
@@ -44,13 +54,6 @@ public:
|
||||
int SetSaveAllTextures(bool val);
|
||||
bool GetSaveAllTextures(void) const {return SaveAllTextures;}
|
||||
|
||||
void SetFiles(const wxArrayString &files);
|
||||
void GetFiles( wxArrayString &files) const;
|
||||
//void AddTexture( const wxString &textures);
|
||||
|
||||
int GetNumberOfFiles(void) const {return Files.GetCount();}
|
||||
|
||||
int SendTextures(void);
|
||||
|
||||
int GetKeyBack() const {return KeyBack;}
|
||||
int SetKeyBack(int key) {KeyBack=key; return 0;}
|
||||
@@ -61,11 +64,43 @@ public:
|
||||
int GetKeyNext() const {return KeyNext;}
|
||||
int SetKeyNext(int key) {KeyNext=key; return 0;}
|
||||
|
||||
int SetFontColour(const int *colour) {FontColour[0]=colour[0];FontColour[1]=colour[1];FontColour[2]=colour[2];return 0;}
|
||||
int GetFontColour(int *colour) const {colour[0]=FontColour[0];colour[1]=FontColour[1];colour[2]=FontColour[2];return 0;}
|
||||
bool &ShowSingleTextureString() {return myShowSingleTextureString;}
|
||||
const bool &ShowSingleTextureString() const {return myShowSingleTextureString;}
|
||||
|
||||
int SetFontColour(const unsigned char *colour) {FontColour[0]=colour[0];FontColour[1]=colour[1];FontColour[2]=colour[2];FontColour[3]=colour[3];return 0;}
|
||||
int GetFontColour(unsigned char *colour) const {colour[0]=FontColour[0];colour[1]=FontColour[1];colour[2]=FontColour[2];colour[3]=FontColour[3];return 0;}
|
||||
|
||||
int SetTextureColour(const unsigned char *colour) {TextureColour[0]=colour[0];TextureColour[1]=colour[1];TextureColour[2]=colour[2];TextureColour[3]=colour[3];return 0;}
|
||||
int GetTextureColour(unsigned char *colour) const {colour[0]=TextureColour[0];colour[1]=TextureColour[1];colour[2]=TextureColour[2];colour[3]=TextureColour[3];return 0;}
|
||||
|
||||
|
||||
bool &UseSizeFilter(void) {return myUseSizeFilter;}
|
||||
const bool &UseSizeFilter(void) const {return myUseSizeFilter;}
|
||||
|
||||
int &HeightMin(void) {return myHeightMin;}
|
||||
const int &HeightMin(void) const {return myHeightMin;}
|
||||
int &HeightMax(void) {return myHeightMax;}
|
||||
const int &HeightMax(void) const {return myHeightMax;}
|
||||
|
||||
int &WidthMin(void) {return myWidthMin;}
|
||||
const int &WidthMin(void) const {return myWidthMin;}
|
||||
int &WidthMax(void) {return myWidthMax;}
|
||||
const int &WidthMax(void) const {return myWidthMax;}
|
||||
|
||||
int &DepthMin(void) {return myDepthMin;}
|
||||
const int &DepthMin(void) const {return myDepthMin;}
|
||||
int &DepthMax(void) {return myDepthMax;}
|
||||
const int &DepthMax(void) const {return myDepthMax;}
|
||||
|
||||
bool &UseFormatFilter(void) {return myUseFormatFilter;}
|
||||
const bool &UseFormatFilter(void) const {return myUseFormatFilter;}
|
||||
|
||||
unsigned long &FormatFilter(void) {return myFormatFilter;}
|
||||
const unsigned long &FormatFilter(void) const {return myFormatFilter;}
|
||||
|
||||
unsigned long &FileFormat(void) {return myFileFormat;}
|
||||
const unsigned long &FileFormat(void) const {return myFileFormat;}
|
||||
|
||||
int SetTextureColour(const int *colour) {TextureColour[0]=colour[0];TextureColour[1]=colour[1];TextureColour[2]=colour[2];return 0;}
|
||||
int GetTextureColour(int *colour) const {colour[0]=TextureColour[0];colour[1]=TextureColour[1];colour[2]=TextureColour[2];return 0;}
|
||||
|
||||
int SetOpenPath(const wxString &path) {OpenPath=path; return 0;}
|
||||
wxString GetOpenPath(void) const {return OpenPath;}
|
||||
@@ -76,22 +111,32 @@ public:
|
||||
uMod_GameInfo& operator = (const uMod_GameInfo &rhs);
|
||||
|
||||
private:
|
||||
bool myShowCollPane;
|
||||
|
||||
bool *Checked;
|
||||
int NumberOfChecked;
|
||||
int LengthOfChecked;
|
||||
bool mySupportTPF;
|
||||
|
||||
bool SaveSingleTexture;
|
||||
bool SaveAllTextures;
|
||||
|
||||
wxArrayString Files;
|
||||
|
||||
int KeyBack;
|
||||
int KeySave;
|
||||
int KeyNext;
|
||||
|
||||
int FontColour[3];
|
||||
int TextureColour[3];
|
||||
bool myUseSizeFilter;
|
||||
int myHeightMin;
|
||||
int myHeightMax;
|
||||
int myWidthMin;
|
||||
int myWidthMax;
|
||||
int myDepthMin;
|
||||
int myDepthMax;
|
||||
|
||||
bool myUseFormatFilter;
|
||||
unsigned long myFormatFilter;
|
||||
unsigned long myFileFormat;
|
||||
|
||||
bool myShowSingleTextureString;
|
||||
unsigned char FontColour[4];
|
||||
unsigned char TextureColour[4];
|
||||
|
||||
wxString OpenPath;
|
||||
wxString SavePath;
|
||||
|
||||
+1122
-398
File diff suppressed because it is too large
Load Diff
+156
-30
@@ -23,19 +23,20 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
#include "uMod_Main.h"
|
||||
|
||||
// this page is opened if a game is started.
|
||||
class uMod_GamePage : public wxScrolledWindow
|
||||
class uMod_GamePage : public wxPanel
|
||||
{
|
||||
public:
|
||||
uMod_GamePage( wxNotebook *parent, const wxString &exe, const wxString &save, PipeStruct &pipe);
|
||||
uMod_GamePage( wxNotebook *parent, const wxString &exe, int injection_method, const wxString &save, PipeStruct &pipe);
|
||||
virtual ~uMod_GamePage(void);
|
||||
|
||||
int AddTexture( const wxString &file_name);
|
||||
|
||||
int UpdateGame(void);
|
||||
int ReloadGame(void);
|
||||
|
||||
int SaveTemplate( const wxString &file_name);
|
||||
int SaveTemplateToString( wxString &content);
|
||||
|
||||
int LoadTemplate( const wxString &file_name);
|
||||
int LoadTemplateFromString( const wxString &content);
|
||||
|
||||
wxString GetExeName(void) {return ExeName;}
|
||||
wxString GetTemplateName(void) {return TemplateName;}
|
||||
@@ -46,15 +47,86 @@ public:
|
||||
int SetSavePath(const wxString &path);
|
||||
wxString GetSavePath(void) {return Game.GetSavePath();}
|
||||
|
||||
/**
|
||||
* User started drag
|
||||
* @param event
|
||||
*/
|
||||
void OnBeginDrag( wxDataViewEvent &event);
|
||||
/**
|
||||
* Ask if drop position is valid
|
||||
* @param event
|
||||
*/
|
||||
void OnDropPossible( wxDataViewEvent &event);
|
||||
/**
|
||||
* User dropped the item
|
||||
* @param event
|
||||
*/
|
||||
void OnDrop( wxDataViewEvent &event);
|
||||
|
||||
void OnButtonUp(wxCommandEvent& WXUNUSED(event));
|
||||
void OnButtonDown(wxCommandEvent& WXUNUSED(event));
|
||||
void OnButtonDelete(wxCommandEvent& WXUNUSED(event));
|
||||
void OnDropFile(wxDropFilesEvent& event);
|
||||
|
||||
/**
|
||||
* Gets called, when the capture texture panel is shown/hidden
|
||||
* @param WXUNUSED
|
||||
*/
|
||||
void OnCollPane(wxCollapsiblePaneEvent& WXUNUSED(event));
|
||||
|
||||
/**
|
||||
* Gets called, when the colour buttons are pressed
|
||||
* @param event
|
||||
*/
|
||||
void OnButtonColour(wxCommandEvent& event);
|
||||
|
||||
/**
|
||||
* Gets called, when one of the check boxes gets checked/unchecked
|
||||
* @param event
|
||||
*/
|
||||
void OnCheckBox(wxCommandEvent& event);
|
||||
|
||||
/**
|
||||
* Gets called, press the button to select the filtered texture formats.
|
||||
* @param event
|
||||
*/
|
||||
void OnButtonFormatFilter(wxCommandEvent& event);
|
||||
|
||||
/**
|
||||
* Gets called, when the save-path button is pressed
|
||||
* @param event
|
||||
*/
|
||||
void OnButtonSavePath(wxCommandEvent& event);
|
||||
|
||||
|
||||
/**
|
||||
* Gets called by a rigth click in the ViewCtrl
|
||||
* @param event
|
||||
*/
|
||||
void OnContextMenu( wxDataViewEvent &event );
|
||||
int OpenPackage(void);
|
||||
|
||||
|
||||
/**
|
||||
* call to change the labels of all items to the actual language
|
||||
* @return
|
||||
*/
|
||||
int UpdateLanguage(void);
|
||||
|
||||
/**
|
||||
* get the actual name of the page (displayed in the tab of the notebook window)
|
||||
* @return
|
||||
*/
|
||||
wxString GetPageName(void);
|
||||
|
||||
/**
|
||||
* The game has created a DirectX device.
|
||||
* @param version device version (e.g. DX9, DX9Ex, DX10 DX10.1
|
||||
* @return
|
||||
*/
|
||||
int AddDXDevice(int version);
|
||||
/**
|
||||
* The game hast destroyed a DirectX device.
|
||||
* @param version
|
||||
* @return
|
||||
*/
|
||||
int RemoveDXDevice(int version);
|
||||
|
||||
|
||||
@@ -62,42 +134,96 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
int CounterDX9, CounterDX9EX;
|
||||
int CounterDX10, CounterDX10EX;
|
||||
/**
|
||||
* Set the info text (which injection method is used and which kind of DirectX device is connected)
|
||||
* @return
|
||||
*/
|
||||
int SetInfo(void);
|
||||
|
||||
const int InjectionMethod;
|
||||
int CounterDX9, CounterDX9EX;
|
||||
int CounterDX10, CounterDX101;
|
||||
|
||||
/**
|
||||
* add a single package (or file)
|
||||
* @param file_name
|
||||
* @return
|
||||
*/
|
||||
int AddPackage( const wxString &file_name);
|
||||
|
||||
/**
|
||||
* adds multiple packages (or files)
|
||||
* @param files
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
int AddPackages(const wxString *files, int num);
|
||||
|
||||
/**
|
||||
* adds multiple packages (or files)
|
||||
* @param files
|
||||
* @return
|
||||
*/
|
||||
int AddPackages(const wxArrayString &files);
|
||||
|
||||
/**
|
||||
* ask for all values from the various control elements of this panel and updates \a Game
|
||||
* @return
|
||||
*/
|
||||
int GetSettings(void);
|
||||
int SetColour( wxTextCtrl** txt, int *colour);
|
||||
int GetColour( wxTextCtrl* txt, int def);
|
||||
|
||||
|
||||
wxString ExeName;
|
||||
wxString TemplateName;
|
||||
|
||||
wxBoxSizer *SizerKeys[2];
|
||||
wxTextCtrl *TextKeyBack;
|
||||
wxTextCtrl *TextKeySave;
|
||||
wxTextCtrl *TextKeyNext;
|
||||
wxChoice *ChoiceKeyBack;
|
||||
wxChoice *ChoiceKeySave;
|
||||
wxChoice *ChoiceKeyNext;
|
||||
|
||||
wxBoxSizer *FontColourSizer;
|
||||
wxTextCtrl *FontColour[4];
|
||||
wxBoxSizer *TextureColourSizer;
|
||||
wxTextCtrl *TextureColour[4];
|
||||
|
||||
wxBoxSizer *MainSizer;
|
||||
|
||||
wxTextCtrl *DX_DLL_Info;
|
||||
wxTextCtrl *TemplateFile;
|
||||
wxCheckBox *SaveAllTextures;
|
||||
|
||||
wxCollapsiblePane *CollPane;
|
||||
wxBoxSizer *CollSizer;
|
||||
|
||||
wxBoxSizer *TextureSizer;
|
||||
|
||||
wxPanel *SingleTexturePanel;
|
||||
wxBoxSizer *SingleTextureSizer;
|
||||
wxCheckBox *SaveSingleTexture;
|
||||
wxCheckBox *ShowSingleTextureString;
|
||||
|
||||
|
||||
uMod_KeyPanel *KeyBack;
|
||||
uMod_KeyPanel *KeySave;
|
||||
uMod_KeyPanel *KeyNext;
|
||||
|
||||
wxButton *FontColour;
|
||||
wxButton *TextureColour;
|
||||
|
||||
|
||||
wxPanel *AllTexturePanel;
|
||||
wxBoxSizer *AllTextureSizer;
|
||||
wxCheckBox *SaveAllTextures;
|
||||
|
||||
wxCheckBox *UseSizeFilter;
|
||||
|
||||
uMod_SpinPanel *SpinWidth;
|
||||
uMod_SpinPanel *SpinHeight;
|
||||
uMod_SpinPanel *SpinDepth;
|
||||
|
||||
|
||||
wxCheckBox *UseFormatFilter;
|
||||
wxButton *FormatFilter;
|
||||
|
||||
|
||||
uMod_CheckBoxArray *FileFormats;
|
||||
wxButton *SavePathButton;
|
||||
wxTextCtrl *SavePath;
|
||||
|
||||
wxBoxSizer **CheckBoxHSizers;
|
||||
wxButton **CheckButtonUp;
|
||||
wxButton **CheckButtonDown;
|
||||
wxButton **CheckButtonDelete;
|
||||
wxDataViewCtrl *ViewCtrl;
|
||||
uMod_TreeViewModel *ViewModel;
|
||||
wxDataViewItem *LastDataViewItem;
|
||||
|
||||
wxCheckBox **CheckBoxes;
|
||||
int NumberOfEntry;
|
||||
int MaxNumberOfEntry;
|
||||
|
||||
@@ -109,7 +235,7 @@ private:
|
||||
uMod_Sender Sender;
|
||||
|
||||
|
||||
//DECLARE_EVENT_TABLE();
|
||||
DECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
||||
#endif /* uMod_GAMEPAGE_H_ */
|
||||
|
||||
+95
-49
@@ -179,8 +179,8 @@ int uMod_Language::LoadLanguage(const wxString &name)
|
||||
command.Replace( "\n", "");
|
||||
msg = entry.AfterFirst(':');
|
||||
|
||||
while (msg[0]=='\r' || msg[0]=='\n') msg.Remove(0,1);
|
||||
while (msg.Last()=='\n' || msg.Last()=='\r') msg.RemoveLast(1);
|
||||
while (msg.Len()>0 && (msg[0]=='\r' || msg[0]=='\n')) msg.Remove(0,1);
|
||||
while (msg.Len()>0 && (msg.Last()=='\n' || msg.Last()=='\r')) msg.RemoveLast(1);
|
||||
|
||||
CheckEntry( command, msg, MenuLanguage)
|
||||
CheckEntry( command, msg, MenuHelp)
|
||||
@@ -198,14 +198,25 @@ int uMod_Language::LoadLanguage(const wxString &name)
|
||||
CheckEntry( command, msg, MenuExit)
|
||||
CheckEntry( command, msg, MainMenuMain)
|
||||
CheckEntry( command, msg, MainMenuHelp)
|
||||
CheckEntry( command, msg, ButtonOpen)
|
||||
CheckEntry( command, msg, ButtonDirectory)
|
||||
CheckEntry( command, msg, MenuOpenPackage)
|
||||
CheckEntry( command, msg, MenuRemovePackage)
|
||||
CheckEntry( command, msg, MenuRemoveSelectedPackages)
|
||||
CheckEntry( command, msg, MenuUpdate)
|
||||
CheckEntry( command, msg, MenuReload)
|
||||
CheckEntry( command, msg, MenuSupportTPF)
|
||||
CheckEntry( command, msg, ButtonUpdate)
|
||||
CheckEntry( command, msg, ButtonReload)
|
||||
CheckEntry( command, msg, ButtonDirectory)
|
||||
CheckEntry( command, msg, ChooseFile)
|
||||
CheckEntry( command, msg, ChooseDir)
|
||||
CheckEntry( command, msg, MultipleSingleFiles)
|
||||
CheckEntry( command, msg, HookInjection)
|
||||
CheckEntry( command, msg, DirectInjection)
|
||||
CheckEntry( command, msg, NoInjection)
|
||||
CheckEntry( command, msg, InvalidGamePage)
|
||||
CheckEntry( command, msg, TextCtrlTemplate)
|
||||
CheckEntry( command, msg, CollapseTextureCapture)
|
||||
CheckEntry( command, msg, CheckBoxSaveSingleTexture)
|
||||
CheckEntry( command, msg, CheckBoxShowStringSaveSingleTexture)
|
||||
CheckEntry( command, msg, CheckBoxSaveAllTextures)
|
||||
CheckEntry( command, msg, TextCtrlSavePath)
|
||||
CheckEntry( command, msg, SelectLanguage)
|
||||
@@ -215,12 +226,15 @@ int uMod_Language::LoadLanguage(const wxString &name)
|
||||
CheckEntry( command, msg, DeleteGame)
|
||||
CheckEntry( command, msg, GameAlreadyAdded)
|
||||
CheckEntry( command, msg, ExitGameAnyway)
|
||||
CheckEntry( command, msg, NoComment)
|
||||
CheckEntry( command, msg, Title)
|
||||
CheckEntry( command, msg, Author)
|
||||
CheckEntry( command, msg, Comment)
|
||||
CheckEntry( command, msg, SingleTextureNode)
|
||||
CheckEntry( command, msg, Error_GameIsHooked)
|
||||
CheckEntry( command, msg, Error_ProcessNotStarted)
|
||||
CheckEntry( command, msg, Error_RemoveHook)
|
||||
CheckEntry( command, msg, Error_FileNotSupported)
|
||||
CheckEntry( command, msg, Error_FileIsEmpty)
|
||||
CheckEntry( command, msg, Error_FktNotFound)
|
||||
CheckEntry( command, msg, Error_D3DX9NotFound)
|
||||
CheckEntry( command, msg, Error_DLLNotFound)
|
||||
@@ -239,9 +253,15 @@ int uMod_Language::LoadLanguage(const wxString &name)
|
||||
CheckEntry( command, msg, Error_Memory)
|
||||
CheckEntry( command, msg, Error_Unzip)
|
||||
CheckEntry( command, msg, Error_ZipEntry)
|
||||
CheckEntry( command, msg, CheckBoxUseSizeFilter)
|
||||
CheckEntry( command, msg, CheckBoxUseFormatFilter)
|
||||
CheckEntry( command, msg, SetFormatFilter)
|
||||
CheckEntry( command, msg, KeyBack)
|
||||
CheckEntry( command, msg, KeySave)
|
||||
CheckEntry( command, msg, KeyNext)
|
||||
CheckEntry( command, msg, AskForKey)
|
||||
CheckEntry( command, msg, KeyNotSet)
|
||||
CheckEntry( command, msg, UnknownKey)
|
||||
CheckEntry( command, msg, FontColour)
|
||||
CheckEntry( command, msg, TextureColour)
|
||||
{}
|
||||
@@ -277,16 +297,30 @@ int uMod_Language::LoadDefault(void)
|
||||
MainMenuMain = "Main";
|
||||
MainMenuHelp = "Help";
|
||||
|
||||
ButtonOpen = "Open texture/package";
|
||||
ButtonDirectory = "Set save directory";
|
||||
MenuOpenPackage = "Open texture/package";
|
||||
MenuRemovePackage = "Remove package";
|
||||
MenuRemoveSelectedPackages = "Remove selected packages";
|
||||
|
||||
MenuUpdate = "Update";
|
||||
MenuReload = "Update (reload)";
|
||||
MenuSupportTPF = "Support TPF-Mods";
|
||||
ButtonUpdate = "Update";
|
||||
ButtonReload = "Update (reload)";
|
||||
ButtonDirectory = "Set save directory";
|
||||
|
||||
ChooseFile = "Choose a file";
|
||||
ChooseDir = "Choose a directory";
|
||||
|
||||
MultipleSingleFiles = "Multiple single files";
|
||||
|
||||
HookInjection = "Hook Injection: ";
|
||||
DirectInjection = "Direct Injection: ";
|
||||
NoInjection = "No Injection: ";
|
||||
InvalidGamePage = "default page";
|
||||
TextCtrlTemplate = "Template: ";
|
||||
|
||||
CollapseTextureCapture = "Capture textures";
|
||||
CheckBoxSaveSingleTexture = "Save single texture";
|
||||
CheckBoxShowStringSaveSingleTexture = "Show message in the upper left corner";
|
||||
CheckBoxSaveAllTextures = "Save all textures";
|
||||
TextCtrlSavePath = "Save path:";
|
||||
|
||||
@@ -299,14 +333,17 @@ int uMod_Language::LoadDefault(void)
|
||||
DeleteGame = "Select the games to be deleted.";
|
||||
GameAlreadyAdded = "Game has been already added.";
|
||||
ExitGameAnyway = "Closing OpenTexMod while a game is running might lead to a crash of the game.\nExit anyway?";
|
||||
NoComment = "No comment.";
|
||||
Author = "Author: ";
|
||||
Title = "Title";
|
||||
Author = "Author";
|
||||
Comment = "Comment";
|
||||
SingleTextureNode = "Single Textures";
|
||||
|
||||
Error_GameIsHooked = "The global hook is active and this game will be injected! Please delete the game from the list or disable the hook.";
|
||||
Error_ProcessNotStarted = "The game could not be started.";
|
||||
Error_RemoveHook = "Removing the Hook while a game is running might lead to crash.";
|
||||
|
||||
Error_FileNotSupported = "This file type is not supported:\n";
|
||||
Error_FileIsEmpty = "Could not retrieve textures from file:\n";
|
||||
Error_D3DX9NotFound = "The D3DX9_43.dll (32bit) is not available on your system.\nPlease install the newest DirectX End-User Runtime Installer.";
|
||||
Error_DLLNotFound = "Could not load the dll.\nThe dll injection won't work.\nThis might happen if D3DX9_43.dll (32bit) is not installed on your system.\nPlease install the newest DirectX End-User Runtime Web Installer.";
|
||||
Error_FktNotFound = "Could not load function out of dll.\nThe dll injection won't work.";
|
||||
@@ -327,14 +364,23 @@ int uMod_Language::LoadDefault(void)
|
||||
Error_Unzip = "Could not unzip.";
|
||||
Error_ZipEntry = "Could not find zip entry.";
|
||||
|
||||
CheckBoxUseSizeFilter = "Use size filter";
|
||||
CheckBoxUseFormatFilter = "Use texture format filter";
|
||||
SetFormatFilter = "Set the filter";
|
||||
WidthSpin = "Width :";
|
||||
HeightSpin = "Height :";
|
||||
DepthSpin = "Depth :";
|
||||
|
||||
KeyBack = "Back";
|
||||
KeySave = "Save";
|
||||
KeyNext = "Next";
|
||||
|
||||
AskForKey = "Pleas press a Key.";
|
||||
KeyNotSet = "Not set";
|
||||
UnknownKey = "Unknown";
|
||||
|
||||
FontColour = "Font colour (RGB):";
|
||||
TextureColour = "Texture colour (RGB):";
|
||||
FontColour = "Font colour";
|
||||
TextureColour = "Texture colour";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -453,44 +499,44 @@ int uMod_Language::LoadKeys(void)
|
||||
// * VK_A - VK_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A)
|
||||
*/
|
||||
int count = 0x30;
|
||||
AddKey( "0", count++);
|
||||
AddKey( "1", count++);
|
||||
AddKey( "2", count++);
|
||||
AddKey( "3", count++);
|
||||
AddKey( "4", count++);
|
||||
AddKey( "5", count++);
|
||||
AddKey( "6", count++);
|
||||
AddKey( "7", count++);
|
||||
AddKey( "8", count++);
|
||||
AddKey( "9", count++);
|
||||
AddKey( "VK_0", count++);
|
||||
AddKey( "VK_1", count++);
|
||||
AddKey( "VK_2", count++);
|
||||
AddKey( "VK_3", count++);
|
||||
AddKey( "VK_4", count++);
|
||||
AddKey( "VK_5", count++);
|
||||
AddKey( "VK_6", count++);
|
||||
AddKey( "VK_7", count++);
|
||||
AddKey( "VK_8", count++);
|
||||
AddKey( "VK_9", count++);
|
||||
|
||||
count = 0x41;
|
||||
AddKey( "a", count++);
|
||||
AddKey( "b", count++);
|
||||
AddKey( "c", count++);
|
||||
AddKey( "d", count++);
|
||||
AddKey( "e", count++);
|
||||
AddKey( "f", count++);
|
||||
AddKey( "g", count++);
|
||||
AddKey( "h", count++);
|
||||
AddKey( "i", count++);
|
||||
AddKey( "j", count++);
|
||||
AddKey( "k", count++);
|
||||
AddKey( "l", count++);
|
||||
AddKey( "m", count++);
|
||||
AddKey( "n", count++);
|
||||
AddKey( "o", count++);
|
||||
AddKey( "p", count++);
|
||||
AddKey( "q", count++);
|
||||
AddKey( "r", count++);
|
||||
AddKey( "s", count++);
|
||||
AddKey( "t", count++);
|
||||
AddKey( "u", count++);
|
||||
AddKey( "v", count++);
|
||||
AddKey( "w", count++);
|
||||
AddKey( "x", count++);
|
||||
AddKey( "y", count++);
|
||||
AddKey( "z", count++);
|
||||
AddKey( "VK_A", count++);
|
||||
AddKey( "VK_B", count++);
|
||||
AddKey( "VK_C", count++);
|
||||
AddKey( "VK_D", count++);
|
||||
AddKey( "VK_E", count++);
|
||||
AddKey( "VK_F", count++);
|
||||
AddKey( "VK_G", count++);
|
||||
AddKey( "VK_H", count++);
|
||||
AddKey( "VK_I", count++);
|
||||
AddKey( "VK_J", count++);
|
||||
AddKey( "VK_K", count++);
|
||||
AddKey( "VK_L", count++);
|
||||
AddKey( "VK_M", count++);
|
||||
AddKey( "VK_N", count++);
|
||||
AddKey( "VK_O", count++);
|
||||
AddKey( "VK_P", count++);
|
||||
AddKey( "VK_Q", count++);
|
||||
AddKey( "VK_R", count++);
|
||||
AddKey( "VK_S", count++);
|
||||
AddKey( "VK_T", count++);
|
||||
AddKey( "VK_U", count++);
|
||||
AddKey( "VK_V", count++);
|
||||
AddKey( "VK_W", count++);
|
||||
AddKey( "VK_X", count++);
|
||||
AddKey( "VK_Y", count++);
|
||||
AddKey( "VK_Z", count++);
|
||||
|
||||
/*
|
||||
|
||||
|
||||
@@ -51,16 +51,29 @@ public:
|
||||
wxString MainMenuMain;
|
||||
wxString MainMenuHelp;
|
||||
|
||||
wxString ButtonOpen;
|
||||
wxString ButtonDirectory;
|
||||
wxString MenuOpenPackage;
|
||||
wxString MenuRemovePackage;
|
||||
wxString MenuRemoveSelectedPackages;
|
||||
wxString MenuUpdate;
|
||||
wxString MenuReload;
|
||||
wxString MenuSupportTPF;
|
||||
wxString ButtonUpdate;
|
||||
wxString ButtonReload;
|
||||
wxString ButtonDirectory;
|
||||
|
||||
wxString ChooseFile;
|
||||
wxString ChooseDir;
|
||||
|
||||
wxString MultipleSingleFiles;
|
||||
|
||||
wxString HookInjection;
|
||||
wxString DirectInjection;
|
||||
wxString NoInjection;
|
||||
wxString InvalidGamePage;
|
||||
wxString TextCtrlTemplate;
|
||||
|
||||
wxString CollapseTextureCapture;
|
||||
wxString CheckBoxSaveSingleTexture;
|
||||
wxString CheckBoxShowStringSaveSingleTexture;
|
||||
wxString CheckBoxSaveAllTextures;
|
||||
wxString TextCtrlSavePath;
|
||||
|
||||
@@ -73,14 +86,17 @@ public:
|
||||
wxString DeleteGame;
|
||||
wxString GameAlreadyAdded;
|
||||
wxString ExitGameAnyway;
|
||||
wxString NoComment;
|
||||
wxString Title;
|
||||
wxString Author;
|
||||
wxString Comment;
|
||||
wxString SingleTextureNode;
|
||||
|
||||
wxString Error_GameIsHooked;
|
||||
wxString Error_ProcessNotStarted;
|
||||
wxString Error_RemoveHook;
|
||||
|
||||
wxString Error_FileNotSupported;
|
||||
wxString Error_FileIsEmpty;
|
||||
wxString Error_FktNotFound;
|
||||
wxString Error_D3DX9NotFound;
|
||||
wxString Error_DLLNotFound;
|
||||
@@ -101,9 +117,20 @@ public:
|
||||
wxString Error_Unzip;
|
||||
wxString Error_ZipEntry;
|
||||
|
||||
wxString CheckBoxUseSizeFilter;
|
||||
wxString CheckBoxUseFormatFilter;
|
||||
wxString SetFormatFilter;
|
||||
wxString WidthSpin;
|
||||
wxString HeightSpin;
|
||||
wxString DepthSpin;
|
||||
|
||||
wxString KeyBack;
|
||||
wxString KeySave;
|
||||
wxString KeyNext;
|
||||
wxString AskForKey;
|
||||
wxString KeyNotSet;
|
||||
wxString UnknownKey;
|
||||
|
||||
wxArrayString KeyStrings;
|
||||
wxArrayInt KeyValues;
|
||||
|
||||
|
||||
+51
-21
@@ -41,7 +41,11 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
#define wxUSE_TEXTCTRL 1
|
||||
#define wxUSE_CHOICEDLG 1
|
||||
#define wxUSE_TOOLTIPS 1
|
||||
#define wxUSE_DATAVIEWCTRL 1
|
||||
#define wxUSE_COLLPANE 1
|
||||
#define wxUSE_COLOURDLG 1
|
||||
#endif
|
||||
#define wxUSE_SPINCTRL 1
|
||||
|
||||
#define WINVER _WIN32_WINNT_WINXP
|
||||
#define _WIN32_WINNT _WIN32_WINNT_WINXP
|
||||
@@ -49,22 +53,26 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
|
||||
#include "wx\wx.h"
|
||||
#include "wx\notebook.h"
|
||||
#include <wx\wx.h>
|
||||
#include <wx\notebook.h>
|
||||
#include <wx/file.h>
|
||||
#include <wx/dir.h>
|
||||
#include <wx/tokenzr.h>
|
||||
#include <wx/dynlib.h>
|
||||
//#include <wx/thread.h>
|
||||
//#include "wx/checkbox.h"
|
||||
//#include <wx/msgdlg.h>
|
||||
//#include <wx/menu.h>
|
||||
//#include <wx/button.h>
|
||||
//#include <wx/filedlg.h>
|
||||
//#include <wx/choice.h>
|
||||
//#include <wx/textctrl.h>
|
||||
//#include <wx/choicdlg.h>
|
||||
|
||||
#include <wx/dataview.h>
|
||||
#include <wx/thread.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <wx/menu.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/filedlg.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/choicdlg.h>
|
||||
#include <wx/collpane.h>
|
||||
#include <wx/colourdata.h>
|
||||
#include <wx/colordlg.h>
|
||||
#include <wx/spinctrl.h>
|
||||
//#include <windows.h>
|
||||
|
||||
#include "../uMod_GlobalDefines.h"
|
||||
@@ -77,13 +85,7 @@ class uMod_Frame;
|
||||
#define MAX_TEXTURES 1024
|
||||
enum
|
||||
{
|
||||
ID_Button_Open = wxID_HIGHEST,
|
||||
ID_Button_Path,
|
||||
ID_Button_Update,
|
||||
ID_Button_Reload,
|
||||
//ID_Button_Save,
|
||||
//ID_Menu_Pref,
|
||||
ID_Menu_Exit,
|
||||
ID_Menu_Exit = wxID_HIGHEST,
|
||||
ID_Menu_Lang,
|
||||
ID_Menu_Help,
|
||||
ID_Menu_About,
|
||||
@@ -101,15 +103,42 @@ enum
|
||||
ID_Delete_Game,
|
||||
ID_Add_Device,
|
||||
ID_Delete_Device,
|
||||
ID_Button_Texture, //this entry must be the last!!
|
||||
|
||||
ID_OpenPackage,
|
||||
ID_RemovePackage,
|
||||
ID_RemoveSelectedPackages,
|
||||
ID_Update,
|
||||
ID_Reload,
|
||||
ID_SupportTPF,
|
||||
ID_Button_Update,
|
||||
|
||||
ID_CollPane,
|
||||
ID_SaveSingleTexture,
|
||||
ID_SaveAllTexture,
|
||||
ID_ShowSingleTextureString,
|
||||
ID_FontColour,
|
||||
ID_TextureColour,
|
||||
|
||||
ID_KeyPress,
|
||||
|
||||
ID_UseSizeFilter,
|
||||
ID_SpinMin, ID_SpinMax,
|
||||
ID_UseFormatFilter,
|
||||
ID_SetFormatFilter,
|
||||
ID_Button_SavePath,
|
||||
|
||||
ID_DataViewCtrl,
|
||||
ID_ContextMenu,
|
||||
};
|
||||
|
||||
#define ABORT_SERVER L"uMod_Abort_Server"
|
||||
#define uMod_d3d9_Hook_dll L"uMod_d3d9_HI.dll"
|
||||
#define uMod_d3d9_DI_dll L"uMod_d3d9_DI.dll"
|
||||
|
||||
#include "uMod_AddTexture.h"
|
||||
#include "uMod_Settings.h"
|
||||
#include "uMod_ModElement.h"
|
||||
#include "uMod_TreeView.h"
|
||||
#include "uMod_AddTexture.h"
|
||||
#include "uMod_Language.h"
|
||||
#include "uMod_Event.h"
|
||||
#include "uMod_Client.h"
|
||||
@@ -117,6 +146,7 @@ enum
|
||||
#include "uMod_File.h"
|
||||
#include "uMod_Sender.h"
|
||||
#include "uMod_Server.h"
|
||||
#include "uMod_MiniPanels.h"
|
||||
#include "uMod_GamePage.h"
|
||||
#include "uMod_DirectInjection.h"
|
||||
#include "uMod_GUI.h"
|
||||
|
||||
@@ -0,0 +1,355 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "uMod_Main.h"
|
||||
|
||||
#ifndef __CDT_PARSER__
|
||||
|
||||
BEGIN_EVENT_TABLE(uMod_SpinPanel, wxPanel)
|
||||
EVT_SPINCTRL(ID_SpinMin, uMod_SpinPanel::OnSpin)
|
||||
EVT_SPINCTRL(ID_SpinMax, uMod_SpinPanel::OnSpin)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
uMod_SpinPanel::uMod_SpinPanel(wxWindow *parent, int winid,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style, const wxString& name)
|
||||
: wxPanel( parent, winid, pos, size, style, name)
|
||||
{
|
||||
|
||||
Text = new wxTextCtrl( this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
|
||||
|
||||
Min = new wxSpinCtrl ( this, ID_SpinMin, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 65535, 1);
|
||||
|
||||
Max = new wxSpinCtrl ( this, ID_SpinMax, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 65535, 1);
|
||||
Max->SetRange( 1, 65535);
|
||||
|
||||
wxBoxSizer* spin_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
spin_sizer->Add( (wxWindow*) Text, 0, wxEXPAND, 0);
|
||||
|
||||
spin_sizer->Add( (wxWindow*) Min, 0, wxEXPAND, 0);
|
||||
spin_sizer->Add( (wxWindow*) new wxTextCtrl(this, wxID_ANY, " -", wxDefaultPosition, wxSize(25,10), wxTE_READONLY), 0, wxEXPAND, 0);
|
||||
spin_sizer->Add( (wxWindow*) Max, 0, wxEXPAND, 0);
|
||||
spin_sizer->AddStretchSpacer();
|
||||
|
||||
SetSizer(spin_sizer);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void uMod_SpinPanel::GetValue( int &min, int &max)
|
||||
{
|
||||
min = Min->GetValue();
|
||||
max = Max->GetValue();
|
||||
}
|
||||
|
||||
void uMod_SpinPanel::SetValue(int min, int max)
|
||||
{
|
||||
if (max<min) return;
|
||||
Min->SetValue( min);
|
||||
Max->SetValue( max);
|
||||
}
|
||||
|
||||
|
||||
void uMod_SpinPanel::SetLabel( const wxString &label)
|
||||
{
|
||||
Text->SetValue( label);
|
||||
}
|
||||
|
||||
|
||||
void uMod_SpinPanel::OnSpin(wxSpinEvent& event)
|
||||
{
|
||||
int min = Min->GetValue();
|
||||
int max = Max->GetValue();
|
||||
|
||||
if (event.GetId() == ID_SpinMin)
|
||||
{
|
||||
if (max<min) Max->SetValue(min);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (min>max) Min->SetValue(max);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
uMod_CheckBoxArray::uMod_CheckBoxArray(wxWindow *parent, const wxArrayString &choices, int col, int winid,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style, const wxString& name)
|
||||
: wxPanel( parent, winid, pos, size, style, name)
|
||||
{
|
||||
if (col>0)
|
||||
{
|
||||
wxGridSizer *sizer = new wxGridSizer( col, 0,0);
|
||||
|
||||
for (unsigned int i=0; i<choices.GetCount(); i++)
|
||||
{
|
||||
wxCheckBox *check_box = new wxCheckBox ( this, wxID_ANY, choices[i], wxDefaultPosition, wxDefaultSize);
|
||||
CheckBoxes.Add(check_box);
|
||||
sizer->Add(check_box);
|
||||
}
|
||||
SetSizer(sizer);
|
||||
}
|
||||
else
|
||||
{
|
||||
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
for (unsigned int i=0; i<choices.GetCount(); i++)
|
||||
{
|
||||
wxCheckBox *check_box = new wxCheckBox ( this, wxID_ANY, choices[i], wxDefaultPosition, wxDefaultSize);
|
||||
CheckBoxes.Add(check_box);
|
||||
sizer->Add(check_box, 0, wxEXPAND, 0);
|
||||
}
|
||||
sizer->AddStretchSpacer();
|
||||
SetSizer(sizer);
|
||||
}
|
||||
}
|
||||
|
||||
void uMod_CheckBoxArray::SetChoices(const wxArrayShort &choices)
|
||||
{
|
||||
for (unsigned int i=0; i<choices.GetCount() && i<CheckBoxes.GetCount(); i++)
|
||||
{
|
||||
if (choices[i]) CheckBoxes[i]->SetValue(true);
|
||||
else CheckBoxes[i]->SetValue(false);
|
||||
}
|
||||
}
|
||||
|
||||
void uMod_CheckBoxArray::GetChoices(wxArrayShort &choices)
|
||||
{
|
||||
choices.Empty();
|
||||
for (unsigned int i=0; i<CheckBoxes.GetCount(); i++)
|
||||
{
|
||||
if (CheckBoxes[i]->GetValue()) choices.Add(1);
|
||||
else choices.Add(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void uMod_CheckBoxArray::SetValue( unsigned long val)
|
||||
{
|
||||
for (unsigned int i=0; i<CheckBoxes.GetCount(); i++)
|
||||
{
|
||||
if (val & 1<<i) CheckBoxes[i]->SetValue(true);
|
||||
else CheckBoxes[i]->SetValue(false);
|
||||
}
|
||||
}
|
||||
|
||||
void uMod_CheckBoxArray::GetValue( unsigned long &val)
|
||||
{
|
||||
val = 0;
|
||||
for (unsigned int i=0; i<CheckBoxes.GetCount(); i++)
|
||||
{
|
||||
if (CheckBoxes[i]->GetValue()) val |= 1<<i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __CDT_PARSER__
|
||||
|
||||
BEGIN_EVENT_TABLE(uMod_KeyPanel, wxPanel)
|
||||
EVT_BUTTON(ID_KeyPress, uMod_KeyPanel::OnButton)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
uMod_KeyPanel::uMod_KeyPanel(wxWindow *parent, const wxString &label, int key, int winid,
|
||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name)
|
||||
: wxPanel( parent, winid, pos, size, style, name)
|
||||
{
|
||||
myKey = key;
|
||||
|
||||
Button = new wxButton( this, ID_KeyPress, label, wxDefaultPosition, wxSize(100,24));
|
||||
|
||||
KeyText = new wxTextCtrl( this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
|
||||
|
||||
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add( (wxWindow*) Button, 0, wxEXPAND, 0);
|
||||
sizer->AddSpacer(10);
|
||||
sizer->Add( (wxWindow*) KeyText, 0, wxEXPAND, 0);
|
||||
sizer->AddStretchSpacer();
|
||||
|
||||
SetKeyLabel();
|
||||
SetSizer(sizer);
|
||||
}
|
||||
|
||||
void uMod_KeyPanel::SetLabel(const wxString &label)
|
||||
{
|
||||
Button->SetLabel( label);
|
||||
}
|
||||
|
||||
void uMod_KeyPanel::OnButton(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
uMod_AskForKey *dialog = new uMod_AskForKey( Language->AskForKey);
|
||||
dialog->ShowModal();
|
||||
myKey = dialog->Key();
|
||||
delete dialog;
|
||||
|
||||
SetKeyLabel();
|
||||
}
|
||||
|
||||
|
||||
void uMod_KeyPanel::SetKeyLabel()
|
||||
{
|
||||
wxString temp;
|
||||
if (myKey<0)
|
||||
temp = Language->KeyNotSet;
|
||||
else
|
||||
{
|
||||
int index = Language->KeyValues.Index( myKey);
|
||||
if (index>=0)
|
||||
temp = Language->KeyStrings[index];
|
||||
else
|
||||
temp = Language->UnknownKey;
|
||||
|
||||
wxString code;
|
||||
code.Printf(" (%#X)", myKey);
|
||||
temp << code;
|
||||
}
|
||||
KeyText->SetValue(temp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __CDT_PARSER__
|
||||
|
||||
BEGIN_EVENT_TABLE(uMod_AskForKey, wxDialog)
|
||||
//EVT_KEY_UP(uMod_AskForKey::OnKey)
|
||||
EVT_CHAR_HOOK(uMod_AskForKey::OnKey)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
#endif
|
||||
|
||||
uMod_AskForKey::uMod_AskForKey(const wxString &title)
|
||||
: wxDialog( (wxWindow*)0, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER)
|
||||
{
|
||||
myKey = -1;
|
||||
}
|
||||
|
||||
void uMod_AskForKey::OnKey(wxKeyEvent& event)
|
||||
{
|
||||
myKey = event.GetRawKeyCode();//GetKeyCode();
|
||||
EndModal(0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
uMod_TextureFormat::uMod_TextureFormat(wxWindow *parent, const wxString &title)
|
||||
: wxDialog(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER)
|
||||
{
|
||||
wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxArrayString choices;
|
||||
|
||||
choices.Add("R8G8B8");
|
||||
choices.Add("A8R8G8B8");
|
||||
choices.Add("X8R8G8B8");
|
||||
choices.Add("R5G6B");
|
||||
choices.Add("X1R5G5B5");
|
||||
choices.Add("A1R5G5B5");
|
||||
choices.Add("A4R4G4B4");
|
||||
choices.Add("R3G3B2");
|
||||
choices.Add("A8");
|
||||
choices.Add("A8R3G3B2");
|
||||
choices.Add("X4R4G4B4");
|
||||
choices.Add("A2B10G10R10");
|
||||
choices.Add("A8B8G8R8");
|
||||
choices.Add("X8B8G8R8");
|
||||
choices.Add("G16R16");
|
||||
choices.Add("A2R10G10B10");
|
||||
choices.Add("A16B16G16R16");
|
||||
|
||||
choices.Add("A8P8");
|
||||
choices.Add("P8");
|
||||
|
||||
choices.Add("L8");
|
||||
choices.Add("A8L8");
|
||||
choices.Add("A4L4");
|
||||
|
||||
choices.Add("V8U8");
|
||||
choices.Add("L6V5U5");
|
||||
choices.Add("X8L8V8U8");
|
||||
choices.Add("Q8W8V8U8");
|
||||
choices.Add("V16U16");
|
||||
choices.Add("A2W10V10U10");
|
||||
|
||||
choices.Add("UYVY");
|
||||
choices.Add("R8G8_B8G8");
|
||||
choices.Add("YUY2");
|
||||
choices.Add("G8R8_G8B8");
|
||||
choices.Add("DXT1");
|
||||
choices.Add("DXT2");
|
||||
choices.Add("DXT3");
|
||||
choices.Add("DXT4");
|
||||
choices.Add("DXT5");
|
||||
|
||||
choices.Add("D16_LOCKABLE");
|
||||
choices.Add("D32");
|
||||
choices.Add("D15S1");
|
||||
choices.Add("D24S8");
|
||||
choices.Add("D24X8");
|
||||
choices.Add("D24X4S4");
|
||||
choices.Add("D16");
|
||||
|
||||
choices.Add("D32F_LOCKABLE");
|
||||
choices.Add("D24FS8");
|
||||
|
||||
choices.Add("D32_LOCKABLE");
|
||||
choices.Add("S8_LOCKABLE");
|
||||
|
||||
choices.Add("L16");
|
||||
|
||||
choices.Add("VERTEXDATA");
|
||||
choices.Add("INDEX16");
|
||||
choices.Add("INDEX32");
|
||||
|
||||
choices.Add("Q16W16V16U16");
|
||||
|
||||
choices.Add("MULTI2_ARGB8");
|
||||
|
||||
choices.Add("R16F");
|
||||
choices.Add("G16R16F");
|
||||
choices.Add("A16B16G16R16F");
|
||||
|
||||
choices.Add("R32F");
|
||||
choices.Add("G32R32F");
|
||||
choices.Add("A32B32G32R32F");
|
||||
|
||||
choices.Add("CxV8U8");
|
||||
|
||||
choices.Add("A1");
|
||||
choices.Add("A2B10G10R10_XR_BIAS");
|
||||
choices.Add("BINARYBUFFER");
|
||||
|
||||
TextureFormats = new uMod_CheckBoxArray( this, choices, 4);
|
||||
sizer->Add( (wxWindow*) TextureFormats, 0, wxEXPAND, 0);
|
||||
|
||||
SetSizer(sizer);
|
||||
wxArrayInt selections;
|
||||
wxGetSelectedChoices( selections, Language->DeleteGame, Language->DeleteGame, choices);
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "uMod_Main.h"
|
||||
|
||||
#ifndef UMOD_MINIPANELS_H_
|
||||
#define UMOD_MINIPANELS_H_
|
||||
|
||||
|
||||
class uMod_SpinPanel : public wxPanel
|
||||
{
|
||||
public:
|
||||
uMod_SpinPanel(wxWindow *parent, int winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
virtual ~uMod_SpinPanel() {}
|
||||
|
||||
/**
|
||||
* Get the min an max value
|
||||
* @param[out] min
|
||||
* @param[out] max
|
||||
*/
|
||||
void GetValue( int &min, int &max);
|
||||
|
||||
/**
|
||||
* Set the min and max value
|
||||
* @param[in] min
|
||||
* @param[in] max
|
||||
*/
|
||||
void SetValue(int min, int max);
|
||||
|
||||
|
||||
/**
|
||||
* Set the label of the text ctrl
|
||||
* @param label
|
||||
* @return
|
||||
*/
|
||||
void SetLabel( const wxString &label);
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Gets called, when one of the spin boxes changes their value
|
||||
* @param event
|
||||
*/
|
||||
void OnSpin(wxSpinEvent& event);
|
||||
|
||||
wxTextCtrl *Text;
|
||||
wxSpinCtrl *Min, *Max;
|
||||
|
||||
DECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
||||
|
||||
WX_DEFINE_ARRAY_PTR( wxCheckBox*, wxCheckBox_Array );
|
||||
|
||||
class uMod_CheckBoxArray : public wxPanel
|
||||
{
|
||||
public:
|
||||
uMod_CheckBoxArray(wxWindow *parent, const wxArrayString &choices, int col, int winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
virtual ~uMod_CheckBoxArray() {}
|
||||
|
||||
void SetChoices(const wxArrayShort &choices);
|
||||
void GetChoices(wxArrayShort &choices);
|
||||
|
||||
|
||||
void SetValue( unsigned long val);
|
||||
void GetValue( unsigned long &val);
|
||||
|
||||
private:
|
||||
wxCheckBox_Array CheckBoxes;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* this class is a mini panel with a set key button and string beside it which shows the actual set key
|
||||
*/
|
||||
class uMod_KeyPanel : public wxPanel
|
||||
{
|
||||
public:
|
||||
uMod_KeyPanel(wxWindow *parent, const wxString &label, int key, int winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
virtual ~uMod_KeyPanel() {}
|
||||
|
||||
int GetKey() {return myKey;}
|
||||
void SetKey(int key) {myKey = key; SetKeyLabel();}
|
||||
|
||||
/**
|
||||
* set the label of the button (for changing the language)
|
||||
* @param label
|
||||
*/
|
||||
void SetLabel(const wxString &label);
|
||||
private:
|
||||
|
||||
/**
|
||||
* called if button was clicked
|
||||
* @param event
|
||||
*/
|
||||
void OnButton(wxCommandEvent& event);
|
||||
|
||||
void SetKeyLabel();
|
||||
|
||||
wxButton *Button;
|
||||
wxTextCtrl *KeyText;
|
||||
|
||||
int myKey;
|
||||
DECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
||||
|
||||
class uMod_AskForKey : public wxDialog
|
||||
{
|
||||
public:
|
||||
uMod_AskForKey(const wxString &title);
|
||||
virtual ~uMod_AskForKey() {}
|
||||
|
||||
|
||||
int Key() {return myKey;}
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* called if a key was hit
|
||||
* @param event
|
||||
*/
|
||||
void OnKey(wxKeyEvent& event);
|
||||
|
||||
int myKey;
|
||||
DECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
class uMod_TextureFormat : public wxDialog
|
||||
{
|
||||
public:
|
||||
uMod_TextureFormat(wxWindow *parent, const wxString &title);
|
||||
virtual ~uMod_TextureFormat() {}
|
||||
|
||||
void SetValue( unsigned long val) {TextureFormats->SetValue(val);}
|
||||
void GetValue( unsigned long &val) {TextureFormats->GetValue(val);}
|
||||
private:
|
||||
|
||||
uMod_CheckBoxArray *TextureFormats;
|
||||
};
|
||||
|
||||
*/
|
||||
#endif /* UMOD_MINIPANELS_H_ */
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* uMod_ModElement.cpp
|
||||
*
|
||||
* Created on: 26.06.2012
|
||||
* Author: marts
|
||||
*/
|
||||
|
||||
|
||||
#include "uMod_Main.h"
|
||||
|
||||
|
||||
int Compare_uMod_TextureElement(uMod_TextureElement* a,uMod_TextureElement* b)
|
||||
{
|
||||
if ( a->Hash() < b->Hash()) return -1;
|
||||
else if ( a->Hash() == b->Hash()) return 0;
|
||||
else return +1;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "uMod_Main.h"
|
||||
#ifndef UMOD_MODELEMEMT_H_
|
||||
#define UMOD_MODELEMEMT_H_
|
||||
|
||||
|
||||
template <class T>
|
||||
class uMod_Data
|
||||
{
|
||||
public:
|
||||
uMod_Data(void): myData((T*)0), myLen(0) {}
|
||||
~uMod_Data() {if (myData!=(T*)0) delete [] myData;}
|
||||
|
||||
T* &Data(void) {return myData;}
|
||||
const T* &Data(void) const {return myData;}
|
||||
|
||||
unsigned int &Len(void) {return myLen;}
|
||||
const unsigned int &Len(void) const {return myLen;}
|
||||
|
||||
int SetSize(int size)
|
||||
{
|
||||
if (myData!=(T*)0) delete [] myData;
|
||||
myData = (T*)0;
|
||||
if (size<=0) return 0;
|
||||
|
||||
try {myData = new T[size];}
|
||||
catch (...) {myData=(T*)0;return -1;}
|
||||
myLen = size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
T *myData;
|
||||
unsigned int myLen;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* This class is a representation of one element, to be modified (e.g. one texture)
|
||||
*/
|
||||
|
||||
class uMod_ModElement
|
||||
{
|
||||
public:
|
||||
|
||||
enum enumType
|
||||
{
|
||||
Group,
|
||||
Texture
|
||||
};
|
||||
|
||||
enum enumStatus
|
||||
{
|
||||
Activate,
|
||||
Deactivate,
|
||||
NONE
|
||||
};
|
||||
|
||||
uMod_ModElement( enumType t, enumStatus s = NONE) : myType(t), myStatus(s), myCounter(1) {}
|
||||
virtual ~uMod_ModElement() {}
|
||||
|
||||
int AddRef(void) {return ++myCounter;}
|
||||
int Release(void) {if (--myCounter==0) {delete this;} return myCounter;}
|
||||
|
||||
|
||||
const wxString &File(void) const {return myFile;}
|
||||
wxString &File(void) {return myFile;}
|
||||
|
||||
const wxString &Title(void) const {return myTitle;}
|
||||
wxString &Title(void) {return myTitle;}
|
||||
|
||||
const wxString &Author(void) const {return myAuthor;}
|
||||
wxString &Author(void) {return myAuthor;}
|
||||
|
||||
const wxString &Comment(void) const {return myComment;}
|
||||
wxString &Comment(void) {return myComment;}
|
||||
|
||||
|
||||
enumType Type(void) const {return myType;}
|
||||
//void SetType(Type type) {myType = type;}
|
||||
|
||||
const enumStatus &Status(void) const {return myStatus;}
|
||||
enumStatus &Status(void) {return myStatus;}
|
||||
|
||||
private:
|
||||
|
||||
wxString myFile;
|
||||
wxString myTitle;
|
||||
wxString myAuthor;
|
||||
wxString myComment;
|
||||
const enumType myType;
|
||||
enumStatus myStatus;
|
||||
int myCounter;
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
* forbid assignment!
|
||||
* @param rh
|
||||
* @return
|
||||
*/
|
||||
uMod_ModElement operator= (const uMod_ModElement & rh) {(void*) &rh; return *this;}
|
||||
};
|
||||
|
||||
|
||||
class uMod_TextureElement : public uMod_ModElement
|
||||
{
|
||||
public:
|
||||
uMod_TextureElement() : uMod_ModElement(Texture) {}
|
||||
virtual ~uMod_TextureElement() {}
|
||||
|
||||
|
||||
uMod_Data<char> &Content(void) {return myContent;}
|
||||
|
||||
|
||||
const DWORD64 &Hash(void) const {return myHash;}
|
||||
DWORD64 &Hash(void) {return myHash;}
|
||||
|
||||
private:
|
||||
uMod_Data<char> myContent;
|
||||
DWORD64 myHash;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* forbid assignment!
|
||||
* @param rh
|
||||
* @return
|
||||
*/
|
||||
uMod_TextureElement operator= (const uMod_TextureElement & rh) {(void*) &rh; return *this;}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//WX_DEFINE_ARRAY_PTR( uMod_ModElement*, uMod_ModElement_ArrayPtr );
|
||||
|
||||
WX_DEFINE_SORTED_ARRAY( uMod_TextureElement*, uMod_TextureElement_SortedArrayPtr );
|
||||
int Compare_uMod_TextureElement(uMod_TextureElement* a, uMod_TextureElement* b);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* UMOD_MODELEMENT_H_ */
|
||||
+191
-252
@@ -23,45 +23,45 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
uMod_Sender::uMod_Sender(PipeStruct &pipe) : Pipe(pipe)
|
||||
{
|
||||
OldTextures = NULL;
|
||||
OldTexturesNum = 0;
|
||||
try {Buffer = new char[BIG_BUFSIZE];}
|
||||
catch (...) {Buffer=NULL;}
|
||||
catch (...) {Buffer=(char*)0;}
|
||||
OldTextures = (uMod_TextureElement_SortedArrayPtr*)0;
|
||||
}
|
||||
|
||||
uMod_Sender::~uMod_Sender(void)
|
||||
{
|
||||
if (Buffer!=NULL) delete [] Buffer;
|
||||
if (OldTextures!=NULL) delete [] OldTextures;
|
||||
if (Buffer!=(char*)0) delete [] Buffer;
|
||||
if (OldTextures != (uMod_TextureElement_SortedArrayPtr*)0)
|
||||
{
|
||||
for (unsigned int t=0; t<OldTextures->GetCount(); t++)
|
||||
{
|
||||
OldTextures->Item(t)->Release();
|
||||
}
|
||||
delete OldTextures;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int uMod_Sender::Send( const uMod_GameInfo &game, const uMod_GameInfo &game_old, bool force, wxArrayString *comments)
|
||||
int uMod_Sender::Send( const uMod_GameInfo &game, const uMod_GameInfo &game_old, uMod_TextureElement_SortedArrayPtr* current_textures, bool force)
|
||||
{
|
||||
LastError.Empty();
|
||||
|
||||
int key = game.GetKeyBack();
|
||||
if (key>=0 && key!=game_old.GetKeyBack())
|
||||
{
|
||||
key = Language->KeyValues[key];
|
||||
SendKey( key, CONTROL_KEY_BACK);
|
||||
}
|
||||
|
||||
key = game.GetKeySave();
|
||||
if (key>=0 && key!=game_old.GetKeySave())
|
||||
{
|
||||
key = Language->KeyValues[key];
|
||||
SendKey( key, CONTROL_KEY_SAVE);
|
||||
}
|
||||
|
||||
key = game.GetKeyNext();
|
||||
if (key>=0 && key!=game_old.GetKeyNext())
|
||||
{
|
||||
key = Language->KeyValues[key];
|
||||
SendKey( key, CONTROL_KEY_NEXT);
|
||||
}
|
||||
|
||||
int colour[3], colour_old[3];
|
||||
unsigned char colour[4], colour_old[4];
|
||||
game.GetFontColour( colour);
|
||||
game_old.GetFontColour( colour_old);
|
||||
for (int i=0; i<3; i++) if (colour[i]!=colour_old[i])
|
||||
for (int i=0; i<4; i++) if (colour[i]!=colour_old[i])
|
||||
{
|
||||
SendColour( colour, CONTROL_FONT_COLOUR);
|
||||
break;
|
||||
@@ -69,182 +69,57 @@ int uMod_Sender::Send( const uMod_GameInfo &game, const uMod_GameInfo &game_old,
|
||||
|
||||
game.GetTextureColour( colour);
|
||||
game_old.GetTextureColour( colour_old);
|
||||
for (int i=0; i<3; i++) if (colour[i]!=colour_old[i])
|
||||
for (int i=0; i<4; i++) if (colour[i]!=colour_old[i])
|
||||
{
|
||||
SendColour( colour, CONTROL_TEXTURE_COLOUR);
|
||||
break;
|
||||
}
|
||||
|
||||
SendDWORD64( game.FileFormat(), CONTROL_SAVE_FORMAT);
|
||||
|
||||
if ( game.GetSaveSingleTexture() != game_old.GetSaveSingleTexture() ) SendSaveSingleTexture( game.GetSaveSingleTexture());
|
||||
if ( game.GetSaveAllTextures() != game_old.GetSaveAllTextures() ) SendSaveAllTextures(game.GetSaveAllTextures());
|
||||
if (game.UseFormatFilter())
|
||||
SendDWORD64( game.FormatFilter(), CONTROL_FORMAT_FILTER);
|
||||
else
|
||||
SendDWORD64( 0u, CONTROL_FORMAT_FILTER);
|
||||
|
||||
if (game.UseSizeFilter())
|
||||
{
|
||||
SendMinMax( game.WidthMin(), game.WidthMax(), CONTROL_WIDTH_FILTER);
|
||||
SendMinMax( game.HeightMin(), game.HeightMax(), CONTROL_HEIGHT_FILTER);
|
||||
SendMinMax( game.DepthMin(), game.DepthMax(), CONTROL_DEPTH_FILTER);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMinMax( 0, 0, CONTROL_HEIGHT_FILTER);
|
||||
SendMinMax( 0, 0, CONTROL_HEIGHT_FILTER);
|
||||
SendMinMax( 0, 0, CONTROL_HEIGHT_FILTER);
|
||||
}
|
||||
|
||||
SendBool( game.ShowSingleTextureString(), CONTROL_SHOW_STRING);
|
||||
SendBool( game.GetSaveSingleTexture(), CONTROL_SAVE_SINGLE);
|
||||
SendBool(game.GetSaveAllTextures(), CONTROL_SAVE_ALL);
|
||||
|
||||
SendBool(game.SupportTPF(), CONTROL_SUPPORT_TPF);
|
||||
|
||||
wxString path;
|
||||
path = game.GetSavePath();
|
||||
if (path!=game_old.GetSavePath()) SendPath(path);
|
||||
|
||||
|
||||
if (game.GetNumberOfFiles()<=0 && OldTexturesNum==0 && OldTextures==NULL)
|
||||
|
||||
|
||||
if ( OldTextures== (uMod_TextureElement_SortedArrayPtr*)0) OldTextures = new uMod_TextureElement_SortedArrayPtr( Compare_uMod_TextureElement );
|
||||
|
||||
//uMod_TextureElement_SortedArrayPtr* current_textures = new uMod_TextureElement_SortedArrayPtr( Compare_uMod_TextureElement );
|
||||
|
||||
SendTextures( *OldTextures, *current_textures, force);
|
||||
|
||||
for (unsigned int t=0; t<OldTextures->GetCount(); t++)
|
||||
{
|
||||
if (LastError.Len()>0) return 1;
|
||||
else return 0;
|
||||
OldTextures->Item(t)->Release();
|
||||
}
|
||||
|
||||
wxArrayString files;
|
||||
|
||||
game.GetFiles( files);
|
||||
int num = files.GetCount();
|
||||
bool *checked = NULL;
|
||||
if (num>0)
|
||||
{
|
||||
if (GetMemory(checked, num)) {LastError << Language->Error_Memory; return -1;}
|
||||
game.GetChecked( checked, num);
|
||||
}
|
||||
|
||||
AddTextureClass *tex = NULL;//new AddTextureClass[num+OldTexturesNum];
|
||||
if (GetMemory( tex, num+OldTexturesNum)) {LastError << Language->Error_Memory; return -1;}
|
||||
wxString comment;
|
||||
|
||||
if (force || OldTexturesNum==0 || OldTextures==NULL)
|
||||
{
|
||||
//reload everything
|
||||
for (int i=0; i<num; i++)
|
||||
{
|
||||
uMod_File file( files[i]);
|
||||
if (file.GetComment(comment))
|
||||
{
|
||||
LastError << file.LastError;
|
||||
file.LastError.Empty();
|
||||
}
|
||||
tex[i].Comment = comment;
|
||||
|
||||
tex[i].Add = checked[i];
|
||||
tex[i].Force = true;
|
||||
tex[i].File = files[i];
|
||||
if (file.GetContent( tex[i], checked[i]))
|
||||
{
|
||||
LastError << file.LastError;
|
||||
file.LastError.Empty();
|
||||
}
|
||||
}
|
||||
|
||||
// append all packages, which was added but (maybe) are no longer in the list
|
||||
int append = 0;
|
||||
if (OldTexturesNum>0 && OldTextures!=NULL)
|
||||
{
|
||||
for (int i=0; i<OldTexturesNum; i++)
|
||||
{
|
||||
if (OldTextures[i].Add)
|
||||
{
|
||||
bool del = true;
|
||||
for (int j=0; j<num; j++) if (OldTextures[i].File==tex[j].File) {del=false; break;}
|
||||
if (del)
|
||||
{
|
||||
tex[num+append].InheriteMemory(OldTextures[i]);
|
||||
tex[num+append].Add = false;
|
||||
tex[num+append].Force = true;
|
||||
append++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SendTextures( num+append, tex);
|
||||
}
|
||||
else
|
||||
{
|
||||
//search for same packages to avoid reload from disk
|
||||
|
||||
//first step: maybe the order did not change
|
||||
int pos = 0;
|
||||
bool *hit=NULL;
|
||||
if (GetMemory( hit, OldTexturesNum, false)) {LastError << Language->Error_Memory; return -1;}
|
||||
for (pos=0; pos<num && pos<OldTexturesNum; pos++)
|
||||
{
|
||||
if (OldTextures[pos].File == files[pos])
|
||||
{
|
||||
tex[pos].InheriteMemory(OldTextures[pos]);
|
||||
tex[pos].Force = false;
|
||||
hit[pos] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//second step: if the order changed -> looking brute force
|
||||
for (int i=pos; i<num; i++) for (int j=pos; j<OldTexturesNum; j++)
|
||||
{
|
||||
if (!hit[j] && OldTextures[j].File == files[i])
|
||||
{
|
||||
tex[i].InheriteMemory(OldTextures[j]);
|
||||
tex[i].Force = false;
|
||||
hit[j] = true;
|
||||
}
|
||||
}
|
||||
|
||||
//next step, set Add to true or false and load packages, which are not loaded
|
||||
for (int i=0; i<num; i++)
|
||||
{
|
||||
tex[i].Add = checked[i];
|
||||
|
||||
if (tex[i].Len==0 || (tex[i].Add && !tex[i].Loaded) )
|
||||
{
|
||||
uMod_File file( files[i]);
|
||||
if (file.GetComment(comment))
|
||||
{
|
||||
LastError << file.LastError;
|
||||
file.LastError.Empty();
|
||||
}
|
||||
tex[i].Comment = comment;
|
||||
|
||||
tex[i].Add = checked[i];
|
||||
tex[i].Force = true;
|
||||
tex[i].File = files[i];
|
||||
if (file.GetContent( tex[i], checked[i]))
|
||||
{
|
||||
LastError << file.LastError;
|
||||
file.LastError.Empty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// append all packages, which was added but are no longer in the list
|
||||
int append = 0;
|
||||
if (OldTexturesNum!=0 && OldTextures!=NULL)
|
||||
{
|
||||
for (int j=pos; j<OldTexturesNum; j++)
|
||||
{
|
||||
if (!hit[j] && OldTextures[j].Add)
|
||||
{
|
||||
bool del = true;
|
||||
for (int i=pos; i<num; i++) if (OldTextures[j].File==tex[i].File) {del=false; break;}
|
||||
if (del)
|
||||
{
|
||||
tex[num+append].InheriteMemory(OldTextures[j]);
|
||||
tex[num+append].Add = false;
|
||||
tex[num+append].Force = true;
|
||||
append++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SendTextures( num+append, tex);
|
||||
if (hit!=NULL) delete [] hit;
|
||||
}
|
||||
if (checked!=NULL) delete [] checked;
|
||||
|
||||
if (comments!=NULL && num>0)
|
||||
{
|
||||
comments->Empty();
|
||||
comments->Alloc(num);
|
||||
for (int i=0; i<num; i++) comments->Add(tex[i].Comment);
|
||||
}
|
||||
|
||||
if (OldTextures!=NULL) delete [] OldTextures;
|
||||
|
||||
OldTexturesNum = num;
|
||||
OldTextures = tex;
|
||||
delete OldTextures;
|
||||
OldTextures = current_textures;
|
||||
|
||||
if (LastError.Len()>0) return 1;
|
||||
else return 0;
|
||||
@@ -275,101 +150,132 @@ int uMod_Sender::SendSaveSingleTexture(bool val)
|
||||
}
|
||||
|
||||
|
||||
int uMod_Sender::SendTextures(unsigned int num, AddTextureClass *tex)
|
||||
int uMod_Sender::SendTextures(const uMod_TextureElement_SortedArrayPtr &old_tex, const uMod_TextureElement_SortedArrayPtr &new_tex, bool force)
|
||||
{
|
||||
if (Buffer==NULL) return (RETURN_NO_MEMORY);
|
||||
if (Buffer==(char*)0) return (RETURN_NO_MEMORY);
|
||||
|
||||
unsigned int old_pos=0;
|
||||
unsigned int new_pos=0;
|
||||
MsgStruct *msg;
|
||||
int pos = 0;
|
||||
for (unsigned int i=0u; i<num; i++) for (unsigned int j=0u; j<tex[i].Num; j++)
|
||||
int buffer_pos = 0;
|
||||
|
||||
// both arrays are sorted
|
||||
// we go through both arrays in parallel
|
||||
while (old_pos<old_tex.GetCount() && new_pos<new_tex.GetCount())
|
||||
{
|
||||
if (tex[i].Force || !tex[i].Add || !tex[i].WasAdded[j])
|
||||
// if force==true we must update
|
||||
// tex[i].Add!=true we can always remove, cause removing does cost time in the render thread
|
||||
// if tex[i].Add==true and WasAdded[j]!=true this texture was not loaded but should be loaded, so maybe we can load it now
|
||||
if (old_tex[old_pos]->Hash() < new_tex[new_pos]->Hash())
|
||||
{
|
||||
bool hit = false; //we send only if this has was not send before
|
||||
unsigned long temp_hash = tex[i].Hash[j];
|
||||
for (unsigned int ii=0u; ii<i && !hit; ii++) for (unsigned int jj=0u; jj<tex[ii].Num && !hit; jj++) if (temp_hash==tex[ii].Hash[jj]) hit=true;
|
||||
for (unsigned int jj=0u; jj<j && !hit; jj++) if (temp_hash==tex[i].Hash[jj]) hit=true;
|
||||
if (hit)
|
||||
{
|
||||
tex[i].WasAdded[j]=false; //no matter what is done for this hash before, this texture is not added!
|
||||
continue;
|
||||
}
|
||||
|
||||
unsigned int size = tex[i].Size[j];
|
||||
if ((sizeof(MsgStruct) + pos) >=BIG_BUFSIZE) //the buffer is full
|
||||
{
|
||||
if (int ret = SendToGame( Buffer, pos)) return ret;
|
||||
pos = 0;
|
||||
}
|
||||
|
||||
msg = (MsgStruct*) &Buffer[pos];
|
||||
msg->Hash = temp_hash;
|
||||
msg->Value = size;
|
||||
pos += sizeof(MsgStruct);
|
||||
|
||||
if (tex[i].Add)
|
||||
{
|
||||
msg->Control = CONTROL_FORCE_RELOAD_TEXTURE_DATA; //we always force because whether force is true or not
|
||||
//if (Add==true && WasAdded[j]!=true) the texture is loaded the first time, or in previous loads it could not be loaded
|
||||
//because an other texture was send with the same hash, in all cases forcing is the best choice (atm)
|
||||
char* temp = tex[i].Textures[j];
|
||||
if (temp!=NULL)
|
||||
{
|
||||
unsigned int l = 0u;
|
||||
while (l<size)
|
||||
{
|
||||
while (pos<BIG_BUFSIZE && l<size) Buffer[pos++] = temp[l++];
|
||||
if (pos==BIG_BUFSIZE)
|
||||
{
|
||||
if (int ret = SendToGame( Buffer, pos)) return ret;
|
||||
pos = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
tex[i].WasAdded[j] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg->Control = CONTROL_REMOVE_TEXTURE;
|
||||
tex[i].WasAdded[j] = false;
|
||||
}
|
||||
RemoveTexture(old_tex[old_pos], buffer_pos);
|
||||
old_pos++;
|
||||
}
|
||||
else if (tex[i].Add && tex[i].WasAdded[j]) // this texture could be removed, due to a rearranging of the list
|
||||
else if (old_tex[old_pos]->Hash() < new_tex[new_pos]->Hash())
|
||||
{
|
||||
bool hit = false; //we send only if this has was not send before
|
||||
unsigned long temp_hash = tex[i].Hash[j];
|
||||
for (unsigned int ii=0u; ii<i && !hit; ii++) for (unsigned int jj=0u; jj<tex[ii].Num && !hit; jj++) if (temp_hash==tex[ii].Hash[jj]) hit=true;
|
||||
for (unsigned int jj=0u; jj<j && !hit; jj++) if (temp_hash==tex[i].Hash[jj]) hit=true;
|
||||
if (hit)
|
||||
{
|
||||
tex[i].WasAdded[j]=false; // due to rearranging this texture is replaced by an other texture
|
||||
}
|
||||
AddTexture(new_tex[new_pos], buffer_pos);
|
||||
new_pos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
//add if forced or if pointer are not the same, which means that two different textures modify the same target texture
|
||||
if (force || old_tex[old_pos]!=new_tex[new_pos]) AddTexture( new_tex[new_pos], buffer_pos);
|
||||
new_pos++;
|
||||
old_pos++;
|
||||
}
|
||||
}
|
||||
|
||||
if ((sizeof(MsgStruct) + pos) >=BIG_BUFSIZE) //the buffer is full
|
||||
// add remaining texture in new_tex
|
||||
while (new_pos<new_tex.GetCount())
|
||||
{
|
||||
if (int ret = SendToGame( Buffer, pos)) return ret;
|
||||
pos = 0;
|
||||
AddTexture(new_tex[new_pos], buffer_pos);
|
||||
new_pos++;
|
||||
}
|
||||
|
||||
msg = (MsgStruct*) &Buffer[pos];
|
||||
|
||||
// delete remaining texture in old_tex
|
||||
while (old_pos<old_tex.GetCount())
|
||||
{
|
||||
RemoveTexture(old_tex[old_pos], buffer_pos);
|
||||
old_pos++;
|
||||
}
|
||||
|
||||
|
||||
//empty the buffer if it can't hold 1 MsgStruct anymore
|
||||
if ((sizeof(MsgStruct) + buffer_pos) >=BIG_BUFSIZE) //the buffer is full
|
||||
{
|
||||
if (int ret = SendToGame( Buffer, buffer_pos)) return ret;
|
||||
buffer_pos = 0;
|
||||
}
|
||||
|
||||
msg = (MsgStruct*) &Buffer[buffer_pos];
|
||||
msg->Control = CONTROL_END_TEXTURES; //End of texture sending
|
||||
msg->Hash = 0u;
|
||||
msg->Value = 0;
|
||||
pos += sizeof(MsgStruct);
|
||||
if (int ret = SendToGame( Buffer, pos)) return ret;
|
||||
buffer_pos += sizeof(MsgStruct);
|
||||
if (int ret = SendToGame( Buffer, buffer_pos)) return ret;
|
||||
|
||||
if (LastError.Len()>0) return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
int uMod_Sender::AddTexture( uMod_TextureElement *tex, int &buffer_pos)
|
||||
{
|
||||
MsgStruct *msg;
|
||||
unsigned int size = tex->Content().Len();
|
||||
if ((sizeof(MsgStruct) + buffer_pos) >=BIG_BUFSIZE) //the buffer is full
|
||||
{
|
||||
if (int ret = SendToGame( Buffer, buffer_pos)) return ret;
|
||||
buffer_pos = 0;
|
||||
}
|
||||
|
||||
msg = (MsgStruct*) &Buffer[buffer_pos];
|
||||
msg->Hash = tex->Hash();
|
||||
msg->Value = size;
|
||||
msg->Control = CONTROL_FORCE_RELOAD_TEXTURE_DATA;
|
||||
|
||||
|
||||
buffer_pos += sizeof(MsgStruct);
|
||||
|
||||
const char* temp = tex->Content().Data();
|
||||
if (temp!=(char*)0)
|
||||
{
|
||||
unsigned int l = 0u;
|
||||
while (l<size)
|
||||
{
|
||||
while (buffer_pos<BIG_BUFSIZE && l<size) Buffer[buffer_pos++] = temp[l++];
|
||||
if (buffer_pos==BIG_BUFSIZE)
|
||||
{
|
||||
if (int ret = SendToGame( Buffer, buffer_pos)) return ret;
|
||||
buffer_pos = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (LastError.Len()>0) return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
int uMod_Sender::RemoveTexture( uMod_TextureElement *tex, int &buffer_pos)
|
||||
{
|
||||
MsgStruct *msg;
|
||||
//empty the buffer if it can't hold 1 MsgStruct anymore
|
||||
if ((sizeof(MsgStruct) + buffer_pos) >=BIG_BUFSIZE) //the buffer is full
|
||||
{
|
||||
if (int ret = SendToGame( Buffer, buffer_pos)) return ret;
|
||||
buffer_pos = 0;
|
||||
}
|
||||
|
||||
msg = (MsgStruct*) &Buffer[buffer_pos];
|
||||
msg->Hash = tex->Hash();
|
||||
msg->Control = CONTROL_REMOVE_TEXTURE;
|
||||
buffer_pos += sizeof(MsgStruct);
|
||||
|
||||
|
||||
if (LastError.Len()>0) return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
int uMod_Sender::SendKey(int key, int ctr)
|
||||
{
|
||||
if (key<0) key=0;
|
||||
MsgStruct msg;
|
||||
msg.Control = ctr;
|
||||
msg.Value = key;
|
||||
@@ -380,11 +286,11 @@ int uMod_Sender::SendKey(int key, int ctr)
|
||||
|
||||
#define D3DCOLOR_ARGB(a,r,g,b) ((DWORD)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
|
||||
|
||||
int uMod_Sender::SendColour( int* colour, int ctr)
|
||||
int uMod_Sender::SendColour( unsigned char* colour, int ctr)
|
||||
{
|
||||
MsgStruct msg;
|
||||
msg.Control = ctr;
|
||||
msg.Value = D3DCOLOR_ARGB( 255, colour[0], colour[1], colour[2]);
|
||||
msg.Value = D3DCOLOR_ARGB( colour[3], colour[0], colour[1], colour[2]);
|
||||
msg.Hash = 0u;
|
||||
|
||||
return SendToGame( (void*) &msg, sizeof(MsgStruct));
|
||||
@@ -411,6 +317,39 @@ int uMod_Sender::SendPath( const wxString &path)
|
||||
}
|
||||
|
||||
|
||||
int uMod_Sender::SendBool( bool val, int ctr)
|
||||
{
|
||||
MsgStruct msg;
|
||||
msg.Control = ctr;
|
||||
if (val) msg.Value = 1;
|
||||
else msg.Value = 0;
|
||||
msg.Hash = 0u;
|
||||
|
||||
return SendToGame( (void*) &msg, sizeof(MsgStruct));
|
||||
}
|
||||
int uMod_Sender::SendDWORD64( DWORD64 val, int ctr)
|
||||
{
|
||||
MsgStruct msg;
|
||||
msg.Control = ctr;
|
||||
msg.Value = val;
|
||||
msg.Hash = 0u;
|
||||
|
||||
return SendToGame( (void*) &msg, sizeof(MsgStruct));
|
||||
}
|
||||
|
||||
int uMod_Sender::SendMinMax( unsigned long min, unsigned long max, int ctr)
|
||||
{
|
||||
DWORD64 u_min = min, u_max = max;
|
||||
MsgStruct msg;
|
||||
msg.Control = ctr;
|
||||
msg.Value = u_min<<32 | u_max;
|
||||
msg.Hash = 0u;
|
||||
|
||||
return SendToGame( (void*) &msg, sizeof(MsgStruct));
|
||||
}
|
||||
|
||||
|
||||
|
||||
int uMod_Sender::SendToGame( void *msg, unsigned long len)
|
||||
{
|
||||
if (len==0) return (RETURN_BAD_ARGUMENT);
|
||||
|
||||
+13
-5
@@ -31,7 +31,7 @@ public:
|
||||
uMod_Sender(PipeStruct &pipe);
|
||||
~uMod_Sender(void);
|
||||
|
||||
int Send( const uMod_GameInfo &game, const uMod_GameInfo &game_old, bool force=false, wxArrayString *comments=NULL);
|
||||
int Send( const uMod_GameInfo &game, const uMod_GameInfo &game_old, uMod_TextureElement_SortedArrayPtr* current_textures, bool force=false);
|
||||
|
||||
wxString LastError;
|
||||
|
||||
@@ -39,13 +39,22 @@ private:
|
||||
int SendSaveAllTextures(bool val);
|
||||
int SendSaveSingleTexture(bool val);
|
||||
|
||||
int SendTextures(unsigned int num, AddTextureClass *tex);
|
||||
int SendTextures(const uMod_TextureElement_SortedArrayPtr &old_tex, const uMod_TextureElement_SortedArrayPtr &new_tex, bool force);
|
||||
|
||||
int AddTexture( uMod_TextureElement *tex, int &buffer_pos);
|
||||
int RemoveTexture( uMod_TextureElement *tex, int &buffer_pos);
|
||||
|
||||
int SendKey(int key, int ctr);
|
||||
|
||||
int SendPath( const wxString &path);
|
||||
|
||||
int SendColour( int* colour, int ctr);
|
||||
int SendColour( unsigned char* colour, int ctr);
|
||||
|
||||
|
||||
int SendBool( bool val, int ctr);
|
||||
int SendDWORD64( DWORD64 val, int ctr);
|
||||
|
||||
int SendMinMax( unsigned long min, unsigned long max, int ctr);
|
||||
|
||||
char *Buffer;
|
||||
int SendToGame( void* msg, unsigned long len);
|
||||
@@ -55,8 +64,7 @@ private:
|
||||
int AddContent( char* buffer, unsigned int len, const char* pw, AddTextureClass *tex, bool add, bool force);
|
||||
|
||||
PipeStruct &Pipe;
|
||||
AddTextureClass *OldTextures;
|
||||
int OldTexturesNum;
|
||||
uMod_TextureElement_SortedArrayPtr *OldTextures;
|
||||
};
|
||||
|
||||
|
||||
|
||||
+19
-17
@@ -42,10 +42,6 @@ void* uMod_Server::Entry(void)
|
||||
|
||||
while(1)
|
||||
{
|
||||
/*
|
||||
Beep(300,100);
|
||||
Beep(600,100);
|
||||
*/
|
||||
pipe_in = CreateNamedPipeW(
|
||||
PIPE_Game2uMod, // pipe name
|
||||
PIPE_ACCESS_INBOUND, // read access
|
||||
@@ -74,11 +70,7 @@ void* uMod_Server::Entry(void)
|
||||
// at first connect to the incoming pipe !!!
|
||||
fConnected = ConnectNamedPipe(pipe_in, NULL) ?
|
||||
true : (GetLastError() == ERROR_PIPE_CONNECTED);
|
||||
/*
|
||||
Beep(900,100);
|
||||
Beep(600,100);
|
||||
Beep(300,100);
|
||||
*/
|
||||
|
||||
if (fConnected)
|
||||
{
|
||||
unsigned long num = 0;
|
||||
@@ -92,15 +84,15 @@ void* uMod_Server::Entry(void)
|
||||
|
||||
if (fSuccess)
|
||||
{
|
||||
if (num>2)
|
||||
if (num>4)
|
||||
{
|
||||
buffer[num]=0;
|
||||
buffer[num-1]=0;
|
||||
wxString name = (wchar_t*) buffer;
|
||||
int injection_method = * ((int*)buffer);
|
||||
wxString name = (wchar_t*) &buffer[sizeof(int)];
|
||||
|
||||
if (name==abort) // kill this server thread
|
||||
{
|
||||
//Beep(1200,300);
|
||||
CloseHandle(pipe_in);
|
||||
return NULL;
|
||||
}
|
||||
@@ -110,11 +102,13 @@ void* uMod_Server::Entry(void)
|
||||
true : (GetLastError() == ERROR_PIPE_CONNECTED);
|
||||
if (fConnected)
|
||||
{
|
||||
uMod_Event event( uMod_EVENT_TYPE, ID_Add_Game);
|
||||
event.SetName(name);
|
||||
event.SetPipeIn(pipe_in);
|
||||
event.SetPipeOut(pipe_out);
|
||||
wxPostEvent( MainFrame, event);
|
||||
uMod_Event *event = new uMod_Event( uMod_EVENT_TYPE, ID_Add_Game);
|
||||
event->SetName(name.c_str());
|
||||
event->SetValue(injection_method);
|
||||
event->SetPipeIn(pipe_in);
|
||||
event->SetPipeOut(pipe_out);
|
||||
wxQueueEvent( MainFrame, (wxEvent*) event);
|
||||
//wxPostEvent( MainFrame, event);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -123,6 +117,14 @@ void* uMod_Server::Entry(void)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMessageBox("less than 4 bytes");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMessageBox("no success");
|
||||
}
|
||||
}
|
||||
else CloseHandle(pipe_in);
|
||||
|
||||
@@ -118,6 +118,19 @@ int uMod_Settings::Load(void)
|
||||
}
|
||||
}
|
||||
|
||||
int width, height;
|
||||
wxDisplaySize( &width, &height);
|
||||
|
||||
if (XSize>width) XSize = width;
|
||||
if (YSize>height) YSize = height;
|
||||
if (XSize<50) XSize = 50;
|
||||
if (YSize<50) YSize = 50;
|
||||
|
||||
if (XPos>width-XSize) XPos = width-XSize;
|
||||
if (YPos>height-YSize) YPos = height-YSize;
|
||||
if (XPos<0) XPos = 0;
|
||||
if (YPos<0) YPos = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -133,17 +146,29 @@ int uMod_Settings::Save(void)
|
||||
content << Language << "\n";
|
||||
file.Write( content.wc_str(), content.Len()*2);
|
||||
|
||||
content.Printf("x_size:%d\n", XSize);
|
||||
file.Write( content.wc_str(), content.Len()*2);
|
||||
if (XSize>0 && XSize<50000)
|
||||
{
|
||||
content.Printf("x_size:%d\n", XSize);
|
||||
file.Write( content.wc_str(), content.Len()*2);
|
||||
}
|
||||
|
||||
content.Printf("y_size:%d\n", YSize);
|
||||
file.Write( content.wc_str(), content.Len()*2);
|
||||
if (YSize>0 && YSize<50000)
|
||||
{
|
||||
content.Printf("y_size:%d\n", YSize);
|
||||
file.Write( content.wc_str(), content.Len()*2);
|
||||
}
|
||||
|
||||
content.Printf("x_pos:%d\n", XPos);
|
||||
file.Write( content.wc_str(), content.Len()*2);
|
||||
if (XPos>0 && XPos<50000)
|
||||
{
|
||||
content.Printf("x_pos:%d\n", XPos);
|
||||
file.Write( content.wc_str(), content.Len()*2);
|
||||
}
|
||||
|
||||
content.Printf("y_pos:%d\n", YPos);
|
||||
file.Write( content.wc_str(), content.Len()*2);
|
||||
if (YPos>0 && YPos<50000)
|
||||
{
|
||||
content.Printf("y_pos:%d\n", YPos);
|
||||
file.Write( content.wc_str(), content.Len()*2);
|
||||
}
|
||||
|
||||
if (UseHook) content = "UseHook:1\n";
|
||||
else content = "UseHook:0\n";
|
||||
|
||||
@@ -0,0 +1,762 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include "uMod_Main.h"
|
||||
|
||||
wxString uMod_TreeViewModel::LastError = wxString();
|
||||
|
||||
|
||||
void uMod_TreeViewModel::GetValue( wxVariant &variant,
|
||||
const wxDataViewItem &item, unsigned int col ) const
|
||||
{
|
||||
wxASSERT(item.IsOk());
|
||||
|
||||
uMod_TreeViewNode *node = (uMod_TreeViewNode*) item.GetID();
|
||||
switch (col)
|
||||
{
|
||||
case 0:
|
||||
if (node->myElement->Title().IsEmpty()) variant = node->myElement->File();
|
||||
else variant = node->myElement->Title();
|
||||
break;
|
||||
case 1:
|
||||
variant = (bool) (node->myElement->Status()==uMod_ModElement::Activate);
|
||||
break;
|
||||
case 2:
|
||||
variant = (bool) (node->myElement->Status()==uMod_ModElement::Deactivate);
|
||||
break;
|
||||
case 3:
|
||||
variant = node->myElement->Author();
|
||||
break;
|
||||
case 4:
|
||||
variant = node->myElement->Comment();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool uMod_TreeViewModel::SetValue( const wxVariant &variant,
|
||||
const wxDataViewItem &item, unsigned int col )
|
||||
{
|
||||
wxASSERT(item.IsOk());
|
||||
if (col<1 || col>2) return false;
|
||||
|
||||
uMod_TreeViewNode *node = (uMod_TreeViewNode*) item.GetID();
|
||||
bool set;
|
||||
variant.Convert( &set);
|
||||
|
||||
uMod_ModElement::enumStatus status = uMod_ModElement::NONE;
|
||||
if (set)
|
||||
{
|
||||
switch (col)
|
||||
{
|
||||
case 1:
|
||||
status = uMod_ModElement::Activate;
|
||||
break;
|
||||
case 2:
|
||||
status = uMod_ModElement::Deactivate;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
node->myElement->Status() = status;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (node->myElement->Type() == uMod_ModElement::Group)
|
||||
{
|
||||
node->myElement->Status() = uMod_ModElement::NONE;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool uMod_TreeViewModel::IsEnabled( const wxDataViewItem &item,
|
||||
unsigned int col ) const
|
||||
{
|
||||
//only the toggle are enabled
|
||||
if (col<1 || col >3) return false;
|
||||
|
||||
uMod_TreeViewNode *node = (uMod_TreeViewNode*) item.GetID();
|
||||
|
||||
//an item is only enabled if no one of the parents is set.
|
||||
uMod_TreeViewNode *parent = node->GetParent();
|
||||
while (parent != (uMod_TreeViewNode*)0)
|
||||
{
|
||||
if (parent->myElement->Status()!=uMod_ModElement::NONE) return false;
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
wxDataViewItem uMod_TreeViewModel::GetParent( const wxDataViewItem &item ) const
|
||||
{
|
||||
// the invisible root node has no parent
|
||||
if (!item.IsOk())
|
||||
return wxDataViewItem(0);
|
||||
|
||||
uMod_TreeViewNode *node = (uMod_TreeViewNode*) item.GetID();
|
||||
return wxDataViewItem( (void*) node->GetParent() );
|
||||
}
|
||||
|
||||
bool uMod_TreeViewModel::HasContainerColumns( const wxDataViewItem &WXUNUSED(item) ) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool uMod_TreeViewModel::IsContainer( const wxDataViewItem &item ) const
|
||||
{
|
||||
// the invisble root node can have children
|
||||
if (!item.IsOk())
|
||||
return true;
|
||||
|
||||
uMod_TreeViewNode *node = (uMod_TreeViewNode*) item.GetID();
|
||||
return node->IsContainer();
|
||||
}
|
||||
|
||||
unsigned int uMod_TreeViewModel::GetChildren( const wxDataViewItem &parent,
|
||||
wxDataViewItemArray &array ) const
|
||||
{
|
||||
uMod_TreeViewNode *node = (uMod_TreeViewNode*) parent.GetID();
|
||||
if (!node)
|
||||
{
|
||||
|
||||
unsigned int count = myPackages.GetCount();
|
||||
for (unsigned int pos = 0; pos < count; pos++)
|
||||
{
|
||||
uMod_TreeViewNode *child = myPackages.Item( pos );
|
||||
array.Add( wxDataViewItem( (void*) child ) );
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
if (node->GetChildCount() == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int count = node->GetChildren().GetCount();
|
||||
for (unsigned int pos = 0; pos < count; pos++)
|
||||
{
|
||||
uMod_TreeViewNode *child = node->GetChildren().Item( pos );
|
||||
array.Add( wxDataViewItem( (void*) child ) );
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
int uMod_TreeViewModel::CreateSingleNode()
|
||||
{
|
||||
if (SingleTextureNode ==(uMod_TreeViewNode*)0)
|
||||
{
|
||||
uMod_ModElement *package = new uMod_ModElement(uMod_ModElement::Group, uMod_ModElement::Activate);
|
||||
|
||||
SingleTextureNode = new uMod_TreeViewNode( (uMod_TreeViewNode*)0, package);
|
||||
package->Release();
|
||||
package->Title() = Language->SingleTextureNode;
|
||||
myPackages.Add( SingleTextureNode);
|
||||
wxDataViewItem child( (void*) SingleTextureNode );
|
||||
wxDataViewItem parent( (void*) 0 );
|
||||
ItemAdded( parent, child );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int uMod_TreeViewModel::AddPackage(const wxString &file_name)
|
||||
{
|
||||
uMod_File file( file_name);
|
||||
if (! file.FileSupported())
|
||||
{
|
||||
LastError << Language->Error_FileNotSupported << "\n" << file_name;
|
||||
return -1;
|
||||
}
|
||||
bool single_file = file.SingleFile();
|
||||
|
||||
uMod_TreeViewNode *node;
|
||||
|
||||
if (single_file)
|
||||
{
|
||||
CreateSingleNode();
|
||||
node = SingleTextureNode;
|
||||
}
|
||||
else
|
||||
{
|
||||
uMod_ModElement *package = new uMod_ModElement(uMod_ModElement::Group, uMod_ModElement::Activate);
|
||||
|
||||
node = new uMod_TreeViewNode( (uMod_TreeViewNode*)0, package);
|
||||
package->Release();
|
||||
package->File() = file_name;
|
||||
}
|
||||
|
||||
if (int ret = file.GetContent(node))
|
||||
{
|
||||
LastError = file.LastError;
|
||||
if (node != SingleTextureNode) delete node;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (node != SingleTextureNode)
|
||||
{
|
||||
myPackages.Add( node);
|
||||
|
||||
wxDataViewItem child( (void*) node );
|
||||
wxDataViewItem parent( (void*) 0 );
|
||||
ItemAdded( parent, child );
|
||||
}
|
||||
else if (SingleTextureNode != (uMod_TreeViewNode*)0)
|
||||
{
|
||||
wxDataViewItem child( (void*) SingleTextureNode->myChildren.Last() );
|
||||
wxDataViewItem parent( SingleTextureNode );
|
||||
ItemAdded( parent, child );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int uMod_TreeViewModel::AddPackages(const wxArrayString &files)
|
||||
{
|
||||
LastError.Empty();
|
||||
uMod_File file;
|
||||
wxDataViewItemArray added_items;
|
||||
wxDataViewItemArray added_single_items;
|
||||
/*
|
||||
bool single_file = false;
|
||||
|
||||
// detect if there are more than one single file
|
||||
for (unsigned int i=0; i<files.GetCount(); i++)
|
||||
{
|
||||
file.SetFile( files[i]);
|
||||
if (file.SingleFile()) {single_file = true;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if (single_files>1)
|
||||
{
|
||||
uMod_ModElement *element = new uMod_ModElement(uMod_ModElement::Group, uMod_ModElement::NONE);
|
||||
element->Title() = Language->MultipleSingleFiles;
|
||||
single_file_node = new uMod_TreeViewNode( (uMod_TreeViewNode*)0, element);
|
||||
element->Release();
|
||||
}
|
||||
*/
|
||||
|
||||
for (unsigned int i=0; i<files.GetCount(); i++)
|
||||
{
|
||||
file.SetFile( files[i]);
|
||||
|
||||
if (! file.FileSupported())
|
||||
{
|
||||
LastError << Language->Error_FileNotSupported << "\n" << files[i] << "\n" ;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (file.SingleFile())
|
||||
{
|
||||
CreateSingleNode();
|
||||
if (file.GetContent(SingleTextureNode))
|
||||
{
|
||||
LastError << file.LastError ;
|
||||
file.LastError.Empty();
|
||||
continue;
|
||||
}
|
||||
wxDataViewItem child( (void*) SingleTextureNode->myChildren.Last() );
|
||||
added_single_items.Add( child);
|
||||
}
|
||||
else
|
||||
{
|
||||
uMod_ModElement *package = new uMod_ModElement(uMod_ModElement::Group, uMod_ModElement::Activate);
|
||||
uMod_TreeViewNode *node = new uMod_TreeViewNode( (uMod_TreeViewNode*)0, package);
|
||||
package->Release();
|
||||
package->File() = files[i];
|
||||
|
||||
if (file.GetContent(node))
|
||||
{
|
||||
LastError << file.LastError;
|
||||
delete node;
|
||||
file.LastError.Empty();
|
||||
continue;
|
||||
}
|
||||
myPackages.Add( node);
|
||||
|
||||
wxDataViewItem child( (void*) node );
|
||||
added_items.Add( child);
|
||||
}
|
||||
}
|
||||
|
||||
if (added_items.GetCount()>0)
|
||||
{
|
||||
wxDataViewItem parent( (void*) 0 );
|
||||
ItemsAdded( parent, added_items);
|
||||
}
|
||||
|
||||
if (added_single_items.GetCount()>0)
|
||||
{
|
||||
wxDataViewItem parent( SingleTextureNode );
|
||||
ItemsAdded( parent, added_single_items);
|
||||
}
|
||||
|
||||
if (LastError.IsEmpty()) return 0;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
|
||||
int uMod_TreeViewModel::AddPackagesFromTemplate(const wxArrayString &packages)
|
||||
{
|
||||
LastError.Empty();
|
||||
|
||||
uMod_File file;
|
||||
wxDataViewItemArray added_items;
|
||||
|
||||
DeleteAllPackages();
|
||||
|
||||
for (unsigned int i=0; i<packages.GetCount(); i++)
|
||||
{
|
||||
uMod_ModElement *element = new uMod_ModElement(uMod_ModElement::Group, uMod_ModElement::Activate);
|
||||
uMod_TreeViewNode *node = new uMod_TreeViewNode( (uMod_TreeViewNode*)0, element);
|
||||
element->Release();
|
||||
|
||||
if (file.GetContentTemplate( packages[i], node))
|
||||
{
|
||||
LastError << file.LastError;
|
||||
file.LastError.Empty();
|
||||
delete node;
|
||||
continue;
|
||||
}
|
||||
|
||||
myPackages.Add( node);
|
||||
|
||||
wxDataViewItem child( (void*) node );
|
||||
added_items.Add( child);
|
||||
|
||||
if (node->myElement->File().IsEmpty())
|
||||
{
|
||||
SingleTextureNode = node;
|
||||
SingleTextureNode->myElement->Title() = Language->SingleTextureNode;
|
||||
}
|
||||
}
|
||||
|
||||
if (added_items.GetCount()>0)
|
||||
{
|
||||
wxDataViewItem parent( (void*) 0 );
|
||||
ItemsAdded( parent, added_items);
|
||||
}
|
||||
|
||||
if (LastError.IsEmpty()) return 0;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
|
||||
int uMod_TreeViewModel::DeletePackage( const wxDataViewItem &item)
|
||||
{
|
||||
uMod_TreeViewNode *node = (uMod_TreeViewNode*) item.GetID();
|
||||
if (node)
|
||||
{
|
||||
if (node->GetParent()== (uMod_TreeViewNode*) 0 )
|
||||
{
|
||||
myPackages.Remove( node);
|
||||
delete node;
|
||||
if (node == SingleTextureNode) SingleTextureNode = (uMod_TreeViewNode*) 0;
|
||||
|
||||
|
||||
wxDataViewItem parent( (void*) 0 );
|
||||
ItemDeleted( parent, item );
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
int uMod_TreeViewModel::DeletePackages( const wxDataViewItemArray &items)
|
||||
{
|
||||
int num = items.GetCount();
|
||||
wxDataViewItemArray deleted_items;
|
||||
for (int i=0; i<num; i++)
|
||||
{
|
||||
uMod_TreeViewNode *node = (uMod_TreeViewNode*) items[i].GetID();
|
||||
if (node)
|
||||
{
|
||||
if (node->GetParent()== (uMod_TreeViewNode*) 0 )
|
||||
{
|
||||
myPackages.Remove( node);
|
||||
delete node;
|
||||
if (node == SingleTextureNode) SingleTextureNode = (uMod_TreeViewNode*) 0;
|
||||
deleted_items.Add( items[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
wxDataViewItem parent( (void*) 0 );
|
||||
ItemsDeleted( parent, deleted_items);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int uMod_TreeViewModel::DeleteAllPackages(void)
|
||||
{
|
||||
wxDataViewItemArray deleted_items;
|
||||
for (unsigned int i=0; i<myPackages.GetCount(); i++)
|
||||
{
|
||||
wxDataViewItem child( myPackages[i]);
|
||||
deleted_items.Add( child);
|
||||
}
|
||||
SingleTextureNode = (uMod_TreeViewNode*) 0;
|
||||
wxDataViewItem parent( (void*) 0 );
|
||||
ItemsDeleted( parent, deleted_items);
|
||||
myPackages.Empty();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int uMod_TreeViewModel::GetActiveTexture( uMod_TextureElement_SortedArrayPtr &texture)
|
||||
{
|
||||
texture.Empty();
|
||||
|
||||
uMod_TreeViewNode_ArrayPtr buffer; // this array store the "path" to the current group node (parent0->parent1->parent2->current_group)
|
||||
wxArrayInt counter; // this array store the actual index position for each group in the hierarchy
|
||||
wxArrayInt active; // this array is need for the inherited active status of parent groups
|
||||
|
||||
for (unsigned int p=0; p<myPackages.GetCount(); p++)
|
||||
{
|
||||
if (myPackages.Item(p)->myElement->Status()==uMod_ModElement::Deactivate) continue;
|
||||
|
||||
|
||||
|
||||
if (myPackages.Item(p)->myElement->Type() == uMod_ModElement::Group)
|
||||
{
|
||||
buffer.Add(myPackages.Item(p));
|
||||
counter.Add(0);
|
||||
if (myPackages.Item(p)->myElement->Status()==uMod_ModElement::Activate) active.Add(1);
|
||||
else active.Add(0);
|
||||
|
||||
while (!buffer.IsEmpty())
|
||||
{
|
||||
int pos = buffer.GetCount()-1;
|
||||
unsigned int index = counter[pos];
|
||||
if (index < buffer[pos]->myChildren.GetCount()) // it has still childrens
|
||||
{
|
||||
if (buffer[pos]->myChildren[index]->myElement->Type() == uMod_ModElement::Group)
|
||||
{
|
||||
if ((active[pos]>0) || (buffer[pos]->myChildren[index]->myElement->Status() != uMod_ModElement::Deactivate))
|
||||
{
|
||||
buffer.Add(buffer[pos]->myChildren[index]);
|
||||
counter.Add(0);
|
||||
if (active[pos]>0 || buffer[pos]->myChildren[index]->myElement->Status()==uMod_ModElement::Activate) active.Add(1);
|
||||
else active.Add(0);
|
||||
}
|
||||
}
|
||||
else if (buffer[pos]->myChildren[index]->myElement->Type() == uMod_ModElement::Texture)
|
||||
{
|
||||
uMod_TextureElement *tex = (uMod_TextureElement*) buffer[pos]->myChildren[index]->myElement;
|
||||
|
||||
if (tex->Content().Len()>0 && ((active[pos]>0) || (tex->Status()==uMod_ModElement::Activate)))
|
||||
{
|
||||
if( wxNOT_FOUND == texture.Index(tex))
|
||||
{
|
||||
texture.Add(tex);
|
||||
tex->AddRef();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
counter[pos]++;
|
||||
}
|
||||
else // finished this group
|
||||
{
|
||||
buffer.RemoveAt(pos);
|
||||
counter.RemoveAt(pos);
|
||||
active.RemoveAt(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (myPackages.Item(p)->myElement->Type()==uMod_ModElement::Texture)
|
||||
{
|
||||
uMod_TextureElement *tex = (uMod_TextureElement*) myPackages.Item(p)->myElement;
|
||||
if (tex->Status()==uMod_ModElement::Activate)
|
||||
if (wxNOT_FOUND == texture.Index(tex))
|
||||
{
|
||||
texture.Add(tex);
|
||||
tex->AddRef();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int uMod_TreeViewModel::String2Node( const wxString &input, uMod_TreeViewNode* node, uMod_TreeViewNode_ArrayPtr *list_node)
|
||||
{
|
||||
if (list_node!=(uMod_TreeViewNode_ArrayPtr*)0) list_node->Empty();
|
||||
|
||||
wxStringTokenizer token( input, "\n");
|
||||
int num = token.CountTokens();
|
||||
|
||||
bool found_start = false;
|
||||
|
||||
wxString entry;
|
||||
|
||||
wxString command;
|
||||
wxString file;
|
||||
wxString action;
|
||||
wxString hash;
|
||||
uMod_TreeViewNode_ArrayPtr buffer;
|
||||
buffer.Add(node);
|
||||
|
||||
for (int i=0; i<num; i++)
|
||||
{
|
||||
entry = token.GetNextToken();
|
||||
if (entry.Len()==0) continue;
|
||||
if (entry[0]=='#') continue;
|
||||
if (entry[0]=='!') continue;
|
||||
|
||||
wxStringTokenizer entry_token( entry, "|", wxTOKEN_RET_EMPTY_ALL);
|
||||
|
||||
command = entry_token.GetNextToken().Trim(true).Trim(false);
|
||||
|
||||
if (!found_start)
|
||||
{
|
||||
if (command=="PACKAGE")
|
||||
{
|
||||
found_start = true;
|
||||
|
||||
node->myElement->File() = entry_token.GetNextToken().Trim(true).Trim(false);
|
||||
node->myElement->Title() = entry_token.GetNextToken().Trim(true).Trim(false);
|
||||
action = entry_token.GetNextToken().Trim(true).Trim(false);
|
||||
if (action=="D") node->myElement->Status() = uMod_ModElement::Deactivate;
|
||||
else if (action=="A") node->myElement->Status() = uMod_ModElement::Activate;
|
||||
else node->myElement->Status() = uMod_ModElement::NONE;
|
||||
node->myElement->Author() = entry_token.GetNextToken().Trim(true).Trim(false);
|
||||
node->myElement->Comment() = entry_token.GetNextToken().Trim(true).Trim(false);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (command=="BEGIN_GROUP")
|
||||
{
|
||||
uMod_ModElement *element = new uMod_ModElement(uMod_ModElement::Group, uMod_ModElement::NONE);
|
||||
uMod_TreeViewNode *node_group = new uMod_TreeViewNode(buffer.Last(), element);
|
||||
|
||||
element->Title() = entry_token.GetNextToken().Trim(true).Trim(false);
|
||||
action = entry_token.GetNextToken().Trim(true).Trim(false);
|
||||
if (action=="D") element->Status() = uMod_ModElement::Deactivate;
|
||||
else if (action=="A") element->Status() = uMod_ModElement::Activate;
|
||||
else element->Status() = uMod_ModElement::NONE;
|
||||
element->Author() = entry_token.GetNextToken().Trim(true).Trim(false);
|
||||
element->Comment() = entry_token.GetNextToken().Trim(true).Trim(false);
|
||||
|
||||
|
||||
if (list_node != (uMod_TreeViewNode_ArrayPtr*)0) list_node->Add(node_group);
|
||||
|
||||
// add node to the last group
|
||||
buffer.Last()->Append( node_group);
|
||||
element->Release();
|
||||
|
||||
//set this group to the last group
|
||||
buffer.Add( node_group);
|
||||
}
|
||||
else if (command=="END_GROUP")
|
||||
{
|
||||
if (buffer.GetCount()==0)
|
||||
{
|
||||
LastError << "There is an END_GROUP without a previous BEGIN_GROUP";
|
||||
return -1;
|
||||
}
|
||||
buffer.RemoveAt(buffer.GetCount()-1);
|
||||
}
|
||||
else if (command=="TEXTURE")
|
||||
{
|
||||
if (buffer.GetCount()==0) continue;
|
||||
|
||||
file = entry_token.GetNextToken().Trim(true).Trim(false);
|
||||
hash = entry_token.GetNextToken().Trim(true).Trim(false);
|
||||
|
||||
if (file.IsEmpty())
|
||||
continue;
|
||||
if (hash.IsEmpty())
|
||||
continue;
|
||||
|
||||
DWORD64 temp_hash;
|
||||
if (!hash.ToULongLong( &temp_hash, 16))
|
||||
{
|
||||
LastError << Language->Error_Hash << "\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
uMod_TextureElement *texture = new uMod_TextureElement();
|
||||
|
||||
texture->File() = file;
|
||||
texture->Hash() = temp_hash;
|
||||
|
||||
texture->Title() = entry_token.GetNextToken().Trim(true).Trim(false);
|
||||
action = entry_token.GetNextToken().Trim(true).Trim(false);
|
||||
if (action=="D") texture->Status() = uMod_ModElement::Deactivate;
|
||||
else texture->Status() = uMod_TextureElement::Activate;
|
||||
texture->Author() = entry_token.GetNextToken().Trim(true).Trim(false);
|
||||
texture->Comment() = entry_token.GetNextToken().Trim(true).Trim(false);
|
||||
|
||||
uMod_TreeViewNode *node_texture = new uMod_TreeViewNode( buffer.Last(), texture);
|
||||
|
||||
if (list_node != (uMod_TreeViewNode_ArrayPtr*)0) list_node->Add(node_texture);
|
||||
|
||||
// add node to the last group
|
||||
buffer.Last()->Append( node_texture);
|
||||
texture->Release();
|
||||
}
|
||||
}
|
||||
|
||||
if (!found_start)
|
||||
{
|
||||
LastError = "Did not find 'PACKAGE' directive\n";
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int uMod_TreeViewModel::Node2String( wxString &out, uMod_TreeViewNode* node)
|
||||
{
|
||||
if (node==(uMod_TreeViewNode*)0) return -1;
|
||||
out.Empty();
|
||||
uMod_TreeViewNode_ArrayPtr buffer; // this array store the "path" to the current group node (parent0->parent1->parent2->current_group)
|
||||
wxArrayInt counter; // this array store the actual index position for each group in the hierarchy
|
||||
|
||||
if (node->myElement->Type() != uMod_ModElement::Group) return -1;
|
||||
|
||||
out << "\nPACKAGE|" << node->myElement->File() << "|";
|
||||
out << node->myElement->Title() << "|";
|
||||
if (node->myElement->Status() == uMod_ModElement::Activate) out << "A";
|
||||
else if (node->myElement->Status() == uMod_ModElement::Deactivate) out << "D";
|
||||
out << "|" << node->myElement->Author();
|
||||
out << "|" << node->myElement->Comment() << "\n\n";
|
||||
|
||||
buffer.Add( node);
|
||||
counter.Add(0);
|
||||
/*
|
||||
|
||||
if (node->myElement->Type() == uMod_ModElement::Group)
|
||||
{
|
||||
buffer.Add(node);
|
||||
counter.Add(0);
|
||||
|
||||
out << "\nBEGIN_GROUP|"<<node->myElement->Title() << "|";
|
||||
if (node->myElement->Status() == uMod_ModElement::Activate) out << "A";
|
||||
else if (node->myElement->Status() == uMod_ModElement::Deactivate) out << "D";
|
||||
out << "|" << node->myElement->Author();
|
||||
out << "|" << node->myElement->Comment();
|
||||
out << "\n\n";
|
||||
*/
|
||||
|
||||
while (!buffer.IsEmpty())
|
||||
{
|
||||
int pos = buffer.GetCount()-1;
|
||||
unsigned int index = counter[pos];
|
||||
if (index < buffer[pos]->myChildren.GetCount()) // it has still childrens
|
||||
{
|
||||
if (buffer[pos]->myChildren[index]->myElement->Type() == uMod_ModElement::Group)
|
||||
{
|
||||
uMod_TreeViewNode* node_child = buffer[pos]->myChildren[index];
|
||||
|
||||
out << "\nBEGIN_GROUP|"<< node_child->myElement->Title() << "|";
|
||||
if (node_child->myElement->Status() == uMod_ModElement::Activate) out << "A";
|
||||
else if (node_child->myElement->Status() == uMod_ModElement::Deactivate) out << "D";
|
||||
out << "|" << node_child->myElement->Author();
|
||||
out << "|" << node_child->myElement->Comment();
|
||||
out << "\n";
|
||||
|
||||
buffer.Add(node_child);
|
||||
counter.Add(0);
|
||||
}
|
||||
else if (buffer[pos]->myChildren[index]->myElement->Type() == uMod_ModElement::Texture)
|
||||
{
|
||||
uMod_TextureElement *tex = (uMod_TextureElement*) buffer[pos]->myChildren[index]->myElement;
|
||||
out << "TEXTURE|"<< tex->File() << "|" ;
|
||||
out << wxString::Format("%#llX", tex->Hash()) << "|";
|
||||
out << tex->Title() << "|";
|
||||
if (tex->Status() == uMod_ModElement::Deactivate) out << "D";
|
||||
out << "|" << tex->Author();
|
||||
out << "|" << tex->Comment();
|
||||
out << "\n";
|
||||
}
|
||||
|
||||
counter[pos]++;
|
||||
}
|
||||
else // finished this group
|
||||
{
|
||||
buffer.RemoveAt(pos);
|
||||
counter.RemoveAt(pos);
|
||||
|
||||
if (buffer.GetCount()>0) out << "END_GROUP\n";
|
||||
}
|
||||
}
|
||||
/*
|
||||
}
|
||||
else if (node->myElement->Type()==uMod_ModElement::Texture)
|
||||
{
|
||||
uMod_TextureElement *tex = (uMod_TextureElement*) node->myElement;
|
||||
|
||||
out << "TEXTURE|"<< tex->File() << "|" ;
|
||||
out << wxString::Format("%#lX", tex->Hash()) << "|";
|
||||
out << tex->Title() << "|";
|
||||
if (tex->Status() == uMod_ModElement::Deactivate) out << "D";
|
||||
out << "|" << tex->Author();
|
||||
out << "|" << tex->Comment();
|
||||
out << "\n\n";
|
||||
|
||||
}
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
bool uMod_TreeViewModel::IsSameNod(uMod_TreeViewNode* a, uMod_TreeViewNode* b)
|
||||
{
|
||||
// at first we test for object specific stats
|
||||
if (a->myElement->Type()==uMod_ModElement::Group && b->myElement->Type()==uMod_ModElement::Group)
|
||||
{
|
||||
//title must be the same
|
||||
if (a->myElement->Title() != b->myElement->Title()) return false;
|
||||
}
|
||||
else if (a->myElement->Type()==uMod_ModElement::Texture && b->myElement->Type()==uMod_ModElement::Texture)
|
||||
{
|
||||
uMod_TextureElement *tex_a = (uMod_TextureElement*) a->myElement;
|
||||
uMod_TextureElement *tex_b = (uMod_TextureElement*) b->myElement;
|
||||
|
||||
//Hash, Title, and File must be the same
|
||||
if (tex_a->Hash() != tex_b->Hash()) return false;
|
||||
if (tex_a->Title() != tex_b->Title()) return false;
|
||||
if (tex_a->File() != tex_b->File()) return false;
|
||||
}
|
||||
else return false; //not the same objects
|
||||
|
||||
|
||||
// now we compare their parents
|
||||
// the title of their parents must be the same
|
||||
if (a->GetParent()!=(uMod_TreeViewNode*)0)
|
||||
{
|
||||
if (b->GetParent()!=(uMod_TreeViewNode*)0)
|
||||
{
|
||||
if (a->GetParent()->myElement->Title() == b->GetParent()->myElement->Title()) return true;
|
||||
else return false;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
else if (b->GetParent()!=(uMod_TreeViewNode*)0) return false;
|
||||
else return true; //both are root textures
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef uMod_TREEVIEW_H_
|
||||
#define uMod_TREEVIEW_H_
|
||||
|
||||
#include "wx/dataview.h"
|
||||
#include "uMod_ModElement.h"
|
||||
|
||||
class uMod_TreeViewNode;
|
||||
WX_DEFINE_ARRAY_PTR( uMod_TreeViewNode*, uMod_TreeViewNode_ArrayPtr );
|
||||
|
||||
class uMod_TreeViewNode
|
||||
{
|
||||
public:
|
||||
uMod_TreeViewNode( uMod_TreeViewNode* parent, uMod_ModElement *element) : myParent(parent), myElement(element)
|
||||
{
|
||||
myElement->AddRef();
|
||||
}
|
||||
|
||||
~uMod_TreeViewNode()
|
||||
{
|
||||
// free all our children nodes
|
||||
size_t count = myChildren.GetCount();
|
||||
for (size_t i = 0; i < count; i++)
|
||||
{
|
||||
uMod_TreeViewNode *child = myChildren[i];
|
||||
delete child;
|
||||
}
|
||||
myElement->Release();
|
||||
}
|
||||
|
||||
bool IsContainer() const {if (myElement->Type() == uMod_ModElement::Group) return true; else return false;}
|
||||
|
||||
uMod_TreeViewNode* GetParent() {return myParent;}
|
||||
|
||||
uMod_TreeViewNode_ArrayPtr& GetChildren() {return myChildren;}
|
||||
|
||||
uMod_TreeViewNode* GetNthChild( unsigned int n ) {return myChildren.Item( n);}
|
||||
|
||||
void Insert( uMod_TreeViewNode* child, unsigned int n) {myChildren.Insert( child, n);}
|
||||
|
||||
void Append( uMod_TreeViewNode* child ) {myChildren.Add( child );}
|
||||
|
||||
unsigned int GetChildCount() const {return myChildren.GetCount();}
|
||||
|
||||
public: // public to avoid getters/setters
|
||||
uMod_ModElement *myElement;
|
||||
|
||||
//private:
|
||||
uMod_TreeViewNode* myParent;
|
||||
uMod_TreeViewNode_ArrayPtr myChildren;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class uMod_TreeViewModel : public wxDataViewModel
|
||||
{
|
||||
public:
|
||||
uMod_TreeViewModel() : SingleTextureNode((uMod_TreeViewNode*)0) {}
|
||||
virtual ~uMod_TreeViewModel() {}
|
||||
|
||||
// implementation of base class virtuals to define model
|
||||
|
||||
virtual unsigned int GetColumnCount() const
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
virtual wxString GetColumnType( unsigned int col ) const
|
||||
{
|
||||
(void) col;
|
||||
return wxT("string");
|
||||
}
|
||||
|
||||
virtual void GetValue( wxVariant &variant,
|
||||
const wxDataViewItem &item, unsigned int col ) const;
|
||||
virtual bool SetValue( const wxVariant &variant,
|
||||
const wxDataViewItem &item, unsigned int col );
|
||||
|
||||
virtual bool IsEnabled( const wxDataViewItem &item,
|
||||
unsigned int col ) const;
|
||||
|
||||
virtual wxDataViewItem GetParent( const wxDataViewItem &item ) const;
|
||||
virtual bool HasContainerColumns( const wxDataViewItem &item ) const;
|
||||
virtual bool IsContainer( const wxDataViewItem &item ) const;
|
||||
virtual unsigned int GetChildren( const wxDataViewItem &parent,
|
||||
wxDataViewItemArray &array ) const;
|
||||
|
||||
|
||||
// implementation of uMod functions
|
||||
int CreateSingleNode(void);
|
||||
|
||||
int AddPackage(const wxString &file_name);
|
||||
int AddPackages(const wxArrayString &files);
|
||||
int AddPackagesFromTemplate(const wxArrayString &packages);
|
||||
|
||||
int DeletePackage( const wxDataViewItem &item);
|
||||
int DeletePackages( const wxDataViewItemArray &item);
|
||||
int DeleteAllPackages(void);
|
||||
|
||||
|
||||
int GetActiveTexture( uMod_TextureElement_SortedArrayPtr &texture);
|
||||
|
||||
static int String2Node( const wxString &input, uMod_TreeViewNode* node, uMod_TreeViewNode_ArrayPtr *list_node = (uMod_TreeViewNode_ArrayPtr*)0);
|
||||
|
||||
static int Node2String( wxString &out, uMod_TreeViewNode* node);
|
||||
|
||||
// static bool IsSameNod(uMod_TreeViewNode* a, uMod_TreeViewNode* b);
|
||||
|
||||
static wxString LastError;
|
||||
|
||||
//private:
|
||||
uMod_TreeViewNode *SingleTextureNode;
|
||||
uMod_TreeViewNode_ArrayPtr myPackages;
|
||||
|
||||
};
|
||||
|
||||
#endif /* uMod_TREEVIEW_H_ */
|
||||
+209
-12
@@ -19,29 +19,37 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
|
||||
#ifndef uMod_GlobalDefines_H_
|
||||
#define uMod_GlobalDefines_H_
|
||||
|
||||
//#define MyTypeHash DWORD64
|
||||
#define MyTypeHash DWORD32
|
||||
|
||||
#define BIG_BUFSIZE 1<<24
|
||||
#define SMALL_BUFSIZE 1<<10
|
||||
|
||||
/**
|
||||
* This struct is the basic of the communication between dll and GUI. For each command send through the pipe a control value is set to MsgStruct::Control.
|
||||
* The MsgStruct::Value can store various information (e.g. key values, boolean, or length of data).
|
||||
*
|
||||
* If mor date should be send, Control is set to one of the intended values and value to the amount of data in byte.
|
||||
* After the MsgStruct is send also the data is send through the pipe.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned int Control;
|
||||
unsigned int Value;
|
||||
MyTypeHash Hash;
|
||||
DWORD32 Control; //!< stores the control value
|
||||
DWORD64 Value; //!< various meanings
|
||||
DWORD64 Hash;
|
||||
} MsgStruct;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
HANDLE In;
|
||||
HANDLE Out;
|
||||
HANDLE In; //!< Incoming pipe
|
||||
HANDLE Out; //!< Outgoning pipe
|
||||
} PipeStruct;
|
||||
|
||||
|
||||
#define uMod_APP_DX9 L"uMod_DX9.txt"
|
||||
#define uMod_APP_DIR L"uMod"
|
||||
#define uMod_VERSION L"uMod V 1.0"
|
||||
#define uMod_VERSION L"uMod V 2.0 alpha"
|
||||
|
||||
#define PIPE_uMod2Game L"\\\\.\\pipe\\uMod2Game"
|
||||
#define PIPE_Game2uMod L"\\\\.\\pipe\\Game2uMod"
|
||||
@@ -57,7 +65,8 @@ typedef struct
|
||||
|
||||
#define CONTROL_SAVE_ALL 10
|
||||
#define CONTROL_SAVE_SINGLE 11
|
||||
#define CONTROL_SET_DIR 12
|
||||
#define CONTROL_SHOW_STRING 12
|
||||
#define CONTROL_SET_DIR 13
|
||||
|
||||
#define CONTROL_KEY_BACK 20
|
||||
#define CONTROL_KEY_SAVE 21
|
||||
@@ -66,16 +75,204 @@ typedef struct
|
||||
#define CONTROL_FONT_COLOUR 30
|
||||
#define CONTROL_TEXTURE_COLOUR 31
|
||||
|
||||
#define CONTROL_WIDTH_FILTER 40
|
||||
#define CONTROL_HEIGHT_FILTER 41
|
||||
#define CONTROL_DEPTH_FILTER 42
|
||||
#define CONTROL_FORMAT_FILTER 43
|
||||
|
||||
#define CONTROL_SAVE_FORMAT 50
|
||||
|
||||
#define CONTROL_SUPPORT_TPF 60
|
||||
|
||||
#define CONTROL_GAME_EXIT 100
|
||||
#define CONTROL_ADD_CLIENT 101
|
||||
#define CONTROL_REMOVE_CLIENT 102
|
||||
|
||||
#define HOOK_INJECTION 1
|
||||
#define DIRECT_INJECTION 2
|
||||
#define NO_INJECTION 3
|
||||
#define INVALID_GAME_PAGE 4
|
||||
|
||||
#define VERSION_DX9 90
|
||||
#define VERSION_DX9EX 91
|
||||
#define VERSION_DX10 100
|
||||
#define VERSION_DX10EX 101
|
||||
#define VERSION_DX11 110
|
||||
#define VERSION_DX11EX 111
|
||||
#define VERSION_DX101 101
|
||||
|
||||
|
||||
#define uMod_D3DXIFF_BMP 1ull<<0
|
||||
#define uMod_D3DXIFF_JPG 1ull<<1
|
||||
#define uMod_D3DXIFF_TGA 1ull<<2
|
||||
#define uMod_D3DXIFF_PNG 1ull<<3
|
||||
#define uMod_D3DXIFF_DDS 1ull<<4
|
||||
#define uMod_D3DXIFF_PPM 1ull<<5
|
||||
|
||||
|
||||
|
||||
|
||||
#define uMod_D3DFMT_R8G8B8 1ull<<0
|
||||
#define uMod_D3DFMT_A8R8G8B8 1ull<<1
|
||||
#define uMod_D3DFMT_X8R8G8B8 1ull<<2
|
||||
#define uMod_D3DFMT_R5G6B5 1ull<<3
|
||||
#define uMod_D3DFMT_X1R5G5B5 1ull<<4
|
||||
#define uMod_D3DFMT_A1R5G5B5 1ull<<5
|
||||
#define uMod_D3DFMT_A4R4G4B4 1ull<<6
|
||||
#define uMod_D3DFMT_R3G3B2 1ull<<7
|
||||
#define uMod_D3DFMT_A8 1ull<<8
|
||||
#define uMod_D3DFMT_A8R3G3B2 1ull<<9
|
||||
#define uMod_D3DFMT_X4R4G4B4 1ull<<10
|
||||
#define uMod_D3DFMT_A2B10G10R10 1ull<<11
|
||||
#define uMod_D3DFMT_A8B8G8R8 1ull<<12
|
||||
#define uMod_D3DFMT_X8B8G8R8 1ull<<13
|
||||
#define uMod_D3DFMT_G16R16 1ull<<14
|
||||
#define uMod_D3DFMT_A2R10G10B10 1ull<<15
|
||||
#define uMod_D3DFMT_A16B16G16R16 1ull<<16
|
||||
|
||||
#define uMod_D3DFMT_A8P8 1ull<<17
|
||||
#define uMod_D3DFMT_P8 1ull<<18
|
||||
|
||||
#define uMod_D3DFMT_L8 1ull<<19
|
||||
#define uMod_D3DFMT_A8L8 1ull<<20
|
||||
#define uMod_D3DFMT_A4L4 1ull<<21
|
||||
|
||||
#define uMod_D3DFMT_V8U8 1ull<<22
|
||||
#define uMod_D3DFMT_L6V5U5 1ull<<23
|
||||
#define uMod_D3DFMT_X8L8V8U8 1ull<<24
|
||||
#define uMod_D3DFMT_Q8W8V8U8 1ull<<25
|
||||
#define uMod_D3DFMT_V16U16 1ull<<26
|
||||
#define uMod_D3DFMT_A2W10V10U10 1ull<<27
|
||||
|
||||
|
||||
#define uMod_D3DFMT_D16_LOCKABLE 1ull<<28
|
||||
#define uMod_D3DFMT_D32 1ull<<29
|
||||
#define uMod_D3DFMT_D15S1 1ull<<30
|
||||
#define uMod_D3DFMT_D24S8 1ull<<31
|
||||
#define uMod_D3DFMT_D24X8 1ull<<32
|
||||
#define uMod_D3DFMT_D24X4S4 1ull<<33
|
||||
#define uMod_D3DFMT_D16 1ull<<34
|
||||
#define uMod_D3DFMT_L16 1ull<<35
|
||||
|
||||
#define uMod_D3DFMT_D32F_LOCKABLE 1ull<<36
|
||||
#define uMod_D3DFMT_D24FS8 1ull<<37
|
||||
|
||||
#define uMod_D3DFMT_D32_LOCKABLE 1ull<<38
|
||||
#define uMod_D3DFMT_S8_LOCKABLE 1ull<<39
|
||||
|
||||
|
||||
#define uMod_D3DFMT_VERTEXDATA 1ull<<40
|
||||
#define uMod_D3DFMT_INDEX16 1ull<<41
|
||||
#define uMod_D3DFMT_INDEX32 1ull<<42
|
||||
|
||||
#define uMod_D3DFMT_Q16W16V16U16 1ull<<43
|
||||
|
||||
|
||||
#define uMod_D3DFMT_R16F 1ull<<44
|
||||
#define uMod_D3DFMT_G16R16F 1ull<<45
|
||||
#define uMod_D3DFMT_A16B16G16R16F 1ull<<46
|
||||
|
||||
#define uMod_D3DFMT_R32F 1ull<<47
|
||||
#define uMod_D3DFMT_G32R32F 1ull<<48
|
||||
#define uMod_D3DFMT_A32B32G32R32F 1ull<<49
|
||||
|
||||
#define uMod_D3DFMT_CxV8U8 1ull<<50
|
||||
|
||||
#define uMod_D3DFMT_A1 1ull<<51
|
||||
#define uMod_D3DFMT_A2B10G10R10_XR_BIAS 1ull<<52
|
||||
#define uMod_D3DFMT_BINARYBUFFER 1ull<<53
|
||||
|
||||
|
||||
#define uMod_D3DFMT_DXT1 1ull<<54
|
||||
#define uMod_D3DFMT_DXT2 1ull<<55
|
||||
#define uMod_D3DFMT_DXT3 1ull<<56
|
||||
#define uMod_D3DFMT_DXT4 1ull<<57
|
||||
#define uMod_D3DFMT_DXT5 1ull<<58
|
||||
#define uMod_D3DFMT_G8R8_G8B8 1ull<<59
|
||||
#define uMod_D3DFMT_R8G8_B8G8 1ull<<60
|
||||
#define uMod_D3DFMT_MULTI2_ARGB8 1ull<<61
|
||||
#define uMod_D3DFMT_UYVY 1ull<<62
|
||||
#define uMod_D3DFMT_YUY2 1ull<<63
|
||||
|
||||
/*
|
||||
|
||||
#define uMod_D3DFMT_R8G8B8 1ull<<0
|
||||
#define uMod_D3DFMT_A8R8G8B8 1ull<<1
|
||||
#define uMod_D3DFMT_X8R8G8B8 1ull<<2
|
||||
#define uMod_D3DFMT_R5G6B5 1ull<<3
|
||||
#define uMod_D3DFMT_X1R5G5B5 1ull<<4
|
||||
#define uMod_D3DFMT_A1R5G5B5 1ull<<5
|
||||
#define uMod_D3DFMT_A4R4G4B4 1ull<<6
|
||||
#define uMod_D3DFMT_R3G3B2 1ull<<7
|
||||
#define uMod_D3DFMT_A8 1ull<<8
|
||||
#define uMod_D3DFMT_A8R3G3B2 1ull<<9
|
||||
#define uMod_D3DFMT_X4R4G4B4 1ull<<10
|
||||
#define uMod_D3DFMT_A2B10G10R10 1ull<<11
|
||||
#define uMod_D3DFMT_A8B8G8R8 1ull<<12
|
||||
#define uMod_D3DFMT_X8B8G8R8 1ull<<13
|
||||
#define uMod_D3DFMT_G16R16 1ull<<14
|
||||
#define uMod_D3DFMT_A2R10G10B10 1ull<<15
|
||||
#define uMod_D3DFMT_A16B16G16R16 1ull<<16
|
||||
|
||||
#define uMod_D3DFMT_A8P8 1ull<<17
|
||||
#define uMod_D3DFMT_P8 1ull<<18
|
||||
|
||||
#define uMod_D3DFMT_L8 1ull<<19
|
||||
#define uMod_D3DFMT_A8L8 1ull<<20
|
||||
#define uMod_D3DFMT_A4L4 1ull<<21
|
||||
|
||||
#define uMod_D3DFMT_V8U8 1ull<<22
|
||||
#define uMod_D3DFMT_L6V5U5 1ull<<23
|
||||
#define uMod_D3DFMT_X8L8V8U8 1ull<<24
|
||||
#define uMod_D3DFMT_Q8W8V8U8 1ull<<25
|
||||
#define uMod_D3DFMT_V16U16 1ull<<26
|
||||
#define uMod_D3DFMT_A2W10V10U10 1ull<<27
|
||||
|
||||
#define uMod_D3DFMT_UYVY 1ull<<28
|
||||
#define uMod_D3DFMT_R8G8_B8G8 1ull<<29
|
||||
#define uMod_D3DFMT_YUY2 1ull<<30
|
||||
#define uMod_D3DFMT_G8R8_G8B8 1ull<<31
|
||||
#define uMod_D3DFMT_DXT1 1ull<<32
|
||||
#define uMod_D3DFMT_DXT2 1ull<<33
|
||||
#define uMod_D3DFMT_DXT3 1ull<<34
|
||||
#define uMod_D3DFMT_DXT4 1ull<<35
|
||||
#define uMod_D3DFMT_DXT5 1ull<<36
|
||||
|
||||
#define uMod_D3DFMT_D16_LOCKABLE 1ull<<37
|
||||
#define uMod_D3DFMT_D32 1ull<<38
|
||||
#define uMod_D3DFMT_D15S1 1ull<<39
|
||||
#define uMod_D3DFMT_D24S8 1ull<<40
|
||||
#define uMod_D3DFMT_D24X8 1ull<<41
|
||||
#define uMod_D3DFMT_D24X4S4 1ull<<42
|
||||
#define uMod_D3DFMT_D16 1ull<<43
|
||||
|
||||
#define uMod_D3DFMT_D32F_LOCKABLE 1ull<<44
|
||||
#define uMod_D3DFMT_D24FS8 1ull<<45
|
||||
|
||||
#define uMod_D3DFMT_D32_LOCKABLE 1ull<<46
|
||||
#define uMod_D3DFMT_S8_LOCKABLE 1ull<<47
|
||||
|
||||
#define uMod_D3DFMT_L16 1ull<<48
|
||||
|
||||
#define uMod_D3DFMT_VERTEXDATA 1ull<<49
|
||||
#define uMod_D3DFMT_INDEX16 1ull<<50
|
||||
#define uMod_D3DFMT_INDEX32 1ull<<51
|
||||
|
||||
#define uMod_D3DFMT_Q16W16V16U16 1ull<<52
|
||||
|
||||
#define uMod_D3DFMT_MULTI2_ARGB8 1ull<<53
|
||||
|
||||
#define uMod_D3DFMT_R16F 1ull<<54
|
||||
#define uMod_D3DFMT_G16R16F 1ull<<55
|
||||
#define uMod_D3DFMT_A16B16G16R16F 1ull<<56
|
||||
|
||||
#define uMod_D3DFMT_R32F 1ull<<57
|
||||
#define uMod_D3DFMT_G32R32F 1ull<<58
|
||||
#define uMod_D3DFMT_A32B32G32R32F 1ull<<59
|
||||
|
||||
#define uMod_D3DFMT_CxV8U8 1ull<<60
|
||||
|
||||
#define uMod_D3DFMT_A1 1ull<<61
|
||||
#define uMod_D3DFMT_A2B10G10R10_XR_BIAS 1ull<<62
|
||||
#define uMod_D3DFMT_BINARYBUFFER 1ull<<63
|
||||
|
||||
//#define uMod_D3DFMT_FORCE_DWORD 1<<64
|
||||
*/
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
This file is part of Universal Modding Engine.
|
||||
|
||||
|
||||
Universal Modding Engine is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Universal Modding Engine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef UMOD_UTILS_H_
|
||||
#define UMOD_UTILS_H_
|
||||
|
||||
|
||||
template <class T>
|
||||
int GetMemory(T* &array, int num)
|
||||
{
|
||||
if (array!=(T*)0) delete [] array;
|
||||
try {array = new T[num];}
|
||||
catch (...) {array = (T*) 0; return -1;}
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
int GetMemory(T* &array, int num, T init)
|
||||
{
|
||||
if (array!=(T*)0) delete [] array;
|
||||
try {array = new T[num];}
|
||||
catch (...) {array = (T*) 0; return -1;}
|
||||
for (int i=0; i<num; i++) array[i]=init;
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
int GetMoreMemory(T* &old_array, int old_num, int new_num)
|
||||
{
|
||||
if (new_num<=old_num) return 0;
|
||||
T* new_array;
|
||||
try {new_array = new T[new_num];}
|
||||
catch (...) {return -1;}
|
||||
if (old_array!=(T*)0)
|
||||
{
|
||||
for (int i=0; i<old_num; i++) new_array[i]=old_array[i];
|
||||
delete [] old_array;
|
||||
}
|
||||
old_array = new_array;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* UMOD_UTILS_H_ */
|
||||
Reference in New Issue
Block a user