Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/ModVerify.CliApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using Microsoft.Extensions.Logging;
using PG.Commons;
using PG.StarWarsGame.Engine;
using PG.StarWarsGame.Engine.Xml.Parsers;
using PG.StarWarsGame.Files.ALO;
using PG.StarWarsGame.Files.MEG;
using PG.StarWarsGame.Files.MTD;
Expand All @@ -35,6 +34,7 @@
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using AET.ModVerify.App.Reporting;
using PG.StarWarsGame.Engine.Xml;
using Testably.Abstractions;
using ILogger = Serilog.ILogger;

Expand All @@ -51,8 +51,8 @@ private static Task<int> Main(string[] args)

internal class Program : SelfUpdateableAppLifecycle
{
private static readonly string EngineParserNamespace = typeof(XmlObjectParser<>).Namespace!;
private static readonly string ParserNamespace = typeof(PetroglyphXmlFileParser<>).Namespace!;
private static readonly string EngineParserNamespace = typeof(PetroglyphStarWarsGameXmlParser).Namespace!;
private static readonly string ParserNamespace = typeof(XmlFileParser<>).Namespace!;
private static readonly string ModVerifyRootNameSpace = typeof(Program).Namespace!;
private static readonly CompiledExpression PrintToConsoleExpression = SerilogExpression.Compile($"EventId.Id = {ModVerifyConstants.ConsoleEventIdValue}");

Expand Down
2 changes: 1 addition & 1 deletion src/ModVerify.CliApp/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"Verify (Automatic Target Selection)": {
"commandName": "Project",
"commandLineArgs": "verify -o verifyResults --path \"C:\\Program Files (x86)\\Steam\\steamapps\\common\\Star Wars Empire at War\\corruption\""
"commandLineArgs": "verify --offline -o verifyResults --path \"C:/Program Files (x86)/Steam/steamapps/common/Star Wars Empire at War/corruption/Mods/Test\""
},
"Create Baseline Interactive": {
"commandName": "Project",
Expand Down
3 changes: 2 additions & 1 deletion src/ModVerify/DefaultGameVerifiersProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ public IEnumerable<GameVerifier> GetVerifiers(
GameVerifySettings settings,
IServiceProvider serviceProvider)
{
yield break;
yield return new ReferencedModelsVerifier(database, settings, serviceProvider);
yield return new DuplicateNameFinder(database, settings, serviceProvider);
yield return new AudioFilesVerifier(database, settings, serviceProvider);
yield return new GuiDialogsVerifier(database, settings, serviceProvider);
//yield return new CommandBarVerifier(database, settings, serviceProvider);
yield return new CommandBarVerifier(database, settings, serviceProvider);
}
}
2 changes: 1 addition & 1 deletion src/ModVerify/ModVerify.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net10.0</TargetFrameworks>
<PackageId>AlamoEngineTools.ModVerify</PackageId>
<RootNamespace>AET.ModVerify</RootNamespace>
<AssemblyName>AET.ModVerify</AssemblyName>
Expand Down
3 changes: 2 additions & 1 deletion src/ModVerify/Reporting/Engine/GameEngineErrorCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using PG.StarWarsGame.Engine.ErrorReporting;
using PG.StarWarsGame.Files.XML.ErrorHandling;

namespace AET.ModVerify.Reporting.Engine;

Expand All @@ -17,7 +18,7 @@ public sealed class GameEngineErrorCollection : IGameEngineErrorCollection, IGam

public IEnumerable<EngineAssert> Asserts => _asserts.ToList();

void IGameEngineErrorReporter.Report(XmlError error)
void IXmlParserErrorReporter.Report(XmlError error)
{
_xmlErrors.Add(error);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using PG.StarWarsGame.Engine.ErrorReporting;
using PG.StarWarsGame.Files.XML.ErrorHandling;

namespace AET.ModVerify.Reporting.Engine;

Expand Down
8 changes: 6 additions & 2 deletions src/ModVerify/Reporting/Engine/XmlParseErrorReporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using AET.ModVerify.Utilities;
using AET.ModVerify.Verifiers;
using Microsoft.Extensions.DependencyInjection;
using PG.StarWarsGame.Engine.ErrorReporting;
using PG.StarWarsGame.Engine.IO;
using PG.StarWarsGame.Files.XML.ErrorHandling;

Expand All @@ -29,7 +28,8 @@ protected override ErrorData CreateError(XmlError error)

var context = new List<string>
{
strippedFileName
$"Parser: {error.Parser.Name}",
$"File: {strippedFileName}"
};

var xmlElement = error.Element;
Expand Down Expand Up @@ -75,6 +75,8 @@ private static VerificationSeverity GetSeverityFromError(XmlParseErrorKind xmlEr
XmlParseErrorKind.DataBeforeHeader => VerificationSeverity.Information,
XmlParseErrorKind.MissingNode => VerificationSeverity.Critical,
XmlParseErrorKind.UnknownNode => VerificationSeverity.Information,
XmlParseErrorKind.TagHasElements => VerificationSeverity.Warning,
XmlParseErrorKind.UnexceptedElementName => VerificationSeverity.Information,
_ => VerificationSeverity.Warning
};
}
Expand All @@ -94,6 +96,8 @@ private static string GetIdFromError(XmlParseErrorKind xmlErrorErrorKind)
XmlParseErrorKind.DataBeforeHeader => VerifierErrorCodes.XmlDataBeforeHeader,
XmlParseErrorKind.MissingNode => VerifierErrorCodes.XmlMissingNode,
XmlParseErrorKind.UnknownNode => VerifierErrorCodes.XmlUnsupportedTag,
XmlParseErrorKind.TagHasElements => VerifierErrorCodes.XmlElementsInTag,
XmlParseErrorKind.UnexceptedElementName => VerifierErrorCodes.XmlUnexceptedElementName,
_ => throw new ArgumentOutOfRangeException(nameof(xmlErrorErrorKind), xmlErrorErrorKind, null)
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/ModVerify/Verifiers/DuplicateNameFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
using AnakinRaW.CommonUtilities.Collections;
using PG.Commons.Hashing;
using PG.StarWarsGame.Engine;
using PG.StarWarsGame.Engine.Xml;
using PG.StarWarsGame.Files.MTD.Data;
using PG.StarWarsGame.Files.MTD.Files;
using PG.StarWarsGame.Files.XML.Data;

namespace AET.ModVerify.Verifiers;

Expand Down
2 changes: 2 additions & 0 deletions src/ModVerify/Verifiers/GuiDialogs/GuiDialogsVerifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ private void VerifyGuiTextures()
};
components.AddRange(GameEngine.GuiDialogManager.Components);

