private GeneralizedPointerTableEntry(GeneralizedPointerTableEntry copyMe)
        {
            this.MainPortraitPointer = copyMe.MainPortraitPointer;
            this.MiniPortraitPointer = copyMe.MiniPortraitPointer;
            this.PalettePointer = copyMe.PalettePointer;
            this.MouthPointer = copyMe.MouthPointer;
            this.GenericPointer = copyMe.GenericPointer;
            this.MainPortraitOffset = copyMe.MainPortraitOffset;
            this.MiniPortraitOffset = copyMe.MiniPortraitOffset;
            this.PaletteOffset = copyMe.PaletteOffset;
            this.MouthOffset = copyMe.MouthOffset;
            this.GenericOffset = copyMe.GenericOffset;

            this.MouthPosition = copyMe.MouthPosition;
            this.EyePosition = copyMe.EyePosition;
            this.EyeControl = copyMe.EyeControl;
        }
 private CanCauseError<Bitmap> GetBitmat(GeneralizedPointerTableEntry entry, IROM rom)
 {
     return from face in entry.MainPortraitOffset == 0 ? CanCauseError<byte[]>.NoError(null) :
                         GetData(rom,
                             entry.MainPortraitOffset,
                             CompressedPortrait,
                             this.MainPortraitSizeBytes,
                             "Main portrait")
            from mini in entry.MiniPortraitOffset == 0 ? CanCauseError<byte[]>.NoError(null) :
                         GetData(rom,
                             entry.MiniPortraitOffset,
                             this.CompressedMini,
                             this.MiniPortraitSizeBytes,
                             "Mini portrait")
            from generic in entry.GenericOffset == 0 ? CanCauseError<byte[]>.NoError(null) :
                         GetData(rom,
                             entry.GenericOffset,
                             true,
                             this.GenericSizeBytes,
                             "Generic portrait")
            from palette in entry.PaletteOffset == 0 ? CanCauseError<byte[]>.NoError(null) :
                         GetData(rom,
                             entry.PaletteOffset,
                             false,
                             this.PaletteSizeBytes,
                             "Palette")
            from mouth in entry.MouthOffset == 0 || !this.SeparateMouthFrames ? CanCauseError<byte[]>.NoError(null) :
                         GetData(rom,
                             entry.MouthOffset,
                             false,
                             this.MouthSizeBytes,
                             "Mouth")
            from result in GetPortraitFromRaw(face, mini, palette, mouth, generic)
            select result;
 }
        private CanCauseError InsertBitmapData(Bitmap bitmap, GeneralizedPointerTableEntry newData)
        {
            var result = PortraitFormat.WriteData(bitmap, memoryManager, rom);
            if (result.CausedError)
            {
                return (CanCauseError)result;
            }
            var ptrs = result.Result;

            //newData.MainPortraitPointer = ptrs[0];
            //newData.MiniPortraitPointer = ptrs[1];
            //newData.PalettePointer = ptrs[2];
            //newData.MouthPointer = ptrs.Length > 3 ? ptrs[3] : ManagedPointer.NullPointer;
            //newData.GenericPointer = ManagedPointer.NullPointer; //Not yet supported

            return CanCauseError.NoError;
        }
        public static CanCauseError<Bitmap> GetPortrait(GeneralizedPointerTableEntry entry, IROM rom)
        {
            var format = GetFormat(rom.GameCode);

            return format.GetBitmat(entry, rom);
        }