xxxxxxxxxx
842
const VERSION = 1 & 0x7F;
var isNesEmbedded = 0;
class myColor
{
constructor(r, g, b, nes)
{
this.r = r;
this.g = g;
this.b = b;
this.nes = nes;
}
}
var nesLUT = [5592405, 6003, 1926, 3016056, 5833293, 7471121, 7208960, 4982784, 1514240, 10752, 12544, 11784, 9797, 0, 0, 0, 10855845, 22470, 2244581, 7219417, 11410086, 13768537, 13705479, 10958592, 6508800, 1599232, 29184, 29489, 27268, 0, 0, 0, 16711679, 3123455, 6128127, 10252543, 16216831, 16742333, 16744053, 16747051, 13475840, 8501250, 4048944, 1232251, 902608, 3947580, 0, 0, 16711679, 10804991, 11651327, 13418239, 16040703, 16762346, 16762825, 16764330, 15718038, 13688981, 11790245, 10480323, 10152166, 11513775, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
var nesPalDivs = [];
var colors = [];
var colRgb = [];
var selec = 0;
var lenSelect;
var colSelect;
var rSelect;
var gSelect;
var bSelect;
var nesCheck;
var rSpan;
var gSpan;
var bSpan;
var lenSpan;
var heiSpan;
var colorsDiv;
var nesDiv;
var palLen = 8;
var palHei = 8;
var tempColor = new myColor(0, 0, 0, 0);
function clamp(number, min, max) {
return Math.max(min, Math.min(number, max));
}
var palTypes = ["3-3-2 RGB", "SMS", "5 Levels", "WEB", "MegaDrive", "Amiga", "SNES", "DS", "RGB24", "NES"];
var palType = 0;
function keyPressed() {
let keyIndex = -1;
if (key == 'c') {
tempColor = colRgb[selec];
}
if (key == 'v') {
colRgb[selec] = new myColor(tempColor.r, tempColor.g, tempColor.b, tempColor.nes);
}
if (key == 'x') {
tempColor = colRgb[selec];
colRgb[selec] = new myColor(0, 0, 0, 0);
}
setSliders();
}
/*
function resetMacSlider()
{
macroSlider.elt.max=macLen-1;
macroSlider.elt.value = clamp(macroSlider.value(), 0, macLen-1);
macroSpan.html("Macro : " + macroSlider.value());
}
*/
function setSliders2()
{
resizeSliders();
selec = clamp(selec, 0, palLen * palHei);
rSelect.elt.value = colRgb[selec].r
gSelect.elt.value = colRgb[selec].g
bSelect.elt.value = colRgb[selec].b
lenSelect.elt.value = palLen;
rSpan.html("RED: "+colRgb[selec].r);
gSpan.html("GREEN: "+colRgb[selec].g);
bSpan.html("BLUE: "+colRgb[selec].b);
lenSpan.html("LENGTH: "+palLen);
// console.log(selec)
// console.log(selec)
}
function setSliders()
{
// resizeSliders();
selec = clamp(selec, 0, palLen * palHei);
rSelect.elt.value = colRgb[selec].r
gSelect.elt.value = colRgb[selec].g
bSelect.elt.value = colRgb[selec].b
lenSelect.elt.value = palLen;
rSpan.html("RED: "+colRgb[selec].r);
gSpan.html("GREEN: "+colRgb[selec].g);
bSpan.html("BLUE: "+colRgb[selec].b);
lenSpan.html("LENGTH: "+palLen);
// console.log(selec)
// console.log(selec)
}
function resizeSliders()
{
if(palType == 0)
{
rSelect.elt.max = 7
gSelect.elt.max = 7
bSelect.elt.max = 3
}
if(palType == 1)
{
rSelect.elt.max = 3
gSelect.elt.max = 3
bSelect.elt.max = 3
}
if(palType == 2)
{
rSelect.elt.max = 4
gSelect.elt.max = 4
bSelect.elt.max = 4
}
if(palType == 3)
{
rSelect.elt.max = 5
gSelect.elt.max = 5
bSelect.elt.max = 5
}
if(palType == 4)
{
rSelect.elt.max = 7
gSelect.elt.max = 7
bSelect.elt.max = 7
}
if(palType == 5)
{
rSelect.elt.max = 15
gSelect.elt.max = 15
bSelect.elt.max = 15
}
if(palType == 6)
{
rSelect.elt.max = 31
gSelect.elt.max = 31
bSelect.elt.max = 31
}
if(palType == 7)
{
rSelect.elt.max = 63
gSelect.elt.max = 63
bSelect.elt.max = 63
}
if(palType == 8)
{
rSelect.elt.max = 255
gSelect.elt.max = 255
bSelect.elt.max = 255
}
// default: // 3-3-2 RGB
// {
// console.log("EEEE")
// rSelect.elt.max = 7
// gSelect.elt.max = 7
// bSelect.elt.max = 3
// break;
// }
for(var i = 0; i < 128; i++)
{
colRgb[i].r = 0;
colRgb[i].g = 0;
colRgb[i].b = 0;
}
rSelect.elt.value = 0
gSelect.elt.value = 0
bSelect.elt.value = 0
rSpan.html("RED: "+rSelect.elt.value);
gSpan.html("GREEN: "+gSelect.elt.value);
bSpan.html("BLUE: "+bSelect.elt.value);
if(palType == 9)
{
colorsDiv.hide();
nesDiv.show();
}
else
{
console.log("EEEEEEEEEEEEEEEe")
colorsDiv.show();
nesDiv.hide();
isNesEmbedded = 0
nesCheck.elt.checked = 0;
}
}
function decimalToHex(d, padding) {
var hex = Number(d).toString(16);
padding = typeof (padding) === "undefined" || padding === null ? padding = 2 : padding;
while (hex.length < padding) {
hex = "0" + hex;
}
return hex;
}
function reloadNESColors() {
for(i = 0; i < nesPalDivs.length; i ++)
{
var color = '#' + decimalToHex(nesLUT[i], 6)
nesPalDivs[i].style('background', color).style('color', color)
}
}
function setup() {
var butDivs = createDiv();
var canDiv = createDiv();
createCanvas(512, 512).parent(canDiv);
for(var i = 0; i < 16 * 16; i++)
{
colors.push(0b00000000)
colRgb.push(new myColor(0, 0, 0, 0))
}
lenDiv = createDiv();
lenSelect = createSlider(2, 16, palLen, 1).addClass("mySliders")
lenSelect.style('width', '512px');
lenSelect.style("margin-bottom","-8px");
lenSelect.parent(lenDiv);
lenSpan = createSpan("LENGTH: "+ palLen);
lenSpan.style("font-size","14px");
lenSpan.style("font-weight","bold");
lenSpan.style('color', '#ffff9e');
lenSpan.parent(lenDiv);
lenSelect.input(function(){
palLen = this.value();
lenSpan.html("LENGTH: "+palLen);
});
heiDiv = createDiv();
heiSelect = createSlider(1, 16, palHei, 1).addClass("mySliders")
heiSelect.style('width', '512px');
heiSelect.style("margin-bottom","-8px");
heiSelect.parent(heiDiv);
heiSpan = createSpan("HEIGHT: "+ palHei);
heiSpan.style("font-size","14px");
heiSpan.style("font-weight","bold");
heiSpan.style('color', '#ffff9e');
heiSpan.parent(heiDiv);
heiSelect.input(function(){
palHei = this.value();
heiSpan.html("HEIGHT: "+palHei);
});
colorsDiv = createDiv();
rDiv = createDiv();
rSelect = createSlider(0, 7, colRgb[selec].r, 1).addClass("mySliders")
rSelect.style('width', '512px');
rSelect.style("margin-bottom","-8px");
rSelect.parent(rDiv);
rSpan = createSpan("RED: "+ colRgb[selec].r);
rSpan.style("font-size","14px");
rSpan.style("font-weight","bold");
rSpan.style('color', '#ffff9e');
rSpan.parent(rDiv);
rSelect.input(function(){
colRgb[selec].r = this.value();
rSpan.html("RED: "+colRgb[selec].r);
});
gDiv = createDiv();
gSelect = createSlider(0, 7, colRgb[selec].g, 1).addClass("mySliders")
gSelect.style('width', '512px');
gSelect.style("margin-bottom","-8px");
gSelect.parent(gDiv);
gSpan = createSpan("GREEN: "+ colRgb[selec].r);
gSpan.style("font-size","14px");
gSpan.style("font-weight","bold");
gSpan.style('color', '#ffff9e');
gSpan.parent(gDiv);
gSelect.input(function(){
colRgb[selec].g = this.value();
gSpan.html("GREEN: "+colRgb[selec].g);
});
bDiv = createDiv();
bSelect = createSlider(0, 3, colRgb[selec].b, 1).addClass("mySliders")
bSelect.style('width', '512px');
bSelect.style("margin-bottom","-8px");
bSelect.parent(bDiv);
bSpan = createSpan("BLUE: "+ colRgb[selec].b);
bSpan.style("font-size","14px");
bSpan.style("font-weight","bold");
bSpan.style('color', '#ffff9e');
bSpan.parent(bDiv);
bSelect.input(function(){
colRgb[selec].b = this.value();
bSpan.html("BLUE: "+colRgb[selec].b);
});
rDiv.parent(colorsDiv);
gDiv.parent(colorsDiv);
bDiv.parent(colorsDiv);
// iDiv = createDiv();
// iSelect = createSlider(0, 63, colRgb[selec].nes, 1).addClass("mySliders")
// iSelect.style('width', '512px');
// iSelect.style("margin-bottom","-8px");
// iSelect.parent(bDiv);
// iSpan = createSpan("NES Index: "+ colRgb[selec].nes);
// iSpan.style("font-size","14px");
// iSpan.style("font-weight","bold");
// iSpan.style('color', '#ffff9e');
// iSpan.parent(bDiv);
// iSelect.input(function(){
// colRgb[selec].nes = this.value();
// iSpan.html("NES Index: "+colRgb[selec].nes);
// });
// style="display: inline-block; width: 6.25%; height: 100%; background: rgb(85, 85, 85); color: rgb(255, 255, 255);"
nesDiv = createDiv().style('width', '512px');
for(i = 0; i < 256; i++)
{
var color = '#' + decimalToHex(nesLUT[i], 6)
console.log(color)
nesPalDivs.push(createDiv('ㅤ').style('display', 'inline-block').style('width', '6.25%').style('height', '6.25%').style('background', color).style('color', color).mousePressed(function() {
colRgb[selec].nes = this.index;
}).parent(nesDiv))
nesPalDivs[i].index = i;
}
nesDiv.hide();
// var myDivColor = createDiv('c').style('display', 'inline-block').style('width', '6.25%').style('height', '6.25%').style('background', '#0000bd').style('color', '#0000bd');
var genPalButton = createButton("Generate Palette!").addClass("myButton").parent(butDivs);
genPalButton.mousePressed(function() {
rgb2bin();
var data = [];
// Header
data.push("P".charCodeAt(0));
data.push("A".charCodeAt(0));
data.push("L".charCodeAt(0));
data.push("6".charCodeAt(0));
data.push("4".charCodeAt(0));
// is nes pal embedded? + version
data.push(VERSION | (isNesEmbedded << 7))
// Lenght of the palette
data.push(palLen & 0xFF);
data.push(palHei & 0xFF);
// Type of the palette
data.push(palType & 0xFF);
// write palette data
if(palType == 0 || palType == 1 || palType == 9)
{
for(i = 0; i < palLen * palHei; i++)
{
data.push(colors[i] & 0xFF);
if(colors[i] & 0xFF > 63)
console.log("error");
}
}
else if(palType > 1 && palType < 7 )
{
for(i = 0; i < palLen * palHei; i++)
{
var msb = colors[i] >> 8
var lsb = colors[i] & 0x00FF
data.push(msb);
data.push(lsb);
}
}
else if(palType >= 7)
{
for(i = 0; i < palLen * palHei; i++)
{
var msb = colors[i] >> 16
var mid = (colors[i] >> 8) & 0xFF;
var lsb = colors[i] & 0xFF
data.push(msb);
data.push(mid);
data.push(lsb);
}
}
// If we ask to embed the NES palette into the PAL64, we do so...
if(isNesEmbedded && palType == 9)
{
for(i = 0; i < nesLUT.length-1; i++)
{
var msb = nesLUT[i] >> 16
var mid = (nesLUT[i] >> 8) & 0xFF;
var lsb = nesLUT[i] & 0xFF
data.push(msb);
data.push(mid);
data.push(lsb);
}
}
var output = new Blob([new Uint8Array(data)], { type: "application/octet-stream" });
saveFile(URL.createObjectURL(output),"palette.pal64");
URL.revokeObjectURL(output);
})
var palUpload = createFileInput(function(file){
var reader = new FileReader();
reader.addEventListener("load",_=>{
var data = reader.result.split("").map(x=>x.charCodeAt(0));
var index = 0;
if (String.fromCharCode(data[index])+String.fromCharCode(data[index+1])+String.fromCharCode(data[index+2])+String.fromCharCode(data[index+3])+String.fromCharCode(data[index+4])!="PAL64") {
alert("Invalid palette. Not PAL64 palette format.");
return;
}
// Is the NES palette Embedded?
var isNesEmbedded = data[index + 5] >> 7;
// Version check
var fileVer = data[index + 5] & 0b01111111;
if(fileVer > VERSION)
{
alert("PAL64 version too new!!!.");
return;
}
palLen = data[index + 6];
palHei = data[index + 7]
palType = data[index + 8];
index += 9;
if(palType == 0 || palType == 1 || palType == 9)
{
for(i = 0; i < palLen * palHei; i++)
{
colors[i] = data[index + i];
}
index = index + (palLen * palHei)
}
else if(palType > 1 && palType < 7 )
{
for(i = 0; i < palLen * palHei; i++)
{
var j = i * 2
var msb = data[index + j]
var lsb = data[index + j + 1]
colors[i] = (msb << 8) | lsb;
}
index = index + (palLen * palHei * 2)
}
else if(palType >= 7)
{
for(i = 0; i < palLen * palHei; i++)
{
var k = i * 3
var msb = data[index + k]
var mid = data[index + k + 1]
var lsb = data[index + k + 2]
colors[i] = (msb << 16) | (mid << 8) | lsb;
}
index = index + (palLen * palHei * 3)
}
if(isNesEmbedded && palType == 9)
{
console.log("a")
for(i = 0; i < nesLUT.length-1; i++)
{
var k = i * 3
var msb = data[index + k] << 16;
var mid = (data[index + k + 1]) << 8;
var lsb = data[index + k + 2];
nesLUT[i] = msb | mid | lsb
}
reloadNESColors()
}
nesCheck.elt.checked = isNesEmbedded;
resizeSliders()
bin2rgb();
palDrop.elt.value = palType;
setSliders()
});
reader.readAsBinaryString(file.file);
});
var nesUpload = createFileInput(function(file){
var reader = new FileReader();
reader.addEventListener("load",_=>{
var data = reader.result.split("").map(x=>x.charCodeAt(0));
var index = 0;
for(var i = 0; i < 255; i++)
{
var j = i * 3
var msb = data[j];
var mid = data[j + 1];
var lsb = data[j + 2];
nesLUT[i] = (msb << 16) | (mid << 8) | lsb;
nesPalDivs[i].style('background', '#' + decimalToHex(nesLUT[i], 6)).style('color', '#' + decimalToHex(nesLUT[i], 6))
}
console.log(nesLUT.join(', '));
});
reader.readAsBinaryString(file.file);
});
var hexUpload = createFileInput(function(file){
var reader = new FileReader();
reader.addEventListener("load",_=>{
var data = reader.result.split("\n")//.map(x=>x.charCodeAt(0));
var index = 0;
for(var i = 0; i < 256; i++)
{
nesLUT[i] = (data[i] != "" && data[i]) ? parseInt(data[i], 16) : 0
nesPalDivs[i].style('background', '#' + decimalToHex(nesLUT[i], 6)).style('color', '#' + decimalToHex(nesLUT[i], 6))
}
console.log(data);
});
reader.readAsBinaryString(file.file);
})
var upLabel = createElement("label","Load Palette!");
palUpload.elt.id = "import";
palUpload.style("display:none;");
upLabel.elt.setAttribute("for","import");
var palUpBut = createButton("").parent(butDivs);
palUpload.parent(palUpBut);
upLabel.parent(palUpBut);
var nesLabel = createElement("label","Load NES Pal!");
nesUpload.elt.id = "import2";
nesUpload.style("display:none;");
nesLabel.elt.setAttribute("for","import2");
var nesUpBut = createButton("").parent(butDivs);
nesUpload.parent(nesUpBut);
nesLabel.parent(nesUpBut);
var hexLabel = createElement("label","Load HEX to NES Pal!");
hexUpload.elt.id = "import3";
hexUpload.style("display:none;");
hexLabel.elt.setAttribute("for","import3");
var hexUpBut = createButton("").parent(butDivs);
hexUpload.parent(hexUpBut);
hexLabel.parent(hexUpBut);
var palDrop = createSelect().parent(butDivs);
for (var j=0;j<palTypes.length;j++) {
palDrop.option(palTypes[j],j);
}
palDrop.input(function(){
palType = this.value();
// resizeSliders2()
setSliders2()
})
nesCheck = createElement("input");
nesCheck.elt.type = "checkbox";
nesCheck.parent(butDivs);
// nesCheck.index = i;
nesCheck.elt.checked = isNesEmbedded;
nesCheck.input(function(){
if(this.elt.checked)
{
isNesEmbedded = 1;
}
else
isNesEmbedded = 0;
})
var nesSpan = createSpan("Embed NES palette into PAL64").parent(butDivs).style('color', '#ffff9e');
}
function saveFile(url, name) {
var link = document.createElement('a');
if (typeof link.download === 'string') {
link.href = url;
link.download = name;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
} else {
window.open(url);
}
}
// function generatePalStr() {
// // let tmp = macro;
// var str = "";
// // wt.join(' ') + " ;";
// macro = 0;
// for(var i = 0; i < 64; i++)
// {
// // var macroWave = getWT();
// str += macroWave.join(' ') + " ;\n";
// }
// macOutput.elt.value = str;
// macro = tmp;
// }
function draw() {
if (mouseIsPressed == true)
{
if(mouseX < 512 && mouseY < 512 && mouseX >= 0 && mouseY >= 0)
{
var myX = Math.floor((mouseX & 511) / (512/palLen))
var myY = Math.floor((mouseY & 511) / (512/palHei))
selec = myX + (1 * myY) * palLen
setSliders()
}
}
background(0);
stroke(100);
var x = 0;
var y = 0;
for(var i = 0; i < palLen * palHei; i++)
{
if(palType == 0)
fill(Math.round(colRgb[i].r * 36.42), Math.round(colRgb[i].g * 36.42), colRgb[i].b * 85);
if(palType == 1)
fill(Math.round(colRgb[i].r * 85), Math.round(colRgb[i].g * 85), colRgb[i].b * 85);
if(palType == 2)
fill(Math.round(colRgb[i].r * 63), Math.round(colRgb[i].g * 63), colRgb[i].b * 63);
if(palType == 3)
fill(Math.round(colRgb[i].r * 51), Math.round(colRgb[i].g * 51), colRgb[i].b * 51);
if(palType == 4)
fill(Math.round(colRgb[i].r * 36), Math.round(colRgb[i].g * 36), colRgb[i].b * 36);
if(palType == 5)
fill(Math.round(colRgb[i].r * 15.9375), Math.round(colRgb[i].g * 15.9375), colRgb[i].b * 15.9375);
if(palType == 6)
fill(Math.round(colRgb[i].r * 8), Math.round(colRgb[i].g * 8), colRgb[i].b * 8);
if(palType == 7)
fill(Math.round(colRgb[i].r * 4.0476), Math.round(colRgb[i].g * 4.0476), colRgb[i].b * 4.0476);
if(palType == 8)
fill(Math.round(colRgb[i].r), Math.round(colRgb[i].g), colRgb[i].b);
if(palType == 9)
fill(nesLUT[colRgb[i].nes] >> 16, nesLUT[colRgb[i].nes] >> 8 & 0xFF, nesLUT[colRgb[i].nes] & 0xFF)
rect((x) * (512/palLen), y * (512/palHei), 512/palLen, (512/palHei));
x++;
if(x >= palLen)
{
x = 0;
y++;
}
}
stroke(1000);
noFill();
rect((selec % palLen) * 512/palLen, (Math.floor(selec / palLen)) * (512/palHei), 512/palLen, (512/palHei));
}
function rgb2bin()
{
for(var i = 0; i < palLen * palHei; i++)
{
var val = 0;
if(palType == 0)
{
// 0bRRRGGGBB
var r = colRgb[i].r << 5;
var g = colRgb[i].g << 2;
var b = colRgb[i].b;
val = r | g | b;
}
if(palType == 1)
{
// 0b00RRGGBB
var r = colRgb[i].r << 4;
var g = colRgb[i].g << 2;
var b = colRgb[i].b;
val = r | g | b;
}
if(palType == 2 || palType == 3 || palType == 4)
{
// 0b0000000R RRGGGBBB
var r = colRgb[i].r << 6;
var g = colRgb[i].g << 3;
var b = colRgb[i].b;
val = r | g | b;
}
if(palType == 5)
{
// 0b0000RRRR GGGGBBBB
var r = colRgb[i].r << 8;
var g = colRgb[i].g << 4;
var b = colRgb[i].b;
val = r | g | b;
}
if(palType == 6)
{
//0b0RRRRRGG GGGBBBBB
var r = colRgb[i].r << 10;
var g = colRgb[i].g << 5;
var b = colRgb[i].b;
val = r | g | b;
}
if(palType == 7)
{
//0b000000RR RRRRGGGG GGBBBBBB
var r = colRgb[i].r << 12;
var g = colRgb[i].g << 6;
var b = colRgb[i].b;
val = r | g | b;
}
if(palType == 8)
{
//0bRRRRRRRR GGGGGGGG BBBBBBBB
var r = colRgb[i].r << 16;
var g = colRgb[i].g << 8;
var b = colRgb[i].b;
val = r | g | b;
}
if(palType == 9)
{
val = colRgb[i].nes;
}
colors[i] = val
}
}
function bin2rgb()
{
for(var i = 0; i < palLen * palHei; i++)
{
var r, g, b, nes = 0;
if(palType == 0)
{
r = colors[i] >> 5 & 0b00000111;
g = colors[i] >> 2 & 0b00000111;
b = colors[i] & 0b00000011;
nes = 0;
}
if(palType == 1)
{
r = colors[i] >> 4 & 0b00000011;
g = colors[i] >> 2 & 0b00000011;
b = colors[i] & 0b00000011;
nes = 0;
}
if(palType == 2 || palType == 3 || palType == 4)
{
r = colors[i] >> 6 & 0b0000000000000111;
g = colors[i] >> 3 & 0b0000000000000111;
b = colors[i] & 0b0000000000000111;
nes = 0;
}
if(palType == 5)
{
r = colors[i] >> 8 & 0b0000000000001111;
g = colors[i] >> 4 & 0b0000000000001111;
b = colors[i] & 0b0000000000001111;
nes = 0;
}
if(palType == 6)
{
r = colors[i] >> 10 & 0b0000000000011111;
g = colors[i] >> 5 & 0b0000000000011111;
b = colors[i] & 0b0000000000011111;
nes = 0;
}
if(palType == 7)
{
r = colors[i] >> 12 & 0b000000000000000000111111;
g = colors[i] >> 6 & 0b000000000000000000111111;
b = colors[i] & 0b000000000000000000111111;
nes = 0;
}
if(palType == 8)
{
r = colors[i] >> 16 & 0x0000FF;
g = colors[i] >> 8 & 0x0000FF;
b = colors[i] & 0x000FF;
nes = 0;
}
if(palType == 9)
{
r = 0;
g = 0;
b = 0;
nes = colors[i];
}
colRgb[i].r = r
colRgb[i].g = g
colRgb[i].b = b
colRgb[i].nes = nes;
}
setSliders()
}