2021-12-25 22:36:38 +01:00
# pragma once
2022-08-18 02:15:23 +02:00
# include "tier0/jobthread.h"
2022-08-06 00:16:11 +02:00
# include "vpklib/packedstore.h"
2022-08-18 02:15:23 +02:00
# include "rtech/rtech_game.h"
2022-10-13 21:59:06 +02:00
# ifndef DEDICATED
# include "public/rendersystem/schema/texture.g.h"
# endif // !DEDICATED
2022-08-18 02:15:23 +02:00
2023-02-26 19:43:02 +01:00
# define PAK_MAX_TYPES 64
# define PAK_PARAM_SIZE 0xB0
2021-12-25 22:36:38 +01:00
2023-04-02 01:26:38 +02:00
# define RPAK_MAGIC (('k'<<24)+('a'<<16)+('P'<<8)+'R')
2022-08-11 11:07:45 +02:00
2023-04-02 01:22:11 +02:00
static const inline unsigned char /*unk_141313180*/ s_PakFileCompressionLUT [ 0x720 ] =
{
0x04 , 0xFE , 0xFC , 0x08 , 0x04 , 0xEF , 0x11 , 0xF9 , 0x04 , 0xFD , 0xFC , 0x07 , 0x04 , 0x05 , 0xFF , 0xF4 ,
0x04 , 0xFE , 0xFC , 0x10 , 0x04 , 0xEF , 0x11 , 0xF6 , 0x04 , 0xFD , 0xFC , 0xFB , 0x04 , 0x06 , 0xFF , 0x0B ,
0x04 , 0xFE , 0xFC , 0x08 , 0x04 , 0xEF , 0x11 , 0xF8 , 0x04 , 0xFD , 0xFC , 0x0C , 0x04 , 0x05 , 0xFF , 0xF7 ,
0x04 , 0xFE , 0xFC , 0x10 , 0x04 , 0xEF , 0x11 , 0xF5 , 0x04 , 0xFD , 0xFC , 0xFA , 0x04 , 0x06 , 0xFF , 0xF3 ,
0x04 , 0xFE , 0xFC , 0x08 , 0x04 , 0xEF , 0x11 , 0xF9 , 0x04 , 0xFD , 0xFC , 0x07 , 0x04 , 0x05 , 0xFF , 0xF4 ,
0x04 , 0xFE , 0xFC , 0x10 , 0x04 , 0xEF , 0x11 , 0xF6 , 0x04 , 0xFD , 0xFC , 0xFB , 0x04 , 0x06 , 0xFF , 0x0E ,
0x04 , 0xFE , 0xFC , 0x08 , 0x04 , 0xEF , 0x11 , 0xF8 , 0x04 , 0xFD , 0xFC , 0x0C , 0x04 , 0x05 , 0xFF , 0x09 ,
0x04 , 0xFE , 0xFC , 0x10 , 0x04 , 0xEF , 0x11 , 0xF5 , 0x04 , 0xFD , 0xFC , 0xFA , 0x04 , 0x06 , 0xFF , 0xF1 ,
0x04 , 0xFE , 0xFC , 0x08 , 0x04 , 0xEF , 0x11 , 0xF9 , 0x04 , 0xFD , 0xFC , 0x07 , 0x04 , 0x05 , 0xFF , 0xF4 ,
0x04 , 0xFE , 0xFC , 0x10 , 0x04 , 0xEF , 0x11 , 0xF6 , 0x04 , 0xFD , 0xFC , 0xFB , 0x04 , 0x06 , 0xFF , 0x0D ,
0x04 , 0xFE , 0xFC , 0x08 , 0x04 , 0xEF , 0x11 , 0xF8 , 0x04 , 0xFD , 0xFC , 0x0C , 0x04 , 0x05 , 0xFF , 0xF7 ,
0x04 , 0xFE , 0xFC , 0x10 , 0x04 , 0xEF , 0x11 , 0xF5 , 0x04 , 0xFD , 0xFC , 0xFA , 0x04 , 0x06 , 0xFF , 0xF2 ,
0x04 , 0xFE , 0xFC , 0x08 , 0x04 , 0xEF , 0x11 , 0xF9 , 0x04 , 0xFD , 0xFC , 0x07 , 0x04 , 0x05 , 0xFF , 0xF4 ,
0x04 , 0xFE , 0xFC , 0x10 , 0x04 , 0xEF , 0x11 , 0xF6 , 0x04 , 0xFD , 0xFC , 0xFB , 0x04 , 0x06 , 0xFF , 0x0F ,
0x04 , 0xFE , 0xFC , 0x08 , 0x04 , 0xEF , 0x11 , 0xF8 , 0x04 , 0xFD , 0xFC , 0x0C , 0x04 , 0x05 , 0xFF , 0x0A ,
0x04 , 0xFE , 0xFC , 0x10 , 0x04 , 0xEF , 0x11 , 0xF5 , 0x04 , 0xFD , 0xFC , 0xFA , 0x04 , 0x06 , 0xFF , 0xF0 ,
0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x07 , 0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x11 ,
0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x08 , 0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x0C ,
0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x07 , 0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x09 ,
0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x08 , 0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x0E ,
0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x07 , 0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x11 ,
0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x08 , 0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x0B ,
0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x07 , 0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x0A ,
0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x08 , 0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x10 ,
0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x07 , 0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x11 ,
0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x08 , 0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x0C ,
0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x07 , 0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x09 ,
0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x08 , 0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x0F ,
0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x07 , 0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x11 ,
0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x08 , 0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x0D ,
0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x07 , 0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x0A ,
0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0x08 , 0x04 , 0x05 , 0x04 , 0x06 , 0x04 , 0x05 , 0x04 , 0xFF ,
0x02 , 0x04 , 0x03 , 0x05 , 0x02 , 0x04 , 0x04 , 0x06 , 0x02 , 0x04 , 0x03 , 0x06 , 0x02 , 0x05 , 0x04 , 0x06 ,
0x02 , 0x04 , 0x03 , 0x05 , 0x02 , 0x04 , 0x04 , 0x06 , 0x02 , 0x04 , 0x03 , 0x06 , 0x02 , 0x05 , 0x04 , 0x08 ,
0x02 , 0x04 , 0x03 , 0x05 , 0x02 , 0x04 , 0x04 , 0x06 , 0x02 , 0x04 , 0x03 , 0x06 , 0x02 , 0x05 , 0x04 , 0x07 ,
0x02 , 0x04 , 0x03 , 0x05 , 0x02 , 0x04 , 0x04 , 0x06 , 0x02 , 0x04 , 0x03 , 0x06 , 0x02 , 0x05 , 0x04 , 0x08 ,
0x02 , 0x04 , 0x03 , 0x05 , 0x02 , 0x04 , 0x04 , 0x06 , 0x02 , 0x04 , 0x03 , 0x06 , 0x02 , 0x05 , 0x04 , 0x06 ,
0x02 , 0x04 , 0x03 , 0x05 , 0x02 , 0x04 , 0x04 , 0x06 , 0x02 , 0x04 , 0x03 , 0x06 , 0x02 , 0x05 , 0x04 , 0x08 ,
0x02 , 0x04 , 0x03 , 0x05 , 0x02 , 0x04 , 0x04 , 0x06 , 0x02 , 0x04 , 0x03 , 0x06 , 0x02 , 0x05 , 0x04 , 0x08 ,
0x02 , 0x04 , 0x03 , 0x05 , 0x02 , 0x04 , 0x04 , 0x06 , 0x02 , 0x04 , 0x03 , 0x06 , 0x02 , 0x05 , 0x04 , 0x08 ,
0x02 , 0x04 , 0x03 , 0x05 , 0x02 , 0x04 , 0x04 , 0x06 , 0x02 , 0x04 , 0x03 , 0x06 , 0x02 , 0x05 , 0x04 , 0x06 ,
0x02 , 0x04 , 0x03 , 0x05 , 0x02 , 0x04 , 0x04 , 0x06 , 0x02 , 0x04 , 0x03 , 0x06 , 0x02 , 0x05 , 0x04 , 0x08 ,
0x02 , 0x04 , 0x03 , 0x05 , 0x02 , 0x04 , 0x04 , 0x06 , 0x02 , 0x04 , 0x03 , 0x06 , 0x02 , 0x05 , 0x04 , 0x07 ,
0x02 , 0x04 , 0x03 , 0x05 , 0x02 , 0x04 , 0x04 , 0x06 , 0x02 , 0x04 , 0x03 , 0x06 , 0x02 , 0x05 , 0x04 , 0x08 ,
0x02 , 0x04 , 0x03 , 0x05 , 0x02 , 0x04 , 0x04 , 0x06 , 0x02 , 0x04 , 0x03 , 0x06 , 0x02 , 0x05 , 0x04 , 0x06 ,
0x02 , 0x04 , 0x03 , 0x05 , 0x02 , 0x04 , 0x04 , 0x06 , 0x02 , 0x04 , 0x03 , 0x06 , 0x02 , 0x05 , 0x04 , 0x08 ,
0x02 , 0x04 , 0x03 , 0x05 , 0x02 , 0x04 , 0x04 , 0x06 , 0x02 , 0x04 , 0x03 , 0x06 , 0x02 , 0x05 , 0x04 , 0x08 ,
0x02 , 0x04 , 0x03 , 0x05 , 0x02 , 0x04 , 0x04 , 0x06 , 0x02 , 0x04 , 0x03 , 0x06 , 0x02 , 0x05 , 0x04 , 0x08 ,
0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x06 ,
0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x07 ,
0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x07 ,
0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x08 ,
0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x06 ,
0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x08 ,
0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x07 ,
0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x08 ,
0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x06 ,
0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x07 ,
0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x07 ,
0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x08 ,
0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x06 ,
0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x08 ,
0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x07 ,
0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x03 , 0x01 , 0x02 , 0x01 , 0x08 ,
0x00 , 0x08 , 0x00 , 0x04 , 0x00 , 0x08 , 0x00 , 0x06 , 0x00 , 0x08 , 0x00 , 0x01 , 0x00 , 0x08 , 0x00 , 0x0B ,
0x00 , 0x08 , 0x00 , 0x0C , 0x00 , 0x08 , 0x00 , 0x09 , 0x00 , 0x08 , 0x00 , 0x03 , 0x00 , 0x08 , 0x00 , 0x0E ,
0x00 , 0x08 , 0x00 , 0x04 , 0x00 , 0x08 , 0x00 , 0x07 , 0x00 , 0x08 , 0x00 , 0x02 , 0x00 , 0x08 , 0x00 , 0x0D ,
0x00 , 0x08 , 0x00 , 0x0C , 0x00 , 0x08 , 0x00 , 0x0A , 0x00 , 0x08 , 0x00 , 0x05 , 0x00 , 0x08 , 0x00 , 0x0F ,
0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x06 , 0x01 , 0x02 , 0x01 , 0x06 , 0x01 , 0x02 , 0x01 , 0x06 ,
0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x06 , 0x01 , 0x02 , 0x01 , 0x06 , 0x01 , 0x02 , 0x01 , 0x06 ,
0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x06 , 0x01 , 0x02 , 0x01 , 0x06 , 0x01 , 0x02 , 0x01 , 0x06 ,
0x01 , 0x02 , 0x01 , 0x05 , 0x01 , 0x02 , 0x01 , 0x06 , 0x01 , 0x02 , 0x01 , 0x06 , 0x01 , 0x02 , 0x01 , 0x06 ,
0x4A , 0x00 , 0x00 , 0x00 , 0x6A , 0x00 , 0x00 , 0x00 , 0x8A , 0x00 , 0x00 , 0x00 , 0xAA , 0x00 , 0x00 , 0x00 ,
0xCA , 0x00 , 0x00 , 0x00 , 0xEA , 0x00 , 0x00 , 0x00 , 0x0A , 0x01 , 0x00 , 0x00 , 0x2A , 0x01 , 0x00 , 0x00 ,
0x4A , 0x01 , 0x00 , 0x00 , 0x6A , 0x01 , 0x00 , 0x00 , 0x8A , 0x01 , 0x00 , 0x00 , 0xAA , 0x01 , 0x00 , 0x00 ,
0xAA , 0x03 , 0x00 , 0x00 , 0xAA , 0x05 , 0x00 , 0x00 , 0xAA , 0x25 , 0x00 , 0x00 , 0xAA , 0x25 , 0x02 , 0x00 ,
0x05 , 0x05 , 0x05 , 0x05 , 0x05 , 0x05 , 0x05 , 0x05 , 0x05 , 0x05 , 0x05 , 0x09 , 0x09 , 0x0D , 0x11 , 0x15 ,
0x00 , 0x00 , 0x02 , 0x04 , 0x06 , 0x08 , 0x0A , 0x2A , 0x00 , 0x01 , 0x01 , 0x01 , 0x01 , 0x01 , 0x05 , 0x05 ,
0x11 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x02 , 0x00 , 0x00 , 0x00 , 0x02 , 0x00 , 0x00 , 0x00 , 0x02 , 0x00 , 0x00 , 0x00 , 0x02 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0xBF , 0x00 , 0x00 , 0x00 , 0xBF , 0x00 , 0x00 , 0x00 , 0xBF , 0x00 , 0x00 , 0x00 , 0xBF ,
0xA8 , 0xAA , 0x2A , 0xBE , 0xA8 , 0xAA , 0x2A , 0xBE , 0xA8 , 0xAA , 0x2A , 0xBE , 0xA8 , 0xAA , 0x2A , 0xBE ,
0xD2 , 0x85 , 0x08 , 0x3C , 0xD2 , 0x85 , 0x08 , 0x3C , 0xD2 , 0x85 , 0x08 , 0x3C , 0xD2 , 0x85 , 0x08 , 0x3C ,
0x83 , 0xF9 , 0x22 , 0x3F , 0x83 , 0xF9 , 0x22 , 0x3F , 0x83 , 0xF9 , 0x22 , 0x3F , 0x83 , 0xF9 , 0x22 , 0x3F ,
0x01 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x10 , 0xC9 , 0x3F , 0x00 , 0x10 , 0xC9 , 0x3F , 0x00 , 0x10 , 0xC9 , 0x3F , 0x00 , 0x10 , 0xC9 , 0x3F ,
0x00 , 0x00 , 0x00 , 0x3F , 0x00 , 0x00 , 0x00 , 0x3F , 0x00 , 0x00 , 0x00 , 0x3F , 0x00 , 0x00 , 0x00 , 0x3F ,
0x02 , 0x61 , 0x4D , 0xB9 , 0x02 , 0x61 , 0x4D , 0xB9 , 0x02 , 0x61 , 0x4D , 0xB9 , 0x02 , 0x61 , 0x4D , 0xB9 ,
0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x07 , 0x08 , 0x09 , 0x0A , 0x0B , 0x0C , 0x0D , 0x0E , 0x0F ,
0x10 , 0x11 , 0x12 , 0x13 , 0x14 , 0x15 , 0x16 , 0x17 , 0x18 , 0x19 , 0x1A , 0x1B , 0x1C , 0x1D , 0x1E , 0x1F ,
0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 ,
0xC2 , 0x14 , 0xCF , 0x37 , 0xC2 , 0x14 , 0xCF , 0x37 , 0xC2 , 0x14 , 0xCF , 0x37 , 0xC2 , 0x14 , 0xCF , 0x37 ,
0x9E , 0x4B , 0x6F , 0xB0 , 0x9E , 0x4B , 0x6F , 0xB0 , 0x9E , 0x4B , 0x6F , 0xB0 , 0x9E , 0x4B , 0x6F , 0xB0 ,
0x00 , 0x01 , 0x02 , 0x03 , 0x04 , 0x05 , 0x06 , 0x00 , 0x03 , 0x00 , 0x00 , 0x00 , 0x07 , 0x00 , 0x00 , 0x00 ,
0x06 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x60 , 0xF1 , 0x1D , 0xC1 , 0xF6 , 0x7F , 0x00 , 0x00 ,
0x22 , 0x0B , 0xB6 , 0xBA , 0x22 , 0x0B , 0xB6 , 0xBA , 0x22 , 0x0B , 0xB6 , 0xBA , 0x22 , 0x0B , 0xB6 , 0xBA ,
0x00 , 0x00 , 0x00 , 0x3F , 0x00 , 0x00 , 0x00 , 0x3F , 0x00 , 0x00 , 0x00 , 0x3F , 0x00 , 0x00 , 0x00 , 0x3F ,
0x02 , 0x61 , 0x4D , 0xB9 , 0x02 , 0x61 , 0x4D , 0xB9 , 0x02 , 0x61 , 0x4D , 0xB9 , 0x02 , 0x61 , 0x4D , 0xB9 ,
0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 ,
0xC2 , 0x14 , 0xCF , 0x37 , 0xC2 , 0x14 , 0xCF , 0x37 , 0xC2 , 0x14 , 0xCF , 0x37 , 0xC2 , 0x14 , 0xCF , 0x37 ,
0x9E , 0x4B , 0x6F , 0xB0 , 0x9E , 0x4B , 0x6F , 0xB0 , 0x9E , 0x4B , 0x6F , 0xB0 , 0x9E , 0x4B , 0x6F , 0xB0 ,
0x22 , 0x0B , 0xB6 , 0xBA , 0x22 , 0x0B , 0xB6 , 0xBA , 0x22 , 0x0B , 0xB6 , 0xBA , 0x22 , 0x0B , 0xB6 , 0xBA ,
0x00 , 0x70 , 0x95 , 0xB6 , 0x00 , 0x70 , 0x95 , 0xB6 , 0x00 , 0x70 , 0x95 , 0xB6 , 0x00 , 0x70 , 0x95 , 0xB6 ,
0xA9 , 0xAA , 0x2A , 0x3D , 0xA9 , 0xAA , 0x2A , 0x3D , 0xA9 , 0xAA , 0x2A , 0x3D , 0xA9 , 0xAA , 0x2A , 0x3D ,
0x00 , 0x00 , 0x80 , 0x3F , 0x00 , 0x00 , 0x80 , 0x3F , 0x00 , 0x00 , 0x80 , 0x3F , 0x00 , 0x00 , 0x80 , 0x3F ,
0x02 , 0x00 , 0x00 , 0x00 , 0x02 , 0x00 , 0x00 , 0x00 , 0x02 , 0x00 , 0x00 , 0x00 , 0x02 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x00 , 0x00 , 0xBF , 0x00 , 0x00 , 0x00 , 0xBF , 0x00 , 0x00 , 0x00 , 0xBF , 0x00 , 0x00 , 0x00 , 0xBF ,
0xA8 , 0xAA , 0x2A , 0xBE , 0xA8 , 0xAA , 0x2A , 0xBE , 0xA8 , 0xAA , 0x2A , 0xBE , 0xA8 , 0xAA , 0x2A , 0xBE ,
0xD2 , 0x85 , 0x08 , 0x3C , 0xD2 , 0x85 , 0x08 , 0x3C , 0xD2 , 0x85 , 0x08 , 0x3C , 0xD2 , 0x85 , 0x08 , 0x3C ,
0x83 , 0xF9 , 0x22 , 0x3F , 0x83 , 0xF9 , 0x22 , 0x3F , 0x83 , 0xF9 , 0x22 , 0x3F , 0x83 , 0xF9 , 0x22 , 0x3F ,
0x01 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 ,
0x00 , 0x10 , 0xC9 , 0x3F , 0x00 , 0x10 , 0xC9 , 0x3F , 0x00 , 0x10 , 0xC9 , 0x3F , 0x00 , 0x10 , 0xC9 , 0x3F ,
0x4C , 0x39 , 0x56 , 0x75 , 0x42 , 0x52 , 0x65 , 0x75 , 0x70 , 0x35 , 0x31 , 0x77 , 0x4C , 0x51 , 0x64 , 0x61 ,
} ;
2021-12-25 22:36:38 +01:00
2022-08-06 00:16:11 +02:00
enum class RPakStatus_t : int32_t
2022-03-23 20:31:29 +01:00
{
PAK_STATUS_FREED = 0 ,
PAK_STATUS_LOAD_PENDING = 1 ,
PAK_STATUS_REPAK_RUNNING = 2 ,
PAK_STATUS_REPAK_DONE = 3 ,
PAK_STATUS_LOAD_STARTING = 4 ,
PAK_STATUS_LOAD_PAKHDR = 5 ,
PAK_STATUS_LOAD_PATCH_INIT = 6 ,
PAK_STATUS_LOAD_PATCH_EDIT_STREAM = 7 ,
PAK_STATUS_LOAD_ASSETS = 8 ,
PAK_STATUS_LOADED = 9 ,
PAK_STATUS_UNLOAD_PENDING = 10 ,
PAK_STATUS_FREE_PENDING = 11 ,
PAK_STATUS_CANCELING = 12 ,
PAK_STATUS_ERROR = 13 ,
PAK_STATUS_INVALID_PAKHANDLE = 14 ,
PAK_STATUS_BUSY = 15
} ;
2022-07-20 11:27:42 +02:00
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 ;
2022-12-20 22:56:55 +01:00
void * m_pAllocAssetFunctions ;
2022-07-20 11:27:42 +02:00
int m_iSubHeaderSize ;
int m_iNativeClassSize ; // Native class size, for 'material' it would be CMaterialGlue full size.
2022-12-20 22:56:55 +01:00
uint32_t m_HeaderAlignment ;
2022-07-20 11:27:42 +02:00
int unk3 ;
// [ PIXIE ]: Should be the full size across Season 0-3.
} ;
2022-11-01 00:44:09 +01:00
struct RPakAssetEntry_t
2022-10-30 20:17:50 +01:00
{
uint64_t m_Guid ;
uint64_t m_Padding ;
2022-11-25 23:01:59 +01:00
uint32_t m_nHeadPageIdx ;
uint32_t m_nHeadPageOffset ;
uint32_t m_nCpuPageIdx ;
uint32_t m_nCpuPageOffset ;
2022-10-30 20:17:50 +01:00
uint64_t m_nStarpakOffset ;
uint64_t m_nStarpakOptOffset ;
uint16_t m_nPageEnd ;
uint16_t unk1 ;
uint32_t m_nRelationsStartIdx ;
uint32_t m_nUsesStartIdx ;
uint32_t m_nRelationsCount ;
uint32_t m_nUsesCount ;
uint32_t m_nAssetHeaderSize ;
uint32_t m_nVersion ;
uint32_t m_nMagic ;
} ;
struct RPakAssetEntryShort
{
uint64_t m_Guid ;
uint64_t m_Padding ;
void * m_pHead ;
void * m_pCpu ;
} ;
2023-01-31 16:09:30 +01:00
struct RPakGlobals_t
2022-07-20 11:27:42 +02:00
{
RPakAssetBinding_t m_nAssetBindings [ 64 ] ; // [ PIXIE ]: Max possible registered assets on Season 3, 0-2 I did not check yet.
2022-10-30 20:17:50 +01:00
RPakAssetEntryShort m_Assets [ 0x40000 ] ;
2022-07-20 11:27:42 +02:00
// End size unknown.
} ;
2022-03-23 20:31:29 +01:00
2022-02-13 17:13:54 +01:00
struct RPakHeader_t
2021-12-25 22:36:38 +01:00
{
2022-09-18 13:55:44 +02:00
uint32_t m_nMagic ; // 'RPak'
uint16_t m_nVersion ; // R2 = '7' R5 = '8'
uint8_t m_nFlags [ 0x2 ] ; //
2022-11-25 00:57:32 +01:00
FILETIME m_nFileTime ; //
2022-11-25 00:11:17 +01:00
uint64_t m_nHash ; //
2022-09-18 13:55:44 +02:00
uint64_t m_nSizeDisk ; // Compressed size
uint64_t m_nEmbeddedStarpakOffset ; //
uint8_t unk0 [ 0x8 ] ; //
uint64_t m_nSizeMemory ; // Decompressed size
uint64_t m_nEmbeddedStarpakSize ; //
uint8_t unk1 [ 0x8 ] ; //
2022-08-06 00:16:11 +02:00
2022-09-18 13:55:44 +02:00
uint16_t m_nStarpakReferenceSize ; //
uint16_t m_nStarpakOptReferenceSize ; //
uint16_t m_nVirtualSegmentCount ; // * 0x10
uint16_t m_nMemPageCount ; // * 0xC
2022-08-06 00:16:11 +02:00
2022-09-18 13:55:44 +02:00
uint32_t m_nPatchIndex ; //
2022-08-06 00:16:11 +02:00
2022-09-18 13:55:44 +02:00
uint32_t m_nDescriptorCount ; //
uint32_t m_nAssetEntryCount ; // File entry count
uint32_t m_nGuidDescriptorCount ; //
uint32_t m_nRelationsCounts ; //
2022-08-06 00:16:11 +02:00
2022-09-18 13:55:44 +02:00
uint8_t unk2 [ 0x10 ] ; //
uint32_t m_nMemPageOffset ; // Size not verified. Offsets every page by x amount, if not 0 start of first page has data corresponding for 'patching some page'
uint8_t unk3 [ 0x8 ] ; //
2021-12-25 22:36:38 +01:00
} ;
2022-11-24 15:41:52 +01:00
struct RPakPatchCompressedHeader_t
2021-12-27 20:44:37 +01:00
{
2022-08-06 00:16:11 +02:00
uint64_t m_nSizeDisk ;
uint64_t m_nSizeMemory ;
2021-12-27 20:44:37 +01:00
} ;
2022-11-24 15:41:52 +01:00
struct RPakDecompState_t
2021-12-26 02:30:20 +01:00
{
2022-08-06 00:16:11 +02:00
uint64_t m_nInputBuf ;
uint64_t m_nOut ;
uint64_t m_nMask ;
uint64_t m_nOutMask ;
uint64_t m_nTotalFileLen ;
uint64_t m_nDecompSize ;
uint64_t m_nInvMaskIn ;
uint64_t m_nInvMaskOut ;
2022-11-25 23:01:59 +01:00
uint32_t m_nHeaderOffset ;
2022-08-06 00:16:11 +02:00
uint32_t dword44 ;
2022-11-25 23:01:59 +01:00
uint64_t m_nInputBytePos ;
2022-08-06 00:16:11 +02:00
uint64_t m_nDecompPosition ;
uint64_t m_nLengthNeeded ;
uint64_t byte ;
2022-11-25 23:01:59 +01:00
uint32_t m_nByteBitOffset ;
2022-08-06 00:16:11 +02:00
uint32_t dword6C ;
uint64_t qword70 ;
uint64_t m_nCompressedStreamSize ;
uint64_t m_nDecompStreamSize ;
2021-12-26 02:30:20 +01:00
} ;
2022-03-23 20:31:29 +01:00
class RPakLoadedInfo_t
{
public :
2022-08-29 17:00:50 +02:00
RPakHandle_t m_nHandle ; //0x0000
2022-03-23 20:31:29 +01:00
RPakStatus_t m_nStatus ; //0x0004
2022-08-06 00:16:11 +02:00
uint64_t m_nUnk1 ; //0x0008
uint32_t m_nUnk2 ; //0x0010
uint32_t m_nAssetCount ; //0x0014
2022-03-23 20:31:29 +01:00
char * m_pszFileName ; //0x0018
2022-05-17 01:33:45 +02:00
void * m_pMalloc ; //0x0020
2022-08-06 00:16:11 +02:00
uint64_t * m_pAssetGuids ; //0x0028 size of the array is m_nAssetCount
2023-03-20 00:05:04 +01:00
# if defined (GAMEDLL_S3)
2022-09-18 13:55:44 +02:00
void * m_pVSegBuffers [ 4 ] ; //0x0030
char pad_0050 [ 16 ] ; //0x0050
void * m_pPakInfo ; //0x0060
RPakLoadedInfo_t * m_pUnknownLoadedPakInfo ; //0x0068
char pad_0070 [ 4 ] ; //0x0070
int8_t m_nUnk3 ; //0x0074
char pad_0075 [ 51 ] ; //0x0075
uint32_t m_nUnk4 ; //0x00A8
uint8_t m_nUnk5 ; //0x00AC
# endif
2023-03-20 00:05:04 +01:00
# if !defined (GAMEDLL_S3)
2022-09-18 13:55:44 +02:00
char pad_0030 [ 128 ] ; //0x0030
char pad_00B0 [ 48 ] ; //0x00B0
2022-05-17 01:33:45 +02:00
# endif // !GAMEDLL_S3
2022-09-18 13:55:44 +02:00
uint64_t m_nUnkEnd ; //0x00B0/0x00E8
2022-05-17 01:33:45 +02:00
} ; //Size: 0x00B8/0x00E8
2022-03-23 20:31:29 +01:00
2022-11-01 00:44:09 +01:00
struct RPakDescriptor_t
2022-10-30 20:17:50 +01:00
{
2022-11-25 23:16:13 +01:00
uint32_t m_Index ;
2022-10-30 20:17:50 +01:00
uint32_t m_Offset ;
} ;
2022-11-25 23:01:59 +01:00
struct RPakMemPageInfo_t
{
uint32_t m_nVirtualSegmentIndex ;
2022-11-25 23:12:23 +01:00
uint32_t m_nPageAlignment ;
2022-11-25 23:01:59 +01:00
uint32_t m_nDataSize ;
} ;
struct RPakVirtualSegment_t
{
uint32_t m_nFlags ;
2022-11-25 23:12:23 +01:00
uint32_t m_nAlignment ;
2022-11-25 23:01:59 +01:00
uint64_t m_nDataSize ;
} ;
2023-03-01 00:09:38 +01:00
struct PakFile_t // !TODO: Map out on S1 and S2!
2022-10-30 20:17:50 +01:00
{
int m_nDescCount ;
int m_nProcessedAssetCount ;
int m_nPageEnd ;
int m_nPageStart ;
uint32_t m_nPatchIndex_maybe ;
uint32_t dword14 ;
char gap18 [ 184 ] ;
uint32_t unsigned_intD0 ;
char gapD4 [ 284 ] ;
uint64_t m_nInputBytePos ;
uint8_t byte1F8 ;
char gap1F9 [ 4 ] ;
uint8_t byte1FD ;
uint8_t byte1FE ;
uint8_t byte200 ;
RPakDecompState_t m_PakDecompState ;
uint64_t qword288 ;
uint64_t qword290 ;
uint64_t qword298 ;
uint64_t qword2A0 ;
char * m_PatchData ;
char gap2B0 [ 696 ] ;
unsigned __int8 ( __fastcall * pfunc568 ) ( __int64 , LARGE_INTEGER * , unsigned __int64 ) ;
uint64_t qword570 ;
uint64_t qword578 ;
int * qword580 ;
uint8_t * * m_ppPagePointers ;
void * m_pPatchCompressPairs ;
uint64_t qword598 ;
char * m_pszStreamingFilePaths ;
char * m_pszOptStreamingFilePaths ;
void * m_pVirtualSegments ;
2022-11-25 23:01:59 +01:00
RPakMemPageInfo_t * m_pMemPages ;
2022-11-25 23:16:13 +01:00
RPakDescriptor_t * m_pVirtualPointers ;
2022-11-01 00:44:09 +01:00
RPakAssetEntry_t * m_pAssetEntries ;
RPakDescriptor_t * m_pGuidDescriptors ;
2022-10-30 20:17:50 +01:00
uint32_t * m_pFileRelations ;
char gap5E0 [ 40 ] ;
2022-11-01 00:44:09 +01:00
RPakAssetEntry_t * * m_ppAssetEntries ;
2023-03-01 00:09:38 +01:00
char gap610 [ 256 ] ;
# if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) // TODO: needs to be checked.
char gap710 [ 256 ] ;
# if !defined (GAMEDLL_S2)
char gap810 [ 8 ] ;
# endif // !(GAMEDLL_S0) || !(GAMEDLL_S1) || !(GAMEDLL_S2)
# endif
2022-10-30 20:17:50 +01:00
const char * m_pszFileName ;
RPakHeader_t m_PakHdr ;
} ;
2023-03-01 00:09:38 +01:00
# if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1)
# if !defined (GAMEDLL_S2)
static_assert ( sizeof ( PakFile_t ) = = 2208 ) ; // S3+
# else
static_assert ( sizeof ( PakFile_t ) = = 2200 ) ; // S2
# endif // !GAMEDLL_S2
# else
static_assert ( sizeof ( PakFile_t ) = = 1944 ) ; // S0/S1
# endif // !GAMEDLL_S0 && !GAMEDLL_S1
2022-11-24 15:41:52 +01:00
static_assert ( sizeof ( RPakDecompState_t ) = = 136 ) ;
static_assert ( sizeof ( RPakPatchCompressedHeader_t ) = = 16 ) ;
2022-04-09 02:18:57 +02:00
/* ==== RTECH =========================================================================================================================================================== */
2023-03-20 00:05:04 +01:00
# if !defined (DEDICATED)
2022-06-19 18:07:43 +02:00
inline CMemory p_RTech_CreateDXTexture ;
2022-10-13 21:59:06 +02:00
inline auto RTech_CreateDXTexture = p_RTech_CreateDXTexture . RCast < void ( * ) ( TextureHeader_t * , int64_t ) > ( ) ;
2022-07-20 22:50:55 +01:00
inline CMemory p_GetStreamOverlay ;
2022-07-21 17:05:19 +01:00
inline auto GetStreamOverlay = p_GetStreamOverlay . RCast < void ( * ) ( const char * mode , char * buf , size_t bufSize ) > ( ) ;
2022-06-19 18:07:43 +02:00
# endif
2022-08-06 00:16:11 +02:00
// [ PIXIE ]: I'm very unsure about this, but it really seems like it
inline CMemory p_RTech_FindFreeSlotInFiles ;
inline auto RTech_FindFreeSlotInFiles = p_RTech_FindFreeSlotInFiles . RCast < int32_t ( * ) ( int32_t * ) > ( ) ;
inline CMemory p_RTech_OpenFile ;
inline auto RTech_OpenFile = p_RTech_OpenFile . RCast < int32_t ( * ) ( const char * , void * , int64_t * ) > ( ) ;
2022-12-20 01:03:59 +01:00
inline CMemory p_RTech_RegisterAsset ;
inline auto RTech_RegisterAsset = p_RTech_RegisterAsset . RCast < void ( * ) ( int , int , const char * , void * , void * , void * , void * , int , int , uint32_t , int , int ) > ( ) ;
2022-10-30 20:17:50 +01:00
# ifdef GAMEDLL_S3
inline CMemory p_Pak_ProcessGuidRelationsForAsset ;
2022-11-25 23:01:59 +01:00
inline auto RTech_Pak_ProcessGuidRelationsForAsset = p_Pak_ProcessGuidRelationsForAsset . RCast < void ( __fastcall * ) ( PakFile_t * , RPakAssetEntry_t * ) > ( ) ;
2022-10-30 20:17:50 +01:00
# endif
2022-08-18 02:15:23 +02:00
inline CMemory p_StreamDB_Init ;
inline auto v_StreamDB_Init = p_StreamDB_Init . RCast < void ( * ) ( const char * pszLevelName ) > ( ) ;
2022-04-18 03:35:08 +02:00
inline RPakLoadedInfo_t * g_pLoadedPakInfo ;
2023-01-31 16:09:30 +01:00
inline int16_t * g_pRequestedPakCount ;
inline int16_t * g_pLoadedPakCount ;
inline JobID_t * g_pPakLoadJobID ;
inline RPakGlobals_t * g_pPakGlobals ;
2021-12-25 22:36:38 +01:00
2022-08-06 00:16:11 +02:00
inline int32_t * s_pFileArray ;
2023-01-31 16:09:30 +01:00
inline PSRWLOCK * s_pFileArrayMutex ;
inline pFileHandleTracker_t * s_pFileHandles ;
2022-08-06 00:16:11 +02:00
2022-08-18 02:15:23 +02:00
inline JobFifoLock_s * g_pPakFifoLock ;
2022-09-09 19:47:31 +02:00
inline void * g_pPakFifoLockWrapper ; // Pointer to functor that takes the global pak fifolock as argument.
2022-08-18 02:15:23 +02:00
inline bool * g_bPakFifoLockAcquired ;
2021-12-25 22:36:38 +01:00
class RTech
{
public :
2022-08-06 00:16:11 +02:00
uint64_t __fastcall StringToGuid ( const char * pData ) ;
uint8_t __fastcall DecompressPakFile ( RPakDecompState_t * state , uint64_t inLen , uint64_t outLen ) ;
uint64_t __fastcall DecompressPakFileInit ( RPakDecompState_t * state , uint8_t * fileBuffer , uint64_t fileSize , uint64_t offNoHeader , uint64_t headerSize ) ;
2022-08-29 17:00:50 +02:00
RPakLoadedInfo_t * GetPakLoadedInfo ( RPakHandle_t nPakId ) ;
2022-05-19 00:47:16 +02:00
RPakLoadedInfo_t * GetPakLoadedInfo ( const char * szPakName ) ;
2023-02-26 19:43:02 +01:00
const char * PakStatusToString ( RPakStatus_t status ) ;
2022-06-19 18:07:43 +02:00
2022-08-18 12:34:33 +02:00
static int32_t OpenFile ( const CHAR * szFilePath , void * unused , LONGLONG * fileSizeOut ) ;
2022-10-30 20:17:50 +01:00
# ifdef GAMEDLL_S3
2022-11-01 00:44:09 +01:00
static void PakProcessGuidRelationsForAsset ( PakFile_t * pak , RPakAssetEntry_t * asset ) ;
2023-03-01 00:09:38 +01:00
# endif // GAMEDLL_S3
2022-10-30 20:17:50 +01:00
2023-03-20 00:05:04 +01:00
# if !defined (DEDICATED)
2022-10-13 21:59:06 +02:00
static void CreateDXTexture ( TextureHeader_t * textureHeader , int64_t cpuArg ) ;
2022-07-04 22:52:10 +02:00
void * * LoadShaderSet ( void * * VTablePtr ) ;
2022-08-18 02:15:23 +02:00
# endif // !DEDICATED
2021-12-25 22:36:38 +01:00
} ;
///////////////////////////////////////////////////////////////////////////////
2022-03-28 18:47:11 +02:00
extern RTech * g_pRTech ;
2022-04-18 03:35:08 +02:00
///////////////////////////////////////////////////////////////////////////////
2023-01-25 02:26:52 +01:00
class V_RTechUtils : public IDetour
2022-04-18 03:35:08 +02:00
{
virtual void GetAdr ( void ) const
{
2023-03-20 00:05:04 +01:00
# if !defined (DEDICATED)
2023-01-25 02:26:52 +01:00
LogFunAdr ( " RTech::CreateDXTexture " , p_RTech_CreateDXTexture . GetPtr ( ) ) ;
2022-08-18 02:15:23 +02:00
# endif // !DEDICATED
2023-01-25 02:26:52 +01:00
LogFunAdr ( " RTech::FindFreeSlotInFiles " , p_RTech_FindFreeSlotInFiles . GetPtr ( ) ) ;
LogFunAdr ( " RTech::OpenFile " , p_RTech_OpenFile . GetPtr ( ) ) ;
2023-03-20 00:05:04 +01:00
# if !defined (DEDICATED)
2023-01-25 02:26:52 +01:00
LogFunAdr ( " GetStreamOverlay " , p_GetStreamOverlay . GetPtr ( ) ) ;
2022-08-18 02:15:23 +02:00
# endif // !DEDICATED
2023-01-25 02:26:52 +01:00
LogFunAdr ( " StreamDB_Init " , p_StreamDB_Init . GetPtr ( ) ) ;
2023-01-31 16:09:30 +01:00
LogVarAdr ( " s_FileArray " , reinterpret_cast < uintptr_t > ( s_pFileArray ) ) ;
LogVarAdr ( " s_FileArrayMutex " , reinterpret_cast < uintptr_t > ( s_pFileArrayMutex ) ) ;
LogVarAdr ( " s_FileHandles " , reinterpret_cast < uintptr_t > ( s_pFileHandles ) ) ;
LogVarAdr ( " g_loadedPakInfo " , reinterpret_cast < uintptr_t > ( g_pLoadedPakInfo ) ) ;
LogVarAdr ( " g_loadedPakCount " , reinterpret_cast < uintptr_t > ( g_pLoadedPakCount ) ) ;
LogVarAdr ( " g_requestedPakCount " , reinterpret_cast < uintptr_t > ( g_pRequestedPakCount ) ) ;
LogVarAdr ( " g_pakGlobals " , reinterpret_cast < uintptr_t > ( g_pPakGlobals ) ) ;
LogVarAdr ( " g_pakLoadJobID " , reinterpret_cast < uintptr_t > ( g_pPakLoadJobID ) ) ;
LogVarAdr ( " g_pakFifoLock " , reinterpret_cast < uintptr_t > ( g_pPakFifoLock ) ) ;
LogVarAdr ( " g_pakFifoLockWrapper " , reinterpret_cast < uintptr_t > ( g_pPakFifoLockWrapper ) ) ;
LogVarAdr ( " g_pakFifoLockAcquired " , reinterpret_cast < uintptr_t > ( g_bPakFifoLockAcquired ) ) ;
2022-04-18 03:35:08 +02:00
}
2022-06-19 18:07:43 +02:00
virtual void GetFun ( void ) const
{
2023-03-20 00:05:04 +01:00
# if !defined (DEDICATED)
2022-08-18 02:15:23 +02:00
# if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
2022-12-01 22:44:55 +01:00
p_RTech_CreateDXTexture = g_GameDll . FindPatternSIMD ( " 48 8B C4 48 89 48 08 53 55 41 55 " ) ;
2022-12-20 01:04:45 +01:00
RTech_CreateDXTexture = p_RTech_CreateDXTexture . RCast < void ( * ) ( TextureHeader_t * , int64_t ) > ( ) ; /*48 8B C4 48 89 48 08 53 55 41 55*/
2022-08-18 02:15:23 +02:00
# elif defined (GAMEDLL_S2) || defined (GAMEDLL_S3)
2022-12-01 22:44:55 +01:00
p_RTech_CreateDXTexture = g_GameDll . FindPatternSIMD ( " E8 ?? ?? ?? ?? 4C 8B C7 48 8B D5 48 8B CB 48 83 C4 60 " ) . FollowNearCallSelf ( ) ;
2022-10-13 21:59:06 +02:00
RTech_CreateDXTexture = p_RTech_CreateDXTexture . RCast < void ( * ) ( TextureHeader_t * , int64_t ) > ( ) ; /*E8 ? ? ? ? 4C 8B C7 48 8B D5 48 8B CB 48 83 C4 60*/
2022-08-18 02:15:23 +02:00
# endif
2022-12-01 22:44:55 +01:00
p_GetStreamOverlay = g_GameDll . FindPatternSIMD ( " E8 ?? ?? ?? ?? 80 7C 24 ?? ?? 0F 84 ?? ?? ?? ?? 48 89 9C 24 ?? ?? ?? ?? " ) . FollowNearCallSelf ( ) ;
2022-08-06 00:16:11 +02:00
GetStreamOverlay = p_GetStreamOverlay . RCast < void ( * ) ( const char * , char * , size_t ) > ( ) ; /*E8 ? ? ? ? 80 7C 24 ? ? 0F 84 ? ? ? ? 48 89 9C 24 ? ? ? ?*/
2022-08-18 02:15:23 +02:00
# endif // !DEDICATED
2022-12-01 22:44:55 +01:00
p_StreamDB_Init = g_GameDll . FindPatternSIMD ( " 48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 54 41 56 41 57 48 83 EC 40 48 8B E9 " ) ;
2022-08-18 02:15:23 +02:00
v_StreamDB_Init = p_StreamDB_Init . RCast < void ( * ) ( const char * ) > ( ) ; /*48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 54 41 56 41 57 48 83 EC 40 48 8B E9*/
2022-08-06 00:16:11 +02:00
2022-12-01 22:44:55 +01:00
p_RTech_FindFreeSlotInFiles = g_GameDll . FindPatternSIMD ( " 44 8B 51 0C 4C 8B C1 " ) ;
2022-08-06 00:16:11 +02:00
RTech_FindFreeSlotInFiles = p_RTech_FindFreeSlotInFiles . RCast < int32_t ( * ) ( int32_t * ) > ( ) ; /*44 8B 51 0C 4C 8B C1*/
2022-12-01 22:44:55 +01:00
p_RTech_OpenFile = g_GameDll . FindPatternSIMD ( " E8 ?? ?? ?? ?? 89 85 08 01 ?? ?? " ) . FollowNearCallSelf ( ) ;
2022-08-06 00:16:11 +02:00
RTech_OpenFile = p_RTech_OpenFile . RCast < int32_t ( * ) ( const char * , void * , int64_t * ) > ( ) ; /*E8 ? ? ? ? 89 85 08 01 00 00*/
2022-10-30 20:17:50 +01:00
2022-12-20 01:03:59 +01:00
p_RTech_RegisterAsset = g_GameDll . FindPatternSIMD ( " 4D 89 42 08 " ) . FindPatternSelf ( " 48 89 6C " , CMemory : : Direction : : UP ) ;
RTech_RegisterAsset = p_RTech_RegisterAsset . RCast < void ( * ) ( int , int , const char * , void * , void * , void * , void * , int , int , uint32_t , int , int ) > ( ) ; /*4D 89 42 08*/
2022-10-30 20:17:50 +01:00
# ifdef GAMEDLL_S3
2022-12-01 22:44:55 +01:00
p_Pak_ProcessGuidRelationsForAsset = g_GameDll . FindPatternSIMD ( " E8 ?? ?? ?? ?? 48 8B 86 ?? ?? ?? ?? 42 8B 0C B0 " ) . FollowNearCallSelf ( ) ;
2022-11-01 00:44:09 +01:00
RTech_Pak_ProcessGuidRelationsForAsset = p_Pak_ProcessGuidRelationsForAsset . RCast < void ( __fastcall * ) ( PakFile_t * , RPakAssetEntry_t * ) > ( ) ; /*E8 ? ? ? ? 48 8B 86 ? ? ? ? 42 8B 0C B0*/
2022-10-30 20:17:50 +01:00
# endif
2022-06-19 18:07:43 +02:00
}
2022-04-18 03:35:08 +02:00
virtual void GetVar ( void ) const
{
2023-01-31 16:09:30 +01:00
s_pFileArray = p_StreamDB_Init . Offset ( 0x70 ) . FindPatternSelf ( " 48 8D 0D " , CMemory : : Direction : : DOWN , 512 , 2 ) . ResolveRelativeAddress ( 0x3 , 0x7 ) . RCast < int32_t * > ( ) ;
s_pFileHandles = p_StreamDB_Init . Offset ( 0x70 ) . FindPatternSelf ( " 4C 8D " , CMemory : : Direction : : DOWN , 512 , 1 ) . ResolveRelativeAddress ( 0x3 , 0x7 ) . RCast < pFileHandleTracker_t * > ( ) ;
s_pFileArrayMutex = p_StreamDB_Init . Offset ( 0x70 ) . FindPatternSelf ( " 48 8D 0D " , CMemory : : Direction : : DOWN , 512 , 1 ) . ResolveRelativeAddress ( 0x3 , 0x7 ) . RCast < PSRWLOCK * > ( ) ;
2022-08-06 00:16:11 +02:00
2023-01-31 16:09:30 +01:00
g_pLoadedPakInfo = p_CPakFile_UnloadPak . FindPattern ( " 48 8D 05 " , CMemory : : Direction : : DOWN ) . ResolveRelativeAddressSelf ( 0x3 , 0x7 ) . RCast < RPakLoadedInfo_t * > ( ) ;
g_pRequestedPakCount = p_CPakFile_UnloadPak . FindPattern ( " 66 89 " , CMemory : : Direction : : DOWN , 450 ) . ResolveRelativeAddressSelf ( 0x3 , 0x7 ) . RCast < int16_t * > ( ) ;
g_pLoadedPakCount = & * g_pRequestedPakCount - 1 ; // '-1' shifts it back with sizeof(int16_t).
2022-08-06 00:16:11 +02:00
2023-01-31 16:09:30 +01:00
g_pPakGlobals = g_GameDll . FindPatternSIMD ( " 48 8D 1D ?? ?? ?? ?? 45 8D 5A 0E " ) . ResolveRelativeAddressSelf ( 0x3 , 0x7 ) . RCast < RPakGlobals_t * > ( ) ; /*48 8D 1D ? ? ? ? 45 8D 5A 0E*/
g_pPakLoadJobID = reinterpret_cast < JobID_t * > ( & * g_pLoadedPakCount - 2 ) ;
2022-08-18 02:15:23 +02:00
g_pPakFifoLock = p_JT_HelpWithAnything . Offset ( 0x155 ) . FindPatternSelf ( " 48 8D 0D " ) . ResolveRelativeAddressSelf ( 0x3 , 0x7 ) . RCast < JobFifoLock_s * > ( ) ;
g_pPakFifoLockWrapper = p_JT_HelpWithAnything . Offset ( 0x1BC ) . FindPatternSelf ( " 48 8D 0D " ) . ResolveRelativeAddressSelf ( 0x3 , 0x7 ) . RCast < void * > ( ) ;
g_bPakFifoLockAcquired = p_JT_HelpWithAnything . Offset ( 0x50 ) . FindPatternSelf ( " C6 05 " ) . ResolveRelativeAddressSelf ( 0x2 , 0x7 ) . RCast < bool * > ( ) ;
2022-04-18 03:35:08 +02:00
}
virtual void GetCon ( void ) const { }
2023-01-25 02:26:52 +01:00
virtual void Attach ( void ) const ;
virtual void Detach ( void ) const ;
2022-04-18 03:35:08 +02:00
} ;
///////////////////////////////////////////////////////////////////////////////