- a bug prevented to unload Mods, which were new added to the list

Improvements:
- OpenTexMod can now be started only once
- language support (German package provided)
- added more error comments
This commit is contained in:
code@koerner-de.net
2011-09-26 14:03:36 +00:00
parent ec7383c76b
commit 3e30507ad4
40 changed files with 886 additions and 294 deletions
+4 -1
View File
@@ -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
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
/*
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
/*
+2 -2
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -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;
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+19
View File
@@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef OTM_ERROR_H_
#define OTM_ERROR_H_
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+101 -54
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -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; i<num; i++)
{
OTM_GamePage* page = (OTM_GamePage*) Notebook->GetPage(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<num; i++) if (array[i] == file_name)
{
wxMessageBox(Language.GameAlreadyAdded, "ERROR", wxOK);
wxMessageBox(Language.GameAlreadyAdded, "ERROR", wxOK|wxICON_ERROR);
return;
}
array.Add(file_name);
SetHookedGames( array);
if (SetHookedGames( array))
{
wxMessageBox( LastError, "ERROR", wxOK|wxICON_ERROR);
LastError.Empty();
return;
}
}
}
@@ -366,7 +403,12 @@ void OTM_Frame::OnMenuDeleteGame(wxCommandEvent& WXUNUSED(event))
{
wxArrayInt selections;
wxArrayString array;
GetHookedGames(array);
if (GetHookedGames( array))
{
wxMessageBox( LastError, "ERROR", wxOK|wxICON_ERROR);
LastError.Empty();
return;
}
wxGetSelectedChoices( selections, Language.DeleteGame, Language.DeleteGame, array);
int num = selections.GetCount();
@@ -375,7 +417,12 @@ void OTM_Frame::OnMenuDeleteGame(wxCommandEvent& WXUNUSED(event))
array.RemoveAt( selections[i]-i); //this will work only if selections is sorted !!
}
SetHookedGames(array);
if (SetHookedGames( array))
{
wxMessageBox( LastError, "ERROR", wxOK|wxICON_ERROR);
LastError.Empty();
return;
}
}
@@ -387,20 +434,20 @@ int OTM_Frame::GetHookedGames( wxArrayString &array)
wchar_t *app_path = _wgetenv( L"APPDATA");
name.Printf("%ls\\%ls\\%ls", app_path, OTM_APP_DIR, OTM_APP_DX9);
if (!file.Access(name, wxFile::read)) return -1;
if (!file.Access(name, wxFile::read)) {LastError << Language.Error_FileOpen << "\n" << name; return -1;}
file.Open(name, wxFile::read);
if (!file.IsOpened()) {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 (...) {return -1;}
catch (...) {LastError << Language.Error_Memory; return -1;}
unsigned int result = file.Read( buffer, len);
file.Close();
if (result != len) return -1;
if (result != len) {delete [] buffer; LastError << Language.Error_FileRead<<"\n" << name; return -1;}
buffer[len]=0;
@@ -437,7 +484,7 @@ 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()) {return -1;}
if (!file.IsOpened()) {LastError << Language.Error_FileOpen << "\n" << name ; return -1;}
wxString content;
int num = array.GetCount();
+7 -4
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -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;
};
+25 -21
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -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; i<num; i++)
{
if (i<NumberOfChecked)
{
if (Checked[i]) content.Printf( L"Add_true:%ls\n", Textures[i].wc_str());
else content.Printf( L"Add_false:%ls\n", Textures[i].wc_str());
if (Checked[i]) content.Printf( L"Add_true:%ls\n", Files[i].wc_str());
else content.Printf( L"Add_false:%ls\n", Files[i].wc_str());
}
else content.Printf( L"Add_true:%ls\n", Textures[i].wc_str());
else content.Printf( L"Add_true:%ls\n", Files[i].wc_str());
file.Write( content.char_str(), content.Len());
}
@@ -122,8 +123,8 @@ int OTM_GameInfo::LoadFromFile( const wxString &file_name)
{
Init();
wxString name = file_name;
name += L"_save.txt";
wxString name;
name << "OTM_GameSave_" << file_name << ".txt";
wxFile file;
if (!file.Access(name, wxFile::read)) return -1;
@@ -162,6 +163,7 @@ int OTM_GameInfo::LoadFromFile( const wxString &file_name)
wxString line;
wxString command;
wxString temp;
Files.Alloc(num);
for (int i=0; i<num; i++)
{
line = token.GetNextToken();
@@ -171,12 +173,12 @@ int OTM_GameInfo::LoadFromFile( const wxString &file_name)
if (command == L"Add_true")
{
Checked[NumberOfChecked++] = true;
Textures.Add(line.AfterFirst(':'));
Files.Add(line.AfterFirst(':'));
}
else if (command == L"Add_false")
{
Checked[NumberOfChecked++] = false;
Textures.Add(line.AfterFirst(':'));
Files.Add(line.AfterFirst(':'));
}
else if (command == L"SavePath") SavePath = line.AfterFirst(':');
else if (command == L"OpenPath") OpenPath = line.AfterFirst(':');
@@ -272,7 +274,7 @@ int OTM_GameInfo::GetChecked( bool* array, int num) const
int OTM_GameInfo::SetChecked( bool* array, int num)
{
if (num>NumberOfChecked)
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<num; i++) Checked[i] = array[i];
NumberOfChecked = num;
return 0;
}
@@ -295,21 +298,22 @@ int OTM_GameInfo::SetSaveAllTextures(bool val)
return 0;
}
void OTM_GameInfo::SetTextures(const wxArrayString &textures)
void OTM_GameInfo::SetFiles(const wxArrayString &files)
{
Textures = textures;
Files = files;
}
void OTM_GameInfo::GetTextures( wxArrayString &textures) const
void OTM_GameInfo::GetFiles( wxArrayString &files) const
{
textures = Textures;
files = Files;
}
void OTM_GameInfo::AddTexture( const wxString &textures)
/*
void OTM_GameInfo::AddTexture( const wxString &file)
{
Textures.Add(textures);
Files.Add(file);
}
*/
OTM_GameInfo& OTM_GameInfo::operator = (const OTM_GameInfo &rhs)
{
@@ -330,7 +334,7 @@ OTM_GameInfo& OTM_GameInfo::operator = (const OTM_GameInfo &rhs)
SavePath = rhs.SavePath;
OpenPath = rhs.OpenPath;
Textures = rhs.Textures;
Files = rhs.Files;
for (int i=0; i<3; i++) FontColour[i]=rhs.FontColour[i];
for (int i=0; i<3; i++) TextureColour[i]=rhs.TextureColour[i];
+7 -6
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -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;
+84 -96
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
#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; i<NumberOfEntry;i++)
{
CheckBoxHSizers[i] = new wxBoxSizer(wxHORIZONTAL);
CheckBoxes[i] = new wxCheckBox( this, -1, array[i]);
CheckBoxes[i] = new wxCheckBox( this, -1, Files[i]);
CheckBoxes[i]->SetValue( 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; i<NumberOfEntry; i++)
{
Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &OTM_GamePage::OnButtonUp, this, ID_Button_Texture+3*i);
Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &OTM_GamePage::OnButtonDown, this, ID_Button_Texture+3*i+1);
Unbind( wxEVT_COMMAND_BUTTON_CLICKED, &OTM_GamePage::OnButtonDelete, this, ID_Button_Texture+3*i+2);
}
delete [] CheckBoxHSizers;
delete [] CheckButtonUp;
delete [] CheckButtonDown;
@@ -219,24 +216,32 @@ void OTM_GamePage::AddTexture( const wxString &file_name)
CheckBoxHSizers[NumberOfEntry]->Add( (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; i<NumberOfEntry; i++) checked[i] = CheckBoxes[i]->GetValue();
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; i<NumberOfEntry; i++) checked[i] = CheckBoxes[i]->GetValue();
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; i<NumberOfEntry; i++) CheckBoxes[i-1]->SetLabel(Files[i]);
for (int i=id+1; i<NumberOfEntry; i++) CheckBoxes[i-1]->SetLabel(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;
}
+6 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -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;
+258 -61
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -21,68 +21,212 @@ along with FooOpenTexMod. If not, see <http://www.gnu.org/licenses/>.
#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<num; i++)
{
temp = files[i];
temp = temp.AfterLast('\\');
temp = temp.AfterFirst('_');
temp = temp.AfterFirst('_');
temp = temp.BeforeLast('.');
lang.Add(temp);
}
return 0;
}
int OTM_Language::GetHelpMessage(wxString &help)
{
wxString file;
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();
unsigned char* buffer;
try {buffer = new unsigned char [len+1];}
catch (...) {LastError << Error_Memory; return -1;}
unsigned int result = dat.Read( buffer, len);
dat.Close();
if (result != len) {delete [] buffer; LastError << Error_FileRead<<"\n" << file; return -1;}
buffer[len]=0;
help=buffer;
return 0;
}
#define CheckEntry( command, msg, target) \
if ( command == #target ) \
{ \
target = msg; \
} else
int OTM_Language::LoadLanguage(const wxString &name)
{
LoadDefault();
CurrentLanguage = name;
if (name=="English")
{
if (wxFile::Exists(LAST_USED_LANGUAGE_FILE)) wxRemoveFile(LAST_USED_LANGUAGE_FILE);
return 0;
}
wxString file_name;
file_name << "OTM_LanguagePack_" << name << ".txt";
wxFile dat;
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];}
catch (...) {LastError << Error_Memory; return -1;}
unsigned int result = dat.Read( buffer, len);
dat.Close();
if (result != len) {delete [] buffer; LastError << Error_FileRead<<"\n" << file_name; return -1;}
buffer[len]=0;
wxStringTokenizer token( buffer, "|");
int num = token.CountTokens();
wxString entry;
wxString command;
wxString msg;
for (int i=0; i<num; i++)
{
entry = token.GetNextToken();
command = entry.BeforeFirst(':');
command.Replace( "\r", "");
command.Replace( "\n", "");
msg = entry.AfterFirst(':');
while (msg[0]=='\r' || msg[0]=='\n') msg.Remove(0,1);
while (msg.Last()=='\n' || msg.Last()=='\r') msg.RemoveLast(1);
CheckEntry( command, msg, MenuLanguage)
CheckEntry( command, msg, MenuHelp)
CheckEntry( command, msg, MenuAbout)
CheckEntry( command, msg, MenuAddGame)
CheckEntry( command, msg, MenuDeleteGame)
CheckEntry( command, msg, MainMenuGame)
CheckEntry( command, msg, MainMenuHelp)
CheckEntry( command, msg, ButtonOpen)
CheckEntry( command, msg, ButtonDirectory)
CheckEntry( command, msg, ButtonUpdate)
CheckEntry( command, msg, ButtonSave)
CheckEntry( command, msg, ChooseFile)
CheckEntry( command, msg, ChooseDir)
CheckEntry( command, msg, CheckBoxSaveSingleTexture)
CheckEntry( command, msg, CheckBoxSaveAllTextures)
CheckEntry( command, msg, TextCtrlSavePath)
CheckEntry( command, msg, SelectLanguage)
CheckEntry( command, msg, ChooseGame)
CheckEntry( command, msg, DeleteGame)
CheckEntry( command, msg, GameAlreadyAdded)
CheckEntry( command, msg, FileNotSupported)
CheckEntry( command, msg, ExitGameAnyway)
CheckEntry( command, msg, Error_FktNotFound)
CheckEntry( command, msg, Error_DLLNotFound)
CheckEntry( command, msg, Error_Send)
CheckEntry( command, msg, Error_KeyTwice)
CheckEntry( command, msg, Error_NoSavePath)
CheckEntry( command, msg, Error_SaveFile)
CheckEntry( command, msg, Error_NoPipe)
CheckEntry( command, msg, Error_WritePipe)
CheckEntry( command, msg, Error_FlushPipe)
CheckEntry( command, msg, Error_Hash)
CheckEntry( command, msg, Error_FileOpen)
CheckEntry( command, msg, Error_FileRead)
CheckEntry( command, msg, Error_Memory)
CheckEntry( command, msg, Error_FileformatNotSupported)
CheckEntry( command, msg, Error_Unzip)
CheckEntry( command, msg, Error_ZipEntry)
CheckEntry( command, msg, KeyBack)
CheckEntry( command, msg, KeySave)
CheckEntry( command, msg, KeyNext)
CheckEntry( command, msg, FontColour)
CheckEntry( command, msg, TextureColour)
{}
}
delete [] buffer;
SaveCurrentLanguage();
return 0;
}
#undef CheckEntry
#define AddKey( name, key ) \
{ \
@@ -90,15 +234,68 @@ int OTM_Language::LoadLanguage(int lang)
KeyValues.Add( key ); \
}
int OTM_Language::LoadKeys(int lang)
int OTM_Language::LoadDefault(void)
{
if (lang==0) //English
{
KeyBack = L"Back";
KeySave = L"Save";
KeyNext = L"Next";
}
MenuLanguage = L"Change Language";
MenuHelp = L"Help";
MenuAbout = L"About";
MenuAddGame = L"Add game";
MenuDeleteGame = L"Delete Game";
MainMenuGame = L"Game";
MainMenuHelp = L"Help";
ButtonOpen = L"Open texture";
ButtonDirectory = L"Set save directory";
ButtonUpdate = L"Update";
ButtonSave = L"save settings";
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:";
SelectLanguage = L"Select a language.";
ChooseGame = L"Select a game binary.";
DeleteGame = L"Select the games to be deleted.";
GameAlreadyAdded = L"Game has been already added.";
FileNotSupported = L"This file type is not supported:\n";
ExitGameAnyway = L"Closing OpenTexMod while a game is running might lead to a crash of the game.\nExit anyway?";
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_KeyTwice = L"You have assigned the same key twice.";
Error_NoSavePath = L"You did not set a save path.";
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.";
KeyBack = L"Back";
KeySave = L"Save";
KeyNext = L"Next";
FontColour = L"Font colour (RGB):";
TextureColour = L"Texture colour (RGB):";
return 0;
}
int OTM_Language::LoadKeys(void)
{
KeyStrings.Empty();
KeyValues.Empty();
/*
+21 -7
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -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;
};
+2 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -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,
+15 -11
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -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; i<num; i++)
{
file_type = textures[i];
file_type = files[i];
file_type = file_type.AfterLast( '.');
if (file_type == L"zip")
{
AddZip( &tex[i], textures[i], checked[i], true, false);
AddZip( &tex[i], files[i], checked[i], true, false);
}
else if (file_type == L"tpf")
{
AddZip( &tex[i], textures[i], checked[i], true, true);
AddZip( &tex[i], files[i], checked[i], true, true);
}
else if (file_type == L"dds")
{
AddFile( &tex[i], textures[i], checked[i], true);
AddFile( &tex[i], files[i], checked[i], true);
}
else
{
wxString msg = Language.FileNotSupported;
msg << textures[i];
msg << files[i];
wxMessageBox(msg, "ERROR", wxOK);
}
}
SendTextures( num, tex);
delete [] checked;
if (LastError.Len()>0) 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
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
+1 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
along with OpenTexMod. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -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):|
+56
View File
@@ -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):|
+96
View File
@@ -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.
@@ -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.
+19
View File
@@ -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 <http://www.gnu.org/licenses/>.
*/
#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"