Skip to content

Commit 663d133

Browse files
authored
Merge pull request #383 from markus-wa/s2
v4: Support Counter-Strike 2
2 parents 8eb0227 + 082a961 commit 663d133

File tree

158 files changed

+102948
-9130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+102948
-9130
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ name: CI
44

55
jobs:
66
ci:
7-
strategy:
8-
matrix:
9-
go-version: [1.18.x]
10-
117
runs-on: ubuntu-latest
128

139
env:
@@ -18,7 +14,7 @@ jobs:
1814
- name: Install Go
1915
uses: actions/setup-go@v2
2016
with:
21-
go-version: ${{ matrix.go-version }}
17+
go-version: 1.21.x
2218

2319
- name: Install Reviewdog
2420
uses: reviewdog/action-setup@v1
@@ -37,14 +33,14 @@ jobs:
3733
sudo apt-get install -y p7zip-full
3834
3935
# Install interface generator
40-
go install github.com/vburenin/ifacemaker@v1.1.0
36+
go install github.com/vburenin/ifacemaker@v1.2.1
4137
4238
# Fetch refs for linter
4339
git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
4440
git fetch
4541
4642
# Install golangci-lint
47-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2
43+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.52.2
4844
4945
- name: Build
5046
run: scripts/build.sh

.github/workflows/protobuf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
if: env.PROTOBUFS_CHANGED == 'true'
2828
uses: actions/setup-go@v2
2929
with:
30-
go-version: 1.18.x
30+
go-version: 1.21.x
3131

3232
- name: Install Protobuf tools
3333
if: env.PROTOBUFS_CHANGED == 'true'

.golangci.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ linters:
1313
disable-all: true
1414
enable:
1515
- bodyclose
16-
- deadcode
17-
- depguard
1816
- dogsled
1917
- dupl
2018
- exportloopref
@@ -36,12 +34,10 @@ linters:
3634
- nolintlint
3735
- rowserrcheck
3836
- staticcheck
39-
- structcheck
4037
- stylecheck
4138
- unconvert
4239
- unparam
4340
- unused
44-
- varcheck
4541
- whitespace
4642
- asciicheck
4743
- gocognit

README.md

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Counter-Strike 2 support is experimental.
66

