Add G4 Box Flags (#2478)

This commit is contained in:
Ammako
2019-11-20 14:39:31 -05:00
committed by Kurt
parent f19193c66f
commit ee9c91e893
2 changed files with 11 additions and 4 deletions

View File

@@ -58,6 +58,7 @@ private void GetSAVOffsets()
private const int BOX_END = BOX_COUNT * BOX_DATA_LEN; // 18 * 0x1000
private const int BOX_NAME = 0x12008; // after current & counter
private const int BOX_WP = BOX_NAME + (BOX_COUNT * BOX_NAME_LEN); // 0x122D8;
private const int BOX_FLAGS = 18 + BOX_WP; // 0x122EA;
public override int GetBoxOffset(int box) => box * 0x1000;
private static int GetBoxNameOffset(int box) => BOX_NAME + (box * BOX_NAME_LEN);
@@ -70,6 +71,12 @@ public override int CurrentBox
set => Storage[BOX_END] = (byte)value;
}
public override byte[] BoxFlags
{
get => new[] { Storage[BOX_FLAGS] };
set => Storage[BOX_FLAGS] = value[0];
}
public int Counter
{
get => BitConverter.ToInt32(Storage, BOX_END + 4);

View File

@@ -25,7 +25,7 @@ public abstract class SAV4Sinnoh : SAV4
private const int BOX_END = BOX_COUNT * BOX_DATA_LEN; // 18 * 0xFF0
private const int BOX_NAME = 4 + BOX_END; // after box data
private const int BOX_WP = BOX_NAME + (BOX_COUNT * BOX_NAME_LEN); // 0x121B4;
private const int BOX_WP_END = 18 + BOX_WP; // 0x121C6
private const int BOX_FLAGS = 18 + BOX_WP; // 0x121C6
public override int GetBoxOffset(int box) => 4 + (box * BOX_DATA_LEN);
private static int GetBoxNameOffset(int box) => BOX_NAME + (box * BOX_NAME_LEN);
@@ -37,10 +37,10 @@ public abstract class SAV4Sinnoh : SAV4
set => Storage[0] = (byte)value;
}
public int Unknown
public override byte[] BoxFlags
{
get => BitConverter.ToInt32(Storage, BOX_WP_END);
set => SetData(Storage, BitConverter.GetBytes(value), BOX_WP_END);
get => new[] { Storage[BOX_FLAGS] };
set => Storage[BOX_FLAGS] = value[0];
}
public override string GetBoxName(int box) => GetString(Storage, GetBoxNameOffset(box), BOX_NAME_LEN);