|
4 | 4 | using System.Collections.Generic; |
5 | 5 | using System.IO; |
6 | 6 | using System.Linq; |
| 7 | +using System.Reactive.Joins; |
7 | 8 | using System.Text; |
8 | 9 | using System.Threading.Tasks; |
9 | 10 | using ZXBasicStudio.BuildSystem; |
|
12 | 13 | using ZXBasicStudio.DocumentEditors.ZXGraphics.neg; |
13 | 14 | using ZXBasicStudio.DocumentModel.Enums; |
14 | 15 | using ZXBasicStudio.DocumentModel.Interfaces; |
| 16 | +using static System.Runtime.InteropServices.JavaScript.JSType; |
| 17 | +using Pattern = ZXBasicStudio.DocumentEditors.ZXGraphics.neg.Pattern; |
15 | 18 |
|
16 | 19 | namespace ZXBasicStudio.DocumentEditors.ZXGraphics.log |
17 | 20 | { |
@@ -466,6 +469,10 @@ public static string Export_Sprite_PutChars(ExportConfig exportConfig, IEnumerab |
466 | 469 | return Export_Sprite_PutChars_DIM(exportConfig, sprites); |
467 | 470 | case ExportDataTypes.ASM: |
468 | 471 | return Export_Sprite_PutChars_ASM(exportConfig, sprites); |
| 472 | + case ExportDataTypes.BIN: |
| 473 | + return Export_Sprite_PutChars_BIN(exportConfig, sprites); |
| 474 | + case ExportDataTypes.TAP: |
| 475 | + return Export_Sprite_PutChars_TAP(exportConfig, sprites); |
469 | 476 | default: |
470 | 477 | return "ERROR: Not implemented!"; |
471 | 478 | } |
@@ -677,7 +684,7 @@ private static string Export_Sprite_PutChars_Pattern(Sprite sprite, int n, Expor |
677 | 684 | var sb = new StringBuilder(); |
678 | 685 |
|
679 | 686 | var pattern = sprite.Patterns[n]; |
680 | | - var data = ServiceLayer.Files_CreateBinDataUpDown(pattern, sprite.Width, sprite.Height, exportConfig); |
| 687 | + var data = ServiceLayer.Files_CreateBinDataUpDown(pattern, sprite.Width, sprite.Height); |
681 | 688 |
|
682 | 689 | if (sprite.Frames > 1 && |
683 | 690 | !(sprite.Frames == 2 && sprite.Masked)) |
@@ -907,7 +914,7 @@ private static string Export_Sprite_PutChars_Pattern_ASM(Sprite sprite, int n, E |
907 | 914 | var sb = new StringBuilder(); |
908 | 915 |
|
909 | 916 | var pattern = sprite.Patterns[n]; |
910 | | - var data = ServiceLayer.Files_CreateBinDataUpDown(pattern, sprite.Width, sprite.Height, exportConfig); |
| 917 | + var data = ServiceLayer.Files_CreateBinDataUpDown(pattern, sprite.Width, sprite.Height); |
911 | 918 |
|
912 | 919 | int col = 0; |
913 | 920 | int row = 0; |
@@ -992,6 +999,47 @@ private static string Export_Sprite_PutChars_Attribute_ASM(Sprite sprite, int n, |
992 | 999 | #endregion |
993 | 1000 |
|
994 | 1001 |
|
| 1002 | + #region TAP and BIN |
| 1003 | + |
| 1004 | + |
| 1005 | + public static string Export_Sprite_PutChars_BIN(ExportConfig exportConfig, IEnumerable<Sprite> sprites) |
| 1006 | + { |
| 1007 | + var binData = Export_Sprite_PutChars_GetBinaryData(sprites); |
| 1008 | + ServiceLayer.Files_SaveFileData(exportConfig.ExportFilePath, binData); |
| 1009 | + return ""; |
| 1010 | + } |
| 1011 | + |
| 1012 | + |
| 1013 | + public static string Export_Sprite_PutChars_TAP(ExportConfig exportConfig, IEnumerable<Sprite> sprites) |
| 1014 | + { |
| 1015 | + var binData = Export_Sprite_PutChars_GetBinaryData(sprites); |
| 1016 | + binData = ServiceLayer.Bin2Tap(exportConfig.ZXFileName, exportConfig.ZXAddress, binData); |
| 1017 | + ServiceLayer.Files_SaveFileData(exportConfig.ExportFilePath, binData); |
| 1018 | + return ""; |
| 1019 | + } |
| 1020 | + |
| 1021 | + |
| 1022 | + private static byte[] Export_Sprite_PutChars_GetBinaryData(IEnumerable<Sprite> sprites) |
| 1023 | + { |
| 1024 | + var binData=new List<byte>(); |
| 1025 | + |
| 1026 | + foreach (var sprite in sprites) |
| 1027 | + { |
| 1028 | + if (sprite != null) |
| 1029 | + { |
| 1030 | + foreach (var pattern in sprite.Patterns) |
| 1031 | + { |
| 1032 | + var data = ServiceLayer.Files_CreateBinDataUpDown(pattern, sprite.Width, sprite.Height); |
| 1033 | + binData.AddRange(data); |
| 1034 | + } |
| 1035 | + } |
| 1036 | + } |
| 1037 | + |
| 1038 | + return binData.ToArray(); |
| 1039 | + } |
| 1040 | + |
| 1041 | + #endregion |
| 1042 | + |
995 | 1043 | #endregion |
996 | 1044 | } |
997 | 1045 | } |
0 commit comments