2022-06-25 18:14:00 +00:00
|
|
|
using System;
|
2021-01-06 23:46:43 +00:00
|
|
|
|
2022-06-18 18:04:24 +00:00
|
|
|
namespace PKHeX.Core;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Logic for recognizing .duc save files dumped via an ARDS.
|
|
|
|
/// </summary>
|
|
|
|
public sealed class SaveHandlerARDS : ISaveHandler
|
2021-01-06 23:46:43 +00:00
|
|
|
{
|
2022-06-18 18:04:24 +00:00
|
|
|
private const int sizeHeader = 0xA4;
|
|
|
|
private const int ExpectedSize = SaveUtil.SIZE_G4RAW + sizeHeader; // 0x800A4
|
2021-01-06 23:46:43 +00:00
|
|
|
|
2023-05-01 23:51:17 +00:00
|
|
|
public bool IsRecognized(long size) => size is ExpectedSize;
|
2021-01-06 23:46:43 +00:00
|
|
|
|
2022-06-25 18:14:00 +00:00
|
|
|
public SaveHandlerSplitResult TrySplit(ReadOnlySpan<byte> input)
|
2022-06-18 18:04:24 +00:00
|
|
|
{
|
|
|
|
// No authentication to see if it actually is a header; no size collisions expected.
|
2022-06-25 18:14:00 +00:00
|
|
|
var header = input[..sizeHeader].ToArray();
|
|
|
|
var data = input[sizeHeader..].ToArray();
|
2023-12-04 04:13:20 +00:00
|
|
|
return new SaveHandlerSplitResult(data, header, []);
|
2021-01-06 23:46:43 +00:00
|
|
|
}
|
|
|
|
}
|