aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--redist/symbol_enumerator.c58
-rw-r--r--src/survive.c4
-rwxr-xr-xsrc/survive_cal.c8
-rw-r--r--winbuild/libsurvive/libsurvive.vcxproj4
4 files changed, 11 insertions, 63 deletions
diff --git a/redist/symbol_enumerator.c b/redist/symbol_enumerator.c
index 31bb68e..909648c 100644
--- a/redist/symbol_enumerator.c
+++ b/redist/symbol_enumerator.c
@@ -4,63 +4,9 @@
#if defined( WIN32 ) || defined( WINDOWS ) || defined( USE_WINDOWS ) || defined( _WIN32 )
#include <windows.h>
+#include <dbghelp.h>
-typedef struct _SYMBOL_INFO {
- ULONG SizeOfStruct;
- ULONG TypeIndex;
- ULONG64 Reserved[2];
- ULONG Index;
- ULONG Size;
- ULONG64 ModBase;
- ULONG Flags;
- ULONG64 Value;
- ULONG64 Address;
- ULONG Register;
- ULONG Scope;
- ULONG Tag;
- ULONG NameLen;
- ULONG MaxNameLen;
- TCHAR Name[1];
-} SYMBOL_INFO, *PSYMBOL_INFO;
-typedef struct _IMAGEHLP_STACK_FRAME {
- ULONG64 InstructionOffset;
- ULONG64 ReturnOffset;
- ULONG64 FrameOffset;
- ULONG64 StackOffset;
- ULONG64 BackingStoreOffset;
- ULONG64 FuncTableEntry;
- ULONG64 Params[4];
- ULONG64 Reserved[5];
- BOOL Virtual;
- ULONG Reserved2;
-} IMAGEHLP_STACK_FRAME, *PIMAGEHLP_STACK_FRAME;
-
-
-typedef BOOL (*PSYM_ENUMERATESYMBOLS_CALLBACK)(
- PSYMBOL_INFO pSymInfo,
- ULONG SymbolSize,
- PVOID UserContext
- );
-
-BOOL WINAPI SymEnumSymbols(
- HANDLE hProcess,
- ULONG64 BaseOfDll,
- PCTSTR Mask,
- PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,
- const PVOID UserContext
-);
-
-BOOL WINAPI SymInitialize(
- HANDLE hProcess,
- PCTSTR UserSearchPath,
- BOOL fInvadeProcess
-);
-
-BOOL WINAPI SymCleanup(
- HANDLE hProcess
-);
-
-BOOL mycb(PSYMBOL_INFO pSymInfo, ULONG SymbolSize, PVOID UserContext) {
+BOOL CALLBACK mycb(PSYMBOL_INFO pSymInfo, ULONG SymbolSize, PVOID UserContext) {
SymEnumeratorCallback cb = (SymEnumeratorCallback)UserContext;
return !cb("", &pSymInfo->Name[0], (void *)pSymInfo->Address, (long)pSymInfo->Size);
}
diff --git a/src/survive.c b/src/survive.c
index 911a900..e75f56b 100644
--- a/src/survive.c
+++ b/src/survive.c
@@ -21,6 +21,8 @@ STATIC_CONFIG_ITEM( CONFIG_FILE, "configfile", 's', "Default configuration file"
STATIC_CONFIG_ITEM( CONFIG_D_CALI, "disable-calibrate", 'i', "Enables or disables calibration", 0 );
STATIC_CONFIG_ITEM( CONFIG_F_CALI, "force-calibrate", 'i', "Forces calibration even if one exists.", 0 );
+#define RUNTIME_SYMNUM 1
+
#ifdef RUNTIME_SYMNUM
#include <symbol_enumerator.h>
static int did_runtime_symnum;
@@ -110,8 +112,6 @@ static void PrintMatchingDrivers( const char * prefix, const char * matchingpara
}
}
-
-
SurviveContext *survive_init_internal(int argc, char *const *argv) {
int i;
diff --git a/src/survive_cal.c b/src/survive_cal.c
index 79519b6..7d32a07 100755
--- a/src/survive_cal.c
+++ b/src/survive_cal.c
@@ -157,9 +157,11 @@ void survive_cal_install( struct SurviveContext * ctx )
// setting the required trackers for calibration to be permissive to make it easier for a newbie to start--
// basically, libsurvive will detect whatever they have plugged in and start using that.
-// const char * RequiredTrackersForCal = config_read_str(ctx->global_config_values, "RequiredTrackersForCal", "HMD,WM0,WM1");
const char *RequiredTrackersForCal = survive_configs(ctx, "requiredtrackersforcal", SC_SETCONFIG, "");
- const uint32_t AllowAllTrackersForCal = survive_configi(ctx, "allowalltrackersforcal", SC_SETCONFIG, 0);
+
+ // If there are no mandatory trackers for calibration; by default just accept whatever it is that the person has.
+ const uint32_t AllowAllTrackersForCal = survive_configi(ctx, "allowalltrackersforcal", SC_SETCONFIG, strlen(RequiredTrackersForCal) == 0);
+
size_t requiredTrackersFound = 0;
for (int j=0; j < ctx->objs_ct; j++)
@@ -185,7 +187,7 @@ void survive_cal_install( struct SurviveContext * ctx )
{
SV_INFO("Calibration is NOT using %s; device count exceeds MAX_DEVICES_TO_CAL", ctx->objs[j]->codename);
}
- }
+ }
}
diff --git a/winbuild/libsurvive/libsurvive.vcxproj b/winbuild/libsurvive/libsurvive.vcxproj
index 620e4e6..019dd6c 100644
--- a/winbuild/libsurvive/libsurvive.vcxproj
+++ b/winbuild/libsurvive/libsurvive.vcxproj
@@ -154,7 +154,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>FLT=double;USE_DOUBLE;MANUAL_REGISTRATION;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WINDOWS;_DEBUG;_LIB;HAVE_LAPACK_CONFIG_H;LAPACK_COMPLEX_STRUCTURE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>FLT=double;USE_DOUBLE;RUNTIME_SYMNUM;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WINDOWS;_DEBUG;_LIB;HAVE_LAPACK_CONFIG_H;LAPACK_COMPLEX_STRUCTURE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\winbuild;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
@@ -198,7 +198,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>FLT=double;USE_DOUBLE;MANUAL_REGISTRATION;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WINDOWS;_DEBUG;_LIB;HAVE_LAPACK_CONFIG_H;LAPACK_COMPLEX_STRUCTURE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>FLT=double;USE_DOUBLE;RUNTIME_SYMNUM;NOZLIB;_CRT_SECURE_NO_WARNINGS;HIDAPI;WINDOWS;_DEBUG;_LIB;HAVE_LAPACK_CONFIG_H;LAPACK_COMPLEX_STRUCTURE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\winbuild;..\..\include\libsurvive;..\..\redist;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>