// TODO: Verify no double definitions for textures and components exit

foreach (var component in components)
VerifyGuiComponentTexturesExist(component);

Expand Down
2 changes: 2 additions & 0 deletions src/ModVerify/Verifiers/VerifierErrorCodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ public static class VerifierErrorCodes
public const string XmlDataBeforeHeader = "XML08";
public const string XmlMissingNode = "XML09";
public const string XmlUnsupportedTag = "XML10";
public const string XmlElementsInTag = "XML11";
public const string XmlUnexceptedElementName = "XML12";
}
18 changes: 9 additions & 9 deletions src/PetroglyphTools/PG.StarWarsGame.Engine/Audio/Sfx/SfxEvent.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Collections.Generic;
using System.Linq;
using PG.Commons.Hashing;
using PG.StarWarsGame.Engine.Xml;
using PG.StarWarsGame.Files.XML;
using PG.StarWarsGame.Files.XML.Data;

namespace PG.StarWarsGame.Engine.Audio.Sfx;

Expand All @@ -25,11 +25,11 @@ public sealed class SfxEvent : NamedXmlObject
public const byte MaxPan2dValue = 100;
public const byte MinPriorityValue = 1;
public const byte MaxPriorityValue = 5;
public const byte MaxProbability = 100;
public const sbyte MinMaxInstances = 0;
public const sbyte InfinitivePlayCount = -1;
public const float MinLoopSeconds = 0.0f;
public const float MinVolumeSaturation = 0.0f;
public const byte MaxProbabilityValue = 100;
public const sbyte MinMaxInstancesValue = 0;
public const sbyte InfinitivePlayCountValue = -1;
public const float MinLoopSecondsValue = 0.0f;
public const float MinVolumeSaturationValue = 0.0f;

