uMod2 Alpha Version:

known bugs: I disabled the remove device function inside the gui, because something in the event handling goes terrible wrong.

Changes:
- hashing algorithm is now a CRC64 value
- changed CRC32 algorithm to a faster one
- in save single texture mode, the selected texture can now be displayed
- the way how uMod get the raw data of the texture was changed
This commit is contained in:
code@koerner-de.net
2012-08-04 19:30:29 +00:00
parent 0bc7eebede
commit 071ac3ece5
41 changed files with 1126 additions and 1108 deletions
+31 -29
View File
@@ -16,14 +16,14 @@ diese dll nicht mit Universal Modding Engine mit geliefert werden. Wenn diese dl
deinem System nicht installiert ist, wird dich Universal Modding Engine darauf hinweisen.
Was kann Universal Modding Engine (uMod) V1.0?
Was kann Universal Modding Engine (uMod) V2.0?
-einzelne Texturen aus einem Spiel extrahieren und speichern (Die Zieltextur kann im Spiel geändert werden.)
-alle Texturen aus einem Spiel extrahieren und speichern
-alle Texturen aus einem Spiel extrahieren und speichern (mit Größen- und Texturformat-Filter)
-Texturen in ein Spiel laden und Zieltexturen ersetzen
-Support einzelner dds Texturen
-Support von zip-Dateien
-Support der originalen TexMod *.tpf Datein
-Support einzelner Texturen
-Support von zip-Dateien (mit Darstellung von Textur-Gruppen als Baumstruktur)
-Support der originalen TexMod *.tpf Dateien (der Support muss über das Kontext-Menü aktiviert werden)
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
@@ -37,12 +37,8 @@ geladen werden. Stellst du diese Option an, w
wahrscheinlich nichts geschehen, da alle Texturen für diese Map bereits geladen sind.
Wechsle also die Map oder lade erneut.
Zip Dateien können eine "texmod.def" Datei enthalten, welche die Hash-Werte und
Dateinamen enthält. Jede Zeile sollte dem Format "hash|filename.dds" entsprechen.
Wenn es keine "texmod.def" Datei enthält, wird jede Datei entpackt und jene, deren
Namen auf das Wildcard "*_hash.dds" zutrifft, werden benutzt.
Die Zip Datei kann eine "Comment.txt" Datei enthalten. Der Inhalte wird als Kommentar
in der GUI angezeigt.
Zip Dateien können eine "content.txt" Datei enthalten, welche Informationen Gruppen und Texturen enthält.
Siehe dazu die zwei mitgelieferten Beispiele.
Wenn du einzelne Dateien lädst, sollten diese dem Wildcard "*_hash.dds" entsprechen.
@@ -69,9 +65,9 @@ Es gibt drei Wege wie uMod sich in die DirectX Verbindung einklinken kann:
bekannte Probleme: Guild Wars (Win XP)
2) Starte das Spiel direkt durch OTM über das Menü
"Einstellungen->Sarte Spiel durch OTM" oder
"Einstellungen->Sarte Spiel durch OTM (mit Kommandozeile)".
2) Starte das Spiel direkt durch uMod über das Menü
"Einstellungen->Sarte Spiel durch uMod" oder
"Einstellungen->Sarte Spiel durch uMod (mit Kommandozeile)".
Das Spiel startet sofort.
3) Kopiere die d3d9.dll (vom uMod Verzeichnis) in das Spiele Verzeichnis.
@@ -86,25 +82,31 @@ Universal Modding Engine und danach das Spiel. Starte das Spiel in beiden F
Universal Modding Engine .
Wenn das Spiel startet und alles glatt läuft, öffnet sich sofort ein neuer Tab in uMod.
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
als ein Template speichern. Ein Template kann auch als Standard eingestellt werden.
Es wird dann automatisch geladen und an das Spiel gesendet, wenn
dieses Spiel das nächste Mal gestartet wird.
Im obersten Feld steht die Methode, welche verwendet wurde um sich in das Spiel
ein zu klinken. Danach sollten Informationen über erzeugte DirectX Devices stehen.
z.B. (DX9) oder (DX9EX: 3). Dies gibt an, welches Device und wie viele durch das Spiel
gestartet (und von uMod umgeleitet) wurden. Fehlt diese Information, so ist das Modden
nicht möglich. Mögliche Ursachen können sein, dass das Spiel kein DirectX 9 verwendet
oder uMod zu langsam war, um sich in das Spiel ein zu klinken.
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".
Der Update Button lädt nur Veränderungen (wenn 1) Pakete aus der Liste entfernt
wurden, 2) du die Häkchen verändert hast oder 3) sich die Reihenfolge geändert hat)
Der "neu laden" Button erzwingt das Neuladen von Festplatte (z.B. wenn du die
Texturen verändert hast).
Wenn Du Veränderungen vornimmst, so musst Du diese über das Kontext-Menü
(rechte Maustaste im unteren Fenster) -> Update bestätigen.
Update (neu laden) bewirkt, dass die Texturen neu von der Festplatte geladen werden.
Diese Option ist nur für diejenigen sinnvoll, die Texturen editieren.
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.
Neue Mods oder Texturen kannst Du über das Kontext-Menü oder per Drag&Drop aus
dem Explorer heraus öffnen. Die Reihenfolge der Mods veränderst Du ebenfalls über
Drag&Drop. Die Reihenfolge kann dann wichtig sein, wenn zwei Mods, die gleiche
Spiele-Textur verändern wollen. Dann wird die Änderung des Mods aktiv, welcher weiter
oben gelistet ist.
Zusätzlich kannst Du jeden Mod aufklappen und einzelne Texturen aktivieren oder deaktivieren.
Mods mit dem neuen Mod-Format können auch mehrere Ebenen von Gruppen enthalten.
Hier kannst du einzelne Gruppen aktivieren und deaktivieren.
Während bei Texturen immer eines der beiden Häkchen gesetzt sein muss, können beim
Mod-Paket oder bei Gruppen beide Häkchen entfernt werden, um die Kontrolle an die nächst
tiefer liegende Ebene zu übergeben.
Wie bekommt man Universal Modding Engine mit Steam zum Laufen?
+22 -20
View File
@@ -13,14 +13,14 @@ cannot be delivered together with Universal Modding Engine . If D3DX9_43.dll is
installed on your system, Universal Modding Engine will give you a hint at program start.
What can Universal Modding Engine (uMod) V1.0?
What can Universal Modding Engine (uMod) V2.0?
-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
-extract and save all textures from a DX9 game (with size and texture format filter)
-load textures into a game to replace target textures
-support single dds texture
-support zip-files as whole mod package
-support the original TexMod *.tpf files
-support zip-files as whole mod package (groups of textures can be displayed as tree view)
-support the original TexMod *.tpf files (the tpf support must be enabled through the context menu)
All these options can be switched on or off, while the game is already running!
So you can search for a texture in the game, save it to disk, edit it,
@@ -32,12 +32,8 @@ the textures are loaded by the game and only in the moment they are loaded.
If you switch this option on, while a map is loaded, probably nothing will hapen,
because all textures are loaded for this map. Change the Map or reload it again.
Zip files can include a "texmod.def" file which contains the hash and the file name.
Each line should be in the format "hash|filename.dds"
If it does not contain a "texmod.def" each file will be unpacked and those which match
the wildcard "*_hash.dds" will be used.
The zip file can include a "Comment.txt" file. The content will be shown as comment
in the GUI.
Zip files can include a content.txt" file which contains information about
groups and textures. Two examples are included in the package.
If you load single files, they should match the wildcard "*_hash.dds"
@@ -80,23 +76,29 @@ If you have chosen the first or third method, you simply start Universal Modding
and afterwards the game. Do NOT start the game through Universal Modding Engine.
If the game starts and all works fine, a new tab opens immediately in uMod.
In this tab you can now mod the game. Press the "update" button to commit
the changes to the game. You can also save your current settings as a template.
One template can be set as default for a game, which will be loaded and
and committed automatically when you start this game the next time.
In the upper text control you can read the method of injection. An additional information
about created DirectX devices follows e.g. (DX9) or (DX9EX: 3). It informs you, what kind of
device and how many devices were created by the game (and detoured by uMod). If this
information is not displayed, you are not able to modify the game. Possible reason might
be, that the game does not use DirectX9 or uMod was not fast enough to inject the game.
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.
After you have changed Settings you have to update via the context menu (right click
in the bottom window). Update (reload) reloads all texture from disk, this is only for
users, which edit textures.
Clicking on update will only update the differences (if packages have been
removed from the list, you toggled check marks or changed the order). The reload
button forces to reload from disk (if you have edited the texture itself).
Due to the fact that different mods can modify the same target texture, only the
mod-texture of the first file in the list is taken into account. The action of this file
(load or unload) is proceeded regardless of what the following mods are opposed
to do with their mod-textures.
New mods or textures can be opened through the context menu or through drag&drop
from the explorer. The order of mods can be rearranged also using drag&drop. The order
of mods is important, if two mods try to modify the same game texture. In this case,
the texture from the mod listed first is taken.
Additionally you can expand mods and activate or deactivate single textures. Mod
with the new mod-format can contain many groups, which can be activated or deactivated
separately. For textures at least one tick mark must be set, for mods and groups bot tick
marks can be unset to give the control to the underlying layer.
How to get Universal Modding Engine work together with Steam?
@@ -1,5 +1,5 @@
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/
Email address and support can be found at http://code.google.com/p/texmod/
The file name must match the wildcard uMod_LanguagePack_NAMEOFLANGUAGE.txt
@@ -36,117 +36,122 @@ English itself is compiled into the uMod_GUI.exe, thus there exists no uMod_Lang
The following list is an example of how an English package would look like (maybe not all keywords are present).
MenuHelp:
Help|
MenuAbout:
About|
MenuLanguage:Change language|
MenuHelp:Help|
MenuAbout:About|
MenuAcknowledgement:Acknowledgement|
MenuStartGame:Start game through uMod|
MenuStartGameCMD :Start game through uMod (with command line)|
MenuStartGameCMD:Start game through uMod (with command line)|
MenuUseHook:Use global hook|
MenuAddGame:
Add game|
MenuDeleteGame:
Delete Game|
MenuAddGame:Add game|
MenuDeleteGame:Delete game|
MenuLoadTemplate:Load template|
MenuSaveTemplate:Save template|
MenuSaveTemplateAs:Save template as ...|
MenuSetDefaultTemplate:Set template as default|
MenuLanguage:Change language|
MenuExit:Exit|
MainMenuMain:Main|
MainMenuHelp:
Help|
MainMenuHelp:Help|
MenuOpenPackage:Open texture/package|
MenuRemovePackage:Remove package|
MenuRemoveSelectedPackages:Remove selected packages|
ButtonOpen:
Open texture|
ButtonDirectory:
save directory|
ButtonUpdate:
Update|
ButtonReload:Update (reload)|
MenuUpdate:Update|
MenuReload:Update (reload)|
MenuSupportTPF:Support TPF-Mods|
ButtonUpdate:Update|
ButtonDirectory:Set save directory|
ChooseFile:Choose a file|
ChooseDir:
Choose a directory|
CheckBoxSaveSingleTexture:
Save single texture|
ChooseDir:Choose a directory|
MultipleSingleFiles:Multiple single files|
HookInjection:Hook Injection: |
DirectInjection:Direct Injection: |
NoInjection:No Injection: |
InvalidGamePage:default page|
TextCtrlTemplate:Template: |
CheckBoxSaveAllTextures:
Save all textures|
TextCtrlSavePath:
Save path: |
SelectLanguage:
Select a language|
CollapseTextureCapture:Capture textures|
CheckBoxSaveSingleTexture:Save single texture|
CheckBoxShowStringSaveSingleTexture:Show message in the upper left corner|
CheckBoxShowSingleTexture:Show texture in the upper left corner|
CheckBoxSaveAllTextures:Save all textures|
SelectLanguage:Select a language.|
StartGame:Select the game to start.|
CommandLine:Set command line arguments.|
ChooseGame:
Select a game binary.
DeleteGame:
Select the games to be deleted.|
GameAlreadyAdded:
Game has been already added.|
ExitGameAnyway:
Closing Universal Modding Engine while a game is running might lead to a crash of the game.
Exit anyway?|
NoComment:
No comment.|
Author:
Author: |
ChooseTemplate:Chose a template|
OpenTemplate:Open template|
SaveTemplate:Save template|
DefaultTemplate:Set default template|
AutoSaveTemplate:auto save|
ChooseGame:Select a game binary.|
DeleteGame:Select the games to be deleted.|
GameAlreadyAdded:Game has been already added.|
ExitGameAnyway:Closing OpenTexMod while a game is running might lead to a crash of the game.
Exit anyway?|
Title:Title|
Author:Author|
Comment:Comment|
SingleTextureNode:Single Textures|
Error_GameIsHooked:The global hook is active and this game will be injected! Please delete the game from the list or disable the hook.|
Error_ProcessNotStarted:The game could not be started.|
Error_RemoveHook:Removing the Hook while a game is running might lead to crash.|
Error_FileNotSupported:
This file type is not supported:|
Error_DLLNotFound:
Could not load the dll.
The dll injection won't work.
This might happen if D3DX9_43.dll is not installed on your system.
Error_FileNotSupported:This file type is not supported:
|
Error_FileIsEmpty:Could not retrieve textures from file:
|
Error_D3DX9NotFound:The D3DX9_43.dll (32bit) is not available on your system.
Please install the newest DirectX End-User Runtime Installer.|
Error_DLLNotFound:Could not load the dll.
The dll injection won't work.
This might happen if D3DX9_43.dll (32bit) 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.
Error_FktNotFound:Could not load function out of dll.
The dll injection won't work.|
Error_AlreadyRunning:An other instance of Universal Modding Engine is already running.|
Error_Send:
Could not send to game.|
Error_KeyTwice:
You assigned a key twice.|
Error_NoSavePath:
You did not set a save path.|
Error_KeyNotSet:
At least one key is not set.|
Error_SaveFile:
Could not save to file.|
Error_NoPipe:
Pipe is not opened.|
Error_WritePipe:
Could not write in pipe.|
Error_FlushPipe:
Could not flush pipe buffer.|
Error_Hash:
Could not find hash, maybe file is not named as *_HASH.dds|
Error_FileOpen:
Could not open file.|
Error_FileRead:
Could not read file.|
Error_Memory:
Could not allocate enough memory|
Error_Unzip:
Could not unzip.|
Error_ZipEntry:
Could not find zip entry.|
KeyBack:
Back|
KeySave:
Save|
KeyNext:
Next|
FontColour:
Font colour (RGB):|
TextureColour:
Texture colour (RGB):|
Error_AlreadyRunning:An other instance of OpenTexMod is already running.|
Error_Send:Could not send to game.|
Error_KeyTwice:You have assigned the same key twice.|
Error_NoSavePath:You did not set a save path.|
Error_KeyNotSet:At least one key is not set.|
Error_SaveFile:Could not save to file.|
Error_NoPipe:Pipe is not opened.|
Error_WritePipe:Could not write in pipe.|
Error_FlushPipe:Could not flush pipe buffer.|
Error_Hash:Could not find hash, maybe file is not named as *_HASH.dds|
Error_FileOpen:Could not open file:|
Error_FileRead:Could not read file:|
Error_NoTemplates:No templates available.|
Error_Memory:Could not allocate enough memory.|
Error_Unzip:Could not unzip.|
Error_ZipEntry:Could not find zip entry.|
CheckBoxUseSizeFilter:Use size filter|
CheckBoxUseFormatFilter:Use texture format filter|
SetFormatFilter:Set the filter|
WidthSpin:Width :|
HeightSpin:Height :|
DepthSpin:Depth :|
KeyBack:Back|
KeySave:Save|
KeyNext:Next|
AskForKey:Pleas press a Key.|
KeyNotSet:Not set|
UnknownKey:Unknown|
FontColour:Font colour|
TextureColour:Texture colour|
-149
View File
@@ -1,149 +0,0 @@
# =========================================================================
# This configuration file was generated by
# Bakefile 0.2.8 (http://www.bakefile.org)
# Beware that all changes made to this file will be overwritten next
# time you run Bakefile!
# =========================================================================
# -------------------------------------------------------------------------
# These are configurable options:
# -------------------------------------------------------------------------
# Compiler flags to link shared library
#LINK_DLL_FLAGS ?= -shared
LINK_DLL_FLAGS ?=
# Compiler flags to link loadable module
#LINK_MODULE_FLAGS ?= -shared
LINK_MODULE_FLAGS ?=
# C compiler
CC = gcc
# C++ compiler
CXX = g++
# Standard flags for CC
CFLAGS ?=
# Standard flags for C++
CXXFLAGS ?= -Wno-unused
# Standard preprocessor flags (common for CC and CXX)
CPPFLAGS ?=
# Standard linker flags
LDFLAGS ?= -static-libgcc -static-libstdc++
# The C preprocessor
CPP ?= $(CC) -E
# What type of library to build? [0,1]
SHARED ?= 0
# Build wxUniversal instead of native port? [0,1]
WXUNIV ?= 0
# Compile Unicode build of wxWidgets? [0,1]
UNICODE ?= 1
# Use MSLU library when building Unicode version. [0,1]
MSLU ?= 0
# Type of compiled binaries [debug,release]
BUILD ?= release
# Should debugging info be included in the executables? The default value
# "default" means that debug info will be included if BUILD=debug
# and not included if BUILD=release. [0,1,default]
DEBUG_INFO ?= 0
# Value of wxDEBUG_LEVEL. The default value is the same as 1 and means that all
# but expensive assert checks are enabled, use 0 to completely remove debugging
# code. [0,1,default]
DEBUG_FLAG ?= 0
# Multiple libraries or single huge monolithic one? [0,1]
MONOLITHIC ?= 0
# Build GUI libraries? [0,1]
USE_GUI ?= 1
# Build wxHTML library (USE_GUI must be 1)? [0,1]
USE_HTML ?= 1
# Build multimedia library (USE_GUI must be 1)? [0,1]
USE_MEDIA ?= 1
# Build wxXRC library (USE_GUI must be 1)? [0,1]
USE_XRC ?= 1
# Build wxAUI library (USE_GUI must be 1)? [0,1]
USE_AUI ?= 1
# Build wxRibbon library (USE_GUI must be 1)? [0,1]
USE_RIBBON ?= 1
# Build wxPropertyGrid library (USE_GUI must be 1)? [0,1]
USE_PROPGRID ?= 1
# Build wxRichTextCtrl library (USE_GUI must be 1)? [0,1]
USE_RICHTEXT ?= 1
# Build wxStyledTextCtrl library (USE_GUI must be 1)? [0,1]
USE_STC ?= 1
# Build OpenGL canvas library (USE_GUI must be 1)? [0,1]
USE_OPENGL ?= 1
# Build quality assurance classes library (USE_GUI must be 1)? [0,1]
USE_QA ?= 0
# Enable exceptions in compiled code. [0,1]
USE_EXCEPTIONS ?= 1
# Enable run-time type information (RTTI) in compiled code. [0,1]
USE_RTTI ?= 1
# Enable threading in compiled code. [0,1]
USE_THREADS ?= 1
# Enable wxCairoContext for platforms other than Linux/GTK. [0,1]
USE_CAIRO ?= 0
# Is this official build by wxWidgets developers? [0,1]
OFFICIAL_BUILD ?= 0
# Use this to name your customized DLLs differently
VENDOR ?= custom
#
WX_FLAVOUR ?=
#
WX_LIB_FLAVOUR ?=
# Name of your custom configuration. This affects directory
# where object files are stored as well as the location of
# compiled .lib files and setup.h under the lib/ toplevel directory.
CFG ?=
# Compiler flags needed to compile test suite in tests directory. If you want
# to run the tests, set it so that the compiler can find CppUnit headers.
CPPUNIT_CFLAGS ?=
# Linker flags needed to link test suite in tests directory. If you want
# to run the tests, include CppUnit library here.
CPPUNIT_LIBS ?=
# Version of C runtime library to use. You can change this to
# static if SHARED=0, but it is highly recommended to not do
# it if SHARED=1 unless you know what you are doing. [dynamic,static]
RUNTIME_LIBS ?= static
# Set the version of your Mingw installation here.
# "3" ...... this is for Mingw 2.0 or newer (comes with gcc3)
# "2.95" ... for Mingw 1.1 or any of the older versions [3,2.95]
GCC_VERSION ?= 3
+2 -3
View File
@@ -18,13 +18,12 @@ OBJS = \
obj
OBJS_exe = \
bin
WX_DIR = D:\Programme\wxWidgets-2.9.3
WX_DIR = D:\Programme\wxWidgets-2.9.4
LIBDIRNAME = \
$(WX_DIR)\lib\$(COMPILER_PREFIX)$(DIR_SUFFIX_CPU)_$(LIBTYPE_SUFFIX)$(CFG)
SETUPHDIR = \
$(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)
MINIMAL_CXXFLAGS = /M$(__RUNTIME_LIBS_10)$(__DEBUGRUNTIME_4) /DWIN32 \
$(__DEBUGINFO_0) /Fd$(OBJS)\uMod_GUI.pdb $(____DEBUGRUNTIME_3_p) \
$(__OPTIMIZEFLAG_6) $(__NO_VC_CRTDBG_p) /D__WXMSW__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
$(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) \
@@ -379,7 +378,7 @@ clean:
-if exist $(OBJS_exe)\uMod_GUI.pdb del $(OBJS_exe)\uMod_GUI.pdb
$(OBJS_exe)\uMod.exe: $(MINIMAL_OBJECTS) $(OBJS)\uMod_GUI.res
link /NOLOGO /OUT:$@ $(__DEBUGINFO_1) /pdb:"$(OBJS)\uMod_GUI.pdb" $(__DEBUGINFO_2) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
link /NOLOGO /OUT:$@ $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
$(MINIMAL_OBJECTS) $(MINIMAL_RESOURCES) $(__WXLIB_ADV_p) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib
<<
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 97 KiB

