├── AUTHORS ├── COPYING ├── ChangeLog ├── INSTALL ├── LICENSE.md ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── README.devel ├── README.xplane ├── Readme.rtf ├── TODO ├── aclocal.m4 ├── ar-lib ├── compile ├── config.guess ├── config.h.in ├── config.sub ├── configure ├── configure.ac ├── depcomp ├── deploy ├── doc ├── Makefile.am ├── Makefile.in ├── README.ltr_pipe ├── debug_flags.txt └── fgfs │ ├── Input │ └── Joysticks │ │ └── LinuxTrack │ │ └── uinput-abs.xml │ ├── Nasal │ └── LinuxTrack │ │ └── linuxtrack.nas │ ├── Protocol │ ├── linuxtrack.nas.xml │ └── linuxtrack.xml │ └── README ├── install-sh ├── ltmain.sh ├── m4 ├── libtool.m4 ├── ltoptions.m4 ├── ltsugar.m4 ├── ltversion.m4 └── lt~obsolete.m4 ├── mac_build ├── mac_m4 └── fake_pkg_conf.m4 ├── maxima └── pose.maxima ├── missing ├── octave ├── bezier.m ├── pose.m └── pose_test.m ├── pkgconf_extract ├── python_prototype ├── appwindow.glade ├── linux_tir4_prototype.py ├── tir4.py └── tir4_read_version_string.py ├── src ├── 99-Mickey.rules ├── 99-TIR.rules ├── Makefile.am ├── Makefile.in ├── axis.c ├── axis.h ├── cal.c ├── cal.h ├── com_proc.c ├── com_proc.h ├── digest.c ├── digest.h ├── drivers.sym ├── dyn_load.c ├── dyn_load.h ├── extract.c ├── extract.h ├── facetrack.cpp ├── facetrack.h ├── fakeusb.c ├── game_data.c ├── game_data.h ├── haarcascade_frontalface_alt2.xml ├── hashing.c ├── helper │ ├── Makefile.am │ └── Makefile.in ├── image_process.c ├── image_process.h ├── ipc_utils.c ├── ipc_utils.h ├── joy.c ├── joy_driver.sym ├── joy_driver_prefs.c ├── joy_driver_prefs.h ├── liblt.sym ├── libusb_ifc.c ├── linuxtrack-wii.desktop ├── linuxtrack-wii.png ├── linuxtrack-wii.svg ├── linuxtrack-wii.xpm ├── linuxtrack.c ├── linuxtrack.desktop ├── linuxtrack.h ├── linuxtrack.pc.in ├── linuxtrack.png ├── linuxtrack.svg ├── linuxtrack.xpm ├── linuxtrack1.conf ├── linuxtrack_hello_world.c ├── linuxtrack_hello_world_adv.c ├── linuxtrack_pre.c ├── list.c ├── list.h ├── local_config.h.in ├── lt_client.c ├── lt_server.c ├── ltlib.c ├── ltlib.h ├── ltlib_client.c ├── ltlib_client.h ├── ltlib_int.c ├── ltlib_int.h ├── ltr_extractor.1 ├── ltr_gui.1 ├── ltr_pipe.1 ├── ltr_pipe.c ├── ltr_recenter.c ├── ltr_server.1 ├── ltr_server.c ├── ltr_server.h ├── ltr_server1.1 ├── ltr_server1.c ├── ltr_srv_comm.c ├── ltr_srv_comm.h ├── ltr_srv_master.cpp ├── ltr_srv_master.h ├── ltr_srv_slave.c ├── ltr_srv_slave.h ├── mac │ ├── English.lproj │ │ ├── InfoPlist.strings │ │ └── MainMenu.nib │ │ │ ├── designable.nib │ │ │ └── keyedobjects.nib │ ├── Info.plist.in │ ├── Makefile.am │ ├── Makefile.in │ ├── PkgInfo │ ├── args.c │ ├── args.h │ ├── buffer.c │ ├── buffer.h │ ├── dummy.cpp │ ├── linuxtrack_wii.icns │ ├── mac_camera.h │ ├── macwebcam.c │ ├── processing.c │ ├── processing.h │ ├── qt_camera.m │ ├── wiimote.h │ ├── wiimote.m │ ├── wiimote_server.h │ ├── wiimote_server.m │ └── wiisrvr_main.m ├── macwebcam_driver.c ├── macwii_driver.c ├── math_utils.c ├── math_utils.h ├── mickey.1 ├── mickey │ ├── calibration.ui │ ├── chsettings.ui │ ├── help │ │ ├── contents.txt │ │ ├── misc.htm │ │ ├── news.htm │ │ ├── tracking.htm │ │ └── welcome.htm │ ├── helpview.ui │ ├── hotkey.cpp │ ├── hotkey.h │ ├── hotkey.ui │ ├── hotkey_setup.ui │ ├── hotkey_setup_dlg.cpp │ ├── hotkey_setup_dlg.h │ ├── keyb.cpp │ ├── keyb.h │ ├── keyb_qxt.h │ ├── keyb_x11.cpp │ ├── keyb_x11.h │ ├── linuxtrack.icns │ ├── main.cpp │ ├── mickey.cpp │ ├── mickey.h │ ├── mickey.pro.in │ ├── mickey.qhcp │ ├── mickey.qhp │ ├── mickey.qrc │ ├── mickey.ui │ ├── mouse.h │ ├── mouse_linux.cpp │ ├── mouse_mac.cpp │ ├── my_line_edit.cpp │ ├── my_line_edit.h │ ├── piper.c │ ├── piper.h │ ├── precomp_headers.h │ ├── pref.ui │ ├── transform.cpp │ ├── transform.h │ ├── uinput_ifc.c │ └── uinput_ifc.h ├── netcomm.c ├── netcomm.h ├── openusb_ifc.c ├── osc_server.c ├── osc_server_mac │ ├── English.lproj │ │ ├── InfoPlist.strings │ │ ├── MainMenu.nib │ │ └── MainMenu.xib │ ├── Makefile.am │ ├── Makefile.in │ ├── OscServer-Info.plist.in │ ├── OscServerAppDelegate.h │ ├── OscServerAppDelegate.m │ ├── PkgInfo │ ├── linuxtrack.icns │ ├── main.m │ ├── osc_server.c │ └── osc_server.h ├── pathconfig.h.in ├── pose.c ├── pose.h ├── pref.cpp ├── pref.h ├── pref.hpp ├── pref_bison.cpp ├── pref_bison.hpp ├── pref_bison.ypp ├── pref_flex.cpp ├── pref_flex.h ├── pref_flex.lpp ├── pref_global.c ├── pref_global.h ├── ps3_prefs.c ├── ps3_prefs.h ├── ps3eye.sym ├── ps3eye_driver.c ├── ps3eye_driver.h ├── qt_gui │ ├── buffering.cpp │ ├── buffering.h │ ├── cap.png │ ├── cap_1.png │ ├── cap_edit.ui │ ├── cap_np.png │ ├── cap_small.png │ ├── cap_tweaking.ui │ ├── clip.png │ ├── clip_1.png │ ├── clip_edit.ui │ ├── clip_np.png │ ├── clip_small.png │ ├── clip_tweaking.ui │ ├── dev_help.ui │ ├── device_setup.cpp │ ├── device_setup.h │ ├── device_setup.ui │ ├── dl.ui │ ├── dlfirmware.cpp │ ├── dlfirmware.h │ ├── downloading.cpp │ ├── downloading.h │ ├── extractor.cpp │ ├── extractor.h │ ├── extractor.ui │ ├── face.png │ ├── face.svg │ ├── glwidget.cpp │ ├── glwidget.h │ ├── guardian.cpp │ ├── guardian.h │ ├── hashing.cpp │ ├── hashing.h │ ├── help │ │ ├── 3dPreview.png │ │ ├── CamPreview.png │ │ ├── Controller.png │ │ ├── DetAxis.png │ │ ├── Extractor.png │ │ ├── Facetracker.png │ │ ├── JoyButtonsSetup1.png │ │ ├── JoyButtonsSetup2.png │ │ ├── JoyButtonsSetup3.png │ │ ├── JoyButtonsSetup4.png │ │ ├── JoyButtonsSetup5.png │ │ ├── KeysSetup1.png │ │ ├── Misc.png │ │ ├── Model.png │ │ ├── ModelCreate.png │ │ ├── Tracking.png │ │ ├── Trackir.png │ │ ├── Webcam.png │ │ ├── Wiimote.png │ │ ├── XplBrowse.png │ │ ├── XplInstall.png │ │ ├── axes_setup.htm │ │ ├── contents.txt │ │ ├── dev_setup.htm │ │ ├── extractor.htm │ │ ├── hall_of_fame.htm │ │ ├── interface.htm │ │ ├── mickey.htm │ │ ├── misc.htm │ │ ├── model_setup.htm │ │ ├── news.htm │ │ ├── welcome.htm │ │ ├── wine.htm │ │ └── xpl_setup.htm │ ├── help_view.cpp │ ├── help_view.h │ ├── help_viewer.cpp │ ├── help_viewer.h │ ├── joy_prefs.cpp │ ├── joy_prefs.h │ ├── joy_setup.ui │ ├── l_wc_setup.ui │ ├── l_wcft_setup.ui │ ├── linuxtrack.icns │ ├── log_view.cpp │ ├── log_view.h │ ├── logview.ui │ ├── ltr.ui │ ├── ltr_dev_help.cpp │ ├── ltr_dev_help.h │ ├── ltr_gui.cpp │ ├── ltr_gui.h │ ├── ltr_gui.pro.in │ ├── ltr_gui.qhcp │ ├── ltr_gui.qhp │ ├── ltr_gui.ui │ ├── ltr_gui_prefs.cpp │ ├── ltr_gui_prefs.h │ ├── ltr_model.cpp │ ├── ltr_model.h │ ├── ltr_profiles.cpp │ ├── ltr_profiles.h │ ├── ltr_rc.qrc │ ├── ltr_show.cpp │ ├── ltr_show.h │ ├── ltr_state.cpp │ ├── ltr_state.h │ ├── ltr_tracking.cpp │ ├── ltr_tracking.h │ ├── m_ps3eye_ft_setup.ui │ ├── m_ps3eye_setup.ui │ ├── m_wc_setup.ui │ ├── m_wcft_setup.ui │ ├── macps3eye_prefs.cpp │ ├── macps3eye_prefs.h │ ├── macps3eyeft_prefs.cpp │ ├── macps3eyeft_prefs.h │ ├── macwebcam_info.cpp │ ├── macwebcam_info.h │ ├── macwebcam_prefs.cpp │ ├── macwebcam_prefs.h │ ├── macwebcamft_prefs.cpp │ ├── macwebcamft_prefs.h │ ├── main.cpp │ ├── model_creation.ui │ ├── model_edit.ui │ ├── model_wizzard.ui │ ├── objreader.cpp │ ├── objreader.h │ ├── plugin_install.cpp │ ├── plugin_install.h │ ├── precomp_headers.h │ ├── prefs_link.h │ ├── profile_selector.cpp │ ├── profile_selector.h │ ├── profile_selector.ui │ ├── profile_setup.cpp │ ├── profile_setup.h │ ├── profile_setup.ui │ ├── progress.cpp │ ├── progress.h │ ├── progress.ui │ ├── scp_form.cpp │ ├── scp_form.h │ ├── scp_form.ui │ ├── scurve.cpp │ ├── scurve.h │ ├── scurve.ui │ ├── scview.cpp │ ├── scview.h │ ├── single.png │ ├── single_edit.ui │ ├── sources.txt │ ├── sources_mac.txt │ ├── sources_mfc.txt │ ├── sparow_glass.obj │ ├── sparow_opaq.obj │ ├── spec.txt │ ├── sphere.obj │ ├── sphere.png │ ├── sphere.txt │ ├── tir_prefs.cpp │ ├── tir_prefs.h │ ├── tir_setup.ui │ ├── tracker.cpp │ ├── tracker.h │ ├── webcam_ft_prefs.cpp │ ├── webcam_ft_prefs.h │ ├── webcam_info.cpp │ ├── webcam_info.h │ ├── webcam_prefs.cpp │ ├── webcam_prefs.h │ ├── wii_setup.ui │ ├── wiimote_prefs.cpp │ ├── wiimote_prefs.h │ ├── win7.reg │ ├── window.cpp │ ├── window.h │ ├── wine_launcher.cpp │ ├── wine_launcher.h │ ├── wine_warn.cpp │ ├── wine_warn.h │ ├── wine_warn.ui │ ├── xm8_detail.png │ ├── xplugin.cpp │ ├── xplugin.h │ └── xplugin.ui ├── runloop.c ├── runloop.h ├── sn3_model.cpp ├── sn4_com.h ├── sn4_model.cpp ├── sn4_model.h ├── spline.c ├── spline.h ├── tests │ ├── Makefile.am │ ├── Makefile.in │ ├── ltlib_test.c │ ├── pose_test.c │ ├── pref_test.c │ ├── test.c │ ├── tir4_driver_test.c │ ├── webcam_driver_test.c │ └── wiimote_driver_test.c ├── tir.h ├── tir.sym ├── tir4_driver.c ├── tir4_driver.h ├── tir4_model.cpp ├── tir_driver.c ├── tir_driver.h ├── tir_driver_prefs.c ├── tir_driver_prefs.h ├── tir_hw.c ├── tir_hw.h ├── tir_img.c ├── tir_img.h ├── tir_model.cpp ├── tir_model.h ├── tracking.c ├── tracking.h ├── usb_ifc.h ├── utils.c ├── utils.h ├── wc_driver_prefs.c ├── wc_driver_prefs.h ├── webcam_driver.c ├── webcam_driver.h ├── webcam_driver.sym ├── wii_com.c ├── wii_com.h ├── wii_driver_prefs.c ├── wii_driver_prefs.h ├── wii_server.1 ├── wii_server │ ├── main.cpp │ ├── precomp_headers.h │ ├── wii_server.cpp │ ├── wii_server.h │ ├── wii_server.pro.in │ ├── wii_server.qrc │ ├── wii_server.ui │ ├── wiimote.cpp │ └── wiimote.h ├── wiimote_driver.c ├── wiimote_driver.h ├── wine_bridge │ ├── Makefile.am │ ├── Makefile.in │ ├── README.wine │ ├── client │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── NPClient.h │ │ ├── NPClient.spec │ │ ├── NPClient_dll.h │ │ ├── NPClient_main.c │ │ ├── check_data.c │ │ ├── rest.c │ │ └── rest.h │ ├── controller │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── dinput.cpp │ │ ├── kbi_interface.h │ │ ├── linuxtrack.ico │ │ ├── linuxtrack1.ico │ │ ├── main.cpp │ │ ├── resource.h │ │ └── resources.rc │ ├── ft_client │ │ ├── FreeTrackClient.spec │ │ ├── FreeTrackClient_dll.h │ │ ├── FreeTrackClient_main.c │ │ ├── Makefile.am │ │ └── Makefile.in │ ├── ft_tester │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── fttester.rc.in │ │ ├── main.cpp │ │ └── resource.h │ ├── linuxtrack.ico │ ├── linuxtrack1.ico │ ├── ltr_wine.nsi.in │ ├── ltr_wine64.nsi.in │ ├── tester │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── main.cpp │ │ ├── npifc.c │ │ ├── npifc.h │ │ ├── npview.rc.in │ │ ├── resource.h │ │ ├── rest.c │ │ └── rest.h │ └── views │ │ ├── Makefile.am │ │ ├── Makefile.in │ │ ├── main.cpp │ │ ├── resource.h │ │ ├── rest.c │ │ └── rest.h ├── xlinuxtrack.c ├── xlinuxtrack.sym ├── xlinuxtrack9.c ├── xlinuxtrack_pref.c └── xlinuxtrack_pref.h └── ylwrap /AUTHORS: -------------------------------------------------------------------------------- 1 | Tulthix 2 | uglyDwarf 3 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2009 Tulthix, uglyDwarf 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/ChangeLog -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 uglyDwarf 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = src src/mac doc src/osc_server_mac #src/tests 2 | #if ! DARWIN 3 | #SUBDIRS += src/mickey 4 | #if X64 5 | #if LTR32ON64 6 | # SUBDIRS += src/helper 7 | #endif 8 | #endif 9 | #endif 10 | 11 | if WINE_PLUGIN 12 | SUBDIRS +=src/wine_bridge/client src/wine_bridge/controller src/wine_bridge/tester \ 13 | src/wine_bridge/ft_client src/wine_bridge/ft_tester src/wine_bridge/views src/wine_bridge 14 | endif 15 | 16 | 17 | dist_pkgdata_DATA = README README.devel README.xplane 18 | EXTRA_DIST = Readme.rtf deploy mac_build pkgconf_extract mac_m4/fake_pkg_conf.m4 LICENSE.md 19 | AM_DISTCHECK_CONFIGURE_FLAGS = --with-xplane-sdk=$(HOME)/devel/SDK/CHeaders \ 20 | --with-wine-libs="-L/usr/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu/wine" 21 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/NEWS -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Linuxtrack is a project aiming to bring head tracking to Linux and Mac. 2 | 3 | Current downloads can be found at https://github.com/uglyDwarf/linuxtrack/wiki/Downloads . 4 | Steps to install the universal package (Linux) can be found at 5 | https://github.com/uglyDwarf/linuxtrack/wiki/universal-Linuxtrack-package . 6 | -------------------------------------------------------------------------------- /README.xplane: -------------------------------------------------------------------------------- 1 | Linuxtrack package contains two plugnins for XPlane simulator. 2 | 3 | xlinuxtrack.so.0 is the legacy plugin, usable on XPlane v8.XX and v9.XX 4 | xlinuxtrack9.so.0 is the current plugin for XPlane v9.XX and up 5 | 6 | The xlinuxtrack9 plugin is installed by default (via ltr_gui). 7 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | TODO for 1.0: 2 | - complete the documentation - both htm and on wiki. 3 | - Improve hello world (one with dlopen)... 4 | - bash include for inuversal package (setting paths, ...) 5 | - udev rule installed automatically 6 | - check parameter passing to different clients 7 | - check wine plugin more thoroughly 8 | - mac compilation 9 | 10 | 11 | TODO after 1.0: 12 | - start writing unit tests for each gui part/module (as much automation as possible) 13 | - network input plugin (working with ltr_pipe) 14 | - mickey @ mac 15 | 16 | 17 | TODO longterm: 18 | - TIR5 LED controls to work right away 19 | - Check for updates 20 | 21 | -------------------------------------------------------------------------------- /deploy: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # 3 | use strict; 4 | my($i, $found, $test, $rex); 5 | my($line); 6 | my($id) = 0; 7 | my($lib) = $ARGV[0]; 8 | my(@rexps) = split(":", $ARGV[1]); 9 | for($i = 0; $i < @rexps; ++$i){ 10 | $rexps[$i] =~ s/\//\\\//g; 11 | #$rexps[$i] =~ s/(.*)/\/$1\//; 12 | $rexps[$i] = qr/^\s+$rexps[$i]/; 13 | } 14 | 15 | my($dylib); 16 | if($lib =~ /.dylib$/){ 17 | $dylib = 1; 18 | }else{ 19 | $dylib = 0; 20 | $id = 1; 21 | } 22 | #$lib =~//; 23 | my($libname) = $lib; 24 | $libname =~ s/^.*\/([^\/]+)$/$1/; 25 | open(L, "otool -L ".$lib." |"); 26 | while($line=){ 27 | $found = 0; 28 | foreach $rex (@rexps){ 29 | if($line =~ $rex){ 30 | $found = 1; 31 | last; 32 | } 33 | } 34 | if($found == 1){ 35 | if($id == 0){ 36 | if($dylib == 1){ 37 | system('install_name_tool -id @executable_path/../Frameworks/'.$libname." ".$lib); 38 | } 39 | $id = 1; 40 | }else{ 41 | $line =~ /^\s*(\S*\/)(\S+)/; 42 | $libname = $2; 43 | my($libpath) = $1.$2; 44 | if($dylib == 1){ 45 | system('install_name_tool -change '.$libpath.' @loader_path/'.$libname.' '.$lib); 46 | }else{ 47 | system('install_name_tool -change '.$libpath.' @executable_path/../Frameworks/'.$libname.' '.$lib); 48 | } 49 | } 50 | } 51 | } 52 | 53 | sub process{ 54 | } 55 | 56 | # 57 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | dist_doc_DATA = README.ltr_pipe debug_flags.txt 2 | nobase_dist_doc_DATA = \ 3 | fgfs/Nasal/LinuxTrack/linuxtrack.nas \ 4 | fgfs/Protocol/linuxtrack.nas.xml \ 5 | fgfs/Protocol/linuxtrack.xml \ 6 | fgfs/Input/Joysticks/LinuxTrack/uinput-abs.xml \ 7 | fgfs/README 8 | 9 | -------------------------------------------------------------------------------- /doc/debug_flags.txt: -------------------------------------------------------------------------------- 1 | Debug flags 2 | ----------- 3 | For example - all on: 4 | export LINUXTRACK_DBG=pfutr 5 | 6 | p - log 2D points passing through image_process (webcam, tir) and save imgs. 7 | f - load fake usb for tir model 8 | u - log packets sent to/from TIR 9 | t - print blob coordinates 10 | r - print raw pose 11 | 12 | 13 | export LINUXTRACK_STIMULI=/tmp/file.X 14 | 15 | Sets input to play packets from for TIR model. 16 | -------------------------------------------------------------------------------- /doc/fgfs/Input/Joysticks/LinuxTrack/uinput-abs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | LinuxTrack uinput-abs 8 | 9 | 10 | Heading 11 | 12 | property-scale 13 | /sim/current-view/goal-heading-offset-deg 14 | -180.0 15 | 16 | 17 | 18 | 19 | Pitch 20 | 21 | property-scale 22 | /sim/current-view/goal-pitch-offset-deg 23 | 180.0 24 | 25 | 26 | 27 | 28 | Roll 29 | 30 | property-scale 31 | /sim/current-view/goal-roll-offset-deg 32 | -180.0 33 | 34 | 35 | 36 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /doc/fgfs/Protocol/linuxtrack.nas.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | newline 10 | tab 11 | 12 | 13 | heading 14 | float 15 | /sim/linuxtrack/data/h 16 | 17 | 18 | 19 | pitch 20 | float 21 | /sim/linuxtrack/data/p 22 | 23 | 24 | 25 | roll 26 | float 27 | /sim/linuxtrack/data/r 28 | 29 | 30 | 31 | x 32 | float 33 | /sim/linuxtrack/data/x 34 | 35 | 36 | 37 | y 38 | float 39 | /sim/linuxtrack/data/y 40 | 41 | 42 | 43 | z 44 | float 45 | /sim/linuxtrack/data/z 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /doc/fgfs/Protocol/linuxtrack.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | newline 10 | tab 11 | 12 | 13 | heading 14 | float 15 | /sim/current-view/goal-heading-offset-deg 16 | 17 | 18 | 19 | pitch 20 | float 21 | /sim/current-view/goal-pitch-offset-deg 22 | 23 | 24 | 25 | roll 26 | float 27 | /sim/current-view/goal-roll-offset-deg 28 | 29 | 30 | 31 | x 32 | float 33 | /sim/current-view/target-x-offset-m 34 | 35 | 36 | 37 | y 38 | float 39 | /sim/current-view/target-y-offset-m 40 | 41 | 42 | 43 | z 44 | float 45 | /sim/current-view/field-of-view 46 | 55.0 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /doc/fgfs/README: -------------------------------------------------------------------------------- 1 | To enable support in FlightGear you must manually copy some of the files 2 | from this directory tree to proper FlightGear directories. See ltr_pipe's 3 | README file for usage information. 4 | 5 | * Files description 6 | ==================== 7 | 8 | Stand-alone protocol file: 9 | 10 | fgfs/Protocol/linuxtrack.xml 11 | 12 | 13 | Protocol file for linuxtrack.nas script: 14 | 15 | fgfs/Protocol/linuxtrack.nas.xml 16 | 17 | 18 | Nasal script for linuxtrack.nas.xml protocol file: 19 | 20 | fgfs/Nasal/LinuxTrack/linuxtrack.nas 21 | 22 | 23 | Example joystick file: 24 | 25 | fgfs/Input/Joysticks/LinuxTrack/uinput-abs.xml 26 | 27 | -------------------------------------------------------------------------------- /m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /mac_m4/fake_pkg_conf.m4: -------------------------------------------------------------------------------- 1 | # Make sure pkg-conf macross missing doesn't break build (on MacOSX) 2 | AC_DEFUN([PKG_PROG_PKG_CONFIG], []) 3 | AC_DEFUN([PKG_CHECK_MODULES],[echo "PKG-CONFIG not used on MacOSX"]) 4 | -------------------------------------------------------------------------------- /octave/bezier.m: -------------------------------------------------------------------------------- 1 | %here is my idea on how to create the sensitivity curves... 2 | %I think we should be able to get such a form, that given x, we'll be able to 3 | %get y (no creation of big tables...) 4 | function bezier 5 | figure; 6 | hold on; 7 | 8 | for i =6 9 | bezier_plot(i/10); 10 | bezier1_plot(i/10); 11 | 12 | endfor 13 | hold off; 14 | endfunction 15 | 16 | function bezier_plot(pt) 17 | 18 | p0=[0;0]; 19 | p1=[pt; 1-pt]; 20 | p2=[1;1]; 21 | 22 | for T = 1:100 23 | t=T/100; 24 | B = [(1-t)^2; 2*t *(1-t); t^2]; 25 | b(T,:) = [B(1)*p0(1) + B(2)*p1(1) + B(3)*p2(1); B(1)*p0(2) + B(2)*p1(2) + B(3)*p2(2)]; 26 | endfor 27 | 28 | plot(b(:,1), b(:,2), 'r'); 29 | 30 | endfunction 31 | 32 | 33 | function bezier1_plot(pt) 34 | 35 | p0=[0;0]; 36 | p1=[pt; 1-pt]; 37 | p2=[1;1]; 38 | 39 | a = p0(1) - 2 * p1(1) + p2(1); 40 | b = 2 * (p1(1) - p0(1)); 41 | 42 | for X = 1:20 43 | x=X/20; 44 | c = p0(1) - x; 45 | 46 | t = (-b + sqrt(b^2 - 4*a*c)) / (2 * a); 47 | 48 | B = [(1-t)^2; 2*t *(1-t); t^2]; 49 | b1(X,:) = [x; B(1)*p0(2) + B(2)*p1(2) + B(3)*p2(2)]; 50 | endfor 51 | b1 52 | plot(b1(:,1), b1(:,2), 'g.+'); 53 | 54 | endfunction 55 | 56 | 57 | -------------------------------------------------------------------------------- /pkgconf_extract: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | use strict; 4 | my($line, %vars, %defs); 5 | 6 | open(F, $ARGV[0]); 7 | while($line = ){ 8 | if($line =~ /(\S+)\s*=\s*(.+)/){ 9 | $vars{$1} = substitute($2); 10 | }elsif($line =~ /(\S+)\s*:\s*(.+)/){ 11 | my($key, $val) = ($1, $2); 12 | $defs{$key} = substitute($val); 13 | #printf("Read in: %s -> %s\n", $1, $defs{$1}); 14 | } 15 | } 16 | close(F); 17 | #printf("\n\n%s\n...\n", $defs{Version}); 18 | #foreach $x (keys(%defs)){ 19 | # printf("%s -> %s\n", $x, $defs{$x}); 20 | #} 21 | #printf("...\n"); 22 | 23 | #printf("\""); 24 | my($i) = 1; 25 | while(1){ 26 | if(defined($ARGV[$i]) && defined($ARGV[$i+1]) && defined($defs{$ARGV[$i+1]})){ 27 | printf("%s=%s ", $ARGV[$i], $defs{$ARGV[$i+1]}); 28 | $i += 2; 29 | }else{ 30 | last; 31 | } 32 | } 33 | #printf("\""); 34 | 35 | sub substitute{ 36 | my($str) = @_; 37 | while($str =~ /(.*)\$\{(\S+)\}(.*)/){ 38 | if(exists($vars{$2})){ 39 | $str = $1.$vars{$2}.$3; 40 | }else{ 41 | $str = $1.$3; 42 | } 43 | } 44 | return $str; 45 | } 46 | 47 | # 48 | -------------------------------------------------------------------------------- /src/99-Mickey.rules: -------------------------------------------------------------------------------- 1 | KERNEL=="uinput", GROUP="uinput", MODE="0660" 2 | 3 | -------------------------------------------------------------------------------- /src/99-TIR.rules: -------------------------------------------------------------------------------- 1 | SUBSYSTEM=="usb", ATTRS{idVendor}=="131d", MODE="0666" 2 | -------------------------------------------------------------------------------- /src/axis.h: -------------------------------------------------------------------------------- 1 | #ifndef AXIS__H 2 | #define AXIS__H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | struct ltr_axes; 11 | typedef struct ltr_axes *ltr_axes_t; 12 | #define LTR_AXES_T_INITIALIZER NULL 13 | #define LTR_AXIS_FILTER_MAX 4.0 14 | 15 | enum axis_t {PITCH, ROLL, YAW, TX, TY, TZ, MISC}; 16 | enum axis_param_t {AXIS_ENABLED, AXIS_DEADZONE, 17 | AXIS_LCURV, AXIS_RCURV, 18 | AXIS_MULT, 19 | AXIS_LLIMIT, AXIS_RLIMIT, 20 | AXIS_FILTER, 21 | AXIS_INVERTED, 22 | AXIS_FULL, MISC_LEGR, MISC_ALTER, MISC_ALIGN, MISC_FOCAL_LENGTH, AXIS_DEFAULT = 1024}; 23 | 24 | void ltr_int_init_axes(ltr_axes_t *axes, const char *profile); 25 | void ltr_int_close_axes(ltr_axes_t *axes); 26 | float ltr_int_val_on_axis(ltr_axes_t axes, enum axis_t id, float x); 27 | float ltr_int_filter_axis(ltr_axes_t axes, enum axis_t id, float x, float *y_minus_1); 28 | 29 | bool ltr_int_is_symetrical(ltr_axes_t axes, enum axis_t id); 30 | 31 | bool ltr_int_set_axis_param(ltr_axes_t axes, enum axis_t id, enum axis_param_t param, float val); 32 | float ltr_int_get_axis_param(ltr_axes_t axes, enum axis_t id, enum axis_param_t param); 33 | 34 | bool ltr_int_set_axis_bool_param(ltr_axes_t axes, enum axis_t id, enum axis_param_t param, bool val); 35 | bool ltr_int_get_axis_bool_param(ltr_axes_t axes, enum axis_t id, enum axis_param_t param); 36 | 37 | bool ltr_int_axes_changed(ltr_axes_t axes, bool reset_flag); 38 | bool ltr_int_get_axes_ff(ltr_axes_t axes, double ffs[]); 39 | 40 | const char *ltr_int_axis_get_desc(enum axis_t id); 41 | const char *ltr_int_axis_param_get_desc(enum axis_param_t id); 42 | 43 | void ltr_int_axes_from_default(ltr_axes_t *axes); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/com_proc.h: -------------------------------------------------------------------------------- 1 | #ifndef COM_PROC__H 2 | #define COM_PROC__H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | #include 10 | 11 | typedef enum {STOP, SLEEP, WAKEUP} command_t; 12 | 13 | typedef struct{ 14 | float x, y; 15 | int score; 16 | } blobs_t; 17 | 18 | struct blob_type; 19 | 20 | command_t ltr_int_getCommand(struct mmap_s *mmm); 21 | void ltr_int_setCommand(struct mmap_s *mmm, command_t cmd); 22 | int ltr_int_getThreshold(struct mmap_s *mmm); 23 | void ltr_int_setThreshold(struct mmap_s *mmm, int thr); 24 | int ltr_int_getMinBlob(struct mmap_s *mmm); 25 | void ltr_int_setMinBlob(struct mmap_s *mmm, int pix); 26 | int ltr_int_getMaxBlob(struct mmap_s *mmm); 27 | void ltr_int_setMaxBlob(struct mmap_s *mmm, int pix); 28 | void ltr_int_setBlobs(struct mmap_s *mmm, struct blob_type *b, int num_blobs); 29 | bool ltr_int_haveNewBlobs(struct mmap_s *mmm); 30 | int ltr_int_getBlobs(struct mmap_s *mmm, struct blob_type * b, int num_blobs); 31 | unsigned char* ltr_int_getFramePtr(struct mmap_s *mmm); 32 | bool ltr_int_getFrameFlag(struct mmap_s *mmm); 33 | void ltr_int_setFrameFlag(struct mmap_s *mmm); 34 | void ltr_int_resetFrameFlag(struct mmap_s *mmm); 35 | void ltr_int_printCmd(char *prefix, command_t cmd); 36 | void ltr_int_setWiiIndication(struct mmap_s *mmm, int new_ind); 37 | int ltr_int_getWiiIndication(struct mmap_s *mmm); 38 | int ltr_int_get_com_size(); 39 | int ltr_int_getOptLevel(struct mmap_s *mmm); 40 | void ltr_int_setOptLevel(struct mmap_s *mmm, int new_opt); 41 | float ltr_int_getEff(struct mmap_s *mmm); 42 | void ltr_int_setEff(struct mmap_s *mmm, float new_eff); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/digest.h: -------------------------------------------------------------------------------- 1 | #ifndef DIGEST__H 2 | #define DIGEST__H 3 | 4 | #include 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define MD5_DIGEST_LENGTH 16UL 12 | #define SHA_DIGEST_LENGTH 20UL 13 | void md5sum(const uint8_t data[], size_t len, uint32_t res[]); 14 | void sha1sum(const uint8_t data[], size_t len, uint32_t res[]); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/drivers.sym: -------------------------------------------------------------------------------- 1 | ltr_int_rl_run 2 | ltr_int_rl_shutdown 3 | ltr_int_rl_suspend 4 | ltr_int_rl_wakeup 5 | -------------------------------------------------------------------------------- /src/dyn_load.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "dyn_load.h" 4 | #include "utils.h" 5 | 6 | void *ltr_int_load_library(char *lib_name, lib_fun_def_t *func_defs) 7 | { 8 | void *libhandle; 9 | char *full_name = ltr_int_get_lib_path(lib_name); 10 | if(full_name == NULL){ 11 | ltr_int_log_message("Couldn't get full name for library %s\n", lib_name); 12 | return NULL; 13 | } 14 | libhandle = dlopen(full_name, RTLD_NOW | RTLD_LOCAL); 15 | if(libhandle == NULL){ 16 | ltr_int_log_message("Couldn't load library '%s' - %s!\n", full_name, dlerror()); 17 | free(full_name); 18 | return NULL; 19 | } 20 | free(full_name); 21 | dlerror(); //clear any existing error... 22 | //log_message("Handle: %p\n", libhandle); 23 | while(func_defs->name != NULL){ 24 | if((*(void **) (func_defs->ref) = dlsym(libhandle, func_defs->name)) == NULL){ 25 | ltr_int_log_message("Error loding functions: %s\n", dlerror()); 26 | dlclose(libhandle); 27 | return NULL; 28 | } 29 | //log_message("Loading func '%s' from '%s' => %p\n", 30 | // func_defs->name, lib_name, *(void **)func_defs->ref); 31 | ++func_defs; 32 | } 33 | return libhandle; 34 | } 35 | 36 | int ltr_int_unload_library(void *libhandle, lib_fun_def_t *func_defs) 37 | { 38 | while(func_defs->name != NULL){ 39 | *(void **)(func_defs->ref) = NULL; 40 | ++func_defs; 41 | } 42 | return dlclose(libhandle); 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/dyn_load.h: -------------------------------------------------------------------------------- 1 | #ifndef DYN_LOAD__H 2 | #define DYN_LOAD__H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | typedef struct{ 9 | char *name; 10 | void *ref; 11 | } lib_fun_def_t; 12 | 13 | void *ltr_int_load_library(char *lib_name, lib_fun_def_t *func_defs); 14 | int ltr_int_unload_library(void *libhandle, lib_fun_def_t *func_defs); 15 | 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/extract.h: -------------------------------------------------------------------------------- 1 | #ifndef _EXTRACT__H 2 | #define _EXTRACT__H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /* 9 | * From sources creates blob named name using inst's contents for obfuscation 10 | */ 11 | int create_blob(const char *name, const char *sources[], const char *inst); 12 | 13 | /* 14 | * Extract contents of the blob using inst contents for deobfuscation. 15 | */ 16 | int extract_blob(const char *inst, const char* destination); 17 | 18 | char *get_blob_name(const char *installer_name); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/facetrack.h: -------------------------------------------------------------------------------- 1 | #ifndef FACEDETECT__H 2 | #define FACEDETECT__H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include "image_process.h" 9 | 10 | bool ltr_int_init_face_detect(); 11 | void ltr_int_face_detect(image_t *img, struct bloblist_type *blt); 12 | void ltr_int_stop_face_detect(); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/game_data.h: -------------------------------------------------------------------------------- 1 | #ifndef GAME_DATA__H 2 | #define GAME_DATA__H 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | bool get_game_data(const char *input_fname, const char *output_fname, bool from_update); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/helper/Makefile.am: -------------------------------------------------------------------------------- 1 | #l32libdir = $(prefix)/$(LIB32DIR)/linuxtrack 2 | # 3 | #if ! DARWIN 4 | # LINUXFLAGS = '-DLIB_PATH="$(pkglibdir)/"' 5 | #if X64 6 | #if LTR32ON64 7 | # l32lib_LTLIBRARIES = liblinuxtrack.la 8 | #endif 9 | #endif 10 | #endif 11 | # 12 | #liblinuxtrack_la_SOURCES = ../ltlib.c ../linuxtrack.h ../utils.c ../utils.h \ 13 | # ../ipc_utils.c ../ipc_utils.h 14 | #liblinuxtrack_la_CFLAGS = $(LINUXFLAGS) -m32 -I.. 15 | #liblinuxtrack_la_LDFLAGS = -export-symbols "${srcdir}/../liblt.sym" -m32 $(LINUXFLAGS) 16 | # 17 | -------------------------------------------------------------------------------- /src/image_process.h: -------------------------------------------------------------------------------- 1 | #ifndef IMAGE_PROCESS__H 2 | #define IMAGE_PROCESS__H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include "cal.h" 9 | #include "list.h" 10 | 11 | typedef struct { 12 | unsigned int vline; 13 | unsigned int hstart; 14 | unsigned int hstop; 15 | unsigned int sum_x; 16 | unsigned int sum; 17 | unsigned int points; 18 | } stripe_t; 19 | 20 | typedef struct { 21 | int w, h; 22 | unsigned char *bitmap; 23 | float ratio; 24 | } image_t; 25 | 26 | void ltr_int_prepare_for_processing(int w, int h); 27 | void ltr_int_cleanup_after_processing(); 28 | void ltr_int_to_stripes(image_t *img); 29 | int ltr_int_stripes_to_blobs(unsigned int num_blobs, struct bloblist_type *blt, 30 | int min_pts, int max_pts, image_t *img); 31 | bool ltr_int_add_stripe(stripe_t *stripe, image_t *img); 32 | void ltr_int_draw_cross(image_t *img, int x, int y, int size); 33 | void ltr_int_draw_empty_square(image_t *img, int x1, int y1, int x2, int y2); 34 | void ltr_int_draw_square(image_t *img, int x, int y, int size); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/ipc_utils.h: -------------------------------------------------------------------------------- 1 | #ifndef IPC_UTILS__H 2 | #define IPC_UTILS__H 3 | 4 | #include 5 | #include 6 | 7 | #ifndef LIBLINUXTRACK_SRC 8 | #define LIBLINUXTRACK_PRIVATE 9 | #else 10 | #define LIBLINUXTRACK_PRIVATE static 11 | #endif 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | typedef struct semaphore_t *semaphore_p; 18 | struct mmap_s{ 19 | char *fname; 20 | size_t size; 21 | void *data; 22 | semaphore_p sem; 23 | semaphore_p lock_sem; 24 | }; 25 | 26 | int ltr_int_server_running_already(const char *lockName, bool isAbsolute, 27 | semaphore_p *psem, bool should_lock); 28 | LIBLINUXTRACK_PRIVATE bool ltr_int_fork_child(char *args[], bool *is_child); 29 | bool ltr_int_wait_child_exit(int limit); 30 | bool ltr_int_child_alive(); 31 | 32 | semaphore_p ltr_int_createSemaphore(char *fname); 33 | bool ltr_int_lockSemaphore(semaphore_p semaphore); 34 | bool ltr_int_tryLockSemaphore(semaphore_p semaphore); 35 | bool ltr_int_testLockSemaphore(semaphore_p semaphore); 36 | bool ltr_int_unlockSemaphore(semaphore_p semaphore); 37 | void ltr_int_closeSemaphore(semaphore_p semaphore); 38 | 39 | bool ltr_int_mmap_file(const char *name, size_t tmp_size, struct mmap_s *m); 40 | LIBLINUXTRACK_PRIVATE bool ltr_int_mmap_file_exclusive(size_t tmp_size, struct mmap_s *m); 41 | LIBLINUXTRACK_PRIVATE bool ltr_int_unmap_file(struct mmap_s *m); 42 | int ltr_int_open_tmp_file(char *fname); 43 | void ltr_int_close_tmp_file(char *fname, int fd); 44 | //LIBLINUXTRACK_PRIVATE char *ltr_int_get_com_file_name(); 45 | 46 | int ltr_int_socket_send(int socket, void *buf, size_t size); 47 | ssize_t ltr_int_socket_receive(int socket, void *buf, size_t size); 48 | int ltr_int_pipe_poll(int pipe, int timeout, bool *hup); 49 | int ltr_int_create_server_socket(const char *name); 50 | int ltr_int_connect_to_socket(const char *name); 51 | int ltr_int_close_socket(int socket); 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/joy_driver.sym: -------------------------------------------------------------------------------- 1 | ltr_int_joy_enum_joysticks 2 | ltr_int_joy_free_joysticks 3 | ltr_int_joy_enum_axes 4 | ltr_int_joy_free_axes 5 | ltr_int_rl_run 6 | ltr_int_rl_shutdown 7 | ltr_int_rl_suspend 8 | ltr_int_rl_wakeup 9 | -------------------------------------------------------------------------------- /src/joy_driver_prefs.h: -------------------------------------------------------------------------------- 1 | #ifndef JOY_DRIVER_PREFS__H 2 | #define JOY_DRIVER_PREFS__H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | typedef enum { 13 | e_JS, 14 | e_EVDEV 15 | } ifc_type_t; 16 | 17 | 18 | typedef struct { 19 | char **nameList; 20 | size_t nameListSize; 21 | size_t namesFound; 22 | }joystickNames_t; 23 | 24 | typedef struct { 25 | uint8_t *axesList; 26 | const char **axisNames; 27 | int *min; 28 | int *max; 29 | size_t axes; 30 | } axes_t; 31 | 32 | bool ltr_int_joy_init_prefs(); 33 | int ltr_int_joy_get_pitch_axis(); 34 | bool ltr_int_joy_set_pitch_axis(int val); 35 | int ltr_int_joy_get_yaw_axis(); 36 | bool ltr_int_joy_set_yaw_axis(int val); 37 | int ltr_int_joy_get_roll_axis(); 38 | bool ltr_int_joy_set_roll_axis(int val); 39 | int ltr_int_joy_get_tx_axis(); 40 | bool ltr_int_joy_set_tx_axis(int val); 41 | int ltr_int_joy_get_ty_axis(); 42 | bool ltr_int_joy_set_ty_axis(int val); 43 | int ltr_int_joy_get_tz_axis(); 44 | bool ltr_int_joy_set_tz_axis(int val); 45 | ifc_type_t ltr_int_joy_get_ifc(); 46 | bool ltr_int_joy_set_ifc(ifc_type_t val); 47 | float ltr_int_joy_get_angle_base(); 48 | bool ltr_int_joy_set_angle_base(float val); 49 | float ltr_int_joy_get_trans_base(); 50 | bool ltr_int_joy_set_trans_base(float val); 51 | int ltr_int_joy_get_pps(); 52 | bool ltr_int_joy_set_pps(int val); 53 | 54 | bool ltr_int_joy_enum_axes(ifc_type_t ifc, const char *name, axes_t *axes); 55 | void ltr_int_joy_free_axes(axes_t axes); 56 | joystickNames_t *ltr_int_joy_enum_joysticks(ifc_type_t ifc); 57 | void ltr_int_joy_free_joysticks(joystickNames_t *nl); 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /src/liblt.sym: -------------------------------------------------------------------------------- 1 | ltr_init 2 | ltr_shutdown 3 | ltr_suspend 4 | ltr_wakeup 5 | ltr_recenter 6 | ltr_get_pose 7 | ltr_get_pose_full 8 | ltr_get_tracking_state 9 | ltr_log_message 10 | ltr_explain 11 | ltr_get_abs_pose 12 | ltr_request_frames 13 | ltr_get_frame 14 | ltr_notification_on 15 | ltr_get_notify_pipe 16 | ltr_wait 17 | -------------------------------------------------------------------------------- /src/linuxtrack-wii.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Name=Ltr Wii Server 4 | Comment=Proxy connecting Wiimote to Linuxtrack 5 | Exec=wii_server 6 | Icon=linuxtrack-wii 7 | Terminal=false 8 | Type=Application 9 | Categories=Game; 10 | StartupNotify=false 11 | Keywords=headtracking;wiimote; 12 | 13 | -------------------------------------------------------------------------------- /src/linuxtrack-wii.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/linuxtrack-wii.png -------------------------------------------------------------------------------- /src/linuxtrack.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Name=Linuxtrack 4 | Comment=Setup headtracking parameters 5 | Exec=ltr_gui 6 | Icon=linuxtrack 7 | Terminal=false 8 | Type=Application 9 | Categories=Game; 10 | StartupNotify=false 11 | Keywords=headtracking; 12 | -------------------------------------------------------------------------------- /src/linuxtrack.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: linuxtrack 7 | Description: Library to interface with Linuxtrack head-tracking application 8 | Version: 0.0.120118 9 | Libs: -L${libdir} -llinuxtrack 10 | Cflags: -I${includedir} 11 | 12 | -------------------------------------------------------------------------------- /src/linuxtrack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/linuxtrack.png -------------------------------------------------------------------------------- /src/linuxtrack_hello_world.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | static float heading, pitch, roll, x, y, z; 7 | static unsigned int counter; 8 | 9 | bool intialize_tracking(void) 10 | { 11 | linuxtrack_state_type state; 12 | //Initialize the tracking using Default profile 13 | state = linuxtrack_init(NULL); 14 | if(state < LINUXTRACK_OK){ 15 | printf("%s\n", linuxtrack_explain(state)); 16 | return false; 17 | } 18 | int timeout = 0; 19 | //wait up to 20 seconds for the tracker initialization 20 | while(timeout < 200){ 21 | state = linuxtrack_get_tracking_state(); 22 | printf("Status: %s\n", linuxtrack_explain(state)); 23 | if((state == RUNNING) || (state == PAUSED)){ 24 | return true; 25 | } 26 | usleep(100000); 27 | ++timeout; 28 | } 29 | printf("Linuxtrack doesn't work right!\n"); 30 | printf("Make sure it is installed and configured correctly.\n"); 31 | return false; 32 | } 33 | 34 | int main(int argc, char *argv[]) 35 | { 36 | (void) argc; 37 | (void) argv; 38 | printf("Linuxtrack: Hello World!\n"); 39 | int frames = 0; 40 | 41 | if(!intialize_tracking()){ 42 | return 1; 43 | } 44 | 45 | //do the tracking 46 | while(frames < 100){ //100 frames ~ 10 seconds 47 | if(linuxtrack_get_pose(&heading, &pitch, &roll, &x, &y, &z, &counter) > 0){ 48 | printf("%f %f %f\n %f %f %f\n", heading, pitch, roll, x, y, z); 49 | } 50 | ++frames; 51 | if(frames == 40){ 52 | //pause for a bit 53 | linuxtrack_suspend(); 54 | }else if(frames == 70){ 55 | //resume 56 | linuxtrack_wakeup(); 57 | } 58 | //here you'd do some usefull stuff 59 | usleep(100000); 60 | } 61 | 62 | //stop the tracker 63 | linuxtrack_shutdown(); 64 | return 0; 65 | } 66 | 67 | -------------------------------------------------------------------------------- /src/linuxtrack_pre.c: -------------------------------------------------------------------------------- 1 | #define LIBLINUXTRACK_SRC 2 | 3 | //#include "utils.h" 4 | //#include "ipc_utils.h" 5 | //#include "ltlib.h" 6 | 7 | //#include "utils.c" 8 | //#include "ipc_utils.c" 9 | //#include "ltlib.c" 10 | -------------------------------------------------------------------------------- /src/list.h: -------------------------------------------------------------------------------- 1 | #ifndef LIST__H 2 | #define LIST__H 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | typedef struct list* plist; 11 | typedef struct iterator{ 12 | struct list_element *elem; 13 | plist parent; 14 | } iterator; 15 | 16 | /* 17 | * Returns pointer empty list. 18 | * When you don't need it, remember to free it! 19 | */ 20 | plist ltr_int_create_list(); 21 | 22 | /* 23 | * Returns true if list is not empty 24 | */ 25 | bool ltr_int_is_empty(plist l); 26 | 27 | /* 28 | * Adds new element (payload) to the list. 29 | */ 30 | void ltr_int_add_element(plist pl, void *payload); 31 | 32 | /* 33 | * Initializes iterator i and points it to the 34 | * begining of the list 35 | */ 36 | void ltr_int_init_iterator(plist l, iterator *i); 37 | 38 | /* 39 | * Initializes iterator i and points it to the 40 | * end of the list 41 | */ 42 | void ltr_int_init_rev_iterator(plist l, iterator *i); 43 | 44 | /* 45 | * Returns pointer to next element in the list, 46 | * NULL if you've reached the end... 47 | */ 48 | void* ltr_int_get_next(iterator* i); 49 | 50 | /* 51 | * Returns pointer to previous element in the list, 52 | * NULL if you've reached the beginning... 53 | */ 54 | void* ltr_int_get_prev(iterator* i); 55 | 56 | /* 57 | * Returns pointer to current element, NULL if at 58 | * the end 59 | */ 60 | void* ltr_int_get_current(iterator* i); 61 | 62 | void *ltr_int_delete_current(plist pl, iterator* i); 63 | 64 | /* 65 | * Frees the list and optionaly also its elements 66 | */ 67 | void ltr_int_free_list(plist list_ptr, bool free_payload); 68 | 69 | /* 70 | * Creates array of strings out of list of strings. 71 | * Counts on the fact that list elements are strings 72 | * The list is freed at the end (just the list, the array inherits those strings) 73 | */ 74 | int ltr_int_list2string_list(plist l, char **ids[]); 75 | void ltr_int_array_cleanup(char **ids[]); 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif 82 | 83 | -------------------------------------------------------------------------------- /src/local_config.h.in: -------------------------------------------------------------------------------- 1 | //#define LIB_PATH "@libdir@/" 2 | -------------------------------------------------------------------------------- /src/ltlib.h: -------------------------------------------------------------------------------- 1 | #ifndef LTLIB__H 2 | #define LTLIB__H 3 | 4 | #include 5 | #include 6 | #include "linuxtrack.h" 7 | 8 | typedef enum{RUN_CMD, PAUSE_CMD, STOP_CMD, FRAMES_CMD, NOP_CMD} ltr_cmd; 9 | 10 | #define MAX_BLOBS 10 11 | #define BLOB_ELEMENTS 3 12 | 13 | typedef struct{ 14 | float abs_yaw; 15 | float abs_pitch; 16 | float abs_roll; 17 | float abs_tx; 18 | float abs_ty; 19 | float abs_tz; 20 | } linuxtrack_abs_pose_t; 21 | 22 | typedef struct{ 23 | linuxtrack_pose_t prev_pose; 24 | linuxtrack_pose_t pose; 25 | linuxtrack_abs_pose_t prev_abs_pose; 26 | linuxtrack_abs_pose_t abs_pose; 27 | uint32_t blobs; 28 | float blob_list[BLOB_ELEMENTS * MAX_BLOBS]; 29 | int timestamp; 30 | int prev_timestamp; 31 | }linuxtrack_full_pose_t; 32 | 33 | struct ltr_comm{ 34 | uint8_t cmd; 35 | uint8_t recenter; 36 | uint8_t notify; 37 | int8_t state; 38 | linuxtrack_full_pose_t full_pose; 39 | uint8_t dead_man_button; 40 | uint8_t preparing_start; 41 | }; 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | //#ifndef LIBLINUXTRACK_SRC 48 | //char *ltr_int_init_helper(const char *cust_section, bool standalone); 49 | //#endif 50 | 51 | linuxtrack_state_type ltr_init(const char *cust_section); 52 | linuxtrack_state_type ltr_recenter(void); 53 | linuxtrack_state_type ltr_shutdown(void); 54 | 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/ltlib_client.h: -------------------------------------------------------------------------------- 1 | #ifndef LTLIB_CLIENT__H 2 | #define LTLIB_CLIENT__H 3 | 4 | int lt_client_init(); 5 | int lt_client_suspend(); 6 | int lt_client_wakeup(); 7 | int lt_client_close(); 8 | 9 | #endif -------------------------------------------------------------------------------- /src/ltlib_int.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_TRACK_INT__H 2 | #define LINUX_TRACK_INT__H 3 | 4 | #include 5 | #include 6 | #include "ltlib.h" 7 | #include "linuxtrack.h" 8 | #include "ipc_utils.h" 9 | #include 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #define FRAME_BUFFERS 3 16 | 17 | struct frame_type; 18 | typedef void (*ltr_new_frame_callback_t)(struct frame_type *frame, void *); 19 | typedef void (*ltr_status_update_callback_t)(void *); 20 | typedef void (*ltr_new_slave_callback_t)(char *); 21 | 22 | int ltr_int_init(void); 23 | int ltr_int_shutdown(void); 24 | int ltr_int_suspend(void); 25 | int ltr_int_wakeup(void); 26 | void ltr_int_recenter(void); 27 | int ltr_int_get_camera_update(linuxtrack_full_pose_t *pose); 28 | linuxtrack_state_type ltr_int_get_tracking_state(void); 29 | void ltr_int_register_cbk(ltr_new_frame_callback_t new_frame_cbk, void *param1, 30 | ltr_status_update_callback_t status_change_cbk, void *param2); 31 | void ltr_int_publish_frames_cmd(void); 32 | linuxtrack_state_type ltr_notification_on(void); 33 | int ltr_get_notify_pipe(void); 34 | int ltr_wait(int timeout); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /src/ltr_gui.1: -------------------------------------------------------------------------------- 1 | .TH ltr_gui 1 "22 January 2011" 2 | .IX ltr_gui 3 | .SH NAME 4 | ltr_gui - setup head tracking parameters 5 | .SH SYNOPSYS 6 | .B ltr_gui 7 | .SH DESCRIPTION 8 | ltr_gui is used to setup all parameters of linuxtrack head tracking software. 9 | 10 | -------------------------------------------------------------------------------- /src/ltr_recenter.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int main(int argc, char *argv[]){ 8 | (void) argc; 9 | (void) argv; 10 | 11 | //redirect stderr to /dev/null to avoid console spamming 12 | fflush(stderr); 13 | int n = open("/dev/null", O_WRONLY); 14 | if(n > 0){ 15 | dup2(n, 2); 16 | close(n); 17 | } 18 | 19 | int socket = ltr_int_connect_to_socket(ltr_int_master_socket_name()); 20 | if(socket < 0){ 21 | //printf("Server not running!\n"); 22 | return 1; 23 | } 24 | ltr_int_close_socket(socket); 25 | socket = -1; 26 | 27 | if(ltr_init(NULL) < LINUXTRACK_OK){ 28 | //printf("Can't initialize communication.\n"); 29 | return 1; 30 | } 31 | ltr_recenter(); 32 | //printf("Recentered.\n"); 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /src/ltr_server.1: -------------------------------------------------------------------------------- 1 | .TH ltr_server 1 "22 January 2011" 2 | .IX ltr_server 3 | .SH NAME 4 | ltr_server - setup head tracking parameters 5 | .SH SYNOPSYS 6 | .B ltr_server 7 | .RI filename 8 | .RI [ section_name ] 9 | .SH DESCRIPTION 10 | ltr_server is a helper executable, allowing to decouple application 11 | from the actual tracker. User is not supposed to run this command directly. 12 | .SH OPTIONS 13 | .TP 14 | .B filename 15 | Then name of file used to communicate between tracker and the application. 16 | .TP 17 | .B section_name 18 | Name of the linuxtrack profile to be used. If not specified, default profile 19 | is used. 20 | 21 | -------------------------------------------------------------------------------- /src/ltr_server.h: -------------------------------------------------------------------------------- 1 | #ifndef LTR_SERVER__H 2 | #define LTR_SERVER__H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | int prep_main_loop(char *section); 9 | #ifdef LTR_GUI 10 | extern void new_frame(struct frame_type *frame, void *param); 11 | #endif 12 | 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/ltr_server1.1: -------------------------------------------------------------------------------- 1 | .TH ltr_server1 1 "11 May 2014" 2 | .IX ltr_server1 3 | .SH NAME 4 | ltr_server1 - setup head tracking parameters 5 | .SH SYNOPSYS 6 | .B ltr_server1 7 | .RI filename 8 | .RI [ section_name ] 9 | .SH DESCRIPTION 10 | ltr_server1 is a helper executable, allowing to decouple application 11 | from the actual tracker. User is not supposed to run this command directly. 12 | .SH OPTIONS 13 | .TP 14 | .B filename 15 | Then name of file used to communicate between tracker and the application. 16 | .TP 17 | .B section_name 18 | Name of the linuxtrack profile to be used. If not specified, default profile 19 | is used. 20 | 21 | -------------------------------------------------------------------------------- /src/ltr_server1.c: -------------------------------------------------------------------------------- 1 | #include "ltr_srv_comm.h" 2 | #include "ltr_srv_slave.h" 3 | #include "ltr_srv_master.h" 4 | #include "utils.h" 5 | #include 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | (void) argc; 10 | (void) argv; 11 | ltr_int_check_root(); 12 | //Make sure that broken pipe won't bring us down 13 | signal(SIGPIPE, SIG_IGN); 14 | if(argc == 1){ 15 | ltr_int_master(true); 16 | }else{ 17 | //Parameter is name of profile 18 | ltr_int_slave(argv[1], argv[2], argv[3], argv[4], argv[5]); 19 | } 20 | return 0; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/ltr_srv_comm.h: -------------------------------------------------------------------------------- 1 | #ifndef LTR_SRV_COMM__H 2 | #define LTR_SRV_COMM__H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | typedef struct{ 11 | uint32_t axis_id; 12 | uint32_t param_id; 13 | union{ 14 | float flt_val; 15 | bool bool_val; 16 | }; 17 | } param_t; 18 | 19 | typedef struct{ 20 | uint32_t cmd; 21 | uint32_t data; 22 | union{ 23 | char str[500]; 24 | linuxtrack_full_pose_t pose; 25 | param_t param; 26 | }; 27 | } message_t; 28 | 29 | enum cmds {CMD_NOP, CMD_NEW_SOCKET, CMD_PAUSE, CMD_WAKEUP, CMD_RECENTER, CMD_POSE, CMD_PARAM, 30 | CMD_FRAMES}; 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | int ltr_int_send_message(int socket, uint32_t cmd, uint32_t data); 37 | int ltr_int_send_message_w_str(int socket, uint32_t cmd, uint32_t data, char *str); 38 | int ltr_int_send_data(int socket, const linuxtrack_full_pose_t *data); 39 | int ltr_int_send_param_update(int socket, uint32_t axis, uint32_t param, float value); 40 | const char *ltr_int_master_socket_name(); 41 | const char *ltr_int_slave_socket_name(); 42 | int ltr_int_max_slave_sockets(); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /src/ltr_srv_master.h: -------------------------------------------------------------------------------- 1 | #ifndef LTR_SRV_MASTER__H 2 | #define LTR_SRV_MASTER__H 3 | 4 | #include 5 | #include 6 | 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | void ltr_int_change(const char *profile, int axis, int elem, float val); 13 | bool ltr_int_master(bool standalone); 14 | 15 | //For ltr_gui 16 | void ltr_int_suspend_cmd(); 17 | void ltr_int_wakeup_cmd(); 18 | void ltr_int_recenter_cmd(); 19 | size_t ltr_int_request_shutdown(); 20 | 21 | void ltr_int_set_callback_hooks(ltr_new_frame_callback_t nfh, ltr_status_update_callback_t suh, 22 | ltr_new_slave_callback_t nsh); 23 | bool ltr_int_gui_lock(bool do_lock); 24 | void ltr_int_gui_lock_clean(); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | #endif 30 | -------------------------------------------------------------------------------- /src/ltr_srv_slave.h: -------------------------------------------------------------------------------- 1 | #ifndef LTR_SRV_SLAVE__H 2 | #define LTR_SRV_SLAVE__H 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | bool ltr_int_slave(const char *c_profile, const char *c_com_file, const char *ppid_str, 11 | const char *close_pipe_str, const char *notify_pipe_str); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/mac/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/mac/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /src/mac/English.lproj/MainMenu.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/mac/English.lproj/MainMenu.nib/keyedobjects.nib -------------------------------------------------------------------------------- /src/mac/Info.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | WiiServer 9 | CFBundleIconFile 10 | linuxtrack_wii.icns 11 | CFBundleIdentifier 12 | linuxtrack.WiiServer 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | WiiiimoteServer v@PACKAGE_VERSION@ 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | NSMainNibFile 24 | MainMenu 25 | NSPrincipalClass 26 | NSApplication 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/mac/PkgInfo: -------------------------------------------------------------------------------- 1 | APPL???? 2 | -------------------------------------------------------------------------------- /src/mac/args.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "args.h" 5 | 6 | static bool enum_cams_flag = false; 7 | static bool capture = false; 8 | static bool map = false; 9 | static bool facetrack = false; 10 | static char *cam_id = NULL; 11 | static char *map_file = NULL; 12 | static char *cascade_file = NULL; 13 | static int w = -1; 14 | static int h = -1; 15 | 16 | bool doEnumCams() 17 | { 18 | return enum_cams_flag; 19 | } 20 | 21 | bool doCapture() 22 | { 23 | return capture; 24 | } 25 | 26 | bool doMap() 27 | { 28 | return map; 29 | } 30 | 31 | const char *getCamName() 32 | { 33 | return cam_id; 34 | } 35 | 36 | const char *getMapFileName() 37 | { 38 | return map_file; 39 | } 40 | 41 | const char *getCascadeFileName() 42 | { 43 | return cascade_file; 44 | } 45 | 46 | bool doFacetrack() 47 | { 48 | return facetrack; 49 | } 50 | 51 | void getRes(int *x, int *y) 52 | { 53 | *x = w; 54 | *y = h; 55 | } 56 | 57 | bool checkCmdLine(int argc, char *argv[]) 58 | { 59 | int ch; 60 | while((ch = getopt(argc, argv, "ec:x:y:f:d:")) != -1){ 61 | switch(ch){ 62 | case 'e': 63 | enum_cams_flag = true; 64 | break; 65 | case 'c': 66 | if((cam_id = strdup(optarg)) != NULL){ 67 | capture = true; 68 | } 69 | break; 70 | case 'x': 71 | w = atoi(optarg); 72 | break; 73 | case 'y': 74 | h = atoi(optarg); 75 | break; 76 | case 'f': 77 | if((map_file = strdup(optarg)) != NULL){ 78 | map = true; 79 | } 80 | break; 81 | case 'd': 82 | if((cascade_file = strdup(optarg)) != NULL){ 83 | facetrack = true; 84 | } 85 | break; 86 | } 87 | } 88 | return enum_cams_flag || (capture && map && (w != -1) && (h != -1)); 89 | } 90 | -------------------------------------------------------------------------------- /src/mac/args.h: -------------------------------------------------------------------------------- 1 | #ifndef ARGS__H 2 | #define ARGS__H 3 | 4 | #include 5 | 6 | bool checkCmdLine(int argc, char *argv[]); 7 | bool doEnumCams(); 8 | bool doCapture(); 9 | bool doMap(); 10 | bool doFacetrack(); 11 | const char *getCamName(); 12 | const char *getMapFileName(); 13 | void getRes(int *x, int *y); 14 | const char *getCascadeFileName(); 15 | 16 | #endif -------------------------------------------------------------------------------- /src/mac/buffer.h: -------------------------------------------------------------------------------- 1 | #ifndef BUFFER__H 2 | #define BUFFER__H 3 | 4 | #include 5 | 6 | bool createBuffers(int buffers, size_t buf_size); 7 | unsigned char *getCurrentBuffer(int i); 8 | bool isEmpty(int i); 9 | void bufferWritten(int *i); 10 | void bufferRead(int *i); 11 | void freeBuffers(); 12 | 13 | #endif -------------------------------------------------------------------------------- /src/mac/dummy.cpp: -------------------------------------------------------------------------------- 1 | //Dummy cpp source to make libtool to use g++ as a linker, as needed by libfacetrack_int. 2 | -------------------------------------------------------------------------------- /src/mac/linuxtrack_wii.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/mac/linuxtrack_wii.icns -------------------------------------------------------------------------------- /src/mac/mac_camera.h: -------------------------------------------------------------------------------- 1 | #ifndef MAC_CAMERA__H 2 | #define MAC_CAMERA__H 3 | 4 | void enumerateCameras(); 5 | bool capture(); 6 | 7 | #endif -------------------------------------------------------------------------------- /src/mac/macwebcam.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "args.h" 5 | #include 6 | #include 7 | #include "mac_camera.h" 8 | #include 9 | 10 | struct mmap_s mmm; 11 | 12 | int main(int argc, char *argv[]) 13 | { 14 | ltr_int_check_root(); 15 | if(!checkCmdLine(argc, argv)){ 16 | ltr_int_log_message("Wrong arguments!\n"); 17 | return EXIT_FAILURE; 18 | } 19 | 20 | if(doEnumCams()){ 21 | enumerateCameras(); 22 | }else if(doCapture()){ 23 | int x, y; 24 | getRes(&x, &y); 25 | // Double buffer... 26 | if(ltr_int_mmap_file(getMapFileName(), ltr_int_get_com_size() + x * y, &mmm)){ 27 | ltr_int_setCommand(&mmm, WAKEUP); 28 | capture(&mmm); 29 | ltr_int_unmap_file(&mmm); 30 | }else{ 31 | ltr_int_log_message("Can't mmap!\n"); 32 | return EXIT_FAILURE; 33 | } 34 | }else{ 35 | return EXIT_FAILURE; 36 | } 37 | 38 | return EXIT_SUCCESS; 39 | } 40 | -------------------------------------------------------------------------------- /src/mac/processing.h: -------------------------------------------------------------------------------- 1 | #ifndef PROCESSING__H 2 | #define PROCESSING__H 3 | 4 | #include 5 | #include 6 | 7 | bool startProcessing(int w, int h, int buffers, struct mmap_s *mmm_p); 8 | void endProcessing(); 9 | bool newFrame(unsigned char *ptr); 10 | 11 | 12 | #endif -------------------------------------------------------------------------------- /src/mac/wiimote_server.h: -------------------------------------------------------------------------------- 1 | // 2 | // wiimote_server.h 3 | // WiiSrvr 4 | // 5 | // Created by Michal Navratil on 8/30/10. 6 | // Copyright 2010 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "wiimote.h" 11 | 12 | @interface wiimote_server : NSObject { 13 | IBOutlet NSButton *connect; 14 | IBOutlet NSTextField *status; 15 | Wii *wiimote; 16 | NSTimer *timer; 17 | NSTimer *connIndicatorOnTimer; 18 | NSTimer *connIndicatorOffTimer; 19 | bool indicate; 20 | int indication; 21 | } 22 | - (void) dealloc; 23 | - (IBAction) connectPressed:(id) sender; 24 | -(void) timerCallback:(NSTimer*)theTimer; 25 | -(void) connectedIndicationOnCallback:(NSTimer*)theTimer; 26 | -(void) connectedIndicationOffCallback:(NSTimer*)theTimer; 27 | @end 28 | -------------------------------------------------------------------------------- /src/mac/wiisrvr_main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // WiiSrvr 4 | // 5 | // Created by Michal Navratil on 8/30/10. 6 | // Copyright __MyCompanyName__ 2010. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | int main(int argc, char *argv[]) 13 | { 14 | ltr_int_check_root(); 15 | ltr_int_log_message("Starting Wiimote server!\n"); 16 | return NSApplicationMain(argc, (const char **) argv); 17 | } 18 | -------------------------------------------------------------------------------- /src/math_utils.h: -------------------------------------------------------------------------------- 1 | #ifndef MATH_UTILS__H 2 | #define MATH_UTILS__H 3 | 4 | #include 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | typedef struct bez_def { 12 | double p0_x, p0_y; 13 | double p1_x, p1_y; 14 | double p2_x, p2_y; 15 | double ax, bx, cx; 16 | double ay, by, cy; 17 | } bez_def; 18 | 19 | void ltr_int_make_vec(double pt1[3],double pt2[3],double res[3]); 20 | double ltr_int_vec_size(double vec[3]); 21 | double ltr_int_dot_product(double vec1[3],double vec2[3]); 22 | void ltr_int_cross_product(double vec1[3],double vec2[3],double res[3]); 23 | void ltr_int_assign_matrix(double src[3][3], double tgt[3][3]); 24 | void ltr_int_mul_matrix(double m1[3][3], double m2[3][3], double res[3][3]); 25 | void ltr_int_mul_vec(double vec[3],double c,double res[3]); 26 | void ltr_int_normalize_vec(double vec[3]); 27 | void ltr_int_matrix_times_vec(double m[3][3], double vec[3],double res[3]); 28 | void ltr_int_make_base(double vec1[3],double vec2[3],double res[3][3]); 29 | void ltr_int_print_matrix(double matrix[3][3], char *name); 30 | void ltr_int_print_vec(double vec[3], char *name); 31 | void ltr_int_transpose(double matrix[3][3], double trans[3][3]); 32 | void ltr_int_transpose_in_place(double matrix[3][3]); 33 | double ltr_int_sqr(double f); 34 | void ltr_int_matrix_to_euler(double matrix[3][3], double *pitch, double *yaw, double *roll); 35 | void ltr_int_euler_to_matrix(double pitch, double yaw, double roll, double matrix[3][3]); 36 | void ltr_int_add_vecs(double vec1[3],double vec2[3],double res[3]); 37 | bool ltr_int_make_bez(double deadzone, double k, bez_def *b); 38 | double ltr_int_bezier(double x, bez_def *b); 39 | bool ltr_int_is_finite(double f); 40 | bool ltr_int_is_vector_finite(double vec[3]); 41 | bool ltr_int_is_matrix_finite(double matrix[3][3]); 42 | double clamp_angle(double angle); 43 | void ltr_int_invert_matrix(double in[3][3], double out[3][3]); 44 | float ltr_int_nonlinfilt(float x, float y_minus_1, float filterfactor); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /src/mickey.1: -------------------------------------------------------------------------------- 1 | .TH mickey 1 "11 May 2014" 2 | .IX mickey 3 | .SH NAME 4 | mickey - virtual mouse using Linuxtrack 5 | .SH SYNOPSYS 6 | .B mickey 7 | .SH DESCRIPTION 8 | Mickey acts as a virtual mouse using Linuxtrack as its frontend. 9 | 10 | -------------------------------------------------------------------------------- /src/mickey/help/contents.txt: -------------------------------------------------------------------------------- 1 | "welcome.htm" "Welcome" 2 | "news.htm" "What's new" 3 | "tracking.htm" "Tracking Setup" 4 | "misc.htm" "Miscelaneous Setup" 5 | 6 | -------------------------------------------------------------------------------- /src/mickey/help/misc.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Miscellaneous setup 6 | 7 | 8 | 9 | 10 |

