From c4ffc26bcf4767cf824226f35b99f3f36eb06489 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 11 Feb 2018 21:46:33 +0100 Subject: contrib: don't install source code --- CMakeLists.txt | 2 +- cmake/opentrack-hier.cmake | 2 - cmake/opentrack-install.cmake | 23 +- contrib-noinst/ft_tester/Makefile.am | 54 +++ contrib-noinst/ft_tester/Makefile.in | 491 ++++++++++++++++++++ contrib-noinst/ft_tester/fttester.rc.in | 67 +++ contrib-noinst/ft_tester/main.cpp | 211 +++++++++ contrib-noinst/ft_tester/resource.h | 27 ++ contrib-noinst/important-stuff/NPClient.h | 17 + contrib-noinst/important-stuff/NPClient.spec | 23 + contrib-noinst/important-stuff/NPClient_dll.h | 58 +++ contrib-noinst/important-stuff/NPClient_main.c | 444 ++++++++++++++++++ contrib-noinst/important-stuff/game_data.c | 166 +++++++ contrib-noinst/important-stuff/game_data.h | 17 + contrib-noinst/make-csv.pl | 105 +++++ contrib-noinst/tester/Makefile.am | 78 ++++ contrib-noinst/tester/Makefile.in | 512 +++++++++++++++++++++ contrib-noinst/tester/main.cpp | 100 ++++ contrib-noinst/tester/npifc.c | 302 ++++++++++++ contrib-noinst/tester/npifc.h | 66 +++ contrib-noinst/tester/npview.rc.in | 49 ++ contrib-noinst/tester/resource.h | 23 + .../ft_tester/Makefile.am | 54 --- .../ft_tester/Makefile.in | 491 -------------------- .../ft_tester/fttester.rc.in | 67 --- .../very-important-source-code/ft_tester/main.cpp | 211 --------- .../ft_tester/resource.h | 27 -- .../important-stuff/NPClient.h | 17 - .../important-stuff/NPClient.spec | 23 - .../important-stuff/NPClient_dll.h | 58 --- .../important-stuff/NPClient_main.c | 444 ------------------ .../important-stuff/game_data.c | 166 ------- .../important-stuff/game_data.h | 17 - contrib/very-important-source-code/make-csv.pl | 105 ----- .../very-important-source-code/tester/Makefile.am | 78 ---- .../very-important-source-code/tester/Makefile.in | 512 --------------------- contrib/very-important-source-code/tester/main.cpp | 100 ---- contrib/very-important-source-code/tester/npifc.c | 302 ------------ contrib/very-important-source-code/tester/npifc.h | 66 --- .../very-important-source-code/tester/npview.rc.in | 49 -- .../very-important-source-code/tester/resource.h | 23 - 41 files changed, 2827 insertions(+), 2820 deletions(-) create mode 100644 contrib-noinst/ft_tester/Makefile.am create mode 100644 contrib-noinst/ft_tester/Makefile.in create mode 100644 contrib-noinst/ft_tester/fttester.rc.in create mode 100644 contrib-noinst/ft_tester/main.cpp create mode 100644 contrib-noinst/ft_tester/resource.h create mode 100644 contrib-noinst/important-stuff/NPClient.h create mode 100644 contrib-noinst/important-stuff/NPClient.spec create mode 100644 contrib-noinst/important-stuff/NPClient_dll.h create mode 100644 contrib-noinst/important-stuff/NPClient_main.c create mode 100644 contrib-noinst/important-stuff/game_data.c create mode 100644 contrib-noinst/important-stuff/game_data.h create mode 100644 contrib-noinst/make-csv.pl create mode 100644 contrib-noinst/tester/Makefile.am create mode 100644 contrib-noinst/tester/Makefile.in create mode 100644 contrib-noinst/tester/main.cpp create mode 100644 contrib-noinst/tester/npifc.c create mode 100644 contrib-noinst/tester/npifc.h create mode 100644 contrib-noinst/tester/npview.rc.in create mode 100644 contrib-noinst/tester/resource.h delete mode 100644 contrib/very-important-source-code/ft_tester/Makefile.am delete mode 100644 contrib/very-important-source-code/ft_tester/Makefile.in delete mode 100644 contrib/very-important-source-code/ft_tester/fttester.rc.in delete mode 100644 contrib/very-important-source-code/ft_tester/main.cpp delete mode 100644 contrib/very-important-source-code/ft_tester/resource.h delete mode 100644 contrib/very-important-source-code/important-stuff/NPClient.h delete mode 100644 contrib/very-important-source-code/important-stuff/NPClient.spec delete mode 100644 contrib/very-important-source-code/important-stuff/NPClient_dll.h delete mode 100644 contrib/very-important-source-code/important-stuff/NPClient_main.c delete mode 100644 contrib/very-important-source-code/important-stuff/game_data.c delete mode 100644 contrib/very-important-source-code/important-stuff/game_data.h delete mode 100644 contrib/very-important-source-code/make-csv.pl delete mode 100644 contrib/very-important-source-code/tester/Makefile.am delete mode 100644 contrib/very-important-source-code/tester/Makefile.in delete mode 100644 contrib/very-important-source-code/tester/main.cpp delete mode 100644 contrib/very-important-source-code/tester/npifc.c delete mode 100644 contrib/very-important-source-code/tester/npifc.h delete mode 100644 contrib/very-important-source-code/tester/npview.rc.in delete mode 100644 contrib/very-important-source-code/tester/resource.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 101d070f..7859958a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,4 +71,4 @@ endfunction() otr_add_subdirs() otr_merge_translations() -install_sources() +#install_sources() diff --git a/cmake/opentrack-hier.cmake b/cmake/opentrack-hier.cmake index 6bfee1a1..7a0659c6 100644 --- a/cmake/opentrack-hier.cmake +++ b/cmake/opentrack-hier.cmake @@ -51,8 +51,6 @@ function(otr_setup_refresh_install_dir) endif() endfunction() -otr_setup_refresh_install_dir() - set(opentrack-contrib-pfx "${opentrack-doc-pfx}/contrib") set(opentrack-binary-suffix "") diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake index 43212109..f50b93d9 100644 --- a/cmake/opentrack-install.cmake +++ b/cmake/opentrack-install.cmake @@ -15,17 +15,26 @@ macro(otr_inst_dir path) endmacro() function(install_sources) - get_property(source-dirs GLOBAL PROPERTY opentrack-all-source-dirs) - foreach(k ${source-dirs}) - file(RELATIVE_PATH dest "${CMAKE_SOURCE_DIR}" "${k}") - otr_inst_dir("${opentrack-doc-src-pfx}" "${dest}") - endforeach() + if(FALSE) + otr_setup_refresh_install_dir() + get_property(source-dirs GLOBAL PROPERTY opentrack-all-source-dirs) + foreach(k ${source-dirs}) + file(RELATIVE_PATH dest "${CMAKE_SOURCE_DIR}" "${k}") + otr_inst_dir("${opentrack-doc-src-pfx}" "${dest}") + endforeach() + otr_inst_dir("${opentrack-doc-src-pfx}" "${CMAKE_SOURCE_DIR}/cmake") + otr_inst_dir("${opentrack-doc-src-pfx}" "${CMAKE_SOURCE_DIR}/bin") + otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/CMakeLists.txt") + otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/README.md") + otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/CONTRIBUTING.md") + otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/WARRANTY.txt") + otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/OPENTRACK-LICENSING.txt") + otr_inst2("${opentrack-doc-src-pfx}" FILES "${CMAKE_SOURCE_DIR}/AUTHORS.md") + endif() endfunction() otr_inst_dir("${opentrack-doc-pfx}" ${CMAKE_SOURCE_DIR}/3rdparty-notices) otr_inst_dir("${opentrack-doc-pfx}" "${CMAKE_SOURCE_DIR}/settings" "${CMAKE_SOURCE_DIR}/contrib") -otr_inst_dir("${opentrack-doc-src-pfx}" "${CMAKE_SOURCE_DIR}/cmake") -otr_inst_dir("${opentrack-doc-src-pfx}" "${CMAKE_SOURCE_DIR}/bin") if(WIN32) otr_inst2(. FILES "${CMAKE_SOURCE_DIR}/bin/qt.conf") diff --git a/contrib-noinst/ft_tester/Makefile.am b/contrib-noinst/ft_tester/Makefile.am new file mode 100644 index 00000000..02747edb --- /dev/null +++ b/contrib-noinst/ft_tester/Makefile.am @@ -0,0 +1,54 @@ +noinst_SCRIPTS = +if WINE_PLUGIN + noinst_SCRIPTS += ftc.exe.so +endif #WINE_PLUGIN + +if DARWIN + LDFLAGS += -Wl,-no_arch_warnings +else + LDFLAGS += -Wl,--no-warn-search-mismatch +endif + +CC = winegcc + +CXX = wineg++ + +SUFFIXES = .o .cpp .c .rc + +.cpp.o : + $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< + +CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ +CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ +RCFLAGS = -I @srcdir@ +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + +ftc.exe.so : main.o fttester.o + wineg++ -g -o $@ -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +fttester.o : fttester.rc resource.h config.h + +main.o : main.cpp + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +EXTRA_DIST = resource.h fttester.rc main.cpp + diff --git a/contrib-noinst/ft_tester/Makefile.in b/contrib-noinst/ft_tester/Makefile.in new file mode 100644 index 00000000..d1fff34d --- /dev/null +++ b/contrib-noinst/ft_tester/Makefile.in @@ -0,0 +1,491 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@WINE_PLUGIN_TRUE@am__append_1 = ftc.exe.so +@DARWIN_TRUE@am__append_2 = -Wl,-no_arch_warnings +@DARWIN_FALSE@am__append_3 = -Wl,--no-warn-search-mismatch +subdir = src/wine_bridge/ft_tester +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/fttester.rc.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = fttester.rc +CONFIG_CLEAN_VPATH_FILES = +SCRIPTS = $(noinst_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON = @BISON@ +CC = winegcc +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = wineg++ +CXXCPP = @CXXCPP@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ $(am__append_2) $(am__append_3) +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIB32DIR = @LIB32DIR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENCV_CFLAGS = @OPENCV_CFLAGS@ +OPENCV_LIBS = @OPENCV_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +QMAKE_PATH = @QMAKE_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WINE64_LIBS = @WINE64_LIBS@ +WINE_LIBS = @WINE_LIBS@ +XPL_CPPFLAGS = @XPL_CPPFLAGS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +with_makensis = @with_makensis@ +with_wine64 = @with_wine64@ +noinst_SCRIPTS = $(am__append_1) +SUFFIXES = .o .cpp .c .rc +CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ +CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ +RCFLAGS = -I @srcdir@ +EXTRA_DIST = resource.h fttester.rc main.cpp +all: all-am + +.SUFFIXES: +.SUFFIXES: .o .cpp .c .rc +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/ft_tester/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/ft_tester/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +fttester.rc: $(top_builddir)/config.status $(srcdir)/fttester.rc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-local + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + clean-local cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distclean-local distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am + + +.cpp.o : + $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + +ftc.exe.so : main.o fttester.o + wineg++ -g -o $@ -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +fttester.o : fttester.rc resource.h config.h + +main.o : main.cpp + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/contrib-noinst/ft_tester/fttester.rc.in b/contrib-noinst/ft_tester/fttester.rc.in new file mode 100644 index 00000000..c072cd1b --- /dev/null +++ b/contrib-noinst/ft_tester/fttester.rc.in @@ -0,0 +1,67 @@ +// Generated by ResEdit 1.5.9 +// Copyright (C) 2006-2011 +// http://www.resedit.net + +#include +#include +#include +#include "resource.h" + +#ifdef HAVE_CONFIG_H + #include "../../../config.h" +#endif + + + + +// +// Dialog resources +// +//LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_DIALOG1 DIALOGEX 0, 0, 333, 183 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "FreeTrack client test utility v@PACKAGE_VERSION@" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + DEFPUSHBUTTON "Quit", IDQUIT, 262, 153, 50, 14 + PUSHBUTTON "Start", IDC_START, 199, 153, 50, 14 + EDITTEXT IDC_YAW, 38, 15, 48, 14, ES_AUTOHSCROLL + RTEXT "Yaw", IDC_STATIC, 12, 17, 21, 14, SS_RIGHT + EDITTEXT IDC_PITCH, 38, 38, 48, 14, ES_AUTOHSCROLL + RTEXT "Pitch", IDC_STATIC, 16, 40, 17, 14, SS_RIGHT + EDITTEXT IDC_ROLL, 38, 61, 48, 14, ES_AUTOHSCROLL + RTEXT "Roll", IDC_STATIC, 20, 63, 13, 14, SS_RIGHT + EDITTEXT IDC_X, 38, 84, 48, 14, ES_AUTOHSCROLL + RTEXT "X", IDC_STATIC, 27, 86, 6, 14, SS_RIGHT + EDITTEXT IDC_Y, 38, 107, 48, 14, ES_AUTOHSCROLL + RTEXT "Y", IDC_STATIC, 27, 109, 6, 14, SS_RIGHT + EDITTEXT IDC_Z, 38, 130, 48, 14, ES_AUTOHSCROLL + RTEXT "Z", IDC_STATIC, 27, 132, 6, 14, SS_RIGHT + EDITTEXT IDC_RYAW, 137, 15, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Yaw", IDC_STATIC, 101, 17, 32, 8, SS_RIGHT + EDITTEXT IDC_RPITCH, 137, 38, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Pitch", IDC_STATIC, 99, 40, 34, 8, SS_RIGHT + EDITTEXT IDC_RROLL, 137, 61, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Roll", IDC_STATIC, 103, 63, 30, 8, SS_RIGHT + EDITTEXT IDC_RX, 137, 84, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw X", IDC_STATIC, 111, 86, 22, 8, SS_RIGHT + EDITTEXT IDC_RY, 137, 107, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Y", IDC_STATIC, 111, 109, 22, 8, SS_RIGHT + EDITTEXT IDC_RZ, 137, 130, 48, 14, ES_AUTOHSCROLL + RTEXT "Raw Z", IDC_STATIC, 111, 132, 22, 8, SS_RIGHT + EDITTEXT IDC_NUM, 264, 15, 48, 14, ES_AUTOHSCROLL + RTEXT "Frame Number", IDC_STATIC, 212, 17, 47, 8, SS_RIGHT + EDITTEXT IDC_RES, 264, 38, 48, 14, ES_AUTOHSCROLL + RTEXT "Camera Resolution", IDC_STATIC, 199, 40, 60, 8, SS_RIGHT + EDITTEXT IDC_PT0, 227, 61, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 1", IDC_STATIC, 199, 63, 23, 8, SS_RIGHT + EDITTEXT IDC_PT1, 227, 84, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 2", IDC_STATIC, 199, 86, 23, 8, SS_RIGHT + EDITTEXT IDC_PT2, 227, 107, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 3", IDC_STATIC, 199, 109, 23, 8, SS_RIGHT + EDITTEXT IDC_PT3, 227, 130, 85, 14, ES_AUTOHSCROLL + RTEXT "Point 4", IDC_STATIC, 199, 132, 23, 8, SS_RIGHT + EDITTEXT IDC_TITLE, 38, 153, 147, 14, ES_AUTOHSCROLL + RTEXT "Title", IDC_STATIC, 19, 155, 14, 8, SS_RIGHT +} + diff --git a/contrib-noinst/ft_tester/main.cpp b/contrib-noinst/ft_tester/main.cpp new file mode 100644 index 00000000..a737f88f --- /dev/null +++ b/contrib-noinst/ft_tester/main.cpp @@ -0,0 +1,211 @@ +#define WIN32_LEAN_AND_MEAN + +#include +#include +#include +#include +#include +#include + +#include "resource.h" + +HINSTANCE hInst; +UINT_PTR timer = 0; + +HMODULE ftclient; + +typedef struct +{ + unsigned int dataID; + int res_x; int res_y; + float yaw; // positive yaw to the left + float pitch;// positive pitch up + float roll;// positive roll to the left + float x; + float y; + float z; + // raw pose with no smoothing, sensitivity, response curve etc. + float ryaw; + float rpitch; + float rroll; + float rx; + float ry; + float rz; + // raw points, sorted by Y, origin top left corner + float x0, y0; + float x1, y1; + float x2, y2; + float x3, y3; +}FreeTrackData; + + +typedef bool (WINAPI *importGetData)(FreeTrackData * data); +typedef char *(WINAPI *importGetDllVersion)(void); +typedef void (WINAPI *importReportName)(char *name); +typedef char *(WINAPI *importProvider)(void); + +importGetData getData; +importGetDllVersion getDllVersion; +importReportName reportName; +importProvider provider; + + +char *client_path() +{ + HKEY hkey = 0; + RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Freetrack\\FreetrackClient", 0, + KEY_QUERY_VALUE, &hkey); + if(!hkey){ + printf("Can't open registry key\n"); + return NULL; + } + + BYTE path[1024]; + DWORD buf_len = 1024; + LONG result = RegQueryValueEx(hkey, "Path", NULL, NULL, path, &buf_len); + char *full_path = (char *)malloc(2048); + if(result == ERROR_SUCCESS && buf_len > 0){ + sprintf(full_path, "%s\\FreeTrackClient.dll", path); + } + RegCloseKey(hkey); + return full_path; +} + + +bool start(HWND hwnd) +{ + char *libname = client_path(); + if(libname == NULL){ + printf("Freetrack client not found!\n"); + return false; + } + ftclient = LoadLibrary(libname); + if(ftclient == NULL){ + printf("Couldn't load Freetrack client library '%s'!\n", libname); + return false; + } + printf("Freetrack client library %s loaded.\n", client_path()); + + + getData = (importGetData)GetProcAddress(ftclient, "FTGetData"); + getDllVersion = (importGetDllVersion)GetProcAddress(ftclient, "FTGetDllVersion"); + reportName = (importReportName)GetProcAddress(ftclient, "FTReportName"); + provider = (importProvider)GetProcAddress(ftclient, "FTProvider"); + + if((getData == NULL) || (getDllVersion == NULL) || (reportName == NULL) || (provider == NULL)){ + printf("Couldn't load Freetrack client functions!\n"); + FreeLibrary(ftclient); + return false; + } + + printf("Dll version: %s\n", getDllVersion()); + printf("Provider: %s\n", provider()); + char title[1024]; + GetDlgItemText(hwnd, IDC_TITLE, title, 1020); + reportName(title); + return true; +} + +void reportError(std::string msg) +{ + MessageBoxA(0, "FreeTrack client test", msg.c_str(), 0); +} +VOID CALLBACK TimerProcedure(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +{ + (void) uMsg; + (void) idEvent; + (void) dwTime; + FreeTrackData d; + getData(&d); + SetDlgItemInt(hwnd, IDC_PITCH, d.pitch, true); + SetDlgItemInt(hwnd, IDC_ROLL, d.roll, true); + SetDlgItemInt(hwnd, IDC_YAW, d.yaw, true); + + SetDlgItemInt(hwnd, IDC_X, d.x, true); + SetDlgItemInt(hwnd, IDC_Y, d.y, true); + SetDlgItemInt(hwnd, IDC_Z, d.z, true); + + SetDlgItemInt(hwnd, IDC_RPITCH, d.rpitch, true); + SetDlgItemInt(hwnd, IDC_RROLL, d.rroll, true); + SetDlgItemInt(hwnd, IDC_RYAW, d.ryaw, true); + + SetDlgItemInt(hwnd, IDC_RX, d.rx, true); + SetDlgItemInt(hwnd, IDC_RY, d.ry, true); + SetDlgItemInt(hwnd, IDC_RZ, d.rz, true); + + std::ostringstream s; + s.str(std::string()); + s<<"("< +#include "rest.h" +//#include "config.h" +#define __WINESRC__ + +#include +#include +#include +#include +#include +#include +#include "windef.h" +#include "winbase.h" +#include "NPClient_dll.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(NPClient); + +bool crypted = false; +static unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static int dbg_flag; + +static void dbg_report(const char *msg,...) +{ + static FILE *f = NULL; + if(dbg_flag){ + if(f == NULL){ + f = fopen("NPClient.log", "w"); + } + va_list ap; + va_start(ap,msg); + vfprintf(f, msg, ap); + fflush(f); + va_end(ap); + } +} + + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); + + switch (fdwReason) + { + case DLL_WINE_PREATTACH: + return TRUE; + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + dbg_flag = getDebugFlag('w'); + dbg_report("Attach request\n"); + break; + case DLL_PROCESS_DETACH: + linuxtrack_shutdown(); + break; + } + + return TRUE; +} +/****************************************************************** + * NPPriv_ClientNotify (NPCLIENT.1) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_ClientNotify() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_GetLastError (NPCLIENT.2) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_GetLastError() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetData (NPCLIENT.3) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetData() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetLastError (NPCLIENT.4) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetLastError() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetParameter (NPCLIENT.5) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetParameter() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetSignature (NPCLIENT.6) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetSignature() +{ + /* @stub in .spec */ +} +#endif +/****************************************************************** + * NPPriv_SetVersion (NPCLIENT.7) + * + * + */ +#if 0 +__stdcall NPCLIENT_NPPriv_SetVersion() +{ + /* @stub in .spec */ +} +#endif + +static float limit_num(float min, float val, float max) +{ + if(val < min) return min; + if(val > max) return max; + return val; +} + +static unsigned int cksum(unsigned char buf[], unsigned int size) +{ + if((size == 0) || (buf == NULL)){ + return 0; + } + + int rounds = size >> 2; + int rem = size % 4; + + int c = size; + int a0, a2; +// printf("Orig: "); +//for(a0 = 0; a0 < (int)size; ++a0) +//{ +// printf("%02X", buf[a0]); +//} +//printf("\n"); + while(rounds != 0){ + a0 = *(short int*)buf; + a2 = *(short int*)(buf+2); + buf += 4; + c += a0; + a2 ^= (c << 5); + a2 <<= 11; + c ^= a2; + c += (c >> 11); + --rounds; + } + switch(rem){ + case 3: + a0 = *(short int*)buf; + a2 = *(signed char*)(buf+2); + c += a0; + a2 = (a2 << 2) ^ c; + c ^= (a2 << 16); + a2 = (c >> 11); + break; + case 2: + a2 = *(short int*)buf; + c += a2; + c ^= (c << 11); + a2 = (c >> 17); + break; + case 1: + a2 = *(signed char*)(buf); + c += a2; + c ^= (c << 10); + a2 = (c >> 1); + break; + default: + break; + } + if(rem != 0){ + c+=a2; + } + + c ^= (c << 3); + c += (c >> 5); + c ^= (c << 4); + c += (c >> 17); + c ^= (c << 25); + c += (c >> 6); + + return (unsigned int)c; +} + +static void enhance(unsigned char buf[], unsigned int size, + unsigned char codetable[], unsigned int table_size) +{ + unsigned int table_ptr = 0; + unsigned char var = 0x88; + unsigned char tmp; + if((size <= 0) || (table_size <= 0) || + (buf == NULL) || (codetable == NULL)){ + return; + } + do{ + tmp = buf[--size]; + buf[size] = tmp ^ codetable[table_ptr] ^ var; + var += size + tmp; + ++table_ptr; + if(table_ptr >= table_size){ + table_ptr -= table_size; + } + }while(size != 0); +} + + +/****************************************************************** + * NP_GetData (NPCLIENT.8) + * + * + */ +int __stdcall NPCLIENT_NP_GetData(tir_data_t * data) +{ + float r, p, y, tx, ty, tz; + unsigned int frame; + int res = linuxtrack_get_pose(&y, &p, &r, &tx, &ty, &tz, &frame); + memset((char *)data, 0, sizeof(tir_data_t)); + data->status = (linuxtrack_get_tracking_state() == RUNNING) ? 0 : 1; + data->frame = frame & 0xFFFF; + data->cksum = 0; + data->roll = r / 180.0 * 16383; + data->pitch = -p / 180.0 * 16383; + data->yaw = y / 180.0 * 16383; + data->tx = -limit_num(-16383.0, 15 * tx, 16383); + data->ty = limit_num(-16383.0, 15 * ty, 16383); + data->tz = limit_num(-16383.0, 15 * tz, 16383); + data->cksum = cksum((unsigned char*)data, sizeof(tir_data_t)); + //printf("Cksum: %04X\n", data->cksum); + if(crypted){ + enhance((unsigned char*)data, sizeof(tir_data_t), table, sizeof(table)); + } + return (res >= 0) ? 0: 1; +} +/****************************************************************** + * NP_GetParameter (NPCLIENT.9) + * + * + */ +int __stdcall NPCLIENT_NP_GetParameter(int arg0, int arg1) +{ + dbg_report("GetParameter request: %d %d\n", arg0, arg1); + TRACE("(void): stub\n"); + return (int) 0; +} + +/****************************************************************** + * NP_GetSignature (NPCLIENT.10) + * + * + */ +int __stdcall NPCLIENT_NP_GetSignature(tir_signature_t * sig) +{ + dbg_report("GetSignature request\n"); + if(getSomeSeriousPoetry(sig->DllSignature, sig->AppSignature)){ + printf("Signature result: OK\n"); + return 0; + }else{ + printf("Signature result: NOT OK!\n"); + return 1; + } +} +/****************************************************************** + * NP_QueryVersion (NPCLIENT.11) + * + * + */ +int __stdcall NPCLIENT_NP_QueryVersion(unsigned short * version) +{ + dbg_report("QueryVersion request\n"); + *version=0x0500; + return 0; +} +/****************************************************************** + * NP_ReCenter (NPCLIENT.12) + * + * + */ +int __stdcall NPCLIENT_NP_ReCenter(void) +{ + dbg_report("ReCenter request\n"); + linuxtrack_recenter(); + return 0; +} + +/****************************************************************** + * NP_RegisterProgramProfileID (NPCLIENT.13) + * + * + */ +int __stdcall NPCLIENT_NP_RegisterProgramProfileID(unsigned short id) +{ + dbg_report("RegisterProgramProfileID request: %d\n", id); + game_desc_t gd; + if(game_data_get_desc(id, &gd)){ + printf("Application ID: %d - %s!!!\n", id, gd.name); + if(game_data_get_desc(id, &gd)){ + crypted = gd.encrypted; + if(gd.encrypted){ + printf("Table: %02X %02X %02X %02X %02X %02X %02X %02X\n", table[0],table[1],table[2],table[3],table[4], + table[5], table[6], table[7]); + table[0] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[1] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[2] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[3] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[4] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[5] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[6] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[7] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + } + } + if(linuxtrack_init(gd.name) != 0){ + return 1; + } + }else{ + if(!linuxtrack_init("Default")){ + return 1; + } + } + linuxtrack_suspend(); + return 0; +} +/****************************************************************** + * NP_RegisterWindowHandle (NPCLIENT.14) + * + * + */ +int __stdcall NPCLIENT_NP_RegisterWindowHandle(HWND hwnd) +{ + dbg_report("RegisterWindowHandle request: 0x%X\n", hwnd); + TRACE("((HWND)%p): stub\n",hwnd); + return (int) 0; +} +/****************************************************************** + * NP_RequestData (NPCLIENT.15) + * + * + */ +int __stdcall NPCLIENT_NP_RequestData(unsigned short req) +{ + dbg_report("RequestData request: %d\n", req); + TRACE("((unsigned short)%d): stub\n",req); + return (int) 0; +} +/****************************************************************** + * NP_SetParameter (NPCLIENT.16) + * + * + */ +int __stdcall NPCLIENT_NP_SetParameter(int arg0, int arg1) +{ + dbg_report("SetParameter request: %d %d\n", arg0, arg1); + TRACE("(void): stub\n"); + return (int) 0; +} +/****************************************************************** + * NP_StartCursor (NPCLIENT.17) + * + * + */ +int __stdcall NPCLIENT_NP_StartCursor(void) +{ + dbg_report("StartCursor request\n"); + TRACE("(void): stub\n"); + return (int) 0; +} +/****************************************************************** + * NP_StartDataTransmission (NPCLIENT.18) + * + * + */ +int __stdcall NPCLIENT_NP_StartDataTransmission(void) +{ + dbg_report("StartDataTransmission request\n"); + linuxtrack_wakeup(); + return 0; +} +/****************************************************************** + * NP_StopCursor (NPCLIENT.19) + * + * + */ +int __stdcall NPCLIENT_NP_StopCursor(void) +{ + dbg_report("StopCursor request\n"); + TRACE("(void): stub\n"); + return (int) 0; +} +/****************************************************************** + * NP_StopDataTransmission (NPCLIENT.20) + * + * + */ +int __stdcall NPCLIENT_NP_StopDataTransmission(void) +{ + dbg_report("StopDataTransmission request\n"); + linuxtrack_suspend(); + return 0; +} +/****************************************************************** + * NP_UnregisterWindowHandle (NPCLIENT.21) + * + * + */ +int __stdcall NPCLIENT_NP_UnregisterWindowHandle(void) +{ + dbg_report("UnregisterWindowHandle request\n"); + TRACE("(void): stub\n"); + return (int) 0; +} + diff --git a/contrib-noinst/important-stuff/game_data.c b/contrib-noinst/important-stuff/game_data.c new file mode 100644 index 00000000..48774187 --- /dev/null +++ b/contrib-noinst/important-stuff/game_data.c @@ -0,0 +1,166 @@ +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include + +//First 5 bytes is MD5 hash of "NaturalPoint" +static uint8_t secret_key[] = {0x0e, 0x9a, 0x63, 0x71, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +static uint8_t S[256] = {0}; + +static char *decoded = NULL; + +static mxml_node_t *xml = NULL; +static mxml_node_t *tree = NULL; + +static void ksa(uint8_t key[], size_t len) +{ + unsigned int i, j; + for(i = 0; i < 256; ++i){ + S[i] = i; + } + j = 0; + for(i = 0; i < 256; ++i){ + j = (j + S[i] + key[i % len]) % 256; + uint8_t tmp = S[i]; + S[i] = S[j]; + S[j] = tmp; + } +} + +static uint8_t rc4() +{ + static uint8_t i = 0; + static uint8_t j = 0; + + i += 1; + j += S[i]; + uint8_t tmp = S[i]; + S[i] = S[j]; + S[j] = tmp; + return S[(S[i] + S[j]) % 256]; +} + +static bool decrypt_file(const char *fname, bool from_update) +{ + uint32_t header[5]; + size_t datlen; + ksa(secret_key, 16); + FILE *inp; + struct stat fst; + + if((inp = fopen(fname, "rb")) == NULL){ + printf("Can't open input file '%s'", fname); + return false; + } + + if(fstat(fileno(inp), &fst) != 0){ + fclose(inp); + printf("Cannot stat file '%s'\n", fname); + return false; + } + + if(from_update){ + if(fread(&header, sizeof(uint32_t), 5, inp) != 5){ + fclose(inp); + printf("Can't read the header - file '%s' is less than 20 bytes long?\n", fname); + return false; + } + datlen = header[4]; + }else{ + datlen = fst.st_size; + } + if((decoded = (char *)malloc(datlen+1)) == NULL){ + printf("malloc failed!\n"); + return false; + } + memset(decoded, 0, datlen+1); + size_t i; + size_t len = fread(decoded, 1, datlen, inp); + (void) len; + for(i = 0; i < datlen; ++i) decoded[i] ^= rc4(); + fclose(inp); + + //inp = fopen("tmp.dump", "w"); + //fwrite(decoded, 1, datlen, inp); + //fclose(inp); + + return true; +} + +static bool game_data_init(const char *fname, bool from_update) +{ + static bool initialized = false; + if(initialized){ + return true; + } + if(!decrypt_file(fname, from_update)){ + printf("Error decrypting file!\n"); + return false; + } + xml = mxmlNewXML("1.0"); + tree = mxmlLoadString(xml, decoded, MXML_TEXT_CALLBACK); + return (tree != NULL); +} + +static void game_data_close() +{ + mxmlDelete(tree); + free(decoded); +} + +#define ltr_int_log_message(...) fprintf(stderr, __VA_ARGS__) + +static void remove_newlines(const char* str, char* out, int out_len) +{ + int i, j; + int len = strlen(str); + for (i = 0, j = 0; str[i] && j + 1 < out_len; i++) + { + if (str[i] == '\r' || str[i] == '\n') + continue; + out[j++] = str[i]; + } + if (j < out_len) + out[j] = '\0'; +} + +bool get_game_data(const char *input_fname, const char *output_fname, bool from_update) +{ + FILE *outfile = NULL; + if((outfile = (output_fname ? fopen(output_fname, "w") : stdout)) == NULL){ + ltr_int_log_message("Can't open the output file '%s'!\n", output_fname); + return false; + } + if(!game_data_init(input_fname, from_update)){ + ltr_int_log_message("Can't process the data file '%s'!\n", input_fname); + return false; + } + + mxml_node_t *game; + const char *name; + const char *id; + for(game = mxmlFindElement(tree, tree, "Game", NULL, NULL, MXML_DESCEND); + game != NULL; + game = mxmlFindElement(game, tree, "Game", NULL, NULL, MXML_DESCEND)) + { + name = mxmlElementGetAttr(game, "Name"); + id = mxmlElementGetAttr(game, "Id"); + + mxml_node_t *appid = mxmlFindElement(game, game, "ApplicationID", NULL, NULL, MXML_DESCEND); + char name_[256]; + remove_newlines(name, name_, sizeof(name_)); + if(appid == NULL) + fprintf(outfile, "%s \"%s\"\n", id, name_); + else + fprintf(outfile, "%s \"%s\" (%s)\n", id, name_, appid->child->value.text.string); + } + fclose(outfile); + game_data_close(); + return true; +} + +int main(int argc, char** argv) { return argc > 1 && get_game_data(argv[1], NULL, false); } diff --git a/contrib-noinst/important-stuff/game_data.h b/contrib-noinst/important-stuff/game_data.h new file mode 100644 index 00000000..b71f7a15 --- /dev/null +++ b/contrib-noinst/important-stuff/game_data.h @@ -0,0 +1,17 @@ +#ifndef GAME_DATA__H +#define GAME_DATA__H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +bool get_game_data(const char *input_fname, const char *output_fname, bool from_update); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/contrib-noinst/make-csv.pl b/contrib-noinst/make-csv.pl new file mode 100644 index 00000000..5dc265f8 --- /dev/null +++ b/contrib-noinst/make-csv.pl @@ -0,0 +1,105 @@ +#!/usr/bin/env perl + +use strict; +use List::Util qw'reduce'; + +use POSIX qw(locale_h); +setlocale(LC_ALL, "C"); + +sub get_games_1 +{ + my @games; + + open my $fd, "<", $ARGV[1] or die "open: $!"; + binmode $fd; + <$fd>; + + while (defined(my $line = <$fd>)) + { + $line =~ s/[\r\n]+$//s; + if ($line !~ /^(\d+)\s+"([^;"]+)"(?:\s+\(([0-9A-F]{16})\))?$/) + { + warn "Broken line"; + next; + } + next if $1 <= 0; + push @games, +{ id => $1, name => $2, key => $3 } + } + [sort { lc($a->{name}) cmp lc($b->{name}) } @games] +} + +sub get_games_2 +{ + open my $fd, "<", $ARGV[0] or die "open: $!"; + binmode $fd; + <$fd>; + my @games; + my %ids; + while (defined(my $line = <$fd>)) + { + $line =~ s/[\r\n]+$//s; + my @line = split/;/, $line; + if (@line != 8) + { + warn "Broken line"; + next; + } + my @cols = qw'no name proto since verified by id key'; + my $h = +{ map { $cols[$_] => $line[$_] } 0..$#cols }; + next if exists $ids{$h->{id}}; + $ids{$h->{id}} = undef; + next if $h->{id} <= 0; + push @games, $h; + } + [@games]; +} + +sub merge +{ + my ($new_games, $old_games) = @_; + my $no = (reduce { $a->{no} > $b->{no} ? $a : $b } +{id=>0}, @$old_games)->{no} + 1; + my %ids = map { $_->{id} => $_ } @$old_games; + binmode \*STDOUT; + for my $g (@$new_games) + { + my $id = $g->{id}; + my $no_ = $ids{$id} ? $ids{$id}->{no} : $no; + next if (exists($ids{$id}) && $ids{$id}->{verified} ne ''); + my $old = $ids{$id} || do { $no++; +{} }; + $ids{$id} = + +{ + no => $no_, + name => $g->{name}, + proto => 'FreeTrack20', + verified => '', + by => '', + id => $g->{id}, + %$old, + since => $g->{key} ? 'V170' : 'V160', + key => $g->{key} ? (sprintf "%04X", $no_) . $g->{key} . '00' : $old->{key} + }; + } + print "No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID\n"; + for (sort { $a->{no} <=> $b->{no} } values %ids) + { + my $g = {%$_}; + if (!defined $g->{key}) + { + $g->{key} = (sprintf "%04X", $g->{no}) . (join"", map { sprintf "%02X", int rand 256 } 0 .. 7) . '00'; + } + my @cols = qw'no name proto since verified by id key'; + print join";", map { $g->{$_} } @cols; + print "\n"; + } +} + +if (@ARGV != 2) +{ + warn "usage: $0 orig.csv dump.txt\n"; + exit 1; +} +else +{ + merge(get_games_1(), get_games_2()); + exit 0; +} diff --git a/contrib-noinst/tester/Makefile.am b/contrib-noinst/tester/Makefile.am new file mode 100644 index 00000000..e025209a --- /dev/null +++ b/contrib-noinst/tester/Makefile.am @@ -0,0 +1,78 @@ +noinst_SCRIPTS = +if WINE_PLUGIN + noinst_SCRIPTS += Tester.exe +if WINE64 + noinst_SCRIPTS += Tester64.exe +endif #WINE64 +endif #WINE_PLUGIN + +if DARWIN + LDFLAGS += -Wl,-no_arch_warnings +else + LDFLAGS += -Wl,--no-warn-search-mismatch +endif + +CC = winegcc + +CXX = wineg++ + +SUFFIXES = .o .cpp .c .rc 64.o + +.cpp.o : + $(CXX) -c $(CXXFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS) -m32 -o $@ $< + +.cpp64.o : + $(CXX) -c $(CXXFLAGS) -o $@ $< + +.c64.o : + $(CC) -c $(CFLAGS) -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< + +CXXFLAGS += -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ +CFLAGS += -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ +RCFLAGS = -I @srcdir@ +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + + +Tester64.exe : main64.o rest64.o npifc64.o npview.o + wineg++ -g -o Tester64 -L. $(WINE64_LIBS) $(LDFLAGS) -Wall -Wextra $^ + +Tester.exe : main.o npview.o rest.o npifc.o + wineg++ -g -o Tester -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +main.o : main.cpp Makefile + +main64.o : main.cpp Makefile + +npview.o : npview.rc + +rest.o : rest.c rest.h Makefile + +rest64.o : rest.c rest.h Makefile + +npifc.o : npifc.c npifc.h Makefile + +npifc64.o : CFLAGS+="-DFOR_WIN64=1" +npifc64.o : npifc.c npifc.h Makefile + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +EXTRA_DIST = main.cpp npifc.c npifc.h resource.h rest.c rest.h + diff --git a/contrib-noinst/tester/Makefile.in b/contrib-noinst/tester/Makefile.in new file mode 100644 index 00000000..cc49d754 --- /dev/null +++ b/contrib-noinst/tester/Makefile.in @@ -0,0 +1,512 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@WINE_PLUGIN_TRUE@am__append_1 = Tester.exe +@WINE64_TRUE@@WINE_PLUGIN_TRUE@am__append_2 = Tester64.exe +@DARWIN_TRUE@am__append_3 = -Wl,-no_arch_warnings +@DARWIN_FALSE@am__append_4 = -Wl,--no-warn-search-mismatch +subdir = src/wine_bridge/tester +DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(srcdir)/npview.rc.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = npview.rc +CONFIG_CLEAN_VPATH_FILES = +SCRIPTS = $(noinst_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +depcomp = +am__depfiles_maybe = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BISON = @BISON@ +CC = winegcc +CFLAGS = @CFLAGS@ -g -I../.. -I../../.. -DHAVE_CONFIG_H \ + -I@srcdir@/../.. -I@top_builddir@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = wineg++ +CXXCPP = @CXXCPP@ +CXXFLAGS = @CXXFLAGS@ -g -DHAVE_CONFIG_H -I../../.. -I. \ + -I@srcdir@/../.. -I@top_builddir@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ $(am__append_3) $(am__append_4) +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIB32DIR = @LIB32DIR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENCV_CFLAGS = @OPENCV_CFLAGS@ +OPENCV_LIBS = @OPENCV_LIBS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +QMAKE_PATH = @QMAKE_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +WINE64_LIBS = @WINE64_LIBS@ +WINE_LIBS = @WINE_LIBS@ +XPL_CPPFLAGS = @XPL_CPPFLAGS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +with_makensis = @with_makensis@ +with_wine64 = @with_wine64@ +noinst_SCRIPTS = $(am__append_1) $(am__append_2) +SUFFIXES = .o .cpp .c .rc 64.o +RCFLAGS = -I @srcdir@ +EXTRA_DIST = main.cpp npifc.c npifc.h resource.h rest.c rest.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .o .cpp .c .rc 64.o +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/tester/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/tester/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +npview.rc: $(top_builddir)/config.status $(srcdir)/npview.rc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-local + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + clean-local cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distclean-local distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am + + +.cpp.o : + $(CXX) -c $(CXXFLAGS) -m32 -o $@ $< + +.c.o : + $(CC) -c $(CFLAGS) -m32 -o $@ $< + +.cpp64.o : + $(CXX) -c $(CXXFLAGS) -o $@ $< + +.c64.o : + $(CC) -c $(CFLAGS) -o $@ $< + +.rc.o : + wrc -o $@ $(RCFLAGS) $< +#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ +vpath %.h @srcdir@/../.. +vpath %.h @top_builddir@ +vpath %.c @srcdir@ +vpath %.c @srcdir@/../.. + +Tester64.exe : main64.o rest64.o npifc64.o npview.o + wineg++ -g -o Tester64 -L. $(WINE64_LIBS) $(LDFLAGS) -Wall -Wextra $^ + +Tester.exe : main.o npview.o rest.o npifc.o + wineg++ -g -o Tester -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ + +main.o : main.cpp Makefile + +main64.o : main.cpp Makefile + +npview.o : npview.rc + +rest.o : rest.c rest.h Makefile + +rest64.o : rest.c rest.h Makefile + +npifc.o : npifc.c npifc.h Makefile + +npifc64.o : CFLAGS+="-DFOR_WIN64=1" +npifc64.o : npifc.c npifc.h Makefile + +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +distclean-local: distclean-local-check +.PHONY: distclean-local-check +distclean-local-check: + rm -f *.exe* *.dll* *.sh *.o + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/contrib-noinst/tester/main.cpp b/contrib-noinst/tester/main.cpp new file mode 100644 index 00000000..95ca0d9b --- /dev/null +++ b/contrib-noinst/tester/main.cpp @@ -0,0 +1,100 @@ +#define WIN32_LEAN_AND_MEAN + +#include +#include +#include +#include "resource.h" +#include "rest.h" +#include "npifc.h" + +HINSTANCE hInst; +UINT_PTR timer = 0; + +VOID CALLBACK TimerProcedure(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) +{ + (void) uMsg; + (void) idEvent; + (void) dwTime; + tir_data_t td; + npifc_getdata(&td); + SetDlgItemInt(hwnd, IDC_PITCH, td.pitch, true); + SetDlgItemInt(hwnd, IDC_ROLL, td.roll, true); + SetDlgItemInt(hwnd, IDC_YAW, td.yaw, true); + + SetDlgItemInt(hwnd, IDC_X1, td.tx, true); + SetDlgItemInt(hwnd, IDC_Y1, td.ty, true); + SetDlgItemInt(hwnd, IDC_Z1, td.tz, true); + + SetDlgItemInt(hwnd, IDC_X2, td.padding[0], true); + SetDlgItemInt(hwnd, IDC_Y2, td.padding[1], true); + SetDlgItemInt(hwnd, IDC_Z2, td.padding[2], true); + SetDlgItemInt(hwnd, IDC_X3, td.padding[3], true); + SetDlgItemInt(hwnd, IDC_Y3, td.padding[4], true); + SetDlgItemInt(hwnd, IDC_Z3, td.padding[5], true); + SetDlgItemInt(hwnd, IDC_S, td.status, true); + SetDlgItemInt(hwnd, IDC_F, td.frame, true); +} + +BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + (void) lParam; + switch(uMsg) + { + case WM_INITDIALOG: + SetDlgItemInt(hwndDlg, IDC_APPID, 2307, true); + return TRUE; + + case WM_CLOSE: + EndDialog(hwndDlg, 0); + return TRUE; + + case WM_COMMAND: + switch(LOWORD(wParam)) + { + /* + * TODO: Add more control ID's, when needed. + */ + case IDQUIT: + npifc_close(); + EndDialog(hwndDlg, 0); + return TRUE; + case IDSTART: + int ok; + int num = GetDlgItemInt(hwndDlg, IDC_APPID, (BOOL*)&ok, false); + if(!ok){ + num = 2307; + } + game_desc_t gd; + if(timer != 0){ + KillTimer(hwndDlg, timer); + timer = 0; + } + if(game_data_get_desc(num, &gd)){ + printf("Application ID: %d - %s\n", num, gd.name); + if(npifc_init(hwndDlg, num)){ + timer = SetTimer(hwndDlg, 0, 50, TimerProcedure); + } + }else{ + printf("Unknown Application ID: %d\n", num); + } + break; + + } + } + + return FALSE; +} + + +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) +{ + (void) hPrevInstance; + (void) lpCmdLine; + (void) nShowCmd; + hInst = hInstance; + + // The user interface is a modal dialog box + return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DialogProc); +} + + diff --git a/contrib-noinst/tester/npifc.c b/contrib-noinst/tester/npifc.c new file mode 100644 index 00000000..b036464e --- /dev/null +++ b/contrib-noinst/tester/npifc.c @@ -0,0 +1,302 @@ +#define _GNU_SOURCE +#include +#include +#define WIN32_LEAN_AND_MEAN +#include +#include "npifc.h" +#include "rest.h" + + +tir_signature_t ts; +HMODULE npclient; +/* +typedef int (*NP_RegisterWindowHandle_t)(HWND hwnd); +typedef int (*NP_UnregisterWindowHandle_t)(void); +typedef int (*NP_RegisterProgramProfileID_t)(unsigned short id); +typedef int (*NP_QueryVersion_t)(unsigned short *version); +typedef int (*NP_RequestData_t)(unsigned short req); +typedef int (*NP_GetSignature_t)(tir_signature_t *sig); +typedef int (*NP_GetData_t)(tir_data_t *data); +typedef int (*NP_GetParameter_t)(void); +typedef int (*NP_SetParameter_t)(void); +typedef int (*NP_StartCursor_t)(void); +typedef int (*NP_StopCursor_t)(void); +typedef int (*NP_ReCenter_t)(void); +typedef int (*NP_StartDataTransmission_t)(void); +typedef int (*NP_StopDataTransmission_t)(void); +*/ +NP_RegisterWindowHandle_t NP_RegisterWindowHandle = NULL; +NP_UnregisterWindowHandle_t NP_UnregisterWindowHandle = NULL; +NP_RegisterProgramProfileID_t NP_RegisterProgramProfileID = NULL; +NP_QueryVersion_t NP_QueryVersion = NULL; +NP_RequestData_t NP_RequestData = NULL; +NP_GetSignature_t NP_GetSignature = NULL; +NP_GetData_t NP_GetData = NULL; +NP_GetParameter_t NP_GetParameter = NULL; +NP_SetParameter_t NP_SetParameter = NULL; +NP_StartCursor_t NP_StartCursor = NULL; +NP_StopCursor_t NP_StopCursor = NULL; +NP_ReCenter_t NP_ReCenter = NULL; +NP_StartDataTransmission_t NP_StartDataTransmission = NULL; +NP_StopDataTransmission_t NP_StopDataTransmission = NULL; + +bool crypted = false; + + + +unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +char *client_path() +{ + HKEY hkey = 0; + RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\NaturalPoint\\NATURALPOINT\\NPClient Location", 0, + KEY_QUERY_VALUE, &hkey); + if(!hkey){ + printf("Can't open registry key\n"); + return NULL; + } + + BYTE path[1024]; + DWORD buf_len = 1024; + LONG result = RegQueryValueEx(hkey, "Path", NULL, NULL, path, &buf_len); + char *full_path = NULL; + int res = -1; + if(result == ERROR_SUCCESS && buf_len > 0){ +#ifdef FOR_WIN64 + res = asprintf(&full_path, "%s/NPClient64.dll", path); +#else + res = asprintf(&full_path, "%s/NPClient.dll", path); +#endif + } + RegCloseKey(hkey); + if(res > 0){ + return full_path; + }else{ + return NULL; + } +} + +bool initialized = false; + +bool npifc_init(HWND wnd, int id) +{ + //table[] = {0xb3, 0x16, 0x36, 0xeb, 0xb9, 0x05, 0x4f, 0xa4}; + game_desc_t gd; + if(game_data_get_desc(id, &gd)){ + crypted = gd.encrypted; + if(gd.encrypted){ + table[0] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[1] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[2] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[3] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; + table[4] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[5] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[6] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + table[7] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; + } + } + printf("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + table[0], table[1], table[2], table[3], + table[4], table[5], table[6], table[7]); + + char *client = client_path(); + if(client == NULL){ + printf("Couldn't obtain client path!\n"); + return false; + } + npclient = LoadLibrary(client); + if(!npclient){ + printf("Can't load client %s\n", client); + return false; + } + + NP_RegisterWindowHandle = (NP_RegisterWindowHandle_t)GetProcAddress(npclient, "NP_RegisterWindowHandle"); + NP_UnregisterWindowHandle = (NP_UnregisterWindowHandle_t)GetProcAddress(npclient, "NP_UnregisterWindowHandle"); + NP_RegisterProgramProfileID = (NP_RegisterProgramProfileID_t)GetProcAddress(npclient, "NP_RegisterProgramProfileID"); + NP_QueryVersion = (NP_QueryVersion_t)GetProcAddress(npclient, "NP_QueryVersion"); + NP_RequestData = (NP_RequestData_t)GetProcAddress(npclient, "NP_RequestData"); + NP_GetSignature = (NP_GetSignature_t)GetProcAddress(npclient, "NP_GetSignature"); + NP_GetData = (NP_GetData_t)GetProcAddress(npclient, "NP_GetData"); + NP_GetParameter = (NP_GetParameter_t)GetProcAddress(npclient, "NP_GetParameter"); + NP_SetParameter = (NP_SetParameter_t)GetProcAddress(npclient, "NP_SetParameter"); + NP_StartCursor = (NP_StartCursor_t)GetProcAddress(npclient, "NP_StartCursor"); + NP_StopCursor = (NP_StopCursor_t)GetProcAddress(npclient, "NP_StopCursor"); + NP_ReCenter = (NP_ReCenter_t)GetProcAddress(npclient, "NP_ReCenter"); + NP_StartDataTransmission = (NP_StartDataTransmission_t)GetProcAddress(npclient, "NP_StartDataTransmission"); + NP_StopDataTransmission = (NP_StopDataTransmission_t)GetProcAddress(npclient, "NP_StopDataTransmission"); + if((NP_RegisterWindowHandle == NULL) || (NP_UnregisterWindowHandle == NULL) + || (NP_RegisterProgramProfileID == NULL) || (NP_QueryVersion == NULL) || (NP_RequestData == NULL) + || (NP_GetSignature == NULL) || (NP_GetData == NULL) || (NP_GetParameter == NULL) + || (NP_SetParameter == NULL) || (NP_StartCursor == NULL) || (NP_StopCursor == NULL) + || (NP_ReCenter == NULL) || (NP_StartDataTransmission == NULL) || (NP_StopDataTransmission == NULL)){ + printf("Couldn't bind all necessary functions!\n"); + return false; + } + tir_signature_t sig; + int res; + if((res = NP_GetSignature(&sig)) != 0){ + printf("Error retrieving signature! %d\n", res); + return false; + } + printf("Dll Sig:%s\nApp Sig2:%s\n", sig.DllSignature, sig.AppSignature); + NP_RegisterWindowHandle(wnd); + if(NP_RegisterProgramProfileID(id) != 0){ + printf("Couldn't register profile id!\n"); + return false; + } + printf("Program profile registered!\n"); + NP_RequestData(65535); + NP_StopCursor(); + NP_StartDataTransmission(); + initialized = true; + return true; +} + +void npifc_close() +{ + if(initialized){ + NP_StopDataTransmission(); + NP_StartCursor(); + NP_UnregisterWindowHandle(); + } + initialized = false; +} + +void c_encrypt(unsigned char buf[], unsigned int size, + unsigned char code_table[], unsigned int table_size) +{ + unsigned int table_ptr = 0; + unsigned char var = 0x88; + unsigned char tmp; + if((size <= 0) || (table_size <= 0) || + (buf == NULL) || (code_table == NULL)) + return; + do{ + tmp = buf[--size]; + buf[size] = tmp ^ code_table[table_ptr] ^ var; + var += size + tmp; + ++table_ptr; + if(table_ptr >= table_size){ + table_ptr -= table_size; + } + }while(size != 0); +} + + + +void decrypt(unsigned char buf[], unsigned int size, + unsigned char code_table[], unsigned int table_size) +{ + unsigned int table_ptr = 0; + unsigned char var = 0x88; + unsigned char tmp; + if((size <= 0) || (table_size <= 0) || + (buf == NULL) || (code_table == NULL)){ + return; + } + do{ + tmp = buf[--size]; + buf[size] = tmp ^ code_table[table_ptr] ^ var; + var += size + buf[size]; + ++table_ptr; + if(table_ptr >= table_size){ + table_ptr -= table_size; + } + }while(size != 0); +} + +unsigned int cksum(unsigned char buf[], unsigned int size) +{ + if((size == 0) || (buf == NULL)){ + return 0; + } + int rounds = size >> 2; + int rem = size % 4; + + int c = size; + int a0 = 0; + int a2 = 0; + + while(rounds != 0){ + a0 = *(short int*)buf; + a2 = *(short int*)(buf+2); + buf += 4; + c += a0; + a2 ^= (c << 5); + a2 <<= 11; + c ^= a2; + c += (c >> 11); + --rounds; + } + switch(rem){ + case 3: + a0 = *(short int*)buf; + a2 = *(signed char*)(buf+2); + c += a0; + a2 = (a2 << 2) ^ c; + c ^= (a2 << 16); + a2 = (c >> 11); + break; + case 2: + a2 = *(short int*)buf; + c += a2; + c ^= (c << 11); + a2 = (c >> 17); + break; + case 1: + a2 = *(signed char*)(buf); + c += a2; + c ^= (c << 10); + a2 = (c >> 1); + break; + default: + break; + } + if(rem != 0){ + c+=a2; + } + + c ^= (c << 3); + c += (c >> 5); + c ^= (c << 4); + c += (c >> 17); + c ^= (c << 25); + c += (c >> 6); + + return (unsigned int)c; +} + +int decode_frame(tir_data_t *td) +{ + //printf("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", + // table[0], table[1], table[2], table[3], + // table[4], table[5], table[6], table[7]); + unsigned int csum; + decrypt((unsigned char*)td, sizeof(*td), table, sizeof(table)); + csum = td->cksum; + td->cksum = 0; + if(csum != cksum((unsigned char*)td, sizeof(*td))){ + printf("Problem with frame!\n"); + //int a0; + //printf("Dec: "); + //for(a0 = 0; a0 < (int)sizeof(tir_data_t); ++a0) + //{ + // printf("%02X", ((unsigned char *)td)[a0]); + //} + //printf("\n"); + //printf("Cksum: %04X vs computed: %04X\n", csum, cksum((unsigned char*)td, sizeof(*td))); + return -1; + } + //printf("Frame OK!\n"); + return 0; +} + +int npifc_getdata(tir_data_t *data) +{ + int res = NP_GetData(data); + if(crypted){ + decode_frame(data); + } + return res; +} + diff --git a/contrib-noinst/tester/npifc.h b/contrib-noinst/tester/npifc.h new file mode 100644 index 00000000..d580e16d --- /dev/null +++ b/contrib-noinst/tester/npifc.h @@ -0,0 +1,66 @@ +#ifndef NPIFC__H +#define NPIFC__H + + +#include + +#ifdef __cplusplus +extern "C" { +#endif + bool npifc_init(HWND wnd, int id); + void npifc_close(); + +#pragma pack(1) +typedef struct tir_data{ + short status; + short frame; + unsigned int cksum; + float roll, pitch, yaw; + float tx, ty, tz; + float padding[9]; +} tir_data_t; + +typedef struct tir_signature{ + char DllSignature[200]; + char AppSignature[200]; +} tir_signature_t; +#pragma pack(0) + +int npifc_getdata(tir_data_t *data); + +typedef int __stdcall (*NP_RegisterWindowHandle_t)(HWND hwnd); +typedef int __stdcall (*NP_UnregisterWindowHandle_t)(void); +typedef int __stdcall (*NP_RegisterProgramProfileID_t)(unsigned short id); +typedef int __stdcall (*NP_QueryVersion_t)(unsigned short *version); +typedef int __stdcall (*NP_RequestData_t)(unsigned short req); +typedef int __stdcall (*NP_GetSignature_t)(tir_signature_t *sig); +typedef int __stdcall (*NP_GetData_t)(tir_data_t *data); +typedef int __stdcall (*NP_GetParameter_t)(void); +typedef int __stdcall (*NP_SetParameter_t)(void); +typedef int __stdcall (*NP_StartCursor_t)(void); +typedef int __stdcall (*NP_StopCursor_t)(void); +typedef int __stdcall (*NP_ReCenter_t)(void); +typedef int __stdcall (*NP_StartDataTransmission_t)(void); +typedef int __stdcall (*NP_StopDataTransmission_t)(void); + +extern NP_RegisterWindowHandle_t NP_RegisterWindowHandle; +extern NP_UnregisterWindowHandle_t NP_UnregisterWindowHandle; +extern NP_RegisterProgramProfileID_t NP_RegisterProgramProfileID; +extern NP_QueryVersion_t NP_QueryVersion; +extern NP_RequestData_t NP_RequestData; +extern NP_GetSignature_t NP_GetSignature; +extern NP_GetData_t NP_GetData; +extern NP_GetParameter_t NP_GetParameter; +extern NP_SetParameter_t NP_SetParameter; +extern NP_StartCursor_t NP_StartCursor; +extern NP_StopCursor_t NP_StopCursor; +extern NP_ReCenter_t NP_ReCenter; +extern NP_StartDataTransmission_t NP_StartDataTransmission; +extern NP_StopDataTransmission_t NP_StopDataTransmission; + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/contrib-noinst/tester/npview.rc.in b/contrib-noinst/tester/npview.rc.in new file mode 100644 index 00000000..1ab6fe48 --- /dev/null +++ b/contrib-noinst/tester/npview.rc.in @@ -0,0 +1,49 @@ +// Generated by ResEdit 1.5.9 +// Copyright (C) 2006-2011 +// http://www.resedit.net + +#include +#include +#include +#include "resource.h" + +#ifdef HAVE_CONFIG_H + #include "../../../config.h" +#endif + + + +// +// Dialog resources +// +//LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_DIALOG1 DIALOGEX 0, 0, 379, 124 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "NPTest v@PACKAGE_VERSION@" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + DEFPUSHBUTTON "Quit", IDQUIT, 262, 102, 50, 14 + DEFPUSHBUTTON "Start", IDSTART, 7, 102, 50, 14 + EDITTEXT IDC_PITCH, 32, 32, 51, 14, ES_AUTOHSCROLL + LTEXT "Pitch", IDC_STATIC, 11, 34, 20, 8, SS_LEFT + LTEXT "Yaw", IDC_STATIC, 11, 59, 20, 8, SS_LEFT + EDITTEXT IDC_YAW, 32, 57, 51, 14, ES_AUTOHSCROLL + LTEXT "Roll", IDC_STATIC, 11, 84, 20, 8, SS_LEFT + EDITTEXT IDC_ROLL, 32, 82, 51, 14, ES_AUTOHSCROLL + LTEXT "X", IDC_STATIC, 101, 35, 6, 8, SS_LEFT + EDITTEXT IDC_X1, 112, 32, 51, 14, ES_AUTOHSCROLL + LTEXT "Y", IDC_STATIC, 101, 60, 6, 8, SS_LEFT + EDITTEXT IDC_Y1, 112, 57, 51, 14, ES_AUTOHSCROLL + LTEXT "Z", IDC_STATIC, 101, 85, 6, 8, SS_LEFT + EDITTEXT IDC_Z1, 112, 82, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_X2, 172, 32, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Y2, 172, 57, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Z2, 172, 82, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_X3, 232, 32, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Y3, 232, 57, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_Z3, 232, 82, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_S, 292, 32, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_F, 292, 57, 51, 14, ES_AUTOHSCROLL + EDITTEXT IDC_APPID, 32, 12, 51, 12, ES_AUTOHSCROLL + LTEXT "ID", IDC_STATIC, 17, 14, 8, 8, SS_LEFT +} diff --git a/contrib-noinst/tester/resource.h b/contrib-noinst/tester/resource.h new file mode 100644 index 00000000..328d9cb7 --- /dev/null +++ b/contrib-noinst/tester/resource.h @@ -0,0 +1,23 @@ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_DIALOG1 100 +#define IDQUIT 1002 +#define IDSTART 1003 +#define IDC_APPID 1016 +#define IDC_PITCH 1017 +#define IDC_YAW 1018 +#define IDC_ROLL 1019 +#define IDC_X1 1020 +#define IDC_X2 1021 +#define IDC_X3 1022 +#define IDC_Y1 1023 +#define IDC_Y2 1024 +#define IDC_Y3 1025 +#define IDC_Z1 1026 +#define IDC_Z2 1027 +#define IDC_Z3 1028 +#define IDC_S 1029 +#define IDC_F 1030 + diff --git a/contrib/very-important-source-code/ft_tester/Makefile.am b/contrib/very-important-source-code/ft_tester/Makefile.am deleted file mode 100644 index 02747edb..00000000 --- a/contrib/very-important-source-code/ft_tester/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -noinst_SCRIPTS = -if WINE_PLUGIN - noinst_SCRIPTS += ftc.exe.so -endif #WINE_PLUGIN - -if DARWIN - LDFLAGS += -Wl,-no_arch_warnings -else - LDFLAGS += -Wl,--no-warn-search-mismatch -endif - -CC = winegcc - -CXX = wineg++ - -SUFFIXES = .o .cpp .c .rc - -.cpp.o : - $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< - -.c.o : - $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< - -.rc.o : - wrc -o $@ $(RCFLAGS) $< - -CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ -CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ -RCFLAGS = -I @srcdir@ -#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ -vpath %.h @srcdir@/../.. -vpath %.h @top_builddir@ -vpath %.c @srcdir@ -vpath %.c @srcdir@/../.. - -ftc.exe.so : main.o fttester.o - wineg++ -g -o $@ -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ - -fttester.o : fttester.rc resource.h config.h - -main.o : main.cpp - -clean-local: clean-local-check -.PHONY: clean-local-check -clean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -distclean-local: distclean-local-check -.PHONY: distclean-local-check -distclean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -EXTRA_DIST = resource.h fttester.rc main.cpp - diff --git a/contrib/very-important-source-code/ft_tester/Makefile.in b/contrib/very-important-source-code/ft_tester/Makefile.in deleted file mode 100644 index d1fff34d..00000000 --- a/contrib/very-important-source-code/ft_tester/Makefile.in +++ /dev/null @@ -1,491 +0,0 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@WINE_PLUGIN_TRUE@am__append_1 = ftc.exe.so -@DARWIN_TRUE@am__append_2 = -Wl,-no_arch_warnings -@DARWIN_FALSE@am__append_3 = -Wl,--no-warn-search-mismatch -subdir = src/wine_bridge/ft_tester -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(srcdir)/fttester.rc.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = fttester.rc -CONFIG_CLEAN_VPATH_FILES = -SCRIPTS = $(noinst_SCRIPTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -depcomp = -am__depfiles_maybe = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BISON = @BISON@ -CC = winegcc -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = wineg++ -CXXCPP = @CXXCPP@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ $(am__append_2) $(am__append_3) -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIB32DIR = @LIB32DIR@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJC = @OBJC@ -OBJCFLAGS = @OBJCFLAGS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OPENCV_CFLAGS = @OPENCV_CFLAGS@ -OPENCV_LIBS = @OPENCV_LIBS@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -QMAKE_PATH = @QMAKE_PATH@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -WINE64_LIBS = @WINE64_LIBS@ -WINE_LIBS = @WINE_LIBS@ -XPL_CPPFLAGS = @XPL_CPPFLAGS@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -ac_ct_OBJC = @ac_ct_OBJC@ -am__leading_dot = @am__leading_dot@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -with_makensis = @with_makensis@ -with_wine64 = @with_wine64@ -noinst_SCRIPTS = $(am__append_1) -SUFFIXES = .o .cpp .c .rc -CXXFLAGS_PRE = -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ -CFLAGS_PRE = -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ -RCFLAGS = -I @srcdir@ -EXTRA_DIST = resource.h fttester.rc main.cpp -all: all-am - -.SUFFIXES: -.SUFFIXES: .o .cpp .c .rc -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/ft_tester/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/ft_tester/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -fttester.rc: $(top_builddir)/config.status $(srcdir)/fttester.rc.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(SCRIPTS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-local mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-local - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - clean-local cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distclean-local distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ - uninstall-am - - -.cpp.o : - $(CXX) -c $(CXXFLAGS_PRE) $(CXXFLAGS) $(CPPFLAGS) -m32 -o $@ $< - -.c.o : - $(CC) -c $(CFLAGS_PRE) $(CFLAGS) $(CPPFLAGS) -m32 -o $@ $< - -.rc.o : - wrc -o $@ $(RCFLAGS) $< -#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ -vpath %.h @srcdir@/../.. -vpath %.h @top_builddir@ -vpath %.c @srcdir@ -vpath %.c @srcdir@/../.. - -ftc.exe.so : main.o fttester.o - wineg++ -g -o $@ -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ - -fttester.o : fttester.rc resource.h config.h - -main.o : main.cpp - -clean-local: clean-local-check -.PHONY: clean-local-check -clean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -distclean-local: distclean-local-check -.PHONY: distclean-local-check -distclean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/contrib/very-important-source-code/ft_tester/fttester.rc.in b/contrib/very-important-source-code/ft_tester/fttester.rc.in deleted file mode 100644 index 332f3c73..00000000 --- a/contrib/very-important-source-code/ft_tester/fttester.rc.in +++ /dev/null @@ -1,67 +0,0 @@ -// Generated by ResEdit 1.5.9 -// Copyright (C) 2006-2011 -// http://www.resedit.net - -#include -#include -#include -#include "resource.h" - -#ifdef HAVE_CONFIG_H - #include "../../../config.h" -#endif - - - - -// -// Dialog resources -// -//LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -IDD_DIALOG1 DIALOGEX 0, 0, 333, 183 -STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU -CAPTION "FreeTrack client test utility v@PACKAGE_VERSION@" -FONT 8, "Ms Shell Dlg", 400, 0, 1 -{ - DEFPUSHBUTTON "Quit", IDQUIT, 262, 153, 50, 14 - PUSHBUTTON "Start", IDC_START, 199, 153, 50, 14 - EDITTEXT IDC_YAW, 38, 15, 48, 14, ES_AUTOHSCROLL - RTEXT "Yaw", IDC_STATIC, 12, 17, 21, 14, SS_RIGHT - EDITTEXT IDC_PITCH, 38, 38, 48, 14, ES_AUTOHSCROLL - RTEXT "Pitch", IDC_STATIC, 16, 40, 17, 14, SS_RIGHT - EDITTEXT IDC_ROLL, 38, 61, 48, 14, ES_AUTOHSCROLL - RTEXT "Roll", IDC_STATIC, 20, 63, 13, 14, SS_RIGHT - EDITTEXT IDC_X, 38, 84, 48, 14, ES_AUTOHSCROLL - RTEXT "X", IDC_STATIC, 27, 86, 6, 14, SS_RIGHT - EDITTEXT IDC_Y, 38, 107, 48, 14, ES_AUTOHSCROLL - RTEXT "Y", IDC_STATIC, 27, 109, 6, 14, SS_RIGHT - EDITTEXT IDC_Z, 38, 130, 48, 14, ES_AUTOHSCROLL - RTEXT "Z", IDC_STATIC, 27, 132, 6, 14, SS_RIGHT - EDITTEXT IDC_RYAW, 137, 15, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw Yaw", IDC_STATIC, 101, 17, 32, 8, SS_RIGHT - EDITTEXT IDC_RPITCH, 137, 38, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw Pitch", IDC_STATIC, 99, 40, 34, 8, SS_RIGHT - EDITTEXT IDC_RROLL, 137, 61, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw Roll", IDC_STATIC, 103, 63, 30, 8, SS_RIGHT - EDITTEXT IDC_RX, 137, 84, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw X", IDC_STATIC, 111, 86, 22, 8, SS_RIGHT - EDITTEXT IDC_RY, 137, 107, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw Y", IDC_STATIC, 111, 109, 22, 8, SS_RIGHT - EDITTEXT IDC_RZ, 137, 130, 48, 14, ES_AUTOHSCROLL - RTEXT "Raw Z", IDC_STATIC, 111, 132, 22, 8, SS_RIGHT - EDITTEXT IDC_NUM, 264, 15, 48, 14, ES_AUTOHSCROLL - RTEXT "Frame Number", IDC_STATIC, 212, 17, 47, 8, SS_RIGHT - EDITTEXT IDC_RES, 264, 38, 48, 14, ES_AUTOHSCROLL - RTEXT "Camera Resolution", IDC_STATIC, 199, 40, 60, 8, SS_RIGHT - EDITTEXT IDC_PT0, 227, 61, 85, 14, ES_AUTOHSCROLL - RTEXT "Point 1", IDC_STATIC, 199, 63, 23, 8, SS_RIGHT - EDITTEXT IDC_PT1, 227, 84, 85, 14, ES_AUTOHSCROLL - RTEXT "Point 2", IDC_STATIC, 199, 86, 23, 8, SS_RIGHT - EDITTEXT IDC_PT2, 227, 107, 85, 14, ES_AUTOHSCROLL - RTEXT "Point 3", IDC_STATIC, 199, 109, 23, 8, SS_RIGHT - EDITTEXT IDC_PT3, 227, 130, 85, 14, ES_AUTOHSCROLL - RTEXT "Point 4", IDC_STATIC, 199, 132, 23, 8, SS_RIGHT - EDITTEXT IDC_TITLE, 38, 153, 147, 14, ES_AUTOHSCROLL - RTEXT "Title", IDC_STATIC, 19, 155, 14, 8, SS_RIGHT -} - diff --git a/contrib/very-important-source-code/ft_tester/main.cpp b/contrib/very-important-source-code/ft_tester/main.cpp deleted file mode 100644 index a737f88f..00000000 --- a/contrib/very-important-source-code/ft_tester/main.cpp +++ /dev/null @@ -1,211 +0,0 @@ -#define WIN32_LEAN_AND_MEAN - -#include -#include -#include -#include -#include -#include - -#include "resource.h" - -HINSTANCE hInst; -UINT_PTR timer = 0; - -HMODULE ftclient; - -typedef struct -{ - unsigned int dataID; - int res_x; int res_y; - float yaw; // positive yaw to the left - float pitch;// positive pitch up - float roll;// positive roll to the left - float x; - float y; - float z; - // raw pose with no smoothing, sensitivity, response curve etc. - float ryaw; - float rpitch; - float rroll; - float rx; - float ry; - float rz; - // raw points, sorted by Y, origin top left corner - float x0, y0; - float x1, y1; - float x2, y2; - float x3, y3; -}FreeTrackData; - - -typedef bool (WINAPI *importGetData)(FreeTrackData * data); -typedef char *(WINAPI *importGetDllVersion)(void); -typedef void (WINAPI *importReportName)(char *name); -typedef char *(WINAPI *importProvider)(void); - -importGetData getData; -importGetDllVersion getDllVersion; -importReportName reportName; -importProvider provider; - - -char *client_path() -{ - HKEY hkey = 0; - RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Freetrack\\FreetrackClient", 0, - KEY_QUERY_VALUE, &hkey); - if(!hkey){ - printf("Can't open registry key\n"); - return NULL; - } - - BYTE path[1024]; - DWORD buf_len = 1024; - LONG result = RegQueryValueEx(hkey, "Path", NULL, NULL, path, &buf_len); - char *full_path = (char *)malloc(2048); - if(result == ERROR_SUCCESS && buf_len > 0){ - sprintf(full_path, "%s\\FreeTrackClient.dll", path); - } - RegCloseKey(hkey); - return full_path; -} - - -bool start(HWND hwnd) -{ - char *libname = client_path(); - if(libname == NULL){ - printf("Freetrack client not found!\n"); - return false; - } - ftclient = LoadLibrary(libname); - if(ftclient == NULL){ - printf("Couldn't load Freetrack client library '%s'!\n", libname); - return false; - } - printf("Freetrack client library %s loaded.\n", client_path()); - - - getData = (importGetData)GetProcAddress(ftclient, "FTGetData"); - getDllVersion = (importGetDllVersion)GetProcAddress(ftclient, "FTGetDllVersion"); - reportName = (importReportName)GetProcAddress(ftclient, "FTReportName"); - provider = (importProvider)GetProcAddress(ftclient, "FTProvider"); - - if((getData == NULL) || (getDllVersion == NULL) || (reportName == NULL) || (provider == NULL)){ - printf("Couldn't load Freetrack client functions!\n"); - FreeLibrary(ftclient); - return false; - } - - printf("Dll version: %s\n", getDllVersion()); - printf("Provider: %s\n", provider()); - char title[1024]; - GetDlgItemText(hwnd, IDC_TITLE, title, 1020); - reportName(title); - return true; -} - -void reportError(std::string msg) -{ - MessageBoxA(0, "FreeTrack client test", msg.c_str(), 0); -} -VOID CALLBACK TimerProcedure(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) -{ - (void) uMsg; - (void) idEvent; - (void) dwTime; - FreeTrackData d; - getData(&d); - SetDlgItemInt(hwnd, IDC_PITCH, d.pitch, true); - SetDlgItemInt(hwnd, IDC_ROLL, d.roll, true); - SetDlgItemInt(hwnd, IDC_YAW, d.yaw, true); - - SetDlgItemInt(hwnd, IDC_X, d.x, true); - SetDlgItemInt(hwnd, IDC_Y, d.y, true); - SetDlgItemInt(hwnd, IDC_Z, d.z, true); - - SetDlgItemInt(hwnd, IDC_RPITCH, d.rpitch, true); - SetDlgItemInt(hwnd, IDC_RROLL, d.rroll, true); - SetDlgItemInt(hwnd, IDC_RYAW, d.ryaw, true); - - SetDlgItemInt(hwnd, IDC_RX, d.rx, true); - SetDlgItemInt(hwnd, IDC_RY, d.ry, true); - SetDlgItemInt(hwnd, IDC_RZ, d.rz, true); - - std::ostringstream s; - s.str(std::string()); - s<<"("< -#include "rest.h" -//#include "config.h" -#define __WINESRC__ - -#include -#include -#include -#include -#include -#include -#include "windef.h" -#include "winbase.h" -#include "NPClient_dll.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(NPClient); - -bool crypted = false; -static unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static int dbg_flag; - -static void dbg_report(const char *msg,...) -{ - static FILE *f = NULL; - if(dbg_flag){ - if(f == NULL){ - f = fopen("NPClient.log", "w"); - } - va_list ap; - va_start(ap,msg); - vfprintf(f, msg, ap); - fflush(f); - va_end(ap); - } -} - - -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); - - switch (fdwReason) - { - case DLL_WINE_PREATTACH: - return TRUE; - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls(hinstDLL); - dbg_flag = getDebugFlag('w'); - dbg_report("Attach request\n"); - break; - case DLL_PROCESS_DETACH: - linuxtrack_shutdown(); - break; - } - - return TRUE; -} -/****************************************************************** - * NPPriv_ClientNotify (NPCLIENT.1) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_ClientNotify() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_GetLastError (NPCLIENT.2) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_GetLastError() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_SetData (NPCLIENT.3) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_SetData() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_SetLastError (NPCLIENT.4) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_SetLastError() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_SetParameter (NPCLIENT.5) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_SetParameter() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_SetSignature (NPCLIENT.6) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_SetSignature() -{ - /* @stub in .spec */ -} -#endif -/****************************************************************** - * NPPriv_SetVersion (NPCLIENT.7) - * - * - */ -#if 0 -__stdcall NPCLIENT_NPPriv_SetVersion() -{ - /* @stub in .spec */ -} -#endif - -static float limit_num(float min, float val, float max) -{ - if(val < min) return min; - if(val > max) return max; - return val; -} - -static unsigned int cksum(unsigned char buf[], unsigned int size) -{ - if((size == 0) || (buf == NULL)){ - return 0; - } - - int rounds = size >> 2; - int rem = size % 4; - - int c = size; - int a0, a2; -// printf("Orig: "); -//for(a0 = 0; a0 < (int)size; ++a0) -//{ -// printf("%02X", buf[a0]); -//} -//printf("\n"); - while(rounds != 0){ - a0 = *(short int*)buf; - a2 = *(short int*)(buf+2); - buf += 4; - c += a0; - a2 ^= (c << 5); - a2 <<= 11; - c ^= a2; - c += (c >> 11); - --rounds; - } - switch(rem){ - case 3: - a0 = *(short int*)buf; - a2 = *(signed char*)(buf+2); - c += a0; - a2 = (a2 << 2) ^ c; - c ^= (a2 << 16); - a2 = (c >> 11); - break; - case 2: - a2 = *(short int*)buf; - c += a2; - c ^= (c << 11); - a2 = (c >> 17); - break; - case 1: - a2 = *(signed char*)(buf); - c += a2; - c ^= (c << 10); - a2 = (c >> 1); - break; - default: - break; - } - if(rem != 0){ - c+=a2; - } - - c ^= (c << 3); - c += (c >> 5); - c ^= (c << 4); - c += (c >> 17); - c ^= (c << 25); - c += (c >> 6); - - return (unsigned int)c; -} - -static void enhance(unsigned char buf[], unsigned int size, - unsigned char codetable[], unsigned int table_size) -{ - unsigned int table_ptr = 0; - unsigned char var = 0x88; - unsigned char tmp; - if((size <= 0) || (table_size <= 0) || - (buf == NULL) || (codetable == NULL)){ - return; - } - do{ - tmp = buf[--size]; - buf[size] = tmp ^ codetable[table_ptr] ^ var; - var += size + tmp; - ++table_ptr; - if(table_ptr >= table_size){ - table_ptr -= table_size; - } - }while(size != 0); -} - - -/****************************************************************** - * NP_GetData (NPCLIENT.8) - * - * - */ -int __stdcall NPCLIENT_NP_GetData(tir_data_t * data) -{ - float r, p, y, tx, ty, tz; - unsigned int frame; - int res = linuxtrack_get_pose(&y, &p, &r, &tx, &ty, &tz, &frame); - memset((char *)data, 0, sizeof(tir_data_t)); - data->status = (linuxtrack_get_tracking_state() == RUNNING) ? 0 : 1; - data->frame = frame & 0xFFFF; - data->cksum = 0; - data->roll = r / 180.0 * 16383; - data->pitch = -p / 180.0 * 16383; - data->yaw = y / 180.0 * 16383; - data->tx = -limit_num(-16383.0, 15 * tx, 16383); - data->ty = limit_num(-16383.0, 15 * ty, 16383); - data->tz = limit_num(-16383.0, 15 * tz, 16383); - data->cksum = cksum((unsigned char*)data, sizeof(tir_data_t)); - //printf("Cksum: %04X\n", data->cksum); - if(crypted){ - enhance((unsigned char*)data, sizeof(tir_data_t), table, sizeof(table)); - } - return (res >= 0) ? 0: 1; -} -/****************************************************************** - * NP_GetParameter (NPCLIENT.9) - * - * - */ -int __stdcall NPCLIENT_NP_GetParameter(int arg0, int arg1) -{ - dbg_report("GetParameter request: %d %d\n", arg0, arg1); - TRACE("(void): stub\n"); - return (int) 0; -} - -/****************************************************************** - * NP_GetSignature (NPCLIENT.10) - * - * - */ -int __stdcall NPCLIENT_NP_GetSignature(tir_signature_t * sig) -{ - dbg_report("GetSignature request\n"); - if(getSomeSeriousPoetry(sig->DllSignature, sig->AppSignature)){ - printf("Signature result: OK\n"); - return 0; - }else{ - printf("Signature result: NOT OK!\n"); - return 1; - } -} -/****************************************************************** - * NP_QueryVersion (NPCLIENT.11) - * - * - */ -int __stdcall NPCLIENT_NP_QueryVersion(unsigned short * version) -{ - dbg_report("QueryVersion request\n"); - *version=0x0500; - return 0; -} -/****************************************************************** - * NP_ReCenter (NPCLIENT.12) - * - * - */ -int __stdcall NPCLIENT_NP_ReCenter(void) -{ - dbg_report("ReCenter request\n"); - linuxtrack_recenter(); - return 0; -} - -/****************************************************************** - * NP_RegisterProgramProfileID (NPCLIENT.13) - * - * - */ -int __stdcall NPCLIENT_NP_RegisterProgramProfileID(unsigned short id) -{ - dbg_report("RegisterProgramProfileID request: %d\n", id); - game_desc_t gd; - if(game_data_get_desc(id, &gd)){ - printf("Application ID: %d - %s!!!\n", id, gd.name); - if(game_data_get_desc(id, &gd)){ - crypted = gd.encrypted; - if(gd.encrypted){ - printf("Table: %02X %02X %02X %02X %02X %02X %02X %02X\n", table[0],table[1],table[2],table[3],table[4], - table[5], table[6], table[7]); - table[0] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[1] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[2] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[3] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[4] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[5] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[6] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[7] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - } - } - if(linuxtrack_init(gd.name) != 0){ - return 1; - } - }else{ - if(!linuxtrack_init("Default")){ - return 1; - } - } - linuxtrack_suspend(); - return 0; -} -/****************************************************************** - * NP_RegisterWindowHandle (NPCLIENT.14) - * - * - */ -int __stdcall NPCLIENT_NP_RegisterWindowHandle(HWND hwnd) -{ - dbg_report("RegisterWindowHandle request: 0x%X\n", hwnd); - TRACE("((HWND)%p): stub\n",hwnd); - return (int) 0; -} -/****************************************************************** - * NP_RequestData (NPCLIENT.15) - * - * - */ -int __stdcall NPCLIENT_NP_RequestData(unsigned short req) -{ - dbg_report("RequestData request: %d\n", req); - TRACE("((unsigned short)%d): stub\n",req); - return (int) 0; -} -/****************************************************************** - * NP_SetParameter (NPCLIENT.16) - * - * - */ -int __stdcall NPCLIENT_NP_SetParameter(int arg0, int arg1) -{ - dbg_report("SetParameter request: %d %d\n", arg0, arg1); - TRACE("(void): stub\n"); - return (int) 0; -} -/****************************************************************** - * NP_StartCursor (NPCLIENT.17) - * - * - */ -int __stdcall NPCLIENT_NP_StartCursor(void) -{ - dbg_report("StartCursor request\n"); - TRACE("(void): stub\n"); - return (int) 0; -} -/****************************************************************** - * NP_StartDataTransmission (NPCLIENT.18) - * - * - */ -int __stdcall NPCLIENT_NP_StartDataTransmission(void) -{ - dbg_report("StartDataTransmission request\n"); - linuxtrack_wakeup(); - return 0; -} -/****************************************************************** - * NP_StopCursor (NPCLIENT.19) - * - * - */ -int __stdcall NPCLIENT_NP_StopCursor(void) -{ - dbg_report("StopCursor request\n"); - TRACE("(void): stub\n"); - return (int) 0; -} -/****************************************************************** - * NP_StopDataTransmission (NPCLIENT.20) - * - * - */ -int __stdcall NPCLIENT_NP_StopDataTransmission(void) -{ - dbg_report("StopDataTransmission request\n"); - linuxtrack_suspend(); - return 0; -} -/****************************************************************** - * NP_UnregisterWindowHandle (NPCLIENT.21) - * - * - */ -int __stdcall NPCLIENT_NP_UnregisterWindowHandle(void) -{ - dbg_report("UnregisterWindowHandle request\n"); - TRACE("(void): stub\n"); - return (int) 0; -} - diff --git a/contrib/very-important-source-code/important-stuff/game_data.c b/contrib/very-important-source-code/important-stuff/game_data.c deleted file mode 100644 index 48774187..00000000 --- a/contrib/very-important-source-code/important-stuff/game_data.c +++ /dev/null @@ -1,166 +0,0 @@ -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include - -//First 5 bytes is MD5 hash of "NaturalPoint" -static uint8_t secret_key[] = {0x0e, 0x9a, 0x63, 0x71, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static uint8_t S[256] = {0}; - -static char *decoded = NULL; - -static mxml_node_t *xml = NULL; -static mxml_node_t *tree = NULL; - -static void ksa(uint8_t key[], size_t len) -{ - unsigned int i, j; - for(i = 0; i < 256; ++i){ - S[i] = i; - } - j = 0; - for(i = 0; i < 256; ++i){ - j = (j + S[i] + key[i % len]) % 256; - uint8_t tmp = S[i]; - S[i] = S[j]; - S[j] = tmp; - } -} - -static uint8_t rc4() -{ - static uint8_t i = 0; - static uint8_t j = 0; - - i += 1; - j += S[i]; - uint8_t tmp = S[i]; - S[i] = S[j]; - S[j] = tmp; - return S[(S[i] + S[j]) % 256]; -} - -static bool decrypt_file(const char *fname, bool from_update) -{ - uint32_t header[5]; - size_t datlen; - ksa(secret_key, 16); - FILE *inp; - struct stat fst; - - if((inp = fopen(fname, "rb")) == NULL){ - printf("Can't open input file '%s'", fname); - return false; - } - - if(fstat(fileno(inp), &fst) != 0){ - fclose(inp); - printf("Cannot stat file '%s'\n", fname); - return false; - } - - if(from_update){ - if(fread(&header, sizeof(uint32_t), 5, inp) != 5){ - fclose(inp); - printf("Can't read the header - file '%s' is less than 20 bytes long?\n", fname); - return false; - } - datlen = header[4]; - }else{ - datlen = fst.st_size; - } - if((decoded = (char *)malloc(datlen+1)) == NULL){ - printf("malloc failed!\n"); - return false; - } - memset(decoded, 0, datlen+1); - size_t i; - size_t len = fread(decoded, 1, datlen, inp); - (void) len; - for(i = 0; i < datlen; ++i) decoded[i] ^= rc4(); - fclose(inp); - - //inp = fopen("tmp.dump", "w"); - //fwrite(decoded, 1, datlen, inp); - //fclose(inp); - - return true; -} - -static bool game_data_init(const char *fname, bool from_update) -{ - static bool initialized = false; - if(initialized){ - return true; - } - if(!decrypt_file(fname, from_update)){ - printf("Error decrypting file!\n"); - return false; - } - xml = mxmlNewXML("1.0"); - tree = mxmlLoadString(xml, decoded, MXML_TEXT_CALLBACK); - return (tree != NULL); -} - -static void game_data_close() -{ - mxmlDelete(tree); - free(decoded); -} - -#define ltr_int_log_message(...) fprintf(stderr, __VA_ARGS__) - -static void remove_newlines(const char* str, char* out, int out_len) -{ - int i, j; - int len = strlen(str); - for (i = 0, j = 0; str[i] && j + 1 < out_len; i++) - { - if (str[i] == '\r' || str[i] == '\n') - continue; - out[j++] = str[i]; - } - if (j < out_len) - out[j] = '\0'; -} - -bool get_game_data(const char *input_fname, const char *output_fname, bool from_update) -{ - FILE *outfile = NULL; - if((outfile = (output_fname ? fopen(output_fname, "w") : stdout)) == NULL){ - ltr_int_log_message("Can't open the output file '%s'!\n", output_fname); - return false; - } - if(!game_data_init(input_fname, from_update)){ - ltr_int_log_message("Can't process the data file '%s'!\n", input_fname); - return false; - } - - mxml_node_t *game; - const char *name; - const char *id; - for(game = mxmlFindElement(tree, tree, "Game", NULL, NULL, MXML_DESCEND); - game != NULL; - game = mxmlFindElement(game, tree, "Game", NULL, NULL, MXML_DESCEND)) - { - name = mxmlElementGetAttr(game, "Name"); - id = mxmlElementGetAttr(game, "Id"); - - mxml_node_t *appid = mxmlFindElement(game, game, "ApplicationID", NULL, NULL, MXML_DESCEND); - char name_[256]; - remove_newlines(name, name_, sizeof(name_)); - if(appid == NULL) - fprintf(outfile, "%s \"%s\"\n", id, name_); - else - fprintf(outfile, "%s \"%s\" (%s)\n", id, name_, appid->child->value.text.string); - } - fclose(outfile); - game_data_close(); - return true; -} - -int main(int argc, char** argv) { return argc > 1 && get_game_data(argv[1], NULL, false); } diff --git a/contrib/very-important-source-code/important-stuff/game_data.h b/contrib/very-important-source-code/important-stuff/game_data.h deleted file mode 100644 index b71f7a15..00000000 --- a/contrib/very-important-source-code/important-stuff/game_data.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef GAME_DATA__H -#define GAME_DATA__H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -bool get_game_data(const char *input_fname, const char *output_fname, bool from_update); - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/contrib/very-important-source-code/make-csv.pl b/contrib/very-important-source-code/make-csv.pl deleted file mode 100644 index 5dc265f8..00000000 --- a/contrib/very-important-source-code/make-csv.pl +++ /dev/null @@ -1,105 +0,0 @@ -#!/usr/bin/env perl - -use strict; -use List::Util qw'reduce'; - -use POSIX qw(locale_h); -setlocale(LC_ALL, "C"); - -sub get_games_1 -{ - my @games; - - open my $fd, "<", $ARGV[1] or die "open: $!"; - binmode $fd; - <$fd>; - - while (defined(my $line = <$fd>)) - { - $line =~ s/[\r\n]+$//s; - if ($line !~ /^(\d+)\s+"([^;"]+)"(?:\s+\(([0-9A-F]{16})\))?$/) - { - warn "Broken line"; - next; - } - next if $1 <= 0; - push @games, +{ id => $1, name => $2, key => $3 } - } - [sort { lc($a->{name}) cmp lc($b->{name}) } @games] -} - -sub get_games_2 -{ - open my $fd, "<", $ARGV[0] or die "open: $!"; - binmode $fd; - <$fd>; - my @games; - my %ids; - while (defined(my $line = <$fd>)) - { - $line =~ s/[\r\n]+$//s; - my @line = split/;/, $line; - if (@line != 8) - { - warn "Broken line"; - next; - } - my @cols = qw'no name proto since verified by id key'; - my $h = +{ map { $cols[$_] => $line[$_] } 0..$#cols }; - next if exists $ids{$h->{id}}; - $ids{$h->{id}} = undef; - next if $h->{id} <= 0; - push @games, $h; - } - [@games]; -} - -sub merge -{ - my ($new_games, $old_games) = @_; - my $no = (reduce { $a->{no} > $b->{no} ? $a : $b } +{id=>0}, @$old_games)->{no} + 1; - my %ids = map { $_->{id} => $_ } @$old_games; - binmode \*STDOUT; - for my $g (@$new_games) - { - my $id = $g->{id}; - my $no_ = $ids{$id} ? $ids{$id}->{no} : $no; - next if (exists($ids{$id}) && $ids{$id}->{verified} ne ''); - my $old = $ids{$id} || do { $no++; +{} }; - $ids{$id} = - +{ - no => $no_, - name => $g->{name}, - proto => 'FreeTrack20', - verified => '', - by => '', - id => $g->{id}, - %$old, - since => $g->{key} ? 'V170' : 'V160', - key => $g->{key} ? (sprintf "%04X", $no_) . $g->{key} . '00' : $old->{key} - }; - } - print "No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID\n"; - for (sort { $a->{no} <=> $b->{no} } values %ids) - { - my $g = {%$_}; - if (!defined $g->{key}) - { - $g->{key} = (sprintf "%04X", $g->{no}) . (join"", map { sprintf "%02X", int rand 256 } 0 .. 7) . '00'; - } - my @cols = qw'no name proto since verified by id key'; - print join";", map { $g->{$_} } @cols; - print "\n"; - } -} - -if (@ARGV != 2) -{ - warn "usage: $0 orig.csv dump.txt\n"; - exit 1; -} -else -{ - merge(get_games_1(), get_games_2()); - exit 0; -} diff --git a/contrib/very-important-source-code/tester/Makefile.am b/contrib/very-important-source-code/tester/Makefile.am deleted file mode 100644 index e025209a..00000000 --- a/contrib/very-important-source-code/tester/Makefile.am +++ /dev/null @@ -1,78 +0,0 @@ -noinst_SCRIPTS = -if WINE_PLUGIN - noinst_SCRIPTS += Tester.exe -if WINE64 - noinst_SCRIPTS += Tester64.exe -endif #WINE64 -endif #WINE_PLUGIN - -if DARWIN - LDFLAGS += -Wl,-no_arch_warnings -else - LDFLAGS += -Wl,--no-warn-search-mismatch -endif - -CC = winegcc - -CXX = wineg++ - -SUFFIXES = .o .cpp .c .rc 64.o - -.cpp.o : - $(CXX) -c $(CXXFLAGS) -m32 -o $@ $< - -.c.o : - $(CC) -c $(CFLAGS) -m32 -o $@ $< - -.cpp64.o : - $(CXX) -c $(CXXFLAGS) -o $@ $< - -.c64.o : - $(CC) -c $(CFLAGS) -o $@ $< - -.rc.o : - wrc -o $@ $(RCFLAGS) $< - -CXXFLAGS += -g -DHAVE_CONFIG_H -I../../.. -I. -I@srcdir@/../.. -I@top_builddir@ -CFLAGS += -g -I../.. -I../../.. -DHAVE_CONFIG_H -I@srcdir@/../.. -I@top_builddir@ -RCFLAGS = -I @srcdir@ -#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ -vpath %.h @srcdir@/../.. -vpath %.h @top_builddir@ -vpath %.c @srcdir@ -vpath %.c @srcdir@/../.. - - -Tester64.exe : main64.o rest64.o npifc64.o npview.o - wineg++ -g -o Tester64 -L. $(WINE64_LIBS) $(LDFLAGS) -Wall -Wextra $^ - -Tester.exe : main.o npview.o rest.o npifc.o - wineg++ -g -o Tester -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ - -main.o : main.cpp Makefile - -main64.o : main.cpp Makefile - -npview.o : npview.rc - -rest.o : rest.c rest.h Makefile - -rest64.o : rest.c rest.h Makefile - -npifc.o : npifc.c npifc.h Makefile - -npifc64.o : CFLAGS+="-DFOR_WIN64=1" -npifc64.o : npifc.c npifc.h Makefile - -clean-local: clean-local-check -.PHONY: clean-local-check -clean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -distclean-local: distclean-local-check -.PHONY: distclean-local-check -distclean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -EXTRA_DIST = main.cpp npifc.c npifc.h resource.h rest.c rest.h - diff --git a/contrib/very-important-source-code/tester/Makefile.in b/contrib/very-important-source-code/tester/Makefile.in deleted file mode 100644 index cc49d754..00000000 --- a/contrib/very-important-source-code/tester/Makefile.in +++ /dev/null @@ -1,512 +0,0 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@WINE_PLUGIN_TRUE@am__append_1 = Tester.exe -@WINE64_TRUE@@WINE_PLUGIN_TRUE@am__append_2 = Tester64.exe -@DARWIN_TRUE@am__append_3 = -Wl,-no_arch_warnings -@DARWIN_FALSE@am__append_4 = -Wl,--no-warn-search-mismatch -subdir = src/wine_bridge/tester -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(srcdir)/npview.rc.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = npview.rc -CONFIG_CLEAN_VPATH_FILES = -SCRIPTS = $(noinst_SCRIPTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -depcomp = -am__depfiles_maybe = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BISON = @BISON@ -CC = winegcc -CFLAGS = @CFLAGS@ -g -I../.. -I../../.. -DHAVE_CONFIG_H \ - -I@srcdir@/../.. -I@top_builddir@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = wineg++ -CXXCPP = @CXXCPP@ -CXXFLAGS = @CXXFLAGS@ -g -DHAVE_CONFIG_H -I../../.. -I. \ - -I@srcdir@/../.. -I@top_builddir@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ $(am__append_3) $(am__append_4) -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIB32DIR = @LIB32DIR@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJC = @OBJC@ -OBJCFLAGS = @OBJCFLAGS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OPENCV_CFLAGS = @OPENCV_CFLAGS@ -OPENCV_LIBS = @OPENCV_LIBS@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -QMAKE_PATH = @QMAKE_PATH@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -WINE64_LIBS = @WINE64_LIBS@ -WINE_LIBS = @WINE_LIBS@ -XPL_CPPFLAGS = @XPL_CPPFLAGS@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -ac_ct_OBJC = @ac_ct_OBJC@ -am__leading_dot = @am__leading_dot@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -with_makensis = @with_makensis@ -with_wine64 = @with_wine64@ -noinst_SCRIPTS = $(am__append_1) $(am__append_2) -SUFFIXES = .o .cpp .c .rc 64.o -RCFLAGS = -I @srcdir@ -EXTRA_DIST = main.cpp npifc.c npifc.h resource.h rest.c rest.h -all: all-am - -.SUFFIXES: -.SUFFIXES: .o .cpp .c .rc 64.o -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/tester/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu --ignore-deps src/wine_bridge/tester/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -npview.rc: $(top_builddir)/config.status $(srcdir)/npview.rc.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(SCRIPTS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-local mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-local - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - clean-local cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distclean-local distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ - uninstall-am - - -.cpp.o : - $(CXX) -c $(CXXFLAGS) -m32 -o $@ $< - -.c.o : - $(CC) -c $(CFLAGS) -m32 -o $@ $< - -.cpp64.o : - $(CXX) -c $(CXXFLAGS) -o $@ $< - -.c64.o : - $(CC) -c $(CFLAGS) -o $@ $< - -.rc.o : - wrc -o $@ $(RCFLAGS) $< -#VPATH = ../..:@srcdir@/../..:@top_builddir@:@srcdir@ -vpath %.h @srcdir@/../.. -vpath %.h @top_builddir@ -vpath %.c @srcdir@ -vpath %.c @srcdir@/../.. - -Tester64.exe : main64.o rest64.o npifc64.o npview.o - wineg++ -g -o Tester64 -L. $(WINE64_LIBS) $(LDFLAGS) -Wall -Wextra $^ - -Tester.exe : main.o npview.o rest.o npifc.o - wineg++ -g -o Tester -L. $(WINE_LIBS) $(LDFLAGS) -m32 -Wall -Wextra $^ - -main.o : main.cpp Makefile - -main64.o : main.cpp Makefile - -npview.o : npview.rc - -rest.o : rest.c rest.h Makefile - -rest64.o : rest.c rest.h Makefile - -npifc.o : npifc.c npifc.h Makefile - -npifc64.o : CFLAGS+="-DFOR_WIN64=1" -npifc64.o : npifc.c npifc.h Makefile - -clean-local: clean-local-check -.PHONY: clean-local-check -clean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -distclean-local: distclean-local-check -.PHONY: distclean-local-check -distclean-local-check: - rm -f *.exe* *.dll* *.sh *.o - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/contrib/very-important-source-code/tester/main.cpp b/contrib/very-important-source-code/tester/main.cpp deleted file mode 100644 index 95ca0d9b..00000000 --- a/contrib/very-important-source-code/tester/main.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#define WIN32_LEAN_AND_MEAN - -#include -#include -#include -#include "resource.h" -#include "rest.h" -#include "npifc.h" - -HINSTANCE hInst; -UINT_PTR timer = 0; - -VOID CALLBACK TimerProcedure(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) -{ - (void) uMsg; - (void) idEvent; - (void) dwTime; - tir_data_t td; - npifc_getdata(&td); - SetDlgItemInt(hwnd, IDC_PITCH, td.pitch, true); - SetDlgItemInt(hwnd, IDC_ROLL, td.roll, true); - SetDlgItemInt(hwnd, IDC_YAW, td.yaw, true); - - SetDlgItemInt(hwnd, IDC_X1, td.tx, true); - SetDlgItemInt(hwnd, IDC_Y1, td.ty, true); - SetDlgItemInt(hwnd, IDC_Z1, td.tz, true); - - SetDlgItemInt(hwnd, IDC_X2, td.padding[0], true); - SetDlgItemInt(hwnd, IDC_Y2, td.padding[1], true); - SetDlgItemInt(hwnd, IDC_Z2, td.padding[2], true); - SetDlgItemInt(hwnd, IDC_X3, td.padding[3], true); - SetDlgItemInt(hwnd, IDC_Y3, td.padding[4], true); - SetDlgItemInt(hwnd, IDC_Z3, td.padding[5], true); - SetDlgItemInt(hwnd, IDC_S, td.status, true); - SetDlgItemInt(hwnd, IDC_F, td.frame, true); -} - -BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - (void) lParam; - switch(uMsg) - { - case WM_INITDIALOG: - SetDlgItemInt(hwndDlg, IDC_APPID, 2307, true); - return TRUE; - - case WM_CLOSE: - EndDialog(hwndDlg, 0); - return TRUE; - - case WM_COMMAND: - switch(LOWORD(wParam)) - { - /* - * TODO: Add more control ID's, when needed. - */ - case IDQUIT: - npifc_close(); - EndDialog(hwndDlg, 0); - return TRUE; - case IDSTART: - int ok; - int num = GetDlgItemInt(hwndDlg, IDC_APPID, (BOOL*)&ok, false); - if(!ok){ - num = 2307; - } - game_desc_t gd; - if(timer != 0){ - KillTimer(hwndDlg, timer); - timer = 0; - } - if(game_data_get_desc(num, &gd)){ - printf("Application ID: %d - %s\n", num, gd.name); - if(npifc_init(hwndDlg, num)){ - timer = SetTimer(hwndDlg, 0, 50, TimerProcedure); - } - }else{ - printf("Unknown Application ID: %d\n", num); - } - break; - - } - } - - return FALSE; -} - - -int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) -{ - (void) hPrevInstance; - (void) lpCmdLine; - (void) nShowCmd; - hInst = hInstance; - - // The user interface is a modal dialog box - return DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DialogProc); -} - - diff --git a/contrib/very-important-source-code/tester/npifc.c b/contrib/very-important-source-code/tester/npifc.c deleted file mode 100644 index b036464e..00000000 --- a/contrib/very-important-source-code/tester/npifc.c +++ /dev/null @@ -1,302 +0,0 @@ -#define _GNU_SOURCE -#include -#include -#define WIN32_LEAN_AND_MEAN -#include -#include "npifc.h" -#include "rest.h" - - -tir_signature_t ts; -HMODULE npclient; -/* -typedef int (*NP_RegisterWindowHandle_t)(HWND hwnd); -typedef int (*NP_UnregisterWindowHandle_t)(void); -typedef int (*NP_RegisterProgramProfileID_t)(unsigned short id); -typedef int (*NP_QueryVersion_t)(unsigned short *version); -typedef int (*NP_RequestData_t)(unsigned short req); -typedef int (*NP_GetSignature_t)(tir_signature_t *sig); -typedef int (*NP_GetData_t)(tir_data_t *data); -typedef int (*NP_GetParameter_t)(void); -typedef int (*NP_SetParameter_t)(void); -typedef int (*NP_StartCursor_t)(void); -typedef int (*NP_StopCursor_t)(void); -typedef int (*NP_ReCenter_t)(void); -typedef int (*NP_StartDataTransmission_t)(void); -typedef int (*NP_StopDataTransmission_t)(void); -*/ -NP_RegisterWindowHandle_t NP_RegisterWindowHandle = NULL; -NP_UnregisterWindowHandle_t NP_UnregisterWindowHandle = NULL; -NP_RegisterProgramProfileID_t NP_RegisterProgramProfileID = NULL; -NP_QueryVersion_t NP_QueryVersion = NULL; -NP_RequestData_t NP_RequestData = NULL; -NP_GetSignature_t NP_GetSignature = NULL; -NP_GetData_t NP_GetData = NULL; -NP_GetParameter_t NP_GetParameter = NULL; -NP_SetParameter_t NP_SetParameter = NULL; -NP_StartCursor_t NP_StartCursor = NULL; -NP_StopCursor_t NP_StopCursor = NULL; -NP_ReCenter_t NP_ReCenter = NULL; -NP_StartDataTransmission_t NP_StartDataTransmission = NULL; -NP_StopDataTransmission_t NP_StopDataTransmission = NULL; - -bool crypted = false; - - - -unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -char *client_path() -{ - HKEY hkey = 0; - RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\NaturalPoint\\NATURALPOINT\\NPClient Location", 0, - KEY_QUERY_VALUE, &hkey); - if(!hkey){ - printf("Can't open registry key\n"); - return NULL; - } - - BYTE path[1024]; - DWORD buf_len = 1024; - LONG result = RegQueryValueEx(hkey, "Path", NULL, NULL, path, &buf_len); - char *full_path = NULL; - int res = -1; - if(result == ERROR_SUCCESS && buf_len > 0){ -#ifdef FOR_WIN64 - res = asprintf(&full_path, "%s/NPClient64.dll", path); -#else - res = asprintf(&full_path, "%s/NPClient.dll", path); -#endif - } - RegCloseKey(hkey); - if(res > 0){ - return full_path; - }else{ - return NULL; - } -} - -bool initialized = false; - -bool npifc_init(HWND wnd, int id) -{ - //table[] = {0xb3, 0x16, 0x36, 0xeb, 0xb9, 0x05, 0x4f, 0xa4}; - game_desc_t gd; - if(game_data_get_desc(id, &gd)){ - crypted = gd.encrypted; - if(gd.encrypted){ - table[0] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[1] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[2] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[3] = (unsigned char)(gd.key1&0xff); gd.key1 >>= 8; - table[4] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[5] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[6] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - table[7] = (unsigned char)(gd.key2&0xff); gd.key2 >>= 8; - } - } - printf("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", - table[0], table[1], table[2], table[3], - table[4], table[5], table[6], table[7]); - - char *client = client_path(); - if(client == NULL){ - printf("Couldn't obtain client path!\n"); - return false; - } - npclient = LoadLibrary(client); - if(!npclient){ - printf("Can't load client %s\n", client); - return false; - } - - NP_RegisterWindowHandle = (NP_RegisterWindowHandle_t)GetProcAddress(npclient, "NP_RegisterWindowHandle"); - NP_UnregisterWindowHandle = (NP_UnregisterWindowHandle_t)GetProcAddress(npclient, "NP_UnregisterWindowHandle"); - NP_RegisterProgramProfileID = (NP_RegisterProgramProfileID_t)GetProcAddress(npclient, "NP_RegisterProgramProfileID"); - NP_QueryVersion = (NP_QueryVersion_t)GetProcAddress(npclient, "NP_QueryVersion"); - NP_RequestData = (NP_RequestData_t)GetProcAddress(npclient, "NP_RequestData"); - NP_GetSignature = (NP_GetSignature_t)GetProcAddress(npclient, "NP_GetSignature"); - NP_GetData = (NP_GetData_t)GetProcAddress(npclient, "NP_GetData"); - NP_GetParameter = (NP_GetParameter_t)GetProcAddress(npclient, "NP_GetParameter"); - NP_SetParameter = (NP_SetParameter_t)GetProcAddress(npclient, "NP_SetParameter"); - NP_StartCursor = (NP_StartCursor_t)GetProcAddress(npclient, "NP_StartCursor"); - NP_StopCursor = (NP_StopCursor_t)GetProcAddress(npclient, "NP_StopCursor"); - NP_ReCenter = (NP_ReCenter_t)GetProcAddress(npclient, "NP_ReCenter"); - NP_StartDataTransmission = (NP_StartDataTransmission_t)GetProcAddress(npclient, "NP_StartDataTransmission"); - NP_StopDataTransmission = (NP_StopDataTransmission_t)GetProcAddress(npclient, "NP_StopDataTransmission"); - if((NP_RegisterWindowHandle == NULL) || (NP_UnregisterWindowHandle == NULL) - || (NP_RegisterProgramProfileID == NULL) || (NP_QueryVersion == NULL) || (NP_RequestData == NULL) - || (NP_GetSignature == NULL) || (NP_GetData == NULL) || (NP_GetParameter == NULL) - || (NP_SetParameter == NULL) || (NP_StartCursor == NULL) || (NP_StopCursor == NULL) - || (NP_ReCenter == NULL) || (NP_StartDataTransmission == NULL) || (NP_StopDataTransmission == NULL)){ - printf("Couldn't bind all necessary functions!\n"); - return false; - } - tir_signature_t sig; - int res; - if((res = NP_GetSignature(&sig)) != 0){ - printf("Error retrieving signature! %d\n", res); - return false; - } - printf("Dll Sig:%s\nApp Sig2:%s\n", sig.DllSignature, sig.AppSignature); - NP_RegisterWindowHandle(wnd); - if(NP_RegisterProgramProfileID(id) != 0){ - printf("Couldn't register profile id!\n"); - return false; - } - printf("Program profile registered!\n"); - NP_RequestData(65535); - NP_StopCursor(); - NP_StartDataTransmission(); - initialized = true; - return true; -} - -void npifc_close() -{ - if(initialized){ - NP_StopDataTransmission(); - NP_StartCursor(); - NP_UnregisterWindowHandle(); - } - initialized = false; -} - -void c_encrypt(unsigned char buf[], unsigned int size, - unsigned char code_table[], unsigned int table_size) -{ - unsigned int table_ptr = 0; - unsigned char var = 0x88; - unsigned char tmp; - if((size <= 0) || (table_size <= 0) || - (buf == NULL) || (code_table == NULL)) - return; - do{ - tmp = buf[--size]; - buf[size] = tmp ^ code_table[table_ptr] ^ var; - var += size + tmp; - ++table_ptr; - if(table_ptr >= table_size){ - table_ptr -= table_size; - } - }while(size != 0); -} - - - -void decrypt(unsigned char buf[], unsigned int size, - unsigned char code_table[], unsigned int table_size) -{ - unsigned int table_ptr = 0; - unsigned char var = 0x88; - unsigned char tmp; - if((size <= 0) || (table_size <= 0) || - (buf == NULL) || (code_table == NULL)){ - return; - } - do{ - tmp = buf[--size]; - buf[size] = tmp ^ code_table[table_ptr] ^ var; - var += size + buf[size]; - ++table_ptr; - if(table_ptr >= table_size){ - table_ptr -= table_size; - } - }while(size != 0); -} - -unsigned int cksum(unsigned char buf[], unsigned int size) -{ - if((size == 0) || (buf == NULL)){ - return 0; - } - int rounds = size >> 2; - int rem = size % 4; - - int c = size; - int a0 = 0; - int a2 = 0; - - while(rounds != 0){ - a0 = *(short int*)buf; - a2 = *(short int*)(buf+2); - buf += 4; - c += a0; - a2 ^= (c << 5); - a2 <<= 11; - c ^= a2; - c += (c >> 11); - --rounds; - } - switch(rem){ - case 3: - a0 = *(short int*)buf; - a2 = *(signed char*)(buf+2); - c += a0; - a2 = (a2 << 2) ^ c; - c ^= (a2 << 16); - a2 = (c >> 11); - break; - case 2: - a2 = *(short int*)buf; - c += a2; - c ^= (c << 11); - a2 = (c >> 17); - break; - case 1: - a2 = *(signed char*)(buf); - c += a2; - c ^= (c << 10); - a2 = (c >> 1); - break; - default: - break; - } - if(rem != 0){ - c+=a2; - } - - c ^= (c << 3); - c += (c >> 5); - c ^= (c << 4); - c += (c >> 17); - c ^= (c << 25); - c += (c >> 6); - - return (unsigned int)c; -} - -int decode_frame(tir_data_t *td) -{ - //printf("0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n", - // table[0], table[1], table[2], table[3], - // table[4], table[5], table[6], table[7]); - unsigned int csum; - decrypt((unsigned char*)td, sizeof(*td), table, sizeof(table)); - csum = td->cksum; - td->cksum = 0; - if(csum != cksum((unsigned char*)td, sizeof(*td))){ - printf("Problem with frame!\n"); - //int a0; - //printf("Dec: "); - //for(a0 = 0; a0 < (int)sizeof(tir_data_t); ++a0) - //{ - // printf("%02X", ((unsigned char *)td)[a0]); - //} - //printf("\n"); - //printf("Cksum: %04X vs computed: %04X\n", csum, cksum((unsigned char*)td, sizeof(*td))); - return -1; - } - //printf("Frame OK!\n"); - return 0; -} - -int npifc_getdata(tir_data_t *data) -{ - int res = NP_GetData(data); - if(crypted){ - decode_frame(data); - } - return res; -} - diff --git a/contrib/very-important-source-code/tester/npifc.h b/contrib/very-important-source-code/tester/npifc.h deleted file mode 100644 index d580e16d..00000000 --- a/contrib/very-important-source-code/tester/npifc.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef NPIFC__H -#define NPIFC__H - - -#include - -#ifdef __cplusplus -extern "C" { -#endif - bool npifc_init(HWND wnd, int id); - void npifc_close(); - -#pragma pack(1) -typedef struct tir_data{ - short status; - short frame; - unsigned int cksum; - float roll, pitch, yaw; - float tx, ty, tz; - float padding[9]; -} tir_data_t; - -typedef struct tir_signature{ - char DllSignature[200]; - char AppSignature[200]; -} tir_signature_t; -#pragma pack(0) - -int npifc_getdata(tir_data_t *data); - -typedef int __stdcall (*NP_RegisterWindowHandle_t)(HWND hwnd); -typedef int __stdcall (*NP_UnregisterWindowHandle_t)(void); -typedef int __stdcall (*NP_RegisterProgramProfileID_t)(unsigned short id); -typedef int __stdcall (*NP_QueryVersion_t)(unsigned short *version); -typedef int __stdcall (*NP_RequestData_t)(unsigned short req); -typedef int __stdcall (*NP_GetSignature_t)(tir_signature_t *sig); -typedef int __stdcall (*NP_GetData_t)(tir_data_t *data); -typedef int __stdcall (*NP_GetParameter_t)(void); -typedef int __stdcall (*NP_SetParameter_t)(void); -typedef int __stdcall (*NP_StartCursor_t)(void); -typedef int __stdcall (*NP_StopCursor_t)(void); -typedef int __stdcall (*NP_ReCenter_t)(void); -typedef int __stdcall (*NP_StartDataTransmission_t)(void); -typedef int __stdcall (*NP_StopDataTransmission_t)(void); - -extern NP_RegisterWindowHandle_t NP_RegisterWindowHandle; -extern NP_UnregisterWindowHandle_t NP_UnregisterWindowHandle; -extern NP_RegisterProgramProfileID_t NP_RegisterProgramProfileID; -extern NP_QueryVersion_t NP_QueryVersion; -extern NP_RequestData_t NP_RequestData; -extern NP_GetSignature_t NP_GetSignature; -extern NP_GetData_t NP_GetData; -extern NP_GetParameter_t NP_GetParameter; -extern NP_SetParameter_t NP_SetParameter; -extern NP_StartCursor_t NP_StartCursor; -extern NP_StopCursor_t NP_StopCursor; -extern NP_ReCenter_t NP_ReCenter; -extern NP_StartDataTransmission_t NP_StartDataTransmission; -extern NP_StopDataTransmission_t NP_StopDataTransmission; - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/contrib/very-important-source-code/tester/npview.rc.in b/contrib/very-important-source-code/tester/npview.rc.in deleted file mode 100644 index 231002f1..00000000 --- a/contrib/very-important-source-code/tester/npview.rc.in +++ /dev/null @@ -1,49 +0,0 @@ -// Generated by ResEdit 1.5.9 -// Copyright (C) 2006-2011 -// http://www.resedit.net - -#include -#include -#include -#include "resource.h" - -#ifdef HAVE_CONFIG_H - #include "../../../config.h" -#endif - - - -// -// Dialog resources -// -//LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -IDD_DIALOG1 DIALOGEX 0, 0, 379, 124 -STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU -CAPTION "NPTest v@PACKAGE_VERSION@" -FONT 8, "Ms Shell Dlg", 400, 0, 1 -{ - DEFPUSHBUTTON "Quit", IDQUIT, 262, 102, 50, 14 - DEFPUSHBUTTON "Start", IDSTART, 7, 102, 50, 14 - EDITTEXT IDC_PITCH, 32, 32, 51, 14, ES_AUTOHSCROLL - LTEXT "Pitch", IDC_STATIC, 11, 34, 20, 8, SS_LEFT - LTEXT "Yaw", IDC_STATIC, 11, 59, 20, 8, SS_LEFT - EDITTEXT IDC_YAW, 32, 57, 51, 14, ES_AUTOHSCROLL - LTEXT "Roll", IDC_STATIC, 11, 84, 20, 8, SS_LEFT - EDITTEXT IDC_ROLL, 32, 82, 51, 14, ES_AUTOHSCROLL - LTEXT "X", IDC_STATIC, 101, 35, 6, 8, SS_LEFT - EDITTEXT IDC_X1, 112, 32, 51, 14, ES_AUTOHSCROLL - LTEXT "Y", IDC_STATIC, 101, 60, 6, 8, SS_LEFT - EDITTEXT IDC_Y1, 112, 57, 51, 14, ES_AUTOHSCROLL - LTEXT "Z", IDC_STATIC, 101, 85, 6, 8, SS_LEFT - EDITTEXT IDC_Z1, 112, 82, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_X2, 172, 32, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_Y2, 172, 57, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_Z2, 172, 82, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_X3, 232, 32, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_Y3, 232, 57, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_Z3, 232, 82, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_S, 292, 32, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_F, 292, 57, 51, 14, ES_AUTOHSCROLL - EDITTEXT IDC_APPID, 32, 12, 51, 12, ES_AUTOHSCROLL - LTEXT "ID", IDC_STATIC, 17, 14, 8, 8, SS_LEFT -} diff --git a/contrib/very-important-source-code/tester/resource.h b/contrib/very-important-source-code/tester/resource.h deleted file mode 100644 index 328d9cb7..00000000 --- a/contrib/very-important-source-code/tester/resource.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef IDC_STATIC -#define IDC_STATIC (-1) -#endif - -#define IDD_DIALOG1 100 -#define IDQUIT 1002 -#define IDSTART 1003 -#define IDC_APPID 1016 -#define IDC_PITCH 1017 -#define IDC_YAW 1018 -#define IDC_ROLL 1019 -#define IDC_X1 1020 -#define IDC_X2 1021 -#define IDC_X3 1022 -#define IDC_Y1 1023 -#define IDC_Y2 1024 -#define IDC_Y3 1025 -#define IDC_Z1 1026 -#define IDC_Z2 1027 -#define IDC_Z3 1028 -#define IDC_S 1029 -#define IDC_F 1030 - -- cgit v1.2.3