98 lines
5.6 KiB
C#
98 lines
5.6 KiB
C#
using System.Buffers.Binary;
|
|
using GamePort.Game;
|
|
|
|
var original = Path.GetFullPath(args.Length == 1 ? args[0] : "../Original");
|
|
var source = File.ReadAllBytes(Path.Combine(original, "Neutron.exe"));
|
|
float SourceFloat(int va) => BitConverter.Int32BitsToSingle(BinaryPrimitives.ReadInt32LittleEndian(source.AsSpan(va - 0x400000, 4)));
|
|
void Bytes(int va, string hex)
|
|
{
|
|
var expected = Convert.FromHexString(hex);
|
|
Require(source.AsSpan(va - 0x400000, expected.Length).SequenceEqual(expected), $"Original instructions differ at0x{va:X}");
|
|
}
|
|
Near(SourceFloat(0x48d974), ObjectivePanel.SlideInSeconds, "source entry boundary");
|
|
Near(SourceFloat(0x48d970), ObjectivePanel.SlideScale, "source slide scale");
|
|
Near(SourceFloat(0x48d96c), ObjectivePanel.SlideDistance, "source slide distance");
|
|
Near(SourceFloat(0x48d940), ObjectivePanel.ExitDuration, "source exit window");
|
|
Require(BinaryPrimitives.ReadInt32LittleEndian(source.AsSpan(0xec498, 4)) == 7, "Source stationary end differs");
|
|
Bytes(0x406f76, "C70588814F0000000000");
|
|
Bytes(0x4043d9, "391DE4995000");
|
|
Bytes(0x4043e5, "D90588814F00D8442428");
|
|
Bytes(0x407071, "A087985000");
|
|
Bytes(0x40715b, "C705307C4F0001000000");
|
|
Bytes(0x40718e, "C70588814F0000000000");
|
|
Bytes(0x407271, "578BCEFF92CC040000");
|
|
Console.WriteLine("PASS source objective timer/input/visibility instructions and constants");
|
|
|
|
var panel = new ObjectivePanel(1);
|
|
panel.Step(0);
|
|
Require(!panel.PadVisible && !panel.ContentVisible, "Loaded selector starts hidden at original timer20");
|
|
panel.Select(1); panel.Step(0);
|
|
Require(panel.PadVisible && !panel.ContentVisible, "Slide-in draws pad without objective/digit");
|
|
Near(panel.YOffset, 31, "Entry pad is100 below its layout position");
|
|
panel.Step(.35f);
|
|
Near(panel.YOffset, -19, "Half entry position follows source scale");
|
|
panel.Step(.35f);
|
|
Require(panel.PadVisible && panel.ContentVisible, "Content becomes visible at entry equality.7");
|
|
Near(panel.YOffset, -69, "Stationary original layout offset");
|
|
panel.Step(6.3f);
|
|
Near(panel.Elapsed, 7, "Exact stationary boundary");
|
|
Require(panel.PadVisible && !panel.ContentVisible, "Exit hides content at7, retaining pad");
|
|
panel.Step(.35f);
|
|
Near(panel.YOffset, -19, "Exit pad moves down using source reciprocal");
|
|
panel.Step(ObjectivePanel.ExitEnd-panel.Elapsed);
|
|
Require(!panel.PadVisible && !panel.ContentVisible, "Pad disappears at8.7 equality");
|
|
Console.WriteLine("PASS source slide-in/stationary/slide-out coordinates and exact timeout boundaries");
|
|
|
|
panel.Key(true); panel.Step(0);
|
|
Require(panel.PadVisible && panel.Elapsed == 0, "O reopens hidden panel");
|
|
panel.Step(1); panel.Key(true);
|
|
Require(panel.ContentVisible && panel.Elapsed == 1, "Held O does not retrigger");
|
|
panel.Key(false); panel.Key(true); panel.Step(0);
|
|
Require(panel.Elapsed == 7 && !panel.ContentVisible, "Next O edge starts slide-out");
|
|
panel.Key(false); panel.Key(true); panel.Step(0);
|
|
Require(panel.Elapsed == 0 && panel.PadVisible, "O during slide-out reopens");
|
|
Near(panel.LayoutOffset, -69, "O does not resize/change gadget layout");
|
|
Console.WriteLine("PASS O edge latch, close/reopen phases and layout separation");
|
|
|
|
panel.Select(2); panel.Step(1);
|
|
Require(panel.CurrentObjective == 2 && panel.ContentVisible, "New objective shows after entry");
|
|
panel.Select(2); panel.Step(0);
|
|
Require(panel.Elapsed == 0 && !panel.ContentVisible, "Same positive selector also resets timing");
|
|
panel.Select(0);
|
|
Require(panel.CurrentObjective == 2 && panel.Elapsed == 0, "Nonpositive assignment is source no-op");
|
|
var empty = new ObjectivePanel(); empty.Show(); empty.Step(1);
|
|
Require(!empty.PadVisible && !empty.ContentVisible, "Objective0 does not invent art/digit");
|
|
Console.WriteLine("PASS source selector reset/no-op and no-objective presentation");
|
|
|
|
panel.Step(1);
|
|
var saved = panel.Elapsed;
|
|
panel.Step(10, hasControlledActor: false);
|
|
Require(panel.Elapsed == saved && !panel.PadVisible && !panel.ContentVisible, "No controlled entity freezes/hides UI");
|
|
panel.Step(0);
|
|
Require(panel.ContentVisible && panel.Elapsed == saved, "Explicit paused clock does not consume time");
|
|
panel.Step(0, modalActive: true);
|
|
Require(panel.Elapsed == ObjectivePanel.ExitEnd && !panel.PadVisible && !panel.ContentVisible, "Practice modal forces hidden end time");
|
|
panel.Show(); panel.Step(0);
|
|
Require(panel.PadVisible && panel.Elapsed == 0, "Practice dismissal may explicitly reopen current objective");
|
|
Console.WriteLine("PASS separate controlled-entity, pause and modal lifecycle");
|
|
|
|
var sounded = new ObjectivePanel();
|
|
var sounds = new List<int>(); sounded.SoundEffect += sounds.Add;
|
|
sounded.Select(1); sounded.Step(0); sounded.Step(.1f); sounded.Select(2); sounded.Step(0);
|
|
Require(sounds.SequenceEqual(new[] {216}), "Entry sound latch survives timer reset during entry");
|
|
sounded.Step(.7f); sounded.Select(3); sounded.Step(0);
|
|
Require(sounds.SequenceEqual(new[] {216,216}), "Stationary phase rearms the next entry sound");
|
|
Throws<ArgumentOutOfRangeException>(() => sounded.Step(float.NaN));
|
|
Throws<ArgumentOutOfRangeException>(() => sounded.Step(-1));
|
|
Throws<ArgumentOutOfRangeException>(() => sounded.Select(44));
|
|
Console.WriteLine("PASS source entry-sound latch and malformed input bounds");
|
|
Console.WriteLine("Objective checks:6 groups passed. Original gameplay comparison remains outstanding.");
|
|
|
|
static void Require(bool condition, string message) { if (!condition) throw new InvalidOperationException(message); }
|
|
static void Near(float actual, float expected, string message) => Require(MathF.Abs(actual-expected)<.0002f, $"{message}: {actual} != {expected}");
|
|
static void Throws<T>(Action action) where T : Exception
|
|
{
|
|
try { action(); } catch (T) { return; }
|
|
throw new InvalidOperationException($"Expected{typeof(T).Name}");
|
|
}
|