DEFINE_string(delay_file, "delay.int32", "The name of the delay file.");
DEFINE_string(drift_file, "drift.int32", "The name of the drift file.");
DEFINE_string(level_file, "level.int32", "The name of the level file.");
+DEFINE_string(keypress_file, "keypress.bool", "The name of the keypress file.");
DEFINE_string(settings_file, "settings.txt", "The name of the settings file.");
DEFINE_bool(full, false,
"Unpack the full set of files (normally not needed).");
FILE* delay_file = NULL;
FILE* drift_file = NULL;
FILE* level_file = NULL;
+ FILE* keypress_file = NULL;
if (FLAGS_full) {
delay_file = fopen(FLAGS_delay_file.c_str(), "wb");
if (delay_file == NULL) {
printf("Unable to open %s\n", FLAGS_level_file.c_str());
return 1;
}
+ keypress_file = fopen(FLAGS_keypress_file.c_str(), "wb");
+ if (keypress_file == NULL) {
+ printf("Unable to open %s\n", FLAGS_keypress_file.c_str());
+ return 1;
+ }
}
Event event_msg;
return 1;
}
}
+
+ if (msg.has_keypress()) {
+ bool keypress = msg.keypress();
+ if (fwrite(&keypress, sizeof(bool), 1, keypress_file) != 1) {
+ printf("Error when writing to %s\n", FLAGS_keypress_file.c_str());
+ return 1;
+ }
+ }
}
} else if (event_msg.type() == Event::INIT) {
if (!event_msg.has_init()) {