public void writePalette(int palettePos, int w, int h, string path, string dir, string name) { if (!Directory.Exists(path + "Palettes//" + dir)) { Directory.CreateDirectory(path + "Palettes//" + dir); } //Bitmap paletteBitmap = new Bitmap(w * 8, h * 8); Color[] palettes = new Color[h * w]; int pos = palettePos; int ppos = 0; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { palettes[ppos] = GFX.getColor((short)((ROM.DATA[pos + 1] << 8) + ROM.DATA[pos])); //Graphics g = Graphics.FromImage(paletteBitmap); //g.FillRectangle(new SolidBrush(c), new Rectangle(x * 8, y * 8, 8, 8)); pos += 2; ppos++; } } File.WriteAllText(path + "Palettes//" + dir + "//" + name + ".json", JsonConvert.SerializeObject(palettes)); /* * //path = ProjectDirectory// * paletteBitmap.Save(path + "Palettes//" + dir + "//" + name + ".png"); * * paletteBitmap.Dispose();*/ }
public OverworldConfig() { hardCodedDWGrass = GFX.getColor((short)((ROM.DATA[ConstantsReader.GetAddress("hardcodedGrassDW") + 1] << 8) + ROM.DATA[ConstantsReader.GetAddress("hardcodedGrassDW")])); hardCodedLWGrass = GFX.getColor((short)((ROM.DATA[ConstantsReader.GetAddress("hardcodedGrassLW") + 1] << 8) + ROM.DATA[ConstantsReader.GetAddress("hardcodedGrassLW")])); hardCodedDMGrass = GFX.getColor((short)((ROM.DATA[ConstantsReader.GetAddress("hardcodedGrassSpecial") + 1] << 8) + ROM.DATA[ConstantsReader.GetAddress("hardcodedGrassSpecial")])); }