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
r5dev/rtech
@ -106,13 +106,13 @@ uint64_t __fastcall RTech::DecompressPakFileInit(RPakDecompState_t* state, uint8
|
||||
state->m_nDecompPosition = headerSize;
|
||||
decompressed_size_bits = byte_init & 0x3F;
|
||||
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);
|
||||
byte_1_low = *(uint64_t*)((mask & input_byte_pos_init) + file_buf) << (64
|
||||
- ((uint8_t)decompressed_size_bits
|
||||
+ 6));
|
||||
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;
|
||||
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;
|
||||
@ -125,18 +125,18 @@ uint64_t __fastcall RTech::DecompressPakFileInit(RPakDecompState_t* state, uint8
|
||||
byte_bit_offset_final = bit_pos_final & 7;
|
||||
input_byte_pos_final = (bit_pos_final_1 >> 3) + input_byte_pos_1;
|
||||
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)
|
||||
{
|
||||
state->header_skip_bytes_bs = 0;
|
||||
state->m_nHeaderOffset = 0;
|
||||
stream_len_needed = fileSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
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);
|
||||
}
|
||||
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->qword70 = qw70;
|
||||
state->byte = byte_final;
|
||||
state->byte_bit_offset = byte_bit_offset_final;
|
||||
state->m_nByteBitOffset = byte_bit_offset_final;
|
||||
state->dword6C = 0;
|
||||
state->m_nCompressedStreamSize = stream_len_needed + offNoHeader;
|
||||
state->m_nDecompStreamSize = result;
|
||||
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_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)
|
||||
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.
|
||||
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;
|
||||
if (state->m_nCompressedStreamSize < some_size)
|
||||
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;
|
||||
if (decompressed_position == decompressed_size)
|
||||
{
|
||||
state->input_byte_pos = input_byte_pos;
|
||||
state->m_nInputBytePos = input_byte_pos;
|
||||
result = 1;
|
||||
state->m_nDecompPosition = decompressed_position;
|
||||
return result;
|
||||
}
|
||||
|
||||
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;
|
||||
byte_new >>= 1;
|
||||
++byte_bit_offset;
|
||||
@ -494,10 +494,10 @@ uint8_t __fastcall RTech::DecompressPakFile(RPakDecompState_t* state, uint64_t i
|
||||
|
||||
state->dword6C = dword6C;
|
||||
result = 0;
|
||||
state->input_byte_pos = input_byte_pos;
|
||||
state->m_nInputBytePos = input_byte_pos;
|
||||
state->m_nDecompPosition = decompressed_position;
|
||||
state->byte = byte_new;
|
||||
state->byte_bit_offset = byte_bit_offset;
|
||||
state->m_nByteBitOffset = byte_bit_offset;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -113,8 +113,10 @@ struct RPakAssetEntry_t
|
||||
{
|
||||
uint64_t m_Guid;
|
||||
uint64_t m_Padding;
|
||||
void* m_pHead;
|
||||
void* m_pCpu;
|
||||
uint32_t m_nHeadPageIdx;
|
||||
uint32_t m_nHeadPageOffset;
|
||||
uint32_t m_nCpuPageIdx;
|
||||
uint32_t m_nCpuPageOffset;
|
||||
uint64_t m_nStarpakOffset;
|
||||
uint64_t m_nStarpakOptOffset;
|
||||
uint16_t m_nPageEnd;
|
||||
@ -190,13 +192,13 @@ struct RPakDecompState_t
|
||||
uint64_t m_nDecompSize;
|
||||
uint64_t m_nInvMaskIn;
|
||||
uint64_t m_nInvMaskOut;
|
||||
uint32_t header_skip_bytes_bs;
|
||||
uint32_t m_nHeaderOffset;
|
||||
uint32_t dword44;
|
||||
uint64_t input_byte_pos;
|
||||
uint64_t m_nInputBytePos;
|
||||
uint64_t m_nDecompPosition;
|
||||
uint64_t m_nLengthNeeded;
|
||||
uint64_t byte;
|
||||
uint32_t byte_bit_offset;
|
||||
uint32_t m_nByteBitOffset;
|
||||
uint32_t dword6C;
|
||||
uint64_t qword70;
|
||||
uint64_t m_nCompressedStreamSize;
|
||||
@ -238,6 +240,20 @@ struct RPakDescriptor_t
|
||||
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
|
||||
{
|
||||
int m_nDescCount;
|
||||
@ -272,8 +288,8 @@ struct PakFile_t
|
||||
char* m_pszStreamingFilePaths;
|
||||
char* m_pszOptStreamingFilePaths;
|
||||
void* m_pVirtualSegments;
|
||||
void* m_pMemPages;
|
||||
void* m_pVirtualPointers;
|
||||
RPakMemPageInfo_t* m_pMemPages;
|
||||
RPakVirtualSegment_t* m_pVirtualPointers;
|
||||
RPakAssetEntry_t* m_pAssetEntries;
|
||||
RPakDescriptor_t* m_pGuidDescriptors;
|
||||
uint32_t* m_pFileRelations;
|
||||
@ -306,7 +322,7 @@ inline auto RTech_OpenFile = p_RTech_OpenFile.RCast<int32_t(*)(const char*, void
|
||||
|
||||
#ifdef GAMEDLL_S3
|
||||
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
|
||||
|
||||
inline CMemory p_StreamDB_Init;
|
||||
|
Loading…
x
Reference in New Issue
Block a user