mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Rename/improve RPak structure fields
* Renamed for consistency. * Added new structures for known fields.
This commit is contained in:
parent
69396d5f42
commit
8373cc70ca
@ -106,13 +106,13 @@ uint64_t __fastcall RTech::DecompressPakFileInit(RPakDecompState_t* state, uint8
|
|||||||
state->m_nDecompPosition = headerSize;
|
state->m_nDecompPosition = headerSize;
|
||||||
decompressed_size_bits = byte_init & 0x3F;
|
decompressed_size_bits = byte_init & 0x3F;
|
||||||
byte_init >>= 6;
|
byte_init >>= 6;
|
||||||
state->input_byte_pos = input_byte_pos_init;
|
state->m_nInputBytePos = input_byte_pos_init;
|
||||||
state->m_nDecompSize = byte_init & ((1i64 << decompressed_size_bits) - 1) | (1i64 << decompressed_size_bits);
|
state->m_nDecompSize = byte_init & ((1i64 << decompressed_size_bits) - 1) | (1i64 << decompressed_size_bits);
|
||||||
byte_1_low = *(uint64_t*)((mask & input_byte_pos_init) + file_buf) << (64
|
byte_1_low = *(uint64_t*)((mask & input_byte_pos_init) + file_buf) << (64
|
||||||
- ((uint8_t)decompressed_size_bits
|
- ((uint8_t)decompressed_size_bits
|
||||||
+ 6));
|
+ 6));
|
||||||
input_byte_pos_1 = input_byte_pos_init + ((uint64_t)(uint32_t)(decompressed_size_bits + 6) >> 3);
|
input_byte_pos_1 = input_byte_pos_init + ((uint64_t)(uint32_t)(decompressed_size_bits + 6) >> 3);
|
||||||
state->input_byte_pos = input_byte_pos_1;
|
state->m_nInputBytePos = input_byte_pos_1;
|
||||||
bit_pos_final = ((decompressed_size_bits + 6) & 7) + 13;
|
bit_pos_final = ((decompressed_size_bits + 6) & 7) + 13;
|
||||||
byte_1 = (0xFFFFFFFFFFFFFFFFui64 >> ((decompressed_size_bits + 6) & 7)) & ((byte_init >> decompressed_size_bits) | byte_1_low);
|
byte_1 = (0xFFFFFFFFFFFFFFFFui64 >> ((decompressed_size_bits + 6) & 7)) & ((byte_init >> decompressed_size_bits) | byte_1_low);
|
||||||
brih_bits = (((uint8_t)byte_1 - 1) & 0x3F) + 1;
|
brih_bits = (((uint8_t)byte_1 - 1) & 0x3F) + 1;
|
||||||
@ -125,18 +125,18 @@ uint64_t __fastcall RTech::DecompressPakFileInit(RPakDecompState_t* state, uint8
|
|||||||
byte_bit_offset_final = bit_pos_final & 7;
|
byte_bit_offset_final = bit_pos_final & 7;
|
||||||
input_byte_pos_final = (bit_pos_final_1 >> 3) + input_byte_pos_1;
|
input_byte_pos_final = (bit_pos_final_1 >> 3) + input_byte_pos_1;
|
||||||
byte_final = (0xFFFFFFFFFFFFFFFFui64 >> byte_bit_offset_final) & byte_final_full;
|
byte_final = (0xFFFFFFFFFFFFFFFFui64 >> byte_bit_offset_final) & byte_final_full;
|
||||||
state->input_byte_pos = input_byte_pos_final;
|
state->m_nInputBytePos = input_byte_pos_final;
|
||||||
if (inv_mask_in == -1i64)
|
if (inv_mask_in == -1i64)
|
||||||
{
|
{
|
||||||
state->header_skip_bytes_bs = 0;
|
state->m_nHeaderOffset = 0;
|
||||||
stream_len_needed = fileSize;
|
stream_len_needed = fileSize;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
brih_bytes = brih_bits >> 3;
|
brih_bytes = brih_bits >> 3;
|
||||||
state->header_skip_bytes_bs = brih_bytes + 1;
|
state->m_nHeaderOffset = brih_bytes + 1;
|
||||||
byte_tmp = *(uint64_t*)((mask & input_byte_pos_final) + file_buf);
|
byte_tmp = *(uint64_t*)((mask & input_byte_pos_final) + file_buf);
|
||||||
state->input_byte_pos = input_byte_pos_final + brih_bytes + 1;
|
state->m_nInputBytePos = input_byte_pos_final + brih_bytes + 1;
|
||||||
stream_len_needed = byte_tmp & ((1i64 << (8 * ((uint8_t)brih_bytes + 1))) - 1);
|
stream_len_needed = byte_tmp & ((1i64 << (8 * ((uint8_t)brih_bytes + 1))) - 1);
|
||||||
}
|
}
|
||||||
result = state->m_nDecompSize;
|
result = state->m_nDecompSize;
|
||||||
@ -145,13 +145,13 @@ uint64_t __fastcall RTech::DecompressPakFileInit(RPakDecompState_t* state, uint8
|
|||||||
state->m_nLengthNeeded = stream_len_needed + offNoHeader;
|
state->m_nLengthNeeded = stream_len_needed + offNoHeader;
|
||||||
state->qword70 = qw70;
|
state->qword70 = qw70;
|
||||||
state->byte = byte_final;
|
state->byte = byte_final;
|
||||||
state->byte_bit_offset = byte_bit_offset_final;
|
state->m_nByteBitOffset = byte_bit_offset_final;
|
||||||
state->dword6C = 0;
|
state->dword6C = 0;
|
||||||
state->m_nCompressedStreamSize = stream_len_needed + offNoHeader;
|
state->m_nCompressedStreamSize = stream_len_needed + offNoHeader;
|
||||||
state->m_nDecompStreamSize = result;
|
state->m_nDecompStreamSize = result;
|
||||||
if (result - 1 > inv_mask_out)
|
if (result - 1 > inv_mask_out)
|
||||||
{
|
{
|
||||||
stream_compressed_size_new = stream_len_needed + offNoHeader - state->header_skip_bytes_bs;
|
stream_compressed_size_new = stream_len_needed + offNoHeader - state->m_nHeaderOffset;
|
||||||
state->m_nDecompStreamSize = inv_mask_out + 1;
|
state->m_nDecompStreamSize = inv_mask_out + 1;
|
||||||
state->m_nCompressedStreamSize = stream_compressed_size_new;
|
state->m_nCompressedStreamSize = stream_compressed_size_new;
|
||||||
}
|
}
|
||||||
@ -229,9 +229,9 @@ uint8_t __fastcall RTech::DecompressPakFile(RPakDecompState_t* state, uint64_t i
|
|||||||
if (outLen < state->m_nInvMaskOut + (decompressed_position & ~state->m_nInvMaskOut) + 1 && outLen < state->m_nDecompSize)
|
if (outLen < state->m_nInvMaskOut + (decompressed_position & ~state->m_nInvMaskOut) + 1 && outLen < state->m_nDecompSize)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
byte_bit_offset = state->byte_bit_offset; // Keeping copy since we increment it down below.
|
byte_bit_offset = state->m_nByteBitOffset; // Keeping copy since we increment it down below.
|
||||||
byte = state->byte; // Keeping copy since its getting overwritten down below.
|
byte = state->byte; // Keeping copy since its getting overwritten down below.
|
||||||
input_byte_pos = state->input_byte_pos; // Keeping copy since we increment it down below.
|
input_byte_pos = state->m_nInputBytePos; // Keeping copy since we increment it down below.
|
||||||
some_size = state->qword70;
|
some_size = state->qword70;
|
||||||
if (state->m_nCompressedStreamSize < some_size)
|
if (state->m_nCompressedStreamSize < some_size)
|
||||||
some_size = state->m_nCompressedStreamSize;
|
some_size = state->m_nCompressedStreamSize;
|
||||||
@ -432,14 +432,14 @@ uint8_t __fastcall RTech::DecompressPakFile(RPakDecompState_t* state, uint64_t i
|
|||||||
decompressed_size = state->m_nDecompSize;
|
decompressed_size = state->m_nDecompSize;
|
||||||
if (decompressed_position == decompressed_size)
|
if (decompressed_position == decompressed_size)
|
||||||
{
|
{
|
||||||
state->input_byte_pos = input_byte_pos;
|
state->m_nInputBytePos = input_byte_pos;
|
||||||
result = 1;
|
result = 1;
|
||||||
state->m_nDecompPosition = decompressed_position;
|
state->m_nDecompPosition = decompressed_position;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
inv_mask_in = state->m_nInvMaskIn;
|
inv_mask_in = state->m_nInvMaskIn;
|
||||||
header_skip_bytes_bs = state->header_skip_bytes_bs;
|
header_skip_bytes_bs = state->m_nHeaderOffset;
|
||||||
v32 = inv_mask_in & -(int64_t)input_byte_pos;
|
v32 = inv_mask_in & -(int64_t)input_byte_pos;
|
||||||
byte_new >>= 1;
|
byte_new >>= 1;
|
||||||
++byte_bit_offset;
|
++byte_bit_offset;
|
||||||
@ -494,10 +494,10 @@ uint8_t __fastcall RTech::DecompressPakFile(RPakDecompState_t* state, uint64_t i
|
|||||||
|
|
||||||
state->dword6C = dword6C;
|
state->dword6C = dword6C;
|
||||||
result = 0;
|
result = 0;
|
||||||
state->input_byte_pos = input_byte_pos;
|
state->m_nInputBytePos = input_byte_pos;
|
||||||
state->m_nDecompPosition = decompressed_position;
|
state->m_nDecompPosition = decompressed_position;
|
||||||
state->byte = byte_new;
|
state->byte = byte_new;
|
||||||
state->byte_bit_offset = byte_bit_offset;
|
state->m_nByteBitOffset = byte_bit_offset;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -113,8 +113,10 @@ struct RPakAssetEntry_t
|
|||||||
{
|
{
|
||||||
uint64_t m_Guid;
|
uint64_t m_Guid;
|
||||||
uint64_t m_Padding;
|
uint64_t m_Padding;
|
||||||
void* m_pHead;
|
uint32_t m_nHeadPageIdx;
|
||||||
void* m_pCpu;
|
uint32_t m_nHeadPageOffset;
|
||||||
|
uint32_t m_nCpuPageIdx;
|
||||||
|
uint32_t m_nCpuPageOffset;
|
||||||
uint64_t m_nStarpakOffset;
|
uint64_t m_nStarpakOffset;
|
||||||
uint64_t m_nStarpakOptOffset;
|
uint64_t m_nStarpakOptOffset;
|
||||||
uint16_t m_nPageEnd;
|
uint16_t m_nPageEnd;
|
||||||
@ -190,13 +192,13 @@ struct RPakDecompState_t
|
|||||||
uint64_t m_nDecompSize;
|
uint64_t m_nDecompSize;
|
||||||
uint64_t m_nInvMaskIn;
|
uint64_t m_nInvMaskIn;
|
||||||
uint64_t m_nInvMaskOut;
|
uint64_t m_nInvMaskOut;
|
||||||
uint32_t header_skip_bytes_bs;
|
uint32_t m_nHeaderOffset;
|
||||||
uint32_t dword44;
|
uint32_t dword44;
|
||||||
uint64_t input_byte_pos;
|
uint64_t m_nInputBytePos;
|
||||||
uint64_t m_nDecompPosition;
|
uint64_t m_nDecompPosition;
|
||||||
uint64_t m_nLengthNeeded;
|
uint64_t m_nLengthNeeded;
|
||||||
uint64_t byte;
|
uint64_t byte;
|
||||||
uint32_t byte_bit_offset;
|
uint32_t m_nByteBitOffset;
|
||||||
uint32_t dword6C;
|
uint32_t dword6C;
|
||||||
uint64_t qword70;
|
uint64_t qword70;
|
||||||
uint64_t m_nCompressedStreamSize;
|
uint64_t m_nCompressedStreamSize;
|
||||||
@ -238,6 +240,20 @@ struct RPakDescriptor_t
|
|||||||
uint32_t m_Offset;
|
uint32_t m_Offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct RPakMemPageInfo_t
|
||||||
|
{
|
||||||
|
uint32_t m_nVirtualSegmentIndex;
|
||||||
|
uint32_t m_nFlags;
|
||||||
|
uint32_t m_nDataSize;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RPakVirtualSegment_t
|
||||||
|
{
|
||||||
|
uint32_t m_nFlags;
|
||||||
|
uint32_t m_nFlags_Unk;
|
||||||
|
uint64_t m_nDataSize;
|
||||||
|
};
|
||||||
|
|
||||||
struct PakFile_t
|
struct PakFile_t
|
||||||
{
|
{
|
||||||
int m_nDescCount;
|
int m_nDescCount;
|
||||||
@ -272,8 +288,8 @@ struct PakFile_t
|
|||||||
char* m_pszStreamingFilePaths;
|
char* m_pszStreamingFilePaths;
|
||||||
char* m_pszOptStreamingFilePaths;
|
char* m_pszOptStreamingFilePaths;
|
||||||
void* m_pVirtualSegments;
|
void* m_pVirtualSegments;
|
||||||
void* m_pMemPages;
|
RPakMemPageInfo_t* m_pMemPages;
|
||||||
void* m_pVirtualPointers;
|
RPakVirtualSegment_t* m_pVirtualPointers;
|
||||||
RPakAssetEntry_t* m_pAssetEntries;
|
RPakAssetEntry_t* m_pAssetEntries;
|
||||||
RPakDescriptor_t* m_pGuidDescriptors;
|
RPakDescriptor_t* m_pGuidDescriptors;
|
||||||
uint32_t* m_pFileRelations;
|
uint32_t* m_pFileRelations;
|
||||||
@ -306,7 +322,7 @@ inline auto RTech_OpenFile = p_RTech_OpenFile.RCast<int32_t(*)(const char*, void
|
|||||||
|
|
||||||
#ifdef GAMEDLL_S3
|
#ifdef GAMEDLL_S3
|
||||||
inline CMemory p_Pak_ProcessGuidRelationsForAsset;
|
inline CMemory p_Pak_ProcessGuidRelationsForAsset;
|
||||||
inline auto RTech_Pak_ProcessGuidRelationsForAsset = p_RTech_OpenFile.RCast<void(__fastcall*)(PakFile_t*, RPakAssetEntry_t*)>();
|
inline auto RTech_Pak_ProcessGuidRelationsForAsset = p_Pak_ProcessGuidRelationsForAsset.RCast<void(__fastcall*)(PakFile_t*, RPakAssetEntry_t*)>();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline CMemory p_StreamDB_Init;
|
inline CMemory p_StreamDB_Init;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user