The unzip function is still buggy!!

BugFix:
- removed CheckBoxVSizer, it was unused, but object were detached
- correct estimation of the number of hash entries in OTM_Sender::SendTextures

Improvements:
- added a comment support for tpf and zip files
This commit is contained in:
code@koerner-de.net
2011-10-04 20:08:45 +00:00
parent 3e30507ad4
commit 8d4ab8963f
31 changed files with 1267 additions and 766 deletions
+7 -8
View File
@@ -1,8 +1,4 @@
* text=auto !eol
OTM_DX9/.cproject -text
OTM_DX9/.project -text
OTM_DX9/.settings/org.eclipse.cdt.codan.core.prefs -text
OTM_DX9/.settings/org.eclipse.cdt.managedbuilder.core.prefs -text
OTM_DX9/OTM_ArrayHandler.cpp -text
OTM_DX9/OTM_ArrayHandler.h -text
OTM_DX9/OTM_DX9_dll.cpp -text
@@ -21,16 +17,17 @@ OTM_DX9/OTM_TextureClient.cpp -text
OTM_DX9/OTM_TextureClient.h -text
OTM_DX9/OTM_TextureServer.cpp -text
OTM_DX9/OTM_TextureServer.h -text
OTM_DX9/makefile -text
OTM_DX9/makefile.gcc -text
OTM_DX9/makefile.vc -text
/OTM_Error.h -text
OTM_GUI/.cproject -text
OTM_GUI/.project -text
OTM_GUI/OTM.ico -text
OTM_GUI/OTM.rc -text
OTM_GUI/OTM_Client.cpp -text
OTM_GUI/OTM_Client.h -text
OTM_GUI/OTM_Event.cpp -text
OTM_GUI/OTM_Event.h -text
OTM_GUI/OTM_File.cpp -text
OTM_GUI/OTM_File.h -text
OTM_GUI/OTM_GUI.cpp -text
OTM_GUI/OTM_GUI.h -text
OTM_GUI/OTM_GameInfo.cpp -text
@@ -49,7 +46,9 @@ OTM_GUI/bin/OTM_LanguagePack_Deutsch.txt -text
OTM_GUI/bin/README_Deutsch.txt -text
OTM_GUI/bin/README_English.txt -text
OTM_GUI/config.gcc -text
OTM_GUI/makefile -text
OTM_GUI/config.vc -text
OTM_GUI/makefile.gcc -text
OTM_GUI/makefile.vc -text
OTM_GUI/unzip.cpp -text
OTM_GUI/unzip.h -text
OTM_GUI/zip.cpp -text
-87
View File
@@ -1,87 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="0.73276285">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.73276285" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="OTM_DX9" buildProperties="" description="" errorParsers="org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.VCErrorParser;org.eclipse.cdt.core.CWDLocator" id="0.73276285" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.73276285." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.msvc.toolchain.dll.debug.2061447385" name="Microsoft Visual C++" superClass="org.eclipse.cdt.msvc.toolchain.dll.debug">
<targetPlatform id="org.eclipse.cdt.msvc.targetPlatform.dll.debug.233121915" superClass="org.eclipse.cdt.msvc.targetPlatform.dll.debug"/>
<builder buildPath="${workspace_loc:/OTM_DX9/Default}" enableAutoBuild="true" id="org.eclipse.cdt.msvc.builder.1963474156" keepEnvironmentInBuildfile="false" name="CDT Internal Builder" superClass="org.eclipse.cdt.msvc.builder"/>
<tool id="org.eclipse.cdt.msvc.cl.dll.debug.2125566236" name="C/C++ Compiler (cl)" superClass="org.eclipse.cdt.msvc.cl.dll.debug">
<option id="org.eclipse.cdt.msvc.cl.option.includes.488419284" name="Include Path (/I)" superClass="org.eclipse.cdt.msvc.cl.option.includes" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include}&quot;"/>
</option>
<inputType id="org.eclipse.cdt.msvc.cl.inputType.302322857" superClass="org.eclipse.cdt.msvc.cl.inputType"/>
</tool>
<tool id="org.eclipse.cdt.msvc.rc.dll.debug.1873418054" name="Resource Compiler (rc)" superClass="org.eclipse.cdt.msvc.rc.dll.debug">
<inputType id="org.eclipse.cdt.msvc.rc.inputType.1405536548" superClass="org.eclipse.cdt.msvc.rc.inputType"/>
</tool>
<tool id="org.eclipse.cdt.msvc.link.dll.debug.994080190" name="Linker (link)" superClass="org.eclipse.cdt.msvc.link.dll.debug">
<inputType id="org.eclipse.cdt.msvc.link.inputType.1379149798" superClass="org.eclipse.cdt.msvc.link.inputType"/>
</tool>
<tool id="org.eclipse.cdt.msvc.lib.818899026" name="Library Manager (lib)" superClass="org.eclipse.cdt.msvc.lib"/>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="OTM_DX9.null.509486267" name="OTM_DX9"/>
</storageModule>
<storageModule moduleId="refreshScope" versionNumber="1">
<resource resourceType="PROJECT" workspacePath="/OTM_DX9"/>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.144721211;cdt.managedbuild.config.gnu.mingw.exe.release.144721211.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release.1336891038;cdt.managedbuild.tool.gnu.c.compiler.input.1143368029">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="0.73276285;0.73276285.;org.eclipse.cdt.msvc.cl.dll.debug.2125566236;org.eclipse.cdt.msvc.cl.inputType.302322857">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.msw.build.clScannerInfo"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="org.eclipse.cdt.msvc.dll.release.1931526957;org.eclipse.cdt.msvc.dll.release.1931526957.;org.eclipse.cdt.msvc.cl.dll.release.1770338018;org.eclipse.cdt.msvc.cl.inputType.457704148">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.msw.build.clScannerInfo"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.144721211;cdt.managedbuild.config.gnu.mingw.exe.release.144721211.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.release.1749816749;cdt.managedbuild.tool.gnu.cpp.compiler.input.512600446">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="0.32769032">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="org.eclipse.cdt.msvc.dll.debug.986761609;org.eclipse.cdt.msvc.dll.debug.986761609.;org.eclipse.cdt.msvc.cl.dll.debug.994086239;org.eclipse.cdt.msvc.cl.inputType.520939511">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.msw.build.clScannerInfo"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1686594558;cdt.managedbuild.config.gnu.mingw.exe.debug.1686594558.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.1940399600;cdt.managedbuild.tool.gnu.cpp.compiler.input.1598278097">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="org.eclipse.cdt.msvc.dll.release.1931526957;org.eclipse.cdt.msvc.dll.release.1931526957.;org.eclipse.cdt.msvc.cl.dll.debug.1295277464;org.eclipse.cdt.msvc.cl.inputType.32821312">
<autodiscovery enabled="false" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.msw.build.clScannerInfo"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1686594558;cdt.managedbuild.config.gnu.mingw.exe.debug.1686594558.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.658639258;cdt.managedbuild.tool.gnu.c.compiler.input.1232651667">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="0.73276285">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
</cproject>
-70
View File
@@ -1,70 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>OTM_DX9</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/OTM_DX9/Default}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
@@ -1,67 +0,0 @@
#Mon Aug 22 20:44:58 CEST 2011
eclipse.preferences.version=1
org.eclipse.cdt.codan.checkers.errnoreturn=Warning
org.eclipse.cdt.codan.checkers.errnoreturn.params={implicit\=>false}
org.eclipse.cdt.codan.checkers.errreturnvalue=Error
org.eclipse.cdt.codan.checkers.errreturnvalue.params={}
org.eclipse.cdt.codan.checkers.noreturn=Error
org.eclipse.cdt.codan.checkers.noreturn.params={implicit\=>false}
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error
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}}
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error
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}}
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={}
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={}
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={no_break_comment\=>"no break",last_case_param\=>true,empty_case_param\=>false}
org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={unknown\=>false,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
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}}
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error
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}}
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
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}}
org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error
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}}
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error
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}}
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error
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}}
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error
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}}
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=-Error
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}}
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={}
org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error
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}}
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error
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}}
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error
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}}
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=Warning
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={}
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=Warning
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={}
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={macro\=>true,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={paramNot\=>false}
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={else\=>false,afterelse\=>false}
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error
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}}
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={}
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={}
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={exceptions\=>("@(\#)","$Id")}
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error
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}}
useParentScope=false
@@ -1,14 +0,0 @@
#Sun Aug 21 14:35:07 CEST 2011
eclipse.preferences.version=1
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1686594558/CPATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1686594558/CPATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1686594558/CPLUS_INCLUDE_PATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1686594558/CPLUS_INCLUDE_PATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1686594558/C_INCLUDE_PATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1686594558/C_INCLUDE_PATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1686594558/append=true
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.1686594558/appendContributed=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1686594558/LIBRARY_PATH/delimiter=;
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1686594558/LIBRARY_PATH/operation=remove
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1686594558/append=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.1686594558/appendContributed=true
+67
View File
@@ -0,0 +1,67 @@
!IFDEF NO_INJECTION
prcompiler_flag = /D "NO_INJECTION"
def_file = /DEF:"OTM_DX9_dll_NO_INJECTION.def"
obj_suff = NO_INJECTION.obj
dll = d3d9.dll
!ELSE
prcompiler_flag =
def_file = /DEF:"OTM_DX9_dll.def"
obj_suff = obj
dll = OTM_d3d9.dll
!ENDIF
CXX = cl
CLINK = link.exe
DEFINES = /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /D "_WINDLL" /D "_MBCS"
CFLAGS = /I "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include" /nologo /W3 /WX- /O2 $(DEFINES) $(prcompiler_flag) /Gm- /EHsc /MT /GS /fp:precise /Zc:wchar_t
LFLAGS = /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86" /DLL "Winmm.lib" "d3dx9.lib" "user32.lib" "Kernel32.lib" $(def_file) /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /TLBID:1 /DYNAMICBASE:NO /NXCOMPAT:NO /MACHINE:X86
obj = obj
bin = bin
objects = $(obj)\OTM_DX9_dll.$(obj_suff) \
$(obj)\OTM_IDirect3D9.$(obj_suff) \
$(obj)\OTM_IDirect3DDevice9.$(obj_suff) \
$(obj)\OTM_IDirect3DTexture9.$(obj_suff) \
$(obj)\OTM_ArrayHandler.$(obj_suff) \
$(obj)\OTM_TextureClient.$(obj_suff) \
$(obj)\OTM_TextureServer.$(obj_suff)
headers = OTM_Main.h \
OTM_Defines.h \
OTM_DX9_dll.h \
OTM_IDirect3D9.h \
OTM_IDirect3DDevice9.h \
OTM_IDirect3DTexture9.h \
OTM_ArrayHandler.h \
OTM_TextureClient.h \
OTM_TextureServer.h
$(bin)\d3d9.dll: $(objects)
$(CLINK) $(LFLAGS) $(objects) /OUT:$(bin)\$(dll)
copy $(bin)\$(dll) ..\OTM_GUI\bin\$(dll)
$(obj)\OTM_DX9_dll.$(obj_suff): OTM_DX9_dll.cpp $(headers)
$(CXX) $(CFLAGS) /c /Fo$@ OTM_DX9_dll.cpp
$(obj)\OTM_IDirect3D9.$(obj_suff): OTM_IDirect3D9.cpp $(headers)
$(CXX) $(CFLAGS) /c /Fo$@ OTM_IDirect3D9.cpp
$(obj)\OTM_IDirect3DDevice9.$(obj_suff): OTM_IDirect3DDevice9.cpp $(headers)
$(CXX) $(CFLAGS) /c /Fo$@ OTM_IDirect3DDevice9.cpp
$(obj)\OTM_IDirect3DTexture9.$(obj_suff): OTM_IDirect3DTexture9.cpp $(headers)
$(CXX) $(CFLAGS) /c /Fo$@ OTM_IDirect3DTexture9.cpp
$(obj)\OTM_ArrayHandler.$(obj_suff): OTM_ArrayHandler.cpp $(headers)
$(CXX) $(CFLAGS) /c /Fo$@ OTM_ArrayHandler.cpp
$(obj)\OTM_TextureClient.$(obj_suff): OTM_TextureClient.cpp $(headers)
$(CXX) $(CFLAGS) /c /Fo$@ OTM_TextureClient.cpp
$(obj)\OTM_TextureServer.$(obj_suff): OTM_TextureServer.cpp $(headers)
$(CXX) $(CFLAGS) /c /Fo$@ OTM_TextureServer.cpp
clean:
del $(objects) $(bin)\$(dll)
-53
View File
@@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="0.1512101163">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1512101163" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="" artifactName="OTM_GUI" buildProperties="" description="" errorParsers="org.eclipse.cdt.core.VCErrorParser" id="0.1512101163" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg" postannouncebuildStep="" postbuildStep="" preannouncebuildStep="" prebuildStep="">
<folderInfo id="0.1512101163." name="/" resourcePath="">
<toolChain errorParsers="" id="org.eclipse.cdt.msvc.toolchain.dll.debug.1352208083" name="Microsoft Visual C++" superClass="org.eclipse.cdt.msvc.toolchain.dll.debug">
<targetPlatform binaryParser="org.eclipse.cdt.core.PE" id="org.eclipse.cdt.msvc.targetPlatform.dll.debug.578962962" superClass="org.eclipse.cdt.msvc.targetPlatform.dll.debug"/>
<builder buildPath="${workspace_loc:/OTM_GUI/Default}" errorParsers="" id="org.eclipse.cdt.msvc.builder.275613668" keepEnvironmentInBuildfile="false" name="CDT Internal Builder" superClass="org.eclipse.cdt.msvc.builder"/>
<tool command="cl /c" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.VCErrorParser" id="org.eclipse.cdt.msvc.cl.dll.debug.1765972152" name="C/C++ Compiler (cl)" superClass="org.eclipse.cdt.msvc.cl.dll.debug">
<option id="org.eclipse.cdt.msvc.cl.option.includes.2026641270" name="Include Path (/I)" superClass="org.eclipse.cdt.msvc.cl.option.includes" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include&quot;"/>
<listOptionValue builtIn="false" value="&quot;D:\Programme\wx\include&quot;"/>
<listOptionValue builtIn="false" value="&quot;C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include}&quot;"/>
</option>
<inputType id="org.eclipse.cdt.msvc.cl.inputType.1761429112" superClass="org.eclipse.cdt.msvc.cl.inputType"/>
</tool>
<tool command="rc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.VCErrorParser" id="org.eclipse.cdt.msvc.rc.dll.debug.2070069572" name="Resource Compiler (rc)" superClass="org.eclipse.cdt.msvc.rc.dll.debug">
<inputType id="org.eclipse.cdt.msvc.rc.inputType.692646059" superClass="org.eclipse.cdt.msvc.rc.inputType"/>
</tool>
<tool command="link" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.VCErrorParser" id="org.eclipse.cdt.msvc.link.dll.debug.1759666471" name="Linker (link)" superClass="org.eclipse.cdt.msvc.link.dll.debug">
<inputType id="org.eclipse.cdt.msvc.link.inputType.2002620815" superClass="org.eclipse.cdt.msvc.link.inputType"/>
</tool>
<tool command="lib" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="" id="org.eclipse.cdt.msvc.lib.1573721437" name="Library Manager (lib)" superClass="org.eclipse.cdt.msvc.lib"/>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="OTM_GUI.null.1846258688" name="OTM_GUI"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="0.1512101163">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="refreshScope"/>
</cproject>
-71
View File
@@ -1,71 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>OTM_GUI</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<dictionary>
<key>?name?</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.append_environment</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildArguments</key>
<value></value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildCommand</key>
<value>make</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.buildLocation</key>
<value>${workspace_loc:/OTM_GUI/Default}</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.contents</key>
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
<value>false</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.stopOnError</key>
<value>true</value>
</dictionary>
<dictionary>
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
+2
View File
@@ -65,10 +65,12 @@ void* OTM_Client::Entry(void)
{
commands = (MsgStruct*) &buffer[pos];
//unsigned int add_length = 0;
/*
switch (commands->Control)
{
}
*/
pos+=sizeof(MsgStruct);// + add_length;
}
}
+455
View File
@@ -0,0 +1,455 @@
#include "OTM_File.h"
AddTextureClass::AddTextureClass(void)
{
Num = 0;
Textures = NULL;
Size = NULL;
Hash = NULL;
Force = NULL;
Add = NULL;
Len=0;
}
void AddTextureClass::SetSize(int num)
{
Num = 0;
Force = new bool[num];
Add = new bool[num];
Size = new unsigned int[num];
for (int i=0; i<num; i++) Size[i] = 0u;
Hash = new unsigned long[num];
Textures = new char*[num];
for (int i=0; i<num; i++) Textures[i] = NULL;
Len = num;
}
AddTextureClass::~AddTextureClass(void)
{
if (Force!=NULL) delete [] Force;
if (Add!=NULL) delete [] Add;
if (Size!=NULL) delete [] Size;
if (Hash!=NULL) delete [] Hash;
if (Textures!=NULL)
{
for (unsigned int i=0; i<Num && i<Len; i++) if (Textures[i]!=NULL) delete [] Textures[i];
delete [] Textures;
}
}
OTM_File::OTM_File(OTM_Language &lang) : Language(lang)
{
Loaded=false;
XORed=false;
FileInMemory=NULL;
MemoryLength=0u;
FileLen=0u;
}
OTM_File::OTM_File(OTM_Language &lang, const wxString &file) : Language(lang)
{
Loaded=false;
XORed=false;
FileInMemory=NULL;
MemoryLength=0u;
FileLen=0u;
SetFile(file);
}
OTM_File::~OTM_File(void)
{
if (FileInMemory!=NULL) delete [] FileInMemory;
}
int OTM_File::GetComment( wxString &tool_tip)
{
wxString file_type = FileName.AfterLast( '.');
if (file_type == L"zip")
{
if (int ret = GetCommentZip( tool_tip)) return ret;
}
else if (file_type == L"tpf")
{
if (int ret = GetCommentTpf( tool_tip)) return ret;
}
else if (file_type == L"dds")
{
tool_tip = Language.NoComment;
return -1;
}
return 0;
}
int OTM_File::GetContent( AddTextureClass *tex, bool add, bool force)
{
wxString file_type = FileName.AfterLast( '.');
if (file_type == L"zip")
{
AddZip( tex, add, true, false);
}
else if (file_type == L"tpf")
{
AddZip( tex, add, true, true);
}
else if (file_type == L"dds")
{
AddFile( tex, add, true);
}
else
{
LastError << Language.Error_FileNotSupported;
LastError << "\n" << FileName;
}
if (LastError.Len()>0) return -1;
else return 0;
}
int OTM_File::ReadFile(void)
{
if (Loaded) return 0;
XORed=false;
wxFile dat;
if (!dat.Access(FileName, wxFile::read)) {LastError << Language.Error_FileOpen <<"\n" << FileName; return -1;}
dat.Open(FileName, wxFile::read);
if (!dat.IsOpened()) {LastError << Language.Error_FileOpen <<"\n" << FileName; return -1;}
FileLen = dat.Length();
if (FileLen==0) {LastError << Language.Error_FileOpen <<"\n" << FileName; return -1;}
if (FileLen>=MemoryLength)
{
if (FileInMemory!=NULL) delete [] FileInMemory;
try {FileInMemory = new char [FileLen+1];}
catch (...) {FileInMemory=NULL; MemoryLength=0; FileLen=0; LastError << Language.Error_Memory; return -1;}
MemoryLength = FileLen+1;
}
unsigned int result = dat.Read( FileInMemory, FileLen);
dat.Close();
if (result != FileLen) {FileLen=0; LastError << Language.Error_FileRead<<"\n" << FileName; return -1;}
FileInMemory[FileLen]=0;
Loaded = true;
return 0;
}
int OTM_File::UnXOR(void)
{
if (XORed) return 0;
/*
*
* BIG THANKS TO Tonttu
* (TPFcreate 1.5)
*
*/
unsigned int *buff = (unsigned int*) FileInMemory;
unsigned int TPF_XOR = 0x3FA43FA4u;
unsigned int size = FileLen/4u;
for (unsigned int i=0; i<size; i++) buff[i] ^= TPF_XOR;
for (unsigned int i=size*4u; i<size*4u+FileLen%4u; i++) ((unsigned char*) FileInMemory)[i]^=(unsigned char) TPF_XOR;
unsigned int pos = FileLen-1;
while (pos>0u && FileInMemory[pos]) pos--;
if (pos>0u && pos<FileLen-1) FileLen = pos+1;
XORed = true;
/*
* original code by Tonttu
* The last bytes are not revealed correctly
unsigned int j=0;
while ( j <= result - 4 )
{
*( unsigned int* )( &buffer[j] ) ^= TPF_XOR;
j += 4;
}
while ( j < result )
{
buffer[j] ^= (unsigned char )( TPF_XOR >> 24 );
TPF_XOR <<= 4;
j++;
}
*/
return 0;
}
int OTM_File::GetCommentZip( wxString &tool_tip)
{
if (int ret = ReadFile()) return ret;
HZIP ZIP_Handle = OpenZip( FileInMemory, FileLen, NULL);
if (ZIP_Handle==NULL) {tool_tip = Language.NoComment; LastError << Language.Error_Unzip; return -1;}
ZIPENTRY ze;
int index;
FindZipItem( ZIP_Handle, L"Comment.txt", false, &index, &ze);
if (index>=0) //if Comment.txt is present in the zip file
{
char* comment;
int len = ze.unc_size;
try {comment=new char[len+1];}
catch(...) {tool_tip = Language.NoComment; LastError << Language.Error_Memory; return -1;}
ZRESULT zr = UnzipItem( ZIP_Handle, index, comment, len);
if (zr!=ZR_OK && zr!=ZR_MORE) {delete [] comment; tool_tip = Language.NoComment; LastError << Language.Error_Unzip <<"\nZIP:" << L"Comment.txt"; return -1;}
comment[len]=0;
tool_tip = comment;
delete [] comment;
}
else tool_tip = Language.NoComment;
CloseZip(ZIP_Handle);
return 0;
}
int OTM_File::GetCommentTpf( wxString &tool_tip)
{
if (int ret = ReadFile()) return ret;
UnXOR();
tool_tip = &FileInMemory[FileLen];
tool_tip.Prepend( Language.Author);
return 0;
}
int OTM_File::AddFile( AddTextureClass *tex, bool add, bool force)
{
tex->SetSize(1);
unsigned long temp_hash;
wxString name = FileName.AfterLast( '_');
name = name.BeforeLast( '.');
if (!name.ToULong( &temp_hash, 16)) {LastError << Language.Error_Hash <<"\n" << FileName << "\n"; return -1;} // return if hash could not be extracted
if (add)
{
if (int ret = ReadFile()) return ret;
try {tex->Textures[0] = new char[FileLen];}
catch (...) {tex->Textures[0]=NULL; LastError << Language.Error_Memory; return -1;}
for (unsigned int i=0; i<FileLen; i++) tex->Textures[0][i] = FileInMemory[i];
tex->Size[0] = FileLen;
}
else {tex->Size[0] = 0; tex->Textures[0] = NULL;}
tex->Num = 1;
tex->Add[0] = add;
tex->Force[0] = true;
tex->Hash[0] = temp_hash;
return 0;
}
int OTM_File::AddZip( AddTextureClass *tex, bool add, bool force, bool tpf)
{
if (int ret = ReadFile()) return ret;
if (tpf)
{
UnXOR();
const char pw[] = {0x73, 0x2A, 0x63, 0x7D, 0x5F, 0x0A, 0xA6, 0xBD,
0x7D, 0x65, 0x7E, 0x67, 0x61, 0x2A, 0x7F, 0x7F,
0x74, 0x61, 0x67, 0x5B, 0x60, 0x70, 0x45, 0x74,
0x5C, 0x22, 0x74, 0x5D, 0x6E, 0x6A, 0x73, 0x41,
0x77, 0x6E, 0x46, 0x47, 0x77, 0x49, 0x0C, 0x4B,
0x46, 0x6F, '\0'};
return AddContent( pw, tex, add, force);
}
else
{
return AddContent( NULL, tex, add, force);
}
}
int OTM_File::AddContent( const char* pw, AddTextureClass *tex, bool add, bool force)
{
// Thats is really nasty code, but atm I am happy that it works. I should try an other unzip api,
// This one seems to behave very strange.
// I know, that also a bug in my code could be reason for the crashes, but UnzipItem( ... ) unzipes wrong files
// and GetZipItem( ... ) returns garbage as file names, and the next call of GetZipItem( ... ) blows up the program.
//
// I have commented line 3519 in unzip.cpp.
// It was stated this is a bug, but it did not solve my problems.
//
// closing and reopen the zip handle did the trick.
//
HZIP ZIP_Handle = OpenZip( FileInMemory, FileLen, pw);
if (ZIP_Handle==NULL) {LastError << Language.Error_Unzip; return -1;}
ZIPENTRY ze;
int index;
FindZipItem( ZIP_Handle, L"texmod.def", false, &index, &ze);
if (index>=0) //if texmod.def is present in the zip file
{
char* def;
int len = ze.unc_size;
try {def=new char[len+1];}
catch(...) {LastError << Language.Error_Memory; return -1;}
ZRESULT zr = UnzipItem( ZIP_Handle, index, def, len);
if (zr!=ZR_OK && zr!=ZR_MORE) {delete [] def; return -1;}
def[len]=0;
wxStringTokenizer token( def, "\n");
int num = token.CountTokens();
tex->SetSize(num);
unsigned long temp_hash;
int count = 0;
wxString entry;
wxString file;
for (int i=0; i<num; i++)
{
entry = token.GetNextToken();
file = entry.BeforeFirst( '|');
if (!file.ToULong( &temp_hash, 16)) {LastError << Language.Error_Hash <<"\nTPF:" << entry << "\n"; continue;}
file = entry.AfterFirst( '|');
file.Replace( "\r", "");
if (add)
{
FindZipItem( ZIP_Handle, file.wc_str(), false, &index, &ze); // look for texture
if (index>=0)
{
try {tex->Textures[count] = new char[ze.unc_size];}
catch(...)
{
tex->Textures[count] = NULL;
LastError << Language.Error_Memory;
continue;
}
ZRESULT rz = UnzipItem( ZIP_Handle, index, tex->Textures[count], ze.unc_size);
if (rz!=ZR_OK && rz!=ZR_MORE)
{
delete [] tex->Textures[count];
LastError << Language.Error_Unzip <<"\nTPF:" << file << "\n";
tex->Textures[count] = NULL;
}
else
{
tex->Hash[count] = temp_hash;
tex->Add[count] = true;
tex->Size[count] = ze.unc_size;
tex->Force[count] = force;
count++;
}
}
}
else
{
tex->Hash[count] = temp_hash;
tex->Add[count] = false;
tex->Size[count] = 0;
tex->Force[count] = force;
count++;
}
}
delete [] def;
tex->Num = count;
}
else // texmod.def is not present in the zip file
{
CloseZip(ZIP_Handle); //somehow we need to close and to reopen the zip handle, otherwise the program crashes
ZIP_Handle = OpenZip( FileInMemory, FileLen, pw);
if (ZIP_Handle==NULL) {LastError << Language.Error_Unzip; return -1;}
wxString name;
wxString file;
GetZipItem( ZIP_Handle, -1, &ze); //ask for number of entries
int num = ze.index;
tex->SetSize(num);
int count = 0;
unsigned long temp_hash;
for (int i=0; i<num; i++)
{
if (GetZipItem( ZIP_Handle, i, &ze)!=ZR_OK) continue; //ask for name and size
int len = ze.unc_size;
char *buffer;
try {buffer = new char[len+1];}
catch(...)
{
continue;
}
ZRESULT rz = UnzipItem( ZIP_Handle, i, buffer, len);
if (rz!=ZR_OK && rz!=ZR_MORE)
{
delete [] buffer;
buffer = NULL;
LastError << Language.Error_Unzip <<"\nZIP:" << file << "\n";
}
file = ze.name;
if (file.Len()==0) continue;
name = file.AfterLast( '.');
if (name!="dds") continue; //if this is not texture file, continue
name = file.AfterLast( '_');
name = name.BeforeLast( '.');
if (!name.ToULong( &temp_hash, 16)) {LastError << Language.Error_Hash <<"\nZIP:" << file << "\n"; continue;} //if hash could not be extracted
if (add)
{
if (buffer==NULL) continue;
tex->Textures[count] = buffer;
tex->Hash[count] = temp_hash;
tex->Add[count] = true;
tex->Size[count] = len;//ze.unc_size;
tex->Force[count] = force;
count++;
}
else
{
if (buffer!=NULL) delete [] buffer;
tex->Hash[count] = temp_hash;
tex->Add[count] = false;
tex->Size[count] = 0;
tex->Force[count] = force;
count++;
}
}
tex->Num = count;
}
CloseZip(ZIP_Handle);
return 0;
}
+62
View File
@@ -0,0 +1,62 @@
#ifndef OTM_FILE_H_
#define OTM_FILE_H_
class AddTextureClass
{
public:
AddTextureClass(void);
void SetSize(int num);
~AddTextureClass(void);
unsigned int Num;
char **Textures;
unsigned int *Size;
unsigned long *Hash;
bool *Add;
bool *Force;
unsigned int Len;
};
#include "OTM_Main.h"
#include "unzip.h"
class OTM_File
{
public:
OTM_File(OTM_Language &lang);
OTM_File(OTM_Language &lang, const wxString &file);
~OTM_File(void);
int GetComment( wxString &tool_tip);
int GetContent( AddTextureClass *tex, bool add, bool force);
int SetFile(const wxString &file) {FileName=file;Loaded=false; return 0;}
wxString GetFile(void) {return FileName;}
wxString LastError;
private:
int ReadFile(void);
int UnXOR(void);
int GetCommentZip( wxString &tool_tip);
int GetCommentTpf( wxString &tool_tip);
int AddFile( AddTextureClass *tex, bool add, bool force);
int AddZip( AddTextureClass *tex, bool add, bool force, bool tpf);
int AddContent( const char* pw, AddTextureClass *tex, bool add, bool force);
OTM_Language &Language;
wxString FileName;
bool Loaded;
bool XORed;
char *FileInMemory;
unsigned int MemoryLength;
unsigned int FileLen;
};
#endif /* OTM_FILE_H_ */
+3 -8
View File
@@ -239,11 +239,10 @@ void OTM_Frame::OnAddGame( wxCommandEvent &event)
void OTM_Frame::OnDeleteGame( wxCommandEvent &event)
{
OTM_Client *client = ((OTM_Event&)event).GetClient();
int index = -1;
for (int i=0; i<NumberOfGames; i++) if (Clients[i]==client)
{
Notebook->DeletePage(i);
Clients[i]->Delete();
Clients[i]->Wait();
delete Clients[i];
NumberOfGames--;
for (int j=i; j<NumberOfGames; j++) Clients[j] = Clients[j+1];
@@ -377,12 +376,8 @@ void OTM_Frame::OnMenuAddGame(wxCommandEvent& WXUNUSED(event))
file_name = file_name.AfterLast('\\');
wxArrayString array;
if (GetHookedGames( array))
{
wxMessageBox( LastError, "ERROR", wxOK|wxICON_ERROR);
LastError.Empty();
return;
}
if (GetHookedGames( array)) array.Empty();
int num = array.GetCount();
for (int i=0; i<num; i++) if (array[i] == file_name)
{
+5 -11
View File
@@ -140,7 +140,7 @@ int OTM_GameInfo::LoadFromFile( const wxString &file_name)
unsigned int result = file.Read( buffer, len);
file.Close();
if (result != len) return -1;
if (result != len) {delete [] buffer; return -1;}
buffer[len]=0;
@@ -156,7 +156,7 @@ int OTM_GameInfo::LoadFromFile( const wxString &file_name)
{
if (Checked!=NULL) delete [] Checked;
try {Checked = new bool [num+100];}
catch (...) {Checked=NULL; return -1;}
catch (...) {Checked=NULL;LengthOfChecked=0; return -1;}
LengthOfChecked = num+100;
}
@@ -250,7 +250,7 @@ int OTM_GameInfo::LoadFromFile( const wxString &file_name)
else TextureColour[2] = 0;
}
/*
if (NumberOfChecked>=LengthOfChecked)
{
bool *t_bool;
@@ -261,6 +261,7 @@ int OTM_GameInfo::LoadFromFile( const wxString &file_name)
Checked = t_bool;
LengthOfChecked +=100;
}
*/
}
return 0;
}
@@ -278,7 +279,7 @@ int OTM_GameInfo::SetChecked( bool* array, int num)
{
if (Checked!=NULL) delete [] Checked;
try {Checked = new bool [num+100];}
catch (...) {Checked=NULL; return -1;}
catch (...) {Checked=NULL; LengthOfChecked = 0; return -1;}
LengthOfChecked = num+100;
}
for (int i=0; i<num; i++) Checked[i] = array[i];
@@ -308,13 +309,6 @@ void OTM_GameInfo::GetFiles( wxArrayString &files) const
files = Files;
}
/*
void OTM_GameInfo::AddTexture( const wxString &file)
{
Files.Add(file);
}
*/
OTM_GameInfo& OTM_GameInfo::operator = (const OTM_GameInfo &rhs)
{
SaveSingleTexture = rhs.SaveSingleTexture;
+47 -16
View File
@@ -69,7 +69,7 @@ OTM_GamePage::OTM_GamePage( wxNotebook *parent, const wxString &name, PipeStruct
SaveAllTextures = new wxCheckBox( this, -1, Language.CheckBoxSaveAllTextures);
MainSizer->Add( (wxWindow*) SaveAllTextures, 0, wxEXPAND, 0);
SavePath = new wxTextCtrl(this, wxID_ANY, Language.TextCtrlSavePath, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
SavePath = new wxTextCtrl(this, wxID_ANY, Language.TextCtrlSavePath, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
MainSizer->Add( (wxWindow*) SavePath, 0, wxEXPAND, 0);
MainSizer->AddSpacer(10);
@@ -80,7 +80,6 @@ OTM_GamePage::OTM_GamePage( wxNotebook *parent, const wxString &name, PipeStruct
NumberOfEntry = 0;
MaxNumberOfEntry = 100;
CheckBoxes = new wxCheckBox*[MaxNumberOfEntry];
CheckBoxVSizer = new wxBoxSizer(wxVERTICAL);
CheckBoxHSizers = new wxBoxSizer*[MaxNumberOfEntry];
CheckButtonUp = new wxButton*[MaxNumberOfEntry];
CheckButtonDown = new wxButton*[MaxNumberOfEntry];
@@ -91,7 +90,8 @@ OTM_GamePage::OTM_GamePage( wxNotebook *parent, const wxString &name, PipeStruct
}
else
{
if (Sender.Send( Game, GameOld)==0) GameOld = Game;
wxArrayString comments;
if (Sender.Send( Game, GameOld, &comments)==0) GameOld = Game;
int key = Game.GetKeyBack();
if (key>=0) ChoiceKeyBack->SetSelection( key);
@@ -120,22 +120,21 @@ OTM_GamePage::OTM_GamePage( wxNotebook *parent, const wxString &name, PipeStruct
NumberOfEntry = Files.GetCount();
MaxNumberOfEntry = NumberOfEntry+100;
CheckBoxes = new wxCheckBox*[MaxNumberOfEntry];
bool *checked = new bool[NumberOfEntry];
Game.GetChecked( checked, NumberOfEntry);
CheckBoxVSizer = new wxBoxSizer(wxVERTICAL);
CheckBoxes = new wxCheckBox*[MaxNumberOfEntry];
CheckBoxHSizers = new wxBoxSizer*[MaxNumberOfEntry];
CheckButtonUp = new wxButton*[MaxNumberOfEntry];
CheckButtonDown = new wxButton*[MaxNumberOfEntry];
CheckButtonDelete = new wxButton*[MaxNumberOfEntry];
wxString name;
for (int i=0; i<NumberOfEntry;i++)
for (int i=0; i<NumberOfEntry; i++)
{
CheckBoxHSizers[i] = new wxBoxSizer(wxHORIZONTAL);
CheckBoxes[i] = new wxCheckBox( this, -1, Files[i]);
CheckBoxes[i]->SetValue( checked[i]);
CheckBoxes[i]->SetToolTip( comments[i]);
wchar_t button_txt[2];
button_txt[0] = 8657;
@@ -192,10 +191,18 @@ int OTM_GamePage::SetSavePath( const wxString &path)
void OTM_GamePage::AddTexture( const wxString &file_name)
{
if (NumberOfEntry>=MaxNumberOfEntry) return;
OTM_File file( Language, file_name);
wxString tool_tip;
if (file.GetComment( tool_tip))
{
LastError = file.LastError;
file.LastError.Empty();
}
CheckBoxHSizers[NumberOfEntry] = new wxBoxSizer(wxHORIZONTAL);
CheckBoxes[NumberOfEntry] = new wxCheckBox( this, -1, file_name);
CheckBoxes[NumberOfEntry]->SetValue( true);
CheckBoxes[NumberOfEntry]->SetToolTip( tool_tip);
wchar_t button_txt[2];
button_txt[0] = 8657;
@@ -269,6 +276,7 @@ int OTM_GamePage::GetSettings(void)
int OTM_GamePage::UpdateGame(void)
{
if (int ret = GetSettings()) return ret;
if (int ret = Sender.Send( Game, GameOld))
{
LastError = Language.Error_Send;
@@ -324,16 +332,22 @@ void OTM_GamePage::OnButtonUp(wxCommandEvent& event)
int id = (event.GetId() - ID_Button_Texture)/3;
if (id <=0 || id>= NumberOfEntry) return;
wxString cpy = Files[id];
wxString cpy_str = Files[id];
Files[id] = Files[id-1];
Files[id-1] = cpy;
Files[id-1] = cpy_str;
CheckBoxes[id]->SetLabel(Files[id]);
CheckBoxes[id-1]->SetLabel(Files[id-1]);
bool cpy_checked = CheckBoxes[id]->GetValue();
CheckBoxes[id]->SetValue(CheckBoxes[id-1]);
CheckBoxes[id]->SetValue(CheckBoxes[id-1]->GetValue());
CheckBoxes[id-1]->SetValue(cpy_checked);
cpy_str = CheckBoxes[id]->GetToolTip()->GetTip();
wxString cpy_str2 = CheckBoxes[id-1]->GetToolTip()->GetTip();
CheckBoxes[id]->SetToolTip(cpy_str2);
CheckBoxes[id-1]->SetToolTip(cpy_str);
}
void OTM_GamePage::OnButtonDown(wxCommandEvent& event)
@@ -341,16 +355,21 @@ void OTM_GamePage::OnButtonDown(wxCommandEvent& event)
int id = (event.GetId() - ID_Button_Texture-1)/3;
if (id <0 || id>= NumberOfEntry-1) return;
wxString cpy = Files[id];
wxString cpy_str = Files[id];
Files[id] = Files[id+1];
Files[id+1] = cpy;
Files[id+1] = cpy_str;
CheckBoxes[id]->SetLabel(Files[id]);
CheckBoxes[id+1]->SetLabel(Files[id+1]);
bool cpy_checked = CheckBoxes[id]->GetValue();
CheckBoxes[id]->SetValue(CheckBoxes[id+1]);
CheckBoxes[id]->SetValue(CheckBoxes[id+1]->GetValue());
CheckBoxes[id+1]->SetValue(cpy_checked);
cpy_str = CheckBoxes[id]->GetToolTip()->GetTip();
wxString cpy_str2 = CheckBoxes[id+1]->GetToolTip()->GetTip();
CheckBoxes[id]->SetToolTip(cpy_str2);
CheckBoxes[id+1]->SetToolTip(cpy_str);
}
void OTM_GamePage::OnButtonDelete(wxCommandEvent& event)
@@ -359,6 +378,13 @@ void OTM_GamePage::OnButtonDelete(wxCommandEvent& event)
if (id <0 || id>= NumberOfEntry) return;
for (int i=id+1; i<NumberOfEntry; i++) CheckBoxes[i-1]->SetLabel(Files[i]);
for (int i=id+1; i<NumberOfEntry; i++) CheckBoxes[i-1]->SetValue(CheckBoxes[i]->GetValue());
wxString cpy_str;
for (int i=id+1; i<NumberOfEntry; i++)
{
cpy_str = CheckBoxes[i]->GetToolTip()->GetTip();
CheckBoxes[i-1]->SetToolTip(cpy_str);
}
Files.RemoveAt(id, 1);
NumberOfEntry--;
@@ -368,23 +394,28 @@ void OTM_GamePage::OnButtonDelete(wxCommandEvent& event)
Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &OTM_GamePage::OnButtonDown, this, ID_Button_Texture+3*NumberOfEntry+1);
Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &OTM_GamePage::OnButtonDelete, this, ID_Button_Texture+3*NumberOfEntry+2);
CheckBoxVSizer->Detach( CheckBoxHSizers[NumberOfEntry]);
CheckBoxHSizers[NumberOfEntry]->Detach( (wxWindow*) CheckBoxes[NumberOfEntry]);
CheckBoxHSizers[NumberOfEntry]->Detach( (wxWindow*) CheckButtonUp[NumberOfEntry]);
CheckBoxHSizers[NumberOfEntry]->Detach( (wxWindow*) CheckButtonDown[NumberOfEntry]);
CheckBoxHSizers[NumberOfEntry]->Detach( (wxWindow*) CheckButtonDelete[NumberOfEntry]);
delete CheckBoxHSizers[NumberOfEntry];
CheckBoxHSizers[NumberOfEntry] = NULL;
MainSizer->Detach( CheckBoxHSizers[NumberOfEntry]);
delete CheckBoxes[NumberOfEntry];
CheckBoxes[NumberOfEntry] = NULL;
delete CheckButtonUp[NumberOfEntry];
CheckButtonUp[NumberOfEntry] = NULL;
delete CheckButtonDown[NumberOfEntry];
CheckButtonDown[NumberOfEntry] = NULL;
delete CheckButtonDelete[NumberOfEntry];
CheckButtonDelete[NumberOfEntry] = NULL;
delete CheckBoxHSizers[NumberOfEntry];
CheckBoxHSizers[NumberOfEntry] = NULL;
}
+1 -1
View File
@@ -79,7 +79,7 @@ private:
wxTextCtrl *SavePath;
wxBoxSizer **CheckBoxHSizers;
wxBoxSizer *CheckBoxVSizer;
//wxBoxSizer *CheckBoxVSizer;
wxButton **CheckButtonUp;
wxButton **CheckButtonDown;
wxButton **CheckButtonDelete;
+4 -4
View File
@@ -195,8 +195,8 @@ int OTM_Language::LoadLanguage(const wxString &name)
CheckEntry( command, msg, ChooseGame)
CheckEntry( command, msg, DeleteGame)
CheckEntry( command, msg, GameAlreadyAdded)
CheckEntry( command, msg, FileNotSupported)
CheckEntry( command, msg, ExitGameAnyway)
CheckEntry( command, msg, Error_FileNotSupported)
CheckEntry( command, msg, Error_FktNotFound)
CheckEntry( command, msg, Error_DLLNotFound)
CheckEntry( command, msg, Error_Send)
@@ -210,7 +210,6 @@ int OTM_Language::LoadLanguage(const wxString &name)
CheckEntry( command, msg, Error_FileOpen)
CheckEntry( command, msg, Error_FileRead)
CheckEntry( command, msg, Error_Memory)
CheckEntry( command, msg, Error_FileformatNotSupported)
CheckEntry( command, msg, Error_Unzip)
CheckEntry( command, msg, Error_ZipEntry)
CheckEntry( command, msg, KeyBack)
@@ -262,9 +261,11 @@ int OTM_Language::LoadDefault(void)
ChooseGame = L"Select a game binary.";
DeleteGame = L"Select the games to be deleted.";
GameAlreadyAdded = L"Game has been already added.";
FileNotSupported = L"This file type is not supported:\n";
ExitGameAnyway = L"Closing OpenTexMod while a game is running might lead to a crash of the game.\nExit anyway?";
NoComment = L"No comment.";
Author = L"Author: ";
Error_FileNotSupported = L"This file type is not supported:\n";
Error_DLLNotFound = L"Could not load the dll.\nThe dll injection won't work.\nThis might happen if D3DX9_43.dll is not installed on your system.\nPlease install the newest DirectX End-User Runtime Web Installer.";
Error_FktNotFound = L"Could not load function out of dll.\nThe dll injection won't work.";
@@ -279,7 +280,6 @@ int OTM_Language::LoadDefault(void)
Error_FileOpen = L"Could not open file:";
Error_FileRead = L"Could not read file:";
Error_Memory = L"Could not allocate enough memory.";
Error_FileformatNotSupported = L"This file format is not supported.";
Error_Unzip = L"Could not unzip.";
Error_ZipEntry = L"Could not find zip entry.";
+3 -2
View File
@@ -57,9 +57,11 @@ public:
wxString ChooseGame;
wxString DeleteGame;
wxString GameAlreadyAdded;
wxString FileNotSupported;
wxString ExitGameAnyway;
wxString NoComment;
wxString Author;
wxString Error_FileNotSupported;
wxString Error_FktNotFound;
wxString Error_DLLNotFound;
wxString Error_Send;
@@ -73,7 +75,6 @@ public:
wxString Error_FileOpen;
wxString Error_FileRead;
wxString Error_Memory;
wxString Error_FileformatNotSupported;
wxString Error_Unzip;
wxString Error_ZipEntry;
+2 -1
View File
@@ -40,8 +40,8 @@ along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
#define wxUSE_FILE 1
#define wxUSE_TEXTCTRL 1
#define wxUSE_CHOICEDLG 1
#define wxUSE_TOOLTIPS 1
#endif
#define wxUSE_DYNLIB_CLASS 1
#define WINVER _WIN32_WINNT_WINXP
#define _WIN32_WINNT _WIN32_WINNT_WINXP
@@ -99,6 +99,7 @@ enum
#include "OTM_Event.h"
#include "OTM_Client.h"
#include "OTM_GameInfo.h"
#include "OTM_File.h"
#include "OTM_Sender.h"
#include "OTM_Server.h"
#include "OTM_GamePage.h"
+26 -318
View File
@@ -20,55 +20,6 @@ along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
#include "OTM_Main.h"
#include "unzip.h"
AddTextureClass::AddTextureClass(void)
{
Num = 0;
Textures = NULL;
Size = NULL;
Hash = NULL;
Force = NULL;
Add = NULL;
Len=0;
}
void AddTextureClass::SetSize(int num)
{
Num = 0;
Force = new bool[num];
Add = new bool[num];
Size = new unsigned int[num];
for (int i=0; i<num; i++) Size[i] = 0;
Hash = new unsigned long[num];
Textures = new char*[num];
for (int i=0; i<num; i++) Textures[i] = NULL;
Len = num;
}
AddTextureClass::~AddTextureClass(void)
{
if (Force!=NULL) delete [] Force;
if (Add!=NULL) delete [] Add;
if (Size!=NULL) delete [] Size;
if (Hash!=NULL) delete [] Hash;
if (Textures!=NULL)
{
for (unsigned int j=0; j<Len; j++) if (Textures[j]!=NULL) delete [] Textures[j];
delete [] Textures;
}
}
OTM_Sender::OTM_Sender(PipeStruct &pipe, OTM_Language &lang) : Pipe(pipe), Language(lang)
{
try {Buffer = new char[BIG_BUFSIZE];}
@@ -81,7 +32,7 @@ OTM_Sender::~OTM_Sender(void)
}
int OTM_Sender::Send( const OTM_GameInfo &game, const OTM_GameInfo &game_old)
int OTM_Sender::Send( const OTM_GameInfo &game, const OTM_GameInfo &game_old, wxArrayString *comments)
{
LastError.Empty();
int key = game.GetKeyBack();
@@ -140,40 +91,34 @@ int OTM_Sender::Send( const OTM_GameInfo &game, const OTM_GameInfo &game_old)
game.GetFiles( files);
int num = files.GetCount();
if (comments!=NULL)
{
comments->Empty();
comments->Alloc(num);
}
bool *checked = new bool [num];
game.GetChecked( checked, num);
AddTextureClass *tex = new AddTextureClass[num];
wxString file_type;
unsigned long temp_hash;
wxString comment;
for (int i=0; i<num; i++)
{
file_type = files[i];
file_type = file_type.AfterLast( '.');
if (file_type == L"zip")
OTM_File file( Language, files[i]);
if (comments!=NULL)
{
AddZip( &tex[i], files[i], checked[i], true, false);
file.GetComment(comment);
comments->Add(comment);
}
else if (file_type == L"tpf")
if (file.GetContent( &tex[i], checked[i], true))
{
AddZip( &tex[i], files[i], checked[i], true, true);
}
else if (file_type == L"dds")
{
AddFile( &tex[i], files[i], checked[i], true);
}
else
{
wxString msg = Language.FileNotSupported;
msg << files[i];
wxMessageBox(msg, "ERROR", wxOK);
LastError << file.LastError;
file.LastError.Empty();
}
}
SendTextures( num, tex);
delete [] checked;
delete [] tex;
if (LastError.Len()>0) return 1;
else return 0;
@@ -210,11 +155,10 @@ int OTM_Sender::SendTextures(unsigned int num, AddTextureClass *tex)
if (Buffer==NULL) return (RETURN_NO_MEMORY);
int count = 0;
for (unsigned int i=0u; i<num; i++) count+=tex->Num;
for (unsigned int i=0u; i<num; i++) count+=tex[i].Num;
unsigned long *hash = new unsigned long[count];
count = 0;
//wxMessageBox("OTM_Sender::SendTextures", "start", wxOK);
MsgStruct *msg;
int pos = 0;
for (unsigned int i=0u; i<num; i++) for (unsigned int j=0u; j<tex[i].Num; j++)
@@ -231,9 +175,10 @@ int OTM_Sender::SendTextures(unsigned int num, AddTextureClass *tex)
}
hash[count++] = temp_hash;
unsigned int size = tex[i].Size[j];
msg = (MsgStruct*) &Buffer[pos];
msg->Hash = temp_hash;
msg->Value = tex[i].Size[j];
msg->Value = size;
pos += sizeof(MsgStruct);
if (tex[i].Add[j])
@@ -242,15 +187,17 @@ int OTM_Sender::SendTextures(unsigned int num, AddTextureClass *tex)
else msg->Control = CONTROL_ADD_TEXTURE_DATA;
char* temp = tex[i].Textures[j];
for (unsigned int l=0; l<tex[i].Size[j]; l++) Buffer[pos+l] = temp[l];
pos+=tex[i].Size[j];
if (temp!=NULL)
{
for (unsigned int l=0; l<size; l++) Buffer[pos+l] = temp[l];
pos+=size;
}
}
else msg->Control = CONTROL_REMOVE_TEXTURE;
}
delete [] hash;
if (pos) if (int ret = SendToGame( Buffer, pos)) return ret;
delete [] tex;
if (pos) if (int ret = SendToGame( Buffer, pos)) return ret;
if (LastError.Len()>0) return 1;
else return 0;
@@ -304,6 +251,7 @@ int OTM_Sender::SendToGame( void *msg, unsigned long len)
{
if (len==0) return (RETURN_BAD_ARGUMENT);
unsigned long num;
if (Pipe.Out==INVALID_HANDLE_VALUE) {LastError << Language.Error_NoPipe; return -1;}
bool ret = WriteFile( Pipe.Out, (const void*) msg, len, &num, NULL);
if (!ret || len!=num) {LastError << Language.Error_WritePipe; return -1;}
@@ -311,243 +259,3 @@ int OTM_Sender::SendToGame( void *msg, unsigned long len)
return 0;
}
int OTM_Sender::AddFile( AddTextureClass *tex, wxString file, bool add, bool force)
{
tex->SetSize(1);
unsigned long temp_hash;
wxString name = file.AfterLast( '_');
name = name.BeforeLast( '.');
if (!name.ToULong( &temp_hash, 16)) {LastError << Language.Error_Hash <<"\n" << file; return -1;} // return if hash could not be extracted
tex->Add[0] = add;
if (add)
{
wxFile dat;
if (!dat.Access(name, wxFile::read)) {LastError << Language.Error_FileOpen <<"\n" << file; return -1;}
dat.Open(file, wxFile::read);
if (!dat.IsOpened()) {LastError << Language.Error_FileOpen <<"\n" << file; return -1;}
unsigned len = file.Length();
try {tex->Textures[0] = new char [len];}
catch (...) {tex->Textures[0] = NULL; LastError << Language.Error_Memory; return -1;}
unsigned int result = dat.Read( (void*) tex->Textures[0], len);
dat.Close();
if (result != len) {LastError << Language.Error_FileRead <<"\n" << file; return -1;}
tex->Size[0] = len;
}
else {tex->Size[0] = 0; tex->Textures[0] = NULL;}
tex->Num = 1;
tex->Force[0] = true;
tex->Hash[0] = temp_hash;
return 0;
}
int OTM_Sender::AddZip( AddTextureClass *tex, wxString file, bool add, bool force, bool tpf)
{
wxFile dat;
if (!dat.Access(file, wxFile::read)) {LastError << Language.Error_FileOpen <<"\n" << file; return -1;}
dat.Open(file, wxFile::read);
if (!dat.IsOpened()) {LastError << Language.Error_FileOpen <<"\n" << file; return -1;}
unsigned len = dat.Length();
unsigned char* buffer;
try {buffer = new unsigned char [len];}
catch (...) {LastError << Language.Error_Memory; return -1;}
unsigned int result = dat.Read( buffer, len);
dat.Close();
if (result != len) {delete [] buffer; LastError << Language.Error_FileRead<<"\n" << file; return -1;}
if (tpf)
{
/*
*
* BIG THANKS TO Tonttu
* (TPFcreate 1.5)
*
*/
unsigned int TPF_XOR = 0x3FA43FA4u;
const char pw[] = {0x73, 0x2A, 0x63, 0x7D, 0x5F, 0x0A, 0xA6, 0xBD,
0x7D, 0x65, 0x7E, 0x67, 0x61, 0x2A, 0x7F, 0x7F,
0x74, 0x61, 0x67, 0x5B, 0x60, 0x70, 0x45, 0x74,
0x5C, 0x22, 0x74, 0x5D, 0x6E, 0x6A, 0x73, 0x41,
0x77, 0x6E, 0x46, 0x47, 0x77, 0x49, 0x0C, 0x4B,
0x46, 0x6F, '\0'};
unsigned int j=0;
while ( j <= result - 4 )
{
*( unsigned int* )( &buffer[j] ) ^= TPF_XOR;
j += 4;
}
while ( j < result )
{
buffer[j] ^= (unsigned char )( TPF_XOR >> 24 );
TPF_XOR <<= 4;
j++;
}
AddContent( (char*) buffer, len, pw, tex, add, force);
}
else
{
AddContent( (char*) buffer, len, NULL, tex, add, force);
}
delete [] buffer;
return 0;
}
int OTM_Sender::AddContent( char* buffer, unsigned int len, const char* pw, AddTextureClass *tex, bool add, bool force)
{
HZIP hz = OpenZip( (void*) buffer, len, pw);
ZIPENTRY ze;
int index;
FindZipItem( hz, L"texmod.def", false, &index, &ze);
if (index>=0) //if texmod.def is present in the zip file
{
char* def;
int len = ze.unc_size;
try {def=new char[len+1];}
catch(...) {CloseZip(hz); LastError << Language.Error_Memory; return -1;}
ZRESULT zr = UnzipItem( hz,index, def, len);
if (zr!=ZR_OK && zr!=ZR_MORE) {delete [] def; CloseZip(hz); return -1;}
def[len]=0;
wxStringTokenizer token( def, "\n");
int num = token.CountTokens();
tex->SetSize(num);
unsigned long temp_hash;
int pos = 0;
int count = 0;
wxString entry;
wxString file;
for (int i=0; i<num; i++)
{
entry = token.GetNextToken();
file = entry.BeforeFirst( '|');
if (!file.ToULong( &temp_hash, 16)) {LastError << Language.Error_Hash <<"\nTPF:" << file; continue;}
file = entry.AfterFirst( '|');
file.Replace( "\r", "");
if (add)
{
FindZipItem( hz, file.wc_str(), false, &index, &ze); // look for texture
if (index>=0)
{
try {tex->Textures[count] = new char[ze.unc_size];}
catch(...)
{
tex->Textures[count] = NULL;
LastError << Language.Error_Memory;
continue;
}
if (ZR_OK!=UnzipItem( hz, index, tex->Textures[count], ze.unc_size))
{
delete [] tex->Textures[count];
LastError << Language.Error_Unzip <<"\nTPF:" << file;
tex->Textures[count] = NULL;
}
else
{
tex->Hash[count] = temp_hash;
tex->Add[count] = true;
tex->Size[count] = ze.unc_size;
tex->Force[count] = force;
count++;
}
}
}
else
{
tex->Hash[count] = temp_hash;
tex->Add[count] = false;
tex->Size[count] = 0;
tex->Force[count] = force;
count++;
}
}
delete [] def;
tex->Num = count;
}
else // texmod.def is not present in the zip file
{
wxString name;
wxString file;
GetZipItem( hz, -1, &ze); //ask for number of entries
index = ze.index;
tex->SetSize(index);
int count = 0;
unsigned long temp_hash;
for (int i=0; i<index; i++)
{
if (GetZipItem( hz, i, &ze)!=ZR_OK) continue; //ask for name and size
file = ze.name;
name = file.AfterLast( '.');
if (name!="dds") {LastError << Language.Error_FileformatNotSupported <<"\nZIP: " << file; continue;} //if this is not texture file, continue
name = file.AfterLast( '_');
name = name.BeforeLast( '.');
if (!name.ToULong( &temp_hash, 16)) {LastError << Language.Error_Hash <<"\nZIP:" << file; continue;} //if hash couldt not be extracted
if (add)
{
try {tex->Textures[count] = new char[ze.unc_size];}
catch(...)
{
tex->Textures[count] = NULL;
LastError << Language.Error_Memory;
continue;
}
ZRESULT rz = UnzipItem( hz, i, tex->Textures[count], ze.unc_size);
if (ZR_OK!=rz)
{
delete [] tex->Textures[count];
LastError << Language.Error_Unzip <<"\nZIP:" << file;
tex->Textures[count] = NULL;
}
else
{
tex->Hash[count] = temp_hash;
tex->Add[count] = true;
tex->Size[count] = ze.unc_size;
tex->Force[count] = force;
count++;
}
}
else
{
tex->Hash[count] = temp_hash;
tex->Add[count] = false;
tex->Size[count] = 0;
tex->Force[count] = force;
count++;
}
}
tex->Num = count;
}
CloseZip(hz);
return 0;
}
+1 -18
View File
@@ -22,23 +22,6 @@ along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
#define OTM_SENDER_H_
#include "OTM_Main.h"
class AddTextureClass
{
public:
AddTextureClass(void);
void SetSize(int num);
~AddTextureClass(void);
unsigned int Num;
char **Textures;
unsigned int *Size;
unsigned long *Hash;
bool *Add;
bool *Force;
unsigned int Len;
};
// an object of this class is owned by each OTM_GamePage object. It act as sender ^^
class OTM_Sender
@@ -47,7 +30,7 @@ public:
OTM_Sender(PipeStruct &pipe, OTM_Language &lang);
~OTM_Sender(void);
int Send( const OTM_GameInfo &game, const OTM_GameInfo &game_old);
int Send( const OTM_GameInfo &game, const OTM_GameInfo &game_old, wxArrayString *comments=NULL);
wxString LastError;
@@ -63,11 +63,15 @@ DeleteGame:
Select the games to be deleted.|
GameAlreadyAdded:
Game has been already added.|
FileNotSupported:
This file type is not supported:|
ExitGameAnyway:
Closing OpenTexMod while a game is running might lead to a crash of the game.
Exit anyway?|
NoComment:
No comment.|
Author:
Author: |
Error_FileNotSupported:
This file type is not supported:|
Error_DLLNotFound:
Could not load the dll.
The dll injection won't work.
@@ -98,8 +102,6 @@ Error_FileRead:
Could not read file.|
Error_Memory:
Could not allocate enough memory|
Error_FileformatNotSupported:
This file format is not supported.|
Error_Unzip:
Could not unzip.|
Error_ZipEntry:
+3 -2
View File
@@ -18,13 +18,15 @@ SelectLanguage:W
ChooseGame:Wähle eine Spiel-exe|
DeleteGame:Wähle die Spiele zum Entfernen|
GameAlreadyAdded:Das Spiel wurde bereits hinzugefügt.|
FileNotSupported:Dieser Filetype wird nicht unterstützt:|
ExitGameAnyway:
Es ist nicht ratsam OpenTexMod zu schließen, während Spiele noch offen sind.
Dies kann zum Absturz der Spiele führen.
Trozdem beenden?|
NoComment:Kein Kommentar.|
Author:Autor: |
Error_FileNotSupported:Dieser Filetype wird nicht unterstützt:|
Error_DLLNotFound:
Konnte die dll nicht laden,
Die dll injection wird nicht funktionieren.
@@ -46,7 +48,6 @@ Error_Hash:Konnte den Hash nicht erkennen, vielleicht entspricht der Name nicht
Error_FileOpen:Konnte Datei nicht öffnen:|
Error_FileRead:Konnte Datei nich lesen:|
Error_Memory:Konnte nicht genügen Speicher allokieren.|
Error_FileformatNotSupported:Dieses Dateiformat wird nicht unterstützt.|
Error_Unzip:Konnte zip-Datei nicht entpacken.|
Error_ZipEntry:Konnte Eintrag in zip-Datei nicht finden.|
KeyBack:Zurück|
+10
View File
@@ -36,6 +36,16 @@ geladen werden. Stellst du diese Option an, w
wahrscheinlich nichts geschehen, da alle Texturen für diese Map bereits geladen sind.
Wechsle also die Map oder lade erneut.
Zip Dateien können eine "texmod.def" Datei enthalten, welche die Hash-Werte und
Dateinamen enthält. Jede Zeile sollte dem Format "hash|filename.dds" entsprechen.
Wenn es keine "texmod.def" Datei enthält, wird jede Datei entpackt und jene, deren
Namen auf das Wildcard "*_hash.dds" zutrifft, werden benutzt.
Die Zip Datei kann eine "Comment.txt" enthalten. Der Inhalte wird als Kommentar
in der GUI angezeigt.
Wenn du einzelne Dateien lädst, sollten diese dem Wildcard "*_hash.dds" entsprechen.
Wie interagiert OpenTexMod mit den Spielen?
OpenTexMod klingt sich zwischen die Verbindung vom Spiel und DirectX ein.
+9
View File
@@ -30,6 +30,15 @@ the textures are loaded by the game and only in the moment they are loaded.
If you switch this option on, while a map is loaded, probably nothing will hapen,
because all textures are loaded for this map. Change the Map or reload it again.
Zip files can include a "texmod.def" file which contains the hash and the file name.
Each line should be in the format "hash|filename.dds"
If it does not contain a "texmod.def" each file will be unpacked and those which match
the wildcard "*_hash.dds" will be used.
The zip file can include a "Comment.txt" file. The content will be shown as comment
in the GUI.
If you load single files, they should match the wildcard "*_hash.dds"
How does OpenTexMod interact with the game?
+149
View File
@@ -0,0 +1,149 @@
# =========================================================================
# This configuration file was generated by
# Bakefile 0.2.8 (http://www.bakefile.org)
# Beware that all changes made to this file will be overwritten next
# time you run Bakefile!
# =========================================================================
# -------------------------------------------------------------------------
# These are configurable options:
# -------------------------------------------------------------------------
# C compiler
CC = cl
# C++ compiler
CXX = cl
# Standard flags for CC
CFLAGS =
# Standard flags for C++
CXXFLAGS =
# Standard preprocessor flags (common for CC and CXX)
CPPFLAGS =
# Standard linker flags
LDFLAGS =
# The C preprocessor
CPP = $(CC) /EP /nologo
# What type of library to build? [0,1]
SHARED = 0
# Build wxUniversal instead of native port? [0,1]
WXUNIV = 0
# Compile Unicode build of wxWidgets? [0,1]
UNICODE = 1
# Use MSLU library when building Unicode version. [0,1]
MSLU = 0
# Type of compiled binaries [debug,release]
BUILD = debug
# The target processor architecture must be specified when it is not X86.
# This does not affect the compiler output, so you still need to make sure
# your environment is set up appropriately with the correct compiler in the
# PATH. Rather it affects some options passed to some of the common build
# utilities such as the resource compiler and the linker.
#
# Accepted values: AMD64, IA64.
TARGET_CPU = $(CPU)
# Should debugging info be included in the executables? The default value
# "default" means that debug info will be included if BUILD=debug
# and not included if BUILD=release. [0,1,default]
DEBUG_INFO = 1
# Value of wxDEBUG_LEVEL. The default value is the same as 1 and means that all
# but expensive assert checks are enabled, use 0 to completely remove debugging
# code. [0,1,default]
DEBUG_FLAG = 1
# Link against debug (e.g. msvcrtd.dll) or release (msvcrt.dll) RTL?
# Default is to use debug CRT if and only if BUILD==debug. [0,1,default]
DEBUG_RUNTIME_LIBS = default
# Multiple libraries or single huge monolithic one? [0,1]
MONOLITHIC = 0
# Build GUI libraries? [0,1]
USE_GUI = 1
# Build wxHTML library (USE_GUI must be 1)? [0,1]
USE_HTML = 1
# Build multimedia library (USE_GUI must be 1)? [0,1]
USE_MEDIA = 1
# Build wxXRC library (USE_GUI must be 1)? [0,1]
USE_XRC = 1
# Build wxAUI library (USE_GUI must be 1)? [0,1]
USE_AUI = 1
# Build wxRibbon library (USE_GUI must be 1)? [0,1]
USE_RIBBON = 1
# Build wxPropertyGrid library (USE_GUI must be 1)? [0,1]
USE_PROPGRID = 1
# Build wxRichTextCtrl library (USE_GUI must be 1)? [0,1]
USE_RICHTEXT = 1
# Build wxStyledTextCtrl library (USE_GUI must be 1)? [0,1]
USE_STC = 1
# Build OpenGL canvas library (USE_GUI must be 1)? [0,1]
USE_OPENGL = 1
# Build quality assurance classes library (USE_GUI must be 1)? [0,1]
USE_QA = 1
# Enable exceptions in compiled code. [0,1]
USE_EXCEPTIONS = 1
# Enable run-time type information (RTTI) in compiled code. [0,1]
USE_RTTI = 1
# Enable threading in compiled code. [0,1]
USE_THREADS = 1
# Enable wxCairoContext for platforms other than Linux/GTK. [0,1]
USE_CAIRO = 0
# Is this official build by wxWidgets developers? [0,1]
OFFICIAL_BUILD = 0
# Use this to name your customized DLLs differently
VENDOR = custom
#
WX_FLAVOUR =
#
WX_LIB_FLAVOUR =
# Name of your custom configuration. This affects directory
# where object files are stored as well as the location of
# compiled .lib files and setup.h under the lib/ toplevel directory.
CFG =
# Compiler flags needed to compile test suite in tests directory. If you want
# to run the tests, set it so that the compiler can find CppUnit headers.
CPPUNIT_CFLAGS =
# Linker flags needed to link test suite in tests directory. If you want
# to run the tests, include CppUnit library here.
CPPUNIT_LIBS =
# Version of C runtime library to use. You can change this to
# static if SHARED=0, but it is highly recommended to not do
# it if SHARED=1 unless you know what you are doing. [dynamic,static]
RUNTIME_LIBS = dynamic
+7 -3
View File
@@ -18,7 +18,7 @@ OBJS = \
obj
OBJS_exe = \
bin
WX_DIR = D:\Programme\wx
WX_DIR = D:\Programme\wxWidgets-2.9.2
LIBDIRNAME = $(WX_DIR)\lib\gcc_$(LIBTYPE_SUFFIX)$(CFG)
SETUPHDIR = \
$(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)
@@ -26,7 +26,7 @@ MINIMAL_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG_2) $(__THREADSFLAG) \
$(GCCFLAGS) -DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
$(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) $(__MSLU_DEFINE_p) \
$(__GFXCTX_DEFINE_p) -I$(SETUPHDIR) -I$(WX_DIR)\include -W -Wall -I. \
$(__GFXCTX_DEFINE_p) -I$(SETUPHDIR) -I$(WX_DIR)\include -W -Wall -Wextra -I. \
$(__DLLFLAG_p) -DNOPCH $(__RTTIFLAG_5) \
$(__EXCEPTIONSFLAG_6) -Wno-ctor-dtor-privacy $(CPPFLAGS) $(CXXFLAGS)
MINIMAL_OBJECTS = \
@@ -37,6 +37,7 @@ MINIMAL_OBJECTS = \
$(OBJS)\OTM_GamePage.o \
$(OBJS)\OTM_Server.o \
$(OBJS)\OTM_Client.o \
$(OBJS)\OTM_File.o \
$(OBJS)\OTM_Sender.o \
$(OBJS)\OTM_Language.o
@@ -81,7 +82,7 @@ ifeq ($(MONOLITHIC),1)
EXTRALIBS_FOR_BASE =
endif
ifeq ($(BUILD),debug)
__OPTIMIZEFLAG_2 = -O0
__OPTIMIZEFLAG_2 = -O0 -g
endif
ifeq ($(BUILD),release)
__OPTIMIZEFLAG_2 = -O2
@@ -254,6 +255,9 @@ $(OBJS)\OTM_Server.o: ./OTM_Server.cpp
$(OBJS)\OTM_Client.o: ./OTM_Client.cpp
$(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\OTM_File.o: ./OTM_File.cpp
$(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\OTM_Sender.o: ./OTM_Sender.cpp
$(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
+389
View File
@@ -0,0 +1,389 @@
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.8 (http://www.bakefile.org)
# Do not modify, all changes will be overwritten!
# =========================================================================
!include <config.vc>
# -------------------------------------------------------------------------
# Do not modify the rest of this file!
# -------------------------------------------------------------------------
### Variables: ###
WX_RELEASE_NODOT = 29
COMPILER_PREFIX = vc
OBJS = \
obj
OBJS_exe = \
bin
WX_DIR = D:\Programme\wxWidgets-2.9.2
LIBDIRNAME = \
$(WX_DIR)\lib\$(COMPILER_PREFIX)$(DIR_SUFFIX_CPU)_$(LIBTYPE_SUFFIX)$(CFG)
SETUPHDIR = \
$(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)
MINIMAL_CXXFLAGS = /M$(__RUNTIME_LIBS_10)$(__DEBUGRUNTIME_4) /DWIN32 \
$(__DEBUGINFO_0) /Fd$(OBJS)\OTM_GUI.pdb $(____DEBUGRUNTIME_3_p) \
$(__OPTIMIZEFLAG_6) $(__NO_VC_CRTDBG_p) /D__WXMSW__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) \
$(__MSLU_DEFINE_p) /I$(SETUPHDIR) /I$(WX_DIR)\include \
$(____CAIRO_INCLUDEDIR_FILENAMES_p) /W4 /I. $(__DLLFLAG_p) /D_WINDOWS \
/DNOPCH $(__RTTIFLAG_11) $(__EXCEPTIONSFLAG_12) \
$(CPPFLAGS) $(CXXFLAGS)
MINIMAL_OBJECTS = \
$(OBJS)\unzip.obj \
$(OBJS)\OTM_GUI.obj \
$(OBJS)\OTM_GameInfo.obj \
$(OBJS)\OTM_GamePage.obj \
$(OBJS)\OTM_Server.obj \
$(OBJS)\OTM_Client.obj \
$(OBJS)\OTM_File.obj \
$(OBJS)\OTM_Sender.obj \
$(OBJS)\OTM_Language.obj
MINIMAL_RESOURCES = \
$(OBJS)\OTM_GUI.res
### Conditionally set variables: ###
!if "$(USE_GUI)" == "0"
PORTNAME = base
!endif
!if "$(USE_GUI)" == "1"
PORTNAME = msw
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
WXDEBUGFLAG = d
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
WXDEBUGFLAG = d
!endif
!if "$(UNICODE)" == "1"
WXUNICODEFLAG = u
!endif
!if "$(WXUNIV)" == "1"
WXUNIVNAME = univ
!endif
!if "$(TARGET_CPU)" == "AMD64"
DIR_SUFFIX_CPU = _amd64
!endif
!if "$(TARGET_CPU)" == "IA64"
DIR_SUFFIX_CPU = _ia64
!endif
!if "$(TARGET_CPU)" == "amd64"
DIR_SUFFIX_CPU = _amd64
!endif
!if "$(TARGET_CPU)" == "ia64"
DIR_SUFFIX_CPU = _ia64
!endif
!if "$(SHARED)" == "1"
WXDLLFLAG = dll
!endif
!if "$(SHARED)" == "0"
LIBTYPE_SUFFIX = lib
!endif
!if "$(SHARED)" == "1"
LIBTYPE_SUFFIX = dll
!endif
!if "$(TARGET_CPU)" == "AMD64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(TARGET_CPU)" == "IA64"
LINK_TARGET_CPU = /MACHINE:IA64
!endif
!if "$(TARGET_CPU)" == "amd64"
LINK_TARGET_CPU = /MACHINE:X64
!endif
!if "$(TARGET_CPU)" == "ia64"
LINK_TARGET_CPU = /MACHINE:IA64
!endif
!if "$(MONOLITHIC)" == "0"
EXTRALIBS_FOR_BASE =
!endif
!if "$(MONOLITHIC)" == "1"
EXTRALIBS_FOR_BASE =
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_0 = /Zi
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_0 =
!endif
!if "$(DEBUG_INFO)" == "0"
__DEBUGINFO_0 =
!endif
!if "$(DEBUG_INFO)" == "1"
__DEBUGINFO_0 = /Zi
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_1 = /DEBUG
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_1 =
!endif
!if "$(DEBUG_INFO)" == "0"
__DEBUGINFO_1 =
!endif
!if "$(DEBUG_INFO)" == "1"
__DEBUGINFO_1 = /DEBUG
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_2 = $(__DEBUGRUNTIME_5)
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_INFO)" == "default"
__DEBUGINFO_2 =
!endif
!if "$(DEBUG_INFO)" == "0"
__DEBUGINFO_2 =
!endif
!if "$(DEBUG_INFO)" == "1"
__DEBUGINFO_2 = $(__DEBUGRUNTIME_5)
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
____DEBUGRUNTIME_3_p = /D_DEBUG
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
____DEBUGRUNTIME_3_p =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
____DEBUGRUNTIME_3_p =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
____DEBUGRUNTIME_3_p = /D_DEBUG
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
____DEBUGRUNTIME_3_p_1 = /d _DEBUG
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
____DEBUGRUNTIME_3_p_1 =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
____DEBUGRUNTIME_3_p_1 =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
____DEBUGRUNTIME_3_p_1 = /d _DEBUG
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__DEBUGRUNTIME_4 = d
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__DEBUGRUNTIME_4 =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
__DEBUGRUNTIME_4 =
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
__DEBUGRUNTIME_4 = d
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__DEBUGRUNTIME_5 =
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__DEBUGRUNTIME_5 = /opt:ref /opt:icf
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
__DEBUGRUNTIME_5 = /opt:ref /opt:icf
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "1"
__DEBUGRUNTIME_5 =
!endif
!if "$(BUILD)" == "debug"
__OPTIMIZEFLAG_6 = /Od
!endif
!if "$(BUILD)" == "release"
__OPTIMIZEFLAG_6 = /O2
!endif
!if "$(USE_THREADS)" == "0"
__THREADSFLAG_9 = L
!endif
!if "$(USE_THREADS)" == "1"
__THREADSFLAG_9 = T
!endif
!if "$(RUNTIME_LIBS)" == "dynamic"
__RUNTIME_LIBS_10 = D
!endif
!if "$(RUNTIME_LIBS)" == "static"
__RUNTIME_LIBS_10 = $(__THREADSFLAG_9)
!endif
!if "$(USE_RTTI)" == "0"
__RTTIFLAG_11 =
!endif
!if "$(USE_RTTI)" == "1"
__RTTIFLAG_11 = /GR
!endif
!if "$(USE_EXCEPTIONS)" == "0"
__EXCEPTIONSFLAG_12 =
!endif
!if "$(USE_EXCEPTIONS)" == "1"
__EXCEPTIONSFLAG_12 = /EHsc
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "0"
__NO_VC_CRTDBG_p = /D__NO_VC_CRTDBG__
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_FLAG)" == "1"
__NO_VC_CRTDBG_p = /D__NO_VC_CRTDBG__
!endif
!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "0"
__NO_VC_CRTDBG_p_1 = /d __NO_VC_CRTDBG__
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_FLAG)" == "1"
__NO_VC_CRTDBG_p_1 = /d __NO_VC_CRTDBG__
!endif
!if "$(WXUNIV)" == "1"
__WXUNIV_DEFINE_p = /D__WXUNIVERSAL__
!endif
!if "$(WXUNIV)" == "1"
__WXUNIV_DEFINE_p_1 = /d __WXUNIVERSAL__
!endif
!if "$(DEBUG_FLAG)" == "0"
__DEBUG_DEFINE_p = /DwxDEBUG_LEVEL=0
!endif
!if "$(DEBUG_FLAG)" == "0"
__DEBUG_DEFINE_p_1 = /d wxDEBUG_LEVEL=0
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__NDEBUG_DEFINE_p = /DNDEBUG
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
__NDEBUG_DEFINE_p = /DNDEBUG
!endif
!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default"
__NDEBUG_DEFINE_p_1 = /d NDEBUG
!endif
!if "$(DEBUG_RUNTIME_LIBS)" == "0"
__NDEBUG_DEFINE_p_1 = /d NDEBUG
!endif
!if "$(USE_EXCEPTIONS)" == "0"
__EXCEPTIONS_DEFINE_p = /DwxNO_EXCEPTIONS
!endif
!if "$(USE_EXCEPTIONS)" == "0"
__EXCEPTIONS_DEFINE_p_1 = /d wxNO_EXCEPTIONS
!endif
!if "$(USE_RTTI)" == "0"
__RTTI_DEFINE_p = /DwxNO_RTTI
!endif
!if "$(USE_RTTI)" == "0"
__RTTI_DEFINE_p_1 = /d wxNO_RTTI
!endif
!if "$(USE_THREADS)" == "0"
__THREAD_DEFINE_p = /DwxNO_THREADS
!endif
!if "$(USE_THREADS)" == "0"
__THREAD_DEFINE_p_1 = /d wxNO_THREADS
!endif
!if "$(UNICODE)" == "0"
__UNICODE_DEFINE_p = /DwxUSE_UNICODE=0
!endif
!if "$(UNICODE)" == "1"
__UNICODE_DEFINE_p = /D_UNICODE
!endif
!if "$(UNICODE)" == "0"
__UNICODE_DEFINE_p_1 = /d wxUSE_UNICODE=0
!endif
!if "$(UNICODE)" == "1"
__UNICODE_DEFINE_p_1 = /d _UNICODE
!endif
!if "$(MSLU)" == "1"
__MSLU_DEFINE_p = /DwxUSE_UNICODE_MSLU=1
!endif
!if "$(MSLU)" == "1"
__MSLU_DEFINE_p_1 = /d wxUSE_UNICODE_MSLU=1
!endif
!if "$(USE_CAIRO)" == "1"
____CAIRO_INCLUDEDIR_FILENAMES_p = /I$(CAIRO_ROOT)\include\cairo
!endif
!if "$(USE_CAIRO)" == "1"
____CAIRO_INCLUDEDIR_FILENAMES_1_p = /i $(CAIRO_ROOT)\include\cairo
!endif
!if "$(SHARED)" == "1"
__DLLFLAG_p = /DWXUSINGDLL
!endif
!if "$(SHARED)" == "1"
__DLLFLAG_p_1 = /d WXUSINGDLL
!endif
!if "$(MONOLITHIC)" == "0"
__WXLIB_CORE_p = \
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core.lib
!endif
!if "$(MONOLITHIC)" == "0"
__WXLIB_BASE_p = \
wxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
!endif
!if "$(MONOLITHIC)" == "1"
__WXLIB_MONO_p = \
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
!endif
!if "$(USE_GUI)" == "1"
__LIB_TIFF_p = wxtiff$(WXDEBUGFLAG).lib
!endif
!if "$(USE_GUI)" == "1"
__LIB_JPEG_p = wxjpeg$(WXDEBUGFLAG).lib
!endif
!if "$(USE_GUI)" == "1"
__LIB_PNG_p = wxpng$(WXDEBUGFLAG).lib
!endif
!if "$(MSLU)" == "1"
__UNICOWS_LIB_p = unicows.lib
!endif
!if "$(USE_CAIRO)" == "1"
__CAIRO_LIB_p = cairo.lib
!endif
!if "$(USE_CAIRO)" == "1"
____CAIRO_LIBDIR_FILENAMES_p = /LIBPATH:$(CAIRO_ROOT)\lib
!endif
all: $(OBJS)
$(OBJS):
-if not exist $(OBJS) mkdir $(OBJS)
### Targets: ###
all: $(OBJS_exe)\OTM_GUI.exe
clean:
-if exist $(OBJS)\*.obj del $(OBJS)\*.obj
-if exist $(OBJS)\*.res del $(OBJS)\*.res
-if exist $(OBJS)\*.pch del $(OBJS)\*.pch
-if exist $(OBJS_exe)\OTM_GUI.exe del $(OBJS_exe)\OTM_GUI.exe
-if exist $(OBJS_exe)\OTM_GUI.ilk del $(OBJS_exe)\OTM_GUI.ilk
-if exist $(OBJS_exe)\OTM_GUI.pdb del $(OBJS_exe)\OTM_GUI.pdb
$(OBJS_exe)\OTM_GUI.exe: $(MINIMAL_OBJECTS) $(OBJS)\OTM_GUI.res
link /NOLOGO /OUT:$@ $(__DEBUGINFO_1) /pdb:"$(OBJS)\OTM_GUI.pdb" $(__DEBUGINFO_2) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
$(MINIMAL_OBJECTS) $(MINIMAL_RESOURCES) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib
<<
$(OBJS)\OTM_GUI.res: OTM.rc
rc /fo$@ /d WIN32 $(____DEBUGRUNTIME_3_p_1) $(__NO_VC_CRTDBG_p_1) /d __WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__NDEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) $(__UNICODE_DEFINE_p_1) $(__MSLU_DEFINE_p_1) /i $(SETUPHDIR) /i . $(__DLLFLAG_p_1) /d _WINDOWS /d NOPCH OTM.rc
#$(OBJS)\display_display.obj: .\display.cpp
# $(CXX) /c /nologo /TP /Fo$@ $(DISPLAY_CXXFLAGS) .\display.cpp
$(OBJS)\unzip.obj: .\unzip.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\unzip.cpp
$(OBJS)\OTM_GUI.obj: .\OTM_GUI.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\OTM_GUI.cpp
$(OBJS)\OTM_GameInfo.obj: .\OTM_GameInfo.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\OTM_GameInfo.cpp
$(OBJS)\OTM_GamePage.obj: .\OTM_GamePage.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\OTM_GamePage.cpp
$(OBJS)\OTM_Server.obj: .\OTM_Server.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\OTM_Server.cpp
$(OBJS)\OTM_Client.obj: .\OTM_Client.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\OTM_Client.cpp
$(OBJS)\OTM_File.obj: .\OTM_File.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\OTM_File.cpp
$(OBJS)\OTM_Sender.obj: .\OTM_Sender.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\OTM_Sender.cpp
$(OBJS)\OTM_Language.obj: .\OTM_Language.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\OTM_Language.cpp
+5 -4
View File
@@ -3,7 +3,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h> /*added by ROTA*/
//#include <wchar.h> /*added by ROTA*/
#include <tchar.h>
#include "unzip.h"
@@ -1562,8 +1562,9 @@ int inflate_blocks_free(inflate_blocks_statef *s, z_streamp z)
extern const char inflate_copyright[] =
" inflate 1.1.3 Copyright 1995-1998 Mark Adler ";
// allready added in wxWidgets
//extern const char inflate_copyright[] =
// " inflate 1.1.3 Copyright 1995-1998 Mark Adler ";
// If you use the zlib library in a product, an acknowledgment is welcome
// in the documentation of your product. If for some reason you cannot
// include such an acknowledgment, I would appreciate that you keep this
@@ -3515,7 +3516,7 @@ int unzReadCurrentFile (unzFile file, voidp buf, unsigned len, bool *reached_eo
if (uDoEncHead>pfile_in_zip_read_info->stream.avail_in) uDoEncHead=pfile_in_zip_read_info->stream.avail_in;
if (uDoEncHead>0)
{ char bufcrc=pfile_in_zip_read_info->stream.next_in[uDoEncHead-1];
pfile_in_zip_read_info->rest_read_uncompressed-=uDoEncHead;
//pfile_in_zip_read_info->rest_read_uncompressed-=uDoEncHead; // commented by ROTA
pfile_in_zip_read_info->stream.avail_in -= uDoEncHead;
pfile_in_zip_read_info->stream.next_in += uDoEncHead;
pfile_in_zip_read_info->encheadleft -= uDoEncHead;
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef _unzip_H
#define _unzip_H
//#define TCHAR char
// UNZIPPING functions -- for unzipping.
// This file is a repackaged form of extracts from the zlib code available
// at www.gzip.org/zlib, by Jean-Loup Gailly and Mark Adler. The original
+3 -3
View File
@@ -1140,7 +1140,7 @@ void send_all_trees(TState &state,int lcodes, int dcodes, int blcodes)
for (rank = 0; rank < blcodes; rank++) {
Trace("\nbl code %2d ", bl_order[rank]);
send_bits(state,state.ts.bl_tree[bl_order[rank]].dl.len, 3);
}
}
Trace("\nbl tree: sent %ld", state.bs.bits_sent);
send_tree(state,(ct_data *)state.ts.dyn_ltree, lcodes-1); /* send the literal tree */
@@ -1637,7 +1637,7 @@ int longest_match(TState &state,IPos cur_match)
scan < strend);
Assert(state,scan <= state.ds.window+(unsigned)(state.ds.window_size-1), "wild scan");
len = MAX_MATCH - (int)(strend - scan);
scan = strend - MAX_MATCH;
@@ -2155,7 +2155,7 @@ lutime_t filetime2timet(const FILETIME ft)
void filetime2dosdatetime(const FILETIME ft, WORD *dosdate,WORD *dostime)
{ // date: bits 0-4 are day of month 1-31. Bits 5-8 are month 1..12. Bits 9-15 are year-1980
// time: bits 0-4 are seconds/2, bits 5-10 are minute 0..59. Bits 11-15 are hour 0..23
SYSTEMTIME st; FileTimeToSystemTime(&ft,&st);
SYSTEMTIME st; FileTimeToSystemTime(&ft,&st);
*dosdate = (WORD)(((st.wYear-1980)&0x7f) << 9);
*dosdate |= (WORD)((st.wMonth&0xf) << 5);
*dosdate |= (WORD)((st.wDay&0x1f));