aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 273d6b7..173ab5b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -34,6 +34,7 @@ int main(int argc, char **argv) {
double seconds = 30.0;
int shot_frames = -1;
const char *shot_path = "shot.ppm";
+ const char *fifo_path = NULL;
for (int i = 2; i < argc; i++) {
if (!strcmp(argv[i], "--test")) {
test = true;
@@ -41,6 +42,9 @@ int main(int argc, char **argv) {
} else if (!strcmp(argv[i], "--shot")) {
if (i + 1 < argc) shot_frames = atoi(argv[++i]);
if (i + 1 < argc && argv[i+1][0] != '-') shot_path = argv[++i];
+ } else if (!strcmp(argv[i], "--fifo")) {
+ fifo_path = (i + 1 < argc && argv[i+1][0] != '-')
+ ? argv[++i] : "/tmp/gbc.fifo";
}
}
@@ -72,6 +76,11 @@ int main(int argc, char **argv) {
signal(SIGINT, on_sig);
signal(SIGTERM, on_sig);
+ if (fifo_path) {
+ input_open_fifo(fifo_path);
+ fprintf(stderr, "control fifo: echo 'a' > %s (a b start select "
+ "up down left right; +x/-x hold/release; release)\n", fifo_path);
+ }
term_init();
const double frame_time = 1.0 / 59.73;
@@ -93,6 +102,7 @@ int main(int argc, char **argv) {
}
term_restore();
+ input_close_fifo();
cart_free(&gb->cart);
free(gb);
return 0;