* 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

* debug mode enabled

* fix... something... somehow??? @STL can you explain this???

* safety

* 1.8.0.0
This commit is contained in:
Marc
2026-01-09 00:43:28 +01:00
committed by GitHub
parent b060e25ee2
commit 4fa1d8e2c5
5 changed files with 19 additions and 15 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.29) cmake_minimum_required(VERSION 3.29)
set(CMAKE_GENERATOR_PLATFORM win32) set(CMAKE_GENERATOR_PLATFORM win32)
@@ -10,9 +10,9 @@ if(NOT(CMAKE_SIZEOF_VOID_P EQUAL 4))
endif() endif()
set(VERSION_MAJOR 1) set(VERSION_MAJOR 1)
set(VERSION_MINOR 7) set(VERSION_MINOR 8)
set(VERSION_PATCH 0) set(VERSION_PATCH 0)
set(VERSION_TWEAK 3) set(VERSION_TWEAK 0)
set(VERSION_RC "${CMAKE_CURRENT_BINARY_DIR}/version.rc") set(VERSION_RC "${CMAKE_CURRENT_BINARY_DIR}/version.rc")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in" "${VERSION_RC}" @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in" "${VERSION_RC}" @ONLY)
+4 -3
View File
@@ -14,7 +14,7 @@ export struct TexEntry {
namespace { namespace {
HashType GetCrcFromFilename(const std::string& filename) { HashType GetCrcFromFilename(const std::string& filename) {
const static std::regex re(R"(0x[0-9a-f]{4,16})", std::regex::optimize | std::regex::icase); const static std::regex re(R"(0x[0-9a-fA-F]{4,16})", std::regex::optimize);
std::smatch match; std::smatch match;
if (!std::regex_search(filename, match, re)) { if (!std::regex_search(filename, match, re)) {
return 0; return 0;
@@ -117,13 +117,14 @@ void ParseSimpleArchive(const libzippp::ZipArchive& archive, std::vector<TexEntr
for (const auto& entry : archive.getEntries()) { for (const auto& entry : archive.getEntries()) {
if (!entry.isFile()) if (!entry.isFile())
continue; continue;
const auto crc_hash = GetCrcFromFilename(entry.getName()); const auto entry_name = entry.getName();
const auto crc_hash = GetCrcFromFilename(entry_name);
if (!crc_hash) if (!crc_hash)
continue; continue;
const auto data_ptr = static_cast<uint8_t*>(entry.readAsBinary()); const auto data_ptr = static_cast<uint8_t*>(entry.readAsBinary());
const auto size = entry.getSize(); const auto size = entry.getSize();
std::vector vec(data_ptr, data_ptr + size); std::vector vec(data_ptr, data_ptr + size);
std::filesystem::path tex_name(entry.getName()); std::filesystem::path tex_name(entry_name);
entries.emplace_back(std::move(vec), crc_hash, tex_name.extension().string()); entries.emplace_back(std::move(vec), crc_hash, tex_name.extension().string());
delete[] data_ptr; delete[] data_ptr;
} }
+4 -4
View File
@@ -37,20 +37,20 @@ struct TextureFileStruct {
inline void Message([[maybe_unused]] const char* format, ...) inline void Message([[maybe_unused]] const char* format, ...)
{ {
#ifdef _DEBUG #ifdef _DEBUG
#if 0 //const HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
//[[maybe_unused]] const auto success = SetConsoleTextAttribute(hConsole, 0); // white
va_list args; va_list args;
va_start(args, format); va_start(args, format);
vprintf(format, args); vprintf(format, args);
va_end(args); va_end(args);
#endif #endif
#endif
} }
inline void Info([[maybe_unused]] const char* format, ...) inline void Info([[maybe_unused]] const char* format, ...)
{ {
#ifdef _DEBUG #ifdef _DEBUG
const HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); //const HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
[[maybe_unused]] const auto success = SetConsoleTextAttribute(hConsole, 0); // white //[[maybe_unused]] const auto success = SetConsoleTextAttribute(hConsole, 0); // white
va_list args; va_list args;
va_start(args, format); va_start(args, format);
vprintf(format, args); vprintf(format, args);
+4 -2
View File
@@ -14,7 +14,7 @@ namespace {
bool use_64_bit_crc = false; bool use_64_bit_crc = false;
HashType GetCrcFromFilename(const std::string& filename) { HashType GetCrcFromFilename(const std::string& filename) {
const static std::regex re(R"(0x[0-9a-f]{4,16})", std::regex::optimize | std::regex::icase); const static std::regex re(R"(0x[0-9a-fA-F]{4,16})", std::regex::optimize);
std::smatch match; std::smatch match;
if (!std::regex_search(filename, match, re)) { if (!std::regex_search(filename, match, re)) {
return 0; return 0;
@@ -143,8 +143,10 @@ void ParseTexmodArchive(std::vector<std::string>& lines, libzippp::ZipArchive& a
// match[1] | match[2] // match[1] | match[2]
const static auto address_file_regex = std::regex(R"(^[\\/.]*([^|]+)\|([^\r\n]+))", std::regex::optimize); const static auto address_file_regex = std::regex(R"(^[\\/.]*([^|]+)\|([^\r\n]+))", std::regex::optimize);
std::smatch match; std::smatch match;
if (!std::regex_search(line, match, address_file_regex)) if (!std::regex_search(line, match, address_file_regex)) {
Warning("Failed to parse texmod.def archive line: %s - %s", line.c_str(), line.c_str());
continue; continue;
}
const auto address_string = match[1].str(); const auto address_string = match[1].str();
const auto file_path = match[2].str(); const auto file_path = match[2].str();
+4 -3
View File
@@ -167,7 +167,8 @@ std::vector<gsl::owner<TextureFileStruct*>> ProcessModfile(const std::filesystem
{ {
const auto hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); const auto hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
if (FAILED(hr)) return {}; if (FAILED(hr)) return {};
Message("Initialize: loading file %s... ", modfile.c_str()); const auto modfile_str = modfile.string();
Message("Initialize: loading file %s... ", modfile_str.c_str());
auto file_loader = ModfileLoader(modfile); auto file_loader = ModfileLoader(modfile);
auto entries = file_loader.GetContents(); auto entries = file_loader.GetContents();
if (entries.empty()) { if (entries.empty()) {
@@ -238,7 +239,7 @@ void TextureClient::LoadModsFromModlist(std::pair<std::string, std::string> modf
} }
should_update = true; should_update = true;
} }
Message("Finished loading mods from %s: Loaded %u bytes (%u mb)", modfile_tuple.first.c_str(), loaded_size, loaded_size / 1024 / 1024); Message("Finished loading mods from %s: Loaded %u bytes (%u mb)\n", modfile_tuple.first.c_str(), loaded_size, loaded_size / 1024 / 1024);
} }
void TextureClient::Initialize() void TextureClient::Initialize()
@@ -319,7 +320,7 @@ int TextureClient::RemoveTexture(uModTexturePtr auto pTexture)
int TextureClient::LookUpToMod(uModTexturePtr auto pTexture) int TextureClient::LookUpToMod(uModTexturePtr auto pTexture)
{ {
Message("TextureClient::LookUpToMod( %p): hash: %#lX, %p\n", pTexture, pTexture->Hash, this); Message("TextureClient::LookUpToMod( %p): hash: %#lX\n", pTexture, pTexture->Hash);
int ret = RETURN_OK; int ret = RETURN_OK;
if (pTexture->CrossRef_D3Dtex != nullptr) if (pTexture->CrossRef_D3Dtex != nullptr)