Created
May 25, 2020 05:50
-
-
Save NotAdam/c79bb58f33841290725b78cc9348c65e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef ubyte uint8_t; | |
typedef byte int8_t; | |
typedef ushort uint16_t; | |
typedef short int16_t; | |
typedef uint uint32_t; | |
typedef int int32_t; | |
typedef uint64 uint64_t; | |
typedef int64 int64_t; | |
struct ReplayHeader | |
{ | |
char magic[12]; | |
uint32_t unkC; | |
uint32_t clientBuildId; | |
time_t createdAt; | |
uint32_t totalTimeMs; | |
uint32_t totalTimeMs2; | |
uint32_t contentFinderConditionId; | |
uint32_t unk24; | |
uint32_t alwaysTrue : 1; | |
uint32_t unk28 : 31; | |
uint32_t unk2c; | |
uint64_t contentId <format = hex >; | |
uint8_t partyJobs[ 8 ]; | |
uint32_t recorderJobIndex; | |
uint32_t chaptersSize; | |
uint32_t packetsSize; | |
uint32_t unknown4c; | |
uint32_t numChapters; | |
} hdr <bgcolor = cLtGreen>; | |
if( hdr.magic != "FFXIVREPLAY\0" ) | |
{ | |
Printf("invalid file magic: %s\n", hdr.magic ); | |
return; | |
} | |
struct Chapter | |
{ | |
uint32_t unk; // kind? | |
uint32_t dataOffset; | |
uint32_t chapterTimeMs; | |
} chapters[ hdr.numChapters ] <bgcolor = cLtGreen, read=readChapter>; | |
string readChapter( Chapter& ch ) | |
{ | |
string s; | |
SPrintf( s, "unk: %d, offset: %x, time: %d", ch.unk, ch.dataOffset, ch.chapterTimeMs ); | |
return s; | |
} | |
// maybe numchapters is part of the chapter size? | |
local uint32_t chapterReserved = hdr.chaptersSize - sizeof( chapters ) - 4; | |
uint8_t chaptersPadding[ chapterReserved ] <bgcolor = cLtYellow>; | |
local uint32_t packetsRemaining = hdr.packetsSize; | |
while( packetsRemaining > 0 ) | |
{ | |
struct PacketEntry | |
{ | |
uint16_t opcode; | |
uint16_t size; | |
uint32_t msOffset; | |
uint32_t actorId; | |
uint8_t data[size]; | |
} packet <bgcolor = cLtBlue, read=readPacket>; | |
packetsRemaining -= sizeof( packet ); | |
} | |
string readPacket( PacketEntry& pe ) | |
{ | |
string s; | |
SPrintf( s, "opcode: %x, size: %x, time: %dms, actor: %d", pe.opcode, pe.size, pe.msOffset, pe.actorId ); | |
return s; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment