Example #1
0
        /// <summary>
        /// Fills in fields based on data with the assumption that this is a Playstation-style save
        /// </summary>
        private void BuildFromGMEFile(byte[] file)
        {
            CopyArray(file, offset0x00, 0, 0x60);
            offset0x00[0x100] = 0xFF;
            CopyArray(file, saveNameRaw, 0x101, 17);

            Date = StupidDate.FromNormalDate(file[0x114], file[0x115]);

            SaveScreenMapPosition = file[0x116];
            CopyArray(file, offset0x117, 0x117, 9);
            Timer = (uint)((uint)file[0x120] + ((uint)file[0x121] << 8) + ((uint)file[0x122] << 16) + ((uint)file[0x123] << 24));
            
            byte[] artefactsDates = new byte[53];
            byte[] artefactsStates = new byte[6];
            CopyArray(file, artefactsDates, 0x124, 53);
            CopyArray(file, artefactsStates, 0x1AD8, 6);
            artefacts = new Artefacts(artefactsDates, artefactsStates);

            byte[] wondersDates = new byte[18];
            byte[] wondersStates = new byte[2];
            CopyArray(file, wondersDates, 0x159, 18);
            CopyArray(file, wondersStates, 0x1ADE, 2);
            wonders = new Wonders(wondersDates, wondersStates);

            byte[] featsDates = new byte[108];
            byte[] featsStates = new byte[48];
            CopyArray(file, featsDates, 0x16B, 108);
            CopyArray(file, featsStates, 0x1AE0, 48);
            feats = new Feats(featsDates, featsStates);

            CopyArray(file, offset0x400, 0x3F8, 64);
            numPropositions = file[0x438];
            CopyArray(file, prop1, 0x439, 9);
            CopyArray(file, prop2, 0x442, 9);
            CopyArray(file, prop3, 0x44B, 9);
            CopyArray(file, prop4, 0x454, 9);
            CopyArray(file, prop5, 0x45D, 9);
            CopyArray(file, prop6, 0x466, 9);
            CopyArray(file, prop7, 0x46F, 9);
            CopyArray(file, prop8, 0x478, 9);

            for (int i = 0; i < 16; i++)
            {
                byte[] charBytes = new byte[0xE0];
                CopyArray(file, charBytes, 0x484 + i * 0xE0, 0xE0);
                characters.Add(new Character(charBytes, i));
            }
            for (int i = 16; i < 24; i++)
            {
                characters.Add(new Character(i));
            }
            for (int i = 16; i < 20; i++)
            {
                byte[] charBytes = new byte[0xE0];
                CopyArray(file, charBytes, 0x484 + i * 0xE0, 0xE0);
                characters.Add(new Character(charBytes, i+8));
            }

            byte[] inventoryBytes = new byte[316];
            CopyArray(file, inventoryBytes, 0x1604, 256);
            inventory = new Inventory(inventoryBytes);

            CopyArray(file, inventoryBytes, 0x1704, 256);
            poachersDen = new Inventory(inventoryBytes, 255);

            CopyArray(file, offset0x2304, 0x1804, 304);
            WarFunds = (uint)((uint)file[0x1934] + ((uint)file[0x1935] << 8) + ((uint)file[0x1936] << 16) + ((uint)file[0x1937] << 24));
            CopyArray(file, offset0x2438, 0x1938, 4);
            CopyArray(file, offset0x2444, 0x1944, 4);
            MapPosition = file[0x1948];
            CopyArray(file, offset0x2449, 0x1949, 191);
            Kills = (uint)((uint)file[0x1A08] + ((uint)file[0x1A09] << 8) + ((uint)file[0x1A0A] << 16) + ((uint)file[0x1A0B] << 25));
            Casualties = (uint)((uint)file[0x1A0C] + ((uint)file[0x1A0D] << 8) + ((uint)file[0x1A0E] << 16) + ((uint)file[0x1A0F] << 24));
            CopyArray(file, offset0x2510, 0x1A10, 200);
            CopyArray(file, offset0x2610, 0x1B10, 372);

            byte[] optionsBytes = new byte[4];
            CopyArray(file, optionsBytes, 0x1C84, 4);
            options = new Options(optionsBytes);

            CopyArray(file, offset0x2788, 0x1C88, 376);
        }
