xy: Fix radar record read/write

This commit is contained in:
Kurt
2025-03-30 00:03:04 -05:00
parent 7eda8ada4d
commit a0be3f5f5f

View File

@@ -39,7 +39,7 @@ public Roamer6 Roamer
[TypeConverter(typeof(ValueTypeTypeConverter))]
public sealed class PokeRadar6(Memory<byte> Data)
{
public const int SIZE = 2 + (RecordCount * PokeRadarRecord.SIZE); // 0x18
public const int SIZE = 4 + (RecordCount * PokeRadarRecord.SIZE); // 0x18
private const int MaxCharge = 50;
private const int RecordCount = 5;
@@ -61,17 +61,17 @@ public sealed class PokeRadar6(Memory<byte> Data)
private static int GetRecordOffset(int index)
{
if ((uint) index >= RecordCount)
throw new ArgumentOutOfRangeException(nameof(index));
return 6 + (index * 2);
ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual<uint>((uint)index, RecordCount);
return 4 + (index * 4);
}
public PokeRadarRecord Record1 { get => GetRecord(0); set => SetRecord(value, 0); }
public PokeRadarRecord Record2 { get => GetRecord(1); set => SetRecord(value, 1); }
public PokeRadarRecord Record3 { get => GetRecord(2); set => SetRecord(value, 2); }
public PokeRadarRecord Record4 { get => GetRecord(3); set => SetRecord(value, 3); }
public PokeRadarRecord Record5 { get => GetRecord(4); set => SetRecord(value, 4); }
// xy.script.390
// It’s the record machine that offers details of the Poké Radar research.
public PokeRadarRecord RecordPast1st { get => GetRecord(0); set => SetRecord(value, 0); }
public PokeRadarRecord RecordPast2nd { get => GetRecord(1); set => SetRecord(value, 1); }
public PokeRadarRecord RecordPast3rd { get => GetRecord(2); set => SetRecord(value, 2); }
public PokeRadarRecord RecordTarget { get => GetRecord(3); set => SetRecord(value, 3); }
public PokeRadarRecord RecordLatest { get => GetRecord(4); set => SetRecord(value, 4); }
}
[TypeConverter(typeof(ValueTypeTypeConverter))]