summarylogtreecommitdiffstats
path: root/palette.patch
blob: dcc3f808e66de0dcb36280813e4bfdb7ce227bf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
diff '--color=auto' -Naur a/smacker.c b/smacker.c
--- a/smacker.c	2021-06-09 15:49:13.498784481 +0200
+++ b/smacker.c	2021-06-09 15:49:52.586150196 +0200
@@ -1225,8 +1225,8 @@
 			size --;
 
 			/* overflow: see if we write/read beyond 256colors, or overwrite own palette */
-			if (i + count > 256 || src + count > 256 ||
-				(src < i && src + count > i)) {
+			if (i + count > 256 || src + count > 256)
+			{
 				fprintf(stderr, "libsmacker::palette_render(s,p,size) - ERROR: overflow, 0x40 attempt to copy %d entries from %d to %d\n", count, src, i);
 				goto error;
 			}
@@ -1733,6 +1733,11 @@
 	return SMK_MORE;
 }
 
+unsigned char smk_palette_updated(smk s)
+{
+	return s->frame_type[s->cur_frame] & 0x01;
+}
+
 /* advance to next frame */
 char smk_next(smk s)
 {
diff '--color=auto' -Naur a/smacker.h b/smacker.h
--- a/smacker.h	2021-06-09 15:49:13.498784481 +0200
+++ b/smacker.h	2021-06-09 15:49:32.952850956 +0200
@@ -91,6 +91,8 @@
 
 /** rewind to first frame and unpack */
 char smk_first(smk object);
+/** was the pallet updated this frame */
+unsigned char smk_palette_updated(smk s);
 /** advance to next frame and unpack */
 char smk_next(smk object);
 /** seek to first keyframe before/at N in an smk */