Skip to content

Commit 8eb7386

Browse files
committed
back to demoinfocs v4
1 parent dfdb621 commit 8eb7386

File tree

9 files changed

+24
-49
lines changed

9 files changed

+24
-49
lines changed

cmd/wasm/wasm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"syscall/js"
1212
"time"
1313

14-
"github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs"
14+
"github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs"
1515
"google.golang.org/protobuf/proto"
1616
)
1717

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/alexflint/go-arg v1.5.1
1010
github.com/golang/geo v0.0.0-20230421003525-6adc56603217
1111
github.com/gorilla/websocket v1.5.3
12-
github.com/markus-wa/demoinfocs-golang/v5 v5.0.0-20240904222726-24b77fe5ebfa
12+
github.com/markus-wa/demoinfocs-golang/v4 v4.3.0
1313
github.com/sparkoo/go-steam v0.0.0-20231112203532-968479d66868
1414
github.com/stretchr/testify v1.9.0
1515
github.com/yohcop/openid-go v1.0.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
8585
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
8686
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
8787
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
88-
github.com/markus-wa/demoinfocs-golang/v5 v5.0.0-20240904222726-24b77fe5ebfa h1:+pL8fo9ZRYpvYRw9RTP1QY032T4USfqNWeuZAsHD+ao=
89-
github.com/markus-wa/demoinfocs-golang/v5 v5.0.0-20240904222726-24b77fe5ebfa/go.mod h1:703o9w3vKbMGvoIA9L/dyJVbRXIBcm2wOkIbO2wVZ7o=
88+
github.com/markus-wa/demoinfocs-golang/v4 v4.3.0 h1:R+lazMCOA7ycuAKDPoqWjjLHYuIyor/sVM7hD9UaB+M=
89+
github.com/markus-wa/demoinfocs-golang/v4 v4.3.0/go.mod h1:HoKANU0AlFzSgtEJ4YD/pMQw3L0dNRgtn2GPVD+tF7I=
9090
github.com/markus-wa/go-unassert v0.1.3 h1:4N2fPLUS3929Rmkv94jbWskjsLiyNT2yQpCulTFFWfM=
9191
github.com/markus-wa/go-unassert v0.1.3/go.mod h1:/pqt7a0LRmdsRNYQ2nU3SGrXfw3bLXrvIkakY/6jpPY=
9292
github.com/markus-wa/gobitread v0.2.4 h1:BDr3dZnsqntDD4D8E7DzhkQlASIkQdfxCXLhWcI2K5A=

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020

2121
"github.com/alexflint/go-arg"
2222
"github.com/gorilla/websocket"
23-
"github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs"
23+
"github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs"
2424
"go.uber.org/zap"
2525
"google.golang.org/protobuf/proto"
2626
)

pkg/message/message.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package message
22

3-
import "github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs"
3+
import "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs"
44

55
func NewRound(startTick int) *Round {
66
return &Round{

pkg/parser/bomb.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"csgo-2d-demo-player/pkg/message"
66

77
"github.com/golang/geo/r3"
8-
dem "github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs"
9-
"github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs/events"
8+
dem "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs"
9+
"github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events"
1010
)
1111

1212
type bombHandler struct {

pkg/parser/parser.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
"time"
1111

1212
"github.com/golang/geo/r3"
13-
dem "github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs"
14-
"github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs/common"
15-
"github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs/events"
13+
dem "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs"
14+
"github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/common"
15+
"github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events"
1616
"go.uber.org/zap"
1717
)
1818

pkg/parser/weapons.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package parser
33
import (
44
"csgo-2d-demo-player/pkg/log"
55

6-
"github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs/common"
6+
"github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/common"
77
)
88

99
// TODO: unused, remove later. keeping here for now to have model names

web/src/Player/PlayerApp.jsx

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,18 @@ export function PlayerApp() {
2424

2525
const urlParams = new URLSearchParams(window.location.search);
2626
const channel = new BroadcastChannel(urlParams.get("uuid"));
27-
channel.addEventListener("message", e => {
28-
console.log("received", e, isWasmLoaded)
29-
window.testt(e.data, function (data) {
27+
channel.onmessage = (event) => {
28+
console.log("received", event, isWasmLoaded)
29+
window.testt(event.data, function (data) {
3030
if (data instanceof Uint8Array) {
3131
const msg = proto.Message.deserializeBinary(data).toObject()
3232
messageBus.emit(msg)
3333
} else {
34-
// text frame
35-
// console.log(event.data);
3634
console.log("[message] text data received from server, this is weird. We're using protobufs ?!?!?", data);
3735
messageBus.emit(JSON.parse(data))
3836
}
39-
40-
// console.log(`[message] Data received from server: ${event.data}`);
41-
// let msg = JSON.parse(event.data)
42-
// messageBus.emit(msg)
4337
})
44-
});
38+
};
4539
messageBus.listen([13], function (msg) {
4640
alert(msg.message)
4741
// window.testt(byteArray)
@@ -55,37 +49,10 @@ export function PlayerApp() {
5549
go.run(result.instance);
5650
console.log("should be loaded now")
5751
setIsWasmLoaded(true)
58-
// window.withDownload("https://corsproxy.io/?" + encodeURIComponent("https://github.com/sparkoo/csgo-2d-demo-viewer/raw/refs/heads/master/test_demos/1-c26b4e22-66ac-4904-87cc-3b2b65a67ddb-1-1.dem.gz"))
59-
// fetch("https://corsproxy.io/?" + encodeURIComponent("https://github.com/sparkoo/csgo-2d-demo-viewer/raw/refs/heads/master/test_demos/1-c26b4e22-66ac-4904-87cc-3b2b65a67ddb-1-1.dem.gz"))
60-
// .then((result) => {
61-
// console.log(result)
62-
// result.arrayBuffer().then(b => {
63-
// const data = new Uint8Array(b)
64-
// console.log(data)
65-
// window.testt(data, function (data) {
66-
// if(data instanceof Uint8Array) {
67-
// const msg = proto.Message.deserializeBinary(data).toObject()
68-
// messageBus.emit(msg)
69-
// } else {
70-
// // text frame
71-
// // console.log(event.data);
72-
// console.log("[message] text data received from server, this is weird. We're using protobufs ?!?!?", data);
73-
// messageBus.emit(JSON.parse(data))
74-
// }
75-
76-
// // console.log(`[message] Data received from server: ${event.data}`);
77-
// // let msg = JSON.parse(event.data)
78-
// // messageBus.emit(msg)
79-
// })
80-
// })
81-
// })
82-
// .catch(err => console.log(err))
8352
});
8453
}
85-
8654
}, [isWasmLoaded])
8755

88-
8956
return (
9057
<ErrorBoundary>
9158
<div className="grid-container">
@@ -98,3 +65,11 @@ export function PlayerApp() {
9865
</div>
9966
</ErrorBoundary>);
10067
}
68+
69+
async function parseDemo(event, messageBus) {
70+
await parse(event, messageBus)
71+
}
72+
73+
async function parse(event, messageBus) {
74+
75+
}

0 commit comments

Comments
 (0)