private void LoadBlockTiles() { byte[] img1 = ImgFunction.LZUncompress(Br, tileset1.tileset - ROM).Item1; byte[] img2 = ImgFunction.LZUncompress(Br, tileset2.tileset - ROM).Item1; byte[] img = new byte[img1.Length + img2.Length]; Buffer.BlockCopy(img1, 0, img, 0, img1.Length); Buffer.BlockCopy(img2, 0, img, img1.Length, img2.Length); tileset = ImgFunction.ConvertGBAImageToBitmapIndexed(img, map_pals, 128, img.Length * 2 / 128); }
/// <summary> /// 保存任意压缩数据,需要提供原始指针所在地址。 /// </summary> /// <param name="rw"></param> /// <param name="data">所需要写入的数据</param> /// <param name="offset">指针所在地址</param> /// <param name="fill">是否将原来的数据填充为0xFF</param> public int Save(ReadAndWrite rw, byte[] data, int offset_to_repoint, bool fill) { //指针所在地址 int offset_old = rw.ReadPointer(offset_to_repoint); //新地址 int offset_new = rw.FindFreeOffset(start, data.Length); rw.WriteBytes(offset_new, 0, data); start = rw.Position; rw.Repoint(offset_to_repoint, offset_new); int length = ImgFunction.LZUncompress(rw.Br, offset_old).Item2; if (fill) { rw.FillWith0xFF(offset_old, length); } return(offset_new); }
public byte[] GetData(ReadAndWrite rw, int offset) { offset = rw.ReadPointer(offset); return(ImgFunction.LZUncompress(rw.Br, offset).Item1); }