Compare commits

...

5 Commits

Author SHA1 Message Date
DubbleClick edd937f4c7 release 1.8.0.2 2026-04-15 22:29:18 +07:00
DubbleClick e1900cd342 fix edge case in tpf unscrambling logic 2026-04-15 22:22:32 +07:00
Marc 313c7390ca Increment version tweak to 1.8.0.1 2026-01-09 14:00:26 +01:00
Marc ab1a3a19e1 might have 0X instead of 0x (#36) 2026-01-09 13:53:52 +01:00
Marc 4fa1d8e2c5 1.8.0 (#35)
* 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
2026-01-09 00:43:28 +01:00
7 changed files with 25 additions and 18 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)
@@ -10,9 +10,9 @@ if(NOT(CMAKE_SIZEOF_VOID_P EQUAL 4))
endif()
set(VERSION_MAJOR 1)
set(VERSION_MINOR 7)
set(VERSION_MINOR 8)
set(VERSION_PATCH 0)
set(VERSION_TWEAK 3)
set(VERSION_TWEAK 2)
set(VERSION_RC "${CMAKE_CURRENT_BINARY_DIR}/version.rc")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in" "${VERSION_RC}" @ONLY)
+4 -3
View File
@@ -14,7 +14,7 @@ export struct TexEntry {
namespace {
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"(0[xX][0-9a-fA-F]{4,16})", std::regex::optimize);
std::smatch match;
if (!std::regex_search(filename, match, re)) {
return 0;
@@ -117,13 +117,14 @@ void ParseSimpleArchive(const libzippp::ZipArchive& archive, std::vector<TexEntr
for (const auto& entry : archive.getEntries()) {
if (!entry.isFile())
continue;
const auto crc_hash = GetCrcFromFilename(entry.getName());
const auto entry_name = entry.getName();
const auto crc_hash = GetCrcFromFilename(entry_name);
if (!crc_hash)
continue;
const auto data_ptr = static_cast<uint8_t*>(entry.readAsBinary());
const auto size = entry.getSize();
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());
delete[] data_ptr;
}
+1 -1
View File
@@ -46,7 +46,7 @@ private:
[[nodiscard]] char XOR(const char b, const long position) const
{
if (position > line_length - 4) {
if (position >= (line_length / 4) * 4) {
return b ^ TPF_XOREven;
}
+4 -4
View File
@@ -37,20 +37,20 @@ struct TextureFileStruct {
inline void Message([[maybe_unused]] const char* format, ...)
{
#ifdef _DEBUG
#if 0
//const HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
//[[maybe_unused]] const auto success = SetConsoleTextAttribute(hConsole, 0); // white
va_list args;
va_start(args, format);
vprintf(format, args);
va_end(args);
#endif
#endif
}
inline void Info([[maybe_unused]] const char* format, ...)
{
#ifdef _DEBUG
const HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
[[maybe_unused]] const auto success = SetConsoleTextAttribute(hConsole, 0); // white
//const HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
//[[maybe_unused]] const auto success = SetConsoleTextAttribute(hConsole, 0); // white
va_list args;
va_start(args, format);
vprintf(format, args);
+8 -3
View File
@@ -14,7 +14,7 @@ namespace {
bool use_64_bit_crc = false;
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"(0[xX][0-9a-fA-F]{4,16})", std::regex::optimize);
std::smatch match;
if (!std::regex_search(filename, match, re)) {
return 0;
@@ -124,9 +124,12 @@ void ParseSimpleArchive(const libzippp::ZipArchive& archive, std::vector<TexEntr
for (const auto& entry : archive.getEntries()) {
if (!entry.isFile())
continue;
const auto entry_name = entry.getName();
const auto crc_hash = GetCrcFromFilename(entry.getName());
if (!crc_hash)
if (!crc_hash) {
Warning("Entry with name %s could not be parsed", entry_name.c_str());
continue;
}
const auto data_ptr = static_cast<BYTE*>(entry.readAsBinary());
const auto size = entry.getSize();
std::vector vec(data_ptr, data_ptr + size);
@@ -143,8 +146,10 @@ void ParseTexmodArchive(std::vector<std::string>& lines, libzippp::ZipArchive& a
// match[1] | match[2]
const static auto address_file_regex = std::regex(R"(^[\\/.]*([^|]+)\|([^\r\n]+))", std::regex::optimize);
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;
}
const auto address_string = match[1].str();
const auto file_path = match[2].str();
+1 -1
View File
@@ -46,7 +46,7 @@ private:
[[nodiscard]] char XOR(const char b, const long position) const
{
if (position > line_length - 4) {
if (position >= (line_length / 4) * 4) {
return b ^ TPF_XOREven;
}
+4 -3
View File
@@ -167,7 +167,8 @@ std::vector<gsl::owner<TextureFileStruct*>> ProcessModfile(const std::filesystem
{
const auto hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
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 entries = file_loader.GetContents();
if (entries.empty()) {
@@ -238,7 +239,7 @@ void TextureClient::LoadModsFromModlist(std::pair<std::string, std::string> modf
}
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()
@@ -319,7 +320,7 @@ int TextureClient::RemoveTexture(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;
if (pTexture->CrossRef_D3Dtex != nullptr)