Skip to content

Commit

Permalink
Merge pull request #71 from redraskal/fix/y8s4-header
Browse files Browse the repository at this point in the history
fix: header buffer too small
  • Loading branch information
redraskal committed Dec 12, 2023
2 parents bb77daf + dd2ace1 commit 3150bfd
Show file tree
Hide file tree
Showing 8 changed files with 349 additions and 558 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
build:
strategy:
matrix:
go: ["1.20"]
go: ["1.21"]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: "1.20"
goversion: "1.21"
pre_command: "go build -o libr6dissect.${{ env.ext }} -buildmode=c-shared exports/exports.go"
extra_files: "LICENSE README.md libr6dissect.h libr6dissect.${{ env.ext }}"
ldflags: "-X 'main.Version=${{ env.version }}'"
8 changes: 2 additions & 6 deletions dissect/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,10 @@ func NewReader(in io.Reader) (r *Reader, err error) {
}
if chunkedCompression {
log.Debug().Msg("creating header buffer")
headerBuffer := make([]byte, 2000)
n, err := internalReader.Read(headerBuffer)
headerBuffer, err := internalReader.Peek(4000)
if err != nil {
return nil, err
}
if n != 2000 {
return nil, ErrInvalidFile
}
r.b = headerBuffer
log.Debug().Msg("reading header magic")
if err = r.readHeaderMagic(); err != nil {
Expand All @@ -68,7 +64,7 @@ func NewReader(in io.Reader) (r *Reader, err error) {
pattern := []byte{0x32, 0x30, 0x30, 0x56, 0x52, 0x50, 0x4D, 0x43}
i := 0
r.b = []byte{}
zstdReader, _ := zstd.NewReader(internalReader)
zstdReader, _ := zstd.NewReader(bytes.NewReader([]byte{}))
for !errors.Is(err, io.EOF) {
log.Debug().Msg("scanning for dissect frame")
for i != 8 {
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
{
"header": {
"gameVersion": "Y8S4_Alpha03",
"codeVersion": 7958800,
"timestamp": "2023-12-07T20:36:08Z",
"matchType": {
"name": "CustomGameOnline",
"id": 8
},
"map": {
"name": "Border",
"id": 305979357167
},
"site": "2F Armory Lockers, 2F Archives",
"recordingPlayerID": 967714438443501373,
"recordingProfileID": "859bf2d8-eb6b-4226-b143-240175aea21c",
"additionalTags": "423855620",
"gamemode": {
"name": "Bomb",
"id": 327933806
},
"roundsPerMatch": 6,
"roundsPerMatchOvertime": 1,
"roundNumber": 0,
"overtimeRoundNumber": 0,
"teams": [
{
"name": "OPPONENTS",
"score": 1,
"won": false,
"role": "Attack"
},
{
"name": "YOUR TEAM",
"score": 0,
"won": true,
"winCondition": "Time",
"role": "Defense"
}
],
"players": [
{
"id": 6366317606386794496,
"profileID": "ca430bed-e343-42dc-b538-2da34be6e315",
"username": "E-Nun-E",
"teamIndex": 1,
"operator": {
"name": "Doc",
"id": 92270644007
},
"heroName": 350237835,
"alliance": 4,
"roleImage": 2461366796,
"roleName": "DOC",
"rolePortrait": 27880706765,
"spawn": "2F Armory Lockers, 2F Archives"
},
{
"id": 6366317606386794496,
"profileID": "a75b84cf-91fa-4209-acb1-710fad78c445",
"username": "SparkleStar.QAQ",
"teamIndex": 0,
"operator": {
"name": "Iana",
"id": 104189664038
},
"alliance": 0,
"spawn": "Valley"
},
{
"id": 6366317606386794496,
"profileID": "7aaa4980-21d0-4586-a3ba-07c4e52ef0ad",
"username": "dartm.",
"teamIndex": 0,
"operator": {
"name": "Gridlock",
"id": 174977508808
},
"alliance": 0,
"spawn": "West Vehicle Exit"
},
{
"id": 6366317606386794496,
"profileID": "dbb27cca-6060-4f36-a337-1497251d0bc0",
"username": "Zentetsu29514",
"teamIndex": 0,
"operator": {
"name": "Kali",
"id": 104189663920
},
"alliance": 0,
"spawn": "Valley"
},
{
"id": 6366317606386794496,
"profileID": "680f9275-9db5-4eeb-9c25-b468c417cbf5",
"username": "AbiscuitA-H.R.T",
"teamIndex": 0,
"operator": {
"name": "Ace",
"id": 104189664390
},
"alliance": 0,
"spawn": "Valley"
},
{
"id": 6366317606386794496,
"profileID": "8874ec3e-f511-43e5-81d7-0beb39b0ceb0",
"username": "Vodka204",
"teamIndex": 0,
"operator": {
"name": "Ram",
"id": 395943091136
},
"alliance": 0,
"spawn": "RANDOM"
},
{
"id": 6366317606386794496,
"profileID": "859bf2d8-eb6b-4226-b143-240175aea21c",
"username": "YOU",
"teamIndex": 1,
"operator": {
"name": "Wamai",
"id": 104189663803
},
"alliance": 0,
"spawn": "2F Armory Lockers, 2F Archives"
},
{
"id": 6366317606386794496,
"profileID": "8672742b-cce9-4cfd-abdf-9a4c7297f41b",
"username": "PurpleBMW3337",
"teamIndex": 1,
"operator": {
"name": "Alibi",
"id": 104189662071
},
"alliance": 0,
"spawn": "2F Armory Lockers, 2F Archives"
},
{
"id": 6366317606386794496,
"profileID": "efca562e-0d6e-49e6-b341-8cd4eca22436",
"username": "viz_dragon25375",
"teamIndex": 1,
"operator": {
"name": "Tubarao",
"id": 288200867549
},
"alliance": 0,
"spawn": "2F Armory Lockers, 2F Archives"
},
{
"id": 6366317606386794496,
"profileID": "bf042c91-5e5d-48b3-9dfc-31d0ca5f4b9d",
"username": "EMT13145237",
"teamIndex": 1,
"operator": {
"name": "Mozzie",
"id": 174977508820
},
"alliance": 0,
"spawn": "2F Armory Lockers, 2F Archives"
}
],
"gmSettings": [
397525280156,
245225394853,
245225394902
],
"playlistCategory": 397525280078,
"matchID": "3fcc9729-ec42-477a-a603-291ca4faf259"
},
"matchFeedback": [
{
"type": {
"name": "Other",
"id": 10
},
"time": "0:00",
"timeInSeconds": 0,
"message": "Friendly Fire turned off until Action Phase"
},
{
"type": {
"name": "Other",
"id": 10
},
"time": "2:59",
"timeInSeconds": 179,
"message": "Friendly Fire is now active"
},
{
"type": {
"name": "Kill",
"id": 0
},
"username": "AbiscuitA-H.R.T",
"target": "PurpleBMW3337",
"headshot": true,
"time": "1:34",
"timeInSeconds": 94
},
{
"type": {
"name": "LocateObjective",
"id": 6
},
"username": "AbiscuitA-H.R.T",
"time": "0:51",
"timeInSeconds": 51
},
{
"type": {
"name": "Kill",
"id": 0
},
"username": "dartm.",
"target": "E-Nun-E",
"headshot": false,
"time": "0:32",
"timeInSeconds": 32
},
{
"type": {
"name": "Kill",
"id": 0
},
"username": "dartm.",
"target": "viz_dragon25375",
"headshot": true,
"time": "0:27",
"timeInSeconds": 27
},
{
"type": {
"name": "Kill",
"id": 0
},
"username": "viz_dragon25375",
"target": "AbiscuitA-H.R.T",
"headshot": false,
"time": "0:27",
"timeInSeconds": 27
}
]
}
44 changes: 24 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
module github.com/redraskal/r6-dissect

go 1.20
go 1.21

require (
github.com/go-test/deep v1.1.0
github.com/klauspost/compress v1.16.7
github.com/rs/zerolog v1.29.1
github.com/klauspost/compress v1.17.4
github.com/rs/zerolog v1.31.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.16.0
github.com/xuri/excelize/v2 v2.7.1
golang.org/x/net v0.12.0
golang.org/x/tools v0.11.0
github.com/spf13/viper v1.18.1
github.com/xuri/excelize/v2 v2.8.0
golang.org/x/net v0.19.0
golang.org/x/tools v0.16.0
)

require (
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/pelletier/go-toml/v2 v2.0.9 // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/richardlehane/mscfb v1.0.4 // indirect
github.com/richardlehane/msoleps v1.0.3 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/xuri/efp v0.0.0-20230422071738-01f4e37c47e9 // indirect
github.com/xuri/nfp v0.0.0-20230723160540-a7d120392641 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/xuri/efp v0.0.0-20231025114914-d1ff6096ae53 // indirect
github.com/xuri/nfp v0.0.0-20230919160717-d98342af3f05 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 3150bfd

Please sign in to comment.