Miscellaneous setup

11 |

Hot-key setup

12 | Hot-key setup allows you to customize the hot-key for starting/stopping the tracking. 13 | It covers some seldom used keys, that should be suitable for the purpose. 14 |

15 | The hot-key allows you to select the hot-key and possibly a modifier (Ctrl, Alt, ...). 16 | If the hot-key is not usable (e.g. it is already grabbed by another application), 17 | a warning message-box pops up and the previous hot-key is reset. 18 | 19 |

Timeouts setup

20 | To facilitate a hands free setup of Mickey, all the settings are timed - there is no need 21 | to click any buttons. 22 |

23 | Centering timeout specifies a time after the press of the Recenter button and 24 | the actual center point registration. 25 |

26 | Calibration timeout is a time during which you are supposed to move your head to 27 | left/right/top/bottom extremes (that are still usable for the tracking) during calibration. When the time is up, 28 | the calibration is finished and the tracking is adjusted appropriately. 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/mickey/help/news.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | What's new? 6 | 7 | 8 | 9 | 10 |

What's new?

11 |
    12 |
  • Mickey supports both relative mode (head movements control cursor speed) and absolute mode (head movements 13 | directly control position of the cursor).
  • 14 |
  • Mickey employs sensitivity curve to adjust the tracking feel, allowing for greater precision when movement is 15 | small and high cursor speed for bigger movement.
  • 16 |
  • All adjustments (centering, calibration, ...) are timed now and the timeouts are customizable.
  • 17 |
  • Pausing/un-pausing shortcut is now customizable. The range of available hot-keys is not very wide, 18 | but covers seldom used keys. If you need a key that is not listed, please file a bug and it'll be added.
  • 19 |
