Skip to content

Commit

Permalink
fix extension parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
TalicZealot committed Mar 1, 2024
1 parent 50376cd commit 4565e01
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 25 deletions.
7 changes: 4 additions & 3 deletions SotnRandoTools/src/RandoTracker/Models/Extension.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -27,7 +28,7 @@ internal sealed class Extension
{
[JsonProperty("extends")]
public string Extends { get; set; } = "classic";
[JsonProperty("locations")]
[JsonProperty("customLocations")]
public List<ExtensionLocation> Locations { get; set; } = new List<ExtensionLocation>();
}
}
11 changes: 4 additions & 7 deletions SotnRandoTools/src/RandoTracker/Tracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
};
Expand All @@ -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<int> values = new List<int>();
foreach (var value in room.Values)
Expand Down Expand Up @@ -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]];
Expand Down
21 changes: 6 additions & 15 deletions SotnRandoTools/src/SotnRandoTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,8 @@
<EmbeddedResource Include="Resources\BizAlucard.png" />
</ItemGroup>
<ItemGroup Condition="$(DefineConstants.Contains('GL'))">
<Reference Include="BizHawk.Bizware.Graphics">
<HintPath>..\BizHawk\dll\BizHawk.Bizware.Graphics.dll</HintPath>
</Reference>
<Reference Include="BizHawk.Bizware.Graphics.Controls">
<HintPath>..\BizHawk\dll\BizHawk.Bizware.Graphics.Controls.dll</HintPath>
</Reference>
<Reference Include="BizHawk.Bizware.Graphics" HintPath="$(ProjectDir)../BizHawk/dll/BizHawk.Bizware.Graphics.dll" />
<Reference Include="BizHawk.Bizware.Graphics.Controls" HintPath="$(ProjectDir)../BizHawk.Bizware.Graphics.Controls.dll" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="all" />
Expand All @@ -67,16 +63,11 @@
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="WatsonWebsocket" Version="2.3.0" />
<Reference Include="BizHawk.Common">
<HintPath>..\BizHawk\dll\BizHawk.Common.dll</HintPath>
</Reference>
<Reference Include="BizHawk.Bizware.BizwareGL">
<HintPath>..\BizHawk\dll\BizHawk.Bizware.BizwareGL.dll</HintPath>
</Reference>
<Reference Include="BizHawk.Common" HintPath="$(ProjectDir)../BizHawk/dll/BizHawk.Common.dll" />
<Reference Include="BizHawk.Bizware.BizwareGL" HintPath="$(ProjectDir)../BizHawk/dll/BizHawk.Bizware.BizwareGL.dll" />
<Reference Include="PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<Reference Include="SotnApi">
<HintPath>..\BizHawk\ExternalTools\SotnRandoTools\dll\SotnApi.dll</HintPath>
</Reference>
<Reference Include="SotnApi" HintPath="$(ProjectDir)../BizHawk/ExternalTools/SotnRandoTools/dll/SotnApi.dll" />
<Reference Include="System.Memory" HintPath="$(ProjectDir)../BizHawk/dll/System.Memory.dll" />
<Reference Include="System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="System.Windows.Forms" />
<Reference Include="BizHawk.Client.Common" HintPath="$(ProjectDir)../BizHawk/dll/BizHawk.Client.Common.dll" />
Expand Down

0 comments on commit 4565e01

Please sign in to comment.