private void UpdateColors(int start, int page) { var destination = Model.ReadPointer(start); var run = ViewPort.Model.GetNextRun(destination) as IPaletteRun; Colors.SourcePalettePointer = start; var palette = run?.GetPalette(Model, page) ?? TileViewModel.CreateDefaultPalette(16); Colors.SetContents(palette); Colors.Page = page; Colors.HasMultiplePages = Pages > 1; }
/// <summary> /// If the hint is a table name, only match palettes from that table. /// </summary> private IReadOnlyList <short> GetDesiredPalette(int start, string hint, int page, bool exitEarly, out PaletteFormat paletteFormat) { paletteFormat = default; hint = format.PaletteHint ?? hint; // if there's a paletteHint, that takes precendence var destination = Model.ReadPointer(Start); if (Model.GetNextRun(destination) is ISpriteRun sRun) { var palette = sRun.FindRelatedPalettes(Model, Start, hint).FirstOrDefault(); if (palette != null) { paletteFormat = palette.PaletteFormat; return(palette.AllColors(Model)); } } return(TileViewModel.CreateDefaultPalette(0x10)); }