From 18266a296a53c809e6f0ef069112906a6ea9352f Mon Sep 17 00:00:00 2001 From: Kris Roberts Date: Mon, 11 Sep 2023 21:44:12 -0700 Subject: [PATCH] VA_Init1 calls "Initilize RobertsmaniaReplay plugin" but doesnt wait for it to return and runs it at the end of VA_Init1. Add check for null elements in g_CarIdxTimeLapPosition array when reseting data. Check for carIdx < 0 in NotInWorldPositionCheck. --- RobertsmaniaReplay/VAPlugin_RobertsmaniaReplay.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/RobertsmaniaReplay/VAPlugin_RobertsmaniaReplay.cs b/RobertsmaniaReplay/VAPlugin_RobertsmaniaReplay.cs index fdf57ed..830c465 100644 --- a/RobertsmaniaReplay/VAPlugin_RobertsmaniaReplay.cs +++ b/RobertsmaniaReplay/VAPlugin_RobertsmaniaReplay.cs @@ -375,6 +375,10 @@ private static void ResetTrackPositionData() { g_CarIdxTimeLapPositions[i].Clear(); } + else + { + g_CarIdxTimeLapPositions[i] = new List(); + } } } @@ -1186,6 +1190,10 @@ public static bool TrackSurfacesCheck(TrackSurfaces trackSurface) public static bool NotInWorldPositionCheck(int carIdx) { + if (carIdx < 0) + { + return false; + } return g_CurrentSessionTime - g_CarIdxNotInWorldTimes[carIdx] > cNotInWorldTimeoutSecs; } @@ -1595,7 +1603,6 @@ public static void VA_Init1(dynamic vaProxy) //note that in this version, you can get and set the VoiceAttack variables directly. _vaProxy = vaProxy; - _vaProxy.Command.Execute("Initialize RobertsmaniaReplay plugin", true, true, null); if (_iRSDKWrapper == null) { @@ -1615,6 +1622,8 @@ public static void VA_Init1(dynamic vaProxy) { g_Drivers[i] = new DriverEntry(0, 0); } + + _vaProxy.Command.Execute("Initialize RobertsmaniaReplay plugin", false, true, null); } #endregion