diff options
Diffstat (limited to 'contrib-noinst/tester')
-rw-r--r-- | contrib-noinst/tester/Makefile.am | 78 | ||||
-rw-r--r-- | contrib-noinst/tester/Makefile.in | 512 | ||||
-rw-r--r-- | contrib-noinst/tester/main.cpp | 100 | ||||
-rw-r--r-- | contrib-noinst/tester/npifc.c | 302 | ||||
-rw-r--r-- | contrib-noinst/tester/npifc.h | 66 | ||||
-rw-r--r-- | contrib-noinst/tester/npview.rc.in | 49 | ||||
-rw-r--r-- | contrib-noinst/tester/resource.h | 23 |
7 files changed, 1130 insertions, 0 deletions
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 <windows.h> +#include <stdio.h> +#include <stdint.h> +#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 <stdio.h> +#include <stdint.h> +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#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 <stdbool.h> + +#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 <windows.h> +#include <commctrl.h> +#include <richedit.h> +#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 + |