1 Commits
Author SHA1 Message Date
esilva f569f46499 Bump the BeamNG SDK and report the title for the window 2026-07-06 23:42:08 +01:00
5 changed files with 13 additions and 6 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ module github.com/ESilva15/BeamNGMockOg
go 1.23.2
require (
github.com/ESilva15/gobngsdk v1.1.1
github.com/ESilva15/gobngsdk v1.1.3
github.com/spf13/cobra v1.10.1
)
+2 -2
View File
@@ -1,5 +1,5 @@
github.com/ESilva15/gobngsdk v1.1.1 h1:MyKUjIqG77lYcUY6cnZpnnxPoxS/FdAYwGoi6InXan0=
github.com/ESilva15/gobngsdk v1.1.1/go.mod h1:cKLaZRgM0tGGXDvosaSjHnxeyC5Y6rg7zCLqEUJnOzw=
github.com/ESilva15/gobngsdk v1.1.3 h1:CFaz2KjHKnBLrQuEN1QHOd1761cWM/rmTwLpSLrgbe4=
github.com/ESilva15/gobngsdk v1.1.3/go.mod h1:cKLaZRgM0tGGXDvosaSjHnxeyC5Y6rg7zCLqEUJnOzw=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
+3
View File
@@ -89,6 +89,9 @@ func (r *Recorder) view(ctx context.Context) {
case viewData := <-r.viewCh:
buf.Reset()
buf.WriteString("\x1b[2J\x1b[H")
fmt.Fprintf(&buf, "\x1b]0;%s - Recording ", ProgramName)
stringifyRecordingProgress(&buf, nBytes)
fmt.Fprintf(&buf, "\x07")
stringifyRecordingProgress(&buf, nBytes)
fmt.Fprintf(&buf, "\n\n")
+5 -3
View File
@@ -48,7 +48,7 @@ func NewReplayer(address string, port int, fp string) (*Replayer, error) {
replayer := &Replayer{
DataSourcePath: fp,
SDK: bngsdk.BeamNGSDK{
Data: &bngsdk.Outgauge{},
Data: bngsdk.Outgauge{},
Buffer: make([]byte, unsafe.Sizeof(bngsdk.Outgauge{})),
},
Socket: udp,
@@ -79,18 +79,20 @@ func (r *Replayer) renderToTerminal(ctx context.Context) {
return
case data := <-r.dataViewCh:
// Reset to the start of the terminal
percent := int(float64(data.SizeRead) / float64(fileInfo.Size()) * 100)
buf.Reset()
buf.WriteString("\x1b[2J\x1b[H")
fmt.Fprintf(&buf, "\x1b]0;%s - Replaying %d%%\x07", ProgramName, percent)
bytesReader.Reset(data.SDK.Buffer)
err := binary.Read(&bytesReader, binary.LittleEndian, r.SDK.Data)
err := binary.Read(&bytesReader, binary.LittleEndian, &r.SDK.Data)
if err != nil {
fmt.Fprintf(&buf, "FAILED TO PARSE DATA\nError: %+v", err)
_, _ = buf.WriteTo(os.Stdout)
continue
}
percent := int(float64(data.SizeRead) / float64(fileInfo.Size()) * 100)
fmt.Fprintf(&buf, "Replayed: %d%%\n", percent)
stringifyOutgaugeData(&buf, data.SDK)
+2
View File
@@ -5,6 +5,8 @@ import (
"net"
)
const ProgramName = "TelemetryMockerserver"
type Transport interface {
Send(data []byte) error
Close() error