aboutsummaryrefslogtreecommitdiff
path: root/src/survive.c
diff options
context:
space:
mode:
authorJustin Berger <jdavidberger@gmail.com>2018-03-23 14:42:53 +0000
committerJustin Berger <jdavidberger@gmail.com>2018-03-23 14:42:53 +0000
commit17e06b4822e60ccca865e77b45bf2b52a26852f2 (patch)
tree7245fcad9d6d80fdeae85f80efd1bef08a16e3d5 /src/survive.c
parent3fd7b740119e86d404d06bceafb02267d6e539c4 (diff)
downloadlibsurvive-17e06b4822e60ccca865e77b45bf2b52a26852f2.tar.gz
libsurvive-17e06b4822e60ccca865e77b45bf2b52a26852f2.tar.bz2
Made picking posers more consistent / configposer can use short name
Diffstat (limited to 'src/survive.c')
-rw-r--r--src/survive.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/survive.c b/src/survive.c
index e6bf69f..a8e7b94 100644
--- a/src/survive.c
+++ b/src/survive.c
@@ -199,7 +199,8 @@ SurviveContext *survive_init_internal(int argc, char *const *argv) {
return ctx;
}
-static void *setup_func_by_name(SurviveContext *ctx, const char *name, const char *configname, const char *configdef) {
+void *GetDriverByConfig(SurviveContext *ctx, const char *name, const char *configname, const char *configdef,
+ int verbose) {
const char *Preferred = survive_configs(ctx, configname, SC_SETCONFIG, configdef);
const char *DriverName = 0;
const char *picked = 0;
@@ -207,12 +208,14 @@ static void *setup_func_by_name(SurviveContext *ctx, const char *name, const cha
void *func = 0;
int prefixLen = strlen(name);
- SV_INFO("Available %s:", name);
+ if (verbose > 1)
+ SV_INFO("Available %s:", name);
while ((DriverName = GetDriverNameMatching(name, i++))) {
void *p = GetDriver(DriverName);
bool match = strcmp(DriverName, Preferred) == 0 || strcmp(DriverName + prefixLen, Preferred) == 0;
- SV_INFO("\t%c%s", match ? '*' : ' ', DriverName + prefixLen);
+ if (verbose > 1)
+ SV_INFO("\t%c%s", match ? '*' : ' ', DriverName + prefixLen);
if (!func || match) {
func = p;
picked = (DriverName + prefixLen);
@@ -221,7 +224,10 @@ static void *setup_func_by_name(SurviveContext *ctx, const char *name, const cha
if (!func) {
SV_ERROR("Error. Cannot find any valid %s.", name);
}
- SV_INFO("Totals %d %ss. Using %s.", i - 1, name, picked);
+ if (verbose > 1)
+ SV_INFO("Totals %d %ss.", i - 1, name);
+ if (verbose > 0)
+ SV_INFO("Using %s for %s", name, configname);
return func;
}
@@ -230,6 +236,8 @@ int survive_startup(SurviveContext *ctx) {
int r = 0;
int i = 0;
+ survive_install_recording(ctx);
+
// initialize the button queue
memset(&(ctx->buttonQueue), 0, sizeof(ctx->buttonQueue));
ctx->buttonQueue.buttonservicesem = OGCreateSema();
@@ -237,15 +245,13 @@ int survive_startup(SurviveContext *ctx) {
// start the thread to process button data
ctx->buttonservicethread = OGCreateThread(button_servicer, ctx);
- PoserCB PreferredPoserCB = setup_func_by_name(ctx, "Poser", "defaultposer", "PoserTurveyTori");
- ctx->lightcapfunction = setup_func_by_name(ctx, "Disambiguator", "disambiguator", "Turvey");
+ PoserCB PreferredPoserCB = GetDriverByConfig(ctx, "Poser", "defaultposer", "TurveyTori", 2);
+ ctx->lightcapfunction = GetDriverByConfig(ctx, "Disambiguator", "disambiguator", "Turvey", 2);
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);