mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
MaterialSystem: rename CMaterialGlue member vars
This commit is contained in:
parent
8911bfa81a
commit
1410ecd79c
@ -519,7 +519,6 @@ void Pak_Decompress_f(const CCommand& args)
|
|||||||
FileSystem()->Close(hPakFile);
|
FileSystem()->Close(hPakFile);
|
||||||
|
|
||||||
PakFileHeader_t* pHeader = reinterpret_cast<PakFileHeader_t*>(pPakBuf);
|
PakFileHeader_t* pHeader = reinterpret_cast<PakFileHeader_t*>(pPakBuf);
|
||||||
uint16_t flags = (pHeader->flags[0] << 8) | pHeader->flags[1];
|
|
||||||
|
|
||||||
SYSTEMTIME systemTime;
|
SYSTEMTIME systemTime;
|
||||||
FileTimeToSystemTime(&pHeader->fileTime, &systemTime);
|
FileTimeToSystemTime(&pHeader->fileTime, &systemTime);
|
||||||
@ -527,7 +526,7 @@ void Pak_Decompress_f(const CCommand& args)
|
|||||||
Msg(eDLL_T::RTECH, " | |-+ Header ------------------------------------------------\n");
|
Msg(eDLL_T::RTECH, " | |-+ Header ------------------------------------------------\n");
|
||||||
Msg(eDLL_T::RTECH, " | |-- Magic : '0x%08X'\n", pHeader->magic);
|
Msg(eDLL_T::RTECH, " | |-- Magic : '0x%08X'\n", pHeader->magic);
|
||||||
Msg(eDLL_T::RTECH, " | |-- Version : '%hu'\n", pHeader->version);
|
Msg(eDLL_T::RTECH, " | |-- Version : '%hu'\n", pHeader->version);
|
||||||
Msg(eDLL_T::RTECH, " | |-- Flags : '0x%04hX'\n", flags);
|
Msg(eDLL_T::RTECH, " | |-- Flags : '0x%04hX'\n", pHeader->flags);
|
||||||
Msg(eDLL_T::RTECH, " | |-- Time : '%hu-%hu-%hu/%hu %hu:%hu:%hu.%hu'\n",
|
Msg(eDLL_T::RTECH, " | |-- Time : '%hu-%hu-%hu/%hu %hu:%hu:%hu.%hu'\n",
|
||||||
systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wDayOfWeek,
|
systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wDayOfWeek,
|
||||||
systemTime.wHour, systemTime.wMinute, systemTime.wSecond, systemTime.wMilliseconds);
|
systemTime.wHour, systemTime.wMinute, systemTime.wSecond, systemTime.wMilliseconds);
|
||||||
@ -544,7 +543,7 @@ void Pak_Decompress_f(const CCommand& args)
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((pHeader->flags[1] & 1) != 1)
|
if (!(pHeader->flags & PAK_HEADER_FLAGS_COMPRESSED))
|
||||||
{
|
{
|
||||||
Error(eDLL_T::RTECH, NO_ERROR, "%s - pak file '%s' already decompressed!\n",
|
Error(eDLL_T::RTECH, NO_ERROR, "%s - pak file '%s' already decompressed!\n",
|
||||||
__FUNCTION__, inPakFile.String());
|
__FUNCTION__, inPakFile.String());
|
||||||
@ -560,8 +559,10 @@ void Pak_Decompress_f(const CCommand& args)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PakDecoder_t decoder{}; // Needs full decode mask as we don't decompress in chunks.
|
const bool usesCustomCompression = pHeader->flags & PAK_HEADER_FLAGS_ZSTD;
|
||||||
const uint64_t nDecompSize = Pak_InitDefaultDecoder(&decoder, pPakBuf, PAK_DECODE_MASK_FULL, nFileSize, NULL, sizeof(PakFileHeader_t));
|
|
||||||
|
PakDecoder_t decoder{};
|
||||||
|
const uint64_t nDecompSize = Pak_InitDecoder(&decoder, pPakBuf, UINT64_MAX, nFileSize, NULL, sizeof(PakFileHeader_t), usesCustomCompression);
|
||||||
|
|
||||||
if (nDecompSize != pHeader->decompressedSize)
|
if (nDecompSize != pHeader->decompressedSize)
|
||||||
{
|
{
|
||||||
@ -582,17 +583,17 @@ void Pak_Decompress_f(const CCommand& args)
|
|||||||
uint8_t* const pDecompBuf = pDecompBufContainer.get();
|
uint8_t* const pDecompBuf = pDecompBufContainer.get();
|
||||||
|
|
||||||
// Needs full decode mask as we don't decompress in chunks.
|
// Needs full decode mask as we don't decompress in chunks.
|
||||||
decoder.outputMask = PAK_DECODE_MASK_FULL;
|
decoder.outputMask = UINT64_MAX;
|
||||||
decoder.outputBuf = pDecompBuf;
|
decoder.outputBuf = pDecompBuf;
|
||||||
|
|
||||||
uint8_t nDecompResult = Pak_DefaultDecode(&decoder, pHeader->compressedSize, pHeader->decompressedSize);
|
uint8_t nDecompResult = Pak_StreamToBufferDecode(&decoder, pHeader->compressedSize, pHeader->decompressedSize, usesCustomCompression);
|
||||||
if (nDecompResult != 1)
|
if (nDecompResult != 1)
|
||||||
{
|
{
|
||||||
Error(eDLL_T::RTECH, NO_ERROR, "%s - decompression failed for '%s' return value: '%hu'!\n",
|
Error(eDLL_T::RTECH, NO_ERROR, "%s - decompression failed for '%s' return value: '%hu'!\n",
|
||||||
__FUNCTION__, inPakFile.String(), nDecompResult);
|
__FUNCTION__, inPakFile.String(), nDecompResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
pHeader->flags[1] = 0x0; // Set compressed flag to false for the decompressed pak file.
|
pHeader->flags &= ~PAK_HEADER_FLAGS_COMPRESSED; // Remove compressed flags.
|
||||||
pHeader->compressedSize = pHeader->decompressedSize; // Equal compressed size with decompressed.
|
pHeader->compressedSize = pHeader->decompressedSize; // Equal compressed size with decompressed.
|
||||||
|
|
||||||
FileSystem()->CreateDirHierarchy(PLATFORM_PAK_OVERRIDE_PATH, "GAME");
|
FileSystem()->CreateDirHierarchy(PLATFORM_PAK_OVERRIDE_PATH, "GAME");
|
||||||
@ -1233,46 +1234,46 @@ void Mat_CrossHair_f(const CCommand& args)
|
|||||||
Msg(eDLL_T::MS, "______________________________________________________________\n");
|
Msg(eDLL_T::MS, "______________________________________________________________\n");
|
||||||
Msg(eDLL_T::MS, "-+ Material --------------------------------------------------\n");
|
Msg(eDLL_T::MS, "-+ Material --------------------------------------------------\n");
|
||||||
Msg(eDLL_T::MS, " |-- ADDR: '%llX'\n", material);
|
Msg(eDLL_T::MS, " |-- ADDR: '%llX'\n", material);
|
||||||
Msg(eDLL_T::MS, " |-- GUID: '%llX'\n", material->m_GUID);
|
Msg(eDLL_T::MS, " |-- GUID: '%llX'\n", material->assetGuid);
|
||||||
Msg(eDLL_T::MS, " |-- Streaming texture count: '%d'\n", material->m_nStreamableTextureCount);
|
Msg(eDLL_T::MS, " |-- Num Streaming Textures: '%d'\n", material->numStreamingTextureHandles);
|
||||||
Msg(eDLL_T::MS, " |-- Material width: '%d'\n", material->m_iWidth);
|
Msg(eDLL_T::MS, " |-- Material width: '%d'\n", material->width);
|
||||||
Msg(eDLL_T::MS, " |-- Material height: '%d'\n", material->m_iHeight);
|
Msg(eDLL_T::MS, " |-- Material height: '%d'\n", material->height);
|
||||||
Msg(eDLL_T::MS, " |-- Flags: '%llX'\n", material->m_iFlags);
|
Msg(eDLL_T::MS, " |-- Samplers: '%08X'\n", material->samplers);
|
||||||
|
|
||||||
std::function<void(CMaterialGlue*, const char*)> fnPrintChild = [](CMaterialGlue* material, const char* print)
|
std::function<void(CMaterialGlue*, const char*)> fnPrintChild = [](CMaterialGlue* material, const char* print)
|
||||||
{
|
{
|
||||||
Msg(eDLL_T::MS, " |-+\n");
|
Msg(eDLL_T::MS, " |-+\n");
|
||||||
Msg(eDLL_T::MS, " | |-+ Child material ----------------------------------------\n");
|
Msg(eDLL_T::MS, " | |-+ Child material ----------------------------------------\n");
|
||||||
Msg(eDLL_T::MS, print, material);
|
Msg(eDLL_T::MS, print, material);
|
||||||
Msg(eDLL_T::MS, " | |-- GUID: '%llX'\n", material->m_GUID);
|
Msg(eDLL_T::MS, " | |-- GUID: '%llX'\n", material->assetGuid);
|
||||||
Msg(eDLL_T::MS, " | |-- Material name: '%s'\n", material->m_pszName);
|
Msg(eDLL_T::MS, " | |-- Material name: '%s'\n", material->name);
|
||||||
};
|
};
|
||||||
|
|
||||||
Msg(eDLL_T::MS, " |-- Material name: '%s'\n", material->m_pszName);
|
Msg(eDLL_T::MS, " |-- Material name: '%s'\n", material->name);
|
||||||
Msg(eDLL_T::MS, " |-- Material surface name 1: '%s'\n", material->m_pszSurfaceProp);
|
Msg(eDLL_T::MS, " |-- Material surface name 1: '%s'\n", material->surfaceProp);
|
||||||
Msg(eDLL_T::MS, " |-- Material surface name 2: '%s'\n", material->m_pszSurfaceProp2);
|
Msg(eDLL_T::MS, " |-- Material surface name 2: '%s'\n", material->surfaceProp2);
|
||||||
Msg(eDLL_T::MS, " |-- DX buffer: '%llX'\n", material->m_pDXBuffer);
|
Msg(eDLL_T::MS, " |-- DX buffer: '%llX'\n", material->dxBuffer);
|
||||||
Msg(eDLL_T::MS, " |-- DX buffer VFTable: '%llX'\n", material->m_pID3D11BufferVTable);
|
Msg(eDLL_T::MS, " |-- DX buffer VFTable: '%llX'\n", material->unkD3DPointer);
|
||||||
|
|
||||||
material->m_pDepthShadow
|
material->depthShadowMaterial
|
||||||
? fnPrintChild(material->m_pDepthShadow, " | |-+ DepthShadow: '%llX'\n")
|
? fnPrintChild(material->depthShadowMaterial, " | |-+ DepthShadow: '%llX'\n")
|
||||||
: Msg(eDLL_T::MS, " | |-+ DepthShadow: 'NULL'\n");
|
: Msg(eDLL_T::MS, " | |-+ DepthShadow: 'NULL'\n");
|
||||||
material->m_pDepthPrepass
|
material->depthPrepassMaterial
|
||||||
? fnPrintChild(material->m_pDepthPrepass, " | |-+ DepthPrepass: '%llX'\n")
|
? fnPrintChild(material->depthPrepassMaterial, " | |-+ DepthPrepass: '%llX'\n")
|
||||||
: Msg(eDLL_T::MS, " | |-+ DepthPrepass: 'NULL'\n");
|
: Msg(eDLL_T::MS, " | |-+ DepthPrepass: 'NULL'\n");
|
||||||
material->m_pDepthVSM
|
material->depthVSMMaterial
|
||||||
? fnPrintChild(material->m_pDepthVSM, " | |-+ DepthVSM: '%llX'\n")
|
? fnPrintChild(material->depthVSMMaterial, " | |-+ DepthVSM: '%llX'\n")
|
||||||
: Msg(eDLL_T::MS, " | |-+ DepthVSM: 'NULL'\n");
|
: Msg(eDLL_T::MS, " | |-+ DepthVSM: 'NULL'\n");
|
||||||
material->m_pDepthShadow
|
material->depthShadowTightMaterial
|
||||||
? fnPrintChild(material->m_pDepthShadow, " | |-+ DepthShadowTight: '%llX'\n")
|
? fnPrintChild(material->depthShadowTightMaterial, " | |-+ DepthShadowTight: '%llX'\n")
|
||||||
: Msg(eDLL_T::MS, " | |-+ DepthShadowTight: 'NULL'\n");
|
: Msg(eDLL_T::MS, " | |-+ DepthShadowTight: 'NULL'\n");
|
||||||
material->m_pColPass
|
material->colpassMaterial
|
||||||
? fnPrintChild(material->m_pColPass, " | |-+ ColPass: '%llX'\n")
|
? fnPrintChild(material->colpassMaterial, " | |-+ ColPass: '%llX'\n")
|
||||||
: Msg(eDLL_T::MS, " | |-+ ColPass: 'NULL'\n");
|
: Msg(eDLL_T::MS, " | |-+ ColPass: 'NULL'\n");
|
||||||
|
|
||||||
Msg(eDLL_T::MS, "-+ Texture GUID map ------------------------------------------\n");
|
Msg(eDLL_T::MS, "-+ Texture GUID map ------------------------------------------\n");
|
||||||
Msg(eDLL_T::MS, " |-- Texture handles: '%llX'\n", material->m_pTextureHandles);
|
Msg(eDLL_T::MS, " |-- Texture handles: '%llX'\n", material->textureHandles);
|
||||||
Msg(eDLL_T::MS, " |-- Streaming texture handles: '%llX'\n", material->m_pStreamableTextureHandles);
|
Msg(eDLL_T::MS, " |-- Streaming texture handles: '%llX'\n", material->streamingTextureHandles);
|
||||||
|
|
||||||
Msg(eDLL_T::MS, "--------------------------------------------------------------\n");
|
Msg(eDLL_T::MS, "--------------------------------------------------------------\n");
|
||||||
}
|
}
|
||||||
|
@ -5,59 +5,72 @@
|
|||||||
#include "public/materialsystem/shader_vcs_version.h"
|
#include "public/materialsystem/shader_vcs_version.h"
|
||||||
#include "public/rendersystem/schema/texture.g.h"
|
#include "public/rendersystem/schema/texture.g.h"
|
||||||
|
|
||||||
struct CMaterialGlue_Unknown
|
struct MaterialDXState_t
|
||||||
{
|
{
|
||||||
__m128i unk1;
|
uint32_t blendState[8];
|
||||||
__m128i unk2;
|
unsigned int unkFlags;
|
||||||
__m128i unk3;
|
unsigned __int16 depthStencilFlags;
|
||||||
|
unsigned __int16 rasterizerFlags;
|
||||||
|
char pad[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(push, 1) // Without this MSVC might get the idea to align our members to completely fuck the offsets up.
|
#pragma pack(push, 1)
|
||||||
// [ PIXIE ]: The texture GUID's aren't in a specific order, gonna leave them as ptr's so an individual can check them in any memory searcher.
|
|
||||||
// [ PIXIE ]: Verification needed for earlier seasons, if the struct is the same.
|
|
||||||
// [ PIXIE ]: Class seems mostly right, a few members are still missing though.
|
|
||||||
class CMaterialGlue : public IMaterialInternal
|
class CMaterialGlue : public IMaterialInternal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
uint8_t pad_0008[8]; //0x0008
|
uint8_t pad_0008[8]; //0x0008
|
||||||
uint64_t m_GUID; //0x0010
|
uint64_t assetGuid; //0x0010
|
||||||
const char* m_pszName; //0x0018
|
const char* name; //0x0018
|
||||||
const char* m_pszSurfaceProp; //0x0020
|
|
||||||
const char* m_pszSurfaceProp2; //0x0028
|
const char* surfaceProp; //0x0020
|
||||||
CMaterialGlue* m_pDepthShadow; //0x0030
|
const char* surfaceProp2; //0x0028
|
||||||
CMaterialGlue* m_pDepthPrepass; //0x0038
|
|
||||||
CMaterialGlue* m_pDepthVSM; //0x0040
|
CMaterialGlue* depthShadowMaterial; //0x0030
|
||||||
CMaterialGlue* m_pDepthShadowTight; //0x0048
|
CMaterialGlue* depthPrepassMaterial; //0x0038
|
||||||
CMaterialGlue* m_pColPass; //0x0050
|
CMaterialGlue* depthVSMMaterial; //0x0040
|
||||||
CShaderGlue* m_pShaderGlue; //0x0058
|
CMaterialGlue* depthShadowTightMaterial; //0x0048
|
||||||
TextureHeader_t** m_pTextureHandles; //0x0060
|
CMaterialGlue* colpassMaterial; //0x0050
|
||||||
TextureHeader_t** m_pStreamableTextureHandles; //0x0068
|
|
||||||
int16_t m_nStreamableTextureCount; //0x0070
|
CShaderGlue* shaderset; //0x0058
|
||||||
int16_t m_iWidth; //0x0072
|
|
||||||
int16_t m_iHeight; //0x0074
|
TextureHeader_t** textureHandles; //0x0060
|
||||||
int16_t m_iDepth; //0x0076
|
TextureHeader_t** streamingTextureHandles; //0x0068
|
||||||
uint32_t m_iFlags; //0x0078 [ PIXIE ]: I'm pretty sure those are VTF Image Flags, If you set them to NULL they cause Texture stretching.
|
|
||||||
int32_t m_unused2; //0x007C
|
int16_t numStreamingTextureHandles; //0x0070
|
||||||
uint8_t pad_0080[8]; //0x0080
|
|
||||||
uint32_t m_iUnknownFlags1; //0x0088
|
int16_t width; //0x0072
|
||||||
char pad_008C[4]; //0x008C
|
int16_t height; //0x0074
|
||||||
CMaterialGlue_Unknown m_UnkSections[2];
|
int16_t depth; //0x0076
|
||||||
uint8_t bytef0;
|
|
||||||
uint8_t bytef1;
|
uint32_t samplers; //0x0078
|
||||||
uint8_t m_iMaterialType;
|
|
||||||
|
char padding_7C[4]; //0x007C
|
||||||
|
|
||||||
|
uint32_t unk_80;
|
||||||
|
uint32_t unk_84;
|
||||||
|
|
||||||
|
uint64_t flags; // 0x0088
|
||||||
|
|
||||||
|
MaterialDXState_t dxStates[2];
|
||||||
|
|
||||||
|
uint16_t numAnimationFrames; // used in CMaterialGlue::GetNumAnimationFrames (0x1403B4250), which is called from GetSpriteInfo @ 0x1402561FC
|
||||||
|
uint8_t materialType;
|
||||||
uint8_t bytef3;
|
uint8_t bytef3;
|
||||||
int dwordf4;
|
|
||||||
void* m_pTextureAnim;
|
char padding_F4[4];
|
||||||
void** m_pDXBuffer;
|
|
||||||
void** m_pID3D11BufferVTable;
|
void* textureAnim;
|
||||||
void* m_pViewsBuffer;
|
void** dxBuffer;
|
||||||
uint32_t m_iUnknown3; //0x0118
|
void** unkD3DPointer; // was m_pID3D11BufferVTable
|
||||||
uint16_t m_iUnknown4; //0x011C
|
void* viewsBuffer;
|
||||||
uint16_t m_iUnknown5; //0x011E
|
|
||||||
uint16_t m_iUnknown6; //0x0120
|
uint32_t unknown3; //0x0118
|
||||||
uint64_t m_Unknown7; //0x0122
|
uint16_t unknown4; //0x011C
|
||||||
uint32_t m_iUnknown8; //0x012A
|
uint16_t unknown5; //0x011E
|
||||||
uint16_t m_iUnknown9; //0x012E
|
uint16_t unknown6; //0x0120
|
||||||
|
uint64_t unknown7; //0x0122
|
||||||
|
uint32_t unknown8; //0x012A
|
||||||
|
uint16_t unknown9; //0x012E
|
||||||
}; //Size: 0x0130 confirmed end size.
|
}; //Size: 0x0130 confirmed end size.
|
||||||
static_assert(sizeof(CMaterialGlue) == 0x130);
|
static_assert(sizeof(CMaterialGlue) == 0x130);
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -229,12 +229,12 @@ void CTextOverlay::DrawCrosshairMaterial(void) const
|
|||||||
|
|
||||||
static Color c = { 255, 255, 255, 255 };
|
static Color c = { 255, 255, 255, 255 };
|
||||||
DrawFormat(cl_materialinfo_offset_x->GetInt(), cl_materialinfo_offset_y->GetInt(), c, "name: %s\nguid: %llx\ndimensions: %d x %d\nsurface: %s/%s\nstc: %i\ntc: %i",
|
DrawFormat(cl_materialinfo_offset_x->GetInt(), cl_materialinfo_offset_y->GetInt(), c, "name: %s\nguid: %llx\ndimensions: %d x %d\nsurface: %s/%s\nstc: %i\ntc: %i",
|
||||||
pMaterialGlue->m_pszName,
|
pMaterialGlue->name,
|
||||||
pMaterialGlue->m_GUID,
|
pMaterialGlue->assetGuid,
|
||||||
pMaterialGlue->m_iWidth, pMaterialGlue->m_iHeight,
|
pMaterialGlue->width, pMaterialGlue->height,
|
||||||
pMaterialGlue->m_pszSurfaceProp, pMaterialGlue->m_pszSurfaceProp2,
|
pMaterialGlue->surfaceProp, pMaterialGlue->surfaceProp2,
|
||||||
pMaterialGlue->m_nStreamableTextureCount,
|
pMaterialGlue->numStreamingTextureHandles,
|
||||||
pMaterialGlue->m_pShaderGlue->m_nTextureInputCount);
|
pMaterialGlue->shaderset->m_nTextureInputCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user