#pragma once
#include <cstdint>
#include <vector>

#include "core/TileSet.h"

namespace bmp2tile
{

// Ported directly from maxim-zhao/bmp2tilecompressors'
// gfxcomp_phantasystargaiden.cpp -- the "PS Gaiden" / .psgcompr plugin
// (reverse-engineered from Phantasy Star Gaiden's tile data, hence the
// name -- nothing to do with the PSG sound chip). This is the exact
// per-tile bitplane-delta encoding devkitSMS's
// SMS_loadPSGaidencompressedTilesatAddr expects.
//
// Output starts with a 2-byte little-endian tile count, matching the
// original. Throws std::runtime_error if there are more than 65535 tiles
// (matching the original's `numTiles > 0xffff` check).
std::vector<uint8_t> CompressPsGaidenTiles(const std::vector<Tile>& tiles);

}  // namespace bmp2tile
