Not much here
This commit is contained in:
+12
-5
@@ -14,7 +14,7 @@ func TestFunctionality(t *testing.T) {
|
||||
t.Fatal("Was unable to prepare telemetry file for testing.")
|
||||
}
|
||||
|
||||
i, err := Init(input, "", "")
|
||||
i, _ := Init(input, "", "")
|
||||
defer i.Close()
|
||||
|
||||
// Set up a loop to iterate our data
|
||||
@@ -32,14 +32,21 @@ func TestFunctionality(t *testing.T) {
|
||||
// Vehicle Movement data gathered from the names we can find on the
|
||||
// telemetry_docs.pdf file
|
||||
// - I wish to make this less verbose if possible
|
||||
if _, ok := i.Vars.Vars["Gear"]; !ok {
|
||||
log.Fatal("Field `Gear` doesn't exist")
|
||||
if _, ok := i.Vars.Vars["CarIdxPosition"]; !ok {
|
||||
log.Fatal("Field `CarIdxPosition` doesn't exist")
|
||||
}
|
||||
driversPositions := i.Vars.Vars["CarIdxPosition"].Value.([]int)
|
||||
|
||||
gear := int32(i.Vars.Vars["Gear"].Value.(int))
|
||||
drivers := i.SessionInfo.DriverInfo.Drivers
|
||||
|
||||
fmt.Printf("\033[?25l\033[2J\033[H")
|
||||
fmt.Printf("Gear: %d\n", gear)
|
||||
for k := range len(drivers) {
|
||||
if drivers[k].CarIsPaceCar == 1 || drivers[k].IsSpectator == 1 {
|
||||
continue
|
||||
}
|
||||
|
||||
fmt.Printf("[%d] [%d] %s\n", k, driversPositions[drivers[k].CarIdx], drivers[k].UserName)
|
||||
}
|
||||
|
||||
<-mainLoopTicker.C
|
||||
}
|
||||
|
||||
+11
-11
@@ -151,19 +151,19 @@ func (i *IBT) readData(buf []byte) error {
|
||||
case IRSDK_bool:
|
||||
v.Value = int(rbuf[0]) > 0
|
||||
case IRSDK_int:
|
||||
v.Value = int(binary.LittleEndian.Uint32(rbuf))
|
||||
fmt.Printf("%s\n", v.Name)
|
||||
if v.Name == "CarIdxPosition" {
|
||||
fmt.Printf("CarIdXPosition: %d\n", v.Count)
|
||||
for entry := range v.Count {
|
||||
if v.Count > 1 {
|
||||
data := make([]int, v.Count)
|
||||
for entry := 0; entry < int(v.Count); entry++ {
|
||||
entryOffset := v.Offset + int32(entry)*int32(VarTypes[int(v.Type)].Size)
|
||||
rbuf := buf[entryOffset : entryOffset+int32(VarTypes[int(v.Type)].Size)]
|
||||
v := int(binary.LittleEndian.Uint32(rbuf))
|
||||
if v != 0 {
|
||||
fmt.Printf("[%d] %v %v\n", entry, v, i.SessionInfo.DriverInfo.Drivers[entry].AbbrevName)
|
||||
}
|
||||
}
|
||||
}
|
||||
newValue := int(binary.LittleEndian.Uint32(rbuf))
|
||||
data[entry] = newValue
|
||||
}
|
||||
|
||||
v.Value = data
|
||||
} else {
|
||||
v.Value = int(binary.LittleEndian.Uint32(rbuf))
|
||||
}
|
||||
case IRSDK_bitField:
|
||||
v.Value = fmt.Sprintf("0x%x", int(binary.LittleEndian.Uint32(rbuf)))
|
||||
case IRSDK_float:
|
||||
|
||||
Reference in New Issue
Block a user