-
Notifications
You must be signed in to change notification settings - Fork 1
/
frames.php
54 lines (48 loc) · 1.41 KB
/
frames.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
$loader = require __DIR__ . '/vendor/autoload.php';
$dir = 'c:/rocket-league-frames';
foreach (scandir($dir) as $subdir) {
if (in_array($subdir, ['.', '..'])) {
continue;
}
if (is_dir($dir . '/' . $subdir)) {
foreach (scandir($dir . '/' . $subdir) as $file) {
if (in_array($file, ['.', '..'])) {
continue;
}
doFrameFile($dir . '/' . $subdir . '/' . $file);
}
}
else {
doFrameFile($dir . '/' . $subdir);
}
}
function doFrameFile($path)
{
$info = pathinfo(dirname($path));
if (!file_exists('results/' . $info['filename'] . '.json')) {
return;
}
$br = new Gizmo\BinaryReader(file_get_contents($path), false);
$frame = Gizmo\Frame::deserialize($br);
dumpframe($frame);
}
function dumpFrame($frame)
{
print "Frame@" . sprintf("%01.3f", round($frame->time, 3));
print "+" . sprintf("%01.3f", round($frame->diff, 3));
//print "\n";
foreach ($frame->replications as $r) {
dumpReplication($r);
}
}
function dumpReplication($r)
{
print "\tR#" . $r->actorId . ":" . ($r->channelState ? 'open' : 'closed');
if (!$r->channelState) {
return;
}
print ":" . ($r->actorState ? 'new' : 'existing') . ":" . $r->actorObjectId . ":" . $r->unknown1;
print "\t" . ($r->vector ? implode(',', get_object_vars($r->vector)) : '');
print "\t" . $r->next . "\n";
}