2021-12-25 22:36:38 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Internals
|
2022-01-04 11:53:54 +01:00
|
|
|
BOOL IsBadReadPtrV2(void* ptr);
|
2022-06-12 12:40:26 +02:00
|
|
|
BOOL FileExists(const fs::path& svFilePath);
|
2021-12-25 22:36:38 +01:00
|
|
|
MODULEINFO GetModuleInfo(const char* szModule);
|
|
|
|
DWORD64 FindPatternSIMD(const char* szModule, const unsigned char* szPattern, const char* szMask);
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2022-06-07 13:44:31 +02:00
|
|
|
// Debug
|
2021-12-25 22:36:38 +01:00
|
|
|
void DbgPrint(LPCSTR sFormat, ...);
|
2022-01-19 23:14:50 +01:00
|
|
|
void PrintLastError(void);
|
2022-04-24 19:32:47 +02:00
|
|
|
void HexDump(const char* szHeader, const char* szLogger, const void* pData, int nSize);
|
2022-04-10 19:59:34 +02:00
|
|
|
|
2022-06-07 13:44:31 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// String
|
|
|
|
bool HasExtension(const string& svInput, const string& svExtension);
|
|
|
|
string GetExtension(const string& svInput, bool bReturnOriginal = false, bool bKeepDelimiter = false);
|
2022-05-30 01:50:21 +02:00
|
|
|
string RemoveExtension(const string& svInput);
|
|
|
|
|
2022-06-07 13:44:31 +02:00
|
|
|
bool HasFileName(const string& svInput, const string& svFileName);
|
2022-06-02 01:55:41 +02:00
|
|
|
string GetFileName(const string& svInput, bool bRemoveExtension, bool bWindows = false);
|
|
|
|
string RemoveFileName(const string& svInput, bool bWindows = false);
|
2022-05-30 01:50:21 +02:00
|
|
|
|
Proper VPK repacking
Initial proper implementation pending cleanup.
The new system builds a manifest file when a VPK is unpacked. The manifest files contains data such as the entry flags and texture flags. It also contains a field determining whether the file should be compressed or not.
When a user repacks a pack, the system attempts to load this manifest file and does a lookup to the object to retrieve the flags (most of these flags are unknown, but they are used by the engine and are necessary for stuff like cubemaps and texture files to work correctly. Cubemaps won't work with proper flags, and textures (decals, particle system components, etc..) will look washed out without them.
I think some also determine whether a file within the VPK should be cached or not, so simply marking everything as 0x101 will probably end up in more CPU time and higher filesystem cache usage (depot/ is only 0x1, I don't think anything there is getting cached ever without the 0x100 flag).
User could also repack a VPK while excluding anything that is not in the manifest file. So you could unpack all VPK's into a single directory (each VPK has its own manifest file tied to its level name), and rebuild all the VPK's with only the files that where originally in them.
fs_pack_vpk command usage: <locale> <context> <level_name> <manifest_only>
locale determines the pak language (default english), context determines whether is a server/client vpk, level_name determines the BSP name of the pak, manifest_only determines whether the pack system should only include files within the manifest (leaving this arg out will build all files into the vpk).
The VPK workspace path is determined with ConVar 'fs_packedstore_workspace'.
2022-06-04 01:08:23 +02:00
|
|
|
string CreateDirectories(string svInput, bool bWindows = false);
|
2022-04-10 19:59:34 +02:00
|
|
|
string ConvertToWinPath(const string& svInput);
|
2022-04-29 05:30:06 +02:00
|
|
|
string ConvertToUnixPath(const string& svInput);
|
2022-04-10 19:59:34 +02:00
|
|
|
|
|
|
|
string Base64Encode(const string& svInput);
|
|
|
|
string Base64Decode(const string& svInput);
|
|
|
|
|
2022-05-30 01:50:21 +02:00
|
|
|
string UTF8Encode(const wstring& wsvInput);
|
2022-06-02 16:30:35 +02:00
|
|
|
string UTF8Decode(const string& svInput);
|
2022-06-24 12:12:30 +02:00
|
|
|
size_t UTF8CharLength(const uint8_t cInput);
|
2022-05-30 01:50:21 +02:00
|
|
|
|
2022-05-24 02:23:37 +02:00
|
|
|
bool StringIsDigit(const string& svInput);
|
2022-04-18 16:45:26 +02:00
|
|
|
bool CompareStringAlphabetically(const string& svA, const string& svB);
|
|
|
|
bool CompareStringLexicographically(const string& svA, const string& svB);
|
|
|
|
|
2022-04-10 19:59:34 +02:00
|
|
|
bool StringReplace(string& svInput, const string& svFrom, const string& svTo);
|
2022-06-02 01:55:41 +02:00
|
|
|
string StringReplaceC(const string& svInput, const string& svFrom, const string& svTo);
|
2022-04-10 19:59:34 +02:00
|
|
|
string StringEscape(const string& svInput);
|
|
|
|
string StringUnescape(const string& svInput);
|
2022-05-10 23:32:44 +02:00
|
|
|
|
2022-04-10 19:59:34 +02:00
|
|
|
vector<int> StringToBytes(const string& svInput, bool bNullTerminator);
|
|
|
|
vector<int> PatternToBytes(const string& svInput);
|
2022-06-26 17:45:54 +02:00
|
|
|
pair<vector<uint8_t>, string> PatternToMaskedBytes(const string& svInput);
|
2022-05-30 01:50:21 +02:00
|
|
|
vector<int> IntToDigits(int iValue);
|
2021-12-25 22:36:38 +01:00
|
|
|
|
2022-06-07 13:44:31 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Print
|
2022-05-10 23:36:01 +02:00
|
|
|
void PrintM128i8(__m128i in);
|
|
|
|
void PrintM128i16(__m128i in);
|
|
|
|
void PrintM128i32(__m128i in);
|
|
|
|
void PrintM128i64(__m128i in);
|
|
|
|
|
2022-05-10 23:32:44 +02:00
|
|
|
string PrintPercentageEscape(const string& svInput);
|
|
|
|
|
2021-12-25 22:36:38 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|