This commit is contained in:
Ryan Fleury
2025-06-19 08:28:36 -07:00
parent db4831fafb
commit e37ee72feb
4 changed files with 204 additions and 203 deletions
-49
View File
@@ -4,55 +4,6 @@
#include "lib_rdi/rdi.c"
#include "lib_rdi/rdi_parse.c"
////////////////////////////////
//~ rjf: RDI Decompression
internal void
rdi_decompress_parsed(U8 *decompressed_data, U64 decompressed_size, RDI_Parsed *og_rdi)
{
// rjf: copy header
RDI_Header *src_header = (RDI_Header *)og_rdi->raw_data;
RDI_Header *dst_header = (RDI_Header *)decompressed_data;
{
MemoryCopy(dst_header, src_header, sizeof(RDI_Header));
}
// rjf: copy & adjust sections for decompressed version
if(og_rdi->sections_count != 0)
{
RDI_Section *dsec_base = (RDI_Section *)(decompressed_data + dst_header->data_section_off);
MemoryCopy(dsec_base, (U8 *)og_rdi->raw_data + src_header->data_section_off, sizeof(RDI_Section) * og_rdi->sections_count);
U64 off = dst_header->data_section_off + sizeof(RDI_Section) * og_rdi->sections_count;
off += 7;
off -= off%8;
for(U64 idx = 0; idx < og_rdi->sections_count; idx += 1)
{
dsec_base[idx].encoding = RDI_SectionEncoding_Unpacked;
dsec_base[idx].off = off;
dsec_base[idx].encoded_size = dsec_base[idx].unpacked_size;
off += dsec_base[idx].unpacked_size;
off += 7;
off -= off%8;
}
}
// rjf: decompress sections into new decompressed file buffer
if(og_rdi->sections_count != 0)
{
RDI_Section *src_first = og_rdi->sections;
RDI_Section *dst_first = (RDI_Section *)(decompressed_data + dst_header->data_section_off);
RDI_Section *src_opl = src_first + og_rdi->sections_count;
RDI_Section *dst_opl = dst_first + og_rdi->sections_count;
for(RDI_Section *src = src_first, *dst = dst_first;
src < src_opl && dst < dst_opl;
src += 1, dst += 1)
{
rr_lzb_simple_decode((U8*)og_rdi->raw_data + src->off, src->encoded_size,
decompressed_data + dst->off, dst->unpacked_size);
}
}
}
////////////////////////////////
//~ rjf: Lookup Helpers
-5
View File
@@ -64,11 +64,6 @@ read_only global String8 rdi_name_title_from_dump_subset_table[] =
#undef X
};
////////////////////////////////
//~ rjf: RDI Decompression
internal void rdi_decompress_parsed(U8 *decompressed_data, U64 decompressed_size, RDI_Parsed *og_rdi);
////////////////////////////////
//~ rjf: Lookup Helpers