From 4565e0186e76fa8a730054c2f9ea9b1bfe4a5413 Mon Sep 17 00:00:00 2001 From: Talic Date: Fri, 1 Mar 2024 20:54:45 +0200 Subject: [PATCH] fix extension parsing --- .../src/RandoTracker/Models/Extension.cs | 7 ++++--- SotnRandoTools/src/RandoTracker/Tracker.cs | 11 ++++------ SotnRandoTools/src/SotnRandoTools.csproj | 21 ++++++------------- 3 files changed, 14 insertions(+), 25 deletions(-) diff --git a/SotnRandoTools/src/RandoTracker/Models/Extension.cs b/SotnRandoTools/src/RandoTracker/Models/Extension.cs index 046d79b..6be4710 100644 --- a/SotnRandoTools/src/RandoTracker/Models/Extension.cs +++ b/SotnRandoTools/src/RandoTracker/Models/Extension.cs @@ -1,14 +1,15 @@ using System.Collections.Generic; using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace SotnRandoTools.RandoTracker.Models { internal sealed class ExtensionRoom { [JsonProperty("address")] - public long Address { get; set; } + public string Address { get; set; } [JsonProperty("values")] - public int[]? Values { get; set; } + public string[] Values { get; set; } } internal sealed class ExtensionLocation { @@ -27,7 +28,7 @@ internal sealed class Extension { [JsonProperty("extends")] public string Extends { get; set; } = "classic"; - [JsonProperty("locations")] + [JsonProperty("customLocations")] public List Locations { get; set; } = new List(); } } diff --git a/SotnRandoTools/src/RandoTracker/Tracker.cs b/SotnRandoTools/src/RandoTracker/Tracker.cs index 825765c..07e8a19 100644 --- a/SotnRandoTools/src/RandoTracker/Tracker.cs +++ b/SotnRandoTools/src/RandoTracker/Tracker.cs @@ -6,7 +6,6 @@ using BizHawk.Client.Common; using BizHawk.Emulation.Common; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using SotnApi.Constants.Values.Game; using SotnApi.Interfaces; using SotnApi.Models; @@ -739,8 +738,8 @@ private bool LoadExtension(string extensionFilePath) customLocation = new Location { Name = location.Name, - Y = location.X, - X = location.Y, + X = location.X, + Y = location.Y, SecondCastle = location.SecondCastle, CustomExtension = true }; @@ -753,10 +752,10 @@ private bool LoadExtension(string extensionFilePath) customLocation.CustomExtension = true; } - int roomCounter = 1; + int roomCounter = 0; foreach (var room in location.Rooms) { - watchlistService.SafeLocationWatches.Add(Watch.GenerateWatch(domain, room.Address, WatchSize.Byte, WatchDisplayType.Hex, false, location.Name + roomCounter)); + watchlistService.SafeLocationWatches.Add(Watch.GenerateWatch(domain, Convert.ToInt64(room.Address, 16), WatchSize.Byte, WatchDisplayType.Hex, false, location.Name + roomCounter)); roomCounter++; List values = new List(); foreach (var value in room.Values) @@ -1359,8 +1358,6 @@ private void CheckReachability() private bool TrackedObjectStatus(string name) { - if (name is null) { throw new ArgumentNullException(nameof(name)); } - if (relicToIndex.ContainsKey(name)) { TrackerRelic relic = relics[relicToIndex[name]]; diff --git a/SotnRandoTools/src/SotnRandoTools.csproj b/SotnRandoTools/src/SotnRandoTools.csproj index 887037e..cc3a7d1 100644 --- a/SotnRandoTools/src/SotnRandoTools.csproj +++ b/SotnRandoTools/src/SotnRandoTools.csproj @@ -53,12 +53,8 @@ - - ..\BizHawk\dll\BizHawk.Bizware.Graphics.dll - - - ..\BizHawk\dll\BizHawk.Bizware.Graphics.Controls.dll - + + @@ -67,16 +63,11 @@ - - ..\BizHawk\dll\BizHawk.Common.dll - - - ..\BizHawk\dll\BizHawk.Bizware.BizwareGL.dll - + + - - ..\BizHawk\ExternalTools\SotnRandoTools\dll\SotnApi.dll - + +