From a41e0ce4d79b5fc8a896305b7fd8d66f0cedba8f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 26 Oct 2015 07:35:14 +0100 Subject: add description on wiki for camera offset --- facetracknoir/settings.ui | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/facetracknoir/settings.ui b/facetracknoir/settings.ui index d31f9b99..92d275b6 100644 --- a/facetracknoir/settings.ui +++ b/facetracknoir/settings.ui @@ -223,7 +223,7 @@ - Specify an angle for off-center camera as a basis for which direction is which, avoiding axis interconnect. + <html><head/><body><p>Specify an angle for off-center camera as a basis for which direction is which, avoiding axis interconnect. Also see <a href="https://github.com/opentrack/opentrack/wiki/choosing-camera-offset"><span style=" text-decoration: underline; color:#0000ff;">description on wiki</span></a>.</p></body></html> Qt::AlignJustify|Qt::AlignVCenter @@ -234,6 +234,9 @@ 2 + + true + -- cgit v1.2.3 From 7c8b01037e7dd6680d5cd9ba32c27c1a3ed52809 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 27 Oct 2015 08:56:11 +0100 Subject: add dropbox uploader to contrib --- clientfiles/dropbox-uploader/README | 1 + clientfiles/dropbox-uploader/dropbox_uploader.sh | 1364 ++++++++++++++++++++++ 2 files changed, 1365 insertions(+) create mode 100644 clientfiles/dropbox-uploader/README create mode 100644 clientfiles/dropbox-uploader/dropbox_uploader.sh diff --git a/clientfiles/dropbox-uploader/README b/clientfiles/dropbox-uploader/README new file mode 100644 index 00000000..49189e17 --- /dev/null +++ b/clientfiles/dropbox-uploader/README @@ -0,0 +1 @@ +From <https://github.com/andreafabrizi/Dropbox-Uploader> diff --git a/clientfiles/dropbox-uploader/dropbox_uploader.sh b/clientfiles/dropbox-uploader/dropbox_uploader.sh new file mode 100644 index 00000000..1e7b830e --- /dev/null +++ b/clientfiles/dropbox-uploader/dropbox_uploader.sh @@ -0,0 +1,1364 @@ +#!/usr/bin/env bash +# +# Dropbox Uploader +# +# Copyright (C) 2010-2014 Andrea Fabrizi +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# + +#Default configuration file +CONFIG_FILE=~/.dropbox_uploader + +#Default chunk size in Mb for the upload process +#It is recommended to increase this value only if you have enough free space on your /tmp partition +#Lower values may increase the number of http requests +CHUNK_SIZE=4 + +#Curl location +#If not set, curl will be searched into the $PATH +#CURL_BIN="/usr/bin/curl" + +#Default values +TMP_DIR="/tmp" +DEBUG=0 +QUIET=0 +SHOW_PROGRESSBAR=0 +SKIP_EXISTING_FILES=0 +ERROR_STATUS=0 + +#Don't edit these... +API_REQUEST_TOKEN_URL="https://api.dropbox.com/1/oauth/request_token" +API_USER_AUTH_URL="https://www.dropbox.com/1/oauth/authorize" +API_ACCESS_TOKEN_URL="https://api.dropbox.com/1/oauth/access_token" +API_CHUNKED_UPLOAD_URL="https://api-content.dropbox.com/1/chunked_upload" +API_CHUNKED_UPLOAD_COMMIT_URL="https://api-content.dropbox.com/1/commit_chunked_upload" +API_UPLOAD_URL="https://api-content.dropbox.com/1/files_put" +API_DOWNLOAD_URL="https://api-content.dropbox.com/1/files" +API_DELETE_URL="https://api.dropbox.com/1/fileops/delete" +API_MOVE_URL="https://api.dropbox.com/1/fileops/move" +API_COPY_URL="https://api.dropbox.com/1/fileops/copy" +API_METADATA_URL="https://api.dropbox.com/1/metadata" +API_INFO_URL="https://api.dropbox.com/1/account/info" +API_MKDIR_URL="https://api.dropbox.com/1/fileops/create_folder" +API_SHARES_URL="https://api.dropbox.com/1/shares" +API_SAVEURL_URL="https://api.dropbox.com/1/save_url/auto" +API_SAVEURL_JOB_URL="https://api.dropbox.com/1/save_url_job" +APP_CREATE_URL="https://www.dropbox.com/developers/apps" +RESPONSE_FILE="$TMP_DIR/du_resp_$RANDOM" +CHUNK_FILE="$TMP_DIR/du_chunk_$RANDOM" +TEMP_FILE="$TMP_DIR/du_tmp_$RANDOM" +BIN_DEPS="sed basename date grep stat dd mkdir" +VERSION="0.16" + +umask 077 + +#Check the shell +if [ -z "$BASH_VERSION" ]; then + echo -e "Error: this script requires the BASH shell!" + exit 1 +fi + +shopt -s nullglob #Bash allows filename patterns which match no files to expand to a null string, rather than themselves +shopt -s dotglob #Bash includes filenames beginning with a "." in the results of filename expansion + +#Look for optional config file parameter +while getopts ":qpskdf:" opt; do + case $opt in + + f) + CONFIG_FILE=$OPTARG + ;; + + d) + DEBUG=1 + ;; + + q) + QUIET=1 + ;; + + p) + SHOW_PROGRESSBAR=1 + ;; + + k) + CURL_ACCEPT_CERTIFICATES="-k" + ;; + + s) + SKIP_EXISTING_FILES=1 + ;; + + \?) + echo "Invalid option: -$OPTARG" >&2 + exit 1 + ;; + + :) + echo "Option -$OPTARG requires an argument." >&2 + exit 1 + ;; + + esac +done + +if [[ $DEBUG != 0 ]]; then + echo $VERSION + uname -a 2> /dev/null + cat /etc/issue 2> /dev/null + set -x + RESPONSE_FILE="$TMP_DIR/du_resp_debug" +fi + +if [[ $CURL_BIN == "" ]]; then + BIN_DEPS="$BIN_DEPS curl" + CURL_BIN="curl" +fi + +#Dependencies check +which $BIN_DEPS > /dev/null +if [[ $? != 0 ]]; then + for i in $BIN_DEPS; do + which $i > /dev/null || + NOT_FOUND="$i $NOT_FOUND" + done + echo -e "Error: Required program could not be found: $NOT_FOUND" + exit 1 +fi + +#Check if readlink is installed and supports the -m option +#It's not necessary, so no problem if it's not installed +which readlink > /dev/null +if [[ $? == 0 && $(readlink -m "//test" 2> /dev/null) == "/test" ]]; then + HAVE_READLINK=1 +else + HAVE_READLINK=0 +fi + +#Forcing to use the builtin printf, if it's present, because it's better +#otherwise the external printf program will be used +#Note that the external printf command can cause character encoding issues! +builtin printf "" 2> /dev/null +if [[ $? == 0 ]]; then + PRINTF="builtin printf" + PRINTF_OPT="-v o" +else + PRINTF=$(which printf) + if [[ $? != 0 ]]; then + echo -e "Error: Required program could not be found: printf" + fi + PRINTF_OPT="" +fi + +#Print the message based on $QUIET variable +function print +{ + if [[ $QUIET == 0 ]]; then + echo -ne "$1"; + fi +} + +#Returns unix timestamp +function utime +{ + echo $(date +%s) +} + +#Remove temporary files +function remove_temp_files +{ + if [[ $DEBUG == 0 ]]; then + rm -fr "$RESPONSE_FILE" + rm -fr "$CHUNK_FILE" + rm -fr "$TEMP_FILE" + fi +} + +#Returns the file size in bytes +function file_size +{ + #Generic GNU + SIZE=$(stat --format="%s" "$1" 2> /dev/null) + if [ $? -eq 0 ]; then + echo $SIZE + return + fi + + #Some embedded linux devices + SIZE=$(stat -c "%s" "$1" 2> /dev/null) + if [ $? -eq 0 ]; then + echo $SIZE + return + fi + + #BSD, OSX and other OSs + SIZE=$(stat -f "%z" "$1" 2> /dev/null) + if [ $? -eq 0 ]; then + echo $SIZE + return + fi + + echo "0" +} + + +#Usage +function usage +{ + echo -e "Dropbox Uploader v$VERSION" + echo -e "Andrea Fabrizi - andrea.fabrizi@gmail.com\n" + echo -e "Usage: $0 COMMAND [PARAMETERS]..." + echo -e "\nCommands:" + + echo -e "\t upload " + echo -e "\t download [LOCAL_FILE/DIR]" + echo -e "\t delete " + echo -e "\t move " + echo -e "\t copy " + echo -e "\t mkdir " + echo -e "\t list [REMOTE_DIR]" + echo -e "\t share " + echo -e "\t saveurl " + echo -e "\t info" + echo -e "\t unlink" + + echo -e "\nOptional parameters:" + echo -e "\t-f Load the configuration file from a specific file" + echo -e "\t-s Skip already existing files when download/upload. Default: Overwrite" + echo -e "\t-d Enable DEBUG mode" + echo -e "\t-q Quiet mode. Don't show messages" + echo -e "\t-p Show cURL progress meter" + echo -e "\t-k Doesn't check for SSL certificates (insecure)" + + echo -en "\nFor more info and examples, please see the README file.\n\n" + remove_temp_files + exit 1 +} + +#Check the curl exit code +function check_http_response +{ + CODE=$? + + #Checking curl exit code + case $CODE in + + #OK + 0) + + ;; + + #Proxy error + 5) + print "\nError: Couldn't resolve proxy. The given proxy host could not be resolved.\n" + + remove_temp_files + exit 1 + ;; + + #Missing CA certificates + 60|58) + print "\nError: cURL is not able to performs peer SSL certificate verification.\n" + print "Please, install the default ca-certificates bundle.\n" + print "To do this in a Debian/Ubuntu based system, try:\n" + print " sudo apt-get install ca-certificates\n\n" + print "If the problem persists, try to use the -k option (insecure).\n" + + remove_temp_files + exit 1 + ;; + + 6) + print "\nError: Couldn't resolve host.\n" + + remove_temp_files + exit 1 + ;; + + 7) + print "\nError: Couldn't connect to host.\n" + + remove_temp_files + exit 1 + ;; + + esac + + #Checking response file for generic errors + if grep -q "HTTP/1.1 400" "$RESPONSE_FILE"; then + ERROR_MSG=$(sed -n -e 's/{"error": "\([^"]*\)"}/\1/p' "$RESPONSE_FILE") + + case $ERROR_MSG in + *access?attempt?failed?because?this?app?is?not?configured?to?have*) + echo -e "\nError: The Permission type/Access level configured doesn't match the DropBox App settings!\nPlease run \"$0 unlink\" and try again." + exit 1 + ;; + esac + + fi + +} + +#Urlencode +function urlencode +{ + #The printf is necessary to correctly decode unicode sequences + local string=$($PRINTF "${1}") + local strlen=${#string} + local encoded="" + + for (( pos=0 ; pos 1 ]]; then + new_path="$new_path/" + fi + + echo "$new_path" + else + echo "$path" + fi +} + +#Check if it's a file or directory +#Returns FILE/DIR/ERR +function db_stat +{ + local FILE=$(normalize_path "$1") + + #Checking if it's a file or a directory + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" "$API_METADATA_URL/$ACCESS_LEVEL/$(urlencode "$FILE")?oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" 2> /dev/null + check_http_response + + #Even if the file/dir has been deleted from DropBox we receive a 200 OK response + #So we must check if the file exists or if it has been deleted + if grep -q "\"is_deleted\":" "$RESPONSE_FILE"; then + local IS_DELETED=$(sed -n 's/.*"is_deleted":.\([^,]*\).*/\1/p' "$RESPONSE_FILE") + else + local IS_DELETED="false" + fi + + #Exits... + grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE" + if [[ $? == 0 && $IS_DELETED != "true" ]]; then + + local IS_DIR=$(sed -n 's/^\(.*\)\"contents":.\[.*/\1/p' "$RESPONSE_FILE") + + #It's a directory + if [[ $IS_DIR != "" ]]; then + echo "DIR" + #It's a file + else + echo "FILE" + fi + + #Doesn't exists + else + echo "ERR" + fi +} + +#Generic upload wrapper around db_upload_file and db_upload_dir functions +#$1 = Local source file/dir +#$2 = Remote destination file/dir +function db_upload +{ + local SRC=$(normalize_path "$1") + local DST=$(normalize_path "$2") + + #Checking if the file/dir exists + if [[ ! -e $SRC && ! -d $SRC ]]; then + print " > No such file or directory: $SRC\n" + ERROR_STATUS=1 + return + fi + + #Checking if the file/dir has read permissions + if [[ ! -r $SRC ]]; then + print " > Error reading file $SRC: permission denied\n" + ERROR_STATUS=1 + return + fi + + TYPE=$(db_stat "$DST") + + #If DST it's a file, do nothing, it's the default behaviour + if [[ $TYPE == "FILE" ]]; then + DST="$DST" + + #if DST doesn't exists and doesn't ends with a /, it will be the destination file name + elif [[ $TYPE == "ERR" && "${DST: -1}" != "/" ]]; then + DST="$DST" + + #if DST doesn't exists and ends with a /, it will be the destination folder + elif [[ $TYPE == "ERR" && "${DST: -1}" == "/" ]]; then + local filename=$(basename "$SRC") + DST="$DST/$filename" + + #If DST it'a directory, it will be the destination folder + elif [[ $TYPE == "DIR" ]]; then + local filename=$(basename "$SRC") + DST="$DST/$filename" + fi + + #It's a directory + if [[ -d $SRC ]]; then + db_upload_dir "$SRC" "$DST" + + #It's a file + elif [[ -e $SRC ]]; then + db_upload_file "$SRC" "$DST" + + #Unsupported object... + else + print " > Skipping not regular file \"$SRC\"\n" + fi +} + +#Generic upload wrapper around db_chunked_upload_file and db_simple_upload_file +#The final upload function will be choosen based on the file size +#$1 = Local source file +#$2 = Remote destination file +function db_upload_file +{ + local FILE_SRC=$(normalize_path "$1") + local FILE_DST=$(normalize_path "$2") + + shopt -s nocasematch + + #Checking not allowed file names + basefile_dst=$(basename "$FILE_DST") + if [[ $basefile_dst == "thumbs.db" || \ + $basefile_dst == "desktop.ini" || \ + $basefile_dst == ".ds_store" || \ + $basefile_dst == "icon\r" || \ + $basefile_dst == ".dropbox" || \ + $basefile_dst == ".dropbox.attr" \ + ]]; then + print " > Skipping not allowed file name \"$FILE_DST\"\n" + return + fi + + shopt -u nocasematch + + #Checking file size + FILE_SIZE=$(file_size "$FILE_SRC") + + #Checking if the file already exists + TYPE=$(db_stat "$FILE_DST") + if [[ $TYPE != "ERR" && $SKIP_EXISTING_FILES == 1 ]]; then + print " > Skipping already existing file \"$FILE_DST\"\n" + return + fi + + if [[ $FILE_SIZE -gt 157286000 ]]; then + #If the file is greater than 150Mb, the chunked_upload API will be used + db_chunked_upload_file "$FILE_SRC" "$FILE_DST" + else + db_simple_upload_file "$FILE_SRC" "$FILE_DST" + fi + +} + +#Simple file upload +#$1 = Local source file +#$2 = Remote destination file +function db_simple_upload_file +{ + local FILE_SRC=$(normalize_path "$1") + local FILE_DST=$(normalize_path "$2") + + if [[ $SHOW_PROGRESSBAR == 1 && $QUIET == 0 ]]; then + CURL_PARAMETERS="--progress-bar" + LINE_CR="\n" + else + CURL_PARAMETERS="-s" + LINE_CR="" + fi + + print " > Uploading \"$FILE_SRC\" to \"$FILE_DST\"... $LINE_CR" + $CURL_BIN $CURL_ACCEPT_CERTIFICATES $CURL_PARAMETERS -i --globoff -o "$RESPONSE_FILE" --upload-file "$FILE_SRC" "$API_UPLOAD_URL/$ACCESS_LEVEL/$(urlencode "$FILE_DST")?oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print "DONE\n" + else + print "FAILED\n" + print "An error occurred requesting /upload\n" + ERROR_STATUS=1 + fi +} + +#Chunked file upload +#$1 = Local source file +#$2 = Remote destination file +function db_chunked_upload_file +{ + local FILE_SRC=$(normalize_path "$1") + local FILE_DST=$(normalize_path "$2") + + print " > Uploading \"$FILE_SRC\" to \"$FILE_DST\"" + + local FILE_SIZE=$(file_size "$FILE_SRC") + local OFFSET=0 + local UPLOAD_ID="" + local UPLOAD_ERROR=0 + local CHUNK_PARAMS="" + + #Uploading chunks... + while ([[ $OFFSET != $FILE_SIZE ]]); do + + let OFFSET_MB=$OFFSET/1024/1024 + + #Create the chunk + dd if="$FILE_SRC" of="$CHUNK_FILE" bs=1048576 skip=$OFFSET_MB count=$CHUNK_SIZE 2> /dev/null + + #Only for the first request these parameters are not included + if [[ $OFFSET != 0 ]]; then + CHUNK_PARAMS="upload_id=$UPLOAD_ID&offset=$OFFSET" + fi + + #Uploading the chunk... + echo > "$RESPONSE_FILE" + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --upload-file "$CHUNK_FILE" "$API_CHUNKED_UPLOAD_URL?$CHUNK_PARAMS&oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" 2> /dev/null + #check_http_response not needed, because we have to retry the request in case of error + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print "." + UPLOAD_ERROR=0 + UPLOAD_ID=$(sed -n 's/.*"upload_id": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") + OFFSET=$(sed -n 's/.*"offset": *\([^}]*\).*/\1/p' "$RESPONSE_FILE") + else + print "*" + let UPLOAD_ERROR=$UPLOAD_ERROR+1 + + #On error, the upload is retried for max 3 times + if [[ $UPLOAD_ERROR -gt 2 ]]; then + print " FAILED\n" + print "An error occurred requesting /chunked_upload\n" + ERROR_STATUS=1 + return + fi + fi + + done + + UPLOAD_ERROR=0 + + #Commit the upload + while (true); do + + echo > "$RESPONSE_FILE" + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "upload_id=$UPLOAD_ID&oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_CHUNKED_UPLOAD_COMMIT_URL/$ACCESS_LEVEL/$(urlencode "$FILE_DST")" 2> /dev/null + #check_http_response not needed, because we have to retry the request in case of error + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print "." + UPLOAD_ERROR=0 + break + else + print "*" + let UPLOAD_ERROR=$UPLOAD_ERROR+1 + + #On error, the commit is retried for max 3 times + if [[ $UPLOAD_ERROR -gt 2 ]]; then + print " FAILED\n" + print "An error occurred requesting /commit_chunked_upload\n" + ERROR_STATUS=1 + return + fi + fi + + done + + print " DONE\n" +} + +#Directory upload +#$1 = Local source dir +#$2 = Remote destination dir +function db_upload_dir +{ + local DIR_SRC=$(normalize_path "$1") + local DIR_DST=$(normalize_path "$2") + + #Creatig remote directory + db_mkdir "$DIR_DST" + + for file in "$DIR_SRC/"*; do + db_upload "$file" "$DIR_DST" + done +} + +#Generic download wrapper +#$1 = Remote source file/dir +#$2 = Local destination file/dir +function db_download +{ + local SRC=$(normalize_path "$1") + local DST=$(normalize_path "$2") + + TYPE=$(db_stat "$SRC") + + #It's a directory + if [[ $TYPE == "DIR" ]]; then + + #If the DST folder is not specified, I assume that is the current directory + if [[ $DST == "" ]]; then + DST="." + fi + + #Checking if the destination directory exists + if [[ ! -d $DST ]]; then + local basedir="" + else + local basedir=$(basename "$SRC") + fi + + local DEST_DIR=$(normalize_path "$DST/$basedir") + print " > Downloading \"$SRC\" to \"$DEST_DIR\"... \n" + print " > Creating local directory \"$DEST_DIR\"... " + mkdir -p "$DEST_DIR" + + #Check + if [[ $? == 0 ]]; then + print "DONE\n" + else + print "FAILED\n" + ERROR_STATUS=1 + return + fi + + #Extracting directory content [...] + #and replacing "}, {" with "}\n{" + #I don't like this piece of code... but seems to be the only way to do this with SED, writing a portable code... + local DIR_CONTENT=$(sed -n 's/.*: \[{\(.*\)/\1/p' "$RESPONSE_FILE" | sed 's/}, *{/}\ +{/g') + + #Extracting files and subfolders + TMP_DIR_CONTENT_FILE="${RESPONSE_FILE}_$RANDOM" + echo "$DIR_CONTENT" | sed -n 's/.*"path": *"\([^"]*\)",.*"is_dir": *\([^"]*\),.*/\1:\2/p' > $TMP_DIR_CONTENT_FILE + + #For each entry... + while read -r line; do + + local FILE=${line%:*} + local TYPE=${line#*:} + + #Removing unneeded / + FILE=${FILE##*/} + + if [[ $TYPE == "false" ]]; then + db_download_file "$SRC/$FILE" "$DEST_DIR/$FILE" + else + db_download "$SRC/$FILE" "$DEST_DIR" + fi + + done < $TMP_DIR_CONTENT_FILE + + rm -fr $TMP_DIR_CONTENT_FILE + + #It's a file + elif [[ $TYPE == "FILE" ]]; then + + #Checking DST + if [[ $DST == "" ]]; then + DST=$(basename "$SRC") + fi + + #If the destination is a directory, the file will be download into + if [[ -d $DST ]]; then + DST="$DST/$SRC" + fi + + db_download_file "$SRC" "$DST" + + #Doesn't exists + else + print " > No such file or directory: $SRC\n" + ERROR_STATUS=1 + return + fi +} + +#Simple file download +#$1 = Remote source file +#$2 = Local destination file +function db_download_file +{ + local FILE_SRC=$(normalize_path "$1") + local FILE_DST=$(normalize_path "$2") + + if [[ $SHOW_PROGRESSBAR == 1 && $QUIET == 0 ]]; then + CURL_PARAMETERS="--progress-bar" + LINE_CR="\n" + else + CURL_PARAMETERS="-s" + LINE_CR="" + fi + + #Checking if the file already exists + if [[ -e $FILE_DST && $SKIP_EXISTING_FILES == 1 ]]; then + print " > Skipping already existing file \"$FILE_DST\"\n" + return + fi + + #Creating the empty file, that for two reasons: + #1) In this way I can check if the destination file is writable or not + #2) Curl doesn't automatically creates files with 0 bytes size + dd if=/dev/zero of="$FILE_DST" count=0 2> /dev/null + if [[ $? != 0 ]]; then + print " > Error writing file $FILE_DST: permission denied\n" + ERROR_STATUS=1 + return + fi + + print " > Downloading \"$FILE_SRC\" to \"$FILE_DST\"... $LINE_CR" + $CURL_BIN $CURL_ACCEPT_CERTIFICATES $CURL_PARAMETERS --globoff -D "$RESPONSE_FILE" -o "$FILE_DST" "$API_DOWNLOAD_URL/$ACCESS_LEVEL/$(urlencode "$FILE_SRC")?oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print "DONE\n" + else + print "FAILED\n" + rm -fr "$FILE_DST" + ERROR_STATUS=1 + return + fi +} + +#Saveurl +#$1 = URL +#$2 = Remote file destination +function db_saveurl +{ + local URL="$1" + local FILE_DST=$(normalize_path "$2") + local FILE_NAME=$(basename "$URL") + + print " > Downloading \"$URL\" to \"$FILE_DST\"..." + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "url=$(urlencode "$URL")&oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_SAVEURL_URL/$FILE_DST/$FILE_NAME" 2> /dev/null + check_http_response + + JOB_ID=$(sed -n 's/.*"job": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") + if [[ $JOB_ID == "" ]]; then + print " > Error getting the job id\n" + return + fi + + #Checking the status + while (true); do + + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_SAVEURL_JOB_URL/$JOB_ID" 2> /dev/null + check_http_response + + STATUS=$(sed -n 's/.*"status": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") + case $STATUS in + + PENDING) + print "." + ;; + + DOWNLOADING) + print "+" + ;; + + COMPLETE) + print " DONE\n" + break + ;; + + FAILED) + print " ERROR\n" + MESSAGE=$(sed -n 's/.*"error": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") + print " > Error: $MESSAGE\n" + break + ;; + + esac + + sleep 2 + + done +} + +#Prints account info +function db_account_info +{ + print "Dropbox Uploader v$VERSION\n\n" + print " > Getting info... " + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_INFO_URL" 2> /dev/null + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + + name=$(sed -n 's/.*"display_name": "\([^"]*\).*/\1/p' "$RESPONSE_FILE") + echo -e "\n\nName:\t$name" + + uid=$(sed -n 's/.*"uid": \([0-9]*\).*/\1/p' "$RESPONSE_FILE") + echo -e "UID:\t$uid" + + email=$(sed -n 's/.*"email": "\([^"]*\).*/\1/p' "$RESPONSE_FILE") + echo -e "Email:\t$email" + + quota=$(sed -n 's/.*"quota": \([0-9]*\).*/\1/p' "$RESPONSE_FILE") + let quota_mb=$quota/1024/1024 + echo -e "Quota:\t$quota_mb Mb" + + used=$(sed -n 's/.*"normal": \([0-9]*\).*/\1/p' "$RESPONSE_FILE") + let used_mb=$used/1024/1024 + echo -e "Used:\t$used_mb Mb" + + let free_mb=($quota-$used)/1024/1024 + echo -e "Free:\t$free_mb Mb" + + echo "" + + else + print "FAILED\n" + ERROR_STATUS=1 + fi +} + +#Account unlink +function db_unlink +{ + echo -ne "Are you sure you want unlink this script from your Dropbox account? [y/n]" + read answer + if [[ $answer == "y" ]]; then + rm -fr "$CONFIG_FILE" + echo -ne "DONE\n" + fi +} + +#Delete a remote file +#$1 = Remote file to delete +function db_delete +{ + local FILE_DST=$(normalize_path "$1") + + print " > Deleting \"$FILE_DST\"... " + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM&root=$ACCESS_LEVEL&path=$(urlencode "$FILE_DST")" "$API_DELETE_URL" 2> /dev/null + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print "DONE\n" + else + print "FAILED\n" + ERROR_STATUS=1 + fi +} + +#Move/Rename a remote file +#$1 = Remote file to rename or move +#$2 = New file name or location +function db_move +{ + local FILE_SRC=$(normalize_path "$1") + local FILE_DST=$(normalize_path "$2") + + TYPE=$(db_stat "$FILE_DST") + + #If the destination it's a directory, the source will be moved into it + if [[ $TYPE == "DIR" ]]; then + local filename=$(basename "$FILE_SRC") + FILE_DST=$(normalize_path "$FILE_DST/$filename") + fi + + print " > Moving \"$FILE_SRC\" to \"$FILE_DST\" ... " + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM&root=$ACCESS_LEVEL&from_path=$(urlencode "$FILE_SRC")&to_path=$(urlencode "$FILE_DST")" "$API_MOVE_URL" 2> /dev/null + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print "DONE\n" + else + print "FAILED\n" + ERROR_STATUS=1 + fi +} + +#Copy a remote file to a remote location +#$1 = Remote file to rename or move +#$2 = New file name or location +function db_copy +{ + local FILE_SRC=$(normalize_path "$1") + local FILE_DST=$(normalize_path "$2") + + TYPE=$(db_stat "$FILE_DST") + + #If the destination it's a directory, the source will be copied into it + if [[ $TYPE == "DIR" ]]; then + local filename=$(basename "$FILE_SRC") + FILE_DST=$(normalize_path "$FILE_DST/$filename") + fi + + print " > Copying \"$FILE_SRC\" to \"$FILE_DST\" ... " + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM&root=$ACCESS_LEVEL&from_path=$(urlencode "$FILE_SRC")&to_path=$(urlencode "$FILE_DST")" "$API_COPY_URL" 2> /dev/null + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print "DONE\n" + else + print "FAILED\n" + ERROR_STATUS=1 + fi +} + +#Create a new directory +#$1 = Remote directory to create +function db_mkdir +{ + local DIR_DST=$(normalize_path "$1") + + print " > Creating Directory \"$DIR_DST\"... " + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM&root=$ACCESS_LEVEL&path=$(urlencode "$DIR_DST")" "$API_MKDIR_URL" 2> /dev/null + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print "DONE\n" + elif grep -q "^HTTP/1.1 403 Forbidden" "$RESPONSE_FILE"; then + print "ALREADY EXISTS\n" + else + print "FAILED\n" + ERROR_STATUS=1 + fi +} + +#List remote directory +#$1 = Remote directory +function db_list +{ + local DIR_DST=$(normalize_path "$1") + + print " > Listing \"$DIR_DST\"... " + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" "$API_METADATA_URL/$ACCESS_LEVEL/$(urlencode "$DIR_DST")?oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" 2> /dev/null + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + + local IS_DIR=$(sed -n 's/^\(.*\)\"contents":.\[.*/\1/p' "$RESPONSE_FILE") + + #It's a directory + if [[ $IS_DIR != "" ]]; then + + print "DONE\n" + + #Extracting directory content [...] + #and replacing "}, {" with "}\n{" + #I don't like this piece of code... but seems to be the only way to do this with SED, writing a portable code... + local DIR_CONTENT=$(sed -n 's/.*: \[{\(.*\)/\1/p' "$RESPONSE_FILE" | sed 's/}, *{/}\ +{/g') + + #Converting escaped quotes to unicode format + echo "$DIR_CONTENT" | sed 's/\\"/\\u0022/' > "$TEMP_FILE" + + #Extracting files and subfolders + rm -fr "$RESPONSE_FILE" + while read -r line; do + + local FILE=$(echo "$line" | sed -n 's/.*"path": *"\([^"]*\)".*/\1/p') + local IS_DIR=$(echo "$line" | sed -n 's/.*"is_dir": *\([^,]*\).*/\1/p') + local SIZE=$(echo "$line" | sed -n 's/.*"bytes": *\([0-9]*\).*/\1/p') + + echo -e "$FILE:$IS_DIR;$SIZE" >> "$RESPONSE_FILE" + + done < "$TEMP_FILE" + + #Looking for the biggest file size + #to calculate the padding to use + local padding=0 + while read -r line; do + local FILE=${line%:*} + local META=${line##*:} + local SIZE=${META#*;} + + if [[ ${#SIZE} -gt $padding ]]; then + padding=${#SIZE} + fi + done < "$RESPONSE_FILE" + + #For each entry, printing directories... + while read -r line; do + + local FILE=${line%:*} + local META=${line##*:} + local TYPE=${META%;*} + local SIZE=${META#*;} + + #Removing unneeded / + FILE=${FILE##*/} + + if [[ $TYPE == "true" ]]; then + FILE=$(echo -e "$FILE") + $PRINTF " [D] %-${padding}s %s\n" "$SIZE" "$FILE" + fi + + done < "$RESPONSE_FILE" + + #For each entry, printing files... + while read -r line; do + + local FILE=${line%:*} + local META=${line##*:} + local TYPE=${META%;*} + local SIZE=${META#*;} + + #Removing unneeded / + FILE=${FILE##*/} + + if [[ $TYPE == "false" ]]; then + FILE=$(echo -e "$FILE") + $PRINTF " [F] %-${padding}s %s\n" "$SIZE" "$FILE" + fi + + done < "$RESPONSE_FILE" + + #It's a file + else + print "FAILED: $DIR_DST is not a directory!\n" + ERROR_STATUS=1 + fi + + else + print "FAILED\n" + ERROR_STATUS=1 + fi +} + +#Share remote file +#$1 = Remote file +function db_share +{ + local FILE_DST=$(normalize_path "$1") + + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" "$API_SHARES_URL/$ACCESS_LEVEL/$(urlencode "$FILE_DST")?oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM&short_url=true" 2> /dev/null + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print " > Share link: " + SHARE_LINK=$(sed -n 's/.*"url": "\([^"]*\).*/\1/p' "$RESPONSE_FILE") + echo "$SHARE_LINK" + else + print "FAILED\n" + ERROR_STATUS=1 + fi +} + +################ +#### SETUP #### +################ + +#CHECKING FOR AUTH FILE +if [[ -e $CONFIG_FILE ]]; then + + #Loading data... and change old format config if necesary. + source "$CONFIG_FILE" 2>/dev/null || { + sed -i'' 's/:/=/' "$CONFIG_FILE" && source "$CONFIG_FILE" 2>/dev/null + } + + #Checking the loaded data + if [[ $APPKEY == "" || $APPSECRET == "" || $OAUTH_ACCESS_TOKEN_SECRET == "" || $OAUTH_ACCESS_TOKEN == "" ]]; then + echo -ne "Error loading data from $CONFIG_FILE...\n" + echo -ne "It is recommended to run $0 unlink\n" + remove_temp_files + exit 1 + fi + + #Back compatibility with previous Dropbox Uploader versions + if [[ $ACCESS_LEVEL == "" ]]; then + ACCESS_LEVEL="dropbox" + fi + +#NEW SETUP... +else + + echo -ne "\n This is the first time you run this script.\n\n" + echo -ne " 1) Open the following URL in your Browser, and log in using your account: $APP_CREATE_URL\n" + echo -ne " 2) Click on \"Create App\", then select \"Dropbox API app\"\n" + echo -ne " 3) Now go on with the configuration, choosing the app permissions and access restrictions to your DropBox folder\n" + echo -ne " 4) Enter the \"App Name\" that you prefer (e.g. MyUploader$RANDOM$RANDOM$RANDOM)\n\n" + + echo -ne " Now, click on the \"Create App\" button.\n\n" + + echo -ne " When your new App is successfully created, please type the\n" + echo -ne " App Key, App Secret and the Permission type shown in the confirmation page:\n\n" + + #Getting the app key and secret from the user + while (true); do + + echo -ne " # App key: " + read APPKEY + + echo -ne " # App secret: " + read APPSECRET + + echo -ne "\nPermission type:\n App folder [a]: If you choose that the app only needs access to files it creates\n Full Dropbox [f]: If you choose that the app needs access to files already on Dropbox\n\n # Permission type [a/f]: " + read ACCESS_LEVEL + + if [[ $ACCESS_LEVEL == "a" ]]; then + ACCESS_LEVEL="sandbox" + ACCESS_MSG="App Folder" + else + ACCESS_LEVEL="dropbox" + ACCESS_MSG="Full Dropbox" + fi + + echo -ne "\n > App key is $APPKEY, App secret is $APPSECRET and Access level is $ACCESS_MSG. Looks ok? [y/n]: " + read answer + if [[ $answer == "y" ]]; then + break; + fi + + done + + #TOKEN REQUESTS + echo -ne "\n > Token request... " + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_REQUEST_TOKEN_URL" 2> /dev/null + check_http_response + OAUTH_TOKEN_SECRET=$(sed -n 's/oauth_token_secret=\([a-z A-Z 0-9]*\).*/\1/p' "$RESPONSE_FILE") + OAUTH_TOKEN=$(sed -n 's/.*oauth_token=\([a-z A-Z 0-9]*\)/\1/p' "$RESPONSE_FILE") + + if [[ $OAUTH_TOKEN != "" && $OAUTH_TOKEN_SECRET != "" ]]; then + echo -ne "OK\n" + else + echo -ne " FAILED\n\n Please, check your App key and secret...\n\n" + remove_temp_files + exit 1 + fi + + while (true); do + + #USER AUTH + echo -ne "\n Please open the following URL in your browser, and allow Dropbox Uploader\n" + echo -ne " to access your DropBox folder:\n\n --> ${API_USER_AUTH_URL}?oauth_token=$OAUTH_TOKEN\n" + echo -ne "\nPress enter when done...\n" + read + + #API_ACCESS_TOKEN_URL + echo -ne " > Access Token request... " + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_ACCESS_TOKEN_URL" 2> /dev/null + check_http_response + OAUTH_ACCESS_TOKEN_SECRET=$(sed -n 's/oauth_token_secret=\([a-z A-Z 0-9]*\)&.*/\1/p' "$RESPONSE_FILE") + OAUTH_ACCESS_TOKEN=$(sed -n 's/.*oauth_token=\([a-z A-Z 0-9]*\)&.*/\1/p' "$RESPONSE_FILE") + OAUTH_ACCESS_UID=$(sed -n 's/.*uid=\([0-9]*\)/\1/p' "$RESPONSE_FILE") + + if [[ $OAUTH_ACCESS_TOKEN != "" && $OAUTH_ACCESS_TOKEN_SECRET != "" && $OAUTH_ACCESS_UID != "" ]]; then + echo -ne "OK\n" + + #Saving data in new format, compatible with source command. + echo "APPKEY=$APPKEY" > "$CONFIG_FILE" + echo "APPSECRET=$APPSECRET" >> "$CONFIG_FILE" + echo "ACCESS_LEVEL=$ACCESS_LEVEL" >> "$CONFIG_FILE" + echo "OAUTH_ACCESS_TOKEN=$OAUTH_ACCESS_TOKEN" >> "$CONFIG_FILE" + echo "OAUTH_ACCESS_TOKEN_SECRET=$OAUTH_ACCESS_TOKEN_SECRET" >> "$CONFIG_FILE" + + echo -ne "\n Setup completed!\n" + break + else + print " FAILED\n" + ERROR_STATUS=1 + fi + + done; + + remove_temp_files + exit $ERROR_STATUS +fi + +################ +#### START #### +################ + +COMMAND=${@:$OPTIND:1} +ARG1=${@:$OPTIND+1:1} +ARG2=${@:$OPTIND+2:1} + +let argnum=$#-$OPTIND + +#CHECKING PARAMS VALUES +case $COMMAND in + + upload) + + if [[ $argnum -lt 2 ]]; then + usage + fi + + FILE_DST=${@:$#:1} + + for (( i=$OPTIND+1; i<$#; i++ )); do + FILE_SRC=${@:$i:1} + db_upload "$FILE_SRC" "/$FILE_DST" + done + + ;; + + download) + + if [[ $argnum -lt 1 ]]; then + usage + fi + + FILE_SRC=$ARG1 + FILE_DST=$ARG2 + + db_download "/$FILE_SRC" "$FILE_DST" + + ;; + + saveurl) + + if [[ $argnum -lt 1 ]]; then + usage + fi + + URL=$ARG1 + FILE_DST=$ARG2 + + db_saveurl "$URL" "/$FILE_DST" + + ;; + + share) + + if [[ $argnum -lt 1 ]]; then + usage + fi + + FILE_DST=$ARG1 + + db_share "/$FILE_DST" + + ;; + + info) + + db_account_info + + ;; + + delete|remove) + + if [[ $argnum -lt 1 ]]; then + usage + fi + + FILE_DST=$ARG1 + + db_delete "/$FILE_DST" + + ;; + + move|rename) + + if [[ $argnum -lt 2 ]]; then + usage + fi + + FILE_SRC=$ARG1 + FILE_DST=$ARG2 + + db_move "/$FILE_SRC" "/$FILE_DST" + + ;; + + copy) + + if [[ $argnum -lt 2 ]]; then + usage + fi + + FILE_SRC=$ARG1 + FILE_DST=$ARG2 + + db_copy "/$FILE_SRC" "/$FILE_DST" + + ;; + + mkdir) + + if [[ $argnum -lt 1 ]]; then + usage + fi + + DIR_DST=$ARG1 + + db_mkdir "/$DIR_DST" + + ;; + + list) + + DIR_DST=$ARG1 + + #Checking DIR_DST + if [[ $DIR_DST == "" ]]; then + DIR_DST="/" + fi + + db_list "/$DIR_DST" + + ;; + + unlink) + + db_unlink + + ;; + + *) + + if [[ $COMMAND != "" ]]; then + print "Error: Unknown command: $COMMAND\n\n" + ERROR_STATUS=1 + fi + usage + + ;; + +esac + +remove_temp_files +exit $ERROR_STATUS -- cgit v1.2.3 From 192e1131873e66d2118afd7a6e13e5701053a4d0 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 27 Oct 2015 08:57:04 +0100 Subject: rename "clientfiles/" to "contrib/" as customary --- CMakeLists.txt | 5 +- clientfiles/FlightGear/Protocol/headtracker.xml | 54 - clientfiles/FlightGear/readme.txt | 8 - clientfiles/Tir4Fun/npclient.dll | Bin 53248 -> 0 bytes clientfiles/Tir4Fun/readme.txt | 9 - clientfiles/Tir4Fun/tir4fun.exe | Bin 36864 -> 0 bytes clientfiles/aruco/aruco_create_marker.exe | Bin 826368 -> 0 bytes clientfiles/aruco/test3.jpg | Bin 2145 -> 0 bytes clientfiles/cfs3/readme.txt | 27 - clientfiles/cfs3/tirviews.dll | Bin 109568 -> 0 bytes .../cute-octopus-vector-material_15-1831.jpg | Bin 71514 -> 0 bytes clientfiles/dropbox-uploader/README | 1 - clientfiles/dropbox-uploader/dropbox_uploader.sh | 1364 -------------------- .../freepie-udp/com.freepie.android.imu.apk | Bin 167989 -> 0 bytes clientfiles/freepie-udp/license.txt | 22 - clientfiles/freetracktest/freetracktest.exe | Bin 398848 -> 0 bytes clientfiles/freetracktest/readme.txt | 20 - clientfiles/fs2002 and fs2004/fsuipc.dll | Bin 210880 -> 0 bytes clientfiles/glovepie/facetracknoir2trackir.pie | 16 - clientfiles/glovepie/readme.txt | 24 - .../ppjoy/ppjoy mapping for facetracknoir.jpg | Bin 155205 -> 0 bytes clientfiles/ppjoy/readme.txt | 24 - .../very-important-source-code/README-CREDIT.txt | 6 - .../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 - clientfiles/very-important-source-code/make-csv.pl | 72 -- clientfiles/very-important-source-code/npclient.c | 587 --------- .../very-important-source-code/tester/Makefile.am | 78 -- .../very-important-source-code/tester/Makefile.in | 512 -------- .../very-important-source-code/tester/main.cpp | 100 -- .../very-important-source-code/tester/npifc.c | 302 ----- .../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 - clientfiles/vjoy/VJoy.dll | Bin 94208 -> 0 bytes contrib/FlightGear/Protocol/headtracker.xml | 54 + contrib/FlightGear/readme.txt | 8 + contrib/Tir4Fun/npclient.dll | Bin 0 -> 53248 bytes contrib/Tir4Fun/readme.txt | 9 + contrib/Tir4Fun/tir4fun.exe | Bin 0 -> 36864 bytes contrib/aruco/aruco_create_marker.exe | Bin 0 -> 826368 bytes contrib/aruco/test3.jpg | Bin 0 -> 2145 bytes contrib/cfs3/readme.txt | 27 + contrib/cfs3/tirviews.dll | Bin 0 -> 109568 bytes contrib/cute-octopus-vector-material_15-1831.jpg | Bin 0 -> 71514 bytes contrib/dropbox-uploader/README | 1 + contrib/dropbox-uploader/dropbox_uploader.sh | 1364 ++++++++++++++++++++ contrib/freepie-udp/com.freepie.android.imu.apk | Bin 0 -> 167989 bytes contrib/freepie-udp/license.txt | 22 + contrib/freetracktest/freetracktest.exe | Bin 0 -> 398848 bytes contrib/freetracktest/readme.txt | 20 + contrib/fs2002 and fs2004/fsuipc.dll | Bin 0 -> 210880 bytes contrib/glovepie/facetracknoir2trackir.pie | 16 + contrib/glovepie/readme.txt | 24 + contrib/ppjoy/ppjoy mapping for facetracknoir.jpg | Bin 0 -> 155205 bytes contrib/ppjoy/readme.txt | 24 + .../very-important-source-code/README-CREDIT.txt | 6 + .../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 | 72 ++ contrib/very-important-source-code/npclient.c | 587 +++++++++ .../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 + contrib/vjoy/VJoy.dll | Bin 0 -> 94208 bytes ftnoir_tracker_rs/ftnoir_tracker_rs.cpp | 2 +- ftnoir_tracker_rs/ftnoir_tracker_rs_controls.cpp | 2 +- 89 files changed, 4944 insertions(+), 4943 deletions(-) delete mode 100644 clientfiles/FlightGear/Protocol/headtracker.xml delete mode 100644 clientfiles/FlightGear/readme.txt delete mode 100644 clientfiles/Tir4Fun/npclient.dll delete mode 100644 clientfiles/Tir4Fun/readme.txt delete mode 100644 clientfiles/Tir4Fun/tir4fun.exe delete mode 100644 clientfiles/aruco/aruco_create_marker.exe delete mode 100644 clientfiles/aruco/test3.jpg delete mode 100644 clientfiles/cfs3/readme.txt delete mode 100644 clientfiles/cfs3/tirviews.dll delete mode 100644 clientfiles/cute-octopus-vector-material_15-1831.jpg delete mode 100644 clientfiles/dropbox-uploader/README delete mode 100644 clientfiles/dropbox-uploader/dropbox_uploader.sh delete mode 100644 clientfiles/freepie-udp/com.freepie.android.imu.apk delete mode 100644 clientfiles/freepie-udp/license.txt delete mode 100644 clientfiles/freetracktest/freetracktest.exe delete mode 100644 clientfiles/freetracktest/readme.txt delete mode 100644 clientfiles/fs2002 and fs2004/fsuipc.dll delete mode 100644 clientfiles/glovepie/facetracknoir2trackir.pie delete mode 100644 clientfiles/glovepie/readme.txt delete mode 100644 clientfiles/ppjoy/ppjoy mapping for facetracknoir.jpg delete mode 100644 clientfiles/ppjoy/readme.txt delete mode 100644 clientfiles/very-important-source-code/README-CREDIT.txt delete mode 100644 clientfiles/very-important-source-code/ft_tester/Makefile.am delete mode 100644 clientfiles/very-important-source-code/ft_tester/Makefile.in delete mode 100644 clientfiles/very-important-source-code/ft_tester/fttester.rc.in delete mode 100644 clientfiles/very-important-source-code/ft_tester/main.cpp delete mode 100644 clientfiles/very-important-source-code/ft_tester/resource.h delete mode 100644 clientfiles/very-important-source-code/important-stuff/NPClient.h delete mode 100644 clientfiles/very-important-source-code/important-stuff/NPClient.spec delete mode 100644 clientfiles/very-important-source-code/important-stuff/NPClient_dll.h delete mode 100644 clientfiles/very-important-source-code/important-stuff/NPClient_main.c delete mode 100644 clientfiles/very-important-source-code/important-stuff/game_data.c delete mode 100644 clientfiles/very-important-source-code/important-stuff/game_data.h delete mode 100644 clientfiles/very-important-source-code/make-csv.pl delete mode 100644 clientfiles/very-important-source-code/npclient.c delete mode 100644 clientfiles/very-important-source-code/tester/Makefile.am delete mode 100644 clientfiles/very-important-source-code/tester/Makefile.in delete mode 100644 clientfiles/very-important-source-code/tester/main.cpp delete mode 100644 clientfiles/very-important-source-code/tester/npifc.c delete mode 100644 clientfiles/very-important-source-code/tester/npifc.h delete mode 100644 clientfiles/very-important-source-code/tester/npview.rc.in delete mode 100644 clientfiles/very-important-source-code/tester/resource.h delete mode 100644 clientfiles/vjoy/VJoy.dll create mode 100644 contrib/FlightGear/Protocol/headtracker.xml create mode 100644 contrib/FlightGear/readme.txt create mode 100644 contrib/Tir4Fun/npclient.dll create mode 100644 contrib/Tir4Fun/readme.txt create mode 100644 contrib/Tir4Fun/tir4fun.exe create mode 100644 contrib/aruco/aruco_create_marker.exe create mode 100644 contrib/aruco/test3.jpg create mode 100644 contrib/cfs3/readme.txt create mode 100644 contrib/cfs3/tirviews.dll create mode 100644 contrib/cute-octopus-vector-material_15-1831.jpg create mode 100644 contrib/dropbox-uploader/README create mode 100644 contrib/dropbox-uploader/dropbox_uploader.sh create mode 100644 contrib/freepie-udp/com.freepie.android.imu.apk create mode 100644 contrib/freepie-udp/license.txt create mode 100644 contrib/freetracktest/freetracktest.exe create mode 100644 contrib/freetracktest/readme.txt create mode 100644 contrib/fs2002 and fs2004/fsuipc.dll create mode 100644 contrib/glovepie/facetracknoir2trackir.pie create mode 100644 contrib/glovepie/readme.txt create mode 100644 contrib/ppjoy/ppjoy mapping for facetracknoir.jpg create mode 100644 contrib/ppjoy/readme.txt create mode 100644 contrib/very-important-source-code/README-CREDIT.txt create mode 100644 contrib/very-important-source-code/ft_tester/Makefile.am create mode 100644 contrib/very-important-source-code/ft_tester/Makefile.in create mode 100644 contrib/very-important-source-code/ft_tester/fttester.rc.in create mode 100644 contrib/very-important-source-code/ft_tester/main.cpp create mode 100644 contrib/very-important-source-code/ft_tester/resource.h create mode 100644 contrib/very-important-source-code/important-stuff/NPClient.h create mode 100644 contrib/very-important-source-code/important-stuff/NPClient.spec create mode 100644 contrib/very-important-source-code/important-stuff/NPClient_dll.h create mode 100644 contrib/very-important-source-code/important-stuff/NPClient_main.c create mode 100644 contrib/very-important-source-code/important-stuff/game_data.c create mode 100644 contrib/very-important-source-code/important-stuff/game_data.h create mode 100644 contrib/very-important-source-code/make-csv.pl create mode 100644 contrib/very-important-source-code/npclient.c create mode 100644 contrib/very-important-source-code/tester/Makefile.am create mode 100644 contrib/very-important-source-code/tester/Makefile.in create mode 100644 contrib/very-important-source-code/tester/main.cpp create mode 100644 contrib/very-important-source-code/tester/npifc.c create mode 100644 contrib/very-important-source-code/tester/npifc.h create mode 100644 contrib/very-important-source-code/tester/npview.rc.in create mode 100644 contrib/very-important-source-code/tester/resource.h create mode 100644 contrib/vjoy/VJoy.dll diff --git a/CMakeLists.txt b/CMakeLists.txt index 36ffbfb7..420c9067 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -575,7 +575,7 @@ install(DIRECTORY ${CMAKE_SOURCE_DIR}/3rdparty-notices DESTINATION .) install(FILES "${CMAKE_SOURCE_DIR}/bin/freetrackclient.dll" DESTINATION . ${opentrack-perms}) install(FILES "${CMAKE_SOURCE_DIR}/bin/NPClient.dll" "${CMAKE_SOURCE_DIR}/bin/NPClient64.dll" "${CMAKE_SOURCE_DIR}/bin/TrackIR.exe" DESTINATION . ${opentrack-perms}) -install(DIRECTORY "${CMAKE_SOURCE_DIR}/bin/settings" "${CMAKE_SOURCE_DIR}/clientfiles" DESTINATION .) +install(DIRECTORY "${CMAKE_SOURCE_DIR}/bin/settings" "${CMAKE_SOURCE_DIR}/contrib" DESTINATION .) if(NOT WIN32 AND SDK_WINE_PREFIX AND NOT SDK_WINE_NO_WRAPPER) install(FILES "${CMAKE_BINARY_DIR}/opentrack-wrapper-wine.exe.so" @@ -594,7 +594,8 @@ endif() if(WIN32) install(FILES "${CMAKE_SOURCE_DIR}/ftnoir_tracker_rs/rs_impl/bin/opentrack-tracker-rs-impl.exe" DESTINATION . ${opentrack-perms}) - install(FILES "${CMAKE_SOURCE_DIR}/ftnoir_tracker_rs/redist/intel_rs_sdk_runtime_websetup_6.0.21.6598.exe" DESTINATION ./clientfiles/ ${opentrack-perms}) + install(FILES + "${CMAKE_SOURCE_DIR}/ftnoir_tracker_rs/redist/intel_rs_sdk_runtime_websetup_6.0.21.6598.exe" DESTINATION ./contrib/ ${opentrack-perms}) endif() if(APPLE) diff --git a/clientfiles/FlightGear/Protocol/headtracker.xml b/clientfiles/FlightGear/Protocol/headtracker.xml deleted file mode 100644 index 8c14119a..00000000 --- a/clientfiles/FlightGear/Protocol/headtracker.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - true - none - host - 52 - - - x - double - /sim/current-view/x-offset-m - - - - y - double - /sim/current-view/y-offset-m - - - - z - double - /sim/current-view/z-offset-m - - - - heading - double - /sim/current-view/heading-offset-deg - - - - pitch - double - /sim/current-view/pitch-offset-deg - - - - roll - double - /sim/current-view/roll-offset-deg - - - - status - int - /sim/current-view/headtracker-debug-status - - - - diff --git a/clientfiles/FlightGear/readme.txt b/clientfiles/FlightGear/readme.txt deleted file mode 100644 index 48cee837..00000000 --- a/clientfiles/FlightGear/readme.txt +++ /dev/null @@ -1,8 +0,0 @@ -Copy Protocol/headtracker.xml to fgdata/Protocol/headtracker.xml - -$ fgfs --generic=socket,in,25,localhost,5542,udp,headtracker - -Adjust paths as necessary. - -cheers, --sh 20131008 diff --git a/clientfiles/Tir4Fun/npclient.dll b/clientfiles/Tir4Fun/npclient.dll deleted file mode 100644 index e392442e..00000000 Binary files a/clientfiles/Tir4Fun/npclient.dll and /dev/null differ diff --git a/clientfiles/Tir4Fun/readme.txt b/clientfiles/Tir4Fun/readme.txt deleted file mode 100644 index d64af301..00000000 --- a/clientfiles/Tir4Fun/readme.txt +++ /dev/null @@ -1,9 +0,0 @@ -What is TIR4FUN? - -TIR4FUN is a free utility for dedicated gamers. It enables 6DOF POV control with mouse and joystick axes. - -Software is provided as it is. Configuration is straightforward. GUI says it all! - -Installation: - -Copy all files to a directory. Launch tir4fun.exe to bring up the GUI. diff --git a/clientfiles/Tir4Fun/tir4fun.exe b/clientfiles/Tir4Fun/tir4fun.exe deleted file mode 100644 index a51eced0..00000000 Binary files a/clientfiles/Tir4Fun/tir4fun.exe and /dev/null differ diff --git a/clientfiles/aruco/aruco_create_marker.exe b/clientfiles/aruco/aruco_create_marker.exe deleted file mode 100644 index 4400e80e..00000000 Binary files a/clientfiles/aruco/aruco_create_marker.exe and /dev/null differ diff --git a/clientfiles/aruco/test3.jpg b/clientfiles/aruco/test3.jpg deleted file mode 100644 index 2ff6dbd0..00000000 Binary files a/clientfiles/aruco/test3.jpg and /dev/null differ diff --git a/clientfiles/cfs3/readme.txt b/clientfiles/cfs3/readme.txt deleted file mode 100644 index e51cebfa..00000000 --- a/clientfiles/cfs3/readme.txt +++ /dev/null @@ -1,27 +0,0 @@ -FaceTrackNoIR for - - * Combat Flight Simulator 3 (also works for Over Flanders Fields) - * Wings of War - * NASCAR Racing Season 2003 - * Colin McRae Rally 4 - * Race Driver 2 - * F1 Challenge - * Richard Burns Rally - -FaceTrackNoIR was made compatible with these programs with the help of the functions TrackIR provides in the dll TIRViews.dll. -This dll can be downloaded from the TrackIR website: http://www.naturalpoint.com/trackir/06-support/support-download-software-and-manuals.html - -To make the functions work, copy the dll in the FaceTrackNoIR installation folder. Then tick the 'use TIRViews.dll' checkbox for the 'fake TrackIR' game protocol. - -Please let us know if you like the program, if you have ideas for improvements or any questions you might have. - - - -The FaceTrackNoIR team: - -Wim Vriend -Ron Hendriks - - - -Disclaimer: For usage of 3rd party software like FlightGear, the FaceTrackNoIR team is not responsible. Use it at your own risk. \ No newline at end of file diff --git a/clientfiles/cfs3/tirviews.dll b/clientfiles/cfs3/tirviews.dll deleted file mode 100644 index a1fb306f..00000000 Binary files a/clientfiles/cfs3/tirviews.dll and /dev/null differ diff --git a/clientfiles/cute-octopus-vector-material_15-1831.jpg b/clientfiles/cute-octopus-vector-material_15-1831.jpg deleted file mode 100644 index c4e5318f..00000000 Binary files a/clientfiles/cute-octopus-vector-material_15-1831.jpg and /dev/null differ diff --git a/clientfiles/dropbox-uploader/README b/clientfiles/dropbox-uploader/README deleted file mode 100644 index 49189e17..00000000 --- a/clientfiles/dropbox-uploader/README +++ /dev/null @@ -1 +0,0 @@ -From <https://github.com/andreafabrizi/Dropbox-Uploader> diff --git a/clientfiles/dropbox-uploader/dropbox_uploader.sh b/clientfiles/dropbox-uploader/dropbox_uploader.sh deleted file mode 100644 index 1e7b830e..00000000 --- a/clientfiles/dropbox-uploader/dropbox_uploader.sh +++ /dev/null @@ -1,1364 +0,0 @@ -#!/usr/bin/env bash -# -# Dropbox Uploader -# -# Copyright (C) 2010-2014 Andrea Fabrizi -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# - -#Default configuration file -CONFIG_FILE=~/.dropbox_uploader - -#Default chunk size in Mb for the upload process -#It is recommended to increase this value only if you have enough free space on your /tmp partition -#Lower values may increase the number of http requests -CHUNK_SIZE=4 - -#Curl location -#If not set, curl will be searched into the $PATH -#CURL_BIN="/usr/bin/curl" - -#Default values -TMP_DIR="/tmp" -DEBUG=0 -QUIET=0 -SHOW_PROGRESSBAR=0 -SKIP_EXISTING_FILES=0 -ERROR_STATUS=0 - -#Don't edit these... -API_REQUEST_TOKEN_URL="https://api.dropbox.com/1/oauth/request_token" -API_USER_AUTH_URL="https://www.dropbox.com/1/oauth/authorize" -API_ACCESS_TOKEN_URL="https://api.dropbox.com/1/oauth/access_token" -API_CHUNKED_UPLOAD_URL="https://api-content.dropbox.com/1/chunked_upload" -API_CHUNKED_UPLOAD_COMMIT_URL="https://api-content.dropbox.com/1/commit_chunked_upload" -API_UPLOAD_URL="https://api-content.dropbox.com/1/files_put" -API_DOWNLOAD_URL="https://api-content.dropbox.com/1/files" -API_DELETE_URL="https://api.dropbox.com/1/fileops/delete" -API_MOVE_URL="https://api.dropbox.com/1/fileops/move" -API_COPY_URL="https://api.dropbox.com/1/fileops/copy" -API_METADATA_URL="https://api.dropbox.com/1/metadata" -API_INFO_URL="https://api.dropbox.com/1/account/info" -API_MKDIR_URL="https://api.dropbox.com/1/fileops/create_folder" -API_SHARES_URL="https://api.dropbox.com/1/shares" -API_SAVEURL_URL="https://api.dropbox.com/1/save_url/auto" -API_SAVEURL_JOB_URL="https://api.dropbox.com/1/save_url_job" -APP_CREATE_URL="https://www.dropbox.com/developers/apps" -RESPONSE_FILE="$TMP_DIR/du_resp_$RANDOM" -CHUNK_FILE="$TMP_DIR/du_chunk_$RANDOM" -TEMP_FILE="$TMP_DIR/du_tmp_$RANDOM" -BIN_DEPS="sed basename date grep stat dd mkdir" -VERSION="0.16" - -umask 077 - -#Check the shell -if [ -z "$BASH_VERSION" ]; then - echo -e "Error: this script requires the BASH shell!" - exit 1 -fi - -shopt -s nullglob #Bash allows filename patterns which match no files to expand to a null string, rather than themselves -shopt -s dotglob #Bash includes filenames beginning with a "." in the results of filename expansion - -#Look for optional config file parameter -while getopts ":qpskdf:" opt; do - case $opt in - - f) - CONFIG_FILE=$OPTARG - ;; - - d) - DEBUG=1 - ;; - - q) - QUIET=1 - ;; - - p) - SHOW_PROGRESSBAR=1 - ;; - - k) - CURL_ACCEPT_CERTIFICATES="-k" - ;; - - s) - SKIP_EXISTING_FILES=1 - ;; - - \?) - echo "Invalid option: -$OPTARG" >&2 - exit 1 - ;; - - :) - echo "Option -$OPTARG requires an argument." >&2 - exit 1 - ;; - - esac -done - -if [[ $DEBUG != 0 ]]; then - echo $VERSION - uname -a 2> /dev/null - cat /etc/issue 2> /dev/null - set -x - RESPONSE_FILE="$TMP_DIR/du_resp_debug" -fi - -if [[ $CURL_BIN == "" ]]; then - BIN_DEPS="$BIN_DEPS curl" - CURL_BIN="curl" -fi - -#Dependencies check -which $BIN_DEPS > /dev/null -if [[ $? != 0 ]]; then - for i in $BIN_DEPS; do - which $i > /dev/null || - NOT_FOUND="$i $NOT_FOUND" - done - echo -e "Error: Required program could not be found: $NOT_FOUND" - exit 1 -fi - -#Check if readlink is installed and supports the -m option -#It's not necessary, so no problem if it's not installed -which readlink > /dev/null -if [[ $? == 0 && $(readlink -m "//test" 2> /dev/null) == "/test" ]]; then - HAVE_READLINK=1 -else - HAVE_READLINK=0 -fi - -#Forcing to use the builtin printf, if it's present, because it's better -#otherwise the external printf program will be used -#Note that the external printf command can cause character encoding issues! -builtin printf "" 2> /dev/null -if [[ $? == 0 ]]; then - PRINTF="builtin printf" - PRINTF_OPT="-v o" -else - PRINTF=$(which printf) - if [[ $? != 0 ]]; then - echo -e "Error: Required program could not be found: printf" - fi - PRINTF_OPT="" -fi - -#Print the message based on $QUIET variable -function print -{ - if [[ $QUIET == 0 ]]; then - echo -ne "$1"; - fi -} - -#Returns unix timestamp -function utime -{ - echo $(date +%s) -} - -#Remove temporary files -function remove_temp_files -{ - if [[ $DEBUG == 0 ]]; then - rm -fr "$RESPONSE_FILE" - rm -fr "$CHUNK_FILE" - rm -fr "$TEMP_FILE" - fi -} - -#Returns the file size in bytes -function file_size -{ - #Generic GNU - SIZE=$(stat --format="%s" "$1" 2> /dev/null) - if [ $? -eq 0 ]; then - echo $SIZE - return - fi - - #Some embedded linux devices - SIZE=$(stat -c "%s" "$1" 2> /dev/null) - if [ $? -eq 0 ]; then - echo $SIZE - return - fi - - #BSD, OSX and other OSs - SIZE=$(stat -f "%z" "$1" 2> /dev/null) - if [ $? -eq 0 ]; then - echo $SIZE - return - fi - - echo "0" -} - - -#Usage -function usage -{ - echo -e "Dropbox Uploader v$VERSION" - echo -e "Andrea Fabrizi - andrea.fabrizi@gmail.com\n" - echo -e "Usage: $0 COMMAND [PARAMETERS]..." - echo -e "\nCommands:" - - echo -e "\t upload " - echo -e "\t download [LOCAL_FILE/DIR]" - echo -e "\t delete " - echo -e "\t move " - echo -e "\t copy " - echo -e "\t mkdir " - echo -e "\t list [REMOTE_DIR]" - echo -e "\t share " - echo -e "\t saveurl " - echo -e "\t info" - echo -e "\t unlink" - - echo -e "\nOptional parameters:" - echo -e "\t-f Load the configuration file from a specific file" - echo -e "\t-s Skip already existing files when download/upload. Default: Overwrite" - echo -e "\t-d Enable DEBUG mode" - echo -e "\t-q Quiet mode. Don't show messages" - echo -e "\t-p Show cURL progress meter" - echo -e "\t-k Doesn't check for SSL certificates (insecure)" - - echo -en "\nFor more info and examples, please see the README file.\n\n" - remove_temp_files - exit 1 -} - -#Check the curl exit code -function check_http_response -{ - CODE=$? - - #Checking curl exit code - case $CODE in - - #OK - 0) - - ;; - - #Proxy error - 5) - print "\nError: Couldn't resolve proxy. The given proxy host could not be resolved.\n" - - remove_temp_files - exit 1 - ;; - - #Missing CA certificates - 60|58) - print "\nError: cURL is not able to performs peer SSL certificate verification.\n" - print "Please, install the default ca-certificates bundle.\n" - print "To do this in a Debian/Ubuntu based system, try:\n" - print " sudo apt-get install ca-certificates\n\n" - print "If the problem persists, try to use the -k option (insecure).\n" - - remove_temp_files - exit 1 - ;; - - 6) - print "\nError: Couldn't resolve host.\n" - - remove_temp_files - exit 1 - ;; - - 7) - print "\nError: Couldn't connect to host.\n" - - remove_temp_files - exit 1 - ;; - - esac - - #Checking response file for generic errors - if grep -q "HTTP/1.1 400" "$RESPONSE_FILE"; then - ERROR_MSG=$(sed -n -e 's/{"error": "\([^"]*\)"}/\1/p' "$RESPONSE_FILE") - - case $ERROR_MSG in - *access?attempt?failed?because?this?app?is?not?configured?to?have*) - echo -e "\nError: The Permission type/Access level configured doesn't match the DropBox App settings!\nPlease run \"$0 unlink\" and try again." - exit 1 - ;; - esac - - fi - -} - -#Urlencode -function urlencode -{ - #The printf is necessary to correctly decode unicode sequences - local string=$($PRINTF "${1}") - local strlen=${#string} - local encoded="" - - for (( pos=0 ; pos 1 ]]; then - new_path="$new_path/" - fi - - echo "$new_path" - else - echo "$path" - fi -} - -#Check if it's a file or directory -#Returns FILE/DIR/ERR -function db_stat -{ - local FILE=$(normalize_path "$1") - - #Checking if it's a file or a directory - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" "$API_METADATA_URL/$ACCESS_LEVEL/$(urlencode "$FILE")?oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" 2> /dev/null - check_http_response - - #Even if the file/dir has been deleted from DropBox we receive a 200 OK response - #So we must check if the file exists or if it has been deleted - if grep -q "\"is_deleted\":" "$RESPONSE_FILE"; then - local IS_DELETED=$(sed -n 's/.*"is_deleted":.\([^,]*\).*/\1/p' "$RESPONSE_FILE") - else - local IS_DELETED="false" - fi - - #Exits... - grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE" - if [[ $? == 0 && $IS_DELETED != "true" ]]; then - - local IS_DIR=$(sed -n 's/^\(.*\)\"contents":.\[.*/\1/p' "$RESPONSE_FILE") - - #It's a directory - if [[ $IS_DIR != "" ]]; then - echo "DIR" - #It's a file - else - echo "FILE" - fi - - #Doesn't exists - else - echo "ERR" - fi -} - -#Generic upload wrapper around db_upload_file and db_upload_dir functions -#$1 = Local source file/dir -#$2 = Remote destination file/dir -function db_upload -{ - local SRC=$(normalize_path "$1") - local DST=$(normalize_path "$2") - - #Checking if the file/dir exists - if [[ ! -e $SRC && ! -d $SRC ]]; then - print " > No such file or directory: $SRC\n" - ERROR_STATUS=1 - return - fi - - #Checking if the file/dir has read permissions - if [[ ! -r $SRC ]]; then - print " > Error reading file $SRC: permission denied\n" - ERROR_STATUS=1 - return - fi - - TYPE=$(db_stat "$DST") - - #If DST it's a file, do nothing, it's the default behaviour - if [[ $TYPE == "FILE" ]]; then - DST="$DST" - - #if DST doesn't exists and doesn't ends with a /, it will be the destination file name - elif [[ $TYPE == "ERR" && "${DST: -1}" != "/" ]]; then - DST="$DST" - - #if DST doesn't exists and ends with a /, it will be the destination folder - elif [[ $TYPE == "ERR" && "${DST: -1}" == "/" ]]; then - local filename=$(basename "$SRC") - DST="$DST/$filename" - - #If DST it'a directory, it will be the destination folder - elif [[ $TYPE == "DIR" ]]; then - local filename=$(basename "$SRC") - DST="$DST/$filename" - fi - - #It's a directory - if [[ -d $SRC ]]; then - db_upload_dir "$SRC" "$DST" - - #It's a file - elif [[ -e $SRC ]]; then - db_upload_file "$SRC" "$DST" - - #Unsupported object... - else - print " > Skipping not regular file \"$SRC\"\n" - fi -} - -#Generic upload wrapper around db_chunked_upload_file and db_simple_upload_file -#The final upload function will be choosen based on the file size -#$1 = Local source file -#$2 = Remote destination file -function db_upload_file -{ - local FILE_SRC=$(normalize_path "$1") - local FILE_DST=$(normalize_path "$2") - - shopt -s nocasematch - - #Checking not allowed file names - basefile_dst=$(basename "$FILE_DST") - if [[ $basefile_dst == "thumbs.db" || \ - $basefile_dst == "desktop.ini" || \ - $basefile_dst == ".ds_store" || \ - $basefile_dst == "icon\r" || \ - $basefile_dst == ".dropbox" || \ - $basefile_dst == ".dropbox.attr" \ - ]]; then - print " > Skipping not allowed file name \"$FILE_DST\"\n" - return - fi - - shopt -u nocasematch - - #Checking file size - FILE_SIZE=$(file_size "$FILE_SRC") - - #Checking if the file already exists - TYPE=$(db_stat "$FILE_DST") - if [[ $TYPE != "ERR" && $SKIP_EXISTING_FILES == 1 ]]; then - print " > Skipping already existing file \"$FILE_DST\"\n" - return - fi - - if [[ $FILE_SIZE -gt 157286000 ]]; then - #If the file is greater than 150Mb, the chunked_upload API will be used - db_chunked_upload_file "$FILE_SRC" "$FILE_DST" - else - db_simple_upload_file "$FILE_SRC" "$FILE_DST" - fi - -} - -#Simple file upload -#$1 = Local source file -#$2 = Remote destination file -function db_simple_upload_file -{ - local FILE_SRC=$(normalize_path "$1") - local FILE_DST=$(normalize_path "$2") - - if [[ $SHOW_PROGRESSBAR == 1 && $QUIET == 0 ]]; then - CURL_PARAMETERS="--progress-bar" - LINE_CR="\n" - else - CURL_PARAMETERS="-s" - LINE_CR="" - fi - - print " > Uploading \"$FILE_SRC\" to \"$FILE_DST\"... $LINE_CR" - $CURL_BIN $CURL_ACCEPT_CERTIFICATES $CURL_PARAMETERS -i --globoff -o "$RESPONSE_FILE" --upload-file "$FILE_SRC" "$API_UPLOAD_URL/$ACCESS_LEVEL/$(urlencode "$FILE_DST")?oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print "DONE\n" - else - print "FAILED\n" - print "An error occurred requesting /upload\n" - ERROR_STATUS=1 - fi -} - -#Chunked file upload -#$1 = Local source file -#$2 = Remote destination file -function db_chunked_upload_file -{ - local FILE_SRC=$(normalize_path "$1") - local FILE_DST=$(normalize_path "$2") - - print " > Uploading \"$FILE_SRC\" to \"$FILE_DST\"" - - local FILE_SIZE=$(file_size "$FILE_SRC") - local OFFSET=0 - local UPLOAD_ID="" - local UPLOAD_ERROR=0 - local CHUNK_PARAMS="" - - #Uploading chunks... - while ([[ $OFFSET != $FILE_SIZE ]]); do - - let OFFSET_MB=$OFFSET/1024/1024 - - #Create the chunk - dd if="$FILE_SRC" of="$CHUNK_FILE" bs=1048576 skip=$OFFSET_MB count=$CHUNK_SIZE 2> /dev/null - - #Only for the first request these parameters are not included - if [[ $OFFSET != 0 ]]; then - CHUNK_PARAMS="upload_id=$UPLOAD_ID&offset=$OFFSET" - fi - - #Uploading the chunk... - echo > "$RESPONSE_FILE" - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --upload-file "$CHUNK_FILE" "$API_CHUNKED_UPLOAD_URL?$CHUNK_PARAMS&oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" 2> /dev/null - #check_http_response not needed, because we have to retry the request in case of error - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print "." - UPLOAD_ERROR=0 - UPLOAD_ID=$(sed -n 's/.*"upload_id": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") - OFFSET=$(sed -n 's/.*"offset": *\([^}]*\).*/\1/p' "$RESPONSE_FILE") - else - print "*" - let UPLOAD_ERROR=$UPLOAD_ERROR+1 - - #On error, the upload is retried for max 3 times - if [[ $UPLOAD_ERROR -gt 2 ]]; then - print " FAILED\n" - print "An error occurred requesting /chunked_upload\n" - ERROR_STATUS=1 - return - fi - fi - - done - - UPLOAD_ERROR=0 - - #Commit the upload - while (true); do - - echo > "$RESPONSE_FILE" - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "upload_id=$UPLOAD_ID&oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_CHUNKED_UPLOAD_COMMIT_URL/$ACCESS_LEVEL/$(urlencode "$FILE_DST")" 2> /dev/null - #check_http_response not needed, because we have to retry the request in case of error - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print "." - UPLOAD_ERROR=0 - break - else - print "*" - let UPLOAD_ERROR=$UPLOAD_ERROR+1 - - #On error, the commit is retried for max 3 times - if [[ $UPLOAD_ERROR -gt 2 ]]; then - print " FAILED\n" - print "An error occurred requesting /commit_chunked_upload\n" - ERROR_STATUS=1 - return - fi - fi - - done - - print " DONE\n" -} - -#Directory upload -#$1 = Local source dir -#$2 = Remote destination dir -function db_upload_dir -{ - local DIR_SRC=$(normalize_path "$1") - local DIR_DST=$(normalize_path "$2") - - #Creatig remote directory - db_mkdir "$DIR_DST" - - for file in "$DIR_SRC/"*; do - db_upload "$file" "$DIR_DST" - done -} - -#Generic download wrapper -#$1 = Remote source file/dir -#$2 = Local destination file/dir -function db_download -{ - local SRC=$(normalize_path "$1") - local DST=$(normalize_path "$2") - - TYPE=$(db_stat "$SRC") - - #It's a directory - if [[ $TYPE == "DIR" ]]; then - - #If the DST folder is not specified, I assume that is the current directory - if [[ $DST == "" ]]; then - DST="." - fi - - #Checking if the destination directory exists - if [[ ! -d $DST ]]; then - local basedir="" - else - local basedir=$(basename "$SRC") - fi - - local DEST_DIR=$(normalize_path "$DST/$basedir") - print " > Downloading \"$SRC\" to \"$DEST_DIR\"... \n" - print " > Creating local directory \"$DEST_DIR\"... " - mkdir -p "$DEST_DIR" - - #Check - if [[ $? == 0 ]]; then - print "DONE\n" - else - print "FAILED\n" - ERROR_STATUS=1 - return - fi - - #Extracting directory content [...] - #and replacing "}, {" with "}\n{" - #I don't like this piece of code... but seems to be the only way to do this with SED, writing a portable code... - local DIR_CONTENT=$(sed -n 's/.*: \[{\(.*\)/\1/p' "$RESPONSE_FILE" | sed 's/}, *{/}\ -{/g') - - #Extracting files and subfolders - TMP_DIR_CONTENT_FILE="${RESPONSE_FILE}_$RANDOM" - echo "$DIR_CONTENT" | sed -n 's/.*"path": *"\([^"]*\)",.*"is_dir": *\([^"]*\),.*/\1:\2/p' > $TMP_DIR_CONTENT_FILE - - #For each entry... - while read -r line; do - - local FILE=${line%:*} - local TYPE=${line#*:} - - #Removing unneeded / - FILE=${FILE##*/} - - if [[ $TYPE == "false" ]]; then - db_download_file "$SRC/$FILE" "$DEST_DIR/$FILE" - else - db_download "$SRC/$FILE" "$DEST_DIR" - fi - - done < $TMP_DIR_CONTENT_FILE - - rm -fr $TMP_DIR_CONTENT_FILE - - #It's a file - elif [[ $TYPE == "FILE" ]]; then - - #Checking DST - if [[ $DST == "" ]]; then - DST=$(basename "$SRC") - fi - - #If the destination is a directory, the file will be download into - if [[ -d $DST ]]; then - DST="$DST/$SRC" - fi - - db_download_file "$SRC" "$DST" - - #Doesn't exists - else - print " > No such file or directory: $SRC\n" - ERROR_STATUS=1 - return - fi -} - -#Simple file download -#$1 = Remote source file -#$2 = Local destination file -function db_download_file -{ - local FILE_SRC=$(normalize_path "$1") - local FILE_DST=$(normalize_path "$2") - - if [[ $SHOW_PROGRESSBAR == 1 && $QUIET == 0 ]]; then - CURL_PARAMETERS="--progress-bar" - LINE_CR="\n" - else - CURL_PARAMETERS="-s" - LINE_CR="" - fi - - #Checking if the file already exists - if [[ -e $FILE_DST && $SKIP_EXISTING_FILES == 1 ]]; then - print " > Skipping already existing file \"$FILE_DST\"\n" - return - fi - - #Creating the empty file, that for two reasons: - #1) In this way I can check if the destination file is writable or not - #2) Curl doesn't automatically creates files with 0 bytes size - dd if=/dev/zero of="$FILE_DST" count=0 2> /dev/null - if [[ $? != 0 ]]; then - print " > Error writing file $FILE_DST: permission denied\n" - ERROR_STATUS=1 - return - fi - - print " > Downloading \"$FILE_SRC\" to \"$FILE_DST\"... $LINE_CR" - $CURL_BIN $CURL_ACCEPT_CERTIFICATES $CURL_PARAMETERS --globoff -D "$RESPONSE_FILE" -o "$FILE_DST" "$API_DOWNLOAD_URL/$ACCESS_LEVEL/$(urlencode "$FILE_SRC")?oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print "DONE\n" - else - print "FAILED\n" - rm -fr "$FILE_DST" - ERROR_STATUS=1 - return - fi -} - -#Saveurl -#$1 = URL -#$2 = Remote file destination -function db_saveurl -{ - local URL="$1" - local FILE_DST=$(normalize_path "$2") - local FILE_NAME=$(basename "$URL") - - print " > Downloading \"$URL\" to \"$FILE_DST\"..." - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "url=$(urlencode "$URL")&oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_SAVEURL_URL/$FILE_DST/$FILE_NAME" 2> /dev/null - check_http_response - - JOB_ID=$(sed -n 's/.*"job": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") - if [[ $JOB_ID == "" ]]; then - print " > Error getting the job id\n" - return - fi - - #Checking the status - while (true); do - - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_SAVEURL_JOB_URL/$JOB_ID" 2> /dev/null - check_http_response - - STATUS=$(sed -n 's/.*"status": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") - case $STATUS in - - PENDING) - print "." - ;; - - DOWNLOADING) - print "+" - ;; - - COMPLETE) - print " DONE\n" - break - ;; - - FAILED) - print " ERROR\n" - MESSAGE=$(sed -n 's/.*"error": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") - print " > Error: $MESSAGE\n" - break - ;; - - esac - - sleep 2 - - done -} - -#Prints account info -function db_account_info -{ - print "Dropbox Uploader v$VERSION\n\n" - print " > Getting info... " - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_INFO_URL" 2> /dev/null - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - - name=$(sed -n 's/.*"display_name": "\([^"]*\).*/\1/p' "$RESPONSE_FILE") - echo -e "\n\nName:\t$name" - - uid=$(sed -n 's/.*"uid": \([0-9]*\).*/\1/p' "$RESPONSE_FILE") - echo -e "UID:\t$uid" - - email=$(sed -n 's/.*"email": "\([^"]*\).*/\1/p' "$RESPONSE_FILE") - echo -e "Email:\t$email" - - quota=$(sed -n 's/.*"quota": \([0-9]*\).*/\1/p' "$RESPONSE_FILE") - let quota_mb=$quota/1024/1024 - echo -e "Quota:\t$quota_mb Mb" - - used=$(sed -n 's/.*"normal": \([0-9]*\).*/\1/p' "$RESPONSE_FILE") - let used_mb=$used/1024/1024 - echo -e "Used:\t$used_mb Mb" - - let free_mb=($quota-$used)/1024/1024 - echo -e "Free:\t$free_mb Mb" - - echo "" - - else - print "FAILED\n" - ERROR_STATUS=1 - fi -} - -#Account unlink -function db_unlink -{ - echo -ne "Are you sure you want unlink this script from your Dropbox account? [y/n]" - read answer - if [[ $answer == "y" ]]; then - rm -fr "$CONFIG_FILE" - echo -ne "DONE\n" - fi -} - -#Delete a remote file -#$1 = Remote file to delete -function db_delete -{ - local FILE_DST=$(normalize_path "$1") - - print " > Deleting \"$FILE_DST\"... " - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM&root=$ACCESS_LEVEL&path=$(urlencode "$FILE_DST")" "$API_DELETE_URL" 2> /dev/null - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print "DONE\n" - else - print "FAILED\n" - ERROR_STATUS=1 - fi -} - -#Move/Rename a remote file -#$1 = Remote file to rename or move -#$2 = New file name or location -function db_move -{ - local FILE_SRC=$(normalize_path "$1") - local FILE_DST=$(normalize_path "$2") - - TYPE=$(db_stat "$FILE_DST") - - #If the destination it's a directory, the source will be moved into it - if [[ $TYPE == "DIR" ]]; then - local filename=$(basename "$FILE_SRC") - FILE_DST=$(normalize_path "$FILE_DST/$filename") - fi - - print " > Moving \"$FILE_SRC\" to \"$FILE_DST\" ... " - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM&root=$ACCESS_LEVEL&from_path=$(urlencode "$FILE_SRC")&to_path=$(urlencode "$FILE_DST")" "$API_MOVE_URL" 2> /dev/null - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print "DONE\n" - else - print "FAILED\n" - ERROR_STATUS=1 - fi -} - -#Copy a remote file to a remote location -#$1 = Remote file to rename or move -#$2 = New file name or location -function db_copy -{ - local FILE_SRC=$(normalize_path "$1") - local FILE_DST=$(normalize_path "$2") - - TYPE=$(db_stat "$FILE_DST") - - #If the destination it's a directory, the source will be copied into it - if [[ $TYPE == "DIR" ]]; then - local filename=$(basename "$FILE_SRC") - FILE_DST=$(normalize_path "$FILE_DST/$filename") - fi - - print " > Copying \"$FILE_SRC\" to \"$FILE_DST\" ... " - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM&root=$ACCESS_LEVEL&from_path=$(urlencode "$FILE_SRC")&to_path=$(urlencode "$FILE_DST")" "$API_COPY_URL" 2> /dev/null - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print "DONE\n" - else - print "FAILED\n" - ERROR_STATUS=1 - fi -} - -#Create a new directory -#$1 = Remote directory to create -function db_mkdir -{ - local DIR_DST=$(normalize_path "$1") - - print " > Creating Directory \"$DIR_DST\"... " - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM&root=$ACCESS_LEVEL&path=$(urlencode "$DIR_DST")" "$API_MKDIR_URL" 2> /dev/null - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print "DONE\n" - elif grep -q "^HTTP/1.1 403 Forbidden" "$RESPONSE_FILE"; then - print "ALREADY EXISTS\n" - else - print "FAILED\n" - ERROR_STATUS=1 - fi -} - -#List remote directory -#$1 = Remote directory -function db_list -{ - local DIR_DST=$(normalize_path "$1") - - print " > Listing \"$DIR_DST\"... " - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" "$API_METADATA_URL/$ACCESS_LEVEL/$(urlencode "$DIR_DST")?oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" 2> /dev/null - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - - local IS_DIR=$(sed -n 's/^\(.*\)\"contents":.\[.*/\1/p' "$RESPONSE_FILE") - - #It's a directory - if [[ $IS_DIR != "" ]]; then - - print "DONE\n" - - #Extracting directory content [...] - #and replacing "}, {" with "}\n{" - #I don't like this piece of code... but seems to be the only way to do this with SED, writing a portable code... - local DIR_CONTENT=$(sed -n 's/.*: \[{\(.*\)/\1/p' "$RESPONSE_FILE" | sed 's/}, *{/}\ -{/g') - - #Converting escaped quotes to unicode format - echo "$DIR_CONTENT" | sed 's/\\"/\\u0022/' > "$TEMP_FILE" - - #Extracting files and subfolders - rm -fr "$RESPONSE_FILE" - while read -r line; do - - local FILE=$(echo "$line" | sed -n 's/.*"path": *"\([^"]*\)".*/\1/p') - local IS_DIR=$(echo "$line" | sed -n 's/.*"is_dir": *\([^,]*\).*/\1/p') - local SIZE=$(echo "$line" | sed -n 's/.*"bytes": *\([0-9]*\).*/\1/p') - - echo -e "$FILE:$IS_DIR;$SIZE" >> "$RESPONSE_FILE" - - done < "$TEMP_FILE" - - #Looking for the biggest file size - #to calculate the padding to use - local padding=0 - while read -r line; do - local FILE=${line%:*} - local META=${line##*:} - local SIZE=${META#*;} - - if [[ ${#SIZE} -gt $padding ]]; then - padding=${#SIZE} - fi - done < "$RESPONSE_FILE" - - #For each entry, printing directories... - while read -r line; do - - local FILE=${line%:*} - local META=${line##*:} - local TYPE=${META%;*} - local SIZE=${META#*;} - - #Removing unneeded / - FILE=${FILE##*/} - - if [[ $TYPE == "true" ]]; then - FILE=$(echo -e "$FILE") - $PRINTF " [D] %-${padding}s %s\n" "$SIZE" "$FILE" - fi - - done < "$RESPONSE_FILE" - - #For each entry, printing files... - while read -r line; do - - local FILE=${line%:*} - local META=${line##*:} - local TYPE=${META%;*} - local SIZE=${META#*;} - - #Removing unneeded / - FILE=${FILE##*/} - - if [[ $TYPE == "false" ]]; then - FILE=$(echo -e "$FILE") - $PRINTF " [F] %-${padding}s %s\n" "$SIZE" "$FILE" - fi - - done < "$RESPONSE_FILE" - - #It's a file - else - print "FAILED: $DIR_DST is not a directory!\n" - ERROR_STATUS=1 - fi - - else - print "FAILED\n" - ERROR_STATUS=1 - fi -} - -#Share remote file -#$1 = Remote file -function db_share -{ - local FILE_DST=$(normalize_path "$1") - - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" "$API_SHARES_URL/$ACCESS_LEVEL/$(urlencode "$FILE_DST")?oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM&short_url=true" 2> /dev/null - check_http_response - - #Check - if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then - print " > Share link: " - SHARE_LINK=$(sed -n 's/.*"url": "\([^"]*\).*/\1/p' "$RESPONSE_FILE") - echo "$SHARE_LINK" - else - print "FAILED\n" - ERROR_STATUS=1 - fi -} - -################ -#### SETUP #### -################ - -#CHECKING FOR AUTH FILE -if [[ -e $CONFIG_FILE ]]; then - - #Loading data... and change old format config if necesary. - source "$CONFIG_FILE" 2>/dev/null || { - sed -i'' 's/:/=/' "$CONFIG_FILE" && source "$CONFIG_FILE" 2>/dev/null - } - - #Checking the loaded data - if [[ $APPKEY == "" || $APPSECRET == "" || $OAUTH_ACCESS_TOKEN_SECRET == "" || $OAUTH_ACCESS_TOKEN == "" ]]; then - echo -ne "Error loading data from $CONFIG_FILE...\n" - echo -ne "It is recommended to run $0 unlink\n" - remove_temp_files - exit 1 - fi - - #Back compatibility with previous Dropbox Uploader versions - if [[ $ACCESS_LEVEL == "" ]]; then - ACCESS_LEVEL="dropbox" - fi - -#NEW SETUP... -else - - echo -ne "\n This is the first time you run this script.\n\n" - echo -ne " 1) Open the following URL in your Browser, and log in using your account: $APP_CREATE_URL\n" - echo -ne " 2) Click on \"Create App\", then select \"Dropbox API app\"\n" - echo -ne " 3) Now go on with the configuration, choosing the app permissions and access restrictions to your DropBox folder\n" - echo -ne " 4) Enter the \"App Name\" that you prefer (e.g. MyUploader$RANDOM$RANDOM$RANDOM)\n\n" - - echo -ne " Now, click on the \"Create App\" button.\n\n" - - echo -ne " When your new App is successfully created, please type the\n" - echo -ne " App Key, App Secret and the Permission type shown in the confirmation page:\n\n" - - #Getting the app key and secret from the user - while (true); do - - echo -ne " # App key: " - read APPKEY - - echo -ne " # App secret: " - read APPSECRET - - echo -ne "\nPermission type:\n App folder [a]: If you choose that the app only needs access to files it creates\n Full Dropbox [f]: If you choose that the app needs access to files already on Dropbox\n\n # Permission type [a/f]: " - read ACCESS_LEVEL - - if [[ $ACCESS_LEVEL == "a" ]]; then - ACCESS_LEVEL="sandbox" - ACCESS_MSG="App Folder" - else - ACCESS_LEVEL="dropbox" - ACCESS_MSG="Full Dropbox" - fi - - echo -ne "\n > App key is $APPKEY, App secret is $APPSECRET and Access level is $ACCESS_MSG. Looks ok? [y/n]: " - read answer - if [[ $answer == "y" ]]; then - break; - fi - - done - - #TOKEN REQUESTS - echo -ne "\n > Token request... " - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_REQUEST_TOKEN_URL" 2> /dev/null - check_http_response - OAUTH_TOKEN_SECRET=$(sed -n 's/oauth_token_secret=\([a-z A-Z 0-9]*\).*/\1/p' "$RESPONSE_FILE") - OAUTH_TOKEN=$(sed -n 's/.*oauth_token=\([a-z A-Z 0-9]*\)/\1/p' "$RESPONSE_FILE") - - if [[ $OAUTH_TOKEN != "" && $OAUTH_TOKEN_SECRET != "" ]]; then - echo -ne "OK\n" - else - echo -ne " FAILED\n\n Please, check your App key and secret...\n\n" - remove_temp_files - exit 1 - fi - - while (true); do - - #USER AUTH - echo -ne "\n Please open the following URL in your browser, and allow Dropbox Uploader\n" - echo -ne " to access your DropBox folder:\n\n --> ${API_USER_AUTH_URL}?oauth_token=$OAUTH_TOKEN\n" - echo -ne "\nPress enter when done...\n" - read - - #API_ACCESS_TOKEN_URL - echo -ne " > Access Token request... " - $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_ACCESS_TOKEN_URL" 2> /dev/null - check_http_response - OAUTH_ACCESS_TOKEN_SECRET=$(sed -n 's/oauth_token_secret=\([a-z A-Z 0-9]*\)&.*/\1/p' "$RESPONSE_FILE") - OAUTH_ACCESS_TOKEN=$(sed -n 's/.*oauth_token=\([a-z A-Z 0-9]*\)&.*/\1/p' "$RESPONSE_FILE") - OAUTH_ACCESS_UID=$(sed -n 's/.*uid=\([0-9]*\)/\1/p' "$RESPONSE_FILE") - - if [[ $OAUTH_ACCESS_TOKEN != "" && $OAUTH_ACCESS_TOKEN_SECRET != "" && $OAUTH_ACCESS_UID != "" ]]; then - echo -ne "OK\n" - - #Saving data in new format, compatible with source command. - echo "APPKEY=$APPKEY" > "$CONFIG_FILE" - echo "APPSECRET=$APPSECRET" >> "$CONFIG_FILE" - echo "ACCESS_LEVEL=$ACCESS_LEVEL" >> "$CONFIG_FILE" - echo "OAUTH_ACCESS_TOKEN=$OAUTH_ACCESS_TOKEN" >> "$CONFIG_FILE" - echo "OAUTH_ACCESS_TOKEN_SECRET=$OAUTH_ACCESS_TOKEN_SECRET" >> "$CONFIG_FILE" - - echo -ne "\n Setup completed!\n" - break - else - print " FAILED\n" - ERROR_STATUS=1 - fi - - done; - - remove_temp_files - exit $ERROR_STATUS -fi - -################ -#### START #### -################ - -COMMAND=${@:$OPTIND:1} -ARG1=${@:$OPTIND+1:1} -ARG2=${@:$OPTIND+2:1} - -let argnum=$#-$OPTIND - -#CHECKING PARAMS VALUES -case $COMMAND in - - upload) - - if [[ $argnum -lt 2 ]]; then - usage - fi - - FILE_DST=${@:$#:1} - - for (( i=$OPTIND+1; i<$#; i++ )); do - FILE_SRC=${@:$i:1} - db_upload "$FILE_SRC" "/$FILE_DST" - done - - ;; - - download) - - if [[ $argnum -lt 1 ]]; then - usage - fi - - FILE_SRC=$ARG1 - FILE_DST=$ARG2 - - db_download "/$FILE_SRC" "$FILE_DST" - - ;; - - saveurl) - - if [[ $argnum -lt 1 ]]; then - usage - fi - - URL=$ARG1 - FILE_DST=$ARG2 - - db_saveurl "$URL" "/$FILE_DST" - - ;; - - share) - - if [[ $argnum -lt 1 ]]; then - usage - fi - - FILE_DST=$ARG1 - - db_share "/$FILE_DST" - - ;; - - info) - - db_account_info - - ;; - - delete|remove) - - if [[ $argnum -lt 1 ]]; then - usage - fi - - FILE_DST=$ARG1 - - db_delete "/$FILE_DST" - - ;; - - move|rename) - - if [[ $argnum -lt 2 ]]; then - usage - fi - - FILE_SRC=$ARG1 - FILE_DST=$ARG2 - - db_move "/$FILE_SRC" "/$FILE_DST" - - ;; - - copy) - - if [[ $argnum -lt 2 ]]; then - usage - fi - - FILE_SRC=$ARG1 - FILE_DST=$ARG2 - - db_copy "/$FILE_SRC" "/$FILE_DST" - - ;; - - mkdir) - - if [[ $argnum -lt 1 ]]; then - usage - fi - - DIR_DST=$ARG1 - - db_mkdir "/$DIR_DST" - - ;; - - list) - - DIR_DST=$ARG1 - - #Checking DIR_DST - if [[ $DIR_DST == "" ]]; then - DIR_DST="/" - fi - - db_list "/$DIR_DST" - - ;; - - unlink) - - db_unlink - - ;; - - *) - - if [[ $COMMAND != "" ]]; then - print "Error: Unknown command: $COMMAND\n\n" - ERROR_STATUS=1 - fi - usage - - ;; - -esac - -remove_temp_files -exit $ERROR_STATUS diff --git a/clientfiles/freepie-udp/com.freepie.android.imu.apk b/clientfiles/freepie-udp/com.freepie.android.imu.apk deleted file mode 100644 index b1f052aa..00000000 Binary files a/clientfiles/freepie-udp/com.freepie.android.imu.apk and /dev/null differ diff --git a/clientfiles/freepie-udp/license.txt b/clientfiles/freepie-udp/license.txt deleted file mode 100644 index c40094f2..00000000 --- a/clientfiles/freepie-udp/license.txt +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2012-2015 Anders Malmgren -Copyright (c) 2014-2015 Stanislaw Halik - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/clientfiles/freetracktest/freetracktest.exe b/clientfiles/freetracktest/freetracktest.exe deleted file mode 100644 index 2965a07f..00000000 Binary files a/clientfiles/freetracktest/freetracktest.exe and /dev/null differ diff --git a/clientfiles/freetracktest/readme.txt b/clientfiles/freetracktest/readme.txt deleted file mode 100644 index ca40906f..00000000 --- a/clientfiles/freetracktest/readme.txt +++ /dev/null @@ -1,20 +0,0 @@ -FaceTrackNoIR for Free-track 'enabled' games. - -FaceTrackNoIR was made compatible with the Free-track protocol, for which the Free-track source (a well, part of it) was -translated from Delphi Pascal to C++ (Visual Studio C++, with Qt). - -To start the Free-track protocol-server in FaceTrackNoIR, select Free-track in the 'game-protocol' listbox. The program -'FreeTrackTest.exe' is provided to check, if the protocol-server is running. - -FreeTrackTest.exe was created by the Free-track team. - - - -The FaceTrackNoIR team: - -Wim Vriend -Ron Hendriks - - - -Disclaimer: For usage of 3rd party software like FreeTrackTest, the FaceTrackNoIR team is not responsible. Use it at your own risk. \ No newline at end of file diff --git a/clientfiles/fs2002 and fs2004/fsuipc.dll b/clientfiles/fs2002 and fs2004/fsuipc.dll deleted file mode 100644 index 264d14c5..00000000 Binary files a/clientfiles/fs2002 and fs2004/fsuipc.dll and /dev/null differ diff --git a/clientfiles/glovepie/facetracknoir2trackir.pie b/clientfiles/glovepie/facetracknoir2trackir.pie deleted file mode 100644 index d0839e5d..00000000 --- a/clientfiles/glovepie/facetracknoir2trackir.pie +++ /dev/null @@ -1,16 +0,0 @@ -// -// 6 Degrees of Freedom Headtracking with FaceTrackNoIR -// 2010 by Wim Vriend -// -pie.FrameRate = 120Hz -var.multiply = 1.5 -var.R2D = 57.295781 -FakeTrackIR.pitch=(Joystick.pitch - 0.10) * var.R2D * var.multiply -FakeTrackIR.yaw=(Joystick.yaw - 0.10) * var.R2D * var.multiply -FakeTrackIR.roll=(Joystick.roll - 0.10) * var.R2D * var.multiply -FakeTrackIR.x=(Joystick.x - 0.10) * var.R2D * var.multiply -FakeTrackIR.y=(Joystick.y - 0.10) * var.R2D * var.multiply -FakeTrackIR.z=(Joystick.z - 0.10) * var.R2D * var.multiply -debug = 'pitch='+FakeTrackIR.pitch+' roll='+FakeTrackIR.roll+' yaw='+FakeTrackIR.yaw+' xyz=('+FakeTrackIR.x+','+FakeTrackIR.y+','+FakeTrackIR.z+')' -//debug = FakeTrackIR.active - diff --git a/clientfiles/glovepie/readme.txt b/clientfiles/glovepie/readme.txt deleted file mode 100644 index 3639e26b..00000000 --- a/clientfiles/glovepie/readme.txt +++ /dev/null @@ -1,24 +0,0 @@ -FaceTrackNoIR for PPJoy 'enabled' games/programs. - -FaceTrackNoIR was made compatible with the PPJoy virtual joystick(s), that can be used by various other programs as input. GlovePIE is one of the most powerfull we know (we have also tried tir4fun, but that is quite limited). - -To start the PPJoy protocol-server in FaceTrackNoIR, select Virtual Joystick in the 'game-protocol' listbox. The -settings, necessary to configure PPJoy for FaceTrackNoIR as included in the PPJoy folder. - -GlovePIE was made by Carl Kenner and may NOT be used for military purposes. You can download it from the website -http://glovepie.org/glovepie.php - -The script FaceTrackNoIR2TrackIR.PIE, which was included in this folder, surves as an example for GlovePIE. If anyone -want to use, change or improve it: feel free to do so. In fact, if you do, we would like to receive a copy :-) - -Regards, - - -The FaceTrackNoIR team: - -Wim Vriend -Ron Hendriks - - - -Disclaimer: For usage of 3rd party software like GlovePIE, the FaceTrackNoIR team is not responsible. Use it at your own risk. \ No newline at end of file diff --git a/clientfiles/ppjoy/ppjoy mapping for facetracknoir.jpg b/clientfiles/ppjoy/ppjoy mapping for facetracknoir.jpg deleted file mode 100644 index 052c6899..00000000 Binary files a/clientfiles/ppjoy/ppjoy mapping for facetracknoir.jpg and /dev/null differ diff --git a/clientfiles/ppjoy/readme.txt b/clientfiles/ppjoy/readme.txt deleted file mode 100644 index 20c52111..00000000 --- a/clientfiles/ppjoy/readme.txt +++ /dev/null @@ -1,24 +0,0 @@ -FaceTrackNoIR for PPJoy 'enabled' games/programs. - -FaceTrackNoIR was made compatible with the PPJoy virtual joystick(s), that can be used by various other programs as input. - -To start the PPJoy protocol-server in FaceTrackNoIR, select Virtual Joystick in the 'game-protocol' listbox. The -settings, necessary to configure PPJoy for FaceTrackNoIR as included in the PPJoy folder, in the file -PPJoy mapping for FaceTrackNoIR.jpg. - -PPJoy was made by Deon van der Westhuysen and is unfortunately not updated anymore. You can download it from the website -http://shareware.pcmag.com/free/Miscellaneous-Utilities/PPJoy/75176.html, but possibly from others as well... - - -Regards, - - -The FaceTrackNoIR team: - -Wim Vriend -Ron Hendriks - - - - -Disclaimer: For usage of 3rd party software like PPJoy, the FaceTrackNoIR team is not responsible. Use it at your own risk. \ No newline at end of file diff --git a/clientfiles/very-important-source-code/README-CREDIT.txt b/clientfiles/very-important-source-code/README-CREDIT.txt deleted file mode 100644 index 82214139..00000000 --- a/clientfiles/very-important-source-code/README-CREDIT.txt +++ /dev/null @@ -1,6 +0,0 @@ -The contents of the directory written by one and only, uglyDwarf. - -Obtained at epoch time 1412397452 from the mithril-mine's shaft, where -the elite dwarves reside. - -For the latest happenings, visit diff --git a/clientfiles/very-important-source-code/ft_tester/Makefile.am b/clientfiles/very-important-source-code/ft_tester/Makefile.am deleted file mode 100644 index 02747edb..00000000 --- a/clientfiles/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/clientfiles/very-important-source-code/ft_tester/Makefile.in b/clientfiles/very-important-source-code/ft_tester/Makefile.in deleted file mode 100644 index d1fff34d..00000000 --- a/clientfiles/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/clientfiles/very-important-source-code/ft_tester/fttester.rc.in b/clientfiles/very-important-source-code/ft_tester/fttester.rc.in deleted file mode 100644 index 332f3c73..00000000 --- a/clientfiles/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/clientfiles/very-important-source-code/ft_tester/main.cpp b/clientfiles/very-important-source-code/ft_tester/main.cpp deleted file mode 100644 index a737f88f..00000000 --- a/clientfiles/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/clientfiles/very-important-source-code/important-stuff/game_data.c b/clientfiles/very-important-source-code/important-stuff/game_data.c deleted file mode 100644 index 48774187..00000000 --- a/clientfiles/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/clientfiles/very-important-source-code/important-stuff/game_data.h b/clientfiles/very-important-source-code/important-stuff/game_data.h deleted file mode 100644 index b71f7a15..00000000 --- a/clientfiles/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/clientfiles/very-important-source-code/make-csv.pl b/clientfiles/very-important-source-code/make-csv.pl deleted file mode 100644 index ee60364e..00000000 --- a/clientfiles/very-important-source-code/make-csv.pl +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env perl - -use strict; -use List::Util qw'reduce'; - -sub get_games_1 { - my @games; - - open my $fd, "<", $ARGV[1] or die "open: $!"; - <$fd>; - - while (defined(my $line = <$fd>)) { - chomp $line; - if ($line !~ /^(\d+)\s+"([^"]+)"(?:\s+\(([0-9A-F]{16})\))?$/) { - warn "Broken line"; - next; - } - push @games, +{ id => $1, name => $2, key => defined $3 ? (sprintf "%04X", $1) . $3 . '00' : undef}; - } - - [@games]; -} - -sub get_games_2 { - open my $fd, "<", $ARGV[0] or die "open: $!"; - <$fd>; - my @games; - while (defined(my $line = <$fd>)) { - chomp $line; - my @line = split/;/, $line; - if (@line != 8) { - warn "Broken line"; - next; - } - my @cols = qw'no name proto since verified by id key'; - push @games, +{ map { $cols[$_] => $line[$_] } 0..$#cols }; - } - [@games]; -} - -sub merge { - my ($new_games, $old_games) = @_; - my $no = (reduce { $a->{no} > $b->{no} ? $a : $b } +{id=>0}, @$old_games)->{no} + 1; - my %game_hash = map { $_->{name} => $_ } @$old_games; - my %ids = map { $_->{id} => 1 } @$old_games; - for my $g (@$new_games) { - if (!exists $game_hash{$g->{name}} && !exists $ids{$g->{id}}) { - $game_hash{$g->{name}} = +{ - no => $no++, - name => $g->{name}, - proto => 'FreeTrack20', - since => (defined $g->{key} ? 'V170' : 'V160'), - verified => '', - by => '', - id => $g->{id}, - key => $g->{key} - }; - } - } - print "No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID\n"; - for (sort { lc($a->{name}) cmp lc($b->{name}) } values %game_hash) { - 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"; - } -} - -merge(get_games_1(), get_games_2()); diff --git a/clientfiles/very-important-source-code/npclient.c b/clientfiles/very-important-source-code/npclient.c deleted file mode 100644 index 3878f809..00000000 --- a/clientfiles/very-important-source-code/npclient.c +++ /dev/null @@ -1,587 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#define FREETRACK_MUTEX "FT_Mutext" -#define FT_MM_DATA "FT_SharedMem" - -typedef struct TFreeTrackData { - int DataID; - int CamWidth; - int CamHeight; - float Yaw; - float Pitch; - float Roll; - float X; - float Y; - float Z; - float RawYaw; - float RawPitch; - float RawRoll; - float RawX; - float RawY; - float RawZ; - float X1; - float Y1; - float X2; - float Y2; - float X3; - float Y3; - float X4; - float Y4; -} TFreeTrackData; - -typedef struct FTMemMap { - TFreeTrackData data; - __int32 GameId; - unsigned char table[8]; - __int32 GameId2; -} FTMemMap; - -static BOOL bEncryptionChecked = FALSE; -static double r = 0, p = 0, y = 0, tx = 0, ty = 0, tz = 0; - -#define NP_DECLSPEC __declspec(dllexport) -#define NP_EXPORT(t) t NP_DECLSPEC __stdcall -#define NP_AXIS_MAX 16383 - -static BOOL FTCreateMapping(void); -static void FTDestroyMapping(void); -static __inline double scale2AnalogLimits( double x, double min_x, double max_x ); -static __inline double getDegreesFromRads ( double rads ); - -#if DEBUG -static FILE *debug_stream; -#define dbg_report(...) do { if (debug_stream) { fprintf(debug_stream, __VA_ARGS__); fflush(debug_stream); } } while(0); -#else -#define dbg_report(...) -#endif - -static HANDLE hFTMemMap = 0; -static FTMemMap *pMemData = 0; -static HANDLE hFTMutex = 0; -static BOOL bEncryption = FALSE; -static unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -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; - -BOOL DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - switch (fdwReason) { - case DLL_PROCESS_ATTACH: -#if DEBUG - debug_stream = fopen("c:\\NPClient.log", "a"); -#endif -#ifdef _WIN64 - dbg_report("\n= WIN64 =========================================================================================\n"); -#else - dbg_report("\n= WIN32 =========================================================================================\n"); -#endif - dbg_report("DllMain: (%p, %ld, %p)\n", (void*) hinstDLL, (long) fdwReason, lpvReserved); - dbg_report("DllMain: Attach request\n"); - DisableThreadLibraryCalls(hinstDLL); - timeBeginPeriod(1); - break; - - case DLL_PROCESS_DETACH: - dbg_report("DllMain: Detach\n"); - dbg_report("DllMain: (%p, %ld, %p)\n", (void*) hinstDLL, (long) fdwReason, lpvReserved); - dbg_report("==========================================================================================\n"); - timeEndPeriod(1); - FTDestroyMapping(); - break; - } - return TRUE; -} -/****************************************************************** - * NPPriv_ClientNotify (NPCLIENT.1) - */ - -NP_EXPORT(int) NPPriv_ClientNotify(void) -{ - dbg_report("stub\n"); - /* @stub in .spec */ - return 0; -} -/****************************************************************** - * NPPriv_GetLastError (NPCLIENT.2) - */ - -NP_EXPORT(int) NPPriv_GetLastError(void) -{ - dbg_report("stub\n"); - /* @stub in .spec */ - return 0; -} -/****************************************************************** - * NPPriv_SetData (NPCLIENT.3) - */ - -NP_EXPORT(int) NPPriv_SetData(void) -{ - dbg_report("stub\n"); - /* @stub in .spec */ - return 0; -} -/****************************************************************** - * NPPriv_SetLastError (NPCLIENT.4) - */ - -NP_EXPORT(int) NPPriv_SetLastError(void) -{ - dbg_report("stub\n"); - /* @stub in .spec */ - return 0; -} -/****************************************************************** - * NPPriv_SetParameter (NPCLIENT.5) - */ - -NP_EXPORT(int) NPPriv_SetParameter(void) -{ - dbg_report("stub\n"); - /* @stub in .spec */ - return 0; -} -/****************************************************************** - * NPPriv_SetSignature (NPCLIENT.6) - */ - -NP_EXPORT(int) NPPriv_SetSignature(void) -{ - dbg_report("stub\n"); - /* @stub in .spec */ - return 0; -} -/****************************************************************** - * NPPriv_SetVersion (NPCLIENT.7) - */ - -NP_EXPORT(int) NPPriv_SetVersion(void) -{ - dbg_report("stub\n"); - /* @stub in .spec */ - return 0; -} - -/* TIR5 requires a checksum to be calculated over the headpose-data and to be relayed to the game. */ -static unsigned int cksum(unsigned char buf[], unsigned int size) -{ - int rounds = size >> 2; - int rem = size % 4; - - int c = size; - int a0, a2; - - if((size == 0) || (buf == NULL)){ - return 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; -} - -static __inline void enhance(unsigned char buf[], unsigned int size, - unsigned char table[], int table_size) -{ - unsigned int table_ptr = 0; - unsigned char var = 0x88; - unsigned char tmp; - if((size <= 0) || (table_size <= 0) || - (buf == NULL) || (table == NULL)){ - return; - } - do{ - tmp = buf[--size]; - buf[size] = tmp ^ table[table_ptr] ^ var; - var += size + tmp; - ++table_ptr; - if(table_ptr >= table_size){ - table_ptr -= table_size; - } - }while(size != 0); -} - -/****************************************************************** - * NP_GetData (NPCLIENT.8) - */ - -NP_EXPORT(int) NP_GetData(tir_data_t * data) -{ - static int frameno = 0; - int i; -#if DEBUG - int recv = 0; -#endif - if (!FTCreateMapping()) - { - dbg_report("Can't open mapping\n"); - return 0; - } - - if (pMemData && hFTMutex && WaitForSingleObject(hFTMutex, 15) == WAIT_OBJECT_0) { -#if DEBUG - recv = 1; -#endif - y = getDegreesFromRads( pMemData->data.Yaw ); - p = getDegreesFromRads( pMemData->data.Pitch ); - r = getDegreesFromRads( pMemData->data.Roll ); - tx = pMemData->data.X; - ty = pMemData->data.Y; - tz = pMemData->data.Z; - - if (!bEncryptionChecked) { - dbg_report("NP_GetData: game = %d\n", pMemData->GameId); - memcpy(table, pMemData->table, 8); - for (i = 0; i < 8; i++) - if (table[i]) - { - bEncryption = TRUE; - break; - } - dbg_report("NP_GetData: Table = %02d %02d %02d %02d %02d %02d %02d %02d\n", table[0],table[1],table[2],table[3],table[4],table[5], table[6], table[7]); - bEncryptionChecked = pMemData->GameId2 == pMemData->GameId; - } - - ReleaseMutex(hFTMutex); - } - - data->frame = frameno += 1; - data->status = 0; - data->cksum = 0; - - data->roll = scale2AnalogLimits (r, -180.0, 180.0); - data->pitch = scale2AnalogLimits (p, -180.0, 180.0); - data->yaw = scale2AnalogLimits (y, -180.0, 180.0); - - data->tx = scale2AnalogLimits (tx, -500.0, 500.0); - data->ty = scale2AnalogLimits (ty, -500.0, 500.0); - data->tz = scale2AnalogLimits (tz, -500.0, 500.0); - - for(i = 0; i < 9; ++i) { - data->padding[i] = 0.0; - } - -#if DEBUG - dbg_report("GetData: rotation: %d %f %f %f\n", recv, data->yaw, data->pitch, data->roll); -#endif - - data->cksum = cksum((unsigned char*)data, sizeof(tir_data_t)); - - if(bEncryption) { - enhance((unsigned char*)data, sizeof(tir_data_t), table, sizeof(table)); - } - - return 0; -} -/****************************************************************** - * NP_GetParameter (NPCLIENT.9) - */ - -NP_EXPORT(int) NP_GetParameter(int arg0, int arg1) -{ - dbg_report("GetParameter request: %d %d\n", arg0, arg1); - return (int) 0; -} - -/****************************************************************** - * NP_GetSignature (NPCLIENT.10) - * - * - */ - -static volatile unsigned char part2_2[200] = { - 0xe3, 0xe5, 0x8e, 0xe8, 0x06, 0xd4, 0xab, - 0xcf, 0xfa, 0x51, 0xa6, 0x84, 0x69, 0x52, - 0x21, 0xde, 0x6b, 0x71, 0xe6, 0xac, 0xaa, - 0x16, 0xfc, 0x89, 0xd6, 0xac, 0xe7, 0xf8, - 0x7c, 0x09, 0x6a, 0x8b, 0x8b, 0x64, 0x0b, - 0x7c, 0xc3, 0x61, 0x7f, 0xc2, 0x97, 0xd3, - 0x33, 0xd9, 0x99, 0x59, 0xbe, 0xed, 0xdc, - 0x2c, 0x5d, 0x93, 0x5c, 0xd4, 0xdd, 0xdf, - 0x8b, 0xd5, 0x1d, 0x46, 0x95, 0xbd, 0x10, - 0x5a, 0xa9, 0xd1, 0x9f, 0x71, 0x70, 0xd3, - 0x94, 0x3c, 0x71, 0x5d, 0x53, 0x1c, 0x52, - 0xe4, 0xc0, 0xf1, 0x7f, 0x87, 0xd0, 0x70, - 0xa4, 0x04, 0x07, 0x05, 0x69, 0x2a, 0x16, - 0x15, 0x55, 0x85, 0xa6, 0x30, 0xc8, 0xb6, - 0x00 -}; - - -static volatile unsigned char part1_2[200] = { - 0x6d, 0x0b, 0xab, 0x56, 0x74, 0xe6, 0x1c, - 0xff, 0x24, 0xe8, 0x34, 0x8f, 0x00, 0x63, - 0xed, 0x47, 0x5d, 0x9b, 0xe1, 0xe0, 0x1d, - 0x02, 0x31, 0x22, 0x89, 0xac, 0x1f, 0xc0, - 0xbd, 0x29, 0x13, 0x23, 0x3e, 0x98, 0xdd, - 0xd0, 0x2a, 0x98, 0x7d, 0x29, 0xff, 0x2a, - 0x7a, 0x86, 0x6c, 0x39, 0x22, 0x3b, 0x86, - 0x86, 0xfa, 0x78, 0x31, 0xc3, 0x54, 0xa4, - 0x78, 0xaa, 0xc3, 0xca, 0x77, 0x32, 0xd3, - 0x67, 0xbd, 0x94, 0x9d, 0x7e, 0x6d, 0x31, - 0x6b, 0xa1, 0xc3, 0x14, 0x8c, 0x17, 0xb5, - 0x64, 0x51, 0x5b, 0x79, 0x51, 0xa8, 0xcf, - 0x5d, 0x1a, 0xb4, 0x84, 0x9c, 0x29, 0xf0, - 0xe6, 0x69, 0x73, 0x66, 0x0e, 0x4b, 0x3c, - 0x7d, 0x99, 0x8b, 0x4e, 0x7d, 0xaf, 0x86, - 0x92, 0xff -}; - -static volatile unsigned char part2_1[200] = { - 0x8b, 0x84, 0xfc, 0x8c, 0x71, 0xb5, 0xd9, - 0xaa, 0xda, 0x32, 0xc7, 0xe9, 0x0c, 0x20, - 0x40, 0xd4, 0x4b, 0x02, 0x89, 0xca, 0xde, - 0x61, 0x9d, 0xfb, 0xb3, 0x8c, 0x97, 0x8a, - 0x13, 0x6a, 0x0f, 0xf8, 0xf8, 0x0d, 0x65, - 0x1b, 0xe3, 0x05, 0x1e, 0xb6, 0xf6, 0xd9, - 0x13, 0xad, 0xeb, 0x38, 0xdd, 0x86, 0xfc, - 0x59, 0x2e, 0xf6, 0x2e, 0xf4, 0xb0, 0xb0, - 0xfd, 0xb0, 0x70, 0x23, 0xfb, 0xc9, 0x1a, - 0x50, 0x89, 0x92, 0xf0, 0x01, 0x09, 0xa1, - 0xfd, 0x5b, 0x19, 0x29, 0x73, 0x59, 0x2b, - 0x81, 0x83, 0x9e, 0x11, 0xf3, 0xa2, 0x1f, - 0xc8, 0x24, 0x53, 0x60, 0x0a, 0x42, 0x78, - 0x7a, 0x39, 0xea, 0xc1, 0x59, 0xad, 0xc5, - 0x00 -}; - -static volatile unsigned char part1_1[200] = { - 0x1d, 0x79, 0xce, 0x35, 0x1d, 0x95, 0x79, - 0xdf, 0x4c, 0x8d, 0x55, 0xeb, 0x20, 0x17, - 0x9f, 0x26, 0x3e, 0xf0, 0x88, 0x8e, 0x7a, - 0x08, 0x11, 0x52, 0xfc, 0xd8, 0x3f, 0xb9, - 0xd2, 0x5c, 0x61, 0x03, 0x56, 0xfd, 0xbc, - 0xb4, 0x0a, 0xf1, 0x13, 0x5d, 0x90, 0x0a, - 0x0e, 0xee, 0x09, 0x19, 0x45, 0x5a, 0xeb, - 0xe3, 0xf0, 0x58, 0x5f, 0xac, 0x23, 0x84, - 0x1f, 0xc5, 0xe3, 0xa6, 0x18, 0x5d, 0xb8, - 0x47, 0xdc, 0xe6, 0xf2, 0x0b, 0x03, 0x55, - 0x61, 0xab, 0xe3, 0x57, 0xe3, 0x67, 0xcc, - 0x16, 0x38, 0x3c, 0x11, 0x25, 0x88, 0x8a, - 0x24, 0x7f, 0xf7, 0xeb, 0xf2, 0x5d, 0x82, - 0x89, 0x05, 0x53, 0x32, 0x6b, 0x28, 0x54, - 0x13, 0xf6, 0xe7, 0x21, 0x1a, 0xc6, 0xe3, - 0xe1, 0xff -}; - -NP_EXPORT(int) NP_GetSignature(tir_signature_t * sig) -{ - int i; - dbg_report("GetSignature request\n"); - - for (i = 0; i < 200; i++) - sig->DllSignature[i] = part1_2[i] ^ part1_1[i]; - for (i = 0; i < 200; i++) - sig->AppSignature[i] = part2_1[i] ^ part2_2[i]; - memset(sig->DllSignature + strlen(sig->DllSignature), 0, 200 - strlen(sig->DllSignature)); - memset(sig->AppSignature + strlen(sig->AppSignature), 0, 200 - strlen(sig->AppSignature)); - return 0; -} - -NP_EXPORT(int) NP_QueryVersion(unsigned short * version) -{ - dbg_report("QueryVersion request\n"); - *version=0x0500; - return 0; -} -/****************************************************************** - * NP_ReCenter (NPCLIENT.12) - */ - -NP_EXPORT(int) NP_ReCenter(void) -{ - dbg_report("ReCenter request\n"); - return 0; -} - -/****************************************************************** - * NP_RegisterProgramProfileID (NPCLIENT.13) - */ - -NP_EXPORT(int) NP_RegisterProgramProfileID(unsigned short id) -{ - if (FTCreateMapping()) - pMemData->GameId = id; - dbg_report("RegisterProgramProfileID request: %d\n", id); - return 0; -} -/****************************************************************** - * NP_RegisterWindowHandle (NPCLIENT.14) - */ - -NP_EXPORT(int) NP_RegisterWindowHandle(HWND hwnd) -{ - dbg_report("RegisterWindowHandle request: %p\n", (void*) hwnd); - return (int) 0; -} -/****************************************************************** - * NP_RequestData (NPCLIENT.15) - */ - -NP_EXPORT(int) NP_RequestData(unsigned short req) -{ - dbg_report("RequestData request: %d\n", req); - return (int) 0; -} -/****************************************************************** - * NP_SetParameter (NPCLIENT.16) - */ - -NP_EXPORT(int) NP_SetParameter(int arg0, int arg1) -{ - dbg_report("SetParameter request: %d %d\n", arg0, arg1); - return (int) 0; -} -/****************************************************************** - * NP_StartCursor (NPCLIENT.17) - */ - -NP_EXPORT(int) NP_StartCursor(void) -{ - dbg_report("StartCursor request\n"); - return (int) 0; -} -/****************************************************************** - * NP_StartDataTransmission (NPCLIENT.18) - */ - -NP_EXPORT(int) NP_StartDataTransmission(void) -{ - dbg_report("StartDataTransmission request.\n"); - - return (int) 0; -} -/****************************************************************** - * NP_StopCursor (NPCLIENT.19) - */ - -NP_EXPORT(int) NP_StopCursor(void) -{ - dbg_report("StopCursor request\n"); - return (int) 0; -} -/****************************************************************** - * NP_StopDataTransmission (NPCLIENT.20) - */ - -NP_EXPORT(int) NP_StopDataTransmission(void) -{ - return (int) 0; -} -/****************************************************************** - * NP_UnregisterWindowHandle (NPCLIENT.21) - */ - -NP_EXPORT(int) NP_UnregisterWindowHandle(void) -{ - dbg_report("UnregisterWindowHandle request\n"); - return (int) 0; -} - -static BOOL FTCreateMapping(void) -{ - BOOL bMappingExists = FALSE; - - if (pMemData) - return TRUE; - - dbg_report("FTCreateMapping request (pMemData == NULL).\n"); - - hFTMutex = CreateMutexA(NULL, FALSE, FREETRACK_MUTEX); - hFTMemMap = CreateFileMappingA( INVALID_HANDLE_VALUE, 00, PAGE_READWRITE, 0, sizeof( FTMemMap ), (LPCSTR) FT_MM_DATA ); - pMemData = (FTMemMap *) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof( FTMemMap ) ); - return pMemData != NULL && hFTMutex != NULL; -} - -static void FTDestroyMapping(void) -{ - if ( pMemData != NULL ) { - UnmapViewOfFile ( pMemData ); - } - - CloseHandle( hFTMutex ); - CloseHandle( hFTMemMap ); - pMemData = 0; - hFTMemMap = 0; -} - -static __inline double getDegreesFromRads ( double rads ) { - return (rads * 57.295781); -} - -static __inline double scale2AnalogLimits( double x, double min_x, double max_x ) { - double y; - double local_x; - - local_x = x; - if (local_x > max_x) { - local_x = max_x; - } - if (local_x < min_x) { - local_x = min_x; - } - y = ( NP_AXIS_MAX * local_x ) / max_x; - - return y; -} diff --git a/clientfiles/very-important-source-code/tester/Makefile.am b/clientfiles/very-important-source-code/tester/Makefile.am deleted file mode 100644 index e025209a..00000000 --- a/clientfiles/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/clientfiles/very-important-source-code/tester/Makefile.in b/clientfiles/very-important-source-code/tester/Makefile.in deleted file mode 100644 index cc49d754..00000000 --- a/clientfiles/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/clientfiles/very-important-source-code/tester/main.cpp b/clientfiles/very-important-source-code/tester/main.cpp deleted file mode 100644 index 95ca0d9b..00000000 --- a/clientfiles/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/clientfiles/very-important-source-code/tester/npifc.c b/clientfiles/very-important-source-code/tester/npifc.c deleted file mode 100644 index b036464e..00000000 --- a/clientfiles/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/clientfiles/very-important-source-code/tester/npifc.h b/clientfiles/very-important-source-code/tester/npifc.h deleted file mode 100644 index d580e16d..00000000 --- a/clientfiles/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/clientfiles/very-important-source-code/tester/npview.rc.in b/clientfiles/very-important-source-code/tester/npview.rc.in deleted file mode 100644 index 231002f1..00000000 --- a/clientfiles/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/clientfiles/very-important-source-code/tester/resource.h b/clientfiles/very-important-source-code/tester/resource.h deleted file mode 100644 index 328d9cb7..00000000 --- a/clientfiles/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 - diff --git a/clientfiles/vjoy/VJoy.dll b/clientfiles/vjoy/VJoy.dll deleted file mode 100644 index e3446675..00000000 Binary files a/clientfiles/vjoy/VJoy.dll and /dev/null differ diff --git a/contrib/FlightGear/Protocol/headtracker.xml b/contrib/FlightGear/Protocol/headtracker.xml new file mode 100644 index 00000000..8c14119a --- /dev/null +++ b/contrib/FlightGear/Protocol/headtracker.xml @@ -0,0 +1,54 @@ + + + + + + true + none + host + 52 + + + x + double + /sim/current-view/x-offset-m + + + + y + double + /sim/current-view/y-offset-m + + + + z + double + /sim/current-view/z-offset-m + + + + heading + double + /sim/current-view/heading-offset-deg + + + + pitch + double + /sim/current-view/pitch-offset-deg + + + + roll + double + /sim/current-view/roll-offset-deg + + + + status + int + /sim/current-view/headtracker-debug-status + + + + diff --git a/contrib/FlightGear/readme.txt b/contrib/FlightGear/readme.txt new file mode 100644 index 00000000..48cee837 --- /dev/null +++ b/contrib/FlightGear/readme.txt @@ -0,0 +1,8 @@ +Copy Protocol/headtracker.xml to fgdata/Protocol/headtracker.xml + +$ fgfs --generic=socket,in,25,localhost,5542,udp,headtracker + +Adjust paths as necessary. + +cheers, +-sh 20131008 diff --git a/contrib/Tir4Fun/npclient.dll b/contrib/Tir4Fun/npclient.dll new file mode 100644 index 00000000..e392442e Binary files /dev/null and b/contrib/Tir4Fun/npclient.dll differ diff --git a/contrib/Tir4Fun/readme.txt b/contrib/Tir4Fun/readme.txt new file mode 100644 index 00000000..d64af301 --- /dev/null +++ b/contrib/Tir4Fun/readme.txt @@ -0,0 +1,9 @@ +What is TIR4FUN? + +TIR4FUN is a free utility for dedicated gamers. It enables 6DOF POV control with mouse and joystick axes. + +Software is provided as it is. Configuration is straightforward. GUI says it all! + +Installation: + +Copy all files to a directory. Launch tir4fun.exe to bring up the GUI. diff --git a/contrib/Tir4Fun/tir4fun.exe b/contrib/Tir4Fun/tir4fun.exe new file mode 100644 index 00000000..a51eced0 Binary files /dev/null and b/contrib/Tir4Fun/tir4fun.exe differ diff --git a/contrib/aruco/aruco_create_marker.exe b/contrib/aruco/aruco_create_marker.exe new file mode 100644 index 00000000..4400e80e Binary files /dev/null and b/contrib/aruco/aruco_create_marker.exe differ diff --git a/contrib/aruco/test3.jpg b/contrib/aruco/test3.jpg new file mode 100644 index 00000000..2ff6dbd0 Binary files /dev/null and b/contrib/aruco/test3.jpg differ diff --git a/contrib/cfs3/readme.txt b/contrib/cfs3/readme.txt new file mode 100644 index 00000000..e51cebfa --- /dev/null +++ b/contrib/cfs3/readme.txt @@ -0,0 +1,27 @@ +FaceTrackNoIR for + + * Combat Flight Simulator 3 (also works for Over Flanders Fields) + * Wings of War + * NASCAR Racing Season 2003 + * Colin McRae Rally 4 + * Race Driver 2 + * F1 Challenge + * Richard Burns Rally + +FaceTrackNoIR was made compatible with these programs with the help of the functions TrackIR provides in the dll TIRViews.dll. +This dll can be downloaded from the TrackIR website: http://www.naturalpoint.com/trackir/06-support/support-download-software-and-manuals.html + +To make the functions work, copy the dll in the FaceTrackNoIR installation folder. Then tick the 'use TIRViews.dll' checkbox for the 'fake TrackIR' game protocol. + +Please let us know if you like the program, if you have ideas for improvements or any questions you might have. + + + +The FaceTrackNoIR team: + +Wim Vriend +Ron Hendriks + + + +Disclaimer: For usage of 3rd party software like FlightGear, the FaceTrackNoIR team is not responsible. Use it at your own risk. \ No newline at end of file diff --git a/contrib/cfs3/tirviews.dll b/contrib/cfs3/tirviews.dll new file mode 100644 index 00000000..a1fb306f Binary files /dev/null and b/contrib/cfs3/tirviews.dll differ diff --git a/contrib/cute-octopus-vector-material_15-1831.jpg b/contrib/cute-octopus-vector-material_15-1831.jpg new file mode 100644 index 00000000..c4e5318f Binary files /dev/null and b/contrib/cute-octopus-vector-material_15-1831.jpg differ diff --git a/contrib/dropbox-uploader/README b/contrib/dropbox-uploader/README new file mode 100644 index 00000000..49189e17 --- /dev/null +++ b/contrib/dropbox-uploader/README @@ -0,0 +1 @@ +From <https://github.com/andreafabrizi/Dropbox-Uploader> diff --git a/contrib/dropbox-uploader/dropbox_uploader.sh b/contrib/dropbox-uploader/dropbox_uploader.sh new file mode 100644 index 00000000..1e7b830e --- /dev/null +++ b/contrib/dropbox-uploader/dropbox_uploader.sh @@ -0,0 +1,1364 @@ +#!/usr/bin/env bash +# +# Dropbox Uploader +# +# Copyright (C) 2010-2014 Andrea Fabrizi +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# + +#Default configuration file +CONFIG_FILE=~/.dropbox_uploader + +#Default chunk size in Mb for the upload process +#It is recommended to increase this value only if you have enough free space on your /tmp partition +#Lower values may increase the number of http requests +CHUNK_SIZE=4 + +#Curl location +#If not set, curl will be searched into the $PATH +#CURL_BIN="/usr/bin/curl" + +#Default values +TMP_DIR="/tmp" +DEBUG=0 +QUIET=0 +SHOW_PROGRESSBAR=0 +SKIP_EXISTING_FILES=0 +ERROR_STATUS=0 + +#Don't edit these... +API_REQUEST_TOKEN_URL="https://api.dropbox.com/1/oauth/request_token" +API_USER_AUTH_URL="https://www.dropbox.com/1/oauth/authorize" +API_ACCESS_TOKEN_URL="https://api.dropbox.com/1/oauth/access_token" +API_CHUNKED_UPLOAD_URL="https://api-content.dropbox.com/1/chunked_upload" +API_CHUNKED_UPLOAD_COMMIT_URL="https://api-content.dropbox.com/1/commit_chunked_upload" +API_UPLOAD_URL="https://api-content.dropbox.com/1/files_put" +API_DOWNLOAD_URL="https://api-content.dropbox.com/1/files" +API_DELETE_URL="https://api.dropbox.com/1/fileops/delete" +API_MOVE_URL="https://api.dropbox.com/1/fileops/move" +API_COPY_URL="https://api.dropbox.com/1/fileops/copy" +API_METADATA_URL="https://api.dropbox.com/1/metadata" +API_INFO_URL="https://api.dropbox.com/1/account/info" +API_MKDIR_URL="https://api.dropbox.com/1/fileops/create_folder" +API_SHARES_URL="https://api.dropbox.com/1/shares" +API_SAVEURL_URL="https://api.dropbox.com/1/save_url/auto" +API_SAVEURL_JOB_URL="https://api.dropbox.com/1/save_url_job" +APP_CREATE_URL="https://www.dropbox.com/developers/apps" +RESPONSE_FILE="$TMP_DIR/du_resp_$RANDOM" +CHUNK_FILE="$TMP_DIR/du_chunk_$RANDOM" +TEMP_FILE="$TMP_DIR/du_tmp_$RANDOM" +BIN_DEPS="sed basename date grep stat dd mkdir" +VERSION="0.16" + +umask 077 + +#Check the shell +if [ -z "$BASH_VERSION" ]; then + echo -e "Error: this script requires the BASH shell!" + exit 1 +fi + +shopt -s nullglob #Bash allows filename patterns which match no files to expand to a null string, rather than themselves +shopt -s dotglob #Bash includes filenames beginning with a "." in the results of filename expansion + +#Look for optional config file parameter +while getopts ":qpskdf:" opt; do + case $opt in + + f) + CONFIG_FILE=$OPTARG + ;; + + d) + DEBUG=1 + ;; + + q) + QUIET=1 + ;; + + p) + SHOW_PROGRESSBAR=1 + ;; + + k) + CURL_ACCEPT_CERTIFICATES="-k" + ;; + + s) + SKIP_EXISTING_FILES=1 + ;; + + \?) + echo "Invalid option: -$OPTARG" >&2 + exit 1 + ;; + + :) + echo "Option -$OPTARG requires an argument." >&2 + exit 1 + ;; + + esac +done + +if [[ $DEBUG != 0 ]]; then + echo $VERSION + uname -a 2> /dev/null + cat /etc/issue 2> /dev/null + set -x + RESPONSE_FILE="$TMP_DIR/du_resp_debug" +fi + +if [[ $CURL_BIN == "" ]]; then + BIN_DEPS="$BIN_DEPS curl" + CURL_BIN="curl" +fi + +#Dependencies check +which $BIN_DEPS > /dev/null +if [[ $? != 0 ]]; then + for i in $BIN_DEPS; do + which $i > /dev/null || + NOT_FOUND="$i $NOT_FOUND" + done + echo -e "Error: Required program could not be found: $NOT_FOUND" + exit 1 +fi + +#Check if readlink is installed and supports the -m option +#It's not necessary, so no problem if it's not installed +which readlink > /dev/null +if [[ $? == 0 && $(readlink -m "//test" 2> /dev/null) == "/test" ]]; then + HAVE_READLINK=1 +else + HAVE_READLINK=0 +fi + +#Forcing to use the builtin printf, if it's present, because it's better +#otherwise the external printf program will be used +#Note that the external printf command can cause character encoding issues! +builtin printf "" 2> /dev/null +if [[ $? == 0 ]]; then + PRINTF="builtin printf" + PRINTF_OPT="-v o" +else + PRINTF=$(which printf) + if [[ $? != 0 ]]; then + echo -e "Error: Required program could not be found: printf" + fi + PRINTF_OPT="" +fi + +#Print the message based on $QUIET variable +function print +{ + if [[ $QUIET == 0 ]]; then + echo -ne "$1"; + fi +} + +#Returns unix timestamp +function utime +{ + echo $(date +%s) +} + +#Remove temporary files +function remove_temp_files +{ + if [[ $DEBUG == 0 ]]; then + rm -fr "$RESPONSE_FILE" + rm -fr "$CHUNK_FILE" + rm -fr "$TEMP_FILE" + fi +} + +#Returns the file size in bytes +function file_size +{ + #Generic GNU + SIZE=$(stat --format="%s" "$1" 2> /dev/null) + if [ $? -eq 0 ]; then + echo $SIZE + return + fi + + #Some embedded linux devices + SIZE=$(stat -c "%s" "$1" 2> /dev/null) + if [ $? -eq 0 ]; then + echo $SIZE + return + fi + + #BSD, OSX and other OSs + SIZE=$(stat -f "%z" "$1" 2> /dev/null) + if [ $? -eq 0 ]; then + echo $SIZE + return + fi + + echo "0" +} + + +#Usage +function usage +{ + echo -e "Dropbox Uploader v$VERSION" + echo -e "Andrea Fabrizi - andrea.fabrizi@gmail.com\n" + echo -e "Usage: $0 COMMAND [PARAMETERS]..." + echo -e "\nCommands:" + + echo -e "\t upload " + echo -e "\t download [LOCAL_FILE/DIR]" + echo -e "\t delete " + echo -e "\t move " + echo -e "\t copy " + echo -e "\t mkdir " + echo -e "\t list [REMOTE_DIR]" + echo -e "\t share " + echo -e "\t saveurl " + echo -e "\t info" + echo -e "\t unlink" + + echo -e "\nOptional parameters:" + echo -e "\t-f Load the configuration file from a specific file" + echo -e "\t-s Skip already existing files when download/upload. Default: Overwrite" + echo -e "\t-d Enable DEBUG mode" + echo -e "\t-q Quiet mode. Don't show messages" + echo -e "\t-p Show cURL progress meter" + echo -e "\t-k Doesn't check for SSL certificates (insecure)" + + echo -en "\nFor more info and examples, please see the README file.\n\n" + remove_temp_files + exit 1 +} + +#Check the curl exit code +function check_http_response +{ + CODE=$? + + #Checking curl exit code + case $CODE in + + #OK + 0) + + ;; + + #Proxy error + 5) + print "\nError: Couldn't resolve proxy. The given proxy host could not be resolved.\n" + + remove_temp_files + exit 1 + ;; + + #Missing CA certificates + 60|58) + print "\nError: cURL is not able to performs peer SSL certificate verification.\n" + print "Please, install the default ca-certificates bundle.\n" + print "To do this in a Debian/Ubuntu based system, try:\n" + print " sudo apt-get install ca-certificates\n\n" + print "If the problem persists, try to use the -k option (insecure).\n" + + remove_temp_files + exit 1 + ;; + + 6) + print "\nError: Couldn't resolve host.\n" + + remove_temp_files + exit 1 + ;; + + 7) + print "\nError: Couldn't connect to host.\n" + + remove_temp_files + exit 1 + ;; + + esac + + #Checking response file for generic errors + if grep -q "HTTP/1.1 400" "$RESPONSE_FILE"; then + ERROR_MSG=$(sed -n -e 's/{"error": "\([^"]*\)"}/\1/p' "$RESPONSE_FILE") + + case $ERROR_MSG in + *access?attempt?failed?because?this?app?is?not?configured?to?have*) + echo -e "\nError: The Permission type/Access level configured doesn't match the DropBox App settings!\nPlease run \"$0 unlink\" and try again." + exit 1 + ;; + esac + + fi + +} + +#Urlencode +function urlencode +{ + #The printf is necessary to correctly decode unicode sequences + local string=$($PRINTF "${1}") + local strlen=${#string} + local encoded="" + + for (( pos=0 ; pos 1 ]]; then + new_path="$new_path/" + fi + + echo "$new_path" + else + echo "$path" + fi +} + +#Check if it's a file or directory +#Returns FILE/DIR/ERR +function db_stat +{ + local FILE=$(normalize_path "$1") + + #Checking if it's a file or a directory + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" "$API_METADATA_URL/$ACCESS_LEVEL/$(urlencode "$FILE")?oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" 2> /dev/null + check_http_response + + #Even if the file/dir has been deleted from DropBox we receive a 200 OK response + #So we must check if the file exists or if it has been deleted + if grep -q "\"is_deleted\":" "$RESPONSE_FILE"; then + local IS_DELETED=$(sed -n 's/.*"is_deleted":.\([^,]*\).*/\1/p' "$RESPONSE_FILE") + else + local IS_DELETED="false" + fi + + #Exits... + grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE" + if [[ $? == 0 && $IS_DELETED != "true" ]]; then + + local IS_DIR=$(sed -n 's/^\(.*\)\"contents":.\[.*/\1/p' "$RESPONSE_FILE") + + #It's a directory + if [[ $IS_DIR != "" ]]; then + echo "DIR" + #It's a file + else + echo "FILE" + fi + + #Doesn't exists + else + echo "ERR" + fi +} + +#Generic upload wrapper around db_upload_file and db_upload_dir functions +#$1 = Local source file/dir +#$2 = Remote destination file/dir +function db_upload +{ + local SRC=$(normalize_path "$1") + local DST=$(normalize_path "$2") + + #Checking if the file/dir exists + if [[ ! -e $SRC && ! -d $SRC ]]; then + print " > No such file or directory: $SRC\n" + ERROR_STATUS=1 + return + fi + + #Checking if the file/dir has read permissions + if [[ ! -r $SRC ]]; then + print " > Error reading file $SRC: permission denied\n" + ERROR_STATUS=1 + return + fi + + TYPE=$(db_stat "$DST") + + #If DST it's a file, do nothing, it's the default behaviour + if [[ $TYPE == "FILE" ]]; then + DST="$DST" + + #if DST doesn't exists and doesn't ends with a /, it will be the destination file name + elif [[ $TYPE == "ERR" && "${DST: -1}" != "/" ]]; then + DST="$DST" + + #if DST doesn't exists and ends with a /, it will be the destination folder + elif [[ $TYPE == "ERR" && "${DST: -1}" == "/" ]]; then + local filename=$(basename "$SRC") + DST="$DST/$filename" + + #If DST it'a directory, it will be the destination folder + elif [[ $TYPE == "DIR" ]]; then + local filename=$(basename "$SRC") + DST="$DST/$filename" + fi + + #It's a directory + if [[ -d $SRC ]]; then + db_upload_dir "$SRC" "$DST" + + #It's a file + elif [[ -e $SRC ]]; then + db_upload_file "$SRC" "$DST" + + #Unsupported object... + else + print " > Skipping not regular file \"$SRC\"\n" + fi +} + +#Generic upload wrapper around db_chunked_upload_file and db_simple_upload_file +#The final upload function will be choosen based on the file size +#$1 = Local source file +#$2 = Remote destination file +function db_upload_file +{ + local FILE_SRC=$(normalize_path "$1") + local FILE_DST=$(normalize_path "$2") + + shopt -s nocasematch + + #Checking not allowed file names + basefile_dst=$(basename "$FILE_DST") + if [[ $basefile_dst == "thumbs.db" || \ + $basefile_dst == "desktop.ini" || \ + $basefile_dst == ".ds_store" || \ + $basefile_dst == "icon\r" || \ + $basefile_dst == ".dropbox" || \ + $basefile_dst == ".dropbox.attr" \ + ]]; then + print " > Skipping not allowed file name \"$FILE_DST\"\n" + return + fi + + shopt -u nocasematch + + #Checking file size + FILE_SIZE=$(file_size "$FILE_SRC") + + #Checking if the file already exists + TYPE=$(db_stat "$FILE_DST") + if [[ $TYPE != "ERR" && $SKIP_EXISTING_FILES == 1 ]]; then + print " > Skipping already existing file \"$FILE_DST\"\n" + return + fi + + if [[ $FILE_SIZE -gt 157286000 ]]; then + #If the file is greater than 150Mb, the chunked_upload API will be used + db_chunked_upload_file "$FILE_SRC" "$FILE_DST" + else + db_simple_upload_file "$FILE_SRC" "$FILE_DST" + fi + +} + +#Simple file upload +#$1 = Local source file +#$2 = Remote destination file +function db_simple_upload_file +{ + local FILE_SRC=$(normalize_path "$1") + local FILE_DST=$(normalize_path "$2") + + if [[ $SHOW_PROGRESSBAR == 1 && $QUIET == 0 ]]; then + CURL_PARAMETERS="--progress-bar" + LINE_CR="\n" + else + CURL_PARAMETERS="-s" + LINE_CR="" + fi + + print " > Uploading \"$FILE_SRC\" to \"$FILE_DST\"... $LINE_CR" + $CURL_BIN $CURL_ACCEPT_CERTIFICATES $CURL_PARAMETERS -i --globoff -o "$RESPONSE_FILE" --upload-file "$FILE_SRC" "$API_UPLOAD_URL/$ACCESS_LEVEL/$(urlencode "$FILE_DST")?oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print "DONE\n" + else + print "FAILED\n" + print "An error occurred requesting /upload\n" + ERROR_STATUS=1 + fi +} + +#Chunked file upload +#$1 = Local source file +#$2 = Remote destination file +function db_chunked_upload_file +{ + local FILE_SRC=$(normalize_path "$1") + local FILE_DST=$(normalize_path "$2") + + print " > Uploading \"$FILE_SRC\" to \"$FILE_DST\"" + + local FILE_SIZE=$(file_size "$FILE_SRC") + local OFFSET=0 + local UPLOAD_ID="" + local UPLOAD_ERROR=0 + local CHUNK_PARAMS="" + + #Uploading chunks... + while ([[ $OFFSET != $FILE_SIZE ]]); do + + let OFFSET_MB=$OFFSET/1024/1024 + + #Create the chunk + dd if="$FILE_SRC" of="$CHUNK_FILE" bs=1048576 skip=$OFFSET_MB count=$CHUNK_SIZE 2> /dev/null + + #Only for the first request these parameters are not included + if [[ $OFFSET != 0 ]]; then + CHUNK_PARAMS="upload_id=$UPLOAD_ID&offset=$OFFSET" + fi + + #Uploading the chunk... + echo > "$RESPONSE_FILE" + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --upload-file "$CHUNK_FILE" "$API_CHUNKED_UPLOAD_URL?$CHUNK_PARAMS&oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" 2> /dev/null + #check_http_response not needed, because we have to retry the request in case of error + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print "." + UPLOAD_ERROR=0 + UPLOAD_ID=$(sed -n 's/.*"upload_id": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") + OFFSET=$(sed -n 's/.*"offset": *\([^}]*\).*/\1/p' "$RESPONSE_FILE") + else + print "*" + let UPLOAD_ERROR=$UPLOAD_ERROR+1 + + #On error, the upload is retried for max 3 times + if [[ $UPLOAD_ERROR -gt 2 ]]; then + print " FAILED\n" + print "An error occurred requesting /chunked_upload\n" + ERROR_STATUS=1 + return + fi + fi + + done + + UPLOAD_ERROR=0 + + #Commit the upload + while (true); do + + echo > "$RESPONSE_FILE" + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "upload_id=$UPLOAD_ID&oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_CHUNKED_UPLOAD_COMMIT_URL/$ACCESS_LEVEL/$(urlencode "$FILE_DST")" 2> /dev/null + #check_http_response not needed, because we have to retry the request in case of error + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print "." + UPLOAD_ERROR=0 + break + else + print "*" + let UPLOAD_ERROR=$UPLOAD_ERROR+1 + + #On error, the commit is retried for max 3 times + if [[ $UPLOAD_ERROR -gt 2 ]]; then + print " FAILED\n" + print "An error occurred requesting /commit_chunked_upload\n" + ERROR_STATUS=1 + return + fi + fi + + done + + print " DONE\n" +} + +#Directory upload +#$1 = Local source dir +#$2 = Remote destination dir +function db_upload_dir +{ + local DIR_SRC=$(normalize_path "$1") + local DIR_DST=$(normalize_path "$2") + + #Creatig remote directory + db_mkdir "$DIR_DST" + + for file in "$DIR_SRC/"*; do + db_upload "$file" "$DIR_DST" + done +} + +#Generic download wrapper +#$1 = Remote source file/dir +#$2 = Local destination file/dir +function db_download +{ + local SRC=$(normalize_path "$1") + local DST=$(normalize_path "$2") + + TYPE=$(db_stat "$SRC") + + #It's a directory + if [[ $TYPE == "DIR" ]]; then + + #If the DST folder is not specified, I assume that is the current directory + if [[ $DST == "" ]]; then + DST="." + fi + + #Checking if the destination directory exists + if [[ ! -d $DST ]]; then + local basedir="" + else + local basedir=$(basename "$SRC") + fi + + local DEST_DIR=$(normalize_path "$DST/$basedir") + print " > Downloading \"$SRC\" to \"$DEST_DIR\"... \n" + print " > Creating local directory \"$DEST_DIR\"... " + mkdir -p "$DEST_DIR" + + #Check + if [[ $? == 0 ]]; then + print "DONE\n" + else + print "FAILED\n" + ERROR_STATUS=1 + return + fi + + #Extracting directory content [...] + #and replacing "}, {" with "}\n{" + #I don't like this piece of code... but seems to be the only way to do this with SED, writing a portable code... + local DIR_CONTENT=$(sed -n 's/.*: \[{\(.*\)/\1/p' "$RESPONSE_FILE" | sed 's/}, *{/}\ +{/g') + + #Extracting files and subfolders + TMP_DIR_CONTENT_FILE="${RESPONSE_FILE}_$RANDOM" + echo "$DIR_CONTENT" | sed -n 's/.*"path": *"\([^"]*\)",.*"is_dir": *\([^"]*\),.*/\1:\2/p' > $TMP_DIR_CONTENT_FILE + + #For each entry... + while read -r line; do + + local FILE=${line%:*} + local TYPE=${line#*:} + + #Removing unneeded / + FILE=${FILE##*/} + + if [[ $TYPE == "false" ]]; then + db_download_file "$SRC/$FILE" "$DEST_DIR/$FILE" + else + db_download "$SRC/$FILE" "$DEST_DIR" + fi + + done < $TMP_DIR_CONTENT_FILE + + rm -fr $TMP_DIR_CONTENT_FILE + + #It's a file + elif [[ $TYPE == "FILE" ]]; then + + #Checking DST + if [[ $DST == "" ]]; then + DST=$(basename "$SRC") + fi + + #If the destination is a directory, the file will be download into + if [[ -d $DST ]]; then + DST="$DST/$SRC" + fi + + db_download_file "$SRC" "$DST" + + #Doesn't exists + else + print " > No such file or directory: $SRC\n" + ERROR_STATUS=1 + return + fi +} + +#Simple file download +#$1 = Remote source file +#$2 = Local destination file +function db_download_file +{ + local FILE_SRC=$(normalize_path "$1") + local FILE_DST=$(normalize_path "$2") + + if [[ $SHOW_PROGRESSBAR == 1 && $QUIET == 0 ]]; then + CURL_PARAMETERS="--progress-bar" + LINE_CR="\n" + else + CURL_PARAMETERS="-s" + LINE_CR="" + fi + + #Checking if the file already exists + if [[ -e $FILE_DST && $SKIP_EXISTING_FILES == 1 ]]; then + print " > Skipping already existing file \"$FILE_DST\"\n" + return + fi + + #Creating the empty file, that for two reasons: + #1) In this way I can check if the destination file is writable or not + #2) Curl doesn't automatically creates files with 0 bytes size + dd if=/dev/zero of="$FILE_DST" count=0 2> /dev/null + if [[ $? != 0 ]]; then + print " > Error writing file $FILE_DST: permission denied\n" + ERROR_STATUS=1 + return + fi + + print " > Downloading \"$FILE_SRC\" to \"$FILE_DST\"... $LINE_CR" + $CURL_BIN $CURL_ACCEPT_CERTIFICATES $CURL_PARAMETERS --globoff -D "$RESPONSE_FILE" -o "$FILE_DST" "$API_DOWNLOAD_URL/$ACCESS_LEVEL/$(urlencode "$FILE_SRC")?oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print "DONE\n" + else + print "FAILED\n" + rm -fr "$FILE_DST" + ERROR_STATUS=1 + return + fi +} + +#Saveurl +#$1 = URL +#$2 = Remote file destination +function db_saveurl +{ + local URL="$1" + local FILE_DST=$(normalize_path "$2") + local FILE_NAME=$(basename "$URL") + + print " > Downloading \"$URL\" to \"$FILE_DST\"..." + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "url=$(urlencode "$URL")&oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_SAVEURL_URL/$FILE_DST/$FILE_NAME" 2> /dev/null + check_http_response + + JOB_ID=$(sed -n 's/.*"job": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") + if [[ $JOB_ID == "" ]]; then + print " > Error getting the job id\n" + return + fi + + #Checking the status + while (true); do + + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_SAVEURL_JOB_URL/$JOB_ID" 2> /dev/null + check_http_response + + STATUS=$(sed -n 's/.*"status": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") + case $STATUS in + + PENDING) + print "." + ;; + + DOWNLOADING) + print "+" + ;; + + COMPLETE) + print " DONE\n" + break + ;; + + FAILED) + print " ERROR\n" + MESSAGE=$(sed -n 's/.*"error": *"*\([^"]*\)"*.*/\1/p' "$RESPONSE_FILE") + print " > Error: $MESSAGE\n" + break + ;; + + esac + + sleep 2 + + done +} + +#Prints account info +function db_account_info +{ + print "Dropbox Uploader v$VERSION\n\n" + print " > Getting info... " + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_INFO_URL" 2> /dev/null + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + + name=$(sed -n 's/.*"display_name": "\([^"]*\).*/\1/p' "$RESPONSE_FILE") + echo -e "\n\nName:\t$name" + + uid=$(sed -n 's/.*"uid": \([0-9]*\).*/\1/p' "$RESPONSE_FILE") + echo -e "UID:\t$uid" + + email=$(sed -n 's/.*"email": "\([^"]*\).*/\1/p' "$RESPONSE_FILE") + echo -e "Email:\t$email" + + quota=$(sed -n 's/.*"quota": \([0-9]*\).*/\1/p' "$RESPONSE_FILE") + let quota_mb=$quota/1024/1024 + echo -e "Quota:\t$quota_mb Mb" + + used=$(sed -n 's/.*"normal": \([0-9]*\).*/\1/p' "$RESPONSE_FILE") + let used_mb=$used/1024/1024 + echo -e "Used:\t$used_mb Mb" + + let free_mb=($quota-$used)/1024/1024 + echo -e "Free:\t$free_mb Mb" + + echo "" + + else + print "FAILED\n" + ERROR_STATUS=1 + fi +} + +#Account unlink +function db_unlink +{ + echo -ne "Are you sure you want unlink this script from your Dropbox account? [y/n]" + read answer + if [[ $answer == "y" ]]; then + rm -fr "$CONFIG_FILE" + echo -ne "DONE\n" + fi +} + +#Delete a remote file +#$1 = Remote file to delete +function db_delete +{ + local FILE_DST=$(normalize_path "$1") + + print " > Deleting \"$FILE_DST\"... " + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM&root=$ACCESS_LEVEL&path=$(urlencode "$FILE_DST")" "$API_DELETE_URL" 2> /dev/null + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print "DONE\n" + else + print "FAILED\n" + ERROR_STATUS=1 + fi +} + +#Move/Rename a remote file +#$1 = Remote file to rename or move +#$2 = New file name or location +function db_move +{ + local FILE_SRC=$(normalize_path "$1") + local FILE_DST=$(normalize_path "$2") + + TYPE=$(db_stat "$FILE_DST") + + #If the destination it's a directory, the source will be moved into it + if [[ $TYPE == "DIR" ]]; then + local filename=$(basename "$FILE_SRC") + FILE_DST=$(normalize_path "$FILE_DST/$filename") + fi + + print " > Moving \"$FILE_SRC\" to \"$FILE_DST\" ... " + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM&root=$ACCESS_LEVEL&from_path=$(urlencode "$FILE_SRC")&to_path=$(urlencode "$FILE_DST")" "$API_MOVE_URL" 2> /dev/null + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print "DONE\n" + else + print "FAILED\n" + ERROR_STATUS=1 + fi +} + +#Copy a remote file to a remote location +#$1 = Remote file to rename or move +#$2 = New file name or location +function db_copy +{ + local FILE_SRC=$(normalize_path "$1") + local FILE_DST=$(normalize_path "$2") + + TYPE=$(db_stat "$FILE_DST") + + #If the destination it's a directory, the source will be copied into it + if [[ $TYPE == "DIR" ]]; then + local filename=$(basename "$FILE_SRC") + FILE_DST=$(normalize_path "$FILE_DST/$filename") + fi + + print " > Copying \"$FILE_SRC\" to \"$FILE_DST\" ... " + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM&root=$ACCESS_LEVEL&from_path=$(urlencode "$FILE_SRC")&to_path=$(urlencode "$FILE_DST")" "$API_COPY_URL" 2> /dev/null + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print "DONE\n" + else + print "FAILED\n" + ERROR_STATUS=1 + fi +} + +#Create a new directory +#$1 = Remote directory to create +function db_mkdir +{ + local DIR_DST=$(normalize_path "$1") + + print " > Creating Directory \"$DIR_DST\"... " + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM&root=$ACCESS_LEVEL&path=$(urlencode "$DIR_DST")" "$API_MKDIR_URL" 2> /dev/null + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print "DONE\n" + elif grep -q "^HTTP/1.1 403 Forbidden" "$RESPONSE_FILE"; then + print "ALREADY EXISTS\n" + else + print "FAILED\n" + ERROR_STATUS=1 + fi +} + +#List remote directory +#$1 = Remote directory +function db_list +{ + local DIR_DST=$(normalize_path "$1") + + print " > Listing \"$DIR_DST\"... " + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" "$API_METADATA_URL/$ACCESS_LEVEL/$(urlencode "$DIR_DST")?oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" 2> /dev/null + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + + local IS_DIR=$(sed -n 's/^\(.*\)\"contents":.\[.*/\1/p' "$RESPONSE_FILE") + + #It's a directory + if [[ $IS_DIR != "" ]]; then + + print "DONE\n" + + #Extracting directory content [...] + #and replacing "}, {" with "}\n{" + #I don't like this piece of code... but seems to be the only way to do this with SED, writing a portable code... + local DIR_CONTENT=$(sed -n 's/.*: \[{\(.*\)/\1/p' "$RESPONSE_FILE" | sed 's/}, *{/}\ +{/g') + + #Converting escaped quotes to unicode format + echo "$DIR_CONTENT" | sed 's/\\"/\\u0022/' > "$TEMP_FILE" + + #Extracting files and subfolders + rm -fr "$RESPONSE_FILE" + while read -r line; do + + local FILE=$(echo "$line" | sed -n 's/.*"path": *"\([^"]*\)".*/\1/p') + local IS_DIR=$(echo "$line" | sed -n 's/.*"is_dir": *\([^,]*\).*/\1/p') + local SIZE=$(echo "$line" | sed -n 's/.*"bytes": *\([0-9]*\).*/\1/p') + + echo -e "$FILE:$IS_DIR;$SIZE" >> "$RESPONSE_FILE" + + done < "$TEMP_FILE" + + #Looking for the biggest file size + #to calculate the padding to use + local padding=0 + while read -r line; do + local FILE=${line%:*} + local META=${line##*:} + local SIZE=${META#*;} + + if [[ ${#SIZE} -gt $padding ]]; then + padding=${#SIZE} + fi + done < "$RESPONSE_FILE" + + #For each entry, printing directories... + while read -r line; do + + local FILE=${line%:*} + local META=${line##*:} + local TYPE=${META%;*} + local SIZE=${META#*;} + + #Removing unneeded / + FILE=${FILE##*/} + + if [[ $TYPE == "true" ]]; then + FILE=$(echo -e "$FILE") + $PRINTF " [D] %-${padding}s %s\n" "$SIZE" "$FILE" + fi + + done < "$RESPONSE_FILE" + + #For each entry, printing files... + while read -r line; do + + local FILE=${line%:*} + local META=${line##*:} + local TYPE=${META%;*} + local SIZE=${META#*;} + + #Removing unneeded / + FILE=${FILE##*/} + + if [[ $TYPE == "false" ]]; then + FILE=$(echo -e "$FILE") + $PRINTF " [F] %-${padding}s %s\n" "$SIZE" "$FILE" + fi + + done < "$RESPONSE_FILE" + + #It's a file + else + print "FAILED: $DIR_DST is not a directory!\n" + ERROR_STATUS=1 + fi + + else + print "FAILED\n" + ERROR_STATUS=1 + fi +} + +#Share remote file +#$1 = Remote file +function db_share +{ + local FILE_DST=$(normalize_path "$1") + + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" "$API_SHARES_URL/$ACCESS_LEVEL/$(urlencode "$FILE_DST")?oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_ACCESS_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM&short_url=true" 2> /dev/null + check_http_response + + #Check + if grep -q "^HTTP/1.1 200 OK" "$RESPONSE_FILE"; then + print " > Share link: " + SHARE_LINK=$(sed -n 's/.*"url": "\([^"]*\).*/\1/p' "$RESPONSE_FILE") + echo "$SHARE_LINK" + else + print "FAILED\n" + ERROR_STATUS=1 + fi +} + +################ +#### SETUP #### +################ + +#CHECKING FOR AUTH FILE +if [[ -e $CONFIG_FILE ]]; then + + #Loading data... and change old format config if necesary. + source "$CONFIG_FILE" 2>/dev/null || { + sed -i'' 's/:/=/' "$CONFIG_FILE" && source "$CONFIG_FILE" 2>/dev/null + } + + #Checking the loaded data + if [[ $APPKEY == "" || $APPSECRET == "" || $OAUTH_ACCESS_TOKEN_SECRET == "" || $OAUTH_ACCESS_TOKEN == "" ]]; then + echo -ne "Error loading data from $CONFIG_FILE...\n" + echo -ne "It is recommended to run $0 unlink\n" + remove_temp_files + exit 1 + fi + + #Back compatibility with previous Dropbox Uploader versions + if [[ $ACCESS_LEVEL == "" ]]; then + ACCESS_LEVEL="dropbox" + fi + +#NEW SETUP... +else + + echo -ne "\n This is the first time you run this script.\n\n" + echo -ne " 1) Open the following URL in your Browser, and log in using your account: $APP_CREATE_URL\n" + echo -ne " 2) Click on \"Create App\", then select \"Dropbox API app\"\n" + echo -ne " 3) Now go on with the configuration, choosing the app permissions and access restrictions to your DropBox folder\n" + echo -ne " 4) Enter the \"App Name\" that you prefer (e.g. MyUploader$RANDOM$RANDOM$RANDOM)\n\n" + + echo -ne " Now, click on the \"Create App\" button.\n\n" + + echo -ne " When your new App is successfully created, please type the\n" + echo -ne " App Key, App Secret and the Permission type shown in the confirmation page:\n\n" + + #Getting the app key and secret from the user + while (true); do + + echo -ne " # App key: " + read APPKEY + + echo -ne " # App secret: " + read APPSECRET + + echo -ne "\nPermission type:\n App folder [a]: If you choose that the app only needs access to files it creates\n Full Dropbox [f]: If you choose that the app needs access to files already on Dropbox\n\n # Permission type [a/f]: " + read ACCESS_LEVEL + + if [[ $ACCESS_LEVEL == "a" ]]; then + ACCESS_LEVEL="sandbox" + ACCESS_MSG="App Folder" + else + ACCESS_LEVEL="dropbox" + ACCESS_MSG="Full Dropbox" + fi + + echo -ne "\n > App key is $APPKEY, App secret is $APPSECRET and Access level is $ACCESS_MSG. Looks ok? [y/n]: " + read answer + if [[ $answer == "y" ]]; then + break; + fi + + done + + #TOKEN REQUESTS + echo -ne "\n > Token request... " + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_REQUEST_TOKEN_URL" 2> /dev/null + check_http_response + OAUTH_TOKEN_SECRET=$(sed -n 's/oauth_token_secret=\([a-z A-Z 0-9]*\).*/\1/p' "$RESPONSE_FILE") + OAUTH_TOKEN=$(sed -n 's/.*oauth_token=\([a-z A-Z 0-9]*\)/\1/p' "$RESPONSE_FILE") + + if [[ $OAUTH_TOKEN != "" && $OAUTH_TOKEN_SECRET != "" ]]; then + echo -ne "OK\n" + else + echo -ne " FAILED\n\n Please, check your App key and secret...\n\n" + remove_temp_files + exit 1 + fi + + while (true); do + + #USER AUTH + echo -ne "\n Please open the following URL in your browser, and allow Dropbox Uploader\n" + echo -ne " to access your DropBox folder:\n\n --> ${API_USER_AUTH_URL}?oauth_token=$OAUTH_TOKEN\n" + echo -ne "\nPress enter when done...\n" + read + + #API_ACCESS_TOKEN_URL + echo -ne " > Access Token request... " + $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o "$RESPONSE_FILE" --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_TOKEN_SECRET&oauth_timestamp=$(utime)&oauth_nonce=$RANDOM" "$API_ACCESS_TOKEN_URL" 2> /dev/null + check_http_response + OAUTH_ACCESS_TOKEN_SECRET=$(sed -n 's/oauth_token_secret=\([a-z A-Z 0-9]*\)&.*/\1/p' "$RESPONSE_FILE") + OAUTH_ACCESS_TOKEN=$(sed -n 's/.*oauth_token=\([a-z A-Z 0-9]*\)&.*/\1/p' "$RESPONSE_FILE") + OAUTH_ACCESS_UID=$(sed -n 's/.*uid=\([0-9]*\)/\1/p' "$RESPONSE_FILE") + + if [[ $OAUTH_ACCESS_TOKEN != "" && $OAUTH_ACCESS_TOKEN_SECRET != "" && $OAUTH_ACCESS_UID != "" ]]; then + echo -ne "OK\n" + + #Saving data in new format, compatible with source command. + echo "APPKEY=$APPKEY" > "$CONFIG_FILE" + echo "APPSECRET=$APPSECRET" >> "$CONFIG_FILE" + echo "ACCESS_LEVEL=$ACCESS_LEVEL" >> "$CONFIG_FILE" + echo "OAUTH_ACCESS_TOKEN=$OAUTH_ACCESS_TOKEN" >> "$CONFIG_FILE" + echo "OAUTH_ACCESS_TOKEN_SECRET=$OAUTH_ACCESS_TOKEN_SECRET" >> "$CONFIG_FILE" + + echo -ne "\n Setup completed!\n" + break + else + print " FAILED\n" + ERROR_STATUS=1 + fi + + done; + + remove_temp_files + exit $ERROR_STATUS +fi + +################ +#### START #### +################ + +COMMAND=${@:$OPTIND:1} +ARG1=${@:$OPTIND+1:1} +ARG2=${@:$OPTIND+2:1} + +let argnum=$#-$OPTIND + +#CHECKING PARAMS VALUES +case $COMMAND in + + upload) + + if [[ $argnum -lt 2 ]]; then + usage + fi + + FILE_DST=${@:$#:1} + + for (( i=$OPTIND+1; i<$#; i++ )); do + FILE_SRC=${@:$i:1} + db_upload "$FILE_SRC" "/$FILE_DST" + done + + ;; + + download) + + if [[ $argnum -lt 1 ]]; then + usage + fi + + FILE_SRC=$ARG1 + FILE_DST=$ARG2 + + db_download "/$FILE_SRC" "$FILE_DST" + + ;; + + saveurl) + + if [[ $argnum -lt 1 ]]; then + usage + fi + + URL=$ARG1 + FILE_DST=$ARG2 + + db_saveurl "$URL" "/$FILE_DST" + + ;; + + share) + + if [[ $argnum -lt 1 ]]; then + usage + fi + + FILE_DST=$ARG1 + + db_share "/$FILE_DST" + + ;; + + info) + + db_account_info + + ;; + + delete|remove) + + if [[ $argnum -lt 1 ]]; then + usage + fi + + FILE_DST=$ARG1 + + db_delete "/$FILE_DST" + + ;; + + move|rename) + + if [[ $argnum -lt 2 ]]; then + usage + fi + + FILE_SRC=$ARG1 + FILE_DST=$ARG2 + + db_move "/$FILE_SRC" "/$FILE_DST" + + ;; + + copy) + + if [[ $argnum -lt 2 ]]; then + usage + fi + + FILE_SRC=$ARG1 + FILE_DST=$ARG2 + + db_copy "/$FILE_SRC" "/$FILE_DST" + + ;; + + mkdir) + + if [[ $argnum -lt 1 ]]; then + usage + fi + + DIR_DST=$ARG1 + + db_mkdir "/$DIR_DST" + + ;; + + list) + + DIR_DST=$ARG1 + + #Checking DIR_DST + if [[ $DIR_DST == "" ]]; then + DIR_DST="/" + fi + + db_list "/$DIR_DST" + + ;; + + unlink) + + db_unlink + + ;; + + *) + + if [[ $COMMAND != "" ]]; then + print "Error: Unknown command: $COMMAND\n\n" + ERROR_STATUS=1 + fi + usage + + ;; + +esac + +remove_temp_files +exit $ERROR_STATUS diff --git a/contrib/freepie-udp/com.freepie.android.imu.apk b/contrib/freepie-udp/com.freepie.android.imu.apk new file mode 100644 index 00000000..b1f052aa Binary files /dev/null and b/contrib/freepie-udp/com.freepie.android.imu.apk differ diff --git a/contrib/freepie-udp/license.txt b/contrib/freepie-udp/license.txt new file mode 100644 index 00000000..c40094f2 --- /dev/null +++ b/contrib/freepie-udp/license.txt @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2012-2015 Anders Malmgren +Copyright (c) 2014-2015 Stanislaw Halik + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/contrib/freetracktest/freetracktest.exe b/contrib/freetracktest/freetracktest.exe new file mode 100644 index 00000000..2965a07f Binary files /dev/null and b/contrib/freetracktest/freetracktest.exe differ diff --git a/contrib/freetracktest/readme.txt b/contrib/freetracktest/readme.txt new file mode 100644 index 00000000..ca40906f --- /dev/null +++ b/contrib/freetracktest/readme.txt @@ -0,0 +1,20 @@ +FaceTrackNoIR for Free-track 'enabled' games. + +FaceTrackNoIR was made compatible with the Free-track protocol, for which the Free-track source (a well, part of it) was +translated from Delphi Pascal to C++ (Visual Studio C++, with Qt). + +To start the Free-track protocol-server in FaceTrackNoIR, select Free-track in the 'game-protocol' listbox. The program +'FreeTrackTest.exe' is provided to check, if the protocol-server is running. + +FreeTrackTest.exe was created by the Free-track team. + + + +The FaceTrackNoIR team: + +Wim Vriend +Ron Hendriks + + + +Disclaimer: For usage of 3rd party software like FreeTrackTest, the FaceTrackNoIR team is not responsible. Use it at your own risk. \ No newline at end of file diff --git a/contrib/fs2002 and fs2004/fsuipc.dll b/contrib/fs2002 and fs2004/fsuipc.dll new file mode 100644 index 00000000..264d14c5 Binary files /dev/null and b/contrib/fs2002 and fs2004/fsuipc.dll differ diff --git a/contrib/glovepie/facetracknoir2trackir.pie b/contrib/glovepie/facetracknoir2trackir.pie new file mode 100644 index 00000000..d0839e5d --- /dev/null +++ b/contrib/glovepie/facetracknoir2trackir.pie @@ -0,0 +1,16 @@ +// +// 6 Degrees of Freedom Headtracking with FaceTrackNoIR +// 2010 by Wim Vriend +// +pie.FrameRate = 120Hz +var.multiply = 1.5 +var.R2D = 57.295781 +FakeTrackIR.pitch=(Joystick.pitch - 0.10) * var.R2D * var.multiply +FakeTrackIR.yaw=(Joystick.yaw - 0.10) * var.R2D * var.multiply +FakeTrackIR.roll=(Joystick.roll - 0.10) * var.R2D * var.multiply +FakeTrackIR.x=(Joystick.x - 0.10) * var.R2D * var.multiply +FakeTrackIR.y=(Joystick.y - 0.10) * var.R2D * var.multiply +FakeTrackIR.z=(Joystick.z - 0.10) * var.R2D * var.multiply +debug = 'pitch='+FakeTrackIR.pitch+' roll='+FakeTrackIR.roll+' yaw='+FakeTrackIR.yaw+' xyz=('+FakeTrackIR.x+','+FakeTrackIR.y+','+FakeTrackIR.z+')' +//debug = FakeTrackIR.active + diff --git a/contrib/glovepie/readme.txt b/contrib/glovepie/readme.txt new file mode 100644 index 00000000..3639e26b --- /dev/null +++ b/contrib/glovepie/readme.txt @@ -0,0 +1,24 @@ +FaceTrackNoIR for PPJoy 'enabled' games/programs. + +FaceTrackNoIR was made compatible with the PPJoy virtual joystick(s), that can be used by various other programs as input. GlovePIE is one of the most powerfull we know (we have also tried tir4fun, but that is quite limited). + +To start the PPJoy protocol-server in FaceTrackNoIR, select Virtual Joystick in the 'game-protocol' listbox. The +settings, necessary to configure PPJoy for FaceTrackNoIR as included in the PPJoy folder. + +GlovePIE was made by Carl Kenner and may NOT be used for military purposes. You can download it from the website +http://glovepie.org/glovepie.php + +The script FaceTrackNoIR2TrackIR.PIE, which was included in this folder, surves as an example for GlovePIE. If anyone +want to use, change or improve it: feel free to do so. In fact, if you do, we would like to receive a copy :-) + +Regards, + + +The FaceTrackNoIR team: + +Wim Vriend +Ron Hendriks + + + +Disclaimer: For usage of 3rd party software like GlovePIE, the FaceTrackNoIR team is not responsible. Use it at your own risk. \ No newline at end of file diff --git a/contrib/ppjoy/ppjoy mapping for facetracknoir.jpg b/contrib/ppjoy/ppjoy mapping for facetracknoir.jpg new file mode 100644 index 00000000..052c6899 Binary files /dev/null and b/contrib/ppjoy/ppjoy mapping for facetracknoir.jpg differ diff --git a/contrib/ppjoy/readme.txt b/contrib/ppjoy/readme.txt new file mode 100644 index 00000000..20c52111 --- /dev/null +++ b/contrib/ppjoy/readme.txt @@ -0,0 +1,24 @@ +FaceTrackNoIR for PPJoy 'enabled' games/programs. + +FaceTrackNoIR was made compatible with the PPJoy virtual joystick(s), that can be used by various other programs as input. + +To start the PPJoy protocol-server in FaceTrackNoIR, select Virtual Joystick in the 'game-protocol' listbox. The +settings, necessary to configure PPJoy for FaceTrackNoIR as included in the PPJoy folder, in the file +PPJoy mapping for FaceTrackNoIR.jpg. + +PPJoy was made by Deon van der Westhuysen and is unfortunately not updated anymore. You can download it from the website +http://shareware.pcmag.com/free/Miscellaneous-Utilities/PPJoy/75176.html, but possibly from others as well... + + +Regards, + + +The FaceTrackNoIR team: + +Wim Vriend +Ron Hendriks + + + + +Disclaimer: For usage of 3rd party software like PPJoy, the FaceTrackNoIR team is not responsible. Use it at your own risk. \ No newline at end of file diff --git a/contrib/very-important-source-code/README-CREDIT.txt b/contrib/very-important-source-code/README-CREDIT.txt new file mode 100644 index 00000000..82214139 --- /dev/null +++ b/contrib/very-important-source-code/README-CREDIT.txt @@ -0,0 +1,6 @@ +The contents of the directory written by one and only, uglyDwarf. + +Obtained at epoch time 1412397452 from the mithril-mine's shaft, where +the elite dwarves reside. + +For the latest happenings, visit diff --git a/contrib/very-important-source-code/ft_tester/Makefile.am b/contrib/very-important-source-code/ft_tester/Makefile.am new file mode 100644 index 00000000..02747edb --- /dev/null +++ b/contrib/very-important-source-code/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/very-important-source-code/ft_tester/Makefile.in b/contrib/very-important-source-code/ft_tester/Makefile.in new file mode 100644 index 00000000..d1fff34d --- /dev/null +++ b/contrib/very-important-source-code/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/very-important-source-code/ft_tester/fttester.rc.in b/contrib/very-important-source-code/ft_tester/fttester.rc.in new file mode 100644 index 00000000..332f3c73 --- /dev/null +++ b/contrib/very-important-source-code/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/very-important-source-code/ft_tester/main.cpp b/contrib/very-important-source-code/ft_tester/main.cpp new file mode 100644 index 00000000..a737f88f --- /dev/null +++ b/contrib/very-important-source-code/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/very-important-source-code/important-stuff/game_data.c b/contrib/very-important-source-code/important-stuff/game_data.c new file mode 100644 index 00000000..48774187 --- /dev/null +++ b/contrib/very-important-source-code/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/very-important-source-code/important-stuff/game_data.h b/contrib/very-important-source-code/important-stuff/game_data.h new file mode 100644 index 00000000..b71f7a15 --- /dev/null +++ b/contrib/very-important-source-code/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/very-important-source-code/make-csv.pl b/contrib/very-important-source-code/make-csv.pl new file mode 100644 index 00000000..ee60364e --- /dev/null +++ b/contrib/very-important-source-code/make-csv.pl @@ -0,0 +1,72 @@ +#!/usr/bin/env perl + +use strict; +use List::Util qw'reduce'; + +sub get_games_1 { + my @games; + + open my $fd, "<", $ARGV[1] or die "open: $!"; + <$fd>; + + while (defined(my $line = <$fd>)) { + chomp $line; + if ($line !~ /^(\d+)\s+"([^"]+)"(?:\s+\(([0-9A-F]{16})\))?$/) { + warn "Broken line"; + next; + } + push @games, +{ id => $1, name => $2, key => defined $3 ? (sprintf "%04X", $1) . $3 . '00' : undef}; + } + + [@games]; +} + +sub get_games_2 { + open my $fd, "<", $ARGV[0] or die "open: $!"; + <$fd>; + my @games; + while (defined(my $line = <$fd>)) { + chomp $line; + my @line = split/;/, $line; + if (@line != 8) { + warn "Broken line"; + next; + } + my @cols = qw'no name proto since verified by id key'; + push @games, +{ map { $cols[$_] => $line[$_] } 0..$#cols }; + } + [@games]; +} + +sub merge { + my ($new_games, $old_games) = @_; + my $no = (reduce { $a->{no} > $b->{no} ? $a : $b } +{id=>0}, @$old_games)->{no} + 1; + my %game_hash = map { $_->{name} => $_ } @$old_games; + my %ids = map { $_->{id} => 1 } @$old_games; + for my $g (@$new_games) { + if (!exists $game_hash{$g->{name}} && !exists $ids{$g->{id}}) { + $game_hash{$g->{name}} = +{ + no => $no++, + name => $g->{name}, + proto => 'FreeTrack20', + since => (defined $g->{key} ? 'V170' : 'V160'), + verified => '', + by => '', + id => $g->{id}, + key => $g->{key} + }; + } + } + print "No;Game Name;Game protocol;Supported since;Verified;By;INTERNATIONAL_ID;FTN_ID\n"; + for (sort { lc($a->{name}) cmp lc($b->{name}) } values %game_hash) { + 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"; + } +} + +merge(get_games_1(), get_games_2()); diff --git a/contrib/very-important-source-code/npclient.c b/contrib/very-important-source-code/npclient.c new file mode 100644 index 00000000..3878f809 --- /dev/null +++ b/contrib/very-important-source-code/npclient.c @@ -0,0 +1,587 @@ +#include +#include +#include +#include +#include +#include + +#define FREETRACK_MUTEX "FT_Mutext" +#define FT_MM_DATA "FT_SharedMem" + +typedef struct TFreeTrackData { + int DataID; + int CamWidth; + int CamHeight; + float Yaw; + float Pitch; + float Roll; + float X; + float Y; + float Z; + float RawYaw; + float RawPitch; + float RawRoll; + float RawX; + float RawY; + float RawZ; + float X1; + float Y1; + float X2; + float Y2; + float X3; + float Y3; + float X4; + float Y4; +} TFreeTrackData; + +typedef struct FTMemMap { + TFreeTrackData data; + __int32 GameId; + unsigned char table[8]; + __int32 GameId2; +} FTMemMap; + +static BOOL bEncryptionChecked = FALSE; +static double r = 0, p = 0, y = 0, tx = 0, ty = 0, tz = 0; + +#define NP_DECLSPEC __declspec(dllexport) +#define NP_EXPORT(t) t NP_DECLSPEC __stdcall +#define NP_AXIS_MAX 16383 + +static BOOL FTCreateMapping(void); +static void FTDestroyMapping(void); +static __inline double scale2AnalogLimits( double x, double min_x, double max_x ); +static __inline double getDegreesFromRads ( double rads ); + +#if DEBUG +static FILE *debug_stream; +#define dbg_report(...) do { if (debug_stream) { fprintf(debug_stream, __VA_ARGS__); fflush(debug_stream); } } while(0); +#else +#define dbg_report(...) +#endif + +static HANDLE hFTMemMap = 0; +static FTMemMap *pMemData = 0; +static HANDLE hFTMutex = 0; +static BOOL bEncryption = FALSE; +static unsigned char table[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + +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; + +BOOL DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + switch (fdwReason) { + case DLL_PROCESS_ATTACH: +#if DEBUG + debug_stream = fopen("c:\\NPClient.log", "a"); +#endif +#ifdef _WIN64 + dbg_report("\n= WIN64 =========================================================================================\n"); +#else + dbg_report("\n= WIN32 =========================================================================================\n"); +#endif + dbg_report("DllMain: (%p, %ld, %p)\n", (void*) hinstDLL, (long) fdwReason, lpvReserved); + dbg_report("DllMain: Attach request\n"); + DisableThreadLibraryCalls(hinstDLL); + timeBeginPeriod(1); + break; + + case DLL_PROCESS_DETACH: + dbg_report("DllMain: Detach\n"); + dbg_report("DllMain: (%p, %ld, %p)\n", (void*) hinstDLL, (long) fdwReason, lpvReserved); + dbg_report("==========================================================================================\n"); + timeEndPeriod(1); + FTDestroyMapping(); + break; + } + return TRUE; +} +/****************************************************************** + * NPPriv_ClientNotify (NPCLIENT.1) + */ + +NP_EXPORT(int) NPPriv_ClientNotify(void) +{ + dbg_report("stub\n"); + /* @stub in .spec */ + return 0; +} +/****************************************************************** + * NPPriv_GetLastError (NPCLIENT.2) + */ + +NP_EXPORT(int) NPPriv_GetLastError(void) +{ + dbg_report("stub\n"); + /* @stub in .spec */ + return 0; +} +/****************************************************************** + * NPPriv_SetData (NPCLIENT.3) + */ + +NP_EXPORT(int) NPPriv_SetData(void) +{ + dbg_report("stub\n"); + /* @stub in .spec */ + return 0; +} +/****************************************************************** + * NPPriv_SetLastError (NPCLIENT.4) + */ + +NP_EXPORT(int) NPPriv_SetLastError(void) +{ + dbg_report("stub\n"); + /* @stub in .spec */ + return 0; +} +/****************************************************************** + * NPPriv_SetParameter (NPCLIENT.5) + */ + +NP_EXPORT(int) NPPriv_SetParameter(void) +{ + dbg_report("stub\n"); + /* @stub in .spec */ + return 0; +} +/****************************************************************** + * NPPriv_SetSignature (NPCLIENT.6) + */ + +NP_EXPORT(int) NPPriv_SetSignature(void) +{ + dbg_report("stub\n"); + /* @stub in .spec */ + return 0; +} +/****************************************************************** + * NPPriv_SetVersion (NPCLIENT.7) + */ + +NP_EXPORT(int) NPPriv_SetVersion(void) +{ + dbg_report("stub\n"); + /* @stub in .spec */ + return 0; +} + +/* TIR5 requires a checksum to be calculated over the headpose-data and to be relayed to the game. */ +static unsigned int cksum(unsigned char buf[], unsigned int size) +{ + int rounds = size >> 2; + int rem = size % 4; + + int c = size; + int a0, a2; + + if((size == 0) || (buf == NULL)){ + return 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; +} + +static __inline void enhance(unsigned char buf[], unsigned int size, + unsigned char table[], int table_size) +{ + unsigned int table_ptr = 0; + unsigned char var = 0x88; + unsigned char tmp; + if((size <= 0) || (table_size <= 0) || + (buf == NULL) || (table == NULL)){ + return; + } + do{ + tmp = buf[--size]; + buf[size] = tmp ^ table[table_ptr] ^ var; + var += size + tmp; + ++table_ptr; + if(table_ptr >= table_size){ + table_ptr -= table_size; + } + }while(size != 0); +} + +/****************************************************************** + * NP_GetData (NPCLIENT.8) + */ + +NP_EXPORT(int) NP_GetData(tir_data_t * data) +{ + static int frameno = 0; + int i; +#if DEBUG + int recv = 0; +#endif + if (!FTCreateMapping()) + { + dbg_report("Can't open mapping\n"); + return 0; + } + + if (pMemData && hFTMutex && WaitForSingleObject(hFTMutex, 15) == WAIT_OBJECT_0) { +#if DEBUG + recv = 1; +#endif + y = getDegreesFromRads( pMemData->data.Yaw ); + p = getDegreesFromRads( pMemData->data.Pitch ); + r = getDegreesFromRads( pMemData->data.Roll ); + tx = pMemData->data.X; + ty = pMemData->data.Y; + tz = pMemData->data.Z; + + if (!bEncryptionChecked) { + dbg_report("NP_GetData: game = %d\n", pMemData->GameId); + memcpy(table, pMemData->table, 8); + for (i = 0; i < 8; i++) + if (table[i]) + { + bEncryption = TRUE; + break; + } + dbg_report("NP_GetData: Table = %02d %02d %02d %02d %02d %02d %02d %02d\n", table[0],table[1],table[2],table[3],table[4],table[5], table[6], table[7]); + bEncryptionChecked = pMemData->GameId2 == pMemData->GameId; + } + + ReleaseMutex(hFTMutex); + } + + data->frame = frameno += 1; + data->status = 0; + data->cksum = 0; + + data->roll = scale2AnalogLimits (r, -180.0, 180.0); + data->pitch = scale2AnalogLimits (p, -180.0, 180.0); + data->yaw = scale2AnalogLimits (y, -180.0, 180.0); + + data->tx = scale2AnalogLimits (tx, -500.0, 500.0); + data->ty = scale2AnalogLimits (ty, -500.0, 500.0); + data->tz = scale2AnalogLimits (tz, -500.0, 500.0); + + for(i = 0; i < 9; ++i) { + data->padding[i] = 0.0; + } + +#if DEBUG + dbg_report("GetData: rotation: %d %f %f %f\n", recv, data->yaw, data->pitch, data->roll); +#endif + + data->cksum = cksum((unsigned char*)data, sizeof(tir_data_t)); + + if(bEncryption) { + enhance((unsigned char*)data, sizeof(tir_data_t), table, sizeof(table)); + } + + return 0; +} +/****************************************************************** + * NP_GetParameter (NPCLIENT.9) + */ + +NP_EXPORT(int) NP_GetParameter(int arg0, int arg1) +{ + dbg_report("GetParameter request: %d %d\n", arg0, arg1); + return (int) 0; +} + +/****************************************************************** + * NP_GetSignature (NPCLIENT.10) + * + * + */ + +static volatile unsigned char part2_2[200] = { + 0xe3, 0xe5, 0x8e, 0xe8, 0x06, 0xd4, 0xab, + 0xcf, 0xfa, 0x51, 0xa6, 0x84, 0x69, 0x52, + 0x21, 0xde, 0x6b, 0x71, 0xe6, 0xac, 0xaa, + 0x16, 0xfc, 0x89, 0xd6, 0xac, 0xe7, 0xf8, + 0x7c, 0x09, 0x6a, 0x8b, 0x8b, 0x64, 0x0b, + 0x7c, 0xc3, 0x61, 0x7f, 0xc2, 0x97, 0xd3, + 0x33, 0xd9, 0x99, 0x59, 0xbe, 0xed, 0xdc, + 0x2c, 0x5d, 0x93, 0x5c, 0xd4, 0xdd, 0xdf, + 0x8b, 0xd5, 0x1d, 0x46, 0x95, 0xbd, 0x10, + 0x5a, 0xa9, 0xd1, 0x9f, 0x71, 0x70, 0xd3, + 0x94, 0x3c, 0x71, 0x5d, 0x53, 0x1c, 0x52, + 0xe4, 0xc0, 0xf1, 0x7f, 0x87, 0xd0, 0x70, + 0xa4, 0x04, 0x07, 0x05, 0x69, 0x2a, 0x16, + 0x15, 0x55, 0x85, 0xa6, 0x30, 0xc8, 0xb6, + 0x00 +}; + + +static volatile unsigned char part1_2[200] = { + 0x6d, 0x0b, 0xab, 0x56, 0x74, 0xe6, 0x1c, + 0xff, 0x24, 0xe8, 0x34, 0x8f, 0x00, 0x63, + 0xed, 0x47, 0x5d, 0x9b, 0xe1, 0xe0, 0x1d, + 0x02, 0x31, 0x22, 0x89, 0xac, 0x1f, 0xc0, + 0xbd, 0x29, 0x13, 0x23, 0x3e, 0x98, 0xdd, + 0xd0, 0x2a, 0x98, 0x7d, 0x29, 0xff, 0x2a, + 0x7a, 0x86, 0x6c, 0x39, 0x22, 0x3b, 0x86, + 0x86, 0xfa, 0x78, 0x31, 0xc3, 0x54, 0xa4, + 0x78, 0xaa, 0xc3, 0xca, 0x77, 0x32, 0xd3, + 0x67, 0xbd, 0x94, 0x9d, 0x7e, 0x6d, 0x31, + 0x6b, 0xa1, 0xc3, 0x14, 0x8c, 0x17, 0xb5, + 0x64, 0x51, 0x5b, 0x79, 0x51, 0xa8, 0xcf, + 0x5d, 0x1a, 0xb4, 0x84, 0x9c, 0x29, 0xf0, + 0xe6, 0x69, 0x73, 0x66, 0x0e, 0x4b, 0x3c, + 0x7d, 0x99, 0x8b, 0x4e, 0x7d, 0xaf, 0x86, + 0x92, 0xff +}; + +static volatile unsigned char part2_1[200] = { + 0x8b, 0x84, 0xfc, 0x8c, 0x71, 0xb5, 0xd9, + 0xaa, 0xda, 0x32, 0xc7, 0xe9, 0x0c, 0x20, + 0x40, 0xd4, 0x4b, 0x02, 0x89, 0xca, 0xde, + 0x61, 0x9d, 0xfb, 0xb3, 0x8c, 0x97, 0x8a, + 0x13, 0x6a, 0x0f, 0xf8, 0xf8, 0x0d, 0x65, + 0x1b, 0xe3, 0x05, 0x1e, 0xb6, 0xf6, 0xd9, + 0x13, 0xad, 0xeb, 0x38, 0xdd, 0x86, 0xfc, + 0x59, 0x2e, 0xf6, 0x2e, 0xf4, 0xb0, 0xb0, + 0xfd, 0xb0, 0x70, 0x23, 0xfb, 0xc9, 0x1a, + 0x50, 0x89, 0x92, 0xf0, 0x01, 0x09, 0xa1, + 0xfd, 0x5b, 0x19, 0x29, 0x73, 0x59, 0x2b, + 0x81, 0x83, 0x9e, 0x11, 0xf3, 0xa2, 0x1f, + 0xc8, 0x24, 0x53, 0x60, 0x0a, 0x42, 0x78, + 0x7a, 0x39, 0xea, 0xc1, 0x59, 0xad, 0xc5, + 0x00 +}; + +static volatile unsigned char part1_1[200] = { + 0x1d, 0x79, 0xce, 0x35, 0x1d, 0x95, 0x79, + 0xdf, 0x4c, 0x8d, 0x55, 0xeb, 0x20, 0x17, + 0x9f, 0x26, 0x3e, 0xf0, 0x88, 0x8e, 0x7a, + 0x08, 0x11, 0x52, 0xfc, 0xd8, 0x3f, 0xb9, + 0xd2, 0x5c, 0x61, 0x03, 0x56, 0xfd, 0xbc, + 0xb4, 0x0a, 0xf1, 0x13, 0x5d, 0x90, 0x0a, + 0x0e, 0xee, 0x09, 0x19, 0x45, 0x5a, 0xeb, + 0xe3, 0xf0, 0x58, 0x5f, 0xac, 0x23, 0x84, + 0x1f, 0xc5, 0xe3, 0xa6, 0x18, 0x5d, 0xb8, + 0x47, 0xdc, 0xe6, 0xf2, 0x0b, 0x03, 0x55, + 0x61, 0xab, 0xe3, 0x57, 0xe3, 0x67, 0xcc, + 0x16, 0x38, 0x3c, 0x11, 0x25, 0x88, 0x8a, + 0x24, 0x7f, 0xf7, 0xeb, 0xf2, 0x5d, 0x82, + 0x89, 0x05, 0x53, 0x32, 0x6b, 0x28, 0x54, + 0x13, 0xf6, 0xe7, 0x21, 0x1a, 0xc6, 0xe3, + 0xe1, 0xff +}; + +NP_EXPORT(int) NP_GetSignature(tir_signature_t * sig) +{ + int i; + dbg_report("GetSignature request\n"); + + for (i = 0; i < 200; i++) + sig->DllSignature[i] = part1_2[i] ^ part1_1[i]; + for (i = 0; i < 200; i++) + sig->AppSignature[i] = part2_1[i] ^ part2_2[i]; + memset(sig->DllSignature + strlen(sig->DllSignature), 0, 200 - strlen(sig->DllSignature)); + memset(sig->AppSignature + strlen(sig->AppSignature), 0, 200 - strlen(sig->AppSignature)); + return 0; +} + +NP_EXPORT(int) NP_QueryVersion(unsigned short * version) +{ + dbg_report("QueryVersion request\n"); + *version=0x0500; + return 0; +} +/****************************************************************** + * NP_ReCenter (NPCLIENT.12) + */ + +NP_EXPORT(int) NP_ReCenter(void) +{ + dbg_report("ReCenter request\n"); + return 0; +} + +/****************************************************************** + * NP_RegisterProgramProfileID (NPCLIENT.13) + */ + +NP_EXPORT(int) NP_RegisterProgramProfileID(unsigned short id) +{ + if (FTCreateMapping()) + pMemData->GameId = id; + dbg_report("RegisterProgramProfileID request: %d\n", id); + return 0; +} +/****************************************************************** + * NP_RegisterWindowHandle (NPCLIENT.14) + */ + +NP_EXPORT(int) NP_RegisterWindowHandle(HWND hwnd) +{ + dbg_report("RegisterWindowHandle request: %p\n", (void*) hwnd); + return (int) 0; +} +/****************************************************************** + * NP_RequestData (NPCLIENT.15) + */ + +NP_EXPORT(int) NP_RequestData(unsigned short req) +{ + dbg_report("RequestData request: %d\n", req); + return (int) 0; +} +/****************************************************************** + * NP_SetParameter (NPCLIENT.16) + */ + +NP_EXPORT(int) NP_SetParameter(int arg0, int arg1) +{ + dbg_report("SetParameter request: %d %d\n", arg0, arg1); + return (int) 0; +} +/****************************************************************** + * NP_StartCursor (NPCLIENT.17) + */ + +NP_EXPORT(int) NP_StartCursor(void) +{ + dbg_report("StartCursor request\n"); + return (int) 0; +} +/****************************************************************** + * NP_StartDataTransmission (NPCLIENT.18) + */ + +NP_EXPORT(int) NP_StartDataTransmission(void) +{ + dbg_report("StartDataTransmission request.\n"); + + return (int) 0; +} +/****************************************************************** + * NP_StopCursor (NPCLIENT.19) + */ + +NP_EXPORT(int) NP_StopCursor(void) +{ + dbg_report("StopCursor request\n"); + return (int) 0; +} +/****************************************************************** + * NP_StopDataTransmission (NPCLIENT.20) + */ + +NP_EXPORT(int) NP_StopDataTransmission(void) +{ + return (int) 0; +} +/****************************************************************** + * NP_UnregisterWindowHandle (NPCLIENT.21) + */ + +NP_EXPORT(int) NP_UnregisterWindowHandle(void) +{ + dbg_report("UnregisterWindowHandle request\n"); + return (int) 0; +} + +static BOOL FTCreateMapping(void) +{ + BOOL bMappingExists = FALSE; + + if (pMemData) + return TRUE; + + dbg_report("FTCreateMapping request (pMemData == NULL).\n"); + + hFTMutex = CreateMutexA(NULL, FALSE, FREETRACK_MUTEX); + hFTMemMap = CreateFileMappingA( INVALID_HANDLE_VALUE, 00, PAGE_READWRITE, 0, sizeof( FTMemMap ), (LPCSTR) FT_MM_DATA ); + pMemData = (FTMemMap *) MapViewOfFile(hFTMemMap, FILE_MAP_WRITE, 0, 0, sizeof( FTMemMap ) ); + return pMemData != NULL && hFTMutex != NULL; +} + +static void FTDestroyMapping(void) +{ + if ( pMemData != NULL ) { + UnmapViewOfFile ( pMemData ); + } + + CloseHandle( hFTMutex ); + CloseHandle( hFTMemMap ); + pMemData = 0; + hFTMemMap = 0; +} + +static __inline double getDegreesFromRads ( double rads ) { + return (rads * 57.295781); +} + +static __inline double scale2AnalogLimits( double x, double min_x, double max_x ) { + double y; + double local_x; + + local_x = x; + if (local_x > max_x) { + local_x = max_x; + } + if (local_x < min_x) { + local_x = min_x; + } + y = ( NP_AXIS_MAX * local_x ) / max_x; + + return y; +} diff --git a/contrib/very-important-source-code/tester/Makefile.am b/contrib/very-important-source-code/tester/Makefile.am new file mode 100644 index 00000000..e025209a --- /dev/null +++ b/contrib/very-important-source-code/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/very-important-source-code/tester/Makefile.in b/contrib/very-important-source-code/tester/Makefile.in new file mode 100644 index 00000000..cc49d754 --- /dev/null +++ b/contrib/very-important-source-code/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/very-important-source-code/tester/main.cpp b/contrib/very-important-source-code/tester/main.cpp new file mode 100644 index 00000000..95ca0d9b --- /dev/null +++ b/contrib/very-important-source-code/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/very-important-source-code/tester/npifc.c b/contrib/very-important-source-code/tester/npifc.c new file mode 100644 index 00000000..b036464e --- /dev/null +++ b/contrib/very-important-source-code/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/very-important-source-code/tester/npifc.h b/contrib/very-important-source-code/tester/npifc.h new file mode 100644 index 00000000..d580e16d --- /dev/null +++ b/contrib/very-important-source-code/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/very-important-source-code/tester/npview.rc.in b/contrib/very-important-source-code/tester/npview.rc.in new file mode 100644 index 00000000..231002f1 --- /dev/null +++ b/contrib/very-important-source-code/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/very-important-source-code/tester/resource.h b/contrib/very-important-source-code/tester/resource.h new file mode 100644 index 00000000..328d9cb7 --- /dev/null +++ b/contrib/very-important-source-code/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/vjoy/VJoy.dll b/contrib/vjoy/VJoy.dll new file mode 100644 index 00000000..e3446675 Binary files /dev/null and b/contrib/vjoy/VJoy.dll differ diff --git a/ftnoir_tracker_rs/ftnoir_tracker_rs.cpp b/ftnoir_tracker_rs/ftnoir_tracker_rs.cpp index f17d7fcb..3e9b23c8 100644 --- a/ftnoir_tracker_rs/ftnoir_tracker_rs.cpp +++ b/ftnoir_tracker_rs/ftnoir_tracker_rs.cpp @@ -81,7 +81,7 @@ void RSTracker::rsImplProcessFinished(int exitCode){ msgBox.exec(); if(msgBox.clickedButton() == triggerSdkInstallation){ - bool pStarted = QProcess::startDetached("clientfiles\\intel_rs_sdk_runtime_websetup_6.0.21.6598.exe --finstall=core,face3d --fnone=all"); + bool pStarted = QProcess::startDetached("contrib\\intel_rs_sdk_runtime_websetup_6.0.21.6598.exe --finstall=core,face3d --fnone=all"); if(!pStarted){ QMessageBox::warning(0, "Intel® RealSense™ Runtime Installation", "Installation process failed to start.", QMessageBox::Ok); } diff --git a/ftnoir_tracker_rs/ftnoir_tracker_rs_controls.cpp b/ftnoir_tracker_rs/ftnoir_tracker_rs_controls.cpp index e5187bd1..6c71d58f 100644 --- a/ftnoir_tracker_rs/ftnoir_tracker_rs_controls.cpp +++ b/ftnoir_tracker_rs/ftnoir_tracker_rs_controls.cpp @@ -20,7 +20,7 @@ RSTrackerControls::RSTrackerControls() void RSTrackerControls::doInstallRSRuntime() { - bool processStarted = QProcess::startDetached("clientfiles\\intel_rs_sdk_runtime_websetup_6.0.21.6598.exe --finstall=core,face3d --fnone=all"); + bool processStarted = QProcess::startDetached("contrib\\intel_rs_sdk_runtime_websetup_6.0.21.6598.exe --finstall=core,face3d --fnone=all"); if(processStarted){ this->close(); } -- cgit v1.2.3 From ee5a2b5cd1e93a2133697445aa68f40539c902e2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 28 Oct 2015 13:45:21 +0100 Subject: buffer flush --- CMakeLists.txt | 38 ++++- cmake/mingw-w64.cmake | 2 +- ftnoir_tracker_rift_025/ftnoir_rift.qrc | 7 + .../ftnoir_rift_clientcontrols.ui | 176 +++++++++++++++++++++ ftnoir_tracker_rift_025/ftnoir_tracker_rift.cpp | 102 ++++++++++++ ftnoir_tracker_rift_025/ftnoir_tracker_rift.h | 60 +++++++ .../ftnoir_tracker_rift_dialog.cpp | 26 +++ ftnoir_tracker_rift_025/images/medium.png | Bin 0 -> 5764 bytes ftnoir_tracker_rift_025/images/rift_medium.png | Bin 0 -> 5764 bytes ftnoir_tracker_rift_025/images/rift_small.png | Bin 0 -> 1212 bytes ftnoir_tracker_rift_025/images/rift_tiny.png | Bin 0 -> 624 bytes ftnoir_tracker_rift_025/images/small.png | Bin 0 -> 1212 bytes ftnoir_tracker_rift_025/images/tiny.png | Bin 0 -> 624 bytes 13 files changed, 407 insertions(+), 4 deletions(-) create mode 100644 ftnoir_tracker_rift_025/ftnoir_rift.qrc create mode 100644 ftnoir_tracker_rift_025/ftnoir_rift_clientcontrols.ui create mode 100644 ftnoir_tracker_rift_025/ftnoir_tracker_rift.cpp create mode 100644 ftnoir_tracker_rift_025/ftnoir_tracker_rift.h create mode 100644 ftnoir_tracker_rift_025/ftnoir_tracker_rift_dialog.cpp create mode 100644 ftnoir_tracker_rift_025/images/medium.png create mode 100644 ftnoir_tracker_rift_025/images/rift_medium.png create mode 100644 ftnoir_tracker_rift_025/images/rift_small.png create mode 100644 ftnoir_tracker_rift_025/images/rift_tiny.png create mode 100644 ftnoir_tracker_rift_025/images/small.png create mode 100644 ftnoir_tracker_rift_025/images/tiny.png diff --git a/CMakeLists.txt b/CMakeLists.txt index 420c9067..766d23cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,6 +187,7 @@ endif() SET(SDK_HYDRA "" CACHE PATH "libSixense path for Razer Hydra") SET(SDK_HYDRA_AMD64 FALSE CACHE BOOL "whether libSixense is amd64 (else ia-32)") SET(SDK_RIFT "" CACHE PATH "libOVR path for Oculus Rift") +SET(SDK_RIFT_025 "" CACHE PATH "libOVR 0.2.5 path for Oculus Rift") set(SDK_ARUCO_LIBPATH "" CACHE FILEPATH "Aruco paper marker tracker static library path") @@ -426,6 +427,37 @@ endif() link_with_dinput8(opentrack-tracker-joystick) +if(SDK_RIFT_025) + set(link-flags) + set(c-flags) + if(APPLE) + set(link-flags "-framework CoreFoundation -framework CoreGraphics -framework IOKit -framework Quartz") + set(c-flags "-fno-strict-aliasing") + else() + if(NOT MSVC) + set(c-flags "-fno-strict-aliasing") + endif() + endif() + opentrack_library(opentrack-tracker-rift-025 ftnoir_tracker_rift-025 LINK ${link-flags} COMPILE ${c-flags}) + target_include_directories(opentrack-tracker-rift-025 SYSTEM PUBLIC ${SDK_RIFT_025}/Include ${SDK_RIFT_025}/Src) + if(WIN32) + if(MSVC) + set(ext lib) + set(p) + else() + set(ext a) + set(p lib) + endif() + target_link_libraries(opentrack-tracker-rift-025 ${SDK_RIFT_025}/${p}LibOVR.${ext} winmm setupapi ws2_32 imagehlp wbemuuid) + else() + if(NOT APPLE) + target_link_libraries(opentrack-tracker-rift-025 ${SDK_RIFT_025}/libLibOVR.a udev Xinerama) + else() + target_link_libraries(opentrack-tracker-rift-025 ${SDK_RIFT_025}/libLibOVR.a) + endif() + endif() +endif() + if(SDK_RIFT) set(link-flags) set(c-flags) @@ -433,9 +465,9 @@ if(SDK_RIFT) set(link-flags "-framework CoreFoundation -framework CoreGraphics -framework IOKit -framework Quartz") set(c-flags "-fno-strict-aliasing") else() - if(NOT MSVC) - set(c-flags "-fno-strict-aliasing") - endif() + if(NOT MSVC) + set(c-flags "-fno-strict-aliasing") + endif() endif() opentrack_library(opentrack-tracker-rift ftnoir_tracker_rift LINK ${link-flags} COMPILE ${c-flags}) target_include_directories(opentrack-tracker-rift SYSTEM PUBLIC ${SDK_RIFT}/Include ${SDK_RIFT}/Src) diff --git a/cmake/mingw-w64.cmake b/cmake/mingw-w64.cmake index 1f60993a..8604dafb 100644 --- a/cmake/mingw-w64.cmake +++ b/cmake/mingw-w64.cmake @@ -7,7 +7,7 @@ SET(CMAKE_SYSTEM_NAME Windows) SET(CMAKE_SYSTEM_VERSION 1) # specify the cross compiler -set(c i686-w64-mingw32-) +set(c /c/mingw-w64/i686-4.9.2-posix-sjlj-rt_v4-rev4/mingw32/bin/i686-w64-mingw32-) SET(CMAKE_C_COMPILER ${c}gcc) SET(CMAKE_CXX_COMPILER ${c}g++) diff --git a/ftnoir_tracker_rift_025/ftnoir_rift.qrc b/ftnoir_tracker_rift_025/ftnoir_rift.qrc new file mode 100644 index 00000000..cd174fc4 --- /dev/null +++ b/ftnoir_tracker_rift_025/ftnoir_rift.qrc @@ -0,0 +1,7 @@ + + + images/rift_medium.png + images/rift_small.png + images/rift_tiny.png + + diff --git a/ftnoir_tracker_rift_025/ftnoir_rift_clientcontrols.ui b/ftnoir_tracker_rift_025/ftnoir_rift_clientcontrols.ui new file mode 100644 index 00000000..20c8f00b --- /dev/null +++ b/ftnoir_tracker_rift_025/ftnoir_rift_clientcontrols.ui @@ -0,0 +1,176 @@ + + + UIRiftControls + + + Qt::NonModal + + + + 0 + 0 + 218 + 200 + + + + + 0 + 0 + + + + Oculus Rift tracker settings FaceTrackNoIR + + + + images/FaceTrackNoIR.pngimages/FaceTrackNoIR.png + + + Qt::LeftToRight + + + false + + + + + + Yaw spring + + + + + + Enable + + + + + + + Persistence + + + + + + + + 0 + 0 + + + + + 0 + 23 + + + + 5 + + + 0.900000000000000 + + + 1.000000000000000 + + + 0.001000000000000 + + + + + + + Constant drift + + + + + + + + 0 + 0 + + + + + 0 + 23 + + + + 5 + + + 0.000100000000000 + + + 0.100000000000000 + + + 0.001000000000000 + + + + + + + Deadzone + + + + + + + + 0 + 0 + + + + + 0 + 23 + + + + 5 + + + 0.100000000000000 + + + 0.010000000000000 + + + + + + + + + + + 0 + 0 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + startEngineClicked() + stopEngineClicked() + cameraSettingsClicked() + + diff --git a/ftnoir_tracker_rift_025/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift_025/ftnoir_tracker_rift.cpp new file mode 100644 index 00000000..549b5ca2 --- /dev/null +++ b/ftnoir_tracker_rift_025/ftnoir_tracker_rift.cpp @@ -0,0 +1,102 @@ +/* Copyright: "i couldn't care less what anyone does with the 5 lines of code i wrote" - mm0zct */ +#include "ftnoir_tracker_rift.h" +#include "facetracknoir/global-settings.h" +#include "OVR.h" +#include + +using namespace OVR; + +Rift_Tracker::Rift_Tracker() +{ + should_quit = false; + pManager = NULL; + pSensor = NULL; + pSFusion = NULL; + old_yaw = 0; +} + +Rift_Tracker::~Rift_Tracker() +{ + if (pSensor) + pSensor->Release(); + if (pSFusion) + delete pSFusion; + if (pManager) + pManager->Release(); + System::Destroy(); +} + +void Rift_Tracker::start_tracker(QFrame*) +{ + System::Init(Log::ConfigureDefaultLog(LogMask_All)); + pManager = DeviceManager::Create(); + if (pManager != NULL) + { + DeviceEnumerator enumerator = pManager->EnumerateDevices(); + if (enumerator.IsAvailable()) + { + pSensor = enumerator.CreateDevice(); + + if (pSensor) + { + pSFusion = new OVR::SensorFusion(); + pSFusion->Reset(); + pSFusion->AttachToSensor(pSensor); + } + else + { + QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to create Rift sensor",QMessageBox::Ok,QMessageBox::NoButton); + } + + } + else + { + QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to enumerate Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); + } + } + else + { + QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); + } +} + + +void Rift_Tracker::data(double *data) +{ + if (pSFusion != NULL && pSensor != NULL) + { + Quatf hmdOrient = pSFusion->GetOrientation(); + double newHeadPose[6]; + + float yaw = 0.0f; + float pitch = 0.0f; + float roll = 0.0f; + hmdOrient.GetEulerAngles(&yaw, &pitch , &roll); + newHeadPose[Pitch] = pitch; + newHeadPose[Roll] = roll; + newHeadPose[Yaw] = yaw; + if (s.useYawSpring) + { + newHeadPose[Yaw] = old_yaw*s.persistence + (yaw-old_yaw); + if(newHeadPose[Yaw] > s.deadzone) + newHeadPose[Yaw] -= s.constant_drift; + if(newHeadPose[Yaw] < -s.deadzone) + newHeadPose[Yaw] += s.constant_drift; + old_yaw=yaw; + } + if (s.bEnableYaw) + { + data[Yaw] = newHeadPose[Yaw] * 57.295781f; + } + if (s.bEnablePitch) + { + data[Pitch] = newHeadPose[Pitch] * 57.295781f; + } + if (s.bEnableRoll) + { + data[Roll] = newHeadPose[Roll] * 57.295781f; + } + } +} + +OPENTRACK_DECLARE_TRACKER(Rift_Tracker, TrackerControls, FTNoIR_TrackerDll) diff --git a/ftnoir_tracker_rift_025/ftnoir_tracker_rift.h b/ftnoir_tracker_rift_025/ftnoir_tracker_rift.h new file mode 100644 index 00000000..231648dd --- /dev/null +++ b/ftnoir_tracker_rift_025/ftnoir_tracker_rift.h @@ -0,0 +1,60 @@ +#pragma once +#include "ui_ftnoir_rift_clientcontrols.h" +#include +#include +#include +#include "opentrack/plugin-api.hpp" +#include "OVR.h" +#include +#include "opentrack/options.hpp" +using namespace options; + +struct settings : opts { + value useYawSpring; + value constant_drift, persistence, deadzone; + settings() : + opts("Rift"), + useYawSpring(b, "yaw-spring", false), + constant_drift(b, "constant-drift", 0.000005), + persistence(b, "persistence", 0.99999), + deadzone(b, "deadzone", 0.02) + {} +}; + +class Rift_Tracker : public ITracker +{ +public: + Rift_Tracker(); + ~Rift_Tracker() override; + void start_tracker(QFrame *) override; + void data(double *data) override; +private: + double old_yaw; + ovrHmd hmd; + settings s; +}; + +class TrackerControls: public ITrackerDialog +{ + Q_OBJECT +public: + TrackerControls(); + + void register_tracker(ITracker *) {} + void unregister_tracker() {} + +private: + Ui::UIRiftControls ui; + settings s; +private slots: + void doOK(); + void doCancel(); +}; + +class FTNoIR_TrackerDll : public Metadata +{ +public: + QString name() { return QString("Oculus Rift -- HMD"); } + QIcon icon() { return QIcon(":/images/rift_tiny.png"); } +}; + diff --git a/ftnoir_tracker_rift_025/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift_025/ftnoir_tracker_rift_dialog.cpp new file mode 100644 index 00000000..6c8e9cd7 --- /dev/null +++ b/ftnoir_tracker_rift_025/ftnoir_tracker_rift_dialog.cpp @@ -0,0 +1,26 @@ +#include "ftnoir_tracker_rift.h" +#include "opentrack/plugin-api.hpp" + +TrackerControls::TrackerControls() +{ + ui.setupUi( this ); + + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); + connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); + + tie_setting(s.constant_drift, ui.constantDrift); + tie_setting(s.deadzone, ui.deadzone); + tie_setting(s.persistence, ui.persistence); + tie_setting(s.useYawSpring, ui.yawSpring); +} + +void TrackerControls::doOK() { + s.b->save(); + this->close(); +} + +void TrackerControls::doCancel() { + s.b->reload(); + close(); +} + diff --git a/ftnoir_tracker_rift_025/images/medium.png b/ftnoir_tracker_rift_025/images/medium.png new file mode 100644 index 00000000..a5ba49e7 Binary files /dev/null and b/ftnoir_tracker_rift_025/images/medium.png differ diff --git a/ftnoir_tracker_rift_025/images/rift_medium.png b/ftnoir_tracker_rift_025/images/rift_medium.png new file mode 100644 index 00000000..a5ba49e7 Binary files /dev/null and b/ftnoir_tracker_rift_025/images/rift_medium.png differ diff --git a/ftnoir_tracker_rift_025/images/rift_small.png b/ftnoir_tracker_rift_025/images/rift_small.png new file mode 100644 index 00000000..3f18080c Binary files /dev/null and b/ftnoir_tracker_rift_025/images/rift_small.png differ diff --git a/ftnoir_tracker_rift_025/images/rift_tiny.png b/ftnoir_tracker_rift_025/images/rift_tiny.png new file mode 100644 index 00000000..76fe0f58 Binary files /dev/null and b/ftnoir_tracker_rift_025/images/rift_tiny.png differ diff --git a/ftnoir_tracker_rift_025/images/small.png b/ftnoir_tracker_rift_025/images/small.png new file mode 100644 index 00000000..3f18080c Binary files /dev/null and b/ftnoir_tracker_rift_025/images/small.png differ diff --git a/ftnoir_tracker_rift_025/images/tiny.png b/ftnoir_tracker_rift_025/images/tiny.png new file mode 100644 index 00000000..76fe0f58 Binary files /dev/null and b/ftnoir_tracker_rift_025/images/tiny.png differ -- cgit v1.2.3 From b0fbe9605b47437d06694a747e607a1b9558c8b3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 29 Oct 2015 07:25:52 +0100 Subject: rift: finish 0.2.5 support --- CMakeLists.txt | 2 +- ftnoir_tracker_rift/ftnoir_tracker_rift.h | 2 +- ftnoir_tracker_rift_025/ftnoir_rift.qrc | 7 - ftnoir_tracker_rift_025/ftnoir_rift_025.qrc | 7 + .../ftnoir_rift_clientcontrols.ui | 176 --------------------- .../ftnoir_rift_clientcontrols_025.ui | 176 +++++++++++++++++++++ ftnoir_tracker_rift_025/ftnoir_tracker_rift.cpp | 102 ------------ ftnoir_tracker_rift_025/ftnoir_tracker_rift.h | 60 ------- .../ftnoir_tracker_rift_025.cpp | 92 +++++++++++ ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.h | 63 ++++++++ .../ftnoir_tracker_rift_dialog.cpp | 26 --- .../ftnoir_tracker_rift_dialog_025.cpp | 26 +++ 12 files changed, 366 insertions(+), 373 deletions(-) delete mode 100644 ftnoir_tracker_rift_025/ftnoir_rift.qrc create mode 100644 ftnoir_tracker_rift_025/ftnoir_rift_025.qrc delete mode 100644 ftnoir_tracker_rift_025/ftnoir_rift_clientcontrols.ui create mode 100644 ftnoir_tracker_rift_025/ftnoir_rift_clientcontrols_025.ui delete mode 100644 ftnoir_tracker_rift_025/ftnoir_tracker_rift.cpp delete mode 100644 ftnoir_tracker_rift_025/ftnoir_tracker_rift.h create mode 100644 ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.cpp create mode 100644 ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.h delete mode 100644 ftnoir_tracker_rift_025/ftnoir_tracker_rift_dialog.cpp create mode 100644 ftnoir_tracker_rift_025/ftnoir_tracker_rift_dialog_025.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 766d23cb..e447c4b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -438,7 +438,7 @@ if(SDK_RIFT_025) set(c-flags "-fno-strict-aliasing") endif() endif() - opentrack_library(opentrack-tracker-rift-025 ftnoir_tracker_rift-025 LINK ${link-flags} COMPILE ${c-flags}) + opentrack_library(opentrack-tracker-rift-025 ftnoir_tracker_rift_025 LINK ${link-flags} COMPILE ${c-flags}) target_include_directories(opentrack-tracker-rift-025 SYSTEM PUBLIC ${SDK_RIFT_025}/Include ${SDK_RIFT_025}/Src) if(WIN32) if(MSVC) diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index 231648dd..f4458413 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -54,7 +54,7 @@ private slots: class FTNoIR_TrackerDll : public Metadata { public: - QString name() { return QString("Oculus Rift -- HMD"); } + QString name() { return QString("Oculus Rift DK2 -- HMD"); } QIcon icon() { return QIcon(":/images/rift_tiny.png"); } }; diff --git a/ftnoir_tracker_rift_025/ftnoir_rift.qrc b/ftnoir_tracker_rift_025/ftnoir_rift.qrc deleted file mode 100644 index cd174fc4..00000000 --- a/ftnoir_tracker_rift_025/ftnoir_rift.qrc +++ /dev/null @@ -1,7 +0,0 @@ - - - images/rift_medium.png - images/rift_small.png - images/rift_tiny.png - - diff --git a/ftnoir_tracker_rift_025/ftnoir_rift_025.qrc b/ftnoir_tracker_rift_025/ftnoir_rift_025.qrc new file mode 100644 index 00000000..cd174fc4 --- /dev/null +++ b/ftnoir_tracker_rift_025/ftnoir_rift_025.qrc @@ -0,0 +1,7 @@ + + + images/rift_medium.png + images/rift_small.png + images/rift_tiny.png + + diff --git a/ftnoir_tracker_rift_025/ftnoir_rift_clientcontrols.ui b/ftnoir_tracker_rift_025/ftnoir_rift_clientcontrols.ui deleted file mode 100644 index 20c8f00b..00000000 --- a/ftnoir_tracker_rift_025/ftnoir_rift_clientcontrols.ui +++ /dev/null @@ -1,176 +0,0 @@ - - - UIRiftControls - - - Qt::NonModal - - - - 0 - 0 - 218 - 200 - - - - - 0 - 0 - - - - Oculus Rift tracker settings FaceTrackNoIR - - - - images/FaceTrackNoIR.pngimages/FaceTrackNoIR.png - - - Qt::LeftToRight - - - false - - - - - - Yaw spring - - - - - - Enable - - - - - - - Persistence - - - - - - - - 0 - 0 - - - - - 0 - 23 - - - - 5 - - - 0.900000000000000 - - - 1.000000000000000 - - - 0.001000000000000 - - - - - - - Constant drift - - - - - - - - 0 - 0 - - - - - 0 - 23 - - - - 5 - - - 0.000100000000000 - - - 0.100000000000000 - - - 0.001000000000000 - - - - - - - Deadzone - - - - - - - - 0 - 0 - - - - - 0 - 23 - - - - 5 - - - 0.100000000000000 - - - 0.010000000000000 - - - - - - - - - - - 0 - 0 - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - startEngineClicked() - stopEngineClicked() - cameraSettingsClicked() - - diff --git a/ftnoir_tracker_rift_025/ftnoir_rift_clientcontrols_025.ui b/ftnoir_tracker_rift_025/ftnoir_rift_clientcontrols_025.ui new file mode 100644 index 00000000..20c8f00b --- /dev/null +++ b/ftnoir_tracker_rift_025/ftnoir_rift_clientcontrols_025.ui @@ -0,0 +1,176 @@ + + + UIRiftControls + + + Qt::NonModal + + + + 0 + 0 + 218 + 200 + + + + + 0 + 0 + + + + Oculus Rift tracker settings FaceTrackNoIR + + + + images/FaceTrackNoIR.pngimages/FaceTrackNoIR.png + + + Qt::LeftToRight + + + false + + + + + + Yaw spring + + + + + + Enable + + + + + + + Persistence + + + + + + + + 0 + 0 + + + + + 0 + 23 + + + + 5 + + + 0.900000000000000 + + + 1.000000000000000 + + + 0.001000000000000 + + + + + + + Constant drift + + + + + + + + 0 + 0 + + + + + 0 + 23 + + + + 5 + + + 0.000100000000000 + + + 0.100000000000000 + + + 0.001000000000000 + + + + + + + Deadzone + + + + + + + + 0 + 0 + + + + + 0 + 23 + + + + 5 + + + 0.100000000000000 + + + 0.010000000000000 + + + + + + + + + + + 0 + 0 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + startEngineClicked() + stopEngineClicked() + cameraSettingsClicked() + + diff --git a/ftnoir_tracker_rift_025/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift_025/ftnoir_tracker_rift.cpp deleted file mode 100644 index 549b5ca2..00000000 --- a/ftnoir_tracker_rift_025/ftnoir_tracker_rift.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* Copyright: "i couldn't care less what anyone does with the 5 lines of code i wrote" - mm0zct */ -#include "ftnoir_tracker_rift.h" -#include "facetracknoir/global-settings.h" -#include "OVR.h" -#include - -using namespace OVR; - -Rift_Tracker::Rift_Tracker() -{ - should_quit = false; - pManager = NULL; - pSensor = NULL; - pSFusion = NULL; - old_yaw = 0; -} - -Rift_Tracker::~Rift_Tracker() -{ - if (pSensor) - pSensor->Release(); - if (pSFusion) - delete pSFusion; - if (pManager) - pManager->Release(); - System::Destroy(); -} - -void Rift_Tracker::start_tracker(QFrame*) -{ - System::Init(Log::ConfigureDefaultLog(LogMask_All)); - pManager = DeviceManager::Create(); - if (pManager != NULL) - { - DeviceEnumerator enumerator = pManager->EnumerateDevices(); - if (enumerator.IsAvailable()) - { - pSensor = enumerator.CreateDevice(); - - if (pSensor) - { - pSFusion = new OVR::SensorFusion(); - pSFusion->Reset(); - pSFusion->AttachToSensor(pSensor); - } - else - { - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to create Rift sensor",QMessageBox::Ok,QMessageBox::NoButton); - } - - } - else - { - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to enumerate Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); - } - } - else - { - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); - } -} - - -void Rift_Tracker::data(double *data) -{ - if (pSFusion != NULL && pSensor != NULL) - { - Quatf hmdOrient = pSFusion->GetOrientation(); - double newHeadPose[6]; - - float yaw = 0.0f; - float pitch = 0.0f; - float roll = 0.0f; - hmdOrient.GetEulerAngles(&yaw, &pitch , &roll); - newHeadPose[Pitch] = pitch; - newHeadPose[Roll] = roll; - newHeadPose[Yaw] = yaw; - if (s.useYawSpring) - { - newHeadPose[Yaw] = old_yaw*s.persistence + (yaw-old_yaw); - if(newHeadPose[Yaw] > s.deadzone) - newHeadPose[Yaw] -= s.constant_drift; - if(newHeadPose[Yaw] < -s.deadzone) - newHeadPose[Yaw] += s.constant_drift; - old_yaw=yaw; - } - if (s.bEnableYaw) - { - data[Yaw] = newHeadPose[Yaw] * 57.295781f; - } - if (s.bEnablePitch) - { - data[Pitch] = newHeadPose[Pitch] * 57.295781f; - } - if (s.bEnableRoll) - { - data[Roll] = newHeadPose[Roll] * 57.295781f; - } - } -} - -OPENTRACK_DECLARE_TRACKER(Rift_Tracker, TrackerControls, FTNoIR_TrackerDll) diff --git a/ftnoir_tracker_rift_025/ftnoir_tracker_rift.h b/ftnoir_tracker_rift_025/ftnoir_tracker_rift.h deleted file mode 100644 index 231648dd..00000000 --- a/ftnoir_tracker_rift_025/ftnoir_tracker_rift.h +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once -#include "ui_ftnoir_rift_clientcontrols.h" -#include -#include -#include -#include "opentrack/plugin-api.hpp" -#include "OVR.h" -#include -#include "opentrack/options.hpp" -using namespace options; - -struct settings : opts { - value useYawSpring; - value constant_drift, persistence, deadzone; - settings() : - opts("Rift"), - useYawSpring(b, "yaw-spring", false), - constant_drift(b, "constant-drift", 0.000005), - persistence(b, "persistence", 0.99999), - deadzone(b, "deadzone", 0.02) - {} -}; - -class Rift_Tracker : public ITracker -{ -public: - Rift_Tracker(); - ~Rift_Tracker() override; - void start_tracker(QFrame *) override; - void data(double *data) override; -private: - double old_yaw; - ovrHmd hmd; - settings s; -}; - -class TrackerControls: public ITrackerDialog -{ - Q_OBJECT -public: - TrackerControls(); - - void register_tracker(ITracker *) {} - void unregister_tracker() {} - -private: - Ui::UIRiftControls ui; - settings s; -private slots: - void doOK(); - void doCancel(); -}; - -class FTNoIR_TrackerDll : public Metadata -{ -public: - QString name() { return QString("Oculus Rift -- HMD"); } - QIcon icon() { return QIcon(":/images/rift_tiny.png"); } -}; - diff --git a/ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.cpp b/ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.cpp new file mode 100644 index 00000000..75940697 --- /dev/null +++ b/ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.cpp @@ -0,0 +1,92 @@ +/* Copyright: "i couldn't care less what anyone does with the 5 lines of code i wrote" - mm0zct */ +#include "ftnoir_tracker_rift_025.h" +#include "opentrack/plugin-api.hpp" +#include "OVR.h" +#include + +using namespace OVR; + +Rift_Tracker::Rift_Tracker() +{ + pManager = NULL; + pSensor = NULL; + pSFusion = NULL; + old_yaw = 0; +} + +Rift_Tracker::~Rift_Tracker() +{ + if (pSensor) + pSensor->Release(); + if (pSFusion) + delete pSFusion; + if (pManager) + pManager->Release(); + System::Destroy(); +} + +void Rift_Tracker::start_tracker(QFrame*) +{ + System::Init(Log::ConfigureDefaultLog(LogMask_All)); + pManager = DeviceManager::Create(); + if (pManager != NULL) + { + DeviceEnumerator enumerator = pManager->EnumerateDevices(); + if (enumerator.IsAvailable()) + { + pSensor = enumerator.CreateDevice(); + + if (pSensor) + { + pSFusion = new OVR::SensorFusion(); + pSFusion->Reset(); + pSFusion->AttachToSensor(pSensor); + } + else + { + QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to create Rift sensor",QMessageBox::Ok,QMessageBox::NoButton); + } + + } + else + { + QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to enumerate Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); + } + } + else + { + QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); + } +} + + +void Rift_Tracker::data(double *data) +{ + if (pSFusion != NULL && pSensor != NULL) + { + Quatf hmdOrient = pSFusion->GetOrientation(); + double newHeadPose[6]; + + float yaw = 0.0f; + float pitch = 0.0f; + float roll = 0.0f; + hmdOrient.GetEulerAngles(&yaw, &pitch , &roll); + newHeadPose[Pitch] = pitch; + newHeadPose[Roll] = roll; + newHeadPose[Yaw] = yaw; + if (s.useYawSpring) + { + newHeadPose[Yaw] = old_yaw*s.persistence + (yaw-old_yaw); + if(newHeadPose[Yaw] > s.deadzone) + newHeadPose[Yaw] -= s.constant_drift; + if(newHeadPose[Yaw] < -s.deadzone) + newHeadPose[Yaw] += s.constant_drift; + old_yaw=yaw; + } + data[Yaw] = newHeadPose[Yaw] * 57.295781f; + data[Pitch] = newHeadPose[Pitch] * 57.295781f; + data[Roll] = newHeadPose[Roll] * 57.295781f; + } +} + +OPENTRACK_DECLARE_TRACKER(Rift_Tracker, TrackerControls, FTNoIR_TrackerDll) diff --git a/ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.h b/ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.h new file mode 100644 index 00000000..ca3068bc --- /dev/null +++ b/ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.h @@ -0,0 +1,63 @@ +#pragma once +#include "ui_ftnoir_rift_clientcontrols_025.h" +#include +#include +#include +#include "opentrack/plugin-api.hpp" +#include "OVR.h" +#include +#include "opentrack/options.hpp" +using namespace options; + +struct settings : opts { + value useYawSpring; + value constant_drift, persistence, deadzone; + settings() : + opts("Rift-025"), + useYawSpring(b, "yaw-spring", false), + constant_drift(b, "constant-drift", 0.000005), + persistence(b, "persistence", 0.99999), + deadzone(b, "deadzone", 0.02) + {} +}; + +class Rift_Tracker : public ITracker +{ +public: + Rift_Tracker(); + ~Rift_Tracker() override; + void start_tracker(QFrame *) override; + void data(double *data) override; +private: + double old_yaw; + settings s; + static bool isInitialised; + OVR::DeviceManager* pManager; + OVR::SensorDevice* pSensor; + OVR::SensorFusion* pSFusion; +}; + +class TrackerControls: public ITrackerDialog +{ + Q_OBJECT +public: + TrackerControls(); + + void register_tracker(ITracker *) {} + void unregister_tracker() {} + +private: + Ui::UIRiftControls ui; + settings s; +private slots: + void doOK(); + void doCancel(); +}; + +class FTNoIR_TrackerDll : public Metadata +{ +public: + QString name() { return QString("Oculus Rift DK1 -- HMD"); } + QIcon icon() { return QIcon(":/images/rift_tiny.png"); } +}; + diff --git a/ftnoir_tracker_rift_025/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift_025/ftnoir_tracker_rift_dialog.cpp deleted file mode 100644 index 6c8e9cd7..00000000 --- a/ftnoir_tracker_rift_025/ftnoir_tracker_rift_dialog.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "ftnoir_tracker_rift.h" -#include "opentrack/plugin-api.hpp" - -TrackerControls::TrackerControls() -{ - ui.setupUi( this ); - - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - - tie_setting(s.constant_drift, ui.constantDrift); - tie_setting(s.deadzone, ui.deadzone); - tie_setting(s.persistence, ui.persistence); - tie_setting(s.useYawSpring, ui.yawSpring); -} - -void TrackerControls::doOK() { - s.b->save(); - this->close(); -} - -void TrackerControls::doCancel() { - s.b->reload(); - close(); -} - diff --git a/ftnoir_tracker_rift_025/ftnoir_tracker_rift_dialog_025.cpp b/ftnoir_tracker_rift_025/ftnoir_tracker_rift_dialog_025.cpp new file mode 100644 index 00000000..8100e362 --- /dev/null +++ b/ftnoir_tracker_rift_025/ftnoir_tracker_rift_dialog_025.cpp @@ -0,0 +1,26 @@ +#include "ftnoir_tracker_rift_025.h" +#include "opentrack/plugin-api.hpp" + +TrackerControls::TrackerControls() +{ + ui.setupUi( this ); + + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); + connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); + + tie_setting(s.constant_drift, ui.constantDrift); + tie_setting(s.deadzone, ui.deadzone); + tie_setting(s.persistence, ui.persistence); + tie_setting(s.useYawSpring, ui.yawSpring); +} + +void TrackerControls::doOK() { + s.b->save(); + this->close(); +} + +void TrackerControls::doCancel() { + s.b->reload(); + close(); +} + -- cgit v1.2.3 From 5049312cc8847f5bd8cc9cf32dd42e39ae0bb1f5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 29 Oct 2015 10:34:44 +0100 Subject: support rift 0.2.5, 0.4.2, 0.8.0 Issue: #263 --- CMakeLists.txt | 84 ++++------ ftnoir_tracker_rift/ftnoir_rift.qrc | 7 - ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui | 176 --------------------- ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 71 --------- ftnoir_tracker_rift/ftnoir_tracker_rift.h | 60 ------- ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp | 26 --- ftnoir_tracker_rift/images/medium.png | Bin 5764 -> 0 bytes ftnoir_tracker_rift/images/rift_medium.png | Bin 5764 -> 0 bytes ftnoir_tracker_rift/images/rift_small.png | Bin 1212 -> 0 bytes ftnoir_tracker_rift/images/rift_tiny.png | Bin 624 -> 0 bytes ftnoir_tracker_rift/images/small.png | Bin 1212 -> 0 bytes ftnoir_tracker_rift/images/tiny.png | Bin 624 -> 0 bytes ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.h | 2 +- ftnoir_tracker_rift_042/ftnoir_rift_042.qrc | 7 + .../ftnoir_rift_clientcontrols_042.ui | 176 +++++++++++++++++++++ .../ftnoir_tracker_rift_042.cpp | 71 +++++++++ ftnoir_tracker_rift_042/ftnoir_tracker_rift_042.h | 60 +++++++ .../ftnoir_tracker_rift_dialog_042.cpp | 26 +++ ftnoir_tracker_rift_042/images/medium.png | Bin 0 -> 5764 bytes ftnoir_tracker_rift_042/images/rift_medium.png | Bin 0 -> 5764 bytes ftnoir_tracker_rift_042/images/rift_small.png | Bin 0 -> 1212 bytes ftnoir_tracker_rift_042/images/rift_tiny.png | Bin 0 -> 624 bytes ftnoir_tracker_rift_042/images/small.png | Bin 0 -> 1212 bytes ftnoir_tracker_rift_042/images/tiny.png | Bin 0 -> 624 bytes ftnoir_tracker_rift_080/ftnoir_rift_080.qrc | 7 + .../ftnoir_rift_clientcontrols_080.ui | 176 +++++++++++++++++++++ .../ftnoir_tracker_rift_080.cpp | 69 ++++++++ ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.h | 60 +++++++ .../ftnoir_tracker_rift_dialog_080.cpp | 26 +++ ftnoir_tracker_rift_080/images/medium.png | Bin 0 -> 5764 bytes ftnoir_tracker_rift_080/images/rift_medium.png | Bin 0 -> 5764 bytes ftnoir_tracker_rift_080/images/rift_small.png | Bin 0 -> 1212 bytes ftnoir_tracker_rift_080/images/rift_tiny.png | Bin 0 -> 624 bytes ftnoir_tracker_rift_080/images/small.png | Bin 0 -> 1212 bytes ftnoir_tracker_rift_080/images/tiny.png | Bin 0 -> 624 bytes 35 files changed, 708 insertions(+), 396 deletions(-) delete mode 100644 ftnoir_tracker_rift/ftnoir_rift.qrc delete mode 100644 ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui delete mode 100644 ftnoir_tracker_rift/ftnoir_tracker_rift.cpp delete mode 100644 ftnoir_tracker_rift/ftnoir_tracker_rift.h delete mode 100644 ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp delete mode 100644 ftnoir_tracker_rift/images/medium.png delete mode 100644 ftnoir_tracker_rift/images/rift_medium.png delete mode 100644 ftnoir_tracker_rift/images/rift_small.png delete mode 100644 ftnoir_tracker_rift/images/rift_tiny.png delete mode 100644 ftnoir_tracker_rift/images/small.png delete mode 100644 ftnoir_tracker_rift/images/tiny.png create mode 100644 ftnoir_tracker_rift_042/ftnoir_rift_042.qrc create mode 100644 ftnoir_tracker_rift_042/ftnoir_rift_clientcontrols_042.ui create mode 100644 ftnoir_tracker_rift_042/ftnoir_tracker_rift_042.cpp create mode 100644 ftnoir_tracker_rift_042/ftnoir_tracker_rift_042.h create mode 100644 ftnoir_tracker_rift_042/ftnoir_tracker_rift_dialog_042.cpp create mode 100644 ftnoir_tracker_rift_042/images/medium.png create mode 100644 ftnoir_tracker_rift_042/images/rift_medium.png create mode 100644 ftnoir_tracker_rift_042/images/rift_small.png create mode 100644 ftnoir_tracker_rift_042/images/rift_tiny.png create mode 100644 ftnoir_tracker_rift_042/images/small.png create mode 100644 ftnoir_tracker_rift_042/images/tiny.png create mode 100644 ftnoir_tracker_rift_080/ftnoir_rift_080.qrc create mode 100644 ftnoir_tracker_rift_080/ftnoir_rift_clientcontrols_080.ui create mode 100644 ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.cpp create mode 100644 ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.h create mode 100644 ftnoir_tracker_rift_080/ftnoir_tracker_rift_dialog_080.cpp create mode 100644 ftnoir_tracker_rift_080/images/medium.png create mode 100644 ftnoir_tracker_rift_080/images/rift_medium.png create mode 100644 ftnoir_tracker_rift_080/images/rift_small.png create mode 100644 ftnoir_tracker_rift_080/images/rift_tiny.png create mode 100644 ftnoir_tracker_rift_080/images/small.png create mode 100644 ftnoir_tracker_rift_080/images/tiny.png diff --git a/CMakeLists.txt b/CMakeLists.txt index e447c4b8..a444bce3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,7 +186,8 @@ endif() SET(SDK_HYDRA "" CACHE PATH "libSixense path for Razer Hydra") SET(SDK_HYDRA_AMD64 FALSE CACHE BOOL "whether libSixense is amd64 (else ia-32)") -SET(SDK_RIFT "" CACHE PATH "libOVR path for Oculus Rift") +SET(SDK_RIFT_080 "" CACHE PATH "libOVR path for Oculus Rift") +SET(SDK_RIFT_042 "" CACHE PATH "libOVR path for Oculus Rift") SET(SDK_RIFT_025 "" CACHE PATH "libOVR 0.2.5 path for Oculus Rift") set(SDK_ARUCO_LIBPATH "" CACHE FILEPATH "Aruco paper marker tracker static library path") @@ -427,67 +428,40 @@ endif() link_with_dinput8(opentrack-tracker-joystick) -if(SDK_RIFT_025) - set(link-flags) - set(c-flags) - if(APPLE) - set(link-flags "-framework CoreFoundation -framework CoreGraphics -framework IOKit -framework Quartz") - set(c-flags "-fno-strict-aliasing") - else() - if(NOT MSVC) +foreach(ver 025 042 080) + if(SDK_RIFT_${ver}) + set(link-flags) + set(c-flags) + if(APPLE) + set(link-flags "-framework CoreFoundation -framework CoreGraphics -framework IOKit -framework Quartz") set(c-flags "-fno-strict-aliasing") - endif() - endif() - opentrack_library(opentrack-tracker-rift-025 ftnoir_tracker_rift_025 LINK ${link-flags} COMPILE ${c-flags}) - target_include_directories(opentrack-tracker-rift-025 SYSTEM PUBLIC ${SDK_RIFT_025}/Include ${SDK_RIFT_025}/Src) - if(WIN32) - if(MSVC) - set(ext lib) - set(p) else() - set(ext a) - set(p lib) + if(NOT MSVC) + set(c-flags "-fno-strict-aliasing") endif() - target_link_libraries(opentrack-tracker-rift-025 ${SDK_RIFT_025}/${p}LibOVR.${ext} winmm setupapi ws2_32 imagehlp wbemuuid) - else() - if(NOT APPLE) - target_link_libraries(opentrack-tracker-rift-025 ${SDK_RIFT_025}/libLibOVR.a udev Xinerama) - else() - target_link_libraries(opentrack-tracker-rift-025 ${SDK_RIFT_025}/libLibOVR.a) endif() - endif() -endif() - -if(SDK_RIFT) - set(link-flags) - set(c-flags) - if(APPLE) - set(link-flags "-framework CoreFoundation -framework CoreGraphics -framework IOKit -framework Quartz") - set(c-flags "-fno-strict-aliasing") - else() - if(NOT MSVC) - set(c-flags "-fno-strict-aliasing") - endif() - endif() - opentrack_library(opentrack-tracker-rift ftnoir_tracker_rift LINK ${link-flags} COMPILE ${c-flags}) - target_include_directories(opentrack-tracker-rift SYSTEM PUBLIC ${SDK_RIFT}/Include ${SDK_RIFT}/Src) - if(WIN32) - if(MSVC) - set(ext lib) - set(p) - else() - set(ext a) - set(p lib) - endif() - target_link_libraries(opentrack-tracker-rift ${SDK_RIFT}/${p}LibOVR.${ext} winmm setupapi ws2_32 imagehlp wbemuuid) - else() - if(NOT APPLE) - target_link_libraries(opentrack-tracker-rift ${SDK_RIFT}/libLibOVR.a udev Xinerama) + opentrack_library(opentrack-tracker-rift-${ver} ftnoir_tracker_rift_${ver} LINK ${link-flags} COMPILE ${c-flags}) + target_include_directories(opentrack-tracker-rift-${ver} SYSTEM PUBLIC + ${SDK_RIFT_${ver}}/Include ${SDK_RIFT_${ver}}/Src + ) + if(WIN32) + if(MSVC) + set(ext lib) + set(p) + else() + set(ext a) + set(p lib) + endif() + target_link_libraries(opentrack-tracker-rift-${ver} ${SDK_RIFT_${ver}}/${p}LibOVR.${ext} winmm setupapi ws2_32 imagehlp wbemuuid) else() - target_link_libraries(opentrack-tracker-rift ${SDK_RIFT}/libLibOVR.a) + if(NOT APPLE) + target_link_libraries(opentrack-tracker-rift-${ver} ${SDK_RIFT_${ver}}/libLibOVR.a udev Xinerama) + else() + target_link_libraries(opentrack-tracker-rift-${ver} ${SDK_RIFT_${ver}}/libLibOVR.a) + endif() endif() endif() -endif() +endforeach() if(SDK_HYDRA) opentrack_library(opentrack-tracker-hydra ftnoir_tracker_hydra) diff --git a/ftnoir_tracker_rift/ftnoir_rift.qrc b/ftnoir_tracker_rift/ftnoir_rift.qrc deleted file mode 100644 index cd174fc4..00000000 --- a/ftnoir_tracker_rift/ftnoir_rift.qrc +++ /dev/null @@ -1,7 +0,0 @@ - - - images/rift_medium.png - images/rift_small.png - images/rift_tiny.png - - diff --git a/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui b/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui deleted file mode 100644 index 20c8f00b..00000000 --- a/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui +++ /dev/null @@ -1,176 +0,0 @@ - - - UIRiftControls - - - Qt::NonModal - - - - 0 - 0 - 218 - 200 - - - - - 0 - 0 - - - - Oculus Rift tracker settings FaceTrackNoIR - - - - images/FaceTrackNoIR.pngimages/FaceTrackNoIR.png - - - Qt::LeftToRight - - - false - - - - - - Yaw spring - - - - - - Enable - - - - - - - Persistence - - - - - - - - 0 - 0 - - - - - 0 - 23 - - - - 5 - - - 0.900000000000000 - - - 1.000000000000000 - - - 0.001000000000000 - - - - - - - Constant drift - - - - - - - - 0 - 0 - - - - - 0 - 23 - - - - 5 - - - 0.000100000000000 - - - 0.100000000000000 - - - 0.001000000000000 - - - - - - - Deadzone - - - - - - - - 0 - 0 - - - - - 0 - 23 - - - - 5 - - - 0.100000000000000 - - - 0.010000000000000 - - - - - - - - - - - 0 - 0 - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - startEngineClicked() - stopEngineClicked() - cameraSettingsClicked() - - diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp deleted file mode 100644 index 74208272..00000000 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright: "i couldn't care less what anyone does with the 5 lines of code i wrote" - mm0zct */ -#include "ftnoir_tracker_rift.h" -#include "opentrack/plugin-api.hpp" -#include "OVR_CAPI.h" -#include "Kernel/OVR_Math.h" -#include - -using namespace OVR; - -Rift_Tracker::Rift_Tracker() : old_yaw(0), hmd(nullptr) -{ -} - -Rift_Tracker::~Rift_Tracker() -{ - ovrHmd_Destroy(hmd); - ovr_Shutdown(); -} - -void Rift_Tracker::start_tracker(QFrame*) -{ - ovr_Initialize(); - hmd = ovrHmd_Create(0); - if (hmd) - { - ovrHmd_ConfigureTracking(hmd, ovrTrackingCap_Orientation | ovrTrackingCap_MagYawCorrection | ovrTrackingCap_Position, ovrTrackingCap_Orientation); - } - else - { - // XXX need change ITracker et al api to allow for failure reporting - // this qmessagebox doesn't give any relevant details either -sh 20141012 - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); - } -} - - -void Rift_Tracker::data(double *data) -{ - if (hmd) - { - ovrHSWDisplayState hsw; - if (ovrHmd_GetHSWDisplayState(hmd, &hsw), hsw.Displayed) - ovrHmd_DismissHSWDisplay(hmd); - ovrTrackingState ss = ovrHmd_GetTrackingState(hmd, 0); - if(ss.StatusFlags & ovrStatus_OrientationTracked) { - auto pose = ss.HeadPose.ThePose; - Quatf quat = pose.Orientation; - float yaw, pitch, roll; - quat.GetEulerAngles(&yaw, &pitch, &roll); - // XXX TODO move to core - if (s.useYawSpring) - { - yaw = old_yaw*s.persistence + (yaw-old_yaw); - if(yaw > s.deadzone) - yaw -= s.constant_drift; - if(yaw < -s.deadzone) - yaw += s.constant_drift; - old_yaw=yaw; - } - constexpr double d2r = 57.295781; - data[Yaw] = yaw * -d2r; - data[Pitch] = pitch * d2r; - data[Roll] = roll * d2r; - data[TX] = pose.Position.x * -1e2; - data[TY] = pose.Position.y * 1e2; - data[TZ] = pose.Position.z * 1e2; - } - } -} - -OPENTRACK_DECLARE_TRACKER(Rift_Tracker, TrackerControls, FTNoIR_TrackerDll) diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h deleted file mode 100644 index f4458413..00000000 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once -#include "ui_ftnoir_rift_clientcontrols.h" -#include -#include -#include -#include "opentrack/plugin-api.hpp" -#include "OVR.h" -#include -#include "opentrack/options.hpp" -using namespace options; - -struct settings : opts { - value useYawSpring; - value constant_drift, persistence, deadzone; - settings() : - opts("Rift"), - useYawSpring(b, "yaw-spring", false), - constant_drift(b, "constant-drift", 0.000005), - persistence(b, "persistence", 0.99999), - deadzone(b, "deadzone", 0.02) - {} -}; - -class Rift_Tracker : public ITracker -{ -public: - Rift_Tracker(); - ~Rift_Tracker() override; - void start_tracker(QFrame *) override; - void data(double *data) override; -private: - double old_yaw; - ovrHmd hmd; - settings s; -}; - -class TrackerControls: public ITrackerDialog -{ - Q_OBJECT -public: - TrackerControls(); - - void register_tracker(ITracker *) {} - void unregister_tracker() {} - -private: - Ui::UIRiftControls ui; - settings s; -private slots: - void doOK(); - void doCancel(); -}; - -class FTNoIR_TrackerDll : public Metadata -{ -public: - QString name() { return QString("Oculus Rift DK2 -- HMD"); } - QIcon icon() { return QIcon(":/images/rift_tiny.png"); } -}; - diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp deleted file mode 100644 index 6c8e9cd7..00000000 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "ftnoir_tracker_rift.h" -#include "opentrack/plugin-api.hpp" - -TrackerControls::TrackerControls() -{ - ui.setupUi( this ); - - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - - tie_setting(s.constant_drift, ui.constantDrift); - tie_setting(s.deadzone, ui.deadzone); - tie_setting(s.persistence, ui.persistence); - tie_setting(s.useYawSpring, ui.yawSpring); -} - -void TrackerControls::doOK() { - s.b->save(); - this->close(); -} - -void TrackerControls::doCancel() { - s.b->reload(); - close(); -} - diff --git a/ftnoir_tracker_rift/images/medium.png b/ftnoir_tracker_rift/images/medium.png deleted file mode 100644 index a5ba49e7..00000000 Binary files a/ftnoir_tracker_rift/images/medium.png and /dev/null differ diff --git a/ftnoir_tracker_rift/images/rift_medium.png b/ftnoir_tracker_rift/images/rift_medium.png deleted file mode 100644 index a5ba49e7..00000000 Binary files a/ftnoir_tracker_rift/images/rift_medium.png and /dev/null differ diff --git a/ftnoir_tracker_rift/images/rift_small.png b/ftnoir_tracker_rift/images/rift_small.png deleted file mode 100644 index 3f18080c..00000000 Binary files a/ftnoir_tracker_rift/images/rift_small.png and /dev/null differ diff --git a/ftnoir_tracker_rift/images/rift_tiny.png b/ftnoir_tracker_rift/images/rift_tiny.png deleted file mode 100644 index 76fe0f58..00000000 Binary files a/ftnoir_tracker_rift/images/rift_tiny.png and /dev/null differ diff --git a/ftnoir_tracker_rift/images/small.png b/ftnoir_tracker_rift/images/small.png deleted file mode 100644 index 3f18080c..00000000 Binary files a/ftnoir_tracker_rift/images/small.png and /dev/null differ diff --git a/ftnoir_tracker_rift/images/tiny.png b/ftnoir_tracker_rift/images/tiny.png deleted file mode 100644 index 76fe0f58..00000000 Binary files a/ftnoir_tracker_rift/images/tiny.png and /dev/null differ diff --git a/ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.h b/ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.h index ca3068bc..717cbe84 100644 --- a/ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.h +++ b/ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.h @@ -25,7 +25,7 @@ class Rift_Tracker : public ITracker { public: Rift_Tracker(); - ~Rift_Tracker() override; + virtual ~Rift_Tracker() override; void start_tracker(QFrame *) override; void data(double *data) override; private: diff --git a/ftnoir_tracker_rift_042/ftnoir_rift_042.qrc b/ftnoir_tracker_rift_042/ftnoir_rift_042.qrc new file mode 100644 index 00000000..cd174fc4 --- /dev/null +++ b/ftnoir_tracker_rift_042/ftnoir_rift_042.qrc @@ -0,0 +1,7 @@ + + + images/rift_medium.png + images/rift_small.png + images/rift_tiny.png + + diff --git a/ftnoir_tracker_rift_042/ftnoir_rift_clientcontrols_042.ui b/ftnoir_tracker_rift_042/ftnoir_rift_clientcontrols_042.ui new file mode 100644 index 00000000..20c8f00b --- /dev/null +++ b/ftnoir_tracker_rift_042/ftnoir_rift_clientcontrols_042.ui @@ -0,0 +1,176 @@ + + + UIRiftControls + + + Qt::NonModal + + + + 0 + 0 + 218 + 200 + + + + + 0 + 0 + + + + Oculus Rift tracker settings FaceTrackNoIR + + + + images/FaceTrackNoIR.pngimages/FaceTrackNoIR.png + + + Qt::LeftToRight + + + false + + + + + + Yaw spring + + + + + + Enable + + + + + + + Persistence + + + + + + + + 0 + 0 + + + + + 0 + 23 + + + + 5 + + + 0.900000000000000 + + + 1.000000000000000 + + + 0.001000000000000 + + + + + + + Constant drift + + + + + + + + 0 + 0 + + + + + 0 + 23 + + + + 5 + + + 0.000100000000000 + + + 0.100000000000000 + + + 0.001000000000000 + + + + + + + Deadzone + + + + + + + + 0 + 0 + + + + + 0 + 23 + + + + 5 + + + 0.100000000000000 + + + 0.010000000000000 + + + + + + + + + + + 0 + 0 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + startEngineClicked() + stopEngineClicked() + cameraSettingsClicked() + + diff --git a/ftnoir_tracker_rift_042/ftnoir_tracker_rift_042.cpp b/ftnoir_tracker_rift_042/ftnoir_tracker_rift_042.cpp new file mode 100644 index 00000000..655a014c --- /dev/null +++ b/ftnoir_tracker_rift_042/ftnoir_tracker_rift_042.cpp @@ -0,0 +1,71 @@ +/* Copyright: "i couldn't care less what anyone does with the 5 lines of code i wrote" - mm0zct */ +#include "ftnoir_tracker_rift_042.h" +#include "opentrack/plugin-api.hpp" +#include "OVR_CAPI.h" +#include "Kernel/OVR_Math.h" +#include + +using namespace OVR; + +Rift_Tracker::Rift_Tracker() : old_yaw(0), hmd(nullptr) +{ +} + +Rift_Tracker::~Rift_Tracker() +{ + ovrHmd_Destroy(hmd); + ovr_Shutdown(); +} + +void Rift_Tracker::start_tracker(QFrame*) +{ + ovr_Initialize(); + hmd = ovrHmd_Create(0); + if (hmd) + { + ovrHmd_ConfigureTracking(hmd, ovrTrackingCap_Orientation | ovrTrackingCap_MagYawCorrection | ovrTrackingCap_Position, ovrTrackingCap_Orientation); + } + else + { + // XXX need change ITracker et al api to allow for failure reporting + // this qmessagebox doesn't give any relevant details either -sh 20141012 + QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); + } +} + + +void Rift_Tracker::data(double *data) +{ + if (hmd) + { + ovrHSWDisplayState hsw; + if (ovrHmd_GetHSWDisplayState(hmd, &hsw), hsw.Displayed) + ovrHmd_DismissHSWDisplay(hmd); + ovrTrackingState ss = ovrHmd_GetTrackingState(hmd, 0); + if(ss.StatusFlags & ovrStatus_OrientationTracked) { + auto pose = ss.HeadPose.ThePose; + Quatf quat = pose.Orientation; + float yaw, pitch, roll; + quat.GetEulerAngles(&yaw, &pitch, &roll); + // XXX TODO move to core + if (s.useYawSpring) + { + yaw = old_yaw*s.persistence + (yaw-old_yaw); + if(yaw > s.deadzone) + yaw -= s.constant_drift; + if(yaw < -s.deadzone) + yaw += s.constant_drift; + old_yaw=yaw; + } + constexpr double d2r = 57.295781; + data[Yaw] = yaw * -d2r; + data[Pitch] = pitch * d2r; + data[Roll] = roll * d2r; + data[TX] = pose.Position.x * -1e2; + data[TY] = pose.Position.y * 1e2; + data[TZ] = pose.Position.z * 1e2; + } + } +} + +OPENTRACK_DECLARE_TRACKER(Rift_Tracker, TrackerControls, FTNoIR_TrackerDll) diff --git a/ftnoir_tracker_rift_042/ftnoir_tracker_rift_042.h b/ftnoir_tracker_rift_042/ftnoir_tracker_rift_042.h new file mode 100644 index 00000000..437a2a39 --- /dev/null +++ b/ftnoir_tracker_rift_042/ftnoir_tracker_rift_042.h @@ -0,0 +1,60 @@ +#pragma once +#include "ui_ftnoir_rift_clientcontrols_042.h" +#include +#include +#include +#include "opentrack/plugin-api.hpp" +#include "OVR.h" +#include +#include "opentrack/options.hpp" +using namespace options; + +struct settings : opts { + value useYawSpring; + value constant_drift, persistence, deadzone; + settings() : + opts("Rift"), + useYawSpring(b, "yaw-spring", false), + constant_drift(b, "constant-drift", 0.000005), + persistence(b, "persistence", 0.99999), + deadzone(b, "deadzone", 0.02) + {} +}; + +class Rift_Tracker : public ITracker +{ +public: + Rift_Tracker(); + virtual ~Rift_Tracker() override; + void start_tracker(QFrame *) override; + void data(double *data) override; +private: + double old_yaw; + ovrHmd hmd; + settings s; +}; + +class TrackerControls: public ITrackerDialog +{ + Q_OBJECT +public: + TrackerControls(); + + void register_tracker(ITracker *) {} + void unregister_tracker() {} + +private: + Ui::UIRiftControls ui; + settings s; +private slots: + void doOK(); + void doCancel(); +}; + +class FTNoIR_TrackerDll : public Metadata +{ +public: + QString name() { return QString("Oculus Rift runtime 0.4.2 -- HMD"); } + QIcon icon() { return QIcon(":/images/rift_tiny.png"); } +}; + diff --git a/ftnoir_tracker_rift_042/ftnoir_tracker_rift_dialog_042.cpp b/ftnoir_tracker_rift_042/ftnoir_tracker_rift_dialog_042.cpp new file mode 100644 index 00000000..9a8b7549 --- /dev/null +++ b/ftnoir_tracker_rift_042/ftnoir_tracker_rift_dialog_042.cpp @@ -0,0 +1,26 @@ +#include "ftnoir_tracker_rift_042.h" +#include "opentrack/plugin-api.hpp" + +TrackerControls::TrackerControls() +{ + ui.setupUi( this ); + + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); + connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); + + tie_setting(s.constant_drift, ui.constantDrift); + tie_setting(s.deadzone, ui.deadzone); + tie_setting(s.persistence, ui.persistence); + tie_setting(s.useYawSpring, ui.yawSpring); +} + +void TrackerControls::doOK() { + s.b->save(); + this->close(); +} + +void TrackerControls::doCancel() { + s.b->reload(); + close(); +} + diff --git a/ftnoir_tracker_rift_042/images/medium.png b/ftnoir_tracker_rift_042/images/medium.png new file mode 100644 index 00000000..a5ba49e7 Binary files /dev/null and b/ftnoir_tracker_rift_042/images/medium.png differ diff --git a/ftnoir_tracker_rift_042/images/rift_medium.png b/ftnoir_tracker_rift_042/images/rift_medium.png new file mode 100644 index 00000000..a5ba49e7 Binary files /dev/null and b/ftnoir_tracker_rift_042/images/rift_medium.png differ diff --git a/ftnoir_tracker_rift_042/images/rift_small.png b/ftnoir_tracker_rift_042/images/rift_small.png new file mode 100644 index 00000000..3f18080c Binary files /dev/null and b/ftnoir_tracker_rift_042/images/rift_small.png differ diff --git a/ftnoir_tracker_rift_042/images/rift_tiny.png b/ftnoir_tracker_rift_042/images/rift_tiny.png new file mode 100644 index 00000000..76fe0f58 Binary files /dev/null and b/ftnoir_tracker_rift_042/images/rift_tiny.png differ diff --git a/ftnoir_tracker_rift_042/images/small.png b/ftnoir_tracker_rift_042/images/small.png new file mode 100644 index 00000000..3f18080c Binary files /dev/null and b/ftnoir_tracker_rift_042/images/small.png differ diff --git a/ftnoir_tracker_rift_042/images/tiny.png b/ftnoir_tracker_rift_042/images/tiny.png new file mode 100644 index 00000000..76fe0f58 Binary files /dev/null and b/ftnoir_tracker_rift_042/images/tiny.png differ diff --git a/ftnoir_tracker_rift_080/ftnoir_rift_080.qrc b/ftnoir_tracker_rift_080/ftnoir_rift_080.qrc new file mode 100644 index 00000000..cd174fc4 --- /dev/null +++ b/ftnoir_tracker_rift_080/ftnoir_rift_080.qrc @@ -0,0 +1,7 @@ + + + images/rift_medium.png + images/rift_small.png + images/rift_tiny.png + + diff --git a/ftnoir_tracker_rift_080/ftnoir_rift_clientcontrols_080.ui b/ftnoir_tracker_rift_080/ftnoir_rift_clientcontrols_080.ui new file mode 100644 index 00000000..20c8f00b --- /dev/null +++ b/ftnoir_tracker_rift_080/ftnoir_rift_clientcontrols_080.ui @@ -0,0 +1,176 @@ + + + UIRiftControls + + + Qt::NonModal + + + + 0 + 0 + 218 + 200 + + + + + 0 + 0 + + + + Oculus Rift tracker settings FaceTrackNoIR + + + + images/FaceTrackNoIR.pngimages/FaceTrackNoIR.png + + + Qt::LeftToRight + + + false + + + + + + Yaw spring + + + + + + Enable + + + + + + + Persistence + + + + + + + + 0 + 0 + + + + + 0 + 23 + + + + 5 + + + 0.900000000000000 + + + 1.000000000000000 + + + 0.001000000000000 + + + + + + + Constant drift + + + + + + + + 0 + 0 + + + + + 0 + 23 + + + + 5 + + + 0.000100000000000 + + + 0.100000000000000 + + + 0.001000000000000 + + + + + + + Deadzone + + + + + + + + 0 + 0 + + + + + 0 + 23 + + + + 5 + + + 0.100000000000000 + + + 0.010000000000000 + + + + + + + + + + + 0 + 0 + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + startEngineClicked() + stopEngineClicked() + cameraSettingsClicked() + + diff --git a/ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.cpp b/ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.cpp new file mode 100644 index 00000000..4907f891 --- /dev/null +++ b/ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.cpp @@ -0,0 +1,69 @@ +/* Copyright: "i couldn't care less what anyone does with the 5 lines of code i wrote" - mm0zct */ +#include "ftnoir_tracker_rift_080.h" +#include "opentrack/plugin-api.hpp" +#include "OVR_CAPI.h" +#include "Extras/OVR_Math.h" +#include "OVR_CAPI_0_8_0.h" +#include + +using namespace OVR; + +Rift_Tracker::Rift_Tracker() : old_yaw(0), hmd(nullptr) +{ +} + +Rift_Tracker::~Rift_Tracker() +{ + if (hmd) + ovr_Destroy(hmd); + ovr_Shutdown(); +} + +void Rift_Tracker::start_tracker(QFrame*) +{ + ovrGraphicsLuid luid; + ovrResult result = ovr_Create(&hmd, &luid); + if (OVR_SUCCESS(result)) + { + ovr_ConfigureTracking(hmd, ovrTrackingCap_Orientation | ovrTrackingCap_MagYawCorrection | ovrTrackingCap_Position, ovrTrackingCap_Orientation); + } + else + { + // XXX need change ITracker et al api to allow for failure reporting + // this qmessagebox doesn't give any relevant details either -sh 20141012 + QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); + } +} + +void Rift_Tracker::data(double *data) +{ + if (hmd) + { + ovrTrackingState ss = ovr_GetTrackingState(hmd, 0, false); + if(ss.StatusFlags & ovrStatus_OrientationTracked) { + auto pose = ss.HeadPose.ThePose; + Quatf quat = pose.Orientation; + float yaw, pitch, roll; + quat.GetEulerAngles(&yaw, &pitch, &roll); + // XXX TODO move to core + if (s.useYawSpring) + { + yaw = old_yaw*s.persistence + (yaw-old_yaw); + if(yaw > s.deadzone) + yaw -= s.constant_drift; + if(yaw < -s.deadzone) + yaw += s.constant_drift; + old_yaw=yaw; + } + constexpr double d2r = 57.295781; + data[Yaw] = yaw * -d2r; + data[Pitch] = pitch * d2r; + data[Roll] = roll * d2r; + data[TX] = pose.Position.x * -1e2; + data[TY] = pose.Position.y * 1e2; + data[TZ] = pose.Position.z * 1e2; + } + } +} + +OPENTRACK_DECLARE_TRACKER(Rift_Tracker, TrackerControls, FTNoIR_TrackerDll) diff --git a/ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.h b/ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.h new file mode 100644 index 00000000..7ba191e1 --- /dev/null +++ b/ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.h @@ -0,0 +1,60 @@ +#pragma once +#include "ui_ftnoir_rift_clientcontrols_080.h" +#include +#include +#include +#include "opentrack/plugin-api.hpp" +#include "OVR.h" +#include +#include "opentrack/options.hpp" +using namespace options; + +struct settings : opts { + value useYawSpring; + value constant_drift, persistence, deadzone; + settings() : + opts("Rift"), + useYawSpring(b, "yaw-spring", false), + constant_drift(b, "constant-drift", 0.000005), + persistence(b, "persistence", 0.99999), + deadzone(b, "deadzone", 0.02) + {} +}; + +class Rift_Tracker : public ITracker +{ +public: + Rift_Tracker(); + virtual ~Rift_Tracker() override; + void start_tracker(QFrame *) override; + void data(double *data) override; +private: + double old_yaw; + ovrSession hmd; + settings s; +}; + +class TrackerControls: public ITrackerDialog +{ + Q_OBJECT +public: + TrackerControls(); + + void register_tracker(ITracker *) {} + void unregister_tracker() {} + +private: + Ui::UIRiftControls ui; + settings s; +private slots: + void doOK(); + void doCancel(); +}; + +class FTNoIR_TrackerDll : public Metadata +{ +public: + QString name() { return QString("Oculus Rift runtime 0.8.0 -- HMD"); } + QIcon icon() { return QIcon(":/images/rift_tiny.png"); } +}; + diff --git a/ftnoir_tracker_rift_080/ftnoir_tracker_rift_dialog_080.cpp b/ftnoir_tracker_rift_080/ftnoir_tracker_rift_dialog_080.cpp new file mode 100644 index 00000000..0bf797be --- /dev/null +++ b/ftnoir_tracker_rift_080/ftnoir_tracker_rift_dialog_080.cpp @@ -0,0 +1,26 @@ +#include "ftnoir_tracker_rift_080.h" +#include "opentrack/plugin-api.hpp" + +TrackerControls::TrackerControls() +{ + ui.setupUi( this ); + + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); + connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); + + tie_setting(s.constant_drift, ui.constantDrift); + tie_setting(s.deadzone, ui.deadzone); + tie_setting(s.persistence, ui.persistence); + tie_setting(s.useYawSpring, ui.yawSpring); +} + +void TrackerControls::doOK() { + s.b->save(); + this->close(); +} + +void TrackerControls::doCancel() { + s.b->reload(); + close(); +} + diff --git a/ftnoir_tracker_rift_080/images/medium.png b/ftnoir_tracker_rift_080/images/medium.png new file mode 100644 index 00000000..a5ba49e7 Binary files /dev/null and b/ftnoir_tracker_rift_080/images/medium.png differ diff --git a/ftnoir_tracker_rift_080/images/rift_medium.png b/ftnoir_tracker_rift_080/images/rift_medium.png new file mode 100644 index 00000000..a5ba49e7 Binary files /dev/null and b/ftnoir_tracker_rift_080/images/rift_medium.png differ diff --git a/ftnoir_tracker_rift_080/images/rift_small.png b/ftnoir_tracker_rift_080/images/rift_small.png new file mode 100644 index 00000000..3f18080c Binary files /dev/null and b/ftnoir_tracker_rift_080/images/rift_small.png differ diff --git a/ftnoir_tracker_rift_080/images/rift_tiny.png b/ftnoir_tracker_rift_080/images/rift_tiny.png new file mode 100644 index 00000000..76fe0f58 Binary files /dev/null and b/ftnoir_tracker_rift_080/images/rift_tiny.png differ diff --git a/ftnoir_tracker_rift_080/images/small.png b/ftnoir_tracker_rift_080/images/small.png new file mode 100644 index 00000000..3f18080c Binary files /dev/null and b/ftnoir_tracker_rift_080/images/small.png differ diff --git a/ftnoir_tracker_rift_080/images/tiny.png b/ftnoir_tracker_rift_080/images/tiny.png new file mode 100644 index 00000000..76fe0f58 Binary files /dev/null and b/ftnoir_tracker_rift_080/images/tiny.png differ -- cgit v1.2.3 From 27fff8e9557cd10691e2b7c850f008666efa9647 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 29 Oct 2015 10:39:00 +0100 Subject: xargs sed -i -e s/'FaceTrackNoIR Error/Error/g' --- ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp | 8 ++++---- ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp | 4 ++-- ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.cpp | 6 +++--- ftnoir_tracker_rift_042/ftnoir_tracker_rift_042.cpp | 2 +- ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.cpp | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp index 57ee132c..eea1cbca 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp @@ -230,11 +230,11 @@ void FTNoIR_Tracker::Initialize( QFrame *videoframe ) } } else { - QMessageBox::warning(0,"FaceTrackNoIR Error", ComPort->errorString(),QMessageBox::Ok,QMessageBox::NoButton); + QMessageBox::warning(0,"Error", ComPort->errorString(),QMessageBox::Ok,QMessageBox::NoButton); } } else { - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to open ComPort",QMessageBox::Ok,QMessageBox::NoButton); + QMessageBox::warning(0,"Error", "Unable to open ComPort",QMessageBox::Ok,QMessageBox::NoButton); delete ComPort; ComPort = NULL; } @@ -351,11 +351,11 @@ void FTNoIR_Tracker::start_tracker(QFrame*) Log("Port setup, waiting for HAT frames to process"); qDebug() << QTime::currentTime() << " HAT wait MPU "; } else { - QMessageBox::warning(0,"FaceTrackNoIR Error", ComPort->errorString(),QMessageBox::Ok,QMessageBox::NoButton); + QMessageBox::warning(0,"Error", ComPort->errorString(),QMessageBox::Ok,QMessageBox::NoButton); } } else { - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to open ComPort: " + ComPort->errorString(), QMessageBox::Ok,QMessageBox::NoButton); + QMessageBox::warning(0,"Error", "Unable to open ComPort: " + ComPort->errorString(), QMessageBox::Ok,QMessageBox::NoButton); delete ComPort; ComPort = NULL; } diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp index 90cdeec1..3ef1a764 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp @@ -37,7 +37,7 @@ TrackerControls::TrackerControls() : theTracker(NULL), settingsDirty(false), tim // Stop if no SerialPort dispo if (ui.cbSerialPort->count()<1) { - QMessageBox::critical(this,"FaceTrackNoIR Error", "No SerialPort avaible"); + QMessageBox::critical(this,"Error", "No SerialPort avaible"); } else { int indxport =ui.cbSerialPort->findText(settings.SerialPortName,Qt::MatchExactly ); @@ -45,7 +45,7 @@ TrackerControls::TrackerControls() : theTracker(NULL), settingsDirty(false), tim ui.cbSerialPort->setCurrentIndex(indxport); } else { if (settings.SerialPortName != "") - QMessageBox::warning(this,"FaceTrackNoIR Error", "Selected SerialPort modified"); + QMessageBox::warning(this,"Error", "Selected SerialPort modified"); ui.cbSerialPort-> setCurrentIndex(indxport); } } diff --git a/ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.cpp b/ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.cpp index 75940697..9588aaf8 100644 --- a/ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.cpp +++ b/ftnoir_tracker_rift_025/ftnoir_tracker_rift_025.cpp @@ -44,18 +44,18 @@ void Rift_Tracker::start_tracker(QFrame*) } else { - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to create Rift sensor",QMessageBox::Ok,QMessageBox::NoButton); + QMessageBox::warning(0,"Error", "Unable to create Rift sensor",QMessageBox::Ok,QMessageBox::NoButton); } } else { - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to enumerate Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); + QMessageBox::warning(0,"Error", "Unable to enumerate Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); } } else { - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); + QMessageBox::warning(0,"Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); } } diff --git a/ftnoir_tracker_rift_042/ftnoir_tracker_rift_042.cpp b/ftnoir_tracker_rift_042/ftnoir_tracker_rift_042.cpp index 655a014c..deea4a08 100644 --- a/ftnoir_tracker_rift_042/ftnoir_tracker_rift_042.cpp +++ b/ftnoir_tracker_rift_042/ftnoir_tracker_rift_042.cpp @@ -29,7 +29,7 @@ void Rift_Tracker::start_tracker(QFrame*) { // XXX need change ITracker et al api to allow for failure reporting // this qmessagebox doesn't give any relevant details either -sh 20141012 - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); + QMessageBox::warning(0,"Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); } } diff --git a/ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.cpp b/ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.cpp index 4907f891..5495e0e3 100644 --- a/ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.cpp +++ b/ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.cpp @@ -31,7 +31,7 @@ void Rift_Tracker::start_tracker(QFrame*) { // XXX need change ITracker et al api to allow for failure reporting // this qmessagebox doesn't give any relevant details either -sh 20141012 - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); + QMessageBox::warning(0,"Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); } } -- cgit v1.2.3 From 06a0a71f27134a86d19612fd786bfc2ca6f4c4bb Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 29 Oct 2015 10:41:11 +0100 Subject: fix vtable mess --- ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h | 2 +- ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h index 7d0fcd83..ebaffc6d 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h @@ -26,7 +26,7 @@ class TrackerControls: public QWidget, public ITrackerDialog Q_OBJECT public: explicit TrackerControls(); - virtual ~TrackerControls(); + ~TrackerControls() override; #ifdef OPENTRACK_API void Initialize(QWidget *parent) ; // unused void register_tracker(ITracker *tracker); diff --git a/ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.h b/ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.h index 7ba191e1..08684dd2 100644 --- a/ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.h +++ b/ftnoir_tracker_rift_080/ftnoir_tracker_rift_080.h @@ -25,7 +25,7 @@ class Rift_Tracker : public ITracker { public: Rift_Tracker(); - virtual ~Rift_Tracker() override; + ~Rift_Tracker() override; void start_tracker(QFrame *) override; void data(double *data) override; private: -- cgit v1.2.3