// Default values which are not the default value of the type
public const byte DefaultPriority = 3;
Expand Down Expand Up @@ -163,7 +163,7 @@ internal SfxEvent(string name, Crc32 nameCrc, XmlLocationInfo location)
{
}

internal override void CoerceValues()
internal void FixupValues()
{
AdjustMinMaxValues(ref _minVolume, ref _maxVolume);
AdjustMinMaxValues(ref _minPitch, ref _maxPitch);
Expand All @@ -187,15 +187,15 @@ internal override void CoerceValues()
*/
public void ApplyPreset(SfxEvent preset)
{
Preset = preset;

Is3D = preset.Is3D;
Is2D = preset.Is2D;
IsGui = preset.IsGui;
IsHudVo = preset.IsHudVo;
IsUnitResponseVo = preset.IsUnitResponseVo;
IsAmbientVo = preset.IsAmbientVo;
IsLocalized = preset.IsLocalized;
Preset = preset;
UsePresetName = preset.Name;
PlaySequentially = preset.PlaySequentially;
PreSamples = preset.PreSamples;
Samples = preset.Samples;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using PG.StarWarsGame.Engine.ErrorReporting;
using PG.StarWarsGame.Engine.IO.Repositories;
using PG.StarWarsGame.Engine.Localization;
using PG.StarWarsGame.Engine.Xml.Parsers;
using PG.StarWarsGame.Engine.Xml;

namespace PG.StarWarsGame.Engine.Audio.Sfx;

Expand All @@ -24,42 +24,20 @@ protected override async Task InitializeCoreAsync(CancellationToken token)

Logger?.LogInformation("Parsing SFXEvents...");

var contentParser = new XmlContainerContentParser(ServiceProvider, ErrorReporter);
contentParser.XmlParseError += OnParseError;
try
{
await Task.Run(() => contentParser.ParseEntriesFromFileListXml(
"DATA\\XML\\SFXEventFiles.XML",
GameRepository,
"DATA\\XML",
NamedEntries,
VerifyFilePathLength),
token);
}
finally
{
contentParser.XmlParseError -= OnParseError;
}
}

private void OnParseError(object sender, XmlContainerParserErrorEventArgs e)
{
if (e.ErrorInXmlFileList || e.HasException)
{
e.Continue = false;
ErrorReporter.Report(new InitializationError
var contentParser = new PetroglyphStarWarsGameXmlParser(GameRepository,
new PetroglyphStarWarsGameXmlParseSettings
{
GameManager = ToString(),
Message = GetMessage(e)
});
}
}

private static string GetMessage(XmlContainerParserErrorEventArgs errorEventArgs)
{
if (errorEventArgs.HasException)
return $"Error while parsing SFXEvent XML file '{errorEventArgs.File}': {errorEventArgs.Exception.Message}";
return "Could not find SFXEventFiles.xml";
InvalidObjectXmlFailsInitialization = true,
InvalidFilesListXmlFailsInitialization = true
}, ServiceProvider, ErrorReporter);

await Task.Run(() => contentParser.ParseEntriesFromFileListXml(
"DATA\\XML\\SFXEventFiles.XML",
"DATA\\XML",
NamedEntries,
VerifyFilePathLength),
token);
}

private void VerifyFilePathLength(string filePath)
Expand Down
Loading
Loading