+27 -96
View File
@@ -57,83 +57,52 @@ uMod_File::~uMod_File(void)
bool uMod_File::FileSupported(void)
{
wxString file_type = FileName.AfterLast( '.');
if (file_type == L"zip") return true;
else if (file_type == L"tpf") return true;
else if (file_type == L"dds") return true;
if (file_type == "zip") return true;
if (file_type == "tpf") return true;
if (file_type == "bmp") return true;
if (file_type == "jpg") return true;
if (file_type == "tga") return true;
if (file_type == "png") return true;
if (file_type == "dds") return true;
if (file_type == "ppm") return true;
return false;
}
bool uMod_File::PackageFile(void)
{
wxString file_type = FileName.AfterLast( '.');
if (file_type == "zip") return true;
if (file_type == "tpf") return true;
return false;
}
bool uMod_File::SingleFile(void)
{
wxString file_type = FileName.AfterLast( '.');
if (file_type == L"dds") return true;
if (file_type == "bmp") return true;
if (file_type == "jpg") return true;
if (file_type == "tga") return true;
if (file_type == "png") return true;
if (file_type == "dds") return true;
if (file_type == "ppm") return true;
return false;
}
/*
int uMod_File::GetComment( wxString &tool_tip)
{
wxString file_type = FileName.AfterLast( '.');
if (file_type == L"zip")
{
if (int ret = GetCommentZip( tool_tip)) return ret;
}
else if (file_type == L"tpf")
{
if (int ret = GetCommentTpf( tool_tip)) return ret;
}
else if (file_type == L"dds")
{
tool_tip = Language->NoComment;
return -1;
}
return 0;
}
int uMod_File::GetContent( AddTextureClass &tex, bool add)
{
wxString file_type = FileName.AfterLast( '.');
if (file_type == L"zip")
{
AddZip( tex, add, false);
}
else if (file_type == L"tpf")
{
AddZip( tex, add, true);
}
else if (file_type == L"dds")
{
AddFile( tex, add);
}
else
{
LastError << Language->Error_FileNotSupported;
LastError << "\n" << FileName;
}
if (LastError.Len()>0) return -1;
else
{
if (add) tex.Loaded = true;
return 0;
}
}
*/
int uMod_File::GetContent( uMod_TreeViewNode* node)
{
wxString file_type = FileName.AfterLast( '.');
if (file_type == L"zip")
if (file_type == "zip")
{
AddZip( node);
}
else if (file_type == L"tpf")
else if (file_type == "tpf")
{
AddTpf( node);
}
else if (file_type == L"dds")
else if (SingleFile())
{
AddFile( node);
}
@@ -219,53 +188,17 @@ int uMod_File::UnXOR(void)
}
/*
int uMod_File::AddFile( uMod_TreeViewNode* node)
{
DWORD64 temp_hash;
wxString name = FileName.AfterLast( '_');
name = name.BeforeLast( '.');
if (!name.ToULongLong( &temp_hash, 16)) {LastError << Language->Error_Hash <<"\n" << FileName << "\n"; return -1;} // return if hash could not be extracted
if (int ret = ReadFile()) return ret;
uMod_TextureElement *texture = new uMod_TextureElement();
if (texture->Content().SetSize(FileLen))
if (!name.ToULongLong( &temp_hash, 16)) // return if hash could not be extracted
{
LastError << Language->Error_Memory;
texture->Release();
LastError << Language->Error_Hash <<"\n" << FileName << "\n";
return -1;
}
char *data = texture->Content().Data();
for (unsigned int i=0; i<FileLen; i++) data[i] = FileInMemory[i];
texture->Hash() = temp_hash;
texture->Title() = FileName;
texture->Status() = uMod_TextureElement::Activate;
uMod_ModElement *element = new uMod_ModElement(uMod_ModElement::Group, uMod_ModElement::NONE);
element->Title() = FileName;
node = new uMod_TreeViewNode( (uMod_TreeViewNode*)0, element);
uMod_TreeViewNode *texture_node = new uMod_TreeViewNode( node, texture);
node->Append(texture_node);
texture->Release();
element->Release();
return 0;
}
*/
int uMod_File::AddFile( uMod_TreeViewNode* node)
{
DWORD64 temp_hash;
wxString name = FileName.AfterLast( '_');
name = name.BeforeLast( '.');
if (!name.ToULongLong( &temp_hash, 16)) {LastError << Language->Error_Hash <<"\n" << FileName << "\n"; return -1;} // return if hash could not be extracted
if (int ret = ReadFile()) return ret;
@@ -398,7 +331,6 @@ int uMod_File::GetContentTemplate_ZIP( const uMod_TreeViewNode_ArrayPtr &list_no
int uMod_File::GetContentTemplate_SF( const uMod_TreeViewNode_ArrayPtr &list_node, uMod_TreeViewNode* node)
{
DWORD64 temp_hash;
wxString name;
for (unsigned int i=0; i<list_node.GetCount(); i++)
@@ -425,7 +357,6 @@ int uMod_File::GetContentTemplate_SF( const uMod_TreeViewNode_ArrayPtr &list_nod
for (unsigned int i=0; i<FileLen; i++) data[i] = FileInMemory[i];
texture->Hash() = temp_hash;
texture->Status() = uMod_TextureElement::Activate;
}
+1
View File
@@ -29,6 +29,7 @@ public:
~uMod_File(void);
bool FileSupported(void);
bool PackageFile(void);
bool SingleFile(void);
//int AddSingleFileToNode( uMod_TreeViewNode* node);
int GetContentTemplate(const wxString &content, uMod_TreeViewNode* node);
+50 -106
View File
@@ -33,10 +33,6 @@ DEFINE_EVENT_TYPE(uMod_EVENT_TYPE)
BEGIN_EVENT_TABLE(uMod_Frame, wxFrame)
EVT_CLOSE(uMod_Frame::OnClose)
//EVT_BUTTON(ID_Button_Open, uMod_Frame::OnButtonOpen)
//EVT_BUTTON(ID_Button_Path, uMod_Frame::OnButtonPath)
//EVT_BUTTON(ID_Button_Update, uMod_Frame::OnButtonUpdate)
//EVT_BUTTON(ID_Button_Reload, uMod_Frame::OnButtonReload)
EVT_MENU(ID_Menu_Help, uMod_Frame::OnMenuHelp)
EVT_MENU(ID_Menu_About, uMod_Frame::OnMenuAbout)
@@ -52,7 +48,7 @@ BEGIN_EVENT_TABLE(uMod_Frame, wxFrame)
EVT_MENU(ID_Menu_LoadTemplate, uMod_Frame::OnMenuOpenTemplate)
EVT_MENU(ID_Menu_SaveTemplate, uMod_Frame::OnMenuSaveTemplate)
EVT_MENU(ID_Menu_SaveTemplateAs, uMod_Frame::OnMenuSaveTemplateAs)
EVT_MENU(ID_Menu_SaveTemplateAs, uMod_Frame::OnMenuSaveTemplate)
EVT_MENU(ID_Menu_SetDefaultTemplate, uMod_Frame::OnMenuSetDefaultTemplate)
EVT_MENU(ID_Menu_Lang, uMod_Frame::OnMenuLanguage)
@@ -85,7 +81,7 @@ bool MyApp::OnInit(void)
wxMessageBox( Language->Error_AlreadyRunning, "ERROR", wxOK|wxICON_ERROR);
return false;
}
uMod_Frame *frame = new uMod_Frame( uMod_VERSION, set);
uMod_Frame *frame = new uMod_Frame( uMod_VERSION L" by ROTA", set);
SetTopWindow( frame );
return true;
@@ -142,7 +138,7 @@ uMod_Frame::uMod_Frame(const wxString& title, uMod_Settings &set)
MainSizer->Add( (wxWindow*) Notebook, 1, wxEXPAND , 0 );
PipeStruct pipe = {INVALID_HANDLE_VALUE,INVALID_HANDLE_VALUE};
uMod_GamePage *page = new uMod_GamePage( Notebook, "uMod", INVALID_GAME_PAGE, "templates/uMod.txt", pipe);
uMod_GamePage *page = new uMod_GamePage( Notebook, "uMod", INVALID_GAME_PAGE, "uMod", pipe);
if (page->LastError.Len()>0)
{
wxMessageBox(page->LastError, "ERROR", wxOK|wxICON_ERROR);
@@ -253,7 +249,7 @@ void uMod_Frame::OnAddGame( wxCommandEvent &event)
client->Create();
client->Run();
wxString save_file;
wxString save_file = "auto_save";
int num = SaveFile_Exe.GetCount();
for (int i=0; i<num; i++) if (name==SaveFile_Exe[i])
{
@@ -330,131 +326,74 @@ void uMod_Frame::OnClose(wxCloseEvent& event)
//event.Skip();
Destroy();
}
/*
void uMod_Frame::OnButtonOpen(wxCommandEvent& WXUNUSED(event))
int uMod_Frame::ChooseTemplate( const wxString &message, wxString &file)
{
if (Notebook->GetPageCount()==0) return;
uMod_GamePage *page = (uMod_GamePage*) Notebook->GetCurrentPage();
if (page==NULL) return;
file.Empty();
wxString temp = "D:\\Code\\uMod\\temp\\bf.tpf";
if (page->AddTexture( temp)) wxMessageBox(page->LastError);
temp = "D:\\Code\\uMod\\temp\\tex.zip";
if (page->AddTexture( temp)) wxMessageBox(page->LastError);
temp = "D:\\Code\\uMod\\temp\\test.zip";
if (page->AddTexture( temp)) wxMessageBox(page->LastError);
return;
//wxString file_name = wxFileSelector( Language->ChooseFile, page->GetOpenPath(), "", "*.*", "textures (*.dds)|*.dds|zip (*.zip)|*.zip|tpf (*.tpf)|*.tpf", wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
wxString file_name = wxFileSelector( Language->ChooseFile, page->GetOpenPath(), "", "", "", wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
if ( !file_name.empty() )
wxArrayString files;
if (wxDir::GetAllFiles( "templates/", &files, "*.txt", wxDIR_FILES)<=0)
{
page->SetOpenPath(file_name.BeforeLast( '/'));
if (page->AddTexture( file_name))
{
wxMessageBox(page->LastError, "ERROR", wxOK|wxICON_ERROR);
page->LastError.Empty();
}
wxMessageBox( Language->Error_NoTemplates, "ERROR", wxOK|wxICON_ERROR);
return -1;
}
}
void uMod_Frame::OnButtonPath(wxCommandEvent& WXUNUSED(event))
{
if (Notebook->GetPageCount()==0) return;
uMod_GamePage *page = (uMod_GamePage*) Notebook->GetCurrentPage();
if (page==NULL) return;
for (unsigned int i=0; i<files.GetCount();i++)
files[i] = files[i].AfterFirst('\\').BeforeLast('.');
wxString dir = wxDirSelector( Language->ChooseDir, page->GetSavePath());
if ( !dir.empty() )
files.Insert("auto_save", 0);
wxSingleChoiceDialog *dialog = new wxSingleChoiceDialog(this, Language->ChooseTemplate, message, files);
if (dialog->ShowModal ()==wxID_OK)
{
page->SetSavePath( dir);
file = dialog->GetStringSelection();
return 0;
}
return 1;
}
void uMod_Frame::OnButtonUpdate(wxCommandEvent& WXUNUSED(event))
{
if (Notebook->GetPageCount()==0) return;
uMod_GamePage *page = (uMod_GamePage*) Notebook->GetCurrentPage();
if (page==NULL) return;
if (page->UpdateGame())
{
wxMessageBox(page->LastError, "ERROR", wxOK|wxICON_ERROR);
page->LastError.Empty();
}
}
void uMod_Frame::OnButtonReload(wxCommandEvent& WXUNUSED(event))
{
if (Notebook->GetPageCount()==0) return;
uMod_GamePage *page = (uMod_GamePage*) Notebook->GetCurrentPage();
if (page==NULL) return;
if (page->ReloadGame())
{
wxMessageBox(page->LastError, "ERROR", wxOK|wxICON_ERROR);
page->LastError.Empty();
}
}
*/
void uMod_Frame::OnMenuOpenTemplate(wxCommandEvent& WXUNUSED(event))
{
if (Notebook->GetPageCount()==0) return;
uMod_GamePage *page = (uMod_GamePage*) Notebook->GetCurrentPage();
if (page==NULL) return;
//wxString file_name = wxFileSelector( Language->ChooseFile, page->GetOpenPath(), "", "*.*", "textures (*.dds)|*.dds|zip (*.zip)|*.zip|tpf (*.tpf)|*.tpf", wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
wxString dir = wxGetCwd();
dir << "/templates";
wxString file_name = wxFileSelector( Language->ChooseFile, dir, "", "*.txt", "text (*.txt)|*.txt", wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
if ( !file_name.empty() )
wxString file_name;
if (ChooseTemplate( Language->OpenTemplate, file_name)!=0)
return;
if (page->LoadTemplate( file_name))
{
if (page->LoadTemplate( file_name))
{
wxMessageBox(page->LastError, "ERROR", wxOK|wxICON_ERROR);
page->LastError.Empty();
}
wxMessageBox(page->LastError, "ERROR", wxOK|wxICON_ERROR);
page->LastError.Empty();
}
}
void uMod_Frame::OnMenuSaveTemplate(wxCommandEvent& WXUNUSED(event))
void uMod_Frame::OnMenuSaveTemplate(wxCommandEvent& event)
{
int id = event.GetId();
if (Notebook->GetPageCount()==0) return;
uMod_GamePage *page = (uMod_GamePage*) Notebook->GetCurrentPage();
if (page==NULL) return;
wxString file_name = page->GetTemplateName();
if ( file_name.empty() )
if (id==ID_Menu_SaveTemplateAs || file_name.IsEmpty())
{
wxString dir = wxGetCwd();
dir << "/templates";
file_name = wxFileSelector( Language->ChooseFile, dir, "", "*.txt", "text (*.txt)|*.txt", wxFD_SAVE | wxFD_OVERWRITE_PROMPT, this);
}
if ( !file_name.empty() )
{
if (page->SaveTemplate(file_name))
file_name = file_name.AfterFirst('\\').BeforeLast('.');
wxTextEntryDialog *dialog = new wxTextEntryDialog( this, Language->ChooseTemplate , Language->SaveTemplate, file_name);
if (dialog->ShowModal ()==wxID_OK)
{
wxMessageBox(page->LastError, "ERROR", wxOK|wxICON_ERROR);
page->LastError.Empty();
file_name = dialog->GetValue();
}
delete dialog;
}
}
void uMod_Frame::OnMenuSaveTemplateAs(wxCommandEvent& WXUNUSED(event))
{
if (Notebook->GetPageCount()==0) return;
uMod_GamePage *page = (uMod_GamePage*) Notebook->GetCurrentPage();
if (page==NULL) return;
wxString dir = wxGetCwd();
dir << "/templates";
wxString file_name = wxFileSelector( Language->ChooseFile, dir, "", "*.txt", "text (*.txt)|*.txt", wxFD_SAVE | wxFD_OVERWRITE_PROMPT, this);
if ( !file_name.empty() )
{
if (page->SaveTemplate(file_name))
@@ -472,21 +411,24 @@ void uMod_Frame::OnMenuSetDefaultTemplate(wxCommandEvent& WXUNUSED(event))
if (page==NULL) return;
if (page == (uMod_GamePage*) Notebook->GetPage(0)) return;
wxString file_name;
if (ChooseTemplate( Language->DefaultTemplate, file_name)!=0)
return;
wxString exe = page->GetExeName();
wxString file = page->GetTemplateName();
int num = SaveFile_Exe.GetCount();
bool hit = false;
for (int i=0; i<num; i++) if (SaveFile_Exe[i]==exe)
{
SaveFile_Name[i] = file;
SaveFile_Name[i] = file_name;
hit = true;
break;
}
if (!hit)
{
SaveFile_Exe.Add(exe);
SaveFile_Name.Add(file);
SaveFile_Name.Add(file_name);
}
if (SaveTemplate())
{
@@ -574,9 +516,11 @@ void uMod_Frame::OnMenuAcknowledgement(wxCommandEvent& WXUNUSED(event))
wxString msg;
msg << "ROTA thanks:\n\n";
msg << "RS for coding the original TexMod and for information about the used hashing algorithm\n\n";
msg << "Vergil for the uMod logo and useful hints\n\n";
msg << "EvilAlex for translation into Russian and bug fixing\n";
msg << "ReRRemi for translation into French";
msg << "\n\n";
msg << "ReRRemi for translation into French\n";
msg << "mirHL for transaltion into Italian\n";
//msg << "\n\n";
//msg << "King Brace Blane for a tutorial video on YouTube and bug fixing";
wxMessageBox( msg, Language->MenuAcknowledgement, wxOK);
}
+4 -1
View File
@@ -74,7 +74,6 @@ public:
void OnMenuOpenTemplate(wxCommandEvent& WXUNUSED(event));
void OnMenuSaveTemplate(wxCommandEvent& WXUNUSED(event));
void OnMenuSaveTemplateAs(wxCommandEvent& WXUNUSED(event));
void OnMenuSetDefaultTemplate(wxCommandEvent& WXUNUSED(event));
void OnMenuLanguage(wxCommandEvent& WXUNUSED(event));
@@ -86,6 +85,8 @@ public:
private:
int ChooseTemplate( const wxString &message, wxString &file);
int ActivateGamesControl(void);
int DeactivateGamesControl(void);
@@ -97,6 +98,8 @@ private:
int GetInjectedGames( wxArrayString &games, wxArrayString &cmd);
int SetInjectedGames( wxArrayString &games, wxArrayString &cmd);
uMod_Server *Server;
wxNotebook *Notebook;
+13 -1
View File
@@ -39,6 +39,7 @@ void uMod_GameInfo::Init(void)
SaveSingleTexture = false;
SaveAllTextures = false;
myShowSingleTextureString = false;
myShowSingleTexture = false;
mySupportTPF = false;
KeyBack = -1;
@@ -59,7 +60,9 @@ void uMod_GameInfo::Init(void)
myFormatFilter = 0u;
myFileFormat = uMod_D3DXIFF_DDS;
SavePath.Empty();
SavePath = wxGetCwd();
SavePath << "\\textures";
OpenPath.Empty();
}
@@ -90,6 +93,9 @@ int uMod_GameInfo::SaveToString( wxString &content )
temp.Printf( "ShowSingleTextureString:%d\n", myShowSingleTextureString);
content << temp;
temp.Printf( "ShowSingleTexture:%d\n", myShowSingleTexture);
content << temp;
temp.Printf( "SupportTPF:%d\n", mySupportTPF);
content << temp;
@@ -183,6 +189,12 @@ int uMod_GameInfo::LoadFromString( const wxString &content)
if (temp.Len()>0 && temp[0]=='0') myShowSingleTextureString = false;
else myShowSingleTextureString = true;
}
else if (command == "ShowSingleTexture")
{
temp = line.AfterFirst(':');
if (temp.Len()>0 && temp[0]=='0') myShowSingleTexture = false;
else myShowSingleTexture = true;
}
else if (command == "SupportTPF")
{
temp = line.AfterFirst(':');
+5
View File
@@ -42,6 +42,7 @@ public:
bool &ShowCollPane(void) {return myShowCollPane;}
const bool &ShowCollPane(void) const {return myShowCollPane;}
bool &SupportTPF(void) {return mySupportTPF;}
@@ -67,6 +68,9 @@ public:
bool &ShowSingleTextureString() {return myShowSingleTextureString;}
const bool &ShowSingleTextureString() const {return myShowSingleTextureString;}
bool &ShowSingleTexture() {return myShowSingleTexture;}
const bool &ShowSingleTexture() const {return myShowSingleTexture;}
int SetFontColour(const unsigned char *colour) {FontColour[0]=colour[0];FontColour[1]=colour[1];FontColour[2]=colour[2];FontColour[3]=colour[3];return 0;}
int GetFontColour(unsigned char *colour) const {colour[0]=FontColour[0];colour[1]=FontColour[1];colour[2]=FontColour[2];colour[3]=FontColour[3];return 0;}
@@ -135,6 +139,7 @@ private:
unsigned long myFileFormat;
bool myShowSingleTextureString;
bool myShowSingleTexture;
unsigned char FontColour[4];
unsigned char TextureColour[4];
+120 -136
View File
@@ -122,9 +122,13 @@ uMod_GamePage::uMod_GamePage( wxNotebook *parent, const wxString &exe, int injec
SaveSingleTexture = new wxCheckBox( SingleTexturePanel, ID_SaveSingleTexture, Language->CheckBoxSaveSingleTexture);
SingleTextureSizer->Add( (wxWindow*) SaveSingleTexture, 0, wxEXPAND, 0);
// check box for showing the string
ShowSingleTexture = new wxCheckBox( SingleTexturePanel, wxID_ANY, Language->CheckBoxShowSingleTexture);
SingleTextureSizer->Add( (wxWindow*) ShowSingleTexture, 0, wxEXPAND| wxUP | wxLEFT | wxRIGHT, 5);
// check box for showing the string
ShowSingleTextureString = new wxCheckBox( SingleTexturePanel, ID_ShowSingleTextureString, Language->CheckBoxShowStringSaveSingleTexture);
SingleTextureSizer->Add( (wxWindow*) ShowSingleTextureString, 0, wxEXPAND|wxALL, 5);
SingleTextureSizer->Add( (wxWindow*) ShowSingleTextureString, 0, wxEXPAND| wxBOTTOM | wxLEFT | wxRIGHT, 5);
//set the two colour buttons into one horizontal sizer
@@ -235,7 +239,7 @@ uMod_GamePage::uMod_GamePage( wxNotebook *parent, const wxString &exe, int injec
temp_sizer->Add( (wxWindow*) SavePathButton, 0, wxEXPAND|wxALL, 0);
temp_sizer->AddSpacer(10);
SavePath = new wxTextCtrl(win, wxID_ANY, Language->TextCtrlSavePath, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
SavePath = new wxTextCtrl(win, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
temp_sizer->Add( (wxWindow*) SavePath, 1, wxEXPAND, 0);
CollSizer->Add( temp_sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
@@ -305,20 +309,25 @@ uMod_GamePage::uMod_GamePage( wxNotebook *parent, const wxString &exe, int injec
if (LastError.IsEmpty())
{
if (TemplateName.Len()>0) LoadTemplate(TemplateName);
LastError.Empty();
else LoadGameData(Game);
if (!LastError.IsEmpty())
{
LoadGameData(Game);
LastError.Empty();
}
}
else LoadGameData(Game);
}
uMod_GamePage::~uMod_GamePage(void)
{
GetSettings();
SaveTemplate("auto_save");
}
int uMod_GamePage::SetSavePath( const wxString &path)
{
wxString save_path = Language->TextCtrlSavePath;
save_path << path;
SavePath->SetValue(save_path);
SavePath->SetValue(path);
Game.SetSavePath( path);
return 0;
}
@@ -413,6 +422,9 @@ int uMod_GamePage::SetInfo(void)
case NO_INJECTION:
info = Language->NoInjection;
break;
case INVALID_GAME_PAGE:
info = Language->InvalidGamePage;
break;
default:
info = "BUG^^ injection:";
break;
@@ -483,6 +495,7 @@ int uMod_GamePage::GetSettings(void)
Game.SetSaveAllTextures( save_all);
Game.ShowSingleTextureString() = ShowSingleTextureString->GetValue();
Game.ShowSingleTexture() = ShowSingleTexture->GetValue();
Game.UseSizeFilter() = UseSizeFilter->GetValue();
SpinHeight->GetValue( Game.HeightMin(), Game.HeightMax());
@@ -525,9 +538,35 @@ int uMod_GamePage::ReloadGame(void)
return LoadTemplateFromString(content);
}
int uMod_GamePage::SaveTemplate( const wxString &file_name)
int uMod_GamePage::GetTemplateFileName( const wxString &template_name, wxString &file_name)
{
if (template_name=="auto_save")
{
unsigned int hash = 0u;
int len = ExeName.Len();
unsigned char *str = (unsigned char*) ExeName.fn_str();
for (int i=0; i<len; i++)
{
hash = *str + (hash<< 6) + (hash << 16) - hash; // SDBM algorithm
}
file_name = "templates\\auto_save\\";
file_name << hash << "_" << GetPageName() << ".txt";
}
else
{
file_name = "templates\\";
file_name << template_name << ".txt";
}
return 0;
}
int uMod_GamePage::SaveTemplate( const wxString &template_name)
{
wxFile file;
wxString file_name;
GetTemplateFileName( template_name, file_name);
file.Open(file_name, wxFile::write);
if (!file.IsOpened())
@@ -569,21 +608,28 @@ int uMod_GamePage::SaveTemplateToString( wxString &content)
return 0;
}
int uMod_GamePage::LoadTemplate( const wxString &file_name)
int uMod_GamePage::LoadTemplate( const wxString &template_name)
{
LastError.Empty();
if (file_name.Len()==0) return -1;
if (template_name.Len()==0) return -1;
wxString file_name;
GetTemplateFileName( template_name, file_name);
wxFile file;
if (!file.Access(file_name, wxFile::read))
{
if (template_name == "auto_save") return 0;
LastError = Language->Error_FileOpen << "\n" << file_name;
return -1;
}
file.Open(file_name, wxFile::read);
if (!file.IsOpened())
{
if (template_name == "auto_save") return 0;
LastError = Language->Error_FileOpen << "\n" << file_name;
return -1;
}
@@ -614,7 +660,7 @@ int uMod_GamePage::LoadTemplate( const wxString &file_name)
if (int ret = LoadTemplateFromString(content)) return ret;
TemplateName = file_name;
TemplateName = template_name;
wxString path;
path = Language->TextCtrlTemplate;
path << TemplateName;
@@ -657,13 +703,22 @@ int uMod_GamePage::LoadTemplateFromString( const wxString &content_orig)
LastError << ViewModel->LastError;
}
LoadGameData(Game);
//if (Sender.Send( Game, GameOld, true)==0) GameOld = Game;
CollPane->Collapse( !Game.ShowCollPane());
if (LastError.IsEmpty())
{
return UpdateGame();
}
else return -1;
}
if (Game.ShowSingleTextureString())
int uMod_GamePage::LoadGameData(const uMod_GameInfo &game)
{
CollPane->Collapse( !game.ShowCollPane());
if (game.ShowSingleTextureString())
{
ShowSingleTextureString->SetValue(true);
FontColour->Enable();
@@ -673,16 +728,20 @@ int uMod_GamePage::LoadTemplateFromString( const wxString &content_orig)
ShowSingleTextureString->SetValue(false);
FontColour->Enable(false);
}
if (game.ShowSingleTexture())
ShowSingleTexture->SetValue(true);
else
ShowSingleTexture->SetValue(false);
KeyBack->SetKey(Game.GetKeyBack());
KeySave->SetKey(Game.GetKeySave());
KeyNext->SetKey(Game.GetKeyNext());
KeyBack->SetKey(game.GetKeyBack());
KeySave->SetKey(game.GetKeySave());
KeyNext->SetKey(game.GetKeyNext());
SpinWidth->SetValue( Game.WidthMin(), Game.WidthMax());
SpinHeight->SetValue( Game.HeightMin(), Game.HeightMax());
SpinDepth->SetValue( Game.DepthMin(), Game.DepthMax());
SpinWidth->SetValue( game.WidthMin(), game.WidthMax());
SpinHeight->SetValue( game.HeightMin(), game.HeightMax());
SpinDepth->SetValue( game.DepthMin(), game.DepthMax());
if (Game.UseSizeFilter())
if (game.UseSizeFilter())
{
UseSizeFilter->SetValue(true);
SpinWidth->Enable();
@@ -697,7 +756,7 @@ int uMod_GamePage::LoadTemplateFromString( const wxString &content_orig)
SpinDepth->Enable(false);
}
if (Game.UseFormatFilter())
if (game.UseFormatFilter())
{
UseFormatFilter->SetValue(true);
FormatFilter->Enable();
@@ -709,14 +768,14 @@ int uMod_GamePage::LoadTemplateFromString( const wxString &content_orig)
}
if (Game.GetSaveSingleTexture())
if (game.GetSaveSingleTexture())
{
SaveSingleTexture->SetValue( true);
SaveAllTextures->SetValue(false);
SingleTexturePanel->Enable();
AllTexturePanel->Disable();
}
else if (Game.GetSaveAllTextures())
else if (game.GetSaveAllTextures())
{
SaveSingleTexture->SetValue( false);
SaveAllTextures->SetValue( true);
@@ -731,11 +790,9 @@ int uMod_GamePage::LoadTemplateFromString( const wxString &content_orig)
AllTexturePanel->Enable();
}
FileFormats->SetValue(Game.FileFormat());
FileFormats->SetValue(game.FileFormat());
wxString path = Language->TextCtrlSavePath;
path << Game.GetSavePath();
SavePath->SetValue( path);
SavePath->SetValue( game.GetSavePath());
// The wxCollapsiblePane could be hide/shown thus we must manually layout and refresh the sizer and the window
@@ -745,11 +802,7 @@ int uMod_GamePage::LoadTemplateFromString( const wxString &content_orig)
// VieCtrl must repaint otherwise some graphical glitches ocure
ViewCtrl->Refresh();
if (LastError.IsEmpty())
{
return UpdateGame();
}
else return -1;
return 0;
}
void uMod_GamePage::OnCollPane(wxCollapsiblePaneEvent& WXUNUSED(event))
@@ -965,99 +1018,6 @@ void uMod_GamePage::OnButtonFormatFilter(wxCommandEvent& WXUNUSED(event))
temp << "D3DFMT_YUY2 (" << MAKEFOURCC('Y', 'U', 'Y', '2') << ")";
choices.Add(temp);
temp.Empty();
/*
choices.Add("D3DFMT_DXT1 (827611204)"); 31545844
choices.Add("D3DFMT_DXT2 (844388420)"); 32545844
choices.Add("D3DFMT_DXT3 (861165636"); 33545844
choices.Add("D3DFMT_DXT4 (877942852)"); 34545844
choices.Add("D3DFMT_DXT5 (894720068)"); 35545844
choices.Add("D3DFMT_G8R8_G8B8 (MAKEFOURCC('G', 'R', 'G', 'B')");
choices.Add("D3DFMT_MULTI2_ARGB8 (MAKEFOURCC('M','E','T','1')"); 31
choices.Add("D3DFMT_R8G8_B8G8 (MAKEFOURCC('R', 'G', 'B', 'G')");
choices.Add("D3DFMT_UYVY (MAKEFOURCC('U', 'Y', 'V', 'Y')");
choices.Add("D3DFMT_YUY2 (MAKEFOURCC('Y', 'U', 'Y', '2')");
*/
/*
choices.Add("R8G8B8");
choices.Add("A8R8G8B8");
choices.Add("X8R8G8B8");
choices.Add("R5G6B");
choices.Add("X1R5G5B5");
choices.Add("A1R5G5B5");
choices.Add("A4R4G4B4");
choices.Add("R3G3B2");
choices.Add("A8");
choices.Add("A8R3G3B2");
choices.Add("X4R4G4B4");
choices.Add("A2B10G10R10");
choices.Add("A8B8G8R8");
choices.Add("X8B8G8R8");
choices.Add("G16R16");
choices.Add("A2R10G10B10");
choices.Add("A16B16G16R16");
choices.Add("A8P8");
choices.Add("P8");
choices.Add("L8");
choices.Add("A8L8");
choices.Add("A4L4");
choices.Add("V8U8");
choices.Add("L6V5U5");
choices.Add("X8L8V8U8");
choices.Add("Q8W8V8U8");
choices.Add("V16U16");
choices.Add("A2W10V10U10");
choices.Add("UYVY");
choices.Add("R8G8_B8G8");
choices.Add("YUY2");
choices.Add("G8R8_G8B8");
choices.Add("DXT1");
choices.Add("DXT2");
choices.Add("DXT3");
choices.Add("DXT4");
choices.Add("DXT5");
choices.Add("D16_LOCKABLE");
choices.Add("D32");
choices.Add("D15S1");
choices.Add("D24S8");
choices.Add("D24X8");
choices.Add("D24X4S4");
choices.Add("D16");
choices.Add("D32F_LOCKABLE");
choices.Add("D24FS8");
choices.Add("D32_LOCKABLE");
choices.Add("S8_LOCKABLE");
choices.Add("L16");
choices.Add("VERTEXDATA");
choices.Add("INDEX16");
choices.Add("INDEX32");
choices.Add("Q16W16V16U16");
choices.Add("MULTI2_ARGB8");
choices.Add("R16F");
choices.Add("G16R16F");
choices.Add("A16B16G16R16F");
choices.Add("R32F");
choices.Add("G32R32F");
choices.Add("A32B32G32R32F");
choices.Add("CxV8U8");
choices.Add("A1");
choices.Add("A2B10G10R10_XR_BIAS");
choices.Add("BINARYBUFFER");
*/
wxArrayInt selections;
unsigned long selected = Game.FormatFilter();
@@ -1083,11 +1043,7 @@ void uMod_GamePage::OnButtonSavePath(wxCommandEvent& WXUNUSED(event))
if ( !dir.empty() )
{
Game.SetSavePath(dir);
wxString path;
path = Language->TextCtrlSavePath;
path << dir;
SavePath->SetValue( path);
SavePath->SetValue( dir);
}
}
@@ -1231,6 +1187,13 @@ void uMod_GamePage::OnContextMenu( wxDataViewEvent &event )
else if (node->GetParent() != (uMod_TreeViewNode*) 0 )
menu.Enable(ID_RemovePackage, false);
// the first page has no update or reload function (it is not connected to a game)
if (InjectionMethod == INVALID_GAME_PAGE)
{
menu.Enable(ID_Update, false);
menu.Enable(ID_Reload, false);
}
// if nothing is selected, we cannot deleted selected packages ;)
if (ViewCtrl->GetSelectedItemsCount()<=0)
menu.Enable(ID_RemoveSelectedPackages, false);
@@ -1301,25 +1264,46 @@ int uMod_GamePage::OpenPackage(void)
int uMod_GamePage::UpdateLanguage(void)
{
SetInfo();
wxString path;
path = Language->TextCtrlTemplate;
path << TemplateName;
TemplateFile->SetValue( path);
CollPane->SetLabel(Language->CollapseTextureCapture);
SaveSingleTexture->SetLabel( Language->CheckBoxSaveSingleTexture);
ShowSingleTextureString->SetLabel( Language->CheckBoxShowStringSaveSingleTexture);
ShowSingleTexture->SetLabel( Language->CheckBoxShowSingleTexture);
KeyBack->SetLabel( Language->KeyBack);
KeyBack->SetKeyLabel();
KeySave->SetLabel( Language->KeySave);
KeySave->SetKeyLabel();
KeyNext->SetLabel( Language->KeyNext);
KeyNext->SetKeyLabel();
FontColour->SetLabel( Language->FontColour);
TextureColour->SetLabel( Language->TextureColour);
SaveAllTextures->SetLabel( Language->CheckBoxSaveAllTextures);
UseSizeFilter->SetLabel( Language->CheckBoxUseSizeFilter);
SpinWidth->SetLabel( Language->WidthSpin);
SpinHeight->SetLabel( Language->HeightSpin);
SpinDepth->SetLabel( Language->DepthSpin);
SaveAllTextures->SetLabel( Language->CheckBoxSaveAllTextures);
wxString temp = Language->TextCtrlSavePath;
temp << Game.GetSavePath();
SavePath->SetValue( temp);
UseFormatFilter->SetLabel( Language->CheckBoxUseFormatFilter);
FormatFilter->SetLabel( Language->SetFormatFilter);
SavePathButton->SetLabel( Language->ButtonDirectory);
SavePath->SetValue( Game.GetSavePath());
ViewCtrl->GetColumn(0)->SetTitle(Language->Title);
ViewCtrl->GetColumn(3)->SetTitle(Language->Author);
ViewCtrl->GetColumn(4)->SetTitle(Language->Comment);
return 0;
}
+9
View File
@@ -37,6 +37,7 @@ public:
int LoadTemplate( const wxString &file_name);
int LoadTemplateFromString( const wxString &content);
int LoadGameData(const uMod_GameInfo &game);
wxString GetExeName(void) {return ExeName;}
wxString GetTemplateName(void) {return TemplateName;}
@@ -172,6 +173,13 @@ private:
*/
int GetSettings(void);
/**
* returns the file name to a given template name
* @param template_name
* @param file_name
* @return 0 on success
*/
int GetTemplateFileName( const wxString &template_name, wxString &file_name);
wxString ExeName;
wxString TemplateName;
@@ -191,6 +199,7 @@ private:
wxBoxSizer *SingleTextureSizer;
wxCheckBox *SaveSingleTexture;
wxCheckBox *ShowSingleTextureString;
wxCheckBox *ShowSingleTexture;
uMod_KeyPanel *KeyBack;
+18 -5
View File
@@ -20,7 +20,7 @@ along with Universal Modding Engine. If not, see <http://www.gnu.org/licenses/>
#include "uMod_Main.h"
uMod_Language *Language = NULL;
uMod_Language *Language = (uMod_Language*)0;
uMod_Language::uMod_Language(void)
{
@@ -217,11 +217,16 @@ int uMod_Language::LoadLanguage(const wxString &name)
CheckEntry( command, msg, CollapseTextureCapture)
CheckEntry( command, msg, CheckBoxSaveSingleTexture)
CheckEntry( command, msg, CheckBoxShowStringSaveSingleTexture)
CheckEntry( command, msg, CheckBoxShowSingleTexture)
CheckEntry( command, msg, CheckBoxSaveAllTextures)
CheckEntry( command, msg, TextCtrlSavePath)
CheckEntry( command, msg, SelectLanguage)
CheckEntry( command, msg, StartGame)
CheckEntry( command, msg, CommandLine)
CheckEntry( command, msg, ChooseTemplate)
CheckEntry( command, msg, OpenTemplate)
CheckEntry( command, msg, SaveTemplate)
CheckEntry( command, msg, DefaultTemplate)
CheckEntry( command, msg, AutoSaveTemplate)
CheckEntry( command, msg, ChooseGame)
CheckEntry( command, msg, DeleteGame)
CheckEntry( command, msg, GameAlreadyAdded)
@@ -250,6 +255,7 @@ int uMod_Language::LoadLanguage(const wxString &name)
CheckEntry( command, msg, Error_Hash)
CheckEntry( command, msg, Error_FileOpen)
CheckEntry( command, msg, Error_FileRead)
CheckEntry( command, msg, Error_NoTemplates)
CheckEntry( command, msg, Error_Memory)
CheckEntry( command, msg, Error_Unzip)
CheckEntry( command, msg, Error_ZipEntry)
@@ -278,8 +284,8 @@ int uMod_Language::LoadDefault(void)
CurrentLanguage="English";
MenuLanguage = "Change language";
MenuHelp = "Help";
MenuAbout = "About";
MenuHelp = "Help";
MenuAbout = "About";
MenuAcknowledgement = "Acknowledgement";
MenuStartGame = "Start game through uMod";
@@ -321,14 +327,20 @@ int uMod_Language::LoadDefault(void)
CollapseTextureCapture = "Capture textures";
CheckBoxSaveSingleTexture = "Save single texture";
CheckBoxShowStringSaveSingleTexture = "Show message in the upper left corner";
CheckBoxShowSingleTexture = "Show texture in the upper left corner";
CheckBoxSaveAllTextures = "Save all textures";
TextCtrlSavePath = "Save path:";
SelectLanguage = "Select a language.";
StartGame = "Select the game to start.";
CommandLine = "Set command line arguments.";
ChooseTemplate = "Chose a template";
OpenTemplate = "Open template";
SaveTemplate = "Save template";
DefaultTemplate = "Set default template";
AutoSaveTemplate = "auto save";
ChooseGame = "Select a game binary.";
DeleteGame = "Select the games to be deleted.";
GameAlreadyAdded = "Game has been already added.";
@@ -360,6 +372,7 @@ int uMod_Language::LoadDefault(void)
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_NoTemplates = "No templates available.";
Error_Memory = "Could not allocate enough memory.";
Error_Unzip = "Could not unzip.";
Error_ZipEntry = "Could not find zip entry.";
+8 -1
View File
@@ -74,14 +74,20 @@ public:
wxString CollapseTextureCapture;
wxString CheckBoxSaveSingleTexture;
wxString CheckBoxShowStringSaveSingleTexture;
wxString CheckBoxShowSingleTexture;
wxString CheckBoxSaveAllTextures;
wxString TextCtrlSavePath;
wxString SelectLanguage;
wxString StartGame;
wxString CommandLine;
wxString ChooseTemplate;
wxString OpenTemplate;
wxString SaveTemplate;
wxString DefaultTemplate;
wxString AutoSaveTemplate;
wxString ChooseGame;
wxString DeleteGame;
wxString GameAlreadyAdded;
@@ -113,6 +119,7 @@ public:
wxString Error_Hash;
wxString Error_FileOpen;
wxString Error_FileRead;
wxString Error_NoTemplates;
wxString Error_Memory;
wxString Error_Unzip;
wxString Error_ZipEntry;
+5 -1
View File
@@ -116,6 +116,11 @@ public:
* @param label
*/
void SetLabel(const wxString &label);
/**
* Set the label for the key.
*/
void SetKeyLabel();
private:
/**
@@ -124,7 +129,6 @@ private:
*/
void OnButton(wxCommandEvent& event);
void SetKeyLabel();
wxButton *Button;
wxTextCtrl *KeyText;
+11 -8
View File
@@ -96,15 +96,18 @@ int uMod_Sender::Send( const uMod_GameInfo &game, const uMod_GameInfo &game_old,
}
SendBool( game.ShowSingleTextureString(), CONTROL_SHOW_STRING);
SendBool( game.ShowSingleTexture(), CONTROL_SHOW_TEXTURE);
SendBool( game.GetSaveSingleTexture(), CONTROL_SAVE_SINGLE);
SendBool(game.GetSaveAllTextures(), CONTROL_SAVE_ALL);
SendBool( game.GetSaveAllTextures(), CONTROL_SAVE_ALL);
SendBool(game.SupportTPF(), CONTROL_SUPPORT_TPF);
SendPath(game.GetSavePath());
/*
wxString path;
path = game.GetSavePath();
if (path!=game_old.GetSavePath()) SendPath(path);
*/
@@ -304,16 +307,16 @@ int uMod_Sender::SendPath( const wxString &path)
msg->Hash = 0u;
msg->Control = CONTROL_SET_DIR;
int len = path.Len();
if ((len+1)*sizeof(wchar_t) + sizeof(MsgStruct) >= BIG_BUFSIZE) return -1;
const wchar_t *file = path.wc_str();
wchar_t *buff_file = (wchar_t*) &Buffer[sizeof(MsgStruct)];
int len = 0;
while (file[len] && (sizeof(MsgStruct)+len*sizeof(wchar_t))<BIG_BUFSIZE) {buff_file[len] = file[len]; len++;};
if ((sizeof(MsgStruct)+len*sizeof(wchar_t))<BIG_BUFSIZE) buff_file[len] = 0;
len++;
for (int i=0; i<len; i++) {buff_file[i] = file[i];}
buff_file[len] = 0;
msg->Value = len*sizeof(wchar_t);
return SendToGame( Buffer, sizeof(MsgStruct)+len*sizeof(wchar_t));
msg->Value = (len+1)*sizeof(wchar_t);
return SendToGame( Buffer, sizeof(MsgStruct)+(len+1)*sizeof(wchar_t));
}
-19
View File
@@ -237,26 +237,7 @@ int uMod_TreeViewModel::AddPackages(const wxArrayString &files)
uMod_File file;
wxDataViewItemArray added_items;
wxDataViewItemArray added_single_items;
/*
bool single_file = false;
// detect if there are more than one single file
for (unsigned int i=0; i<files.GetCount(); i++)
{
file.SetFile( files[i]);
if (file.SingleFile()) {single_file = true;
}
*/
/*
if (single_files>1)
{
uMod_ModElement *element = new uMod_ModElement(uMod_ModElement::Group, uMod_ModElement::NONE);
element->Title() = Language->MultipleSingleFiles;
single_file_node = new uMod_TreeViewNode( (uMod_TreeViewNode*)0, element);
element->Release();
}
*/
for (unsigned int i=0; i<files.GetCount(); i++)
{