Example #1
0
        public void Write()
        {
            switch (Save.SaveInstance.SaveGeneration)
            {
            case SaveGeneration.GCN:
            case SaveGeneration.Wii:
                Write(PatternUtility.EncodeC4(DecodedData));
                break;

            case SaveGeneration.NDS:
            case SaveGeneration.N3DS:
                Write(PatternUtility.CondenseNonBlockPattern(DecodedData));
                break;
            }
        }
Example #2
0
        public void Import(uint[] bitmapBuffer)
        {
            // Convert to nibble map array of bytes
            var patternBuffer = new byte[bitmapBuffer.Length / 2];

            if (_saveFile.SaveGeneration == SaveGeneration.NDS || _saveFile.SaveGeneration == SaveGeneration.N3DS)
            {
                for (var i = 0; i < patternBuffer.Length; i++)
                {
                    var idx = i * 2;
                    patternBuffer[i] = (byte)((PatternData.ClosestColorRgb(bitmapBuffer[idx + 1], PaletteData) << 4) |
                                              PatternData.ClosestColorRgb(bitmapBuffer[idx], PaletteData));
                }
            }
            else
            {
                var convertedBuffer = new byte[bitmapBuffer.Length];
                for (var i = 0; i < convertedBuffer.Length; i++)
                {
                    convertedBuffer[i] = PatternData.ClosestColorRgb(bitmapBuffer[i], PaletteData,
                                                                     _saveFile.SaveGeneration == SaveGeneration.GCN);
                }
                patternBuffer = PatternUtility.EncodeC4(convertedBuffer);
            }

            switch (_saveFile.SaveGeneration)
            {
            case SaveGeneration.GCN:
            case SaveGeneration.Wii:
                GeneratePatternBitmap(patternBuffer);
                break;

            case SaveGeneration.NDS:
                GenerateWwPatternBitmap(patternBuffer);
                break;

            case SaveGeneration.N3DS:
                GenerateNlPatternBitmap(patternBuffer);
                break;
            }

            Write(patternBuffer);
        }
Example #3
0
        public void Import(uint[] Bitmap_Buffer)
        {
            // Convert to nibble map array of bytes
            byte[] Pattern_Buffer = new byte[Bitmap_Buffer.Length / 2];

            if (Save_File.Save_Generation == SaveGeneration.NDS || Save_File.Save_Generation == SaveGeneration.N3DS)
            {
                for (int i = 0; i < Pattern_Buffer.Length; i++)
                {
                    int idx = i * 2;
                    Pattern_Buffer[i] = (byte)((PatternData.ClosestColorRGB(Bitmap_Buffer[idx + 1], PaletteData) << 4) | PatternData.ClosestColorRGB(Bitmap_Buffer[idx], PaletteData)); // these are reversed
                }
            }
            else
            {
                byte[] ConvertedBuffer = new byte[Bitmap_Buffer.Length];
                for (int i = 0; i < ConvertedBuffer.Length; i++)
                {
                    ConvertedBuffer[i] = PatternData.ClosestColorRGB(Bitmap_Buffer[i], PaletteData);
                }
                Pattern_Buffer = PatternUtility.EncodeC4(ConvertedBuffer);
            }

            switch (Save_File.Save_Generation)
            {
            case SaveGeneration.GCN:
            case SaveGeneration.Wii:
                GeneratePatternBitmap(Pattern_Buffer);
                break;

            case SaveGeneration.NDS:
                GenerateWWPatternBitmap(Pattern_Buffer);
                break;

            case SaveGeneration.N3DS:
                GenerateNLPatternBitmap(Pattern_Buffer);
                break;
            }

            Write(Pattern_Buffer);
        }
Example #4
0
        public void RedrawBitmap()
        {
            switch (_saveFile.SaveGeneration)
            {
            case SaveGeneration.GCN:
            case SaveGeneration.Wii:
                GeneratePatternBitmap(DecodedData, false);
                Write(PatternUtility.EncodeC4(DecodedData, 32, 32));
                break;

            case SaveGeneration.NDS:
                GenerateWwPatternBitmap(DecodedData, false);
                Write(PatternUtility.CondenseNonBlockPattern(DecodedData));
                break;

            case SaveGeneration.N3DS:
                GenerateNlPatternBitmap(DecodedData, false);
                Write(PatternUtility.CondenseNonBlockPattern(DecodedData));
                break;
            }
        }