├── .cproject
├── .project
├── .settings
└── org.eclipse.cdt.codan.core.prefs
├── README.txt
├── uMod_DX9
├── makefile.gcc
├── makefile.vc
├── uMod_ArrayHandler.cpp
├── uMod_ArrayHandler.h
├── uMod_DX9_dll.cpp
├── uMod_DX9_dll.h
├── uMod_DX9_dll_DIRECT_INJECTION.def
├── uMod_DX9_dll_HOOK_INJECTION.def
├── uMod_DX9_dll_NO_INJECTION.def
├── uMod_Defines.h
├── uMod_IDirect3D9.cpp
├── uMod_IDirect3D9.h
├── uMod_IDirect3D9Ex.cpp
├── uMod_IDirect3D9Ex.h
├── uMod_IDirect3DCubeTexture9.cpp
├── uMod_IDirect3DCubeTexture9.h
├── uMod_IDirect3DDevice9.cpp
├── uMod_IDirect3DDevice9.h
├── uMod_IDirect3DDevice9Ex.cpp
├── uMod_IDirect3DDevice9Ex.h
├── uMod_IDirect3DTexture9.cpp
├── uMod_IDirect3DTexture9.h
├── uMod_IDirect3DVolumeTexture9.cpp
├── uMod_IDirect3DVolumeTexture9.h
├── uMod_Main.h
├── uMod_TextureClient.cpp
├── uMod_TextureClient.h
├── uMod_TextureFunction.cpp
├── uMod_TextureFunction.h
├── uMod_TextureServer.cpp
└── uMod_TextureServer.h
├── uMod_Error.h
├── uMod_GUI
├── bin
│ ├── README_Deutsch.txt
│ ├── README_English.txt
│ ├── README_French.txt
│ └── languages
│ │ ├── Example_uMod_LanguagePack_English.txt
│ │ ├── uMod_LanguagePackU_Deutsch.txt
│ │ ├── uMod_LanguagePackU_French.txt
│ │ ├── uMod_LanguagePackU_Russian.txt
│ │ └── uMod_LanguagePack_Italian.txt
├── config.gcc
├── config.vc
├── makefile.gcc
├── makefile.vc
├── uMod.ico
├── uMod.rc
├── uMod_AddTexture.cpp
├── uMod_AddTexture.h
├── uMod_Client.cpp
├── uMod_Client.h
├── uMod_DirectInjection.cpp
├── uMod_DirectInjection.h
├── uMod_Event.cpp
├── uMod_Event.h
├── uMod_File.cpp
├── uMod_File.h
├── uMod_GUI.cpp
├── uMod_GUI.h
├── uMod_GameInfo.cpp
├── uMod_GameInfo.h
├── uMod_GamePage.cpp
├── uMod_GamePage.h
├── uMod_Language.cpp
├── uMod_Language.h
├── uMod_Main.h
├── uMod_Sender.cpp
├── uMod_Sender.h
├── uMod_Server.cpp
├── uMod_Server.h
├── uMod_Settings.cpp
├── uMod_Settings.h
├── unzip.cpp
├── unzip.h
├── zip.cpp
└── zip.h
└── uMod_GlobalDefines.h
/.cproject:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | uMod 1
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?name?
14 |
15 |
16 |
17 | org.eclipse.cdt.make.core.append_environment
18 | true
19 |
20 |
21 | org.eclipse.cdt.make.core.buildArguments
22 |
23 |
24 |
25 | org.eclipse.cdt.make.core.buildCommand
26 | make
27 |
28 |
29 | org.eclipse.cdt.make.core.buildLocation
30 | ${workspace_loc:/uMod/Debug}
31 |
32 |
33 | org.eclipse.cdt.make.core.contents
34 | org.eclipse.cdt.make.core.activeConfigSettings
35 |
36 |
37 | org.eclipse.cdt.make.core.enableAutoBuild
38 | false
39 |
40 |
41 | org.eclipse.cdt.make.core.enableCleanBuild
42 | true
43 |
44 |
45 | org.eclipse.cdt.make.core.enableFullBuild
46 | true
47 |
48 |
49 | org.eclipse.cdt.make.core.stopOnError
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.useDefaultBuildCmd
54 | true
55 |
56 |
57 |
58 |
59 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
60 | full,incremental,
61 |
62 |
63 |
64 |
65 |
66 | org.eclipse.cdt.core.cnature
67 | org.eclipse.cdt.core.ccnature
68 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
69 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
70 |
71 |
72 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.cdt.codan.core.prefs:
--------------------------------------------------------------------------------
1 | #Sun Mar 11 21:51:23 CET 2012
2 | eclipse.preferences.version=1
3 | org.eclipse.cdt.codan.checkers.errnoreturn=Warning
4 | org.eclipse.cdt.codan.checkers.errnoreturn.params={implicit\=>false}
5 | org.eclipse.cdt.codan.checkers.errreturnvalue=Error
6 | org.eclipse.cdt.codan.checkers.errreturnvalue.params={}
7 | org.eclipse.cdt.codan.checkers.noreturn=Error
8 | org.eclipse.cdt.codan.checkers.noreturn.params={implicit\=>false}
9 | org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error
10 | org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
11 | org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error
12 | org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
13 | org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
14 | org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={}
15 | org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error
16 | org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={}
17 | org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning
18 | org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={no_break_comment\=>"no break",last_case_param\=>true,empty_case_param\=>false}
19 | org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
20 | org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={unknown\=>false,exceptions\=>()}
21 | org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
22 | org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
23 | org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error
24 | org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
25 | org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
26 | org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
27 | org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error
28 | org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
29 | org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error
30 | org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
31 | org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error
32 | org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
33 | org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error
34 | org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
35 | org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error
36 | org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
37 | org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
38 | org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
39 | org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
40 | org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={}
41 | org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error
42 | org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
43 | org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error
44 | org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
45 | org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error
46 | org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
47 | org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning
48 | org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={}
49 | org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning
50 | org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={}
51 | org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning
52 | org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={macro\=>true,exceptions\=>()}
53 | org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning
54 | org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={paramNot\=>false}
55 | org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning
56 | org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={else\=>false,afterelse\=>false}
57 | org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error
58 | org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
59 | org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning
60 | org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={}
61 | org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning
62 | org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={}
63 | org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning
64 | org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={exceptions\=>("@(\#)","$Id")}
65 | org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error
66 | org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>false,RUN_ON_INC_BUILD\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
67 |
--------------------------------------------------------------------------------
/README.txt:
--------------------------------------------------------------------------------
1 | The licence is set for each file separately.
2 |
3 |
4 | 1) How to compile the GUI:
5 |
6 | 1.1) You need:
7 | - wxWidgets 2.9. (an earlier version won't work, cause I use wxString functions only available in 2.9., I use atm 2.9.2)
8 |
9 | In the package a makefile for the gcc (makefile.gcc) and a makefile for the MS Visual C Compiler (makefile.vc) is included, but you can generate your own makefile for the compiler of your choice.
10 |
11 | Compiling wxWidgets:
12 | - Compile it with BUILD=release otherwise the executable will be very large.
13 | - The vc compiler somehow generates a smaller executable.
14 | - Set the linkage to static (in the config.gcc or config.vc) before you compile the wxWidgets, to ensure, that also on other PC's your executable will run.
15 |
16 | If you use my makefiles, you have to change the WX_DIR Variable to your wxWidgets directory. This Variable is nearly at the beginning of the makefiles.
17 | note: I have set the linkage to static in the corresponding config.* files, if you have not compiled you wxWidgets with static linkage the compiler will fail, when linking the GUI.
18 |
19 | 1.2) Using gcc:
20 | change in the uMod_GUI Directory and type:
21 | mingw32-make -f makefile.gcc BUILD=release
22 | (note: with the options -j 4 you compile simultaneously with 4 threads)
23 |
24 | 1.3) Using vc:
25 | change in the uMod_GUI Directory and type:
26 | nmake -f makefile.vc BUILD=release
27 | (note: you need to use the special MS Visual prompt)
28 |
29 |
30 | 2) How to compile the dll:
31 |
32 | 2.1) You need:
33 | - The DirectX SDK (I use June 2010)
34 | - MS Visual C Compiler (I use the free Express 2010 version)
35 | - maybe the Microsoft Windows SDK
36 |
37 | There exist two makefiles, one for the mingw32-make.exe (makefile.gcc) which call the vc compiler and one for the nmake.exe (makefile.vc) which also calls the vc compiler. I have created the makefile.gcc only to use the -j 4 option of the gnu make.
38 |
39 | You have to compile the 3 dll's separately (one for each injection method). The dll will be copied after successful compilation in the uMod_GUI/bin directory.
40 |
41 | If you want to use the logging mode of the dll you have to parse LOG_MESSAGE=1
42 |
43 |
44 | 2.2) Using gcc (BUT you need the vc compiler!):
45 | change in the uMod_DX9 Directory and type:
46 | mingw32-make -f makefile.gcc
47 | mingw32-make -f makefile.gcc DI=1
48 | mingw32-make -f makefile.gcc NI=1
49 | (note: you need to use the special MS Visual prompt)
50 | (note: with the options -j 4 you compile simultaneously with 4 threads)
51 |
52 |
53 | 2.3) Using vc:
54 | change in the uMod_DX9 Directory and type:
55 | nmake -f makefile.vc
56 | nmake -f makefile.vc DI=1
57 | nmake -f makefile.vc NI=1
58 | (note: you need to use the special MS Visual prompt)
--------------------------------------------------------------------------------
/uMod_DX9/makefile.gcc:
--------------------------------------------------------------------------------
1 | ifdef NI
2 |
3 | ifdef LOG_MESSAGE
4 | precompiler_flag = /D "LOG_MESSAGE" /D "NO_INJECTION"
5 | else
6 | precompiler_flag = /D "NO_INJECTION"
7 | endif
8 |
9 | def_file = /DEF:"uMod_DX9_dll_NO_INJECTION.def"
10 | obj_suff = NI.obj
11 | dll = d3d9.dll
12 |
13 | else
14 |
15 | ifdef DI
16 | ifdef LOG_MESSAGE
17 | precompiler_flag = /D "LOG_MESSAGE" /D "DIRECT_INJECTION"
18 | else
19 | precompiler_flag = /D "DIRECT_INJECTION"
20 | endif
21 |
22 | def_file = /DEF:"uMod_DX9_dll_DIRECT_INJECTION.def"
23 | obj_suff = DI.obj
24 | dll = uMod_d3d9_DI.dll
25 |
26 | else
27 |
28 | ifdef LOG_MESSAGE
29 | precompiler_flag = /D "LOG_MESSAGE" /D "HOOK_INJECTION"
30 | else
31 | precompiler_flag = /D "HOOK_INJECTION"
32 | endif
33 |
34 | def_file = /DEF:"uMod_DX9_dll_HOOK_INJECTION.def"
35 | obj_suff = HI.obj
36 | dll = uMod_d3d9_HI.dll
37 | endif
38 | endif
39 |
40 |
41 | CXX = cl
42 | CLINK = link.exe
43 | DEFINES = /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "_WINDLL" /D "_MBCS"
44 | 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
45 | 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
46 |
47 | obj = obj
48 | bin = bin
49 |
50 | objects = ${obj}\uMod_DX9_dll.${obj_suff} \
51 | ${obj}\uMod_IDirect3D9.${obj_suff} \
52 | ${obj}\uMod_IDirect3D9Ex.${obj_suff} \
53 | ${obj}\uMod_IDirect3DDevice9.${obj_suff} \
54 | ${obj}\uMod_IDirect3DDevice9Ex.${obj_suff} \
55 | ${obj}\uMod_TextureFunction.${obj_suff} \
56 | ${obj}\uMod_IDirect3DTexture9.${obj_suff} \
57 | ${obj}\uMod_IDirect3DVolumeTexture9.${obj_suff} \
58 | ${obj}\uMod_IDirect3DCubeTexture9.${obj_suff} \
59 | ${obj}\uMod_ArrayHandler.${obj_suff} \
60 | ${obj}\uMod_TextureClient.${obj_suff} \
61 | ${obj}\uMod_TextureServer.${obj_suff}
62 |
63 | headers = uMod_Main.h \
64 | uMod_Defines.h \
65 | uMod_DX9_dll.h \
66 | uMod_IDirect3D9.h \
67 | uMod_IDirect3DDevice9.h \
68 | uMod_TextureFunction.h \
69 | uMod_IDirect3DTexture9.h \
70 | uMod_IDirect3DVolumeTexture9.h \
71 | uMod_IDirect3DCubeTexture9.h \
72 | uMod_ArrayHandler.h \
73 | uMod_TextureClient.h \
74 | uMod_TextureServer.h
75 |
76 | ${bin}\d3d9.dll: ${objects}
77 | ${CLINK} ${LFLAGS} ${objects} /OUT:${bin}\${dll}
78 | copy ${bin}\${dll} ..\uMod_GUI\bin\${dll}
79 |
80 | ${obj}\uMod_DX9_dll.${obj_suff}: uMod_DX9_dll.cpp ${headers}
81 | ${CXX} ${CFLAGS} /c $< /Fo$@
82 |
83 | ${obj}\uMod_IDirect3D9.${obj_suff}: uMod_IDirect3D9.cpp ${headers}
84 | ${CXX} ${CFLAGS} /c $< /Fo$@
85 |
86 | ${obj}\uMod_IDirect3D9Ex.${obj_suff}: uMod_IDirect3D9Ex.cpp ${headers}
87 | ${CXX} ${CFLAGS} /c $< /Fo$@
88 |
89 | ${obj}\uMod_IDirect3DDevice9.${obj_suff}: uMod_IDirect3DDevice9.cpp ${headers}
90 | ${CXX} ${CFLAGS} /c $< /Fo$@
91 |
92 | ${obj}\uMod_IDirect3DDevice9Ex.${obj_suff}: uMod_IDirect3DDevice9Ex.cpp ${headers}
93 | ${CXX} ${CFLAGS} /c $< /Fo$@
94 |
95 | ${obj}\uMod_TextureFunction.${obj_suff}: uMod_TextureFunction.cpp ${headers}
96 | ${CXX} ${CFLAGS} /c $< /Fo$@
97 |
98 | ${obj}\uMod_IDirect3DTexture9.${obj_suff}: uMod_IDirect3DTexture9.cpp ${headers}
99 | ${CXX} ${CFLAGS} /c $< /Fo$@
100 |
101 | ${obj}\uMod_IDirect3DVolumeTexture9.${obj_suff}: uMod_IDirect3DVolumeTexture9.cpp ${headers}
102 | ${CXX} ${CFLAGS} /c $< /Fo$@
103 |
104 | ${obj}\uMod_IDirect3DCubeTexture9.${obj_suff}: uMod_IDirect3DCubeTexture9.cpp ${headers}
105 | ${CXX} ${CFLAGS} /c $< /Fo$@
106 |
107 | ${obj}\uMod_ArrayHandler.${obj_suff}: uMod_ArrayHandler.cpp ${headers}
108 | ${CXX} ${CFLAGS} /c $< /Fo$@
109 |
110 | ${obj}\uMod_TextureClient.${obj_suff}: uMod_TextureClient.cpp ${headers}
111 | ${CXX} ${CFLAGS} /c $< /Fo$@
112 |
113 | ${obj}\uMod_TextureServer.${obj_suff}: uMod_TextureServer.cpp ${headers}
114 | ${CXX} ${CFLAGS} /c $< /Fo$@
115 |
116 | clean:
117 | del ${objects} ${bin}\${dll}
--------------------------------------------------------------------------------
/uMod_DX9/makefile.vc:
--------------------------------------------------------------------------------
1 | !IFDEF NI
2 |
3 | !IFDEF LOG_MESSAGE
4 | precompiler_flag = /D "LOG_MESSAGE" /D "NO_INJECTION"
5 | !ELSE
6 | precompiler_flag = /D "NO_INJECTION"
7 | !ENDIF
8 |
9 | def_file = /DEF:"uMod_DX9_dll_NO_INJECTION.def"
10 | obj_suff = NI.obj
11 | dll = d3d9.dll
12 |
13 | !ELSE
14 |
15 | !IFDEF DI
16 | !IFDEF LOG_MESSAGE
17 | precompiler_flag = /D "LOG_MESSAGE" /D "DIRECT_INJECTION"
18 | !ELSE
19 | precompiler_flag = /D "DIRECT_INJECTION"
20 | !ENDIF
21 |
22 | def_file = /DEF:"uMod_DX9_dll_DIRECT_INJECTION.def"
23 | obj_suff = DI.obj
24 | dll = uMod_d3d9_DI.dll
25 |
26 | !ELSE
27 |
28 | !IFDEF LOG_MESSAGE
29 | precompiler_flag = /D "LOG_MESSAGE" /D "HOOK_INJECTION"
30 | !ELSE
31 | precompiler_flag = /D "HOOK_INJECTION"
32 | !ENDIF
33 |
34 | def_file = /DEF:"uMod_DX9_dll_HOOK_INJECTION.def"
35 | obj_suff = HI.obj
36 | dll = uMod_d3d9_HI.dll
37 |
38 | !ENDIF
39 |
40 |
41 | CXX = cl
42 | CLINK = link.exe
43 | DEFINES = /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "_WINDLL" /D "_MBCS"
44 | 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
45 | 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
46 |
47 | obj = obj
48 | bin = bin
49 |
50 | objects = $(obj)\uMod_DX9_dll.$(obj_suff) \
51 | $(obj)\uMod_IDirect3D9.$(obj_suff) \
52 | $(obj)\uMod_IDirect3D9Ex.$(obj_suff) \
53 | $(obj)\uMod_IDirect3DDevice9.$(obj_suff) \
54 | $(obj)\uMod_IDirect3DDevice9Ex.$(obj_suff) \
55 | $(obj)\uMod_TextureFunction.$(obj_suff) \
56 | $(obj)\uMod_IDirect3DTexture9.$(obj_suff) \
57 | $(obj)\uMod_IDirect3DVolumeTexture9.$(obj_suff) \
58 | $(obj)\uMod_IDirect3DCubeTexture9.$(obj_suff) \
59 | $(obj)\uMod_ArrayHandler.$(obj_suff) \
60 | $(obj)\uMod_TextureClient.$(obj_suff) \
61 | $(obj)\uMod_TextureServer.$(obj_suff)
62 |
63 | headers = uMod_Main.h \
64 | uMod_Defines.h \
65 | uMod_DX9_dll.h \
66 | uMod_IDirect3D9.h \
67 | uMod_IDirect3DDevice9.h \
68 | uMod_TextureFunction.h \
69 | uMod_IDirect3DTexture9.h \
70 | uMod_IDirect3DVolumeTexture9.h \
71 | uMod_IDirect3DCubeTexture9.h \
72 | uMod_ArrayHandler.h \
73 | uMod_TextureClient.h \
74 | uMod_TextureServer.h
75 |
76 | $(bin)\d3d9.dll: $(objects)
77 | $(CLINK) $(LFLAGS) $(objects) /OUT:$(bin)\$(dll)
78 | copy $(bin)\$(dll) ..\uMod_GUI\bin\$(dll)
79 |
80 | $(obj)\uMod_DX9_dll.$(obj_suff): uMod_DX9_dll.cpp $(headers)
81 | $(CXX) $(CFLAGS) /c /Fo$@ uMod_DX9_dll.cpp
82 |
83 | $(obj)\uMod_IDirect3D9.$(obj_suff): uMod_IDirect3D9.cpp $(headers)
84 | $(CXX) $(CFLAGS) /c /Fo$@ uMod_IDirect3D9.cpp
85 |
86 | $(obj)\uMod_IDirect3D9Ex.$(obj_suff): uMod_IDirect3D9Ex.cpp $(headers)
87 | $(CXX) $(CFLAGS) /c /Fo$@ uMod_IDirect3D9Ex.cpp
88 |
89 | $(obj)\uMod_IDirect3DDevice9.$(obj_suff): uMod_IDirect3DDevice9.cpp $(headers)
90 | $(CXX) $(CFLAGS) /c /Fo$@ uMod_IDirect3DDevice9.cpp
91 |
92 | $(obj)\uMod_IDirect3DDevice9Ex.$(obj_suff): uMod_IDirect3DDevice9Ex.cpp $(headers)
93 | $(CXX) $(CFLAGS) /c /Fo$@ uMod_IDirect3DDevice9Ex.cpp
94 |
95 | $(obj)\uMod_TextureFunction.$(obj_suff): uMod_TextureFunction.cpp $(headers)
96 | $(CXX) $(CFLAGS) /c /Fo$@ uMod_TextureFunction.cpp
97 |
98 | $(obj)\uMod_IDirect3DTexture9.$(obj_suff): uMod_IDirect3DTexture9.cpp $(headers)
99 | $(CXX) $(CFLAGS) /c /Fo$@ uMod_IDirect3DTexture9.cpp
100 |
101 | $(obj)\uMod_IDirect3DVolumeTexture9.$(obj_suff): uMod_IDirect3DVolumeTexture9.cpp $(headers)
102 | $(CXX) $(CFLAGS) /c /Fo$@ uMod_IDirect3DVolumeTexture9.cpp
103 |
104 | $(obj)\uMod_IDirect3DCubeTexture9.$(obj_suff): uMod_IDirect3DCubeTexture9.cpp $(headers)
105 | $(CXX) $(CFLAGS) /c /Fo$@ uMod_IDirect3DCubeTexture9.cpp
106 |
107 | $(obj)\uMod_ArrayHandler.$(obj_suff): uMod_ArrayHandler.cpp $(headers)
108 | $(CXX) $(CFLAGS) /c /Fo$@ uMod_ArrayHandler.cpp
109 |
110 | $(obj)\uMod_TextureClient.$(obj_suff): uMod_TextureClient.cpp $(headers)
111 | $(CXX) $(CFLAGS) /c /Fo$@ uMod_TextureClient.cpp
112 |
113 | $(obj)\uMod_TextureServer.$(obj_suff): uMod_TextureServer.cpp $(headers)
114 | $(CXX) $(CFLAGS) /c /Fo$@ uMod_TextureServer.cpp
115 |
116 | clean:
117 | del $(objects) $(bin)\$(dll)
--------------------------------------------------------------------------------
/uMod_DX9/uMod_ArrayHandler.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 |
22 | #include "uMod_Main.h"
23 |
24 |
25 |
26 |
27 |
28 | uMod_FileHandler::uMod_FileHandler(void)
29 | {
30 | Message("uMod_FileHandler(void): %lu\n", this);
31 | Number = 0;
32 | FieldCounter = 0;
33 | Files = NULL;
34 | }
35 |
36 | uMod_FileHandler::~uMod_FileHandler(void)
37 | {
38 | Message("~uMod_FileHandler(void): %lu\n", this);
39 | if (Files!=NULL)
40 | {
41 | for (int i=0; iReference>=0) return (RETURN_UPDATE_ALLREADY_ADDED);
52 |
53 | if (Number/FieldLength==FieldCounter) // get more memory
54 | {
55 | TextureFileStruct*** temp = NULL;
56 | try {temp = new TextureFileStruct**[FieldCounter+10];}
57 | catch (...)
58 | {
59 | gl_ErrorState |= uMod_ERROR_MEMORY | uMod_ERROR_TEXTURE;
60 | return (RETURN_NO_MEMORY);
61 | }
62 |
63 | for (int i=0; iReference = Number++; //set the reference for a fast deleting
86 |
87 | return (RETURN_OK);
88 | }
89 |
90 |
91 | int uMod_FileHandler::Remove(TextureFileStruct* file)
92 | {
93 | Message("uMod_FileHandler::Remove(%lu): %lu\n", file, this);
94 | if (gl_ErrorState & uMod_ERROR_FATAL) return (RETURN_FATAL_ERROR);
95 | int ref = file->Reference;
96 |
97 | if (ref<0) return (RETURN_OK); // returning if no Reference is set
98 | file->Reference = -1; //set reference outside of bound
99 | if (ref<(--Number)) //if reference is unequal to Number-1 we copy the last entry to the index "ref"
100 | {
101 | Files[ref/FieldLength][ref%FieldLength] = Files[Number/FieldLength][Number%FieldLength];
102 | Files[ref/FieldLength][ref%FieldLength]->Reference = ref; //set the new reference entry
103 | }
104 | return (RETURN_OK);
105 | }
106 |
107 |
--------------------------------------------------------------------------------
/uMod_DX9/uMod_ArrayHandler.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #ifndef uMod_FIELDHANDLER_H_
22 | #define uMod_FIELDHANDLER_H_
23 |
24 | #include "..\uMod_GlobalDefines.h"
25 | #include "uMod_IDirect3DTexture9.h"
26 |
27 | typedef struct
28 | {
29 | bool ForceReload; // to force a reload of the texture (if it is already modded)
30 | char* pData; // store texture file as file in memory
31 | unsigned int Size; // size of file
32 | int NumberOfTextures;
33 | int Reference; // for a fast delete in the FileHandler
34 | IDirect3DBaseTexture9 **Textures; // pointer to the fake textures
35 | MyTypeHash Hash; // hash value
36 | } TextureFileStruct;
37 |
38 |
39 |
40 | class uMod_FileHandler // array to store TextureFileStruct
41 | {
42 | public:
43 | uMod_FileHandler(void);
44 | ~uMod_FileHandler(void);
45 |
46 | int Add( TextureFileStruct* file);
47 | int Remove( TextureFileStruct* file);
48 |
49 | int GetNumber(void) {return (Number);}
50 |
51 | TextureFileStruct *operator [] (int i) {if (i<0||i>=Number) return (NULL); else return (Files[i/FieldLength][i%FieldLength]);}
52 |
53 | protected:
54 | static const int FieldLength = 1024;
55 | long Number;
56 | int FieldCounter;
57 | TextureFileStruct*** Files;
58 | };
59 |
60 |
61 |
62 | template
63 | class uMod_TextureHandler // array to store uMod_IDirect3DTexture9, uMod_IDirect3DVolumeTexture9 or uMod_IDirect3DCubeTexture9
64 | {
65 | public:
66 | uMod_TextureHandler(void);
67 | ~uMod_TextureHandler(void);
68 |
69 | int Add( T* texture);
70 | int Remove( T* texture);
71 |
72 | int GetNumber(void) {return (Number);}
73 | T *operator [] (int i) {if (i<0||i>=Number) return (NULL); else return (Textures[i/FieldLength][i%FieldLength]);}
74 |
75 | private:
76 | static const int FieldLength = 1024;
77 | long Number;
78 | int FieldCounter;
79 | T*** Textures;
80 | };
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 | template
95 | uMod_TextureHandler::uMod_TextureHandler(void)
96 | {
97 | Message("uMod_TextureHandler(void): %lu\n", this);
98 | Number = 0;
99 | FieldCounter = 0;
100 |
101 | Textures = NULL;
102 | }
103 |
104 | template
105 | uMod_TextureHandler::~uMod_TextureHandler(void)
106 | {
107 | Message("~uMod_TextureHandler(void): %lu\n", this);
108 | if (Textures!=NULL)
109 | {
110 | for (int i=0; i
116 | int uMod_TextureHandler::Add(T* pTexture)
117 | {
118 | Message("uMod_TextureHandler::Add( %lu): %lu\n", pTexture, this);
119 | if (gl_ErrorState & uMod_ERROR_FATAL) return (RETURN_FATAL_ERROR);
120 |
121 | if (pTexture->Reference>=0) return (RETURN_TEXTURE_ALLREADY_ADDED);
122 |
123 | if (Number/FieldLength==FieldCounter)
124 | {
125 | T*** temp = NULL;
126 | try {temp = new T**[FieldCounter+10];}
127 | catch (...)
128 | {
129 | gl_ErrorState |= uMod_ERROR_MEMORY | uMod_ERROR_TEXTURE;
130 | return (RETURN_NO_MEMORY);
131 | }
132 |
133 | for (int i=0; iReference = Number++;
156 |
157 | return (RETURN_OK);
158 | }
159 |
160 |
161 | template
162 | int uMod_TextureHandler::Remove(T* pTexture) //will be called, if a texture is completely released
163 | {
164 | Message("uMod_TextureHandler::Remove( %lu): %lu\n", pTexture, this);
165 | if (gl_ErrorState & uMod_ERROR_FATAL) return (RETURN_FATAL_ERROR);
166 |
167 | int ref = pTexture->Reference;
168 | if (ref<0) return (RETURN_OK); // returning if no TextureHandlerRef is set
169 |
170 | if (ref<(--Number))
171 | {
172 | Textures[ref/FieldLength][ref%FieldLength] = Textures[Number/FieldLength][Number%FieldLength];
173 | Textures[ref/FieldLength][ref%FieldLength]->Reference = ref;
174 | }
175 | return (RETURN_OK);
176 | }
177 |
178 |
179 |
180 |
181 |
182 |
183 | #endif /* uMod_FIELDHANDLER_H_ */
184 |
--------------------------------------------------------------------------------
/uMod_DX9/uMod_DX9_dll.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #ifndef uMod_DX9_DLL_H_
22 | #define uMod_DX9_DLL_H_
23 |
24 | void InitInstance(HINSTANCE hModule);
25 | void ExitInstance(void);
26 | void LoadOriginalDll(void);
27 | bool HookThisProgram( wchar_t *ret);
28 | DWORD WINAPI ServerThread( LPVOID lpParam);
29 |
30 |
31 |
32 | #ifndef NO_INJECTION
33 |
34 | void *DetourFunc(BYTE *src, const BYTE *dst, const int len);
35 | bool RetourFunc(BYTE *src, BYTE *restore, const int len);
36 | IDirect3D9 *APIENTRY uMod_Direct3DCreate9(UINT SDKVersion);
37 | HRESULT APIENTRY uMod_Direct3DCreate9Ex( UINT SDKVersion, IDirect3D9Ex **ppD3D);
38 |
39 | #ifdef HOOK_INJECTION
40 | LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam);
41 | void InstallHook(void);
42 | void RemoveHook(void);
43 | #endif
44 |
45 |
46 | #ifdef DIRECT_INJECTION
47 | void Nothing(void);
48 | #endif
49 |
50 | #endif
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/uMod_DX9/uMod_DX9_dll_DIRECT_INJECTION.def:
--------------------------------------------------------------------------------
1 | LIBRARY "uMod_d3d9_DI"
2 | EXPORTS
3 | uMod_Direct3DCreate9 @1
4 | uMod_Direct3DCreate9Ex @2
5 | Nothing @3
--------------------------------------------------------------------------------
/uMod_DX9/uMod_DX9_dll_HOOK_INJECTION.def:
--------------------------------------------------------------------------------
1 | LIBRARY "uMod_d3d9_Hook"
2 | EXPORTS
3 | uMod_Direct3DCreate9 @1
4 | uMod_Direct3DCreate9Ex @2
5 | InstallHook @3
6 | RemoveHook @4
--------------------------------------------------------------------------------
/uMod_DX9/uMod_DX9_dll_NO_INJECTION.def:
--------------------------------------------------------------------------------
1 | LIBRARY "d3d9"
2 | EXPORTS
3 | Direct3DCreate9 @1
4 | Direct3DCreate9Ex @2
--------------------------------------------------------------------------------
/uMod_DX9/uMod_Defines.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #ifndef uMod_DEFINES_H_
22 | #define uMod_DEFINES_H_
23 |
24 |
25 |
26 | #ifdef LOG_MESSAGE
27 | extern FILE *gl_File;
28 |
29 | #define Message(...) {if (gl_File!=NULL) {fprintf( gl_File, __VA_ARGS__); fflush(gl_File);}}
30 | #ifdef HOOK_INJECTION
31 | #define OpenMessage(...) {if (fopen_s( &gl_File, "uMod_log.txt", "wt")) gl_File=NULL; else fprintf( gl_File, "HI R40: 0000000\n");}
32 | #endif
33 |
34 | #ifdef DIRECT_INJECTION
35 | #define OpenMessage(...) {if (fopen_s( &gl_File, "uMod_log.txt", "wt")) gl_File=NULL; else fprintf( gl_File, "DI 40: 0000000\n");}
36 | #endif
37 |
38 | #ifdef NO_INJECTION
39 | #define OpenMessage(...) {if (fopen_s( &gl_File, "uMod_log.txt", "wt")) gl_File=NULL; else fprintf( gl_File, "NI R40: 0000000\n");}
40 | #endif
41 |
42 | #define CloseMessage(...) {if (gl_File!=NULL) fclose(gl_File);}
43 |
44 |
45 | #else
46 | #define OpenMessage(...)
47 | #define Message(...)
48 | #define CloseMessage(...)
49 | #endif
50 |
51 |
52 | #ifdef __CDT_PARSER__
53 | typedef unsigned long DWORD64;
54 | typedef unsigned long DWORD32;
55 |
56 | #define STDMETHOD(method) virtual HRESULT method
57 | #define STDMETHOD_(ret, method) virtual ret method
58 | #define sprintf_s(...)
59 | #define fprintf(...)
60 | #define fclose(...)
61 | #define fseek(...)
62 | #define ftell(...) 0
63 | #define fflush(...)
64 | typedef LONG HRESULT;
65 |
66 | #define UNREFERENCED_PARAMETER(...)
67 | #endif
68 |
69 |
70 | #endif /* uMod_DEFINES_H_ */
71 |
--------------------------------------------------------------------------------
/uMod_DX9/uMod_IDirect3D9.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 |
22 |
23 | #include "uMod_Main.h"
24 |
25 | #ifndef PRE_MESSAGE
26 | #define PRE_MESSAGE "uMod_IDirect3D9"
27 | #endif
28 |
29 | uMod_IDirect3D9::uMod_IDirect3D9( IDirect3D9 *pOriginal, uMod_TextureServer* server)
30 | {
31 | Message( PRE_MESSAGE "::" PRE_MESSAGE "( %lu, %lu): %lu\n", pOriginal, server, this);
32 | m_pIDirect3D9 = pOriginal;
33 | uMod_Server = server;
34 | }
35 |
36 | uMod_IDirect3D9::~uMod_IDirect3D9(void)
37 | {
38 | Message( PRE_MESSAGE "::~" PRE_MESSAGE "(): %lu\n", this);
39 | }
40 |
41 | HRESULT __stdcall uMod_IDirect3D9::QueryInterface(REFIID riid, void** ppvObj)
42 | {
43 | *ppvObj = NULL;
44 |
45 | // call this to increase AddRef at original object
46 | // and to check if such an interface is there
47 |
48 | HRESULT hRes = m_pIDirect3D9->QueryInterface(riid, ppvObj);
49 |
50 | if (hRes == NOERROR) // if OK, send our "fake" address
51 | {
52 | *ppvObj = this;
53 | }
54 |
55 | return (hRes);
56 | }
57 |
58 | ULONG __stdcall uMod_IDirect3D9::AddRef(void)
59 | {
60 | return(m_pIDirect3D9->AddRef());
61 | }
62 |
63 | ULONG __stdcall uMod_IDirect3D9::Release(void)
64 | {
65 | // call original routine
66 | ULONG count = m_pIDirect3D9->Release();
67 |
68 | // in case no further Ref is there, the Original Object has deleted itself
69 | if (count == 0)
70 | {
71 | delete(this);
72 | }
73 |
74 | return(count);
75 | }
76 |
77 | HRESULT __stdcall uMod_IDirect3D9::RegisterSoftwareDevice(void* pInitializeFunction)
78 | {
79 | return(m_pIDirect3D9->RegisterSoftwareDevice(pInitializeFunction));
80 | }
81 |
82 | UINT __stdcall uMod_IDirect3D9::GetAdapterCount(void)
83 | {
84 | return(m_pIDirect3D9->GetAdapterCount());
85 | }
86 |
87 | HRESULT __stdcall uMod_IDirect3D9::GetAdapterIdentifier(UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier)
88 | {
89 | return(m_pIDirect3D9->GetAdapterIdentifier(Adapter,Flags,pIdentifier));
90 | }
91 |
92 | UINT __stdcall uMod_IDirect3D9::GetAdapterModeCount(UINT Adapter, D3DFORMAT Format)
93 | {
94 | return(m_pIDirect3D9->GetAdapterModeCount(Adapter, Format));
95 | }
96 |
97 | HRESULT __stdcall uMod_IDirect3D9::EnumAdapterModes(UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode)
98 | {
99 | return(m_pIDirect3D9->EnumAdapterModes(Adapter,Format,Mode,pMode));
100 | }
101 |
102 | HRESULT __stdcall uMod_IDirect3D9::GetAdapterDisplayMode( UINT Adapter,D3DDISPLAYMODE* pMode)
103 | {
104 | return(m_pIDirect3D9->GetAdapterDisplayMode(Adapter,pMode));
105 | }
106 |
107 | HRESULT __stdcall uMod_IDirect3D9::CheckDeviceType(UINT iAdapter,D3DDEVTYPE DevType,D3DFORMAT DisplayFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed)
108 | {
109 | return(m_pIDirect3D9->CheckDeviceType(iAdapter,DevType,DisplayFormat,BackBufferFormat,bWindowed));
110 | }
111 |
112 | HRESULT __stdcall uMod_IDirect3D9::CheckDeviceFormat(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat)
113 | {
114 | return(m_pIDirect3D9->CheckDeviceFormat(Adapter,DeviceType,AdapterFormat,Usage,RType,CheckFormat));
115 | }
116 |
117 | HRESULT __stdcall uMod_IDirect3D9::CheckDeviceMultiSampleType(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels)
118 | {
119 | return(m_pIDirect3D9->CheckDeviceMultiSampleType(Adapter,DeviceType,SurfaceFormat,Windowed,MultiSampleType,pQualityLevels));
120 | }
121 |
122 | HRESULT __stdcall uMod_IDirect3D9::CheckDepthStencilMatch(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat)
123 | {
124 | return(m_pIDirect3D9->CheckDepthStencilMatch(Adapter,DeviceType,AdapterFormat,RenderTargetFormat,DepthStencilFormat));
125 | }
126 |
127 | HRESULT __stdcall uMod_IDirect3D9::CheckDeviceFormatConversion(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat)
128 | {
129 | return(m_pIDirect3D9->CheckDeviceFormatConversion(Adapter,DeviceType,SourceFormat,TargetFormat));
130 | }
131 |
132 | HRESULT __stdcall uMod_IDirect3D9::GetDeviceCaps(UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps)
133 | {
134 | return(m_pIDirect3D9->GetDeviceCaps(Adapter,DeviceType,pCaps));
135 | }
136 |
137 | HMONITOR __stdcall uMod_IDirect3D9::GetAdapterMonitor(UINT Adapter)
138 | {
139 | return(m_pIDirect3D9->GetAdapterMonitor(Adapter));
140 | }
141 |
142 | HRESULT __stdcall uMod_IDirect3D9::CreateDevice(UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface)
143 | {
144 | Message( PRE_MESSAGE "::CreateDevice(): %lu\n", this);
145 | // we intercept this call and provide our own "fake" Device Object
146 | HRESULT hres = m_pIDirect3D9->CreateDevice( Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface);
147 |
148 | int count = 1;
149 | if (pPresentationParameters!=NULL) count = pPresentationParameters->BackBufferCount;
150 | uMod_IDirect3DDevice9 *pIDirect3DDevice9 = new uMod_IDirect3DDevice9(*ppReturnedDeviceInterface, uMod_Server, count);
151 |
152 | // store our pointer (the fake one) for returning it to the calling program
153 | *ppReturnedDeviceInterface = pIDirect3DDevice9;
154 |
155 | return(hres);
156 | }
157 |
--------------------------------------------------------------------------------
/uMod_DX9/uMod_IDirect3D9.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 | /*
20 | *
21 | * BIG THANKS TO Michael Koch
22 | * (proxydll_9.zip)
23 | *
24 | */
25 |
26 |
27 | #ifndef uMod_IDirect3D9_H_
28 | #define uMod_IDirect3D9_H_
29 |
30 |
31 | #include
32 | #include
33 | #include "uMod_TextureServer.h"
34 | #include "uMod_TextureClient.h"
35 |
36 | class uMod_IDirect3D9 : public IDirect3D9
37 | {
38 | public:
39 | uMod_IDirect3D9(IDirect3D9 *pOriginal, uMod_TextureServer *server);
40 | virtual ~uMod_IDirect3D9(void);
41 |
42 | // The original DX9 function definitions
43 | HRESULT __stdcall QueryInterface(REFIID riid, void** ppvObj);
44 | ULONG __stdcall AddRef(void);
45 | ULONG __stdcall Release(void);
46 | HRESULT __stdcall RegisterSoftwareDevice(void* pInitializeFunction);
47 | UINT __stdcall GetAdapterCount(void);
48 | HRESULT __stdcall GetAdapterIdentifier(UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) ;
49 | UINT __stdcall GetAdapterModeCount(UINT Adapter, D3DFORMAT Format);
50 | HRESULT __stdcall EnumAdapterModes(UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) ;
51 | HRESULT __stdcall GetAdapterDisplayMode( UINT Adapter,D3DDISPLAYMODE* pMode) ;
52 | HRESULT __stdcall CheckDeviceType(UINT iAdapter,D3DDEVTYPE DevType,D3DFORMAT DisplayFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) ;
53 | HRESULT __stdcall CheckDeviceFormat(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) ;
54 | HRESULT __stdcall CheckDeviceMultiSampleType(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) ;
55 | HRESULT __stdcall CheckDepthStencilMatch(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) ;
56 | HRESULT __stdcall CheckDeviceFormatConversion(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat);
57 | HRESULT __stdcall GetDeviceCaps(UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) ;
58 | HMONITOR __stdcall GetAdapterMonitor(UINT Adapter) ;
59 | HRESULT __stdcall CreateDevice(UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) ;
60 |
61 | private:
62 | IDirect3D9 *m_pIDirect3D9;
63 | uMod_TextureServer* uMod_Server;
64 | };
65 |
66 | #endif
67 |
--------------------------------------------------------------------------------
/uMod_DX9/uMod_IDirect3D9Ex.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 |
22 |
23 | #include "uMod_Main.h"
24 |
25 |
26 |
27 | #define IDirect3D9 IDirect3D9Ex
28 | #define uMod_IDirect3D9 uMod_IDirect3D9Ex
29 | #define m_pIDirect3D9 m_pIDirect3D9Ex
30 | #define PRE_MESSAGE "uMod_IDirect3D9Ex"
31 |
32 | #include "uMod_IDirect3D9.cpp"
33 |
34 |
35 | HRESULT __stdcall uMod_IDirect3D9Ex::CreateDeviceEx( UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, D3DDISPLAYMODEEX *pFullscreenDisplayMode, IDirect3DDevice9Ex **ppReturnedDeviceInterface)
36 | {
37 | Message( "uMod_IDirect3D9Ex::CreateDeviceEx: %lu\n", this);
38 | // we intercept this call and provide our own "fake" Device Object
39 | HRESULT hres = m_pIDirect3D9Ex->CreateDeviceEx( Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, pFullscreenDisplayMode, ppReturnedDeviceInterface);
40 |
41 | int count = 1;
42 | if (pPresentationParameters!=NULL) count = pPresentationParameters->BackBufferCount;
43 | uMod_IDirect3DDevice9Ex *pIDirect3DDevice9Ex = new uMod_IDirect3DDevice9Ex(*ppReturnedDeviceInterface, uMod_Server, count);
44 |
45 | // store our pointer (the fake one) for returning it to the calling program
46 | *ppReturnedDeviceInterface = pIDirect3DDevice9Ex;
47 |
48 | return(hres);
49 | return (m_pIDirect3D9Ex->CreateDeviceEx( Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, pFullscreenDisplayMode, ppReturnedDeviceInterface));
50 | }
51 |
52 | HRESULT __stdcall uMod_IDirect3D9Ex::EnumAdapterModesEx( UINT Adapter, const D3DDISPLAYMODEFILTER *pFilter, UINT Mode, D3DDISPLAYMODEEX *pMode)
53 | {
54 | return (m_pIDirect3D9Ex->EnumAdapterModesEx( Adapter, pFilter, Mode, pMode));
55 | }
56 |
57 | HRESULT __stdcall uMod_IDirect3D9Ex::GetAdapterDisplayModeEx( UINT Adapter, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation)
58 | {
59 | return (m_pIDirect3D9Ex->GetAdapterDisplayModeEx( Adapter, pMode, pRotation));
60 | }
61 |
62 | HRESULT __stdcall uMod_IDirect3D9Ex::GetAdapterLUID( UINT Adapter, LUID *pLUID)
63 | {
64 | return (m_pIDirect3D9Ex->GetAdapterLUID( Adapter, pLUID));
65 | }
66 |
67 | UINT __stdcall uMod_IDirect3D9Ex::GetAdapterModeCountEx( UINT Adapter, const D3DDISPLAYMODEFILTER *pFilter)
68 | {
69 | return (m_pIDirect3D9Ex->GetAdapterModeCountEx( Adapter, pFilter));
70 | }
71 |
72 |
--------------------------------------------------------------------------------
/uMod_DX9/uMod_IDirect3D9Ex.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 | /*
20 | *
21 | * BIG THANKS TO Michael Koch
22 | * (proxydll_9.zip)
23 | *
24 | */
25 |
26 |
27 | #ifndef uMod_IDirect3D9Ex_H_
28 | #define uMod_IDirect3D9Ex_H_
29 |
30 |
31 | #include
32 | #include
33 | #include "uMod_TextureServer.h"
34 | #include "uMod_TextureClient.h"
35 |
36 | class uMod_IDirect3D9Ex : public IDirect3D9Ex
37 | {
38 | public:
39 | uMod_IDirect3D9Ex( IDirect3D9Ex *pOriginal, uMod_TextureServer *server);
40 | virtual ~uMod_IDirect3D9Ex(void);
41 |
42 | // The original DX9 function definitions
43 | HRESULT __stdcall QueryInterface(REFIID riid, void** ppvObj);
44 | ULONG __stdcall AddRef(void);
45 | ULONG __stdcall Release(void);
46 | HRESULT __stdcall RegisterSoftwareDevice(void* pInitializeFunction);
47 | UINT __stdcall GetAdapterCount(void);
48 | HRESULT __stdcall GetAdapterIdentifier(UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) ;
49 | UINT __stdcall GetAdapterModeCount(UINT Adapter, D3DFORMAT Format);
50 | HRESULT __stdcall EnumAdapterModes(UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) ;
51 | HRESULT __stdcall GetAdapterDisplayMode( UINT Adapter,D3DDISPLAYMODE* pMode) ;
52 | HRESULT __stdcall CheckDeviceType(UINT iAdapter,D3DDEVTYPE DevType,D3DFORMAT DisplayFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) ;
53 | HRESULT __stdcall CheckDeviceFormat(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) ;
54 | HRESULT __stdcall CheckDeviceMultiSampleType(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) ;
55 | HRESULT __stdcall CheckDepthStencilMatch(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) ;
56 | HRESULT __stdcall CheckDeviceFormatConversion(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat);
57 | HRESULT __stdcall GetDeviceCaps(UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) ;
58 | HMONITOR __stdcall GetAdapterMonitor(UINT Adapter) ;
59 | HRESULT __stdcall CreateDevice(UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) ;
60 |
61 | HRESULT __stdcall CreateDeviceEx( UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS *pPresentationParameters, D3DDISPLAYMODEEX *pFullscreenDisplayMode, IDirect3DDevice9Ex **ppReturnedDeviceInterface);
62 | HRESULT __stdcall EnumAdapterModesEx( UINT Adapter, const D3DDISPLAYMODEFILTER *pFilter, UINT Mode, D3DDISPLAYMODEEX *pMode);
63 | HRESULT __stdcall GetAdapterDisplayModeEx( UINT Adapter, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation);
64 | HRESULT __stdcall GetAdapterLUID( UINT Adapter, LUID *pLUID);
65 | UINT __stdcall GetAdapterModeCountEx( UINT Adapter, const D3DDISPLAYMODEFILTER *pFilter);
66 |
67 |
68 | private:
69 | IDirect3D9Ex *m_pIDirect3D9Ex;
70 | uMod_TextureServer* uMod_Server;
71 | };
72 |
73 | #endif
74 |
--------------------------------------------------------------------------------
/uMod_DX9/uMod_IDirect3DCubeTexture9.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 | /*
21 | *
22 | * BIG THANKS TO Matthew L (Azorbix)
23 | * (Direct3D StarterKit v3.0)
24 | *
25 | */
26 |
27 |
28 | #ifndef uMod_IDirect3DCubeTexture9_H
29 | #define uMod_IDirect3DCubeTexture9_H
30 |
31 | #include
32 | #include
33 |
34 | #include "uMod_Defines.h"
35 |
36 |
37 |
38 | interface uMod_IDirect3DCubeTexture9 : public IDirect3DCubeTexture9
39 | {
40 | uMod_IDirect3DCubeTexture9(IDirect3DCubeTexture9 **ppTex, IDirect3DDevice9 *pIDirect3DDevice9)
41 | {
42 | m_D3Dtex = *ppTex; //Texture which will be displayed and will be passed to the game
43 | m_D3Ddev = pIDirect3DDevice9; //device pointer
44 | CrossRef_D3Dtex = NULL; //cross reference
45 | // fake texture: store the pointer to the original uMod_IDirect3DCubeTexture9 object, needed if a fake texture is unselected
46 | // original texture: stores the pointer to the fake texture object, is needed if original texture is deleted,
47 | // thus the fake texture can also be deleted
48 | Reference = -1; //need for fast deleting
49 | Hash = 0u;
50 | FAKE = false;
51 | }
52 |
53 | // callback interface
54 | IDirect3DCubeTexture9 *m_D3Dtex;
55 | uMod_IDirect3DCubeTexture9 *CrossRef_D3Dtex;
56 | IDirect3DDevice9 *m_D3Ddev;
57 | int Reference;
58 | MyTypeHash Hash;
59 | bool FAKE;
60 |
61 | // original interface
62 | STDMETHOD(QueryInterface) (REFIID riid, void** ppvObj);
63 | STDMETHOD_(ULONG,AddRef)();
64 | STDMETHOD_(ULONG,Release)();
65 | STDMETHOD(GetDevice)(IDirect3DDevice9** ppDevice);
66 | STDMETHOD(SetPrivateData)(REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags);
67 | STDMETHOD(GetPrivateData)(REFGUID refguid,void* pData,DWORD* pSizeOfData);
68 | STDMETHOD(FreePrivateData)(REFGUID refguid);
69 | STDMETHOD_(DWORD, SetPriority)(DWORD PriorityNew);
70 | STDMETHOD_(DWORD, GetPriority)();
71 | STDMETHOD_(void, PreLoad)();
72 | STDMETHOD_(D3DRESOURCETYPE, GetType)();
73 | STDMETHOD_(DWORD, SetLOD)(DWORD LODNew);
74 | STDMETHOD_(DWORD, GetLOD)();
75 | STDMETHOD_(DWORD, GetLevelCount)();
76 | STDMETHOD(SetAutoGenFilterType)(D3DTEXTUREFILTERTYPE FilterType);
77 | STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)();
78 | STDMETHOD_(void, GenerateMipSubLevels)();
79 |
80 | STDMETHOD(AddDirtyRect)(D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect);
81 | STDMETHOD(GetLevelDesc)(UINT Level, D3DSURFACE_DESC *pDesc);
82 | STDMETHOD(GetCubeMapSurface)(D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface9 **ppCubeMapSurface);
83 | STDMETHOD(LockRect)( D3DCUBEMAP_FACES FaceType, UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags);
84 | STDMETHOD(UnlockRect)(D3DCUBEMAP_FACES FaceType, UINT Level);
85 |
86 |
87 | int GetHash(MyTypeHash &hash);
88 | };
89 |
90 |
91 |
92 | inline void UnswitchTextures(uMod_IDirect3DCubeTexture9 *pTexture)
93 | {
94 | uMod_IDirect3DCubeTexture9* CrossRef = pTexture->CrossRef_D3Dtex;
95 | if (CrossRef!=NULL)
96 | {
97 | // switch textures back
98 | IDirect3DCubeTexture9* cpy = pTexture->m_D3Dtex;
99 | pTexture->m_D3Dtex = CrossRef->m_D3Dtex;
100 | CrossRef->m_D3Dtex = cpy;
101 |
102 | // cancel the link
103 | CrossRef->CrossRef_D3Dtex = NULL;
104 | pTexture->CrossRef_D3Dtex = NULL;
105 | }
106 | }
107 |
108 | inline int SwitchTextures( uMod_IDirect3DCubeTexture9 *pTexture1, uMod_IDirect3DCubeTexture9 *pTexture2)
109 | {
110 | if (pTexture1->m_D3Ddev == pTexture2->m_D3Ddev && pTexture1->CrossRef_D3Dtex == NULL && pTexture2->CrossRef_D3Dtex == NULL)
111 | {
112 | // make cross reference
113 | pTexture1->CrossRef_D3Dtex = pTexture2;
114 | pTexture2->CrossRef_D3Dtex = pTexture1;
115 |
116 | // switch textures
117 | IDirect3DCubeTexture9* cpy = pTexture2->m_D3Dtex;
118 | pTexture2->m_D3Dtex = pTexture1->m_D3Dtex;
119 | pTexture1->m_D3Dtex = cpy;
120 | return (RETURN_OK);
121 | }
122 | else return (RETURN_TEXTURE_NOT_SWITCHED);
123 | }
124 |
125 |
126 | #endif
127 |
--------------------------------------------------------------------------------
/uMod_DX9/uMod_IDirect3DDevice9Ex.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #include "uMod_Main.h"
22 |
23 | #define uMod_IDirect3DDevice9 uMod_IDirect3DDevice9Ex
24 | #define IDirect3DDevice9 IDirect3DDevice9Ex
25 | #define m_pIDirect3DDevice9 m_pIDirect3DDevice9Ex
26 |
27 | #define RETURN_QueryInterface 0x01000001L
28 | #define PRE_MESSAGE "uMod_IDirect3DDevice9Ex"
29 |
30 |
31 | #include "uMod_IDirect3DDevice9.cpp"
32 |
33 |
34 |
35 | HRESULT __stdcall uMod_IDirect3DDevice9Ex::CheckDeviceState( HWND hWindow)
36 | {
37 | return(m_pIDirect3DDevice9Ex->CheckDeviceState( hWindow));
38 | }
39 |
40 | HRESULT __stdcall uMod_IDirect3DDevice9Ex::CheckResourceResidency( IDirect3DResource9 **ppResourceArray, UINT32 NumResources)
41 | {
42 | return(m_pIDirect3DDevice9Ex->CheckResourceResidency( ppResourceArray, NumResources));
43 | }
44 |
45 | HRESULT __stdcall uMod_IDirect3DDevice9Ex::ComposeRects( IDirect3DSurface9 *pSource, IDirect3DSurface9 *pDestination, IDirect3DVertexBuffer9 *pSrcRectDescriptors, UINT NumRects, IDirect3DVertexBuffer9 *pDstRectDescriptors, D3DCOMPOSERECTSOP Operation, INT XOffset, INT YOffset)
46 | {
47 | return(m_pIDirect3DDevice9Ex->ComposeRects( pSource, pDestination, pSrcRectDescriptors, NumRects, pDstRectDescriptors, Operation, XOffset, YOffset));
48 | }
49 |
50 | HRESULT __stdcall uMod_IDirect3DDevice9Ex::CreateDepthStencilSurfaceEx( UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle, DWORD Usage)
51 | {
52 | return(m_pIDirect3DDevice9Ex->CreateDepthStencilSurfaceEx( Width, Height, Format, MultiSample, MultisampleQuality, Discard, ppSurface, pSharedHandle, Usage));
53 | }
54 |
55 | HRESULT __stdcall uMod_IDirect3DDevice9Ex::CreateOffscreenPlainSurfaceEx( UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle, DWORD Usage)
56 | {
57 | return(m_pIDirect3DDevice9Ex->CreateOffscreenPlainSurfaceEx( Width, Height, Format, Pool, ppSurface, pSharedHandle, Usage));
58 | }
59 |
60 | HRESULT __stdcall uMod_IDirect3DDevice9Ex::CreateRenderTargetEx( UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle, DWORD Usage)
61 | {
62 | return(m_pIDirect3DDevice9Ex->CreateRenderTargetEx( Width, Height, Format, MultiSample, MultisampleQuality, Lockable, ppSurface, pSharedHandle, Usage));
63 | }
64 |
65 | HRESULT __stdcall uMod_IDirect3DDevice9Ex::GetDisplayModeEx( UINT iSwapChain, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation)
66 | {
67 | return(m_pIDirect3DDevice9Ex->GetDisplayModeEx( iSwapChain, pMode, pRotation));
68 | }
69 |
70 | HRESULT __stdcall uMod_IDirect3DDevice9Ex::GetGPUThreadPriority( INT *pPriority)
71 | {
72 | return(m_pIDirect3DDevice9Ex->GetGPUThreadPriority( pPriority));
73 | }
74 |
75 | HRESULT __stdcall uMod_IDirect3DDevice9Ex::GetMaximumFrameLatency( UINT *pMaxLatency)
76 | {
77 | return(m_pIDirect3DDevice9Ex->GetMaximumFrameLatency( pMaxLatency));
78 | }
79 |
80 | HRESULT __stdcall uMod_IDirect3DDevice9Ex::PresentEx( const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion, DWORD dwFlags)
81 | {
82 | return(m_pIDirect3DDevice9Ex->PresentEx( pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags));
83 | }
84 |
85 | HRESULT __stdcall uMod_IDirect3DDevice9Ex::ResetEx( D3DPRESENT_PARAMETERS *pPresentationParameters, D3DDISPLAYMODEEX *pFullscreenDisplayMode)
86 | {
87 | return(m_pIDirect3DDevice9Ex->ResetEx( pPresentationParameters, pFullscreenDisplayMode));
88 | }
89 |
90 | HRESULT __stdcall uMod_IDirect3DDevice9Ex::SetConvolutionMonoKernel( UINT Width, UINT Height, float *RowWeights, float *ColumnWeights)
91 | {
92 | return(m_pIDirect3DDevice9Ex->SetConvolutionMonoKernel( Width, Height, RowWeights, ColumnWeights));
93 | }
94 |
95 | HRESULT __stdcall uMod_IDirect3DDevice9Ex::SetGPUThreadPriority( INT pPriority)
96 | {
97 | return(m_pIDirect3DDevice9Ex->SetGPUThreadPriority( pPriority));
98 | }
99 |
100 | HRESULT __stdcall uMod_IDirect3DDevice9Ex::SetMaximumFrameLatency( UINT pMaxLatency)
101 | {
102 | return(m_pIDirect3DDevice9Ex->SetMaximumFrameLatency( pMaxLatency));
103 | }
104 |
105 | /*
106 | HRESULT __stdcall uMod_IDirect3DDevice9Ex::TestCooperativeLevel()
107 | {
108 | return(m_pIDirect3DDevice9Ex->TestCooperativeLevel());
109 | }
110 | */
111 |
112 | HRESULT __stdcall uMod_IDirect3DDevice9Ex::WaitForVBlank( UINT SwapChainIndex)
113 | {
114 | return(m_pIDirect3DDevice9Ex->WaitForVBlank( SwapChainIndex));
115 | }
116 |
117 |
--------------------------------------------------------------------------------
/uMod_DX9/uMod_IDirect3DTexture9.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 | /*
21 | *
22 | * BIG THANKS TO Matthew L (Azorbix)
23 | * (Direct3D StarterKit v3.0)
24 | *
25 | */
26 |
27 |
28 | #ifndef uMod_IDirect3DTexture9_H
29 | #define uMod_IDirect3DTexture9_H
30 |
31 | #include
32 | #include
33 |
34 | #include "uMod_Defines.h"
35 |
36 |
37 |
38 | interface uMod_IDirect3DTexture9 : public IDirect3DTexture9
39 | {
40 | uMod_IDirect3DTexture9(IDirect3DTexture9 **ppTex, IDirect3DDevice9 *pIDirect3DDevice9)
41 | {
42 | m_D3Dtex = *ppTex; //Texture which will be displayed and will be passed to the game
43 | m_D3Ddev = pIDirect3DDevice9; //device pointer
44 | CrossRef_D3Dtex = NULL; //cross reference
45 | // fake texture: store the pointer to the original uMod_IDirect3DTexture9 object, needed if a fake texture is unselected
46 | // original texture: stores the pointer to the fake texture object, is needed if original texture is deleted,
47 | // thus the fake texture can also be deleted
48 | Reference = -1; //need for fast deleting
49 | Hash = 0u;
50 | FAKE = false;
51 | }
52 |
53 | // callback interface
54 | IDirect3DTexture9 *m_D3Dtex;
55 | uMod_IDirect3DTexture9 *CrossRef_D3Dtex;
56 | IDirect3DDevice9 *m_D3Ddev;
57 | int Reference;
58 | MyTypeHash Hash;
59 | bool FAKE;
60 |
61 | // original interface
62 | STDMETHOD(QueryInterface) (REFIID riid, void** ppvObj);
63 | STDMETHOD_(ULONG,AddRef)();
64 | STDMETHOD_(ULONG,Release)();
65 | STDMETHOD(GetDevice)(IDirect3DDevice9** ppDevice);
66 | STDMETHOD(SetPrivateData)(REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags);
67 | STDMETHOD(GetPrivateData)(REFGUID refguid,void* pData,DWORD* pSizeOfData);
68 | STDMETHOD(FreePrivateData)(REFGUID refguid);
69 | STDMETHOD_(DWORD, SetPriority)(DWORD PriorityNew);
70 | STDMETHOD_(DWORD, GetPriority)();
71 | STDMETHOD_(void, PreLoad)();
72 | STDMETHOD_(D3DRESOURCETYPE, GetType)();
73 | STDMETHOD_(DWORD, SetLOD)(DWORD LODNew);
74 | STDMETHOD_(DWORD, GetLOD)();
75 | STDMETHOD_(DWORD, GetLevelCount)();
76 | STDMETHOD(SetAutoGenFilterType)(D3DTEXTUREFILTERTYPE FilterType);
77 | STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)();
78 | STDMETHOD_(void, GenerateMipSubLevels)();
79 | STDMETHOD(GetLevelDesc)(UINT Level,D3DSURFACE_DESC *pDesc);
80 | STDMETHOD(GetSurfaceLevel)(UINT Level,IDirect3DSurface9** ppSurfaceLevel);
81 | STDMETHOD(LockRect)(UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags);
82 | STDMETHOD(UnlockRect)(UINT Level);
83 | STDMETHOD(AddDirtyRect)(CONST RECT* pDirtyRect);
84 |
85 | int GetHash(MyTypeHash &hash);
86 | };
87 |
88 |
89 |
90 | inline void UnswitchTextures(uMod_IDirect3DTexture9 *pTexture)
91 | {
92 | uMod_IDirect3DTexture9* CrossRef = pTexture->CrossRef_D3Dtex;
93 | if (CrossRef!=NULL)
94 | {
95 | // switch textures back
96 | IDirect3DTexture9* cpy = pTexture->m_D3Dtex;
97 | pTexture->m_D3Dtex = CrossRef->m_D3Dtex;
98 | CrossRef->m_D3Dtex = cpy;
99 |
100 | // cancel the link
101 | CrossRef->CrossRef_D3Dtex = NULL;
102 | pTexture->CrossRef_D3Dtex = NULL;
103 | }
104 | }
105 |
106 | inline int SwitchTextures( uMod_IDirect3DTexture9 *pTexture1, uMod_IDirect3DTexture9 *pTexture2)
107 | {
108 | if (pTexture1->m_D3Ddev == pTexture2->m_D3Ddev && pTexture1->CrossRef_D3Dtex == NULL && pTexture2->CrossRef_D3Dtex == NULL)
109 | {
110 | // make cross reference
111 | pTexture1->CrossRef_D3Dtex = pTexture2;
112 | pTexture2->CrossRef_D3Dtex = pTexture1;
113 |
114 | // switch textures
115 | IDirect3DTexture9* cpy = pTexture2->m_D3Dtex;
116 | pTexture2->m_D3Dtex = pTexture1->m_D3Dtex;
117 | pTexture1->m_D3Dtex = cpy;
118 | return (RETURN_OK);
119 | }
120 | else return (RETURN_TEXTURE_NOT_SWITCHED);
121 | }
122 |
123 |
124 | #endif
125 |
--------------------------------------------------------------------------------
/uMod_DX9/uMod_IDirect3DVolumeTexture9.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 | /*
21 | *
22 | * BIG THANKS TO Matthew L (Azorbix)
23 | * (Direct3D StarterKit v3.0)
24 | *
25 | */
26 |
27 |
28 | #ifndef uMod_IDirect3DVolumeTexture9_H
29 | #define uMod_IDirect3DVolumeTexture9_H
30 |
31 | #include
32 | #include
33 |
34 | #include "uMod_Defines.h"
35 |
36 |
37 |
38 | interface uMod_IDirect3DVolumeTexture9 : public IDirect3DVolumeTexture9
39 | {
40 | uMod_IDirect3DVolumeTexture9(IDirect3DVolumeTexture9 **ppTex, IDirect3DDevice9 *pIDirect3DDevice9)
41 | {
42 | m_D3Dtex = *ppTex; //Texture which will be displayed and will be passed to the game
43 | m_D3Ddev = pIDirect3DDevice9; //device pointer
44 | CrossRef_D3Dtex = NULL; //cross reference
45 | // fake texture: store the pointer to the original uMod_IDirect3DVolumeTexture9 object, needed if a fake texture is unselected
46 | // original texture: stores the pointer to the fake texture object, is needed if original texture is deleted,
47 | // thus the fake texture can also be deleted
48 | Reference = -1; //need for fast deleting
49 | Hash = 0u;
50 | FAKE = false;
51 | }
52 |
53 | // callback interface
54 | IDirect3DVolumeTexture9 *m_D3Dtex;
55 | uMod_IDirect3DVolumeTexture9 *CrossRef_D3Dtex;
56 | IDirect3DDevice9 *m_D3Ddev;
57 | int Reference;
58 | MyTypeHash Hash;
59 | bool FAKE;
60 |
61 | // original interface
62 | STDMETHOD(QueryInterface) (REFIID riid, void** ppvObj);
63 | STDMETHOD_(ULONG,AddRef)();
64 | STDMETHOD_(ULONG,Release)();
65 | STDMETHOD(GetDevice)(IDirect3DDevice9** ppDevice);
66 | STDMETHOD(SetPrivateData)(REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags);
67 | STDMETHOD(GetPrivateData)(REFGUID refguid,void* pData,DWORD* pSizeOfData);
68 | STDMETHOD(FreePrivateData)(REFGUID refguid);
69 | STDMETHOD_(DWORD, SetPriority)(DWORD PriorityNew);
70 | STDMETHOD_(DWORD, GetPriority)();
71 | STDMETHOD_(void, PreLoad)();
72 | STDMETHOD_(D3DRESOURCETYPE, GetType)();
73 | STDMETHOD_(DWORD, SetLOD)(DWORD LODNew);
74 | STDMETHOD_(DWORD, GetLOD)();
75 | STDMETHOD_(DWORD, GetLevelCount)();
76 | STDMETHOD(SetAutoGenFilterType)(D3DTEXTUREFILTERTYPE FilterType);
77 | STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)();
78 | STDMETHOD_(void, GenerateMipSubLevels)();
79 | STDMETHOD(AddDirtyBox)(CONST D3DBOX *pDirtyBox);
80 | STDMETHOD(GetLevelDesc)(UINT Level, D3DVOLUME_DESC *pDesc);
81 | STDMETHOD(GetVolumeLevel)(UINT Level, IDirect3DVolume9 **ppVolumeLevel);
82 | STDMETHOD(LockBox)(UINT Level, D3DLOCKED_BOX *pLockedVolume, CONST D3DBOX *pBox, DWORD Flags);
83 | STDMETHOD(UnlockBox)(UINT Level);
84 |
85 |
86 | int GetHash(MyTypeHash &hash);
87 | };
88 |
89 |
90 |
91 | inline void UnswitchTextures(uMod_IDirect3DVolumeTexture9 *pTexture)
92 | {
93 | uMod_IDirect3DVolumeTexture9* CrossRef = pTexture->CrossRef_D3Dtex;
94 | if (CrossRef!=NULL)
95 | {
96 | // switch textures back
97 | IDirect3DVolumeTexture9* cpy = pTexture->m_D3Dtex;
98 | pTexture->m_D3Dtex = CrossRef->m_D3Dtex;
99 | CrossRef->m_D3Dtex = cpy;
100 |
101 | // cancel the link
102 | CrossRef->CrossRef_D3Dtex = NULL;
103 | pTexture->CrossRef_D3Dtex = NULL;
104 | }
105 | }
106 |
107 | inline int SwitchTextures( uMod_IDirect3DVolumeTexture9 *pTexture1, uMod_IDirect3DVolumeTexture9 *pTexture2)
108 | {
109 | if (pTexture1->m_D3Ddev == pTexture2->m_D3Ddev && pTexture1->CrossRef_D3Dtex == NULL && pTexture2->CrossRef_D3Dtex == NULL)
110 | {
111 | // make cross reference
112 | pTexture1->CrossRef_D3Dtex = pTexture2;
113 | pTexture2->CrossRef_D3Dtex = pTexture1;
114 |
115 | // switch textures
116 | IDirect3DVolumeTexture9* cpy = pTexture2->m_D3Dtex;
117 | pTexture2->m_D3Dtex = pTexture1->m_D3Dtex;
118 | pTexture1->m_D3Dtex = cpy;
119 | return (RETURN_OK);
120 | }
121 | else return (RETURN_TEXTURE_NOT_SWITCHED);
122 | }
123 |
124 |
125 | #endif
126 |
--------------------------------------------------------------------------------
/uMod_DX9/uMod_Main.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #ifndef uMod_MAIN_H_
22 | #define uMod_MAIN_H_
23 |
24 | #define WINVER _WIN32_WINNT_WINXP
25 | #define _WIN32_WINNT _WIN32_WINNT_WINXP
26 | #define _WIN32_WINDOWS _WIN32_WINNT_WINXP
27 | #define NTDDI_VERSION NTDDI_WINXP
28 | //#define NTDDI_LONGHORN NTDDI_WINXP
29 | #define WIN32_LEAN_AND_MEAN
30 |
31 |
32 | #include
33 |
34 | #include
35 | #include
36 |
37 | #include
38 | #include
39 |
40 |
41 |
42 |
43 | #include "../uMod_GlobalDefines.h"
44 | #include "../uMod_Error.h"
45 | #include "uMod_Defines.h"
46 | #include "uMod_DX9_dll.h"
47 | #include "uMod_TextureFunction.h"
48 |
49 | #include "uMod_IDirect3D9.h"
50 | #include "uMod_IDirect3D9Ex.h"
51 |
52 | #include "uMod_IDirect3DDevice9.h"
53 | #include "uMod_IDirect3DDevice9Ex.h"
54 |
55 | #include "uMod_IDirect3DCubeTexture9.h"
56 | #include "uMod_IDirect3DTexture9.h"
57 | #include "uMod_IDirect3DVolumeTexture9.h"
58 |
59 | #include "uMod_ArrayHandler.h"
60 | #include "uMod_TextureServer.h"
61 | #include "uMod_TextureClient.h"
62 |
63 |
64 | extern unsigned int gl_ErrorState;
65 |
66 | #endif
67 |
--------------------------------------------------------------------------------
/uMod_DX9/uMod_TextureClient.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #ifndef uMod_TEXTUREHANDLER_HPP
22 | #define uMod_TEXTUREHANDLER_HPP
23 |
24 | #include "uMod_IDirect3DTexture9.h"
25 | #include "uMod_IDirect3DDevice9.h"
26 | #include "..\uMod_Error.h"
27 |
28 |
29 | class uMod_TextureServer;
30 |
31 | /*
32 | * An object of this class is owned by each d3d9 device.
33 | * functions called by the Server are called from the server thread instance.
34 | * All other functions are called from the render thread instance of the game itself.
35 | */
36 |
37 | class uMod_TextureClient
38 | {
39 | public:
40 | uMod_TextureClient(uMod_TextureServer* server, IDirect3DDevice9* device);
41 | ~uMod_TextureClient(void);
42 |
43 | int AddTexture( uMod_IDirect3DTexture9* tex); //called from uMod_IDirect3DDevice9::CreateTexture(...) or uMod_IDirect3DDevice9::BeginScene()
44 | int AddTexture( uMod_IDirect3DVolumeTexture9* tex); //called from uMod_IDirect3DVolumeTexture9::CreateTexture(...) or uMod_IDirect3DDevice9::BeginScene()
45 | int AddTexture( uMod_IDirect3DCubeTexture9* tex); //called from uMod_IDirect3DCubeTexture9::CreateTexture(...) or uMod_IDirect3DDevice9::BeginScene()
46 |
47 | int RemoveTexture( uMod_IDirect3DTexture9* tex); //called from uMod_IDirect3DTexture9::Release()
48 | int RemoveTexture( uMod_IDirect3DVolumeTexture9* tex); //called from uMod_IDirect3DVolumeTexture9::Release()
49 | int RemoveTexture( uMod_IDirect3DCubeTexture9* tex); //called from uMod_IDirect3DCubeTexture9::Release()
50 |
51 | int SaveAllTextures(bool val); //called from the Server
52 | int SaveSingleTexture(bool val); //called from the Server
53 |
54 | int SetSaveDirectory( wchar_t *dir); //called from the Server
55 | int SetGameName( wchar_t *dir); //called from the Server
56 |
57 | int SaveTexture(uMod_IDirect3DTexture9* pTexture); //called from uMod_IDirect3DDevice9::BeginScene() (save button) or from AddTexture(...) (SaveAllTextures)
58 | int SaveTexture(uMod_IDirect3DVolumeTexture9* pTexture); //called from uMod_IDirect3DDevice9::BeginScene() (save button) or from AddTexture(...) (SaveAllTextures)
59 | int SaveTexture(uMod_IDirect3DCubeTexture9* pTexture); //called from uMod_IDirect3DDevice9::BeginScene() (save button) or from AddTexture(...) (SaveAllTextures)
60 |
61 |
62 |
63 | int SetKeyBack( int key) {if (key>0) KeyBack = key; return (RETURN_OK);} //called from the Server
64 | int SetKeySave( int key) {if (key>0) KeySave = key; return (RETURN_OK);} //called from the Server
65 | int SetKeyNext( int key) {if (key>0) KeyNext = key; return (RETURN_OK);} //called from the Server
66 |
67 | int SetFontColour( DWORD r, DWORD g, DWORD b) {FontColour = D3DCOLOR_ARGB(255, r,g,b); return (RETURN_OK);} //called from the Server
68 | int SetTextureColour( DWORD r, DWORD g, DWORD b) {TextureColour = D3DCOLOR_ARGB(255, r,g,b); return (RETURN_OK);} //called from the Server
69 |
70 |
71 | int AddUpdate(TextureFileStruct* update, int number); //called from the Server, client object must delete update array
72 | int MergeUpdate(void); //called from uMod_IDirect3DDevice9::BeginScene()
73 |
74 | int LookUpToMod( uMod_IDirect3DTexture9* pTexture, int num_index_list=0, int *index_list=NULL); // called at the end AddTexture(...) and from Device->UpdateTexture(...)
75 | int LookUpToMod( uMod_IDirect3DVolumeTexture9* pTexture, int num_index_list=0, int *index_list=NULL); // called at the end AddTexture(...) and from Device->UpdateTexture(...)
76 | int LookUpToMod( uMod_IDirect3DCubeTexture9* pTexture, int num_index_list=0, int *index_list=NULL); // called at the end AddTexture(...) and from Device->UpdateTexture(...)
77 |
78 | uMod_TextureHandler OriginalTextures; // stores the pointer to the uMod_IDirect3DTexture9 objects created by the game
79 | uMod_TextureHandler OriginalVolumeTextures; // stores the pointer to the uMod_IDirect3DVolumeTexture9 objects created by the game
80 | uMod_TextureHandler OriginalCubeTextures; // stores the pointer to the uMod_IDirect3DCubeTexture9 objects created by the game
81 |
82 | bool BoolSaveAllTextures;
83 | bool BoolSaveSingleTexture;
84 | int KeyBack;
85 | int KeySave;
86 | int KeyNext;
87 |
88 | D3DCOLOR FontColour;
89 | D3DCOLOR TextureColour;
90 |
91 | private:
92 | uMod_TextureServer* Server;
93 | IDirect3DDevice9* D3D9Device;
94 | wchar_t SavePath[MAX_PATH];
95 | wchar_t GameName[MAX_PATH];
96 |
97 | TextureFileStruct* Update;
98 | int NumberOfUpdate;
99 |
100 | int LockMutex();
101 | int UnlockMutex();
102 | HANDLE Mutex;
103 |
104 | int NumberToMod; // number of texture to be modded
105 | TextureFileStruct* FileToMod; // array which stores the file in memory and the hash of each texture to be modded
106 |
107 |
108 | int LookUpToMod( MyTypeHash hash, int num_index_list, int *index_list); // called from LookUpToMod(...);
109 | int LoadTexture( TextureFileStruct* file_in_memory, uMod_IDirect3DTexture9 **ppTexture); // called if a target texture is found
110 | int LoadTexture( TextureFileStruct* file_in_memory, uMod_IDirect3DVolumeTexture9 **ppTexture); // called if a target texture is found
111 | int LoadTexture( TextureFileStruct* file_in_memory, uMod_IDirect3DCubeTexture9 **ppTexture); // called if a target texture is found
112 |
113 | // and the corresponding fake texture should be loaded
114 |
115 | //MyTypeHash GetHash(unsigned char *str, int len);
116 | //unsigned int GetCRC32(char *pcDatabuf, unsigned int ulDatalen);
117 | };
118 |
119 |
120 |
121 | #endif /* uMod_TEXTUREHANDLER_HPP_ */
122 |
--------------------------------------------------------------------------------
/uMod_DX9/uMod_TextureFunction.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 | #include "uMod_Main.h"
21 |
22 | /*
23 | MyTypeHash GetHash(unsigned char *str, int len) // estimate the hash
24 | {
25 | MyTypeHash hash = 0;
26 | for (int i=0; i>=1)
56 | {
57 | crc = (crc >> 1) ^ (((crc ^ data) & 1) ? CRC32POLY : 0);
58 | }
59 | }
60 | return (crc);
61 | }
62 |
63 |
--------------------------------------------------------------------------------
/uMod_DX9/uMod_TextureFunction.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 | #ifndef uMod_TEXTUREFUNCTION_H_
19 | #define uMod_TEXTUREFUNCTION_H_
20 |
21 |
22 | unsigned int GetCRC32( char *pcDatabuf, unsigned int ulDatalen);
23 | /*
24 | case D3DFMT_MULTI2_ARGB8:
25 | case D3DFMT_VERTEXDATA:
26 | */
27 | inline int GetBitsFromFormat(D3DFORMAT format)
28 | {
29 | switch(format) //switch trough the formats to calculate the size of the raw data
30 | {
31 | case D3DFMT_A1: // 1-bit monochrome.
32 | {
33 | return (1);
34 | break;
35 | }
36 |
37 | case D3DFMT_R3G3B2: // 8-bit RGB texture format using 3 bits for red, 3 bits for green, and 2 bits for blue.
38 | case D3DFMT_A8: // 8-bit alpha only.
39 | case D3DFMT_A8P8: // 8-bit color indexed with 8 bits of alpha.
40 | case D3DFMT_P8: // 8-bit color indexed.
41 | case D3DFMT_L8: // 8-bit luminance only.
42 | case D3DFMT_A4L4: // 8-bit using 4 bits each for alpha and luminance.
43 | case D3DFMT_FORCE_DWORD:
44 | case D3DFMT_S8_LOCKABLE: // A lockable 8-bit stencil buffer.
45 | {
46 | return (8);
47 | break;
48 | }
49 |
50 | case D3DFMT_D16_LOCKABLE: //16-bit z-buffer bit depth.
51 | case 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.
52 | case D3DFMT_L6V5U5: // 16-bit bump-map format with luminance using 6 bits for luminance, and 5 bits each for v and u.
53 | case D3DFMT_V8U8: // 16-bit bump-map format using 8 bits each for u and v data.
54 | case D3DFMT_CxV8U8: // 16-bit normal compression format. The texture sampler computes the C channel from: C = sqrt(1 - U2 - V2).
55 | case D3DFMT_R5G6B5: // 16-bit RGB pixel format with 5 bits for red, 6 bits for green, and 5 bits for blue.
56 | case D3DFMT_X1R5G5B5: // 16-bit pixel format where 5 bits are reserved for each color.
57 | case D3DFMT_A1R5G5B5: // 16-bit pixel format where 5 bits are reserved for each color and 1 bit is reserved for alpha.
58 | case D3DFMT_A4R4G4B4: // 16-bit ARGB pixel format with 4 bits for each channel.
59 | case D3DFMT_A8R3G3B2: // 16-bit ARGB texture format using 8 bits for alpha, 3 bits each for red and green, and 2 bits for blue.
60 | case D3DFMT_X4R4G4B4: // 16-bit RGB pixel format using 4 bits for each color.
61 | case D3DFMT_L16: // 16-bit luminance only.
62 | case D3DFMT_R16F: // 16-bit float format using 16 bits for the red channel.
63 | case D3DFMT_A8L8: // 16-bit using 8 bits each for alpha and luminance.
64 | case D3DFMT_D16: // 16-bit z-buffer bit depth.
65 | case D3DFMT_INDEX16: // 16-bit index buffer bit depth.
66 | case D3DFMT_G8R8_G8B8: // ??
67 | case D3DFMT_R8G8_B8G8: // ??
68 | case D3DFMT_UYVY: // ??
69 | case D3DFMT_YUY2: // ??
70 | {
71 | return (16);
72 | break;
73 | }
74 |
75 |
76 | case D3DFMT_R8G8B8: //24-bit RGB pixel format with 8 bits per channel.
77 | {
78 | return (24);
79 | break;
80 | }
81 |
82 | case D3DFMT_R32F: // 32-bit float format using 32 bits for the red channel.
83 | case D3DFMT_X8L8V8U8: // 32-bit bump-map format with luminance using 8 bits for each channel.
84 | case D3DFMT_A2W10V10U10: // 32-bit bump-map format using 2 bits for alpha and 10 bits each for w, v, and u.
85 | case D3DFMT_Q8W8V8U8: // 32-bit bump-map format using 8 bits for each channel.
86 | case D3DFMT_V16U16: // 32-bit bump-map format using 16 bits for each channel.
87 | case D3DFMT_A8R8G8B8: // 32-bit ARGB pixel format with alpha, using 8 bits per channel.
88 | case D3DFMT_X8R8G8B8: // 32-bit RGB pixel format, where 8 bits are reserved for each color.
89 | case D3DFMT_A2B10G10R10: // 32-bit pixel format using 10 bits for each color and 2 bits for alpha.
90 | case D3DFMT_A8B8G8R8: // 32-bit ARGB pixel format with alpha, using 8 bits per channel.
91 | case D3DFMT_X8B8G8R8: // 32-bit RGB pixel format, where 8 bits are reserved for each color.
92 | case D3DFMT_G16R16: // 32-bit pixel format using 16 bits each for green and red.
93 | case D3DFMT_G16R16F: // 32-bit float format using 16 bits for the red channel and 16 bits for the green channel.
94 | case D3DFMT_A2R10G10B10: // 32-bit pixel format using 10 bits each for red, green, and blue, and 2 bits for alpha.
95 | case D3DFMT_D32: // 32-bit z-buffer bit depth.
96 | case D3DFMT_D24S8: // 32-bit z-buffer bit depth using 24 bits for the depth channel and 8 bits for the stencil channel.
97 | case D3DFMT_D24X8: //32-bit z-buffer bit depth using 24 bits for the depth channel.
98 | case D3DFMT_D24X4S4: // 32-bit z-buffer bit depth using 24 bits for the depth channel and 4 bits for the stencil channel.
99 | case D3DFMT_D32F_LOCKABLE: // A lockable format where the depth value is represented as a standard IEEE floating-point number.
100 | case 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.
101 | case D3DFMT_D32_LOCKABLE: // A lockable 32-bit depth buffer.
102 | case D3DFMT_INDEX32: // 32-bit index buffer bit depth.
103 | //case : //
104 | //case : //
105 | //case : //
106 | //case : //
107 | {
108 | return (32);
109 | break;
110 | }
111 |
112 | case D3DFMT_G32R32F: // 64-bit float format using 32 bits for the red channel and 32 bits for the green channel.
113 | case D3DFMT_Q16W16V16U16: // 64-bit bump-map format using 16 bits for each component.
114 | case D3DFMT_A16B16G16R16: // 64-bit pixel format using 16 bits for each component.
115 | case D3DFMT_A16B16G16R16F: // 64-bit float format using 16 bits for the each channel (alpha, blue, green, red).
116 | {
117 | return (64);
118 | break;
119 | }
120 |
121 | case D3DFMT_A32B32G32R32F: // 128-bit float format using 32 bits for the each channel (alpha, blue, green, red).
122 | {
123 | return (128);
124 | break;
125 | }
126 | case D3DFMT_DXT2:
127 | case D3DFMT_DXT3:
128 | case D3DFMT_DXT4:
129 | case D3DFMT_DXT5:
130 | {
131 | return (8);
132 | break;
133 | }
134 | case D3DFMT_DXT1:
135 | {
136 | return (4);
137 | break;
138 | }
139 | default: //compressed formats
140 | {
141 | return (4);
142 | break;
143 | }
144 | }
145 | }
146 |
147 | #endif /* uMod_TEXTUREFUNCTION_H_ */
148 |
--------------------------------------------------------------------------------
/uMod_DX9/uMod_TextureServer.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 | #ifndef uMod_TEXTURESERVER_H_
21 | #define uMod_TEXTURESERVER_H_
22 |
23 | #include "../uMod_GlobalDefines.h"
24 | #include "uMod_ArrayHandler.h"
25 |
26 |
27 | /*
28 | * An object of this class is created only once.
29 | * The Mainloop functions is executed by a server thread,
30 | * which listen on a pipe.
31 | *
32 | * Functions called by the Client are called from the a thread instance of the game itself.
33 | * Nearly all other functions are called from the server thread instance.
34 | */
35 |
36 |
37 | class uMod_TextureClient;
38 |
39 | class uMod_TextureServer
40 | {
41 | public:
42 | uMod_TextureServer(wchar_t *name);
43 | ~uMod_TextureServer(void);
44 |
45 | int AddClient(uMod_TextureClient *client, TextureFileStruct** update, int* number); // called from a Client
46 | int RemoveClient(uMod_TextureClient *client); // called from a Client
47 |
48 | int OpenPipe(wchar_t *name); // called on initialization of our d3d9 fake dll
49 | int ClosePipe(void); // called on exit of our d3d9 fake dll
50 | int MainLoop(void); // is executed in a server thread
51 |
52 |
53 | // following functions are only public for testing purpose !!
54 | // they should be private and only be called from the Mainloop
55 |
56 | int AddFile( char* buffer, unsigned int size, MyTypeHash hash, bool force); // called from Mainloop(), if the content of the texture is sent
57 | int AddFile( wchar_t* file_name, MyTypeHash hash, bool force); // called from Mainloop(), if the name and the path to the file is sent
58 | int RemoveFile( MyTypeHash hash); // called from Mainloop()
59 |
60 | int SaveAllTextures(bool val); // called from Mainloop()
61 | int SaveSingleTexture(bool val); // called from Mainloop()
62 |
63 | int SetSaveDirectory( wchar_t *dir); // called from Mainloop()
64 |
65 |
66 | int SetKeyBack( int key); // called from Mainloop()
67 | int SetKeySave( int key); // called from Mainloop()
68 | int SetKeyNext( int key); // called from Mainloop()
69 |
70 | int SetFontColour(DWORD colour); // called from Mainloop()
71 | int SetTextureColour(DWORD colour); // called from Mainloop()
72 |
73 | private:
74 | bool BoolSaveAllTextures;
75 | bool BoolSaveSingleTexture;
76 | wchar_t SavePath[MAX_PATH];
77 | wchar_t GameName[MAX_PATH];
78 |
79 | int PropagateUpdate(uMod_TextureClient* client=NULL); // called from Mainloop() if texture are loaded or removed
80 | int PrepareUpdate(TextureFileStruct** update, int* number); // called from PropagateUpdate() and AddClient()
81 | // generate a copy of the current texture to be modded
82 | // the file content of the textures are not copied, the clients get the pointer to the file content
83 | // but the arrays allocate by this function, must be deleted by the client
84 |
85 | int LockMutex();
86 | int UnlockMutex();
87 | HANDLE Mutex;
88 |
89 |
90 | int KeyBack;
91 | int KeySave;
92 | int KeyNext;
93 |
94 | DWORD FontColour;
95 | DWORD TextureColour;
96 |
97 |
98 | PipeStruct Pipe;
99 |
100 | uMod_TextureClient** Clients;
101 | int NumberOfClients;
102 | int LenghtOfClients;
103 |
104 | uMod_FileHandler CurrentMod; // hold the file content of texture
105 | uMod_FileHandler OldMod; // hold the file content of texture which were added previously but are not needed any more
106 | // this is needed, because a texture clients might not have merged the last update and thus hold pointers to the file content of old textures
107 | };
108 |
109 |
110 | #endif /* uMod_TEXTURESERVER_H_ */
111 |
--------------------------------------------------------------------------------
/uMod_Error.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 | #ifndef uMod_ERROR_H_
21 | #define uMod_ERROR_H_
22 |
23 |
24 | // define return values, a value less than zero indicates an error
25 | #define RETURN_OK 0
26 |
27 | #define RETURN_FATAL_ERROR -1
28 | #define RETURN_NO_MEMORY -2
29 | #define RETURN_BAD_ARGUMENT -3
30 |
31 | #define RETURN_NO_IDirect3DDevice9 -10
32 |
33 | #define RETURN_TEXTURE_NOT_LOADED -20
34 | #define RETURN_TEXTURE_NOT_SAVED -21
35 | #define RETURN_TEXTURE_NOT_FOUND -22
36 | #define RETURN_TEXTURE_ALLREADY_ADDED -23
37 | #define RETURN_TEXTURE_NOT_SWITCHED -24
38 |
39 | #define RETURN_LockRect_FAILED -30
40 | #define RETURN_UnlockRect_FAILED -31
41 | #define RETURN_GetLevelDesc_FAILED -32
42 |
43 |
44 | #define RETURN_NO_MUTEX -40
45 | #define RETURN_MUTEX_LOCK -41
46 | #define RETURN_MUTEX_UNLOCK -42
47 |
48 | #define RETURN_UPDATE_ALLREADY_ADDED -50
49 | #define RETURN_FILE_NOT_LOADED -51
50 |
51 | #define RETURN_PIPE_NOT_OPENED 60
52 |
53 |
54 |
55 |
56 |
57 | // define error states
58 | #define uMod_ERROR_FATAL 1u
59 | #define uMod_ERROR_MUTEX 1u<<1
60 | #define uMod_ERROR_PIPE 1u<<2
61 | #define uMod_ERROR_MEMORY 1u<<3
62 | #define uMod_ERROR_TEXTURE 1u<<4
63 | #define uMod_ERROR_MULTIPLE_IDirect3D9 1u<<5
64 | #define uMod_ERROR_MULTIPLE_IDirect3DDevice9 1u<<6
65 | #define uMod_ERROR_UPDATE 1u<<7
66 | #define uMod_ERROR_SERVER 1u<<8
67 |
68 |
69 |
70 |
71 |
72 |
73 | #endif /* uMod_ERROR_H_ */
74 |
--------------------------------------------------------------------------------
/uMod_GUI/bin/README_Deutsch.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/build-wars/texmod/0b53db48814fa46eebd896768203a12ba9c51ca8/uMod_GUI/bin/README_Deutsch.txt
--------------------------------------------------------------------------------
/uMod_GUI/bin/README_English.txt:
--------------------------------------------------------------------------------
1 | WARNING: You use this program at your own risk!
2 | 1) If the program crash, you won't get probably any support from the game developer,
3 | but you can report the bug under http://code.google.com/p/texmod/issues/list
4 | 2) Games can detected if they are modified, so you might risk a ban
5 | of your online account!
6 | 3) This is an open-source project. The code can be retrieved, modified and compiled
7 | by everyone. Download Universal Modding Engine only from sources you trust!
8 | Download it by your self and don't use versions, send to you by team or guild members!
9 | http://code.google.com/p/texmod/downloads/list
10 |
11 | Universal Modding Engine uses the D3DX9_43.dll (32bit). Due to the EULA this dll
12 | cannot be delivered together with Universal Modding Engine . If D3DX9_43.dll is not
13 | installed on your system, Universal Modding Engine will give you a hint at program start.
14 |
15 |
16 | What can Universal Modding Engine (uMod) V1.0?
17 |
18 | -extract and save single textures from a DX9 game (the target texture can be toggled in the game)
19 | -extract and save all textures from a DX9 game
20 | -load textures into a game to replace target textures
21 | -support single dds texture
22 | -support zip-files as whole mod package
23 | -support the original TexMod *.tpf files
24 |
25 | All these options can be switched on or off, while the game is already running!
26 | So you can search for a texture in the game, save it to disk, edit it,
27 | load it into the game, edit it again and load it into the game again, ...,
28 | actiavate or deactivate mods and all without a restart of the game.
29 |
30 | side note: If "save all textures" is switched on, the texture will only be saved, if
31 | the textures are loaded by the game and only in the moment they are loaded.
32 | If you switch this option on, while a map is loaded, probably nothing will hapen,
33 | because all textures are loaded for this map. Change the Map or reload it again.
34 |
35 | Zip files can include a "texmod.def" file which contains the hash and the file name.
36 | Each line should be in the format "hash|filename.dds"
37 | If it does not contain a "texmod.def" each file will be unpacked and those which match
38 | the wildcard "*_hash.dds" will be used.
39 | The zip file can include a "Comment.txt" file. The content will be shown as comment
40 | in the GUI.
41 |
42 | If you load single files, they should match the wildcard "*_hash.dds"
43 |
44 |
45 | How does Universal Modding Engine interact with the game?
46 |
47 | Universal Modding Engine intercept the connection between the game and DirectX.
48 | It is required, that Universal Modding Engine is running before the game is started.
49 |
50 | The GUI of Universal Modding Engine act as a server. A game which is successfully
51 | intercepted with the Universal Modding Engine-dll will connect on program start to the server.
52 | The GUI of Universal Modding Engine can handle multiple games at the same time. It will
53 | also process each instance of a game as separate process (if the same game
54 | was started more than once).
55 |
56 |
57 | How to get Universal Modding Engine work?
58 |
59 | There are three ways how Universal Modding Engine can intercept the DirectX connection:
60 | (Do NOT use more than one method simultaneously!)
61 |
62 | 1) Add the games-binary through the menu "Main->Add game"
63 | For Steam see below.
64 |
65 | known problems: Guild Wars (Win XP)
66 |
67 | 2) Start the game directly through uMod though the menu
68 | "Main->Start game through uMod" or
69 | "Main->Start game through uMod (with command line)".
70 | The game start immediately.
71 |
72 | 3) Copy the d3d9.dll (from the Universal Modding Engine directory) into the game directory.
73 | Some games load a dll first from their own directory before they look up the system directory.
74 | Only for these games this method will work.
75 | WARNING: never copy this dll into your system directory!!
76 |
77 | known problems: Guild Wars
78 |
79 | If you have chosen the first or third method, you simply start Universal Modding Engine
80 | and afterwards the game. Do NOT start the game through Universal Modding Engine.
81 |
82 | If the game starts and all works fine, a new tab opens immediately in uMod.
83 | In this tab you can now mod the game. Press the "update" button to commit
84 | the changes to the game. You can also save your current settings as a template.
85 | One template can be set as default for a game, which will be loaded and
86 | and committed automatically when you start this game the next time.
87 |
88 | To load a mod, you must set the check mark of the file. If you wish to unload a mod,
89 | just remove the check mark and click on update again.
90 |
91 | Clicking on update will only update the differences (if packages have been
92 | removed from the list, you toggled check marks or changed the order). The reload
93 | button forces to reload from disk (if you have edited the texture itself).
94 |
95 | Due to the fact that different mods can modify the same target texture, only the
96 | mod-texture of the first file in the list is taken into account. The action of this file
97 | (load or unload) is proceeded regardless of what the following mods are opposed
98 | to do with their mod-textures.
99 |
100 |
101 | How to get Universal Modding Engine work together with Steam?
102 |
103 | Universal Modding Engine looks for the name and the path of the executed binary.
104 | Thus you shall not add the steam.exe but rather the game.exe
105 | e.g.: C:\Steam\SteamApps\acoount_name\portal\hl2.exe
106 | If you cannot find the exe, just start the game and use the TaskManager
107 | to search for it. You can figure out the path through right click->properties.
--------------------------------------------------------------------------------
/uMod_GUI/bin/README_French.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/build-wars/texmod/0b53db48814fa46eebd896768203a12ba9c51ca8/uMod_GUI/bin/README_French.txt
--------------------------------------------------------------------------------
/uMod_GUI/bin/languages/Example_uMod_LanguagePack_English.txt:
--------------------------------------------------------------------------------
1 | If you have created a language package and would like to add to the officially download, please send it to me.
2 | Email address and support can be found at http://code.google.com/p/texmod/
3 |
4 |
5 | The file name must match the wildcard uMod_LanguagePack_NAMEOFLANGUAGE.txt
6 | Format of an entry is divided into 3 parts: 1) Keyword directly followed by a colon, 2) message, and 3) end symbol "|"
7 | Restriction of the the message: do not use "|" within a message!!
8 |
9 | You can also use utf-16LE encoding, but you have to label the file as uMod_LanguagePackU_NAMEOFLANGUAGE.txt
10 |
11 | comments must start with an "#" and must end with |
12 |
13 | e.g.
14 |
15 | #
16 |
17 | this is a comment
18 |
19 | |
20 |
21 | Keyword:
22 |
23 | Message1 line1
24 | Message1 line2
25 |
26 | |
27 |
28 | Keyword2:Message2|
29 | Keyword3:Message3 line1
30 | Message3 line2|
31 |
32 |
33 | There is no need to include all keywords, since English is loaded each time as default and afterwards the entries are replaced.
34 | English itself is compiled into the uMod_GUI.exe, thus there exists no uMod_LanguagePack_English.txt.
35 |
36 | The following list is an example of how an English package would look like (maybe not all keywords are present).
37 |
38 |
39 |
40 | MenuHelp:
41 | Help|
42 | MenuAbout:
43 | About|
44 | MenuAcknowledgement:Acknowledgement|
45 | MenuStartGame:Start game through uMod|
46 | MenuStartGameCMD :Start game through uMod (with command line)|
47 | MenuUseHook:Use global hook|
48 | MenuAddGame:
49 | Add game|
50 | MenuDeleteGame:
51 | Delete Game|
52 | MenuLoadTemplate:Load template|
53 | MenuSaveTemplate:Save template|
54 | MenuSaveTemplateAs:Save template as ...|
55 | MenuSetDefaultTemplate:Set template as default|
56 | MenuLanguage:Change language|
57 | MenuExit:Exit|
58 | MainMenuMain:Main|
59 | MainMenuHelp:
60 | Help|
61 |
62 |
63 | ButtonOpen:
64 | Open texture|
65 | ButtonDirectory:
66 | save directory|
67 | ButtonUpdate:
68 | Update|
69 | ButtonReload:Update (reload)|
70 |
71 |
72 | ChooseFile:Choose a file|
73 | ChooseDir:
74 | Choose a directory|
75 | CheckBoxSaveSingleTexture:
76 | Save single texture|
77 | TextCtrlTemplate:Template: |
78 | CheckBoxSaveAllTextures:
79 | Save all textures|
80 | TextCtrlSavePath:
81 | Save path: |
82 | SelectLanguage:
83 | Select a language|
84 | StartGame:Select the game to start.|
85 | CommandLine:Set command line arguments.|
86 | ChooseGame:
87 | Select a game binary.
88 | DeleteGame:
89 | Select the games to be deleted.|
90 | GameAlreadyAdded:
91 | Game has been already added.|
92 | ExitGameAnyway:
93 | Closing Universal Modding Engine while a game is running might lead to a crash of the game.
94 | Exit anyway?|
95 | NoComment:
96 | No comment.|
97 | Author:
98 | Author: |
99 |
100 |
101 | Error_GameIsHooked:The global hook is active and this game will be injected! Please delete the game from the list or disable the hook.|
102 | Error_ProcessNotStarted:The game could not be started.|
103 | Error_RemoveHook:Removing the Hook while a game is running might lead to crash.|
104 | Error_FileNotSupported:
105 | This file type is not supported:|
106 | Error_DLLNotFound:
107 | Could not load the dll.
108 | The dll injection won't work.
109 | This might happen if D3DX9_43.dll is not installed on your system.
110 | Please install the newest DirectX End-User Runtime Web Installer.|
111 | Error_FktNotFound:
112 | Could not load function out of dll.
113 | The dll injection won't work.|
114 | Error_AlreadyRunning:An other instance of Universal Modding Engine is already running.|
115 | Error_Send:
116 | Could not send to game.|
117 | Error_KeyTwice:
118 | You assigned a key twice.|
119 | Error_NoSavePath:
120 | You did not set a save path.|
121 | Error_KeyNotSet:
122 | At least one key is not set.|
123 | Error_SaveFile:
124 | Could not save to file.|
125 | Error_NoPipe:
126 | Pipe is not opened.|
127 | Error_WritePipe:
128 | Could not write in pipe.|
129 | Error_FlushPipe:
130 | Could not flush pipe buffer.|
131 | Error_Hash:
132 | Could not find hash, maybe file is not named as *_HASH.dds|
133 | Error_FileOpen:
134 | Could not open file.|
135 | Error_FileRead:
136 | Could not read file.|
137 | Error_Memory:
138 | Could not allocate enough memory|
139 | Error_Unzip:
140 | Could not unzip.|
141 | Error_ZipEntry:
142 | Could not find zip entry.|
143 | KeyBack:
144 | Back|
145 | KeySave:
146 | Save|
147 | KeyNext:
148 | Next|
149 | FontColour:
150 | Font colour (RGB):|
151 | TextureColour:
152 | Texture colour (RGB):|
--------------------------------------------------------------------------------
/uMod_GUI/bin/languages/uMod_LanguagePackU_Deutsch.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/build-wars/texmod/0b53db48814fa46eebd896768203a12ba9c51ca8/uMod_GUI/bin/languages/uMod_LanguagePackU_Deutsch.txt
--------------------------------------------------------------------------------
/uMod_GUI/bin/languages/uMod_LanguagePackU_French.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/build-wars/texmod/0b53db48814fa46eebd896768203a12ba9c51ca8/uMod_GUI/bin/languages/uMod_LanguagePackU_French.txt
--------------------------------------------------------------------------------
/uMod_GUI/bin/languages/uMod_LanguagePackU_Russian.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/build-wars/texmod/0b53db48814fa46eebd896768203a12ba9c51ca8/uMod_GUI/bin/languages/uMod_LanguagePackU_Russian.txt
--------------------------------------------------------------------------------
/uMod_GUI/bin/languages/uMod_LanguagePack_Italian.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/build-wars/texmod/0b53db48814fa46eebd896768203a12ba9c51ca8/uMod_GUI/bin/languages/uMod_LanguagePack_Italian.txt
--------------------------------------------------------------------------------
/uMod_GUI/config.gcc:
--------------------------------------------------------------------------------
1 | # =========================================================================
2 | # This configuration file was generated by
3 | # Bakefile 0.2.8 (http://www.bakefile.org)
4 | # Beware that all changes made to this file will be overwritten next
5 | # time you run Bakefile!
6 | # =========================================================================
7 |
8 |
9 | # -------------------------------------------------------------------------
10 | # These are configurable options:
11 | # -------------------------------------------------------------------------
12 |
13 | # Compiler flags to link shared library
14 | #LINK_DLL_FLAGS ?= -shared
15 | LINK_DLL_FLAGS ?=
16 |
17 | # Compiler flags to link loadable module
18 | #LINK_MODULE_FLAGS ?= -shared
19 | LINK_MODULE_FLAGS ?=
20 |
21 | # C compiler
22 | CC = gcc
23 |
24 | # C++ compiler
25 | CXX = g++
26 |
27 | # Standard flags for CC
28 | CFLAGS ?=
29 |
30 | # Standard flags for C++
31 | CXXFLAGS ?= -Wno-unused
32 |
33 | # Standard preprocessor flags (common for CC and CXX)
34 | CPPFLAGS ?=
35 |
36 | # Standard linker flags
37 | LDFLAGS ?= -static-libgcc -static-libstdc++
38 |
39 | # The C preprocessor
40 | CPP ?= $(CC) -E
41 |
42 | # What type of library to build? [0,1]
43 | SHARED ?= 0
44 |
45 | # Build wxUniversal instead of native port? [0,1]
46 | WXUNIV ?= 0
47 |
48 | # Compile Unicode build of wxWidgets? [0,1]
49 | UNICODE ?= 1
50 |
51 | # Use MSLU library when building Unicode version. [0,1]
52 | MSLU ?= 0
53 |
54 | # Type of compiled binaries [debug,release]
55 | BUILD ?= release
56 |
57 | # Should debugging info be included in the executables? The default value
58 | # "default" means that debug info will be included if BUILD=debug
59 | # and not included if BUILD=release. [0,1,default]
60 | DEBUG_INFO ?= 0
61 |
62 | # Value of wxDEBUG_LEVEL. The default value is the same as 1 and means that all
63 | # but expensive assert checks are enabled, use 0 to completely remove debugging
64 | # code. [0,1,default]
65 | DEBUG_FLAG ?= 0
66 |
67 | # Multiple libraries or single huge monolithic one? [0,1]
68 | MONOLITHIC ?= 0
69 |
70 | # Build GUI libraries? [0,1]
71 | USE_GUI ?= 1
72 |
73 | # Build wxHTML library (USE_GUI must be 1)? [0,1]
74 | USE_HTML ?= 1
75 |
76 | # Build multimedia library (USE_GUI must be 1)? [0,1]
77 | USE_MEDIA ?= 1
78 |
79 | # Build wxXRC library (USE_GUI must be 1)? [0,1]
80 | USE_XRC ?= 1
81 |
82 | # Build wxAUI library (USE_GUI must be 1)? [0,1]
83 | USE_AUI ?= 1
84 |
85 | # Build wxRibbon library (USE_GUI must be 1)? [0,1]
86 | USE_RIBBON ?= 1
87 |
88 | # Build wxPropertyGrid library (USE_GUI must be 1)? [0,1]
89 | USE_PROPGRID ?= 1
90 |
91 | # Build wxRichTextCtrl library (USE_GUI must be 1)? [0,1]
92 | USE_RICHTEXT ?= 1
93 |
94 | # Build wxStyledTextCtrl library (USE_GUI must be 1)? [0,1]
95 | USE_STC ?= 1
96 |
97 | # Build OpenGL canvas library (USE_GUI must be 1)? [0,1]
98 | USE_OPENGL ?= 1
99 |
100 | # Build quality assurance classes library (USE_GUI must be 1)? [0,1]
101 | USE_QA ?= 0
102 |
103 | # Enable exceptions in compiled code. [0,1]
104 | USE_EXCEPTIONS ?= 1
105 |
106 | # Enable run-time type information (RTTI) in compiled code. [0,1]
107 | USE_RTTI ?= 1
108 |
109 | # Enable threading in compiled code. [0,1]
110 | USE_THREADS ?= 1
111 |
112 | # Enable wxCairoContext for platforms other than Linux/GTK. [0,1]
113 | USE_CAIRO ?= 0
114 |
115 | # Is this official build by wxWidgets developers? [0,1]
116 | OFFICIAL_BUILD ?= 0
117 |
118 | # Use this to name your customized DLLs differently
119 | VENDOR ?= custom
120 |
121 | #
122 | WX_FLAVOUR ?=
123 |
124 | #
125 | WX_LIB_FLAVOUR ?=
126 |
127 | # Name of your custom configuration. This affects directory
128 | # where object files are stored as well as the location of
129 | # compiled .lib files and setup.h under the lib/ toplevel directory.
130 | CFG ?=
131 |
132 | # Compiler flags needed to compile test suite in tests directory. If you want
133 | # to run the tests, set it so that the compiler can find CppUnit headers.
134 | CPPUNIT_CFLAGS ?=
135 |
136 | # Linker flags needed to link test suite in tests directory. If you want
137 | # to run the tests, include CppUnit library here.
138 | CPPUNIT_LIBS ?=
139 |
140 | # Version of C runtime library to use. You can change this to
141 | # static if SHARED=0, but it is highly recommended to not do
142 | # it if SHARED=1 unless you know what you are doing. [dynamic,static]
143 | RUNTIME_LIBS ?= static
144 |
145 | # Set the version of your Mingw installation here.
146 | # "3" ...... this is for Mingw 2.0 or newer (comes with gcc3)
147 | # "2.95" ... for Mingw 1.1 or any of the older versions [3,2.95]
148 | GCC_VERSION ?= 3
149 |
150 |
--------------------------------------------------------------------------------
/uMod_GUI/config.vc:
--------------------------------------------------------------------------------
1 | # =========================================================================
2 | # This configuration file was generated by
3 | # Bakefile 0.2.8 (http://www.bakefile.org)
4 | # Beware that all changes made to this file will be overwritten next
5 | # time you run Bakefile!
6 | # =========================================================================
7 |
8 |
9 | # -------------------------------------------------------------------------
10 | # These are configurable options:
11 | # -------------------------------------------------------------------------
12 |
13 | # C compiler
14 | CC = cl
15 |
16 | # C++ compiler
17 | CXX = cl
18 |
19 | # Standard flags for CC
20 | CFLAGS =
21 |
22 | # Standard flags for C++
23 | CXXFLAGS =
24 |
25 | # Standard preprocessor flags (common for CC and CXX)
26 | CPPFLAGS =
27 |
28 | # Standard linker flags
29 | LDFLAGS =
30 |
31 | # The C preprocessor
32 | CPP = $(CC) /EP /nologo
33 |
34 | # What type of library to build? [0,1]
35 | SHARED = 0
36 |
37 | # Build wxUniversal instead of native port? [0,1]
38 | WXUNIV = 0
39 |
40 | # Compile Unicode build of wxWidgets? [0,1]
41 | UNICODE = 1
42 |
43 | # Use MSLU library when building Unicode version. [0,1]
44 | MSLU = 0
45 |
46 | # Type of compiled binaries [debug,release]
47 | BUILD = release
48 |
49 | # The target processor architecture must be specified when it is not X86.
50 | # This does not affect the compiler output, so you still need to make sure
51 | # your environment is set up appropriately with the correct compiler in the
52 | # PATH. Rather it affects some options passed to some of the common build
53 | # utilities such as the resource compiler and the linker.
54 | #
55 | # Accepted values: AMD64, IA64.
56 | TARGET_CPU = $(CPU)
57 |
58 | # Should debugging info be included in the executables? The default value
59 | # "default" means that debug info will be included if BUILD=debug
60 | # and not included if BUILD=release. [0,1,default]
61 | DEBUG_INFO = 1
62 |
63 | # Value of wxDEBUG_LEVEL. The default value is the same as 1 and means that all
64 | # but expensive assert checks are enabled, use 0 to completely remove debugging
65 | # code. [0,1,default]
66 | DEBUG_FLAG = 0
67 |
68 | # Link against debug (e.g. msvcrtd.dll) or release (msvcrt.dll) RTL?
69 | # Default is to use debug CRT if and only if BUILD==debug. [0,1,default]
70 | DEBUG_RUNTIME_LIBS = default
71 |
72 | # Multiple libraries or single huge monolithic one? [0,1]
73 | MONOLITHIC = 0
74 |
75 | # Build GUI libraries? [0,1]
76 | USE_GUI = 1
77 |
78 | # Build wxHTML library (USE_GUI must be 1)? [0,1]
79 | USE_HTML = 1
80 |
81 | # Build multimedia library (USE_GUI must be 1)? [0,1]
82 | USE_MEDIA = 1
83 |
84 | # Build wxXRC library (USE_GUI must be 1)? [0,1]
85 | USE_XRC = 1
86 |
87 | # Build wxAUI library (USE_GUI must be 1)? [0,1]
88 | USE_AUI = 1
89 |
90 | # Build wxRibbon library (USE_GUI must be 1)? [0,1]
91 | USE_RIBBON = 1
92 |
93 | # Build wxPropertyGrid library (USE_GUI must be 1)? [0,1]
94 | USE_PROPGRID = 1
95 |
96 | # Build wxRichTextCtrl library (USE_GUI must be 1)? [0,1]
97 | USE_RICHTEXT = 1
98 |
99 | # Build wxStyledTextCtrl library (USE_GUI must be 1)? [0,1]
100 | USE_STC = 1
101 |
102 | # Build OpenGL canvas library (USE_GUI must be 1)? [0,1]
103 | USE_OPENGL = 1
104 |
105 | # Build quality assurance classes library (USE_GUI must be 1)? [0,1]
106 | USE_QA = 1
107 |
108 | # Enable exceptions in compiled code. [0,1]
109 | USE_EXCEPTIONS = 1
110 |
111 | # Enable run-time type information (RTTI) in compiled code. [0,1]
112 | USE_RTTI = 1
113 |
114 | # Enable threading in compiled code. [0,1]
115 | USE_THREADS = 1
116 |
117 | # Enable wxCairoContext for platforms other than Linux/GTK. [0,1]
118 | USE_CAIRO = 0
119 |
120 | # Is this official build by wxWidgets developers? [0,1]
121 | OFFICIAL_BUILD = 0
122 |
123 | # Use this to name your customized DLLs differently
124 | VENDOR = custom
125 |
126 | #
127 | WX_FLAVOUR =
128 |
129 | #
130 | WX_LIB_FLAVOUR =
131 |
132 | # Name of your custom configuration. This affects directory
133 | # where object files are stored as well as the location of
134 | # compiled .lib files and setup.h under the lib/ toplevel directory.
135 | CFG =
136 |
137 | # Compiler flags needed to compile test suite in tests directory. If you want
138 | # to run the tests, set it so that the compiler can find CppUnit headers.
139 | CPPUNIT_CFLAGS =
140 |
141 | # Linker flags needed to link test suite in tests directory. If you want
142 | # to run the tests, include CppUnit library here.
143 | CPPUNIT_LIBS =
144 |
145 | # Version of C runtime library to use. You can change this to
146 | # static if SHARED=0, but it is highly recommended to not do
147 | # it if SHARED=1 unless you know what you are doing. [dynamic,static]
148 | RUNTIME_LIBS = static
149 |
150 |
--------------------------------------------------------------------------------
/uMod_GUI/makefile.gcc:
--------------------------------------------------------------------------------
1 | # =========================================================================
2 | # This makefile was generated by
3 | # Bakefile 0.2.1 (http://bakefile.sourceforge.net)
4 | # Do not modify, all changes will be overwritten!
5 | # =========================================================================
6 |
7 | include config.gcc
8 |
9 | # -------------------------------------------------------------------------
10 | # Do not modify the rest of this file!
11 | # -------------------------------------------------------------------------
12 |
13 | ### Variables: ###
14 |
15 | CPPDEPS = -MT$@ -MF$@.d -MD
16 | WX_RELEASE_NODOT = 29
17 | OBJS = \
18 | obj
19 | OBJS_exe = \
20 | bin
21 | WX_DIR = D:\Programme\wxWidgets-2.9.2
22 | LIBDIRNAME = $(WX_DIR)\lib\gcc_$(LIBTYPE_SUFFIX)$(CFG)
23 | SETUPHDIR = \
24 | $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)
25 | MINIMAL_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG_2) $(__THREADSFLAG) \
26 | $(GCCFLAGS) -DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
27 | $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
28 | $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) $(__MSLU_DEFINE_p) \
29 | $(__GFXCTX_DEFINE_p) -I$(SETUPHDIR) -I$(WX_DIR)\include -W -Wall -Wextra -I. \
30 | $(__DLLFLAG_p) -DNOPCH $(__RTTIFLAG_5) \
31 | $(__EXCEPTIONSFLAG_6) -Wno-ctor-dtor-privacy $(CPPFLAGS) $(CXXFLAGS)
32 | MINIMAL_OBJECTS = \
33 | $(OBJS)\uMod_rc.o \
34 | $(OBJS)\unzip.o \
35 | $(OBJS)\uMod_DirectInjection.o \
36 | $(OBJS)\uMod_GUI.o \
37 | $(OBJS)\uMod_GameInfo.o \
38 | $(OBJS)\uMod_GamePage.o \
39 | $(OBJS)\uMod_Server.o \
40 | $(OBJS)\uMod_Client.o \
41 | $(OBJS)\uMod_File.o \
42 | $(OBJS)\uMod_Sender.o \
43 | $(OBJS)\uMod_Settings.o \
44 | $(OBJS)\uMod_AddTexture.o \
45 | $(OBJS)\uMod_Language.o
46 |
47 | ### Conditionally set variables: ###
48 |
49 | ifeq ($(GCC_VERSION),2.95)
50 | GCCFLAGS = -fvtable-thunks
51 | endif
52 | ifeq ($(USE_GUI),0)
53 | PORTNAME = base
54 | endif
55 | ifeq ($(USE_GUI),1)
56 | PORTNAME = msw
57 | endif
58 | ifeq ($(BUILD),debug)
59 | ifeq ($(DEBUG_FLAG),default)
60 | WXDEBUGFLAG = d
61 | endif
62 | endif
63 | ifeq ($(DEBUG_FLAG),1)
64 | WXDEBUGFLAG = d
65 | endif
66 | ifeq ($(UNICODE),1)
67 | WXUNICODEFLAG = u
68 | endif
69 | ifeq ($(WXUNIV),1)
70 | WXUNIVNAME = univ
71 | endif
72 | ifeq ($(SHARED),1)
73 | WXDLLFLAG = dll
74 | endif
75 | ifeq ($(SHARED),0)
76 | LIBTYPE_SUFFIX = lib
77 | endif
78 | ifeq ($(SHARED),1)
79 | LIBTYPE_SUFFIX = dll
80 | endif
81 | ifeq ($(MONOLITHIC),0)
82 | EXTRALIBS_FOR_BASE =
83 | endif
84 | ifeq ($(MONOLITHIC),1)
85 | EXTRALIBS_FOR_BASE =
86 | endif
87 | ifeq ($(BUILD),debug)
88 | __OPTIMIZEFLAG_2 = -O0 -g
89 | endif
90 | ifeq ($(BUILD),release)
91 | __OPTIMIZEFLAG_2 = -O2
92 | endif
93 | ifeq ($(USE_RTTI),0)
94 | __RTTIFLAG_5 = -fno-rtti
95 | endif
96 | ifeq ($(USE_RTTI),1)
97 | __RTTIFLAG_5 =
98 | endif
99 | ifeq ($(USE_EXCEPTIONS),0)
100 | __EXCEPTIONSFLAG_6 = -fno-exceptions
101 | endif
102 | ifeq ($(USE_EXCEPTIONS),1)
103 | __EXCEPTIONSFLAG_6 =
104 | endif
105 | ifeq ($(WXUNIV),1)
106 | __WXUNIV_DEFINE_p = -D__WXUNIVERSAL__
107 | endif
108 | ifeq ($(WXUNIV),1)
109 | __WXUNIV_DEFINE_p_1 = --define __WXUNIVERSAL__
110 | endif
111 | ifeq ($(BUILD),debug)
112 | ifeq ($(DEBUG_FLAG),default)
113 | __DEBUG_DEFINE_p = -D__WXDEBUG__
114 | endif
115 | endif
116 | ifeq ($(DEBUG_FLAG),1)
117 | __DEBUG_DEFINE_p = -D__WXDEBUG__
118 | endif
119 | ifeq ($(BUILD),debug)
120 | ifeq ($(DEBUG_FLAG),default)
121 | __DEBUG_DEFINE_p_1 = --define __WXDEBUG__
122 | endif
123 | endif
124 | ifeq ($(DEBUG_FLAG),1)
125 | __DEBUG_DEFINE_p_1 = --define __WXDEBUG__
126 | endif
127 | ifeq ($(USE_EXCEPTIONS),0)
128 | __EXCEPTIONS_DEFINE_p = -DwxNO_EXCEPTIONS
129 | endif
130 | ifeq ($(USE_EXCEPTIONS),0)
131 | __EXCEPTIONS_DEFINE_p_1 = --define wxNO_EXCEPTIONS
132 | endif
133 | ifeq ($(USE_RTTI),0)
134 | __RTTI_DEFINE_p = -DwxNO_RTTI
135 | endif
136 | ifeq ($(USE_RTTI),0)
137 | __RTTI_DEFINE_p_1 = --define wxNO_RTTI
138 | endif
139 | ifeq ($(USE_THREADS),0)
140 | __THREAD_DEFINE_p = -DwxNO_THREADS
141 | endif
142 | ifeq ($(USE_THREADS),0)
143 | __THREAD_DEFINE_p_1 = --define wxNO_THREADS
144 | endif
145 | ifeq ($(UNICODE),1)
146 | __UNICODE_DEFINE_p = -D_UNICODE
147 | endif
148 | ifeq ($(UNICODE),1)
149 | __UNICODE_DEFINE_p_1 = --define _UNICODE
150 | endif
151 | ifeq ($(MSLU),1)
152 | __MSLU_DEFINE_p = -DwxUSE_UNICODE_MSLU=1
153 | endif
154 | ifeq ($(MSLU),1)
155 | __MSLU_DEFINE_p_1 = --define wxUSE_UNICODE_MSLU=1
156 | endif
157 | ifeq ($(USE_GDIPLUS),1)
158 | __GFXCTX_DEFINE_p = -DwxUSE_GRAPHICS_CONTEXT=1
159 | endif
160 | ifeq ($(USE_GDIPLUS),1)
161 | __GFXCTX_DEFINE_p_1 = --define wxUSE_GRAPHICS_CONTEXT=1
162 | endif
163 | ifeq ($(SHARED),1)
164 | __DLLFLAG_p = -DWXUSINGDLL
165 | endif
166 | ifeq ($(SHARED),1)
167 | __DLLFLAG_p_1 = --define WXUSINGDLL
168 | endif
169 | ifeq ($(MONOLITHIC),0)
170 | __WXLIB_CORE_p = \
171 | -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core
172 | endif
173 | ifeq ($(MONOLITHIC),0)
174 | __WXLIB_BASE_p = \
175 | -lwxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)
176 | endif
177 | ifeq ($(MONOLITHIC),1)
178 | __WXLIB_MONO_p = \
179 | -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)
180 | endif
181 | ifeq ($(USE_GUI),1)
182 | __LIB_TIFF_p = -lwxtiff$(WXDEBUGFLAG)
183 | endif
184 | ifeq ($(USE_GUI),1)
185 | __LIB_JPEG_p = -lwxjpeg$(WXDEBUGFLAG)
186 | endif
187 | ifeq ($(USE_GUI),1)
188 | __LIB_PNG_p = -lwxpng$(WXDEBUGFLAG)
189 | endif
190 | ifeq ($(MSLU),1)
191 | __UNICOWS_LIB_p = -lunicows
192 | endif
193 | ifeq ($(USE_GDIPLUS),1)
194 | __GDIPLUS_LIB_p = -lgdiplus
195 | endif
196 | ifeq ($(BUILD),debug)
197 | ifeq ($(DEBUG_INFO),default)
198 | __DEBUGINFO = -g
199 | endif
200 | endif
201 | ifeq ($(BUILD),release)
202 | ifeq ($(DEBUG_INFO),default)
203 | __DEBUGINFO =
204 | endif
205 | endif
206 | ifeq ($(DEBUG_INFO),0)
207 | __DEBUGINFO =
208 | endif
209 | ifeq ($(DEBUG_INFO),1)
210 | __DEBUGINFO = -g
211 | endif
212 | ifeq ($(USE_THREADS),0)
213 | __THREADSFLAG =
214 | endif
215 | ifeq ($(USE_THREADS),1)
216 | __THREADSFLAG = -mthreads
217 | endif
218 |
219 |
220 | all: $(OBJS)
221 | $(OBJS):
222 | -if not exist $(OBJS) mkdir $(OBJS)
223 |
224 | all: $(OBJS_exe)
225 | $(OBJS_exe):
226 | -if not exist $(OBJS_exe) mkdir $(OBJS_exe)
227 |
228 | ### Targets: ###
229 |
230 | all: $(OBJS_exe)\uMod.exe
231 |
232 | clean:
233 | -if exist $(OBJS)\*.o del $(OBJS)\*.o
234 | -if exist $(OBJS)\*.d del $(OBJS)\*.d
235 | -if exist $(OBJS_exe)\uMod.exe del $(OBJS_exe)\uMod.exe
236 |
237 | $(OBJS_exe)\uMod.exe: $(MINIMAL_OBJECTS) $(OBJS)\uMod_rc.o
238 | $(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
239 |
240 | $(OBJS)\uMod_rc.o: uMod.rc uMod.ico
241 | windres --use-temp-file -i $< -o $@
242 |
243 | $(OBJS)\unzip.o: ./unzip.cpp
244 | $(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
245 |
246 | $(OBJS)\uMod_DirectInjection.o: ./uMod_DirectInjection.cpp
247 | $(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
248 |
249 | $(OBJS)\uMod_GUI.o: ./uMod_GUI.cpp
250 | $(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
251 |
252 | $(OBJS)\uMod_GameInfo.o: ./uMod_GameInfo.cpp
253 | $(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
254 |
255 | $(OBJS)\uMod_GamePage.o: ./uMod_GamePage.cpp
256 | $(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
257 |
258 | $(OBJS)\uMod_Server.o: ./uMod_Server.cpp
259 | $(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
260 |
261 | $(OBJS)\uMod_Client.o: ./uMod_Client.cpp
262 | $(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
263 |
264 | $(OBJS)\uMod_File.o: ./uMod_File.cpp
265 | $(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
266 |
267 | $(OBJS)\uMod_Sender.o: ./uMod_Sender.cpp
268 | $(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
269 |
270 | $(OBJS)\uMod_Settings.o: ./uMod_Settings.cpp
271 | $(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
272 |
273 | $(OBJS)\uMod_AddTexture.o: ./uMod_AddTexture.cpp
274 | $(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
275 |
276 | $(OBJS)\uMod_Language.o: ./uMod_Language.cpp
277 | $(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
278 |
279 |
280 | .PHONY: all clean
281 |
282 |
283 | # Dependencies tracking:
284 | -include $(OBJS)/*.d
285 |
--------------------------------------------------------------------------------
/uMod_GUI/uMod.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/build-wars/texmod/0b53db48814fa46eebd896768203a12ba9c51ca8/uMod_GUI/uMod.ico
--------------------------------------------------------------------------------
/uMod_GUI/uMod.rc:
--------------------------------------------------------------------------------
1 | MAINICON ICON "uMod.ico"
--------------------------------------------------------------------------------
/uMod_GUI/uMod_AddTexture.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #include "uMod_Main.h"
22 |
23 |
24 |
25 | AddTextureClass::AddTextureClass(void)
26 | {
27 | Num = 0;
28 | Textures = NULL;
29 | Size = NULL;
30 | Hash = NULL;
31 | WasAdded = NULL;
32 | Len=0;
33 |
34 | Add = false;
35 | Force = false;
36 | Loaded = false;
37 | OwnMemory = false;
38 | }
39 |
40 | AddTextureClass::~AddTextureClass(void)
41 | {
42 | ReleaseMemory();
43 | }
44 |
45 | int AddTextureClass::ReleaseMemory(void)
46 | {
47 | if (OwnMemory)
48 | {
49 | if (Size!=NULL) delete [] Size;
50 | if (Hash!=NULL) delete [] Hash;
51 | if (WasAdded!=NULL) delete [] WasAdded;
52 |
53 |
54 | if (Textures!=NULL)
55 | {
56 | for (unsigned int i=0; i0)
85 | {
86 | if (GetMemory( Textures[i], tex.Size[i])) return -1;
87 | for (unsigned int j=0u; j.
17 | */
18 |
19 |
20 | #ifndef uMod_ADDTEXTURE_H_
21 | #define uMod_ADDTEXTURE_H_
22 |
23 | #include "uMod_Main.h"
24 |
25 | class AddTextureClass
26 | {
27 | public:
28 | AddTextureClass(void);
29 | ~AddTextureClass(void);
30 | int ReleaseMemory(void);
31 |
32 | int SetSize(int num);
33 | int InheriteMemory(AddTextureClass &tex);
34 |
35 | unsigned int Num;
36 | char **Textures;
37 | unsigned int *Size;
38 | unsigned long *Hash;
39 | bool *WasAdded;
40 | unsigned int Len;
41 |
42 | bool Add;
43 | bool Force;
44 | bool Loaded;
45 | bool OwnMemory;
46 | wxString File;
47 | wxString Comment;
48 |
49 |
50 | };
51 |
52 |
53 |
54 | #endif /* uMod_ADDTEXTURE_H_ */
55 |
--------------------------------------------------------------------------------
/uMod_GUI/uMod_Client.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #include "uMod_Main.h"
22 |
23 | uMod_Client::uMod_Client( PipeStruct &pipe, uMod_Frame *frame) : wxThread(wxTHREAD_JOINABLE)
24 | {
25 | Pipe.In = pipe.In;
26 | Pipe.Out = pipe.Out;
27 | MainFrame = frame;
28 | }
29 |
30 | uMod_Client::~uMod_Client(void)
31 | {
32 | if (Pipe.Out != INVALID_HANDLE_VALUE)
33 | {
34 | DisconnectNamedPipe(Pipe.Out);
35 | CloseHandle(Pipe.Out);
36 | Pipe.Out = INVALID_HANDLE_VALUE;
37 | }
38 | if (Pipe.In != INVALID_HANDLE_VALUE)
39 | {
40 | DisconnectNamedPipe(Pipe.In);
41 | CloseHandle(Pipe.In);
42 | Pipe.In = INVALID_HANDLE_VALUE;
43 | }
44 | }
45 |
46 | void* uMod_Client::Entry(void)
47 | {
48 | char buffer[SMALL_BUFSIZE];
49 | while (1)
50 | {
51 | unsigned long size;
52 | bool ret = ReadFile(
53 | Pipe.In, // handle to pipe
54 | buffer, // buffer to receive data
55 | SMALL_BUFSIZE, // size of buffer
56 | &size, // number of bytes read
57 | NULL); // not overlapped I/O
58 |
59 | if (ret || GetLastError()==ERROR_MORE_DATA)
60 | {
61 | unsigned int pos=0;
62 | MsgStruct *commands;
63 | bool update_textures = false;
64 | while (posControl)
70 | {
71 |
72 | }
73 | */
74 | pos+=sizeof(MsgStruct);// + add_length;
75 | }
76 | }
77 | else
78 | {
79 | break;
80 | }
81 | }
82 | CloseHandle(Pipe.In);
83 | Pipe.In = INVALID_HANDLE_VALUE;
84 | CloseHandle(Pipe.Out);
85 | Pipe.Out = INVALID_HANDLE_VALUE;
86 |
87 | uMod_Event event( uMod_EVENT_TYPE, ID_Delete_Game);
88 | event.SetClient(this);
89 | wxPostEvent( MainFrame, event);
90 |
91 | return NULL;
92 | }
93 |
94 |
--------------------------------------------------------------------------------
/uMod_GUI/uMod_Client.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #ifndef uMod_CLIENT_H_
22 | #define uMod_CLIENT_H_
23 |
24 | #include "uMod_Main.h"
25 |
26 | // an object of this class is created for each running game
27 | // it reads out of the incoming pipe (it must run as thread)
28 | // if the pipe is closed (Game is canceled) it send a messeage to the main thread
29 | // it should read the error state from the dll, but this is not yet implemented
30 | class uMod_Client : public wxThread
31 | {
32 | public:
33 | uMod_Client( PipeStruct &pipe, uMod_Frame *frame);
34 | virtual ~uMod_Client(void);
35 |
36 | void* Entry(void);
37 |
38 |
39 | PipeStruct Pipe;
40 |
41 | private:
42 | uMod_Frame *MainFrame;
43 | };
44 |
45 | #endif /* uMod_CLIENT_H_ */
46 |
--------------------------------------------------------------------------------
/uMod_GUI/uMod_DirectInjection.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 | #ifndef uMod_INJECTDIRECTLY_H_
21 | #define uMod_INJECTDIRECTLY_H_
22 |
23 |
24 |
25 | void Inject(HANDLE hProcess, const wchar_t* dllname, const char* funcname);
26 |
27 | #endif /* uMod_INJECTDIRECTLY_H_ */
28 |
--------------------------------------------------------------------------------
/uMod_GUI/uMod_Event.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #include "uMod_Main.h"
22 |
23 |
24 |
--------------------------------------------------------------------------------
/uMod_GUI/uMod_Event.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #ifndef uMod_EVENTTYPE_H_
22 | #define uMod_EVENTTYPE_H_
23 | #include "uMod_Client.h"
24 | #include "uMod_Main.h"
25 |
26 |
27 | //we need our own event to pass send some arguments from the server or the client thread to the main thread
28 | BEGIN_DECLARE_EVENT_TYPES()
29 | DECLARE_EVENT_TYPE( uMod_EVENT_TYPE, -1)
30 | END_DECLARE_EVENT_TYPES()
31 |
32 | class uMod_Event : public wxCommandEvent
33 | {
34 | public:
35 | uMod_Event( wxEventType commandType = uMod_EVENT_TYPE, int id = 0 )
36 | : wxCommandEvent(commandType, id) { }
37 | virtual ~uMod_Event(void) {}
38 |
39 | // You *must* copy here the data to be transported
40 | uMod_Event( const uMod_Event &event )
41 | : wxCommandEvent(event) { this->SetText( event.GetText()); PipeIn=((uMod_Event&)event).GetPipeIn(); PipeOut=((uMod_Event&)event).GetPipeOut(); Name=((uMod_Event&)event).GetName(); Client=((uMod_Event&)event).GetClient();}
42 |
43 | // Required for sending with wxPostEvent()
44 | wxEvent* Clone() const { return new uMod_Event(*this); }
45 |
46 | wxString GetText() const { return m_Text; }
47 | void SetText( const wxString& text ) { m_Text = text; }
48 |
49 | wxString GetName(void) {return Name;}
50 | HANDLE GetPipeIn(void) {return PipeIn;}
51 | HANDLE GetPipeOut(void) {return PipeOut;}
52 | uMod_Client * GetClient(void) {return Client;}
53 |
54 | void SetName( wxString name) {Name=name;}
55 | void SetPipeIn( HANDLE pipe) {PipeIn=pipe;}
56 | void SetPipeOut( HANDLE pipe) {PipeOut=pipe;}
57 | void SetClient( uMod_Client *client) {Client=client;}
58 |
59 | private:
60 |
61 | wxString Name;
62 | HANDLE PipeIn;
63 | HANDLE PipeOut;
64 | uMod_Client *Client;
65 |
66 | wxString m_Text;
67 | };
68 |
69 |
70 | #endif /* uMod_EVENTTYPE_H_ */
71 |
--------------------------------------------------------------------------------
/uMod_GUI/uMod_File.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 | #include "uMod_Main.h"
20 | #include "unzip.h"
21 |
22 |
23 | uMod_File::uMod_File(void)
24 | {
25 | Loaded=false;
26 | XORed=false;
27 | FileInMemory=NULL;
28 | MemoryLength=0u;
29 | FileLen=0u;
30 | }
31 |
32 | uMod_File::uMod_File(const wxString &file)
33 | {
34 | Loaded=false;
35 | XORed=false;
36 | FileInMemory=NULL;
37 | MemoryLength=0u;
38 | FileLen=0u;
39 | SetFile(file);
40 | }
41 |
42 |
43 | uMod_File::~uMod_File(void)
44 | {
45 | if (FileInMemory!=NULL) delete [] FileInMemory;
46 | }
47 |
48 |
49 | bool uMod_File::FileSupported(void)
50 | {
51 | wxString file_type = FileName.AfterLast( '.');
52 | if (file_type == L"zip") return true;
53 | else if (file_type == L"tpf") return true;
54 | else if (file_type == L"dds") return true;
55 |
56 | return false;
57 | }
58 |
59 |
60 | int uMod_File::GetComment( wxString &tool_tip)
61 | {
62 | wxString file_type = FileName.AfterLast( '.');
63 | if (file_type == L"zip")
64 | {
65 | if (int ret = GetCommentZip( tool_tip)) return ret;
66 | }
67 | else if (file_type == L"tpf")
68 | {
69 | if (int ret = GetCommentTpf( tool_tip)) return ret;
70 | }
71 | else if (file_type == L"dds")
72 | {
73 | tool_tip = Language->NoComment;
74 | return -1;
75 | }
76 | return 0;
77 | }
78 |
79 | int uMod_File::GetContent( AddTextureClass &tex, bool add)
80 | {
81 | wxString file_type = FileName.AfterLast( '.');
82 | if (file_type == L"zip")
83 | {
84 | AddZip( tex, add, false);
85 | }
86 | else if (file_type == L"tpf")
87 | {
88 | AddZip( tex, add, true);
89 | }
90 | else if (file_type == L"dds")
91 | {
92 | AddFile( tex, add);
93 | }
94 | else
95 | {
96 | LastError << Language->Error_FileNotSupported;
97 | LastError << "\n" << FileName;
98 | }
99 | if (LastError.Len()>0) return -1;
100 | else
101 | {
102 | if (add) tex.Loaded = true;
103 | return 0;
104 | }
105 | }
106 |
107 | int uMod_File::ReadFile(void)
108 | {
109 | if (Loaded) return 0;
110 | XORed=false;
111 |
112 | wxFile dat;
113 | if (!dat.Access(FileName, wxFile::read)) {LastError << Language->Error_FileOpen <<"\n" << FileName; return -1;}
114 | dat.Open(FileName, wxFile::read);
115 | if (!dat.IsOpened()) {LastError << Language->Error_FileOpen <<"\n" << FileName; return -1;}
116 | FileLen = dat.Length();
117 | if (FileLen==0) {LastError << Language->Error_FileOpen <<"\n" << FileName; return -1;}
118 |
119 | if (FileLen>=MemoryLength)
120 | {
121 | if (FileInMemory!=NULL) delete [] FileInMemory;
122 | try {FileInMemory = new char [FileLen+1];}
123 | catch (...) {FileInMemory=NULL; MemoryLength=0; FileLen=0; LastError << Language->Error_Memory; return -1;}
124 | MemoryLength = FileLen+1;
125 | }
126 | unsigned int result = dat.Read( FileInMemory, FileLen);
127 | dat.Close();
128 |
129 | if (result != FileLen) {FileLen=0; LastError << Language->Error_FileRead<<"\n" << FileName; return -1;}
130 | FileInMemory[FileLen]=0;
131 |
132 | Loaded = true;
133 | return 0;
134 | }
135 |
136 |
137 |
138 | int uMod_File::UnXOR(void)
139 | {
140 | if (XORed) return 0;
141 | /*
142 | *
143 | * BIG THANKS TO Tonttu
144 | * (TPFcreate 1.5)
145 | *
146 | */
147 | unsigned int *buff = (unsigned int*) FileInMemory;
148 | unsigned int TPF_XOR = 0x3FA43FA4u;
149 | unsigned int size = FileLen/4u;
150 | for (unsigned int i=0; i0u && FileInMemory[pos]) pos--;
156 | if (pos>0u && pos> 24 );
172 | TPF_XOR <<= 4;
173 | j++;
174 | }
175 | */
176 | return 0;
177 | }
178 |
179 |
180 |
181 | int uMod_File::GetCommentZip( wxString &tool_tip)
182 | {
183 | if (int ret = ReadFile()) return ret;
184 |
185 | HZIP ZIP_Handle = OpenZip( FileInMemory, FileLen, NULL);
186 | if (ZIP_Handle==NULL) {tool_tip = Language->NoComment; LastError << Language->Error_Unzip; return -1;}
187 |
188 | ZIPENTRY ze;
189 | int index;
190 | FindZipItem( ZIP_Handle, L"Comment.txt", false, &index, &ze);
191 | if (index>=0) //if Comment.txt is present in the zip file
192 | {
193 | char* comment;
194 | int len = ze.unc_size;
195 | try {comment=new char[len+1];}
196 | catch(...) {tool_tip = Language->NoComment; LastError << Language->Error_Memory; return -1;}
197 | ZRESULT zr = UnzipItem( ZIP_Handle, index, comment, len);
198 |
199 | if (zr!=ZR_OK && zr!=ZR_MORE) {delete [] comment; tool_tip = Language->NoComment; LastError << Language->Error_Unzip <<"\nZIP:" << L"Comment.txt"; return -1;}
200 | comment[len]=0;
201 | tool_tip = comment;
202 | delete [] comment;
203 | }
204 | else tool_tip = Language->NoComment;
205 |
206 | CloseZip(ZIP_Handle);
207 | return 0;
208 | }
209 |
210 | int uMod_File::GetCommentTpf( wxString &tool_tip)
211 | {
212 | if (int ret = ReadFile()) return ret;
213 |
214 | UnXOR();
215 | tool_tip = &FileInMemory[FileLen];
216 | tool_tip.Prepend( Language->Author);
217 | return 0;
218 | }
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 | int uMod_File::AddFile( AddTextureClass &tex, bool add)
229 | {
230 | tex.SetSize(1);
231 | unsigned long temp_hash;
232 |
233 | wxString name = FileName.AfterLast( '_');
234 | name = name.BeforeLast( '.');
235 | if (!name.ToULong( &temp_hash, 16)) {LastError << Language->Error_Hash <<"\n" << FileName << "\n"; return -1;} // return if hash could not be extracted
236 |
237 | if (add)
238 | {
239 | if (int ret = ReadFile()) return ret;
240 |
241 | try {tex.Textures[0] = new char[FileLen];}
242 | catch (...) {tex.Textures[0]=NULL; LastError << Language->Error_Memory; return -1;}
243 | for (unsigned int i=0; iError_Unzip; return -1;}
292 |
293 | ZIPENTRY ze;
294 | int index;
295 | FindZipItem( ZIP_Handle, L"texmod.def", false, &index, &ze);
296 | if (index>=0) //if texmod.def is present in the zip file
297 | {
298 | char* def;
299 | int len = ze.unc_size;
300 | try {def=new char[len+1];}
301 | catch(...) {LastError << Language->Error_Memory; return -1;}
302 | ZRESULT zr = UnzipItem( ZIP_Handle, index, def, len);
303 |
304 | if (zr!=ZR_OK && zr!=ZR_MORE) {delete [] def; return -1;}
305 | def[len]=0;
306 |
307 | wxStringTokenizer token( def, "\n");
308 |
309 | int num = token.CountTokens();
310 |
311 |
312 | tex.SetSize(num);
313 |
314 | unsigned long temp_hash;
315 | int count = 0;
316 | wxString entry;
317 | wxString file;
318 |
319 | for (int i=0; iError_Hash <<"\nTPF:" << entry << "\n"; continue;}
324 |
325 | file = entry.AfterFirst( '|');
326 | file.Replace( "\r", "");
327 |
328 | while ( (file[0]=='.' && (file[1]=='/' || file[1]=='\\')) || file[0]=='/' || file[0]=='\\') file.Remove(0,1);
329 |
330 | if (add)
331 | {
332 | FindZipItem( ZIP_Handle, file.wc_str(), false, &index, &ze); // look for texture
333 | if (index>=0)
334 | {
335 | try {tex.Textures[count] = new char[ze.unc_size];}
336 | catch(...)
337 | {
338 | tex.Textures[count] = NULL;
339 | LastError << Language->Error_Memory;
340 | continue;
341 | }
342 |
343 | ZRESULT rz = UnzipItem( ZIP_Handle, index, tex.Textures[count], ze.unc_size);
344 | if (rz!=ZR_OK && rz!=ZR_MORE)
345 | {
346 | delete [] tex.Textures[count];
347 | LastError << Language->Error_Unzip <<"\nTPF:" << file << "\n";
348 | tex.Textures[count] = NULL;
349 | }
350 | else
351 | {
352 | tex.Hash[count] = temp_hash;
353 | tex.Size[count] = ze.unc_size;
354 | count++;
355 | }
356 | }
357 | else
358 | {
359 | LastError << Language->Error_Unzip <<"\nTPF:" << file << "\n";
360 | CloseZip(ZIP_Handle); //somehow we need to close and to reopen the zip handle, otherwise the program crashes
361 | ZIP_Handle = OpenZip( FileInMemory, FileLen, pw);
362 | }
363 | }
364 | else
365 | {
366 | tex.Hash[count] = temp_hash;
367 | tex.Size[count] = 0;
368 | count++;
369 | }
370 | }
371 | delete [] def;
372 | tex.Num = count;
373 | }
374 | else // texmod.def is not present in the zip file
375 | {
376 | CloseZip(ZIP_Handle); //somehow we need to close and to reopen the zip handle, otherwise the program crashes
377 | ZIP_Handle = OpenZip( FileInMemory, FileLen, pw);
378 | if (ZIP_Handle==NULL) {LastError << Language->Error_Unzip; return -1;}
379 | wxString name;
380 | wxString file;
381 | GetZipItem( ZIP_Handle, -1, &ze); //ask for number of entries
382 | int num = ze.index;
383 |
384 | tex.SetSize(num);
385 | int count = 0;
386 | unsigned long temp_hash;
387 | for (int i=0; iError_Unzip <<"\nZIP:" << file << "\n";
406 | }
407 |
408 | file = ze.name;
409 | if (file.Len()==0) continue;
410 |
411 | name = file.AfterLast( '.');
412 | if (name!="dds") continue; //if this is not texture file, continue
413 |
414 | name = file.AfterLast( '_');
415 | name = name.BeforeLast( '.');
416 |
417 | if (!name.ToULong( &temp_hash, 16)) {LastError << Language->Error_Hash <<"\nZIP:" << file << "\n"; continue;} //if hash could not be extracted
418 |
419 | if (add)
420 | {
421 | if (buffer==NULL) continue;
422 |
423 | tex.Textures[count] = buffer;
424 | tex.Hash[count] = temp_hash;
425 | tex.Size[count] = len;//ze.unc_size;
426 | count++;
427 | }
428 | else
429 | {
430 | if (buffer!=NULL) delete [] buffer;
431 | tex.Hash[count] = temp_hash;
432 | tex.Size[count] = 0;
433 | count++;
434 | }
435 | }
436 | tex.Num = count;
437 | }
438 |
439 | CloseZip(ZIP_Handle);
440 | return 0;
441 | }
442 |
--------------------------------------------------------------------------------
/uMod_GUI/uMod_File.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 | #ifndef uMod_FILE_H_
20 | #define uMod_FILE_H_
21 |
22 | #include "uMod_Main.h"
23 |
24 | class uMod_File
25 | {
26 | public:
27 | uMod_File(void);
28 | uMod_File(const wxString &file);
29 | ~uMod_File(void);
30 |
31 | bool FileSupported(void);
32 |
33 | int GetComment( wxString &tool_tip);
34 | int GetContent( AddTextureClass &tex, bool add);
35 |
36 | int SetFile(const wxString &file) {FileName=file;Loaded=false; return 0;}
37 | wxString GetFile(void) {return FileName;}
38 |
39 |
40 | wxString LastError;
41 |
42 | private:
43 | int ReadFile(void);
44 |
45 | int UnXOR(void);
46 | int GetCommentZip( wxString &tool_tip);
47 | int GetCommentTpf( wxString &tool_tip);
48 |
49 | int AddFile( AddTextureClass &tex, bool add);
50 | int AddZip( AddTextureClass &tex, bool add, bool tpf);
51 | int AddContent( const char* pw, AddTextureClass &tex, bool add);
52 |
53 | wxString FileName;
54 | bool Loaded;
55 | bool XORed;
56 | char *FileInMemory;
57 | unsigned int MemoryLength;
58 | unsigned int FileLen;
59 | };
60 |
61 |
62 | #endif /* uMod_FILE_H_ */
63 |
--------------------------------------------------------------------------------
/uMod_GUI/uMod_GUI.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #ifndef uMod_GUI_H_
22 | #define uMod_GUI_H_
23 |
24 |
25 | #include "uMod_Main.h"
26 |
27 | class uMod_Frame : public wxFrame
28 | {
29 | public:
30 | uMod_Frame(const wxString& title, uMod_Settings &set);
31 | ~uMod_Frame(void);
32 |
33 |
34 |
35 | void OnAddGame( wxCommandEvent &event);
36 | void OnDeleteGame( wxCommandEvent &event);
37 |
38 | void OnClose(wxCloseEvent& WXUNUSED(event));
39 |
40 |
41 | void OnButtonOpen(wxCommandEvent& WXUNUSED(event));
42 | void OnButtonPath(wxCommandEvent& WXUNUSED(event));
43 | void OnButtonUpdate(wxCommandEvent& WXUNUSED(event));
44 | void OnButtonReload(wxCommandEvent& WXUNUSED(event));
45 |
46 | void OnMenuStartGame( wxCommandEvent &event);
47 |
48 | void OnMenuUseHook( wxCommandEvent &event);
49 | void OnMenuAddGame(wxCommandEvent& WXUNUSED(event));
50 | void OnMenuDeleteGame(wxCommandEvent& WXUNUSED(event));
51 |
52 | void OnMenuOpenTemplate(wxCommandEvent& WXUNUSED(event));
53 | void OnMenuSaveTemplate(wxCommandEvent& WXUNUSED(event));
54 | void OnMenuSaveTemplateAs(wxCommandEvent& WXUNUSED(event));
55 | void OnMenuSetDefaultTemplate(wxCommandEvent& WXUNUSED(event));
56 | void OnMenuLanguage(wxCommandEvent& WXUNUSED(event));
57 |
58 | void OnMenuExit(wxCommandEvent& WXUNUSED(event));
59 |
60 | void OnMenuHelp(wxCommandEvent& WXUNUSED(event));
61 | void OnMenuAbout(wxCommandEvent& WXUNUSED(event));
62 | void OnMenuAcknowledgement(wxCommandEvent& WXUNUSED(event));
63 |
64 | private:
65 |
66 | int ActivateGamesControl(void);
67 | int DeactivateGamesControl(void);
68 |
69 | uMod_Settings Settings;
70 | int KillServer(void);
71 | int GetHookedGames( wxArrayString &array);
72 | int SetHookedGames( const wxArrayString &array);
73 |
74 | int GetInjectedGames( wxArrayString &games, wxArrayString &cmd);
75 | int SetInjectedGames( wxArrayString &games, wxArrayString &cmd);
76 |
77 | uMod_Server *Server;
78 |
79 | wxNotebook *Notebook;
80 |
81 |
82 | wxButton *OpenButton;
83 | wxButton *DirectoryButton;
84 | wxButton *UpdateButton;
85 | wxButton *ReloadButton;
86 |
87 |
88 | wxMenuBar *MenuBar;
89 | wxMenu *MenuMain;
90 | wxMenu *MenuHelp;
91 |
92 | wxBoxSizer *MainSizer;
93 | wxBoxSizer *ButtonSizer;
94 |
95 |
96 | int NumberOfGames;
97 | int MaxNumberOfGames;
98 | uMod_Client **Clients;
99 |
100 | int LoadTemplate(void);
101 | int SaveTemplate(void);
102 | wxArrayString SaveFile_Exe;
103 | wxArrayString SaveFile_Name;
104 |
105 |
106 | void InstallHook(void);
107 | void RemoveHook(void);
108 |
109 | HMODULE H_DX9_DLL;
110 |
111 | wxString LastError;
112 |
113 | DECLARE_EVENT_TABLE();
114 | };
115 |
116 | class MyApp : public wxApp
117 | {
118 | public:
119 | virtual ~MyApp();
120 | virtual bool OnInit();
121 |
122 | private:
123 | HANDLE CheckForSingleRun;
124 | };
125 |
126 |
127 |
128 |
129 | #endif
130 |
--------------------------------------------------------------------------------
/uMod_GUI/uMod_GameInfo.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #include "uMod_Main.h"
22 |
23 |
24 |
25 | uMod_GameInfo::uMod_GameInfo(void)
26 | {
27 | Checked = NULL;
28 | NumberOfChecked = 0;
29 | LengthOfChecked = 0;
30 | Init();
31 | }
32 |
33 |
34 | uMod_GameInfo::~uMod_GameInfo(void)
35 | {
36 | if (Checked!=NULL) delete [] Checked;
37 | }
38 |
39 | void uMod_GameInfo::Init(void)
40 | {
41 | SaveSingleTexture = false;
42 | SaveAllTextures = false;
43 |
44 | KeyBack = -1;
45 | KeySave = -1;
46 | KeyNext = -1;
47 | FontColour[0]=255;FontColour[1]=0;FontColour[2]=0;
48 | TextureColour[0]=0;TextureColour[1]=255;TextureColour[2]=0;
49 | NumberOfChecked = 0;
50 | SavePath.Empty();
51 | OpenPath.Empty();
52 | Files.Empty();
53 | }
54 |
55 | int uMod_GameInfo::SaveToFile( const wxString &file_name)
56 | {
57 | wxFile file;
58 |
59 | //if (!file.Access(name, wxFile::write)) return -1;
60 | file.Open(file_name, wxFile::write);
61 | if (!file.IsOpened()) {return -1;}
62 |
63 | wxString content;
64 | if (SavePath.Len()>0)
65 | {
66 | content.Printf( L"SavePath:%ls\n", SavePath.wc_str());
67 | file.Write( content.char_str(), content.Len());
68 | }
69 |
70 | if (OpenPath.Len()>0)
71 | {
72 | content.Printf( L"OpenPath:%ls\n", OpenPath.wc_str());
73 | file.Write( content.char_str(), content.Len());
74 | }
75 |
76 | content.Printf( L"SaveAllTextures:%d\nSaveSingleTexture:%d\n", SaveAllTextures, SaveSingleTexture);
77 | file.Write( content.char_str(), content.Len());
78 |
79 | if (KeyBack>=0)
80 | {
81 | content.Printf( L"KeyBack:%d\n", KeyBack);
82 | file.Write( content.char_str(), content.Len());
83 | }
84 | if (KeySave>=0)
85 | {
86 | content.Printf( L"KeySave:%d\n", KeySave);
87 | file.Write( content.char_str(), content.Len());
88 | }
89 | if (KeyNext>=0)
90 | {
91 | content.Printf( L"KeyNext:%d\n", KeyNext);
92 | file.Write( content.char_str(), content.Len());
93 | }
94 |
95 | content.Printf( L"FontColour:%d,%d,%d\n", FontColour[0], FontColour[1], FontColour[2]);
96 | file.Write( content.char_str(), content.Len());
97 | content.Printf( L"TextureColour:%d,%d,%d\n", TextureColour[0], TextureColour[1], TextureColour[2]);
98 | file.Write( content.char_str(), content.Len());
99 |
100 | int num = Files.GetCount();
101 |
102 | for (int i=0; i=LengthOfChecked)
249 | {
250 | bool *t_bool;
251 | try {t_bool = new bool [LengthOfChecked+100];}
252 | catch (...) {return -1;}
253 | for (int i=0; iLengthOfChecked)
273 | {
274 | if (Checked!=NULL) delete [] Checked;
275 | try {Checked = new bool [num+100];}
276 | catch (...) {Checked=NULL; LengthOfChecked = 0; return -1;}
277 | LengthOfChecked = num+100;
278 | }
279 | for (int i=0; i.
17 | */
18 |
19 |
20 |
21 | #ifndef uMod_GAME_H_
22 | #define uMod_GAME_H_
23 | #include "uMod_Main.h"
24 |
25 | //this class is intended as a storing object for each game
26 | // one should ad an assignment operator, loading and saving default values, ...
27 | class uMod_GameInfo
28 | {
29 | public:
30 | uMod_GameInfo(void);
31 | ~uMod_GameInfo(void);
32 | void Init(void);
33 |
34 |
35 | int SaveToFile( const wxString &file_name);
36 | int LoadFromFile( const wxString &file_name);
37 |
38 | int GetChecked( bool* array, int num) const;
39 | int SetChecked( bool* array, int num);
40 |
41 | int SetSaveSingleTexture(bool val);
42 | bool GetSaveSingleTexture(void) const {return SaveSingleTexture;}
43 |
44 | int SetSaveAllTextures(bool val);
45 | bool GetSaveAllTextures(void) const {return SaveAllTextures;}
46 |
47 | void SetFiles(const wxArrayString &files);
48 | void GetFiles( wxArrayString &files) const;
49 | //void AddTexture( const wxString &textures);
50 |
51 | int GetNumberOfFiles(void) const {return Files.GetCount();}
52 |
53 | int SendTextures(void);
54 |
55 | int GetKeyBack() const {return KeyBack;}
56 | int SetKeyBack(int key) {KeyBack=key; return 0;}
57 |
58 | int GetKeySave() const {return KeySave;}
59 | int SetKeySave(int key) {KeySave=key; return 0;}
60 |
61 | int GetKeyNext() const {return KeyNext;}
62 | int SetKeyNext(int key) {KeyNext=key; return 0;}
63 |
64 | int SetFontColour(const int *colour) {FontColour[0]=colour[0];FontColour[1]=colour[1];FontColour[2]=colour[2];return 0;}
65 | int GetFontColour(int *colour) const {colour[0]=FontColour[0];colour[1]=FontColour[1];colour[2]=FontColour[2];return 0;}
66 |
67 | int SetTextureColour(const int *colour) {TextureColour[0]=colour[0];TextureColour[1]=colour[1];TextureColour[2]=colour[2];return 0;}
68 | int GetTextureColour(int *colour) const {colour[0]=TextureColour[0];colour[1]=TextureColour[1];colour[2]=TextureColour[2];return 0;}
69 |
70 | int SetOpenPath(const wxString &path) {OpenPath=path; return 0;}
71 | wxString GetOpenPath(void) const {return OpenPath;}
72 |
73 | int SetSavePath(const wxString &path) {SavePath=path; return 0;}
74 | wxString GetSavePath(void) const {return SavePath;}
75 |
76 | uMod_GameInfo& operator = (const uMod_GameInfo &rhs);
77 |
78 | private:
79 |
80 | bool *Checked;
81 | int NumberOfChecked;
82 | int LengthOfChecked;
83 |
84 | bool SaveSingleTexture;
85 | bool SaveAllTextures;
86 |
87 | wxArrayString Files;
88 |
89 | int KeyBack;
90 | int KeySave;
91 | int KeyNext;
92 |
93 | int FontColour[3];
94 | int TextureColour[3];
95 |
96 | wxString OpenPath;
97 | wxString SavePath;
98 | };
99 |
100 |
101 | #endif /* uMod_SERVER_H_ */
102 |
--------------------------------------------------------------------------------
/uMod_GUI/uMod_GamePage.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #ifndef uMod_GAMEPAGE_H_
22 | #define uMod_GAMEPAGE_H_
23 | #include "uMod_Main.h"
24 |
25 | // this page is opened if a game is started.
26 | class uMod_GamePage : public wxScrolledWindow
27 | {
28 | public:
29 | uMod_GamePage( wxNotebook *parent, const wxString &exe, const wxString &save, PipeStruct &pipe);
30 | virtual ~uMod_GamePage(void);
31 |
32 | int AddTexture( const wxString &file_name);
33 |
34 | int UpdateGame(void);
35 | int ReloadGame(void);
36 |
37 | int SaveTemplate( const wxString &file_name);
38 | int LoadTemplate( const wxString &file_name);
39 |
40 | wxString GetExeName(void) {return ExeName;}
41 | wxString GetTemplateName(void) {return TemplateName;}
42 |
43 | int SetOpenPath(const wxString &path) {return Game.SetOpenPath(path);}
44 | wxString GetOpenPath(void) {return Game.GetOpenPath();}
45 |
46 | int SetSavePath(const wxString &path);
47 | wxString GetSavePath(void) {return Game.GetSavePath();}
48 |
49 |
50 | void OnButtonUp(wxCommandEvent& WXUNUSED(event));
51 | void OnButtonDown(wxCommandEvent& WXUNUSED(event));
52 | void OnButtonDelete(wxCommandEvent& WXUNUSED(event));
53 |
54 | int UpdateLanguage(void);
55 |
56 | wxString LastError;
57 |
58 | private:
59 |
60 | int GetSettings(void);
61 | int SetColour( wxTextCtrl** txt, int *colour);
62 | int GetColour( wxTextCtrl* txt, int def);
63 |
64 | wxString ExeName;
65 | wxString TemplateName;
66 |
67 | wxBoxSizer *SizerKeys[2];
68 | wxTextCtrl *TextKeyBack;
69 | wxTextCtrl *TextKeySave;
70 | wxTextCtrl *TextKeyNext;
71 | wxChoice *ChoiceKeyBack;
72 | wxChoice *ChoiceKeySave;
73 | wxChoice *ChoiceKeyNext;
74 |
75 | wxBoxSizer *FontColourSizer;
76 | wxTextCtrl *FontColour[4];
77 | wxBoxSizer *TextureColourSizer;
78 | wxTextCtrl *TextureColour[4];
79 |
80 | wxBoxSizer *MainSizer;
81 |
82 | wxTextCtrl *TemplateFile;
83 | wxCheckBox *SaveAllTextures;
84 | wxCheckBox *SaveSingleTexture;
85 | wxTextCtrl *SavePath;
86 |
87 | wxBoxSizer **CheckBoxHSizers;
88 | wxButton **CheckButtonUp;
89 | wxButton **CheckButtonDown;
90 | wxButton **CheckButtonDelete;
91 |
92 | wxCheckBox **CheckBoxes;
93 | int NumberOfEntry;
94 | int MaxNumberOfEntry;
95 |
96 |
97 | wxArrayString Files;
98 | uMod_GameInfo Game;
99 | uMod_GameInfo GameOld;
100 |
101 | uMod_Sender Sender;
102 |
103 |
104 | //DECLARE_EVENT_TABLE();
105 | };
106 |
107 | #endif /* uMod_GAMEPAGE_H_ */
108 |
--------------------------------------------------------------------------------
/uMod_GUI/uMod_Language.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #ifndef uMod_LANGUAGE_H_
22 | #define uMod_LANGUAGE_H_
23 |
24 | class uMod_Language
25 | {
26 | public:
27 | uMod_Language(void);
28 | uMod_Language(const wxString &name);
29 |
30 |
31 | int LoadLanguage(const wxString &name);
32 | int GetLanguages(wxArrayString &lang);
33 | int GetHelpMessage(wxString &help);
34 | wxString GetCurrentLanguage(void) {return CurrentLanguage;}
35 |
36 | wxString MenuLanguage;
37 | wxString MenuHelp;
38 | wxString MenuAbout;
39 | wxString MenuAcknowledgement;
40 | wxString MenuStartGame;
41 | wxString MenuStartGameCMD;
42 | wxString MenuUseHook;
43 | wxString MenuAddGame;
44 | wxString MenuDeleteGame;
45 | wxString MenuLoadTemplate;
46 | wxString MenuSaveTemplate;
47 | wxString MenuSaveTemplateAs;
48 | wxString MenuSetDefaultTemplate;
49 | wxString MenuExit;
50 |
51 | wxString MainMenuMain;
52 | wxString MainMenuHelp;
53 |
54 | wxString ButtonOpen;
55 | wxString ButtonDirectory;
56 | wxString ButtonUpdate;
57 | wxString ButtonReload;
58 |
59 | wxString ChooseFile;
60 | wxString ChooseDir;
61 |
62 | wxString TextCtrlTemplate;
63 | wxString CheckBoxSaveSingleTexture;
64 | wxString CheckBoxSaveAllTextures;
65 | wxString TextCtrlSavePath;
66 |
67 | wxString SelectLanguage;
68 |
69 | wxString StartGame;
70 | wxString CommandLine;
71 |
72 | wxString ChooseGame;
73 | wxString DeleteGame;
74 | wxString GameAlreadyAdded;
75 | wxString ExitGameAnyway;
76 | wxString NoComment;
77 | wxString Author;
78 |
79 | wxString Error_GameIsHooked;
80 | wxString Error_ProcessNotStarted;
81 | wxString Error_RemoveHook;
82 |
83 | wxString Error_FileNotSupported;
84 | wxString Error_FktNotFound;
85 | wxString Error_D3DX9NotFound;
86 | wxString Error_DLLNotFound;
87 | wxString Error_AlreadyRunning;
88 |
89 | wxString Error_Send;
90 | wxString Error_KeyTwice;
91 | wxString Error_NoSavePath;
92 | wxString Error_KeyNotSet;
93 | wxString Error_SaveFile;
94 | wxString Error_NoPipe;
95 | wxString Error_WritePipe;
96 | wxString Error_FlushPipe;
97 | wxString Error_Hash;
98 | wxString Error_FileOpen;
99 | wxString Error_FileRead;
100 | wxString Error_Memory;
101 | wxString Error_Unzip;
102 | wxString Error_ZipEntry;
103 |
104 | wxString KeyBack;
105 | wxString KeySave;
106 | wxString KeyNext;
107 | wxArrayString KeyStrings;
108 | wxArrayInt KeyValues;
109 |
110 |
111 | wxString FontColour;
112 | wxString TextureColour;
113 |
114 |
115 | wxString LastError;
116 |
117 | private:
118 | int LoadDefault(void);
119 | int LoadKeys(void);
120 |
121 | wxString CurrentLanguage;
122 | };
123 |
124 |
125 | extern uMod_Language *Language;
126 |
127 |
128 | #endif /* uMod_LANGUAGE_H_ */
129 |
--------------------------------------------------------------------------------
/uMod_GUI/uMod_Main.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #ifndef uMod_MAIN_H_
22 | #define uMod_MAIN_H_
23 |
24 |
25 | // I use eclipse and somehow i need these define or many of the wx classes are unknown to the CDT parser
26 | #ifdef __CDT_PARSER__
27 | #define HAVE_W32API_H
28 | #define __WXMSW__
29 | #define NOPCH
30 | #define _UNICODE
31 | #define wxUSE_NOTEBOOK 1
32 | #define wxUSE_CHECKBOX 1
33 | #define wxUSE_THREADS 1
34 | #define wxUSE_MSGDLG 1
35 | #define wxUSE_MENUS 1
36 | #define wxUSE_BUTTON 1
37 | #define wxUSE_FILEDLG 1
38 | #define wxUSE_DIRDLG 1
39 | #define wxUSE_CHOICE 1
40 | #define wxUSE_FILE 1
41 | #define wxUSE_TEXTCTRL 1
42 | #define wxUSE_CHOICEDLG 1
43 | #define wxUSE_TOOLTIPS 1
44 | #endif
45 |
46 | #define WINVER _WIN32_WINNT_WINXP
47 | #define _WIN32_WINNT _WIN32_WINNT_WINXP
48 | #define NTDDI_VERSION NTDDI_WINXP
49 | #define WIN32_LEAN_AND_MEAN
50 |
51 |
52 | #include "wx\wx.h"
53 | #include "wx\notebook.h"
54 | #include
55 | #include
56 | #include
57 | #include
58 | //#include
59 | //#include "wx/checkbox.h"
60 | //#include
61 | //#include
62 | //#include
63 | //#include
64 | //#include
65 | //#include
66 | //#include
67 |
68 | //#include
69 |
70 | #include "../uMod_GlobalDefines.h"
71 | #include "../uMod_Error.h"
72 |
73 |
74 | class uMod_Frame;
75 |
76 | #define MAX_TEXTURES 1024
77 | enum
78 | {
79 | ID_Button_Open = wxID_HIGHEST,
80 | ID_Button_Path,
81 | ID_Button_Update,
82 | ID_Button_Reload,
83 | //ID_Button_Save,
84 | //ID_Menu_Pref,
85 | ID_Menu_Exit,
86 | ID_Menu_Lang,
87 | ID_Menu_Help,
88 | ID_Menu_About,
89 | ID_Menu_Acknowledgement,
90 | ID_Menu_StartGame,
91 | ID_Menu_StartGameCMD,
92 | ID_Menu_UseHook,
93 | ID_Menu_AddGame,
94 | ID_Menu_DeleteGame,
95 | ID_Menu_LoadTemplate,
96 | ID_Menu_SaveTemplate,
97 | ID_Menu_SaveTemplateAs,
98 | ID_Menu_SetDefaultTemplate,
99 | ID_Add_Game,
100 | ID_Delete_Game,
101 | ID_Button_Texture, //this entry must be the last!!
102 | };
103 |
104 | #define ABORT_SERVER L"uMod_Abort_Server"
105 | #define uMod_d3d9_Hook_dll L"uMod_d3d9_HI.dll"
106 | #define uMod_d3d9_DI_dll L"uMod_d3d9_DI.dll"
107 |
108 | #include "uMod_AddTexture.h"
109 | #include "uMod_Settings.h"
110 | #include "uMod_Language.h"
111 | #include "uMod_Event.h"
112 | #include "uMod_Client.h"
113 | #include "uMod_GameInfo.h"
114 | #include "uMod_File.h"
115 | #include "uMod_Sender.h"
116 | #include "uMod_Server.h"
117 | #include "uMod_GamePage.h"
118 | #include "uMod_DirectInjection.h"
119 | #include "uMod_GUI.h"
120 |
121 |
122 | template
123 | int GetMemory(T* &array, int num)
124 | {
125 | if (array!=(T*)0) delete [] array;
126 | try {array = new T[num];}
127 | catch (...) {array = (T*) 0; return -1;}
128 | return 0;
129 | }
130 |
131 | template
132 | int GetMemory(T* &array, int num, T init)
133 | {
134 | if (array!=(T*)0) delete [] array;
135 | try {array = new T[num];}
136 | catch (...) {array = (T*) 0; return -1;}
137 | for (int i=0; i
142 | int GetMoreMemory(T* &old_array, int old_num, int new_num)
143 | {
144 | if (new_num<=old_num) return 0;
145 | T* new_array;
146 | try {new_array = new T[new_num];}
147 | catch (...) {return -1;}
148 | if (old_array!=(T*)0)
149 | {
150 | for (int i=0; i.
17 | */
18 |
19 |
20 |
21 | #ifndef uMod_SENDER_H_
22 | #define uMod_SENDER_H_
23 |
24 | #include "uMod_Main.h"
25 |
26 |
27 | // an object of this class is owned by each uMod_GamePage object. It act as sender ^^
28 | class uMod_Sender
29 | {
30 | public:
31 | uMod_Sender(PipeStruct &pipe);
32 | ~uMod_Sender(void);
33 |
34 | int Send( const uMod_GameInfo &game, const uMod_GameInfo &game_old, bool force=false, wxArrayString *comments=NULL);
35 |
36 | wxString LastError;
37 |
38 | private:
39 | int SendSaveAllTextures(bool val);
40 | int SendSaveSingleTexture(bool val);
41 |
42 | int SendTextures(unsigned int num, AddTextureClass *tex);
43 |
44 | int SendKey(int key, int ctr);
45 |
46 | int SendPath( const wxString &path);
47 |
48 | int SendColour( int* colour, int ctr);
49 |
50 | char *Buffer;
51 | int SendToGame( void* msg, unsigned long len);
52 |
53 | int AddFile( AddTextureClass *tex, wxString file, bool add, bool force);
54 | int AddZip( AddTextureClass *tex, wxString file, bool add, bool force, bool tpf);
55 | int AddContent( char* buffer, unsigned int len, const char* pw, AddTextureClass *tex, bool add, bool force);
56 |
57 | PipeStruct &Pipe;
58 | AddTextureClass *OldTextures;
59 | int OldTexturesNum;
60 | };
61 |
62 |
63 | #endif /* uMod_SENDER_H_ */
64 |
--------------------------------------------------------------------------------
/uMod_GUI/uMod_Server.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #include "uMod_Main.h"
22 |
23 |
24 | uMod_Server::uMod_Server(uMod_Frame *frame) : wxThread(wxTHREAD_JOINABLE)
25 | {
26 | MainFrame = frame;
27 | }
28 |
29 |
30 | uMod_Server::~uMod_Server(void)
31 | {
32 | }
33 |
34 |
35 | void* uMod_Server::Entry(void)
36 | {
37 | bool fConnected = false;
38 | HANDLE pipe_in;
39 | HANDLE pipe_out;
40 | char buffer[SMALL_BUFSIZE];
41 | wxString abort = ABORT_SERVER;
42 |
43 | while(1)
44 | {
45 | /*
46 | Beep(300,100);
47 | Beep(600,100);
48 | */
49 | pipe_in = CreateNamedPipeW(
50 | PIPE_Game2uMod, // pipe name
51 | PIPE_ACCESS_INBOUND, // read access
52 | PIPE_TYPE_BYTE | // byte type pipe
53 | PIPE_WAIT, // blocking mode
54 | PIPE_UNLIMITED_INSTANCES, // max. instances
55 | SMALL_BUFSIZE, // output buffer size
56 | SMALL_BUFSIZE, // input buffer size
57 | 0, // client time-out
58 | NULL); // default security attribute
59 | if (pipe_in == INVALID_HANDLE_VALUE) return NULL;
60 |
61 | pipe_out = CreateNamedPipeW(
62 | PIPE_uMod2Game, // pipe name
63 | PIPE_ACCESS_OUTBOUND, // write access
64 | PIPE_TYPE_BYTE | // byte type pipe
65 | PIPE_WAIT, // blocking mode
66 | PIPE_UNLIMITED_INSTANCES, // max. instances
67 | BIG_BUFSIZE, // output buffer size
68 | BIG_BUFSIZE, // input buffer size
69 | 0, // client time-out
70 | NULL); // default security attribute
71 | if (pipe_out == INVALID_HANDLE_VALUE) return NULL;
72 |
73 |
74 | // at first connect to the incoming pipe !!!
75 | fConnected = ConnectNamedPipe(pipe_in, NULL) ?
76 | true : (GetLastError() == ERROR_PIPE_CONNECTED);
77 | /*
78 | Beep(900,100);
79 | Beep(600,100);
80 | Beep(300,100);
81 | */
82 | if (fConnected)
83 | {
84 | unsigned long num = 0;
85 | //read the name of the game
86 | bool fSuccess = ReadFile(
87 | pipe_in, // handle to pipe
88 | buffer, // buffer to receive data
89 | SMALL_BUFSIZE, // size of buffer
90 | &num, // number of bytes read
91 | NULL); // not overlapped I/O
92 |
93 | if (fSuccess)
94 | {
95 | if (num>2)
96 | {
97 | buffer[num]=0;
98 | buffer[num-1]=0;
99 | wxString name = (wchar_t*) buffer;
100 |
101 | if (name==abort) // kill this server thread
102 | {
103 | //Beep(1200,300);
104 | CloseHandle(pipe_in);
105 | return NULL;
106 | }
107 |
108 |
109 | fConnected = ConnectNamedPipe(pipe_out, NULL) ?
110 | true : (GetLastError() == ERROR_PIPE_CONNECTED);
111 | if (fConnected)
112 | {
113 | uMod_Event event( uMod_EVENT_TYPE, ID_Add_Game);
114 | event.SetName(name);
115 | event.SetPipeIn(pipe_in);
116 | event.SetPipeOut(pipe_out);
117 | wxPostEvent( MainFrame, event);
118 | }
119 | else
120 | {
121 | CloseHandle(pipe_in);
122 | CloseHandle(pipe_out);
123 | return NULL;
124 | }
125 | }
126 | }
127 | }
128 | else CloseHandle(pipe_in);
129 | }
130 | return NULL;
131 | }
132 |
133 |
--------------------------------------------------------------------------------
/uMod_GUI/uMod_Server.h:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #ifndef uMod_SERVER_H_
22 | #define uMod_SERVER_H_
23 | #include "uMod_Main.h"
24 |
25 | // an object of this class should be created only once
26 | // it waits for incomming connections (a starting game)
27 | // and if so, it send a message to the mainthread
28 |
29 | // Note the server thread can only be killed, if one connect to it and send "uMod_ABORT" as game name
30 | class uMod_Server : public wxThread
31 | {
32 | public:
33 | uMod_Server(uMod_Frame *frame);
34 | virtual ~uMod_Server(void);
35 |
36 |
37 | void* Entry(void);
38 |
39 | private:
40 |
41 | uMod_Frame *MainFrame;
42 | };
43 |
44 |
45 | #endif /* uMod_SERVER_H_ */
46 |
--------------------------------------------------------------------------------
/uMod_GUI/uMod_Settings.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | This file is part of Universal Modding Engine.
3 |
4 |
5 | Universal Modding Engine is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Universal Modding Engine is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with Universal Modding Engine. If not, see .
17 | */
18 |
19 |
20 |
21 | #include "uMod_Main.h"
22 |
23 |
24 | uMod_Settings::uMod_Settings(void)
25 | {
26 | XSize = 600;
27 | YSize = 400;
28 | XPos = -1;
29 | YPos = -1;
30 | UseHook = false;
31 | Language = "English";
32 | }
33 |
34 | uMod_Settings::uMod_Settings(uMod_Settings &set)
35 | {
36 | XSize = set.XSize;
37 | YSize = set.YSize;
38 | XPos = set.XPos;
39 | YPos = set.YPos;
40 | UseHook = set.UseHook;
41 | Language = set.Language;
42 | }
43 |
44 |
45 | #define SETTINGS_FILE "uMod_Settings.txt"
46 |
47 | int uMod_Settings::Load(void)
48 | {
49 | wxFile file;
50 |
51 | if (!file.Access(SETTINGS_FILE, wxFile::read)) {return -1;}
52 | file.Open(SETTINGS_FILE, wxFile::read);
53 | if (!file.IsOpened()) return -1;
54 |
55 | unsigned len = file.Length();
56 |
57 | unsigned char* buffer;
58 | try {buffer = new unsigned char [len+2];}
59 | catch (...) {return -1;}
60 |
61 | unsigned int result = file.Read( buffer, len);
62 | file.Close();
63 |
64 | if (result != len) {delete [] buffer; return -1;}
65 |
66 | wchar_t *buff = (wchar_t*)buffer;
67 | len/=2;
68 | buff[len]=0;
69 |
70 | wxString content;
71 | content = buff;
72 | delete [] buffer;
73 |
74 | wxStringTokenizer token( content, "\n");
75 |
76 | int num = token.CountTokens();
77 | wxString line;
78 | wxString command;
79 | wxString value;
80 |
81 | UseHook = false;
82 | for (int i=0; i.
17 | */
18 |
19 |
20 | #ifndef uMod_SETTINGS_H_
21 | #define uMod_SETTINGS_H_
22 |
23 |
24 | #include "uMod_Main.h"
25 |
26 | class uMod_Settings
27 | {
28 | public:
29 | uMod_Settings(void);
30 | uMod_Settings(uMod_Settings &set);
31 |
32 |
33 | int XSize, YSize;
34 | int XPos, YPos;
35 | bool UseHook;
36 | wxString Language;
37 |
38 | int Load(void);
39 | int Save(void);
40 |
41 | };
42 |
43 |
44 | #endif /* uMod_SETTINGS_H_ */
45 |
--------------------------------------------------------------------------------
/uMod_GUI/unzip.h:
--------------------------------------------------------------------------------
1 | #ifndef _unzip_H
2 | #define _unzip_H
3 | //#define TCHAR char
4 | // UNZIPPING functions -- for unzipping.
5 | // This file is a repackaged form of extracts from the zlib code available
6 | // at www.gzip.org/zlib, by Jean-Loup Gailly and Mark Adler. The original
7 | // copyright notice may be found in unzip.cpp. The repackaging was done
8 | // by Lucian Wischik to simplify and extend its use in Windows/C++. Also
9 | // encryption and unicode filenames have been added.
10 |
11 |
12 | #ifndef _zip_H
13 | DECLARE_HANDLE(HZIP);
14 | #endif
15 | // An HZIP identifies a zip file that has been opened
16 |
17 | typedef DWORD ZRESULT;
18 | // return codes from any of the zip functions. Listed later.
19 |
20 | typedef struct
21 | { int index; // index of this file within the zip
22 | TCHAR name[MAX_PATH]; // filename within the zip
23 | DWORD attr; // attributes, as in GetFileAttributes.
24 | FILETIME atime,ctime,mtime;// access, create, modify filetimes
25 | long comp_size; // sizes of item, compressed and uncompressed. These
26 | long unc_size; // may be -1 if not yet known (e.g. being streamed in)
27 | } ZIPENTRY;
28 |
29 |
30 | HZIP OpenZip(const TCHAR *fn, const char *password);
31 | HZIP OpenZip(void *z,unsigned int len, const char *password);
32 | HZIP OpenZipHandle(HANDLE h, const char *password);
33 | // OpenZip - opens a zip file and returns a handle with which you can
34 | // subsequently examine its contents. You can open a zip file from:
35 | // from a pipe: OpenZipHandle(hpipe_read,0);
36 | // from a file (by handle): OpenZipHandle(hfile,0);
37 | // from a file (by name): OpenZip("c:\\test.zip","password");
38 | // from a memory block: OpenZip(bufstart, buflen,0);
39 | // If the file is opened through a pipe, then items may only be
40 | // accessed in increasing order, and an item may only be unzipped once,
41 | // although GetZipItem can be called immediately before and after unzipping
42 | // it. If it's opened in any other way, then full random access is possible.
43 | // Note: pipe input is not yet implemented.
44 | // Note: zip passwords are ascii, not unicode.
45 | // Note: for windows-ce, you cannot close the handle until after CloseZip.
46 | // but for real windows, the zip makes its own copy of your handle, so you
47 | // can close yours anytime.
48 |
49 | ZRESULT GetZipItem(HZIP hz, int index, ZIPENTRY *ze);
50 | // GetZipItem - call this to get information about an item in the zip.
51 | // If index is -1 and the file wasn't opened through a pipe,
52 | // then it returns information about the whole zipfile
53 | // (and in particular ze.index returns the number of index items).
54 | // Note: the item might be a directory (ze.attr & FILE_ATTRIBUTE_DIRECTORY)
55 | // See below for notes on what happens when you unzip such an item.
56 | // Note: if you are opening the zip through a pipe, then random access
57 | // is not possible and GetZipItem(-1) fails and you can't discover the number
58 | // of items except by calling GetZipItem on each one of them in turn,
59 | // starting at 0, until eventually the call fails. Also, in the event that
60 | // you are opening through a pipe and the zip was itself created into a pipe,
61 | // then then comp_size and sometimes unc_size as well may not be known until
62 | // after the item has been unzipped.
63 |
64 | ZRESULT FindZipItem(HZIP hz, const TCHAR *name, bool ic, int *index, ZIPENTRY *ze);
65 | // FindZipItem - finds an item by name. ic means 'insensitive to case'.
66 | // It returns the index of the item, and returns information about it.
67 | // If nothing was found, then index is set to -1 and the function returns
68 | // an error code.
69 |
70 | ZRESULT UnzipItem(HZIP hz, int index, const TCHAR *fn);
71 | ZRESULT UnzipItem(HZIP hz, int index, void *z,unsigned int len);
72 | ZRESULT UnzipItemHandle(HZIP hz, int index, HANDLE h);
73 | // UnzipItem - given an index to an item, unzips it. You can unzip to:
74 | // to a pipe: UnzipItemHandle(hz,i, hpipe_write);
75 | // to a file (by handle): UnzipItemHandle(hz,i, hfile);
76 | // to a file (by name): UnzipItem(hz,i, ze.name);
77 | // to a memory block: UnzipItem(hz,i, buf,buflen);
78 | // In the final case, if the buffer isn't large enough to hold it all,
79 | // then the return code indicates that more is yet to come. If it was
80 | // large enough, and you want to know precisely how big, GetZipItem.
81 | // Note: zip files are normally stored with relative pathnames. If you
82 | // unzip with ZIP_FILENAME a relative pathname then the item gets created
83 | // relative to the current directory - it first ensures that all necessary
84 | // subdirectories have been created. Also, the item may itself be a directory.
85 | // If you unzip a directory with ZIP_FILENAME, then the directory gets created.
86 | // If you unzip it to a handle or a memory block, then nothing gets created
87 | // and it emits 0 bytes.
88 | ZRESULT SetUnzipBaseDir(HZIP hz, const TCHAR *dir);
89 | // if unzipping to a filename, and it's a relative filename, then it will be relative to here.
90 | // (defaults to current-directory).
91 |
92 |
93 | ZRESULT CloseZip(HZIP hz);
94 | // CloseZip - the zip handle must be closed with this function.
95 |
96 | unsigned int FormatZipMessage(ZRESULT code, TCHAR *buf,unsigned int len);
97 | // FormatZipMessage - given an error code, formats it as a string.
98 | // It returns the length of the error message. If buf/len points
99 | // to a real buffer, then it also writes as much as possible into there.
100 |
101 |
102 | // These are the result codes:
103 | #define ZR_OK 0x00000000 // nb. the pseudo-code zr-recent is never returned,
104 | #define ZR_RECENT 0x00000001 // but can be passed to FormatZipMessage.
105 | // The following come from general system stuff (e.g. files not openable)
106 | #define ZR_GENMASK 0x0000FF00
107 | #define ZR_NODUPH 0x00000100 // couldn't duplicate the handle
108 | #define ZR_NOFILE 0x00000200 // couldn't create/open the file
109 | #define ZR_NOALLOC 0x00000300 // failed to allocate some resource
110 | #define ZR_WRITE 0x00000400 // a general error writing to the file
111 | #define ZR_NOTFOUND 0x00000500 // couldn't find that file in the zip
112 | #define ZR_MORE 0x00000600 // there's still more data to be unzipped
113 | #define ZR_CORRUPT 0x00000700 // the zipfile is corrupt or not a zipfile
114 | #define ZR_READ 0x00000800 // a general error reading the file
115 | #define ZR_PASSWORD 0x00001000 // we didn't get the right password to unzip the file
116 | // The following come from mistakes on the part of the caller
117 | #define ZR_CALLERMASK 0x00FF0000
118 | #define ZR_ARGS 0x00010000 // general mistake with the arguments
119 | #define ZR_NOTMMAP 0x00020000 // tried to ZipGetMemory, but that only works on mmap zipfiles, which yours wasn't
120 | #define ZR_MEMSIZE 0x00030000 // the memory size is too small
121 | #define ZR_FAILED 0x00040000 // the thing was already failed when you called this function
122 | #define ZR_ENDED 0x00050000 // the zip creation has already been closed
123 | #define ZR_MISSIZE 0x00060000 // the indicated input file size turned out mistaken
124 | #define ZR_PARTIALUNZ 0x00070000 // the file had already been partially unzipped
125 | #define ZR_ZMODE 0x00080000 // tried to mix creating/opening a zip
126 | // The following come from bugs within the zip library itself
127 | #define ZR_BUGMASK 0xFF000000
128 | #define ZR_NOTINITED 0x01000000 // initialisation didn't work
129 | #define ZR_SEEK 0x02000000 // trying to seek in an unseekable file
130 | #define ZR_NOCHANGE 0x04000000 // changed its mind on storage, but not allowed
131 | #define ZR_FLATE 0x05000000 // an internal error in the de/inflation code
132 |
133 |
134 |
135 |
136 |
137 | // e.g.
138 | //
139 | // SetCurrentDirectory("c:\\docs\\stuff");
140 | // HZIP hz = OpenZip("c:\\stuff.zip",0);
141 | // ZIPENTRY ze; GetZipItem(hz,-1,&ze); int numitems=ze.index;
142 | // for (int i=0; i.
17 | */
18 |
19 | #ifndef uMod_GlobalDefines_H_
20 | #define uMod_GlobalDefines_H_
21 |
22 | //#define MyTypeHash DWORD64
23 | #define MyTypeHash DWORD32
24 |
25 | #define BIG_BUFSIZE 1<<24
26 | #define SMALL_BUFSIZE 1<<10
27 |
28 | typedef struct
29 | {
30 | unsigned int Control;
31 | unsigned int Value;
32 | MyTypeHash Hash;
33 | } MsgStruct;
34 |
35 | typedef struct
36 | {
37 | HANDLE In;
38 | HANDLE Out;
39 | } PipeStruct;
40 |
41 |
42 | #define uMod_APP_DX9 L"uMod_DX9.txt"
43 | #define uMod_APP_DIR L"uMod"
44 | #define uMod_VERSION L"uMod V 1.0"
45 |
46 | #define PIPE_uMod2Game L"\\\\.\\pipe\\uMod2Game"
47 | #define PIPE_Game2uMod L"\\\\.\\pipe\\Game2uMod"
48 |
49 | #define CONTROL_ADD_TEXTURE 1
50 | #define CONTROL_FORCE_RELOAD_TEXTURE 2
51 | #define CONTROL_REMOVE_TEXTURE 3
52 | #define CONTROL_FORCE_RELOAD_TEXTURE_DATA 4
53 | #define CONTROL_ADD_TEXTURE_DATA 5
54 | #define CONTROL_MORE_TEXTURES 6
55 |
56 |
57 | #define CONTROL_SAVE_ALL 10
58 | #define CONTROL_SAVE_SINGLE 11
59 | #define CONTROL_SET_DIR 12
60 |
61 | #define CONTROL_KEY_BACK 20
62 | #define CONTROL_KEY_SAVE 21
63 | #define CONTROL_KEY_NEXT 22
64 |
65 | #define CONTROL_FONT_COLOUR 30
66 | #define CONTROL_TEXTURE_COLOUR 31
67 |
68 |
69 |
70 |
71 | #endif
72 |
--------------------------------------------------------------------------------