From 8d4ab8963ffda8494d25e35e1811ae95da28b23e Mon Sep 17 00:00:00 2001 From: "code@koerner-de.net" Date: Tue, 4 Oct 2011 20:08:45 +0000 Subject: [PATCH] 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 --- .gitattributes | 15 +- OTM_DX9/.cproject | 87 ---- OTM_DX9/.project | 70 --- .../org.eclipse.cdt.codan.core.prefs | 67 --- .../org.eclipse.cdt.managedbuilder.core.prefs | 14 - OTM_DX9/{makefile => makefile.gcc} | 0 OTM_DX9/makefile.vc | 67 +++ OTM_GUI/.cproject | 53 -- OTM_GUI/.project | 71 --- OTM_GUI/OTM_Client.cpp | 2 + OTM_GUI/OTM_File.cpp | 455 ++++++++++++++++++ OTM_GUI/OTM_File.h | 62 +++ OTM_GUI/OTM_GUI.cpp | 11 +- OTM_GUI/OTM_GameInfo.cpp | 16 +- OTM_GUI/OTM_GamePage.cpp | 63 ++- OTM_GUI/OTM_GamePage.h | 2 +- OTM_GUI/OTM_Language.cpp | 8 +- OTM_GUI/OTM_Language.h | 5 +- OTM_GUI/OTM_Main.h | 3 +- OTM_GUI/OTM_Sender.cpp | 344 +------------ OTM_GUI/OTM_Sender.h | 19 +- .../bin/Example_OTM_LanguagePack_English.txt | 10 +- OTM_GUI/bin/OTM_LanguagePack_Deutsch.txt | 5 +- OTM_GUI/bin/README_Deutsch.txt | 10 + OTM_GUI/bin/README_English.txt | 9 + OTM_GUI/config.vc | 149 ++++++ OTM_GUI/{makefile => makefile.gcc} | 10 +- OTM_GUI/makefile.vc | 389 +++++++++++++++ OTM_GUI/unzip.cpp | 9 +- OTM_GUI/unzip.h | 2 +- OTM_GUI/zip.cpp | 6 +- 31 files changed, 1267 insertions(+), 766 deletions(-) delete mode 100644 OTM_DX9/.cproject delete mode 100644 OTM_DX9/.project delete mode 100644 OTM_DX9/.settings/org.eclipse.cdt.codan.core.prefs delete mode 100644 OTM_DX9/.settings/org.eclipse.cdt.managedbuilder.core.prefs rename OTM_DX9/{makefile => makefile.gcc} (100%) create mode 100644 OTM_DX9/makefile.vc delete mode 100644 OTM_GUI/.cproject delete mode 100644 OTM_GUI/.project create mode 100644 OTM_GUI/OTM_File.cpp create mode 100644 OTM_GUI/OTM_File.h create mode 100644 OTM_GUI/config.vc rename OTM_GUI/{makefile => makefile.gcc} (93%) create mode 100644 OTM_GUI/makefile.vc diff --git a/.gitattributes b/.gitattributes index 0177d66..02755af 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/OTM_DX9/.cproject b/OTM_DX9/.cproject deleted file mode 100644 index 11576fa..0000000 --- a/OTM_DX9/.cproject +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OTM_DX9/.project b/OTM_DX9/.project deleted file mode 100644 index fc3fd60..0000000 --- a/OTM_DX9/.project +++ /dev/null @@ -1,70 +0,0 @@ - - - OTM_DX9 - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.buildArguments - - - - org.eclipse.cdt.make.core.buildCommand - make - - - org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/OTM_DX9/Default} - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - true - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - true - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - - diff --git a/OTM_DX9/.settings/org.eclipse.cdt.codan.core.prefs b/OTM_DX9/.settings/org.eclipse.cdt.codan.core.prefs deleted file mode 100644 index 0722ad0..0000000 --- a/OTM_DX9/.settings/org.eclipse.cdt.codan.core.prefs +++ /dev/null @@ -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 diff --git a/OTM_DX9/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/OTM_DX9/.settings/org.eclipse.cdt.managedbuilder.core.prefs deleted file mode 100644 index 1229533..0000000 --- a/OTM_DX9/.settings/org.eclipse.cdt.managedbuilder.core.prefs +++ /dev/null @@ -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 diff --git a/OTM_DX9/makefile b/OTM_DX9/makefile.gcc similarity index 100% rename from OTM_DX9/makefile rename to OTM_DX9/makefile.gcc diff --git a/OTM_DX9/makefile.vc b/OTM_DX9/makefile.vc new file mode 100644 index 0000000..faa36af --- /dev/null +++ b/OTM_DX9/makefile.vc @@ -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) \ No newline at end of file diff --git a/OTM_GUI/.cproject b/OTM_GUI/.cproject deleted file mode 100644 index b7587e2..0000000 --- a/OTM_GUI/.cproject +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/OTM_GUI/.project b/OTM_GUI/.project deleted file mode 100644 index cff2c88..0000000 --- a/OTM_GUI/.project +++ /dev/null @@ -1,71 +0,0 @@ - - - OTM_GUI - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.buildArguments - - - - org.eclipse.cdt.make.core.buildCommand - make - - - org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/OTM_GUI/Default} - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - true - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - - diff --git a/OTM_GUI/OTM_Client.cpp b/OTM_GUI/OTM_Client.cpp index d4c8a5a..fba10b4 100644 --- a/OTM_GUI/OTM_Client.cpp +++ b/OTM_GUI/OTM_Client.cpp @@ -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; } } diff --git a/OTM_GUI/OTM_File.cpp b/OTM_GUI/OTM_File.cpp new file mode 100644 index 0000000..96aad08 --- /dev/null +++ b/OTM_GUI/OTM_File.cpp @@ -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; i0) 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; i0u && FileInMemory[pos]) pos--; + if (pos>0u && pos> 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; iTextures[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=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; iTextures[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; +} diff --git a/OTM_GUI/OTM_File.h b/OTM_GUI/OTM_File.h new file mode 100644 index 0000000..8951438 --- /dev/null +++ b/OTM_GUI/OTM_File.h @@ -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_ */ diff --git a/OTM_GUI/OTM_GUI.cpp b/OTM_GUI/OTM_GUI.cpp index 31a000f..5cb81ef 100644 --- a/OTM_GUI/OTM_GUI.cpp +++ b/OTM_GUI/OTM_GUI.cpp @@ -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; iDeletePage(i); - Clients[i]->Delete(); + Clients[i]->Wait(); delete Clients[i]; NumberOfGames--; for (int j=i; j=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; iAdd( (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; iSetValue( 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; iSetLabel(Files[i]); + for (int i=id+1; iSetValue(CheckBoxes[i]->GetValue()); + wxString cpy_str; + for (int i=id+1; iGetToolTip()->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; } diff --git a/OTM_GUI/OTM_GamePage.h b/OTM_GUI/OTM_GamePage.h index b818c03..38833c7 100644 --- a/OTM_GUI/OTM_GamePage.h +++ b/OTM_GUI/OTM_GamePage.h @@ -79,7 +79,7 @@ private: wxTextCtrl *SavePath; wxBoxSizer **CheckBoxHSizers; - wxBoxSizer *CheckBoxVSizer; + //wxBoxSizer *CheckBoxVSizer; wxButton **CheckButtonUp; wxButton **CheckButtonDown; wxButton **CheckButtonDelete; diff --git a/OTM_GUI/OTM_Language.cpp b/OTM_GUI/OTM_Language.cpp index c7c404b..09401b5 100644 --- a/OTM_GUI/OTM_Language.cpp +++ b/OTM_GUI/OTM_Language.cpp @@ -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."; diff --git a/OTM_GUI/OTM_Language.h b/OTM_GUI/OTM_Language.h index 9f71c4c..a16390e 100644 --- a/OTM_GUI/OTM_Language.h +++ b/OTM_GUI/OTM_Language.h @@ -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; diff --git a/OTM_GUI/OTM_Main.h b/OTM_GUI/OTM_Main.h index c27fc01..c665e27 100644 --- a/OTM_GUI/OTM_Main.h +++ b/OTM_GUI/OTM_Main.h @@ -40,8 +40,8 @@ along with OpenTexMod. If not, see . #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" diff --git a/OTM_GUI/OTM_Sender.cpp b/OTM_GUI/OTM_Sender.cpp index ec4ebc7..f04f61f 100644 --- a/OTM_GUI/OTM_Sender.cpp +++ b/OTM_GUI/OTM_Sender.cpp @@ -20,55 +20,6 @@ along with OpenTexMod. If not, see . #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; iEmpty(); + 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; iAdd(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; iNum; + for (unsigned int i=0u; iHash = 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; lControl = 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=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; iTextures[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; -} diff --git a/OTM_GUI/OTM_Sender.h b/OTM_GUI/OTM_Sender.h index 9efe7f5..b960e45 100644 --- a/OTM_GUI/OTM_Sender.h +++ b/OTM_GUI/OTM_Sender.h @@ -22,23 +22,6 @@ along with OpenTexMod. If not, see . #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; diff --git a/OTM_GUI/bin/Example_OTM_LanguagePack_English.txt b/OTM_GUI/bin/Example_OTM_LanguagePack_English.txt index 01f4818..46aa76e 100644 --- a/OTM_GUI/bin/Example_OTM_LanguagePack_English.txt +++ b/OTM_GUI/bin/Example_OTM_LanguagePack_English.txt @@ -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: diff --git a/OTM_GUI/bin/OTM_LanguagePack_Deutsch.txt b/OTM_GUI/bin/OTM_LanguagePack_Deutsch.txt index 3c36b14..6f3bb49 100644 --- a/OTM_GUI/bin/OTM_LanguagePack_Deutsch.txt +++ b/OTM_GUI/bin/OTM_LanguagePack_Deutsch.txt @@ -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| diff --git a/OTM_GUI/bin/README_Deutsch.txt b/OTM_GUI/bin/README_Deutsch.txt index 026699d..de9da45 100644 --- a/OTM_GUI/bin/README_Deutsch.txt +++ b/OTM_GUI/bin/README_Deutsch.txt @@ -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. diff --git a/OTM_GUI/bin/README_English.txt b/OTM_GUI/bin/README_English.txt index 5bfd24a..b9dcbd7 100644 --- a/OTM_GUI/bin/README_English.txt +++ b/OTM_GUI/bin/README_English.txt @@ -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? diff --git a/OTM_GUI/config.vc b/OTM_GUI/config.vc new file mode 100644 index 0000000..62a020b --- /dev/null +++ b/OTM_GUI/config.vc @@ -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 + diff --git a/OTM_GUI/makefile b/OTM_GUI/makefile.gcc similarity index 93% rename from OTM_GUI/makefile rename to OTM_GUI/makefile.gcc index ca17ee0..0b57651 100644 --- a/OTM_GUI/makefile +++ b/OTM_GUI/makefile.gcc @@ -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) $< diff --git a/OTM_GUI/makefile.vc b/OTM_GUI/makefile.vc new file mode 100644 index 0000000..2deee2c --- /dev/null +++ b/OTM_GUI/makefile.vc @@ -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 + +# ------------------------------------------------------------------------- +# 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 diff --git a/OTM_GUI/unzip.cpp b/OTM_GUI/unzip.cpp index fca460a..77c330a 100644 --- a/OTM_GUI/unzip.cpp +++ b/OTM_GUI/unzip.cpp @@ -3,7 +3,7 @@ #include #include #include -#include /*added by ROTA*/ +//#include /*added by ROTA*/ #include #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; diff --git a/OTM_GUI/unzip.h b/OTM_GUI/unzip.h index 5310f1d..d87d771 100644 --- a/OTM_GUI/unzip.h +++ b/OTM_GUI/unzip.h @@ -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 diff --git a/OTM_GUI/zip.cpp b/OTM_GUI/zip.cpp index 77d0724..fe33bf5 100644 --- a/OTM_GUI/zip.cpp +++ b/OTM_GUI/zip.cpp @@ -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));