From 566a8bdb433a7b704943302c3764cf3eebb2856c Mon Sep 17 00:00:00 2001 From: RDW Date: Wed, 25 Sep 2024 11:27:15 +0200 Subject: [PATCH] Tools: Add ACT mystery bytes to the FileAnalyzer --- Tests/Tools/FileAnalyzer.spec.lua | 32 +++++++++++++++++++++++++++++++ Tools/FileAnalyzer.lua | 19 ++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/Tests/Tools/FileAnalyzer.spec.lua b/Tests/Tools/FileAnalyzer.spec.lua index e7f38d81..47a7d82f 100644 --- a/Tests/Tools/FileAnalyzer.spec.lua +++ b/Tests/Tools/FileAnalyzer.spec.lua @@ -156,6 +156,38 @@ describe("FileAnalyzer", function() assertEquals(analysisResult.fields.version[2.5], 1) assertEquals(analysisResult.fields.numAnimationClips[1], 5) + + assertEquals(analysisResult.fields.animationFrameMysteryBytes, { + [-2004318072] = 1, + [-1532779871] = 1, + [-1465473371] = 1, + [-1263291727] = 1, + [0] = 11, + [4] = 1, + [32] = 1, + [66] = 1, + [145] = 1, + [480] = 1, + [640] = 1, + [724] = 1, + [904] = 1, + [1750] = 1, + [2366] = 1, + [3535] = 1, + [6757] = 1, + [6778] = 1, + [54647] = 1, + [67305985] = 2, + [134678021] = 2, + [286331153] = 1, + [572662306] = 1, + [858993459] = 1, + [1145324612] = 1, + [1431655765] = 1, + [1717986918] = 1, + [2004318071] = 1, + }) + assertEquals(analysisResult.fields.spriteAnchorMysteryBytes, {}) end) end) diff --git a/Tools/FileAnalyzer.lua b/Tools/FileAnalyzer.lua index 130f12ad..4646505d 100644 --- a/Tools/FileAnalyzer.lua +++ b/Tools/FileAnalyzer.lua @@ -180,6 +180,8 @@ function FileAnalyzer:AnalyzeACT(actFiles) version = {}, numAnimationClips = {}, unknownHeaderField = {}, + animationFrameMysteryBytes = {}, + spriteAnchorMysteryBytes = {}, }, } @@ -213,6 +215,23 @@ function FileAnalyzer:AnalyzeACT(actFiles) analysisResult.fields.unknownHeaderField[act.unknownHeaderField] = analysisResult.fields.unknownHeaderField[act.unknownHeaderField] + 1 + for _, clip in ipairs(act.animationClips) do + for _, frame in ipairs(clip.animationFrames) do + for _, bytes in ipairs(frame.mysteryBytes) do + analysisResult.fields.animationFrameMysteryBytes[bytes] = analysisResult.fields.animationFrameMysteryBytes[bytes] + or 0 + analysisResult.fields.animationFrameMysteryBytes[bytes] = analysisResult.fields.animationFrameMysteryBytes[bytes] + + 1 + for _, anchor in ipairs(frame.anchors) do + analysisResult.fields.spriteAnchorMysteryBytes[anchor.mysteryBytes] = analysisResult.fields.spriteAnchorMysteryBytes[anchor.mysteryBytes] + or 0 + analysisResult.fields.spriteAnchorMysteryBytes[anchor.mysteryBytes] = analysisResult.fields.spriteAnchorMysteryBytes[anchor.mysteryBytes] + + 1 + end + end + end + end + analysisResult.numFilesAnalyzed = analysisResult.numFilesAnalyzed + 1 end