From 44d0136cb4b532c957d6c037ea6a862a1e371cd9 Mon Sep 17 00:00:00 2001 From: Ennio Barbaro Date: Thu, 2 Jul 2015 23:24:52 +0200 Subject: Fixed bug crash if dlopen fails --- opentrack/plugin-support.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'opentrack') diff --git a/opentrack/plugin-support.hpp b/opentrack/plugin-support.hpp index bc07c106..95b4b0a1 100644 --- a/opentrack/plugin-support.hpp +++ b/opentrack/plugin-support.hpp @@ -115,7 +115,8 @@ struct dylib { { fprintf(stderr, "Error, ignoring: %s\n", err); fflush(stderr); - dlclose(handle); + if (handle) + dlclose(handle); handle = nullptr; return true; } @@ -138,6 +139,7 @@ struct dylib { return; } else { (void) _foo::err(handle); + return; } #endif -- cgit v1.2.3 From 340906d3571ba3c75e67d8457de4129381d5a6b3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 2 Jul 2015 11:58:04 +0200 Subject: try fix MSVC --- CMakeLists.txt | 15 ++++++++++++--- facetracknoir/main.cpp | 2 +- ftnoir_protocol_sc/ftnoir_protocol_sc.cpp | 2 +- ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp | 4 +++- ftnoir_tracker_aruco/include/exports.h | 2 +- ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp | 1 - ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp | 4 +++- opentrack/export.hpp | 8 +++++++- opentrack/plugin-support.hpp | 2 +- 9 files changed, 29 insertions(+), 11 deletions(-) (limited to 'opentrack') diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fb6e8d2..4389432d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,10 @@ find_package(Qt5 COMPONENTS SerialPort QUIET) include_directories(SYSTEM ${Qt5Core_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS}) add_definitions(${Qt5Core_DEFINITIONS} ${Qt5Xml_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS}) +if(MSVC) + add_definitions(-DNOMINMAX -D_CRT_SECURE_NO_WARNINGS) +endif() + set(my-qt-deps) if(WIN32) # hack to avoid breakage on buildbot set(my-qt-deps ws2_32) @@ -71,6 +75,9 @@ set(EXTRA-MOCS opentrack/options.hpp) macro(opentrack_module n dir) file(GLOB ${n}-c ${dir}/*.cpp ${dir}/*.c ${dir}/*.h ${dir}/*.hpp ${EXTRA-MOCS}) file(GLOB ${n}-res ${dir}/*.rc) + foreach(f ${n}-res) + set_source_files_properties(${f} PROPERTIES LANGUAGE RC) + endforeach() file(GLOB ${n}-ui ${dir}/*.ui) file(GLOB ${n}-rc ${dir}/*.qrc) endmacro() @@ -78,7 +85,7 @@ endmacro() macro(opentrack_qt n) qt5_wrap_cpp(${n}-moc ${${n}-c} OPTIONS --no-notes) QT5_WRAP_UI(${n}-uih ${${n}-ui}) - QT5_ADD_RESOURCES(${n}-rcc ${${n}-rc}) + QT5_ADD_RESOURCES(${n}-rcc) set(${n}-all ${${n}-c} ${${n}-rc} ${${n}-rcc} ${${n}-uih} ${${n}-moc} ${${n}-res}) endmacro() @@ -97,7 +104,7 @@ macro(opentrack_library n dir) COMPILE_FLAGS "${foolib_COMPILE} ${foolib_GNU-COMPILE} -fvisibility=hidden -fvisibility-inlines-hidden" ) else() - set_target_properties(${n} PROPERTIES LINK_FLAGS ${foolib_LINK} COMPILE_FLAGS ${foolib_COMPILE}) + set_target_properties(${n} PROPERTIES LINK_FLAGS "${foolib_LINK}" COMPILE_FLAGS "${foolib_COMPILE}") endif() install(TARGETS ${n} RUNTIME DESTINATION . LIBRARY DESTINATION .) endmacro() @@ -348,7 +355,9 @@ if(SDK_RIFT) set(link-flags "-framework CoreFoundation -framework CoreGraphics -framework IOKit -framework Quartz") set(c-flags "-fno-strict-aliasing") else() - set(c-flags "-fno-strict-aliasing") + if(NOT MSVC) + set(c-flags "-fno-strict-aliasing") + endif() endif() opentrack_library(opentrack-tracker-rift ftnoir_tracker_rift LINK ${link-flags} COMPILE ${c-flags}) target_include_directories(opentrack-tracker-rift SYSTEM PUBLIC ${SDK_RIFT}/Include ${SDK_RIFT}/Src) diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp index c92f6980..2e08c8ba 100644 --- a/facetracknoir/main.cpp +++ b/facetracknoir/main.cpp @@ -20,7 +20,7 @@ static void add_program_library_path() { char* p = _pgmptr; { - char path[MAX_PATH]; + char path[MAX_PATH+1]; strcpy(path, p); char* ptr = strrchr(path, '\\'); if (ptr) diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp index 36764edc..b1d84f9b 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp @@ -103,7 +103,7 @@ public: actx.lpResourceName = MAKEINTRESOURCEA(resid); actx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID; #ifdef _MSC_VER -# error "MSVC support removed" +# define PREFIX "" #else # define PREFIX "lib" #endif diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp index b636ffd4..63f75685 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.cpp @@ -13,7 +13,9 @@ FTNoIR_Protocol::~FTNoIR_Protocol() } void FTNoIR_Protocol::pose( const double *headpose ) { -#pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif JOYSTICK_STATE state[2] = { 0 }; state[0].POV = (4 << 12) | (4 << 8) | (4 << 4) | 4; diff --git a/ftnoir_tracker_aruco/include/exports.h b/ftnoir_tracker_aruco/include/exports.h index aaeb94e4..8f7dab8c 100644 --- a/ftnoir_tracker_aruco/include/exports.h +++ b/ftnoir_tracker_aruco/include/exports.h @@ -36,7 +36,7 @@ or implied, of Rafael Muñoz Salinas. #endif -#if (defined WIN32 || defined _WIN32 || defined WINCE) && defined DSO_EXPORTS +#if ((defined WIN32 || defined _WIN32 || defined WINCE) && defined DSO_EXPORTS) || defined(_MSC_VER) #define ARUCO_EXPORTS __declspec(dllexport) #else #define ARUCO_EXPORTS __attribute__ ((visibility ("default"))) diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp index 34c27579..826cecaa 100644 --- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp +++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp @@ -10,7 +10,6 @@ Hydra_Tracker::Hydra_Tracker() : should_quit(false) {} -#pragma GCC diagnostic ignored "-Wreorder" #include Hydra_Tracker::~Hydra_Tracker() diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp index 2dc0ad6b..264166fe 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp @@ -41,7 +41,9 @@ FTNoIR_Tracker::~FTNoIR_Tracker() } } -#pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif static BOOL CALLBACK EnumObjectsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, VOID* pContext ) diff --git a/opentrack/export.hpp b/opentrack/export.hpp index 8c8bdc69..f0983b75 100644 --- a/opentrack/export.hpp +++ b/opentrack/export.hpp @@ -1,7 +1,13 @@ #pragma once + #ifdef _WIN32 # define OPENTRACK_LINKAGE __declspec(dllexport) #else # define OPENTRACK_LINKAGE #endif -#define OPENTRACK_EXPORT __attribute__ ((visibility ("default"))) OPENTRACK_LINKAGE + +#ifndef _MSC_VER +# define OPENTRACK_EXPORT __attribute__ ((visibility ("default"))) OPENTRACK_LINKAGE +#else +# define OPENTRACK_EXPORT OPENTRACK_LINKAGE +#endif \ No newline at end of file diff --git a/opentrack/plugin-support.hpp b/opentrack/plugin-support.hpp index 95b4b0a1..627bce6a 100644 --- a/opentrack/plugin-support.hpp +++ b/opentrack/plugin-support.hpp @@ -42,7 +42,7 @@ #include #ifdef _MSC_VER -# error "No support for MSVC anymore" +# define OPENTRACK_LIB_PREFIX "" #else # define OPENTRACK_LIB_PREFIX "lib" #endif -- cgit v1.2.3 From 6c23e1ad43f143ee8b694b907432c5801713a7d5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 3 Jul 2015 09:46:29 +0200 Subject: fix MSVC, now runs --- CMakeLists.txt | 61 +++++++++++++++++++---- facetracknoir/main.cpp | 10 ++-- ftnoir_protocol_sc/ftnoir-protocol-sc.rc | 4 +- ftnoir_protocol_sc/scserver-acceleration.manifest | 13 ----- ftnoir_protocol_sc/scserver-sp2.manifest | 13 ----- ftnoir_protocol_sc/scserver_acceleration.manifest | 13 +++++ ftnoir_protocol_sc/scserver_sp2.manifest | 13 +++++ ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h | 7 +++ opentrack/version.C | 5 -- opentrack/version.cc | 9 ++++ 10 files changed, 102 insertions(+), 46 deletions(-) delete mode 100644 ftnoir_protocol_sc/scserver-acceleration.manifest delete mode 100644 ftnoir_protocol_sc/scserver-sp2.manifest create mode 100644 ftnoir_protocol_sc/scserver_acceleration.manifest create mode 100644 ftnoir_protocol_sc/scserver_sp2.manifest delete mode 100644 opentrack/version.C create mode 100644 opentrack/version.cc (limited to 'opentrack') diff --git a/CMakeLists.txt b/CMakeLists.txt index 4389432d..c45163dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,7 @@ set(my-qt-deps) if(WIN32) # hack to avoid breakage on buildbot set(my-qt-deps ws2_32) endif() -set(MY_QT_LIBS ${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Xml_LIBRARIES} ${Qt5Core_LIBRARIES} ${my-qt-deps}) +set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Xml_LIBRARIES} ${my-qt-deps}) # note, hatire supports both ftnoir and opentrack # don't remove without being sure as hell -sh 20140922 @@ -69,6 +69,8 @@ if(CMAKE_COMPILER_IS_GNUCXX OR APPLE) set(CMAKE_CXX_FLAGS " -std=c++11 ${CMAKE_CXX_FLAGS} ") endif() +set_property(GLOBAL PROPERTY USE_FOLDERS OFF) + # qt broken as usual set(EXTRA-MOCS opentrack/options.hpp) @@ -85,10 +87,17 @@ endmacro() macro(opentrack_qt n) qt5_wrap_cpp(${n}-moc ${${n}-c} OPTIONS --no-notes) QT5_WRAP_UI(${n}-uih ${${n}-ui}) - QT5_ADD_RESOURCES(${n}-rcc) + QT5_ADD_RESOURCES(${n}-rcc ${${n}-rc}) set(${n}-all ${${n}-c} ${${n}-rc} ${${n}-rcc} ${${n}-uih} ${${n}-moc} ${${n}-res}) endmacro() +set(msvc-subsystem "/VERSION:5.1 /SUBSYSTEM:WINDOWS,5.01") +function(opentrack_compat target) + if(MSVC) + set_target_properties(${target} PROPERTIES LINK_FLAGS "${msvc-subsystem} /DEBUG /OPT:ICF") + endif() +endfunction() + macro(opentrack_library n dir) cmake_parse_arguments(foolib "" "LINK;COMPILE;GNU-LINK;GNU-COMPILE" "" ${ARGN}) if(NOT " ${foolib_UNPARSED_ARGUMENTS}" STREQUAL " ") @@ -104,7 +113,11 @@ macro(opentrack_library n dir) COMPILE_FLAGS "${foolib_COMPILE} ${foolib_GNU-COMPILE} -fvisibility=hidden -fvisibility-inlines-hidden" ) else() - set_target_properties(${n} PROPERTIES LINK_FLAGS "${foolib_LINK}" COMPILE_FLAGS "${foolib_COMPILE}") + set(link-flags) + if(MSVC) + set(link-flags "${msvc-subsystem} /DEBUG /OPT:ICF") + endif() + set_target_properties(${n} PROPERTIES LINK_FLAGS "${link-flags} ${foolib_LINK}" COMPILE_FLAGS "${foolib_COMPILE}") endif() install(TARGETS ${n} RUNTIME DESTINATION . LIBRARY DESTINATION .) endmacro() @@ -171,6 +184,7 @@ add_custom_target(tarball DEPENDS ${filename}) opentrack_module(opentrack-api opentrack) opentrack_qt(opentrack-api) add_library(opentrack-api STATIC ${opentrack-api-all}) +opentrack_compat(opentrack-api) target_link_libraries(opentrack-api ${MY_QT_LIBS}) if(NOT WIN32) @@ -221,31 +235,36 @@ if(SDK_XPLANE) endif() add_library(opentrack-compat STATIC ${opentrack-compat-c}) +opentrack_compat(opentrack-compat) # uh... if(NOT WIN32 AND NOT APPLE) target_link_libraries(opentrack-compat rt) endif() opentrack_module(opentrack-csv csv) add_library(opentrack-csv STATIC ${opentrack-csv-c}) +opentrack_compat(opentrack-csv) target_link_libraries(opentrack-csv ${MY_QT_LIBS}) opentrack_module(opentrack-pose-widget pose-widget) opentrack_qt(opentrack-pose-widget) add_library(opentrack-pose-widget STATIC ${opentrack-pose-widget-all}) +opentrack_compat(opentrack-pose-widget) target_include_directories(opentrack-pose-widget PUBLIC pose-widget/) # else Qt moc breaks target_link_libraries(opentrack-pose-widget ${MY_QT_LIBS}) opentrack_module(opentrack-spline-widget qfunctionconfigurator) opentrack_qt(opentrack-spline-widget) add_library(opentrack-spline-widget STATIC ${opentrack-spline-widget-all}) +opentrack_compat(opentrack-spline-widget) target_include_directories(opentrack-spline-widget PUBLIC qfunctionconfigurator/) target_link_libraries(opentrack-spline-widget ${MY_QT_LIBS}) -add_library(opentrack-version STATIC opentrack/version.C) +add_library(opentrack-version STATIC opentrack/version.cc) +opentrack_compat(opentrack-version) set_target_properties(opentrack-version PROPERTIES COMPILE_DEFINITIONS - "IN_VERSION_UNIT;OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\"") + "OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\"") opentrack_library(opentrack-filter-accela ftnoir_filter_accela) target_link_libraries(opentrack-filter-accela opentrack-spline-widget) @@ -256,7 +275,12 @@ opentrack_library(opentrack-proto-fgfs ftnoir_protocol_fg) if(SDK_VJOY) opentrack_library(opentrack-proto-vjoy ftnoir_protocol_vjoy GNU-LINK "-Wl,--enable-stdcall-fixup") - target_link_libraries(opentrack-proto-vjoy ${MY_QT_LIBS} ${SDK_VJOY}/VJoy.dll) + if(MSVC) + set(ext .lib) + else() + set(ext .dll) + endif() + target_link_libraries(opentrack-proto-vjoy ${MY_QT_LIBS} ${SDK_VJOY}/VJoy${ext}) target_include_directories(opentrack-proto-vjoy SYSTEM PUBLIC ${SDK_VJOY}) endif() @@ -272,6 +296,9 @@ if(SDK_FSUIPC) opentrack_library(opentrack-proto-fsuipc ftnoir_protocol_fsuipc) target_link_libraries(opentrack-proto-fsuipc ${SDK_FSUIPC}/FSUIPC_User.lib) target_include_directories(opentrack-proto-fsuipc SYSTEM PUBLIC ${SDK_FSUIPC}) + if(MSVC) + set_target_properties(opentrack-proto-fsuipc PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBC.lib") + endif() #target_link_directories(${SDK_FSUIPC}) endif() @@ -362,7 +389,14 @@ if(SDK_RIFT) opentrack_library(opentrack-tracker-rift ftnoir_tracker_rift LINK ${link-flags} COMPILE ${c-flags}) target_include_directories(opentrack-tracker-rift SYSTEM PUBLIC ${SDK_RIFT}/Include ${SDK_RIFT}/Src) if(WIN32) - target_link_libraries(opentrack-tracker-rift ${SDK_RIFT}/libLibOVR.a winmm setupapi ws2_32 imagehlp wbemuuid) + if(MSVC) + set(ext lib) + set(p) + else() + set(ext a) + set(p lib) + endif() + target_link_libraries(opentrack-tracker-rift ${SDK_RIFT}/${p}LibOVR.${ext} winmm setupapi ws2_32 imagehlp wbemuuid) else() if(NOT APPLE) target_link_libraries(opentrack-tracker-rift ${SDK_RIFT}/libLibOVR.a udev Xinerama) @@ -376,9 +410,16 @@ if(SDK_HYDRA) opentrack_library(opentrack-tracker-hydra ftnoir_tracker_hydra) target_include_directories(opentrack-tracker-hydra SYSTEM PUBLIC ${SDK_HYDRA}/include ${SDK_HYDRA}/include/sixense_utils) if(WIN32) + if(MSVC) + set(dir lib) + set(ext lib) + else() + set(dir bin) + set(ext dll) + endif() target_link_libraries(opentrack-tracker-hydra - "${SDK_HYDRA}/bin/win32/release_dll/sixense.dll" - #"${SDK_HYDRA}/bin/win32/release_dll/sixense_utils.dll" + "${SDK_HYDRA}/${dir}/win32/release_dll/sixense.${ext}" + #"${SDK_HYDRA}/${dir}/win32/release_dll/sixense_utils.${ext}" ) install(FILES "${SDK_HYDRA}/bin/win32/release_dll/sixense.dll" #"${SDK_HYDRA}/bin/win32/release_dll/sixense_utils.dll" @@ -439,7 +480,7 @@ if(UNIX OR APPLE) endif() opentrack_qt(opentrack) add_executable(opentrack ${opentrack-win32-executable} ${opentrack-all}) - +opentrack_compat(opentrack) if(NOT WIN32) set_target_properties(opentrack PROPERTIES SUFFIX ".bin") endif() diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp index 2e08c8ba..6d29e3b5 100644 --- a/facetracknoir/main.cpp +++ b/facetracknoir/main.cpp @@ -77,13 +77,17 @@ int main(int argc, char** argv) if (use_profile) MainWindow::set_profile(profile); - MainWindow w; + auto w = std::make_shared(); if (use_profile) - w.startTracker(); + w->startTracker(); - w.show(); + w->show(); app.exec(); + // on MSVC crashes in atexit +#ifdef _MSC_VER + TerminateProcess(GetCurrentProcess(), 0); +#endif return 0; } diff --git a/ftnoir_protocol_sc/ftnoir-protocol-sc.rc b/ftnoir_protocol_sc/ftnoir-protocol-sc.rc index 80b6c12c..c89eb9a7 100644 --- a/ftnoir_protocol_sc/ftnoir-protocol-sc.rc +++ b/ftnoir_protocol_sc/ftnoir-protocol-sc.rc @@ -1,4 +1,4 @@ #include 142 RT_MANIFEST scserver.manifest -143 RT_MANIFEST scserver-sp2.manifest -144 RT_MANIFEST scserver-acceleration.manifest \ No newline at end of file +143 RT_MANIFEST scserver_sp2.manifest +144 RT_MANIFEST scserver_acceleration.manifest \ No newline at end of file diff --git a/ftnoir_protocol_sc/scserver-acceleration.manifest b/ftnoir_protocol_sc/scserver-acceleration.manifest deleted file mode 100644 index 06459587..00000000 --- a/ftnoir_protocol_sc/scserver-acceleration.manifest +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/ftnoir_protocol_sc/scserver-sp2.manifest b/ftnoir_protocol_sc/scserver-sp2.manifest deleted file mode 100644 index 19b123ba..00000000 --- a/ftnoir_protocol_sc/scserver-sp2.manifest +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/ftnoir_protocol_sc/scserver_acceleration.manifest b/ftnoir_protocol_sc/scserver_acceleration.manifest new file mode 100644 index 00000000..06459587 --- /dev/null +++ b/ftnoir_protocol_sc/scserver_acceleration.manifest @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/ftnoir_protocol_sc/scserver_sp2.manifest b/ftnoir_protocol_sc/scserver_sp2.manifest new file mode 100644 index 00000000..3020d16c --- /dev/null +++ b/ftnoir_protocol_sc/scserver_sp2.manifest @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h index 73496fba..a9e8ed6e 100644 --- a/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h +++ b/ftnoir_protocol_vjoy/ftnoir_protocol_vjoy.h @@ -96,6 +96,13 @@ typedef struct _JOYSTICK_STATE UINT32 Buttons; // 32 Buttons } JOYSTICK_STATE, * PJOYSTICK_STATE; +#ifndef _MSC_VER EXTERN_C BOOL __stdcall VJoy_Initialize(PCHAR name, PCHAR serial); EXTERN_C VOID __stdcall VJoy_Shutdown(); EXTERN_C BOOL __stdcall VJoy_UpdateJoyState(int id, PJOYSTICK_STATE pJoyState); +#else +#define VJOY_API __declspec(dllimport) +VJOY_API BOOL __stdcall VJoy_Initialize(PCHAR name, PCHAR serial); +VJOY_API VOID __stdcall VJoy_Shutdown(); +VJOY_API BOOL __stdcall VJoy_UpdateJoyState(int id, PJOYSTICK_STATE pJoyState); +#endif diff --git a/opentrack/version.C b/opentrack/version.C deleted file mode 100644 index 0ef4ec14..00000000 --- a/opentrack/version.C +++ /dev/null @@ -1,5 +0,0 @@ -#ifdef IN_VERSION_UNIT -# define IN_CRAPOLA_COMPILE_UNIT -volatile const char* opentrack_version = OPENTRACK_VERSION; -#else -#endif diff --git a/opentrack/version.cc b/opentrack/version.cc new file mode 100644 index 00000000..026ad057 --- /dev/null +++ b/opentrack/version.cc @@ -0,0 +1,9 @@ +#include "opentrack/export.hpp" + +#ifdef __cplusplus +extern "C" +#endif +OPENTRACK_EXPORT +volatile const char* opentrack_version; + +volatile const char* opentrack_version = OPENTRACK_VERSION; -- cgit v1.2.3 From 9201417e9973f901a39195507cf2935a529e821e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 3 Jul 2015 14:42:33 +0200 Subject: fix msvc empty config list Some MSVC 2015RC bug with static initialized const char*. But reproduced also in #179 (?) --- facetracknoir/process_detector.cpp | 8 ++++---- facetracknoir/ui.cpp | 16 ++++++++-------- ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp | 8 ++++---- opentrack/options.hpp | 12 ++++++------ 4 files changed, 22 insertions(+), 22 deletions(-) (limited to 'opentrack') diff --git a/facetracknoir/process_detector.cpp b/facetracknoir/process_detector.cpp index 237d350d..79b5c95f 100644 --- a/facetracknoir/process_detector.cpp +++ b/facetracknoir/process_detector.cpp @@ -9,25 +9,25 @@ void settings::set_game_list(const QString &game_list) { - QSettings settings(group::org); + QSettings settings(OPENTRACK_ORG); settings.setValue("executable-list", game_list); } QString settings::get_game_list() { - QSettings settings(group::org); + QSettings settings(OPENTRACK_ORG); return settings.value("executable-list").toString(); } bool settings::is_enabled() { - QSettings settings(group::org); + QSettings settings(OPENTRACK_ORG); return settings.value("executable-detector-enabled", false).toBool(); } void settings::set_is_enabled(bool enabled) { - QSettings settings(group::org); + QSettings settings(OPENTRACK_ORG); settings.setValue("executable-detector-enabled", enabled); } diff --git a/facetracknoir/ui.cpp b/facetracknoir/ui.cpp index 284367ce..5a600f02 100644 --- a/facetracknoir/ui.cpp +++ b/facetracknoir/ui.cpp @@ -112,8 +112,8 @@ void MainWindow::open() { if (! fileName.isEmpty() ) { { - QSettings settings(group::org); - settings.setValue(group::filename_key, remove_app_path(fileName)); + QSettings settings(OPENTRACK_ORG); + settings.setValue(OPENTRACK_CONFIG_FILENAME_KEY, remove_app_path(fileName)); } fill_profile_combobox(); load_settings(); @@ -161,8 +161,8 @@ void MainWindow::saveAs() { (void) QFile::copy(oldFile, fileName); - QSettings settings(group::org); - settings.setValue (group::filename_key, remove_app_path(fileName)); + QSettings settings(OPENTRACK_ORG); + settings.setValue (OPENTRACK_CONFIG_FILENAME_KEY, remove_app_path(fileName)); } save(); @@ -460,8 +460,8 @@ void MainWindow::profileSelected(int index) return; { - QSettings settings(group::org); - settings.setValue (group::filename_key, remove_app_path(QFileInfo(group::ini_pathname()).absolutePath() + "/" + + QSettings settings(OPENTRACK_ORG); + settings.setValue (OPENTRACK_CONFIG_FILENAME_KEY, remove_app_path(QFileInfo(group::ini_pathname()).absolutePath() + "/" + ui.iconcomboProfile->itemText(index))); } load_settings(); @@ -540,6 +540,6 @@ void MainWindow::maybe_start_profile_from_executable() void MainWindow::set_profile(const QString &profile) { - QSettings settings(group::org); - settings.setValue(group::filename_key, MainWindow::remove_app_path(profile)); + QSettings settings(OPENTRACK_ORG); + settings.setValue(OPENTRACK_CONFIG_FILENAME_KEY, MainWindow::remove_app_path(profile)); } diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp index 017a8f0a..80543e7a 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp @@ -36,12 +36,12 @@ void TrackerSettings::load_ini() { #ifdef OPENTRACK_API - QSettings settings(options::group::org); // Registry settings (in HK_USER) + QSettings settings(OPENTRACK_ORG); // Registry settings (in HK_USER) #else QSettings settings("opentrack"); // Registry settings (in HK_USER) #endif #ifdef OPENTRACK_API - QString currentFile = settings.value( options::group::filename_key, QCoreApplication::applicationDirPath() + options::group::default_path ).toString(); + QString currentFile = settings.value( OPENTRACK_CONFIG_FILENAME_KEY, QCoreApplication::applicationDirPath() + OPENTRACK_DEFAULT_CONFIG_PATH ).toString(); #else QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); #endif @@ -106,12 +106,12 @@ void TrackerSettings::save_ini() const { #ifdef OPENTRACK_API - QSettings settings(options::group::org); // Registry settings (in HK_USER) + QSettings settings(OPENTRACK_ORG); // Registry settings (in HK_USER) #else QSettings settings("opentrack"); // Registry settings (in HK_USER) #endif #ifdef OPENTRACK_API - QString currentFile = settings.value( options::group::filename_key, QCoreApplication::applicationDirPath() + options::group::default_path ).toString(); + QString currentFile = settings.value( OPENTRACK_CONFIG_FILENAME_KEY, QCoreApplication::applicationDirPath() + OPENTRACK_DEFAULT_CONFIG_PATH ).toString(); #else QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); #endif diff --git a/opentrack/options.hpp b/opentrack/options.hpp index 7c3f6847..a10ba382 100644 --- a/opentrack/options.hpp +++ b/opentrack/options.hpp @@ -38,6 +38,10 @@ #include template using mem = std::shared_ptr; +#define OPENTRACK_CONFIG_FILENAME_KEY "settings-file" +#define OPENTRACK_DEFAULT_CONFIG_PATH "/settings/default.ini" +#define OPENTRACK_ORG "opentrack-2.3" + namespace options { template using map = std::map; @@ -97,7 +101,6 @@ namespace options { } conf.endGroup(); } - static constexpr const char* org = "opentrack-2.3"; void save() { @@ -129,13 +132,10 @@ namespace options { return kvs.count(s) != 0; } - static constexpr const char* filename_key = "settings-file"; - static constexpr const char* default_path = "/settings/default.ini"; - static const QString ini_pathname() { - QSettings settings(group::org); - return settings.value(filename_key, QCoreApplication::applicationDirPath() + default_path).toString(); + QSettings settings(OPENTRACK_ORG); + return settings.value(OPENTRACK_CONFIG_FILENAME_KEY, QCoreApplication::applicationDirPath() + OPENTRACK_DEFAULT_CONFIG_PATH).toString(); } static const QStringList ini_list() -- cgit v1.2.3