Skip to content

Commit 3e9a5f0

Browse files
committed
Updated
1 parent 6eba854 commit 3e9a5f0

File tree

4 files changed

+102
-1
lines changed

4 files changed

+102
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,15 @@ I've intensionally left out the rest of the data as it's mostly **FF**. However,
106106

107107
#### Memory structure
108108

109-
You can find my research for the structure in [/scripts/PIXMOB_EEPROM_flash2.bt](scripts/PIXMOB_EEPROM_flash2.bt)
109+
You can find my research for the structure in [/scripts/010Editor/PIXMOB_EEPROM_flash2.bt](scripts/010Editor/PIXMOB_EEPROM_flash2.bt)
110110
template which works for [010Editor](https://www.sweetscape.com/010editor/).
111111

112112
![010editor_sc](docs/eeprom_struct.png)
113113

114+
You can also apply the script [/scripts/010Editor/PIXMOB_VISAULIZE_COLORS.1sc](scripts/010Editor/PIXMOB_VISAULIZE_COLORS.1sc)
115+
which will show you the current colors in memory:
116+
117+
![010editor_vs](docs/color_visuals.png)
114118

115119

116120
### Support & Contribute

docs/color_visuals.png

25.9 KB
Loading
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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

Comments
 (0)