77
[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://vshymanskyy.github.io/StandWithUkraine)
88

9-
[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs?tab=doc)
9+
[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs?tab=doc)
1010
[![Build Status](https://img.shields.io/github/actions/workflow/status/markus-wa/demoinfocs-golang/ci.yml?branch=master&style=flat-square)](https://github.com/markus-wa/demoinfocs-golang/actions)
1111
[![codecov](https://img.shields.io/codecov/c/github/markus-wa/demoinfocs-golang?style=flat-square)](https://codecov.io/gh/markus-wa/demoinfocs-golang)
1212
[![Go Report](https://goreportcard.com/badge/github.com/markus-wa/demoinfocs-golang?style=flat-square)](https://goreportcard.com/report/github.com/markus-wa/demoinfocs-golang)
@@ -23,13 +23,15 @@ For business inquiries please use the contact information found on the [GitHub p
2323

2424
## Go Get
2525

26-
### CS:GO
26+
### CS2 - ⚠️ Experimental
2727

28-
go get -u github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs
28+
go get -u github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs
2929

30-
### CS2 - ⚠️ Experimental
30+
⚠️ The CS2 / v4 API may change in backwards incompatible ways without warning.
3131

32-
go get -u github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs@s2
32+
### CS:GO
33+
34+
go get -u github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs
3335

3436
## Table of Contents
3537

@@ -53,7 +55,7 @@ For business inquiries please use the contact information found on the [GitHub p
5355

5456
## Requirements
5557

56-
This library requires at least `go 1.18` to run.
58+
This library requires at least `go 1.21` to run.
5759
You can download the latest version of Go [here](https://golang.org/).
5860

5961
## Quickstart Guide
@@ -70,7 +72,7 @@ go mod init github.com/<YOUR_GITHUB_USER>/my-project
7072
# the module name (github.com/<YOUR_GITHUB_USER>/my-project) can always be changed later
7173
# you can also put example.com/my-project or anything else if you don't plan to publish your project
7274
73-
go get -u github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs
75+
go get -u github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs
7476
```
7577

7678
3. Create a `main.go` file with the example below
@@ -92,8 +94,8 @@ import (
9294
"log"
9395
"os"
9496

95-
dem "github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs"
96-
events "github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs/events"
97+
dem "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs"
98+
events "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events"
9799
)
98100

99101
func main() {
@@ -150,24 +152,24 @@ Check out the [examples](examples) folder for more examples, like [how to genera
150152

151153
### Documentation
152154

153-
The full API documentation is available here on [pkg.go.dev](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs).
155+
The full API documentation is available here on [pkg.go.dev](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs).
154156

155157
## Features
156158

157-
* Game events (kills, shots, round starts/ends, footsteps etc.) - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs/events?tab=doc) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/print-events)
158-
* Tracking of game-state (players, teams, grenades, ConVars etc.) - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs?tab=doc#GameState)
159-
* Grenade projectiles / trajectories - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs?tab=doc#GameState.GrenadeProjectiles) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/nade-trajectories)
160-
* Access to entities, server-classes & data-tables - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs/sendtables?tab=doc#ServerClasses) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/entities)
161-
* Access to all net-messages - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs?tab=doc#NetMessageCreator) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/net-messages)
162-
* Chat & console messages <sup id="achat1">1</sup> - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs/events?tab=doc#ChatMessage) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/print-events)
163-
* Matchmaking ranks (official MM demos only) - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs/events?tab=doc#RankUpdate)
159+
* Game events (kills, shots, round starts/ends, footsteps etc.) - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events?tab=doc) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/print-events)
160+
* Tracking of game-state (players, teams, grenades, ConVars etc.) - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs?tab=doc#GameState)
161+
* Grenade projectiles / trajectories - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs?tab=doc#GameState.GrenadeProjectiles) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/nade-trajectories)
162+
* Access to entities, server-classes & data-tables - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/sendtables?tab=doc#ServerClasses) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/entities)
163+
* Access to all net-messages - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs?tab=doc#NetMessageCreator) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/net-messages)
164+
* Chat & console messages <sup id="achat1">1</sup> - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events?tab=doc#ChatMessage) / [example](https://github.com/markus-wa/demoinfocs-golang/tree/master/examples/print-events)
165+
* Matchmaking ranks (official MM demos only) - [docs](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events?tab=doc#RankUpdate)
164166
* Full POV demo support <sup id="achat1">2</sup>
165-
* Support for encrypted net-messages (if the [decryption key](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3@master/pkg/demoinfocs#ParserConfig) is provided)
167+
* Support for encrypted net-messages (if the [decryption key](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4@master/pkg/demoinfocs#ParserConfig) is provided)
166168
* JavaScript (browser / Node.js) support via WebAssembly - [example](https://github.com/markus-wa/demoinfocs-wasm)
167169
* [Easy debugging via build-flags](#debugging)
168170
* Built with performance & concurrency in mind
169171

170-
1. <small id="f1">In MM demos the chat is encrypted, so [`ParserConfig.NetMessageDecryptionKey`](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3@master/pkg/demoinfocs#ParserConfig) needs to be set - see also [`MatchInfoDecryptionKey()`](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v3@master/pkg/demoinfocs#MatchInfoDecryptionKey).</small>
172+
1. <small id="f1">In MM demos the chat is encrypted, so [`ParserConfig.NetMessageDecryptionKey`](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4@master/pkg/demoinfocs#ParserConfig) needs to be set - see also [`MatchInfoDecryptionKey()`](https://pkg.go.dev/github.com/markus-wa/demoinfocs-golang/v4@master/pkg/demoinfocs#MatchInfoDecryptionKey).</small>
171173
2. <small id="f2">Better than some other parsers at the time of writing.</small>
172174

173175
## Performance / Benchmarks
@@ -242,7 +244,7 @@ e.g.
242244

243245
Side-note: The tag isn't called `debug` to avoid naming conflicts with other libs (and underscores in tags don't work, apparently).
244246

245-
To change the default debugging behavior, Go's `ldflags` parameter can be used. Example for additionally printing out all server-classes with their properties: `-ldflags="-X 'github.com/markus-wa/demoinfocs-golang/v3/pkg/demoinfocs.debugServerClasses=YES'"`.
247+
To change the default debugging behavior, Go's `ldflags` parameter can be used. Example for additionally printing out all server-classes with their properties: `-ldflags="-X 'github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs.debugServerClasses=YES'"`.
246248

247249
e.g.
248250

0 commit comments

Comments
 (0)