mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
RTech changes.
* Added RPakAssetBinding_t. * Added RPakUnknownStruct_t * PatternScan the global RPakUnknownStruct_t. * Renamed Members of CMaterialGlue * RTechTextureInfo_t now has another unknown member named.
This commit is contained in:
parent
c0d3dafa6f
commit
f57da25341
@ -20,7 +20,7 @@ public:
|
||||
CMaterialGlue* m_pDepthShadowTight; //0x0048
|
||||
CMaterialGlue* m_pColPass; //0x0050
|
||||
CShaderGlue* m_pShaderGlue; //0x0058
|
||||
void* m_pTextureGUID1; //0x0060
|
||||
void* m_pTextureGUID; //0x0060
|
||||
void* m_pStreamableTextures; //0x0068
|
||||
int16_t m_nStreamableTextureCount; //0x0070
|
||||
int16_t m_iWidth; //0x0072
|
||||
@ -34,7 +34,7 @@ public:
|
||||
uint8_t m_iUnknown1; //0x00F3
|
||||
char pad_00F4[12]; //0x00F4
|
||||
void* m_pDXBuffer; //0x0100 [ PIXIE ]: ID3D11Buffer*, might need to include dx here.
|
||||
void* m_pID3D11BufferVTable; //0x0108 [ PIXIE ]: ID3D11BufferVtbl, probably just leave it as a void*
|
||||
void* m_pDXBufferVTable; //0x0108 [ PIXIE ]: ID3D11BufferVtbl, probably just leave it as a void*
|
||||
void* m_pUnknown2; //0x0110
|
||||
uint32_t m_iUnknown3; //0x0118
|
||||
uint16_t m_iUnknown4; //0x011C
|
||||
|
@ -208,7 +208,7 @@ CMemory CModule::GetExportedFunction(const string& svFunctionName) const
|
||||
if (!m_pNTHeaders || m_pNTHeaders->Signature != IMAGE_NT_SIGNATURE) // Is ntHeader valid?
|
||||
return CMemory();
|
||||
|
||||
// Get the location of IMAGE_EXPORT_DIRECTORY for this module by adding the IMAGE_DIRECTORY_ENTRY_EXPORT relative virtual Address onto our module base Address.
|
||||
// Get the location of IMAGE_EXPORT_DIRECTORY for this module by adding the IMAGE_DIRECTORY_ENTRY_EXPORT relative virtual address onto our module base address.
|
||||
const IMAGE_EXPORT_DIRECTORY* pImageExportDirectory = reinterpret_cast<IMAGE_EXPORT_DIRECTORY*>(m_pModuleBase + m_pNTHeaders->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress);
|
||||
if (!pImageExportDirectory)
|
||||
return CMemory();
|
||||
@ -217,17 +217,17 @@ CMemory CModule::GetExportedFunction(const string& svFunctionName) const
|
||||
if (!pImageExportDirectory->NumberOfFunctions)
|
||||
return CMemory();
|
||||
|
||||
// Get the location of the functions via adding the relative virtual Address from the struct into our module base Address.
|
||||
// Get the location of the functions via adding the relative virtual address from the struct into our module base address.
|
||||
const DWORD* pAddressOfFunctions = reinterpret_cast<DWORD*>(m_pModuleBase + pImageExportDirectory->AddressOfFunctions);
|
||||
if (!pAddressOfFunctions)
|
||||
return CMemory();
|
||||
|
||||
// Get the names of the functions via adding the relative virtual Address from the struct into our module base Address.
|
||||
// Get the names of the functions via adding the relative virtual address from the struct into our module base Address.
|
||||
const DWORD* pAddressOfName = reinterpret_cast<DWORD*>(m_pModuleBase + pImageExportDirectory->AddressOfNames);
|
||||
if (!pAddressOfName)
|
||||
return CMemory();
|
||||
|
||||
// Get the ordinals of the functions via adding the relative virtual Address from the struct into our module base Address.
|
||||
// Get the ordinals of the functions via adding the relative virtual Address from the struct into our module base address.
|
||||
DWORD* pAddressOfOrdinals = reinterpret_cast<DWORD*>(m_pModuleBase + pImageExportDirectory->AddressOfNameOrdinals);
|
||||
if (!pAddressOfOrdinals)
|
||||
return CMemory();
|
||||
@ -239,8 +239,8 @@ CMemory CModule::GetExportedFunction(const string& svFunctionName) const
|
||||
|
||||
if (ExportFunctionName.compare(svFunctionName) == 0) // Is this our wanted exported function?
|
||||
{
|
||||
// Get the function ordinal. Then grab the relative virtual Address of our wanted function. Then add module base Address so we get the actual location.
|
||||
return CMemory(m_pModuleBase + pAddressOfFunctions[reinterpret_cast<WORD*>(pAddressOfOrdinals)[i]]); // Return as Address class.
|
||||
// Get the function ordinal. Then grab the relative virtual address of our wanted function. Then add module base address so we get the actual location.
|
||||
return CMemory(m_pModuleBase + pAddressOfFunctions[reinterpret_cast<WORD*>(pAddressOfOrdinals)[i]]); // Return as CMemory class.
|
||||
}
|
||||
}
|
||||
return CMemory();
|
||||
|
@ -505,6 +505,10 @@ std::uint8_t __fastcall RTech::DecompressPakFile(RPakDecompState_t* state, std::
|
||||
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 6262 ) // Disable stack warning, tells us to move more data to the heap instead. Not really possible with 'initialData' here. Since its parallel processed.
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
// Purpose: creates 2D texture and shader resource from textureHeader and imageData.
|
||||
//----------------------------------------------------------------------------------
|
||||
void RTech::CreateDXTexture(RTechTextureInfo_t* textureHeader, int64_t imageData)
|
||||
{
|
||||
if (textureHeader->unk0 && !textureHeader->m_nHeight) // Return never gets hit. Maybe its some debug check?
|
||||
@ -566,7 +570,7 @@ void RTech::CreateDXTexture(RTechTextureInfo_t* textureHeader, int64_t imageData
|
||||
textureDesc.Format = dxgiFormat;
|
||||
textureDesc.SampleDesc.Count = 1;
|
||||
textureDesc.SampleDesc.Quality = 0;
|
||||
textureDesc.Usage = (D3D11_USAGE)(textureHeader->unk2 != 2);
|
||||
textureDesc.Usage = (D3D11_USAGE)(textureHeader->m_nCPUAccessFlag != 2);
|
||||
textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
textureDesc.MiscFlags = 0;
|
||||
|
||||
|
@ -85,6 +85,27 @@ const std::map<RPakStatus_t, std::string> RPakStatusToString {
|
||||
{ RPakStatus_t::PAK_STATUS_BUSY, "PAK_STATUS_BUSY" },
|
||||
};
|
||||
|
||||
struct RPakAssetBinding_t
|
||||
{
|
||||
uint32_t m_nExtension; // For example '0x6C74616D' for the material asset.
|
||||
int m_iVersion;
|
||||
const char* m_szDescription; // Description/Name of asset.
|
||||
void* m_pLoadAssetFunction;
|
||||
void* m_pUnloadAssetFunction;
|
||||
void* m_pReplaceAssetFunction;
|
||||
void* m_pUnknownAssetFunction; // [ PIXIE ]: Also a function pointer just sometimes it's set to CStdMemAlloc and sometimes it handles some data.
|
||||
int m_iSubHeaderSize;
|
||||
int m_iNativeClassSize; // Native class size, for 'material' it would be CMaterialGlue full size.
|
||||
uint32_t unk2;
|
||||
int unk3;
|
||||
// [ PIXIE ]: Should be the full size across Season 0-3.
|
||||
};
|
||||
|
||||
struct RPakUnknownStruct_t
|
||||
{
|
||||
RPakAssetBinding_t m_nAssetBindings[64]; // [ PIXIE ]: Max possible registered assets on Season 3, 0-2 I did not check yet.
|
||||
// End size unknown.
|
||||
};
|
||||
|
||||
struct RPakHeader_t
|
||||
{
|
||||
@ -181,7 +202,7 @@ struct RTechTextureInfo_t
|
||||
uint8_t m_nMipLevelsStreamedOpt;
|
||||
uint8_t m_nArraySize;
|
||||
uint8_t m_nLayerCount;
|
||||
uint8_t unk2;
|
||||
uint8_t m_nCPUAccessFlag; // [ PIXIE ]: In RTech::CreateDXBuffer textureDescription Usage is determined by the CPU Access Flag so I assume it's the same case here.
|
||||
uint8_t m_nMipLevels;
|
||||
uint8_t m_nMipLevelsStreamed;
|
||||
uint8_t unk3[24];
|
||||
@ -433,6 +454,7 @@ inline auto RTech_CreateDXTexture = p_RTech_CreateDXTexture.RCast<void(*)(RPakTe
|
||||
|
||||
inline RPakLoadedInfo_t* g_pLoadedPakInfo;
|
||||
inline std::int16_t* s_pLoadedPakCount;
|
||||
inline RPakUnknownStruct_t* g_pUnknownPakStruct;
|
||||
|
||||
class RTech
|
||||
{
|
||||
@ -476,10 +498,11 @@ class VPakFile : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const
|
||||
{
|
||||
CMemory localRef = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x5C\x24\x00\x48\x89\x74\x24\x00\x57\x48\x83\xEC\x30\x8B\xC1"), "xxxx?xxxx?xxxxxxx");
|
||||
g_pUnknownPakStruct = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x8D\x1D\x00\x00\x00\x00\x45\x8D\x5A\x0E"), "xxx????xxxx").ResolveRelativeAddressSelf(0x3, 0x7).RCast<RPakUnknownStruct_t*>(); /*48 8D 1D ? ? ? ? 45 8D 5A 0E*/
|
||||
|
||||
g_pLoadedPakInfo = localRef.FindPattern("48 8D 05", CMemory::Direction::DOWN).ResolveRelativeAddressSelf(0x3, 0x7).RCast<RPakLoadedInfo_t*>();
|
||||
s_pLoadedPakCount = localRef.FindPattern("66 89", CMemory::Direction::DOWN, 450).ResolveRelativeAddressSelf(0x3, 0x7).RCast<std::int16_t*>();
|
||||
CMemory RTech_UnloadPak = g_mGameDll.FindPatternSIMD(reinterpret_cast<rsig_t>("\x48\x89\x5C\x24\x00\x48\x89\x74\x24\x00\x57\x48\x83\xEC\x30\x8B\xC1"), "xxxx?xxxx?xxxxxxx");
|
||||
g_pLoadedPakInfo = RTech_UnloadPak.FindPattern("48 8D 05", CMemory::Direction::DOWN).ResolveRelativeAddressSelf(0x3, 0x7).RCast<RPakLoadedInfo_t*>();
|
||||
s_pLoadedPakCount = RTech_UnloadPak.FindPattern("66 89", CMemory::Direction::DOWN, 450).ResolveRelativeAddressSelf(0x3, 0x7).RCast<std::int16_t*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
|
@ -879,7 +879,7 @@ void Mat_CrossHair_f(const CCommand& args)
|
||||
DevMsg(eDLL_T::MS, " |-- Material Surface Name 1: '%s'\n", material->m_pszSurfaceName1);
|
||||
DevMsg(eDLL_T::MS, " |-- Material Surface Name 2: '%s'\n", material->m_pszSurfaceName2);
|
||||
DevMsg(eDLL_T::MS, " |-- DX Buffer: '%llX'\n", material->m_pDXBuffer);
|
||||
DevMsg(eDLL_T::MS, " |-- DX BufferVTable: '%llX'\n", material->m_pID3D11BufferVTable);
|
||||
DevMsg(eDLL_T::MS, " |-- DX BufferVTable: '%llX'\n", material->m_pDXBufferVTable);
|
||||
|
||||
material->m_pDepthShadow ? fnPrintChild(material->m_pDepthShadow, " | |-+ DepthShadow Addr: '%llX'\n") : DevMsg(eDLL_T::MS, " | |-+ DepthShadow Addr: 'NULL'\n");
|
||||
material->m_pDepthPrepass ? fnPrintChild(material->m_pDepthPrepass, " | |-+ DepthPrepass Addr: '%llX'\n") : DevMsg(eDLL_T::MS, " | |-+ DepthPrepass Addr: 'NULL'\n");
|
||||
@ -888,7 +888,7 @@ void Mat_CrossHair_f(const CCommand& args)
|
||||
material->m_pColPass ? fnPrintChild(material->m_pColPass, " | |-+ ColPass Addr: '%llX'\n") : DevMsg(eDLL_T::MS, " | |-+ ColPass Addr: 'NULL'\n");
|
||||
|
||||
DevMsg(eDLL_T::MS, "-+ Texture GUID map ------------------------------------------\n");
|
||||
material->m_pTextureGUID1 ? DevMsg(eDLL_T::MS, " |-- TextureMap 1 Addr: '%llX'\n", material->m_pTextureGUID1) : DevMsg(eDLL_T::MS, " |-- TextureMap 1 Addr: 'NULL'\n");
|
||||
material->m_pTextureGUID ? DevMsg(eDLL_T::MS, " |-- TextureMap 1 Addr: '%llX'\n", material->m_pTextureGUID) : DevMsg(eDLL_T::MS, " |-- TextureMap 1 Addr: 'NULL'\n");
|
||||
material->m_pStreamableTextures ? DevMsg(eDLL_T::MS, " |-- TextureMap 2 Addr: '%llX'\n", material->m_pStreamableTextures) : DevMsg(eDLL_T::MS, " |-- TextureMap 2 Addr: 'NULL'\n");
|
||||
|
||||
DevMsg(eDLL_T::MS, "--------------------------------------------------------------\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user