Example #1
0
        public static void ExportAseriesSheet(string FileName, int PokemonIndex)
        {
            Bitmap ExportBitMap;

            if (MainObject.Header2 == "BPE")
            {
                var destBitmap   = new Bitmap(0x100, 0x80);
                var argsrcBitmap = GetImageFunctions.GetNormalAnimationPokemonPicToBitmap(PokemonIndex);
                WichuSpriteFunctions.BitmapBLT(ref argsrcBitmap, ref destBitmap, 0, 0, 0, 0, 0x40, 0x80);
                var argsrcBitmap1 = GetImageFunctions.GetShinyAnimationPokemonPicToBitmap(PokemonIndex);
                WichuSpriteFunctions.BitmapBLT(ref argsrcBitmap1, ref destBitmap, 0x40, 0, 0, 0, 0x40, 0x80);
                var argsrcBitmap2 = GetImageFunctions.GetNormalBackPokemonPicToBitmap(PokemonIndex);
                WichuSpriteFunctions.BitmapBLT(ref argsrcBitmap2, ref destBitmap, 0x80, 0, 0, 0, 0x40, 0x40);
                var argsrcBitmap3 = GetImageFunctions.GetBackPokemonPicToBitmap(PokemonIndex);
                WichuSpriteFunctions.BitmapBLT(ref argsrcBitmap3, ref destBitmap, 0xC0, 0, 0, 0, 0x40, 0x40);
                ExportBitMap = destBitmap;
            }
            else
            {
                var destBitmap2   = new Bitmap(0x100, 0x40);
                var argsrcBitmap4 = GetImageFunctions.GetFrontPokemonPicToBitmap(PokemonIndex);
                WichuSpriteFunctions.BitmapBLT(ref argsrcBitmap4, ref destBitmap2, 0, 0, 0, 0, 0x40, 0x40);
                var argsrcBitmap5 = GetImageFunctions.GetShinyFrontPokemonPicToBitmap(PokemonIndex);
                WichuSpriteFunctions.BitmapBLT(ref argsrcBitmap5, ref destBitmap2, 0x40, 0, 0, 0, 0x40, 0x40);
                var argsrcBitmap6 = GetImageFunctions.GetNormalBackPokemonPicToBitmap(PokemonIndex);
                WichuSpriteFunctions.BitmapBLT(ref argsrcBitmap6, ref destBitmap2, 0x80, 0, 0, 0, 0x40, 0x40);
                var argsrcBitmap7 = GetImageFunctions.GetBackPokemonPicToBitmap(PokemonIndex);
                WichuSpriteFunctions.BitmapBLT(ref argsrcBitmap7, ref destBitmap2, 0xC0, 0, 0, 0, 0x40, 0x40);
                ExportBitMap = destBitmap2;
            }

            ExportBitMap.Save(FileName);
            ExportBitMap.Dispose();
        }
Example #2
0
        // NEEDS TO BE MOVED TO THE FORMS SIDE
        public static void GetAndDrawTrainerPic(this PictureBox picBox, int index)
        {
            var sOffset   = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "TrainerImageTable", ""), System.Globalization.NumberStyles.HexNumber) + index * 8;
            var pOffset   = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "TrainerPaletteTable", ""), System.Globalization.NumberStyles.HexNumber) + index * 8;
            var temp      = new byte[4096];
            var image     = new byte[65536];
            var palette15 = new byte[4096];

            Color[] palette32;
            Bitmap  bSprite;

            using (var fs = new FileStream(MainObject.LoadedRom, FileMode.Open, FileAccess.Read))
            {
                using var r = new BinaryReader(fs);
                fs.Position = sOffset;
                sOffset     = r.ReadInt32() - 0x8000000;
                fs.Position = sOffset;
                r.Read(temp, 0, 0xFFF);
                Lz77.Lz77UnComp(temp, image);
                temp        = new byte[4096];
                fs.Position = pOffset;
                pOffset     = r.ReadInt32() - 0x8000000;
                fs.Position = pOffset;
                r.Read(temp, 0, 0xFFF);
                Lz77.Lz77UnComp(temp, palette15);
                palette32 = GetImageFunctions.LoadPalette(palette15);
            }

            bSprite      = GetImageFunctions.LoadSprite(ref image, palette32, 64, 64, Conversions.ToBoolean(Ini.GetString(MainObject.AppPath + "GBAPGESettings.ini", "Settings", "TransparentImages", "0")));
            picBox.Image = bSprite;
            picBox.Refresh();
        }
