public byte[] ToByteArray() { byte[] result = new byte[saveFileSize]; CopyArray(offset0x00, result, 0, 0, 257); Character.EncodeName(characters[0].Name, result, 0x101); for (int i = characters[0].Name.Length; i < 17; i++) { result[0x101 + i] = 0xFE; } result[0x112] = Characters[0].Job.Byte; result[0x113] = Characters[0].Level; result[0x114] = (byte)((((byte)Date.Month) >> 4) + 1); result[0x115] = (byte)Date.Day; result[0x116] = SaveScreenMapPosition; CopyArray(offset0x117, result, 0, 0x117, 17); result[0x128] = (byte)(Timer & 0xFF); result[0x129] = (byte)((Timer >> 8) & 0xFF); result[0x12A] = (byte)((Timer >> 16) & 0xFF); result[0x12B] = (byte)((Timer >> 24) & 0xFF); CopyArray(artefacts.DatesToByteArray(), result, 0, 0x12C, 53); CopyArray(wonders.DatesToByteArray(), result, 0, 0x161, 18); CopyArray(feats.DatesToByteArray(), result, 0, 0x173, 108); CopyArray(offset0x1DF, result, 0, 0x1DF, 545); CopyArray(offset0x400, result, 0, 0x400, 64); result[0x440] = numPropositions; CopyArray(prop1, result, 0, 0x441, 9); CopyArray(prop2, result, 0, 0x44A, 9); CopyArray(prop3, result, 0, 0x453, 9); CopyArray(prop4, result, 0, 0x45C, 9); CopyArray(prop5, result, 0, 0x465, 9); CopyArray(prop6, result, 0, 0x46E, 9); CopyArray(prop7, result, 0, 0x477, 9); CopyArray(prop8, result, 0, 0x480, 9); result[0x489] = 0xFF; result[0x48A] = 0xFF; result[0x48B] = 0xFF; for (int i = 0; i < 28; i++) { if (Characters[i] != null) { byte[] charBytes = Characters[i].ToByteArray(); CopyArray(charBytes, result, 0, 0x48C + i * 0x100, 0x100); } } inventory.UpdateEquippedQuantities(characters); CopyArray(inventory.ToByteArray(), result, 0, 0x208C, 316); CopyArray(poachersDen.ToByteArray(), result, 0, 0x21C8, 316); CopyArray(offset0x2304, result, 0, 0x2304, 304); result[0x2434] = (byte)(WarFunds & 0xFF); result[0x2435] = (byte)((WarFunds >> 8) & 0xFF); result[0x2436] = (byte)((WarFunds >> 16) & 0xFF); result[0x2437] = (byte)((WarFunds >> 24) & 0xFF); CopyArray(offset0x2438, result, 0, 0x2438, 4); DateTime realDate = Date.ToNormalDate(); result[0x243C] = (byte)realDate.Month; result[0x2440] = (byte)realDate.Day; CopyArray(offset0x2444, result, 0, 0x2444, 4); result[0x2448] = MapPosition; CopyArray(offset0x2449, result, 0, 0x2449, 191); result[0x2508] = (byte)(Kills & 0xFF); result[0x2509] = (byte)((Kills >> 8) & 0xFF); result[0x250A] = (byte)((Kills >> 16) & 0xFF); result[0x250B] = (byte)((Kills >> 24) & 0xFF); result[0x250C] = (byte)(Casualties & 0xFF); result[0x250D] = (byte)((Casualties >> 8) & 0xFF); result[0x250E] = (byte)((Casualties >> 16) & 0xFF); result[0x250F] = (byte)((Casualties >> 24) & 0xFF); CopyArray(offset0x2510, result, 0, 0x2510, 200); CopyArray(artefacts.StatesToByteArray(), result, 0, 0x25D8, 6); CopyArray(wonders.StatesToByteArray(), result, 0, 0x25DE, 2); CopyArray(feats.StatesToByteArray(), result, 0, 0x25E0, 48); CopyArray(offset0x2610, result, 0, 0x2610, 372); CopyArray(options.ToByteArray(), result, 0, 0x2784, 4); CopyArray(offset0x2788, result, 0, 0x2788, 692); result[0x2A3A] = 0xFF; result[0x2A3B] = 0xFF; AddChecksum(result); return(result); }