diff --git a/.gitattributes b/.gitattributes
index 02755af..cf6250a 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -22,6 +22,8 @@ OTM_DX9/makefile.vc -text
/OTM_Error.h -text
OTM_GUI/OTM.ico -text
OTM_GUI/OTM.rc -text
+OTM_GUI/OTM_AddTexture.cpp -text
+OTM_GUI/OTM_AddTexture.h -text
OTM_GUI/OTM_Client.cpp -text
OTM_GUI/OTM_Client.h -text
OTM_GUI/OTM_Event.cpp -text
@@ -41,10 +43,15 @@ OTM_GUI/OTM_Sender.cpp -text
OTM_GUI/OTM_Sender.h -text
OTM_GUI/OTM_Server.cpp -text
OTM_GUI/OTM_Server.h -text
+OTM_GUI/OTM_Settings.cpp -text
+OTM_GUI/OTM_Settings.h -text
OTM_GUI/bin/Example_OTM_LanguagePack_English.txt -text
OTM_GUI/bin/OTM_LanguagePack_Deutsch.txt -text
OTM_GUI/bin/README_Deutsch.txt -text
OTM_GUI/bin/README_English.txt -text
+OTM_GUI/bin/languages/Example_OTM_LanguagePack_English.txt -text
+OTM_GUI/bin/languages/OTM_LanguagePackU_Deutsch.txt -text
+OTM_GUI/bin/languages/OTM_LanguagePackU_Russian.txt -text
OTM_GUI/config.gcc -text
OTM_GUI/config.vc -text
OTM_GUI/makefile.gcc -text
diff --git a/OTM_DX9/OTM_DX9_dll.cpp b/OTM_DX9/OTM_DX9_dll.cpp
index 368e32f..b295617 100644
--- a/OTM_DX9/OTM_DX9_dll.cpp
+++ b/OTM_DX9/OTM_DX9_dll.cpp
@@ -26,9 +26,8 @@ along with OpenTexMod. If not, see .
#include "OTM_Main.h"
-#include
-
-#pragma comment(lib, "Shlwapi.lib")
+//#include
+//#pragma comment(lib, "Shlwapi.lib")
OTM_IDirect3DDevice9* gl_pIDirect3DDevice9 = NULL;
@@ -99,14 +98,14 @@ IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion)
return (gl_pIDirect3D9);
}
-bool HookThisProgramm( wchar_t *ret)
+bool HookThisProgram( wchar_t *ret)
{
wchar_t Executable[MAX_PATH];
GetModuleFileNameW( GetModuleHandle( NULL ), Executable, MAX_PATH );
- PathStripPathW( Executable );
+
int len = 0;
while (Executable[len]) {ret[len] = Executable[len]; len++;}
- Executable[len] = 0;
+ ret[len] = 0;
return (true);
}
@@ -151,33 +150,34 @@ IDirect3D9 *APIENTRY MyDirect3DCreate9(UINT SDKVersion)
return (gl_pIDirect3D9);
}
-bool HookThisProgramm( wchar_t *ret)
+bool HookThisProgram( wchar_t *ret)
{
- //This method should be changed. Maybe the directory should be the user application directory.
FILE* file;
wchar_t *app_path = _wgetenv( L"APPDATA");
wchar_t file_name[MAX_PATH];
swprintf_s( file_name, MAX_PATH, L"%ls\\%ls\\%ls", app_path, OTM_APP_DIR, OTM_APP_DX9);
- if (_wfopen_s( &file, file_name, L"rt")) return (false);
+ if (_wfopen_s( &file, file_name, L"rt,ccs=UTF-16LE")) return (false);
wchar_t Executable[MAX_PATH];
wchar_t Game[MAX_PATH];
GetModuleFileNameW( GetModuleHandle( NULL ), Executable, MAX_PATH );
- PathStripPathW( Executable );
+ //MessageBoxW( NULL, Executable, L"test", 0);
while (!feof(file))
{
- if ( fgetws ( Game, MAX_PATH, file) != NULL )
+ if ( fgetws( Game, MAX_PATH, file) != NULL )
{
+ //MessageBoxW( NULL, Game, L"test", 0);
int len = 0;
while (Game[len])
{
- if (Game[len]=='\r' || Game[len]=='\n') {Game[len]=0; break;}
+ if (Game[len]==L'\r' || Game[len]==L'\n') {Game[len]=0; break;}
len++;
}
if ( _wcsicmp( Executable, Game ) == 0 )
{
for (int i=0; iOpenPipe())
+ if (gl_TextureServer->OpenPipe(game))
{
Message("InitInstance: Pipe not opened\n");
return;
@@ -219,7 +219,7 @@ void InitInstance(HINSTANCE hModule)
gl_ServerThread = CreateThread( NULL, 0, ServerThread, NULL, 0, NULL);
if (gl_ServerThread==NULL) Message("InitInstance: Serverthread not started\n");
- //this is for testing purpose, these function should be called from the server thread, provoked by the OTM_GUI
+ //this is for testing purpose, these functions should be called from the server thread, provoked by the OTM_GUI
//gl_TextureServer->SaveAllTextures(true);
//gl_TextureServer->SetSaveDirectory("tex\\");
/*
diff --git a/OTM_DX9/OTM_Defines.h b/OTM_DX9/OTM_Defines.h
index 5288e3e..c1cd1cd 100644
--- a/OTM_DX9/OTM_Defines.h
+++ b/OTM_DX9/OTM_Defines.h
@@ -22,13 +22,16 @@ along with OpenTexMod. If not, see .
#define OTM_DEFINES_H_
+#ifdef ALPHA
#define Message(...) {if (gl_File!=NULL) {fprintf( gl_File, __VA_ARGS__); fflush(gl_File);}}
#define OpenMessage(...) {if (fopen_s( &gl_File, "OTM_log.txt", "wt")) gl_File=NULL;}
#define CloseMessage(...) {if (gl_File!=NULL) fclose(gl_File);}
+#else
+#define OpenMessage(...)
+#define Message(...)
+#define CloseMessage(...)
+#endif
-//#define OpenMessage(...)
-//#define Message(...)
-//#define CloseMessage(...)
#ifdef __CDT_PARSER__
typedef unsigned long DWORD64;
diff --git a/OTM_DX9/OTM_TextureClient.cpp b/OTM_DX9/OTM_TextureClient.cpp
index 2884d41..db50ab2 100644
--- a/OTM_DX9/OTM_TextureClient.cpp
+++ b/OTM_DX9/OTM_TextureClient.cpp
@@ -334,10 +334,11 @@ int OTM_TextureClient::MergeUpdate(void)
Update[u].Checked = true;
found = true;
Update[u].pTexture = FileToMod[i].pTexture; //might also be a NULL pointer
+
if (Update[u].ForceReload && Update[i].pTexture!=NULL)
{
OTM_IDirect3DTexture9 *pTexture = Update[u].pTexture->CrossRef_D3Dtex;
- RemoveTexture( Update[u].pTexture);
+ Update[u].pTexture->Release();
Update[u].pTexture = NULL;
if (pTexture!=NULL) //should always be the case
{
diff --git a/OTM_DX9/OTM_TextureServer.cpp b/OTM_DX9/OTM_TextureServer.cpp
index 1a00e2e..baced4f 100644
--- a/OTM_DX9/OTM_TextureServer.cpp
+++ b/OTM_DX9/OTM_TextureServer.cpp
@@ -33,9 +33,22 @@ OTM_TextureServer::OTM_TextureServer(wchar_t *game)
BoolSaveAllTextures = false;
BoolSaveSingleTexture = false;
SavePath[0] = 0;
- int i=0;
- for (i=0; ipath_pos) len = dot_pos - path_pos;
+ else len -= path_pos;
+
+ for (int i=0; iValue;
- Message("MainLoop: CONTROL_ADD_TEXTURE_DATA (%#lX %u, %u %u): %lu\n", commands->Hash, size, sizeof(MsgStruct), sizeof(char), this);
+ Message("MainLoop: CONTROL_FORCE_RELOAD_TEXTURE_DATA (%#lX %u, %u %u): %lu\n", commands->Hash, size, sizeof(MsgStruct), sizeof(char), this);
if (pos + sizeof(MsgStruct) + size <= num) AddFile( &buffer[pos + sizeof(MsgStruct)], size, commands->Hash, force);
update_textures = true;
force = false;
@@ -669,7 +682,7 @@ int OTM_TextureServer::MainLoop(void) // run as a separated thread !!
return (RETURN_OK);
}
-int OTM_TextureServer::OpenPipe(void) // called from InitInstance()
+int OTM_TextureServer::OpenPipe(wchar_t *game) // called from InitInstance()
{
Message("OpenPipe: Out\n")
// open first outgoing pipe !!
@@ -685,11 +698,11 @@ int OTM_TextureServer::OpenPipe(void) // called from InitInstance()
if (Pipe.Out == INVALID_HANDLE_VALUE) return (RETURN_PIPE_NOT_OPENED);
unsigned int len = 0u;
- while (GameName[len]) len++;
+ while (game[len]) len++;
len++; //to send also the zero
unsigned long num;
//send name of this game to OTM_GUI
- WriteFile(Pipe.Out, (const void*) GameName, len * sizeof(wchar_t), &num, NULL);
+ WriteFile(Pipe.Out, (const void*) game, len * sizeof(wchar_t), &num, NULL);
Message("OpenPipe: In\n");
Pipe.In = CreateFileW(PIPE_OTM2Game, // pipe name
diff --git a/OTM_DX9/OTM_TextureServer.h b/OTM_DX9/OTM_TextureServer.h
index e904fd7..373beeb 100644
--- a/OTM_DX9/OTM_TextureServer.h
+++ b/OTM_DX9/OTM_TextureServer.h
@@ -38,7 +38,7 @@ public:
int AddClient(OTM_TextureClient *client, TextureFileStruct** update, int* number);
int RemoveClient(OTM_TextureClient *client);
- int OpenPipe(void);
+ int OpenPipe(wchar_t *name);
int ClosePipe(void);
int MainLoop(void);
diff --git a/OTM_DX9/makefile.gcc b/OTM_DX9/makefile.gcc
index d5bc0fb..7bbd891 100644
--- a/OTM_DX9/makefile.gcc
+++ b/OTM_DX9/makefile.gcc
@@ -1,10 +1,23 @@
ifdef NO_INJECTION
-prcompiler_flag = /D "NO_INJECTION"
+
+ifdef ALPHA
+precompiler_flag = /D "ALPHA" /D "NO_INJECTION"
+else
+precompiler_flag = /D "NO_INJECTION"
+endif
+
def_file = /DEF:"OTM_DX9_dll_NO_INJECTION.def"
obj_suff = NO_INJECTION.obj
dll = d3d9.dll
+
else
-prcompiler_flag =
+
+ifdef ALPHA
+precompiler_flag = /D "ALPHA"
+else
+precompiler_flag =
+endif
+
def_file = /DEF:"OTM_DX9_dll.def"
obj_suff = obj
dll = OTM_d3d9.dll
@@ -14,7 +27,7 @@ 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
+CFLAGS = /I "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include" /nologo /W3 /WX- /O2 ${DEFINES} ${precompiler_flag} /Gm- /EHsc /MT /GS /fp:precise /Zc:wchar_t
LFLAGS = /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86" /DLL "Winmm.lib" "d3dx9.lib" "user32.lib" "Kernel32.lib" ${def_file} /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /TLBID:1 /DYNAMICBASE:NO /NXCOMPAT:NO /MACHINE:X86
obj = obj
diff --git a/OTM_DX9/makefile.vc b/OTM_DX9/makefile.vc
index faa36af..48bcfb6 100644
--- a/OTM_DX9/makefile.vc
+++ b/OTM_DX9/makefile.vc
@@ -1,10 +1,23 @@
!IFDEF NO_INJECTION
-prcompiler_flag = /D "NO_INJECTION"
+
+!IFDEF ALPHA
+precompiler_flag = /D "ALPHA" /D "NO_INJECTION"
+!ELSE
+precompiler_flag = /D "NO_INJECTION"
+!ENDIF
+
def_file = /DEF:"OTM_DX9_dll_NO_INJECTION.def"
obj_suff = NO_INJECTION.obj
dll = d3d9.dll
+
!ELSE
-prcompiler_flag =
+
+!IFDEF ALPHA
+precompiler_flag = /D "ALPHA"
+!ELSE
+precompiler_flag =
+!ENDIF
+
def_file = /DEF:"OTM_DX9_dll.def"
obj_suff = obj
dll = OTM_d3d9.dll
@@ -14,7 +27,7 @@ dll = OTM_d3d9.dll
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
+CFLAGS = /I "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include" /nologo /W3 /WX- /O2 $(DEFINES) $(precompiler_flag) /Gm- /EHsc /MT /GS /fp:precise /Zc:wchar_t
LFLAGS = /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86" /DLL "Winmm.lib" "d3dx9.lib" "user32.lib" "Kernel32.lib" $(def_file) /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /TLBID:1 /DYNAMICBASE:NO /NXCOMPAT:NO /MACHINE:X86
obj = obj
diff --git a/OTM_GUI/OTM_AddTexture.cpp b/OTM_GUI/OTM_AddTexture.cpp
new file mode 100644
index 0000000..d7674e8
--- /dev/null
+++ b/OTM_GUI/OTM_AddTexture.cpp
@@ -0,0 +1,112 @@
+/*
+This file is part of OpenTexMod.
+
+
+OpenTexMod is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+OpenTexMod is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with OpenTexMod. If not, see .
+*/
+
+
+
+#include "OTM_Main.h"
+
+
+
+AddTextureClass::AddTextureClass(void)
+{
+ Num = 0;
+ Textures = NULL;
+ Size = NULL;
+ Hash = NULL;
+ WasAdded = NULL;
+ Len=0;
+
+ Add = false;
+ Force = false;
+ Loaded = false;
+ OwnMemory = false;
+}
+
+AddTextureClass::~AddTextureClass(void)
+{
+ ReleaseMemory();
+}
+
+int AddTextureClass::ReleaseMemory(void)
+{
+ if (OwnMemory)
+ {
+ if (Size!=NULL) delete [] Size;
+ if (Hash!=NULL) delete [] Hash;
+ if (WasAdded!=NULL) delete [] WasAdded;
+
+
+ if (Textures!=NULL)
+ {
+ for (unsigned int i=0; i0)
+ {
+ if (GetMemory( Textures[i], tex.Size[i])) return -1;
+ for (unsigned int j=0u; j.
+*/
+
+
+#ifndef OTM_ADDTEXTURE_H_
+#define OTM_ADDTEXTURE_H_
+
+#include "OTM_Main.h"
+
+class AddTextureClass
+{
+public:
+ AddTextureClass(void);
+ ~AddTextureClass(void);
+ int ReleaseMemory(void);
+
+ int SetSize(int num);
+ int InheriteMemory(AddTextureClass &tex);
+
+ unsigned int Num;
+ char **Textures;
+ unsigned int *Size;
+ unsigned long *Hash;
+ bool *WasAdded;
+ unsigned int Len;
+
+ bool Add;
+ bool Force;
+ bool Loaded;
+ bool OwnMemory;
+ wxString File;
+ wxString Comment;
+
+
+};
+
+
+
+#endif /* OTM_ADDTEXTURE_H_ */
diff --git a/OTM_GUI/OTM_File.cpp b/OTM_GUI/OTM_File.cpp
index 655886a..0d39c4c 100644
--- a/OTM_GUI/OTM_File.cpp
+++ b/OTM_GUI/OTM_File.cpp
@@ -1,53 +1,26 @@
+/*
+This file is part of OpenTexMod.
-#include "OTM_File.h"
+OpenTexMod is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+OpenTexMod is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with 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; iNoComment;
return -1;
}
return 0;
}
-int OTM_File::GetContent( AddTextureClass *tex, bool add, bool force)
+int OTM_File::GetContent( AddTextureClass &tex, bool add)
{
wxString file_type = FileName.AfterLast( '.');
if (file_type == L"zip")
{
- AddZip( tex, add, force, false);
+ AddZip( tex, add, false);
}
else if (file_type == L"tpf")
{
- AddZip( tex, add, force, true);
+ AddZip( tex, add, true);
}
else if (file_type == L"dds")
{
- AddFile( tex, add, force);
+ AddFile( tex, add);
}
else
{
- LastError << Language.Error_FileNotSupported;
+ LastError << Language->Error_FileNotSupported;
LastError << "\n" << FileName;
}
if (LastError.Len()>0) return -1;
- else return 0;
+ else
+ {
+ if (add) tex.Loaded = true;
+ return 0;
+ }
}
int OTM_File::ReadFile(void)
@@ -133,23 +110,23 @@ int OTM_File::ReadFile(void)
XORed=false;
wxFile dat;
- if (!dat.Access(FileName, wxFile::read)) {LastError << Language.Error_FileOpen <<"\n" << FileName; return -1;}
+ 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;}
+ 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==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;}
+ 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;}
+ if (result != FileLen) {FileLen=0; LastError << Language->Error_FileRead<<"\n" << FileName; return -1;}
FileInMemory[FileLen]=0;
Loaded = true;
@@ -206,7 +183,7 @@ 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;}
+ if (ZIP_Handle==NULL) {tool_tip = Language->NoComment; LastError << Language->Error_Unzip; return -1;}
ZIPENTRY ze;
int index;
@@ -216,15 +193,15 @@ int OTM_File::GetCommentZip( wxString &tool_tip)
char* comment;
int len = ze.unc_size;
try {comment=new char[len+1];}
- catch(...) {tool_tip = Language.NoComment; LastError << Language.Error_Memory; return -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;}
+ 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;
+ else tool_tip = Language->NoComment;
CloseZip(ZIP_Handle);
return 0;
@@ -236,7 +213,7 @@ int OTM_File::GetCommentTpf( wxString &tool_tip)
UnXOR();
tool_tip = &FileInMemory[FileLen];
- tool_tip.Prepend( Language.Author);
+ tool_tip.Prepend( Language->Author);
return 0;
}
@@ -248,34 +225,32 @@ int OTM_File::GetCommentTpf( wxString &tool_tip)
-int OTM_File::AddFile( AddTextureClass *tex, bool add, bool force)
+int OTM_File::AddFile( AddTextureClass &tex, bool add)
{
- tex->SetSize(1);
+ 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 (!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;
+ try {tex.Textures[0] = new char[FileLen];}
+ catch (...) {tex.Textures[0]=NULL; LastError << Language->Error_Memory; return -1;}
+ for (unsigned int i=0; iSize[0] = 0; tex->Textures[0] = NULL;}
+ else {tex.Size[0] = 0; tex.Textures[0] = NULL;}
- tex->Num = 1;
- tex->Add[0] = add;
- tex->Force[0] = force;
- tex->Hash[0] = temp_hash;
+ tex.Num = 1;
+ tex.Hash[0] = temp_hash;
return 0;
}
-int OTM_File::AddZip( AddTextureClass *tex, bool add, bool force, bool tpf)
+int OTM_File::AddZip( AddTextureClass &tex, bool add, bool tpf)
{
if (int ret = ReadFile()) return ret;
@@ -290,16 +265,16 @@ int OTM_File::AddZip( AddTextureClass *tex, bool add, bool force, bool tpf)
0x77, 0x6E, 0x46, 0x47, 0x77, 0x49, 0x0C, 0x4B,
0x46, 0x6F, '\0'};
- return AddContent( pw, tex, add, force);
+ return AddContent( pw, tex, add);
}
else
{
- return AddContent( NULL, tex, add, force);
+ return AddContent( NULL, tex, add);
}
}
-int OTM_File::AddContent( const char* pw, AddTextureClass *tex, bool add, bool force)
+int OTM_File::AddContent( const char* pw, AddTextureClass &tex, bool add)
{
// 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.
@@ -313,7 +288,7 @@ int OTM_File::AddContent( const char* pw, AddTextureClass *tex, bool add, bool f
//
HZIP ZIP_Handle = OpenZip( FileInMemory, FileLen, pw);
- if (ZIP_Handle==NULL) {LastError << Language.Error_Unzip; return -1;}
+ if (ZIP_Handle==NULL) {LastError << Language->Error_Unzip; return -1;}
ZIPENTRY ze;
int index;
@@ -323,7 +298,7 @@ int OTM_File::AddContent( const char* pw, AddTextureClass *tex, bool add, bool f
char* def;
int len = ze.unc_size;
try {def=new char[len+1];}
- catch(...) {LastError << Language.Error_Memory; return -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;}
@@ -334,7 +309,7 @@ int OTM_File::AddContent( const char* pw, AddTextureClass *tex, bool add, bool f
int num = token.CountTokens();
- tex->SetSize(num);
+ tex.SetSize(num);
unsigned long temp_hash;
int count = 0;
@@ -345,7 +320,7 @@ int OTM_File::AddContent( const char* pw, AddTextureClass *tex, bool add, bool f
{
entry = token.GetNextToken();
file = entry.BeforeFirst( '|');
- if (!file.ToULong( &temp_hash, 16)) {LastError << Language.Error_Hash <<"\nTPF:" << entry << "\n"; continue;}
+ if (!file.ToULong( &temp_hash, 16)) {LastError << Language->Error_Hash <<"\nTPF:" << entry << "\n"; continue;}
file = entry.AfterFirst( '|');
file.Replace( "\r", "");
@@ -357,60 +332,56 @@ int OTM_File::AddContent( const char* pw, AddTextureClass *tex, bool add, bool f
FindZipItem( ZIP_Handle, file.wc_str(), false, &index, &ze); // look for texture
if (index>=0)
{
- try {tex->Textures[count] = new char[ze.unc_size];}
+ try {tex.Textures[count] = new char[ze.unc_size];}
catch(...)
{
- tex->Textures[count] = NULL;
- LastError << Language.Error_Memory;
+ tex.Textures[count] = NULL;
+ LastError << Language->Error_Memory;
continue;
}
- ZRESULT rz = UnzipItem( ZIP_Handle, index, tex->Textures[count], ze.unc_size);
+ 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;
+ 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;
+ tex.Hash[count] = temp_hash;
+ tex.Size[count] = ze.unc_size;
count++;
}
}
else
{
- LastError << Language.Error_Unzip <<"\nTPF:" << file << "\n";
+ LastError << Language->Error_Unzip <<"\nTPF:" << file << "\n";
CloseZip(ZIP_Handle); //somehow we need to close and to reopen the zip handle, otherwise the program crashes
ZIP_Handle = OpenZip( FileInMemory, FileLen, pw);
}
}
else
{
- tex->Hash[count] = temp_hash;
- tex->Add[count] = false;
- tex->Size[count] = 0;
- tex->Force[count] = force;
+ tex.Hash[count] = temp_hash;
+ tex.Size[count] = 0;
count++;
}
}
delete [] def;
- tex->Num = count;
+ 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;}
+ 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);
+ tex.SetSize(num);
int count = 0;
unsigned long temp_hash;
for (int i=0; iError_Unzip <<"\nZIP:" << file << "\n";
}
file = ze.name;
@@ -443,30 +414,26 @@ int OTM_File::AddContent( const char* pw, AddTextureClass *tex, bool add, bool f
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 (!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;
+ tex.Textures[count] = buffer;
+ tex.Hash[count] = temp_hash;
+ tex.Size[count] = len;//ze.unc_size;
count++;
}
else
{
if (buffer!=NULL) delete [] buffer;
- tex->Hash[count] = temp_hash;
- tex->Add[count] = false;
- tex->Size[count] = 0;
- tex->Force[count] = force;
+ tex.Hash[count] = temp_hash;
+ tex.Size[count] = 0;
count++;
}
}
- tex->Num = count;
+ tex.Num = count;
}
CloseZip(ZIP_Handle);
diff --git a/OTM_GUI/OTM_File.h b/OTM_GUI/OTM_File.h
index cf9f669..67da74c 100644
--- a/OTM_GUI/OTM_File.h
+++ b/OTM_GUI/OTM_File.h
@@ -1,38 +1,37 @@
+/*
+This file is part of OpenTexMod.
+
+
+OpenTexMod is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+OpenTexMod is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with OpenTexMod. If not, see .
+*/
+
#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);
+ OTM_File(const wxString &file);
~OTM_File(void);
bool FileSupported(void);
int GetComment( wxString &tool_tip);
- int GetContent( AddTextureClass *tex, bool add, bool force);
+ int GetContent( AddTextureClass &tex, bool add);
int SetFile(const wxString &file) {FileName=file;Loaded=false; return 0;}
wxString GetFile(void) {return FileName;}
@@ -47,11 +46,10 @@ private:
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);
+ int AddFile( AddTextureClass &tex, bool add);
+ int AddZip( AddTextureClass &tex, bool add, bool tpf);
+ int AddContent( const char* pw, AddTextureClass &tex, bool add);
- OTM_Language &Language;
wxString FileName;
bool Loaded;
bool XORed;
diff --git a/OTM_GUI/OTM_GUI.cpp b/OTM_GUI/OTM_GUI.cpp
index 0dfb6fa..553cc4c 100644
--- a/OTM_GUI/OTM_GUI.cpp
+++ b/OTM_GUI/OTM_GUI.cpp
@@ -36,14 +36,24 @@ BEGIN_EVENT_TABLE(OTM_Frame, wxFrame)
EVT_BUTTON(ID_Button_Open, OTM_Frame::OnButtonOpen)
EVT_BUTTON(ID_Button_Path, OTM_Frame::OnButtonPath)
EVT_BUTTON(ID_Button_Update, OTM_Frame::OnButtonUpdate)
- EVT_BUTTON(ID_Button_Save, OTM_Frame::OnButtonSave)
+ EVT_BUTTON(ID_Button_Reload, OTM_Frame::OnButtonReload)
- EVT_MENU(ID_Menu_Lang, OTM_Frame::OnMenuLanguage)
EVT_MENU(ID_Menu_Help, OTM_Frame::OnMenuHelp)
EVT_MENU(ID_Menu_About, OTM_Frame::OnMenuAbout)
+ EVT_MENU(ID_Menu_Acknowledgement, OTM_Frame::OnMenuAcknowledgement)
+
+
EVT_MENU(ID_Menu_AddGame, OTM_Frame::OnMenuAddGame)
EVT_MENU(ID_Menu_DeleteGame, OTM_Frame::OnMenuDeleteGame)
+ EVT_MENU(ID_Menu_LoadTemplate, OTM_Frame::OnMenuOpenTemplate)
+ EVT_MENU(ID_Menu_SaveTemplate, OTM_Frame::OnMenuSaveTemplate)
+ EVT_MENU(ID_Menu_SaveTemplateAs, OTM_Frame::OnMenuSaveTemplateAs)
+ EVT_MENU(ID_Menu_SetDefaultTemplate, OTM_Frame::OnMenuSetDefaultTemplate)
+
+ EVT_MENU(ID_Menu_Lang, OTM_Frame::OnMenuLanguage)
+ EVT_MENU(ID_Menu_Exit, OTM_Frame::OnMenuExit)
+
EVT_COMMAND (ID_Add_Game, OTM_EVENT_TYPE, OTM_Frame::OnAddGame)
EVT_COMMAND (ID_Delete_Game, OTM_EVENT_TYPE, OTM_Frame::OnDeleteGame)
END_EVENT_TABLE()
@@ -56,15 +66,20 @@ MyApp::~MyApp(void)
if (CheckForSingleRun!=NULL) CloseHandle( CheckForSingleRun);
}
+
bool MyApp::OnInit(void)
{
+ OTM_Settings set;
+ set.Load();
+
+ Language = new OTM_Language(set.Language);
CheckForSingleRun = CreateMutex( NULL, true, L"Global\\OTM_CheckForSingleRun");
if (ERROR_ALREADY_EXISTS == GetLastError())
{
- wxMessageBox( L"An instance of OpenTexMod already exists.", "ERROR", wxOK|wxICON_ERROR);
+ wxMessageBox( Language->Error_AlreadyRunning, "ERROR", wxOK|wxICON_ERROR);
return false;
}
- OTM_Frame *frame = new OTM_Frame( OTM_VERSION, wxDefaultPosition, wxSize(600,400));
+ OTM_Frame *frame = new OTM_Frame( OTM_VERSION, wxDefaultPosition, wxSize(set.XSize,set.YSize));
SetTopWindow( frame );
return true;
@@ -82,19 +97,27 @@ OTM_Frame::OTM_Frame(const wxString& title, const wxPoint& pos, const wxSize& si
MenuBar = new wxMenuBar;
//MenuMain = new wxMenu;
- MenuGame = new wxMenu;
+ MenuMain = new wxMenu;
MenuHelp = new wxMenu;
- MenuGame->Append( ID_Menu_AddGame, Language.MenuAddGame );
- MenuGame->Append( ID_Menu_DeleteGame, Language.MenuDeleteGame );
+ MenuMain->Append( ID_Menu_AddGame, Language->MenuAddGame );
+ MenuMain->Append( ID_Menu_DeleteGame, Language->MenuDeleteGame );
+ MenuMain->AppendSeparator();
+ MenuMain->Append( ID_Menu_LoadTemplate, Language->MenuLoadTemplate );
+ MenuMain->Append( ID_Menu_SaveTemplate, Language->MenuSaveTemplate );
+ MenuMain->Append( ID_Menu_SaveTemplateAs, Language->MenuSaveTemplateAs );
+ MenuMain->Append( ID_Menu_SetDefaultTemplate, Language->MenuSetDefaultTemplate );
+ MenuMain->AppendSeparator();
+ MenuMain->Append( ID_Menu_Lang, Language->MenuLanguage );
+ MenuMain->Append( ID_Menu_Exit, Language->MenuExit );
- MenuHelp->Append( ID_Menu_Lang, Language.MenuLanguage );
- MenuHelp->Append( ID_Menu_Help, Language.MenuHelp );
- MenuHelp->Append( ID_Menu_About, Language.MenuAbout );
+ MenuHelp->Append( ID_Menu_Help, Language->MenuHelp );
+ MenuHelp->Append( ID_Menu_About, Language->MenuAbout );
+ MenuHelp->Append( ID_Menu_Acknowledgement, Language->MenuAcknowledgement );
- MenuBar->Append( MenuGame, Language.MainMenuGame );
- MenuBar->Append( MenuHelp, Language.MainMenuHelp );
+ MenuBar->Append( MenuMain, Language->MainMenuMain );
+ MenuBar->Append( MenuHelp, Language->MainMenuHelp );
SetMenuBar(MenuBar);
@@ -102,19 +125,20 @@ OTM_Frame::OTM_Frame(const wxString& title, const wxPoint& pos, const wxSize& si
MainSizer = new wxBoxSizer(wxVERTICAL);
Notebook = new wxNotebook( this, wxID_ANY);
+ Notebook->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENU));
MainSizer->Add( (wxWindow*) Notebook, 1, wxEXPAND , 0 );
ButtonSizer = new wxBoxSizer(wxHORIZONTAL);
- OpenButton = new wxButton( this, ID_Button_Open, Language.ButtonOpen, wxDefaultPosition, wxSize(100,24));
- DirectoryButton = new wxButton( this, ID_Button_Path, Language.ButtonDirectory, wxDefaultPosition, wxSize(100,24));
- UpdateButton = new wxButton( this, ID_Button_Update, Language.ButtonUpdate, wxDefaultPosition, wxSize(100,24));
- SaveButton = new wxButton( this, ID_Button_Save, Language.ButtonSave, wxDefaultPosition, wxSize(100,24));
+ OpenButton = new wxButton( this, ID_Button_Open, Language->ButtonOpen, wxDefaultPosition, wxSize(100,24));
+ DirectoryButton = new wxButton( this, ID_Button_Path, Language->ButtonDirectory, wxDefaultPosition, wxSize(100,24));
+ UpdateButton = new wxButton( this, ID_Button_Update, Language->ButtonUpdate, wxDefaultPosition, wxSize(100,24));
+ ReloadButton = new wxButton( this, ID_Button_Reload, Language->ButtonReload, wxDefaultPosition, wxSize(100,24));
ButtonSizer->Add( (wxWindow*) OpenButton, 1, wxEXPAND, 0);
ButtonSizer->Add( (wxWindow*) DirectoryButton, 1, wxEXPAND, 0);
ButtonSizer->Add( (wxWindow*) UpdateButton, 1, wxEXPAND, 0);
- ButtonSizer->Add( (wxWindow*) SaveButton, 1, wxEXPAND, 0);
+ ButtonSizer->Add( (wxWindow*) ReloadButton, 1, wxEXPAND, 0);
MainSizer->Add( ButtonSizer, 0, wxEXPAND , 0 );
@@ -125,8 +149,9 @@ OTM_Frame::OTM_Frame(const wxString& title, const wxPoint& pos, const wxSize& si
Clients = NULL;
if (GetMemory( Clients, MaxNumberOfGames))
{
- wxMessageBox( Language.Error_Memory, "ERROR", wxOK|wxICON_ERROR);
+ wxMessageBox( Language->Error_Memory, "ERROR", wxOK|wxICON_ERROR);
}
+ LoadTemplate();
Show( true );
@@ -142,7 +167,7 @@ OTM_Frame::OTM_Frame(const wxString& title, const wxPoint& pos, const wxSize& si
wchar_t *error_msg;
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &error_msg, 0, NULL );
- wxString temp = Language.Error_DLLNotFound;
+ wxString temp = Language->Error_DLLNotFound;
temp << "\n" << OTM_d3d9_dll;
temp << "\n" << error_msg << "Code: " << error;
wxMessageBox( temp, "ERROR", wxOK);
@@ -154,7 +179,7 @@ OTM_Frame::OTM_Frame(const wxString& title, const wxPoint& pos, const wxSize& si
wchar_t *error_msg;
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &error_msg, 0, NULL );
- wxString temp = Language.Error_DLLNotFound;
+ wxString temp = Language->Error_DLLNotFound;
temp << "\n" << OTM_d3d9_dll;
temp << "\n" << error_msg << "Code: " << error;
wxMessageBox(temp, "ERROR", wxOK|wxICON_ERROR);
@@ -180,6 +205,11 @@ OTM_Frame::~OTM_Frame(void)
}
if (Clients!=NULL) delete [] Clients;
+
+ OTM_Settings set;
+ set.Language = Language->GetCurrentLanguage();
+ GetSize( &set.XSize, &set.YSize);
+ set.Save();
}
int OTM_Frame::KillServer(void)
@@ -212,7 +242,7 @@ void OTM_Frame::OnAddGame( wxCommandEvent &event)
{
if (GetMoreMemory( Clients, MaxNumberOfGames, MaxNumberOfGames+10))
{
- wxMessageBox( Language.Error_Memory, "ERROR", wxOK|wxICON_ERROR);
+ wxMessageBox( Language->Error_Memory, "ERROR", wxOK|wxICON_ERROR);
return;
}
MaxNumberOfGames += 10;
@@ -228,13 +258,24 @@ void OTM_Frame::OnAddGame( wxCommandEvent &event)
client->Create();
client->Run();
- OTM_GamePage *page = new OTM_GamePage( Notebook, name, client->Pipe, Language);
+ wxString save_file;
+ int num = SaveFile_Exe.GetCount();
+ for (int i=0; iPipe);
if (page->LastError.Len()>0)
{
wxMessageBox(page->LastError, "ERROR", wxOK|wxICON_ERROR);
delete page;
return;
}
+ name = name.AfterLast('\\');
+ name = name.AfterLast('/');
+ name = name.BeforeLast('.');
Notebook->AddPage( page, name, true);
Clients[NumberOfGames] = client;
@@ -260,7 +301,7 @@ void OTM_Frame::OnClose(wxCloseEvent& event)
{
if (event.CanVeto() && NumberOfGames>0)
{
- if (wxMessageBox(Language.ExitGameAnyway, "ERROR", wxYES_NO|wxICON_ERROR)!=wxYES) {event.Veto(); return;}
+ if (wxMessageBox(Language->ExitGameAnyway, "ERROR", wxYES_NO|wxICON_ERROR)!=wxYES) {event.Veto(); return;}
}
event.Skip();
Destroy();
@@ -273,8 +314,8 @@ void OTM_Frame::OnButtonOpen(wxCommandEvent& WXUNUSED(event))
if (page==NULL) return;
- //wxString file_name = wxFileSelector( Language.ChooseFile, page->GetOpenPath(), "", "*.*", "textures (*.dds)|*.dds|zip (*.zip)|*.zip|tpf (*.tpf)|*.tpf", wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
- wxString file_name = wxFileSelector( Language.ChooseFile, page->GetOpenPath(), "", "", "", wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
+ //wxString file_name = wxFileSelector( Language->ChooseFile, page->GetOpenPath(), "", "*.*", "textures (*.dds)|*.dds|zip (*.zip)|*.zip|tpf (*.tpf)|*.tpf", wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
+ wxString file_name = wxFileSelector( Language->ChooseFile, page->GetOpenPath(), "", "", "", wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
if ( !file_name.empty() )
{
page->SetOpenPath(file_name.BeforeLast( '/'));
@@ -292,7 +333,7 @@ void OTM_Frame::OnButtonPath(wxCommandEvent& WXUNUSED(event))
OTM_GamePage *page = (OTM_GamePage*) Notebook->GetCurrentPage();
if (page==NULL) return;
- wxString dir = wxDirSelector( Language.ChooseDir, page->GetSavePath());
+ wxString dir = wxDirSelector( Language->ChooseDir, page->GetSavePath());
if ( !dir.empty() )
{
page->SetSavePath( dir);
@@ -311,44 +352,148 @@ void OTM_Frame::OnButtonUpdate(wxCommandEvent& WXUNUSED(event))
}
}
-void OTM_Frame::OnButtonSave(wxCommandEvent& WXUNUSED(event))
+void OTM_Frame::OnButtonReload(wxCommandEvent& WXUNUSED(event))
{
if (Notebook->GetPageCount()==0) return;
OTM_GamePage *page = (OTM_GamePage*) Notebook->GetCurrentPage();
if (page==NULL) return;
- if (page->SaveToFile())
+ if (page->ReloadGame())
{
wxMessageBox(page->LastError, "ERROR", wxOK|wxICON_ERROR);
page->LastError.Empty();
}
}
+
+
+
+void OTM_Frame::OnMenuOpenTemplate(wxCommandEvent& WXUNUSED(event))
+{
+ if (Notebook->GetPageCount()==0) return;
+ OTM_GamePage *page = (OTM_GamePage*) Notebook->GetCurrentPage();
+ if (page==NULL) return;
+
+
+ //wxString file_name = wxFileSelector( Language->ChooseFile, page->GetOpenPath(), "", "*.*", "textures (*.dds)|*.dds|zip (*.zip)|*.zip|tpf (*.tpf)|*.tpf", wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
+ wxString file_name = wxFileSelector( Language->ChooseFile, wxGetCwd(), "", "", "", wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
+ if ( !file_name.empty() )
+ {
+ if (page->LoadTemplate( file_name))
+ {
+ wxMessageBox(page->LastError, "ERROR", wxOK|wxICON_ERROR);
+ page->LastError.Empty();
+ }
+ }
+}
+
+void OTM_Frame::OnMenuSaveTemplate(wxCommandEvent& WXUNUSED(event))
+{
+ if (Notebook->GetPageCount()==0) return;
+ OTM_GamePage *page = (OTM_GamePage*) Notebook->GetCurrentPage();
+ if (page==NULL) return;
+
+ wxString file_name = page->GetTemplateName();
+
+ if ( file_name.empty() )
+ {
+ wxString dir = wxGetCwd();
+ dir << "/templates";
+ file_name = wxFileSelector( Language->ChooseFile, dir, "", "*.txt", "text (*.txt)|*.txt", wxFD_SAVE | wxFD_OVERWRITE_PROMPT, this);
+ }
+ if ( !file_name.empty() )
+ {
+ if (page->SaveTemplate(file_name))
+ {
+ wxMessageBox(page->LastError, "ERROR", wxOK|wxICON_ERROR);
+ page->LastError.Empty();
+ }
+ }
+}
+
+void OTM_Frame::OnMenuSaveTemplateAs(wxCommandEvent& WXUNUSED(event))
+{
+ if (Notebook->GetPageCount()==0) return;
+ OTM_GamePage *page = (OTM_GamePage*) Notebook->GetCurrentPage();
+ if (page==NULL) return;
+
+
+ wxString dir = wxGetCwd();
+ dir << "/templates";
+ wxString file_name = wxFileSelector( Language->ChooseFile, dir, "", "*.txt", "text (*.txt)|*.txt", wxFD_SAVE | wxFD_OVERWRITE_PROMPT, this);
+ if ( !file_name.empty() )
+ {
+ if (page->SaveTemplate(file_name))
+ {
+ wxMessageBox(page->LastError, "ERROR", wxOK|wxICON_ERROR);
+ page->LastError.Empty();
+ }
+ }
+}
+
+void OTM_Frame::OnMenuSetDefaultTemplate(wxCommandEvent& WXUNUSED(event))
+{
+ if (Notebook->GetPageCount()==0) return;
+ OTM_GamePage *page = (OTM_GamePage*) Notebook->GetCurrentPage();
+ if (page==NULL) return;
+
+ wxString exe = page->GetExeName();
+ wxString file = page->GetTemplateName();
+
+ int num = SaveFile_Exe.GetCount();
+ bool hit = false;
+ for (int i=0; iGetLanguages( lang);
+ wxString choice = wxGetSingleChoice( Language->SelectLanguage, Language->SelectLanguage, lang);
if (choice.Len()>0)
{
- if (Language.LoadLanguage(choice))
+ if (Language->LoadLanguage(choice))
{
- wxMessageBox(Language.LastError, "ERROR", wxOK|wxICON_ERROR);
- Language.LastError.Empty();
+ wxMessageBox(Language->LastError, "ERROR", wxOK|wxICON_ERROR);
+ Language->LastError.Empty();
return;
}
- MenuBar->SetMenuLabel( 0, Language.MainMenuGame);
- MenuGame->SetLabel( ID_Menu_AddGame, Language.MenuAddGame);
- MenuGame->SetLabel( ID_Menu_DeleteGame, Language.MenuDeleteGame);
+ MenuBar->SetMenuLabel( 0, Language->MainMenuMain);
+ MenuMain->SetLabel( ID_Menu_AddGame, Language->MenuAddGame);
+ MenuMain->SetLabel( ID_Menu_DeleteGame, Language->MenuDeleteGame);
- MenuBar->SetMenuLabel( 1, Language.MainMenuHelp);
- MenuHelp->SetLabel( ID_Menu_Lang, Language.MenuLanguage);
- MenuHelp->SetLabel( ID_Menu_Help, Language.MenuHelp);
- MenuHelp->SetLabel( ID_Menu_About, Language.MenuAbout);
+ MenuMain->SetLabel( ID_Menu_LoadTemplate, Language->MenuLoadTemplate );
+ MenuMain->SetLabel( ID_Menu_SaveTemplate, Language->MenuSaveTemplate );
+ MenuMain->SetLabel( ID_Menu_SaveTemplateAs, Language->MenuSaveTemplateAs );
+ MenuMain->SetLabel( ID_Menu_SetDefaultTemplate, Language->MenuSetDefaultTemplate );
- OpenButton->SetLabel( Language.ButtonOpen);
- DirectoryButton->SetLabel( Language.ButtonDirectory);
- UpdateButton->SetLabel( Language.ButtonUpdate);
- SaveButton->SetLabel( Language.ButtonSave);
+ MenuMain->SetLabel( ID_Menu_Lang, Language->MenuLanguage);
+ MenuMain->SetLabel( ID_Menu_Exit, Language->MenuExit );
+
+ MenuBar->SetMenuLabel( 1, Language->MainMenuHelp);
+ MenuHelp->SetLabel( ID_Menu_Help, Language->MenuHelp);
+ MenuHelp->SetLabel( ID_Menu_About, Language->MenuAbout);
+ MenuHelp->SetLabel( ID_Menu_Acknowledgement, Language->MenuAcknowledgement);
+
+
+ OpenButton->SetLabel( Language->ButtonOpen);
+ DirectoryButton->SetLabel( Language->ButtonDirectory);
+ UpdateButton->SetLabel( Language->ButtonUpdate);
+ ReloadButton->SetLabel( Language->ButtonReload);
int num = Notebook->GetPageCount();
for (int i=0; iGetHelpMessage( help))
{
- wxMessageBox(Language.LastError, "ERROR", wxOK|wxICON_ERROR);
- Language.LastError.Empty();
+ wxMessageBox(Language->LastError, "ERROR", wxOK|wxICON_ERROR);
+ Language->LastError.Empty();
return;
}
- wxMessageBox( help, Language.MenuHelp, wxOK);
+ wxMessageBox( help, Language->MenuHelp, wxOK);
}
void OTM_Frame::OnMenuAbout(wxCommandEvent& WXUNUSED(event))
@@ -377,14 +527,24 @@ void OTM_Frame::OnMenuAbout(wxCommandEvent& WXUNUSED(event))
wxString msg;
msg << OTM_VERSION << " by ROTA\nhttp://code.google.com/p/texmod/";
wxMessageBox( msg, "Info", wxOK);
-};
+}
+
+void OTM_Frame::OnMenuAcknowledgement(wxCommandEvent& WXUNUSED(event))
+{
+ wxString title;
+ title << OTM_VERSION << " by ROTA";
+ wxString msg;
+ msg << "EvilAlex for translation into Russian and bug fixing";
+ wxMessageBox( msg, title, wxOK);
+}
+
void OTM_Frame::OnMenuAddGame(wxCommandEvent& WXUNUSED(event))
{
- wxString file_name = wxFileSelector( Language.ChooseGame, "", "", "exe", "binary (*.exe)|*.exe", wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
+ wxString file_name = wxFileSelector( Language->ChooseGame, "", "", "exe", "binary (*.exe)|*.exe", wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
if ( !file_name.empty() )
{
- file_name = file_name.AfterLast('\\');
+ //file_name = file_name.AfterLast('\\');
wxArrayString array;
if (GetHookedGames( array)) array.Empty();
@@ -392,7 +552,7 @@ void OTM_Frame::OnMenuAddGame(wxCommandEvent& WXUNUSED(event))
int num = array.GetCount();
for (int i=0; iGameAlreadyAdded, "ERROR", wxOK|wxICON_ERROR);
return;
}
array.Add(file_name);
@@ -415,7 +575,7 @@ void OTM_Frame::OnMenuDeleteGame(wxCommandEvent& WXUNUSED(event))
LastError.Empty();
return;
}
- wxGetSelectedChoices( selections, Language.DeleteGame, Language.DeleteGame, array);
+ wxGetSelectedChoices( selections, Language->DeleteGame, Language->DeleteGame, array);
int num = selections.GetCount();
for (int i=0; iError_FileOpen << "\n" << name; return -1;}
file.Open(name, wxFile::read);
- if (!file.IsOpened()) {LastError << Language.Error_FileOpen << "\n" << name ; return -1;}
+ if (!file.IsOpened()) {LastError << Language->Error_FileOpen << "\n" << name ; return -1;}
unsigned len = file.Length();
unsigned char* buffer;
- try {buffer = new unsigned char [len+1];}
- catch (...) {LastError << Language.Error_Memory; return -1;}
+ try {buffer = new unsigned char [len+2];}
+ catch (...) {LastError << Language->Error_Memory; return -1;}
unsigned int result = file.Read( buffer, len);
file.Close();
- if (result != len) {delete [] buffer; LastError << Language.Error_FileRead<<"\n" << name; return -1;}
+ if (result != len) {delete [] buffer; LastError << Language->Error_FileRead<<"\n" << name; return -1;}
- buffer[len]=0;
+ wchar_t *buff = (wchar_t*)buffer;
+ len/=2;
+ buff[len]=0;
wxString content;
- content = buffer;
+ content = buff;
delete [] buffer;
wxStringTokenizer token( content, "\n");
@@ -471,8 +633,6 @@ int OTM_Frame::GetHookedGames( wxArrayString &array)
{
array.Add( token.GetNextToken());
}
-
- file.Close();
return 0;
}
@@ -490,15 +650,88 @@ int OTM_Frame::SetHookedGames( const wxArrayString &array)
name.Printf("%ls\\%ls\\%ls", app_path, OTM_APP_DIR, OTM_APP_DX9);
file.Open(name, wxFile::write);
- if (!file.IsOpened()) {LastError << Language.Error_FileOpen << "\n" << name ; return -1;}
+ if (!file.IsOpened()) {LastError << Language->Error_FileOpen << "\n" << name ; return -1;}
wxString content;
+ //wchar_t code = 0xFFFE;
+ //file.Write( content.wc_str(), 2);
+
int num = array.GetCount();
for (int i=0; iError_FileOpen << "\n" << SAVE_FILE; return -1;}
+ file.Open(SAVE_FILE, wxFile::read);
+ if (!file.IsOpened()) {LastError << Language->Error_FileOpen << "\n" << SAVE_FILE ; return -1;}
+
+ unsigned len = file.Length();
+
+ unsigned char* buffer;
+ try {buffer = new unsigned char [len+2];}
+ catch (...) {LastError << Language->Error_Memory; return -1;}
+
+ unsigned int result = file.Read( buffer, len);
+ file.Close();
+
+ if (result != len) {delete [] buffer; LastError << Language->Error_FileRead<<"\n" << SAVE_FILE; return -1;}
+
+ wchar_t *buff = (wchar_t*)buffer;
+ len/=2;
+ buff[len]=0;
+
+ wxString content;
+ content = buff;
+ delete [] buffer;
+
+ wxStringTokenizer token( content, "\n");
+
+ int num = token.CountTokens();
+
+ SaveFile_Exe.Empty();
+ SaveFile_Exe.Alloc(num+10);
+ SaveFile_Name.Empty();
+ SaveFile_Name.Alloc(num+10);
+
+ wxString line;
+ wxString exe;
+ wxString name;
+ for (int i=0; iError_FileOpen << "\n" << SAVE_FILE ; return -1;}
+ wxString content;
+
+ int num = SaveFile_Exe.GetCount();
+ for (int i=0; i.
-OTM_GameInfo::OTM_GameInfo(const wxString &name)
+OTM_GameInfo::OTM_GameInfo(void)
{
- Name = name;
-
Checked = NULL;
NumberOfChecked = 0;
LengthOfChecked = 0;
@@ -56,12 +54,10 @@ void OTM_GameInfo::Init(void)
int OTM_GameInfo::SaveToFile( const wxString &file_name)
{
- wxString name;
- name << "OTM_GameSave_" << file_name << ".txt";
wxFile file;
//if (!file.Access(name, wxFile::write)) return -1;
- file.Open(name, wxFile::write);
+ file.Open(file_name, wxFile::write);
if (!file.IsOpened()) {return -1;}
wxString content;
@@ -122,13 +118,11 @@ int OTM_GameInfo::SaveToFile( const wxString &file_name)
int OTM_GameInfo::LoadFromFile( const wxString &file_name)
{
Init();
+ if (file_name.Len()==0) return -1;
- wxString name;
- name << "OTM_GameSave_" << file_name << ".txt";
wxFile file;
-
- if (!file.Access(name, wxFile::read)) return -1;
- file.Open(name, wxFile::read);
+ if (!file.Access(file_name, wxFile::read)) return -1;
+ file.Open(file_name, wxFile::read);
if (!file.IsOpened()) {return -1;}
unsigned len = file.Length();
diff --git a/OTM_GUI/OTM_GameInfo.h b/OTM_GUI/OTM_GameInfo.h
index 001e87d..e32017d 100644
--- a/OTM_GUI/OTM_GameInfo.h
+++ b/OTM_GUI/OTM_GameInfo.h
@@ -27,15 +27,12 @@ along with OpenTexMod. If not, see .
class OTM_GameInfo
{
public:
- OTM_GameInfo(const wxString &name);
+ OTM_GameInfo(void);
~OTM_GameInfo(void);
void Init(void);
- wxString Name;
- int SaveToFile() {return SaveToFile( Name);}
int SaveToFile( const wxString &file_name);
- int LoadFromFile() {return LoadFromFile( Name);}
int LoadFromFile( const wxString &file_name);
int GetChecked( bool* array, int num) const;
diff --git a/OTM_GUI/OTM_GamePage.cpp b/OTM_GUI/OTM_GamePage.cpp
index 679f13e..a7d9121 100644
--- a/OTM_GUI/OTM_GamePage.cpp
+++ b/OTM_GUI/OTM_GamePage.cpp
@@ -19,8 +19,15 @@ along with OpenTexMod. If not, see .
#include "OTM_Main.h"
-OTM_GamePage::OTM_GamePage( wxNotebook *parent, const wxString &name, PipeStruct &pipe, OTM_Language &lang) : wxPanel(parent), Language(lang), Game(name), GameOld(name), Sender(pipe, lang)
+OTM_GamePage::OTM_GamePage( wxNotebook *parent, const wxString &exe, const wxString &save, PipeStruct &pipe)
+ : wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL), Sender(pipe)
{
+ ExeName = exe;
+ TemplateName = save;
+
+ //SetBackgroundColour( *wxLIGHT_GREY);
+ //SetBackgroundColour( wxColour( "LIGHT GREY"));
+
CheckBoxHSizers = NULL;
CheckButtonUp = NULL;
CheckButtonDown = NULL;
@@ -29,22 +36,27 @@ OTM_GamePage::OTM_GamePage( wxNotebook *parent, const wxString &name, PipeStruct
MainSizer = new wxBoxSizer(wxVERTICAL);
+
+ TemplateFile = new wxTextCtrl(this, wxID_ANY, Language->TextCtrlTemplate, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
+ MainSizer->Add( (wxWindow*) TemplateFile, 0, wxEXPAND, 0);
+ MainSizer->AddSpacer(10);
+
SizerKeys[0] = new wxBoxSizer(wxHORIZONTAL);
SizerKeys[1] = new wxBoxSizer(wxHORIZONTAL);
- TextKeyBack = new wxTextCtrl(this, wxID_ANY, Language.KeyBack, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
+ TextKeyBack = new wxTextCtrl(this, wxID_ANY, Language->KeyBack, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
SizerKeys[0]->Add( (wxWindow*) TextKeyBack, 1, wxEXPAND, 0);
- ChoiceKeyBack = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Language.KeyStrings);
+ ChoiceKeyBack = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Language->KeyStrings);
SizerKeys[1]->Add( (wxWindow*) ChoiceKeyBack, 1, wxEXPAND, 0);
- TextKeySave = new wxTextCtrl(this, wxID_ANY, Language.KeySave, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
+ TextKeySave = new wxTextCtrl(this, wxID_ANY, Language->KeySave, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
SizerKeys[0]->Add( (wxWindow*) TextKeySave, 1, wxEXPAND, 0);
- ChoiceKeySave = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Language.KeyStrings);
+ ChoiceKeySave = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Language->KeyStrings);
SizerKeys[1]->Add( (wxWindow*) ChoiceKeySave, 1, wxEXPAND, 0);
- TextKeyNext = new wxTextCtrl(this, wxID_ANY, Language.KeyNext, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
+ TextKeyNext = new wxTextCtrl(this, wxID_ANY, Language->KeyNext, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
SizerKeys[0]->Add( (wxWindow*) TextKeyNext, 1, wxEXPAND, 0);
- ChoiceKeyNext = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Language.KeyStrings);
+ ChoiceKeyNext = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, Language->KeyStrings);
SizerKeys[1]->Add( (wxWindow*) ChoiceKeyNext, 1, wxEXPAND, 0);
MainSizer->Add( SizerKeys[0], 0, wxEXPAND, 0);
@@ -52,14 +64,14 @@ OTM_GamePage::OTM_GamePage( wxNotebook *parent, const wxString &name, PipeStruct
FontColourSizer = new wxBoxSizer(wxHORIZONTAL);
- FontColour[0] = new wxTextCtrl(this, wxID_ANY, Language.FontColour, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
+ FontColour[0] = new wxTextCtrl(this, wxID_ANY, Language->FontColour, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
FontColour[1] = new wxTextCtrl(this, wxID_ANY, "255", wxDefaultPosition, wxDefaultSize);
FontColour[2] = new wxTextCtrl(this, wxID_ANY, "0", wxDefaultPosition, wxDefaultSize);
FontColour[3] = new wxTextCtrl(this, wxID_ANY, "0", wxDefaultPosition, wxDefaultSize);
for (int i=0; i<4; i++) FontColourSizer->Add( (wxWindow*) FontColour[i], 1, wxEXPAND, 0);
TextureColourSizer = new wxBoxSizer(wxHORIZONTAL);
- TextureColour[0] = new wxTextCtrl(this, wxID_ANY, Language.TextureColour, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
+ TextureColour[0] = new wxTextCtrl(this, wxID_ANY, Language->TextureColour, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
TextureColour[1] = new wxTextCtrl(this, wxID_ANY, "0", wxDefaultPosition, wxDefaultSize);
TextureColour[2] = new wxTextCtrl(this, wxID_ANY, "255", wxDefaultPosition, wxDefaultSize);
TextureColour[3] = new wxTextCtrl(this, wxID_ANY, "0", wxDefaultPosition, wxDefaultSize);
@@ -69,104 +81,33 @@ OTM_GamePage::OTM_GamePage( wxNotebook *parent, const wxString &name, PipeStruct
MainSizer->Add( FontColourSizer, 0, wxEXPAND, 0);
MainSizer->Add( TextureColourSizer, 0, wxEXPAND, 0);
- SaveSingleTexture = new wxCheckBox( this, -1, Language.CheckBoxSaveSingleTexture);
+ SaveSingleTexture = new wxCheckBox( this, -1, Language->CheckBoxSaveSingleTexture);
MainSizer->Add( (wxWindow*) SaveSingleTexture, 0, wxEXPAND, 0);
- SaveAllTextures = new wxCheckBox( this, -1, Language.CheckBoxSaveAllTextures);
+ 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);
+ NumberOfEntry = 0;
+ MaxNumberOfEntry = 1024;
+ if (GetMemory( CheckBoxes, MaxNumberOfEntry)) {LastError = Language->Error_Memory; return;}
+ if (GetMemory( CheckBoxHSizers, MaxNumberOfEntry)) {LastError = Language->Error_Memory; return ;}
+ if (GetMemory( CheckButtonUp, MaxNumberOfEntry)) {LastError = Language->Error_Memory; return;}
+ if (GetMemory( CheckButtonDown, MaxNumberOfEntry)) {LastError = Language->Error_Memory; return;}
+ if (GetMemory( CheckButtonDelete, MaxNumberOfEntry)) {LastError = Language->Error_Memory; return;}
+ SavePath->SetValue(Language->TextCtrlSavePath);
- if (Game.LoadFromFile())
- {
- NumberOfEntry = 0;
- MaxNumberOfEntry = 1024;
- if (GetMemory( CheckBoxes, MaxNumberOfEntry)) {LastError = Language.Error_Memory; return;}
- if (GetMemory( CheckBoxHSizers, MaxNumberOfEntry)) {LastError = Language.Error_Memory; return ;}
- if (GetMemory( CheckButtonUp, MaxNumberOfEntry)) {LastError = Language.Error_Memory; return;}
- if (GetMemory( CheckButtonDown, MaxNumberOfEntry)) {LastError = Language.Error_Memory; return;}
- if (GetMemory( CheckButtonDelete, MaxNumberOfEntry)) {LastError = Language.Error_Memory; return;}
- SavePath->SetValue(Language.TextCtrlSavePath);
- }
- else
- {
- wxArrayString comments;
- if (Sender.Send( Game, GameOld, &comments)==0) GameOld = Game;
-
- int key = Game.GetKeyBack();
- if (key>=0) ChoiceKeyBack->SetSelection( key);
- key = Game.GetKeySave();
- if (key>=0) ChoiceKeySave->SetSelection( key);
- key = Game.GetKeyNext();
- if (key>=0) ChoiceKeyNext->SetSelection( key);
-
- int colour[3];
- Game.GetFontColour( colour);
- SetColour( &FontColour[1], colour);
- Game.GetTextureColour( colour);
- SetColour( &TextureColour[1], colour);
-
- SaveSingleTexture->SetValue( Game.GetSaveSingleTexture());
- SaveAllTextures->SetValue( Game.GetSaveAllTextures());
-
- wxString save_path = Language.TextCtrlSavePath;
- save_path << Game.GetSavePath();
- SavePath->SetValue(save_path);
-
- NumberOfEntry = Game.GetNumberOfFiles();
- Files.Alloc(NumberOfEntry+100);
-
- Game.GetFiles( Files);
-
- NumberOfEntry = Files.GetCount();
- MaxNumberOfEntry = ((NumberOfEntry/1024)+1)*1024;
-
- bool *checked = NULL;
- if (GetMemory( checked, NumberOfEntry)) {LastError = Language.Error_Memory; return;}
- Game.GetChecked( checked, NumberOfEntry);
-
- if (GetMemory( CheckBoxes, MaxNumberOfEntry)) {LastError = Language.Error_Memory; return;}
- if (GetMemory( CheckBoxHSizers, MaxNumberOfEntry)) {LastError = Language.Error_Memory; return ;}
- if (GetMemory( CheckButtonUp, MaxNumberOfEntry)) {LastError = Language.Error_Memory; return;}
- if (GetMemory( CheckButtonDown, MaxNumberOfEntry)) {LastError = Language.Error_Memory; return;}
- if (GetMemory( CheckButtonDelete, MaxNumberOfEntry)) {LastError = Language.Error_Memory; return;}
-
- for (int i=0; iSetValue( checked[i]);
- CheckBoxes[i]->SetToolTip( comments[i]);
-
- wchar_t button_txt[2];
- button_txt[0] = 8657;
- button_txt[1] = 0;
-
- CheckButtonUp[i] = new wxButton( this, ID_Button_Texture+3*i, button_txt, wxDefaultPosition, wxSize(24,24));
- Bind( wxEVT_COMMAND_BUTTON_CLICKED, &OTM_GamePage::OnButtonUp, this, ID_Button_Texture+3*i);
-
- button_txt[0] = 8659;
- CheckButtonDown[i] = new wxButton( this, ID_Button_Texture+3*i+1, button_txt, wxDefaultPosition, wxSize(24,24));
- Bind( wxEVT_COMMAND_BUTTON_CLICKED, &OTM_GamePage::OnButtonDown, this, ID_Button_Texture+3*i+1);
-
- CheckButtonDelete[i] = new wxButton( this, ID_Button_Texture+3*i+2, L"X", wxDefaultPosition, wxSize(24,24));
- Bind( wxEVT_COMMAND_BUTTON_CLICKED, &OTM_GamePage::OnButtonDelete, this, ID_Button_Texture+3*i+2);
-
- CheckBoxHSizers[i]->Add( (wxWindow*) CheckBoxes[i], 1, wxEXPAND, 0);
- CheckBoxHSizers[i]->Add( (wxWindow*) CheckButtonUp[i], 0, wxEXPAND, 0);
- CheckBoxHSizers[i]->Add( (wxWindow*) CheckButtonDown[i], 0, wxEXPAND, 0);
- CheckBoxHSizers[i]->Add( (wxWindow*) CheckButtonDelete[i], 0, wxEXPAND, 0);
-
- MainSizer->Add( CheckBoxHSizers[i], 0, wxEXPAND, 0);
- }
- delete [] checked;
- }
SetSizer(MainSizer);
+
+ SetScrollRate(0, 20);
+ MainSizer->FitInside(this);
+
+ if (TemplateName.Len()>0) LoadTemplate(TemplateName);
}
OTM_GamePage::~OTM_GamePage(void)
@@ -187,8 +128,8 @@ OTM_GamePage::~OTM_GamePage(void)
int OTM_GamePage::SetSavePath( const wxString &path)
{
- wxString save_path = path;
- save_path.Prepend(Language.TextCtrlSavePath);
+ wxString save_path = Language->TextCtrlSavePath;
+ save_path << path;
SavePath->SetValue(save_path);
Game.SetSavePath( path);
return 0;
@@ -199,15 +140,15 @@ int OTM_GamePage::AddTexture( const wxString &file_name)
{
if (NumberOfEntry>=MaxNumberOfEntry)
{
- if (GetMoreMemory( CheckBoxes, MaxNumberOfEntry, MaxNumberOfEntry+1024)) {LastError = Language.Error_Memory; return -1;}
- if (GetMoreMemory( CheckBoxHSizers, MaxNumberOfEntry, MaxNumberOfEntry+1024)) {LastError = Language.Error_Memory; return -1;}
- if (GetMoreMemory( CheckButtonUp, MaxNumberOfEntry, MaxNumberOfEntry+1024)) {LastError = Language.Error_Memory; return -1;}
- if (GetMoreMemory( CheckButtonDown, MaxNumberOfEntry, MaxNumberOfEntry+1024)) {LastError = Language.Error_Memory; return -1;}
- if (GetMoreMemory( CheckButtonDelete, MaxNumberOfEntry, MaxNumberOfEntry+1024)) {LastError = Language.Error_Memory; return -1;}
+ if (GetMoreMemory( CheckBoxes, MaxNumberOfEntry, MaxNumberOfEntry+1024)) {LastError = Language->Error_Memory; return -1;}
+ if (GetMoreMemory( CheckBoxHSizers, MaxNumberOfEntry, MaxNumberOfEntry+1024)) {LastError = Language->Error_Memory; return -1;}
+ if (GetMoreMemory( CheckButtonUp, MaxNumberOfEntry, MaxNumberOfEntry+1024)) {LastError = Language->Error_Memory; return -1;}
+ if (GetMoreMemory( CheckButtonDown, MaxNumberOfEntry, MaxNumberOfEntry+1024)) {LastError = Language->Error_Memory; return -1;}
+ if (GetMoreMemory( CheckButtonDelete, MaxNumberOfEntry, MaxNumberOfEntry+1024)) {LastError = Language->Error_Memory; return -1;}
MaxNumberOfEntry+=1024;
}
- OTM_File file( Language, file_name);
- if (!file.FileSupported()) {LastError << Language.Error_FileNotSupported << "\n" << file_name; return -1;}
+ OTM_File file( file_name);
+ if (!file.FileSupported()) {LastError << Language->Error_FileNotSupported << "\n" << file_name; return -1;}
wxString tool_tip;
file.GetComment( tool_tip);
@@ -239,8 +180,9 @@ int OTM_GamePage::AddTexture( const wxString &file_name)
Files.Add( file_name);
NumberOfEntry++;
MainSizer->Layout();
+ MainSizer->FitInside(this);
- return 0;
+ return UpdateGame();
}
int OTM_GamePage::GetSettings(void)
@@ -249,16 +191,16 @@ int OTM_GamePage::GetSettings(void)
int key_save = ChoiceKeySave->GetSelection();
int key_next = ChoiceKeyNext->GetSelection();
- if (key_back==key_save && key_back!=wxNOT_FOUND) {LastError << Language.Error_KeyTwice; return 1;}
- if (key_back==key_next && key_back!=wxNOT_FOUND) {LastError << Language.Error_KeyTwice; return 1;}
- if (key_save==key_next && key_save!=wxNOT_FOUND) {LastError << Language.Error_KeyTwice; return 1;}
+ if (key_back==key_save && key_back!=wxNOT_FOUND) {LastError << Language->Error_KeyTwice; return 1;}
+ if (key_back==key_next && key_back!=wxNOT_FOUND) {LastError << Language->Error_KeyTwice; return 1;}
+ if (key_save==key_next && key_save!=wxNOT_FOUND) {LastError << Language->Error_KeyTwice; return 1;}
bool save_single = SaveSingleTexture->GetValue();
bool save_all = SaveAllTextures->GetValue();
wxString path = Game.GetSavePath();
- if ( (save_single || save_all) && path.Len()==0) {LastError << Language.Error_NoSavePath; return 1;}
+ if ( (save_single || save_all) && path.Len()==0) {LastError << Language->Error_NoSavePath; return 1;}
- if ( save_single && ( key_back==wxNOT_FOUND || key_save==wxNOT_FOUND || key_next==wxNOT_FOUND) ) {LastError << Language.Error_KeyNotSet; return 1;}
+ if ( save_single && ( key_back==wxNOT_FOUND || key_save==wxNOT_FOUND || key_next==wxNOT_FOUND) ) {LastError << Language->Error_KeyNotSet; return 1;}
if (key_back!=wxNOT_FOUND) Game.SetKeyBack(key_back);
if (key_save!=wxNOT_FOUND) Game.SetKeySave(key_save);
@@ -283,7 +225,7 @@ int OTM_GamePage::GetSettings(void)
Game.SetFiles( Files);
bool *checked = NULL;
- if (GetMemory( checked, NumberOfEntry)) {LastError = Language.Error_Memory; return -1;}
+ if (GetMemory( checked, NumberOfEntry)) {LastError = Language->Error_Memory; return -1;}
for (int i=0; iGetValue();
Game.SetChecked( checked, NumberOfEntry);
delete [] checked;
@@ -295,9 +237,9 @@ int OTM_GamePage::UpdateGame(void)
{
if (int ret = GetSettings()) return ret;
- if (int ret = Sender.Send( Game, GameOld))
+ if (int ret = Sender.Send( Game, GameOld, false))
{
- LastError = Language.Error_Send;
+ LastError = Language->Error_Send;
LastError << "\n" << Sender.LastError;
Sender.LastError.Empty();
return ret;
@@ -307,15 +249,150 @@ int OTM_GamePage::UpdateGame(void)
return 0;
}
-int OTM_GamePage::SaveToFile( const wxString &file_name)
+
+int OTM_GamePage::ReloadGame(void)
+{
+ if (int ret = GetSettings()) return ret;
+
+ if (int ret = Sender.Send( Game, GameOld, true))
+ {
+ LastError = Language->Error_Send;
+ LastError << "\n" << Sender.LastError;
+ Sender.LastError.Empty();
+ return ret;
+ }
+
+ GameOld = Game;
+ return 0;
+}
+
+int OTM_GamePage::SaveTemplate( const wxString &file_name)
{
if (int ret = GetSettings()) return ret;
if (int ret = Game.SaveToFile( file_name))
{
- LastError = Language.Error_SaveFile;
+ LastError = Language->Error_SaveFile;
LastError <<"\n" << file_name;
return ret;
}
+ TemplateName = file_name;
+ wxString path;
+ path = Language->TextCtrlTemplate;
+ path << TemplateName;
+ TemplateFile->SetValue( path);
+
+ return 0;
+}
+
+int OTM_GamePage::LoadTemplate( const wxString &file_name)
+{
+ if (Game.LoadFromFile(file_name)) return -1;
+ TemplateName = file_name;
+ wxArrayString comments;
+
+ if (Sender.Send( Game, GameOld, true, &comments)==0) GameOld = Game;
+
+ wxString path;
+ path = Language->TextCtrlTemplate;
+ path << TemplateName;
+ TemplateFile->SetValue( path);
+
+ int key = Game.GetKeyBack();
+ if (key>=0) ChoiceKeyBack->SetSelection( key);
+ key = Game.GetKeySave();
+ if (key>=0) ChoiceKeySave->SetSelection( key);
+ key = Game.GetKeyNext();
+ if (key>=0) ChoiceKeyNext->SetSelection( key);
+
+ int colour[3];
+ Game.GetFontColour( colour);
+ SetColour( &FontColour[1], colour);
+ Game.GetTextureColour( colour);
+ SetColour( &TextureColour[1], colour);
+
+ SaveSingleTexture->SetValue( Game.GetSaveSingleTexture());
+ SaveAllTextures->SetValue( Game.GetSaveAllTextures());
+
+ path = Language->TextCtrlSavePath;
+ path << Game.GetSavePath();
+ SavePath->SetValue( path);
+
+ int new_NumberOfEntry = Game.GetNumberOfFiles();
+
+ Game.GetFiles( Files);
+
+ if (new_NumberOfEntry>=MaxNumberOfEntry)
+ {
+ MaxNumberOfEntry = ((NumberOfEntry/1024)+1)*1024;
+ if (GetMoreMemory( CheckBoxes, NumberOfEntry, MaxNumberOfEntry)) {LastError = Language->Error_Memory; return -1;}
+ if (GetMoreMemory( CheckBoxHSizers, NumberOfEntry, MaxNumberOfEntry)) {LastError = Language->Error_Memory; return -1;}
+ if (GetMoreMemory( CheckButtonUp, NumberOfEntry, MaxNumberOfEntry)) {LastError = Language->Error_Memory; return -1;}
+ if (GetMoreMemory( CheckButtonDown, NumberOfEntry, MaxNumberOfEntry)) {LastError = Language->Error_Memory; return -1;}
+ if (GetMoreMemory( CheckButtonDelete, NumberOfEntry, MaxNumberOfEntry)) {LastError = Language->Error_Memory; return -1;}
+ }
+
+ bool *checked = NULL;
+ if (GetMemory( checked, new_NumberOfEntry)) {LastError = Language->Error_Memory; return -1;}
+ Game.GetChecked( checked, new_NumberOfEntry);
+
+
+ for (int i=0; iSetLabel( Files[i]);
+ CheckBoxes[i]->SetValue( checked[i]);
+ CheckBoxes[i]->SetToolTip( comments[i]);
+ }
+
+ for (int i=new_NumberOfEntry; iDetach( (wxWindow*) CheckBoxes[i]);
+ CheckBoxHSizers[i]->Detach( (wxWindow*) CheckButtonUp[i]);
+ CheckBoxHSizers[i]->Detach( (wxWindow*) CheckButtonDown[i]);
+ CheckBoxHSizers[i]->Detach( (wxWindow*) CheckButtonDelete[i]);
+
+ MainSizer->Detach( CheckBoxHSizers[i]);
+
+ delete CheckBoxes[i];
+ delete CheckButtonUp[i];
+ delete CheckButtonDown[i];
+ delete CheckButtonDelete[i];
+ delete CheckBoxHSizers[i];
+ }
+ for (int i=NumberOfEntry; iSetValue( checked[i]);
+ CheckBoxes[i]->SetToolTip( comments[i]);
+
+ wchar_t button_txt[2];
+ button_txt[0] = 8657;
+ button_txt[1] = 0;
+
+ CheckButtonUp[i] = new wxButton( this, ID_Button_Texture+3*i, button_txt, wxDefaultPosition, wxSize(24,24));
+ Bind( wxEVT_COMMAND_BUTTON_CLICKED, &OTM_GamePage::OnButtonUp, this, ID_Button_Texture+3*i);
+
+ button_txt[0] = 8659;
+ CheckButtonDown[i] = new wxButton( this, ID_Button_Texture+3*i+1, button_txt, wxDefaultPosition, wxSize(24,24));
+ Bind( wxEVT_COMMAND_BUTTON_CLICKED, &OTM_GamePage::OnButtonDown, this, ID_Button_Texture+3*i+1);
+
+ CheckButtonDelete[i] = new wxButton( this, ID_Button_Texture+3*i+2, L"X", wxDefaultPosition, wxSize(24,24));
+ Bind( wxEVT_COMMAND_BUTTON_CLICKED, &OTM_GamePage::OnButtonDelete, this, ID_Button_Texture+3*i+2);
+
+ CheckBoxHSizers[i]->Add( (wxWindow*) CheckBoxes[i], 1, wxEXPAND, 0);
+ CheckBoxHSizers[i]->Add( (wxWindow*) CheckButtonUp[i], 0, wxEXPAND, 0);
+ CheckBoxHSizers[i]->Add( (wxWindow*) CheckButtonDown[i], 0, wxEXPAND, 0);
+ CheckBoxHSizers[i]->Add( (wxWindow*) CheckButtonDelete[i], 0, wxEXPAND, 0);
+
+ MainSizer->Add( CheckBoxHSizers[i], 0, wxEXPAND, 0);
+ }
+ delete [] checked;
+ NumberOfEntry = new_NumberOfEntry;
return 0;
}
@@ -421,32 +498,23 @@ void OTM_GamePage::OnButtonDelete(wxCommandEvent& event)
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;
}
int OTM_GamePage::UpdateLanguage(void)
{
- TextKeyBack->SetValue( Language.KeyBack);
- TextKeySave->SetValue( Language.KeySave);
- TextKeyNext->SetValue( Language.KeyNext);
- FontColour[0]->SetValue( Language.FontColour);
- TextureColour[0]->SetValue( Language.TextureColour);
- SaveAllTextures->SetLabel( Language.CheckBoxSaveAllTextures);
- SaveSingleTexture->SetLabel( Language.CheckBoxSaveSingleTexture);
- wxString temp = Language.TextCtrlSavePath;
+ TextKeyBack->SetValue( Language->KeyBack);
+ TextKeySave->SetValue( Language->KeySave);
+ TextKeyNext->SetValue( Language->KeyNext);
+ FontColour[0]->SetValue( Language->FontColour);
+ TextureColour[0]->SetValue( Language->TextureColour);
+ SaveAllTextures->SetLabel( Language->CheckBoxSaveAllTextures);
+ SaveSingleTexture->SetLabel( Language->CheckBoxSaveSingleTexture);
+ wxString temp = Language->TextCtrlSavePath;
temp << Game.GetSavePath();
SavePath->SetValue( temp);
return 0;
diff --git a/OTM_GUI/OTM_GamePage.h b/OTM_GUI/OTM_GamePage.h
index 5d10143..f1785dc 100644
--- a/OTM_GUI/OTM_GamePage.h
+++ b/OTM_GUI/OTM_GamePage.h
@@ -22,22 +22,23 @@ along with OpenTexMod. If not, see .
#define OTM_GAMEPAGE_H_
#include "OTM_Main.h"
-
// this page is opened if a game is started.
-class OTM_GamePage : public wxPanel
+class OTM_GamePage : public wxScrolledWindow
{
public:
- OTM_GamePage( wxNotebook *parent, const wxString &name, PipeStruct &pipe, OTM_Language &lang);
+ OTM_GamePage( wxNotebook *parent, const wxString &exe, const wxString &save, PipeStruct &pipe);
virtual ~OTM_GamePage(void);
int AddTexture( const wxString &file_name);
int UpdateGame(void);
+ int ReloadGame(void);
- int SaveToFile() {return SaveToFile(Game.Name);}
- int SaveToFile( const wxString &file_name);
- //int LoadFromFile( const wxString &file_name) {return Game->LoadFromFile( file_name);}
+ int SaveTemplate( const wxString &file_name);
+ int LoadTemplate( const wxString &file_name);
+ wxString GetExeName(void) {return ExeName;}
+ wxString GetTemplateName(void) {return TemplateName;}
int SetOpenPath(const wxString &path) {return Game.SetOpenPath(path);}
wxString GetOpenPath(void) {return Game.GetOpenPath();}
@@ -60,6 +61,9 @@ private:
int SetColour( wxTextCtrl** txt, int *colour);
int GetColour( wxTextCtrl* txt, int def);
+ wxString ExeName;
+ wxString TemplateName;
+
wxBoxSizer *SizerKeys[2];
wxTextCtrl *TextKeyBack;
wxTextCtrl *TextKeySave;
@@ -74,6 +78,8 @@ private:
wxTextCtrl *TextureColour[4];
wxBoxSizer *MainSizer;
+
+ wxTextCtrl *TemplateFile;
wxCheckBox *SaveAllTextures;
wxCheckBox *SaveSingleTexture;
wxTextCtrl *SavePath;
@@ -87,7 +93,6 @@ private:
int NumberOfEntry;
int MaxNumberOfEntry;
- OTM_Language &Language;
wxArrayString Files;
OTM_GameInfo Game;
diff --git a/OTM_GUI/OTM_Language.cpp b/OTM_GUI/OTM_Language.cpp
index b1df334..249f857 100644
--- a/OTM_GUI/OTM_Language.cpp
+++ b/OTM_GUI/OTM_Language.cpp
@@ -20,15 +20,23 @@ along with OpenTexMod. If not, see .
#include "OTM_Main.h"
+OTM_Language *Language = NULL;
OTM_Language::OTM_Language(void)
{
- if (LoadCurrentLanguage()) {LoadDefault(); CurrentLanguage = "English"; LastError.Empty();}
+ LoadDefault();
LoadKeys();
}
-#define LAST_USED_LANGUAGE_FILE "OTM_LastUsedLanguage.txt"
+OTM_Language::OTM_Language(const wxString &name)
+{
+ LoadLanguage(name);
+ LoadKeys();
+ LastError.Empty();
+}
+//#define LAST_USED_LANGUAGE_FILE "OTM_LastUsedLanguage.txt"
+/*
int OTM_Language::LoadCurrentLanguage(void)
{
wxFile file;
@@ -62,12 +70,15 @@ int OTM_Language::SaveCurrentLanguage(void)
file.Write( CurrentLanguage.char_str(), CurrentLanguage.Len());
return 0;
}
-
+*/
int OTM_Language::GetLanguages(wxArrayString &lang)
{
wxArrayString files;
- wxDir::GetAllFiles( wxGetCwd(), &files, "OTM_LanguagePack_*.txt");
+ wxString dir = wxGetCwd();
+ dir << "/languages";
+ wxDir::GetAllFiles( dir, &files, "OTM_LanguagePack_*.txt");
+ wxDir::GetAllFiles( dir, &files, "OTM_LanguagePackU_*.txt");
lang.Empty();
lang.Alloc(files.GetCount()+1);
lang.Add("English");
@@ -93,29 +104,45 @@ int OTM_Language::GetHelpMessage(wxString &help)
file << "README_" << CurrentLanguage << ".txt";
wxFile dat;
- if (!dat.Access(file, wxFile::read))
- {
- file.Empty();
- file << "README_" << CurrentLanguage << ".txt";
- if (!dat.Access(file, wxFile::read)) {LastError << Error_FileOpen <<"\n" << file; return -1;}
- }
- dat.Open(file, wxFile::read);
- if (!dat.IsOpened()) {LastError << Error_FileOpen <<"\n" << file; return -1;}
- unsigned len = dat.Length();
+ bool utf16=false;
+ if (!dat.Access(file, wxFile::read))
+ {
+ file.Empty();
+ file << "READMEU_" << CurrentLanguage << ".txt";
+ utf16=true;
+ if (!dat.Access(file, wxFile::read))
+ {
+ utf16=false;
+ file = "README_English.txt";
+ if (!dat.Access(file, wxFile::read)) {LastError << Error_FileOpen <<"\n" << file; return -1;}
+ }
+ }
+ dat.Open(file, wxFile::read);
+ if (!dat.IsOpened()) {LastError << Error_FileOpen <<"\n" << file; return -1;}
+ unsigned len = dat.Length();
- unsigned char* buffer;
- try {buffer = new unsigned char [len+1];}
- catch (...) {LastError << Error_Memory; return -1;}
+ unsigned char* buffer;
+ try {buffer = new unsigned char [len+2];}
+ catch (...) {LastError << Error_Memory; return -1;}
- unsigned int result = dat.Read( buffer, len);
- dat.Close();
+ unsigned int result = dat.Read( buffer, len);
+ dat.Close();
- if (result != len) {delete [] buffer; LastError << Error_FileRead<<"\n" << file; return -1;}
+ if (result != len) {delete [] buffer; LastError << Error_FileRead<<"\n" << file; return -1;}
- buffer[len]=0;
- help=buffer;
-
- return 0;
+ if (utf16)
+ {
+ wchar_t *buf = (wchar_t*) buffer;
+ len/=2;
+ buf[len]=0;
+ help=buf;
+ }
+ else
+ {
+ buffer[len]=0;
+ help=buffer;
+ }
+ return 0;
}
@@ -126,26 +153,29 @@ if ( command == #target ) \
target = msg; \
} else
-int OTM_Language::LoadLanguage(const wxString &name, bool save)
+int OTM_Language::LoadLanguage(const wxString &name)
{
LoadDefault();
- if (name=="English")
- {
- if (wxFile::Exists(LAST_USED_LANGUAGE_FILE)) wxRemoveFile(LAST_USED_LANGUAGE_FILE);
- return 0;
- }
+ if (name=="English") return 0;
wxString file_name;
- file_name << "OTM_LanguagePack_" << name << ".txt";
+ file_name << "languages/OTM_LanguagePack_" << name << ".txt";
+ bool utf16=false;
wxFile dat;
- if (!dat.Access(file_name, wxFile::read)) {LastError << Error_FileOpen <<"\n" << file_name; return -1;}
+ if (!dat.Access(file_name, wxFile::read))
+ {
+ utf16=true;
+ file_name.Empty();
+ file_name << "languages/OTM_LanguagePackU_" << name << ".txt";
+ if (!dat.Access(file_name, wxFile::read)){LastError << Error_FileOpen <<"\n" << file_name; return -1;}
+ }
dat.Open(file_name, wxFile::read);
if (!dat.IsOpened()) {LastError << Error_FileOpen <<"\n" << file_name; return -1;}
unsigned len = dat.Length();
unsigned char* buffer;
- try {buffer = new unsigned char [len+1];}
+ try {buffer = new unsigned char [len+2];}
catch (...) {LastError << Error_Memory; return -1;}
unsigned int result = dat.Read( buffer, len);
@@ -153,10 +183,24 @@ int OTM_Language::LoadLanguage(const wxString &name, bool save)
if (result != len) {delete [] buffer; LastError << Error_FileRead<<"\n" << file_name; return -1;}
- buffer[len]=0;
CurrentLanguage = name;
+ wxString content;
- wxStringTokenizer token( buffer, "|");
+ if (utf16)
+ {
+ wchar_t *buf = (wchar_t*) buffer;
+ len/=2;
+ buf[len]=0;
+ if (buf[0]==0XFEFF || buf[0]==0XFFFE) content=&buf[1]; //get rid of the BOM
+ else content=buf;
+ }
+ else
+ {
+ buffer[len]=0;
+ content = buffer;
+ }
+
+ wxStringTokenizer token( content, "|");
int num = token.CountTokens();
wxString entry;
wxString command;
@@ -165,7 +209,7 @@ int OTM_Language::LoadLanguage(const wxString &name, bool save)
for (int i=0; i.
#include "OTM_Main.h"
-OTM_Sender::OTM_Sender(PipeStruct &pipe, OTM_Language &lang) : Pipe(pipe), Language(lang)
+
+OTM_Sender::OTM_Sender(PipeStruct &pipe) : Pipe(pipe)
{
+ OldTextures = NULL;
+ OldTexturesNum = 0;
try {Buffer = new char[BIG_BUFSIZE];}
catch (...) {Buffer=NULL;}
}
@@ -32,25 +35,25 @@ OTM_Sender::~OTM_Sender(void)
}
-int OTM_Sender::Send( const OTM_GameInfo &game, const OTM_GameInfo &game_old, wxArrayString *comments)
+int OTM_Sender::Send( const OTM_GameInfo &game, const OTM_GameInfo &game_old, bool force, wxArrayString *comments)
{
LastError.Empty();
int key = game.GetKeyBack();
if (key>=0 && key!=game_old.GetKeyBack())
{
- key = Language.KeyValues[key];
+ key = Language->KeyValues[key];
SendKey( key, CONTROL_KEY_BACK);
}
key = game.GetKeySave();
if (key>=0 && key!=game_old.GetKeySave())
{
- key = Language.KeyValues[key];
+ key = Language->KeyValues[key];
SendKey( key, CONTROL_KEY_SAVE);
}
key = game.GetKeyNext();
if (key>=0 && key!=game_old.GetKeyNext())
{
- key = Language.KeyValues[key];
+ key = Language->KeyValues[key];
SendKey( key, CONTROL_KEY_NEXT);
}
@@ -80,8 +83,7 @@ int OTM_Sender::Send( const OTM_GameInfo &game, const OTM_GameInfo &game_old, wx
if (path!=game_old.GetSavePath()) SendPath(path);
- // the rest of this function is not optimized !!
- if (game.GetNumberOfFiles()<=0)
+ if (game.GetNumberOfFiles()<=0 && OldTexturesNum==0 && OldTextures==NULL)
{
if (LastError.Len()>0) return 1;
else return 0;
@@ -91,34 +93,145 @@ int OTM_Sender::Send( const OTM_GameInfo &game, const OTM_GameInfo &game_old, wx
game.GetFiles( files);
int num = files.GetCount();
- if (comments!=NULL)
+ bool *checked = NULL;
+ if (num>0)
+ {
+ if (GetMemory(checked, num)) {LastError << Language->Error_Memory; return -1;}
+ game.GetChecked( checked, num);
+ }
+
+ AddTextureClass *tex = NULL;//new AddTextureClass[num+OldTexturesNum];
+ if (GetMemory( tex, num+OldTexturesNum)) {LastError << Language->Error_Memory; return -1;}
+ wxString comment;
+
+ if (force || OldTexturesNum==0 || OldTextures==NULL)
+ {
+ //reload everything
+ for (int i=0; i0 && OldTextures!=NULL)
+ {
+ for (int i=0; iError_Memory; return -1;}
+ for (int i=0; i looking brute force
+ for (int i=pos; i0)
{
comments->Empty();
comments->Alloc(num);
+ for (int i=0; iAdd(tex[i].Comment);
}
- bool *checked = new bool [num];
- game.GetChecked( checked, num);
- AddTextureClass *tex = new AddTextureClass[num];
- wxString comment;
- for (int i=0; iAdd(comment);
- }
- if (file.GetContent( &tex[i], checked[i], true))
- {
- LastError << file.LastError;
- file.LastError.Empty();
- }
- }
- SendTextures( num, tex);
+ if (OldTextures!=NULL) delete [] OldTextures;
- delete [] checked;
- delete [] tex;
+ OldTexturesNum = num;
+ OldTextures = tex;
if (LastError.Len()>0) return 1;
else return 0;
@@ -149,54 +262,56 @@ int OTM_Sender::SendSaveSingleTexture(bool val)
}
-
int OTM_Sender::SendTextures(unsigned int num, AddTextureClass *tex)
{
if (Buffer==NULL) return (RETURN_NO_MEMORY);
- int count = 0;
- for (unsigned int i=0u; iBIG_BUFSIZE)
+ if (tex[i].Force || !tex[i].Add || !tex[i].WasAdded[j])
+ // if force==true we must update
+ // tex[i].Add!=true we can always remove, cause removing does take time in the render thread
+ // if tex[i].Add==true and WasAdded[j]!=true this texture was not loaded but should be loaded, so maybe we can load it now
{
- if (int ret = SendToGame( Buffer, pos)) return ret;
- pos = 0;
- }
+ bool hit = false;
+ unsigned long temp_hash = tex[i].Hash[j];
+ for (unsigned int ii=0u; iiHash = temp_hash;
- msg->Value = size;
- pos += sizeof(MsgStruct);
-
- if (tex[i].Add[j])
- {
- if (tex[i].Force[j]) msg->Control = CONTROL_FORCE_RELOAD_TEXTURE_DATA;
- else msg->Control = CONTROL_ADD_TEXTURE_DATA;
-
- char* temp = tex[i].Textures[j];
- if (temp!=NULL)
+ if (tex[i].Size[j]+sizeof(MsgStruct)+pos>BIG_BUFSIZE)
{
- for (unsigned int l=0; lHash = temp_hash;
+ msg->Value = size;
+ pos += sizeof(MsgStruct);
+
+ if (tex[i].Add)
+ {
+ msg->Control = CONTROL_FORCE_RELOAD_TEXTURE_DATA; //we always force because whether force==true
+ //or Add==true && WasAdded[j]!=true which means it is loaded the first time, or in previous loads it could not be loaded
+ //because an other texture was send with the same hash, in all cases forcing is the best choice (atm)
+ char* temp = tex[i].Textures[j];
+ if (temp!=NULL)
+ {
+ for (unsigned int l=0; lControl = CONTROL_REMOVE_TEXTURE;
+ tex[i].WasAdded[j] = false;
}
}
- else msg->Control = CONTROL_REMOVE_TEXTURE;
}
- delete [] hash;
-
if (pos) if (int ret = SendToGame( Buffer, pos)) return ret;
if (LastError.Len()>0) return 1;
@@ -252,10 +367,10 @@ 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;}
+ 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;}
- if (!FlushFileBuffers(Pipe.Out)) {LastError << Language.Error_FlushPipe; return -1;}
+ if (!ret || len!=num) {LastError << Language->Error_WritePipe; return -1;}
+ if (!FlushFileBuffers(Pipe.Out)) {LastError << Language->Error_FlushPipe; return -1;}
return 0;
}
diff --git a/OTM_GUI/OTM_Sender.h b/OTM_GUI/OTM_Sender.h
index b960e45..e4670d9 100644
--- a/OTM_GUI/OTM_Sender.h
+++ b/OTM_GUI/OTM_Sender.h
@@ -20,6 +20,7 @@ along with OpenTexMod. If not, see .
#ifndef OTM_SENDER_H_
#define OTM_SENDER_H_
+
#include "OTM_Main.h"
@@ -27,10 +28,10 @@ along with OpenTexMod. If not, see .
class OTM_Sender
{
public:
- OTM_Sender(PipeStruct &pipe, OTM_Language &lang);
+ OTM_Sender(PipeStruct &pipe);
~OTM_Sender(void);
- int Send( const OTM_GameInfo &game, const OTM_GameInfo &game_old, wxArrayString *comments=NULL);
+ int Send( const OTM_GameInfo &game, const OTM_GameInfo &game_old, bool force=false, wxArrayString *comments=NULL);
wxString LastError;
@@ -54,7 +55,8 @@ private:
int AddContent( char* buffer, unsigned int len, const char* pw, AddTextureClass *tex, bool add, bool force);
PipeStruct &Pipe;
- OTM_Language &Language;
+ AddTextureClass *OldTextures;
+ int OldTexturesNum;
};
diff --git a/OTM_GUI/OTM_Settings.cpp b/OTM_GUI/OTM_Settings.cpp
new file mode 100644
index 0000000..2576197
--- /dev/null
+++ b/OTM_GUI/OTM_Settings.cpp
@@ -0,0 +1,112 @@
+/*
+This file is part of OpenTexMod.
+
+
+OpenTexMod is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+OpenTexMod is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with OpenTexMod. If not, see .
+*/
+
+
+
+#include "OTM_Main.h"
+
+
+OTM_Settings::OTM_Settings(void)
+{
+ XSize=600;
+ YSize=400;
+ Language="English";
+}
+
+#define SETTINGS_FILE "OTM_Settings.txt"
+
+int OTM_Settings::Load(void)
+{
+ wxFile file;
+
+ if (!file.Access(SETTINGS_FILE, wxFile::read)) {return -1;}
+ file.Open(SETTINGS_FILE, wxFile::read);
+ if (!file.IsOpened()) return -1;
+
+ unsigned len = file.Length();
+
+ unsigned char* buffer;
+ try {buffer = new unsigned char [len+2];}
+ catch (...) {return -1;}
+
+ unsigned int result = file.Read( buffer, len);
+ file.Close();
+
+ if (result != len) {delete [] buffer; return -1;}
+
+ wchar_t *buff = (wchar_t*)buffer;
+ len/=2;
+ buff[len]=0;
+
+ wxString content;
+ content = buff;
+ delete [] buffer;
+
+ wxStringTokenizer token( content, "\n");
+
+ int num = token.CountTokens();
+ wxString line;
+ wxString command;
+ wxString value;
+ for (int i=0; i.
+*/
+
+
+#ifndef OTM_SETTINGS_H_
+#define OTM_SETTINGS_H_
+
+
+#include "OTM_Main.h"
+
+class OTM_Settings
+{
+public:
+ OTM_Settings(void);
+
+
+ int XSize, YSize;
+ wxString Language;
+
+ int Load(void);
+ int Save(void);
+
+};
+
+
+#endif /* OTM_SETTINGS_H_ */
diff --git a/OTM_GUI/bin/README_Deutsch.txt b/OTM_GUI/bin/README_Deutsch.txt
index de9da45..f21ffd7 100644
--- a/OTM_GUI/bin/README_Deutsch.txt
+++ b/OTM_GUI/bin/README_Deutsch.txt
@@ -18,7 +18,7 @@ darauf hinweisen.
Was kann OpenTexMod alpha V0.9?
--einzelne Texturen aus einem Spiel extrahieren und speichern (Die Zieltextur kann im Spiel geändert werden)
+-einzelne Texturen aus einem Spiel extrahieren und speichern (Die Zieltextur kann im Spiel geändert werden.)
-alle Texturen aus einem Spiel extrahieren und speichern
-Texturen in ein Spiel laden und Zieltexturen ersetzen
-Support von zip-Dateien
@@ -63,7 +63,7 @@ Wie bekomme ich OpenTexMod zum laufen?
Es gibt zwei Wege wie OpenTexMod sich in die DirectX Verbindung einklinken kann:
1) (bevorzugt) Füge die Spiel-exe über das Menü Spiele->"Spiel hinzufügen" hinzu.
- Wenn du Steam verwendest, lies weiter unten nach.
+ Für Steam siehe unten.
2) Kopiere die d3d9.dll (vom OpenTexMod Verzeichnis) in das Spiele Verzeichnis.
Einige Spiele laden eine dll zuerst aus dem eigenen Verzeichnis bevor sie im
@@ -77,12 +77,17 @@ OpenTexMod zu starten.
Wenn das Spiel startet und alles glatt läuft, öffnet sich sofort ein neuer Tab in OpenTexMod.
In diesem Tab kannst du nun das Spiel modden. Drücke den "Update" Button um
die Einstellungen an das Spiel zu senden. Du kannst deine aktuellen Einstellungen auch
-speichern. Sie werden dann automatisch geladen und an das Spiel gesendet, wenn du
-dieses Spiel das nächste Mal startest.
+als ein Template speichern. Ein Template kann auch als Standard eingestellt werden.
+Es wird dann automatisch geladen und an das Spiel gesendet, wenn
+dieses Spiel das nächste Mal gestartet wird.
Um einen Mod zu laden, musst du das Häkchen vor den Namen setzen. Wenn du
-den Mod entladen willst, entferne das Häkchen und klicke auf "Update". Zurzeit
-werden die Mods nicht aus dem Spiel entladen, wenn du den "X" Button drückst.
+den Mod entladen willst, entferne das Häkchen und klicke auf "Update".
+
+Der Update Button lädt nur Veränderungen (wenn Pakete aus der Liste entfernt
+wurden, du die Häkchen verändert hast oder sich die Reihenfolge geändert hat)
+Der "neu laden" Button erzwingt das Neuladen von Festplatte (z.B. wenn du die
+Texturen verändert hast).
Weil verschiedene Mods die gleiche Ziel-Textur verändern könnten, wird nur die
Mod-Textur des ersten Mods berücksichtigt. Die Aktion dieses Mods (also Laden oder
@@ -92,15 +97,6 @@ Ziel-Textur machen sollen.
Wie bekommt man OpenTexMod mit Steam zum Laufen?
-OpenTexMod schaut auf den Namen der ausgeführten Spiel-Datei, nicht nach dem Verzeichnis.
+OpenTexMod schaut auf den Namen und auf das Verzeichnis der ausgeführten Spiel-exe.
Daher solltest du nicht die steam.exe sondern die Spiel.exe hinzufügen.
-z.B.: Steam\SteamApps\acoount_name\portal\hl2.exe
-BTW: Dies würde auch alle anderen HalfLife 2 Spiele betreffen.
-
-Wenn du deine Spiele-exe nicht finden kannst, schau im TaskManager nach und:
-1) füge sie per Hand hinzu: editiere unter Windows 7
- C:\Users\user_name\AppData\Roaming\OpenTexMod\OTM_DX9.txt
- oder:
-2) erstelle irgendwo eine Datei mit dem Namen der Spiele-exe und füge diese
- mithilfe des Menüs in OpenTexMod hinzu, anschließend kannst du diese
- Datei löschen.
\ No newline at end of file
+z.B.: C:\Steam\SteamApps\acoount_name\portal\hl2.exe
\ No newline at end of file
diff --git a/OTM_GUI/bin/README_English.txt b/OTM_GUI/bin/README_English.txt
index b9dcbd7..029d8ff 100644
--- a/OTM_GUI/bin/README_English.txt
+++ b/OTM_GUI/bin/README_English.txt
@@ -57,8 +57,7 @@ How to get OpenTexMod work?
There are two ways how OpenTexMod can intercept the DirectX connection:
1) (recommended) Add the games-binary through the menu Games->"Add game"
- If you want to get it work with steam, don't add the steam.exe but rather the game.exe.
- Once you have added the game, OpenTexMod will keep it in mind on further program start.
+ For Steam see below.
2) Copy the d3d9.dll (from the OpenTexMod directory) into the game directory.
Some games load a dll first from their own directory before they look up the system directory.
@@ -71,12 +70,16 @@ the game through OpenTexMod.
If the game starts and all works fine, a new tab opens immediately in OpenTexMod.
In this tab you can now mod the game. Press the "update" button to commit
-the changes to the game. You can also save your current settings. They will be loaded
-and committed automatically when you start the same game the next time.
+the changes to the game. You can also save your current settings as a template.
+One template can be set as default for a game, which will be loaded and
+and committed automatically when you start this game the next time.
To load a mod, you must set the check mark of the file. If you wish to unload a mod,
-just remove the check mark and click on update again. At the moment pressing the
-X button of a file will remove it from the list but won't unload the mod from the game.
+just remove the check mark and click on update again.
+
+Clicking on update will only update the differences (if packages have been
+removed from the list, you toggled check marks or changed the order). The reload
+button forces to reload from disk (if you have edited the texture itself).
Due to the fact that different mods can modify the same target texture, only the
mod-texture of the first file in the list is taken into account. The action of this file
@@ -84,17 +87,8 @@ mod-texture of the first file in the list is taken into account. The action of t
to do with their mod-textures.
-How to get OpenTexMod work together with steam?
+How to get OpenTexMod work together with Steam?
-OpenTexMod looks only for the name of the executed binary and not of their working directory.
+OpenTexMod looks for the name and the path of the executed binary.
Thus you shall not add the steam.exe but rather the game.exe
-e.g.: Steam\SteamApps\acoount_name\portal\hl2.exe
-This would also inject into all other HalfLife 2 games.
-
-If you can't find your target binary, just look into the task manager for the binary
-and:
-1) add it by your self : edit under Windows 7
- C:\Users\user_name\AppData\Roaming\OpenTexMod\OTM_DX9.txt
- or:
-2) add somewhere on your disk an empty file with the name of the binary and
- add this file through the menu of OpenTexMod, afterwards you can delete this file.
\ No newline at end of file
+e.g.: C:\Steam\SteamApps\acoount_name\portal\hl2.exe
\ No newline at end of file
diff --git a/OTM_GUI/bin/languages/Example_OTM_LanguagePack_English.txt b/OTM_GUI/bin/languages/Example_OTM_LanguagePack_English.txt
new file mode 100644
index 0000000..36513f5
--- /dev/null
+++ b/OTM_GUI/bin/languages/Example_OTM_LanguagePack_English.txt
@@ -0,0 +1,137 @@
+If you have created a language package and would like to add to the officially download, please send it to me.
+Email address and support can be found at http://code.google.com/p/texmod/
+
+
+The file name must match the wildcard OTM_LanguagePack_NAMEOFLANGUAGE.txt
+Format of an entry is divided into 3 parts: 1) Keyword directly followed by a colon, 2) message, and 3) end symbol "|"
+Restriction of the the message: do not use "|" within a message!!
+
+You can also use utf-16LE encoding, but you have to label the file as OTM_LanguagePackU_NAMEOFLANGUAGE.txt
+
+comments must start with an "#" and must end with |
+
+e.g.
+
+#
+
+this is a comment
+
+|
+
+Example:
+
+Keyword:
+
+Message1 line1
+Message1 line2
+
+|
+
+Keyword2:Message2|
+Keyword3:Message3 line1
+Message3 line2|
+
+
+There is no need to include all keywords, since English is loaded each time as default and afterwards the entries are replaced.
+English itself is compiled into the OTM_GUI.exe, thus there exists no OTM_LanguagePack_English.txt.
+
+The following list is an example of how an English package would look like (maybe not all keywords are present).
+
+MenuHelp:
+Help|
+MenuAbout:
+About|
+MenuAcknowledgement:Acknowledgement|
+MenuAddGame:
+Add game|
+MenuDeleteGame:
+Delete Game|
+MenuLoadTemplate:Load template|
+MenuSaveTemplate:Save template|
+MenuSaveTemplateAs:Save template as ...|
+MenuSetDefaultTemplate:Set template as default|
+MenuExit:Exit|
+MainMenuMain:Main|
+MainMenuHelp:
+Help|
+ButtonOpen:
+Open texture|
+ButtonDirectory:
+save directory|
+ButtonUpdate:
+Update|
+ButtonReload:Update (reload)|
+ChooseFile:Choose a file|
+ChooseDir:
+Choose a directory|
+CheckBoxSaveSingleTexture:
+Save single texture|
+TextCtrlTemplate:Template: |
+CheckBoxSaveAllTextures:
+Save all textures|
+TextCtrlSavePath:
+Save path: |
+SelectLanguage:
+Select a language|
+ChooseGame:
+Select a game binary.
+DeleteGame:
+Select the games to be deleted.|
+GameAlreadyAdded:
+Game has been already added.|
+ExitGameAnyway:
+Closing OpenTexMod while a game is running might lead to a crash of the game.
+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.
+This might happen if D3DX9_43.dll is not installed on your system.
+Please install the newest DirectX End-User Runtime Web Installer.|
+Error_FktNotFound:
+Could not load function out of dll.
+The dll injection won't work.|
+Error_AlreadyRunning:An other instance of OpenTexMod is already running.|
+Error_Send:
+Could not send to game.|
+Error_KeyTwice:
+You assigned a key twice.|
+Error_NoSavePath:
+You did not set a save path.|
+Error_KeyNotSet:
+At least one key is not set.|
+Error_SaveFile:
+Could not save to file.|
+Error_NoPipe:
+Pipe is not opened.|
+Error_WritePipe:
+Could not write in pipe.|
+Error_FlushPipe:
+Could not flush pipe buffer.|
+Error_Hash:
+Could not find hash, maybe file is not named as *_HASH.dds|
+Error_FileOpen:
+Could not open file.|
+Error_FileRead:
+Could not read file.|
+Error_Memory:
+Could not allocate enough memory|
+Error_Unzip:
+Could not unzip.|
+Error_ZipEntry:
+Could not find zip entry.|
+KeyBack:
+Back|
+KeySave:
+Save|
+KeyNext:
+Next|
+FontColour:
+Font colour (RGB):|
+TextureColour:
+Texture colour (RGB):|
\ No newline at end of file
diff --git a/OTM_GUI/bin/languages/OTM_LanguagePackU_Deutsch.txt b/OTM_GUI/bin/languages/OTM_LanguagePackU_Deutsch.txt
new file mode 100644
index 0000000..fa8db47
Binary files /dev/null and b/OTM_GUI/bin/languages/OTM_LanguagePackU_Deutsch.txt differ
diff --git a/OTM_GUI/bin/languages/OTM_LanguagePackU_Russian.txt b/OTM_GUI/bin/languages/OTM_LanguagePackU_Russian.txt
new file mode 100644
index 0000000..3099654
Binary files /dev/null and b/OTM_GUI/bin/languages/OTM_LanguagePackU_Russian.txt differ
diff --git a/OTM_GUI/config.vc b/OTM_GUI/config.vc
index 62a020b..8655990 100644
--- a/OTM_GUI/config.vc
+++ b/OTM_GUI/config.vc
@@ -44,7 +44,7 @@ UNICODE = 1
MSLU = 0
# Type of compiled binaries [debug,release]
-BUILD = debug
+BUILD = release
# 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
@@ -63,7 +63,7 @@ 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
+DEBUG_FLAG = 0
# 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]
diff --git a/OTM_GUI/makefile.gcc b/OTM_GUI/makefile.gcc
index 0b57651..d39302a 100644
--- a/OTM_GUI/makefile.gcc
+++ b/OTM_GUI/makefile.gcc
@@ -38,7 +38,9 @@ MINIMAL_OBJECTS = \
$(OBJS)\OTM_Server.o \
$(OBJS)\OTM_Client.o \
$(OBJS)\OTM_File.o \
- $(OBJS)\OTM_Sender.o \
+ $(OBJS)\OTM_Sender.o \
+ $(OBJS)\OTM_Settings.o \
+ $(OBJS)\OTM_AddTexture.o \
$(OBJS)\OTM_Language.o
### Conditionally set variables: ###
@@ -261,6 +263,12 @@ $(OBJS)\OTM_File.o: ./OTM_File.cpp
$(OBJS)\OTM_Sender.o: ./OTM_Sender.cpp
$(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\OTM_Settings.o: ./OTM_Settings.cpp
+ $(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
+
+$(OBJS)\OTM_AddTexture.o: ./OTM_AddTexture.cpp
+ $(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\OTM_Language.o: ./OTM_Language.cpp
$(CXX) -c -o $@ $(MINIMAL_CXXFLAGS) $(CPPDEPS) $<
diff --git a/OTM_GUI/makefile.vc b/OTM_GUI/makefile.vc
index 2deee2c..69df307 100644
--- a/OTM_GUI/makefile.vc
+++ b/OTM_GUI/makefile.vc
@@ -41,6 +41,8 @@ MINIMAL_OBJECTS = \
$(OBJS)\OTM_Client.obj \
$(OBJS)\OTM_File.obj \
$(OBJS)\OTM_Sender.obj \
+ $(OBJS)\OTM_Settings.obj \
+ $(OBJS)\OTM_AddTexture.obj \
$(OBJS)\OTM_Language.obj
MINIMAL_RESOURCES = \
$(OBJS)\OTM_GUI.res
@@ -385,5 +387,11 @@ $(OBJS)\OTM_File.obj: .\OTM_File.cpp
$(OBJS)\OTM_Sender.obj: .\OTM_Sender.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\OTM_Sender.cpp
+$(OBJS)\OTM_Settings.obj: .\OTM_Settings.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\OTM_Settings.cpp
+
+$(OBJS)\OTM_AddTexture.obj: .\OTM_AddTexture.cpp
+ $(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\OTM_AddTexture.cpp
+
$(OBJS)\OTM_Language.obj: .\OTM_Language.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MINIMAL_CXXFLAGS) .\OTM_Language.cpp
diff --git a/OTM_GlobalDefines.h b/OTM_GlobalDefines.h
index 7de0d3e..1c6ff00 100644
--- a/OTM_GlobalDefines.h
+++ b/OTM_GlobalDefines.h
@@ -41,7 +41,7 @@ typedef struct
#define OTM_APP_DX9 L"OTM_DX9.txt"
#define OTM_APP_DIR L"OpenTexMod"
-#define OTM_VERSION L"OpenTexMod V 0.9 alpha"
+#define OTM_VERSION L"OpenTexMod V 1.0 alpha"
#define PIPE_OTM2Game L"\\\\.\\pipe\\OTM2Game"
#define PIPE_Game2OTM L"\\\\.\\pipe\\Game2OTM"