diff --git a/.gitattributes b/.gitattributes
index f794256..0177d66 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -44,7 +44,10 @@ 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/bin/README.txt -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/config.gcc -text
OTM_GUI/makefile -text
OTM_GUI/unzip.cpp -text
diff --git a/OTM_DX9/OTM_ArrayHandler.cpp b/OTM_DX9/OTM_ArrayHandler.cpp
index 73cfbe9..a09192e 100644
--- a/OTM_DX9/OTM_ArrayHandler.cpp
+++ b/OTM_DX9/OTM_ArrayHandler.cpp
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_DX9/OTM_ArrayHandler.h b/OTM_DX9/OTM_ArrayHandler.h
index 7be2fa9..160d156 100644
--- a/OTM_DX9/OTM_ArrayHandler.h
+++ b/OTM_DX9/OTM_ArrayHandler.h
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_DX9/OTM_DX9_dll.cpp b/OTM_DX9/OTM_DX9_dll.cpp
index e13aebb..368e32f 100644
--- a/OTM_DX9/OTM_DX9_dll.cpp
+++ b/OTM_DX9/OTM_DX9_dll.cpp
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
/*
diff --git a/OTM_DX9/OTM_DX9_dll.h b/OTM_DX9/OTM_DX9_dll.h
index 1ca8add..bb18668 100644
--- a/OTM_DX9/OTM_DX9_dll.h
+++ b/OTM_DX9/OTM_DX9_dll.h
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_DX9/OTM_Defines.h b/OTM_DX9/OTM_Defines.h
index 0aafa1f..5288e3e 100644
--- a/OTM_DX9/OTM_Defines.h
+++ b/OTM_DX9/OTM_Defines.h
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_DX9/OTM_IDirect3D9.cpp b/OTM_DX9/OTM_IDirect3D9.cpp
index e611ea3..719654c 100644
--- a/OTM_DX9/OTM_IDirect3D9.cpp
+++ b/OTM_DX9/OTM_IDirect3D9.cpp
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_DX9/OTM_IDirect3D9.h b/OTM_DX9/OTM_IDirect3D9.h
index 7736901..390020c 100644
--- a/OTM_DX9/OTM_IDirect3D9.h
+++ b/OTM_DX9/OTM_IDirect3D9.h
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
/*
diff --git a/OTM_DX9/OTM_IDirect3DDevice9.cpp b/OTM_DX9/OTM_IDirect3DDevice9.cpp
index ca5615e..2ae86a6 100644
--- a/OTM_DX9/OTM_IDirect3DDevice9.cpp
+++ b/OTM_DX9/OTM_IDirect3DDevice9.cpp
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
@@ -415,7 +415,7 @@ HRESULT OTM_IDirect3DDevice9::EndScene(void)
}
char buffer[100];
- sprintf( buffer, "Actual texture: %4d (1..%d): %#lX", CounterSaveSingleTexture+1, OTM_Client->OriginalTextures.GetNumber(), SingleTexture->CrossRef_D3Dtex->Hash);
+ sprintf_s( buffer, 100, "Actual texture: %4d (1..%d): %#lX", CounterSaveSingleTexture+1, OTM_Client->OriginalTextures.GetNumber(), SingleTexture->CrossRef_D3Dtex->Hash);
D3DVIEWPORT9 viewport;
GetViewport( &viewport);
RECT rct;
diff --git a/OTM_DX9/OTM_IDirect3DDevice9.h b/OTM_DX9/OTM_IDirect3DDevice9.h
index ae42313..2c664ad 100644
--- a/OTM_DX9/OTM_IDirect3DDevice9.h
+++ b/OTM_DX9/OTM_IDirect3DDevice9.h
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_DX9/OTM_IDirect3DTexture9.cpp b/OTM_DX9/OTM_IDirect3DTexture9.cpp
index 97a0c40..17abde3 100644
--- a/OTM_DX9/OTM_IDirect3DTexture9.cpp
+++ b/OTM_DX9/OTM_IDirect3DTexture9.cpp
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_DX9/OTM_IDirect3DTexture9.h b/OTM_DX9/OTM_IDirect3DTexture9.h
index 3718055..7492942 100644
--- a/OTM_DX9/OTM_IDirect3DTexture9.h
+++ b/OTM_DX9/OTM_IDirect3DTexture9.h
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_DX9/OTM_Main.h b/OTM_DX9/OTM_Main.h
index 1962fb3..63ceab5 100644
--- a/OTM_DX9/OTM_Main.h
+++ b/OTM_DX9/OTM_Main.h
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_DX9/OTM_TextureClient.cpp b/OTM_DX9/OTM_TextureClient.cpp
index 16fdf49..2884d41 100644
--- a/OTM_DX9/OTM_TextureClient.cpp
+++ b/OTM_DX9/OTM_TextureClient.cpp
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_DX9/OTM_TextureClient.h b/OTM_DX9/OTM_TextureClient.h
index c3f26c5..adc6417 100644
--- a/OTM_DX9/OTM_TextureClient.h
+++ b/OTM_DX9/OTM_TextureClient.h
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_DX9/OTM_TextureServer.cpp b/OTM_DX9/OTM_TextureServer.cpp
index c6a6ad9..1a00e2e 100644
--- a/OTM_DX9/OTM_TextureServer.cpp
+++ b/OTM_DX9/OTM_TextureServer.cpp
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_DX9/OTM_TextureServer.h b/OTM_DX9/OTM_TextureServer.h
index 46a52cf..e904fd7 100644
--- a/OTM_DX9/OTM_TextureServer.h
+++ b/OTM_DX9/OTM_TextureServer.h
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_Error.h b/OTM_Error.h
index 50dc31a..f7adbce 100644
--- a/OTM_Error.h
+++ b/OTM_Error.h
@@ -1,3 +1,22 @@
+/*
+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_ERROR_H_
#define OTM_ERROR_H_
diff --git a/OTM_GUI/OTM_Client.cpp b/OTM_GUI/OTM_Client.cpp
index ba199c9..d4c8a5a 100644
--- a/OTM_GUI/OTM_Client.cpp
+++ b/OTM_GUI/OTM_Client.cpp
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_GUI/OTM_Client.h b/OTM_GUI/OTM_Client.h
index 22f26fe..5f74619 100644
--- a/OTM_GUI/OTM_Client.h
+++ b/OTM_GUI/OTM_Client.h
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_GUI/OTM_Event.cpp b/OTM_GUI/OTM_Event.cpp
index 1bfb958..de0fa8b 100644
--- a/OTM_GUI/OTM_Event.cpp
+++ b/OTM_GUI/OTM_Event.cpp
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_GUI/OTM_Event.h b/OTM_GUI/OTM_Event.h
index d5b853f..8b68801 100644
--- a/OTM_GUI/OTM_Event.h
+++ b/OTM_GUI/OTM_Event.h
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_GUI/OTM_GUI.cpp b/OTM_GUI/OTM_GUI.cpp
index 94d8595..31a000f 100644
--- a/OTM_GUI/OTM_GUI.cpp
+++ b/OTM_GUI/OTM_GUI.cpp
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
@@ -38,8 +38,7 @@ BEGIN_EVENT_TABLE(OTM_Frame, wxFrame)
EVT_BUTTON(ID_Button_Update, OTM_Frame::OnButtonUpdate)
EVT_BUTTON(ID_Button_Save, OTM_Frame::OnButtonSave)
- //EVT_MENU(ID_Menu_Pref, OTM_Frame::OnMenuPref)
- //EVT_MENU(ID_Menu_Quit, OTM_Frame::OnMenuQuit)
+ 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_AddGame, OTM_Frame::OnMenuAddGame)
@@ -52,10 +51,20 @@ END_EVENT_TABLE()
IMPLEMENT_APP(MyApp)
#endif
+MyApp::~MyApp(void)
+{
+ if (CheckForSingleRun!=NULL) CloseHandle( CheckForSingleRun);
+}
+
bool MyApp::OnInit(void)
{
-
- OTM_Frame *frame = new OTM_Frame( "OpenTexMod V0.9 alpha by ROTA", wxDefaultPosition, wxSize(600,400));
+ 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);
+ return false;
+ }
+ OTM_Frame *frame = new OTM_Frame( OTM_VERSION, wxDefaultPosition, wxSize(600,400));
SetTopWindow( frame );
return true;
@@ -66,11 +75,7 @@ OTM_Frame::OTM_Frame(const wxString& title, const wxPoint& pos, const wxSize& si
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
{
SetIcon(wxICON(MAINICON));
- if (Language.LoadLanguage(1)!=0)
- {
- wxMessageBox("Could not load language", "Error", wxOK);
- Destroy();
- }
+
Server = new OTM_Server( this);
Server->Create();
Server->Run();
@@ -80,16 +85,14 @@ OTM_Frame::OTM_Frame(const wxString& title, const wxPoint& pos, const wxSize& si
MenuGame = new wxMenu;
MenuHelp = new wxMenu;
- //MenuMain->Append( ID_Menu_Pref, Language.MenuPref, Language.MenuPref );
- //MenuMain->Append( ID_Menu_Quit, Language.MenuQuit, Language.MenuQuit );
- MenuGame->Append( ID_Menu_AddGame, Language.MenuAddGame, Language.MenuAddGame );
- MenuGame->Append( ID_Menu_DeleteGame, Language.MenuDeleteGame, Language.MenuDeleteGame );
+ MenuGame->Append( ID_Menu_AddGame, Language.MenuAddGame );
+ MenuGame->Append( ID_Menu_DeleteGame, Language.MenuDeleteGame );
- MenuHelp->Append( ID_Menu_Help, Language.MenuHelp, Language.MenuHelp );
- MenuHelp->Append( ID_Menu_About, Language.MenuAbout, Language.MenuAbout );
+ MenuHelp->Append( ID_Menu_Lang, Language.MenuLanguage );
+ MenuHelp->Append( ID_Menu_Help, Language.MenuHelp );
+ MenuHelp->Append( ID_Menu_About, Language.MenuAbout );
- //MenuBar->Append( MenuMain, Language.MainMenuStart );
MenuBar->Append( MenuGame, Language.MainMenuGame );
MenuBar->Append( MenuHelp, Language.MainMenuHelp );
@@ -162,7 +165,7 @@ OTM_Frame::OTM_Frame(const wxString& title, const wxPoint& pos, const wxSize& si
wxString temp = Language.Error_DLLNotFound;
temp << "\n" << OTM_d3d9_dll;
temp << "\n" << error_msg << "Code: " << error;
- wxMessageBox(temp, "ERROR", wxOK);
+ wxMessageBox(temp, "ERROR", wxOK|wxICON_ERROR);
}
}
@@ -253,7 +256,7 @@ void OTM_Frame::OnClose(wxCloseEvent& event)
{
if (event.CanVeto() && NumberOfGames>0)
{
- if (wxMessageBox(Language.ExitGameAnyway, "ERROR", wxYES_NO)!=wxYES) {event.Veto(); return;}
+ if (wxMessageBox(Language.ExitGameAnyway, "ERROR", wxYES_NO|wxICON_ERROR)!=wxYES) {event.Veto(); return;}
}
event.Skip();
Destroy();
@@ -293,7 +296,7 @@ void OTM_Frame::OnButtonUpdate(wxCommandEvent& WXUNUSED(event))
if (page==NULL) return;
if (page->UpdateGame())
{
- wxMessageBox(page->LastError, "ERROR", wxOK);
+ wxMessageBox(page->LastError, "ERROR", wxOK|wxICON_ERROR);
page->LastError.Empty();
}
}
@@ -305,60 +308,94 @@ void OTM_Frame::OnButtonSave(wxCommandEvent& WXUNUSED(event))
if (page==NULL) return;
if (page->SaveToFile())
{
- wxMessageBox(page->LastError, "ERROR", wxOK);
+ wxMessageBox(page->LastError, "ERROR", wxOK|wxICON_ERROR);
page->LastError.Empty();
}
}
-/*
-void OTM_Frame::OnMenuPref(wxCommandEvent& WXUNUSED(event)) {}
-void OTM_Frame::OnMenuQuit(wxCommandEvent& WXUNUSED(event)) {Destroy();}
-*/
+void OTM_Frame::OnMenuLanguage(wxCommandEvent& WXUNUSED(event))
+{
+ wxArrayString lang;
+ Language.GetLanguages( lang);
+ wxString choice = wxGetSingleChoice( Language.SelectLanguage, Language.SelectLanguage, lang);
+ if (choice.Len()>0)
+ {
+ if (Language.LoadLanguage(choice))
+ {
+ 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( 1, Language.MainMenuHelp);
+ MenuHelp->SetLabel( ID_Menu_Lang, Language.MenuLanguage);
+ MenuHelp->SetLabel( ID_Menu_Help, Language.MenuHelp);
+ MenuHelp->SetLabel( ID_Menu_About, Language.MenuAbout);
+
+ OpenButton->SetLabel( Language.ButtonOpen);
+ DirectoryButton->SetLabel( Language.ButtonDirectory);
+ UpdateButton->SetLabel( Language.ButtonUpdate);
+ SaveButton->SetLabel( Language.ButtonSave);
+
+ int num = Notebook->GetPageCount();
+ for (int i=0; iGetPage(i);
+ page->UpdateLanguage();
+ }
+ }
+}
void OTM_Frame::OnMenuHelp(wxCommandEvent& WXUNUSED(event))
{
- wxFile dat;
- if (!dat.Access( "README.txt", wxFile::read)) return;
- dat.Open("README.txt", wxFile::read);
- if (!dat.IsOpened()) {return;}
- unsigned len = dat.Length();
+ wxString help;
+ if (Language.GetHelpMessage( help))
+ {
+ wxMessageBox(Language.LastError, "ERROR", wxOK|wxICON_ERROR);
+ Language.LastError.Empty();
+ return;
+ }
- char* buffer;
- try {buffer = new char [len+1];}
- catch (...) {return ;}
-
- unsigned int result = dat.Read( buffer, len);
- dat.Close();
- if (len!=result) {delete [] buffer; return;}
-
- buffer[len] = 0;
-
- wxString msg = buffer;
- wxMessageBox(msg, "help", wxOK);
+ wxMessageBox( help, Language.MenuHelp, wxOK);
}
void OTM_Frame::OnMenuAbout(wxCommandEvent& WXUNUSED(event))
{
- wxMessageBox(L"OpenTexMod V0.9 alpha by ROTA\nhttp://code.google.com/p/texmod/", "Info", wxOK);
+ wxString msg;
+ msg << OTM_VERSION << " by ROTA\nhttp://code.google.com/p/texmod/";
+ wxMessageBox( msg, "Info", wxOK);
};
void OTM_Frame::OnMenuAddGame(wxCommandEvent& WXUNUSED(event))
{
- wxString file_name = wxFileSelector( Language.ChooseFile, "", "", "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('\\');
wxArrayString array;
- GetHookedGames( array);
+ if (GetHookedGames( array))
+ {
+ wxMessageBox( LastError, "ERROR", wxOK|wxICON_ERROR);
+ LastError.Empty();
+ return;
+ }
int num = array.GetCount();
for (int i=0; i.
+along with OpenTexMod. If not, see .
*/
@@ -43,8 +43,7 @@ public:
void OnButtonSave(wxCommandEvent& WXUNUSED(event));
- //void OnMenuPref(wxCommandEvent& WXUNUSED(event));
- //void OnMenuQuit(wxCommandEvent& WXUNUSED(event));
+ void OnMenuLanguage(wxCommandEvent& WXUNUSED(event));
void OnMenuHelp(wxCommandEvent& WXUNUSED(event));
void OnMenuAbout(wxCommandEvent& WXUNUSED(event));
void OnMenuAddGame(wxCommandEvent& WXUNUSED(event));
@@ -68,7 +67,6 @@ private:
wxMenuBar *MenuBar;
- //wxMenu *MenuMain;
wxMenu *MenuGame;
wxMenu *MenuHelp;
@@ -81,13 +79,18 @@ private:
OTM_Client **Clients;
HMODULE H_DX9_DLL;
+ wxString LastError;
+
DECLARE_EVENT_TABLE();
};
class MyApp : public wxApp
{
public:
+ virtual ~MyApp();
virtual bool OnInit();
+private:
+ HANDLE CheckForSingleRun;
};
diff --git a/OTM_GUI/OTM_GameInfo.cpp b/OTM_GUI/OTM_GameInfo.cpp
index 242a705..ead8258 100644
--- a/OTM_GUI/OTM_GameInfo.cpp
+++ b/OTM_GUI/OTM_GameInfo.cpp
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
@@ -35,6 +35,7 @@ OTM_GameInfo::OTM_GameInfo(const wxString &name)
OTM_GameInfo::~OTM_GameInfo(void)
{
+ if (Checked!=NULL) delete [] Checked;
}
void OTM_GameInfo::Init(void)
@@ -50,13 +51,13 @@ void OTM_GameInfo::Init(void)
NumberOfChecked = 0;
SavePath.Empty();
OpenPath.Empty();
- Textures.Empty();
+ Files.Empty();
}
int OTM_GameInfo::SaveToFile( const wxString &file_name)
{
- wxString name = file_name;
- name += L"_save.txt";
+ wxString name;
+ name << "OTM_GameSave_" << file_name << ".txt";
wxFile file;
//if (!file.Access(name, wxFile::write)) return -1;
@@ -100,16 +101,16 @@ int OTM_GameInfo::SaveToFile( const wxString &file_name)
content.Printf( L"TextureColour:%d,%d,%d\n", TextureColour[0], TextureColour[1], TextureColour[2]);
file.Write( content.char_str(), content.Len());
- int num = Textures.GetCount();
+ int num = Files.GetCount();
for (int i=0; iNumberOfChecked)
+ if (num>LengthOfChecked)
{
if (Checked!=NULL) delete [] Checked;
try {Checked = new bool [num+100];}
@@ -280,6 +282,7 @@ int OTM_GameInfo::SetChecked( bool* array, int num)
LengthOfChecked = num+100;
}
for (int i=0; i.
+along with OpenTexMod. If not, see .
*/
@@ -47,11 +47,11 @@ public:
int SetSaveAllTextures(bool val);
bool GetSaveAllTextures(void) const {return SaveAllTextures;}
- void SetTextures(const wxArrayString &textures);
- void GetTextures( wxArrayString &textures) const;
- void AddTexture( const wxString &textures);
+ void SetFiles(const wxArrayString &files);
+ void GetFiles( wxArrayString &files) const;
+ //void AddTexture( const wxString &textures);
- int GetNumberOfTextures(void) const {return Textures.GetCount();}
+ int GetNumberOfFiles(void) const {return Files.GetCount();}
int SendTextures(void);
@@ -86,7 +86,8 @@ private:
bool SaveSingleTexture;
bool SaveAllTextures;
- wxArrayString Textures;
+
+ wxArrayString Files;
int KeyBack;
int KeySave;
diff --git a/OTM_GUI/OTM_GamePage.cpp b/OTM_GUI/OTM_GamePage.cpp
index 95fb7e5..3a5ac9b 100644
--- a/OTM_GUI/OTM_GamePage.cpp
+++ b/OTM_GUI/OTM_GamePage.cpp
@@ -13,22 +13,11 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
#include "OTM_Main.h"
-/*
-#ifndef __CDT_PARSER__
-
-
-BEGIN_EVENT_TABLE(OTM_GamePage, wxFrame)
- EVT_BUTTON(ID_Button_Open, OTM_Frame::OnButtonUp)
- EVT_BUTTON(ID_Button_Path, OTM_Frame::OnButtonDown)
- EVT_BUTTON(ID_Button_Update, OTM_Frame::OnButtonDelete)
-END_EVENT_TABLE()
-#endif
-*/
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)
{
@@ -124,11 +113,12 @@ OTM_GamePage::OTM_GamePage( wxNotebook *parent, const wxString &name, PipeStruct
save_path << Game.GetSavePath();
SavePath->SetValue(save_path);
+ NumberOfEntry = Game.GetNumberOfFiles();
+ Files.Alloc(NumberOfEntry+100);
- wxArrayString array;
- Game.GetTextures( array);
+ Game.GetFiles( Files);
- NumberOfEntry = array.GetCount();
+ NumberOfEntry = Files.GetCount();
MaxNumberOfEntry = NumberOfEntry+100;
CheckBoxes = new wxCheckBox*[MaxNumberOfEntry];
bool *checked = new bool[NumberOfEntry];
@@ -144,7 +134,7 @@ OTM_GamePage::OTM_GamePage( wxNotebook *parent, const wxString &name, PipeStruct
for (int i=0; iSetValue( checked[i]);
wchar_t button_txt[2];
@@ -175,6 +165,13 @@ OTM_GamePage::OTM_GamePage( wxNotebook *parent, const wxString &name, PipeStruct
OTM_GamePage::~OTM_GamePage(void)
{
+ for (int i=0; iAdd( (wxWindow*) CheckButtonDelete[NumberOfEntry], 0, wxEXPAND, 0);
MainSizer->Add( CheckBoxHSizers[NumberOfEntry], 0, wxEXPAND, 0);
+ Files.Add( file_name);
NumberOfEntry++;
- Game.AddTexture( file_name);
MainSizer->Layout();
}
-int OTM_GamePage::UpdateGame(void)
+int OTM_GamePage::GetSettings(void)
{
- Game.SetSaveSingleTexture(SaveSingleTexture->GetValue());
- Game.SetSaveAllTextures(SaveAllTextures->GetValue());
+ int key_back = ChoiceKeyBack->GetSelection();
+ int key_save = ChoiceKeySave->GetSelection();
+ int key_next = ChoiceKeyNext->GetSelection();
- int key = ChoiceKeyBack->GetSelection();
- if (key!=wxNOT_FOUND) Game.SetKeyBack(key);
+ 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;}
- key = ChoiceKeySave->GetSelection();
- if (key!=wxNOT_FOUND) Game.SetKeySave(key);
+ 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;}
- key = ChoiceKeyNext->GetSelection();
- if (key!=wxNOT_FOUND) Game.SetKeyNext(key);
+ if (key_back!=wxNOT_FOUND) Game.SetKeyBack(key_back);
+ if (key_save!=wxNOT_FOUND) Game.SetKeySave(key_save);
+ if (key_next!=wxNOT_FOUND) Game.SetKeyNext(key_next);
+
+ Game.SetSaveSingleTexture( save_single);
+ Game.SetSaveAllTextures( save_all);
int colour[3];
colour[0] = GetColour( FontColour[1], 255);
@@ -251,11 +256,19 @@ int OTM_GamePage::UpdateGame(void)
SetColour( &TextureColour[1], colour);
Game.SetTextureColour(colour);
+ Game.SetFiles( Files);
+
bool *checked = new bool[NumberOfEntry];
for (int i=0; iGetValue();
Game.SetChecked( checked, NumberOfEntry);
delete [] checked;
+ return 0;
+}
+
+int OTM_GamePage::UpdateGame(void)
+{
+ if (int ret = GetSettings()) return ret;
if (int ret = Sender.Send( Game, GameOld))
{
LastError = Language.Error_Send;
@@ -268,6 +281,18 @@ int OTM_GamePage::UpdateGame(void)
return 0;
}
+int OTM_GamePage::SaveToFile( const wxString &file_name)
+{
+ if (int ret = GetSettings()) return ret;
+ if (int ret = Game.SaveToFile( file_name))
+ {
+ LastError = Language.Error_SaveFile;
+ LastError <<"\n" << file_name;
+ return ret;
+ }
+ return 0;
+}
+
int OTM_GamePage::SetColour( wxTextCtrl** txt, int *colour)
{
wxString temp;
@@ -279,6 +304,7 @@ int OTM_GamePage::SetColour( wxTextCtrl** txt, int *colour)
}
return 0;
}
+
int OTM_GamePage::GetColour( wxTextCtrl* txt, int def)
{
wxString temp = txt->GetValue();
@@ -292,64 +318,18 @@ int OTM_GamePage::GetColour( wxTextCtrl* txt, int def)
return colour;
}
-int OTM_GamePage::SaveToFile( const wxString &file_name)
-{
- Game.SetSaveSingleTexture(SaveSingleTexture->GetValue());
- Game.SetSaveAllTextures(SaveAllTextures->GetValue());
-
- int key = ChoiceKeyBack->GetSelection();
- if (key!=wxNOT_FOUND) Game.SetKeyBack(key);
-
- key = ChoiceKeySave->GetSelection();
- if (key!=wxNOT_FOUND) Game.SetKeySave(key);
-
- key = ChoiceKeyNext->GetSelection();
- if (key!=wxNOT_FOUND) Game.SetKeyNext(key);
-
- int colour[3];
- colour[0] = GetColour( FontColour[1], 255);
- colour[1] = GetColour( FontColour[2], 0);
- colour[2] = GetColour( FontColour[3], 0);
- SetColour( &FontColour[1], colour);
- Game.SetFontColour(colour);
-
- colour[0] = GetColour( TextureColour[1], 0);
- colour[1] = GetColour( TextureColour[2], 255);
- colour[2] = GetColour( TextureColour[3], 0);
- SetColour( &TextureColour[1], colour);
- Game.SetTextureColour(colour);
-
- bool *checked = new bool[NumberOfEntry];
- for (int i=0; iGetValue();
- Game.SetChecked( checked, NumberOfEntry);
- delete [] checked;
-
- if (int ret = Game.SaveToFile( file_name))
- {
- LastError = Language.Error_SaveFile;
- LastError <<"\n" << file_name;
- return ret;
- }
- return 0;
-}
-
void OTM_GamePage::OnButtonUp(wxCommandEvent& event)
{
int id = (event.GetId() - ID_Button_Texture)/3;
if (id <=0 || id>= NumberOfEntry) return;
- wxArrayString array;
- Game.GetTextures( array);
+ wxString cpy = Files[id];
+ Files[id] = Files[id-1];
+ Files[id-1] = cpy;
- wxString cpy = array[id];
- array[id] = array[id-1];
- array[id-1] = cpy;
-
- Game.SetTextures( array);
-
- CheckBoxes[id]->SetLabel(array[id]);
- CheckBoxes[id-1]->SetLabel(array[id-1]);
+ CheckBoxes[id]->SetLabel(Files[id]);
+ CheckBoxes[id-1]->SetLabel(Files[id-1]);
bool cpy_checked = CheckBoxes[id]->GetValue();
CheckBoxes[id]->SetValue(CheckBoxes[id-1]);
@@ -361,17 +341,12 @@ void OTM_GamePage::OnButtonDown(wxCommandEvent& event)
int id = (event.GetId() - ID_Button_Texture-1)/3;
if (id <0 || id>= NumberOfEntry-1) return;
- wxArrayString array;
- Game.GetTextures( array);
+ wxString cpy = Files[id];
+ Files[id] = Files[id+1];
+ Files[id+1] = cpy;
- wxString cpy = array[id];
- array[id] = array[id+1];
- array[id+1] = cpy;
-
- Game.SetTextures( array);
-
- CheckBoxes[id]->SetLabel(array[id]);
- CheckBoxes[id+1]->SetLabel(array[id+1]);
+ CheckBoxes[id]->SetLabel(Files[id]);
+ CheckBoxes[id+1]->SetLabel(Files[id+1]);
bool cpy_checked = CheckBoxes[id]->GetValue();
CheckBoxes[id]->SetValue(CheckBoxes[id+1]);
@@ -383,19 +358,15 @@ void OTM_GamePage::OnButtonDelete(wxCommandEvent& event)
int id = (event.GetId() - ID_Button_Texture-2)/3;
if (id <0 || id>= NumberOfEntry) return;
- wxArrayString array;
- Game.GetTextures( array);
+ for (int i=id+1; iSetLabel(Files[i]);
- for (int i=id+1; iSetLabel(array[i]);
-
- array.RemoveAt(id, 1);
- Game.SetTextures( array);
+ Files.RemoveAt(id, 1);
NumberOfEntry--;
- Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &OTM_GamePage::OnButtonUp, this, 3*id);
- Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &OTM_GamePage::OnButtonDown, this, 3*id+1);
- Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &OTM_GamePage::OnButtonDelete, this, 3*id+2);
+ Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &OTM_GamePage::OnButtonUp, this, ID_Button_Texture+3*NumberOfEntry);
+ Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &OTM_GamePage::OnButtonDown, this, ID_Button_Texture+3*NumberOfEntry+1);
+ Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &OTM_GamePage::OnButtonDelete, this, ID_Button_Texture+3*NumberOfEntry+2);
CheckBoxVSizer->Detach( CheckBoxHSizers[NumberOfEntry]);
@@ -415,3 +386,20 @@ void OTM_GamePage::OnButtonDelete(wxCommandEvent& event)
delete CheckButtonDelete[NumberOfEntry];
CheckButtonDelete[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;
+ temp << Game.GetSavePath();
+ SavePath->SetValue( temp);
+ return 0;
+}
+
diff --git a/OTM_GUI/OTM_GamePage.h b/OTM_GUI/OTM_GamePage.h
index 2fd68fe..b818c03 100644
--- a/OTM_GUI/OTM_GamePage.h
+++ b/OTM_GUI/OTM_GamePage.h
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
@@ -50,9 +50,13 @@ public:
void OnButtonDown(wxCommandEvent& WXUNUSED(event));
void OnButtonDelete(wxCommandEvent& WXUNUSED(event));
+ int UpdateLanguage(void);
+
wxString LastError;
private:
+
+ int GetSettings(void);
int SetColour( wxTextCtrl** txt, int *colour);
int GetColour( wxTextCtrl* txt, int def);
@@ -86,6 +90,7 @@ private:
OTM_Language &Language;
+ wxArrayString Files;
OTM_GameInfo Game;
OTM_GameInfo GameOld;
diff --git a/OTM_GUI/OTM_Language.cpp b/OTM_GUI/OTM_Language.cpp
index 06339fc..c7c404b 100644
--- a/OTM_GUI/OTM_Language.cpp
+++ b/OTM_GUI/OTM_Language.cpp
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
@@ -21,68 +21,212 @@ along with FooOpenTexMod. If not, see .
#include "OTM_Main.h"
-OTM_Language::OTM_Language(void)
+OTM_Language::OTM_Language(void) : DefaultLanguage("English")
{
- LoadLanguage(0); //English
+ if (LoadCurrentLanguage()) {CurrentLanguage = DefaultLanguage; LoadDefault();}
+ else LoadLanguage( CurrentLanguage);
+ LoadKeys();
}
-int OTM_Language::LoadLanguage(int lang)
+#define LAST_USED_LANGUAGE_FILE "OTM_LastUsedLanguage.txt"
+
+int OTM_Language::LoadCurrentLanguage(void)
{
- if (lang==0) //English
- {
- //MenuPref = L"Preferences";
- //MenuQuit = L"Quit";
- MenuHelp = L"Help";
- MenuAbout = L"About";
- MenuAddGame = L"Add game";
- MenuDeleteGame = L"Delete Game";
+ wxFile file;
+ if (!file.Access( LAST_USED_LANGUAGE_FILE, wxFile::read)) return -1;
+ file.Open( LAST_USED_LANGUAGE_FILE, wxFile::read);
+ if (!file.IsOpened()) return -1;
+ unsigned len = file.Length();
- //MainMenuStart = L"Start";
- MainMenuGame = L"Game";
- MainMenuHelp = L"Help";
+ char* buffer;
+ try {buffer = new char [len+1];}
+ catch (...) {return -1;}
- ButtonOpen = L"Open texture";
- ButtonDirectory = L"Set save directory";
- ButtonUpdate = L"Update";
- ButtonSave = L"Save as default";
+ unsigned int result = file.Read( buffer, len);
+ file.Close();
+ if (result != len) return -1;
+ buffer[len]=0;
- ChooseFile = L"Choose a texture file";
- ChooseDir = L"Choose a directory";
-
- CheckBoxSaveSingleTexture = L"Save single texture";
- CheckBoxSaveAllTextures = L"Save all textures";
- TextCtrlSavePath = L"Save path: ";
-
- DeleteGame = L"Select the games to be deleted.";
-
- GameAlreadyAdded = L"Game has been already added.";
- FileNotSupported = L"This file type is not supported:\n";
- ExitGameAnyway = L"Closing OpenTexMod while a game is running might lead to a crash of the game.\nExit anyway?";
-
- Error_DLLNotFound = L"Could not load the dll.\nThe dll injection won't work.\nThis might happen if D3DX9_43.dll is not installed on your system.\nPlease install the newest DirectX End-User Runtime Web Installer.";
- Error_FktNotFound = L"Could not load function out of dll.\nThe dll injection won't work.";
-
- Error_Send = L"Could not send to game.";
- Error_SaveFile = L"Could not save to file.";
- Error_NoPipe = L"Pipe is not opened.";
- Error_WritePipe = L"Could not write in pipe.";
- Error_FlushPipe = L"Could not flush pipe buffer.";
- Error_Hash = L"Could not find hash, maybe file is not named as *_HASH.dds";
- Error_FileOpen = L"Could not open file.";
- Error_FileRead = L"Could not read file.";
- Error_Memory = L"Could not allocate enough memory";
- Error_FileformatNotSupported = L"This file format is not supported.";
- Error_Unzip = L"Could not unzip.";
- Error_ZipEntry = L"Could not find zip entry.";
-
- FontColour = L"Font colour (RGB):";
- TextureColour = L"Texture colour (RGB):";
- }
-
- LoadKeys(lang);
+ CurrentLanguage = buffer;
+ delete [] buffer;
return 0;
}
-#define QUOTES(x) #x
+
+
+int OTM_Language::SaveCurrentLanguage(void)
+{
+ wxFile file;
+ if (!file.Access( LAST_USED_LANGUAGE_FILE, wxFile::write)) return -1;
+ file.Open( LAST_USED_LANGUAGE_FILE, wxFile::write);
+ if (!file.IsOpened()) return -1;
+
+ file.Write( CurrentLanguage.char_str(), CurrentLanguage.Len());
+ return 0;
+}
+
+
+int OTM_Language::GetLanguages(wxArrayString &lang)
+{
+ wxArrayString files;
+ wxDir::GetAllFiles( wxGetCwd(), &files, "OTM_LanguagePack_*.txt");
+ lang.Empty();
+ lang.Alloc(files.GetCount()+1);
+ lang.Add("English");
+
+ wxString temp;
+ int num = files.GetCount();
+ for (int i=0; i.
+along with OpenTexMod. If not, see .
*/
@@ -27,16 +27,16 @@ public:
OTM_Language(void);
- int LoadLanguage(int lang);
+ int LoadLanguage(const wxString &name);
+ int GetLanguages(wxArrayString &lang);
+ int GetHelpMessage(wxString &help);
- wxString MenuPref;
- wxString MenuQuit;
+ wxString MenuLanguage;
wxString MenuHelp;
wxString MenuAbout;
wxString MenuAddGame;
wxString MenuDeleteGame;
- wxString MainMenuStart;
wxString MainMenuGame;
wxString MainMenuHelp;
@@ -52,8 +52,10 @@ public:
wxString CheckBoxSaveAllTextures;
wxString TextCtrlSavePath;
- wxString DeleteGame;
+ wxString SelectLanguage;
+ wxString ChooseGame;
+ wxString DeleteGame;
wxString GameAlreadyAdded;
wxString FileNotSupported;
wxString ExitGameAnyway;
@@ -61,6 +63,8 @@ public:
wxString Error_FktNotFound;
wxString Error_DLLNotFound;
wxString Error_Send;
+ wxString Error_KeyTwice;
+ wxString Error_NoSavePath;
wxString Error_SaveFile;
wxString Error_NoPipe;
wxString Error_WritePipe;
@@ -83,8 +87,18 @@ public:
wxString FontColour;
wxString TextureColour;
+
+ wxString LastError;
+
private:
- int LoadKeys(int lang);
+ int LoadCurrentLanguage(void);
+ int SaveCurrentLanguage(void);
+
+ int LoadDefault(void);
+ int LoadKeys(void);
+
+ wxString CurrentLanguage;
+ const wxString DefaultLanguage;
};
diff --git a/OTM_GUI/OTM_Main.h b/OTM_GUI/OTM_Main.h
index 251f28e..c27fc01 100644
--- a/OTM_GUI/OTM_Main.h
+++ b/OTM_GUI/OTM_Main.h
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
@@ -82,6 +82,7 @@ enum
ID_Button_Save,
ID_Menu_Pref,
ID_Menu_Quit,
+ ID_Menu_Lang,
ID_Menu_Help,
ID_Menu_About,
ID_Menu_AddGame,
diff --git a/OTM_GUI/OTM_Sender.cpp b/OTM_GUI/OTM_Sender.cpp
index 71e5c0e..ec4ebc7 100644
--- a/OTM_GUI/OTM_Sender.cpp
+++ b/OTM_GUI/OTM_Sender.cpp
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
@@ -130,16 +130,16 @@ int OTM_Sender::Send( const OTM_GameInfo &game, const OTM_GameInfo &game_old)
// the rest of this function is not optimized !!
- if (game.GetNumberOfTextures()<=0)
+ if (game.GetNumberOfFiles()<=0)
{
if (LastError.Len()>0) return 1;
else return 0;
}
- wxArrayString textures;
+ wxArrayString files;
- game.GetTextures( textures);
- int num = textures.GetCount();
+ game.GetFiles( files);
+ int num = files.GetCount();
bool *checked = new bool [num];
game.GetChecked( checked, num);
@@ -149,30 +149,31 @@ int OTM_Sender::Send( const OTM_GameInfo &game, const OTM_GameInfo &game_old)
unsigned long temp_hash;
for (int i=0; i0) return 1;
else return 0;
@@ -249,6 +250,8 @@ int OTM_Sender::SendTextures(unsigned int num, AddTextureClass *tex)
delete [] hash;
if (pos) if (int ret = SendToGame( Buffer, pos)) return ret;
+ delete [] tex;
+
if (LastError.Len()>0) return 1;
else return 0;
}
@@ -359,7 +362,7 @@ int OTM_Sender::AddZip( AddTextureClass *tex, wxString file, bool add, bool forc
unsigned int result = dat.Read( buffer, len);
dat.Close();
- if (result != len) {LastError << Language.Error_FileRead<<"\n" << file; return -1;}
+ if (result != len) {delete [] buffer; LastError << Language.Error_FileRead<<"\n" << file; return -1;}
if (tpf)
{
@@ -483,6 +486,7 @@ int OTM_Sender::AddContent( char* buffer, unsigned int len, const char* pw, AddT
count++;
}
}
+ delete [] def;
tex->Num = count;
}
else // texmod.def is not present in the zip file
diff --git a/OTM_GUI/OTM_Sender.h b/OTM_GUI/OTM_Sender.h
index 7d4d5ab..9efe7f5 100644
--- a/OTM_GUI/OTM_Sender.h
+++ b/OTM_GUI/OTM_Sender.h
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_GUI/OTM_Server.cpp b/OTM_GUI/OTM_Server.cpp
index 35c7f95..092d1e9 100644
--- a/OTM_GUI/OTM_Server.cpp
+++ b/OTM_GUI/OTM_Server.cpp
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_GUI/OTM_Server.h b/OTM_GUI/OTM_Server.h
index 8ab81c8..a1eb98c 100644
--- a/OTM_GUI/OTM_Server.h
+++ b/OTM_GUI/OTM_Server.h
@@ -13,7 +13,7 @@ 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 FooOpenTexMod. If not, see .
+along with OpenTexMod. If not, see .
*/
diff --git a/OTM_GUI/bin/Example_OTM_LanguagePack_English.txt b/OTM_GUI/bin/Example_OTM_LanguagePack_English.txt
new file mode 100644
index 0000000..01f4818
--- /dev/null
+++ b/OTM_GUI/bin/Example_OTM_LanguagePack_English.txt
@@ -0,0 +1,116 @@
+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!!
+
+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|
+MenuAddGame:
+Add game|
+MenuDeleteGame:
+Delete Game|
+MainMenuGame:
+Game|
+MainMenuHelp:
+Help|
+ButtonOpen:
+Open texture|
+ButtonDirectory:
+save directory|
+ButtonUpdate:
+Update|
+ButtonSave:
+Save settings|
+ChooseFile:
+Choose a texture file|
+ChooseDir:
+Choose a directory|
+CheckBoxSaveSingleTexture:
+Save single texture|
+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.|
+FileNotSupported:
+This file type is not supported:|
+ExitGameAnyway:
+Closing OpenTexMod while a game is running might lead to a crash of the game.
+Exit anyway?|
+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_Send:
+Could not send to game.|
+Error_KeyTwice:
+You assigned a key twice.|
+Error_NoSavePath:
+You did not set a save path.|
+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_FileformatNotSupported:
+This file format is not supported.|
+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/OTM_LanguagePack_Deutsch.txt b/OTM_GUI/bin/OTM_LanguagePack_Deutsch.txt
new file mode 100644
index 0000000..3c36b14
--- /dev/null
+++ b/OTM_GUI/bin/OTM_LanguagePack_Deutsch.txt
@@ -0,0 +1,56 @@
+MenuLanguage:Sprache|
+MenuHelp:Hilfe|
+MenuAbout:Über|
+MenuAddGame:Spiel hinzufügen|
+MenuDeleteGame:Spiel entfernen|
+MainMenuGame:Spiele|
+MainMenuHelp:Hilfe|
+ButtonOpen:Texturen öffnen|
+ButtonDirectory:Speicherpfad|
+ButtonUpdate:Update|
+ButtonSave:Einstellungen speichern|
+ChooseFile:Wähle eine Textur/Mod|
+ChooseDir:Wähle ein Verzeichnes|
+CheckBoxSaveSingleTexture:Speicher einzelne Texturen|
+CheckBoxSaveAllTextures:Speicher alle Texturen|
+TextCtrlSavePath:Speicherverzeichnis: |
+SelectLanguage:Wähle eine Sprache.|
+ChooseGame:Wähle eine Spiel-exe|
+DeleteGame:Wähle die Spiele zum Entfernen|
+GameAlreadyAdded:Das Spiel wurde bereits hinzugefügt.|
+FileNotSupported:Dieser Filetype wird nicht unterstützt:|
+
+ExitGameAnyway:
+Es ist nicht ratsam OpenTexMod zu schließen, während Spiele noch offen sind.
+Dies kann zum Absturz der Spiele führen.
+Trozdem beenden?|
+
+Error_DLLNotFound:
+Konnte die dll nicht laden,
+Die dll injection wird nicht funktionieren.
+Der Grund dafür kann das fehlen von D3DX9_43.dll sein.
+Bitte installiere den neusten DirectX End-User Runtime Web Installer.|
+
+Error_FktNotFound:
+Konnte nicht die Funktion aus der dll laden.
+Die dll injection wird nicht funktionieren.|
+
+Error_Send:Konnte nicht an das Spiel senden.|
+Error_KeyTwice:Du hast einen Taste mehrmals verwendet.|
+Error_NoSavePath:Du hast kein Speicherverzeichnis gesetzt.|
+Error_SaveFile:Konnte nicht in Datei speichern|
+Error_NoPipe:Pipe ist nicht offen.|
+Error_WritePipe:Konnte nicht in Pipe schreiben.|
+Error_FlushPipe:Konnte Inhalt der Pipe nicht schreiben (flush).|
+Error_Hash:Konnte den Hash nicht erkennen, vielleicht entspricht der Name nicht dem Format *_HASH.dds|
+Error_FileOpen:Konnte Datei nicht öffnen:|
+Error_FileRead:Konnte Datei nich lesen:|
+Error_Memory:Konnte nicht genügen Speicher allokieren.|
+Error_FileformatNotSupported:Dieses Dateiformat wird nicht unterstützt.|
+Error_Unzip:Konnte zip-Datei nicht entpacken.|
+Error_ZipEntry:Konnte Eintrag in zip-Datei nicht finden.|
+KeyBack:Zurück|
+KeySave:Speichern|
+KeyNext:Vorwärts|
+FontColour:Schriftfarbe (RGB):|
+TextureColour:Texturfarbe (RGB):|
\ No newline at end of file
diff --git a/OTM_GUI/bin/README_Deutsch.txt b/OTM_GUI/bin/README_Deutsch.txt
new file mode 100644
index 0000000..026699d
--- /dev/null
+++ b/OTM_GUI/bin/README_Deutsch.txt
@@ -0,0 +1,96 @@
+Warnung: Du verwendest diese Programm auf eigene Gefahr hin!
+1) Wenn das Programm abstürzt wird du wahrscheinlich keinen Support
+ vom Spielehersteller bekommen. Aber du kannst den Fehler gerne
+ angeben unter http://code.google.com/p/texmod/issues/list
+2) Spiele können detektieren ob sie verändert werde, daher riskierst du
+ einen Bann deines online Accounts.
+3) Dies ist eine open-source Projekt. Der Code kann von jedem erhalten, verändert
+ und kompiliert werden. Lade OpenTexMod nur von offiziellen Quellen runter,
+ denen du vertraust. Lade es selbst runter und verwende keine Versionen
+ die du von Team- oder Gildenmitgliedern geschickt bekommen hast.
+ http://code.google.com/p/texmod/downloads/list
+
+
+OpenTexMod verwendet die D3DX9_43.dll. Wegen den EULA kann diese dll nicht mit OpenTexMod
+mit geliefert werden. Wenn diese dll auf deinem System nicht installiert ist, wird dich OpenTexMod
+darauf hinweisen.
+
+
+Was kann OpenTexMod alpha V0.9?
+
+-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
+-Support der originalen TexMod *.tpf Datein
+
+Alle diese Optionen können während des Spieles an und aus geschaltet werden!
+Du kannst also nach einer Textur suchen, diese speichern, sie anschließend
+editieren, sie in das Spiel laden, sie nach bearbeiten und wieder in das
+Spiel laden, ...
+und das alles ohne das Spiel neu starten zu müssen.
+
+Randbemerkung: Wenn alle Texturen gespeichert werden sollen, so geschieht das nur,
+wenn die Texturen vom Spiel geladen werden und auch nur in dem Moment, wenn sie
+geladen werden. Stellst du diese Option an, während die Map bereits geladen ist, wird
+wahrscheinlich nichts geschehen, da alle Texturen für diese Map bereits geladen sind.
+Wechsle also die Map oder lade erneut.
+
+Wie interagiert OpenTexMod mit den Spielen?
+
+OpenTexMod klingt sich zwischen die Verbindung vom Spiel und DirectX ein.
+Das verlangt, dass OpenTexMod bereits vor dem Spiel gestartet wird.
+
+Die GUI von OpenTexMod fungiert als Server. Ein Spiel, in das sich erfolgreich
+eingeklingt wurde, verbindet sich beim Programmstart mit dem Server.
+Die GUI von OpenTexMod kann mehrere Spiele gleichzeitig verwalten.
+Jede Instanz eines Spieles wird auch separat gehandhabt (wenn ein Spiel
+mehrfach gestartet wird).
+
+
+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.
+
+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
+ Systemverzeichnis suchen. Nur für diese Spiele wird diese Methode funktionieren.
+ WARNUNG: Kopiere diese dll niemals in das Systemverzeichnis!!
+
+Wenn du dich für eine Methode entschieden hast, starte einfach OpenTexMod
+und danach das Spiel. Es ist nicht nötig (du kannst auch nicht) das Spiel über
+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.
+
+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.
+
+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
+Entladen) wird durchgeführt, ungeachtet dessen, was die restlichen Mods mit der
+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.
+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
diff --git a/OTM_GUI/bin/README.txt b/OTM_GUI/bin/README_English.txt
similarity index 74%
rename from OTM_GUI/bin/README.txt
rename to OTM_GUI/bin/README_English.txt
index 42d4abd..5bfd24a 100644
--- a/OTM_GUI/bin/README.txt
+++ b/OTM_GUI/bin/README_English.txt
@@ -8,10 +8,11 @@ WARNING: You use this program at your own risk!
Download it by your self and don't use versions, send to you by team or guild members!
http://code.google.com/p/texmod/downloads/list
-OpenTexMod uses the D3DX9_43.dll. Due to the EULA this dll cannot be deliviered together with OpenTexMod .
+OpenTexMod uses the D3DX9_43.dll. Due to the EULA this dll cannot be delivered together with OpenTexMod .
If D3DX9_43.dll is not installed on your system, OpenTexMod will give you a hint at program start.
-What can OpenTexMod alpha V0.1?
+
+What can OpenTexMod alpha V0.9?
-extract and save single textures from a DX9 game (the target texture can be toggled in the game)
-extract and save all textures from a DX9 game
@@ -24,6 +25,10 @@ So you can search for a texture in the game, save it to disk, edit it,
load it into the game, edit it again and load it into the game again, ...
and all without a restart of the game.
+side note: If "save all textures" is switched on, the texture will only be saved, if
+the textures are loaded by the game and only in the moment they are loaded.
+If you switch this option on, while a map is loaded, probably nothing will hapen,
+because all textures are loaded for this map. Change the Map or reload it again.
How does OpenTexMod interact with the game?
@@ -34,12 +39,10 @@ It is required, that OpenTexMod is running before the game is started.
The GUI of OpenTexMod act as a server. A game which is successfully
intercepted with the OpenTexMod-dll will connect on program start to the server.
The GUI of OpenTexMod can handle multiple games at the same time. It will
-also process each instance of a game as separate process (if the same game
+also process each instance of a game as separate process (if the same game
was started more than once).
-
-
How to get OpenTexMod work?
There are two ways how OpenTexMod can intercept the DirectX connection:
@@ -53,7 +56,7 @@ There are two ways how OpenTexMod can intercept the DirectX connection:
Only for these games this method will work.
WARNING: never copy this dll into your system directory!!
-If you have chosen one of the two methods, you simply start OpenTexMod
+If you have chosen one of the two methods, you simply start OpenTexMod
and afterwards the game. There is no need to (and either you can't) start
the game through OpenTexMod.
@@ -63,10 +66,26 @@ the changes to the game. You can also save your current settings. They will be l
and committed automatically when you start the same 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
+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.
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
(load or unload) is proceeded regardless of what the following mods are opposed
to do with their mod-textures.
+
+
+How to get OpenTexMod work together with steam?
+
+OpenTexMod looks only for the name of the executed binary and not of their working directory.
+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
diff --git a/OTM_GlobalDefines.h b/OTM_GlobalDefines.h
index 2ba2cea..7de0d3e 100644
--- a/OTM_GlobalDefines.h
+++ b/OTM_GlobalDefines.h
@@ -1,3 +1,21 @@
+/*
+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_GlobalDefines_H_
#define OTM_GlobalDefines_H_
@@ -23,6 +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 PIPE_OTM2Game L"\\\\.\\pipe\\OTM2Game"
#define PIPE_Game2OTM L"\\\\.\\pipe\\Game2OTM"