Example #3
0
        public static void ExportPokemonIcon(string filename, int PokemonIndex)
        {
            string localReadHEX()
            {
                var argStart2 = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "IconPalTable", ""), System.Globalization.NumberStyles.HexNumber) + PokemonIndex; var argLength = 1; var ret = HexFunctions.ReadHex(ref MainObject.LoadedRom, ref argStart2, ref argLength); return(ret);
            }

            var bitout = GetImageFunctions.GetAndDrawPokemonIconToBitmap(PokemonIndex, int.Parse(localReadHEX(), System.Globalization.NumberStyles.HexNumber), true);

            bitout.Save(filename);
        }
Example #4
0
        public static void GetAndDrawFrontPokemonPicBlack(this PictureBox picBox, int index)
        {
            var sOffset = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "PokemonFrontSprites", ""), System.Globalization.NumberStyles.HexNumber) + index * 8; // Pointer to Pokemon front sprites, + 8 = Bulbasaur.
            var pOffset = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "PokemonNormalPal", ""), System.Globalization.NumberStyles.HexNumber) + index * 8;    // Pointer to Pokemon normal palettes, + 8 = Bulbasaur.


            var temp      = new byte[4096];
            var image     = new byte[65536];
            var palette15 = new byte[4096];


            Color[] palette32;
            Bitmap  bSprite;


            using (var fileStream = new FileStream(MainObject.LoadedRom, FileMode.Open, FileAccess.Read))
            {
                using var r         = new BinaryReader(fileStream);
                fileStream.Position = sOffset;
                sOffset             = r.ReadInt32() - 0x8000000;
                fileStream.Position = sOffset;
                r.Read(temp, 0, 0xFFF);
                Lz77.Lz77UnComp(temp, image);
                temp = new byte[4096];
                fileStream.Position = pOffset;
                pOffset             = r.ReadInt32() - 0x8000000;
                fileStream.Position = pOffset;
                r.Read(temp, 0, 0xFFF);
                Lz77.Lz77UnComp(temp, palette15);
                palette32     = GetImageFunctions.LoadPalette(palette15);
                palette32[1]  = Color.Black;
                palette32[2]  = Color.Black;
                palette32[3]  = Color.Black;
                palette32[4]  = Color.Black;
                palette32[5]  = Color.Black;
                palette32[6]  = Color.Black;
                palette32[7]  = Color.Black;
                palette32[8]  = Color.Black;
                palette32[9]  = Color.Black;
                palette32[10] = Color.Black;
                palette32[11] = Color.Black;
                palette32[12] = Color.Black;
                palette32[13] = Color.Black;
                palette32[14] = Color.Black;
                palette32[15] = Color.Black;
            }

            bSprite      = GetImageFunctions.LoadSprite(ref image, palette32, 64, 64, Conversions.ToBoolean(Ini.GetString(MainObject.AppPath + "GBAPGESettings.ini", "Settings", "TransparentImages", "0")));
            picBox.Image = bSprite;
            picBox.Refresh();
        }
Example #5
0
        public static void GetAndDrawPokemonFootPrint(this PictureBox picBox, int index)
        {
            var    sOffset   = int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "FootPrintTable", ""), System.Globalization.NumberStyles.HexNumber) + index * 4;
            var    temp      = new byte[256];
            var    image     = new byte[256];
            var    palette32 = new Color[2];
            Bitmap bSprite;

            using (var fs = new FileStream(MainObject.LoadedRom, FileMode.Open, FileAccess.Read))
            {
                using var r = new BinaryReader(fs);
                fs.Position = sOffset;
                sOffset     = r.ReadInt32() - 0x8000000;
                fs.Position = sOffset;
                r.Read(temp, 0, 0xFF);
                image = temp;
            }

            palette32[0] = Color.Transparent;
            palette32[1] = Color.Black;
            bSprite      = GetImageFunctions.Load2BpSprite16By16(ref image, palette32);
            picBox.Image = bSprite;
            picBox.Refresh();
        }
Example #6
0
        public static void ExportTrainerSprite(string filename, int Index)
        {
            var bitout = GetImageFunctions.GetAndDrawTrainerSpriteToBitmap(Index, true);

            bitout.Save(filename);
        }
Example #7
0
        public static void ExportPokemonFootprint(string filename, int PokemonIndex)
        {
            var bitout = GetImageFunctions.GetPokemonFootPrintToBitmap(PokemonIndex);

            bitout.Save(filename);
        }