From abb8176f4ef23047a66e416f3f3a6eee6fc7a0c4 Mon Sep 17 00:00:00 2001 From: Justin Berger Date: Thu, 22 Mar 2018 10:11:22 -0600 Subject: Fixed startup bug; changed config names to be consistent --- src/survive.c | 4 ++++ src/survive_playback.c | 18 ++++++++++-------- src/survive_playback.h | 17 +++++++++++++++++ src/survive_vive.c | 2 +- 4 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 src/survive_playback.h (limited to 'src') diff --git a/src/survive.c b/src/survive.c index 2f3034b..9209e7c 100644 --- a/src/survive.c +++ b/src/survive.c @@ -10,6 +10,7 @@ #include "os_generic.h" #include "survive_config.h" #include "survive_default_devices.h" +#include "survive_playback.h" #ifdef __APPLE__ #define z_const const @@ -239,6 +240,9 @@ int survive_startup(SurviveContext *ctx) { const char *DriverName; i = 0; + + survive_install_recording(ctx); + while ((DriverName = GetDriverNameMatching("DriverReg", i++))) { DeviceDriver dd = GetDriver(DriverName); SV_INFO("Loading driver %s (%p) (%d)", DriverName, dd, i); diff --git a/src/survive_playback.c b/src/survive_playback.c index 45eea85..9261bb5 100644 --- a/src/survive_playback.c +++ b/src/survive_playback.c @@ -300,9 +300,9 @@ static int playback_close(struct SurviveContext *ctx, void *_driver) { return 0; } -void install_recording(SurviveContext *ctx) { - const char *dataout_file = survive_configs(ctx, "dataoutfile", SC_SETCONFIG, ""); - int record_to_stdout = survive_configi(ctx, "datastdout", SC_SETCONFIG, 0); +void survive_install_recording(SurviveContext *ctx) { + const char *dataout_file = survive_configs(ctx, "record", SC_SETCONFIG, ""); + int record_to_stdout = survive_configi(ctx, "record-stdout", SC_SETCONFIG, 0); if (strlen(dataout_file) > 0 || record_to_stdout) { ctx->recptr = calloc(1, sizeof(struct SurviveRecordingData)); @@ -314,14 +314,16 @@ void install_recording(SurviveContext *ctx) { ctx->recptr = 0; return; } + SV_INFO("Recording to '%s'", dataout_file); ctx->recptr->alwaysWriteStdOut = record_to_stdout; + if (record_to_stdout) { + SV_INFO("Recording to stdout"); + } } } int DriverRegPlayback(SurviveContext *ctx) { - install_recording(ctx); - - const char *playback_file = survive_configs(ctx, "playbackfile", SC_SETCONFIG, ""); + const char *playback_file = survive_configs(ctx, "playback", SC_SETCONFIG, ""); if (strlen(playback_file) == 0) { return 0; @@ -330,7 +332,7 @@ int DriverRegPlayback(SurviveContext *ctx) { SurvivePlaybackData *sp = calloc(1, sizeof(SurvivePlaybackData)); sp->ctx = ctx; sp->playback_dir = playback_file; - sp->time_factor = survive_configf(ctx, "playbackfactor", SC_SETCONFIG, 1.f); + sp->time_factor = survive_configf(ctx, "playback-factor", SC_SETCONFIG, 1.f); printf("%s\n", playback_file); @@ -341,7 +343,7 @@ int DriverRegPlayback(SurviveContext *ctx) { return -1; } - SV_INFO("Using playback file '%s'", playback_file); + SV_INFO("Using playback file '%s' with timefactor of %f", playback_file, sp->time_factor); SurviveObject *hmd = survive_create_hmd(ctx, "Playback", sp); SurviveObject *wm0 = survive_create_wm0(ctx, "Playback", sp, 0); SurviveObject *wm1 = survive_create_wm1(ctx, "Playback", sp, 0); diff --git a/src/survive_playback.h b/src/survive_playback.h new file mode 100644 index 0000000..52638a9 --- /dev/null +++ b/src/survive_playback.h @@ -0,0 +1,17 @@ +#include + +void survive_install_recording(SurviveContext *ctx); +void survive_recording_config_process(SurviveObject *so, char *ct0conf, int len); + +void survive_recording_lighthouse_process(SurviveContext *ctx, uint8_t lighthouse, SurvivePose *lh_pose, + SurvivePose *obj); + +void survive_recording_raw_pose_process(SurviveObject *so, uint8_t lighthouse, SurvivePose *pose); +void survive_recording_info_process(SurviveContext *ctx, const char *fault); +void survive_recording_angle_process(struct SurviveObject *so, int sensor_id, int acode, uint32_t timecode, FLT length, + FLT angle, uint32_t lh); + +void survive_recording_light_process(struct SurviveObject *so, int sensor_id, int acode, int timeinsweep, + uint32_t timecode, uint32_t length, uint32_t lh); + +void survive_recording_imu_process(struct SurviveObject *so, int mask, FLT *accelgyro, uint32_t timecode, int id); diff --git a/src/survive_vive.c b/src/survive_vive.c index cf068a3..d431207 100755 --- a/src/survive_vive.c +++ b/src/survive_vive.c @@ -1720,7 +1720,7 @@ void init_SurviveObject(SurviveObject* so) { int DriverRegHTCVive( SurviveContext * ctx ) { - const char *playback_dir = survive_configs(ctx, "playbackfile", SC_SETCONFIG, ""); + const char *playback_dir = survive_configs(ctx, "playback", SC_SETCONFIG, ""); if(strlen(playback_dir) != 0) { SV_INFO("Playback is active; disabling USB driver"); return 0; -- cgit v1.2.3