20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/mickey/help/welcome.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Welcome! 6 | 7 | 8 | 9 | 10 |

Welcome to Mickey, the virtual mouse!

11 | Mickey is an application, that emulates mouse input via a Linuxtrack software and on a dedicated hardware (SmartNav4) also clicking. 12 | 13 |

14 | For more informations on the Linuxtrack project, see the project page linuxtrack.eu. 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/mickey/helpview.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Form 4 | 5 | 6 | 7 | 0 8 | 0 9 | 504 10 | 392 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | Qt::Horizontal 26 | 27 | 28 | 29 | 40 30 | 20 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | Close 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | CloseButton 50 | pressed() 51 | Form 52 | close() 53 | 54 | 55 | 459 56 | 371 57 | 58 | 59 | 117 60 | 3 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /src/mickey/hotkey.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "hotkey.h" 4 | #include "hotkey_setup_dlg.h" 5 | 6 | 7 | 8 | HotKey::HotKey(const QString &iLabel, const QString &iPrefId, int iHotKeyId, QWidget *parent) 9 | : QWidget(parent), label(iLabel), prefId(iPrefId), hotKeyId(iHotKeyId), hotKey(QString::fromUtf8("None")) 10 | { 11 | ui.setupUi(this); 12 | s = new shortcut(); 13 | QObject::connect(s, SIGNAL(activated(bool)), this, SLOT(shortcutActivated(bool))); 14 | } 15 | 16 | void HotKey::shortcutActivated(bool pressed) 17 | { 18 | //std::cout<<"Activated shortcut "<setShortcut(sequence)){ 27 | QMessageBox::warning(this, QString::fromUtf8("Hotkey not usable."), 28 | QString::fromUtf8("Couldn't register new hotkey!")); 29 | return false; 30 | } 31 | }else{ 32 | s->resetShortcut(); 33 | } 34 | emit newHotKey(prefId, newHK); 35 | ui.AssignButton->setText(label + QString::fromUtf8(" ") + newHK); 36 | hotKey = newHK; 37 | return true; 38 | } 39 | 40 | void HotKey::getHotKey(QString &hk) const 41 | { 42 | hk = hotKey; 43 | } 44 | 45 | 46 | void HotKey::on_AssignButton_pressed() 47 | { 48 | QString newHK; 49 | int res; 50 | hotKeySetupDlg *dlg = new hotKeySetupDlg(newHK, this); 51 | res = dlg->exec(); 52 | delete dlg; 53 | if(res != QDialog::Accepted){ 54 | return; 55 | } 56 | if(newHK.isEmpty()){ 57 | setHotKey(QString::fromUtf8("None")); 58 | }else{ 59 | setHotKey(newHK); 60 | } 61 | } 62 | 63 | #include "moc_hotkey.cpp" 64 | 65 | -------------------------------------------------------------------------------- /src/mickey/hotkey.h: -------------------------------------------------------------------------------- 1 | #ifndef HOTKEY__H 2 | #define HOTKEY__H 3 | 4 | #include 5 | #include 6 | #include "ui_hotkey.h" 7 | #include "keyb.h" 8 | 9 | class HotKey : public QWidget{ 10 | Q_OBJECT 11 | public: 12 | HotKey(const QString &iLabel, const QString &iPrefId, int iHotKeyId, QWidget *parent = 0); 13 | ~HotKey(){delete s;}; 14 | bool setHotKey(const QString &newHK); 15 | void getHotKey(QString &hk) const; 16 | signals: 17 | void activated(int id, bool pressed); 18 | void newHotKey(const QString &hotKeyId, const QString &hk); 19 | private slots: 20 | void shortcutActivated(bool pressed); 21 | void on_AssignButton_pressed(); 22 | private: 23 | QString label, prefId; 24 | int hotKeyId; 25 | QString hotKey; 26 | Ui::HotKeySetup ui; 27 | shortcut *s; 28 | }; 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/mickey/hotkey.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | HotKeySetup 4 | 5 | 6 | 7 | 0 8 | 0 9 | 331 10 | 45 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 2 19 | 20 | 21 | 2 22 | 23 | 24 | 25 | 26 | Assign 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/mickey/hotkey_setup_dlg.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "hotkey_setup_dlg.h" 3 | 4 | hotKeySetupDlg::hotKeySetupDlg(QString &res, QWidget *parent) : QDialog(parent) 5 | { 6 | ui.setupUi(this); 7 | ui.lineEdit->setTargetString(res); 8 | } 9 | 10 | #include "moc_hotkey_setup_dlg.cpp" 11 | 12 | -------------------------------------------------------------------------------- /src/mickey/hotkey_setup_dlg.h: -------------------------------------------------------------------------------- 1 | #ifndef HOTKEY_DIALOG__H 2 | #define HOTKEY_DIALOG__H 3 | 4 | #include "ui_hotkey_setup.h" 5 | 6 | class hotKeySetupDlg : public QDialog 7 | { 8 | Q_OBJECT 9 | public: 10 | hotKeySetupDlg(QString &res, QWidget *parent = 0); 11 | private: 12 | Ui::HotKeySetupDlg ui; 13 | }; 14 | 15 | 16 | #endif -------------------------------------------------------------------------------- /src/mickey/keyb.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifdef HAVE_CONFIG_H 4 | #include "../../config.h" 5 | #endif 6 | 7 | #include "keyb.h" 8 | // Must be before the keyb_x11.h otherwise a type mismatch occurs 9 | // (qmetatype must be included before any header file defining Bool, 10 | // which in this case is X11/Xlib.h) 11 | #include "moc_keyb.cpp" 12 | 13 | #ifndef DARWIN 14 | #include "keyb_x11.h" 15 | #endif 16 | 17 | shortcut::shortcut() 18 | { 19 | } 20 | 21 | shortcut::~shortcut() 22 | { 23 | unsetShortcut(this); 24 | } 25 | 26 | bool shortcut::setShortcut(const QKeySequence &s) 27 | { 28 | //printf("Setting shortcut!\n"); 29 | return setShortCut(s, this); 30 | } 31 | 32 | bool shortcut::resetShortcut() 33 | { 34 | return unsetShortcut(this); 35 | } 36 | 37 | void shortcut::activate(bool pressed) 38 | { 39 | //printf("Firing shortcut!\n"); 40 | emit activated(pressed); 41 | } 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/mickey/keyb.h: -------------------------------------------------------------------------------- 1 | #ifndef KEYB__H 2 | #define KEYB__H 3 | 4 | #include 5 | #include 6 | 7 | class shortcut : public QObject 8 | { 9 | Q_OBJECT 10 | public: 11 | shortcut(); 12 | ~shortcut(); 13 | bool setShortcut(const QKeySequence &s); 14 | bool resetShortcut(); 15 | void activate(bool pressed); 16 | signals: 17 | void activated(bool pressed); 18 | }; 19 | 20 | #endif -------------------------------------------------------------------------------- /src/mickey/keyb_qxt.h: -------------------------------------------------------------------------------- 1 | #ifndef KEYB_QXT__H 2 | #define KEYB_QXT__H 3 | 4 | #include 5 | 6 | class shortcutPimpl : public QObject 7 | { 8 | Q_OBJECT 9 | public: 10 | shortcutPimpl() 11 | { 12 | sc = new QxtGlobalShortcut(this); 13 | QObject::connect(sc, SIGNAL(activated()), this, SIGNAL(activated())); 14 | }; 15 | ~shortcutPimpl(){delete sc;}; 16 | bool setShortcut(const QKeySequence &s){return sc->setShortcut(s);}; 17 | private: 18 | QxtGlobalShortcut *sc; 19 | signals: 20 | void activated(); 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/mickey/keyb_x11.h: -------------------------------------------------------------------------------- 1 | #ifndef KEYB_X11__h 2 | #define KEYB_X11__h 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #ifdef QT5_OVERRIDES 12 | #include 13 | #endif 14 | 15 | class shortcut; 16 | 17 | typedef std::pair keyPair_t; 18 | typedef std::map shortcutHash_t; 19 | 20 | bool setShortCut(const QKeySequence &s, shortcut* id); 21 | bool unsetShortcut(shortcut* id); 22 | 23 | #ifdef QT5_OVERRIDES 24 | class hotKeyFilter : public QAbstractNativeEventFilter 25 | { 26 | protected: 27 | bool nativeEventFilter(const QByteArray & eventType, void * message, long * result); 28 | }; 29 | #endif 30 | /* 31 | class shortcutPimpl : public QObject 32 | { 33 | Q_OBJECT 34 | public: 35 | ~shortcutPimpl(); 36 | bool setShortcut(const QKeySequence &s, shortcut* id); 37 | bool unsetShortcut(shortcut* id); 38 | //void activate(int id){emit activated(id);}; 39 | static shortcutPimpl *createShortcutObject(); 40 | signals: 41 | void activated(int); 42 | private: 43 | shortcutPimpl(); 44 | static void installFilter(); 45 | static void uninstallFilter(); 46 | static QAbstractEventDispatcher::EventFilter prevFilter; 47 | static bool eventFilter(void *message); 48 | static shortcutHash_t shortcutHash; 49 | static int my_x_errhandler(Display* display, XErrorEvent *event); 50 | static bool grabKeyX(Display *display, Window &window, KeyCode code, unsigned int modifiers); 51 | static bool ungrabKeyX(Display *display, Window &window, KeyCode code, unsigned int modifiers); 52 | static bool removeIdFromHash(shortcut* shortcutId, keyPair_t *kp = NULL); 53 | static bool translateSequence(const QKeySequence &s, KeyCode &code, unsigned int &modifiers); 54 | }; 55 | */ 56 | 57 | #endif 58 | 59 | -------------------------------------------------------------------------------- /src/mickey/linuxtrack.icns: -------------------------------------------------------------------------------- 1 | ../qt_gui/linuxtrack.icns -------------------------------------------------------------------------------- /src/mickey/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "mickey.h" 8 | 9 | int main(int argc, char *argv[]) 10 | { 11 | ltr_int_check_root(); 12 | ltr_int_log_message("Starting Mickey controller!\n"); 13 | setenv("LC_ALL", "C", 1); 14 | setlocale(LC_ALL, "C"); 15 | QLocale::setDefault(QLocale::c()); 16 | QApplication app(argc, argv); 17 | GUI.show(); 18 | int res = app.exec(); 19 | MickeyGUI::deleteInstance(); 20 | return res; 21 | } 22 | -------------------------------------------------------------------------------- /src/mickey/mickey.qhcp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | mickey.qhp 7 | help.qch 8 | 9 | 10 | 11 | help.qch 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/mickey/mickey.qhp: -------------------------------------------------------------------------------- 1 | 2 | 3 | uglyDwarf.com.mickey.1.0 4 | doc 5 | 6 | mickey 7 | 0.99.20 8 | 9 | 10 | mickey 11 | 0.99.20 12 | 13 |

