1+ #define TITLE "PIXMOB_VISUALIZER"
2+
3+ typedef int bool;
4+ #define true 1;
5+ #define false 0;
6+
7+ //c++
8+ typedef byte int8_t;
9+ typedef int16 int16_t;
10+ typedef int32 int32_t;
11+ typedef int64 int64_t;
12+ typedef int64 intptr_t;
13+
14+ typedef uchar uint8_t;
15+ typedef uint16 uint16_t;
16+ typedef uint32 uint32_t;
17+ typedef uint64 uint64_t;
18+ typedef uint64 uintptr_t;
19+
20+ long PaddingAlign(long num, int alignTo) {
21+ return (num % alignTo == 0) ? 0 : alignTo - (num % alignTo);
22+ }
23+
24+ bool AlignFS(int alignTo) {
25+ local int b2skip = PaddingAlign(FTell(), alignTo);
26+ FSkip(b2skip);
27+ return true;
28+ }
29+
30+ ubyte CalcCheckSum8(ubyte colA, ubyte colB, ubyte colC)
31+ {
32+ local ubyte output = (colA + colB + colC) & 0xFF;
33+ return output;
34+ }
35+
36+ uint32_t MakeRGBColor(uint8_t red, uint8_t green, uint8_t blue)
37+ {
38+ return ((uint32_t)red << 16) | ((uint32_t)green << 8) | (uint32_t)blue;
39+ }
40+
41+ uint32_t MakeBGRColor(uint8_t red, uint8_t green, uint8_t blue)
42+ {
43+ return ((uint32_t)blue << 16) | ((uint32_t)green << 8) | (uint32_t)red;
44+ }
45+
46+ //These chips work in big Endian
47+ BigEndian();
48+
49+ int i;
50+
51+ int64 position;
52+ ubyte col_green;
53+ ubyte col_red;
54+ ubyte col_blue;
55+ ubyte checksum;
56+ ubyte calculatedChecksum;
57+
58+ uint bookmark_color;
59+
60+ char txtBuffer[1024];
61+
62+ FSeek(0);
63+ FSkip(16); //Skip data we are not interested in
64+
65+ for (i = 0; i < 16; i++)
66+ {
67+ position = FTell();
68+ col_green = ReadUByte(position);
69+ col_red = ReadUByte(position + 1);
70+ col_blue = ReadUByte(position + 2);
71+ checksum = ReadUByte(position + 3);
72+
73+ calculatedChecksum = CalcCheckSum8(col_green, col_red, col_blue);
74+
75+ Printf("Profile %d - Green: %x, Red: %x, Blue: %x, Checksum: %x (Calculated: %x)",
76+ i + 1, col_green, col_red, col_blue, checksum, calculatedChecksum);
77+
78+ if (calculatedChecksum != checksum)
79+ {
80+ Printf(" - Checksum ERROR (Fixed!)\n " );
81+ WriteByte(position + 3, calculatedChecksum);
82+ }
83+ else
84+ {
85+ Printf(" - Checksum Correct!\n " );
86+ }
87+
88+ Memset(txtBuffer, 0, 1024);
89+ SPrintf(txtBuffer, "Profile_%x", i + 1);
90+
91+ bookmark_color = MakeBGRColor(col_red, col_green, col_blue);
92+ Printf("bookmark_color: [%06x] \n " , bookmark_color);
93+
94+ AddBookmark(position, txtBuffer, "byte", 4, cNone, bookmark_color);
95+
96+ FSeek(position + 4);
97+ }
0 commit comments