diff --git a/cmd/wasm/wasm.go b/cmd/wasm/wasm.go index 3d99fc2..55ca8b8 100644 --- a/cmd/wasm/wasm.go +++ b/cmd/wasm/wasm.go @@ -11,7 +11,7 @@ import ( "syscall/js" "time" - "github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs" + "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs" "google.golang.org/protobuf/proto" ) diff --git a/go.mod b/go.mod index b4c2612..cb88b3e 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/alexflint/go-arg v1.5.1 github.com/golang/geo v0.0.0-20230421003525-6adc56603217 github.com/gorilla/websocket v1.5.3 - github.com/markus-wa/demoinfocs-golang/v5 v5.0.0-20240904222726-24b77fe5ebfa + github.com/markus-wa/demoinfocs-golang/v4 v4.3.0 github.com/sparkoo/go-steam v0.0.0-20231112203532-968479d66868 github.com/stretchr/testify v1.9.0 github.com/yohcop/openid-go v1.0.1 diff --git a/go.sum b/go.sum index 1fcc845..74b3adc 100644 --- a/go.sum +++ b/go.sum @@ -85,8 +85,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/markus-wa/demoinfocs-golang/v5 v5.0.0-20240904222726-24b77fe5ebfa h1:+pL8fo9ZRYpvYRw9RTP1QY032T4USfqNWeuZAsHD+ao= -github.com/markus-wa/demoinfocs-golang/v5 v5.0.0-20240904222726-24b77fe5ebfa/go.mod h1:703o9w3vKbMGvoIA9L/dyJVbRXIBcm2wOkIbO2wVZ7o= +github.com/markus-wa/demoinfocs-golang/v4 v4.3.0 h1:R+lazMCOA7ycuAKDPoqWjjLHYuIyor/sVM7hD9UaB+M= +github.com/markus-wa/demoinfocs-golang/v4 v4.3.0/go.mod h1:HoKANU0AlFzSgtEJ4YD/pMQw3L0dNRgtn2GPVD+tF7I= github.com/markus-wa/go-unassert v0.1.3 h1:4N2fPLUS3929Rmkv94jbWskjsLiyNT2yQpCulTFFWfM= github.com/markus-wa/go-unassert v0.1.3/go.mod h1:/pqt7a0LRmdsRNYQ2nU3SGrXfw3bLXrvIkakY/6jpPY= github.com/markus-wa/gobitread v0.2.4 h1:BDr3dZnsqntDD4D8E7DzhkQlASIkQdfxCXLhWcI2K5A= diff --git a/main.go b/main.go index 725eceb..67a5227 100644 --- a/main.go +++ b/main.go @@ -20,7 +20,7 @@ import ( "github.com/alexflint/go-arg" "github.com/gorilla/websocket" - "github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs" + "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs" "go.uber.org/zap" "google.golang.org/protobuf/proto" ) diff --git a/pkg/message/message.go b/pkg/message/message.go index 60f5639..bda7169 100644 --- a/pkg/message/message.go +++ b/pkg/message/message.go @@ -1,6 +1,6 @@ package message -import "github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs" +import "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs" func NewRound(startTick int) *Round { return &Round{ diff --git a/pkg/parser/bomb.go b/pkg/parser/bomb.go index e9afac9..2692a96 100644 --- a/pkg/parser/bomb.go +++ b/pkg/parser/bomb.go @@ -5,8 +5,8 @@ import ( "csgo-2d-demo-player/pkg/message" "github.com/golang/geo/r3" - dem "github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs" - "github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs/events" + dem "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs" + "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events" ) type bombHandler struct { diff --git a/pkg/parser/parser.go b/pkg/parser/parser.go index b097de7..5dfdec2 100644 --- a/pkg/parser/parser.go +++ b/pkg/parser/parser.go @@ -10,9 +10,9 @@ import ( "time" "github.com/golang/geo/r3" - dem "github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs" - "github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs/common" - "github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs/events" + dem "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs" + "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/common" + "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/events" "go.uber.org/zap" ) diff --git a/pkg/parser/weapons.go b/pkg/parser/weapons.go index a40a492..cc2c6dd 100644 --- a/pkg/parser/weapons.go +++ b/pkg/parser/weapons.go @@ -3,7 +3,7 @@ package parser import ( "csgo-2d-demo-player/pkg/log" - "github.com/markus-wa/demoinfocs-golang/v5/pkg/demoinfocs/common" + "github.com/markus-wa/demoinfocs-golang/v4/pkg/demoinfocs/common" ) // TODO: unused, remove later. keeping here for now to have model names diff --git a/web/src/Player/PlayerApp.jsx b/web/src/Player/PlayerApp.jsx index 059d736..76a63c6 100644 --- a/web/src/Player/PlayerApp.jsx +++ b/web/src/Player/PlayerApp.jsx @@ -24,24 +24,18 @@ export function PlayerApp() { const urlParams = new URLSearchParams(window.location.search); const channel = new BroadcastChannel(urlParams.get("uuid")); - channel.addEventListener("message", e => { - console.log("received", e, isWasmLoaded) - window.testt(e.data, function (data) { + channel.onmessage = (event) => { + console.log("received", event, isWasmLoaded) + window.testt(event.data, function (data) { if (data instanceof Uint8Array) { const msg = proto.Message.deserializeBinary(data).toObject() messageBus.emit(msg) } else { - // text frame - // console.log(event.data); console.log("[message] text data received from server, this is weird. We're using protobufs ?!?!?", data); messageBus.emit(JSON.parse(data)) } - - // console.log(`[message] Data received from server: ${event.data}`); - // let msg = JSON.parse(event.data) - // messageBus.emit(msg) }) - }); + }; messageBus.listen([13], function (msg) { alert(msg.message) // window.testt(byteArray) @@ -55,37 +49,10 @@ export function PlayerApp() { go.run(result.instance); console.log("should be loaded now") setIsWasmLoaded(true) - // 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")) - // 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")) - // .then((result) => { - // console.log(result) - // result.arrayBuffer().then(b => { - // const data = new Uint8Array(b) - // console.log(data) - // window.testt(data, function (data) { - // if(data instanceof Uint8Array) { - // const msg = proto.Message.deserializeBinary(data).toObject() - // messageBus.emit(msg) - // } else { - // // text frame - // // console.log(event.data); - // console.log("[message] text data received from server, this is weird. We're using protobufs ?!?!?", data); - // messageBus.emit(JSON.parse(data)) - // } - - // // console.log(`[message] Data received from server: ${event.data}`); - // // let msg = JSON.parse(event.data) - // // messageBus.emit(msg) - // }) - // }) - // }) - // .catch(err => console.log(err)) }); } - }, [isWasmLoaded]) - return (
@@ -98,3 +65,11 @@ export function PlayerApp() {
); } + +async function parseDemo(event, messageBus) { + await parse(event, messageBus) +} + +async function parse(event, messageBus) { + +} \ No newline at end of file