WoWs depack
World of Warships resource files unpacker
|
Open-Source World of Warships resource files unpacker.
Interesting links:
Packages are available for most major distributions in this repository.
Follow the instructions to setup the repository and install the following packages:
shell
apt install git cmake zlib1g-dev libpcre2-dev clang
git clone https://github.com/kakwa/wows-depack.git cd wows-depack/
cmake . make
shell ./wows-depack-cli –help
Usage: wows-depack-cli [OPTION...] -W WOWS_BASE_DIR
World of Warships resource extractor tool. [...]
shell ./wows-depack-cli -W ~/Games/World\ of\ Warships/ -p
/gui/modernization_icons/icon_modernization_PCM020_DamageControl_Mod_I.png /gui/modernization_icons/icon_modernization_PCM047_Special_Mod_I_Montana.png [...] /clanbase/headquarters_2/6/29/31.png /server_stats.xml
shell ./wows-depack-cli -W ~/Games/World\ of\ Warships/ -s '.*[Pp]arams.*'
Found 3 matching files: shipyardParams.xml content/GameParams.data content/UIParams.data
shell ./wows-depack-cli -W ~/Games/World\ of\ Warships/ \ -e 'content/GameParams.data' -o GameParams.data
shell ./wows-depack-cli -W ~/Games/World\ of\ Warships/ \ -e 'content/' -O out/
shell ./wows-depack-cli -W ~/Games/World\ of\ Warships/ \ -e '/' -O out/
shell ./wows-depack-cli -i ~/Games/World\ of\ Warships/bin/6831266/idx/system_data.idx -p
shell ./wows-depack-cli -I ~/Games/World\ of\ Warships/bin/6831266/idx/ -p
C #include "wows-depack.h"
/* Other debug categories */ // WOWS_DEBUG_RAW_RECORD // WOWS_DEBUG_FILE_LISTING /* several debug categories can be enabled like so: */ // WOWS_DEBUG_FILE_LISTING | WOWS_DEBUG_RAW_RECORD;
WOWS_CONTEXT *context = wows_init_context(WOWS_NO_DEBUG);
/* Parse the index file */ int ret = wows_parse_index(index_file_path, context);
C char *index_file_path = "Games/World of Warships/bin/6831266/idx/system_data.idx"
/* Parse the index file */ int ret = wows_parse_index(index_file_path, context);
C // Note: the '6831266' directory changes every updates char *index_dir_path = "Games/World of Warships/bin/6831266/idx"
/* Parse the index file */ int ret = wows_parse_index_dir(index_dir_path, context);
C char *index_dir_path;
get_latest_idx_dir("Games/World of Warships/", index_dir_path);
/* Parse the index file */ int ret = wows_parse_index_dir(index_dir_path, context);
// [...] do stuff
// You need to free index_dir_path after free(index_dir_path);
C // Init output variables int resc; char **res_files;
/* Supported search modes: WOWS_SEARCH_FILE_ONLY < Search only on file names. WOWS_SEARCH_DIR_ONLY < Search only on directory names. WOWS_SEARCH_FILE_PLUS_DIR < Search on directory and file names. WOWS_SEARCH_FULL_PATH < Search on the full path of files. */
// PCRE search pattern, please note that the final regex is "^<search_pattern>$" char search_pattern = ".*Params.</em>";
// Search the files wows_search(context, search_pattern, WOWS_SEARCH_FILE_ONLY, &resc, &res_files);
// Print and free the result printf("Found %d matching files:\n", resc); for (int i = 0; i < resc; i++) { printf("%s\n", res_files[i]); // Free Each file path must be freed free(res_files[i]); } // Free the array containing these paths free(res_files);
C char *output = "path/output.xml"
// Extract to output file ret = wows_extract_file(context, "stuff.xml", output);
C char *buf = NULL; size_t buf_size = 0;
// Open the file FILE *f = open_memstream(&buf, &buf_size);
// Extract to File * ret = wows_extract_file_fp(context, "stuff.xml", f);
// Close the file fclose(f);
free(buff);
C char *output_dir = "./out/"
ret = wows_extract_dir(context, "/wows-resources/dockyard/", output_dir);
C wows_free_context(context);
C // wows_* function call example int ret = wows_parse_index(index_file_path, context);
/* Error handling */ if (ret != 0) { /* get an error message + additional info from context + return code */ char *err_msg = wows_error_string(ret, context); printf("Error: %s\n", err_msg); // the message must be freed free(err_msg); }
C // Print a tree like layout wows_print_tree(context);
// Print the full path of each file, one per line wows_print_flat(context);
C char *input_dir = "./tests"; FILE *nfd_pkg = fopen("stuff.pkg", "w+"); FILE *nfd_idx = fopen("stuff.idx", "w+"); wows_write_pkg(context, input_dir, "stuff.pkg", nfd_pkg, nfd_idx); fclose(nfd_idx); fclose(nfd_pkg);
shell apt install cmake zlib1g-dev libpcre3-dev clang
shell apt install lcov libcunit1-dev doxygen
shell cmake . make
shell
make install DESTDIR=fakeroot
shell tree fakeroot fakeroot └── usr └── local ├── bin │ └── wows-depack-cli ├── include │ └── wows-depack.h └── lib ├── libwows-depack.so -> libwows-depack.so.0 ├── libwows-depack.so.0 -> libwows-depack.so.0.1.0 └── libwows-depack.so.0.1.0
shell
cmake -DCOVERAGE=ON -DBUILD_TESTS=ON .
make tests
make coverage
shell
./wows-depack-test
gdb –args ./wows-depack-test
shell cmake -DBUILD_DOC=ON .
make doc_doxygen
shell ./misc/setup_doxycss.sh
make doc_doxygen
shell
apt install afl-clang
brew install afl-fuzz
shell cmake -DCMAKE_CXX_COMPILER=afl-clang++ -DCMAKE_C_COMPILER=afl-clang . make
shell
INDEX_DIR="~/Games/World\ of\ Warships/bin/6775398/idx/"
afl-fuzz -i "$INDEX_DIR" -o ./out -t 10000 – ./wows-depack-cli -i '@' ```
Then wait for crashes to occur (hopefully this will be in vain).