forked from mmitch/gbsplay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_gbs.c
50 lines (43 loc) · 940 Bytes
/
test_gbs.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* gbsplay is a Gameboy sound player
*
* 2011 (C) by Tobias Diedrich <ranma+gbsplay@tdiedrich.de>
* Christian Garbs <mitch@cgarbs.de>
* Licensed under GNU GPL.
*/
#include "common.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <time.h>
#include "gbs.h"
#include "util.h"
int main(int argc, char **argv)
{
struct gbs *gbs;
i18n_init();
if (argc < 2) {
fprintf(stderr, "Usage: %s <outfile>\n", argv[0]);
exit(1);
}
gbs = gbs_open("examples/nightmode.gbs");
if (gbs == NULL) {
fprintf(stderr, "%s: gbs_open failed\n", argv[0]);
exit(2);
}
if (!gbs_write(gbs, argv[1], 1)) {
fprintf(stderr, "%s: gbs_write failed\n", argv[0]);
unlink(argv[1]);
exit(3);
}
if (!gbs_write(gbs, argv[1], 2)) {
fprintf(stderr, "%s: gbs_write v2 failed\n", argv[0]);
unlink(argv[1]);
exit(4);
}
unlink(argv[1]);
return 0;
}