#pragma once #include #include #include #include #include #include #include #include #include #include using namespace latte::pm4; struct ReplayPosition { size_t packetIndex; size_t commandIndex; }; struct ReplayIndex { struct Frame { ReplayPosition pos; }; struct Packet { decaf::pm4::CapturePacket::Type type; uint32_t size; uint8_t *data; }; struct Command { latte::pm4::Header header; void *command; }; std::vector frames; std::vector packets; std::vector commands; }; struct ReplayFile { ~ReplayFile() { if (view) { platform::unmapViewOfFile(view, size); view = nullptr; } if (handle != platform::InvalidMapFileHandle) { platform::closeMemoryMappedFile(handle); handle = platform::InvalidMapFileHandle; } size = 0; } platform::MapFileHandle handle = platform::InvalidMapFileHandle; uint8_t *view = nullptr; size_t size = 0; ReplayIndex index; }; std::shared_ptr openReplay(const std::string &path); std::string getCommandName(ReplayIndex::Command &command); bool buildReplayIndex(std::shared_ptr replay);