Skip to content

Commit

Permalink
Updates to SF6 support/json
Browse files Browse the repository at this point in the history
  • Loading branch information
alphazolam committed Oct 9, 2022
1 parent aa8392f commit 6a119f5
Show file tree
Hide file tree
Showing 2 changed files with 80,647 additions and 6,424 deletions.
56 changes: 53 additions & 3 deletions RE_RSZ.bt
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,7 @@ typedef struct(uint32 classHash, uint16 fieldIndex) {
if (FTell()+4 <= FileSize())
ubyte data <name="ubyte R">, data <name="ubyte G">, data <name="ubyte B">, data <name="ubyte A">;
break;

case F32_tid:
fieldDataType = "Float";
if (FTell()+4 <= FileSize())
Expand Down Expand Up @@ -1381,6 +1382,7 @@ typedef struct(uint32 classHash, uint16 fieldIndex) {
if (FTell()+2 <= FileSize())
short data;
break;
case Sfix_tid:
case S32_tid:
fieldDataType = "Int";
if (FTell()+4 <= FileSize())
Expand Down Expand Up @@ -1443,14 +1445,21 @@ typedef struct(uint32 classHash, uint16 fieldIndex) {
float data <name="float x">, data <name="float y">, data <name="float z">, data <name="float w">;
}
break;
case Sfix2_tid:
case Int2_tid:
if (FTell()+8 <= FileSize())
int32 data <name="int x">, data <name="int y">;
break;
case Sfix3_tid:
case Int3_tid:
if (FTell()+12 <= FileSize())
int32 data <name="int x">, data <name="int y">, data <name="int z">;
break;
case Sfix4_tid:
case Int4_tid:
if (FTell()+16 <= FileSize())
int32 data <name="int x">, data <name="int y">, data <name="int z">, data <name="int w">;
break;
case Uint3_tid:
if (FTell()+12 <= FileSize())
uint32 data <name="uint x">, data <name="uint y">, data <name="uint z">;
Expand Down Expand Up @@ -3014,12 +3023,13 @@ typedef enum {
id_RCOL = 1280262994,
id_mfs2 = 846423661,
id_BHVT = 1414940738,
id_uvar = 1918989941
id_uvar = 1918989941,
id_fchr = 1919443814,
} MAGIC;

//Start of reading File =====================================================================================================================================
FSeek(0);
if (ReadUInt(0)==id_SCN || ReadUInt(0)==id_PFB || ReadUInt(0)==id_USR || ReadUInt(0)==id_RCOL || ReadUInt(4)==id_mfs2 || ReadUInt(0)==id_BHVT )
if (ReadUInt(0)==id_SCN || ReadUInt(0)==id_PFB || ReadUInt(0)==id_USR || ReadUInt(0)==id_RCOL || ReadUInt(4)==id_mfs2 || ReadUInt(0)==id_BHVT || ReadUInt(4)==id_fchr)
struct {
HashGenerator HashMaker <name="Hash Generator">;
FSkip(-1);
Expand Down Expand Up @@ -3098,6 +3108,7 @@ if (ReadUInt(0)==id_SCN || ReadUInt(0)==id_PFB || ReadUInt(0)==id_USR || ReadUIn
uint64 autoGenerateJointDescTbl;
}
}

if (magic == id_SCN) {
MAGIC signature;
int infoCount;
Expand All @@ -3118,6 +3129,42 @@ if (ReadUInt(0)==id_SCN || ReadUInt(0)==id_PFB || ReadUInt(0)==id_USR || ReadUIn
uint64 userdataInfoTbl;
uint64 dataOffset;
}

if (magic == id_fchr) {
uint version;
uint magic;
uint64 ukn0;
uint64 ukn1;
uint64 ukn2;
uint64 objsOffs;
uint64 ukn4;
uint64 ukn5;
uint64 StringsOffs;
uint64 MainRSZ;
uint64 FileSize;
uint ukn00;
uint ukn01;
uint numObjs;
uint StringsCount;

FSeek(objsOffs);
struct {
for (i=0; i<numObjs;i++)
uint32 objID;
} uknObjs;

FSeek(ukn4);
struct {
for (i=0; i<numObjs;i++)
uint64 uknOffs;
} uknOffsets;

FSeek(StringsOffs);
struct {
for (i=0; i<StringsCount;i++)
StringRead ukn(-1, 0, 0);
} Strings;
}

if (exists(dataOffset) && ReadUInt(dataOffset) != 5919570)
Printf("RSZ magic not found at main file header's dataOffset\n");
Expand Down Expand Up @@ -5891,7 +5938,10 @@ if (RSZOffset > -1) {
FSeek(RSZOffset);
if (ReadUInt(0) == id_PFB || ReadUInt(0) == id_SCN) // SCN or PFB
{ FSkip(-1); BLANK __; FSkip(-1); BLANK ___ <name=ReadMainDataNotice>; }
while (FTell()+4 <= FileSize()) {

//TEST fchr

while (FTell()+4 <= FileSize()) { //&& level < 5
if ( ReadUInt(FTell()) == 5919570 ) { //RSZ
finished = false;
if (level == 1 && !FEof()) {
Expand Down
Loading

0 comments on commit 6a119f5

Please sign in to comment.