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(); }
public static void SaveTrainerSpriteToFreeSpace(int index, byte[] sprite, Color[] pallete) { 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; string imgString; string palString; byte[] imgBytes; byte[] palBytes; string imgNewOffset; string palNewOffset; string LocalCompressLz77String() { var argsrcString = WichuRomFunctions.ConvertByteArrayToString(ref sprite); var ret = WichuRomFunctions.CompressLz77String(ref argsrcString); return(ret); } var argstr = LocalCompressLz77String(); imgBytes = WichuRomFunctions.ConvertStringToByteArray(ref argstr); string LocalCompressLz77String1() { var argsrcString = WichuSpriteFunctions.ConvertPaletteToString(ref pallete); var ret = WichuRomFunctions.CompressLz77String(ref argsrcString); return(ret); } var argstr1 = LocalCompressLz77String1(); palBytes = WichuRomFunctions.ConvertStringToByteArray(ref argstr1); imgString = ByteFunctions.ByteArrayToHexString(imgBytes); palString = ByteFunctions.ByteArrayToHexString(palBytes); imgNewOffset = modSearchFreeSpace.SearchFreeSpaceFourAligned(MainObject.LoadedRom, 0xFF, (long)(Strings.Len(imgString) / 2d), Conversions.ToLong("&H" + Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "StartSearchingForSpaceOffset", "800000"))).ToString(); var argStart = Conversions.ToInteger(imgNewOffset); HexFunctions.WriteHex(ref MainObject.LoadedRom, ref argStart, ref imgString); string LocalReverseHex() { var argHexData = Conversion.Hex(Conversions.ToDouble(imgNewOffset) + 134217728d); var ret = HexFunctions.ReverseHex(ref argHexData); return(ret); } var argData = LocalReverseHex(); HexFunctions.WriteHex(ref MainObject.LoadedRom, ref sOffset, ref argData); palNewOffset = modSearchFreeSpace.SearchFreeSpaceFourAligned(MainObject.LoadedRom, 0xFF, (long)(Strings.Len(palString) / 2d), Conversions.ToLong("&H" + Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "StartSearchingForSpaceOffset", "800000"))).ToString(); var argStart1 = Conversions.ToInteger(palNewOffset); HexFunctions.WriteHex(ref MainObject.LoadedRom, ref argStart1, ref palString); string LocalReverseHex1() { var argHexData = Conversion.Hex(Conversions.ToDouble(palNewOffset) + 134217728d); var ret = HexFunctions.ReverseHex(ref argHexData); return(ret); } var argData1 = LocalReverseHex1(); HexFunctions.WriteHex(ref MainObject.LoadedRom, ref pOffset, ref argData1); }