little and cute tool that helps to include files into program binaries
C
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
Makefile
README.md
dotoify.c

README.md

DOTOIFY

simple tool to pack various resources into binary

Want to include some cute pictures or other things into your executable but don't want to generate megabytes of junk with xdd -i, nor willing to use large and bloated IDEs just for it? Then *.o-ify is your choise! It can generate .c or .s1 files that can be compiled with gcc and linked with your app!

1 to be implemented (^w^')

Usage

./dotoify [-h -o outfile -t type ] files...

  • If -h is passed, help message is printed.
  • If -o is passed, generated program outputs into file instead of stdout.
  • If -t is passed, it determines type of generated source. type can be "c" or "gas", for C and GNU Assembler respectively. Default is C.

Example of generated output:

$ ./dotoify testpic.bmp testpic-2.bmp 
// Generated by DOTOIFY to be compiled with gcc or compatible compiler.
#include <stddef.h>

// file testpic.bmp
extern char res_testpic_bmp[];
extern size_t res_testpic_bmp_len;
asm(
  ".data\n"
  ".global res_testpic_bmp\n"
  ".global res_testpic_bmp_len\n"
  "res_testpic_bmp:\n"
  "  .incbin \"testpic.bmp\"\n"
  "res_testpic_bmp_len:\n"
  "  .quad .-res_testpic_bmp\n"
  );

// file testpic-2.bmp
extern char res_testpic_2_bmp[];
extern size_t res_testpic_2_bmp_len;
asm(
  ".data\n"
  ".global res_testpic_2_bmp\n"
  ".global res_testpic_2_bmp_len\n"
  "res_testpic_2_bmp:\n"
  "  .incbin \"testpic-2.bmp\"\n"
  "res_testpic_2_bmp_len:\n"
  "  .quad .-res_testpic_2_bmp\n"
);