Example #2
0
        /// <summary>
        /// Fills in fields based on data with assumption that this is a PSP-type save
        /// </summary>
        private void BuildFromPSPFile(byte[] file)
        {
            CopyArray(file, offset0x00, 0, 257);
            CopyArray(file, saveNameRaw, 0x101, 17);

            Date = new StupidDate(file[0x115], (Zodiac)((file[0x114] - 1) << 4));

            SaveScreenMapPosition = file[0x116];
            CopyArray(file, offset0x117, 0x117, 17);
            Timer = (uint)((uint)file[0x128] + ((uint)file[0x129] << 8) + ((uint)file[0x12A] << 16) + ((uint)file[0x12B] << 24));

            byte[] artefactsDates = new byte[53];
            byte[] artefactsStates = new byte[6];
            CopyArray(file, artefactsDates, 0x12C, 53);
            CopyArray(file, artefactsStates, 0x25D8, 6);
            artefacts = new Artefacts(artefactsDates, artefactsStates);

            byte[] wondersDates = new byte[18];
            byte[] wondersStates = new byte[2];
            CopyArray(file, wondersDates, 0x161, 18);
            CopyArray(file, wondersStates, 0x25DE, 2);
            wonders = new Wonders(wondersDates, wondersStates);

            byte[] featsDates = new byte[108];
            byte[] featsStates = new byte[48];
            CopyArray(file, featsDates, 0x173, 108);
            CopyArray(file, featsStates, 0x25E0, 48);
            feats = new Feats(featsDates, featsStates);

            CopyArray(file, offset0x400, 0x400, 64);
            numPropositions = file[0x440];
            CopyArray(file, prop1, 0x441, 9);
            CopyArray(file, prop2, 0x44A, 9);
            CopyArray(file, prop3, 0x453, 9);
            CopyArray(file, prop4, 0x45C, 9);
            CopyArray(file, prop5, 0x465, 9);
            CopyArray(file, prop6, 0x46E, 9);
            CopyArray(file, prop7, 0x477, 9);
            CopyArray(file, prop8, 0x480, 9);

            for (int i = 0; i < 28; i++)
            {
                byte[] charBytes = new byte[256];
                CopyArray(file, charBytes, 0x48C + i * 0x100, 0x100);
                characters.Add(new Character(charBytes, i));
            }

            byte[] inventoryBytes = new byte[316];
            CopyArray(file, inventoryBytes, 0x208C, 316);

            inventory = new Inventory(inventoryBytes);

            CopyArray(file, inventoryBytes, 0x21C8, 316);
            poachersDen = new Inventory(inventoryBytes, 255);

            CopyArray(file, offset0x2304, 0x2304, 304);
            WarFunds = (uint)((uint)file[0x2434] + ((uint)file[0x2435] << 8) + ((uint)file[0x2436] << 16) + ((uint)file[0x2437] << 24));
            CopyArray(file, offset0x2438, 0x2438, 4);
            CopyArray(file, offset0x2444, 0x2444, 4);
            MapPosition = file[0x2448];
            CopyArray(file, offset0x2449, 0x2449, 191);
            Kills = (uint)((uint)file[0x2508] + ((uint)file[0x2509] << 8) + ((uint)file[0x250A] << 16) + ((uint)file[0x250B] << 25));
            Casualties = (uint)((uint)file[0x250C] + ((uint)file[0x250D] << 8) + ((uint)file[0x250E] << 16) + ((uint)file[0x250F] << 24));
            CopyArray(file, offset0x2510, 0x2510, 200);
            CopyArray(file, offset0x2610, 0x2610, 372);

            byte[] optionsBytes = new byte[4];
            CopyArray(file, optionsBytes, 0x2784, 4);
            options = new Options(optionsBytes);

            CopyArray(file, offset0x2788, 0x2788, 692);
        }