Embedding Files in Executables

Working on a system to embed data files in code in order to release PokerSnake as a single exe file:

Converting files to code

Files can then be fetched as an char array. Example:

EMBED_FILES* pngFile = find_files("tiles.png", data_files);
if (pngFile == NULL) {
  log_error("Failed to get tiles.png", NULL);

unsigned char *data = stbi_load_from_memory((const stbi_uc*)pngFile->data, pngFile->data_length, &w, &h, &n, 0);
Show Comments