mirror of
				https://github.com/MaddyThorson/StrawberryBF.git
				synced 2025-11-04 01:41:33 +08:00 
			
		
		
		
	added Aseprite deflate with MiniZ
This commit is contained in:
		@ -85,7 +85,7 @@ namespace Strawberry
 | 
				
			|||||||
			Input.[Friend]Init(gamepadLimit);
 | 
								Input.[Friend]Init(gamepadLimit);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			Sprites = new Dictionary<String, Sprite>();
 | 
								Sprites = new Dictionary<String, Sprite>();
 | 
				
			||||||
			//LoadSprites();
 | 
								LoadSprites();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			BuildTypeLists();
 | 
								BuildTypeLists();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
@ -223,6 +223,7 @@ namespace Strawberry
 | 
				
			|||||||
					                width = WORD();
 | 
										                width = WORD();
 | 
				
			||||||
					                height = WORD();
 | 
										                height = WORD();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
														// TODO: allocating the entire RGBA data may cause a stack overflow if the image is big enough?
 | 
				
			||||||
					                var count = width * height * (int)mode;
 | 
										                var count = width * height * (int)mode;
 | 
				
			||||||
					                if (count > temp.Count)
 | 
										                if (count > temp.Count)
 | 
				
			||||||
					                    temp = scope:: uint8[count];
 | 
										                    temp = scope:: uint8[count];
 | 
				
			||||||
@ -235,17 +236,17 @@ namespace Strawberry
 | 
				
			|||||||
					                // DEFLATE
 | 
										                // DEFLATE
 | 
				
			||||||
					                else
 | 
										                else
 | 
				
			||||||
					                {
 | 
										                {
 | 
				
			||||||
										//TODO: Figure this out to enable aseprite loading
 | 
															// TODO: allocating the entire deflated image might cause stack overflow if the image is big enough?
 | 
				
			||||||
 | 
															// get the source buffer
 | 
				
			||||||
 | 
															var source = scope::uint8[chunkEnd - stream.Position];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
										Runtime.FatalError("Decompression not yet implemented.");
 | 
															// TODO: Is there some way to read more than one byte at a time from stream?
 | 
				
			||||||
 | 
															for (int n = 0; n < source.Count; n ++)
 | 
				
			||||||
 | 
																source[n] = stream.Read<uint8>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
										/*
 | 
															// decompress into the temp buffer
 | 
				
			||||||
										Noel's C#:
 | 
															var length = temp.Count;
 | 
				
			||||||
					                    SEEK(2);
 | 
															MiniZ.Uncompress(&temp[0], ref length, &source[0], source.Count);
 | 
				
			||||||
										
 | 
					 | 
				
			||||||
					                    using var deflate = new DeflateStream(reader.BaseStream, CompressionMode.Decompress, true);
 | 
					 | 
				
			||||||
					                    deflate.Read(temp, 0, count);
 | 
					 | 
				
			||||||
										*/
 | 
					 | 
				
			||||||
					                }
 | 
										                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					                // get pixel data
 | 
										                // get pixel data
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user