add get_color_from_paletteset

This commit is contained in:
scawful
2024-08-07 01:29:16 -04:00
parent 8c13ef3e23
commit 1d4b86d61c
2 changed files with 28 additions and 0 deletions

View File

@@ -33,4 +33,29 @@ void unload_rom(Rom rom) {
if (rom.impl) {
delete static_cast<yaze::app::Rom*>(rom.impl);
}
}
snes_color get_color_from_paletteset(const Rom* rom, int palette_set,
int palette, int color) {
snes_color color_struct;
color_struct.red = 0;
color_struct.green = 0;
color_struct.blue = 0;
if (rom->impl) {
yaze::app::Rom* internal_rom = static_cast<yaze::app::Rom*>(rom->impl);
auto get_color =
internal_rom->palette_group()
.get_group(yaze::app::gfx::kPaletteGroupAddressesKeys[palette_set])
->palette(palette)
.GetColor(color);
if (!get_color.ok()) {
return color_struct;
}
color_struct = get_color.value().rom_color();
return color_struct;
}
return color_struct;
}

View File

@@ -26,6 +26,9 @@ struct Rom {
Rom load_rom(const char* filename);
void unload_rom(Rom rom);
snes_color get_color_from_paletteset(const Rom* rom, int palette_set,
int palette, int color);
#ifdef __cplusplus
}
#endif