Esempio n. 1
0
        public static Encounters FromBytes(byte[] bytes)
        {
            GCHandle   gcHandle   = GCHandle.Alloc(bytes, GCHandleType.Pinned);
            Encounters encounters = (Encounters)Marshal.PtrToStructure(gcHandle.AddrOfPinnedObject(), typeof(Encounters));

            gcHandle.Free();
            return(encounters);
        }
Esempio n. 2
0
        public static void Populate_Encounters(byte[] file, int encounter_offset, List <EncountersWrapper> encounterlist)
        {
            int amount_of_maps  = 0xbf;
            int encounters_size = 0x10;

            for (int i = 0; i <= amount_of_maps; i++)
            {
                int    encounters_address = encounter_offset + 4 * i;
                byte[] slice = new byte[encounters_size];
                Array.Copy(file, encounters_address, slice, 0, encounters_size);
                Encounters encounters = Encounters.FromBytes(slice);
                encounterlist.Add(new EncountersWrapper(i, encounters_address, encounters));
            }
        }
 public EncountersWrapper(int id, int memory_location, Encounters encounters)
 {
     this.id = id;
     this.memory_location = memory_location;
     this.encounters      = encounters;
 }