binji / smolnes

NES emulator in <5000 bytes of C
MIT License
630 stars 31 forks source link

Palette Source #7

Closed CoolModder closed 1 year ago

CoolModder commented 1 year ago

Hey, could you show me where you got your palette, or could you give me the list of rgbs in the order used in the emulator? I would be grateful.

binji commented 1 year ago

I'm fairly sure that smolnes uses the same palette that binjnes used to:

// From FrakenGraphics, based on FBX Smooth:
// https://www.patreon.com/posts/nes-palette-for-47391225
static const RGBA s_nespal[] = {
    0xff616161, 0xff880000, 0xff990d1f, 0xff791337, 0xff601256, 0xff10005d,
    0xff000e52, 0xff08233a, 0xff0c3521, 0xff0e410d, 0xff174417, 0xff1f3a00,
    0xff572f00, 0xff000000, 0xff000000, 0xff000000, 0xffaaaaaa, 0xffc44d0d,
    0xffde244b, 0xffcf1269, 0xffad1490, 0xff481c9d, 0xff043492, 0xff055073,
    0xff13695d, 0xff117a16, 0xff088013, 0xff497612, 0xff91661c, 0xff000000,
    0xff000000, 0xff000000, 0xfffcfcfc, 0xfffc9a63, 0xfffc7e8a, 0xfffc6ab0,
    0xfff26ddd, 0xffab71e7, 0xff5886e3, 0xff229ecc, 0xff00b1a8, 0xff00c172,
    0xff4ecd5a, 0xff8ec234, 0xffcebe4f, 0xff424242, 0xff000000, 0xff000000,
    0xfffcfcfc, 0xfffcd4be, 0xfffccaca, 0xfffcc4d9, 0xfffcc1ec, 0xffe7c3fa,
    0xffc3cef7, 0xffa7cde2, 0xff9cdbda, 0xff9ee3c8, 0xffb8e5bf, 0xffc8ebb2,
    0xffebe5b7, 0xffacacac, 0xff000000, 0xff000000,
};
CoolModder commented 1 year ago

Thank you!

CoolModder commented 1 year ago

Sorry to bother you, but none of the bgr colors match up exactly to the palette, and there is multiple colors with very slight differences, and some colors are nonexistent in the table. (All blues)

binji commented 1 year ago

Those colors are stored as 32-bit integers (ABGR), so you need to swap some of the bytes to get RGB if that's what you're expecting:

index ABGR CSS R G B
0 0xff616161 #616161 97 97 97
1 0xff880000 #000088 0 0 136
2 0xff990d1f #1f0d99 31 13 153
3 0xff791337 #371379 55 19 121
4 0xff601256 #561260 86 18 96
5 0xff10005d #5d0010 93 0 16
6 0xff000e52 #520e00 82 14 0
7 0xff08233a #3a2308 58 35 8
8 0xff0c3521 #21350c 33 53 12
9 0xff0e410d #0d410e 13 65 14
10 0xff174417 #174417 23 68 23
11 0xff1f3a00 #003a1f 0 58 31
12 0xff572f00 #002f57 0 47 87
13 0xff000000 #000000 0 0 0
14 0xff000000 #000000 0 0 0
15 0xff000000 #000000 0 0 0
16 0xffaaaaaa #aaaaaa 170 170 170
17 0xffc44d0d #0d4dc4 13 77 196
18 0xffde244b #4b24de 75 36 222
19 0xffcf1269 #6912cf 105 18 207
20 0xffad1490 #9014ad 144 20 173
21 0xff481c9d #9d1c48 157 28 72
22 0xff043492 #923404 146 52 4
23 0xff055073 #735005 115 80 5
24 0xff13695d #5d6913 93 105 19
25 0xff117a16 #167a11 22 122 17
26 0xff088013 #138008 19 128 8
27 0xff497612 #127649 18 118 73
28 0xff91661c #1c6691 28 102 145
29 0xff000000 #000000 0 0 0
30 0xff000000 #000000 0 0 0
31 0xff000000 #000000 0 0 0
32 0xfffcfcfc #fcfcfc 252 252 252
33 0xfffc9a63 #639afc 99 154 252
34 0xfffc7e8a #8a7efc 138 126 252
35 0xfffc6ab0 #b06afc 176 106 252
36 0xfff26ddd #dd6df2 221 109 242
37 0xffab71e7 #e771ab 231 113 171
38 0xff5886e3 #e38658 227 134 88
39 0xff229ecc #cc9e22 204 158 34
40 0xff00b1a8 #a8b100 168 177 0
41 0xff00c172 #72c100 114 193 0
42 0xff4ecd5a #5acd4e 90 205 78
43 0xff8ec234 #34c28e 52 194 142
44 0xffcebe4f #4fbece 79 190 206
45 0xff424242 #424242 66 66 66
46 0xff000000 #000000 0 0 0
47 0xff000000 #000000 0 0 0
48 0xfffcfcfc #fcfcfc 252 252 252
49 0xfffcd4be #bed4fc 190 212 252
50 0xfffccaca #cacafc 202 202 252
51 0xfffcc4d9 #d9c4fc 217 196 252
52 0xfffcc1ec #ecc1fc 236 193 252
53 0xffe7c3fa #fac3e7 250 195 231
54 0xffc3cef7 #f7cec3 247 206 195
55 0xffa7cde2 #e2cda7 226 205 167
56 0xff9cdbda #dadb9c 218 219 156
57 0xff9ee3c8 #c8e39e 200 227 158
58 0xffb8e5bf #bfe5b8 191 229 184
59 0xffc8ebb2 #b2ebc8 178 235 200
60 0xffebe5b7 #b7e5eb 183 229 235
61 0xffacacac #acacac 172 172 172
62 0xff000000 #000000 0 0 0
63 0xff000000 #000000 0 0 0
CoolModder commented 1 year ago

Thank you! Sorry!