// // Created by Иван_Архипов on 30.10.2017. // #define _CRT_SECURE_NO_WARNINGS #include #include #include "LotroDatPatcher.h" using namespace LOTRO_DAT; int main() { std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::string path = "E:\\SteamLibrary\\steamapps\\common\\Lord of the Rings Online\\"; std::string filename = "client_local_English.dat"; std::string output_dir = std::string("Data (") + filename + std::string(")\\"); std::string txt_dir = "txt\\"; std::string jpg_dir = "jpg\\"; std::string dds_dir = "dds\\"; std::string wav_dir = "wav\\"; std::string ogg_dir = "ogg\\"; std::string font_dir = "font\\"; std::string unk_dir = "unk\\"; int txt_all = 0, txt_suc = 0; int jpg_all = 0, jpg_suc = 0; int dds_all = 0, dds_suc = 0; int wav_all = 0, wav_suc = 0; int ogg_all = 0, ogg_suc = 0; int font_all = 0, font_suc = 0; int unk_all = 0, unk_suc = 0; CreateDirectory(output_dir.c_str(), nullptr); CreateDirectory((output_dir + txt_dir).c_str(), nullptr); CreateDirectory((output_dir + jpg_dir).c_str(), nullptr); CreateDirectory((output_dir + dds_dir).c_str(), nullptr); CreateDirectory((output_dir + wav_dir).c_str(), nullptr); CreateDirectory((output_dir + ogg_dir).c_str(), nullptr); CreateDirectory((output_dir + font_dir).c_str(), nullptr); CreateDirectory((output_dir + unk_dir).c_str(), nullptr); std::cerr << "Starting search...\n"; DatFile a(path + filename); std::cerr << "Total files found: " << a.dictionary().size() << std::endl; std::cerr << "Writing unordered dictionary:\n"; FILE *f; fopen_s(&f, (output_dir + "dict.txt").c_str(), "w"); fprintf(f, "file_id | offset | extension\n"); for (auto i : a.dictionary()) { std::string extension = "unk"; EXTENSION ext = i.second->ext(); if (ext == TXT) extension = "txt"; if (ext == JPG) extension = "jpg"; if (ext == DDS) extension = "dds"; if (ext == WAV) extension = "wav"; if (ext == OGG) extension = "ogg"; if (ext == FONT) extension = "font"; fprintf(f, "%lld %lld %s\n", i.second->file_id(), i.second->file_offset(), extension.c_str()); } fclose(f); std::cerr << "Beginning unpacking...\n"; long long all = a.dictionary().size(); long long counter = 0; for (auto i : a.dictionary()) { EXTENSION ext = i.second->ext(); if (ext == TXT) { txt_all++; //txt_suc += i.second->ExportFile((output_dir + txt_dir + std::to_string(i.second->file_id())).c_str()); } if (ext == JPG) { jpg_all++; jpg_suc += i.second->ExportFile((output_dir + jpg_dir + std::to_string(i.second->file_id())).c_str()); } if (ext == DDS) { dds_all++; dds_suc += i.second->ExportFile((output_dir + dds_dir + std::to_string(i.second->file_id())).c_str()); } if (ext == WAV) { wav_all++; wav_suc += i.second->ExportFile((output_dir + wav_dir + std::to_string(i.second->file_id())).c_str()); } if (ext == OGG) { ogg_all++; ogg_suc += i.second->ExportFile((output_dir + ogg_dir + std::to_string(i.second->file_id())).c_str()); } if (ext == FONT) { font_all++; //font_suc += i.second->ExportFile((output_dir + font_dir + std::to_string(i.second->file_id())).c_str()); } if (ext == UNKNOWN) { //cout << " - unk\n"; unk_all++; //unk_suc += i.second->ExportFile((output_dir + unk_dir + std::to_string(i.second->file_id())).c_str()); } counter++; if ((counter - 1) * 100ll / all != counter * 100ll / all) { fprintf(stderr, "Done: %lld%%\n", counter * 100ll / all); } } std::cerr << "Total found:" << std::endl; std::cerr << "Txt: " << txt_all << std::endl << "JPG: " << jpg_all << std::endl << "DDS: " << dds_all << std::endl << "WAV: " << wav_all << std::endl << "OGG: " << ogg_all << std::endl << "Fonts " << font_all << std::endl << "Unknown: " << unk_all << std::endl; std::cerr << "Total exported:" << std::endl; std::cerr << "Txt: " << txt_suc << std::endl << "JPG: " << jpg_suc << std::endl << "DDS: " << dds_suc << std::endl << "WAV: " << wav_suc << std::endl << "OGG: " << ogg_suc << std::endl << "Fonts " << font_suc << std::endl << "Unknown: " << unk_suc << std::endl; std::cerr << "Success. Press enter to close"; system("pause"); return 0; }