v1.7.0.3 (#34)

* change tpfconvert functionality to backup into backup folder

* use vcpkg for more packages

* update readme, bump to 1.7.0.2

* rework dll path

* https://github.com/gwdevhub/gMod/issues/33

* v1.7.0.3
This commit is contained in:
Marc
2025-07-20 22:08:50 +07:00
committed by GitHub
parent 326b7086c9
commit b060e25ee2
5 changed files with 17 additions and 11 deletions
+8 -5
View File
@@ -154,16 +154,16 @@ int TextureClient::UnlockMutex()
return RETURN_OK;
}
gsl::owner<TextureFileStruct*> AddFile(TexEntry& entry, const bool compress, const std::filesystem::path& dll_path)
gsl::owner<TextureFileStruct*> AddFile(TexEntry& entry, const bool compress)
{
const auto texture_file_struct = new TextureFileStruct();
texture_file_struct->crc_hash = entry.crc_hash;
const auto dds_blob = TextureFunction::ConvertToCompressedDDS(entry, compress, dll_path);
const auto dds_blob = TextureFunction::ConvertToCompressedDDS(entry, compress);
texture_file_struct->data.assign(static_cast<BYTE*>(dds_blob.GetBufferPointer()), static_cast<BYTE*>(dds_blob.GetBufferPointer()) + dds_blob.GetBufferSize());
return texture_file_struct;
}
std::vector<gsl::owner<TextureFileStruct*>> ProcessModfile(const std::filesystem::path& modfile, const std::filesystem::path& dll_path, const bool compress)
std::vector<gsl::owner<TextureFileStruct*>> ProcessModfile(const std::filesystem::path& modfile, const bool compress)
{
const auto hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
if (FAILED(hr)) return {};
@@ -179,7 +179,7 @@ std::vector<gsl::owner<TextureFileStruct*>> ProcessModfile(const std::filesystem
texture_file_structs.reserve(entries.size());
unsigned file_bytes_loaded = 0;
for (auto& tpf_entry : entries) {
const auto tex_file_struct = AddFile(tpf_entry, compress, dll_path);
const auto tex_file_struct = AddFile(tpf_entry, compress);
texture_file_structs.push_back(tex_file_struct);
file_bytes_loaded += texture_file_structs.back()->data.size();
}
@@ -198,6 +198,9 @@ void TextureClient::LoadModsFromModlist(std::pair<std::string, std::string> modf
std::string line;
std::vector<std::filesystem::path> modfiles;
while (std::getline(file, line)) {
if (line.starts_with("//") || line.starts_with("#") || line.empty()) {
continue;
}
// Remove newline character
line.erase(std::ranges::remove(line, '\r').begin(), line.end());
line.erase(std::ranges::remove(line, '\n').begin(), line.end());
@@ -218,7 +221,7 @@ void TextureClient::LoadModsFromModlist(std::pair<std::string, std::string> modf
}
std::vector<std::future<std::vector<gsl::owner<TextureFileStruct*>>>> futures;
for (const auto modfile : modfiles) {
futures.emplace_back(std::async(std::launch::async, ProcessModfile, modfile, dll_path, files_size > 400'000'000));
futures.emplace_back(std::async(std::launch::async, ProcessModfile, modfile, files_size > 400'000'000));
}
auto loaded_size = 0u;
for (auto& future : futures) {