snes9x/gtk/src/sourcify.c
Brandon Wright e17ff69533 Gtk: Switch codebase to gtkmm.
GTK: Remove support for GTK+ 2.0.

GTK 3 is stable and widespread enough now.

GTK: Rearrange headers to eliminate gtk_s9xcore.h

Gtk: Initial gtkmm conversion work.

Gtk: More gtkmm conversion and bug fixing.

Gtk: More gtkmm fixes.

Gtk: More Fixes

OpenGL no longer creates a second window.
Accelerators are fixed.

Gtk: More fixes

Removed GLX context dependency on Gtk.

Gtk: Fix formatting.

Gtk: Remove a #pragma once
2020-07-17 14:48:34 -05:00

62 lines
1.4 KiB
C

/*****************************************************************************\
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
This file is licensed under the Snes9x License.
For further information, consult the LICENSE file in the root directory.
\*****************************************************************************/
#include <stdio.h>
#include <sys/stat.h>
int main(int argc, char *argv[])
{
FILE *infile, *outfile;
unsigned char inchar;
unsigned int counter;
struct stat file_info;
if (argc != 4)
{
fprintf(stderr, "Usage: %s infile outfile identifier\n", argv[0]);
return 1;
}
stat(argv[1], &file_info);
infile = fopen(argv[1], "r");
if (!infile)
{
fprintf(stderr, "Input file doesn't exist.\n");
return 2;
}
outfile = fopen(argv[2], "w+");
fprintf(outfile, "int %s_size = %d;\n\n", argv[3], (int)file_info.st_size);
fprintf(outfile, "unsigned char %s [] = \n{\n ", argv[3]);
counter = 0;
while (fread(&inchar, 1, 1, infile))
{
if (counter >= 32)
{
counter = 0;
fprintf(outfile, "\n ");
}
fprintf(outfile, "%d,", inchar);
counter++;
}
/* Erase extra "," */
fseek(outfile, -1, SEEK_CUR);
fprintf(outfile, "\n};\n");
fclose(infile);
fclose(outfile);
return 0;
}