14 |
15 |
16 |
17 |
18 | 19 | 20 | 21 | 22 | help/*.htm* 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/mickey/mickey.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | ../linuxtrack.svg 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/mickey/mouse.h: -------------------------------------------------------------------------------- 1 | #ifndef MOUSE__H 2 | #define MOUSE__H 3 | 4 | typedef enum {LEFT_BUTTON = 1, RIGHT_BUTTON = 2, MIDDLE_BUTTON = 4} buttons_t; 5 | 6 | #ifdef __cplusplus 7 | 8 | struct mouseLocalData; 9 | 10 | class mouseClass{ 11 | public: 12 | mouseClass(); 13 | ~mouseClass(); 14 | bool init(); 15 | bool move(int dx, int dy); 16 | bool click(buttons_t button, struct timeval ts); 17 | private: 18 | mouseLocalData *data; 19 | }; 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/mickey/mouse_linux.cpp: -------------------------------------------------------------------------------- 1 | #include "mouse.h" 2 | #include "uinput_ifc.h" 3 | #include 4 | #include 5 | 6 | struct mouseLocalData{ 7 | mouseLocalData(): fd(-1){}; 8 | int fd; 9 | QMutex mutex; 10 | }; 11 | 12 | 13 | mouseClass::mouseClass(){ 14 | data = new mouseLocalData(); 15 | } 16 | 17 | mouseClass::~mouseClass(){ 18 | close_uinput(data->fd); 19 | data->fd = -1; 20 | delete data; 21 | } 22 | 23 | bool mouseClass::init() 24 | { 25 | char *fileName; 26 | bool permProblem = false; 27 | data->fd = open_uinput(&fileName, &permProblem); 28 | if(data->fd == -1){ 29 | QMessageBox::critical(NULL, QString::fromUtf8("Error Creating Virtual Mouse"), 30 | QString::fromUtf8("There was a problem accessing the file \"%1\"\n\ 31 | Please check that you have the right to write to it.").arg(QString::fromUtf8(fileName))); 32 | return false; 33 | } 34 | return create_device(data->fd); 35 | } 36 | 37 | bool mouseClass::move(int dx, int dy) 38 | { 39 | if(data->fd == -1){ 40 | return false; 41 | } 42 | data->mutex.lock(); 43 | movem(data->fd, dx,dy); 44 | data->mutex.unlock(); 45 | return true; 46 | } 47 | 48 | bool mouseClass::click(buttons_t buttons, struct timeval ts) 49 | { 50 | if(data->fd == -1){ 51 | return false; 52 | } 53 | data->mutex.lock(); 54 | clickm(data->fd, buttons, ts); 55 | data->mutex.unlock(); 56 | return true; 57 | } 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/mickey/my_line_edit.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "my_line_edit.h" 3 | #include 4 | #include 5 | 6 | myLineEdit::myLineEdit(QWidget *parent) : QLineEdit(parent), tgt(NULL) 7 | { 8 | } 9 | 10 | void myLineEdit::keyPressEvent(QKeyEvent * event) 11 | { 12 | QString seq = QString(); 13 | Qt::KeyboardModifiers mods = event->modifiers(); 14 | if(mods & Qt::ShiftModifier){ 15 | seq += QString::fromUtf8("Shift+"); 16 | } 17 | if(mods & Qt::ControlModifier){ 18 | seq += QString::fromUtf8("Ctrl+"); 19 | } 20 | if(mods & Qt::AltModifier){ 21 | seq += QString::fromUtf8("Alt+"); 22 | } 23 | if(mods & Qt::MetaModifier){ 24 | seq += QString::fromUtf8("Meta+"); 25 | } 26 | int k = event->key(); 27 | //std::cout<<"Key event -> '"<key()).toString(QKeySequence::NativeText); 39 | setText(seq); 40 | if(tgt != NULL){ 41 | *tgt = seq; 42 | } 43 | //std::cout<<"Key event -> '"< 5 | 6 | class myLineEdit : public QLineEdit 7 | { 8 | Q_OBJECT 9 | public: 10 | myLineEdit(QWidget *parent = 0); 11 | void setTargetString(QString &res){tgt = &res;}; 12 | private: 13 | virtual void keyPressEvent(QKeyEvent * event); 14 | QString *tgt; 15 | }; 16 | 17 | 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/mickey/piper.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "../sn4_com.h" 5 | #include "../utils.h" 6 | #include "../ipc_utils.h" 7 | 8 | int prepareBtnChanel() 9 | { 10 | //printf("Opening the channel!\n"); 11 | signal(SIGPIPE, SIG_IGN); 12 | char *fname = ltr_int_get_default_file_name("ltr_sn4.socket"); 13 | int socket = ltr_int_connect_to_socket(fname); 14 | free(fname); 15 | if(socket <= 0){ 16 | //printf("Can't open socket!\n"); 17 | return -1; 18 | } 19 | //printf("Socket opened!\n"); 20 | return socket; 21 | } 22 | 23 | int closeBtnChannel(int socket) 24 | { 25 | ltr_int_close_socket(socket); 26 | return 0; 27 | } 28 | 29 | bool fetch_data(int socket, void *data, ssize_t length, ssize_t *read) 30 | { 31 | assert(data != NULL); 32 | assert(read != NULL); 33 | *read = 0; 34 | int res = ltr_int_pipe_poll(socket, 1000, NULL); 35 | switch(res){ 36 | case 0://Timeout 37 | return true; 38 | break; 39 | case 1://have data! 40 | //intentionaly do nothing! 41 | break; 42 | default: 43 | return false; 44 | break; 45 | } 46 | *read = ltr_int_socket_receive(socket, data, length); 47 | return true; 48 | } 49 | 50 | 51 | /* 52 | int main(int argc, char *argv[]) 53 | { 54 | (void)argc; 55 | (void)argv; 56 | sn4_btn_event_t ev; 57 | int socket = prepareBtnChanel(); 58 | ssize_t read; 59 | while(fetch_data(socket, (void*)&ev, sizeof(ev), &read)){ 60 | if(read == sizeof(ev)){ 61 | printf("Piper received %ld\n", read); 62 | printf("%d\n", ev.btns); 63 | } 64 | } 65 | return 0; 66 | } 67 | */ 68 | -------------------------------------------------------------------------------- /src/mickey/piper.h: -------------------------------------------------------------------------------- 1 | #ifndef PIPER__H 2 | #define PIPER__H 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | int prepareBtnChanel(); 11 | bool fetch_data(int fifo, void *data, ssize_t length, ssize_t *read); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif -------------------------------------------------------------------------------- /src/mickey/precomp_headers.h: -------------------------------------------------------------------------------- 1 | #if defined __cplusplus 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #endif 52 | 53 | -------------------------------------------------------------------------------- /src/mickey/uinput_ifc.h: -------------------------------------------------------------------------------- 1 | #ifndef UINPUT_IFC__H 2 | #define UINPUT_IFC__H 3 | 4 | #include 5 | #include "mouse.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | int open_uinput(char **fname, bool *permProblem); 12 | bool create_device(int fd); 13 | bool movem(int fd, int dx, int dy); 14 | bool clickm(int fd, buttons_t btns, struct timeval ts); 15 | void close_uinput(int fd); 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/netcomm.h: -------------------------------------------------------------------------------- 1 | #ifndef NETCOMM__H 2 | #define NETCOMM__H 3 | 4 | #include "cal.h" 5 | 6 | typedef enum {RUN, SHUTDOWN, SUSPEND, WAKE, DATA} message_t; 7 | 8 | 9 | int init_client(const char *address, const unsigned int port, 10 | unsigned int restart_timeout); 11 | int init_server(unsigned int port); 12 | int accept_connection(int socket); 13 | size_t encode_bloblist(struct bloblist_type *blobs, unsigned char *buffer); 14 | void decode_bloblist(struct bloblist_type *blobs, unsigned char *buffer); 15 | #endif 16 | -------------------------------------------------------------------------------- /src/osc_server_mac/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /src/osc_server_mac/English.lproj/MainMenu.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/osc_server_mac/English.lproj/MainMenu.nib -------------------------------------------------------------------------------- /src/osc_server_mac/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = OscServer-Info.plist English.lproj/InfoPlist.strings \ 2 | English.lproj/MainMenu.xib PkgInfo linuxtrack.icns 3 | 4 | AM_CFLAGS = -arch x86_64 5 | SLEOPARD_CFLAG = 6 | SLEOPARD_LDFLAG = -L.. 7 | DARWINFLAGS = -undefined dynamic_lookup 8 | 9 | if DARWIN 10 | bin_PROGRAMS = OscServer 11 | noinst_SCRIPTS = English.lproj/MainMenu.nib 12 | endif 13 | 14 | OscServer_SOURCES = ../linuxtrack.h OscServerAppDelegate.h OscServerAppDelegate.m \ 15 | osc_server.c osc_server.h main.m ../linuxtrack.c 16 | OscServer_LDADD = ../libltr.la -lobjc -lpthread -llo -ldl 17 | OscServer_LDFLAGS = ${AM_CFLAGS} ${SLEOPARD_LDFLAG} -framework Cocoa -framework CoreData \ 18 | -framework AppKit -framework Foundation 19 | OscServer_CFLAGS = ${AM_CFLAGS} ${SLEOPARD_CFLAG} -I${srcdir} -I${srcdir}/.. -I.. 20 | OscServer_OBJCFLAGS = ${AM_CFLAGS} ${SLEOPARD_CFLAG} -I${srcdir} -I${srcdir}/.. -I.. 21 | 22 | English.lproj/MainMenu.nib : English.lproj/MainMenu.xib 23 | ibtool --errors --warnings --notices --output-format human-readable-text \ 24 | English.lproj/MainMenu.xib --compile English.lproj/MainMenu.nib 25 | -------------------------------------------------------------------------------- /src/osc_server_mac/OscServer-Info.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | OscServer 9 | CFBundleIconFile 10 | linuxtrack.icns 11 | CFBundleIdentifier 12 | linuxtrack.OscServer 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | OscServer v@PACKAGE_VERSION@ 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | ???? 21 | CFBundleShortVersionString 22 | 1.0 23 | LSMinimumSystemVersion 24 | 10.6 25 | CFBundleVersion 26 | 1 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/osc_server_mac/OscServerAppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface OscServerAppDelegate : NSObject { 4 | NSWindow *window; 5 | IBOutlet NSButton *StartStop; 6 | IBOutlet NSButton *Pause; 7 | IBOutlet NSButton *Recenter; 8 | IBOutlet NSTextField *status; 9 | IBOutlet NSTextField *portSelector; 10 | NSTimer *timer; 11 | NSUserDefaults *prefs; 12 | bool paused; 13 | bool stopped; 14 | } 15 | 16 | @property (assign) IBOutlet NSWindow *window; 17 | - (IBAction) StartStopPressed:(id) sender; 18 | - (IBAction) PausePressed:(id) sender; 19 | - (IBAction) RecenterPressed:(id) sender; 20 | 21 | -(void) timerCallback:(NSTimer*)theTimer; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /src/osc_server_mac/PkgInfo: -------------------------------------------------------------------------------- 1 | APPL???? -------------------------------------------------------------------------------- /src/osc_server_mac/linuxtrack.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/osc_server_mac/linuxtrack.icns -------------------------------------------------------------------------------- /src/osc_server_mac/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | int main(int argc, char *argv[]) 4 | { 5 | return NSApplicationMain(argc, (const char **) argv); 6 | } 7 | -------------------------------------------------------------------------------- /src/osc_server_mac/osc_server.h: -------------------------------------------------------------------------------- 1 | /* 2 | * osc_server.h 3 | * OscServer 4 | * 5 | * Created by Michal on 8/14/15. 6 | * Copyright 2015 __MyCompanyName__. All rights reserved. 7 | * 8 | */ 9 | #ifndef OSC_SERVER__H 10 | #define OSC_SERVER__H 11 | 12 | void stopTracking(); 13 | bool oscServerInit(int port); 14 | 15 | #endif -------------------------------------------------------------------------------- /src/pathconfig.h.in: -------------------------------------------------------------------------------- 1 | #ifndef PATHCONFIG__H 2 | #define PATHCONFIG__H 3 | 4 | #define PREFIX_new "@prefix@" 5 | #define DATA_PATH_new "@prefix@/share/linuxtrack/" 6 | 7 | #endif -------------------------------------------------------------------------------- /src/pref.h: -------------------------------------------------------------------------------- 1 | #ifndef PREF__H 2 | #define PREF__H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #else 7 | #include 8 | #endif 9 | 10 | char *ltr_int_get_key(const char *section_name, const char *key_name); 11 | bool ltr_int_get_key_flt(const char *section_name, const char *key_name, float *val); 12 | bool ltr_int_get_key_int(const char *section_name, const char *key_name, int *val); 13 | 14 | bool ltr_int_change_key(const char *section_name, const char *key_name, const char *new_value); 15 | bool ltr_int_change_key_flt(const char *section_name, const char *key_name, float new_value); 16 | bool ltr_int_change_key_int(const char *section_name, const char *key_name, int new_value); 17 | void ltr_int_free_prefs(void); 18 | 19 | bool ltr_int_read_prefs(const char *file, bool force_read); 20 | bool ltr_int_new_prefs(void); 21 | bool ltr_int_save_prefs(const char *fname); 22 | bool ltr_int_dump_prefs(const char *file_name); 23 | 24 | bool ltr_int_need_saving(void); 25 | 26 | char *ltr_int_find_section(const char *key_name, const char *value); 27 | //Stupid trick - result is pointer to std::vector 28 | bool ltr_int_find_sections(const char *key_name, void *result); 29 | char *ltr_int_add_unique_section(const char *name_template); 30 | 31 | bool ltr_int_read_prefs(const char *file, bool force_read); 32 | void ltr_int_prefs_changed(void); 33 | //Stupid trick - sections is pointer to std::vector 34 | void ltr_int_get_section_list(void *sections_ptr); 35 | 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /src/pref_bison.ypp: -------------------------------------------------------------------------------- 1 | %{ 2 | #include "pref.hpp" 3 | #include "pref_bison.hpp" 4 | #include "pref_flex.h" 5 | 6 | //void ltr_int_parser_error (char const *s); 7 | void ltr_int_parser_error(YYLTYPE *loc, prefs *prf, char const *s); 8 | %} 9 | 10 | %debug 11 | %define api.pure 12 | %locations 13 | %define parse.error verbose 14 | %parse-param {prefs *prf} 15 | 16 | %union { 17 | std::string *str; 18 | keyVal *kv; 19 | section *sec; 20 | prefs *prf; 21 | } 22 | 23 | 24 | %token TOKEN_COMMENT 25 | %token TOKEN_LEFT_BRACKET 26 | %token TOKEN_RIGHT_BRACKET 27 | %token TOKEN_KEY 28 | %token TOKEN_EQ 29 | %token TOKEN_VALUE 30 | %token TOKEN_SECNAME 31 | 32 | 33 | %type TOKEN_COMMENT TOKEN_KEY TOKEN_VALUE TOKEN_SECNAME 34 | %type key_val_pair 35 | %type section section_content 36 | %type input 37 | 38 | //%right SEC_COMMENT 39 | //%left LONE_COMMENT 40 | 41 | %right LOW_PRIO 42 | %right TOKEN_COMMENT 43 | 44 | %% 45 | input: /* empty */ { 46 | prf->clear(); 47 | $$ = prf; 48 | } 49 | | input section { 50 | $$ = $1; 51 | $$->addItem($2); 52 | } 53 | | input TOKEN_COMMENT{ 54 | $$ = $1; 55 | $$->addItem(new prefComment($2)); 56 | } 57 | | input error 58 | ; 59 | 60 | 61 | section : TOKEN_LEFT_BRACKET TOKEN_SECNAME TOKEN_RIGHT_BRACKET section_content %prec LOW_PRIO{ 62 | $$ = $4; 63 | $$->setName($2); 64 | } 65 | ; 66 | 67 | section_content:/*empty*/ { 68 | $$ = new section(); 69 | } 70 | | section_content key_val_pair { 71 | $$ = $1; 72 | $$->addItem($2); 73 | } 74 | | section_content TOKEN_COMMENT{ 75 | $$ = $1; 76 | $$->addItem(new secComment($2)); 77 | } 78 | 79 | key_val_pair: TOKEN_KEY TOKEN_EQ TOKEN_VALUE { 80 | $$ = new keyVal($1, $3); 81 | } 82 | ; 83 | %% 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /src/pref_flex.lpp: -------------------------------------------------------------------------------- 1 | %{ 2 | #include 3 | #include "pref.hpp" 4 | #include "pref_bison.hpp" 5 | //extern int line_num; 6 | %} 7 | %option bison-bridge 8 | %option bison-locations 9 | %option noyywrap 10 | %option nounput 11 | %option noinput 12 | %option yylineno 13 | %option outfile="lex.yy.c" 14 | %option header-file="../pref_flex.h" 15 | %option prefix="ltr_int_parser_" 16 | 17 | %x VALUE SEC_NAME 18 | 19 | KEY [_a-zA-Z0-9-]+ 20 | %% 21 | =[[:blank:]]* {BEGIN(VALUE); return(TOKEN_EQ);} 22 | \[ {BEGIN(SEC_NAME); return(TOKEN_LEFT_BRACKET);} 23 | \] {return(TOKEN_RIGHT_BRACKET);} 24 | 25 | {KEY} { 26 | yylval->str=new std::string(ltr_int_parser_text); 27 | return(TOKEN_KEY); 28 | } 29 | #.* { 30 | yylval->str=new std::string(ltr_int_parser_text); 31 | return(TOKEN_COMMENT); 32 | } 33 | 34 | [[:blank:]] /* eat up whitespace */ 35 | 36 | [^\n]* { 37 | yylval->str=new std::string(ltr_int_parser_text); 38 | return(TOKEN_VALUE); 39 | } 40 | 41 | 42 | \n { 43 | //line_num++; 44 | (void)yylloc; 45 | BEGIN(INITIAL); 46 | } 47 | [^\]\n]* { 48 | yylval->str=new std::string(ltr_int_parser_text); 49 | BEGIN(INITIAL); 50 | return(TOKEN_SECNAME); 51 | } 52 | 53 | . //ltr_int_log_message( "Unrecognized character: %s\n", ltr_int_parser_text ); 54 | %% 55 | 56 | -------------------------------------------------------------------------------- /src/pref_global.h: -------------------------------------------------------------------------------- 1 | #ifndef PREF_GLOBAL__H 2 | #define PREF_GLOBAL__H 3 | 4 | #include 5 | #include "cal.h" 6 | #include "pose.h" 7 | #include "tracking.h" 8 | #include "axis.h" 9 | 10 | #ifdef __cplusplus 11 | extern "C" { 12 | #endif 13 | 14 | char *ltr_int_get_device_section(); 15 | bool ltr_int_is_model_active(); 16 | float ltr_int_get_focal_length(); 17 | void ltr_int_set_focal_length(float fl); 18 | bool ltr_int_use_alter(); 19 | void ltr_int_set_use_alter(bool state); 20 | bool ltr_int_use_oldrot(); 21 | void ltr_int_set_use_oldrot(bool state); 22 | bool ltr_int_do_tr_align(); 23 | void ltr_int_set_tr_align(bool state); 24 | bool ltr_int_get_device(struct camera_control_block *ccb); 25 | bool ltr_int_get_model_setup(reflector_model_type *rm); 26 | void ltr_int_announce_model_change(); 27 | bool ltr_int_model_changed(bool reset_flag); 28 | int ltr_int_get_orientation(); 29 | 30 | void ltr_int_close_prefs(); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/ps3_prefs.h: -------------------------------------------------------------------------------- 1 | #ifndef PS3_PREFS__H 2 | #define PS3_PREFS__H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #else 7 | #include 8 | #endif 9 | 10 | #include "wc_driver_prefs.h" 11 | 12 | typedef enum{ 13 | e_HUE = 0, 14 | e_SATURATION, 15 | e_AUTOGAIN, 16 | e_AUTOWHITEBALANCE, 17 | e_AUTOEXPOSURE, 18 | e_GAIN, 19 | e_EXPOSURE, 20 | e_BRIGHTNESS, 21 | e_CONTRAST, 22 | e_SHARPNESS, 23 | e_HFLIP, 24 | e_VFLIP, 25 | e_PLFREQ, 26 | e_FPS, 27 | e_NUMCTRLS 28 | } t_controls; 29 | 30 | bool ltr_int_ps3_init_prefs(void); 31 | bool ltr_int_ps3_close_prefs(); 32 | 33 | bool ltr_int_ps3_set_ctrl_val(t_controls ctrl, int val); 34 | int ltr_int_ps3_get_ctrl_val(t_controls ctrl); 35 | int ltr_int_ps3_controls_changed(void); 36 | bool ltr_int_ps3_ctrl_changed(t_controls ctrl); 37 | 38 | //bool ltr_int_ps3_set_resolution(int w, int h); 39 | bool ltr_int_ps3_get_resolution(int *w, int *h); 40 | 41 | int ltr_int_ps3_get_mode(void); 42 | bool ltr_int_ps3_set_mode(int val); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/ps3eye.sym: -------------------------------------------------------------------------------- 1 | ltr_int_rl_run 2 | ltr_int_rl_shutdown 3 | ltr_int_rl_suspend 4 | ltr_int_rl_wakeup 5 | ltr_int_ps3eye_found 6 | -------------------------------------------------------------------------------- /src/ps3eye_driver.h: -------------------------------------------------------------------------------- 1 | #ifndef PS3EYE_DRIVER__H 2 | #define PS3EYE_DRIVER__H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | bool ltr_int_ps3eye_found(void); 9 | 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | 14 | #endif 15 | 16 | -------------------------------------------------------------------------------- /src/qt_gui/buffering.h: -------------------------------------------------------------------------------- 1 | #ifndef BUFFERING__H 2 | #define BUFFERING__H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class QImage; 9 | 10 | class buffer{ 11 | public: 12 | buffer(); 13 | ~buffer(); 14 | bool resizeBuffer(int width, int height); 15 | unsigned char *getBuffer(){return buf;}; 16 | QImage *getImage(){return img;}; 17 | void clearBuffer(); 18 | private: 19 | unsigned char *buf; 20 | QImage *img; 21 | int w, h; 22 | static QVector *palette; 23 | static void initPalette(); 24 | }; 25 | 26 | 27 | class buffering{ 28 | public: 29 | buffering(int n = 3); 30 | ~buffering(){}; 31 | 32 | void init(){current = writeChecked = readChecked = -1;}; 33 | bool resizeBuffers(int w, int h); 34 | bool writeBuffer(buffer **wb); 35 | void bufferWritten(); 36 | bool readBuffer(buffer **rb); 37 | void bufferRead(); 38 | private: 39 | int noBuffers; 40 | std::vector buffers; 41 | int current; //buffer last written 42 | int writeChecked; //buffer checked for writing 43 | int readChecked; //buffer checked for reading 44 | QMutex lock; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/qt_gui/cap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/qt_gui/cap.png -------------------------------------------------------------------------------- /src/qt_gui/cap_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/qt_gui/cap_1.png -------------------------------------------------------------------------------- /src/qt_gui/cap_np.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/qt_gui/cap_np.png -------------------------------------------------------------------------------- /src/qt_gui/cap_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/qt_gui/cap_small.png -------------------------------------------------------------------------------- /src/qt_gui/clip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/qt_gui/clip.png -------------------------------------------------------------------------------- /src/qt_gui/clip_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/qt_gui/clip_1.png -------------------------------------------------------------------------------- /src/qt_gui/clip_np.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/qt_gui/clip_np.png -------------------------------------------------------------------------------- /src/qt_gui/clip_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/qt_gui/clip_small.png -------------------------------------------------------------------------------- /src/qt_gui/dev_help.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DevHelp 4 | 5 | 6 | 7 | 0 8 | 0 9 | 300 10 | 80 11 | 12 | 13 | 14 | DevHelp 15 | 16 | 17 | 18 | 19 | 20 | Dump preferences 21 | 22 | 23 | 24 | 25 | 26 | 27 | Qt::Vertical 28 | 29 | 30 | 31 | 20 32 | 40 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/qt_gui/device_setup.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICE_SETUP__H 2 | #define DEVICE_SETUP__H 3 | 4 | #include 5 | #include 6 | 7 | class Guardian; 8 | 9 | class DeviceSetup : public QWidget 10 | { 11 | Q_OBJECT 12 | public: 13 | DeviceSetup(Guardian *grd, QBoxLayout *tgt, QWidget *parent = 0); 14 | ~DeviceSetup(); 15 | void refresh(); 16 | private: 17 | Ui::DeviceSetupForm ui; 18 | static QString descs[8]; 19 | static int orientValues[8]; 20 | QWidget *devPrefs; 21 | bool initialized; 22 | void initOrientations(); 23 | QBoxLayout *target; 24 | private slots: 25 | void on_DeviceSelector_activated(int index); 26 | void on_CameraOrientation_activated(int index); 27 | void on_RefreshDevices_pressed(); 28 | signals: 29 | void deviceTypeChanged(int deviceType, const QString &desc); 30 | }; 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /src/qt_gui/dlfirmware.h: -------------------------------------------------------------------------------- 1 | #ifndef DLFIRMWARE__H 2 | #define DLFIRMWARE__H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "ui_dl.h" 10 | 11 | class QFile; 12 | class QNetworkAccessManager; 13 | class QProcess; 14 | class dlfwGui; 15 | 16 | class DLFirmware : public QObject 17 | { 18 | Q_OBJECT 19 | public: 20 | DLFirmware(); 21 | ~DLFirmware(); 22 | int download(QString urlStr, QString dest); 23 | signals: 24 | void msg(QString message); 25 | void done(bool ok, QString fileName); 26 | private: 27 | QFile* file; 28 | QString fname; 29 | QString destination; 30 | QString origFname; 31 | QNetworkAccessManager* mgr; 32 | QNetworkReply* reply; 33 | bool busy; 34 | private slots: 35 | void finished(QNetworkReply*); 36 | void progress(qint64, qint64); 37 | void writeData(); 38 | void error(QNetworkReply::NetworkError); 39 | }; 40 | 41 | class dlfwGui : public QWidget{ 42 | Q_OBJECT 43 | public: 44 | dlfwGui(QWidget *parent = 0); 45 | ~dlfwGui(); 46 | void setMsg(QString msg); 47 | private slots: 48 | void on_DLButton_pressed(); 49 | void on_FromFileButton_pressed(); 50 | void msg(QString message); 51 | void done(bool ok, QString fileName); 52 | void unpack_finished(int exitCode, QProcess::ExitStatus exitStatus); 53 | signals: 54 | void finished(bool status); 55 | private: 56 | bool unpackFirmware(QString fname, QString dest); 57 | QProcess *unpacker; 58 | QString destPath; 59 | QString basePath; 60 | Ui::DLFW ui; 61 | DLFirmware *dlfw; 62 | }; 63 | 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/qt_gui/downloading.h: -------------------------------------------------------------------------------- 1 | #ifndef DOWNLOADING__H 2 | #define DOWNLOADING__H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | class Downloading : public QObject 11 | { 12 | Q_OBJECT 13 | public: 14 | Downloading(); 15 | ~Downloading(); 16 | int download(QString urlStr, QString dest); 17 | signals: 18 | void msg(qint64 read, qint64 all); 19 | void msg(const QString &m); 20 | void done(bool ok, QString fileName); 21 | private: 22 | QFile* file; 23 | QString fname; 24 | QString destination; 25 | QString origFname; 26 | QNetworkAccessManager* mgr; 27 | QNetworkReply* reply; 28 | bool busy; 29 | private slots: 30 | void finished(QNetworkReply*); 31 | void progress(qint64, qint64); 32 | void writeData(); 33 | void error(QNetworkReply::NetworkError); 34 | }; 35 | 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/qt_gui/face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/qt_gui/face.png -------------------------------------------------------------------------------- /src/qt_gui/glwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef GLWIDGET_H 2 | #define GLWIDGET_H 3 | 4 | #include 5 | #include 6 | 7 | class ReaderThread : public QThread 8 | { 9 | Q_OBJECT 10 | public: 11 | ReaderThread(); 12 | void run(); 13 | signals: 14 | void done(); 15 | private: 16 | }; 17 | 18 | 19 | class GLWidget : public QGLWidget 20 | { 21 | Q_OBJECT 22 | 23 | public: 24 | GLWidget(QWidget *parent = 0); 25 | ~GLWidget(); 26 | 27 | QSize minimumSizeHint() const; 28 | QSize sizeHint() const; 29 | signals: 30 | void ready(); 31 | public slots: 32 | void setXRotation(float angle); 33 | void setYRotation(float angle); 34 | void setZRotation(float angle); 35 | void setXTrans(float pos); 36 | void setYTrans(float pos); 37 | void setZTrans(float pos); 38 | void objectsRead(); 39 | protected: 40 | void initializeGL(); 41 | void paintGL(); 42 | void resizeGL(int width, int height); 43 | 44 | private: 45 | bool makeObjects(); 46 | void normalizeAngle(int *angle); 47 | 48 | std::vector objects; 49 | float xRot; 50 | float yRot; 51 | float zRot; 52 | float xTrans; 53 | float yTrans; 54 | float zTrans; 55 | 56 | QColor trolltechPurple; 57 | 58 | ReaderThread *rt; 59 | }; 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/qt_gui/guardian.h: -------------------------------------------------------------------------------- 1 | #ifndef GUARDIAN__H 2 | #define GUARDIAN__H 3 | 4 | #include 5 | #include 6 | 7 | class ModelEdit; 8 | class DeviceSetup; 9 | 10 | class Guardian : QObject 11 | { 12 | Q_OBJECT 13 | public: 14 | Guardian(QWidget *parent); 15 | void regTgt(ModelEdit *me); 16 | void regTgt(DeviceSetup *ds); 17 | private: 18 | QWidget *parentWidget; 19 | int mdlType; 20 | int devType; 21 | QString devDesc; 22 | void checkDeviceNModel(); 23 | private slots: 24 | void modelSelected(int modelType); 25 | void deviceTypeChanged(int deviceType, const QString &desc); 26 | }; 27 | 28 | 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/qt_gui/hashing.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "hashing.h" 5 | 6 | bool hashFile(const QString fname, qint64 &size, uint16_t &fastVal, QByteArray &md5, 7 | QByteArray &sha1) 8 | { 9 | FastHash fh; 10 | QFile f(fname); 11 | if(!f.open(QIODevice::ReadOnly)){ 12 | return false; 13 | } 14 | size = f.size(); 15 | char val; 16 | uint16_t res; 17 | for(int i = 0; i < fh.getLength(); ++i){ 18 | f.read(&val, 1); 19 | res = fh.hash(val); 20 | } 21 | fastVal = res; 22 | f.seek(0); 23 | QCryptographicHash ch_sha(QCryptographicHash::Sha1); 24 | ch_sha.addData(f.readAll()); 25 | sha1 = ch_sha.result().toHex(); 26 | 27 | f.seek(0); 28 | QCryptographicHash ch_md5(QCryptographicHash::Md5); 29 | ch_md5.addData(f.readAll()); 30 | md5 = ch_md5.result().toHex(); 31 | 32 | return true; 33 | } 34 | 35 | void BlockId::isBlock(QFile &f, const QString &destPath, QStringList &msgs) 36 | { 37 | QString fname = QFileInfo(name).fileName(); 38 | qint64 pos = f.pos(); 39 | f.seek(pos - FastHash::length); 40 | QByteArray buf = f.read(size); 41 | if(buf.size() != size){ 42 | goto no_match; 43 | } 44 | if(QCryptographicHash::hash(buf, QCryptographicHash::Md5).toHex() != md5){ 45 | goto no_match; 46 | } 47 | if(QCryptographicHash::hash(buf, QCryptographicHash::Sha1).toHex() != sha1){ 48 | goto no_match; 49 | } 50 | if(!found){ 51 | QString outfile = destPath + fname; 52 | QFile out(outfile); 53 | found = out.open(QIODevice::WriteOnly); 54 | if(found){ 55 | found = (out.write(buf) == size); 56 | if(found){ 57 | msgs.append(QString::fromUtf8("Extracted %1...").arg(fname)); 58 | } 59 | } 60 | out.close(); 61 | if(fname.endsWith(QString::fromUtf8(".fw"), Qt::CaseInsensitive)){ 62 | QStringList args; 63 | args << QStringLiteral("-9") << QStringLiteral("%1").arg(outfile); 64 | QProcess::execute(QStringLiteral("gzip"), args); 65 | } 66 | } 67 | no_match: 68 | f.seek(pos); 69 | } 70 | 71 | -------------------------------------------------------------------------------- /src/qt_gui/hashing.h: -------------------------------------------------------------------------------- 1 | #ifndef HASHING__H 2 | #define HASHING__H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | 12 | class FastHash{ 13 | public: 14 | FastHash():buffer(length, 0), index{0}{}; 15 | void init(){for(int i = 0; i < length; ++i) buffer[i] = 0; index = 0;}; 16 | uint16_t hash(char val){ 17 | buffer[index] = val; 18 | index = (index + 1) % length; 19 | uint16_t tmp = 0; 20 | for(int i = 0; i < length; ++i){ 21 | if(tmp & 0x8000){ 22 | tmp ^= 3; 23 | } 24 | tmp <<= 2; 25 | tmp ^= buffer[(index + i) % length]; 26 | } 27 | return tmp; 28 | }; 29 | int getLength()const{return length;}; 30 | static const int length = 32; 31 | private: 32 | std::vector buffer; 33 | int index; 34 | }; 35 | 36 | class BlockId 37 | { 38 | public: 39 | BlockId(const QString &n, const qint64 sz, const uint16_t f, 40 | const QByteArray &m, const QByteArray &s): 41 | name(n), size(sz), fast(f), md5(m), sha1(s), found(false){}; 42 | void isBlock(QFile &f, const QString &destPath, QStringList &msgs); 43 | bool foundAlready()const{return found;}; 44 | void clearFoundFlag(){found = false;}; 45 | const QString &getFname()const{return name;}; 46 | void save(QTextStream &stream){stream< 2 | 3 | 4 | 5 | Welcome! 6 | 7 | 8 | 9 | 10 |

