mirror of
https://github.com/gwdevhub/gMod.git
synced 2026-07-21 01:49:31 +00:00
fd9d1af477
* use image.OverrideFormat() * 1.6.4 * import std * uninitialised member variable * debug statement for 64 bit hash testing * nopetynope * uint32_t * support for 64 bit hashes, but rip compute time :/ * refactor weird comments and constructors * 1.7.0.0 because of 64 bit hashes * only check crc64 if at least one mod with crc64 is loaded * do some dumb shit to deal with incorrect bmps somehow (needs work) * remove image interpretation for bmps * create TpfConvert.exe to convert tpf files easily * attempt * set up vcpkg and install d3dx though that * missing env variable? * Win32 architecture * update ci to tag TpfConvert.exe and d3dx9.dll as well (required to run TpfConvert) * documentation
72 lines
1.5 KiB
C++
72 lines
1.5 KiB
C++
#pragma once
|
|
|
|
//using HashType = DWORD32;
|
|
using HashType = DWORD64;
|
|
|
|
struct HashTuple {
|
|
HashType crc32;
|
|
HashType crc64;
|
|
|
|
bool operator==(const HashTuple& other) const noexcept
|
|
{
|
|
return (other.crc32 == crc32) || (other.crc64 == crc64);
|
|
}
|
|
|
|
explicit operator bool() const noexcept
|
|
{
|
|
return crc32 != 0 || crc64 != 0;
|
|
}
|
|
|
|
explicit operator HashType() const noexcept
|
|
{
|
|
return crc32 ? crc32 : crc64;
|
|
}
|
|
};
|
|
|
|
struct TexEntry {
|
|
std::vector<BYTE> data{};
|
|
HashType crc_hash = 0; // hash value
|
|
std::string ext{};
|
|
};
|
|
|
|
struct TextureFileStruct {
|
|
std::vector<BYTE> data{};
|
|
HashType crc_hash = 0; // hash value
|
|
};
|
|
|
|
inline void Message(const char* format, ...)
|
|
{
|
|
#ifdef _DEBUG
|
|
#if 0
|
|
va_list args;
|
|
va_start(args, format);
|
|
vprintf(format, args);
|
|
va_end(args);
|
|
#endif
|
|
#endif
|
|
}
|
|
|
|
inline void Info(const char* format, ...)
|
|
{
|
|
#ifdef _DEBUG
|
|
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
|
|
}
|
|
|
|
inline void Warning(const char* format, ...)
|
|
{
|
|
#ifdef _DEBUG
|
|
const HANDLE hConsole = GetStdHandle(STD_ERROR_HANDLE);
|
|
[[maybe_unused]] const auto success = SetConsoleTextAttribute(hConsole, 6); // yellow
|
|
va_list args;
|
|
va_start(args, format);
|
|
vfprintf(stderr, format, args);
|
|
va_end(args);
|
|
#endif
|
|
}
|