Welcome to Linuxtrack!

11 | First of all, thank you for using Linuxtrack, head-tracking software for Linux and Mac OS X. 12 |

13 | Linuxtrack allows you to use a web-camera, wiimote or any of the supported NP devices 14 | (currently TrackIR2 to 5, SmartNav3 and SmartNav4) as a head-tracking device, facilitating view control 15 | in simulators (flight, racing) or any other type of software. 16 |

17 | Among applications utilizing Linuxtrack are for example X-Plane flight simulator, 18 | Flight Gear flight simulator, and any TrackIR enabled game running in Wine (Condor soaring simulator, 19 | Il-2, Falcon 4, ...). 20 | 21 |

22 | If you want to know more, see the following pages: 23 |

29 | 30 | Should you encounter a bug, please take a few minutes and file a bug report at the project page 31 | - it will allow me to fix the bug that is bothering you, and it also helps to improve Linuxtrack itself. 32 | Also any comments, ideas for improvement and constructive criticism is very welcome! 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/qt_gui/help_view.h: -------------------------------------------------------------------------------- 1 | #ifndef HELP_VIEW__H 2 | #define HELP_VIEW__H 3 | 4 | #include 5 | #include "ui_logview.h" 6 | #include "help_viewer.h" 7 | 8 | class QSettings; 9 | class QHelpEngine; 10 | class QHelpContentWidget; 11 | class QSplitter; 12 | class HelpViewWidget; 13 | 14 | class HelpViewer : public QWidget{ 15 | Q_OBJECT 16 | HelpViewer(QWidget *parent = 0); 17 | ~HelpViewer(); 18 | static HelpViewer *hlp; 19 | static HelpViewer &getHlp(); 20 | void ChangeHelpPage(QString name); 21 | public: 22 | static void ShowWindow(); 23 | static void ChangePage(QString name); 24 | static void CloseWindow(); 25 | static void LoadPrefs(QSettings &settings); 26 | static void StorePrefs(QSettings &settings); 27 | static void RaiseWindow(); 28 | private slots: 29 | void on_CloseButton_pressed(); 30 | void followLink(const QUrl &url); 31 | //void currentTextChanged(const QString ¤tText); 32 | void helpInitialized(); 33 | void itemClicked(const QModelIndex &index); 34 | private: 35 | Ui::LogViewerForm ui; 36 | QHBoxLayout *layout; 37 | QSplitter *splitter; 38 | QHelpEngine *helpEngine; 39 | QHelpContentWidget *contents; 40 | HelpViewWidget *viewer; 41 | }; 42 | 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /src/qt_gui/help_viewer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | HelpViewWidget::HelpViewWidget(QHelpEngine *he, QWidget *parent):QTextBrowser(parent), helpEngine(he) 4 | { 5 | } 6 | 7 | QVariant HelpViewWidget::loadResource(int type, const QUrl &name) 8 | { 9 | if(name.scheme() == QString::fromUtf8("qthelp")){ 10 | return QVariant(helpEngine->fileData(name)); 11 | }else{ 12 | return QTextBrowser::loadResource(type, name); 13 | } 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/qt_gui/help_viewer.h: -------------------------------------------------------------------------------- 1 | #ifndef HELP_VIEWER__H 2 | #define HELP_VIEWER__H 3 | 4 | #include 5 | 6 | class QHelpEngine; 7 | class QUrl; 8 | 9 | class HelpViewWidget : public QTextBrowser 10 | { 11 | Q_OBJECT 12 | public: 13 | HelpViewWidget(QHelpEngine *he, QWidget *parent = 0); 14 | QVariant loadResource(int type, const QUrl &name); 15 | private: 16 | QHelpEngine *helpEngine; 17 | }; 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /src/qt_gui/joy_prefs.h: -------------------------------------------------------------------------------- 1 | #ifndef JOY_PREFS__H 2 | #define JOY_PREFS__H 3 | 4 | #include 5 | #include 6 | #include "ui_joy_setup.h" 7 | #include "pref.hpp" 8 | #include "prefs_link.h" 9 | 10 | class JoyPrefs: public QWidget{ 11 | Q_OBJECT 12 | public: 13 | JoyPrefs(const QString &dev_id, QWidget *parent = 0); 14 | ~JoyPrefs(); 15 | static bool AddAvailableDevices(QComboBox &combo); 16 | private: 17 | const QString id; 18 | bool Activate(const QString &ID, bool init = false); 19 | void Connect(); 20 | Ui::JoySetup ui; 21 | bool initializing; 22 | static void *libhandle; 23 | private slots: 24 | void on_PitchCombo_activated(int index); 25 | void on_YawCombo_activated(int index); 26 | void on_RollCombo_activated(int index); 27 | void on_TXCombo_activated(int index); 28 | void on_TYCombo_activated(int index); 29 | void on_TZCombo_activated(int index); 30 | void on_JsButton_pressed(); 31 | void on_EvdevButton_pressed(); 32 | void on_PPSFreq_valueChanged(int i); 33 | }; 34 | 35 | 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /src/qt_gui/linuxtrack.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/qt_gui/linuxtrack.icns -------------------------------------------------------------------------------- /src/qt_gui/log_view.cpp: -------------------------------------------------------------------------------- 1 | #include "log_view.h" 2 | #include 3 | #include "utils.h" 4 | 5 | LogView::LogView(QWidget *parent) : QWidget(parent), watcher(parent) 6 | { 7 | ui.setupUi(this); 8 | setWindowTitle(QString::fromUtf8("Logfile viewer")); 9 | size = 0; 10 | changed = true; 11 | //To make sure the logfile exists and we can get its name 12 | ltr_int_log_message("Opening logfile viewer.\n"); 13 | const char *log_name = ltr_int_get_logfile_name(); 14 | watcher.addPath(QString::fromUtf8(log_name)); 15 | QObject::connect(&watcher, SIGNAL(fileChanged(const QString&)), 16 | this, SLOT(fileChanged(const QString&))); 17 | lf = new QFile(QString::fromUtf8(log_name)); 18 | lf->open(QIODevice::ReadOnly); 19 | ts = new QTextStream(lf); 20 | timer = new QTimer(this); 21 | viewer = new QPlainTextEdit(this); 22 | ui.verticalLayout->insertWidget(0, viewer); 23 | QObject::connect(timer, SIGNAL(timeout()), 24 | this, SLOT(readChanges())); 25 | timer->start(250); 26 | } 27 | 28 | void LogView::on_CloseButton_pressed() 29 | { 30 | close(); 31 | } 32 | 33 | void LogView::readChanges() 34 | { 35 | if(changed) 36 | viewer->appendPlainText(ts->readAll()); 37 | changed = false; 38 | } 39 | 40 | 41 | 42 | void LogView::fileChanged(const QString &path) 43 | { 44 | (void) path; 45 | changed = true; 46 | } 47 | 48 | 49 | 50 | LogView::~LogView() 51 | { 52 | timer->stop(); 53 | delete(timer); 54 | delete(ts); 55 | delete(lf); 56 | ui.verticalLayout->removeWidget(viewer); 57 | delete(viewer); 58 | } 59 | 60 | #include "moc_log_view.cpp" 61 | 62 | -------------------------------------------------------------------------------- /src/qt_gui/log_view.h: -------------------------------------------------------------------------------- 1 | #ifndef LOG_VIEW__H 2 | #define LOG_VIEW__H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "ui_logview.h" 11 | 12 | class LogView : public QWidget{ 13 | Q_OBJECT 14 | public: 15 | LogView(QWidget *parent = 0); 16 | ~LogView(); 17 | private slots: 18 | void on_CloseButton_pressed(); 19 | void fileChanged(const QString &path); 20 | void readChanges(); 21 | private: 22 | Ui::LogViewerForm ui; 23 | QFileSystemWatcher watcher; 24 | QFile *lf; 25 | QTextStream *ts; 26 | qint64 size; 27 | QTimer *timer; 28 | QPlainTextEdit *viewer; 29 | bool changed; 30 | }; 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /src/qt_gui/logview.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | LogViewerForm 4 | 5 | 6 | 7 | 0 8 | 0 9 | 581 10 | 510 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | :/ltr/linuxtrack.svg:/ltr/linuxtrack.svg 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | Qt::Horizontal 29 | 30 | 31 | 32 | 40 33 | 20 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | Close 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/qt_gui/ltr_dev_help.cpp: -------------------------------------------------------------------------------- 1 | #include "pref.h" 2 | #include "ltr_dev_help.h" 3 | 4 | LtrDevHelp::LtrDevHelp(QWidget *parent) : QWidget(parent) 5 | { 6 | ui.setupUi(this); 7 | } 8 | 9 | void LtrDevHelp::on_DumpPrefsButton_pressed() 10 | { 11 | ltr_int_dump_prefs(""); 12 | } 13 | 14 | #include "moc_ltr_dev_help.cpp" 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/qt_gui/ltr_dev_help.h: -------------------------------------------------------------------------------- 1 | #ifndef LTR_DEV_HELP__H 2 | #define LTR_DEV_HELP__H 3 | 4 | #include "ui_dev_help.h" 5 | 6 | class LtrDevHelp : public QWidget 7 | { 8 | Q_OBJECT 9 | public: 10 | LtrDevHelp(QWidget *parent = 0); 11 | private slots: 12 | void on_DumpPrefsButton_pressed(); 13 | private: 14 | Ui::DevHelp ui; 15 | }; 16 | 17 | 18 | #endif 19 | 20 | -------------------------------------------------------------------------------- /src/qt_gui/ltr_gui.qhcp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ltr_gui.qhp 7 | help.qch 8 | 9 | 10 | 11 | help.qch 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/qt_gui/ltr_gui.qhp: -------------------------------------------------------------------------------- 1 | 2 | 3 | uglyDwarf.com.linuxtrack.1.0 4 | doc 5 | 6 | linuxtrack 7 | 0.99.20 8 | 9 | 10 | linuxtrack 11 | 0.99.20 12 | 13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | 27 | 28 | 29 | 30 | help/*.htm* 31 | help/*.png 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/qt_gui/ltr_profiles.h: -------------------------------------------------------------------------------- 1 | #ifndef LTR_PROFILES__H 2 | #define LTR_PROFILES__H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #define PROFILE Profile::getProfiles() 9 | 10 | 11 | class AppProfile : public QWidget{ 12 | Q_OBJECT 13 | public: 14 | AppProfile(const QString &n, QWidget *parent = 0); 15 | ~AppProfile(); 16 | bool changeProfile(const QString &newName); 17 | const QString &getProfileName() const; 18 | private: 19 | QString name; 20 | bool initializing; 21 | }; 22 | 23 | class Profile{ 24 | private: 25 | Profile(); 26 | Profile(const Profile&); 27 | static Profile *prof; 28 | QStringList names; 29 | AppProfile *currentProfile; 30 | QString currentName; 31 | public: 32 | static Profile& getProfiles(); 33 | void addProfile(const QString &name); 34 | const QStringList &getProfileNames(); 35 | bool setCurrent(const QString &name); 36 | AppProfile *getCurrentProfile(); 37 | const QString &getCurrentProfileName(); 38 | int isProfile(const QString &name); 39 | }; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/qt_gui/ltr_rc.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | cap_1.png 4 | clip_1.png 5 | cap_np.png 6 | clip_np.png 7 | face.png 8 | single.png 9 | ../linuxtrack.svg 10 | ../linuxtrack-wii.svg 11 | cap_small.png 12 | clip_small.png 13 | cap.png 14 | clip.png 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/qt_gui/ltr_show.h: -------------------------------------------------------------------------------- 1 | #ifndef LTR_SHOW__H 2 | #define LTR_SHOW__H 3 | 4 | #include "ui_ltr_gui.h" 5 | #include "ui_ltr.h" 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include "window.h" 17 | #include "buffering.h" 18 | 19 | class LtrGuiForm; 20 | class QSettings; 21 | 22 | class CameraView : public QWidget 23 | { 24 | Q_OBJECT 25 | public: 26 | CameraView(QWidget *parent = 0); 27 | ~CameraView(); 28 | void redraw(); 29 | private: 30 | QGraphicsScene *scene; 31 | QGraphicsView *view; 32 | QGraphicsPixmapItem *item; 33 | QVBoxLayout *layout; 34 | }; 35 | 36 | class LtrGuiForm : public QWidget 37 | { 38 | Q_OBJECT 39 | public: 40 | LtrGuiForm(const Ui::LinuxtrackMainForm &tmp_gui, QSettings &settings); 41 | ~LtrGuiForm(); 42 | void allowCloseWindow(); 43 | void StorePrefs(QSettings &settings); 44 | public slots: 45 | void update(); 46 | void updateFps(); 47 | 48 | private slots: 49 | void on_startButton_pressed(); 50 | void on_recenterButton_pressed(); 51 | void on_pauseButton_pressed(); 52 | void on_wakeButton_pressed(); 53 | void on_stopButton_pressed(); 54 | void disableCamView_stateChanged(int state); 55 | void disable3DView_stateChanged(int state); 56 | void stateChanged(int current_state); 57 | void newFrameDelivered(struct frame_type *frame); 58 | void on_tabWidget_currentChanged(int index); 59 | protected: 60 | void closeEvent(QCloseEvent *event); 61 | private: 62 | Ui::Ltr_gui ui; 63 | Window *glw; 64 | QTimer *timer; 65 | QTimer *fpsTimer; 66 | QElapsedTimer *stopwatch; 67 | CameraView *cv; 68 | bool allowClose; 69 | float fps; 70 | const Ui::LinuxtrackMainForm &main_gui; 71 | void trackerStopped(); 72 | void trackerRunning(); 73 | void trackerPaused(); 74 | }; 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /src/qt_gui/ltr_state.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "ltr_state.h" 3 | #include 4 | 5 | TrackerState *TrackerState::ts = NULL; 6 | 7 | TrackerState& TrackerState::trackerStateInst() 8 | { 9 | if(ts == NULL){ 10 | ts = new TrackerState(); 11 | } 12 | return *ts; 13 | } 14 | 15 | TrackerState::TrackerState() 16 | { 17 | timer = new QTimer(this); 18 | connect(timer, SIGNAL(timeout()), this, SLOT(pollState())); 19 | prev_state = STOPPED; 20 | timer->start(200); 21 | } 22 | 23 | TrackerState::~TrackerState() 24 | { 25 | delete timer; 26 | } 27 | 28 | /* 29 | linuxtrack_state_type TrackerState::getCurrentState() 30 | { 31 | return ltr_int_get_tracking_state(); 32 | } 33 | */ 34 | 35 | void TrackerState::pollState() 36 | { 37 | linuxtrack_state_type current_state = ltr_int_get_tracking_state(); 38 | if(prev_state != current_state){ 39 | emit stateChanged(current_state); 40 | } 41 | prev_state = current_state; 42 | } 43 | 44 | #include "moc_ltr_state.cpp" 45 | 46 | -------------------------------------------------------------------------------- /src/qt_gui/ltr_state.h: -------------------------------------------------------------------------------- 1 | #ifndef LTR_STATE__H 2 | #define LTR_STATE__H 3 | 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #define STATE TrackerState::trackerStateInst() 10 | 11 | class TrackerState : public QObject{ 12 | Q_OBJECT 13 | public: 14 | static TrackerState& trackerStateInst(); 15 | //linuxtrack_state_type getCurrentState(); 16 | private: 17 | TrackerState(); 18 | ~TrackerState(); 19 | static TrackerState *ts; 20 | QTimer *timer; 21 | linuxtrack_state_type prev_state; 22 | private slots: 23 | void pollState(); 24 | signals: 25 | void stateChanged(linuxtrack_state_type current_state); 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/qt_gui/ltr_tracking.h: -------------------------------------------------------------------------------- 1 | #ifndef LTR_TRACKING__H 2 | #define LTR_TRACKING__H 3 | 4 | #include "ltr_gui.h" 5 | 6 | 7 | class LtrTracking : public QObject 8 | { 9 | Q_OBJECT 10 | public: 11 | LtrTracking(const Ui::LinuxtrackMainForm &ui); 12 | ~LtrTracking(); 13 | void refresh(); 14 | signals: 15 | void customSectionChanged(); 16 | private slots: 17 | void axisChanged(int axis, int elem); 18 | void on_Profiles_currentIndexChanged(const QString &text); 19 | void on_CreateNewProfile_pressed(); 20 | 21 | void on_PitchEnable_stateChanged(int state); 22 | void on_RollEnable_stateChanged(int state); 23 | void on_YawEnable_stateChanged(int state); 24 | void on_XEnable_stateChanged(int state); 25 | void on_YEnable_stateChanged(int state); 26 | void on_ZEnable_stateChanged(int state); 27 | void on_PitchUpSpin_valueChanged(double d); 28 | void on_PitchDownSpin_valueChanged(double d); 29 | void on_YawLeftSpin_valueChanged(double d); 30 | void on_YawRightSpin_valueChanged(double d); 31 | void on_TiltLeftSpin_valueChanged(double d); 32 | void on_TiltRightSpin_valueChanged(double d); 33 | void on_MoveLeftSpin_valueChanged(double d); 34 | void on_MoveRightSpin_valueChanged(double d); 35 | void on_MoveUpSpin_valueChanged(double d); 36 | void on_MoveDownSpin_valueChanged(double d); 37 | void on_MoveBackSpin_valueChanged(double d); 38 | void on_MoveForthSpin_valueChanged(double d); 39 | void on_CommonFF_valueChanged(int value); 40 | void setCommonFF(float val); 41 | void initAxes(); 42 | private: 43 | const Ui::LinuxtrackMainForm &gui; 44 | void Connect(); 45 | void setCommonFFVal(float val); 46 | bool initializing; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/qt_gui/macps3eye_prefs.h: -------------------------------------------------------------------------------- 1 | #ifndef MACPS3EYE_PREFS__H 2 | #define MACPS3EYE_PREFS__H 3 | 4 | #include 5 | #include 6 | #include "ui_m_ps3eye_setup.h" 7 | #include "pref.hpp" 8 | #include "prefs_link.h" 9 | 10 | class MacP3ePrefs : public QWidget{ 11 | Q_OBJECT 12 | public: 13 | MacP3ePrefs(const QString &dev_id, QWidget *parent = 0); 14 | ~MacP3ePrefs(); 15 | static bool AddAvailableDevices(QComboBox &combo); 16 | private: 17 | const QString id; 18 | bool Activate(const QString &ID, bool init = false); 19 | Ui::MacPS3SetupForm ui; 20 | bool initializing; 21 | private slots: 22 | void on_WebcamResolutionsMac_activated(int index); 23 | void on_WebcamThresholdMac_valueChanged(int i); 24 | void on_WebcamMinBlobMac_valueChanged(int i); 25 | void on_WebcamMaxBlobMac_valueChanged(int i); 26 | void on_EXPOSURE_valueChanged(int i); 27 | void on_GAIN_valueChanged(int i); 28 | void on_BRIGHTNESS_valueChanged(int i); 29 | void on_CONTRAST_valueChanged(int i); 30 | void on_SHARPNESS_valueChanged(int i); 31 | void on_AGC_stateChanged(int state); 32 | void on_AWB_stateChanged(int state); 33 | void on_AEX_stateChanged(int state); 34 | void on_PLF50_stateChanged(int state); 35 | }; 36 | 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/qt_gui/macps3eyeft_prefs.h: -------------------------------------------------------------------------------- 1 | #ifndef MACPS3EYEFT_PREFS__H 2 | #define MACPS3EYEFT_PREFS__H 3 | 4 | #include 5 | #include 6 | #include "ui_m_ps3eye_ft_setup.h" 7 | #include "pref.hpp" 8 | #include "prefs_link.h" 9 | 10 | class MacP3eFtPrefs : public QWidget{ 11 | Q_OBJECT 12 | public: 13 | MacP3eFtPrefs(const QString &dev_id, QWidget *parent = 0); 14 | ~MacP3eFtPrefs(); 15 | static bool AddAvailableDevices(QComboBox &combo); 16 | private: 17 | const QString id; 18 | bool Activate(const QString &ID, bool init = false); 19 | Ui::MacPS3FtSetupForm ui; 20 | bool initializing; 21 | private slots: 22 | void on_WebcamResolutionsMac_activated(int index); 23 | void on_EXPOSURE_valueChanged(int i); 24 | void on_GAIN_valueChanged(int i); 25 | void on_BRIGHTNESS_valueChanged(int i); 26 | void on_CONTRAST_valueChanged(int i); 27 | void on_SHARPNESS_valueChanged(int i); 28 | void on_AGC_stateChanged(int state); 29 | void on_AWB_stateChanged(int state); 30 | void on_AEX_stateChanged(int state); 31 | void on_PLF50_stateChanged(int state); 32 | void on_FindCascadeMac_pressed(); 33 | void on_CascadePathMac_editingFinished(); 34 | void on_ExpFilterFactorMac_valueChanged(int value); 35 | void on_OptimLevelMac_valueChanged(int value); 36 | }; 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/qt_gui/macwebcam_info.h: -------------------------------------------------------------------------------- 1 | #ifndef MACWEBCAM_INFO__H 2 | #define MACWEBCAM_INFO__H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | class MacWebcamInfo{ 10 | public: 11 | MacWebcamInfo(const QString &id); 12 | const QStringList& getResolutions(); 13 | int findRes(const int &res_x, const int &res_y); 14 | static bool decodeRes(const QString &res, int &res_x, int &res_y); 15 | ~MacWebcamInfo(); 16 | static QStringList& EnumerateWebcams(); 17 | private: 18 | QString webcam_id; 19 | QStringList res_list; 20 | }; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /src/qt_gui/macwebcam_prefs.h: -------------------------------------------------------------------------------- 1 | #ifndef MACWEBCAM_PREFS__H 2 | #define MACWEBCAM_PREFS__H 3 | 4 | #include 5 | #include 6 | #include "ui_m_wc_setup.h" 7 | #include "pref.hpp" 8 | #include "prefs_link.h" 9 | 10 | class MacWebcamPrefs : public QWidget{ 11 | Q_OBJECT 12 | public: 13 | MacWebcamPrefs(const QString &dev_id, QWidget *parent = 0); 14 | ~MacWebcamPrefs(); 15 | static bool AddAvailableDevices(QComboBox &combo); 16 | private: 17 | const QString id; 18 | bool Activate(const QString &ID, bool init = false); 19 | Ui::MacWebcamSetupForm ui; 20 | bool initializing; 21 | private slots: 22 | void on_WebcamResolutionsMac_activated(int index); 23 | void on_WebcamThresholdMac_valueChanged(int i); 24 | void on_WebcamMinBlobMac_valueChanged(int i); 25 | void on_WebcamMaxBlobMac_valueChanged(int i); 26 | }; 27 | 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/qt_gui/macwebcamft_prefs.h: -------------------------------------------------------------------------------- 1 | #ifndef MACWEBCAMFT_PREFS__H 2 | #define MACWEBCAMFT_PREFS__H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "ui_m_wcft_setup.h" 8 | #include "pref.hpp" 9 | #include "prefs_link.h" 10 | 11 | class MacWebcamFtPrefs : public QWidget{ 12 | Q_OBJECT 13 | public: 14 | MacWebcamFtPrefs(const QString &dev_id, QWidget *parent = 0); 15 | ~MacWebcamFtPrefs(); 16 | static bool AddAvailableDevices(QComboBox &combo); 17 | private: 18 | bool Activate(const QString &ID, bool init = false); 19 | const QString id; 20 | Ui::MacWebcamFtSetupForm ui; 21 | bool initializing; 22 | private slots: 23 | void on_WebcamFtResolutionsMac_activated(int index); 24 | void on_FindCascadeMac_pressed(); 25 | void on_CascadePathMac_editingFinished(); 26 | void on_ExpFilterFactorMac_valueChanged(int value); 27 | void on_OptimLevelMac_valueChanged(int value); 28 | }; 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/qt_gui/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "ltr_gui.h" 4 | #include 5 | #include 6 | #include 7 | 8 | int main(int argc, char *argv[]) 9 | { 10 | ltr_int_check_root(); 11 | ltr_int_log_message("Starting ltr_gui\n"); 12 | setenv("LC_ALL", "C", 1); 13 | setlocale(LC_ALL, "C"); 14 | QLocale::setDefault(QLocale::c()); 15 | QApplication app(argc, argv); 16 | LinuxtrackGui gui; 17 | gui.show(); 18 | return app.exec(); 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/qt_gui/objreader.h: -------------------------------------------------------------------------------- 1 | #ifndef OBJREADER__H 2 | #define OBJREADER__H 3 | 4 | #include 5 | 6 | typedef struct { 7 | float x, y, z; 8 | float nx, ny, nz; 9 | float s, t; 10 | } vtx_t; 11 | 12 | typedef struct { 13 | int offset; 14 | int count; 15 | bool glass; 16 | } tri_t; 17 | 18 | typedef struct { 19 | std::vector vtx_table; 20 | std::vector vtx_indices; 21 | std::vector tris_table; 22 | QString texture; 23 | } object_t; 24 | 25 | extern std::vector object_table; 26 | 27 | void read_obj(); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/qt_gui/plugin_install.h: -------------------------------------------------------------------------------- 1 | #ifndef PLUGIN_INSTALL 2 | #define PLUGIN_INSTALL 3 | 4 | #include 5 | #include "ui_ltr.h" 6 | #include "wine_launcher.h" 7 | #include "extractor.h" 8 | 9 | class Extractor; 10 | 11 | class PluginInstall : public QObject 12 | { 13 | Q_OBJECT 14 | public: 15 | PluginInstall(const Ui::LinuxtrackMainForm &ui, QObject *parent = 0); 16 | ~PluginInstall(); 17 | void close(); 18 | private slots: 19 | void installWinePlugin(); 20 | void tirFirmwareInstall(); 21 | void installLinuxtrackWine(); 22 | void on_TIRFWButton_pressed(); 23 | //void on_TIRViewsButton_pressed(); 24 | void finished(bool ok); 25 | private: 26 | enum state{TIR_FW, MFC, LTR_W, DONE, TIR_FW_ONLY, MFC_ONLY} state; 27 | const Ui::LinuxtrackMainForm &gui; 28 | void Connect(); 29 | WineLauncher *inst; 30 | TirFwExtractor *dlfw; 31 | Mfc42uExtractor *dlmfc; 32 | bool isTirFirmwareInstalled(); 33 | bool isMfc42uInstalled(); 34 | void enableButtons(bool ena); 35 | void mfc42uInstall(); 36 | const QString poem1; 37 | const QString poem2; 38 | const QString gameData; 39 | const QString mfc42u; 40 | const QString tirViews; 41 | }; 42 | 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /src/qt_gui/prefs_link.h: -------------------------------------------------------------------------------- 1 | #ifndef PREFS_LINK__H 2 | #define PREFS_LINK__H 3 | 4 | #include 5 | #include 6 | 7 | typedef enum{ 8 | NONE, 9 | WEBCAM, 10 | WEBCAM_FT, 11 | WIIMOTE, 12 | TIR, 13 | MACWEBCAM, 14 | MACWEBCAM_FT, 15 | JOYSTICK, 16 | MACPS3EYE, 17 | MACPS3EYE_FT 18 | } deviceType_t; 19 | 20 | 21 | struct PrefsLink{ 22 | deviceType_t deviceType; 23 | QString ID; 24 | PrefsLink() : deviceType(NONE), ID(){}; 25 | PrefsLink(const deviceType_t dt, const QString &i) : deviceType(dt), ID(i){}; 26 | }; 27 | 28 | Q_DECLARE_METATYPE(PrefsLink) 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/qt_gui/profile_selector.h: -------------------------------------------------------------------------------- 1 | #ifndef PROFILE_SELECTOR__H 2 | #define PROFILE_SELECTOR__H 3 | 4 | #include 5 | #include "ui_profile_selector.h" 6 | 7 | class ProfileSetup; 8 | 9 | class ProfileSelector : public QWidget 10 | { 11 | Q_OBJECT 12 | public: 13 | ProfileSelector(QWidget *parent = 0); 14 | ~ProfileSelector(); 15 | void refresh(); 16 | private: 17 | Ui::ProfileSelectorForm ui; 18 | ProfileSetup *ps; 19 | bool initializing; 20 | bool setCurrentProfile(QString prof); 21 | public slots: 22 | bool close(); 23 | private slots: 24 | void on_Profiles_currentIndexChanged(const QString &text); 25 | void on_CopyFromDefault_pressed(); 26 | void on_ImportProfile_pressed(); 27 | void on_ExportProfile_pressed(); 28 | }; 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/qt_gui/profile_setup.h: -------------------------------------------------------------------------------- 1 | #ifndef PROFILE_SETUP__H 2 | #define PROFILE_SETUP__H 3 | 4 | #include 5 | #include "ui_profile_setup.h" 6 | 7 | class ScpForm; 8 | 9 | class ProfileSetup : public QWidget 10 | { 11 | Q_OBJECT 12 | public: 13 | ProfileSetup(const QString &name, QWidget *parent = 0); 14 | ~ProfileSetup(); 15 | void copyFromDefault(); 16 | void importProfile(QTextStream &tf); 17 | void exportProfile(QTextStream &tf); 18 | private: 19 | void connect(); 20 | Ui::ProfileSetupForm ui; 21 | ScpForm *sc; 22 | QString profileName; 23 | bool initializing; 24 | public slots: 25 | bool close(); 26 | private slots: 27 | void on_DetailedAxisSetup_pressed(); 28 | void on_PitchEnable_stateChanged(int state); 29 | void on_YawEnable_stateChanged(int state); 30 | void on_RollEnable_stateChanged(int state); 31 | void on_TxEnable_stateChanged(int state); 32 | void on_TyEnable_stateChanged(int state); 33 | void on_TzEnable_stateChanged(int state); 34 | void on_PitchInvert_stateChanged(int state); 35 | void on_YawInvert_stateChanged(int state); 36 | void on_RollInvert_stateChanged(int state); 37 | void on_TxInvert_stateChanged(int state); 38 | void on_TyInvert_stateChanged(int state); 39 | void on_TzInvert_stateChanged(int state); 40 | void on_PitchSens_valueChanged(int val); 41 | void on_YawSens_valueChanged(int val); 42 | void on_RollSens_valueChanged(int val); 43 | void on_TxSens_valueChanged(int val); 44 | void on_TySens_valueChanged(int val); 45 | void on_TzSens_valueChanged(int val); 46 | void on_Smoothing_valueChanged(int val); 47 | void axisChanged(int axis, int elem); 48 | void setCommonFF(float val); 49 | void initAxes(); 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/qt_gui/progress.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "progress.h" 3 | 4 | void Progress::message(qint64 read, qint64 all) 5 | { 6 | ui.ProgressBar->setValue((float)read / all * 100.0); 7 | ui.InfoLabel->setText(QString::fromUtf8("Downloaded %1 of %2.").arg(read).arg(all)); 8 | } 9 | 10 | #include "moc_progress.cpp" 11 | 12 | -------------------------------------------------------------------------------- /src/qt_gui/progress.h: -------------------------------------------------------------------------------- 1 | #ifndef PROGRESS__H 2 | #define PROGRESS__H 3 | 4 | #include "ui_progress.h" 5 | #include 6 | 7 | class Progress: public QDialog 8 | { 9 | Q_OBJECT 10 | public: 11 | Progress(){ui.setupUi(this); ui.InfoLabel->setText(QString::fromUtf8(""));}; 12 | void show(){ui.ProgressBar->setValue(0);QWidget::show();}; 13 | private: 14 | Ui::DLProgress ui; 15 | public slots: 16 | void message(qint64 read, qint64 all); 17 | }; 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/qt_gui/progress.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DLProgress 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 66 11 | 12 | 13 | 14 | Download Progress 15 | 16 | 17 | 18 | 19 | 20 | TextLabel 21 | 22 | 23 | 24 | 25 | 26 | 27 | 0 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/qt_gui/scp_form.cpp: -------------------------------------------------------------------------------- 1 | #include "scp_form.h" 2 | #include 3 | #include "ltr_profiles.h" 4 | 5 | ScpForm::ScpForm(QWidget *parent) :QWidget(parent) 6 | { 7 | ui.setupUi(this); 8 | pitch = new SCurve(PITCH, QString::fromUtf8("Pitch - looking down/up"), QString::fromUtf8("Down"), 9 | QString::fromUtf8("Up"), this); 10 | yaw = new SCurve(YAW, QString::fromUtf8("Yaw - looking left/right"), QString::fromUtf8("Right"), 11 | QString::fromUtf8("Left"), this); 12 | roll = new SCurve(ROLL, QString::fromUtf8("Roll - tilting head left/right"), 13 | QString::fromUtf8("Clockwise"), QString::fromUtf8("Counter-clockwise"), this); 14 | x = new SCurve(TX, QString::fromUtf8("Sideways translation"), QString::fromUtf8("Left"), 15 | QString::fromUtf8("Right"), this); 16 | y = new SCurve(TY, QString::fromUtf8("Up/down translation"), QString::fromUtf8("Down"), 17 | QString::fromUtf8("Up"), this); 18 | z = new SCurve(TZ, QString::fromUtf8("Back/forth translation"), QString::fromUtf8("Forth"), 19 | QString::fromUtf8("Back"), this); 20 | ui.SCPPitch->addWidget(pitch); 21 | ui.SCPYaw->addWidget(yaw); 22 | ui.SCPRoll->addWidget(roll); 23 | ui.SCPX->addWidget(x); 24 | ui.SCPY->addWidget(y); 25 | ui.SCPZ->addWidget(z); 26 | } 27 | 28 | ScpForm::~ScpForm() 29 | { 30 | delete yaw; 31 | delete pitch; 32 | delete roll; 33 | delete x; 34 | delete y; 35 | delete z; 36 | } 37 | 38 | void ScpForm::on_SCPCloseButton_pressed() 39 | { 40 | close(); 41 | } 42 | 43 | #include "moc_scp_form.cpp" 44 | 45 | -------------------------------------------------------------------------------- /src/qt_gui/scp_form.h: -------------------------------------------------------------------------------- 1 | #ifndef SCP_FORM__H 2 | #define SCP_FORM__H 3 | 4 | #include 5 | #include "ui_scp_form.h" 6 | #include "scurve.h" 7 | 8 | class ScpForm : public QWidget 9 | { 10 | Q_OBJECT 11 | public: 12 | ScpForm(QWidget *parent = 0); 13 | ~ScpForm(); 14 | /* 15 | void updatePitch(float newPitch); 16 | void updateRoll(float newRoll); 17 | void updateYaw(float newYaw); 18 | void updateX(float newX); 19 | void updateY(float newY); 20 | void updateZ(float newZ); 21 | */ 22 | private slots: 23 | void on_SCPCloseButton_pressed(); 24 | private: 25 | Ui::SCPForm ui; 26 | SCurve *yaw, *pitch, *roll; 27 | SCurve *x, *y, *z; 28 | }; 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/qt_gui/scurve.h: -------------------------------------------------------------------------------- 1 | #ifndef SCURVE__H 2 | #define SCURVE__H 3 | 4 | #include 5 | #include 6 | 7 | #include "ui_scurve.h" 8 | #include "scview.h" 9 | #include 10 | 11 | class SCurve : public QWidget{ 12 | Q_OBJECT 13 | public: 14 | SCurve(axis_t a, QString axis_name, QString left, QString right, QWidget *parent = 0); 15 | ~SCurve(); 16 | //void movePoint(float new_x); 17 | signals: 18 | void changed(); 19 | //void movePoint(float new_x, float new_y); 20 | void symetryChanged(bool symetrical); 21 | private slots: 22 | void on_SCSymetrical_stateChanged(int state); 23 | void on_SCFactor_valueChanged(int value); 24 | void on_SCLeftCurv_valueChanged(int value); 25 | void on_SCRightCurv_valueChanged(int value); 26 | void on_SCFilterSlider_valueChanged(int value); 27 | void on_SCDeadZone_valueChanged(int value); 28 | void on_SCLeftLimit_valueChanged(double d); 29 | void on_SCRightLimit_valueChanged(double d); 30 | void setEnabled(int state); 31 | void axisChanged(int a, int elem); 32 | void initAxes(); 33 | private: 34 | void setup_gui(); 35 | axis_t axis; 36 | Ui::SCurveForm ui; 37 | bool symetrical; 38 | SCView *view; 39 | bool first; 40 | bool initializing; 41 | 42 | void setDeadzone(float val, bool signal = false); 43 | void setFilter(float val, bool signal = false); 44 | 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/qt_gui/scview.h: -------------------------------------------------------------------------------- 1 | #ifndef SCVIEW__H 2 | #define SCVIEW__H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class SCView : public QWidget 10 | { 11 | Q_OBJECT 12 | public: 13 | SCView(axis_t a, QWidget *parent = 0); 14 | ~SCView(); 15 | // QSize sizeHint() const; 16 | // QSize minimumSizeHint() const; 17 | // void movePoint(float new_x); 18 | public slots: 19 | void redraw(); 20 | void newPose(linuxtrack_full_pose_t *raw_pose, linuxtrack_pose_t *unfiltered, linuxtrack_pose_t *pose); 21 | protected: 22 | void paintEvent(QPaintEvent *event); 23 | 24 | private: 25 | int spline(QPointF points[], int num_points); 26 | float spline(float x); 27 | QWidget *parentWidget; 28 | float rx; //raw value 29 | float px; //processed value 30 | float upx; //unfiltered value 31 | axis_t axis; 32 | QTimer *timer; 33 | bool invert; 34 | }; 35 | 36 | 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/qt_gui/single.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/qt_gui/single.png -------------------------------------------------------------------------------- /src/qt_gui/sources.txt: -------------------------------------------------------------------------------- 1 | https://s3.amazonaws.com/naturalpoint/trackir/software/TrackIR_5.4.2.exe 2 | https://s3.amazonaws.com/naturalpoint/trackir/software/TrackIR_5.4.1.exe 3 | https://s3.amazonaws.com/naturalpoint/trackir/software/TrackIR_5.4.0.exe 4 | https://s3.amazonaws.com/naturalpoint/trackir/software/TrackIR_5.3.0.exe 5 | 6 | -------------------------------------------------------------------------------- /src/qt_gui/sources_mac.txt: -------------------------------------------------------------------------------- 1 | http://media.naturalpoint.com/software/TrackIR_5.3.0.exe 2 | -------------------------------------------------------------------------------- /src/qt_gui/sources_mfc.txt: -------------------------------------------------------------------------------- 1 | http://download.microsoft.com/download/vc60pro/Update/2/W9XNT4/EN-US/VC6RedistSetup_deu.exe 2 | http://linuxtrack.eu/VC6RedistSetup_deu.exe 3 | -------------------------------------------------------------------------------- /src/qt_gui/spec.txt: -------------------------------------------------------------------------------- 1 | poem1.txt 106 10376 321d060cb7e0bcff6d194631531dd973 e3fb90114455a5b2ff350f49f67da63b79e7eb71 2 | tir4.fw 72743 33248 5aeebac5fd168abb71acd75fb89dc2b3 bc4cbf49fa6d4e1c8006a5ce68193f0998ffe367 3 | tir5.fw 36076 50651 a140a72d76517a3904d07ec31c1389fc dd01a9508d4874340e585fa4e42499cfed1845f5 4 | poem2.txt 98 53803 2a996a9aa23c8762547b75b3249bee8e ce41d72ce4289c5a50b54866e42d5107a9c7ba52 5 | sn4.fw 169289 61055 ec793a142481215fce4430c6bf24095e 01e6ea5b84d2958c82d4699a738c3bc7cd8434d6 6 | tir5v2.fw 36145 63093 a2abd72e90decae4d3d4ba761b66e289 de378aad436d0ff8d1affcfbd22ef530712c9237 7 | -------------------------------------------------------------------------------- /src/qt_gui/sphere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/qt_gui/sphere.png -------------------------------------------------------------------------------- /src/qt_gui/sphere.txt: -------------------------------------------------------------------------------- 1 | Original image downloaded from http://freepanorama.blogspot.cz/2012/02/hdr-exr-jpg-133-mb-httpwww.html 2 | Many thanks to the author for making his work free for others to use! 3 | -------------------------------------------------------------------------------- /src/qt_gui/tir_prefs.h: -------------------------------------------------------------------------------- 1 | #ifndef TIR_PREFS__H 2 | #define TIR_PREFS__H 3 | 4 | #include 5 | #include 6 | #include "ui_tir_setup.h" 7 | #include "prefs_link.h" 8 | #include "extractor.h" 9 | #include <../usb_ifc.h> 10 | 11 | class TirPrefs : public QWidget{ 12 | Q_OBJECT 13 | public: 14 | TirPrefs(const QString &dev_id, QWidget *parent = 0); 15 | ~TirPrefs(); 16 | static bool AddAvailableDevices(QComboBox &combo); 17 | private: 18 | const QString id; 19 | bool Activate(const QString &ID, bool init = false); 20 | Ui::TirSetupForm ui; 21 | //void Connect(); 22 | bool initializing; 23 | TirFwExtractor *dlfw; 24 | static bool firmwareOK; 25 | static bool permsOK; 26 | signals: 27 | void pressRefresh(); 28 | private slots: 29 | void on_TirThreshold_valueChanged(int i); 30 | void on_TirMinBlob_valueChanged(int i); 31 | void on_TirMaxBlob_valueChanged(int i); 32 | void on_TirStatusBright_valueChanged(int i); 33 | void on_TirIrBright_valueChanged(int i); 34 | void on_TirSignalizeStatus_stateChanged(int state); 35 | void on_TirUseGrayscale_stateChanged(int state); 36 | void on_TirInstallFirmware_pressed(); 37 | void TirFirmwareDLFinished(bool state); 38 | }; 39 | 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/qt_gui/webcam_ft_prefs.h: -------------------------------------------------------------------------------- 1 | #ifndef WEBCAM_FT_PREFS__H 2 | #define WEBCAM_FT_PREFS__H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "ui_l_wcft_setup.h" 8 | #include "pref.hpp" 9 | #include "prefs_link.h" 10 | 11 | class WebcamFtPrefs : public QWidget{ 12 | Q_OBJECT 13 | public: 14 | WebcamFtPrefs(const QString &dev_id, QWidget *parent = 0); 15 | ~WebcamFtPrefs(); 16 | static bool AddAvailableDevices(QComboBox &combo); 17 | private: 18 | const QString id; 19 | bool Activate(const QString &ID, bool init = false); 20 | Ui::WebcamFtSetupForm ui; 21 | //void Connect(); 22 | bool initializing; 23 | private slots: 24 | void on_WebcamFtFormats_activated(int index); 25 | void on_WebcamFtResolutions_activated(int index); 26 | void on_FindCascade_pressed(); 27 | void on_CascadePath_editingFinished(); 28 | void on_ExpFilterFactor_valueChanged(int value); 29 | void on_OptimLevel_valueChanged(int value); 30 | }; 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/qt_gui/webcam_info.h: -------------------------------------------------------------------------------- 1 | #ifndef WEBCAM_INFO__H 2 | #define WEBCAM_INFO__H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "webcam_driver.h" 8 | 9 | 10 | class WebcamInfo{ 11 | public: 12 | WebcamInfo(const QString &id); 13 | const QStringList& getFormats(); 14 | const QStringList& getResolutions(int index); 15 | QString getFourcc(int index); 16 | int findFourcc(const QString &fcc); 17 | bool findFmtSpecs(int i_fmt, int i_res, QString &res, 18 | QString &fps, QString &fmt); 19 | int findRes(const int &res_x, const int &res_y, const int &fps_num, 20 | const int &fps_den, const QString &fourcc); 21 | static bool decodeRes(const QString &res, int &res_x, int &res_y); 22 | static bool decodeFps(const QString &fps, int &num, int &den); 23 | ~WebcamInfo(); 24 | static QStringList& EnumerateWebcams(); 25 | private: 26 | QString webcam_id; 27 | webcam_formats fmts; 28 | typedef QList > format_array_t; 29 | typedef QList res_list_t; 30 | QStringList format_strings; 31 | format_array_t fmt_descs; 32 | res_list_t res_list; 33 | int fmt_index; 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/qt_gui/webcam_prefs.h: -------------------------------------------------------------------------------- 1 | #ifndef WEBCAM_PREFS__H 2 | #define WEBCAM_PREFS__H 3 | 4 | #include 5 | #include 6 | #include "ui_l_wc_setup.h" 7 | #include "pref.hpp" 8 | #include "prefs_link.h" 9 | 10 | class WebcamPrefs : public QWidget{ 11 | Q_OBJECT 12 | public: 13 | WebcamPrefs(const QString &dev_id, QWidget *parent = 0); 14 | ~WebcamPrefs(); 15 | static bool AddAvailableDevices(QComboBox &combo); 16 | private: 17 | const QString id; 18 | bool Activate(const QString &ID, bool init = false); 19 | Ui::WebcamSetupForm ui; 20 | bool initializing; 21 | private slots: 22 | void on_WebcamFormats_activated(int index); 23 | void on_WebcamResolutions_activated(int index); 24 | void on_WebcamThreshold_valueChanged(int i); 25 | void on_WebcamMinBlob_valueChanged(int i); 26 | void on_WebcamMaxBlob_valueChanged(int i); 27 | }; 28 | 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/qt_gui/wiimote_prefs.h: -------------------------------------------------------------------------------- 1 | #ifndef WIIMOTE_PREFS__H 2 | #define WIIMOTE_PREFS__H 3 | 4 | #include 5 | #include 6 | #include "ui_wii_setup.h" 7 | #include "pref.hpp" 8 | #include "prefs_link.h" 9 | 10 | 11 | class WiimotePrefs : public QWidget{ 12 | Q_OBJECT 13 | public: 14 | WiimotePrefs(const QString &dev_id, QWidget *parent = 0); 15 | ~WiimotePrefs(); 16 | static bool AddAvailableDevices(QComboBox &combo); 17 | private: 18 | const QString id; 19 | bool Activate(const QString &ID, bool init = false); 20 | void Connect(); 21 | Ui::WiiSetupForm ui; 22 | bool initializing; 23 | private slots: 24 | void runIndicationChanged(int state); 25 | void pauseIndicationChanged(int state); 26 | }; 27 | 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/qt_gui/win7.reg: -------------------------------------------------------------------------------- 1 | REGEDIT4 2 | 3 | [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion] 4 | "CSDVersion"="Service Pack 1" 5 | "CurrentBuildNumber"="7601" 6 | "CurrentType"="Uniprocessor Free" 7 | "CurrentVersion"="6.1" 8 | "ProductName"="Microsoft Windows 7" 9 | 10 | [HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ProductOptions] 11 | "ProductType"="WinNT" 12 | 13 | [HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Windows] 14 | "CSDVersion"=dword:00000100 15 | 16 | [HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment] 17 | "OS"="Windows_NT" 18 | 19 | [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\{C3311E09-0E33-4649-B77B-DFAF41253FE6}] 20 | "DisplayVersion"="2.70.0000" 21 | 22 | -------------------------------------------------------------------------------- /src/qt_gui/window.h: -------------------------------------------------------------------------------- 1 | #ifndef WINDOW_H 2 | #define WINDOW_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "tracker.h" 9 | 10 | class GLWidget; 11 | 12 | class Window : public QWidget 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | Window(QWidget *t, QCheckBox *b); 18 | ~Window(); 19 | void prepare_widget(); 20 | void close_widget(); 21 | void stopUpdates(); 22 | void resumeUpdates(); 23 | private slots: 24 | void update_pic(); 25 | void start_widget(); 26 | void newPose(linuxtrack_full_pose_t *raw, linuxtrack_pose_t *unfiltered, linuxtrack_pose_t *processed); 27 | private: 28 | GLWidget *glWidget; 29 | QTimer *timer; 30 | QWidget *tab; 31 | QHBoxLayout *mainLayout; 32 | QCheckBox *control; 33 | bool constructed; 34 | bool inConstruction; 35 | linuxtrack_pose_t pose; 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/qt_gui/wine_launcher.h: -------------------------------------------------------------------------------- 1 | #ifndef WINE_LAUNCHER__H 2 | #define WINE_LAUNCHER__H 3 | 4 | #include 5 | #include 6 | 7 | class WineLauncher:public QObject 8 | { 9 | Q_OBJECT 10 | public: 11 | WineLauncher(); 12 | ~WineLauncher(); 13 | void setEnv(const QString &var, const QString &val); 14 | void run(const QString &tgt); 15 | void run(const QString &tgt, const QStringList ¶ms); 16 | bool wineAvailable(); 17 | private: 18 | bool check(); 19 | void envSet(const QString var, const QString val); 20 | QProcess wine; 21 | QProcessEnvironment env; 22 | QString winePath; 23 | bool available; 24 | private slots: 25 | void finished(int exitCode, QProcess::ExitStatus exitStatus); 26 | void error(QProcess::ProcessError error); 27 | signals: 28 | void finished(bool result); 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/qt_gui/wine_warn.cpp: -------------------------------------------------------------------------------- 1 | #include "wine_warn.h" 2 | 3 | 4 | WineWarn::WineWarn(QWidget *parent) : QDialog(parent) 5 | { 6 | ui.setupUi(this); 7 | } 8 | 9 | WineWarn::~WineWarn() 10 | { 11 | } 12 | 13 | void WineWarn::show() 14 | { 15 | QDialog::show(); 16 | } 17 | 18 | void WineWarn::on_OKButton_pressed() 19 | { 20 | if(ui.DontShow->isChecked()){ 21 | accept(); 22 | }else{ 23 | reject(); 24 | } 25 | } 26 | 27 | #include "moc_wine_warn.cpp" 28 | 29 | -------------------------------------------------------------------------------- /src/qt_gui/wine_warn.h: -------------------------------------------------------------------------------- 1 | #ifndef WINE_WARN__H 2 | #define WINE_WARN__H 3 | 4 | #include 5 | #include "ui_wine_warn.h" 6 | 7 | class WineWarn : public QDialog 8 | { 9 | Q_OBJECT 10 | public: 11 | WineWarn(QWidget *parent = 0); 12 | ~WineWarn(); 13 | private: 14 | Ui::Dialog ui; 15 | public slots: 16 | void show(); 17 | void on_OKButton_pressed(); 18 | }; 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /src/qt_gui/xm8_detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/qt_gui/xm8_detail.png -------------------------------------------------------------------------------- /src/qt_gui/xplugin.h: -------------------------------------------------------------------------------- 1 | #ifndef XPLUGIN__H 2 | #define XPLUGIN__H 3 | 4 | #include 5 | #include "ui_xplugin.h" 6 | 7 | class XPluginInstall : public QDialog 8 | { 9 | Q_OBJECT 10 | public: 11 | XPluginInstall(){ui.setupUi(this);}; 12 | private: 13 | Ui::XPluginInstall ui; 14 | public slots: 15 | void on_BrowseXPlane_pressed(); 16 | }; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/runloop.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNLOOP__H 2 | #define RUNLOOP__H 3 | 4 | #include 5 | 6 | int ltr_int_tracker_init(struct camera_control_block *ccb); 7 | int ltr_int_tracker_pause(); 8 | int ltr_int_tracker_get_frame(struct camera_control_block *ccb, struct frame_type *frame, 9 | bool *frame_acquired); 10 | int ltr_int_tracker_resume(); 11 | int ltr_int_tracker_close(); 12 | #endif 13 | -------------------------------------------------------------------------------- /src/sn4_com.h: -------------------------------------------------------------------------------- 1 | #ifndef SN4_COM__H 2 | #define SN4_COM__H 3 | 4 | #include 5 | #include 6 | 7 | typedef struct{ 8 | uint8_t btns; 9 | struct timeval timestamp; 10 | } sn4_btn_event_t; 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /src/sn4_model.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | //******************************************************************* 4 | 5 | smartnav4::smartnav4(std::string fname) :tir4(fname) 6 | { 7 | } 8 | 9 | void smartnav4::get_config() 10 | { 11 | unsigned char config[] = {0x15, 0x40, 0x02, 0x01, 0x02, 0xFF, 0xFF, 0x08, 12 | 0x04, 0x00, 0x64, 0x02, 0x80, 0x01, 0xE0, 0x8C, 13 | 0x00, 0x00, 0x00, 0x00, 0x02}; 14 | enqueue_packet(config, sizeof(config)); 15 | } 16 | 17 | void smartnav4::do_whatever() 18 | { 19 | unsigned char whatever[] = {0x06, 0x20, 0x02, 0x20, 0x00, 0x00}; 20 | enqueue_packet(whatever, sizeof(whatever)); 21 | } 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/spline.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "spline.h" 3 | 4 | 5 | 6 | 7 | int ltr_int_curve2pts(const splines_def *curve, splines *pts) 8 | { 9 | pts->left.x0 = pts->right.x0 = curve->dead_zone; 10 | pts->left.y0 = pts->right.y0 = 0.0f; 11 | 12 | pts->left.x1 = curve->dead_zone + (1.0f - curve->dead_zone) * (1.0f - curve->l_curvature); 13 | pts->right.x1 = curve->dead_zone + (1.0f - curve->dead_zone) * (1.0f - curve->r_curvature); 14 | pts->left.y1 = curve->l_curvature; 15 | pts->right.y1 = curve->r_curvature; 16 | 17 | pts->left.x2 = pts->right.x2 = 1.0f; 18 | pts->left.y2 = pts->right.y2 = 1.0f; 19 | return 0; 20 | } 21 | 22 | float ltr_int_spline_point(const splines *splns, float x) 23 | { 24 | const spline_pts *pts; 25 | float a, b, c; 26 | float factor; 27 | if(x < 0.0f){ 28 | pts = &(splns->left); 29 | factor = -1.0f; 30 | x *= -1.0f; 31 | }else{ 32 | pts = &(splns->right); 33 | factor = 1.0f; 34 | } 35 | a = pts->x0; 36 | if(x < a){ 37 | return 0.0f; 38 | } 39 | b = pts->x1; 40 | c = pts->x2; 41 | float tmp = c - 2 * b + a; 42 | if(fabs(tmp) < 1e-3){ //simple linear 43 | return factor * (x - a) * ((pts->y2 - pts->y0) / (c - a)); 44 | }else{ 45 | float t = (sqrtf(tmp * x - a * c + b * b) - b + a) / tmp; 46 | float b02 = (1 - t) * (1 - t); 47 | float b12 = 2 * t * (1 - t); 48 | float b22 = t * t; 49 | return factor * ((b02 * pts->y0) + (b12 * pts->y1) + (b22 * pts->y2)); 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /src/spline.h: -------------------------------------------------------------------------------- 1 | #ifndef SPLINE__H 2 | #define SPLINE__H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | typedef struct{ 9 | float dead_zone; 10 | float l_curvature; 11 | float r_curvature; 12 | }splines_def; 13 | 14 | typedef struct{ 15 | float x0, y0; 16 | float x1, y1; 17 | float x2, y2; 18 | }spline_pts; 19 | 20 | typedef struct{ 21 | spline_pts left, right; 22 | }splines; 23 | 24 | //Converts curve definition to spline points 25 | int ltr_int_curve2pts(const splines_def *curve, splines *pts); 26 | 27 | //Make sure x belongs to <-1; 1>! 28 | float ltr_int_spline_point(const splines *pts, float x); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/tests/pref_test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | (void) argc; 8 | (void) argv; 9 | if(ltr_int_read_prefs(NULL, true)){ 10 | char **sections = NULL; 11 | ltr_int_get_section_list(§ions); 12 | char *name; 13 | int i = 0; 14 | while((name = sections[i]) != NULL){ 15 | printf("Section: %s\n", name); 16 | ++i; 17 | } 18 | ltr_int_array_cleanup(§ions); 19 | ltr_int_free_prefs(); 20 | } 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /src/tests/tir4_driver_test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "cal.h" 4 | #include "tir4_driver.h" 5 | 6 | int main(int argc, char **argv) { 7 | struct frame_type frame; 8 | struct camera_control_block ccb; 9 | 10 | ccb.device.category = tir4_camera; 11 | ccb.diag = true; 12 | /* ccb.mode = operational_1dot; */ 13 | /* ccb.mode = operational_3dot; */ 14 | 15 | cal_init(&ccb); 16 | 17 | /* loop forever reading and printing results */ 18 | /* while (true) { */ 19 | /* cal_get_frame(&ccb, &frame); */ 20 | /* frame_print(frame); */ 21 | /* frame_free(&ccb, &frame); */ 22 | /* } */ 23 | 24 | int i; 25 | for(i=0; i<2000; i++) { 26 | cal_get_frame(&ccb, &frame); 27 | frame_print(frame); 28 | frame_free(&ccb, &frame); 29 | } 30 | 31 | /* call disconnects, turns all LEDs off */ 32 | cal_shutdown(&ccb); 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /src/tests/wiimote_driver_test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "cal.h" 5 | #include "wiimote_driver.h" 6 | 7 | int main(int argc, char **argv) { 8 | struct frame_type frame; 9 | struct camera_control_block ccb; 10 | 11 | ccb.device.category = wiimote; 12 | /* ccb.mode = diagnostic; */ 13 | /* ccb.mode = operational_1dot; */ 14 | ccb.mode = operational_3dot; 15 | 16 | cal_init(&ccb); 17 | 18 | /* loop forever reading and printing results */ 19 | /* while (true) { */ 20 | /* cal_get_frame(&ccb, &frame); */ 21 | /* frame_print(frame); */ 22 | /* frame_free(&ccb, &frame); */ 23 | /* } */ 24 | 25 | int i; 26 | for(i=0; i<500; i++) { 27 | cal_get_frame(&ccb, &frame); 28 | frame_print(frame); 29 | frame_free(&ccb, &frame); 30 | ltr_int_usleep(10000); 31 | } 32 | 33 | /* call disconnects, turns all LEDs off */ 34 | cal_shutdown(&ccb); 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /src/tir.h: -------------------------------------------------------------------------------- 1 | #ifndef TIR__H 2 | #define TIR__H 3 | 4 | #include 5 | /* 6 | extern bool open_tir(const char data_path[], bool force_fw_load, bool ir_on); 7 | extern bool pause_tir(); 8 | extern bool resume_tir(); 9 | extern bool read_frame(); 10 | extern bool close_tir(); 11 | extern void get_tir_info(); 12 | extern void switch_green(bool state); 13 | extern void switch_blue(bool state); 14 | extern void switch_reb(bool state); 15 | extern void switch_ir(bool state); 16 | */ 17 | #endif 18 | -------------------------------------------------------------------------------- /src/tir.sym: -------------------------------------------------------------------------------- 1 | ltr_int_rl_run 2 | ltr_int_rl_shutdown 3 | ltr_int_rl_suspend 4 | ltr_int_rl_wakeup 5 | ltr_int_tir_found 6 | -------------------------------------------------------------------------------- /src/tir_driver.h: -------------------------------------------------------------------------------- 1 | #ifndef TIR_DRIVER__H 2 | #define TIR_DRIVER__H 3 | 4 | #include "cal.h" 5 | #include "tir.h" 6 | 7 | int ltr_int_tir_found(bool *have_firmware, bool *have_permissions); 8 | 9 | int ltr_int_tracker_init(struct camera_control_block *ccb); 10 | int ltr_int_tracker_get_frame(struct camera_control_block *ccb, struct frame_type *f, 11 | bool *frame_acquired); 12 | int ltr_int_tracker_pause(); 13 | int ltr_int_tracker_resume(); 14 | int ltr_int_tracker_close(); 15 | 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /src/tir_driver_prefs.h: -------------------------------------------------------------------------------- 1 | #ifndef TIR_DRIVER_PREFS__H 2 | #define TIR_DRIVER_PREFS__H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | bool ltr_int_tir_init_prefs(); 11 | 12 | int ltr_int_tir_get_max_blob(); 13 | bool ltr_int_tir_set_max_blob(int val); 14 | 15 | int ltr_int_tir_get_min_blob(); 16 | bool ltr_int_tir_set_min_blob(int val); 17 | 18 | int ltr_int_tir_get_status_brightness(); 19 | bool ltr_int_tir_set_status_brightness(int val); 20 | 21 | int ltr_int_tir_get_ir_brightness(); 22 | bool ltr_int_tir_set_ir_brightness(int val); 23 | 24 | int ltr_int_tir_get_threshold(); 25 | bool ltr_int_tir_set_threshold(int val); 26 | 27 | bool ltr_int_tir_get_status_indication(); 28 | bool ltr_int_tir_set_status_indication(bool ind); 29 | 30 | bool ltr_int_tir_set_use_grayscale(bool gs); 31 | bool ltr_int_tir_get_use_grayscale(); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | 37 | #endif -------------------------------------------------------------------------------- /src/tir_hw.h: -------------------------------------------------------------------------------- 1 | #ifndef TIRHW__H 2 | #define TIRHW__H 3 | 4 | #include 5 | #include "usb_ifc.h" 6 | 7 | #define TIR_LED_RED 0x10 8 | #define TIR_LED_GREEN 0x20 9 | #define TIR_LED_BLUE 0x40 10 | #define TIR_LED_IR 0x80 11 | 12 | #define TIR_PACKET_SIZE 16384 13 | extern unsigned char ltr_int_packet[TIR_PACKET_SIZE]; 14 | 15 | typedef struct { 16 | //Width and height of image TIRx sees 17 | unsigned int width; 18 | unsigned int height; 19 | //height squash factor - TIR4 has width upsampled by factor of 2, 20 | // and this is the compensation factor 21 | float hf; 22 | dev_found dev_type; 23 | }tir_info; 24 | 25 | void ltr_int_get_tir_info(tir_info *info); 26 | char *ltr_int_find_firmware(dev_found device); 27 | extern int ltr_int_data_in_ep; 28 | 29 | typedef bool (*stop_camera_tir_fun)(); 30 | typedef bool (*start_camera_tir_fun)(); 31 | typedef bool (*init_camera_tir_fun)(bool force_fw_load, bool p_ir_on); 32 | typedef void (*get_tir_info_fun)(tir_info *info); 33 | typedef bool (*close_camera_tir_fun)(); 34 | typedef bool (*set_status_led_tir_fun)(bool state); 35 | 36 | typedef struct { 37 | stop_camera_tir_fun stop_camera_tir; 38 | start_camera_tir_fun start_camera_tir; 39 | init_camera_tir_fun init_camera_tir; 40 | close_camera_tir_fun close_camera_tir; 41 | get_tir_info_fun get_tir_info; 42 | set_status_led_tir_fun set_status_led_tir; 43 | } tir_interface; 44 | 45 | 46 | bool ltr_int_open_tir(bool force_fw_load, bool ir_on); 47 | void ltr_int_get_tir_info(tir_info *info); 48 | bool ltr_int_pause_tir(); 49 | bool ltr_int_resume_tir(); 50 | bool ltr_int_close_tir(); 51 | bool ltr_int_set_threshold_tir(unsigned int val); 52 | 53 | void ltr_int_send_sn4_data(uint8_t data[], size_t length); 54 | 55 | #endif 56 | 57 | -------------------------------------------------------------------------------- /src/tir_img.h: -------------------------------------------------------------------------------- 1 | #ifndef TIR_IMG__H 2 | #define TIR_IMG__H 3 | 4 | #include "list.h" 5 | #include "image_process.h" 6 | #include "tir_hw.h" 7 | 8 | int ltr_int_read_blobs_tir(struct bloblist_type *blt, int min, int max, image_t *img, tir_info *info); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /src/tracking.h: -------------------------------------------------------------------------------- 1 | #ifndef TRACKING__H 2 | #define TRACKING__H 3 | 4 | #include 5 | #include "cal.h" 6 | #include "ltlib.h" 7 | #include "axis.h" 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | /* Coding: 14 | bit0 (lsb) - invert camera X values 15 | bit1 - invert camera Y values 16 | bit2 - switch X and Y values (applied first!) 17 | bit4 - invert pitch, roll, X and Z translations (for tracking from behind) 18 | */ 19 | enum ORIENTATION {ORIENT_NOP = 0, ORIENT_FLIP_X = 1, ORIENT_FLIP_Y = 2, 20 | ORIENT_XCHG_XY = 4, ORIENT_FROM_BEHIND = 8}; 21 | 22 | 23 | //extern linuxtrack_pose_t ltr_int_orig_pose; 24 | 25 | bool ltr_int_init_tracking(); 26 | int ltr_int_update_pose(struct frame_type *frame); 27 | int ltr_int_recenter_tracking(); 28 | int ltr_int_tracking_get_pose(linuxtrack_full_pose_t *pose); 29 | bool ltr_int_postprocess_axes(ltr_axes_t axes, linuxtrack_pose_t *pose, linuxtrack_pose_t *unfiltered); 30 | /* 31 | double ltr_int_nonlinfilt(double x, 32 | double y_minus_1, 33 | double filtfactor); 34 | 35 | void ltr_int_nonlinfilt_vec(double x[3], 36 | double y_minus_1[3], 37 | double filtfactor[3], 38 | double res[3]); 39 | */ 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef UTILS__H 2 | #define UTILS__H 3 | 4 | #ifndef _GNU_SOURCE 5 | #define _GNU_SOURCE 6 | #endif 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | #ifndef LIBLINUXTRACK_SRC 17 | #define LIBLINUXTRACK_PRIVATE 18 | #else 19 | #define LIBLINUXTRACK_PRIVATE static 20 | #endif 21 | 22 | LIBLINUXTRACK_PRIVATE void* ltr_int_my_malloc(size_t size); 23 | LIBLINUXTRACK_PRIVATE char* ltr_int_my_strdup(const char* s); 24 | LIBLINUXTRACK_PRIVATE void ltr_int_log_message(const char *format, ...); 25 | LIBLINUXTRACK_PRIVATE void ltr_int_valog_message(const char *format, va_list va); 26 | const char *ltr_int_get_logfile_name(void); 27 | void ltr_int_strlower(char *s); 28 | LIBLINUXTRACK_PRIVATE char *ltr_int_my_strcat(const char *str1, const char *str2); 29 | LIBLINUXTRACK_PRIVATE char *ltr_int_get_default_file_name(const char *fname); 30 | LIBLINUXTRACK_PRIVATE char *ltr_int_get_app_path(const char *suffix); 31 | char *ltr_int_get_data_path_prefix(const char *data, const char *prefix); 32 | char *ltr_int_get_data_path(const char *data); 33 | char *ltr_int_get_lib_path(const char *libname); 34 | char *ltr_int_get_resource_path(const char *section, const char *rsrc); 35 | void ltr_int_my_perror(const char *str); 36 | 37 | typedef enum {DBG_CHECK, DBG_ON, DBG_OFF} dbg_flag_type; 38 | dbg_flag_type ltr_int_get_dbg_flag(const int flag); 39 | void ltr_int_usleep(unsigned int usec); 40 | void ltr_int_check_root(); 41 | int ltr_int_get_ts(); 42 | int ltr_int_ts_diff(int ts1, int ts2); 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/wc_driver_prefs.h: -------------------------------------------------------------------------------- 1 | #ifndef WC_DRIVER_PREFS__H 2 | #define WC_DRIVER_PREFS__H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | bool ltr_int_wc_init_prefs(); 11 | void ltr_int_wc_close_prefs(); 12 | 13 | int ltr_int_wc_get_max_blob(); 14 | bool ltr_int_wc_set_max_blob(int val); 15 | 16 | int ltr_int_wc_get_min_blob(); 17 | bool ltr_int_wc_set_min_blob(int val); 18 | 19 | int ltr_int_wc_get_threshold(); 20 | bool ltr_int_wc_set_threshold(int val); 21 | 22 | const char *ltr_int_wc_get_id(); 23 | 24 | const char *ltr_int_wc_get_pixfmt(); 25 | bool ltr_int_wc_set_pixfmt(const char *fmt); 26 | 27 | bool ltr_int_wc_get_resolution(int *x, int *y); 28 | bool ltr_int_wc_set_resolution(int x, int y); 29 | 30 | bool ltr_int_wc_get_fps(int *num, int *den); 31 | bool ltr_int_wc_set_fps(int num, int den); 32 | 33 | bool ltr_int_wc_get_flip(); 34 | bool ltr_int_wc_set_flip(bool new_flip); 35 | 36 | const char *ltr_int_wc_get_cascade(); 37 | bool ltr_int_wc_set_cascade(const char *new_cascade); 38 | 39 | float ltr_int_wc_get_eff(); 40 | bool ltr_int_wc_set_eff(float new_eff); 41 | 42 | int ltr_int_wc_get_optim_level(); 43 | bool ltr_int_wc_set_optim_level(int opt); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/webcam_driver.h: -------------------------------------------------------------------------------- 1 | #ifndef WEBCAM_DRIVER__H 2 | #define WEBCAM_DRIVER__H 3 | 4 | #include 5 | #include "cal.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | int ltr_int_tracker_init(struct camera_control_block *ccb); 12 | int ltr_int_tracker_shutdown(); 13 | int ltr_int_tracker_suspend(); 14 | int ltr_int_tracker_wakeup(); 15 | int ltr_int_tracker_get_frame(struct camera_control_block *ccb, struct frame_type *f, 16 | bool *frame_acquired); 17 | 18 | extern dev_interface ltr_int_webcam_interface; 19 | 20 | 21 | typedef struct{ 22 | int i; //index into pixel format table 23 | uint32_t fourcc; 24 | int w; 25 | int h; 26 | int fps_num, fps_den; 27 | } webcam_format; 28 | 29 | typedef struct{ 30 | char **fmt_strings; //Format table 31 | webcam_format *formats; 32 | int entries; 33 | } webcam_formats; 34 | 35 | int ltr_int_enum_webcams(char **ids[]); 36 | int ltr_int_enum_webcam_formats(const char *id, webcam_formats *formats); 37 | int ltr_int_enum_webcam_formats_cleanup(webcam_formats *all_formats); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/webcam_driver.sym: -------------------------------------------------------------------------------- 1 | ltr_int_enum_webcams 2 | ltr_int_enum_webcam_formats 3 | ltr_int_enum_webcam_formats_cleanup 4 | ltr_int_rl_run 5 | ltr_int_rl_shutdown 6 | ltr_int_rl_suspend 7 | ltr_int_rl_wakeup 8 | -------------------------------------------------------------------------------- /src/wii_com.h: -------------------------------------------------------------------------------- 1 | #ifndef WIICOM__H 2 | #define WIICOM__H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | bool ltr_int_initWiiCom(bool isServer, struct mmap_s **mmm_p); 11 | void ltr_int_closeWiiCom(); 12 | void ltr_int_pauseWii(); 13 | void ltr_int_resumeWii(); 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /src/wii_driver_prefs.h: -------------------------------------------------------------------------------- 1 | #ifndef WII_DRIVER_PREFS__H 2 | #define WII_DRIVER_PREFS__H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | bool ltr_int_wii_init_prefs(); 11 | bool ltr_int_get_run_indication(bool *d1, bool *d2, bool *d3, bool *d4); 12 | bool ltr_int_set_run_indication(bool d1, bool d2, bool d3, bool d4); 13 | bool ltr_int_get_pause_indication(bool *d1, bool *d2, bool *d3, bool *d4); 14 | bool ltr_int_set_pause_indication(bool d1, bool d2, bool d3, bool d4); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif -------------------------------------------------------------------------------- /src/wii_server.1: -------------------------------------------------------------------------------- 1 | .TH wii_server 1 "22 January 2011" 2 | .IX wii_server 3 | .SH NAME 4 | wii_server - facilitating connection to the wiimote 5 | .SH SYNOPSYS 6 | .B wii_server 7 | .SH DESCRIPTION 8 | wii_server is a helper executable, allowing you to pair wiimote only once, 9 | maintaining connection even when linuxtrack enabled software is not running 10 | at the moment. 11 | .SH USAGE 12 | Run wii_server, press Connect button and then press "1" and "2" on your 13 | wiimote simultaneously to put wiimote into discoverable mode. After a short 14 | while the wii_server should indicate success of the connection attempt. 15 | Wiimote indicates successfull connection by blinking one of LEDs about once 16 | every five seconds. 17 | 18 | -------------------------------------------------------------------------------- /src/wii_server/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "wii_server.h" 8 | 9 | int main(int argc, char *argv[]) 10 | { 11 | ltr_int_check_root(); 12 | ltr_int_log_message("Starting Wiimote server!\n"); 13 | setenv("LC_ALL", "C", 1); 14 | setlocale(LC_ALL, "C"); 15 | QLocale::setDefault(QLocale::c()); 16 | QApplication app(argc, argv); 17 | WiiServerWindow win; 18 | win.show(); 19 | return app.exec(); 20 | } 21 | 22 | -------------------------------------------------------------------------------- /src/wii_server/precomp_headers.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | -------------------------------------------------------------------------------- /src/wii_server/wii_server.h: -------------------------------------------------------------------------------- 1 | #ifndef WII_SERVER__H 2 | #define WII_SERVER__H 3 | 4 | #ifdef HAVE_CONFIG_H 5 | #include "../../config.h" 6 | #endif 7 | 8 | #include 9 | #include 10 | #include "wiimote.h" 11 | #include "ui_wii_server.h" 12 | 13 | class QTimer; 14 | 15 | class WiiServerWindow : public QWidget 16 | { 17 | Q_OBJECT 18 | public: 19 | WiiServerWindow(QWidget *parent = 0); 20 | ~WiiServerWindow(); 21 | signals: 22 | void connect(); 23 | void disconnect(); 24 | void pause(int); 25 | void wakeup(int); 26 | void stop(); 27 | private slots: 28 | void on_ConnectButton_pressed(); 29 | void handle_command(); 30 | private: 31 | Ui::WiiServer ui; 32 | Wiimote *wii; 33 | WiiThread *thread; 34 | QTimer *cmdTimer; 35 | struct mmap_s *mm; 36 | command_t old_cmd; 37 | private slots: 38 | void update_state(server_state_t server_state); 39 | }; 40 | 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/wii_server/wii_server.pro.in: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # Automatically generated by qmake (2.01a) Sat Jul 9 20:54:06 2011 3 | ###################################################################### 4 | 5 | #CONFIG += qt debug warn_on precompile_header 6 | CONFIG += qt debug warn_on 7 | TEMPLATE = app 8 | TARGET = wii_server 9 | DEPENDPATH += . 10 | INCLUDEPATH += . 11 | INCLUDEPATH += .. 12 | INCLUDEPATH += ./.. 13 | INCLUDEPATH += @srcdir@/.. 14 | VPATH = @srcdir@ 15 | RESOURCES = wii_server.qrc 16 | contains(QT_VERSION, ^5.*){ 17 | QT += widgets 18 | } 19 | 20 | # Input 21 | FORMS += wii_server.ui 22 | SOURCES += main.cpp wii_server.cpp wiimote.cpp 23 | HEADERS += wii_server.h wiimote.h ../wii_com.h ../com_proc.h ../image_process.h 24 | 25 | #PRECOMPILED_HEADER = precomp_headers.h 26 | 27 | QMAKE_CXXFLAGS += -DHAVE_CONFIG_H 28 | 29 | QMAKE_CXXFLAGS += $$(CXXFLAGS) 30 | QMAKE_CFLAGS += $$(CFLAGS) 31 | QMAKE_LFLAGS += $$(LDFLAGS) 32 | 33 | unix:!macx { 34 | QMAKE_CXXFLAGS += -fvisibility=hidden -O2 -Wall -Wextra -Wformat -Wformat-security \ 35 | --param ssp-buffer-size=4 -fstack-protector -D_FORTIFY_SOURCE=2 36 | QMAKE_CFLAGS += -fvisibility=hidden -O2 -Wall -Wextra -Wformat -Wformat-security \ 37 | --param ssp-buffer-size=4 -fstack-protector -D_FORTIFY_SOURCE=2 38 | LIBS += "-L../.libs" "-L$${LIBDIR}" -lm -lltr -lcwiid\ 39 | "-Wl,-rpath,$${LIBDIR}" 40 | 41 | target.path = @prefix@/bin 42 | INSTALLS += target 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/wii_server/wii_server.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | ../linuxtrack-wii.svg 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/wii_server/wii_server.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | WiiServer 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 94 11 | 12 | 13 | 14 | Wiiserver 15 | 16 | 17 | 18 | :/newPrefix/linuxtrack-wii.svg:/newPrefix/linuxtrack-wii.svg 19 | 20 | 21 | 22 | 23 | 24 | Disconnected 25 | 26 | 27 | false 28 | 29 | 30 | Qt::AlignCenter 31 | 32 | 33 | 34 | 35 | 36 | 37 | Connect 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/wii_server/wiimote.h: -------------------------------------------------------------------------------- 1 | #ifndef WIIMOTE__H 2 | #define WIIMOTE__H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class WiiThread : public QThread 9 | { 10 | Q_OBJECT 11 | public: 12 | void run(); 13 | void stop_it(); 14 | void pass_ir_data(struct cwiid_ir_src *data); 15 | signals: 16 | void change_state(int state); 17 | public slots: 18 | void pause(int indication); 19 | void wakeup(int indication); 20 | void stop(); 21 | private: 22 | void idle(); 23 | bool exit_flag; 24 | cwiid_wiimote_t *gWiimote; 25 | bdaddr_t bdaddr; 26 | int idle_cntr; 27 | uint8_t idle_sig; 28 | bool isIdle; 29 | }; 30 | 31 | 32 | typedef enum {WII_DISCONNECTED, WII_CONNECTING, WII_CONNECTED} server_state_t; 33 | 34 | class Wiimote : public QObject 35 | { 36 | Q_OBJECT 37 | public: 38 | Wiimote(struct mmap_s *m); 39 | ~Wiimote(); 40 | server_state_t get_wii_state() const {return server_state;}; 41 | signals: 42 | void changing_state(server_state_t state); 43 | void pause(int indication); 44 | void wakeup(int indication); 45 | void stop(); 46 | public slots: 47 | void connect(void); 48 | void disconnect(void); 49 | void changed_state(int state); 50 | private: 51 | server_state_t server_state; 52 | WiiThread *thread; 53 | }; 54 | 55 | #endif 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/wiimote_driver.h: -------------------------------------------------------------------------------- 1 | #ifndef WIIMOTE_DRIVER__H 2 | #define WIIMOTE_DRIVER__H 3 | 4 | #include 5 | #include "cal.h" 6 | 7 | /********************/ 8 | /* public constants */ 9 | /********************/ 10 | 11 | /* image width and height */ 12 | #define WIIMOTE_HORIZONTAL_RESOLUTION 1024 13 | #define WIIMOTE_VERTICAL_RESOLUTION 768 14 | 15 | /*********************/ 16 | /* public data types */ 17 | /*********************/ 18 | /* none */ 19 | 20 | /******************************/ 21 | /* public function prototypes */ 22 | /******************************/ 23 | /* call to init an uninitialized wiimote device 24 | * typically called once at setup 25 | * turns the IR leds on 26 | * this function may block for up to 3 seconds 27 | * a return value < 0 indicates error */ 28 | int ltr_int_tracker_init(struct camera_control_block *ccb); 29 | 30 | /* call to shutdown the wiimote device 31 | * typically called once at close 32 | * turns the IR leds off 33 | * can be used to deactivate the wiimote; 34 | * must call init to restart 35 | * a return value < 0 indicates error */ 36 | int ltr_int_tracker_shutdown(); 37 | 38 | /* turn off all the leds, and flush the queue 39 | * a return value < 0 indicates error */ 40 | int ltr_int_tracker_suspend(); 41 | 42 | /* unsuspend the currently suspended (and inited) 43 | * camera device. 44 | * IR leds will reactivate, but that is all 45 | * a return value < 0 indicates error */ 46 | int ltr_int_tracker_wakeup(); 47 | 48 | /* read the usb, and process it into frames 49 | * a return value < 0 indicates error */ 50 | int ltr_int_tracker_get_frame(struct camera_control_block *ccb, 51 | struct frame_type *f, bool *frame_acquired); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/wine_bridge/README.wine: -------------------------------------------------------------------------------- 1 | Linuxtrack - wine bridge 2 | ------------------------ 3 | At the moment this is only experimental thing! 4 | To compile the package, following prerequisities must be met: 5 | - Wine installed, along with development files (winegcc/wineg++ available) 6 | - libmxml installed for dumper (not mandatory) 7 | - Nullsoft installator compiler (makensis available) 8 | 9 | To build it, specify --enable-wine-plugin to the linuxtrack configure command. 10 | 11 | Make sure to install it in each of the wine "prefixes" you need the linuxtrack support in. 12 | 13 | Dumper is to be used to dump new application data; go to the NaturalPoint site, and look for Game Updates. 14 | Download the latest update and unpack it somewhere. Then take the sgl.dat contained in the archive, 15 | copy it next to the dumper and run dumper using 'dumper sgl.dat > data.txt'(no need for wine there, it is native 16 | linux app). Resulting file data.txt is to be copied in the linuxtrack support directory. 17 | 18 | Controller allows you to controll the tracking using keyboard (no joystick support); just run it, select keys 19 | to controll the actions (press button, then a key). No Ctrl/Shift/Alt is taken into account - the first 20 | key to be pressed is used. 21 | 22 | Tester is used to check how the link works. Write an application number (from data.txt) and after 23 | pressing start, the link is activated and you should see the numbers moving... 24 | 25 | If you have any questions, reach me through http://linuxtrack.eu or the google code project page... 26 | 27 | -------------------------------------------------------------------------------- /src/wine_bridge/client/NPClient.h: -------------------------------------------------------------------------------- 1 | 2 | extern int NP_RegisterWindowHandle (HWND hwnd); 3 | extern int NP_UnregisterWindowHandle (void); 4 | extern int NP_RegisterProgramProfileID (unsigned short id); 5 | extern int NP_QueryVersion (unsigned short *version); 6 | extern int NP_RequestData (unsigned short req); 7 | extern int NP_GetSignature (tir_signature_t *sig); 8 | extern int NP_GetData (tir_data_t *data); 9 | extern int NP_GetParameter (void); 10 | extern int NP_SetParameter (void); 11 | extern int NP_StartCursor (void); 12 | extern int NP_StopCursor (void); 13 | extern int NP_ReCenter (void); 14 | extern int NP_StartDataTransmission (void); 15 | extern int NP_StopDataTransmission (void); 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/wine_bridge/client/NPClient.spec: -------------------------------------------------------------------------------- 1 | # Generated from NPClient.dll by winedump 2 | 3 | 1 stub NPPriv_ClientNotify 4 | 2 stub NPPriv_GetLastError 5 | 3 stub NPPriv_SetData 6 | 4 stub NPPriv_SetLastError 7 | 5 stub NPPriv_SetParameter 8 | 6 stub NPPriv_SetSignature 9 | 7 stub NPPriv_SetVersion 10 | 8 stdcall NP_GetData( ptr ) NPCLIENT_NP_GetData 11 | 9 stdcall NP_GetParameter( long long) NPCLIENT_NP_GetParameter 12 | 10 stdcall NP_GetSignature( ptr ) NPCLIENT_NP_GetSignature 13 | 11 stdcall NP_QueryVersion( ptr ) NPCLIENT_NP_QueryVersion 14 | 12 stdcall NP_ReCenter() NPCLIENT_NP_ReCenter 15 | 13 stdcall NP_RegisterProgramProfileID( long ) NPCLIENT_NP_RegisterProgramProfileID 16 | 14 stdcall NP_RegisterWindowHandle( ptr ) NPCLIENT_NP_RegisterWindowHandle 17 | 15 stdcall NP_RequestData( long ) NPCLIENT_NP_RequestData 18 | 16 stdcall NP_SetParameter( long long ) NPCLIENT_NP_SetParameter 19 | 17 stdcall NP_StartCursor() NPCLIENT_NP_StartCursor 20 | 18 stdcall NP_StartDataTransmission() NPCLIENT_NP_StartDataTransmission 21 | 19 stdcall NP_StopCursor() NPCLIENT_NP_StopCursor 22 | 20 stdcall NP_StopDataTransmission() NPCLIENT_NP_StopDataTransmission 23 | 21 stdcall NP_UnregisterWindowHandle() NPCLIENT_NP_UnregisterWindowHandle 24 | -------------------------------------------------------------------------------- /src/wine_bridge/client/NPClient_dll.h: -------------------------------------------------------------------------------- 1 | /* 2 | * NPClient.dll 3 | * 4 | * Generated from NPClient.dll by winedump. 5 | * 6 | * DO NOT SEND GENERATED DLLS FOR INCLUSION INTO WINE ! 7 | * 8 | */ 9 | #ifndef __WINE_NPCLIENT_DLL_H 10 | #define __WINE_NPCLIENT_DLL_H 11 | 12 | #include "windef.h" 13 | #include "wine/debug.h" 14 | #include "winbase.h" 15 | #include "winnt.h" 16 | 17 | #pragma pack(1) 18 | typedef struct tir_data{ 19 | short status; 20 | short frame; 21 | unsigned int cksum; 22 | float roll, pitch, yaw; 23 | float tx, ty, tz; 24 | float padding[9]; 25 | } tir_data_t; 26 | 27 | typedef struct tir_signature{ 28 | char DllSignature[200]; 29 | char AppSignature[200]; 30 | } tir_signature_t; 31 | #pragma pack(0) 32 | 33 | 34 | /* __stdcall NPCLIENT_NPPriv_ClientNotify(); */ 35 | /* __stdcall NPCLIENT_NPPriv_GetLastError(); */ 36 | /* __stdcall NPCLIENT_NPPriv_SetData(); */ 37 | /* __stdcall NPCLIENT_NPPriv_SetLastError(); */ 38 | /* __stdcall NPCLIENT_NPPriv_SetParameter(); */ 39 | /* __stdcall NPCLIENT_NPPriv_SetSignature(); */ 40 | /* __stdcall NPCLIENT_NPPriv_SetVersion(); */ 41 | int __stdcall NPCLIENT_NP_GetData(tir_data_t * data); 42 | int __stdcall NPCLIENT_NP_GetParameter(int arg0, int arg1); 43 | int __stdcall NPCLIENT_NP_GetSignature(tir_signature_t * sig); 44 | int __stdcall NPCLIENT_NP_QueryVersion(unsigned short * version); 45 | int __stdcall NPCLIENT_NP_ReCenter(void); 46 | int __stdcall NPCLIENT_NP_RegisterProgramProfileID(unsigned short id); 47 | int __stdcall NPCLIENT_NP_RegisterWindowHandle(HWND hwnd); 48 | int __stdcall NPCLIENT_NP_RequestData(unsigned short req); 49 | int __stdcall NPCLIENT_NP_SetParameter(int arg0, int arg1); 50 | int __stdcall NPCLIENT_NP_StartCursor(void); 51 | int __stdcall NPCLIENT_NP_StartDataTransmission(void); 52 | int __stdcall NPCLIENT_NP_StopCursor(void); 53 | int __stdcall NPCLIENT_NP_StopDataTransmission(void); 54 | int __stdcall NPCLIENT_NP_UnregisterWindowHandle(void); 55 | 56 | 57 | 58 | #endif /* __WINE_NPCLIENT_DLL_H */ 59 | -------------------------------------------------------------------------------- /src/wine_bridge/client/check_data.c: -------------------------------------------------------------------------------- 1 | #define WIN32_LEAN_AND_MEAN 2 | #include 3 | #include "rest.h" 4 | #include 5 | #include 6 | #include 7 | 8 | int main() 9 | { 10 | //signatures 11 | char verse1[200], verse2[200]; 12 | game_desc_t gd; 13 | if(game_data_get_desc(1001, &gd) && getSomeSeriousPoetry(verse1, verse2)){ 14 | //data available, all is OK 15 | }else{ 16 | MessageBox(NULL, 17 | "To fully utilize linuxtrack-wine,\ninstall the support data in ltr_gui!", 18 | "Linuxtrack-wine check", 19 | MB_OK); 20 | } 21 | char *home = getenv("HOME"); 22 | char *path1 = malloc(200 + strlen(home)); 23 | sprintf(path1, "%s/.config/linuxtrack/tir_firmware/TIRViews.dll", home); 24 | if(symlink(path1, "TIRViews.dll") != 0){ 25 | MessageBox(NULL, 26 | "Failed to create symlink to TIRViews.dll!\nSome games will not have headtracking available.", 27 | "Linuxtrack-wine check", 28 | MB_OK); 29 | } 30 | sprintf(path1, "%s/.config/linuxtrack/tir_firmware/mfc42u.dll", home); 31 | if(symlink(path1, "mfc42u.dll") != 0){ 32 | MessageBox(NULL, 33 | "Failed to create symlink to mfc42u.dll!\n" 34 | "Try to install TIRViews support in ltr_gui,\n" 35 | "or install mfc42 into this bottle using winetricks.", 36 | "Linuxtrack-wine check", 37 | MB_OK); 38 | } 39 | return 0; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/wine_bridge/client/rest.h: -------------------------------------------------------------------------------- 1 | #ifndef REST__H 2 | #define REST__H 3 | 4 | #include 5 | #include 6 | typedef struct{const char *name; bool encrypted; uint32_t key1, key2;} game_desc_t; 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | bool game_data_get_desc(int id, game_desc_t *gd); 13 | bool getSomeSeriousPoetry(char *verse1, char *verse2); 14 | bool getDebugFlag(const int flag); 15 | char *file_path(const char *file); 16 | bool tryExclusiveLock(const char *file); 17 | bool sharedLock(const char *file); 18 | bool runFile(const char *file); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/wine_bridge/controller/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_SCRIPTS = 2 | if WINE_PLUGIN 3 | noinst_SCRIPTS += Controller.exe 4 | endif #WINE_PLUGIN 5 | 6 | if DARWIN 7 | LDFLAGS += -Wl,-no_arch_warnings 8 | else 9 | LDFLAGS += -Wl,--no-warn-search-mismatch 10 | endif 11 | 12 | CC = winegcc 13 | 14 | CXX = wineg++ 15 | 16 | .cpp.o : 17 | $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< 18 | 19 | .c.o : 20 | $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< 21 | 22 | .rc.o : 23 | wrc -o $@ $< 24 | 25 | CXXFLAGS_PRE = -isystem/usr/include/wine/windows -DHAVE_CONFIG_H \ 26 | -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ 27 | 28 | CFLAGS_PRE = -I../.. -I../../.. -DHAVE_CONFIG_H \ 29 | -I@srcdir@/../.. -I@top_builddir@ 30 | 31 | #VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ 32 | vpath %.h @srcdir@/../.. 33 | vpath %.h @top_builddir@ 34 | vpath %.c @srcdir@ 35 | vpath %.c @srcdir@/../.. 36 | 37 | Controller.exe : main.o resources.o dinput.o linuxtrack.o 38 | wineg++ -o Controller $(LDFLAGS) $(WINE_LIBS) -m32 \ 39 | $^ -lshell32 -ldxguid -ldinput -ldinput8 -luuid -ldl 40 | 41 | main.o : main.cpp @top_builddir@/config.h 42 | 43 | linuxtrack.o : linuxtrack.c linuxtrack.h config.h 44 | 45 | dinput.o : dinput.cpp kbi_interface.h 46 | 47 | resources.o : resources.rc 48 | 49 | 50 | clean-local: clean-local-check 51 | .PHONY: clean-local-check 52 | clean-local-check: 53 | rm -f *.exe* *.dll* *.sh *.o 54 | 55 | distclean-local: distclean-local-check 56 | .PHONY: distclean-local-check 57 | distclean-local-check: 58 | rm -f *.exe* *.dll* *.sh *.o 59 | 60 | EXTRA_DIST = linuxtrack1.ico linuxtrack.ico dinput.cpp kbi_interface.h \ 61 | main.cpp resource.h resources.rc 62 | 63 | -------------------------------------------------------------------------------- /src/wine_bridge/controller/kbi_interface.h: -------------------------------------------------------------------------------- 1 | #ifndef KBI_INTERFACE__H 2 | #define KBI_INTERFACE__H 3 | 4 | #include 5 | #include 6 | 7 | typedef enum {RECEIVING, DEF_PAUSE, DEF_RECENTER} state_t; 8 | 9 | //Implemented by client 10 | bool kbi_init(HWND hwnd); 11 | void kbi_close(void); 12 | const std::string &kbi_check(int num); 13 | void kbi_msg_loop(); 14 | void kbi_set_state(state_t s); 15 | 16 | //Implemented by server 17 | void set_names(const std::string pause_keys, const std::string recenter_keys); 18 | #endif 19 | -------------------------------------------------------------------------------- /src/wine_bridge/controller/linuxtrack.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/wine_bridge/controller/linuxtrack.ico -------------------------------------------------------------------------------- /src/wine_bridge/controller/linuxtrack1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/wine_bridge/controller/linuxtrack1.ico -------------------------------------------------------------------------------- /src/wine_bridge/controller/resource.h: -------------------------------------------------------------------------------- 1 | #ifndef IDC_STATIC 2 | #define IDC_STATIC (-1) 3 | #endif 4 | 5 | #define IDD_WINE_LTR_SERVEER 101 6 | #define IDQUIT 1002 7 | #define IDC_REDEFINE_PAUSE 1005 8 | #define IDC_REDEFINE_RECENTER 1006 9 | #define IDC_PAUSE_LABEL 1007 10 | #define IDC_RECENTER_LABEL 1008 11 | 12 | -------------------------------------------------------------------------------- /src/wine_bridge/controller/resources.rc: -------------------------------------------------------------------------------- 1 | 1001 ICON "linuxtrack1.ico" 2 | 1002 ICON "linuxtrack.ico" 3 | -------------------------------------------------------------------------------- /src/wine_bridge/ft_client/FreeTrackClient.spec: -------------------------------------------------------------------------------- 1 | # Generated from FreeTrackClient.dll by winedump 2 | 3 | 1 stdcall FTProvider() FREETRACKCLIENT_FTProvider 4 | 2 stdcall FTGetDllVersion() FREETRACKCLIENT_FTGetDllVersion 5 | 3 stdcall FTReportName( str ) FREETRACKCLIENT_FTReportName 6 | 4 stdcall FTGetData( ptr ) FREETRACKCLIENT_FTGetData 7 | -------------------------------------------------------------------------------- /src/wine_bridge/ft_client/FreeTrackClient_dll.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeTrackClient.dll 3 | * 4 | * Generated from FreeTrackClient.dll by winedump. 5 | * 6 | * DO NOT SEND GENERATED DLLS FOR INCLUSION INTO WINE ! 7 | * 8 | */ 9 | #ifndef __WINE_FREETRACKCLIENT_DLL_H 10 | #define __WINE_FREETRACKCLIENT_DLL_H 11 | 12 | #include "windef.h" 13 | #include "wine/debug.h" 14 | #include "winbase.h" 15 | #include "winnt.h" 16 | #include 17 | 18 | 19 | typedef struct 20 | { 21 | unsigned int dataID; 22 | int res_x; int res_y; 23 | float yaw; // positive yaw to the left 24 | float pitch;// positive pitch up 25 | float roll;// positive roll to the left 26 | float x; 27 | float y; 28 | float z; 29 | // raw pose with no smoothing, sensitivity, response curve etc. 30 | float ryaw; 31 | float rpitch; 32 | float rroll; 33 | float rx; 34 | float ry; 35 | float rz; 36 | // raw points, sorted by Y, origin top left corner 37 | float x0, y0; 38 | float x1, y1; 39 | float x2, y2; 40 | float x3, y3; 41 | }FreeTrackData; 42 | 43 | char * __stdcall FREETRACKCLIENT_FTProvider(void); 44 | char * __stdcall FREETRACKCLIENT_FTGetDllVersion(void); 45 | void __stdcall FREETRACKCLIENT_FTReportName(char * name); 46 | bool __stdcall FREETRACKCLIENT_FTGetData(FreeTrackData * data); 47 | 48 | 49 | 50 | #endif /* __WINE_FREETRACKCLIENT_DLL_H */ 51 | -------------------------------------------------------------------------------- /src/wine_bridge/ft_client/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_SCRIPTS = 2 | if WINE_PLUGIN 3 | noinst_SCRIPTS += FreeTrackClient.dll.so 4 | endif #WINE_PLUGIN 5 | 6 | if DARWIN 7 | LDFLAGS += -Wl,-no_arch_warnings 8 | else 9 | LDFLAGS += -Wl,--no-warn-search-mismatch 10 | endif 11 | 12 | CC = winegcc 13 | 14 | CXX = wineg++ 15 | 16 | SUFFIXES = .o .cpp .c .rc 17 | 18 | .cpp.o : 19 | $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< 20 | 21 | .c.o : 22 | $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< 23 | 24 | CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ 25 | CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ 26 | RCFLAGS = -I @srcdir@ 27 | #VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ 28 | vpath %.h @srcdir@/../.. 29 | vpath %.h @top_builddir@ 30 | vpath %.c @srcdir@ 31 | vpath %.c @srcdir@/../.. 32 | 33 | FreeTrackClient.dll.so : FreeTrackClient.spec FreeTrackClient_main.o linuxtrack.o 34 | winegcc $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra -g -o $@ -shared $^ -ldl 35 | 36 | FreeTrackClient_main.o : FreeTrackClient_main.c FreeTrackClient_dll.h 37 | 38 | linuxtrack.o : linuxtrack.c linuxtrack.h 39 | 40 | 41 | clean-local: clean-local-check 42 | .PHONY: clean-local-check 43 | clean-local-check: 44 | rm -f *.exe* *.dll* *.sh *.o 45 | 46 | distclean-local: distclean-local-check 47 | .PHONY: distclean-local-check 48 | distclean-local-check: 49 | rm -f *.exe* *.dll* *.sh *.o 50 | 51 | EXTRA_DIST = FreeTrackClient_main.c FreeTrackClient_dll.h \ 52 | FreeTrackClient.spec 53 | 54 | -------------------------------------------------------------------------------- /src/wine_bridge/ft_tester/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_SCRIPTS = 2 | if WINE_PLUGIN 3 | noinst_SCRIPTS += ftc.exe.so 4 | endif #WINE_PLUGIN 5 | 6 | if DARWIN 7 | LDFLAGS += -Wl,-no_arch_warnings 8 | else 9 | LDFLAGS += -Wl,--no-warn-search-mismatch 10 | endif 11 | 12 | CC = winegcc 13 | 14 | CXX = wineg++ 15 | 16 | SUFFIXES = .o .cpp .c .rc 17 | 18 | .cpp.o : 19 | $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< 20 | 21 | .c.o : 22 | $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< 23 | 24 | .rc.o : 25 | wrc -o $@ $(RCFLAGS) $< 26 | 27 | CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ 28 | CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ 29 | RCFLAGS = -I @srcdir@ 30 | #VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ 31 | vpath %.h @srcdir@/../.. 32 | vpath %.h @top_builddir@ 33 | vpath %.c @srcdir@ 34 | vpath %.c @srcdir@/../.. 35 | 36 | ftc.exe.so : main.o fttester.o 37 | wineg++ -g -o $@ -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ 38 | 39 | fttester.o : fttester.rc resource.h config.h 40 | 41 | main.o : main.cpp 42 | 43 | clean-local: clean-local-check 44 | .PHONY: clean-local-check 45 | clean-local-check: 46 | rm -f *.exe* *.dll* *.sh *.o 47 | 48 | distclean-local: distclean-local-check 49 | .PHONY: distclean-local-check 50 | distclean-local-check: 51 | rm -f *.exe* *.dll* *.sh *.o 52 | 53 | EXTRA_DIST = resource.h main.cpp 54 | 55 | -------------------------------------------------------------------------------- /src/wine_bridge/ft_tester/resource.h: -------------------------------------------------------------------------------- 1 | #ifndef IDC_STATIC 2 | #define IDC_STATIC (-1) 3 | #endif 4 | 5 | #define IDD_DIALOG1 100 6 | #define IDQUIT 1002 7 | #define IDC_YAW 1005 8 | #define IDC_PITCH 1023 9 | #define IDC_ROLL 1024 10 | #define IDC_X 1025 11 | #define IDC_Y 1026 12 | #define IDC_Z 1027 13 | #define IDC_RYAW 1028 14 | #define IDC_RPITCH 1029 15 | #define IDC_RROLL 1030 16 | #define IDC_RX 1031 17 | #define IDC_RY 1032 18 | #define IDC_RZ 1033 19 | #define IDC_NUM 1034 20 | #define IDC_RES 1035 21 | #define IDC_PT0 1036 22 | #define IDC_PT1 1037 23 | #define IDC_PT2 1038 24 | #define IDC_PT3 1039 25 | #define IDC_START 1040 26 | #define IDC_TITLE 1041 27 | 28 | -------------------------------------------------------------------------------- /src/wine_bridge/linuxtrack.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/wine_bridge/linuxtrack.ico -------------------------------------------------------------------------------- /src/wine_bridge/linuxtrack1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uglyDwarf/linuxtrack/205f8d65107059061645f9c1a3c7a2c5828383d5/src/wine_bridge/linuxtrack1.ico -------------------------------------------------------------------------------- /src/wine_bridge/tester/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_SCRIPTS = 2 | if WINE_PLUGIN 3 | noinst_SCRIPTS += Tester.exe 4 | if WINE64 5 | noinst_SCRIPTS += Tester64.exe 6 | endif #WINE64 7 | endif #WINE_PLUGIN 8 | 9 | if DARWIN 10 | LDFLAGS += -Wl,-no_arch_warnings 11 | else 12 | LDFLAGS += -Wl,--no-warn-search-mismatch 13 | endif 14 | 15 | CC = winegcc 16 | 17 | CXX = wineg++ 18 | 19 | SUFFIXES = .o .cpp .c .rc 64.o 20 | 21 | .cpp.o : 22 | $(CXX) -c $(CXXFLAGS) -m32 -o $@ $< 23 | 24 | .c.o : 25 | $(CC) -c $(CFLAGS) -m32 -o $@ $< 26 | 27 | .cpp64.o : 28 | $(CXX) -c $(CXXFLAGS) -o $@ $< 29 | 30 | .c64.o : 31 | $(CC) -c $(CFLAGS) -o $@ $< 32 | 33 | .rc.o : 34 | wrc -o $@ $(RCFLAGS) $< 35 | 36 | CXXFLAGS += -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ 37 | CFLAGS += -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ 38 | RCFLAGS = -I @srcdir@ 39 | #VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ 40 | vpath %.h @srcdir@/../.. 41 | vpath %.h @top_builddir@ 42 | vpath %.c @srcdir@ 43 | vpath %.c @srcdir@/../.. 44 | 45 | 46 | Tester64.exe : main64.o rest64.o npifc64.o npview.o 47 | wineg++ -g -o Tester64 -L. $(WINE64_LIBS) $(LDFLAGS) -Wall -Wextra $^ 48 | 49 | Tester.exe : main.o npview.o rest.o npifc.o 50 | wineg++ -g -o Tester -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ 51 | 52 | main.o : main.cpp Makefile 53 | 54 | main64.o : main.cpp Makefile 55 | 56 | npview.o : npview.rc 57 | 58 | rest.o : rest.c rest.h Makefile 59 | 60 | rest64.o : rest.c rest.h Makefile 61 | 62 | npifc.o : npifc.c npifc.h Makefile 63 | 64 | npifc64.o : CFLAGS+="-DFOR_WIN64=1" 65 | npifc64.o : npifc.c npifc.h Makefile 66 | 67 | clean-local: clean-local-check 68 | .PHONY: clean-local-check 69 | clean-local-check: 70 | rm -f *.exe* *.dll* *.sh *.o 71 | 72 | distclean-local: distclean-local-check 73 | .PHONY: distclean-local-check 74 | distclean-local-check: 75 | rm -f *.exe* *.dll* *.sh *.o 76 | 77 | EXTRA_DIST = main.cpp npifc.c npifc.h resource.h rest.c rest.h 78 | 79 | -------------------------------------------------------------------------------- /src/wine_bridge/tester/resource.h: -------------------------------------------------------------------------------- 1 | #ifndef IDC_STATIC 2 | #define IDC_STATIC (-1) 3 | #endif 4 | 5 | #define IDD_DIALOG1 100 6 | #define IDQUIT 1002 7 | #define IDSTART 1003 8 | #define IDC_APPID 1016 9 | #define IDC_PITCH 1017 10 | #define IDC_YAW 1018 11 | #define IDC_ROLL 1019 12 | #define IDC_X1 1020 13 | #define IDC_X2 1021 14 | #define IDC_X3 1022 15 | #define IDC_Y1 1023 16 | #define IDC_Y2 1024 17 | #define IDC_Y3 1025 18 | #define IDC_Z1 1026 19 | #define IDC_Z2 1027 20 | #define IDC_Z3 1028 21 | #define IDC_S 1029 22 | #define IDC_F 1030 23 | 24 | -------------------------------------------------------------------------------- /src/wine_bridge/tester/rest.c: -------------------------------------------------------------------------------- 1 | ../client/rest.c -------------------------------------------------------------------------------- /src/wine_bridge/tester/rest.h: -------------------------------------------------------------------------------- 1 | ../client/rest.h -------------------------------------------------------------------------------- /src/wine_bridge/views/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_SCRIPTS = 2 | if WINE_PLUGIN 3 | noinst_SCRIPTS += TrackIR.exe 4 | endif #WINE_PLUGIN 5 | 6 | if DARWIN 7 | LDFLAGS += -Wl,-no_arch_warnings 8 | else 9 | LDFLAGS += -Wl,--no-warn-search-mismatch 10 | endif 11 | 12 | CC = winegcc 13 | 14 | CXX = wineg++ 15 | 16 | SUFFIXES = .o .cpp .c .rc 64.o 17 | 18 | .cpp.o : 19 | $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< 20 | 21 | .c.o : 22 | $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< 23 | 24 | .cpp64.o : 25 | $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -o $@ $< 26 | 27 | .c64.o : 28 | $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -o $@ $< 29 | 30 | .rc.o : 31 | wrc -o $@ $(RCFLAGS) $< 32 | 33 | CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ 34 | CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ 35 | RCFLAGS = -I @srcdir@ 36 | #VPATH = .:../..:@srcdir@/../..:@top_builddir@:@srcdir@ 37 | vpath %.h @srcdir@/../.. 38 | vpath %.h @top_builddir@ 39 | vpath %.c @srcdir@ 40 | vpath %.c @srcdir@/../.. 41 | 42 | TrackIR.exe : main.o rest.o 43 | $(CXX) $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra -g -o $@ $^ 44 | 45 | main.o : main.cpp resource.h 46 | 47 | rest.o : rest.c rest.h 48 | 49 | clean-local: clean-local-check 50 | .PHONY: clean-local-check 51 | clean-local-check: 52 | rm -f *.exe* *.dll* *.sh *.o 53 | 54 | distclean-local: distclean-local-check 55 | .PHONY: distclean-local-check 56 | distclean-local-check: 57 | rm -f *.exe* *.dll* *.sh *.o 58 | 59 | EXTRA_DIST = main.cpp resource.h rest.c rest.h 60 | 61 | -------------------------------------------------------------------------------- /src/wine_bridge/views/resource.h: -------------------------------------------------------------------------------- 1 | #ifndef IDC_STATIC 2 | #define IDC_STATIC (-1) 3 | #endif 4 | 5 | #define IDD_DIALOG1 100 6 | #define IDQUIT 1002 7 | 8 | -------------------------------------------------------------------------------- /src/wine_bridge/views/rest.c: -------------------------------------------------------------------------------- 1 | ../client/rest.c -------------------------------------------------------------------------------- /src/wine_bridge/views/rest.h: -------------------------------------------------------------------------------- 1 | ../client/rest.h -------------------------------------------------------------------------------- /src/xlinuxtrack.sym: -------------------------------------------------------------------------------- 1 | XPluginStart 2 | XPluginStop 3 | XPluginDisable 4 | XPluginEnable 5 | XPluginReceiveMessage 6 | -------------------------------------------------------------------------------- /src/xlinuxtrack_pref.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "utils.h" 6 | 7 | enum pref_id {START_STOP, PAUSE}; 8 | struct pref; 9 | 10 | char *xltr_get_pref_file_name(); 11 | void xltr_print_pref(struct pref *p); 12 | bool xltr_read_pref(char *fname, struct pref *p); 13 | bool xltr_save_pref(char *fname, struct pref *p); 14 | bool xltr_is_pref_valid(struct pref *p); 15 | struct pref *xltr_new_pref(); 16 | void xltr_reset_pref(struct pref *p); 17 | bool xltr_set_pref(struct pref *p, enum pref_id id, int val); 18 | int xltr_get_pref(struct pref *p, enum pref_id id); 19 | 20 | --------------------------------------------------------------------------------