mirror of
https://github.com/mangosfour/server.git
synced 2025-12-11 07:37:02 +00:00
Rebase resync
This commit is contained in:
parent
a0797532e8
commit
1997c1e903
3106 changed files with 11118 additions and 627576 deletions
3
.gitattributes
vendored
3
.gitattributes
vendored
|
|
@ -3,6 +3,9 @@
|
|||
*.vcproj eol=crlf
|
||||
*.vcxproj* eol=crlf
|
||||
|
||||
src/shared/revision_nr.h eol=lf
|
||||
src/shared/revision_sql.h eol=lf
|
||||
|
||||
# Whitespace rules
|
||||
# strict (no trailing, no tabs)
|
||||
*.cpp whitespace=trailing-space,space-before-tab,tab-in-indent,cr-at-eol
|
||||
|
|
|
|||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -27,6 +27,7 @@ tags
|
|||
TAGS
|
||||
!.gitignore
|
||||
!.gitattributes
|
||||
!.travis.yml
|
||||
|
||||
#
|
||||
# Build generated files
|
||||
|
|
|
|||
|
|
@ -94,6 +94,9 @@ endif()
|
|||
# find Git: used to get the revision number
|
||||
find_package(Git)
|
||||
|
||||
# find Git: used to get the revision number
|
||||
find_package(Git)
|
||||
|
||||
# check if the platform supports precomiled headers
|
||||
find_package(PCHSupport)
|
||||
|
||||
|
|
|
|||
333
contrib/backporting/mangos-backport.sh
Normal file
333
contrib/backporting/mangos-backport.sh
Normal file
|
|
@ -0,0 +1,333 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# mangos-backport - a bash helper for backporting in git for MaNGOS project
|
||||
# Copyright (C) 2009 freghar <compmancz@gmail.com>
|
||||
#
|
||||
# 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA
|
||||
#
|
||||
|
||||
# The script works pretty simple - each time an empty commit is made,
|
||||
# copying author and message from the original one.
|
||||
# Then the original commit is cherry-picked -n (no commit)
|
||||
# and the changes are git commit --amended to the prepared empty commit.
|
||||
|
||||
### general definitions
|
||||
|
||||
## internals
|
||||
BATCH_PROCESS=0
|
||||
VERBOSE=0
|
||||
|
||||
## user-tunable
|
||||
AUTORESOLVE="src/shared/revision_nr.h"
|
||||
GIT_AMEND_OPTS="-s"
|
||||
GIT_RECOVER="git reset --hard HEAD^"
|
||||
CONFLICT_RETVAL=2 # for batch usage
|
||||
GIT_PATH="./"
|
||||
|
||||
|
||||
### print error to stderr
|
||||
function print_error {
|
||||
echo -e "${@}" 1>&2
|
||||
}
|
||||
|
||||
### prints help
|
||||
function print_help {
|
||||
echo -e "Usage: ${0##*/} [-vb] <revspec>" \
|
||||
"\nBackports a specified commit to current branch." \
|
||||
"\n\n -b Batch processing (no interaction)." \
|
||||
"\n (runs amend without calling \$EDITOR)" \
|
||||
"\n -v Be verbose." \
|
||||
"\n -n Never automatically commit." \
|
||||
"\n"
|
||||
}
|
||||
|
||||
### verbose print
|
||||
function verbose_print {
|
||||
[[ ${VERBOSE} > 0 ]] && echo "${@}"
|
||||
}
|
||||
|
||||
### runs a command and handles it's output verbosity
|
||||
#function verbose_run {
|
||||
# if [[ ${VERBOSE} > 0 ]]; then
|
||||
# "${@}"
|
||||
# return $?
|
||||
# else
|
||||
# "${@}" 1 > /dev/null
|
||||
# return $?
|
||||
# fi
|
||||
#}
|
||||
|
||||
### catches output of a command and returns it's retval
|
||||
#function catch_out {
|
||||
# pick_out=$(${@} 2>&1)
|
||||
# return $?
|
||||
#}
|
||||
|
||||
### recover from an error, deleting empty commit
|
||||
function git_recover {
|
||||
print_error "----------"
|
||||
print_error "Caught an error, checking for last commit ..."
|
||||
|
||||
# check if the last commit is empty,
|
||||
# ie. it has the same tree object dependency as it's parent
|
||||
local head_tree=$(git log -1 --pretty="%T" HEAD)
|
||||
local prev_tree=$(git log -1 --pretty="%T" HEAD^)
|
||||
if [[ $head_tree == $prev_tree ]]; then
|
||||
print_error "Last commit empty, running ${GIT_RECOVER}" \
|
||||
"\nto previous HEAD (should be ${CURRENT_HEAD})."
|
||||
print_error "----------"
|
||||
${GIT_RECOVER}
|
||||
else
|
||||
print_error "Last commit isn't empty (or git log failed) -" \
|
||||
"something strange happened,\ncheck git log" \
|
||||
"and do the cleanup (if needed) by hand."
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
### amend the empty commit, assigning new tree
|
||||
function git_autoamend {
|
||||
|
||||
# if the index is empty, there's nothing to amend
|
||||
if [[ -z $(git diff-index --cached HEAD) ]]; then
|
||||
git_retval=$?
|
||||
[[ $git_retval != 0 ]] && git_recover
|
||||
|
||||
print_error "The index is empty, nothing to amend. This should" \
|
||||
"not happen during normal\nworkflow, so you" \
|
||||
"probably did something crazy like picking\na" \
|
||||
"commit to a branch where it already exists."
|
||||
git_recover
|
||||
fi
|
||||
|
||||
verbose_print "----------"
|
||||
if [[ ${BATCH_PROCESS} > 0 ]]; then
|
||||
if [[ ${VERBOSE} > 0 ]]; then
|
||||
git commit ${GIT_AMEND_OPTS} --amend -C HEAD
|
||||
git_retval=$?
|
||||
else
|
||||
git commit ${GIT_AMEND_OPTS} --amend -C HEAD 1> /dev/null
|
||||
git_retval=$?
|
||||
[[ $git_retval == 0 ]] && echo \
|
||||
"Commit ${COMMIT_HASH} picked."
|
||||
fi
|
||||
else
|
||||
git commit ${GIT_AMEND_OPTS} --amend -c HEAD
|
||||
git_retval=$?
|
||||
fi
|
||||
[[ $git_retval != 0 ]] && git_recover
|
||||
}
|
||||
|
||||
|
||||
### main()
|
||||
|
||||
## arguments
|
||||
|
||||
# arg parsing
|
||||
while getopts "vbn" OPTION; do
|
||||
case $OPTION in
|
||||
v)
|
||||
VERBOSE=1
|
||||
;;
|
||||
b)
|
||||
BATCH_PROCESS=1
|
||||
;;
|
||||
n)
|
||||
NO_AUTOCOMMIT=1
|
||||
;;
|
||||
\?)
|
||||
print_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done;
|
||||
shift $(( $OPTIND - 1 ))
|
||||
ORIG_REF=${1}
|
||||
|
||||
# check for needed arguments
|
||||
if [[ -z ${ORIG_REF} ]]; then
|
||||
print_help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
## startup checks
|
||||
|
||||
# check for needed commands
|
||||
for cmd in git grep sed wc; do
|
||||
if [[ -z $(which ${cmd}) ]]; then
|
||||
print_error "error: ${cmd}: command not found"
|
||||
exit 1
|
||||
fi
|
||||
done;
|
||||
|
||||
# are we in git root dir?
|
||||
if [[ ! -d .git/ ]]; then
|
||||
print_error "error: not in repository root directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# is the index clean?
|
||||
if [[ ! -z $(git diff-index HEAD) ]]; then
|
||||
print_error "error: dirty index, run mixed/hard reset first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
## original commit infos
|
||||
|
||||
# current HEAD commit hash
|
||||
CURRENT_HEAD=$(git show -s --pretty=format:'%h' HEAD)
|
||||
[[ $? != 0 ]] && exit 1
|
||||
|
||||
# author with email
|
||||
COMMIT_AUTHOR=$(git show -s --pretty=format:'%an <%ae>' ${ORIG_REF})
|
||||
[[ $? != 0 ]] && exit 1
|
||||
|
||||
# commit object hash (abbrev)
|
||||
COMMIT_HASH=$(git show -s --pretty=format:'%h' ${ORIG_REF})
|
||||
[[ $? != 0 ]] && exit 1
|
||||
|
||||
# subject (with removed revision number)
|
||||
COMMIT_SUBJECT=$(git show -s --pretty=format:'%s' ${ORIG_REF} | sed -r 's/\[[a-z]?[0-9]*\] //')
|
||||
[[ $? != 0 ]] && exit 1
|
||||
COMMIT_REVISION=$(git show -s --pretty=format:'%s' ${ORIG_REF} | sed -nr 's/^\[([a-z]?[0-9]*).*/\1/p')
|
||||
[[ $? != 0 ]] && exit 1
|
||||
if [ "$COMMIT_REVISION" != "" ]; then COMMIT_REVISION="[$COMMIT_REVISION] - "; fi
|
||||
|
||||
# body
|
||||
COMMIT_BODY=$(git show -s --pretty=format:'%b' ${ORIG_REF})
|
||||
[[ $? != 0 ]] && exit 1
|
||||
|
||||
# whole message (yea, it could be done without echo)
|
||||
COMMIT_MESSAGE=$(echo -e "${COMMIT_SUBJECT}\n\n${COMMIT_BODY}\n\n(based on commit $COMMIT_REVISION${COMMIT_HASH})")
|
||||
[[ $? != 0 ]] && exit 1
|
||||
|
||||
## new empty commit ready, so create it
|
||||
verbose_print "Creating new empty commit on current HEAD (${CURRENT_HEAD}}."
|
||||
verbose_print "----------"
|
||||
if [[ ${VERBOSE} > 0 ]]; then
|
||||
git commit --author="${COMMIT_AUTHOR}" -m "${COMMIT_MESSAGE}" \
|
||||
--allow-empty
|
||||
[[ $? != 0 ]] && exit 1
|
||||
else
|
||||
git commit --author="${COMMIT_AUTHOR}" -m "${COMMIT_MESSAGE}" \
|
||||
--allow-empty 1> /dev/null
|
||||
[[ $? != 0 ]] && exit 1
|
||||
fi
|
||||
|
||||
|
||||
## first, try cherry-picking the commit and catch conflicts.
|
||||
## - if there are none, simply amend and exit
|
||||
## - if there are none related to $AUTORESOLVE, only prepare
|
||||
## the backported commit
|
||||
## - when multiple conflicts occur, including $AUTORESOLVE,
|
||||
## do the resolution for the one file, prepare the commit
|
||||
## and let user resolve the rest (+ amend)
|
||||
## - when only single ($AUTORESOLVE) conflict occur, resolve it
|
||||
## and fire up $EDITOR to autocommit
|
||||
|
||||
pick_out=$(git cherry-pick -n ${ORIG_REF} 2>&1)
|
||||
pick_retval=$?
|
||||
|
||||
# exit if there was a fatal app error
|
||||
if [[ $pick_retval > 1 ]]; then
|
||||
print_error "${pick_out}"
|
||||
git_recover
|
||||
fi
|
||||
|
||||
# get a list of unmerged files
|
||||
unmerged_files=$(git diff-files --diff-filter=U | sed 's/^[^\t]*\t//')
|
||||
git_retval=$?
|
||||
if [[ $git_retval != 0 ]]; then
|
||||
print_error "${pick_out}"
|
||||
git_recover
|
||||
fi
|
||||
|
||||
# simply amend if the pick was successful
|
||||
if [[ $pick_retval == 0 && -z $unmerged_files ]]; then
|
||||
verbose_print "${pick_out}"
|
||||
verbose_print "----------"
|
||||
if [[ ${NO_AUTOCOMMIT} > 0 ]]; then
|
||||
verbose_print "No conflicts to resolve, nothing to do."
|
||||
verbose_print "Please run git commit ${GIT_AMEND_OPTS} --amend" \
|
||||
"after making all necessary changes."
|
||||
verbose_print "Use ${GIT_RECOVER} to recover."
|
||||
else
|
||||
verbose_print "No conflicts to resolve, running amend."
|
||||
git_autoamend
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# sanity check
|
||||
if [[ -z $unmerged_files ]]; then
|
||||
print_error "${pick_out}"
|
||||
print_error "----------"
|
||||
print_error "git cherry-pick failed with status 1," \
|
||||
"\nbut no unmerged files were found."
|
||||
git_recover
|
||||
fi
|
||||
|
||||
# if $AUTORESOLVE isn't there (but other conflicts are), simply exit
|
||||
if [[ -z $(echo "${unmerged_files}" | grep ${AUTORESOLVE}) ]]; then
|
||||
print_error "${pick_out}"
|
||||
echo "----------"
|
||||
verbose_print "${AUTORESOLVE} not found as unmerged."
|
||||
echo "Please run git commit ${GIT_AMEND_OPTS} --amend" \
|
||||
"after resolving all conflicts."
|
||||
echo "To recover from the resolution, use ${GIT_RECOVER}."
|
||||
exit ${CONFLICT_RETVAL}
|
||||
fi
|
||||
|
||||
# do the resolution - use old version of the file
|
||||
if [[ -f ${AUTORESOLVE} ]]; then
|
||||
verbose_print "${pick_out}"
|
||||
verbose_print "----------"
|
||||
verbose_print "Auto-resolving ${AUTORESOLVE} using old version."
|
||||
git show :2:${AUTORESOLVE} > ${AUTORESOLVE}
|
||||
[[ $? != 0 ]] && git_recover
|
||||
git add ${AUTORESOLVE}
|
||||
[[ $? != 0 ]] && git_recover
|
||||
# echo "Resolution of ${AUTORESOLVE} finished successfuly."
|
||||
else
|
||||
print_error "${pick_out}"
|
||||
print_error "----------"
|
||||
print_error "error: ${AUTORESOLVE} not found, cannot resolve"
|
||||
git_recover
|
||||
fi
|
||||
|
||||
# if $AUTORESOLVE was the only conflict, amend the commit
|
||||
if [[ $(echo "${unmerged_files}" | wc -l) == 1 ]]; then
|
||||
verbose_print "----------"
|
||||
if [[ ${NO_AUTOCOMMIT} > 0 ]]; then
|
||||
verbose_print "All done, autocommit disabled, nothing to do."
|
||||
verbose_print "Please run git commit ${GIT_AMEND_OPTS} --amend" \
|
||||
"after making all necessary changes."
|
||||
verbose_print "Use ${GIT_RECOVER} to recover."
|
||||
else
|
||||
verbose_print "All done, running git commit ${GIT_AMEND_OPTS} --amend ..."
|
||||
git_autoamend
|
||||
fi
|
||||
exit 0
|
||||
|
||||
# else let the user do all other conflict resolutions
|
||||
else
|
||||
print_error "${pick_out}"
|
||||
echo "----------"
|
||||
echo "Please run git commit ${GIT_AMEND_OPTS} --amend" \
|
||||
"after resolving all conflicts."
|
||||
echo "To recover from the resolution, use ${GIT_RECOVER}."
|
||||
exit ${CONFLICT_RETVAL}
|
||||
fi
|
||||
1
contrib/cleanupTools/.gitignore
vendored
Normal file
1
contrib/cleanupTools/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
cleanupTools.config
|
||||
133
contrib/cleanupTools/cleanupHistory.sh
Normal file
133
contrib/cleanupTools/cleanupHistory.sh
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Tool to rebase a branch with cleaned commits
|
||||
#
|
||||
# Required:
|
||||
# - some tool for the cleanup
|
||||
# - base commit from which on the current branch shall be cleaned
|
||||
|
||||
# Do config stuff
|
||||
sh "${0%/*}/cleanupToolConfig.sh"
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
echo "You need to edit the configuration file before you can use this tool!"
|
||||
echo "Configuration file: ${0%/*}/cleanupTools.config"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# And use config settings
|
||||
. "${0%/*}/cleanupTools.config"
|
||||
|
||||
if [ "$BASE_COMMIT" = "" ]
|
||||
then
|
||||
echo "You did not specify a base-commit onto which to rebuild history"
|
||||
echo "or another unexpected error happened.."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# First: commit all changes onto current branch
|
||||
git commit -a -m"Cleanup History Commit: Pending Changes of WorkDir"
|
||||
|
||||
# Create list of commits that needs to be processed
|
||||
COMMIT_LIST=`git log --reverse --format=format:"%H" $BASE_COMMIT..HEAD`
|
||||
|
||||
# prepare history_cleanup branch
|
||||
git checkout -b history_cleanup $BASE_COMMIT
|
||||
# cleanup history
|
||||
echo "Cleanup History Tool: Cleanup initial state before rewriting history(might result in an empty commit)"
|
||||
$CLEANUP_TOOL > /dev/null
|
||||
git commit -a -m"Cleanup History Commit: Cleanup state before starting cleaning history"
|
||||
|
||||
for commit in $COMMIT_LIST
|
||||
do
|
||||
git checkout -b history_cleanup_tmp $commit
|
||||
[[ $? != 0 ]] && exit 1
|
||||
echo "Cleanup History Tool: Cleanup after commit $commit)"
|
||||
$CLEANUP_TOOL > /dev/null
|
||||
git commit -a -m"Cleanup History Commit: Temp cleaned" --allow-empty
|
||||
[[ $? != 0 ]] && exit 1
|
||||
git checkout history_cleanup
|
||||
[[ $? != 0 ]] && exit 1
|
||||
|
||||
## Catch differences
|
||||
git diff --binary history_cleanup..history_cleanup_tmp > history_cleanup_tmp.patch
|
||||
|
||||
# Get committer information to store it
|
||||
COMMITTER_N=$(git show -s --pretty=format:'%cn' ${commit})
|
||||
[[ $? != 0 ]] && exit 1
|
||||
COMMITTER_M=$(git show -s --pretty=format:'%ce' ${commit})
|
||||
[[ $? != 0 ]] && exit 1
|
||||
COMMITTER_D=$(git show -s --pretty=format:'%cd' ${commit})
|
||||
[[ $? != 0 ]] && exit 1
|
||||
GIT_COMMITTER_NAME=$COMMITTER_N; GIT_COMMITTER_EMAIL=$COMMITTER_M; GIT_COMMITTER_DATE=$COMMITTER_D;
|
||||
export GIT_COMMITTER_NAME; export GIT_COMMITTER_EMAIL; export GIT_COMMITTER_DATE;
|
||||
|
||||
# Two cases: either diff is identical to original commit, or not
|
||||
git diff --binary $commit^..$commit > history_cleanup_compare.patch
|
||||
DIFF_COUNT=`diff history_cleanup_tmp.patch history_cleanup_compare.patch | grep ">" | grep -v "> index " | wc -l`
|
||||
echo "Current State: Diffcount=$DIFF_COUNT"
|
||||
if [ "$DIFF_COUNT" = " 0" ]
|
||||
then # identical# TODO this is too strict!
|
||||
git cherry-pick $commit
|
||||
else # different, use new commit
|
||||
# commit object hash
|
||||
COMMIT_HASH=$(git show -s --pretty=format:'%h' ${commit})
|
||||
[[ $? != 0 ]] && exit 1
|
||||
# subject
|
||||
COMMIT_SUBJECT=$(git show -s --pretty=format:'%s' ${commit})
|
||||
[[ $? != 0 ]] && exit 1
|
||||
# body
|
||||
COMMIT_BODY=$(git show -s --pretty=format:'%b' ${commit})
|
||||
[[ $? != 0 ]] && exit 1
|
||||
# whole message
|
||||
COMMIT_MESSAGE=$(echo -e "${COMMIT_SUBJECT}\n\n${COMMIT_BODY}\n\n(cleaned version of ${COMMIT_HASH})")
|
||||
[[ $? != 0 ]] && exit 1
|
||||
|
||||
# Apply Cleaned changeset
|
||||
git apply history_cleanup_tmp.patch
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo "Could not apply patch with git methods, try with patch tool directly? (y/n)"
|
||||
read line
|
||||
if [ "$line" = "y" ]
|
||||
then
|
||||
patch -p1 -d. < history_cleanup_tmp.patch
|
||||
echo "Please check manually if this worked.."
|
||||
echo "Did it work? (y/n)"
|
||||
read line
|
||||
if [ "$line" != "y" ]
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo "Could not apply patch, store in history_cleanup_tmp.patch"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Git add new files
|
||||
NEW_FILES_LIST=`grep -B1 "new file mode" history_cleanup_tmp.patch | grep "diff --git a/" | sed 's!diff --git a/\(.*\) .*!\1!'`
|
||||
for fline in $NEW_FILES_LIST
|
||||
do
|
||||
git add $fline
|
||||
[[ $? != 0 ]] && exit 1
|
||||
done
|
||||
|
||||
# Commit just created commit with original information
|
||||
git commit -a --allow-empty -C"$commit"
|
||||
[[ $? != 0 ]] && exit 1
|
||||
git commit --amend --allow-empty -m"${COMMIT_MESSAGE}"
|
||||
[[ $? != 0 ]] && exit 1
|
||||
fi
|
||||
|
||||
git branch -D history_cleanup_tmp
|
||||
[[ $? != 0 ]] && exit 1
|
||||
done
|
||||
|
||||
rm history_cleanup_tmp.patch
|
||||
rm history_cleanup_compare.patch
|
||||
|
||||
GIT_COMMITTER_NAME=""; GIT_COMMITTER_EMAIL=""; GIT_COMMITTER_DATE="";
|
||||
export GIT_COMMITTER_NAME; export GIT_COMMITTER_EMAIL; export GIT_COMMITTER_DATE;
|
||||
68
contrib/cleanupTools/cleanupToolConfig.sh
Normal file
68
contrib/cleanupTools/cleanupToolConfig.sh
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Helper script to create a config file for the cleanup tools
|
||||
# The created config file must be edited manually
|
||||
|
||||
|
||||
if [ -f "${0%/*}/cleanupTools.config" ]
|
||||
then
|
||||
# file already exists, exit
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Create file
|
||||
cat << EOF > "${0%/*}/cleanupTools.config"
|
||||
#!/bin/sh
|
||||
|
||||
# Basic configuration for the cleanup helper scripts with mangos
|
||||
# Be sure to read this whole file and edit the variables as required
|
||||
#
|
||||
############################################################
|
||||
# Generic options:
|
||||
############################################################
|
||||
# Define the path to <MaNGOS> folder relatively from where you want to call the scripts.
|
||||
# The cleanupHistory.sh script must be called from within the repository that is to be cleaned!
|
||||
#
|
||||
BASEPATH="."
|
||||
#
|
||||
# Path to Astyle from the <MaNGOS> directory
|
||||
ASTYLE="../AStyle/bin/AStyle.exe"
|
||||
|
||||
|
||||
############################################################
|
||||
# The cleanupStyle.sh tool:
|
||||
############################################################
|
||||
# Job selection options are:
|
||||
# DO with possible choices: ASTYLE (to call the Astyle tool)
|
||||
# COMMENT_STYLE (to change comments from //foo to // foo and align them to column 61 if possible
|
||||
# OVERRIDE_CORRECTNESS[2] use at own RISK, this is maybe not too usefull
|
||||
DO="ASTYLE"
|
||||
#
|
||||
# DO_ON with possible choices: MANGOS_SRC to invoke the above cleanup routine on <MaNGOS>/src directory and subdirectories
|
||||
# MANGOS_CONTRIB to invoke the above cleanup routine on <MaNGOS>/contrib directory and subdirectories
|
||||
# MANGOS_WHOLE to invoke the above cleanup routine on <MaNGOS> directory and subdirectories
|
||||
# SD2 to invoke the above cleanup routine on <MaNGOS>/src/bindings/ScriptDev2 directory and subdirectories
|
||||
DO_ON="MANGOS_SRC"
|
||||
|
||||
|
||||
############################################################
|
||||
# The cleanupHistory.sh tool:
|
||||
############################################################
|
||||
# This tool will USE the cleanupStyle.sh tool to cleanup the history of the current branch with the settings above
|
||||
# It will clean the history based on the variable BASE_COMMIT that needs to be defined here
|
||||
BASE_COMMIT=""
|
||||
|
||||
|
||||
|
||||
###
|
||||
# Internal variables, do not change except you know what you are doing
|
||||
###
|
||||
# cleanup-tool
|
||||
CLEANUP_TOOL="\$BASEPATH/contrib/cleanupTools/cleanupStyle.sh"
|
||||
# path from current's caller position to ASTYLE
|
||||
ASTYLE="\$BASEPATH/\$ASTYLE"
|
||||
|
||||
EOF
|
||||
|
||||
# Return wil error, to display message if file is not found
|
||||
exit 1
|
||||
|
|
@ -7,20 +7,20 @@
|
|||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma resource "*.dfm"
|
||||
TFrmSearch *FrmSearch;
|
||||
TFrmSearch* FrmSearch;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TFrmSearch::TFrmSearch(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TFrmSearch::btOkClick(TObject *Sender)
|
||||
void __fastcall TFrmSearch::btOkClick(TObject* Sender)
|
||||
{
|
||||
ModalResult = mrOk;
|
||||
ModalResult = mrOk;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TFrmSearch::btCancelClick(TObject *Sender)
|
||||
void __fastcall TFrmSearch::btCancelClick(TObject* Sender)
|
||||
{
|
||||
ModalResult = mrCancel;
|
||||
ModalResult = mrCancel;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -11,19 +11,19 @@
|
|||
//---------------------------------------------------------------------------
|
||||
class TFrmSearch : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TRadioGroup *rgSI;
|
||||
TEdit *edSeach;
|
||||
TLabel *lbseach;
|
||||
TButton *btOk;
|
||||
TButton *btCancel;
|
||||
void __fastcall btOkClick(TObject *Sender);
|
||||
void __fastcall btCancelClick(TObject *Sender);
|
||||
private: // User declarations
|
||||
public: // User declarations
|
||||
__published: // IDE-managed Components
|
||||
TRadioGroup* rgSI;
|
||||
TEdit* edSeach;
|
||||
TLabel* lbseach;
|
||||
TButton* btOk;
|
||||
TButton* btCancel;
|
||||
void __fastcall btOkClick(TObject* Sender);
|
||||
void __fastcall btCancelClick(TObject* Sender);
|
||||
private: // User declarations
|
||||
public: // User declarations
|
||||
__fastcall TFrmSearch(TComponent* Owner);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TFrmSearch *FrmSearch;
|
||||
extern PACKAGE TFrmSearch* FrmSearch;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -7,19 +7,19 @@
|
|||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma resource "*.dfm"
|
||||
TFrmTitle *FrmTitle;
|
||||
TFrmTitle* FrmTitle;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TFrmTitle::TFrmTitle(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TFrmTitle::Button1Click(TObject *Sender)
|
||||
void __fastcall TFrmTitle::Button1Click(TObject* Sender)
|
||||
{
|
||||
ModalResult = mrOk;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TFrmTitle::Button2Click(TObject *Sender)
|
||||
void __fastcall TFrmTitle::Button2Click(TObject* Sender)
|
||||
{
|
||||
ModalResult = mrCancel;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,18 +10,18 @@
|
|||
//---------------------------------------------------------------------------
|
||||
class TFrmTitle : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TLabel *Label1;
|
||||
TEdit *edTitle;
|
||||
TButton *Button1;
|
||||
TButton *Button2;
|
||||
void __fastcall Button1Click(TObject *Sender);
|
||||
void __fastcall Button2Click(TObject *Sender);
|
||||
private: // User declarations
|
||||
public: // User declarations
|
||||
__published: // IDE-managed Components
|
||||
TLabel* Label1;
|
||||
TEdit* edTitle;
|
||||
TButton* Button1;
|
||||
TButton* Button2;
|
||||
void __fastcall Button1Click(TObject* Sender);
|
||||
void __fastcall Button2Click(TObject* Sender);
|
||||
private: // User declarations
|
||||
public: // User declarations
|
||||
__fastcall TFrmTitle(TComponent* Owner);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TFrmTitle *FrmTitle;
|
||||
extern PACKAGE TFrmTitle* FrmTitle;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -18,16 +18,16 @@
|
|||
|
||||
union TypePtr
|
||||
{
|
||||
long* l;
|
||||
DWORD* dw;
|
||||
WORD* w;
|
||||
char* c;
|
||||
void* p;
|
||||
float* f;
|
||||
long* l;
|
||||
DWORD* dw;
|
||||
WORD* w;
|
||||
char* c;
|
||||
void* p;
|
||||
float* f;
|
||||
|
||||
TypePtr(void* in) :p(in)
|
||||
{
|
||||
}
|
||||
TypePtr(void* in) : p(in)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#define TAG(x) (DWORD)( (((DWORD)x&0x0000ff00)<<8)+(((DWORD)x&0x000000ff)<<24)+(((DWORD)x&0x00ff0000)>>8)+(((DWORD)x&0xff000000)>>24) )
|
||||
|
|
@ -36,70 +36,70 @@ union TypePtr
|
|||
//---------------------------------------------------------------------------
|
||||
class TFrmMain : public TForm
|
||||
{
|
||||
__published: // IDE-managed Components
|
||||
TPanel *Panel1;
|
||||
TCoolBar *CoolBar1;
|
||||
TToolBar *ToolBar1;
|
||||
TToolButton *btOpen;
|
||||
TToolButton *btSave;
|
||||
TStringGrid *sgEdit;
|
||||
TOpenDialog *OpenDialog1;
|
||||
TPopupMenu *PopupMenu1;
|
||||
TMenuItem *N1;
|
||||
TMenuItem *N2;
|
||||
TMenuItem *btIntType;
|
||||
TMenuItem *btFloatType;
|
||||
TMenuItem *btTxtType;
|
||||
TImageList *ImageList1;
|
||||
TPanel *pnFileName;
|
||||
TToolButton *ToolButton1;
|
||||
TToolButton *ToolButton2;
|
||||
TTimer *Timer1;
|
||||
TLabel *lbOpState;
|
||||
TMenuItem *N4;
|
||||
TToolButton *ToolButton3;
|
||||
TMenuItem *btRowSave;
|
||||
TMenuItem *btColSave;
|
||||
TMenuItem *btRowClear;
|
||||
TMenuItem *btColClear;
|
||||
TToolButton *ToolButton4;
|
||||
TToolButton *ToolButton5;
|
||||
void __fastcall btOpenClick(TObject *Sender);
|
||||
void __fastcall btSaveClick(TObject *Sender);
|
||||
void __fastcall btIntTypeClick(TObject *Sender);
|
||||
void __fastcall btFloatTypeClick(TObject *Sender);
|
||||
void __fastcall PopupMenu1Popup(TObject *Sender);
|
||||
void __fastcall N1Click(TObject *Sender);
|
||||
void __fastcall FormDestroy(TObject *Sender);
|
||||
void __fastcall ToolButton1Click(TObject *Sender);
|
||||
void __fastcall sgEditKeyDown(TObject *Sender, WORD &Key,
|
||||
TShiftState Shift);
|
||||
void __fastcall sgEditSelectCell(TObject *Sender, int ACol,
|
||||
int ARow, bool &CanSelect);
|
||||
void __fastcall Timer1Timer(TObject *Sender);
|
||||
void __fastcall N4Click(TObject *Sender);
|
||||
void __fastcall btTxtTypeClick(TObject *Sender);
|
||||
void __fastcall ToolButton3Click(TObject *Sender);
|
||||
void __fastcall btRowSaveClick(TObject *Sender);
|
||||
void __fastcall btColSaveClick(TObject *Sender);
|
||||
void __fastcall btRowClearClick(TObject *Sender);
|
||||
void __fastcall btColClearClick(TObject *Sender);
|
||||
void __fastcall ToolButton4Click(TObject *Sender);
|
||||
private: // User declarations
|
||||
__published: // IDE-managed Components
|
||||
TPanel* Panel1;
|
||||
TCoolBar* CoolBar1;
|
||||
TToolBar* ToolBar1;
|
||||
TToolButton* btOpen;
|
||||
TToolButton* btSave;
|
||||
TStringGrid* sgEdit;
|
||||
TOpenDialog* OpenDialog1;
|
||||
TPopupMenu* PopupMenu1;
|
||||
TMenuItem* N1;
|
||||
TMenuItem* N2;
|
||||
TMenuItem* btIntType;
|
||||
TMenuItem* btFloatType;
|
||||
TMenuItem* btTxtType;
|
||||
TImageList* ImageList1;
|
||||
TPanel* pnFileName;
|
||||
TToolButton* ToolButton1;
|
||||
TToolButton* ToolButton2;
|
||||
TTimer* Timer1;
|
||||
TLabel* lbOpState;
|
||||
TMenuItem* N4;
|
||||
TToolButton* ToolButton3;
|
||||
TMenuItem* btRowSave;
|
||||
TMenuItem* btColSave;
|
||||
TMenuItem* btRowClear;
|
||||
TMenuItem* btColClear;
|
||||
TToolButton* ToolButton4;
|
||||
TToolButton* ToolButton5;
|
||||
void __fastcall btOpenClick(TObject* Sender);
|
||||
void __fastcall btSaveClick(TObject* Sender);
|
||||
void __fastcall btIntTypeClick(TObject* Sender);
|
||||
void __fastcall btFloatTypeClick(TObject* Sender);
|
||||
void __fastcall PopupMenu1Popup(TObject* Sender);
|
||||
void __fastcall N1Click(TObject* Sender);
|
||||
void __fastcall FormDestroy(TObject* Sender);
|
||||
void __fastcall ToolButton1Click(TObject* Sender);
|
||||
void __fastcall sgEditKeyDown(TObject* Sender, WORD& Key,
|
||||
TShiftState Shift);
|
||||
void __fastcall sgEditSelectCell(TObject* Sender, int ACol,
|
||||
int ARow, bool& CanSelect);
|
||||
void __fastcall Timer1Timer(TObject* Sender);
|
||||
void __fastcall N4Click(TObject* Sender);
|
||||
void __fastcall btTxtTypeClick(TObject* Sender);
|
||||
void __fastcall ToolButton3Click(TObject* Sender);
|
||||
void __fastcall btRowSaveClick(TObject* Sender);
|
||||
void __fastcall btColSaveClick(TObject* Sender);
|
||||
void __fastcall btRowClearClick(TObject* Sender);
|
||||
void __fastcall btColClearClick(TObject* Sender);
|
||||
void __fastcall ToolButton4Click(TObject* Sender);
|
||||
private: // User declarations
|
||||
|
||||
|
||||
thOpenFile *thOpen;
|
||||
thOpenFile* thOpen;
|
||||
bool Term;
|
||||
|
||||
public: // User declarations
|
||||
public: // User declarations
|
||||
bool OpenOk;
|
||||
|
||||
AnsiString CurrentOpenFile;
|
||||
__fastcall TFrmMain(TComponent* Owner);
|
||||
void SaveToFile(const char * pszFileName);
|
||||
void __fastcall OpenFileCol(AnsiString FileName,int ColIndex,int ColType);
|
||||
void SaveToFile(const char* pszFileName);
|
||||
void __fastcall OpenFileCol(AnsiString FileName, int ColIndex, int ColType);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
extern PACKAGE TFrmMain *FrmMain;
|
||||
extern PACKAGE TFrmMain* FrmMain;
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -9,29 +9,29 @@ USEFORM("SearchFrm.cpp", FrmSearch);
|
|||
//---------------------------------------------------------------------------
|
||||
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
try
|
||||
{
|
||||
Application->Initialize();
|
||||
Application->CreateForm(__classid(TFrmMain), &FrmMain);
|
||||
Application->CreateForm(__classid(TFrmTitle), &FrmTitle);
|
||||
Application->CreateForm(__classid(TFrmSearch), &FrmSearch);
|
||||
Application->Run();
|
||||
}
|
||||
catch (Exception& exception)
|
||||
{
|
||||
Application->ShowException(&exception);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
try
|
||||
{
|
||||
Application->Initialize();
|
||||
Application->CreateForm(__classid(TFrmMain), &FrmMain);
|
||||
Application->CreateForm(__classid(TFrmTitle), &FrmTitle);
|
||||
Application->CreateForm(__classid(TFrmSearch), &FrmSearch);
|
||||
Application->Run();
|
||||
throw Exception("");
|
||||
}
|
||||
catch (Exception &exception)
|
||||
catch (Exception& exception)
|
||||
{
|
||||
Application->ShowException(&exception);
|
||||
Application->ShowException(&exception);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
try
|
||||
{
|
||||
throw Exception("");
|
||||
}
|
||||
catch (Exception &exception)
|
||||
{
|
||||
Application->ShowException(&exception);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -26,157 +26,163 @@
|
|||
//---------------------------------------------------------------------------
|
||||
|
||||
__fastcall thOpenFile::thOpenFile(bool CreateSuspended)
|
||||
: TThread(CreateSuspended)
|
||||
: TThread(CreateSuspended)
|
||||
{
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall thOpenFile::Execute()
|
||||
{
|
||||
//---- Place thread code here ----
|
||||
//if(!Terminated){
|
||||
// FrmMain->LoadAndModify(FrmMain->OpenDialog1->FileName.c_str());
|
||||
// FrmMain->OpenOk=true;
|
||||
//}
|
||||
thEnd=false;
|
||||
RunOpen();
|
||||
FrmMain->OpenOk=true;
|
||||
thEnd=true;
|
||||
//---- Place thread code here ----
|
||||
//if(!Terminated){
|
||||
// FrmMain->LoadAndModify(FrmMain->OpenDialog1->FileName.c_str());
|
||||
// FrmMain->OpenOk=true;
|
||||
//}
|
||||
thEnd = false;
|
||||
RunOpen();
|
||||
FrmMain->OpenOk = true;
|
||||
thEnd = true;
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall thOpenFile::RunOpen()
|
||||
{
|
||||
LoadAndModify(FrmMain->OpenDialog1->FileName.c_str());
|
||||
//OpenOk=true;
|
||||
LoadAndModify(FrmMain->OpenDialog1->FileName.c_str());
|
||||
//OpenOk=true;
|
||||
}
|
||||
|
||||
void thOpenFile::ReadAndModifyFromBuff(char *pBuff, DWORD dwSize, const char* pszFileName)
|
||||
void thOpenFile::ReadAndModifyFromBuff(char* pBuff, DWORD dwSize, const char* pszFileName)
|
||||
{
|
||||
char szErrorMsg[MAX_PATH];
|
||||
char szNewFileName[MAX_PATH];
|
||||
DWORD w;
|
||||
TIniFile *ini;
|
||||
char szErrorMsg[MAX_PATH];
|
||||
char szNewFileName[MAX_PATH];
|
||||
DWORD w;
|
||||
TIniFile* ini;
|
||||
|
||||
|
||||
TypePtr p(pBuff);
|
||||
if('WDBC' != TAG(*p.dw))
|
||||
{
|
||||
_snprintf(szErrorMsg, 512, "[%s]Not Wow's dbc file!", pszFileName);
|
||||
ShowMessage(szErrorMsg);
|
||||
return;
|
||||
}
|
||||
p.dw++;
|
||||
TypePtr p(pBuff);
|
||||
if ('WDBC' != TAG(*p.dw))
|
||||
{
|
||||
_snprintf(szErrorMsg, 512, "[%s]Not Wow's dbc file!", pszFileName);
|
||||
ShowMessage(szErrorMsg);
|
||||
return;
|
||||
}
|
||||
p.dw++;
|
||||
|
||||
DWORD dwRows, dwCols, dwRowLen, dwTextLen;
|
||||
dwRows = *p.dw++;
|
||||
dwCols = *p.dw++;
|
||||
dwRowLen = *p.dw++;
|
||||
dwTextLen = *p.dw++;
|
||||
DWORD dwRows, dwCols, dwRowLen, dwTextLen;
|
||||
dwRows = *p.dw++;
|
||||
dwCols = *p.dw++;
|
||||
dwRowLen = *p.dw++;
|
||||
dwTextLen = *p.dw++;
|
||||
|
||||
FrmMain->sgEdit->RowCount = dwRows+1;
|
||||
FrmMain->sgEdit->ColCount = dwCols+1;
|
||||
FrmMain->sgEdit->RowCount = dwRows + 1;
|
||||
FrmMain->sgEdit->ColCount = dwCols + 1;
|
||||
|
||||
for(int i=0; i<FrmMain->sgEdit->RowCount; i++){
|
||||
FrmMain->sgEdit->Cells[0][i]=IntToStr(i);
|
||||
if(Terminated) return;
|
||||
}
|
||||
//设定列标题
|
||||
AnsiString iniSetFile=ExtractFilePath(Application->ExeName)+"BcdEditer.ini";
|
||||
AnsiString SectionName=ExtractFileName(FrmMain->CurrentOpenFile);
|
||||
for (int i = 0; i < FrmMain->sgEdit->RowCount; i++)
|
||||
{
|
||||
FrmMain->sgEdit->Cells[0][i] = IntToStr(i);
|
||||
if (Terminated) return;
|
||||
}
|
||||
//设定列标题
|
||||
AnsiString iniSetFile = ExtractFilePath(Application->ExeName) + "BcdEditer.ini";
|
||||
AnsiString SectionName = ExtractFileName(FrmMain->CurrentOpenFile);
|
||||
|
||||
ini = new TIniFile( iniSetFile );
|
||||
for(int j=0; j<FrmMain->sgEdit->ColCount; j++){
|
||||
FrmMain->sgEdit->Cells[j][0]= ini->ReadString(SectionName,"ColTitle"+IntToStr(j),IntToStr(j));
|
||||
//sgEdit->Cells[j][0]=IntToStr(j);
|
||||
ColType[j]=ini->ReadInteger(SectionName,"ColType"+IntToStr(j),0);
|
||||
if(Terminated) return;
|
||||
}
|
||||
delete ini;
|
||||
ini = new TIniFile(iniSetFile);
|
||||
for (int j = 0; j < FrmMain->sgEdit->ColCount; j++)
|
||||
{
|
||||
FrmMain->sgEdit->Cells[j][0] = ini->ReadString(SectionName, "ColTitle" + IntToStr(j), IntToStr(j));
|
||||
//sgEdit->Cells[j][0]=IntToStr(j);
|
||||
ColType[j] = ini->ReadInteger(SectionName, "ColType" + IntToStr(j), 0);
|
||||
if (Terminated) return;
|
||||
}
|
||||
delete ini;
|
||||
|
||||
//int *ColType = new int[dwCols];
|
||||
//int *ColType = new int[dwCols];
|
||||
|
||||
DWORD dwTextStartPos = dwRows*dwRowLen+20;
|
||||
char* pTextPtr = pBuff + dwTextStartPos;
|
||||
char pszTemp[MAX_PATH];
|
||||
float fTemp;
|
||||
long lTemp;
|
||||
DWORD i, j;
|
||||
BOOL* pbString = new BOOL[dwRows*dwCols];
|
||||
float newTmp;
|
||||
//int ColType;
|
||||
DWORD dwTextStartPos = dwRows * dwRowLen + 20;
|
||||
char* pTextPtr = pBuff + dwTextStartPos;
|
||||
char pszTemp[MAX_PATH];
|
||||
float fTemp;
|
||||
long lTemp;
|
||||
DWORD i, j;
|
||||
BOOL* pbString = new BOOL[dwRows * dwCols];
|
||||
float newTmp;
|
||||
//int ColType;
|
||||
|
||||
ini = new TIniFile( iniSetFile );
|
||||
ini = new TIniFile(iniSetFile);
|
||||
|
||||
for(i=0; i<dwRows; i++)
|
||||
{
|
||||
for(j=0; j<dwCols; j++)
|
||||
{
|
||||
//SleepEx(0,0);
|
||||
if(Terminated) return;
|
||||
lTemp = *p.l;
|
||||
newTmp = *p.f;
|
||||
memcpy(&fTemp, &newTmp, 4);
|
||||
for (i = 0; i < dwRows; i++)
|
||||
{
|
||||
for (j = 0; j < dwCols; j++)
|
||||
{
|
||||
//SleepEx(0,0);
|
||||
if (Terminated) return;
|
||||
lTemp = *p.l;
|
||||
newTmp = *p.f;
|
||||
memcpy(&fTemp, &newTmp, 4);
|
||||
|
||||
if(j==0) //ID
|
||||
FrmMain->sgEdit->Cells[j+1][i+1]=IntToStr(lTemp);
|
||||
else{
|
||||
if (j == 0) //ID
|
||||
FrmMain->sgEdit->Cells[j + 1][i + 1] = IntToStr(lTemp);
|
||||
else
|
||||
{
|
||||
|
||||
//ColType= ini->ReadInteger(SectionName,"ColType"+IntToStr(j),0);
|
||||
//ColType= ini->ReadInteger(SectionName,"ColType"+IntToStr(j),0);
|
||||
|
||||
switch (ColType[j+1])
|
||||
switch (ColType[j + 1])
|
||||
{
|
||||
case 0: //整型
|
||||
FrmMain->sgEdit->Cells[j + 1][i + 1] = IntToStr(lTemp);
|
||||
break;
|
||||
case 1: //浮点
|
||||
FrmMain->sgEdit->Cells[j + 1][i + 1] = FloatToStr(fTemp);
|
||||
break;
|
||||
case 2: //文本 文本类型只能看,不能编辑
|
||||
if (dwTextStartPos + lTemp < dwSize)
|
||||
{
|
||||
case 0: //整型
|
||||
FrmMain->sgEdit->Cells[j+1][i+1]=IntToStr(lTemp);
|
||||
break;
|
||||
case 1: //浮点
|
||||
FrmMain->sgEdit->Cells[j+1][i+1]=FloatToStr(fTemp);
|
||||
break;
|
||||
case 2: //文本 文本类型只能看,不能编辑
|
||||
if(dwTextStartPos + lTemp < dwSize){
|
||||
pTextPtr = pBuff + dwTextStartPos + lTemp;
|
||||
FrmMain->sgEdit->Cells[j+1][i+1]=pTextPtr;
|
||||
}else{
|
||||
FrmMain->sgEdit->Cells[j+1][i+1]="该列不是文本";
|
||||
}
|
||||
break;
|
||||
default: //整型
|
||||
FrmMain->sgEdit->Cells[j+1][i+1]=IntToStr(lTemp);
|
||||
pTextPtr = pBuff + dwTextStartPos + lTemp;
|
||||
FrmMain->sgEdit->Cells[j + 1][i + 1] = pTextPtr;
|
||||
}
|
||||
}
|
||||
p.c += 4;
|
||||
else
|
||||
{
|
||||
FrmMain->sgEdit->Cells[j + 1][i + 1] = "该列不是文本";
|
||||
}
|
||||
break;
|
||||
default: //整型
|
||||
FrmMain->sgEdit->Cells[j + 1][i + 1] = IntToStr(lTemp);
|
||||
}
|
||||
}
|
||||
p.c += 4;
|
||||
}
|
||||
}
|
||||
|
||||
delete [] pbString;
|
||||
//delete [] ColType;
|
||||
delete ini;
|
||||
delete [] pbString;
|
||||
//delete [] ColType;
|
||||
delete ini;
|
||||
|
||||
}
|
||||
|
||||
void thOpenFile::LoadAndModify(const char * pszFileName)
|
||||
void thOpenFile::LoadAndModify(const char* pszFileName)
|
||||
{
|
||||
HANDLE hFile = NULL;
|
||||
hFile = CreateFile(pszFileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
if(hFile == INVALID_HANDLE_VALUE)return;
|
||||
HANDLE hFile = NULL;
|
||||
hFile = CreateFile(pszFileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
if (hFile == INVALID_HANDLE_VALUE)return;
|
||||
|
||||
DWORD r = 0, nFileSize = 0;
|
||||
nFileSize = GetFileSize(hFile, NULL);
|
||||
char* pTmpBuf = new char[nFileSize];
|
||||
if(pTmpBuf==NULL)
|
||||
{
|
||||
CloseHandle(hFile);
|
||||
return;
|
||||
}
|
||||
ReadFile(hFile, pTmpBuf, nFileSize, &r, NULL);
|
||||
|
||||
FrmMain->CurrentOpenFile=pszFileName;
|
||||
FrmMain->btSave->Enabled=true;
|
||||
|
||||
ReadAndModifyFromBuff(pTmpBuf, nFileSize, pszFileName);
|
||||
|
||||
//SAFE_DELETE_ARRAY(pTmpBuf);
|
||||
delete [] pTmpBuf;
|
||||
DWORD r = 0, nFileSize = 0;
|
||||
nFileSize = GetFileSize(hFile, NULL);
|
||||
char* pTmpBuf = new char[nFileSize];
|
||||
if (pTmpBuf == NULL)
|
||||
{
|
||||
CloseHandle(hFile);
|
||||
return;
|
||||
}
|
||||
ReadFile(hFile, pTmpBuf, nFileSize, &r, NULL);
|
||||
|
||||
FrmMain->CurrentOpenFile = pszFileName;
|
||||
FrmMain->btSave->Enabled = true;
|
||||
|
||||
ReadAndModifyFromBuff(pTmpBuf, nFileSize, pszFileName);
|
||||
|
||||
//SAFE_DELETE_ARRAY(pTmpBuf);
|
||||
delete [] pTmpBuf;
|
||||
CloseHandle(hFile);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,17 +7,17 @@
|
|||
//---------------------------------------------------------------------------
|
||||
class thOpenFile : public TThread
|
||||
{
|
||||
private:
|
||||
protected:
|
||||
private:
|
||||
protected:
|
||||
void __fastcall Execute();
|
||||
void __fastcall RunOpen();
|
||||
public:
|
||||
bool thEnd;
|
||||
int ColType[10000];
|
||||
public:
|
||||
bool thEnd;
|
||||
int ColType[10000];
|
||||
|
||||
__fastcall thOpenFile(bool CreateSuspended);
|
||||
void LoadAndModify(const char * pszFileName);
|
||||
void ReadAndModifyFromBuff(char *pBuff, DWORD dwSize, const char* pszFileName);
|
||||
void LoadAndModify(const char* pszFileName);
|
||||
void ReadAndModifyFromBuff(char* pBuff, DWORD dwSize, const char* pszFileName);
|
||||
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -38,20 +38,24 @@
|
|||
#include "loadlib/wdt.h"
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined( __GNUC__ )
|
||||
#define _open open
|
||||
#define _close close
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
#define _open open
|
||||
#define _close close
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#ifdef O_LARGEFILE
|
||||
#define OPEN_FLAGS (O_RDONLY | O_BINARY | O_LARGEFILE)
|
||||
#define OPEN_FLAGS (O_RDONLY | O_BINARY | O_LARGEFILE)
|
||||
#else
|
||||
#define OPEN_FLAGS (O_RDONLY | O_BINARY)
|
||||
#define OPEN_FLAGS (O_RDONLY | O_BINARY)
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
|
|
@ -60,9 +64,9 @@ typedef struct
|
|||
uint32 id;
|
||||
} map_id;
|
||||
|
||||
map_id *map_ids;
|
||||
uint16 *areas;
|
||||
uint16 *LiqType;
|
||||
map_id* map_ids;
|
||||
uint16* areas;
|
||||
uint16* LiqType;
|
||||
char output_path[128] = ".";
|
||||
char input_path[128] = ".";
|
||||
uint32 maxAreaId = 0;
|
||||
|
|
@ -98,19 +102,19 @@ static char* const langs[] = {"enGB", "enUS", "deDE", "esES", "frFR", "koKR", "z
|
|||
#define EXPANSION_COUNT 3
|
||||
#define WORLD_COUNT 2
|
||||
|
||||
void CreateDir( const std::string& Path )
|
||||
void CreateDir(const std::string& Path)
|
||||
{
|
||||
#ifdef WIN32
|
||||
_mkdir( Path.c_str());
|
||||
#else
|
||||
mkdir( Path.c_str(), 0777 );
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
_mkdir(Path.c_str());
|
||||
#else
|
||||
mkdir(Path.c_str(), 0777);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool FileExists( const char* FileName )
|
||||
bool FileExists(const char* FileName)
|
||||
{
|
||||
int fp = _open(FileName, OPEN_FLAGS);
|
||||
if(fp != -1)
|
||||
if (fp != -1)
|
||||
{
|
||||
_close(fp);
|
||||
return true;
|
||||
|
|
@ -134,50 +138,50 @@ void Usage(char* prg)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
void HandleArgs(int argc, char * arg[])
|
||||
void HandleArgs(int argc, char* arg[])
|
||||
{
|
||||
for(int c = 1; c < argc; ++c)
|
||||
for (int c = 1; c < argc; ++c)
|
||||
{
|
||||
// i - input path
|
||||
// o - output path
|
||||
// e - extract only MAP(1)/DBC(2) - standard both(3)
|
||||
// f - use float to int conversion
|
||||
// h - limit minimum height
|
||||
if(arg[c][0] != '-')
|
||||
if (arg[c][0] != '-')
|
||||
Usage(arg[0]);
|
||||
|
||||
switch(arg[c][1])
|
||||
switch (arg[c][1])
|
||||
{
|
||||
case 'i':
|
||||
if(c + 1 < argc) // all ok
|
||||
if (c + 1 < argc) // all ok
|
||||
strcpy(input_path, arg[(c++) + 1]);
|
||||
else
|
||||
Usage(arg[0]);
|
||||
break;
|
||||
case 'o':
|
||||
if(c + 1 < argc) // all ok
|
||||
if (c + 1 < argc) // all ok
|
||||
strcpy(output_path, arg[(c++) + 1]);
|
||||
else
|
||||
Usage(arg[0]);
|
||||
break;
|
||||
case 'f':
|
||||
if(c + 1 < argc) // all ok
|
||||
CONF_allow_float_to_int=atoi(arg[(c++) + 1])!=0;
|
||||
if (c + 1 < argc) // all ok
|
||||
CONF_allow_float_to_int = atoi(arg[(c++) + 1]) != 0;
|
||||
else
|
||||
Usage(arg[0]);
|
||||
break;
|
||||
case 'e':
|
||||
if(c + 1 < argc) // all ok
|
||||
if (c + 1 < argc) // all ok
|
||||
{
|
||||
CONF_extract=atoi(arg[(c++) + 1]);
|
||||
if(!(CONF_extract > 0 && CONF_extract < 4))
|
||||
CONF_extract = atoi(arg[(c++) + 1]);
|
||||
if (!(CONF_extract > 0 && CONF_extract < 4))
|
||||
Usage(arg[0]);
|
||||
}
|
||||
else
|
||||
Usage(arg[0]);
|
||||
break;
|
||||
case 'b':
|
||||
if(c + 1 < argc) // all ok
|
||||
if (c + 1 < argc) // all ok
|
||||
{
|
||||
CONF_max_build = atoi(arg[(c++) + 1]);
|
||||
if (CONF_max_build < MIN_SUPPORTED_BUILD)
|
||||
|
|
@ -228,7 +232,7 @@ void AppendDB2FileListTo(HANDLE mpqHandle, std::set<std::string>& filelist)
|
|||
uint32 ReadBuild(int locale)
|
||||
{
|
||||
// include build info file also
|
||||
std::string filename = std::string("component.wow-")+langs[locale]+".txt";
|
||||
std::string filename = std::string("component.wow-") + langs[locale] + ".txt";
|
||||
//printf("Read %s file... ", filename.c_str());
|
||||
|
||||
HANDLE fileHandle;
|
||||
|
|
@ -254,14 +258,14 @@ uint32 ReadBuild(int locale)
|
|||
|
||||
size_t pos = text.find("version=\"");
|
||||
size_t pos1 = pos + strlen("version=\"");
|
||||
size_t pos2 = text.find("\"",pos1);
|
||||
size_t pos2 = text.find("\"", pos1);
|
||||
if (pos == text.npos || pos2 == text.npos || pos1 >= pos2)
|
||||
{
|
||||
printf("Fatal error: Invalid %s file format!\n", filename.c_str());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
std::string build_str = text.substr(pos1,pos2-pos1);
|
||||
std::string build_str = text.substr(pos1, pos2 - pos1);
|
||||
|
||||
int build = atoi(build_str.c_str());
|
||||
if (build <= 0)
|
||||
|
|
@ -297,7 +301,7 @@ uint32 ReadMapDBC(int const locale)
|
|||
}
|
||||
|
||||
DBCFile dbc(dbcFile);
|
||||
if(!dbc.open())
|
||||
if (!dbc.open())
|
||||
{
|
||||
printf("Fatal error: Invalid Map.dbc file format!\n");
|
||||
exit(1);
|
||||
|
|
@ -305,7 +309,7 @@ uint32 ReadMapDBC(int const locale)
|
|||
|
||||
size_t map_count = dbc.getRecordCount();
|
||||
map_ids = new map_id[map_count];
|
||||
for(uint32 x = 0; x < map_count; ++x)
|
||||
for (uint32 x = 0; x < map_count; ++x)
|
||||
{
|
||||
map_ids[x].id = dbc.getRecord(x).getUInt(0);
|
||||
strcpy(map_ids[x].name, dbc.getRecord(x).getString(1));
|
||||
|
|
@ -333,7 +337,7 @@ void ReadAreaTableDBC(int const locale)
|
|||
|
||||
DBCFile dbc(dbcFile);
|
||||
|
||||
if(!dbc.open())
|
||||
if (!dbc.open())
|
||||
{
|
||||
printf("Fatal error: Invalid AreaTable.dbc file format!\n");
|
||||
exit(1);
|
||||
|
|
@ -344,7 +348,7 @@ void ReadAreaTableDBC(int const locale)
|
|||
areas = new uint16[maxid + 1];
|
||||
memset(areas, 0xff, (maxid + 1) * sizeof(uint16));
|
||||
|
||||
for(uint32 x = 0; x < area_count; ++x)
|
||||
for (uint32 x = 0; x < area_count; ++x)
|
||||
areas[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3);
|
||||
|
||||
maxAreaId = dbc.getMaxId();
|
||||
|
|
@ -370,7 +374,7 @@ void ReadLiquidTypeTableDBC(int const locale)
|
|||
}
|
||||
|
||||
DBCFile dbc(dbcFile);
|
||||
if(!dbc.open())
|
||||
if (!dbc.open())
|
||||
{
|
||||
printf("Fatal error: Invalid LiquidType.dbc file format!\n");
|
||||
exit(1);
|
||||
|
|
@ -381,7 +385,7 @@ void ReadLiquidTypeTableDBC(int const locale)
|
|||
LiqType = new uint16[LiqType_maxid + 1];
|
||||
memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16));
|
||||
|
||||
for(uint32 x = 0; x < LiqType_count; ++x)
|
||||
for (uint32 x = 0; x < LiqType_count; ++x)
|
||||
LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3);
|
||||
|
||||
printf("Done! (%lu LiqTypes loaded)\n", LiqType_count);
|
||||
|
|
@ -393,7 +397,7 @@ void ReadLiquidTypeTableDBC(int const locale)
|
|||
|
||||
// Map file format data
|
||||
static char const* MAP_MAGIC = "MAPS";
|
||||
static char const* MAP_VERSION_MAGIC = "v1.2";
|
||||
static char const* MAP_VERSION_MAGIC = "c1.3";
|
||||
static char const* MAP_AREA_MAGIC = "AREA";
|
||||
static char const* MAP_HEIGHT_MAGIC = "MHGT";
|
||||
static char const* MAP_LIQUID_MAGIC = "MLIQ";
|
||||
|
|
@ -443,7 +447,6 @@ struct map_heightHeader
|
|||
#define MAP_LIQUID_TYPE_DARK_WATER 0x10
|
||||
#define MAP_LIQUID_TYPE_WMO_WATER 0x20
|
||||
|
||||
|
||||
#define MAP_LIQUID_NO_TYPE 0x0001
|
||||
#define MAP_LIQUID_NO_HEIGHT 0x0002
|
||||
|
||||
|
|
@ -472,17 +475,18 @@ float selectUInt16StepStore(float maxDiff)
|
|||
uint16 area_flags[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
|
||||
|
||||
float V8[ADT_GRID_SIZE][ADT_GRID_SIZE];
|
||||
float V9[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1];
|
||||
float V9[ADT_GRID_SIZE + 1][ADT_GRID_SIZE + 1];
|
||||
uint16 uint16_V8[ADT_GRID_SIZE][ADT_GRID_SIZE];
|
||||
uint16 uint16_V9[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1];
|
||||
uint16 uint16_V9[ADT_GRID_SIZE + 1][ADT_GRID_SIZE + 1];
|
||||
uint8 uint8_V8[ADT_GRID_SIZE][ADT_GRID_SIZE];
|
||||
uint8 uint8_V9[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1];
|
||||
uint8 uint8_V9[ADT_GRID_SIZE + 1][ADT_GRID_SIZE + 1];
|
||||
|
||||
uint8 liquid_type[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
|
||||
uint16 liquid_entry[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
|
||||
uint8 liquid_flags[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
|
||||
bool liquid_show[ADT_GRID_SIZE][ADT_GRID_SIZE];
|
||||
float liquid_height[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1];
|
||||
float liquid_height[ADT_GRID_SIZE + 1][ADT_GRID_SIZE + 1];
|
||||
|
||||
bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32 build)
|
||||
bool ConvertADT(char* filename, char* filename2, int cell_y, int cell_x, uint32 build)
|
||||
{
|
||||
ADT_file adt;
|
||||
|
||||
|
|
@ -490,7 +494,8 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32
|
|||
return false;
|
||||
|
||||
memset(liquid_show, 0, sizeof(liquid_show));
|
||||
memset(liquid_type, 0, sizeof(liquid_type));
|
||||
memset(liquid_flags, 0, sizeof(liquid_flags));
|
||||
memset(liquid_entry, 0, sizeof(liquid_entry));
|
||||
|
||||
// Prepare map header
|
||||
map_fileheader map;
|
||||
|
|
@ -499,15 +504,15 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32
|
|||
map.buildMagic = build;
|
||||
|
||||
// Get area flags data
|
||||
for (int i=0;i<ADT_CELLS_PER_GRID;i++)
|
||||
for (int i = 0; i < ADT_CELLS_PER_GRID; i++)
|
||||
{
|
||||
for(int j=0;j<ADT_CELLS_PER_GRID;j++)
|
||||
for (int j = 0; j < ADT_CELLS_PER_GRID; j++)
|
||||
{
|
||||
adt_MCNK * cell = adt.cells[i][j];
|
||||
adt_MCNK* cell = adt.cells[i][j];
|
||||
uint32 areaid = cell->areaid;
|
||||
if(areaid && areaid <= maxAreaId)
|
||||
if (areaid && areaid <= maxAreaId)
|
||||
{
|
||||
if(areas[areaid] != 0xffff)
|
||||
if (areas[areaid] != 0xffff)
|
||||
{
|
||||
area_flags[i][j] = areas[areaid];
|
||||
continue;
|
||||
|
|
@ -522,11 +527,11 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32
|
|||
//============================================
|
||||
bool fullAreaData = false;
|
||||
uint32 areaflag = area_flags[0][0];
|
||||
for (int y=0;y<ADT_CELLS_PER_GRID;y++)
|
||||
for (int y = 0; y < ADT_CELLS_PER_GRID; y++)
|
||||
{
|
||||
for(int x=0;x<ADT_CELLS_PER_GRID;x++)
|
||||
for (int x = 0; x < ADT_CELLS_PER_GRID; x++)
|
||||
{
|
||||
if(area_flags[y][x]!=areaflag)
|
||||
if (area_flags[y][x] != areaflag)
|
||||
{
|
||||
fullAreaData = true;
|
||||
break;
|
||||
|
|
@ -543,7 +548,7 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32
|
|||
if (fullAreaData)
|
||||
{
|
||||
areaHeader.gridArea = 0;
|
||||
map.areaMapSize+=sizeof(area_flags);
|
||||
map.areaMapSize += sizeof(area_flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -554,11 +559,11 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32
|
|||
//
|
||||
// Get Height map from grid
|
||||
//
|
||||
for (int i=0;i<ADT_CELLS_PER_GRID;i++)
|
||||
for (int i = 0; i < ADT_CELLS_PER_GRID; i++)
|
||||
{
|
||||
for(int j=0;j<ADT_CELLS_PER_GRID;j++)
|
||||
for (int j = 0; j < ADT_CELLS_PER_GRID; j++)
|
||||
{
|
||||
adt_MCNK * cell = adt.cells[i][j];
|
||||
adt_MCNK* cell = adt.cells[i][j];
|
||||
if (!cell)
|
||||
continue;
|
||||
// Height values for triangles stored in order:
|
||||
|
|
@ -578,46 +583,46 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32
|
|||
// . . . . . . . .
|
||||
|
||||
// Set map height as grid height
|
||||
for (int y=0; y <= ADT_CELL_SIZE; y++)
|
||||
for (int y = 0; y <= ADT_CELL_SIZE; y++)
|
||||
{
|
||||
int cy = i*ADT_CELL_SIZE + y;
|
||||
for (int x=0; x <= ADT_CELL_SIZE; x++)
|
||||
int cy = i * ADT_CELL_SIZE + y;
|
||||
for (int x = 0; x <= ADT_CELL_SIZE; x++)
|
||||
{
|
||||
int cx = j*ADT_CELL_SIZE + x;
|
||||
V9[cy][cx]=cell->ypos;
|
||||
int cx = j * ADT_CELL_SIZE + x;
|
||||
V9[cy][cx] = cell->ypos;
|
||||
}
|
||||
}
|
||||
for (int y=0; y < ADT_CELL_SIZE; y++)
|
||||
for (int y = 0; y < ADT_CELL_SIZE; y++)
|
||||
{
|
||||
int cy = i*ADT_CELL_SIZE + y;
|
||||
for (int x=0; x < ADT_CELL_SIZE; x++)
|
||||
int cy = i * ADT_CELL_SIZE + y;
|
||||
for (int x = 0; x < ADT_CELL_SIZE; x++)
|
||||
{
|
||||
int cx = j*ADT_CELL_SIZE + x;
|
||||
V8[cy][cx]=cell->ypos;
|
||||
int cx = j * ADT_CELL_SIZE + x;
|
||||
V8[cy][cx] = cell->ypos;
|
||||
}
|
||||
}
|
||||
// Get custom height
|
||||
adt_MCVT *v = cell->getMCVT();
|
||||
adt_MCVT* v = cell->getMCVT();
|
||||
if (!v)
|
||||
continue;
|
||||
// get V9 height map
|
||||
for (int y=0; y <= ADT_CELL_SIZE; y++)
|
||||
for (int y = 0; y <= ADT_CELL_SIZE; y++)
|
||||
{
|
||||
int cy = i*ADT_CELL_SIZE + y;
|
||||
for (int x=0; x <= ADT_CELL_SIZE; x++)
|
||||
int cy = i * ADT_CELL_SIZE + y;
|
||||
for (int x = 0; x <= ADT_CELL_SIZE; x++)
|
||||
{
|
||||
int cx = j*ADT_CELL_SIZE + x;
|
||||
V9[cy][cx]+=v->height_map[y*(ADT_CELL_SIZE*2+1)+x];
|
||||
int cx = j * ADT_CELL_SIZE + x;
|
||||
V9[cy][cx] += v->height_map[y * (ADT_CELL_SIZE * 2 + 1) + x];
|
||||
}
|
||||
}
|
||||
// get V8 height map
|
||||
for (int y=0; y < ADT_CELL_SIZE; y++)
|
||||
for (int y = 0; y < ADT_CELL_SIZE; y++)
|
||||
{
|
||||
int cy = i*ADT_CELL_SIZE + y;
|
||||
for (int x=0; x < ADT_CELL_SIZE; x++)
|
||||
int cy = i * ADT_CELL_SIZE + y;
|
||||
for (int x = 0; x < ADT_CELL_SIZE; x++)
|
||||
{
|
||||
int cx = j*ADT_CELL_SIZE + x;
|
||||
V8[cy][cx]+=v->height_map[y*(ADT_CELL_SIZE*2+1)+ADT_CELL_SIZE+1+x];
|
||||
int cx = j * ADT_CELL_SIZE + x;
|
||||
V8[cy][cx] += v->height_map[y * (ADT_CELL_SIZE * 2 + 1) + ADT_CELL_SIZE + 1 + x];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -627,18 +632,18 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32
|
|||
//============================================
|
||||
float maxHeight = -20000;
|
||||
float minHeight = 20000;
|
||||
for (int y=0; y<ADT_GRID_SIZE; y++)
|
||||
for (int y = 0; y < ADT_GRID_SIZE; y++)
|
||||
{
|
||||
for(int x=0;x<ADT_GRID_SIZE;x++)
|
||||
for (int x = 0; x < ADT_GRID_SIZE; x++)
|
||||
{
|
||||
float h = V8[y][x];
|
||||
if (maxHeight < h) maxHeight = h;
|
||||
if (minHeight > h) minHeight = h;
|
||||
}
|
||||
}
|
||||
for (int y=0; y<=ADT_GRID_SIZE; y++)
|
||||
for (int y = 0; y <= ADT_GRID_SIZE; y++)
|
||||
{
|
||||
for(int x=0;x<=ADT_GRID_SIZE;x++)
|
||||
for (int x = 0; x <= ADT_GRID_SIZE; x++)
|
||||
{
|
||||
float h = V9[y][x];
|
||||
if (maxHeight < h) maxHeight = h;
|
||||
|
|
@ -649,12 +654,12 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32
|
|||
// Check for allow limit minimum height (not store height in deep ochean - allow save some memory)
|
||||
if (CONF_allow_height_limit && minHeight < CONF_use_minHeight)
|
||||
{
|
||||
for (int y=0; y<ADT_GRID_SIZE; y++)
|
||||
for(int x=0;x<ADT_GRID_SIZE;x++)
|
||||
for (int y = 0; y < ADT_GRID_SIZE; y++)
|
||||
for (int x = 0; x < ADT_GRID_SIZE; x++)
|
||||
if (V8[y][x] < CONF_use_minHeight)
|
||||
V8[y][x] = CONF_use_minHeight;
|
||||
for (int y=0; y<=ADT_GRID_SIZE; y++)
|
||||
for(int x=0;x<=ADT_GRID_SIZE;x++)
|
||||
for (int y = 0; y <= ADT_GRID_SIZE; y++)
|
||||
for (int x = 0; x <= ADT_GRID_SIZE; x++)
|
||||
if (V9[y][x] < CONF_use_minHeight)
|
||||
V9[y][x] = CONF_use_minHeight;
|
||||
if (minHeight < CONF_use_minHeight)
|
||||
|
|
@ -689,100 +694,162 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32
|
|||
float diff = maxHeight - minHeight;
|
||||
if (diff < CONF_float_to_int8_limit) // As uint8 (max accuracy = CONF_float_to_int8_limit/256)
|
||||
{
|
||||
heightHeader.flags|=MAP_HEIGHT_AS_INT8;
|
||||
heightHeader.flags |= MAP_HEIGHT_AS_INT8;
|
||||
step = selectUInt8StepStore(diff);
|
||||
}
|
||||
else if (diff<CONF_float_to_int16_limit) // As uint16 (max accuracy = CONF_float_to_int16_limit/65536)
|
||||
else if (diff < CONF_float_to_int16_limit) // As uint16 (max accuracy = CONF_float_to_int16_limit/65536)
|
||||
{
|
||||
heightHeader.flags|=MAP_HEIGHT_AS_INT16;
|
||||
heightHeader.flags |= MAP_HEIGHT_AS_INT16;
|
||||
step = selectUInt16StepStore(diff);
|
||||
}
|
||||
}
|
||||
|
||||
// Pack it to int values if need
|
||||
if (heightHeader.flags&MAP_HEIGHT_AS_INT8)
|
||||
if (heightHeader.flags & MAP_HEIGHT_AS_INT8)
|
||||
{
|
||||
for (int y=0; y<ADT_GRID_SIZE; y++)
|
||||
for(int x=0;x<ADT_GRID_SIZE;x++)
|
||||
for (int y = 0; y < ADT_GRID_SIZE; y++)
|
||||
for (int x = 0; x < ADT_GRID_SIZE; x++)
|
||||
uint8_V8[y][x] = uint8((V8[y][x] - minHeight) * step + 0.5f);
|
||||
for (int y=0; y<=ADT_GRID_SIZE; y++)
|
||||
for(int x=0;x<=ADT_GRID_SIZE;x++)
|
||||
for (int y = 0; y <= ADT_GRID_SIZE; y++)
|
||||
for (int x = 0; x <= ADT_GRID_SIZE; x++)
|
||||
uint8_V9[y][x] = uint8((V9[y][x] - minHeight) * step + 0.5f);
|
||||
map.heightMapSize+= sizeof(uint8_V9) + sizeof(uint8_V8);
|
||||
map.heightMapSize += sizeof(uint8_V9) + sizeof(uint8_V8);
|
||||
}
|
||||
else if (heightHeader.flags&MAP_HEIGHT_AS_INT16)
|
||||
else if (heightHeader.flags & MAP_HEIGHT_AS_INT16)
|
||||
{
|
||||
for (int y=0; y<ADT_GRID_SIZE; y++)
|
||||
for(int x=0;x<ADT_GRID_SIZE;x++)
|
||||
for (int y = 0; y < ADT_GRID_SIZE; y++)
|
||||
for (int x = 0; x < ADT_GRID_SIZE; x++)
|
||||
uint16_V8[y][x] = uint16((V8[y][x] - minHeight) * step + 0.5f);
|
||||
for (int y=0; y<=ADT_GRID_SIZE; y++)
|
||||
for(int x=0;x<=ADT_GRID_SIZE;x++)
|
||||
for (int y = 0; y <= ADT_GRID_SIZE; y++)
|
||||
for (int x = 0; x <= ADT_GRID_SIZE; x++)
|
||||
uint16_V9[y][x] = uint16((V9[y][x] - minHeight) * step + 0.5f);
|
||||
map.heightMapSize+= sizeof(uint16_V9) + sizeof(uint16_V8);
|
||||
map.heightMapSize += sizeof(uint16_V9) + sizeof(uint16_V8);
|
||||
}
|
||||
else
|
||||
map.heightMapSize+= sizeof(V9) + sizeof(V8);
|
||||
map.heightMapSize += sizeof(V9) + sizeof(V8);
|
||||
}
|
||||
|
||||
// Get from MCLQ chunk (old)
|
||||
for (int i = 0; i < ADT_CELLS_PER_GRID; i++)
|
||||
{
|
||||
for (int j = 0; j < ADT_CELLS_PER_GRID; j++)
|
||||
{
|
||||
adt_MCNK* cell = adt.cells[i][j];
|
||||
if (!cell)
|
||||
continue;
|
||||
|
||||
adt_MCLQ* liquid = cell->getMCLQ();
|
||||
int count = 0;
|
||||
if (!liquid || cell->sizeMCLQ <= 8)
|
||||
continue;
|
||||
|
||||
for (int y = 0; y < ADT_CELL_SIZE; y++)
|
||||
{
|
||||
int cy = i * ADT_CELL_SIZE + y;
|
||||
for (int x = 0; x < ADT_CELL_SIZE; x++)
|
||||
{
|
||||
int cx = j * ADT_CELL_SIZE + x;
|
||||
if (liquid->flags[y][x] != 0x0F)
|
||||
{
|
||||
liquid_show[cy][cx] = true;
|
||||
if (liquid->flags[y][x] & (1 << 7))
|
||||
liquid_flags[i][j] |= MAP_LIQUID_TYPE_DARK_WATER;
|
||||
++count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32 c_flag = cell->flags;
|
||||
if (c_flag & (1 << 2))
|
||||
{
|
||||
liquid_entry[i][j] = 1;
|
||||
liquid_flags[i][j] |= MAP_LIQUID_TYPE_WATER; // water
|
||||
}
|
||||
if (c_flag & (1 << 3))
|
||||
{
|
||||
liquid_entry[i][j] = 2;
|
||||
liquid_flags[i][j] |= MAP_LIQUID_TYPE_OCEAN; // ocean
|
||||
}
|
||||
if (c_flag & (1 << 4))
|
||||
{
|
||||
liquid_entry[i][j] = 3;
|
||||
liquid_flags[i][j] |= MAP_LIQUID_TYPE_MAGMA; // magma/slime
|
||||
}
|
||||
|
||||
if (!count && liquid_flags[i][j])
|
||||
fprintf(stderr, "Wrong liquid detect in MCLQ chunk");
|
||||
|
||||
for (int y = 0; y <= ADT_CELL_SIZE; y++)
|
||||
{
|
||||
int cy = i * ADT_CELL_SIZE + y;
|
||||
for (int x = 0; x <= ADT_CELL_SIZE; x++)
|
||||
{
|
||||
int cx = j * ADT_CELL_SIZE + x;
|
||||
liquid_height[cy][cx] = liquid->liquid[y][x].height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get liquid map for grid (in WOTLK used MH2O chunk)
|
||||
adt_MH2O * h2o = adt.a_grid->getMH2O();
|
||||
adt_MH2O* h2o = adt.a_grid->getMH2O();
|
||||
if (h2o)
|
||||
{
|
||||
for (int i=0;i<ADT_CELLS_PER_GRID;i++)
|
||||
for (int i = 0; i < ADT_CELLS_PER_GRID; i++)
|
||||
{
|
||||
for(int j=0;j<ADT_CELLS_PER_GRID;j++)
|
||||
for (int j = 0; j < ADT_CELLS_PER_GRID; j++)
|
||||
{
|
||||
adt_liquid_header *h = h2o->getLiquidData(i,j);
|
||||
adt_liquid_header* h = h2o->getLiquidData(i, j);
|
||||
if (!h)
|
||||
continue;
|
||||
|
||||
int count = 0;
|
||||
uint64 show = h2o->getLiquidShowMap(h);
|
||||
for (int y=0; y < h->height;y++)
|
||||
for (int y = 0; y < h->height; y++)
|
||||
{
|
||||
int cy = i*ADT_CELL_SIZE + y + h->yOffset;
|
||||
for (int x=0; x < h->width; x++)
|
||||
int cy = i * ADT_CELL_SIZE + y + h->yOffset;
|
||||
for (int x = 0; x < h->width; x++)
|
||||
{
|
||||
int cx = j*ADT_CELL_SIZE + x + h->xOffset;
|
||||
int cx = j * ADT_CELL_SIZE + x + h->xOffset;
|
||||
if (show & 1)
|
||||
{
|
||||
liquid_show[cy][cx] = true;
|
||||
++count;
|
||||
}
|
||||
show>>=1;
|
||||
show >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 type = LiqType[h->liquidType];
|
||||
switch (type)
|
||||
liquid_entry[i][j] = h->liquidType;
|
||||
switch (LiqType[h->liquidType])
|
||||
{
|
||||
case LIQUID_TYPE_WATER: liquid_type[i][j] |= MAP_LIQUID_TYPE_WATER; break;
|
||||
case LIQUID_TYPE_OCEAN: liquid_type[i][j] |= MAP_LIQUID_TYPE_OCEAN; break;
|
||||
case LIQUID_TYPE_MAGMA: liquid_type[i][j] |= MAP_LIQUID_TYPE_MAGMA; break;
|
||||
case LIQUID_TYPE_SLIME: liquid_type[i][j] |= MAP_LIQUID_TYPE_SLIME; break;
|
||||
case LIQUID_TYPE_WATER: liquid_flags[i][j] |= MAP_LIQUID_TYPE_WATER; break;
|
||||
case LIQUID_TYPE_OCEAN: liquid_flags[i][j] |= MAP_LIQUID_TYPE_OCEAN; break;
|
||||
case LIQUID_TYPE_MAGMA: liquid_flags[i][j] |= MAP_LIQUID_TYPE_MAGMA; break;
|
||||
case LIQUID_TYPE_SLIME: liquid_flags[i][j] |= MAP_LIQUID_TYPE_SLIME; break;
|
||||
default:
|
||||
printf("\nCan't find Liquid type %u for map %s\nchunk %d,%d\n", h->liquidType, filename, i, j);
|
||||
break;
|
||||
}
|
||||
// Dark water detect
|
||||
if (type == LIQUID_TYPE_OCEAN)
|
||||
if (LiqType[h->liquidType] == LIQUID_TYPE_OCEAN)
|
||||
{
|
||||
uint8 *lm = h2o->getLiquidLightMap(h);
|
||||
uint8* lm = h2o->getLiquidLightMap(h);
|
||||
if (!lm)
|
||||
liquid_type[i][j]|=MAP_LIQUID_TYPE_DARK_WATER;
|
||||
liquid_flags[i][j] |= MAP_LIQUID_TYPE_DARK_WATER;
|
||||
}
|
||||
|
||||
if (!count && liquid_type[i][j])
|
||||
if (!count && liquid_flags[i][j])
|
||||
printf("Wrong liquid detect in MH2O chunk");
|
||||
|
||||
float *height = h2o->getLiquidHeightMap(h);
|
||||
float* height = h2o->getLiquidHeightMap(h);
|
||||
int pos = 0;
|
||||
for (int y=0; y<=h->height;y++)
|
||||
for (int y = 0; y <= h->height; y++)
|
||||
{
|
||||
int cy = i*ADT_CELL_SIZE + y + h->yOffset;
|
||||
for (int x=0; x<= h->width; x++)
|
||||
int cy = i * ADT_CELL_SIZE + y + h->yOffset;
|
||||
for (int x = 0; x <= h->width; x++)
|
||||
{
|
||||
int cx = j*ADT_CELL_SIZE + x + h->xOffset;
|
||||
int cx = j * ADT_CELL_SIZE + x + h->xOffset;
|
||||
if (height)
|
||||
liquid_height[cy][cx] = height[pos];
|
||||
else
|
||||
|
|
@ -793,72 +860,16 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get from MCLQ chunk (old)
|
||||
for (int i=0;i<ADT_CELLS_PER_GRID;i++)
|
||||
{
|
||||
for(int j=0;j<ADT_CELLS_PER_GRID;j++)
|
||||
{
|
||||
adt_MCNK *cell = adt.cells[i][j];
|
||||
if (!cell)
|
||||
continue;
|
||||
|
||||
adt_MCLQ *liquid = cell->getMCLQ();
|
||||
int count = 0;
|
||||
if (!liquid || cell->sizeMCLQ <= 8)
|
||||
continue;
|
||||
|
||||
for (int y=0; y < ADT_CELL_SIZE; y++)
|
||||
{
|
||||
int cy = i*ADT_CELL_SIZE + y;
|
||||
for (int x=0; x < ADT_CELL_SIZE; x++)
|
||||
{
|
||||
int cx = j*ADT_CELL_SIZE + x;
|
||||
if (liquid->flags[y][x] != 0x0F)
|
||||
{
|
||||
liquid_show[cy][cx] = true;
|
||||
if (liquid->flags[y][x]&(1<<7))
|
||||
liquid_type[i][j]|=MAP_LIQUID_TYPE_DARK_WATER;
|
||||
++count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint32 c_flag = cell->flags;
|
||||
if(c_flag & (1<<2))
|
||||
liquid_type[i][j]|=MAP_LIQUID_TYPE_WATER; // water
|
||||
if(c_flag & (1<<3))
|
||||
liquid_type[i][j]|=MAP_LIQUID_TYPE_OCEAN; // ochean
|
||||
if(c_flag & (1<<4))
|
||||
liquid_type[i][j]|=MAP_LIQUID_TYPE_MAGMA; // magma/slime
|
||||
|
||||
if (!count && liquid_type[i][j])
|
||||
printf("Wrong liquid detect in MCLQ chunk");
|
||||
|
||||
for (int y=0; y <= ADT_CELL_SIZE; y++)
|
||||
{
|
||||
int cy = i*ADT_CELL_SIZE + y;
|
||||
for (int x=0; x<= ADT_CELL_SIZE; x++)
|
||||
{
|
||||
int cx = j*ADT_CELL_SIZE + x;
|
||||
liquid_height[cy][cx] = liquid->liquid[y][x].height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//============================================
|
||||
// Pack liquid data
|
||||
//============================================
|
||||
uint8 type = liquid_type[0][0];
|
||||
uint8 type = liquid_flags[0][0];
|
||||
bool fullType = false;
|
||||
for (int y=0;y<ADT_CELLS_PER_GRID;y++)
|
||||
for (int y = 0; y < ADT_CELLS_PER_GRID; y++)
|
||||
{
|
||||
for(int x=0;x<ADT_CELLS_PER_GRID;x++)
|
||||
for (int x = 0; x < ADT_CELLS_PER_GRID; x++)
|
||||
{
|
||||
if (liquid_type[y][x]!=type)
|
||||
if (liquid_flags[y][x] != type)
|
||||
{
|
||||
fullType = true;
|
||||
y = ADT_CELLS_PER_GRID;
|
||||
|
|
@ -882,9 +893,9 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32
|
|||
int maxX = 0, maxY = 0;
|
||||
maxHeight = -20000;
|
||||
minHeight = 20000;
|
||||
for (int y=0; y<ADT_GRID_SIZE; y++)
|
||||
for (int y = 0; y < ADT_GRID_SIZE; y++)
|
||||
{
|
||||
for(int x=0; x<ADT_GRID_SIZE; x++)
|
||||
for (int x = 0; x < ADT_GRID_SIZE; x++)
|
||||
{
|
||||
if (liquid_show[y][x])
|
||||
{
|
||||
|
|
@ -924,16 +935,16 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32
|
|||
if (liquidHeader.flags & MAP_LIQUID_NO_TYPE)
|
||||
liquidHeader.liquidType = type;
|
||||
else
|
||||
map.liquidMapSize+=sizeof(liquid_type);
|
||||
map.liquidMapSize += sizeof(liquid_entry) + sizeof(liquid_flags);
|
||||
|
||||
if (!(liquidHeader.flags & MAP_LIQUID_NO_HEIGHT))
|
||||
map.liquidMapSize += sizeof(float)*liquidHeader.width*liquidHeader.height;
|
||||
map.liquidMapSize += sizeof(float) * liquidHeader.width * liquidHeader.height;
|
||||
}
|
||||
|
||||
// map hole info
|
||||
uint16 holes[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
|
||||
|
||||
if(map.liquidMapOffset)
|
||||
if (map.liquidMapOffset)
|
||||
map.holesOffset = map.liquidMapOffset + map.liquidMapSize;
|
||||
else
|
||||
map.holesOffset = map.heightMapOffset + map.heightMapSize;
|
||||
|
|
@ -941,20 +952,20 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32
|
|||
map.holesSize = sizeof(holes);
|
||||
memset(holes, 0, map.holesSize);
|
||||
|
||||
for(int i = 0; i < ADT_CELLS_PER_GRID; ++i)
|
||||
for (int i = 0; i < ADT_CELLS_PER_GRID; ++i)
|
||||
{
|
||||
for(int j = 0; j < ADT_CELLS_PER_GRID; ++j)
|
||||
for (int j = 0; j < ADT_CELLS_PER_GRID; ++j)
|
||||
{
|
||||
adt_MCNK * cell = adt.cells[i][j];
|
||||
if(!cell)
|
||||
adt_MCNK* cell = adt.cells[i][j];
|
||||
if (!cell)
|
||||
continue;
|
||||
holes[i][j] = cell->holes;
|
||||
}
|
||||
}
|
||||
|
||||
// Ok all data prepared - store it
|
||||
FILE *output=fopen(filename2, "wb");
|
||||
if(!output)
|
||||
FILE* output = fopen(filename2, "wb");
|
||||
if (!output)
|
||||
{
|
||||
printf("Can't create the output file '%s'\n", filename2);
|
||||
return false;
|
||||
|
|
@ -962,7 +973,7 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32
|
|||
fwrite(&map, sizeof(map), 1, output);
|
||||
// Store area data
|
||||
fwrite(&areaHeader, sizeof(areaHeader), 1, output);
|
||||
if (!(areaHeader.flags&MAP_AREA_NO_AREA))
|
||||
if (!(areaHeader.flags & MAP_AREA_NO_AREA))
|
||||
fwrite(area_flags, sizeof(area_flags), 1, output);
|
||||
|
||||
// Store height data
|
||||
|
|
@ -990,12 +1001,15 @@ bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32
|
|||
if (map.liquidMapOffset)
|
||||
{
|
||||
fwrite(&liquidHeader, sizeof(liquidHeader), 1, output);
|
||||
if (!(liquidHeader.flags&MAP_LIQUID_NO_TYPE))
|
||||
fwrite(liquid_type, sizeof(liquid_type), 1, output);
|
||||
if (!(liquidHeader.flags&MAP_LIQUID_NO_HEIGHT))
|
||||
if (!(liquidHeader.flags & MAP_LIQUID_NO_TYPE))
|
||||
{
|
||||
for (int y=0; y<liquidHeader.height;y++)
|
||||
fwrite(&liquid_height[y+liquidHeader.offsetY][liquidHeader.offsetX], sizeof(float), liquidHeader.width, output);
|
||||
fwrite(liquid_entry, sizeof(liquid_entry), 1, output);
|
||||
fwrite(liquid_flags, sizeof(liquid_flags), 1, output);
|
||||
}
|
||||
if (!(liquidHeader.flags & MAP_LIQUID_NO_HEIGHT))
|
||||
{
|
||||
for (int y = 0; y < liquidHeader.height; y++)
|
||||
fwrite(&liquid_height[y + liquidHeader.offsetY][liquidHeader.offsetX], sizeof(float), liquidHeader.width, output);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1025,18 +1039,18 @@ void ExtractMapsFromMpq(uint32 build, const int locale)
|
|||
CreateDir(path);
|
||||
|
||||
printf("Convert map files\n");
|
||||
for(uint32 z = 0; z < map_count; ++z)
|
||||
for (uint32 z = 0; z < map_count; ++z)
|
||||
{
|
||||
printf("Extract %s (%d/%d) \n", map_ids[z].name, z+1, map_count);
|
||||
printf("Extract %s (%d/%d) \n", map_ids[z].name, z + 1, map_count);
|
||||
// Loadup map grid data
|
||||
sprintf(mpq_map_name, "World\\Maps\\%s\\%s.wdt", map_ids[z].name, map_ids[z].name);
|
||||
WDT_file wdt;
|
||||
if (!wdt.loadFile(mpq_map_name, false))
|
||||
continue;
|
||||
|
||||
for(uint32 y = 0; y < WDT_MAP_SIZE; ++y)
|
||||
for (uint32 y = 0; y < WDT_MAP_SIZE; ++y)
|
||||
{
|
||||
for(uint32 x = 0; x < WDT_MAP_SIZE; ++x)
|
||||
for (uint32 x = 0; x < WDT_MAP_SIZE; ++x)
|
||||
{
|
||||
if (!wdt.main->adt_list[y][x].exist)
|
||||
continue;
|
||||
|
|
@ -1046,7 +1060,7 @@ void ExtractMapsFromMpq(uint32 build, const int locale)
|
|||
ConvertADT(mpq_filename, output_filename, y, x, build);
|
||||
}
|
||||
// draw progress bar
|
||||
printf("Processing........................%d%%\r", (100 * (y+1)) / WDT_MAP_SIZE);
|
||||
printf("Processing........................%d%%\r", (100 * (y + 1)) / WDT_MAP_SIZE);
|
||||
}
|
||||
}
|
||||
delete [] areas;
|
||||
|
|
@ -1061,7 +1075,7 @@ void ExtractDBCFiles(int locale, bool basicLocale)
|
|||
|
||||
// get DBC file list
|
||||
ArchiveSetBounds archives = GetArchivesBounds();
|
||||
for(ArchiveSet::const_iterator i = archives.first; i != archives.second;++i)
|
||||
for (ArchiveSet::const_iterator i = archives.first; i != archives.second; ++i)
|
||||
{
|
||||
AppendDBCFileListTo(*i, dbcfiles);
|
||||
AppendDB2FileListTo(*i, dbcfiles);
|
||||
|
|
@ -1098,30 +1112,30 @@ void ExtractDBCFiles(int locale, bool basicLocale)
|
|||
printf("Extracted %u DBC/DB2 files\n\n", count);
|
||||
}
|
||||
|
||||
typedef std::pair<std::string /*full_filename*/, char const* /*locale_prefix*/> UpdatesPair;
|
||||
typedef std::map<int /*build*/, UpdatesPair> Updates;
|
||||
typedef std::pair < std::string /*full_filename*/, char const* /*locale_prefix*/ > UpdatesPair;
|
||||
typedef std::map < int /*build*/, UpdatesPair > Updates;
|
||||
|
||||
void AppendPatchMPQFilesToList(char const* subdir, char const* suffix, char const* section, Updates& updates)
|
||||
{
|
||||
char dirname[512];
|
||||
if (subdir)
|
||||
sprintf(dirname,"%s/Data/%s", input_path, subdir);
|
||||
sprintf(dirname, "%s/Data/%s", input_path, subdir);
|
||||
else
|
||||
sprintf(dirname,"%s/Data", input_path);
|
||||
sprintf(dirname, "%s/Data", input_path);
|
||||
|
||||
char scanname[512];
|
||||
if (suffix)
|
||||
sprintf(scanname,"wow-update-%s-%%u.MPQ", suffix);
|
||||
sprintf(scanname, "wow-update-%s-%%u.MPQ", suffix);
|
||||
else
|
||||
sprintf(scanname,"wow-update-%%u.MPQ");
|
||||
sprintf(scanname, "wow-update-%%u.MPQ");
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
char maskname[512];
|
||||
if (suffix)
|
||||
sprintf(maskname,"%s/wow-update-%s-*.MPQ", dirname, suffix);
|
||||
sprintf(maskname, "%s/wow-update-%s-*.MPQ", dirname, suffix);
|
||||
else
|
||||
sprintf(maskname,"%s/wow-update-*.MPQ", dirname);
|
||||
sprintf(maskname, "%s/wow-update-*.MPQ", dirname);
|
||||
|
||||
WIN32_FIND_DATA ffd;
|
||||
HANDLE hFind = FindFirstFile(maskname, &ffd);
|
||||
|
|
@ -1144,10 +1158,10 @@ void AppendPatchMPQFilesToList(char const* subdir, char const* suffix, char cons
|
|||
|
||||
#else
|
||||
|
||||
if (DIR *dp = opendir(dirname))
|
||||
if (DIR* dp = opendir(dirname))
|
||||
{
|
||||
int ubuild = 0;
|
||||
dirent *dirp;
|
||||
dirent* dirp;
|
||||
while ((dirp = readdir(dp)) != NULL)
|
||||
if (sscanf(dirp->d_name, scanname, &ubuild) == 1 && (!CONF_max_build || ubuild <= CONF_max_build))
|
||||
updates[ubuild] = UpdatesPair(dirp->d_name, section);
|
||||
|
|
@ -1163,7 +1177,7 @@ void LoadLocaleMPQFiles(int const locale)
|
|||
char filename[512];
|
||||
|
||||
// first base old version of dbc files
|
||||
sprintf(filename,"%s/Data/%s/locale-%s.MPQ", input_path, langs[locale], langs[locale]);
|
||||
sprintf(filename, "%s/Data/%s/locale-%s.MPQ", input_path, langs[locale], langs[locale]);
|
||||
|
||||
HANDLE localeMpqHandle;
|
||||
|
||||
|
|
@ -1183,9 +1197,9 @@ void LoadLocaleMPQFiles(int const locale)
|
|||
for (Updates::const_iterator itr = updates.begin(); itr != updates.end(); ++itr)
|
||||
{
|
||||
if (!itr->second.second)
|
||||
sprintf(filename,"%s/Data/%s/%s", input_path, langs[locale], itr->second.first.c_str());
|
||||
sprintf(filename, "%s/Data/%s/%s", input_path, langs[locale], itr->second.first.c_str());
|
||||
else
|
||||
sprintf(filename,"%s/Data/%s", input_path, itr->second.first.c_str());
|
||||
sprintf(filename, "%s/Data/%s", input_path, itr->second.first.c_str());
|
||||
|
||||
//if (!OpenArchive(filename))
|
||||
if (!SFileOpenPatchArchive(localeMpqHandle, filename, itr->second.second ? itr->second.second : "", 0))
|
||||
|
|
@ -1232,7 +1246,7 @@ void LoadBaseMPQFiles()
|
|||
|
||||
for (Updates::const_iterator itr = updates.begin(); itr != updates.end(); ++itr)
|
||||
{
|
||||
sprintf(filename,"%s/Data/%s", input_path, itr->second.first.c_str());
|
||||
sprintf(filename, "%s/Data/%s", input_path, itr->second.first.c_str());
|
||||
|
||||
printf("%s\n", filename);
|
||||
|
||||
|
|
@ -1244,7 +1258,7 @@ void LoadBaseMPQFiles()
|
|||
}
|
||||
}
|
||||
|
||||
int main(int argc, char * arg[])
|
||||
int main(int argc, char* arg[])
|
||||
{
|
||||
printf("Map & DBC Extractor\n");
|
||||
printf("===================\n\n");
|
||||
|
|
@ -1265,7 +1279,7 @@ int main(int argc, char * arg[])
|
|||
//Open MPQs
|
||||
LoadLocaleMPQFiles(i);
|
||||
|
||||
if((CONF_extract & EXTRACT_DBC) == 0)
|
||||
if ((CONF_extract & EXTRACT_DBC) == 0)
|
||||
{
|
||||
FirstLocale = i;
|
||||
build = ReadBuild(FirstLocale);
|
||||
|
|
@ -1274,7 +1288,7 @@ int main(int argc, char * arg[])
|
|||
}
|
||||
|
||||
//Extract DBC files
|
||||
if(FirstLocale < 0)
|
||||
if (FirstLocale < 0)
|
||||
{
|
||||
FirstLocale = i;
|
||||
build = ReadBuild(FirstLocale);
|
||||
|
|
@ -1289,7 +1303,7 @@ int main(int argc, char * arg[])
|
|||
}
|
||||
}
|
||||
|
||||
if(FirstLocale < 0)
|
||||
if (FirstLocale < 0)
|
||||
{
|
||||
printf("No locales detected\n");
|
||||
return 0;
|
||||
|
|
|
|||
165
contrib/extractor/VC110_ad.vcxproj
Normal file
165
contrib/extractor/VC110_ad.vcxproj
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>ad</ProjectName>
|
||||
<ProjectGuid>{D7552D4F-408F-4F8E-859B-366659150CF4}</ProjectGuid>
|
||||
<RootNamespace>ad</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\debug\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\release\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ad_debug</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>./ad.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\dep\StormLib\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)ad.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
|
||||
<XMLDocumentationFileName>$(IntDir)</XMLDocumentationFileName>
|
||||
<BrowseInformation>true</BrowseInformation>
|
||||
<BrowseInformationFile>$(IntDir)</BrowseInformationFile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0419</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>StormLibDAS.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\dep\StormLib\bin\StormLib\$(Platform)\$(Configuration)AS;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<OutputFile>ad_debug.exe</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>./ad_debug.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>./ad.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Full</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\..\dep\StormLib\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)ad.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
|
||||
<ObjectFileName>$(IntDir)</ObjectFileName>
|
||||
<ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
|
||||
<XMLDocumentationFileName>$(IntDir)</XMLDocumentationFileName>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0419</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>StormLibRAS.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>..\..\dep\StormLib\bin\StormLib\$(Platform)\$(Configuration)AS;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<OutputFile>./ad.exe</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<ProgramDatabaseFile>./ad.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="loadlib\adt.cpp" />
|
||||
<ClCompile Include="dbcfile.cpp" />
|
||||
<ClCompile Include="loadlib\loadlib.cpp" />
|
||||
<ClCompile Include="system.cpp" />
|
||||
<ClCompile Include="loadlib\wdt.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="loadlib\adt.h" />
|
||||
<ClInclude Include="dbcfile.h" />
|
||||
<ClInclude Include="loadlib\loadlib.h" />
|
||||
<ClInclude Include="loadlib\wdt.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
44
contrib/extractor/VC110_ad.vcxproj.filters
Normal file
44
contrib/extractor/VC110_ad.vcxproj.filters
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{7748a821-40c1-4432-a07e-ff4da1273091}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{bd48cc48-7a79-4088-9e3f-8bf123692891}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="loadlib\adt.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="dbcfile.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="loadlib\loadlib.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="system.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="loadlib\wdt.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="loadlib\adt.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="dbcfile.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="loadlib\loadlib.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="loadlib\wdt.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -21,11 +21,10 @@
|
|||
#include "dbcfile.h"
|
||||
#include "loadlib/loadlib.h"
|
||||
|
||||
DBCFile::DBCFile(const std::string &filename):
|
||||
DBCFile::DBCFile(const std::string& filename):
|
||||
filename(filename),
|
||||
data(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
DBCFile::DBCFile(HANDLE file) : fileHandle(file), data(0)
|
||||
|
|
@ -39,7 +38,7 @@ bool DBCFile::open()
|
|||
// return false;
|
||||
|
||||
char header[4];
|
||||
unsigned int na,nb,es,ss;
|
||||
unsigned int na, nb, es, ss;
|
||||
|
||||
if (!SFileReadFile(fileHandle, header, 4, NULL, NULL)) // Magic header
|
||||
{
|
||||
|
|
@ -47,7 +46,7 @@ bool DBCFile::open()
|
|||
return false;
|
||||
}
|
||||
|
||||
if (header[0]!='W' || header[1]!='D' || header[2]!='B' || header[3]!='C')
|
||||
if (header[0] != 'W' || header[1] != 'D' || header[2] != 'B' || header[3] != 'C')
|
||||
{
|
||||
SFileCloseFile(fileHandle);
|
||||
return false;
|
||||
|
|
@ -87,10 +86,10 @@ bool DBCFile::open()
|
|||
return false;
|
||||
}
|
||||
|
||||
data = new unsigned char[recordSize*recordCount+stringSize];
|
||||
stringTable = data + recordSize*recordCount;
|
||||
data = new unsigned char[recordSize * recordCount + stringSize];
|
||||
stringTable = data + recordSize * recordCount;
|
||||
|
||||
size_t data_size = recordSize*recordCount+stringSize;
|
||||
size_t data_size = recordSize * recordCount + stringSize;
|
||||
|
||||
if (!SFileReadFile(fileHandle, data, data_size, NULL, NULL))
|
||||
{
|
||||
|
|
@ -109,7 +108,7 @@ DBCFile::~DBCFile()
|
|||
DBCFile::Record DBCFile::getRecord(size_t id)
|
||||
{
|
||||
assert(data);
|
||||
return Record(*this, data + id*recordSize);
|
||||
return Record(*this, data + id * recordSize);
|
||||
}
|
||||
|
||||
size_t DBCFile::getMaxId()
|
||||
|
|
@ -117,9 +116,9 @@ size_t DBCFile::getMaxId()
|
|||
assert(data);
|
||||
|
||||
size_t maxId = 0;
|
||||
for(size_t i = 0; i < getRecordCount(); ++i)
|
||||
for (size_t i = 0; i < getRecordCount(); ++i)
|
||||
{
|
||||
if(maxId < getRecord(i).getUInt(0))
|
||||
if (maxId < getRecord(i).getUInt(0))
|
||||
maxId = getRecord(i).getUInt(0);
|
||||
}
|
||||
return maxId;
|
||||
|
|
|
|||
|
|
@ -29,116 +29,118 @@
|
|||
|
||||
class DBCFile
|
||||
{
|
||||
public:
|
||||
DBCFile(const std::string &filename);
|
||||
DBCFile(HANDLE file);
|
||||
~DBCFile();
|
||||
|
||||
// Open database. It must be openened before it can be used.
|
||||
bool open();
|
||||
|
||||
// Database exceptions
|
||||
class Exception
|
||||
{
|
||||
public:
|
||||
Exception(const std::string &message): message(message)
|
||||
{ }
|
||||
virtual ~Exception()
|
||||
{ }
|
||||
const std::string &getMessage() {return message;}
|
||||
DBCFile(const std::string& filename);
|
||||
DBCFile(HANDLE file);
|
||||
~DBCFile();
|
||||
|
||||
// Open database. It must be openened before it can be used.
|
||||
bool open();
|
||||
|
||||
// Database exceptions
|
||||
class Exception
|
||||
{
|
||||
public:
|
||||
Exception(const std::string& message): message(message)
|
||||
{ }
|
||||
virtual ~Exception()
|
||||
{ }
|
||||
const std::string& getMessage() {return message;}
|
||||
private:
|
||||
std::string message;
|
||||
};
|
||||
class NotFound: public Exception
|
||||
{
|
||||
public:
|
||||
NotFound(): Exception("Key was not found")
|
||||
{ }
|
||||
};
|
||||
// Iteration over database
|
||||
class Iterator;
|
||||
class Record
|
||||
{
|
||||
public:
|
||||
float getFloat(size_t field) const
|
||||
{
|
||||
assert(field < file.fieldCount);
|
||||
return *reinterpret_cast<float*>(offset + field * 4);
|
||||
}
|
||||
unsigned int getUInt(size_t field) const
|
||||
{
|
||||
assert(field < file.fieldCount);
|
||||
return *reinterpret_cast<unsigned int*>(offset + field * 4);
|
||||
}
|
||||
int getInt(size_t field) const
|
||||
{
|
||||
assert(field < file.fieldCount);
|
||||
return *reinterpret_cast<int*>(offset + field * 4);
|
||||
}
|
||||
const char* getString(size_t field) const
|
||||
{
|
||||
assert(field < file.fieldCount);
|
||||
size_t stringOffset = getUInt(field);
|
||||
assert(stringOffset < file.stringSize);
|
||||
return reinterpret_cast<char*>(file.stringTable + stringOffset);
|
||||
}
|
||||
private:
|
||||
Record(DBCFile& file, unsigned char* offset): file(file), offset(offset) {}
|
||||
unsigned char* offset;
|
||||
DBCFile& file;
|
||||
|
||||
friend class DBCFile;
|
||||
friend class DBCFile::Iterator;
|
||||
};
|
||||
/** Iterator that iterates over records
|
||||
*/
|
||||
class Iterator
|
||||
{
|
||||
public:
|
||||
Iterator(DBCFile& file, unsigned char* offset):
|
||||
record(file, offset) {}
|
||||
/// Advance (prefix only)
|
||||
Iterator& operator++()
|
||||
{
|
||||
record.offset += record.file.recordSize;
|
||||
return *this;
|
||||
}
|
||||
/// Return address of current instance
|
||||
Record const& operator*() const { return record; }
|
||||
const Record* operator->() const
|
||||
{
|
||||
return &record;
|
||||
}
|
||||
/// Comparison
|
||||
bool operator==(const Iterator& b) const
|
||||
{
|
||||
return record.offset == b.record.offset;
|
||||
}
|
||||
bool operator!=(const Iterator& b) const
|
||||
{
|
||||
return record.offset != b.record.offset;
|
||||
}
|
||||
private:
|
||||
Record record;
|
||||
};
|
||||
|
||||
// Get record by id
|
||||
Record getRecord(size_t id);
|
||||
/// Get begin iterator over records
|
||||
Iterator begin();
|
||||
/// Get begin iterator over records
|
||||
Iterator end();
|
||||
/// Trivial
|
||||
size_t getRecordCount() const { return recordCount;}
|
||||
size_t getFieldCount() const { return fieldCount; }
|
||||
size_t getMaxId();
|
||||
private:
|
||||
std::string message;
|
||||
};
|
||||
class NotFound: public Exception
|
||||
{
|
||||
public:
|
||||
NotFound(): Exception("Key was not found")
|
||||
{ }
|
||||
};
|
||||
// Iteration over database
|
||||
class Iterator;
|
||||
class Record
|
||||
{
|
||||
public:
|
||||
float getFloat(size_t field) const
|
||||
{
|
||||
assert(field < file.fieldCount);
|
||||
return *reinterpret_cast<float*>(offset+field*4);
|
||||
}
|
||||
unsigned int getUInt(size_t field) const
|
||||
{
|
||||
assert(field < file.fieldCount);
|
||||
return *reinterpret_cast<unsigned int*>(offset+field*4);
|
||||
}
|
||||
int getInt(size_t field) const
|
||||
{
|
||||
assert(field < file.fieldCount);
|
||||
return *reinterpret_cast<int*>(offset+field*4);
|
||||
}
|
||||
const char *getString(size_t field) const
|
||||
{
|
||||
assert(field < file.fieldCount);
|
||||
size_t stringOffset = getUInt(field);
|
||||
assert(stringOffset < file.stringSize);
|
||||
return reinterpret_cast<char*>(file.stringTable + stringOffset);
|
||||
}
|
||||
private:
|
||||
Record(DBCFile &file, unsigned char *offset): file(file), offset(offset) {}
|
||||
unsigned char *offset;
|
||||
DBCFile &file;
|
||||
|
||||
friend class DBCFile;
|
||||
friend class DBCFile::Iterator;
|
||||
};
|
||||
/** Iterator that iterates over records
|
||||
*/
|
||||
class Iterator
|
||||
{
|
||||
public:
|
||||
Iterator(DBCFile &file, unsigned char *offset):
|
||||
record(file, offset) {}
|
||||
/// Advance (prefix only)
|
||||
Iterator & operator++() {
|
||||
record.offset += record.file.recordSize;
|
||||
return *this;
|
||||
}
|
||||
/// Return address of current instance
|
||||
Record const & operator*() const { return record; }
|
||||
const Record* operator->() const {
|
||||
return &record;
|
||||
}
|
||||
/// Comparison
|
||||
bool operator==(const Iterator &b) const
|
||||
{
|
||||
return record.offset == b.record.offset;
|
||||
}
|
||||
bool operator!=(const Iterator &b) const
|
||||
{
|
||||
return record.offset != b.record.offset;
|
||||
}
|
||||
private:
|
||||
Record record;
|
||||
};
|
||||
|
||||
// Get record by id
|
||||
Record getRecord(size_t id);
|
||||
/// Get begin iterator over records
|
||||
Iterator begin();
|
||||
/// Get begin iterator over records
|
||||
Iterator end();
|
||||
/// Trivial
|
||||
size_t getRecordCount() const { return recordCount;}
|
||||
size_t getFieldCount() const { return fieldCount; }
|
||||
size_t getMaxId();
|
||||
private:
|
||||
std::string filename;
|
||||
HANDLE fileHandle;
|
||||
size_t recordSize;
|
||||
size_t recordCount;
|
||||
size_t fieldCount;
|
||||
size_t stringSize;
|
||||
unsigned char *data;
|
||||
unsigned char *stringTable;
|
||||
std::string filename;
|
||||
HANDLE fileHandle;
|
||||
size_t recordSize;
|
||||
size_t recordCount;
|
||||
size_t fieldCount;
|
||||
size_t stringSize;
|
||||
unsigned char* data;
|
||||
unsigned char* stringTable;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ bool isHole(int holes, int i, int j)
|
|||
{
|
||||
int testi = i / 2;
|
||||
int testj = j / 4;
|
||||
if(testi > 3) testi = 3;
|
||||
if(testj > 3) testj = 3;
|
||||
if (testi > 3) testi = 3;
|
||||
if (testj > 3) testj = 3;
|
||||
return (holes & holetab_h[testi] & holetab_v[testj]) != 0;
|
||||
}
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ bool ADT_file::prepareLoadedData()
|
|||
return false;
|
||||
|
||||
// Check and prepare MHDR
|
||||
a_grid = (adt_MHDR *)(GetData()+8+version->size);
|
||||
a_grid = (adt_MHDR*)(GetData() + 8 + version->size);
|
||||
if (!a_grid->prepareLoadedData())
|
||||
return false;
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ bool adt_MHDR::prepareLoadedData()
|
|||
if (fcc != 'MHDR')
|
||||
return false;
|
||||
|
||||
if (size!=sizeof(adt_MHDR)-8)
|
||||
if (size != sizeof(adt_MHDR) - 8)
|
||||
return false;
|
||||
|
||||
// Check and prepare MCIN
|
||||
|
|
@ -97,9 +97,9 @@ bool adt_MCIN::prepareLoadedData()
|
|||
return false;
|
||||
|
||||
// Check cells data
|
||||
for (int i=0; i<ADT_CELLS_PER_GRID;i++)
|
||||
for (int j=0; j<ADT_CELLS_PER_GRID;j++)
|
||||
if (cells[i][j].offsMCNK && !getMCNK(i,j)->prepareLoadedData())
|
||||
for (int i = 0; i < ADT_CELLS_PER_GRID; i++)
|
||||
for (int j = 0; j < ADT_CELLS_PER_GRID; j++)
|
||||
if (cells[i][j].offsMCNK && !getMCNK(i, j)->prepareLoadedData())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
@ -137,7 +137,7 @@ bool adt_MCVT::prepareLoadedData()
|
|||
if (fcc != 'MCVT')
|
||||
return false;
|
||||
|
||||
if (size != sizeof(adt_MCVT)-8)
|
||||
if (size != sizeof(adt_MCVT) - 8)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -53,12 +53,12 @@ typedef uint8_t uint8;
|
|||
#endif
|
||||
|
||||
typedef std::deque<HANDLE> ArchiveSet;
|
||||
typedef std::pair<ArchiveSet::const_iterator,ArchiveSet::const_iterator> ArchiveSetBounds;
|
||||
typedef std::pair<ArchiveSet::const_iterator, ArchiveSet::const_iterator> ArchiveSetBounds;
|
||||
|
||||
bool OpenArchive(char const* mpqFileName, HANDLE* mpqHandlePtr = NULL);
|
||||
bool OpenNewestFile(char const* filename, HANDLE* fileHandlerPtr);
|
||||
ArchiveSetBounds GetArchivesBounds();
|
||||
bool ExtractFile( char const* mpq_name, std::string const& filename );
|
||||
bool ExtractFile(char const* mpq_name, std::string const& filename);
|
||||
void CloseArchives();
|
||||
|
||||
#define FILE_FORMAT_VERSION 18
|
||||
|
|
@ -68,7 +68,8 @@ void CloseArchives();
|
|||
//
|
||||
struct file_MVER
|
||||
{
|
||||
union{
|
||||
union
|
||||
{
|
||||
uint32 fcc;
|
||||
char fcc_txt[4];
|
||||
};
|
||||
|
|
@ -76,18 +77,19 @@ struct file_MVER
|
|||
uint32 ver;
|
||||
};
|
||||
|
||||
class FileLoader{
|
||||
uint8 *data;
|
||||
uint32 data_size;
|
||||
public:
|
||||
virtual bool prepareLoadedData();
|
||||
uint8 *GetData() {return data;}
|
||||
uint32 GetDataSize() {return data_size;}
|
||||
class FileLoader
|
||||
{
|
||||
uint8* data;
|
||||
uint32 data_size;
|
||||
public:
|
||||
virtual bool prepareLoadedData();
|
||||
uint8* GetData() {return data;}
|
||||
uint32 GetDataSize() {return data_size;}
|
||||
|
||||
file_MVER *version;
|
||||
FileLoader();
|
||||
~FileLoader();
|
||||
bool loadFile(char *filename, bool log = true);
|
||||
virtual void free();
|
||||
file_MVER* version;
|
||||
FileLoader();
|
||||
~FileLoader();
|
||||
bool loadFile(char* filename, bool log = true);
|
||||
virtual void free();
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -49,13 +49,13 @@ bool WDT_file::prepareLoadedData()
|
|||
if (!FileLoader::prepareLoadedData())
|
||||
return false;
|
||||
|
||||
mphd = (wdt_MPHD *)((uint8*)version+version->size+8);
|
||||
mphd = (wdt_MPHD*)((uint8*)version + version->size + 8);
|
||||
if (!mphd->prepareLoadedData())
|
||||
return false;
|
||||
main = (wdt_MAIN *)((uint8*)mphd + mphd->size+8);
|
||||
main = (wdt_MAIN*)((uint8*)mphd + mphd->size + 8);
|
||||
if (!main->prepareLoadedData())
|
||||
return false;
|
||||
wmo = (wdt_MWMO *)((uint8*)main+ main->size+8);
|
||||
wmo = (wdt_MWMO*)((uint8*)main + main->size + 8);
|
||||
if (!wmo->prepareLoadedData())
|
||||
return false;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -25,62 +25,70 @@
|
|||
//**************************************************************************************
|
||||
#define WDT_MAP_SIZE 64
|
||||
|
||||
class wdt_MWMO{
|
||||
union{
|
||||
uint32 fcc;
|
||||
char fcc_txt[4];
|
||||
};
|
||||
public:
|
||||
uint32 size;
|
||||
bool prepareLoadedData();
|
||||
class wdt_MWMO
|
||||
{
|
||||
union
|
||||
{
|
||||
uint32 fcc;
|
||||
char fcc_txt[4];
|
||||
};
|
||||
public:
|
||||
uint32 size;
|
||||
bool prepareLoadedData();
|
||||
};
|
||||
|
||||
class wdt_MPHD{
|
||||
union{
|
||||
uint32 fcc;
|
||||
char fcc_txt[4];
|
||||
};
|
||||
public:
|
||||
uint32 size;
|
||||
class wdt_MPHD
|
||||
{
|
||||
union
|
||||
{
|
||||
uint32 fcc;
|
||||
char fcc_txt[4];
|
||||
};
|
||||
public:
|
||||
uint32 size;
|
||||
|
||||
uint32 data1;
|
||||
uint32 data2;
|
||||
uint32 data3;
|
||||
uint32 data4;
|
||||
uint32 data5;
|
||||
uint32 data6;
|
||||
uint32 data7;
|
||||
uint32 data8;
|
||||
bool prepareLoadedData();
|
||||
};
|
||||
|
||||
class wdt_MAIN{
|
||||
union{
|
||||
uint32 fcc;
|
||||
char fcc_txt[4];
|
||||
};
|
||||
public:
|
||||
uint32 size;
|
||||
|
||||
struct adtData{
|
||||
uint32 exist;
|
||||
uint32 data1;
|
||||
} adt_list[64][64];
|
||||
|
||||
bool prepareLoadedData();
|
||||
uint32 data2;
|
||||
uint32 data3;
|
||||
uint32 data4;
|
||||
uint32 data5;
|
||||
uint32 data6;
|
||||
uint32 data7;
|
||||
uint32 data8;
|
||||
bool prepareLoadedData();
|
||||
};
|
||||
|
||||
class WDT_file : public FileLoader{
|
||||
public:
|
||||
bool prepareLoadedData();
|
||||
class wdt_MAIN
|
||||
{
|
||||
union
|
||||
{
|
||||
uint32 fcc;
|
||||
char fcc_txt[4];
|
||||
};
|
||||
public:
|
||||
uint32 size;
|
||||
|
||||
WDT_file();
|
||||
~WDT_file();
|
||||
void free();
|
||||
struct adtData
|
||||
{
|
||||
uint32 exist;
|
||||
uint32 data1;
|
||||
} adt_list[64][64];
|
||||
|
||||
wdt_MPHD *mphd;
|
||||
wdt_MAIN *main;
|
||||
wdt_MWMO *wmo;
|
||||
bool prepareLoadedData();
|
||||
};
|
||||
|
||||
class WDT_file : public FileLoader
|
||||
{
|
||||
public:
|
||||
bool prepareLoadedData();
|
||||
|
||||
WDT_file();
|
||||
~WDT_file();
|
||||
void free();
|
||||
|
||||
wdt_MPHD* mphd;
|
||||
wdt_MAIN* main;
|
||||
wdt_MWMO* wmo;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -163,11 +163,11 @@ fi
|
|||
if [ "$USE_VMAPS" = "1" ]
|
||||
then
|
||||
echo "`date`: Start extraction of vmaps..." | tee -a $LOG_FILE
|
||||
vmapExtractor4 | tee -a $DETAIL_LOG_FILE
|
||||
vmapExtractor | tee -a $DETAIL_LOG_FILE
|
||||
echo "`date`: Extracting of vmaps finished" | tee -a $LOG_FILE
|
||||
mkdir vmaps
|
||||
echo "`date`: Start assembling of vmaps..." | tee -a $LOG_FILE
|
||||
vmap_assembler.exe buildings vmaps | tee -a $DETAIL_LOG_FILE
|
||||
vmap_assembler Buildings vmaps | tee -a $DETAIL_LOG_FILE
|
||||
echo "`date`: Assembling of vmaps finished" | tee -a $LOG_FILE
|
||||
|
||||
echo | tee -a $LOG_FILE
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -33,13 +33,13 @@ DETAIL_LOG_FILE="MoveMapGen_detailed.log"
|
|||
## ! Use below only for finetuning or if you know what you are doing !
|
||||
|
||||
## All maps
|
||||
MAP_LIST_A="1 37 543 595 289 572 529 562 531 269 47 649 650 599 548 559 429 230 573 349 13 25 409 229 43 48 546 553 547 604 545 90 576"
|
||||
MAP_LIST_B="571 628 560 509 723 532 607 600 668 33 585 566 389 601 369 129 550 189 542 70 109 554 632 552 555 540 598 450 558 249 35 624 557"
|
||||
MAP_LIST_C="0 631 609 534 533 619 469 602 329 580 615 578 36 556 44 565 544 34 617 608 618 449 616 42 451 582 584 586 587 588 589 590 591 592"
|
||||
MAP_LIST_D="530 169 575 603 309 574 30 564 568 209 724 658 489 593 594 596 597 605 606 610 612 613 614 620 621 622 623 641 642 647 672 673 712 713 718"
|
||||
MAP_LIST_D1="209 724 658 489 606 610 612 613 614 620 621"
|
||||
MAP_LIST_D2="169 575 603 309 574 30 564 568 622 623 641 642 647 672 673 712 713 718"
|
||||
MAP_LIST_D3="530 593 594 596 597 605"
|
||||
MAP_LIST_A="1 37 543 595 289 572 529 562 531 269 47 649 650 599 548 559 429 230 573 349 13 25 409 229 43 48 546 553 547 604 545 90 576 742 743 746 747 748 749 750 762 763 764 765 766 767 859 861 930 938 939 940 980"
|
||||
MAP_LIST_B="571 628 560 509 723 532 607 600 668 33 585 566 389 601 369 129 550 189 542 70 109 554 632 552 555 540 598 450 558 249 35 624 557 659 660 661 662 719 720 721 731 732 734 736 738 739 740 741 951 967 969"
|
||||
MAP_LIST_C="0 631 609 534 533 619 469 602 329 580 615 578 36 556 44 565 544 34 617 608 618 449 616 42 451 582 584 586 587 588 589 590 591 592 643 644 645 646 648 627 637 638 669 670 671 674 725 726 727 728 730"
|
||||
MAP_LIST_D="530 169 575 603 309 574 30 564 568 209 724 658 489 593 594 596 597 605 606 610 612 613 614 620 621 622 623 641 642 647 672 673 712 713 718 651 654 655 656 657 751 752 753 754 755 757 759 760 761 974 977"
|
||||
MAP_LIST_D1="209 724 658 489 606 610 612 613 614 620 621 754 755 757 759 760 761"
|
||||
MAP_LIST_D2="169 575 603 309 574 30 564 568 622 623 641 642 647 672 673 712 713"
|
||||
MAP_LIST_D3="530 593 594 596 597 605 651 654 655 656 657 751 752 753 974 977 718"
|
||||
|
||||
badParam()
|
||||
{
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -25,8 +25,10 @@ from collections import deque
|
|||
mapList = deque([0,1,530,571,13,25,30,33,34,35,36,37,42,43,44,47,48,70,90,109,129,169,189,209,229,230,249,269,289,309,329,349,369,
|
||||
389,409,429,449,450,451,469,489,509,529,531,532,533,534,540,542,543,544,545,546,547,548,550,552,553,554,555,556,557,558,559,
|
||||
560,562,564,565,566,568,572,573,574,575,576,578,580,582,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,
|
||||
601,602,603,604,605,606,607,608,609,610,612,613,614,615,616,617,618,619,620,621,622,623,624,628,631,632,641,642,647,649,650,
|
||||
658,668,672,673,712,713,718,723,724])
|
||||
601,602,603,604,605,606,607,608,609,610,612,613,614,615,616,617,618,619,620,621,622,623,624,627,628,631,632,637,638,641,642,
|
||||
643,644,645,646,647,648,649,650,651,654,655,656,657,658,659,660,661,662,668,669,670,671,672,673,674,712,713,718,719,720,721,
|
||||
723,724,725,726,727,728,730,731,732,734,736,738,739,740,741,742,743,746,747,748,749,750,751,752,753,754,755,757,759,760,761,
|
||||
762,763,764,765,766,767,859,861,930,938,939,940,951,967,969,974,977,980])
|
||||
|
||||
class workerThread(threading.Thread):
|
||||
def __init__(self, mapID):
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace MMAP
|
|||
|
||||
string name("meshes/%03u%02i%02i.");
|
||||
|
||||
#define DEBUG_WRITE(fileExtension,data) \
|
||||
#define DEBUG_WRITE(fileExtension,data) \
|
||||
do { \
|
||||
sprintf(fileName, (name + fileExtension).c_str(), mapID, tileY, tileX); \
|
||||
FILE* file = fopen(fileName, "wb"); \
|
||||
|
|
@ -55,18 +55,18 @@ namespace MMAP
|
|||
printf("%sWriting debug output... \r", tileString); \
|
||||
} while (false)
|
||||
|
||||
if(heightfield)
|
||||
if (heightfield)
|
||||
DEBUG_WRITE("hf", heightfield);
|
||||
if(compactHeightfield)
|
||||
if (compactHeightfield)
|
||||
DEBUG_WRITE("chf", compactHeightfield);
|
||||
if(contours)
|
||||
if (contours)
|
||||
DEBUG_WRITE("cs", contours);
|
||||
if(polyMesh)
|
||||
if (polyMesh)
|
||||
DEBUG_WRITE("pmesh", polyMesh);
|
||||
if(polyMeshDetail)
|
||||
if (polyMeshDetail)
|
||||
DEBUG_WRITE("dmesh", polyMeshDetail);
|
||||
|
||||
#undef DEBUG_WRITE
|
||||
#undef DEBUG_WRITE
|
||||
}
|
||||
|
||||
void IntermediateValues::debugWrite(FILE* file, const rcHeightfield* mesh)
|
||||
|
|
@ -84,7 +84,7 @@ namespace MMAP
|
|||
for (int y = 0; y < mesh->height; ++y)
|
||||
for (int x = 0; x < mesh->width; ++x)
|
||||
{
|
||||
rcSpan* span = mesh->spans[x+y*mesh->width];
|
||||
rcSpan* span = mesh->spans[x + y * mesh->width];
|
||||
|
||||
// first, count the number of spans
|
||||
int spanCount = 0;
|
||||
|
|
@ -98,7 +98,7 @@ namespace MMAP
|
|||
fwrite(&spanCount, sizeof(int), 1, file);
|
||||
|
||||
// write the spans
|
||||
span = mesh->spans[x+y*mesh->width];
|
||||
span = mesh->spans[x + y * mesh->width];
|
||||
while (span)
|
||||
{
|
||||
fwrite(span, sizeof(rcSpan), 1, file);
|
||||
|
|
@ -137,7 +137,7 @@ namespace MMAP
|
|||
fwrite(&tmp, sizeof(tmp), 1, file);
|
||||
|
||||
if (chf->cells)
|
||||
fwrite(chf->cells, sizeof(rcCompactCell), chf->width*chf->height, file);
|
||||
fwrite(chf->cells, sizeof(rcCompactCell), chf->width * chf->height, file);
|
||||
if (chf->spans)
|
||||
fwrite(chf->spans, sizeof(rcCompactSpan), chf->spanCount, file);
|
||||
if (chf->dist)
|
||||
|
|
@ -161,9 +161,9 @@ namespace MMAP
|
|||
fwrite(&cs->conts[i].area, sizeof(unsigned char), 1, file);
|
||||
fwrite(&cs->conts[i].reg, sizeof(unsigned short), 1, file);
|
||||
fwrite(&cs->conts[i].nverts, sizeof(int), 1, file);
|
||||
fwrite(cs->conts[i].verts, sizeof(int), cs->conts[i].nverts*4, file);
|
||||
fwrite(cs->conts[i].verts, sizeof(int), cs->conts[i].nverts * 4, file);
|
||||
fwrite(&cs->conts[i].nrverts, sizeof(int), 1, file);
|
||||
fwrite(cs->conts[i].rverts, sizeof(int), cs->conts[i].nrverts*4, file);
|
||||
fwrite(cs->conts[i].rverts, sizeof(int), cs->conts[i].nrverts * 4, file);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -178,9 +178,9 @@ namespace MMAP
|
|||
fwrite(mesh->bmin, sizeof(float), 3, file);
|
||||
fwrite(mesh->bmax, sizeof(float), 3, file);
|
||||
fwrite(&(mesh->nverts), sizeof(int), 1, file);
|
||||
fwrite(mesh->verts, sizeof(unsigned short), mesh->nverts*3, file);
|
||||
fwrite(mesh->verts, sizeof(unsigned short), mesh->nverts * 3, file);
|
||||
fwrite(&(mesh->npolys), sizeof(int), 1, file);
|
||||
fwrite(mesh->polys, sizeof(unsigned short), mesh->npolys*mesh->nvp*2, file);
|
||||
fwrite(mesh->polys, sizeof(unsigned short), mesh->npolys * mesh->nvp * 2, file);
|
||||
fwrite(mesh->flags, sizeof(unsigned short), mesh->npolys, file);
|
||||
fwrite(mesh->areas, sizeof(unsigned char), mesh->npolys, file);
|
||||
fwrite(mesh->regs, sizeof(unsigned short), mesh->npolys, file);
|
||||
|
|
@ -192,14 +192,14 @@ namespace MMAP
|
|||
return;
|
||||
|
||||
fwrite(&(mesh->nverts), sizeof(int), 1, file);
|
||||
fwrite(mesh->verts, sizeof(float), mesh->nverts*3, file);
|
||||
fwrite(mesh->verts, sizeof(float), mesh->nverts * 3, file);
|
||||
fwrite(&(mesh->ntris), sizeof(int), 1, file);
|
||||
fwrite(mesh->tris, sizeof(char), mesh->ntris*4, file);
|
||||
fwrite(mesh->tris, sizeof(char), mesh->ntris * 4, file);
|
||||
fwrite(&(mesh->nmeshes), sizeof(int), 1, file);
|
||||
fwrite(mesh->meshes, sizeof(int), mesh->nmeshes*4, file);
|
||||
fwrite(mesh->meshes, sizeof(int), mesh->nmeshes * 4, file);
|
||||
}
|
||||
|
||||
void IntermediateValues::generateObjFile(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData)
|
||||
void IntermediateValues::generateObjFile(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData)
|
||||
{
|
||||
char objFileName[255];
|
||||
sprintf(objFileName, "meshes/map%03u%02u%02u.obj", mapID, tileY, tileX);
|
||||
|
|
@ -227,10 +227,10 @@ namespace MMAP
|
|||
int triCount = allTris.size() / 3;
|
||||
|
||||
for (int i = 0; i < allVerts.size() / 3; i++)
|
||||
fprintf(objFile, "v %f %f %f\n", verts[i*3], verts[i*3 + 1], verts[i*3 + 2]);
|
||||
fprintf(objFile, "v %f %f %f\n", verts[i * 3], verts[i * 3 + 1], verts[i * 3 + 2]);
|
||||
|
||||
for (int i = 0; i < allTris.size() / 3; i++)
|
||||
fprintf(objFile, "f %i %i %i\n", tris[i*3] + 1, tris[i*3 + 1] + 1, tris[i*3 + 2] + 1);
|
||||
fprintf(objFile, "f %i %i %i\n", tris[i * 3] + 1, tris[i * 3 + 1] + 1, tris[i * 3 + 2] + 1);
|
||||
|
||||
fclose(objFile);
|
||||
|
||||
|
|
@ -265,11 +265,11 @@ namespace MMAP
|
|||
}
|
||||
|
||||
fwrite(&vertCount, sizeof(int), 1, objFile);
|
||||
fwrite(verts, sizeof(float), vertCount*3, objFile);
|
||||
fwrite(verts, sizeof(float), vertCount * 3, objFile);
|
||||
fflush(objFile);
|
||||
|
||||
fwrite(&triCount, sizeof(int), 1, objFile);
|
||||
fwrite(tris, sizeof(int), triCount*3, objFile);
|
||||
fwrite(tris, sizeof(int), triCount * 3, objFile);
|
||||
fflush(objFile);
|
||||
|
||||
fclose(objFile);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace MMAP
|
|||
rcPolyMeshDetail* polyMeshDetail;
|
||||
|
||||
IntermediateValues() : compactHeightfield(NULL), heightfield(NULL),
|
||||
contours(NULL), polyMesh(NULL), polyMeshDetail(NULL) {}
|
||||
contours(NULL), polyMesh(NULL), polyMeshDetail(NULL) {}
|
||||
~IntermediateValues();
|
||||
|
||||
void writeIV(uint32 mapID, uint32 tileX, uint32 tileY);
|
||||
|
|
@ -48,7 +48,7 @@ namespace MMAP
|
|||
void debugWrite(FILE* file, const rcPolyMesh* mesh);
|
||||
void debugWrite(FILE* file, const rcPolyMeshDetail* mesh);
|
||||
|
||||
void generateObjFile(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData);
|
||||
void generateObjFile(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@
|
|||
#include "Platform/Define.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#include <stddef.h>
|
||||
#include <dirent.h>
|
||||
#include <stddef.h>
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
|
@ -40,27 +40,27 @@ namespace MMAP
|
|||
{
|
||||
inline bool matchWildcardFilter(const char* filter, const char* str)
|
||||
{
|
||||
if(!filter || !str)
|
||||
if (!filter || !str)
|
||||
return false;
|
||||
|
||||
// end on null character
|
||||
while(*filter && *str)
|
||||
while (*filter && *str)
|
||||
{
|
||||
if(*filter == '*')
|
||||
if (*filter == '*')
|
||||
{
|
||||
if(*++filter == '\0') // wildcard at end of filter means all remaing chars match
|
||||
if (*++filter == '\0') // wildcard at end of filter means all remaing chars match
|
||||
return true;
|
||||
|
||||
while(true)
|
||||
while (true)
|
||||
{
|
||||
if(*filter == *str)
|
||||
if (*filter == *str)
|
||||
break;
|
||||
if(*str == '\0')
|
||||
if (*str == '\0')
|
||||
return false; // reached end of string without matching next filter character
|
||||
str++;
|
||||
}
|
||||
}
|
||||
else if(*filter != *str)
|
||||
else if (*filter != *str)
|
||||
return false; // mismatch
|
||||
|
||||
filter++;
|
||||
|
|
@ -76,9 +76,9 @@ namespace MMAP
|
|||
LISTFILE_OK = 1
|
||||
};
|
||||
|
||||
inline ListFilesResult getDirContents(vector<string> &fileList, string dirpath = ".", string filter = "*", bool includeSubDirs = false)
|
||||
inline ListFilesResult getDirContents(vector<string>& fileList, string dirpath = ".", string filter = "*", bool includeSubDirs = false)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#ifdef WIN32
|
||||
HANDLE hFind;
|
||||
WIN32_FIND_DATA findFileInfo;
|
||||
string directory;
|
||||
|
|
@ -87,40 +87,40 @@ namespace MMAP
|
|||
|
||||
hFind = FindFirstFile(directory.c_str(), &findFileInfo);
|
||||
|
||||
if(hFind == INVALID_HANDLE_VALUE)
|
||||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
return LISTFILE_DIRECTORY_NOT_FOUND;
|
||||
|
||||
do
|
||||
{
|
||||
if(includeSubDirs || (findFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
|
||||
if (includeSubDirs || (findFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
|
||||
fileList.push_back(string(findFileInfo.cFileName));
|
||||
}
|
||||
while (FindNextFile(hFind, &findFileInfo));
|
||||
|
||||
FindClose(hFind);
|
||||
|
||||
#else
|
||||
const char *p = dirpath.c_str();
|
||||
DIR * dirp = opendir(p);
|
||||
struct dirent * dp;
|
||||
#else
|
||||
const char* p = dirpath.c_str();
|
||||
DIR* dirp = opendir(p);
|
||||
struct dirent* dp;
|
||||
|
||||
while (dirp)
|
||||
{
|
||||
errno = 0;
|
||||
if ((dp = readdir(dirp)) != NULL)
|
||||
{
|
||||
if(matchWildcardFilter(filter.c_str(), dp->d_name))
|
||||
if (matchWildcardFilter(filter.c_str(), dp->d_name))
|
||||
fileList.push_back(string(dp->d_name));
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if(dirp)
|
||||
if (dirp)
|
||||
closedir(dirp);
|
||||
else
|
||||
return LISTFILE_DIRECTORY_NOT_FOUND;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return LISTFILE_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,9 +47,9 @@ namespace MaNGOS
|
|||
// uint16 gridArea;
|
||||
//};
|
||||
|
||||
#define MAP_HEIGHT_NO_HEIGHT 0x0001
|
||||
#define MAP_HEIGHT_AS_INT16 0x0002
|
||||
#define MAP_HEIGHT_AS_INT8 0x0004
|
||||
#define MAP_HEIGHT_NO_HEIGHT 0x0001
|
||||
#define MAP_HEIGHT_AS_INT16 0x0002
|
||||
#define MAP_HEIGHT_AS_INT8 0x0004
|
||||
|
||||
struct GridMapHeightHeader
|
||||
{
|
||||
|
|
@ -59,8 +59,8 @@ namespace MaNGOS
|
|||
float gridMaxHeight;
|
||||
};
|
||||
|
||||
#define MAP_LIQUID_NO_TYPE 0x0001
|
||||
#define MAP_LIQUID_NO_HEIGHT 0x0002
|
||||
#define MAP_LIQUID_NO_TYPE 0x0001
|
||||
#define MAP_LIQUID_NO_HEIGHT 0x0002
|
||||
|
||||
struct GridMapLiquidHeader
|
||||
{
|
||||
|
|
@ -83,16 +83,16 @@ namespace MaNGOS
|
|||
// LIQUID_MAP_UNDER_WATER = 0x00000008
|
||||
//};
|
||||
|
||||
#define MAP_LIQUID_TYPE_NO_WATER 0x00
|
||||
#define MAP_LIQUID_TYPE_WATER 0x01
|
||||
#define MAP_LIQUID_TYPE_OCEAN 0x02
|
||||
#define MAP_LIQUID_TYPE_MAGMA 0x04
|
||||
#define MAP_LIQUID_TYPE_SLIME 0x08
|
||||
#define MAP_LIQUID_TYPE_NO_WATER 0x00
|
||||
#define MAP_LIQUID_TYPE_WATER 0x01
|
||||
#define MAP_LIQUID_TYPE_OCEAN 0x02
|
||||
#define MAP_LIQUID_TYPE_MAGMA 0x04
|
||||
#define MAP_LIQUID_TYPE_SLIME 0x08
|
||||
|
||||
#define MAP_ALL_LIQUIDS (MAP_LIQUID_TYPE_WATER | MAP_LIQUID_TYPE_OCEAN | MAP_LIQUID_TYPE_MAGMA | MAP_LIQUID_TYPE_SLIME)
|
||||
#define MAP_ALL_LIQUIDS (MAP_LIQUID_TYPE_WATER | MAP_LIQUID_TYPE_OCEAN | MAP_LIQUID_TYPE_MAGMA | MAP_LIQUID_TYPE_SLIME)
|
||||
|
||||
#define MAP_LIQUID_TYPE_DARK_WATER 0x10
|
||||
#define MAP_LIQUID_TYPE_WMO_WATER 0x20
|
||||
#define MAP_LIQUID_TYPE_DARK_WATER 0x10
|
||||
#define MAP_LIQUID_TYPE_WMO_WATER 0x20
|
||||
|
||||
//struct GridMapLiquidData
|
||||
//{
|
||||
|
|
|
|||
|
|
@ -32,15 +32,15 @@ namespace MMAP
|
|||
MapBuilder::MapBuilder(float maxWalkableAngle, bool skipLiquid,
|
||||
bool skipContinents, bool skipJunkMaps, bool skipBattlegrounds,
|
||||
bool debugOutput, bool bigBaseUnit, const char* offMeshFilePath) :
|
||||
m_terrainBuilder(NULL),
|
||||
m_debugOutput (debugOutput),
|
||||
m_skipContinents (skipContinents),
|
||||
m_skipJunkMaps (skipJunkMaps),
|
||||
m_skipBattlegrounds (skipBattlegrounds),
|
||||
m_maxWalkableAngle (maxWalkableAngle),
|
||||
m_bigBaseUnit (bigBaseUnit),
|
||||
m_rcContext (NULL),
|
||||
m_offMeshFilePath (offMeshFilePath)
|
||||
m_terrainBuilder(NULL),
|
||||
m_debugOutput(debugOutput),
|
||||
m_skipContinents(skipContinents),
|
||||
m_skipJunkMaps(skipJunkMaps),
|
||||
m_skipBattlegrounds(skipBattlegrounds),
|
||||
m_maxWalkableAngle(maxWalkableAngle),
|
||||
m_bigBaseUnit(bigBaseUnit),
|
||||
m_rcContext(NULL),
|
||||
m_offMeshFilePath(offMeshFilePath)
|
||||
{
|
||||
m_terrainBuilder = new TerrainBuilder(skipLiquid);
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ namespace MMAP
|
|||
for (TileList::iterator it = m_tiles.begin(); it != m_tiles.end(); ++it)
|
||||
{
|
||||
(*it).second->clear();
|
||||
delete (*it).second;
|
||||
delete(*it).second;
|
||||
}
|
||||
|
||||
delete m_terrainBuilder;
|
||||
|
|
@ -73,10 +73,10 @@ namespace MMAP
|
|||
getDirContents(files, "maps");
|
||||
for (uint32 i = 0; i < files.size(); ++i)
|
||||
{
|
||||
mapID = uint32(atoi(files[i].substr(0,3).c_str()));
|
||||
mapID = uint32(atoi(files[i].substr(0, 3).c_str()));
|
||||
if (m_tiles.find(mapID) == m_tiles.end())
|
||||
{
|
||||
m_tiles.insert(pair<uint32,set<uint32>*>(mapID, new set<uint32>));
|
||||
m_tiles.insert(pair<uint32, set<uint32>*>(mapID, new set<uint32>));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
|
@ -85,8 +85,8 @@ namespace MMAP
|
|||
getDirContents(files, "vmaps", "*.vmtree");
|
||||
for (uint32 i = 0; i < files.size(); ++i)
|
||||
{
|
||||
mapID = uint32(atoi(files[i].substr(0,3).c_str()));
|
||||
m_tiles.insert(pair<uint32,set<uint32>*>(mapID, new set<uint32>));
|
||||
mapID = uint32(atoi(files[i].substr(0, 3).c_str()));
|
||||
m_tiles.insert(pair<uint32, set<uint32>*>(mapID, new set<uint32>));
|
||||
count++;
|
||||
}
|
||||
printf("found %u.\n", count);
|
||||
|
|
@ -103,8 +103,8 @@ namespace MMAP
|
|||
getDirContents(files, "vmaps", filter);
|
||||
for (uint32 i = 0; i < files.size(); ++i)
|
||||
{
|
||||
tileX = uint32(atoi(files[i].substr(7,2).c_str()));
|
||||
tileY = uint32(atoi(files[i].substr(4,2).c_str()));
|
||||
tileX = uint32(atoi(files[i].substr(7, 2).c_str()));
|
||||
tileY = uint32(atoi(files[i].substr(4, 2).c_str()));
|
||||
tileID = StaticMapTree::packTileID(tileY, tileX);
|
||||
|
||||
tiles->insert(tileID);
|
||||
|
|
@ -116,8 +116,8 @@ namespace MMAP
|
|||
getDirContents(files, "maps", filter);
|
||||
for (uint32 i = 0; i < files.size(); ++i)
|
||||
{
|
||||
tileY = uint32(atoi(files[i].substr(3,2).c_str()));
|
||||
tileX = uint32(atoi(files[i].substr(5,2).c_str()));
|
||||
tileY = uint32(atoi(files[i].substr(3, 2).c_str()));
|
||||
tileX = uint32(atoi(files[i].substr(5, 2).c_str()));
|
||||
tileID = StaticMapTree::packTileID(tileX, tileY);
|
||||
|
||||
if (tiles->insert(tileID).second)
|
||||
|
|
@ -151,7 +151,7 @@ namespace MMAP
|
|||
}
|
||||
|
||||
/**************************************************************************/
|
||||
void MapBuilder::getGridBounds(uint32 mapID, uint32 &minX, uint32 &minY, uint32 &maxX, uint32 &maxY)
|
||||
void MapBuilder::getGridBounds(uint32 mapID, uint32& minX, uint32& minY, uint32& maxX, uint32& maxY)
|
||||
{
|
||||
maxX = INT_MAX;
|
||||
maxY = INT_MAX;
|
||||
|
|
@ -163,7 +163,7 @@ namespace MMAP
|
|||
|
||||
// make sure we process maps which don't have tiles
|
||||
// initialize the static tree, which loads WDT models
|
||||
if(!m_terrainBuilder->loadVMap(mapID, 64, 64, meshData))
|
||||
if (!m_terrainBuilder->loadVMap(mapID, 64, 64, meshData))
|
||||
return;
|
||||
|
||||
// get the coord bounds of the model data
|
||||
|
|
@ -297,7 +297,7 @@ namespace MMAP
|
|||
}
|
||||
|
||||
/**************************************************************************/
|
||||
void MapBuilder::buildNavMesh(uint32 mapID, dtNavMesh* &navMesh)
|
||||
void MapBuilder::buildNavMesh(uint32 mapID, dtNavMesh*& navMesh)
|
||||
{
|
||||
set<uint32>* tiles = getTileList(mapID);
|
||||
|
||||
|
|
@ -374,7 +374,7 @@ namespace MMAP
|
|||
|
||||
/**************************************************************************/
|
||||
void MapBuilder::buildMoveMapTile(uint32 mapID, uint32 tileX, uint32 tileY,
|
||||
MeshData &meshData, float bmin[3], float bmax[3],
|
||||
MeshData& meshData, float bmin[3], float bmax[3],
|
||||
dtNavMesh* navMesh)
|
||||
{
|
||||
// console output
|
||||
|
|
@ -401,9 +401,9 @@ namespace MMAP
|
|||
const static float BASE_UNIT_DIM = m_bigBaseUnit ? 0.533333f : 0.266666f;
|
||||
|
||||
// All are in UNIT metrics!
|
||||
const static int VERTEX_PER_MAP = int(GRID_SIZE/BASE_UNIT_DIM + 0.5f);
|
||||
const static int VERTEX_PER_MAP = int(GRID_SIZE / BASE_UNIT_DIM + 0.5f);
|
||||
const static int VERTEX_PER_TILE = m_bigBaseUnit ? 40 : 80; // must divide VERTEX_PER_MAP
|
||||
const static int TILES_PER_MAP = VERTEX_PER_MAP/VERTEX_PER_TILE;
|
||||
const static int TILES_PER_MAP = VERTEX_PER_MAP / VERTEX_PER_TILE;
|
||||
|
||||
rcConfig config;
|
||||
memset(&config, 0, sizeof(rcConfig));
|
||||
|
|
@ -436,21 +436,21 @@ namespace MMAP
|
|||
// Initialize per tile config.
|
||||
rcConfig tileCfg;
|
||||
memcpy(&tileCfg, &config, sizeof(rcConfig));
|
||||
tileCfg.width = config.tileSize + config.borderSize*2;
|
||||
tileCfg.height = config.tileSize + config.borderSize*2;
|
||||
tileCfg.width = config.tileSize + config.borderSize * 2;
|
||||
tileCfg.height = config.tileSize + config.borderSize * 2;
|
||||
|
||||
// build all tiles
|
||||
for (int y = 0; y < TILES_PER_MAP; ++y)
|
||||
{
|
||||
for (int x = 0; x < TILES_PER_MAP; ++x)
|
||||
{
|
||||
Tile& tile = tiles[x + y*TILES_PER_MAP];
|
||||
Tile& tile = tiles[x + y * TILES_PER_MAP];
|
||||
|
||||
// Calculate the per tile bounding box.
|
||||
tileCfg.bmin[0] = config.bmin[0] + (x*config.tileSize - config.borderSize)*config.cs;
|
||||
tileCfg.bmin[2] = config.bmin[2] + (y*config.tileSize - config.borderSize)*config.cs;
|
||||
tileCfg.bmax[0] = config.bmin[0] + ((x+1)*config.tileSize + config.borderSize)*config.cs;
|
||||
tileCfg.bmax[2] = config.bmin[2] + ((y+1)*config.tileSize + config.borderSize)*config.cs;
|
||||
tileCfg.bmin[0] = config.bmin[0] + (x * config.tileSize - config.borderSize) * config.cs;
|
||||
tileCfg.bmin[2] = config.bmin[2] + (y * config.tileSize - config.borderSize) * config.cs;
|
||||
tileCfg.bmax[0] = config.bmin[0] + ((x + 1) * config.tileSize + config.borderSize) * config.cs;
|
||||
tileCfg.bmax[2] = config.bmin[2] + ((y + 1) * config.tileSize + config.borderSize) * config.cs;
|
||||
|
||||
float tbmin[2], tbmax[2];
|
||||
tbmin[0] = tileCfg.bmin[0];
|
||||
|
|
@ -468,7 +468,7 @@ namespace MMAP
|
|||
|
||||
// mark all walkable tiles, both liquids and solids
|
||||
unsigned char* triFlags = new unsigned char[tTriCount];
|
||||
memset(triFlags, NAV_GROUND, tTriCount*sizeof(unsigned char));
|
||||
memset(triFlags, NAV_GROUND, tTriCount * sizeof(unsigned char));
|
||||
rcClearUnwalkableTriangles(m_rcContext, tileCfg.walkableSlopeAngle, tVerts, tVertCount, tTris, tTriCount, triFlags);
|
||||
rcRasterizeTriangles(m_rcContext, tVerts, tVertCount, tTris, triFlags, tTriCount, *tile.solid, config.walkableClimb);
|
||||
delete [] triFlags;
|
||||
|
|
@ -560,7 +560,7 @@ namespace MMAP
|
|||
{
|
||||
for (int x = 0; x < TILES_PER_MAP; ++x)
|
||||
{
|
||||
Tile& tile = tiles[x + y*TILES_PER_MAP];
|
||||
Tile& tile = tiles[x + y * TILES_PER_MAP];
|
||||
if (tile.pmesh)
|
||||
{
|
||||
pmmerge[nmerge] = tile.pmesh;
|
||||
|
|
@ -595,7 +595,7 @@ namespace MMAP
|
|||
// remove padding for extraction
|
||||
for (int i = 0; i < iv.polyMesh->nverts; ++i)
|
||||
{
|
||||
unsigned short* v = &iv.polyMesh->verts[i*3];
|
||||
unsigned short* v = &iv.polyMesh->verts[i * 3];
|
||||
v[0] -= (unsigned short)config.borderSize;
|
||||
v[2] -= (unsigned short)config.borderSize;
|
||||
}
|
||||
|
|
@ -623,15 +623,15 @@ namespace MMAP
|
|||
params.detailTriCount = iv.polyMeshDetail->ntris;
|
||||
|
||||
params.offMeshConVerts = meshData.offMeshConnections.getCArray();
|
||||
params.offMeshConCount = meshData.offMeshConnections.size()/6;
|
||||
params.offMeshConCount = meshData.offMeshConnections.size() / 6;
|
||||
params.offMeshConRad = meshData.offMeshConnectionRads.getCArray();
|
||||
params.offMeshConDir = meshData.offMeshConnectionDirs.getCArray();
|
||||
params.offMeshConAreas = meshData.offMeshConnectionsAreas.getCArray();
|
||||
params.offMeshConFlags = meshData.offMeshConnectionsFlags.getCArray();
|
||||
|
||||
params.walkableHeight = BASE_UNIT_DIM*config.walkableHeight; // agent height
|
||||
params.walkableRadius = BASE_UNIT_DIM*config.walkableRadius; // agent radius
|
||||
params.walkableClimb = BASE_UNIT_DIM*config.walkableClimb; // keep less that walkableHeight (aka agent height)!
|
||||
params.walkableHeight = BASE_UNIT_DIM * config.walkableHeight; // agent height
|
||||
params.walkableRadius = BASE_UNIT_DIM * config.walkableRadius; // agent radius
|
||||
params.walkableClimb = BASE_UNIT_DIM * config.walkableClimb; // keep less that walkableHeight (aka agent height)!
|
||||
params.tileX = (((bmin[0] + bmax[0]) / 2) - navMesh->getParams()->orig[0]) / GRID_SIZE;
|
||||
params.tileY = (((bmin[2] + bmax[2]) / 2) - navMesh->getParams()->orig[2]) / GRID_SIZE;
|
||||
rcVcopy(params.bmin, bmin);
|
||||
|
|
@ -668,7 +668,7 @@ namespace MMAP
|
|||
continue;
|
||||
}
|
||||
if (!params.polyCount || !params.polys ||
|
||||
TILES_PER_MAP*TILES_PER_MAP == params.polyCount)
|
||||
TILES_PER_MAP * TILES_PER_MAP == params.polyCount)
|
||||
{
|
||||
// we have flat tiles with no actual geometry - don't build those, its useless
|
||||
// keep in mind that we do output those into debug info
|
||||
|
|
@ -735,7 +735,7 @@ namespace MMAP
|
|||
// restore padding so that the debug visualization is correct
|
||||
for (int i = 0; i < iv.polyMesh->nverts; ++i)
|
||||
{
|
||||
unsigned short* v = &iv.polyMesh->verts[i*3];
|
||||
unsigned short* v = &iv.polyMesh->verts[i * 3];
|
||||
v[0] += (unsigned short)config.borderSize;
|
||||
v[2] += (unsigned short)config.borderSize;
|
||||
}
|
||||
|
|
@ -792,6 +792,7 @@ namespace MMAP
|
|||
case 597: // CraigTest.wdt
|
||||
case 605: // development_nonweighted.wdt
|
||||
case 606: // QA_DVD.wdt
|
||||
case 627: // unused.wdt
|
||||
return true;
|
||||
default:
|
||||
if (isTransportMap(mapID))
|
||||
|
|
@ -809,6 +810,10 @@ namespace MMAP
|
|||
case 566: // EotS
|
||||
case 607: // SotA
|
||||
case 628: // IoC
|
||||
case 727: // TP
|
||||
case 728: // BfG
|
||||
case 761: // BfG2
|
||||
case 968: // EotS2
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -822,7 +827,7 @@ namespace MMAP
|
|||
{
|
||||
switch (mapID)
|
||||
{
|
||||
// transport maps
|
||||
// transport maps
|
||||
case 582:
|
||||
case 584:
|
||||
case 586:
|
||||
|
|
@ -848,9 +853,26 @@ namespace MMAP
|
|||
case 647:
|
||||
case 672:
|
||||
case 673:
|
||||
case 674:
|
||||
case 712:
|
||||
case 713:
|
||||
case 718:
|
||||
case 738:
|
||||
case 739:
|
||||
case 740:
|
||||
case 741:
|
||||
case 742:
|
||||
case 743:
|
||||
case 746:
|
||||
case 747:
|
||||
case 748:
|
||||
case 749:
|
||||
case 750:
|
||||
case 762:
|
||||
case 763:
|
||||
case 765:
|
||||
case 766:
|
||||
case 767:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
@ -878,5 +900,4 @@ namespace MMAP
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ using namespace VMAP;
|
|||
|
||||
namespace MMAP
|
||||
{
|
||||
typedef map<uint32,set<uint32>*> TileList;
|
||||
typedef map<uint32, set<uint32>*> TileList;
|
||||
struct Tile
|
||||
{
|
||||
Tile() : chf(NULL), solid(NULL), cset(NULL), pmesh(NULL), dmesh(NULL) {}
|
||||
|
|
@ -85,7 +85,7 @@ namespace MMAP
|
|||
void discoverTiles();
|
||||
set<uint32>* getTileList(uint32 mapID);
|
||||
|
||||
void buildNavMesh(uint32 mapID, dtNavMesh* &navMesh);
|
||||
void buildNavMesh(uint32 mapID, dtNavMesh*& navMesh);
|
||||
|
||||
void buildTile(uint32 mapID, uint32 tileX, uint32 tileY, dtNavMesh* navMesh);
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ namespace MMAP
|
|||
void buildMoveMapTile(uint32 mapID,
|
||||
uint32 tileX,
|
||||
uint32 tileY,
|
||||
MeshData &meshData,
|
||||
MeshData& meshData,
|
||||
float bmin[3],
|
||||
float bmax[3],
|
||||
dtNavMesh* navMesh);
|
||||
|
|
@ -101,7 +101,7 @@ namespace MMAP
|
|||
void getTileBounds(uint32 tileX, uint32 tileY,
|
||||
float* verts, int vertCount,
|
||||
float* bmin, float* bmax);
|
||||
void getGridBounds(uint32 mapID, uint32 &minX, uint32 &minY, uint32 &maxX, uint32 &maxY);
|
||||
void getGridBounds(uint32 mapID, uint32& minX, uint32& minY, uint32& maxX, uint32& maxY);
|
||||
|
||||
bool shouldSkipMap(uint32 mapID);
|
||||
bool isTransportMap(uint32 mapID);
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@
|
|||
|
||||
namespace MMAP
|
||||
{
|
||||
TerrainBuilder::TerrainBuilder(bool skipLiquid) : m_skipLiquid (skipLiquid){ }
|
||||
TerrainBuilder::TerrainBuilder(bool skipLiquid) : m_skipLiquid(skipLiquid) { }
|
||||
TerrainBuilder::~TerrainBuilder() { }
|
||||
|
||||
/**************************************************************************/
|
||||
void TerrainBuilder::getLoopVars(Spot portion, int &loopStart, int &loopEnd, int &loopInc)
|
||||
void TerrainBuilder::getLoopVars(Spot portion, int& loopStart, int& loopEnd, int& loopInc)
|
||||
{
|
||||
switch (portion)
|
||||
{
|
||||
|
|
@ -65,19 +65,19 @@ namespace MMAP
|
|||
}
|
||||
|
||||
/**************************************************************************/
|
||||
void TerrainBuilder::loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData)
|
||||
void TerrainBuilder::loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData)
|
||||
{
|
||||
if (loadMap(mapID, tileX, tileY, meshData, ENTIRE))
|
||||
{
|
||||
loadMap(mapID, tileX+1, tileY, meshData, LEFT);
|
||||
loadMap(mapID, tileX-1, tileY, meshData, RIGHT);
|
||||
loadMap(mapID, tileX, tileY+1, meshData, TOP);
|
||||
loadMap(mapID, tileX, tileY-1, meshData, BOTTOM);
|
||||
loadMap(mapID, tileX + 1, tileY, meshData, LEFT);
|
||||
loadMap(mapID, tileX - 1, tileY, meshData, RIGHT);
|
||||
loadMap(mapID, tileX, tileY + 1, meshData, TOP);
|
||||
loadMap(mapID, tileX, tileY - 1, meshData, BOTTOM);
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
bool TerrainBuilder::loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData, Spot portion)
|
||||
bool TerrainBuilder::loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, Spot portion)
|
||||
{
|
||||
char mapFileName[255];
|
||||
sprintf(mapFileName, "maps/%03u%02u%02u.map", mapID, tileY, tileX);
|
||||
|
|
@ -134,10 +134,10 @@ namespace MMAP
|
|||
heightMultiplier = (hheader.gridMaxHeight - hheader.gridHeight) / 255;
|
||||
|
||||
for (i = 0; i < V9_SIZE_SQ; ++i)
|
||||
V9[i] = (float)v9[i]*heightMultiplier + hheader.gridHeight;
|
||||
V9[i] = (float)v9[i] * heightMultiplier + hheader.gridHeight;
|
||||
|
||||
for (i = 0; i < V8_SIZE_SQ; ++i)
|
||||
V8[i] = (float)v8[i]*heightMultiplier + hheader.gridHeight;
|
||||
V8[i] = (float)v8[i] * heightMultiplier + hheader.gridHeight;
|
||||
}
|
||||
else if (hheader.flags & MAP_HEIGHT_AS_INT16)
|
||||
{
|
||||
|
|
@ -148,14 +148,14 @@ namespace MMAP
|
|||
heightMultiplier = (hheader.gridMaxHeight - hheader.gridHeight) / 65535;
|
||||
|
||||
for (i = 0; i < V9_SIZE_SQ; ++i)
|
||||
V9[i] = (float)v9[i]*heightMultiplier + hheader.gridHeight;
|
||||
V9[i] = (float)v9[i] * heightMultiplier + hheader.gridHeight;
|
||||
|
||||
for (i = 0; i < V8_SIZE_SQ; ++i)
|
||||
V8[i] = (float)v8[i]*heightMultiplier + hheader.gridHeight;
|
||||
V8[i] = (float)v8[i] * heightMultiplier + hheader.gridHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
fread (V9, sizeof(float), V9_SIZE_SQ, mapFile);
|
||||
fread(V9, sizeof(float), V9_SIZE_SQ, mapFile);
|
||||
fread(V8, sizeof(float), V8_SIZE_SQ, mapFile);
|
||||
}
|
||||
|
||||
|
|
@ -165,8 +165,8 @@ namespace MMAP
|
|||
fread(holes, fheader.holesSize, 1, mapFile);
|
||||
|
||||
int count = meshData.solidVerts.size() / 3;
|
||||
float xoffset = (float(tileX)-32)*GRID_SIZE;
|
||||
float yoffset = (float(tileY)-32)*GRID_SIZE;
|
||||
float xoffset = (float(tileX) - 32) * GRID_SIZE;
|
||||
float yoffset = (float(tileY) - 32) * GRID_SIZE;
|
||||
|
||||
float coord[3];
|
||||
|
||||
|
|
@ -188,8 +188,8 @@ namespace MMAP
|
|||
|
||||
int j, indices[3], loopStart, loopEnd, loopInc;
|
||||
getLoopVars(portion, loopStart, loopEnd, loopInc);
|
||||
for (i = loopStart; i < loopEnd; i+=loopInc)
|
||||
for (j = TOP; j <= BOTTOM; j+=1)
|
||||
for (i = loopStart; i < loopEnd; i += loopInc)
|
||||
for (j = TOP; j <= BOTTOM; j += 1)
|
||||
{
|
||||
getHeightTriangle(i, Spot(j), indices);
|
||||
ttriangles.append(indices[2] + count);
|
||||
|
|
@ -212,15 +212,15 @@ namespace MMAP
|
|||
|
||||
if (!(lheader.flags & MAP_LIQUID_NO_HEIGHT))
|
||||
{
|
||||
liquid_map = new float [lheader.width*lheader.height];
|
||||
fread(liquid_map, sizeof(float), lheader.width*lheader.height, mapFile);
|
||||
liquid_map = new float [lheader.width * lheader.height];
|
||||
fread(liquid_map, sizeof(float), lheader.width * lheader.height, mapFile);
|
||||
}
|
||||
|
||||
if (liquid_type && liquid_map)
|
||||
{
|
||||
int count = meshData.liquidVerts.size() / 3;
|
||||
float xoffset = (float(tileX)-32)*GRID_SIZE;
|
||||
float yoffset = (float(tileY)-32)*GRID_SIZE;
|
||||
float xoffset = (float(tileX) - 32) * GRID_SIZE;
|
||||
float yoffset = (float(tileY) - 32) * GRID_SIZE;
|
||||
|
||||
float coord[3];
|
||||
int row, col;
|
||||
|
|
@ -235,10 +235,10 @@ namespace MMAP
|
|||
col = i % V9_SIZE;
|
||||
|
||||
if (row < lheader.offsetY || row >= lheader.offsetY + lheader.height ||
|
||||
col < lheader.offsetX || col >= lheader.offsetX + lheader.width)
|
||||
col < lheader.offsetX || col >= lheader.offsetX + lheader.width)
|
||||
{
|
||||
// dummy vert using invalid height
|
||||
meshData.liquidVerts.append((xoffset+col*GRID_PART_SIZE)*-1, INVALID_MAP_LIQ_HEIGHT, (yoffset+row*GRID_PART_SIZE)*-1);
|
||||
meshData.liquidVerts.append((xoffset + col * GRID_PART_SIZE) * -1, INVALID_MAP_LIQ_HEIGHT, (yoffset + row * GRID_PART_SIZE) * -1);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -255,7 +255,7 @@ namespace MMAP
|
|||
{
|
||||
row = i / V9_SIZE;
|
||||
col = i % V9_SIZE;
|
||||
meshData.liquidVerts.append((xoffset+col*GRID_PART_SIZE)*-1, lheader.liquidLevel, (yoffset+row*GRID_PART_SIZE)*-1);
|
||||
meshData.liquidVerts.append((xoffset + col * GRID_PART_SIZE) * -1, lheader.liquidLevel, (yoffset + row * GRID_PART_SIZE) * -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -263,11 +263,11 @@ namespace MMAP
|
|||
|
||||
int indices[3], loopStart, loopEnd, loopInc, triInc;
|
||||
getLoopVars(portion, loopStart, loopEnd, loopInc);
|
||||
triInc = BOTTOM-TOP;
|
||||
triInc = BOTTOM - TOP;
|
||||
|
||||
// generate triangles
|
||||
for (int i = loopStart; i < loopEnd; i+=loopInc)
|
||||
for (int j = TOP; j <= BOTTOM; j+= triInc)
|
||||
for (int i = loopStart; i < loopEnd; i += loopInc)
|
||||
for (int j = TOP; j <= BOTTOM; j += triInc)
|
||||
{
|
||||
getHeightTriangle(i, Spot(j), indices, true);
|
||||
ltriangles.append(indices[2] + count);
|
||||
|
|
@ -296,14 +296,14 @@ namespace MMAP
|
|||
// make a copy of liquid vertices
|
||||
// used to pad right-bottom frame due to lost vertex data at extraction
|
||||
float* lverts_copy = NULL;
|
||||
if(meshData.liquidVerts.size())
|
||||
if (meshData.liquidVerts.size())
|
||||
{
|
||||
lverts_copy = new float[meshData.liquidVerts.size()];
|
||||
memcpy(lverts_copy, lverts, sizeof(float)*meshData.liquidVerts.size());
|
||||
}
|
||||
|
||||
getLoopVars(portion, loopStart, loopEnd, loopInc);
|
||||
for (int i = loopStart; i < loopEnd; i+=loopInc)
|
||||
for (int i = loopStart; i < loopEnd; i += loopInc)
|
||||
{
|
||||
for (int j = 0; j < 2; ++j)
|
||||
{
|
||||
|
|
@ -314,7 +314,7 @@ namespace MMAP
|
|||
|
||||
// if there is no liquid, don't use liquid
|
||||
if (!liquid_type || !meshData.liquidVerts.size() || !ltriangles.size())
|
||||
useLiquid = false;
|
||||
useLiquid = false;
|
||||
else
|
||||
{
|
||||
liquidType = getLiquidType(i, liquid_type);
|
||||
|
|
@ -352,10 +352,10 @@ namespace MMAP
|
|||
{
|
||||
float quadHeight = 0;
|
||||
uint32 validCount = 0;
|
||||
for(uint32 idx = 0; idx < 3; idx++)
|
||||
for (uint32 idx = 0; idx < 3; idx++)
|
||||
{
|
||||
float h = lverts_copy[ltris[idx]*3 + 1];
|
||||
if(h != INVALID_MAP_LIQ_HEIGHT && h < INVALID_MAP_LIQ_HEIGHT_MAX)
|
||||
float h = lverts_copy[ltris[idx] * 3 + 1];
|
||||
if (h != INVALID_MAP_LIQ_HEIGHT && h < INVALID_MAP_LIQ_HEIGHT_MAX)
|
||||
{
|
||||
quadHeight += h;
|
||||
validCount++;
|
||||
|
|
@ -363,19 +363,19 @@ namespace MMAP
|
|||
}
|
||||
|
||||
// update vertex height data
|
||||
if(validCount > 0 && validCount < 3)
|
||||
if (validCount > 0 && validCount < 3)
|
||||
{
|
||||
quadHeight /= validCount;
|
||||
for(uint32 idx = 0; idx < 3; idx++)
|
||||
for (uint32 idx = 0; idx < 3; idx++)
|
||||
{
|
||||
float h = lverts[ltris[idx]*3 + 1];
|
||||
if(h == INVALID_MAP_LIQ_HEIGHT || h > INVALID_MAP_LIQ_HEIGHT_MAX)
|
||||
lverts[ltris[idx]*3 + 1] = quadHeight;
|
||||
float h = lverts[ltris[idx] * 3 + 1];
|
||||
if (h == INVALID_MAP_LIQ_HEIGHT || h > INVALID_MAP_LIQ_HEIGHT_MAX)
|
||||
lverts[ltris[idx] * 3 + 1] = quadHeight;
|
||||
}
|
||||
}
|
||||
|
||||
// no valid vertexes - don't use this poly at all
|
||||
if(validCount == 0)
|
||||
if (validCount == 0)
|
||||
useLiquid = false;
|
||||
}
|
||||
|
||||
|
|
@ -388,34 +388,34 @@ namespace MMAP
|
|||
{
|
||||
float minLLevel = INVALID_MAP_LIQ_HEIGHT_MAX;
|
||||
float maxLLevel = INVALID_MAP_LIQ_HEIGHT;
|
||||
for(uint32 x = 0; x < 3; x++)
|
||||
for (uint32 x = 0; x < 3; x++)
|
||||
{
|
||||
float h = lverts[ltris[x]*3 + 1];
|
||||
if(minLLevel > h)
|
||||
float h = lverts[ltris[x] * 3 + 1];
|
||||
if (minLLevel > h)
|
||||
minLLevel = h;
|
||||
|
||||
if(maxLLevel < h)
|
||||
if (maxLLevel < h)
|
||||
maxLLevel = h;
|
||||
}
|
||||
|
||||
float maxTLevel = INVALID_MAP_LIQ_HEIGHT;
|
||||
float minTLevel = INVALID_MAP_LIQ_HEIGHT_MAX;
|
||||
for(uint32 x = 0; x < 6; x++)
|
||||
for (uint32 x = 0; x < 6; x++)
|
||||
{
|
||||
float h = tverts[ttris[x]*3 + 1];
|
||||
if(maxTLevel < h)
|
||||
maxTLevel = h;
|
||||
float h = tverts[ttris[x] * 3 + 1];
|
||||
if (maxTLevel < h)
|
||||
maxTLevel = h;
|
||||
|
||||
if(minTLevel > h)
|
||||
minTLevel = h;
|
||||
if (minTLevel > h)
|
||||
minTLevel = h;
|
||||
}
|
||||
|
||||
// terrain under the liquid?
|
||||
if(minLLevel > maxTLevel)
|
||||
if (minLLevel > maxTLevel)
|
||||
useTerrain = false;
|
||||
|
||||
//liquid under the terrain?
|
||||
if(minTLevel > maxLLevel)
|
||||
if (minTLevel > maxLLevel)
|
||||
useLiquid = false;
|
||||
}
|
||||
|
||||
|
|
@ -428,16 +428,16 @@ namespace MMAP
|
|||
}
|
||||
|
||||
if (useTerrain)
|
||||
for (int k = 0; k < 3*tTriCount/2; ++k)
|
||||
for (int k = 0; k < 3 * tTriCount / 2; ++k)
|
||||
meshData.solidTris.append(ttris[k]);
|
||||
|
||||
// advance to next set of triangles
|
||||
ltris += 3;
|
||||
ttris += 3*tTriCount/2;
|
||||
ttris += 3 * tTriCount / 2;
|
||||
}
|
||||
}
|
||||
|
||||
if(lverts_copy)
|
||||
if (lverts_copy)
|
||||
delete [] lverts_copy;
|
||||
|
||||
return meshData.solidTris.size() || meshData.liquidTris.size();
|
||||
|
|
@ -451,13 +451,13 @@ namespace MMAP
|
|||
switch (grid)
|
||||
{
|
||||
case GRID_V9:
|
||||
coord[0] = (xOffset + index%(V9_SIZE)*GRID_PART_SIZE) * -1.f;
|
||||
coord[1] = (yOffset + (int)(index/(V9_SIZE))*GRID_PART_SIZE) * -1.f;
|
||||
coord[0] = (xOffset + index % (V9_SIZE) * GRID_PART_SIZE) * -1.f;
|
||||
coord[1] = (yOffset + (int)(index / (V9_SIZE)) * GRID_PART_SIZE) * -1.f;
|
||||
coord[2] = v[index];
|
||||
break;
|
||||
case GRID_V8:
|
||||
coord[0] = (xOffset + index%(V8_SIZE)*GRID_PART_SIZE + GRID_PART_SIZE/2.f) * -1.f;
|
||||
coord[1] = (yOffset + (int)(index/(V8_SIZE))*GRID_PART_SIZE + GRID_PART_SIZE/2.f) * -1.f;
|
||||
coord[0] = (xOffset + index % (V8_SIZE) * GRID_PART_SIZE + GRID_PART_SIZE / 2.f) * -1.f;
|
||||
coord[1] = (yOffset + (int)(index / (V8_SIZE)) * GRID_PART_SIZE + GRID_PART_SIZE / 2.f) * -1.f;
|
||||
coord[2] = v[index];
|
||||
break;
|
||||
}
|
||||
|
|
@ -466,44 +466,45 @@ namespace MMAP
|
|||
/**************************************************************************/
|
||||
void TerrainBuilder::getHeightTriangle(int square, Spot triangle, int* indices, bool liquid/* = false*/)
|
||||
{
|
||||
int rowOffset = square/V8_SIZE;
|
||||
int rowOffset = square / V8_SIZE;
|
||||
if (!liquid)
|
||||
switch (triangle)
|
||||
{
|
||||
case TOP:
|
||||
indices[0] = square+rowOffset; // 0-----1 .... 128
|
||||
indices[1] = square+1+rowOffset; // |\ T /|
|
||||
indices[2] = (V9_SIZE_SQ)+square; // | \ / |
|
||||
indices[0] = square + rowOffset; // 0-----1 .... 128
|
||||
indices[1] = square + 1 + rowOffset; // |\ T /|
|
||||
indices[2] = (V9_SIZE_SQ) + square; // | \ / |
|
||||
break; // |L 0 R| .. 127
|
||||
case LEFT: // | / \ |
|
||||
indices[0] = square+rowOffset; // |/ B \|
|
||||
indices[1] = (V9_SIZE_SQ)+square; // 129---130 ... 386
|
||||
indices[2] = square+V9_SIZE+rowOffset; // |\ /|
|
||||
indices[0] = square + rowOffset; // |/ B \|
|
||||
indices[1] = (V9_SIZE_SQ) + square; // 129---130 ... 386
|
||||
indices[2] = square + V9_SIZE + rowOffset; // |\ /|
|
||||
break; // | \ / |
|
||||
case RIGHT: // | 128 | .. 255
|
||||
indices[0] = square+1+rowOffset; // | / \ |
|
||||
indices[1] = square+V9_SIZE+1+rowOffset; // |/ \|
|
||||
indices[2] = (V9_SIZE_SQ)+square; // 258---259 ... 515
|
||||
indices[0] = square + 1 + rowOffset; // | / \ |
|
||||
indices[1] = square + V9_SIZE + 1 + rowOffset; // |/ \|
|
||||
indices[2] = (V9_SIZE_SQ) + square; // 258---259 ... 515
|
||||
break;
|
||||
case BOTTOM:
|
||||
indices[0] = (V9_SIZE_SQ)+square;
|
||||
indices[1] = square+V9_SIZE+1+rowOffset;
|
||||
indices[2] = square+V9_SIZE+rowOffset;
|
||||
indices[0] = (V9_SIZE_SQ) + square;
|
||||
indices[1] = square + V9_SIZE + 1 + rowOffset;
|
||||
indices[2] = square + V9_SIZE + rowOffset;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
else
|
||||
switch (triangle)
|
||||
{ // 0-----1 .... 128
|
||||
{
|
||||
// 0-----1 .... 128
|
||||
case TOP: // |\ |
|
||||
indices[0] = square+rowOffset; // | \ T |
|
||||
indices[1] = square+1+rowOffset; // | \ |
|
||||
indices[2] = square+V9_SIZE+1+rowOffset; // | B \ |
|
||||
indices[0] = square + rowOffset; // | \ T |
|
||||
indices[1] = square + 1 + rowOffset; // | \ |
|
||||
indices[2] = square + V9_SIZE + 1 + rowOffset; // | B \ |
|
||||
break; // | \|
|
||||
case BOTTOM: // 129---130 ... 386
|
||||
indices[0] = square+rowOffset; // |\ |
|
||||
indices[1] = square+V9_SIZE+1+rowOffset; // | \ |
|
||||
indices[2] = square+V9_SIZE+rowOffset; // | \ |
|
||||
indices[0] = square + rowOffset; // |\ |
|
||||
indices[1] = square + V9_SIZE + 1 + rowOffset; // | \ |
|
||||
indices[2] = square + V9_SIZE + rowOffset; // | \ |
|
||||
break; // | \ |
|
||||
default: break; // | \|
|
||||
} // 258---259 ... 515
|
||||
|
|
@ -515,8 +516,8 @@ namespace MMAP
|
|||
{
|
||||
// wow coords: x, y, height
|
||||
// coord is mirroed about the horizontal axes
|
||||
coord[0] = (xOffset + index%(V9_SIZE)*GRID_PART_SIZE) * -1.f;
|
||||
coord[1] = (yOffset + (int)(index/(V9_SIZE))*GRID_PART_SIZE) * -1.f;
|
||||
coord[0] = (xOffset + index % (V9_SIZE) * GRID_PART_SIZE) * -1.f;
|
||||
coord[1] = (yOffset + (int)(index / (V9_SIZE)) * GRID_PART_SIZE) * -1.f;
|
||||
coord[2] = v[index2];
|
||||
}
|
||||
|
||||
|
|
@ -550,7 +551,7 @@ namespace MMAP
|
|||
}
|
||||
|
||||
/**************************************************************************/
|
||||
bool TerrainBuilder::loadVMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData)
|
||||
bool TerrainBuilder::loadVMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData)
|
||||
{
|
||||
IVMapManager* vmapManager = new VMapManager2();
|
||||
VMAPLoadResult result = vmapManager->loadMap("vmaps", mapID, tileX, tileY);
|
||||
|
|
@ -594,10 +595,10 @@ namespace MMAP
|
|||
|
||||
// transform data
|
||||
float scale = instance.iScale;
|
||||
G3D::Matrix3 rotation = G3D::Matrix3::fromEulerAnglesXYZ(G3D::pi()*instance.iRot.z/-180.f, G3D::pi()*instance.iRot.x/-180.f, G3D::pi()*instance.iRot.y/-180.f);
|
||||
G3D::Matrix3 rotation = G3D::Matrix3::fromEulerAnglesXYZ(G3D::pi() * instance.iRot.z / -180.f, G3D::pi() * instance.iRot.x / -180.f, G3D::pi() * instance.iRot.y / -180.f);
|
||||
Vector3 position = instance.iPos;
|
||||
position.x -= 32*GRID_SIZE;
|
||||
position.y -= 32*GRID_SIZE;
|
||||
position.x -= 32 * GRID_SIZE;
|
||||
position.y -= 32 * GRID_SIZE;
|
||||
|
||||
for (vector<GroupModel>::iterator it = groupModels.begin(); it != groupModels.end(); ++it)
|
||||
{
|
||||
|
|
@ -655,7 +656,7 @@ namespace MMAP
|
|||
for (uint32 x = 0; x < vertsX; ++x)
|
||||
for (uint32 y = 0; y < vertsY; ++y)
|
||||
{
|
||||
vert = Vector3(corner.x + x * GRID_PART_SIZE, corner.y + y * GRID_PART_SIZE, data[y*vertsX + x]);
|
||||
vert = Vector3(corner.x + x * GRID_PART_SIZE, corner.y + y * GRID_PART_SIZE, data[y * vertsX + x]);
|
||||
vert = vert * rotation * scale + position;
|
||||
vert.x *= -1.f;
|
||||
vert.y *= -1.f;
|
||||
|
|
@ -666,13 +667,13 @@ namespace MMAP
|
|||
uint32 square;
|
||||
for (uint32 x = 0; x < tilesX; ++x)
|
||||
for (uint32 y = 0; y < tilesY; ++y)
|
||||
if ((flags[x+y*tilesX] & 0x0f) != 0x0f)
|
||||
if ((flags[x + y * tilesX] & 0x0f) != 0x0f)
|
||||
{
|
||||
square = x * tilesY + y;
|
||||
idx1 = square+x;
|
||||
idx2 = square+1+x;
|
||||
idx3 = square+tilesY+1+1+x;
|
||||
idx4 = square+tilesY+1+x;
|
||||
idx1 = square + x;
|
||||
idx2 = square + 1 + x;
|
||||
idx3 = square + tilesY + 1 + 1 + x;
|
||||
idx4 = square + tilesY + 1 + x;
|
||||
|
||||
// top triangle
|
||||
liqTris.push_back(idx3);
|
||||
|
|
@ -690,7 +691,7 @@ namespace MMAP
|
|||
|
||||
for (uint32 i = 0; i < liqTris.size() / 3; ++i)
|
||||
{
|
||||
meshData.liquidTris.append(liqTris[i*3+1] + liqOffset, liqTris[i*3+2] + liqOffset, liqTris[i*3] + liqOffset);
|
||||
meshData.liquidTris.append(liqTris[i * 3 + 1] + liqOffset, liqTris[i * 3 + 2] + liqOffset, liqTris[i * 3] + liqOffset);
|
||||
meshData.liquidType.append(type);
|
||||
}
|
||||
}
|
||||
|
|
@ -706,7 +707,7 @@ namespace MMAP
|
|||
}
|
||||
|
||||
/**************************************************************************/
|
||||
void TerrainBuilder::transform(vector<Vector3> &source, vector<Vector3> &transformedVertices, float scale, G3D::Matrix3 &rotation, Vector3 &position)
|
||||
void TerrainBuilder::transform(vector<Vector3>& source, vector<Vector3>& transformedVertices, float scale, G3D::Matrix3& rotation, Vector3& position)
|
||||
{
|
||||
for (vector<Vector3>::iterator it = source.begin(); it != source.end(); ++it)
|
||||
{
|
||||
|
|
@ -719,7 +720,7 @@ namespace MMAP
|
|||
}
|
||||
|
||||
/**************************************************************************/
|
||||
void TerrainBuilder::copyVertices(vector<Vector3> &source, G3D::Array<float> &dest)
|
||||
void TerrainBuilder::copyVertices(vector<Vector3>& source, G3D::Array<float>& dest)
|
||||
{
|
||||
for (vector<Vector3>::iterator it = source.begin(); it != source.end(); ++it)
|
||||
{
|
||||
|
|
@ -730,30 +731,30 @@ namespace MMAP
|
|||
}
|
||||
|
||||
/**************************************************************************/
|
||||
void TerrainBuilder::copyIndices(vector<MeshTriangle> &source, G3D::Array<int> &dest, int offset, bool flip)
|
||||
void TerrainBuilder::copyIndices(vector<MeshTriangle>& source, G3D::Array<int>& dest, int offset, bool flip)
|
||||
{
|
||||
if (flip)
|
||||
{
|
||||
for (vector<MeshTriangle>::iterator it = source.begin(); it != source.end(); ++it)
|
||||
{
|
||||
dest.push_back((*it).idx2+offset);
|
||||
dest.push_back((*it).idx1+offset);
|
||||
dest.push_back((*it).idx0+offset);
|
||||
dest.push_back((*it).idx2 + offset);
|
||||
dest.push_back((*it).idx1 + offset);
|
||||
dest.push_back((*it).idx0 + offset);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (vector<MeshTriangle>::iterator it = source.begin(); it != source.end(); ++it)
|
||||
{
|
||||
dest.push_back((*it).idx0+offset);
|
||||
dest.push_back((*it).idx1+offset);
|
||||
dest.push_back((*it).idx2+offset);
|
||||
dest.push_back((*it).idx0 + offset);
|
||||
dest.push_back((*it).idx1 + offset);
|
||||
dest.push_back((*it).idx2 + offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
void TerrainBuilder::copyIndices(G3D::Array<int> &source, G3D::Array<int> &dest, int offset)
|
||||
void TerrainBuilder::copyIndices(G3D::Array<int>& source, G3D::Array<int>& dest, int offset)
|
||||
{
|
||||
int* src = source.getCArray();
|
||||
for (int32 i = 0; i < source.size(); ++i)
|
||||
|
|
@ -761,7 +762,7 @@ namespace MMAP
|
|||
}
|
||||
|
||||
/**************************************************************************/
|
||||
void TerrainBuilder::cleanVertices(G3D::Array<float> &verts, G3D::Array<int> &tris)
|
||||
void TerrainBuilder::cleanVertices(G3D::Array<float>& verts, G3D::Array<int>& tris)
|
||||
{
|
||||
map<int, int> vertMap;
|
||||
|
||||
|
|
@ -784,7 +785,7 @@ namespace MMAP
|
|||
{
|
||||
index = (*it).first;
|
||||
(*it).second = count;
|
||||
cleanVerts.append(v[index*3], v[index*3+1], v[index*3+2]);
|
||||
cleanVerts.append(v[index * 3], v[index * 3 + 1], v[index * 3 + 2]);
|
||||
count++;
|
||||
}
|
||||
verts.fastClear();
|
||||
|
|
@ -805,10 +806,10 @@ namespace MMAP
|
|||
}
|
||||
|
||||
/**************************************************************************/
|
||||
void TerrainBuilder::loadOffMeshConnections(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData, const char* offMeshFilePath)
|
||||
void TerrainBuilder::loadOffMeshConnections(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, const char* offMeshFilePath)
|
||||
{
|
||||
// no meshfile input given?
|
||||
if(offMeshFilePath == NULL)
|
||||
if (offMeshFilePath == NULL)
|
||||
return;
|
||||
|
||||
FILE* fp = fopen(offMeshFilePath, "rb");
|
||||
|
|
@ -821,16 +822,16 @@ namespace MMAP
|
|||
// pretty silly thing, as we parse entire file and load only the tile we need
|
||||
// but we don't expect this file to be too large
|
||||
char* buf = new char[512];
|
||||
while(fgets(buf, 512, fp))
|
||||
while (fgets(buf, 512, fp))
|
||||
{
|
||||
float p0[3], p1[3];
|
||||
int mid, tx, ty;
|
||||
float size;
|
||||
if(10 != sscanf(buf, "%d %d,%d (%f %f %f) (%f %f %f) %f", &mid, &tx, &ty,
|
||||
&p0[0], &p0[1], &p0[2], &p1[0], &p1[1], &p1[2], &size))
|
||||
if (10 != sscanf(buf, "%d %d,%d (%f %f %f) (%f %f %f) %f", &mid, &tx, &ty,
|
||||
&p0[0], &p0[1], &p0[2], &p1[0], &p1[1], &p1[2], &size))
|
||||
continue;
|
||||
|
||||
if(mapID == mid, tileX == tx, tileY == ty)
|
||||
if (mapID == mid, tileX == tx, tileY == ty)
|
||||
{
|
||||
meshData.offMeshConnections.append(p0[1]);
|
||||
meshData.offMeshConnections.append(p0[2]);
|
||||
|
|
|
|||
|
|
@ -49,11 +49,11 @@ namespace MMAP
|
|||
};
|
||||
|
||||
static const int V9_SIZE = 129;
|
||||
static const int V9_SIZE_SQ = V9_SIZE*V9_SIZE;
|
||||
static const int V9_SIZE_SQ = V9_SIZE* V9_SIZE;
|
||||
static const int V8_SIZE = 128;
|
||||
static const int V8_SIZE_SQ = V8_SIZE*V8_SIZE;
|
||||
static const int V8_SIZE_SQ = V8_SIZE* V8_SIZE;
|
||||
static const float GRID_SIZE = 533.33333f;
|
||||
static const float GRID_PART_SIZE = GRID_SIZE/V8_SIZE;
|
||||
static const float GRID_PART_SIZE = GRID_SIZE / V8_SIZE;
|
||||
|
||||
// see contrib/extractor/system.cpp, CONF_use_minHeight
|
||||
static const float INVALID_MAP_LIQ_HEIGHT = -500.f;
|
||||
|
|
@ -62,7 +62,7 @@ namespace MMAP
|
|||
// see following files:
|
||||
// contrib/extractor/system.cpp
|
||||
// src/game/GridMap.cpp
|
||||
static char const* MAP_VERSION_MAGIC = "v1.2";
|
||||
static char const* MAP_VERSION_MAGIC = "c1.3";
|
||||
|
||||
struct MeshData
|
||||
{
|
||||
|
|
@ -87,31 +87,31 @@ namespace MMAP
|
|||
TerrainBuilder(bool skipLiquid);
|
||||
~TerrainBuilder();
|
||||
|
||||
void loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData);
|
||||
bool loadVMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData);
|
||||
void loadOffMeshConnections(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData, const char* offMeshFilePath);
|
||||
void loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData);
|
||||
bool loadVMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData);
|
||||
void loadOffMeshConnections(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, const char* offMeshFilePath);
|
||||
|
||||
bool usesLiquids() { return !m_skipLiquid; }
|
||||
|
||||
// vert and triangle methods
|
||||
static void transform(vector<G3D::Vector3> &original, vector<G3D::Vector3> &transformed,
|
||||
float scale, G3D::Matrix3 &rotation, G3D::Vector3 &position);
|
||||
static void copyVertices(vector<G3D::Vector3> &source, G3D::Array<float> &dest);
|
||||
static void copyIndices(vector<VMAP::MeshTriangle> &source, G3D::Array<int> &dest, int offest, bool flip);
|
||||
static void copyIndices(G3D::Array<int> &src, G3D::Array<int> &dest, int offset);
|
||||
static void cleanVertices(G3D::Array<float> &verts, G3D::Array<int> &tris);
|
||||
static void transform(vector<G3D::Vector3>& original, vector<G3D::Vector3>& transformed,
|
||||
float scale, G3D::Matrix3& rotation, G3D::Vector3& position);
|
||||
static void copyVertices(vector<G3D::Vector3>& source, G3D::Array<float>& dest);
|
||||
static void copyIndices(vector<VMAP::MeshTriangle>& source, G3D::Array<int>& dest, int offest, bool flip);
|
||||
static void copyIndices(G3D::Array<int>& src, G3D::Array<int>& dest, int offset);
|
||||
static void cleanVertices(G3D::Array<float>& verts, G3D::Array<int>& tris);
|
||||
private:
|
||||
/// Loads a portion of a map's terrain
|
||||
bool loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData, Spot portion);
|
||||
bool loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, Spot portion);
|
||||
|
||||
/// Sets loop variables for selecting only certain parts of a map's terrain
|
||||
void getLoopVars(Spot portion, int &loopStart, int &loopEnd, int &loopInc);
|
||||
void getLoopVars(Spot portion, int& loopStart, int& loopEnd, int& loopInc);
|
||||
|
||||
/// Controls whether liquids are loaded
|
||||
bool m_skipLiquid;
|
||||
|
||||
/// Load the map terrain from file
|
||||
bool loadHeightMap(uint32 mapID, uint32 tileX, uint32 tileY, G3D::Array<float> &vertices, G3D::Array<int> &triangles, Spot portion);
|
||||
bool loadHeightMap(uint32 mapID, uint32 tileX, uint32 tileY, G3D::Array<float>& vertices, G3D::Array<int>& triangles, Spot portion);
|
||||
|
||||
/// Get the vector coordinate for a specific position
|
||||
void getHeightCoord(int index, Grid grid, float xOffset, float yOffset, float* coord, float* v);
|
||||
|
|
@ -130,7 +130,7 @@ namespace MMAP
|
|||
|
||||
// hide parameterless and copy constructor
|
||||
TerrainBuilder();
|
||||
TerrainBuilder(const TerrainBuilder &tb);
|
||||
TerrainBuilder(const TerrainBuilder& tb);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,26 +31,26 @@ namespace VMAP
|
|||
// maybe add MapBuilder as friend to all of the below classes would be better?
|
||||
|
||||
// declared in src/shared/vmap/MapTree.h
|
||||
void StaticMapTree::getModelInstances(ModelInstance* &models, uint32 &count)
|
||||
void StaticMapTree::getModelInstances(ModelInstance*& models, uint32& count)
|
||||
{
|
||||
models = iTreeValues;
|
||||
count = iNTreeValues;
|
||||
}
|
||||
|
||||
// declared in src/shared/vmap/VMapManager2.h
|
||||
void VMapManager2::getInstanceMapTree(InstanceTreeMap &instanceMapTree)
|
||||
void VMapManager2::getInstanceMapTree(InstanceTreeMap& instanceMapTree)
|
||||
{
|
||||
instanceMapTree = iInstanceMapTrees;
|
||||
}
|
||||
|
||||
// declared in src/shared/vmap/WorldModel.h
|
||||
void WorldModel::getGroupModels(vector<GroupModel> &groupModels)
|
||||
void WorldModel::getGroupModels(vector<GroupModel>& groupModels)
|
||||
{
|
||||
groupModels = this->groupModels;
|
||||
}
|
||||
|
||||
// declared in src/shared/vmap/WorldModel.h
|
||||
void GroupModel::getMeshData(vector<Vector3> &vertices, vector<MeshTriangle> &triangles, WmoLiquid* &liquid)
|
||||
void GroupModel::getMeshData(vector<Vector3>& vertices, vector<MeshTriangle>& triangles, WmoLiquid*& liquid)
|
||||
{
|
||||
vertices = this->vertices;
|
||||
triangles = this->triangles;
|
||||
|
|
@ -64,7 +64,7 @@ namespace VMAP
|
|||
}
|
||||
|
||||
// declared in src/shared/vmap/WorldModel.h
|
||||
void WmoLiquid::getPosInfo(uint32 &tilesX, uint32 &tilesY, Vector3 &corner) const
|
||||
void WmoLiquid::getPosInfo(uint32& tilesX, uint32& tilesY, Vector3& corner) const
|
||||
{
|
||||
tilesX = iTilesX;
|
||||
tilesY = iTilesY;
|
||||
|
|
|
|||
|
|
@ -58,19 +58,40 @@ bool checkDirectories(bool debugOutput)
|
|||
return true;
|
||||
}
|
||||
|
||||
void printUsage()
|
||||
{
|
||||
printf("Generator command line args\n\n");
|
||||
printf("-? : This help\n");
|
||||
printf("[#] : Build only the map specified by #.\n");
|
||||
printf("--maxAngle [#] : Max walkable inclination angle\n");
|
||||
printf("--tile [#,#] : Build the specified tile\n");
|
||||
printf("--skipLiquid [true|false] : liquid data for maps\n");
|
||||
printf("--skipContinents [true|false] : skip continents\n");
|
||||
printf("--skipJunkMaps [true|false] : junk maps include some unused\n");
|
||||
printf("--skipBattlegrounds [true|false] : does not include PVP arenas\n");
|
||||
printf("--debugOutput [true|false] : create debugging files for use with RecastDemo\n");
|
||||
printf("--bigBaseUnit [true|false] : Generate tile/map using bigger basic unit.\n");
|
||||
printf("--silent : Make script friendly. No wait for user input, error, completion.\n");
|
||||
printf("--offMeshInput [file.*] : Path to file containing off mesh connections data.\n\n");
|
||||
printf("Exemple:\nmovemapgen (generate all mmap with default arg\n"
|
||||
"movemapgen 0 (generate map 0)\n"
|
||||
"movemapgen --tile 34,46 (builds only tile 34,46 of map 0)\n\n");
|
||||
printf("Please read readme file for more information and exemples.\n");
|
||||
}
|
||||
|
||||
bool handleArgs(int argc, char** argv,
|
||||
int &mapnum,
|
||||
int &tileX,
|
||||
int &tileY,
|
||||
float &maxAngle,
|
||||
bool &skipLiquid,
|
||||
bool &skipContinents,
|
||||
bool &skipJunkMaps,
|
||||
bool &skipBattlegrounds,
|
||||
bool &debugOutput,
|
||||
bool &silent,
|
||||
bool &bigBaseUnit,
|
||||
char* &offMeshInputPath)
|
||||
int& mapnum,
|
||||
int& tileX,
|
||||
int& tileY,
|
||||
float& maxAngle,
|
||||
bool& skipLiquid,
|
||||
bool& skipContinents,
|
||||
bool& skipJunkMaps,
|
||||
bool& skipBattlegrounds,
|
||||
bool& debugOutput,
|
||||
bool& silent,
|
||||
bool& bigBaseUnit,
|
||||
char*& offMeshInputPath)
|
||||
{
|
||||
char* param = NULL;
|
||||
for (int i = 1; i < argc; ++i)
|
||||
|
|
@ -122,7 +143,7 @@ bool handleArgs(int argc, char** argv,
|
|||
else
|
||||
printf("invalid option for '--skipLiquid', using default\n");
|
||||
}
|
||||
else if(strcmp(argv[i], "--skipContinents") == 0)
|
||||
else if (strcmp(argv[i], "--skipContinents") == 0)
|
||||
{
|
||||
param = argv[++i];
|
||||
if (!param)
|
||||
|
|
@ -199,6 +220,11 @@ bool handleArgs(int argc, char** argv,
|
|||
|
||||
offMeshInputPath = param;
|
||||
}
|
||||
else if (strcmp(argv[i], "-?") == 0)
|
||||
{
|
||||
printUsage();
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
int map = atoi(argv[i]);
|
||||
|
|
@ -242,7 +268,7 @@ int main(int argc, char** argv)
|
|||
debugOutput, silent, bigBaseUnit, offMeshInputPath);
|
||||
|
||||
if (!validParam)
|
||||
return silent ? -1 : finish("You have specified invalid parameters", -1);
|
||||
return silent ? -1 : finish("You have specified invalid parameters (use -? for more help)", -1);
|
||||
|
||||
if (mapnum == -1 && debugOutput)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MoveMapGen", "VC110\MoveMapGen_VC110.vcxproj", "{8028C1F8-4C3E-44D4-96D7-1D6F51B7AB47}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}
|
||||
|
|
|
|||
|
|
@ -12,9 +12,8 @@
|
|||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{8028C1F8-4C3E-44D4-96D7-1D6F51B7AB47}</ProjectGuid>
|
||||
<RootNamespace>MoveMapGen_VC100</RootNamespace>
|
||||
<RootNamespace>MoveMapGen_VC110</RootNamespace>
|
||||
<ProjectName>MoveMapGen</ProjectName>
|
||||
<VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and $(VisualStudioVersion) == ''">$(VCTargetsPath11)</VCTargetsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
|
|
@ -139,16 +138,16 @@
|
|||
<ClInclude Include="..\..\src\IntermediateValues.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\dep\recastnavigation\Detour\win\VC100\Detour.vcxproj">
|
||||
<ProjectReference Include="..\..\..\..\dep\recastnavigation\Detour\win\VC110\Detour.vcxproj">
|
||||
<Project>{72bdf975-4d4a-42c7-b2c4-f9ed90a2abb6}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\dep\recastnavigation\Recast\win\VC100\Recast.vcxproj">
|
||||
<ProjectReference Include="..\..\..\..\dep\recastnavigation\Recast\win\VC110\Recast.vcxproj">
|
||||
<Project>{00b9dc66-96a6-465d-a6c1-5dff94e48a64}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\win\VC100\g3dlite.vcxproj">
|
||||
<ProjectReference Include="..\..\..\..\win\VC110\g3dlite.vcxproj">
|
||||
<Project>{8072769e-cf10-48bf-b9e1-12752a5dac6e}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\win\VC100\zlib.vcxproj">
|
||||
<ProjectReference Include="..\..\..\..\win\VC110\zlib.vcxproj">
|
||||
<Project>{8f1dea42-6a5b-4b62-839d-c141a7bfacf2}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ typedef vector<string> T_TableList;
|
|||
typedef map< string, T_Table > TDataBase;
|
||||
|
||||
static
|
||||
void pg_notice(void *arg, const char *message)
|
||||
void pg_notice(void* arg, const char* message)
|
||||
{
|
||||
/// Do nothing
|
||||
//printf("%s\n", message);
|
||||
|
|
@ -90,19 +90,19 @@ string ConvertNativeType(enum_field_types mysqlType, uint32 length)
|
|||
return "integer";
|
||||
case FIELD_TYPE_LONGLONG:
|
||||
case FIELD_TYPE_LONG:
|
||||
{
|
||||
string temp;
|
||||
char str[10];
|
||||
temp = "numeric";
|
||||
if (length)
|
||||
{
|
||||
string temp;
|
||||
char str[10];
|
||||
temp = "numeric";
|
||||
if (length)
|
||||
{
|
||||
temp.append("(");
|
||||
sprintf(str,"%d",length);
|
||||
temp.append(str);
|
||||
temp.append(")");
|
||||
}
|
||||
return temp;
|
||||
temp.append("(");
|
||||
sprintf(str, "%d", length);
|
||||
temp.append(str);
|
||||
temp.append(")");
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
case FIELD_TYPE_DECIMAL:
|
||||
case FIELD_TYPE_FLOAT:
|
||||
case FIELD_TYPE_DOUBLE:
|
||||
|
|
@ -115,7 +115,7 @@ string ConvertNativeType(enum_field_types mysqlType, uint32 length)
|
|||
if (length)
|
||||
{
|
||||
temp.append("(");
|
||||
sprintf(str,"%d",length);
|
||||
sprintf(str, "%d", length);
|
||||
temp.append(str);
|
||||
temp.append(")");
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ string ConvertNativeType(enum_field_types mysqlType, uint32 length)
|
|||
if (length)
|
||||
{
|
||||
temp.append("(");
|
||||
sprintf(str,"%d",length);
|
||||
sprintf(str, "%d", length);
|
||||
temp.append(str);
|
||||
temp.append(")");
|
||||
}
|
||||
|
|
@ -144,7 +144,7 @@ string ConvertNativeType(enum_field_types mysqlType, uint32 length)
|
|||
inline
|
||||
bool IsNeeedEscapeString(enum_field_types mysqlType)
|
||||
{
|
||||
switch(mysqlType)
|
||||
switch (mysqlType)
|
||||
{
|
||||
case FIELD_TYPE_VAR_STRING:
|
||||
case FIELD_TYPE_STRING:
|
||||
|
|
@ -160,22 +160,22 @@ bool IsNeeedEscapeString(enum_field_types mysqlType)
|
|||
}
|
||||
|
||||
inline
|
||||
void PG_Exec_str(string sql, PGconn *mPGconn)
|
||||
void PG_Exec_str(string sql, PGconn* mPGconn)
|
||||
{
|
||||
PGresult *res = PQexec (mPGconn, sql.c_str());
|
||||
PGresult* res = PQexec(mPGconn, sql.c_str());
|
||||
if (PQresultStatus(res) != PGRES_COMMAND_OK)
|
||||
{
|
||||
printf( "SQL: %s", sql.c_str() );
|
||||
printf( "SQL %s", PQerrorMessage(mPGconn) );
|
||||
printf("SQL: %s", sql.c_str());
|
||||
printf("SQL %s", PQerrorMessage(mPGconn));
|
||||
}
|
||||
}
|
||||
|
||||
void PG_Escape_Str(string& str)
|
||||
{
|
||||
if(str.empty())
|
||||
if (str.empty())
|
||||
return;
|
||||
char* buf = new char[str.size()*2+1];
|
||||
PQescapeString(buf,str.c_str(),str.size());
|
||||
char* buf = new char[str.size() * 2 + 1];
|
||||
PQescapeString(buf, str.c_str(), str.size());
|
||||
str = buf;
|
||||
delete[] buf;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,32 +22,32 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
char sPGhost[26], sPGport[26], sPGdb[26], sPGuser[26], sPGpass[26];
|
||||
printf("Postgres connection settings\n Host>");
|
||||
scanf("%s",sPGhost);
|
||||
scanf("%s", sPGhost);
|
||||
printf(" Port>");
|
||||
scanf("%s",sPGport);
|
||||
scanf("%s", sPGport);
|
||||
printf(" Base>");
|
||||
scanf("%s",sPGdb);
|
||||
scanf("%s", sPGdb);
|
||||
printf(" User>");
|
||||
scanf("%s",sPGuser);
|
||||
scanf("%s", sPGuser);
|
||||
printf(" Pass>");
|
||||
scanf("%s",sPGpass);
|
||||
scanf("%s", sPGpass);
|
||||
|
||||
///////////////////////////////
|
||||
///////PGSQL Connect///////////
|
||||
///////////////////////////////
|
||||
PGconn *mPGconn=NULL;
|
||||
mPGconn = PQsetdbLogin(sPGhost,sPGport, NULL, NULL, sPGdb, sPGuser, sPGpass);
|
||||
PGconn* mPGconn = NULL;
|
||||
mPGconn = PQsetdbLogin(sPGhost, sPGport, NULL, NULL, sPGdb, sPGuser, sPGpass);
|
||||
|
||||
if (PQstatus(mPGconn) != CONNECTION_OK)
|
||||
{
|
||||
printf("Could not connect to Postgre database at [%s]: \n %s\n",sPGhost, PQerrorMessage(mPGconn));
|
||||
printf("Could not connect to Postgre database at [%s]: \n %s\n", sPGhost, PQerrorMessage(mPGconn));
|
||||
PQfinish(mPGconn);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Connected to Postgre database at [%s]\n", sPGhost);
|
||||
printf(" PostgreSQL server ver: [%d]\n\n",PQserverVersion(mPGconn));
|
||||
printf(" PostgreSQL server ver: [%d]\n\n", PQserverVersion(mPGconn));
|
||||
}
|
||||
|
||||
/// Set dummy notice processor
|
||||
|
|
@ -56,53 +56,53 @@ int main(int argc, char* argv[])
|
|||
///////////////////////////////
|
||||
///////MySQL Connect///////////
|
||||
///////////////////////////////
|
||||
MYSQL *mysqlInit;
|
||||
MYSQL* mysqlInit;
|
||||
mysqlInit = mysql_init(NULL);
|
||||
if (!mysqlInit)
|
||||
{
|
||||
printf( "Could not initialize Mysql connection\n" );
|
||||
printf("Could not initialize Mysql connection\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
char sMYhost[26], sMYdb[26], sMYuser[26], sMYpass[26];
|
||||
int iMYport;
|
||||
printf("Mysql connection settings \n Host>");
|
||||
scanf("%s",sMYhost);
|
||||
scanf("%s", sMYhost);
|
||||
printf(" Port>");
|
||||
scanf("%d",&iMYport);
|
||||
scanf("%d", &iMYport);
|
||||
printf(" Base>");
|
||||
scanf("%s",sMYdb);
|
||||
scanf("%s", sMYdb);
|
||||
printf(" User>");
|
||||
scanf("%s",sMYuser);
|
||||
scanf("%s", sMYuser);
|
||||
printf(" Pass>");
|
||||
scanf("%s",sMYpass);
|
||||
scanf("%s", sMYpass);
|
||||
|
||||
mysql_options(mysqlInit,MYSQL_SET_CHARSET_NAME,"utf8");
|
||||
mysql_options(mysqlInit, MYSQL_SET_CHARSET_NAME, "utf8");
|
||||
|
||||
MYSQL *mMysql;
|
||||
MYSQL* mMysql;
|
||||
mMysql = mysql_real_connect(mysqlInit, sMYhost, sMYuser, sMYpass, sMYdb, iMYport, NULL, 0);
|
||||
|
||||
if (mMysql)
|
||||
{
|
||||
printf( "Connected to MySQL database at [%s] \n", sMYhost);
|
||||
printf( " MySQL client library: [%s] \n", mysql_get_client_info());
|
||||
printf( " MySQL server ver: [%s] \n\n", mysql_get_server_info( mMysql));
|
||||
printf("Connected to MySQL database at [%s] \n", sMYhost);
|
||||
printf(" MySQL client library: [%s] \n", mysql_get_client_info());
|
||||
printf(" MySQL server ver: [%s] \n\n", mysql_get_server_info(mMysql));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Could not connect to MySQL database at [%s]:\n %s\n", sMYhost ,mysql_error(mysqlInit));
|
||||
printf("Could not connect to MySQL database at [%s]:\n %s\n", sMYhost , mysql_error(mysqlInit));
|
||||
mysql_close(mysqlInit);
|
||||
return 1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
MYSQL_RES *result = NULL;
|
||||
MYSQL_RES* result = NULL;
|
||||
MYSQL_ROW row;
|
||||
MYSQL_FIELD *fields = NULL;
|
||||
MYSQL_FIELD* fields = NULL;
|
||||
uint64 rowCount = 0;
|
||||
uint32 fieldCount =0;
|
||||
result = mysql_list_tables( mMysql , NULL );
|
||||
uint32 fieldCount = 0;
|
||||
result = mysql_list_tables(mMysql , NULL);
|
||||
rowCount = mysql_num_rows(result);
|
||||
|
||||
/***********************/
|
||||
|
|
@ -110,9 +110,9 @@ int main(int argc, char* argv[])
|
|||
/***********************/
|
||||
T_TableList mTableList;
|
||||
mTableList.reserve((size_t)rowCount);
|
||||
while( (row = mysql_fetch_row(result)) !=NULL )
|
||||
while ((row = mysql_fetch_row(result)) != NULL)
|
||||
{
|
||||
for (uint32 i = 0;i<mysql_num_fields(result);i++)
|
||||
for (uint32 i = 0; i < mysql_num_fields(result); i++)
|
||||
{
|
||||
mTableList.push_back(row[i]);
|
||||
}
|
||||
|
|
@ -125,13 +125,13 @@ int main(int argc, char* argv[])
|
|||
T_Table m_Table;
|
||||
TDataBase m_DataBase_Map;
|
||||
m_DataBase_Map.clear();
|
||||
for (uint32 j=0; j<mTableList.size();++j)
|
||||
for (uint32 j = 0; j < mTableList.size(); ++j)
|
||||
{
|
||||
result = mysql_list_fields(mMysql, mTableList[j].c_str(), NULL);
|
||||
fieldCount = mysql_num_fields(result);
|
||||
fields = mysql_fetch_fields(result);
|
||||
|
||||
for (uint32 i=0; i<fieldCount;++i)
|
||||
for (uint32 i = 0; i < fieldCount; ++i)
|
||||
{
|
||||
sField mfield;
|
||||
mfield.name = fields[i].name;
|
||||
|
|
@ -139,7 +139,7 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
mfield.def = "NULL";
|
||||
}
|
||||
else if (!strcmp(fields[i].def,"0000-00-00 00:00:00"))
|
||||
else if (!strcmp(fields[i].def, "0000-00-00 00:00:00"))
|
||||
{
|
||||
/// Convert MySQL Default timestamp to PGSQL Default timestamp
|
||||
mfield.def.append("'1970-01-01 00:00:00'");
|
||||
|
|
@ -151,7 +151,7 @@ int main(int argc, char* argv[])
|
|||
mfield.def.append(fields[i].def);;
|
||||
mfield.def.append("'");
|
||||
}
|
||||
mfield.type = ConvertNativeType(fields[i].type,fields[i].length);
|
||||
mfield.type = ConvertNativeType(fields[i].type, fields[i].length);
|
||||
mfield.flags = fields[i].flags;
|
||||
m_Table.push_back(mfield);
|
||||
}
|
||||
|
|
@ -169,31 +169,31 @@ int main(int argc, char* argv[])
|
|||
for (citr = m_DataBase_Map.begin(); citr != m_DataBase_Map.end(); ++citr)
|
||||
{
|
||||
ostringstream sql_str;
|
||||
sql_str<<"DROP TABLE IF EXISTS "<<(*citr).first.c_str()<<";\n";
|
||||
sql_str<<"CREATE TABLE "<<(*citr).first.c_str()<<"(\n";
|
||||
sql_str << "DROP TABLE IF EXISTS " << (*citr).first.c_str() << ";\n";
|
||||
sql_str << "CREATE TABLE " << (*citr).first.c_str() << "(\n";
|
||||
|
||||
T_Table::const_iterator v_iter;
|
||||
ostringstream prim_key_str;
|
||||
ostringstream index_str;
|
||||
for (v_iter = (*citr).second.begin();
|
||||
v_iter != (*citr).second.end();
|
||||
++v_iter)
|
||||
v_iter != (*citr).second.end();
|
||||
++v_iter)
|
||||
{
|
||||
sql_str<<" "<<(*v_iter).name;
|
||||
if (((*v_iter).flags & AUTO_INCREMENT_FLAG)!=0)
|
||||
sql_str << " " << (*v_iter).name;
|
||||
if (((*v_iter).flags & AUTO_INCREMENT_FLAG) != 0)
|
||||
{
|
||||
/// AUTO_INCREMENT fields not have "default" data
|
||||
sql_str<<" bigserial";
|
||||
sql_str << " bigserial";
|
||||
}
|
||||
else
|
||||
{
|
||||
sql_str<<" "<<(*v_iter).type;
|
||||
sql_str<<" default "<<(*v_iter).def;
|
||||
sql_str << " " << (*v_iter).type;
|
||||
sql_str << " default " << (*v_iter).def;
|
||||
}
|
||||
/// IF column have PRIMARY KEY flag then use column in PRIMARY KEY
|
||||
if (IS_PRI_KEY( (*v_iter).flags )!=0)
|
||||
if (IS_PRI_KEY((*v_iter).flags) != 0)
|
||||
{
|
||||
if( prim_key_str.str().size())
|
||||
if (prim_key_str.str().size())
|
||||
prim_key_str << ", ";
|
||||
else
|
||||
{
|
||||
|
|
@ -205,9 +205,9 @@ int main(int argc, char* argv[])
|
|||
prim_key_str << (*v_iter).name;
|
||||
prim_key_str << " PRIMARY KEY (";
|
||||
}
|
||||
prim_key_str<<(*v_iter).name;
|
||||
prim_key_str << (*v_iter).name;
|
||||
}
|
||||
else if (((*v_iter).flags & MULTIPLE_KEY_FLAG)!=0)
|
||||
else if (((*v_iter).flags & MULTIPLE_KEY_FLAG) != 0)
|
||||
{
|
||||
/// IF column have INDEX flag then create INDEX
|
||||
index_str << "CREATE INDEX idx_";
|
||||
|
|
@ -220,7 +220,7 @@ int main(int argc, char* argv[])
|
|||
index_str << (*v_iter).name;
|
||||
index_str << ");\n";
|
||||
}
|
||||
else if (((*v_iter).flags & UNIQUE_KEY_FLAG)!=0)
|
||||
else if (((*v_iter).flags & UNIQUE_KEY_FLAG) != 0)
|
||||
{
|
||||
/// IF column have UNIQUE INDEX flag then create INDEX
|
||||
index_str << "CREATE UNIQUE INDEX uidx_";
|
||||
|
|
@ -234,29 +234,29 @@ int main(int argc, char* argv[])
|
|||
index_str << ");\n";
|
||||
}
|
||||
/// don't output "," for last column
|
||||
if(v_iter + 1 != (*citr).second.end())
|
||||
sql_str<< ",\n";
|
||||
if (v_iter + 1 != (*citr).second.end())
|
||||
sql_str << ",\n";
|
||||
else
|
||||
sql_str<< "\n";
|
||||
sql_str << "\n";
|
||||
}
|
||||
sql_str<< ")\n";
|
||||
sql_str << ")\n";
|
||||
|
||||
/// Out Table structure
|
||||
PG_Exec_str(sql_str.str(),mPGconn);
|
||||
PG_Exec_str(sql_str.str(), mPGconn);
|
||||
|
||||
/// out PRIMARY KEY
|
||||
if(prim_key_str.str().size())
|
||||
if (prim_key_str.str().size())
|
||||
{
|
||||
prim_key_str<<")";
|
||||
PG_Exec_str(prim_key_str.str(),mPGconn);
|
||||
prim_key_str << ")";
|
||||
PG_Exec_str(prim_key_str.str(), mPGconn);
|
||||
}
|
||||
|
||||
/// out INDEX's
|
||||
if (index_str.str().size())
|
||||
PG_Exec_str(index_str.str(),mPGconn);
|
||||
PG_Exec_str(index_str.str(), mPGconn);
|
||||
|
||||
++count;
|
||||
printf("Convert [%d] tables...\r",count);
|
||||
printf("Convert [%d] tables...\r", count);
|
||||
}
|
||||
printf("Completed the conversion of [%d] tables!\n", count);
|
||||
|
||||
|
|
@ -265,18 +265,18 @@ int main(int argc, char* argv[])
|
|||
/****************/
|
||||
|
||||
count = 0;
|
||||
for (uint32 j=0; j<mTableList.size();++j)
|
||||
for (uint32 j = 0; j < mTableList.size(); ++j)
|
||||
{
|
||||
ostringstream sql_str;
|
||||
sql_str << "SELECT * FROM ";
|
||||
sql_str << mTableList[j].c_str();
|
||||
|
||||
if (mysql_query(mysqlInit,sql_str.str().c_str()) )
|
||||
if (mysql_query(mysqlInit, sql_str.str().c_str()))
|
||||
continue;
|
||||
if (!(result = mysql_store_result(mysqlInit)))
|
||||
continue;
|
||||
|
||||
while ((row = mysql_fetch_row(result))!=NULL)
|
||||
while ((row = mysql_fetch_row(result)) != NULL)
|
||||
{
|
||||
ostringstream insert_str;
|
||||
insert_str << "INSERT INTO ";
|
||||
|
|
@ -299,7 +299,7 @@ int main(int argc, char* argv[])
|
|||
insert_str << field_str.c_str();
|
||||
insert_str << "'";
|
||||
}
|
||||
else if (!strcmp(row[i],"0000-00-00 00:00:00"))
|
||||
else if (!strcmp(row[i], "0000-00-00 00:00:00"))
|
||||
{
|
||||
/// Convert MySQL timestamp to PGSQL timestamp
|
||||
insert_str << "'1970-01-01 00:00:00'";
|
||||
|
|
@ -313,18 +313,18 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
/// don't output "," for last column
|
||||
if(i + 1 != fieldCount )
|
||||
insert_str<< ",";
|
||||
if (i + 1 != fieldCount)
|
||||
insert_str << ",";
|
||||
else
|
||||
insert_str<< ")\n";
|
||||
insert_str << ")\n";
|
||||
}
|
||||
PG_Exec_str(insert_str.str(), mPGconn);
|
||||
}
|
||||
mysql_free_result(result);
|
||||
++count;
|
||||
printf("Copied data from [%d] tables...\r",count);
|
||||
printf("Copied data from [%d] tables...\r", count);
|
||||
}
|
||||
printf("Finished copying the data from [%d] tables!\n",count);
|
||||
printf("Finished copying the data from [%d] tables!\n", count);
|
||||
mTableList.clear();
|
||||
m_DataBase_Map.clear();
|
||||
|
||||
|
|
@ -336,4 +336,3 @@ int main(int argc, char* argv[])
|
|||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
218
contrib/vmap_assembler/VC110/vmap_assembler.vcxproj
Normal file
218
contrib/vmap_assembler/VC110/vmap_assembler.vcxproj
Normal file
|
|
@ -0,0 +1,218 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{572FFF74-480C-4472-8ABF-81733BB4049D}</ProjectGuid>
|
||||
<RootNamespace>vmap_assembler</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\bin\$(Platform)_$(Configuration)\</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\bin\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\bin\$(ProjectName)__$(Platform)_$(Configuration)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\bin\$(ProjectName)__$(Platform)_$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\bin\$(Platform)_$(Configuration)\</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\bin\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\bin\$(ProjectName)__$(Platform)_$(Configuration)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\bin\$(ProjectName)__$(Platform)_$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\dep\include\g3dlite;..\..\..\src\shared;..\..\..\src\game\vmap;..\..\..\src\framework;..\..\..\dep\ACE_wrappers;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;NO_CORE_FUNCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)vmap_assembler.exe</OutputFile>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
</IgnoreSpecificDefaultLibraries>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<AdditionalLibraryDirectories>
|
||||
</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\dep\include\g3dlite;..\..\..\src\shared;..\..\..\src\game\vmap;..\..\..\src\framework;..\..\..\dep\ACE_wrappers;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;NO_CORE_FUNCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)vmap_assembler.exe</OutputFile>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
</IgnoreSpecificDefaultLibraries>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\..\dep\include\g3dlite;..\..\..\src\shared;..\..\..\src\game\vmap;..\..\..\src\framework;..\..\..\dep\ACE_wrappers;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;NO_CORE_FUNCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)vmap_assembler.exe</OutputFile>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\..\dep\include\g3dlite;..\..\..\src\shared;..\..\..\src\game\vmap;..\..\..\src\framework;..\..\..\dep\ACE_wrappers;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;NO_CORE_FUNCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)vmap_assembler.exe</OutputFile>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\vmap_assembler.cpp" />
|
||||
<ClCompile Include="..\..\..\src\game\vmap\BIH.cpp" />
|
||||
<ClCompile Include="..\..\..\src\game\vmap\MapTree.cpp" />
|
||||
<ClCompile Include="..\..\..\src\game\vmap\ModelInstance.cpp" />
|
||||
<ClCompile Include="..\..\..\src\game\vmap\TileAssembler.cpp" />
|
||||
<ClCompile Include="..\..\..\src\game\vmap\VMapManager2.cpp" />
|
||||
<ClCompile Include="..\..\..\src\game\vmap\WorldModel.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\src\game\vmap\BIH.h" />
|
||||
<ClInclude Include="..\..\..\src\game\vmap\MapTree.h" />
|
||||
<ClInclude Include="..\..\..\src\game\vmap\ModelInstance.h" />
|
||||
<ClInclude Include="..\..\..\src\game\vmap\TileAssembler.h" />
|
||||
<ClInclude Include="..\..\..\src\game\vmap\VMapManager2.h" />
|
||||
<ClInclude Include="..\..\..\src\game\vmap\VMapTools.h" />
|
||||
<ClInclude Include="..\..\..\src\game\vmap\WorldModel.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\win\VC110\g3dlite.vcxproj">
|
||||
<Project>{8072769e-cf10-48bf-b9e1-12752a5dac6e}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\win\VC110\zlib.vcxproj">
|
||||
<Project>{8f1dea42-6a5b-4b62-839d-c141a7bfacf2}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
//=======================================================
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if(argc != 3)
|
||||
if (argc != 3)
|
||||
{
|
||||
std::cout << "usage: " << argv[0] << " <raw data dir> <vmap dest dir>" << std::endl;
|
||||
return 1;
|
||||
|
|
@ -37,7 +37,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
VMAP::TileAssembler* ta = new VMAP::TileAssembler(src, dest);
|
||||
|
||||
if(!ta->convertWorld2())
|
||||
if (!ta->convertWorld2())
|
||||
{
|
||||
std::cout << "exit with errors" << std::endl;
|
||||
delete ta;
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
The default files for ACE_LITE were amended in this commit: https://github.com/mangos/mangosDeps/commit/52e4c984dbca474f7a4353b444339067a95ea277
|
||||
|
||||
The same changes need to be reapplied if a new version is added.
|
||||
|
||||
The following two lines were amended to fix a connection bottleneck (especially on Linux):
|
||||
- ACE_DEFAULT_BACKLOG - Change 5 to 128 https://github.com/mangos/mangosDeps/blob/Rel21/acelite/ace/Default_Constants.h#L81
|
||||
- ACE_DEFAULT_ASYNCH_BACKLOG - Change 5 to 128 https://github.com/mangos/mangosDeps/blob/Rel21/acelite/ace/Default_Constants.h#L85
|
||||
|
||||
For MacOS X, the ACE_UINT64_TYPE should be defined as follows in `ace/config-macosx-leopard.h`
|
||||
```
|
||||
#define ACE_UINT64_TYPE unsigned long long
|
||||
```
|
||||
|
||||
To get Travis CI working with `macos10.12` and `xcode8.3`, the following changes should be made to `ace/config-macosx-yosemite.h`
|
||||
```diff
|
||||
#include "ace/config-macosx-mavericks.h"
|
||||
+#undef ACE_LACKS_CLOCKID_T
|
||||
+#undef ACE_LACKS_CLOCK_MONOTONIC
|
||||
+#undef ACE_LACKS_CLOCK_REALTIME
|
||||
```
|
||||
|
||||
March 7th, 2018 - To build ACE as static library, one has to add the following line to the global CMakeLists.txt
|
||||
```
|
||||
add_definitions(-DACE_AS_STATIC_LIBS)
|
||||
```
|
||||
|
|
@ -53,20 +53,12 @@ if(WIN32 AND MSVC)
|
|||
ALWAYS 0
|
||||
)
|
||||
elseif(UNIX)
|
||||
if(CMAKE_BUILD_TOOL MATCHES "/gmake")
|
||||
set(ACE_BUILD_TOOL gmake)
|
||||
else()
|
||||
set(ACE_BUILD_TOOL make)
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(ACE_Project
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}
|
||||
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
|
||||
DOWNLOAD_COMMAND ""
|
||||
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR> --disable-ssl
|
||||
BUILD_COMMAND ${ACE_BUILD_TOOL} -j2 # export arch="ia32" &&
|
||||
INSTALL_COMMAND ${ACE_BUILD_TOOL} install
|
||||
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/configure --prefix=${CMAKE_INSTALL_PREFIX} --disable-ssl
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
#
|
||||
# This code is part of MaNGOS. Contributor & Copyright details are in AUTHORS/THANKS.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
|
|
@ -14,7 +13,6 @@
|
|||
# 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
|
||||
#
|
||||
|
||||
if(NOT (TBB_USE_EXTERNAL OR USE_STD_MALLOC))
|
||||
add_subdirectory(tbb)
|
||||
|
|
|
|||
|
|
@ -1,58 +0,0 @@
|
|||
June 16, 2019
|
||||
- revert some ACE changes which badly affected threads in FreeBSD
|
||||
|
||||
May 27, 2019
|
||||
- fixed TomLib::Crypt build on VS
|
||||
- fixed Detour/Recast CMake configuration
|
||||
- assuring STATIC generation of libraries for ZLIB::ZLIB, BZIP2::BZIP2 and mpqlib
|
||||
|
||||
May 17,2019
|
||||
- removed useless files from ACE
|
||||
|
||||
May 15, 2019
|
||||
- added PCH support for ACE
|
||||
|
||||
May 10th, 2019
|
||||
- cleaned up libmpq
|
||||
- bzip2 version raised to 1.0.6
|
||||
- zlib version raised to 1.2.11
|
||||
- root CMakeLists.txt logic improved
|
||||
- revert some FreBSD patches
|
||||
|
||||
May 3rd, 2019
|
||||
- added missing sources to ACE CMakeLists.txt
|
||||
- fixed ACE_SIZE_T_FORMAT_SPECIFIER for FreeBSD
|
||||
- applied FreeBSD 12+ patches from ports collection to ACE
|
||||
|
||||
May 2nd, 2019
|
||||
- fixed a typo which prevented ACE to be built as static lib
|
||||
- added _WANT_SEMUN compiler definition for ACE when build on FreeBSD 12+
|
||||
- removed __fastcall attribute from G3D sources
|
||||
- removed redundant zlib and bzip2 sources from stormlib
|
||||
- added TomCrypt and TomMath as static libs for future removal of OpenSSL
|
||||
- changed CmakeLists.txt files to proper show header files on IDEs
|
||||
- removed mersenne source code
|
||||
|
||||
January 16th, 2019
|
||||
- ACE is built as static library by default.
|
||||
- Fixed ACE_HAS_CPP11/14 defines for compatibility with other compilers.
|
||||
- added support for FreeBSD on stormlib
|
||||
|
||||
March 7th, 2018
|
||||
- To build ACE as static library, one has to add the following line to the global CMakeLists.txt
|
||||
'add_definitions(-DACE_AS_STATIC_LIBS)'
|
||||
|
||||
2017 and older
|
||||
- The default files for ACE_LITE were amended in commit: https://github.com/mangos/mangosDeps/commit/52e4c984dbca474f7a4353b444339067a95ea277
|
||||
- The same changes need to be reapplied if a new version is added.
|
||||
- The following two lines were amended to fix a connection bottleneck (especially on Linux):
|
||||
ACE_DEFAULT_BACKLOG - Change 5 to 128 https://github.com/mangos/mangosDeps/blob/Rel21/acelite/ace/Default_Constants.h#L81
|
||||
ACE_DEFAULT_ASYNCH_BACKLOG - Change 5 to 128 https://github.com/mangos/mangosDeps/blob/Rel21/acelite/ace/Default_Constants.h#L85
|
||||
- For MacOS X, the ACE_UINT64_TYPE should be defined as follows in `ace/config-macosx-leopard.h`
|
||||
#define ACE_UINT64_TYPE unsigned long long
|
||||
- To get Travis CI working with `macos10.12` and `xcode8.3`, the following changes should be made to `ace/config-macosx-yosemite.h`
|
||||
#include "ace/config-macosx-mavericks.h"
|
||||
#undef ACE_LACKS_CLOCKID_T
|
||||
#undef ACE_LACKS_CLOCK_MONOTONIC
|
||||
#undef ACE_LACKS_CLOCK_REALTIME
|
||||
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
<table border=0 cellpadding=0 cellspacing=0 valign='top'><tr>
|
||||
<td><a href='https://www.getmangos.eu' target='getmangos.eu'><img src='https://www.getmangos.eu/!assets_mangos/logo.png' border=0></a></td>
|
||||
<td valign='top'>
|
||||
<a href='https://www.getmangos.eu/forums/' target='getmangos.forum'><img src='/icons/FORUM.gif' border=0></a>
|
||||
<a href='https://www.getmangos.eu/wiki' target='getmangos.wiki'><img src='/icons/WIKI.gif' border=0></a>
|
||||
<a href='https://www.getmangos.eu/github-activity/' target='getmangos.activity'><img src='/icons/ACTIVITY.gif' border=0></a>
|
||||
<a href='https://www.getmangos.eu/bug-tracker/mangos-zero/' target='getmangos.tracker'><img src='/icons/TRACKER.gif' border=0></a>
|
||||
</td></tr></table>
|
||||
|
||||
Mangos Dependencies
|
||||
------------
|
||||
*Mangos* stands on the shoulders of well-known Open Source
|
||||
libraries, and a few awesome, but less known libraries to prevent us from
|
||||
inventing the wheel again.
|
||||
|
||||
*Please note that Linux and Mac OS X users should install packages using
|
||||
their systems package management instead of source packages.*
|
||||
|
||||
* **MySQL** / **PostgreSQL**: to store content, and user data, we rely on
|
||||
[MySQL][1]/[MariaDB][2] and [PostgreSQL][3] to handle data.
|
||||
* **ACE**: the [ADAPTIVE Communication Environment][4] aka. *ACE* provides us
|
||||
with a solid cross-platform framework for abstracting operating system
|
||||
specific details.
|
||||
* **Recast**: in order to create navigation data from the client's map files,
|
||||
we use [Recast][5] to do the dirty work. It provides functions for
|
||||
rendering, pathing, etc.
|
||||
* **G3D**: the [G3D][6] engine provides the basic framework for handling 3D
|
||||
data, and is used to handle basic map data.
|
||||
* **libmpq**: [libmpq][7] provides an abstraction layer for reading from the
|
||||
client's data files.
|
||||
* **Zlib**: [Zlib][12] ([Zlib for Windows][10]) provides compression algorithms
|
||||
used in both MPQ archive handling and the client/server protocol.
|
||||
* **Bzip2**: [Bzip2][13] ([Bzip2 for Windows][11]) provides compression
|
||||
algorithms used in MPQ archives.
|
||||
* **OpenSSL**: [OpenSSL][8] ([OpenSSL for Windows][14]) provides encryption
|
||||
algorithms used when authenticating clients.
|
||||
* **Lua**: [Lua 5.2][15] ([Lua 5.2 for Windows][16]) provides a convenient, fast
|
||||
scripting environment, which allows us to make live changes to scripted
|
||||
content.
|
||||
|
||||
*Recast*, *G3D* and *libmpq* are included in the *Mangos* distribution as
|
||||
we rely on specific versions. *libmpq* is to be replaced with *stormlib* shortly.
|
||||
|
||||
Optional dependencies
|
||||
---------------------
|
||||
|
||||
* **Doxygen**: if you want to export HTML or PDF formatted documentation for the
|
||||
*Mangos* API, you should install [Doxygen][9].
|
||||
|
||||
[1]: http://www.mysql.com/ "MySQL · The world's most popular open source database"
|
||||
[2]: http://www.mariadb.org/ "MariaDB · An enhanced, drop-in replacement for MySQL"
|
||||
[3]: http://www.postgresql.org/ "PostgreSQL · The world's most advanced open source database"
|
||||
[4]: http://www.cs.wustl.edu/~schmidt/ACE.html "ACE · The ADAPTIVE Communication Environment"
|
||||
[5]: http://github.com/memononen/recastnavigation "Recast · Navigation-mesh Toolset for Games"
|
||||
[6]: http://sourceforge.net/projects/g3d/ "G3D · G3D Innovation Engine"
|
||||
[7]: http://github.com/ge0rg/libmpq "libmpq · A library for reading data from MPQ archives"
|
||||
[8]: http://www.openssl.org/ "OpenSSL · The Open Source toolkit for SSL/TLS"
|
||||
[9]: http://www.stack.nl/~dimitri/doxygen/ "Doxygen · API documentation generator"
|
||||
[10]: http://gnuwin32.sourceforge.net/packages/zlib.htm "Zlib for Windows"
|
||||
[11]: http://gnuwin32.sourceforge.net/packages/bzip2.htm "Bzip2 for Windows"
|
||||
[12]: http://www.zlib.net/ "Zlib"
|
||||
[13]: http://www.bzip.org/ "Bzip2"
|
||||
[14]: http://slproweb.com/products/Win32OpenSSL.html "OpenSSL for Windows"
|
||||
[15]: http://www.lua.org/ "Lua"
|
||||
[16]: https://code.google.com/p/luaforwindows/ "Lua for Windows"
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 1999-2013 Ladislav Zezula
|
||||
|
||||
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.
|
||||
|
|
@ -1 +0,0 @@
|
|||
This is official repository for the StomLib library, an open-source project that can work with Blizzard MPQ archives.
|
||||
696
dep/StormLib/StormLib_vc110.vcxproj
Normal file
696
dep/StormLib/StormLib_vc110.vcxproj
Normal file
|
|
@ -0,0 +1,696 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="DebugAD|Win32">
|
||||
<Configuration>DebugAD</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="DebugAD|x64">
|
||||
<Configuration>DebugAD</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="DebugAS|Win32">
|
||||
<Configuration>DebugAS</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="DebugAS|x64">
|
||||
<Configuration>DebugAS</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="ReleaseAD|Win32">
|
||||
<Configuration>ReleaseAD</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="ReleaseAD|x64">
|
||||
<Configuration>ReleaseAD</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="ReleaseAS|Win32">
|
||||
<Configuration>ReleaseAS</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="ReleaseAS|x64">
|
||||
<Configuration>ReleaseAS</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>StormLib</ProjectName>
|
||||
<ProjectGuid>{78424708-1F6E-4D4B-920C-FB6D26847055}</ProjectGuid>
|
||||
<RootNamespace>StormLib</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">./bin/$(ProjectName)/$(Platform)/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">./bin/$(ProjectName)/$(Platform)/$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">./bin/$(ProjectName)/$(Platform)/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">./bin/$(ProjectName)/$(Platform)/$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">./bin/$(ProjectName)/$(Platform)/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">./bin/$(ProjectName)/$(Platform)/$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">./bin/$(ProjectName)/$(Platform)/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">./bin/$(ProjectName)/$(Platform)/$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">./bin/$(ProjectName)/$(Platform)/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">./bin/$(ProjectName)/$(Platform)/$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">./bin/$(ProjectName)/$(Platform)/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">./bin/$(ProjectName)/$(Platform)/$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">./bin/$(ProjectName)/$(Platform)/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">./bin/$(ProjectName)/$(Platform)/$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">./bin/$(ProjectName)/$(Platform)/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">./bin/$(ProjectName)/$(Platform)/$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'" />
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">$(ProjectName)RAS</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">$(ProjectName)DAD</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">$(ProjectName)DAS</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">$(ProjectName)RAD</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">$(ProjectName)DAD</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">$(ProjectName)DAS</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">$(ProjectName)RAD</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">$(ProjectName)RAS</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level1</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)$(ProjectName)DAD.lib</OutputFile>
|
||||
</Lib>
|
||||
<PostBuildEvent>
|
||||
<Command>StormLib.bat $(Platform) $(Configuration)</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level1</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)$(ProjectName)DAD.lib</OutputFile>
|
||||
</Lib>
|
||||
<PostBuildEvent>
|
||||
<Command>StormLib.bat $(Platform) $(Configuration)</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level1</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)$(ProjectName)DAS.lib</OutputFile>
|
||||
</Lib>
|
||||
<PostBuildEvent>
|
||||
<Command>StormLib.bat $(Platform) $(Configuration)</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level1</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)$(ProjectName)DAS.lib</OutputFile>
|
||||
</Lib>
|
||||
<PostBuildEvent>
|
||||
<Command>StormLib.bat $(Platform) $(Configuration)</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level1</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)$(ProjectName)RAD.lib</OutputFile>
|
||||
</Lib>
|
||||
<PostBuildEvent>
|
||||
<Command>StormLib.bat $(Platform) $(Configuration)</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level1</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)$(ProjectName)RAD.lib</OutputFile>
|
||||
</Lib>
|
||||
<PostBuildEvent>
|
||||
<Command>StormLib.bat $(Platform) $(Configuration)</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level1</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)$(ProjectName)RAS.lib</OutputFile>
|
||||
</Lib>
|
||||
<PostBuildEvent>
|
||||
<Command>StormLib.bat $(Platform) $(Configuration)</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level1</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)$(ProjectName)RAS.lib</OutputFile>
|
||||
</Lib>
|
||||
<PostBuildEvent>
|
||||
<Command>StormLib.bat $(Platform) $(Configuration)</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<None Include="doc\History.txt" />
|
||||
<None Include="doc\The MoPaQ File Format 0.9.txt" />
|
||||
<None Include="doc\The MoPaQ File Format 1.0.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\StormCommon.h" />
|
||||
<ClInclude Include="src\StormLib.h" />
|
||||
<ClInclude Include="src\StormPort.h" />
|
||||
<ClInclude Include="src\adpcm\adpcm.h" />
|
||||
<ClInclude Include="src\huffman\huff.h" />
|
||||
<ClInclude Include="src\pklib\pklib.h" />
|
||||
<ClInclude Include="src\sparse\sparse.h" />
|
||||
<ClInclude Include="src\jenkins\lookup.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\FileStream.cpp">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SBaseCommon.cpp">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SBaseFileTable.cpp">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SCompression.cpp">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SFileAddFile.cpp">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SFileAttributes.cpp">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SFileCompactArchive.cpp">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SFileCreateArchive.cpp">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SFileExtractFile.cpp">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SFileFindFile.cpp">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SFileListFile.cpp">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SFileOpenArchive.cpp">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SFileOpenFileEx.cpp">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SFilePatchArchives.cpp" />
|
||||
<ClCompile Include="src\SFileReadFile.cpp">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\SFileVerify.cpp">
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='DebugAS|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAD|x64'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|Win32'">Level4</WarningLevel>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='ReleaseAS|x64'">Level4</WarningLevel>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\adpcm\adpcm.cpp" />
|
||||
<ClCompile Include="src\bzip2\blocksort.c" />
|
||||
<ClCompile Include="src\bzip2\bzlib.c" />
|
||||
<ClCompile Include="src\bzip2\compress.c" />
|
||||
<ClCompile Include="src\bzip2\crctable.c" />
|
||||
<ClCompile Include="src\bzip2\decompress.c" />
|
||||
<ClCompile Include="src\bzip2\huffman.c" />
|
||||
<ClCompile Include="src\bzip2\randtable.c" />
|
||||
<ClCompile Include="src\huffman\huff.cpp" />
|
||||
<ClCompile Include="src\libtomcrypt\src\hashes\hash_memory.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\hashes\md5.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\hashes\sha1.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\math\ltm_desc.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\math\multi.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\math\rand_prime.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\misc\base64_decode.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\misc\crypt_argchk.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\misc\crypt_find_hash.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\misc\crypt_find_prng.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\misc\crypt_hash_descriptor.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\misc\crypt_hash_is_valid.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\misc\crypt_libc.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\misc\crypt_ltc_mp_descriptor.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\misc\crypt_prng_descriptor.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\misc\crypt_prng_is_valid.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\misc\crypt_register_hash.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\misc\crypt_register_prng.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\misc\zeromem.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_decode_bit_string.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_decode_boolean.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_decode_choice.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_decode_ia5_string.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_decode_integer.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_decode_object_identifier.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_decode_octet_string.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_decode_printable_string.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_decode_sequence_ex.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_decode_sequence_flexi.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_decode_sequence_multi.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_decode_short_integer.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_decode_utctime.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_decode_utf8_string.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_length_bit_string.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_length_boolean.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_length_ia5_string.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_length_integer.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_length_object_identifier.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_length_octet_string.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_length_printable_string.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_length_sequence.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_length_short_integer.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_length_utctime.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_length_utf8_string.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\asn1\der_sequence_free.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\ecc\ltc_ecc_map.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\ecc\ltc_ecc_mul2add.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\ecc\ltc_ecc_mulmod.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\ecc\ltc_ecc_points.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\ecc\ltc_ecc_projective_add_point.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\ecc\ltc_ecc_projective_dbl_point.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\pkcs1\pkcs_1_mgf1.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\pkcs1\pkcs_1_oaep_decode.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\pkcs1\pkcs_1_pss_decode.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\pkcs1\pkcs_1_v1_5_decode.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\rsa\rsa_exptmod.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\rsa\rsa_free.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\rsa\rsa_import.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\rsa\rsa_make_key.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\rsa\rsa_verify_hash.c" />
|
||||
<ClCompile Include="src\libtomcrypt\src\pk\rsa\rsa_verify_simple.c" />
|
||||
<ClCompile Include="src\libtommath\bn_fast_mp_invmod.c" />
|
||||
<ClCompile Include="src\libtommath\bn_fast_mp_montgomery_reduce.c" />
|
||||
<ClCompile Include="src\libtommath\bn_fast_s_mp_mul_digs.c" />
|
||||
<ClCompile Include="src\libtommath\bn_fast_s_mp_mul_high_digs.c" />
|
||||
<ClCompile Include="src\libtommath\bn_fast_s_mp_sqr.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_2expt.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_abs.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_add.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_add_d.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_addmod.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_and.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_clamp.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_clear.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_clear_multi.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_cmp.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_cmp_d.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_cmp_mag.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_cnt_lsb.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_copy.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_count_bits.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_div.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_div_2.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_div_2d.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_div_3.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_div_d.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_dr_is_modulus.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_dr_reduce.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_dr_setup.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_exch.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_expt_d.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_exptmod.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_exptmod_fast.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_exteuclid.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_fread.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_fwrite.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_gcd.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_get_int.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_grow.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_init.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_init_copy.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_init_multi.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_init_set.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_init_set_int.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_init_size.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_invmod.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_invmod_slow.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_is_square.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_jacobi.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_karatsuba_mul.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_karatsuba_sqr.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_lcm.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_lshd.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_mod.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_mod_2d.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_mod_d.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_montgomery_calc_normalization.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_montgomery_reduce.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_montgomery_setup.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_mul.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_mul_2.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_mul_2d.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_mul_d.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_mulmod.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_n_root.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_neg.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_or.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_prime_fermat.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_prime_is_divisible.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_prime_is_prime.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_prime_miller_rabin.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_prime_next_prime.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_prime_rabin_miller_trials.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_prime_random_ex.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_radix_size.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_radix_smap.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_rand.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_read_radix.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_read_signed_bin.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_read_unsigned_bin.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_reduce.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_reduce_2k.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_reduce_2k_l.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_reduce_2k_setup.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_reduce_2k_setup_l.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_reduce_is_2k.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_reduce_is_2k_l.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_reduce_setup.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_rshd.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_set.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_set_int.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_shrink.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_signed_bin_size.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_sqr.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_sqrmod.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_sqrt.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_sub.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_sub_d.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_submod.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_to_signed_bin.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_to_signed_bin_n.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_to_unsigned_bin.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_to_unsigned_bin_n.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_toom_mul.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_toom_sqr.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_toradix.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_toradix_n.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_unsigned_bin_size.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_xor.c" />
|
||||
<ClCompile Include="src\libtommath\bn_mp_zero.c" />
|
||||
<ClCompile Include="src\libtommath\bn_prime_tab.c" />
|
||||
<ClCompile Include="src\libtommath\bn_reverse.c" />
|
||||
<ClCompile Include="src\libtommath\bn_s_mp_add.c" />
|
||||
<ClCompile Include="src\libtommath\bn_s_mp_exptmod.c" />
|
||||
<ClCompile Include="src\libtommath\bn_s_mp_mul_digs.c" />
|
||||
<ClCompile Include="src\libtommath\bn_s_mp_mul_high_digs.c" />
|
||||
<ClCompile Include="src\libtommath\bn_s_mp_sqr.c" />
|
||||
<ClCompile Include="src\libtommath\bn_s_mp_sub.c" />
|
||||
<ClCompile Include="src\libtommath\bncore.c" />
|
||||
<ClCompile Include="src\lzma\C\LzFind.c" />
|
||||
<ClCompile Include="src\lzma\C\LzFindMt.c" />
|
||||
<ClCompile Include="src\lzma\C\LzmaDec.c" />
|
||||
<ClCompile Include="src\lzma\C\LzmaEnc.c" />
|
||||
<ClCompile Include="src\lzma\C\Threads.c" />
|
||||
<ClCompile Include="src\pklib\explode.c" />
|
||||
<ClCompile Include="src\pklib\implode.c" />
|
||||
<ClCompile Include="src\sparse\sparse.cpp" />
|
||||
<ClCompile Include="src\zlib\adler32.c" />
|
||||
<ClCompile Include="src\zlib\compress2.c" />
|
||||
<ClCompile Include="src\zlib\crc32.c" />
|
||||
<ClCompile Include="src\zlib\deflate.c" />
|
||||
<ClCompile Include="src\zlib\inffast.c" />
|
||||
<ClCompile Include="src\zlib\inflate.c" />
|
||||
<ClCompile Include="src\zlib\inftrees.c" />
|
||||
<ClCompile Include="src\zlib\trees.c" />
|
||||
<ClCompile Include="src\zlib\zutil.c" />
|
||||
<ClCompile Include="src\jenkins\lookup3.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
|
@ -1 +0,0 @@
|
|||
UCMXF6EJY352EFH4XFRXCFH2XC9MQRZK
|
||||
|
|
@ -1 +0,0 @@
|
|||
MMKVHY48RP7WXP4GHYBQ7SL9J9UNPHBP
|
||||
|
|
@ -1 +0,0 @@
|
|||
8MXLWHQ7VGGLTZ9MQZQSFDCLJYET3CPP
|
||||
|
|
@ -1 +0,0 @@
|
|||
EJ2R5TM6XFE2GUNG5QDGHKQ9UAKPWZSZ
|
||||
|
|
@ -1 +0,0 @@
|
|||
PBGFBE42Z6LNK65UGJQ3WZVMCLP4HQQT
|
||||
|
|
@ -1 +0,0 @@
|
|||
X7SEJJS9TSGCW5P28EBSC47AJPEY8VU2
|
||||
|
|
@ -1 +0,0 @@
|
|||
5KVBQA8VYE6XRY3DLGC5ZDE4XS4P7YA2
|
||||
|
|
@ -1 +0,0 @@
|
|||
478JD2K56EVNVVY4XX8TDWYT5B8KB254
|
||||
|
|
@ -1 +0,0 @@
|
|||
8TS4VNFQRZTN6YWHE9CHVDH9NVWD474A
|
||||
|
|
@ -1 +0,0 @@
|
|||
LJ52Z32DF4LZ4ZJJXVKK3AZQA6GABLJB
|
||||
|
|
@ -1 +0,0 @@
|
|||
K6BDHY2ECUE2545YKNLBJPVYWHE7XYAG
|
||||
|
|
@ -1 +0,0 @@
|
|||
6VWCQTN8V3ZZMRUCZXV8A8CGUX2TAA8H
|
||||
|
|
@ -1 +0,0 @@
|
|||
S48B6CDTN5XEQAKQDJNDLJBJ73FDFM3U
|
||||
|
|
@ -1 +0,0 @@
|
|||
Y45MD3CAK4KXSSXHYD9VY64Z8EKJ4XFX
|
||||
|
|
@ -1 +0,0 @@
|
|||
G8MN8UDG6NA2ANGY6A3DNY82HRGF29ZH
|
||||
|
|
@ -1 +0,0 @@
|
|||
3DH5RE5NVM5GTFD85LXGWT6FK859ETR5
|
||||
|
|
@ -1 +0,0 @@
|
|||
8WLKUAXE94PFQU4Y249PAZ24N4R4XKTQ
|
||||
|
|
@ -1 +0,0 @@
|
|||
A34DXX3VHGGXSQBRFE5UFFDXMF9G4G54
|
||||
|
|
@ -1 +0,0 @@
|
|||
ZG7J9K938HJEFWPQUA768MA2PFER6EAJ
|
||||
|
|
@ -1 +0,0 @@
|
|||
NE7CUNNNTVAPXV7E3G2BSVBWGVMW8BL2
|
||||
|
|
@ -1 +0,0 @@
|
|||
3V9E2FTMBM9QQWK7U6MAMWAZWQDB838F
|
||||
|
|
@ -1 +0,0 @@
|
|||
2NSFB8MELULJ83U6YHA3UP6K4MQD48L6
|
||||
|
|
@ -1 +0,0 @@
|
|||
QA2TZ9EWZ4CUU8BMB5WXCTY65F9CSW4E
|
||||
|
|
@ -1 +0,0 @@
|
|||
VHB378W64BAT9SH7D68VV9NLQDK9YEGT
|
||||
|
|
@ -1 +0,0 @@
|
|||
U3NFQJV4M6GC7KBN9XQJ3BRDN3PLD9NE
|
||||
|
|
@ -1,618 +0,0 @@
|
|||
/*****************************************************************************/
|
||||
/* SBaseSubTypes.cpp Copyright (c) Ladislav Zezula 2013 */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Conversion routines for archive formats that are similar to MPQ format */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Date Ver Who Comment */
|
||||
/* -------- ---- --- ------- */
|
||||
/* 02.11.11 1.00 Lad The first version of SBaseSubTypes.cpp */
|
||||
/*****************************************************************************/
|
||||
|
||||
#define __STORMLIB_SELF__
|
||||
#include "StormLib.h"
|
||||
#include "StormCommon.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Support for SQP file format (War of the Immortals) */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct _TSQPHeader
|
||||
{
|
||||
// The ID_MPQ ('MPQ\x1A') signature
|
||||
DWORD dwID;
|
||||
|
||||
// Size of the archive header
|
||||
DWORD dwHeaderSize;
|
||||
|
||||
// 32-bit size of MPQ archive
|
||||
DWORD dwArchiveSize;
|
||||
|
||||
// Offset to the beginning of the hash table, relative to the beginning of the archive.
|
||||
DWORD dwHashTablePos;
|
||||
|
||||
// Offset to the beginning of the block table, relative to the beginning of the archive.
|
||||
DWORD dwBlockTablePos;
|
||||
|
||||
// Number of entries in the hash table. Must be a power of two, and must be less than 2^16 for
|
||||
// the original MoPaQ format, or less than 2^20 for the Burning Crusade format.
|
||||
DWORD dwHashTableSize;
|
||||
|
||||
// Number of entries in the block table
|
||||
DWORD dwBlockTableSize;
|
||||
|
||||
// Must be zero for SQP files
|
||||
USHORT wFormatVersion;
|
||||
|
||||
// Power of two exponent specifying the number of 512-byte disk sectors in each file sector
|
||||
// in the archive. The size of each file sector in the archive is 512 * 2 ^ wSectorSize.
|
||||
USHORT wSectorSize;
|
||||
|
||||
} TSQPHeader;
|
||||
|
||||
typedef struct _TSQPHash
|
||||
{
|
||||
// Most likely the lcLocale+wPlatform.
|
||||
DWORD dwAlwaysZero;
|
||||
|
||||
// If the hash table entry is valid, this is the index into the block table of the file.
|
||||
// Otherwise, one of the following two values:
|
||||
// - FFFFFFFFh: Hash table entry is empty, and has always been empty.
|
||||
// Terminates searches for a given file.
|
||||
// - FFFFFFFEh: Hash table entry is empty, but was valid at some point (a deleted file).
|
||||
// Does not terminate searches for a given file.
|
||||
DWORD dwBlockIndex;
|
||||
|
||||
// The hash of the file path, using method A.
|
||||
DWORD dwName1;
|
||||
|
||||
// The hash of the file path, using method B.
|
||||
DWORD dwName2;
|
||||
|
||||
} TSQPHash;
|
||||
|
||||
typedef struct _TSQPBlock
|
||||
{
|
||||
// Offset of the beginning of the file, relative to the beginning of the archive.
|
||||
DWORD dwFilePos;
|
||||
|
||||
// Flags for the file. See MPQ_FILE_XXXX constants
|
||||
DWORD dwFlags;
|
||||
|
||||
// Compressed file size
|
||||
DWORD dwCSize;
|
||||
|
||||
// Uncompressed file size
|
||||
DWORD dwFSize;
|
||||
|
||||
} TSQPBlock;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Functions - SQP file format
|
||||
|
||||
// This function converts SQP file header into MPQ file header
|
||||
int ConvertSqpHeaderToFormat4(
|
||||
TMPQArchive * ha,
|
||||
ULONGLONG FileSize,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
TSQPHeader * pSqpHeader = (TSQPHeader *)ha->HeaderData;
|
||||
TMPQHeader Header;
|
||||
|
||||
// SQP files from War of the Immortal use MPQ file format with slightly
|
||||
// modified structure. These fields have different position:
|
||||
//
|
||||
// Offset TMPQHeader TSQPHeader
|
||||
// ------ ---------- -----------
|
||||
// 000C wFormatVersion dwHashTablePos (lo)
|
||||
// 000E wSectorSize dwHashTablePos (hi)
|
||||
// 001C dwBlockTableSize (lo) wBlockSize
|
||||
// 001E dwHashTableSize (hi) wFormatVersion
|
||||
|
||||
// Can't open the archive with certain flags
|
||||
if(dwFlags & MPQ_OPEN_FORCE_MPQ_V1)
|
||||
return ERROR_FILE_CORRUPT;
|
||||
|
||||
// The file must not be greater than 4 GB
|
||||
if((FileSize >> 0x20) != 0)
|
||||
return ERROR_FILE_CORRUPT;
|
||||
|
||||
// Translate the SQP header into a MPQ header
|
||||
memset(&Header, 0, sizeof(TMPQHeader));
|
||||
Header.dwID = BSWAP_INT32_UNSIGNED(pSqpHeader->dwID);
|
||||
Header.dwHeaderSize = BSWAP_INT32_UNSIGNED(pSqpHeader->dwHeaderSize);
|
||||
Header.dwArchiveSize = BSWAP_INT32_UNSIGNED(pSqpHeader->dwArchiveSize);
|
||||
Header.dwHashTablePos = BSWAP_INT32_UNSIGNED(pSqpHeader->dwHashTablePos);
|
||||
Header.dwBlockTablePos = BSWAP_INT32_UNSIGNED(pSqpHeader->dwBlockTablePos);
|
||||
Header.dwHashTableSize = BSWAP_INT32_UNSIGNED(pSqpHeader->dwHashTableSize);
|
||||
Header.dwBlockTableSize = BSWAP_INT32_UNSIGNED(pSqpHeader->dwBlockTableSize);
|
||||
Header.wFormatVersion = BSWAP_INT16_UNSIGNED(pSqpHeader->wFormatVersion);
|
||||
Header.wSectorSize = BSWAP_INT16_UNSIGNED(pSqpHeader->wSectorSize);
|
||||
|
||||
// Verify the SQP header
|
||||
if(Header.dwID == ID_MPQ && Header.dwHeaderSize == sizeof(TSQPHeader) && Header.dwArchiveSize == FileSize)
|
||||
{
|
||||
// Check for fixed values of version and sector size
|
||||
if(Header.wFormatVersion == MPQ_FORMAT_VERSION_1 && Header.wSectorSize == 3)
|
||||
{
|
||||
// Initialize the fields of 3.0 header
|
||||
Header.ArchiveSize64 = Header.dwArchiveSize;
|
||||
Header.HashTableSize64 = Header.dwHashTableSize * sizeof(TMPQHash);
|
||||
Header.BlockTableSize64 = Header.dwBlockTableSize * sizeof(TMPQBlock);
|
||||
|
||||
// Copy the converted MPQ header back
|
||||
memcpy(ha->HeaderData, &Header, sizeof(TMPQHeader));
|
||||
|
||||
// Mark this file as SQP file
|
||||
ha->pfnHashString = HashStringSlash;
|
||||
ha->dwFlags |= MPQ_FLAG_READ_ONLY;
|
||||
ha->dwSubType = MPQ_SUBTYPE_SQP;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return ERROR_FILE_CORRUPT;
|
||||
}
|
||||
|
||||
void * LoadSqpTable(TMPQArchive * ha, DWORD dwByteOffset, DWORD cbTableSize, DWORD dwKey)
|
||||
{
|
||||
ULONGLONG ByteOffset;
|
||||
LPBYTE pbSqpTable;
|
||||
|
||||
// Allocate buffer for the table
|
||||
pbSqpTable = STORM_ALLOC(BYTE, cbTableSize);
|
||||
if(pbSqpTable != NULL)
|
||||
{
|
||||
// Load the table
|
||||
ByteOffset = ha->MpqPos + dwByteOffset;
|
||||
if(FileStream_Read(ha->pStream, &ByteOffset, pbSqpTable, cbTableSize))
|
||||
{
|
||||
// Decrypt the SQP table
|
||||
DecryptMpqBlock(pbSqpTable, cbTableSize, dwKey);
|
||||
return pbSqpTable;
|
||||
}
|
||||
|
||||
// Free the table
|
||||
STORM_FREE(pbSqpTable);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TMPQHash * LoadSqpHashTable(TMPQArchive * ha)
|
||||
{
|
||||
TMPQHeader * pHeader = ha->pHeader;
|
||||
TSQPHash * pSqpHashTable;
|
||||
TSQPHash * pSqpHashEnd;
|
||||
TSQPHash * pSqpHash;
|
||||
TMPQHash * pMpqHash;
|
||||
int nError = ERROR_SUCCESS;
|
||||
|
||||
// Load the hash table
|
||||
pSqpHashTable = (TSQPHash *)LoadSqpTable(ha, pHeader->dwHashTablePos, pHeader->dwHashTableSize * sizeof(TSQPHash), MPQ_KEY_HASH_TABLE);
|
||||
if(pSqpHashTable != NULL)
|
||||
{
|
||||
// Parse the entire hash table and convert it to MPQ hash table
|
||||
pSqpHashEnd = pSqpHashTable + pHeader->dwHashTableSize;
|
||||
pMpqHash = (TMPQHash *)pSqpHashTable;
|
||||
for(pSqpHash = pSqpHashTable; pSqpHash < pSqpHashEnd; pSqpHash++, pMpqHash++)
|
||||
{
|
||||
// Ignore free entries
|
||||
if(pSqpHash->dwBlockIndex != HASH_ENTRY_FREE)
|
||||
{
|
||||
// Check block index against the size of the block table
|
||||
if(pHeader->dwBlockTableSize <= MPQ_BLOCK_INDEX(pSqpHash) && pSqpHash->dwBlockIndex < HASH_ENTRY_DELETED)
|
||||
nError = ERROR_FILE_CORRUPT;
|
||||
|
||||
// We do not support nonzero locale and platform ID
|
||||
if(pSqpHash->dwAlwaysZero != 0 && pSqpHash->dwAlwaysZero != HASH_ENTRY_FREE)
|
||||
nError = ERROR_FILE_CORRUPT;
|
||||
|
||||
// Store the file name hash
|
||||
pMpqHash->dwName1 = pSqpHash->dwName1;
|
||||
pMpqHash->dwName2 = pSqpHash->dwName2;
|
||||
|
||||
// Store the rest. Note that this must be done last,
|
||||
// because block index corresponds to pMpqHash->dwName2
|
||||
pMpqHash->dwBlockIndex = MPQ_BLOCK_INDEX(pSqpHash);
|
||||
pMpqHash->Platform = 0;
|
||||
pMpqHash->lcLocale = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// If an error occured, we need to free the hash table
|
||||
if(nError != ERROR_SUCCESS)
|
||||
{
|
||||
STORM_FREE(pSqpHashTable);
|
||||
pSqpHashTable = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Return the converted hash table (or NULL on failure)
|
||||
return (TMPQHash *)pSqpHashTable;
|
||||
}
|
||||
|
||||
// Loads the SQP Block table and converts it to a MPQ block table
|
||||
TMPQBlock * LoadSqpBlockTable(TMPQArchive * ha)
|
||||
{
|
||||
TMPQHeader * pHeader = ha->pHeader;
|
||||
TSQPBlock * pSqpBlockTable;
|
||||
TSQPBlock * pSqpBlockEnd;
|
||||
TSQPBlock * pSqpBlock;
|
||||
TMPQBlock * pMpqBlock;
|
||||
DWORD dwFlags;
|
||||
int nError = ERROR_SUCCESS;
|
||||
|
||||
// Load the hash table
|
||||
pSqpBlockTable = (TSQPBlock *)LoadSqpTable(ha, pHeader->dwBlockTablePos, pHeader->dwBlockTableSize * sizeof(TSQPBlock), MPQ_KEY_BLOCK_TABLE);
|
||||
if(pSqpBlockTable != NULL)
|
||||
{
|
||||
// Parse the entire hash table and convert it to MPQ hash table
|
||||
pSqpBlockEnd = pSqpBlockTable + pHeader->dwBlockTableSize;
|
||||
pMpqBlock = (TMPQBlock *)pSqpBlockTable;
|
||||
for(pSqpBlock = pSqpBlockTable; pSqpBlock < pSqpBlockEnd; pSqpBlock++, pMpqBlock++)
|
||||
{
|
||||
// Check for valid flags
|
||||
if(pSqpBlock->dwFlags & ~MPQ_FILE_VALID_FLAGS)
|
||||
nError = ERROR_FILE_CORRUPT;
|
||||
|
||||
// Convert SQP block table entry to MPQ block table entry
|
||||
dwFlags = pSqpBlock->dwFlags;
|
||||
pMpqBlock->dwCSize = pSqpBlock->dwCSize;
|
||||
pMpqBlock->dwFSize = pSqpBlock->dwFSize;
|
||||
pMpqBlock->dwFlags = dwFlags;
|
||||
}
|
||||
|
||||
// If an error occured, we need to free the hash table
|
||||
if(nError != ERROR_SUCCESS)
|
||||
{
|
||||
STORM_FREE(pSqpBlockTable);
|
||||
pSqpBlockTable = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Return the converted hash table (or NULL on failure)
|
||||
return (TMPQBlock *)pSqpBlockTable;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* Support for MPK file format (Longwu Online) */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
#define MPK_FILE_UNKNOWN_0001 0x00000001 // Seems to be always present
|
||||
#define MPK_FILE_UNKNOWN_0010 0x00000010 // Seems to be always present
|
||||
#define MPK_FILE_COMPRESSED 0x00000100 // Indicates a compressed file
|
||||
#define MPK_FILE_UNKNOWN_2000 0x00002000 // Seems to be always present
|
||||
#define MPK_FILE_EXISTS 0x01000000 // Seems to be always present
|
||||
|
||||
typedef struct _TMPKHeader
|
||||
{
|
||||
// The ID_MPK ('MPK\x1A') signature
|
||||
DWORD dwID;
|
||||
|
||||
// Contains '2000'
|
||||
DWORD dwVersion;
|
||||
|
||||
// 32-bit size of the archive
|
||||
DWORD dwArchiveSize;
|
||||
|
||||
// Size of the archive header
|
||||
DWORD dwHeaderSize;
|
||||
|
||||
DWORD dwHashTablePos;
|
||||
DWORD dwHashTableSize;
|
||||
DWORD dwBlockTablePos;
|
||||
DWORD dwBlockTableSize;
|
||||
DWORD dwUnknownPos;
|
||||
DWORD dwUnknownSize;
|
||||
} TMPKHeader;
|
||||
|
||||
|
||||
typedef struct _TMPKHash
|
||||
{
|
||||
// The hash of the file path, using method A.
|
||||
DWORD dwName1;
|
||||
|
||||
// The hash of the file path, using method B.
|
||||
DWORD dwName2;
|
||||
|
||||
// The hash of the file path, using method C.
|
||||
DWORD dwName3;
|
||||
|
||||
// If the hash table entry is valid, this is the index into the block table of the file.
|
||||
// Otherwise, one of the following two values:
|
||||
// - FFFFFFFFh: Hash table entry is empty, and has always been empty.
|
||||
// Terminates searches for a given file.
|
||||
// - FFFFFFFEh: Hash table entry is empty, but was valid at some point (a deleted file).
|
||||
// Does not terminate searches for a given file.
|
||||
DWORD dwBlockIndex;
|
||||
|
||||
} TMPKHash;
|
||||
|
||||
typedef struct _TMPKBlock
|
||||
{
|
||||
DWORD dwFlags; // 0x1121 - Compressed , 0x1120 - Not compressed
|
||||
DWORD dwFilePos; // Offset of the beginning of the file, relative to the beginning of the archive.
|
||||
DWORD dwFSize; // Uncompressed file size
|
||||
DWORD dwCSize; // Compressed file size
|
||||
DWORD dwUnknown; // 0x86364E6D
|
||||
} TMPKBlock;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Local variables - MPK file format
|
||||
|
||||
static const unsigned char MpkDecryptionKey[512] =
|
||||
{
|
||||
0x60, 0x20, 0x29, 0xE1, 0x01, 0xCE, 0xAA, 0xFE, 0xA3, 0xAB, 0x8E, 0x30, 0xAF, 0x02, 0xD1, 0x7D,
|
||||
0x41, 0x24, 0x06, 0xBD, 0xAE, 0xBE, 0x43, 0xC3, 0xBA, 0xB7, 0x08, 0x13, 0x51, 0xCF, 0xF8, 0xF7,
|
||||
0x25, 0x42, 0xA5, 0x4A, 0xDA, 0x0F, 0x52, 0x1C, 0x90, 0x3B, 0x63, 0x49, 0x36, 0xF6, 0xDD, 0x1B,
|
||||
0xEA, 0x58, 0xD4, 0x40, 0x70, 0x61, 0x55, 0x09, 0xCD, 0x0B, 0xA2, 0x4B, 0x68, 0x2C, 0x8A, 0xF1,
|
||||
0x3C, 0x3A, 0x65, 0xBB, 0xA1, 0xA8, 0x23, 0x97, 0xFD, 0x15, 0x00, 0x94, 0x88, 0x33, 0x59, 0xE9,
|
||||
0xFB, 0x69, 0x21, 0xEF, 0x85, 0x5B, 0x57, 0x6C, 0xFA, 0xB5, 0xEE, 0xB8, 0x71, 0xDC, 0xB1, 0x38,
|
||||
0x0C, 0x0A, 0x5C, 0x56, 0xC9, 0xB4, 0x84, 0x17, 0x1E, 0xE5, 0xD3, 0x5A, 0xCC, 0xFC, 0x11, 0x86,
|
||||
0x7F, 0x45, 0x4F, 0x54, 0xC8, 0x8D, 0x73, 0x89, 0x79, 0x5D, 0xB3, 0xBF, 0xB9, 0xE3, 0x93, 0xE4,
|
||||
0x6F, 0x35, 0x2D, 0x46, 0xF2, 0x76, 0xC5, 0x7E, 0xE2, 0xA4, 0xE6, 0xD9, 0x6E, 0x48, 0x34, 0x2B,
|
||||
0xC6, 0x5F, 0xBC, 0xA0, 0x6D, 0x0D, 0x47, 0x6B, 0x95, 0x96, 0x92, 0x91, 0xB2, 0x27, 0xEB, 0x9E,
|
||||
0xEC, 0x8F, 0xDF, 0x9C, 0x74, 0x99, 0x64, 0xF5, 0xFF, 0x28, 0xB6, 0x37, 0xF3, 0x7C, 0x81, 0x03,
|
||||
0x44, 0x62, 0x1F, 0xDB, 0x04, 0x7B, 0xB0, 0x9B, 0x31, 0xA7, 0xDE, 0x78, 0x9F, 0xAD, 0x0E, 0x3F,
|
||||
0x3E, 0x4D, 0xC7, 0xD7, 0x39, 0x19, 0x5E, 0xC2, 0xD0, 0xAC, 0xE8, 0x1A, 0x87, 0x8B, 0x07, 0x05,
|
||||
0x22, 0xED, 0x72, 0x2E, 0x1D, 0xC1, 0xA9, 0xD6, 0xE0, 0x83, 0xD5, 0xD8, 0xCB, 0x80, 0xF0, 0x66,
|
||||
0x7A, 0x9D, 0x50, 0xF9, 0x10, 0x4E, 0x16, 0x14, 0x77, 0x75, 0x6A, 0x67, 0xD2, 0xC0, 0xA6, 0xC4,
|
||||
0x53, 0x8C, 0x32, 0xCA, 0x82, 0x2A, 0x18, 0x9A, 0xF4, 0x4C, 0x3D, 0x26, 0x12, 0xE7, 0x98, 0x2F,
|
||||
0x4A, 0x04, 0x0D, 0xAF, 0xB4, 0xCF, 0x12, 0xCE, 0x1A, 0x37, 0x61, 0x39, 0x60, 0x95, 0xBE, 0x25,
|
||||
0xE4, 0x6E, 0xFC, 0x1B, 0xE7, 0x49, 0xE6, 0x67, 0xF6, 0xC5, 0xCB, 0x2F, 0x27, 0xD4, 0x68, 0xB2,
|
||||
0x01, 0x52, 0xD0, 0x46, 0x11, 0x20, 0xFB, 0x9D, 0xA9, 0x02, 0xF5, 0x8F, 0x3D, 0x82, 0xD3, 0xFF,
|
||||
0x0B, 0xB8, 0xF2, 0x4D, 0x8E, 0x81, 0x2C, 0xAB, 0x5F, 0xC4, 0x41, 0x29, 0x40, 0xFA, 0xC0, 0xBF,
|
||||
0x33, 0x10, 0x21, 0x16, 0xB0, 0x71, 0x83, 0x96, 0x8D, 0x2B, 0x23, 0x3B, 0xF9, 0xC1, 0xE5, 0x72,
|
||||
0xE2, 0x1C, 0x26, 0xF0, 0x73, 0x36, 0x63, 0x56, 0x31, 0x4E, 0x6B, 0x55, 0x62, 0x79, 0xC6, 0x91,
|
||||
0x00, 0x35, 0xB1, 0x2A, 0xA6, 0x42, 0xDF, 0xEB, 0x3C, 0x51, 0xEA, 0x97, 0x57, 0x94, 0x8C, 0x80,
|
||||
0x34, 0x5C, 0xD2, 0x76, 0xA4, 0xE9, 0x85, 0xE8, 0xBB, 0x78, 0xE0, 0xB5, 0xAD, 0x0F, 0x87, 0x70,
|
||||
0xDD, 0xAE, 0xF4, 0xD9, 0x66, 0x54, 0x6F, 0xCC, 0x4C, 0x77, 0x3E, 0xCD, 0xF1, 0x75, 0x0A, 0xA1,
|
||||
0x28, 0x9B, 0x9A, 0x7E, 0x4B, 0x98, 0x99, 0x47, 0xFE, 0xA5, 0xF7, 0xB7, 0xA3, 0xE1, 0x9F, 0xBC,
|
||||
0x93, 0x44, 0x3A, 0x08, 0x89, 0x22, 0xEE, 0xB9, 0x45, 0xD6, 0x06, 0x09, 0xC9, 0xBD, 0x14, 0x0C,
|
||||
0xB6, 0x5E, 0x9C, 0x7A, 0x65, 0x59, 0xAA, 0x19, 0x5B, 0x7C, 0x18, 0x43, 0x92, 0x13, 0x15, 0x7B,
|
||||
0xED, 0xD5, 0xC7, 0x17, 0xEF, 0x86, 0x90, 0xC2, 0x74, 0x64, 0xF3, 0xDC, 0x6C, 0x38, 0x05, 0x1D,
|
||||
0xC8, 0x0E, 0xEC, 0x6A, 0x32, 0xDA, 0xD7, 0xC3, 0xDB, 0x8B, 0x24, 0xB3, 0x5D, 0x2E, 0xBA, 0xA2,
|
||||
0xD8, 0x03, 0x88, 0x7D, 0x7F, 0x69, 0x8A, 0xFD, 0xCA, 0x4F, 0x30, 0x9E, 0xA0, 0xD1, 0x5A, 0x53,
|
||||
0xDE, 0x3F, 0x84, 0xAC, 0xF8, 0xA7, 0x2D, 0x1F, 0x1E, 0xE3, 0x58, 0x50, 0x6D, 0x48, 0x07, 0xA8
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Functions - MPK file format
|
||||
|
||||
// This function converts MPK file header into MPQ file header
|
||||
int ConvertMpkHeaderToFormat4(
|
||||
TMPQArchive * ha,
|
||||
ULONGLONG FileSize,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
TMPKHeader * pMpkHeader = (TMPKHeader *)ha->HeaderData;
|
||||
TMPQHeader Header;
|
||||
|
||||
// Can't open the archive with certain flags
|
||||
if(dwFlags & MPQ_OPEN_FORCE_MPQ_V1)
|
||||
return ERROR_FILE_CORRUPT;
|
||||
|
||||
// Translate the MPK header into a MPQ header
|
||||
// Note: Hash table size and block table size are in bytes, not in entries
|
||||
memset(&Header, 0, sizeof(TMPQHeader));
|
||||
Header.dwID = BSWAP_INT32_UNSIGNED(pMpkHeader->dwID);
|
||||
Header.dwArchiveSize = BSWAP_INT32_UNSIGNED(pMpkHeader->dwArchiveSize);
|
||||
Header.dwHeaderSize = BSWAP_INT32_UNSIGNED(pMpkHeader->dwHeaderSize);
|
||||
Header.dwHashTablePos = BSWAP_INT32_UNSIGNED(pMpkHeader->dwHashTablePos);
|
||||
Header.dwHashTableSize = BSWAP_INT32_UNSIGNED(pMpkHeader->dwHashTableSize) / sizeof(TMPKHash);
|
||||
Header.dwBlockTablePos = BSWAP_INT32_UNSIGNED(pMpkHeader->dwBlockTablePos);
|
||||
Header.dwBlockTableSize = BSWAP_INT32_UNSIGNED(pMpkHeader->dwBlockTableSize) / sizeof(TMPKBlock);
|
||||
// Header.dwUnknownPos = BSWAP_INT32_UNSIGNED(pMpkHeader->dwUnknownPos);
|
||||
// Header.dwUnknownSize = BSWAP_INT32_UNSIGNED(pMpkHeader->dwUnknownSize);
|
||||
assert(Header.dwHeaderSize == sizeof(TMPKHeader));
|
||||
|
||||
// Verify the MPK header
|
||||
if(Header.dwID == ID_MPK && Header.dwHeaderSize == sizeof(TMPKHeader) && Header.dwArchiveSize == (DWORD)FileSize)
|
||||
{
|
||||
// The header ID must be ID_MPQ
|
||||
Header.dwID = ID_MPQ;
|
||||
Header.wFormatVersion = MPQ_FORMAT_VERSION_1;
|
||||
Header.wSectorSize = 3;
|
||||
|
||||
// Initialize the fields of 3.0 header
|
||||
Header.ArchiveSize64 = Header.dwArchiveSize;
|
||||
Header.HashTableSize64 = Header.dwHashTableSize * sizeof(TMPQHash);
|
||||
Header.BlockTableSize64 = Header.dwBlockTableSize * sizeof(TMPQBlock);
|
||||
|
||||
// Copy the converted MPQ header back
|
||||
memcpy(ha->HeaderData, &Header, sizeof(TMPQHeader));
|
||||
|
||||
// Mark this file as MPK file
|
||||
ha->pfnHashString = HashStringLower;
|
||||
ha->dwFlags |= MPQ_FLAG_READ_ONLY;
|
||||
ha->dwSubType = MPQ_SUBTYPE_MPK;
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
return ERROR_FILE_CORRUPT;
|
||||
}
|
||||
|
||||
// Attempts to search a free hash entry in the hash table being converted.
|
||||
// The created hash table must always be of nonzero size,
|
||||
// should have no duplicated items and no deleted entries
|
||||
TMPQHash * FindFreeHashEntry(TMPQHash * pHashTable, DWORD dwHashTableSize, DWORD dwStartIndex)
|
||||
{
|
||||
TMPQHash * pHash;
|
||||
DWORD dwIndex;
|
||||
|
||||
// Set the initial index
|
||||
dwStartIndex = dwIndex = (dwStartIndex & (dwHashTableSize - 1));
|
||||
assert(dwHashTableSize != 0);
|
||||
|
||||
// Search the hash table and return the found entries in the following priority:
|
||||
for(;;)
|
||||
{
|
||||
// We are not expecting to find matching entry in the hash table being built
|
||||
// We are not expecting to find deleted entry either
|
||||
pHash = pHashTable + dwIndex;
|
||||
|
||||
// If we found a free entry, we need to stop searching
|
||||
if(pHash->dwBlockIndex == HASH_ENTRY_FREE)
|
||||
return pHash;
|
||||
|
||||
// Move to the next hash entry.
|
||||
// If we reached the starting entry, it's failure.
|
||||
dwIndex = (dwIndex + 1) & (dwHashTableSize - 1);
|
||||
if(dwIndex == dwStartIndex)
|
||||
break;
|
||||
}
|
||||
|
||||
// We haven't found anything
|
||||
assert(false);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void DecryptMpkTable(void * pvMpkTable, size_t cbSize)
|
||||
{
|
||||
LPBYTE pbMpkTable = (LPBYTE)pvMpkTable;
|
||||
|
||||
for(size_t i = 0; i < cbSize; i++)
|
||||
pbMpkTable[i] = MpkDecryptionKey[pbMpkTable[i]];
|
||||
}
|
||||
|
||||
void * LoadMpkTable(TMPQArchive * ha, DWORD dwByteOffset, DWORD cbTableSize)
|
||||
{
|
||||
ULONGLONG ByteOffset;
|
||||
LPBYTE pbMpkTable = NULL;
|
||||
|
||||
// Allocate space for the table
|
||||
pbMpkTable = STORM_ALLOC(BYTE, cbTableSize);
|
||||
if(pbMpkTable != NULL)
|
||||
{
|
||||
// Load and the MPK hash table
|
||||
ByteOffset = ha->MpqPos + dwByteOffset;
|
||||
if(FileStream_Read(ha->pStream, &ByteOffset, pbMpkTable, cbTableSize))
|
||||
{
|
||||
// Decrypt the table
|
||||
DecryptMpkTable(pbMpkTable, cbTableSize);
|
||||
return pbMpkTable;
|
||||
}
|
||||
|
||||
// Free the MPK table
|
||||
STORM_FREE(pbMpkTable);
|
||||
pbMpkTable = NULL;
|
||||
}
|
||||
|
||||
// Return the table
|
||||
return pbMpkTable;
|
||||
}
|
||||
|
||||
TMPQHash * LoadMpkHashTable(TMPQArchive * ha)
|
||||
{
|
||||
TMPQHeader * pHeader = ha->pHeader;
|
||||
TMPQHash * pHashTable = NULL;
|
||||
TMPKHash * pMpkHash;
|
||||
TMPQHash * pHash = NULL;
|
||||
DWORD dwHashTableSize = pHeader->dwHashTableSize;
|
||||
|
||||
// MPKs use different hash table searching.
|
||||
// Instead of using MPQ_HASH_TABLE_INDEX hash as index,
|
||||
// they store the value directly in the hash table.
|
||||
// Also for faster searching, the hash table is sorted ascending by the value
|
||||
|
||||
// Load and decrypt the MPK hash table.
|
||||
pMpkHash = (TMPKHash *)LoadMpkTable(ha, pHeader->dwHashTablePos, pHeader->dwHashTableSize * sizeof(TMPKHash));
|
||||
if(pMpkHash != NULL)
|
||||
{
|
||||
// Calculate the hash table size as if it was real MPQ hash table
|
||||
pHeader->dwHashTableSize = GetNearestPowerOfTwo(pHeader->dwHashTableSize);
|
||||
pHeader->HashTableSize64 = pHeader->dwHashTableSize * sizeof(TMPQHash);
|
||||
|
||||
// Now allocate table that will serve like a true MPQ hash table,
|
||||
// so we translate the MPK hash table to MPQ hash table
|
||||
pHashTable = STORM_ALLOC(TMPQHash, pHeader->dwHashTableSize);
|
||||
if(pHashTable != NULL)
|
||||
{
|
||||
// Set the entire hash table to free
|
||||
memset(pHashTable, 0xFF, (size_t)pHeader->HashTableSize64);
|
||||
|
||||
// Copy the MPK hash table into MPQ hash table
|
||||
for(DWORD i = 0; i < dwHashTableSize; i++)
|
||||
{
|
||||
// Finds the free hash entry in the hash table
|
||||
// We don't expect any errors here, because we are putting files to empty hash table
|
||||
pHash = FindFreeHashEntry(pHashTable, pHeader->dwHashTableSize, pMpkHash[i].dwName1);
|
||||
assert(pHash->dwBlockIndex == HASH_ENTRY_FREE);
|
||||
|
||||
// Copy the MPK hash entry to the hash table
|
||||
pHash->dwBlockIndex = pMpkHash[i].dwBlockIndex;
|
||||
pHash->Platform = 0;
|
||||
pHash->lcLocale = 0;
|
||||
pHash->dwName1 = pMpkHash[i].dwName2;
|
||||
pHash->dwName2 = pMpkHash[i].dwName3;
|
||||
}
|
||||
}
|
||||
|
||||
// Free the temporary hash table
|
||||
STORM_FREE(pMpkHash);
|
||||
}
|
||||
|
||||
return pHashTable;
|
||||
}
|
||||
|
||||
static DWORD ConvertMpkFlagsToMpqFlags(DWORD dwMpkFlags)
|
||||
{
|
||||
DWORD dwMpqFlags = MPQ_FILE_EXISTS;
|
||||
|
||||
// Check for flags that are always present
|
||||
assert((dwMpkFlags & MPK_FILE_UNKNOWN_0001) != 0);
|
||||
assert((dwMpkFlags & MPK_FILE_UNKNOWN_0010) != 0);
|
||||
assert((dwMpkFlags & MPK_FILE_UNKNOWN_2000) != 0);
|
||||
assert((dwMpkFlags & MPK_FILE_EXISTS) != 0);
|
||||
|
||||
// Append the compressed flag
|
||||
dwMpqFlags |= (dwMpkFlags & MPK_FILE_COMPRESSED) ? MPQ_FILE_COMPRESS : 0;
|
||||
|
||||
// All files in the MPQ seem to be single unit files
|
||||
dwMpqFlags |= MPQ_FILE_ENCRYPTED | MPQ_FILE_SINGLE_UNIT;
|
||||
|
||||
return dwMpqFlags;
|
||||
}
|
||||
|
||||
TMPQBlock * LoadMpkBlockTable(TMPQArchive * ha)
|
||||
{
|
||||
TMPQHeader * pHeader = ha->pHeader;
|
||||
TMPKBlock * pMpkBlockTable;
|
||||
TMPKBlock * pMpkBlockEnd;
|
||||
TMPQBlock * pBlockTable = NULL;
|
||||
TMPKBlock * pMpkBlock;
|
||||
TMPQBlock * pMpqBlock;
|
||||
|
||||
// Load and decrypt the MPK block table
|
||||
pMpkBlockTable = pMpkBlock = (TMPKBlock *)LoadMpkTable(ha, pHeader->dwBlockTablePos, pHeader->dwBlockTableSize * sizeof(TMPKBlock));
|
||||
if(pMpkBlockTable != NULL)
|
||||
{
|
||||
// Allocate buffer for MPQ-like block table
|
||||
pBlockTable = pMpqBlock = STORM_ALLOC(TMPQBlock, pHeader->dwBlockTableSize);
|
||||
if(pBlockTable != NULL)
|
||||
{
|
||||
// Convert the MPK block table to MPQ block table
|
||||
pMpkBlockEnd = pMpkBlockTable + pHeader->dwBlockTableSize;
|
||||
while(pMpkBlock < pMpkBlockEnd)
|
||||
{
|
||||
// Translate the MPK block table entry to MPQ block table entry
|
||||
pMpqBlock->dwFilePos = pMpkBlock->dwFilePos;
|
||||
pMpqBlock->dwCSize = pMpkBlock->dwCSize;
|
||||
pMpqBlock->dwFSize = pMpkBlock->dwFSize;
|
||||
pMpqBlock->dwFlags = ConvertMpkFlagsToMpqFlags(pMpkBlock->dwFlags);
|
||||
|
||||
// Move both
|
||||
pMpkBlock++;
|
||||
pMpqBlock++;
|
||||
}
|
||||
}
|
||||
|
||||
// Free the MPK block table
|
||||
STORM_FREE(pMpkBlockTable);
|
||||
}
|
||||
|
||||
return pBlockTable;
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,358 +0,0 @@
|
|||
/*****************************************************************************/
|
||||
/* adpcm.cpp Copyright (c) Ladislav Zezula 2003 */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* This module contains implementation of adpcm decompression method used by */
|
||||
/* Storm.dll to decompress WAVE files. Thanks to Tom Amigo for releasing */
|
||||
/* his sources. */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Date Ver Who Comment */
|
||||
/* -------- ---- --- ------- */
|
||||
/* 11.03.03 1.00 Lad Splitted from Pkware.cpp */
|
||||
/* 20.05.03 2.00 Lad Added compression */
|
||||
/* 19.11.03 2.01 Dan Big endian handling */
|
||||
/*****************************************************************************/
|
||||
|
||||
#include "adpcm.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Structures
|
||||
|
||||
typedef union _BYTE_AND_WORD_PTR
|
||||
{
|
||||
short * pw;
|
||||
unsigned char * pb;
|
||||
} BYTE_AND_WORD_PTR;
|
||||
|
||||
typedef union _WORD_AND_BYTE_ARRAY
|
||||
{
|
||||
short w;
|
||||
unsigned char b[2];
|
||||
} WORD_AND_BYTE_ARRAY;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Tables necessary dor decompression
|
||||
|
||||
static long Table1503F120[] =
|
||||
{
|
||||
0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0x00000004, 0xFFFFFFFF, 0x00000002, 0xFFFFFFFF, 0x00000006,
|
||||
0xFFFFFFFF, 0x00000001, 0xFFFFFFFF, 0x00000005, 0xFFFFFFFF, 0x00000003, 0xFFFFFFFF, 0x00000007,
|
||||
0xFFFFFFFF, 0x00000001, 0xFFFFFFFF, 0x00000005, 0xFFFFFFFF, 0x00000003, 0xFFFFFFFF, 0x00000007,
|
||||
0xFFFFFFFF, 0x00000002, 0xFFFFFFFF, 0x00000004, 0xFFFFFFFF, 0x00000006, 0xFFFFFFFF, 0x00000008
|
||||
};
|
||||
|
||||
static long step_table[] =
|
||||
{
|
||||
0x00000007, 0x00000008, 0x00000009, 0x0000000A, 0x0000000B, 0x0000000C, 0x0000000D, 0x0000000E,
|
||||
0x00000010, 0x00000011, 0x00000013, 0x00000015, 0x00000017, 0x00000019, 0x0000001C, 0x0000001F,
|
||||
0x00000022, 0x00000025, 0x00000029, 0x0000002D, 0x00000032, 0x00000037, 0x0000003C, 0x00000042,
|
||||
0x00000049, 0x00000050, 0x00000058, 0x00000061, 0x0000006B, 0x00000076, 0x00000082, 0x0000008F,
|
||||
0x0000009D, 0x000000AD, 0x000000BE, 0x000000D1, 0x000000E6, 0x000000FD, 0x00000117, 0x00000133,
|
||||
0x00000151, 0x00000173, 0x00000198, 0x000001C1, 0x000001EE, 0x00000220, 0x00000256, 0x00000292,
|
||||
0x000002D4, 0x0000031C, 0x0000036C, 0x000003C3, 0x00000424, 0x0000048E, 0x00000502, 0x00000583,
|
||||
0x00000610, 0x000006AB, 0x00000756, 0x00000812, 0x000008E0, 0x000009C3, 0x00000ABD, 0x00000BD0,
|
||||
0x00000CFF, 0x00000E4C, 0x00000FBA, 0x0000114C, 0x00001307, 0x000014EE, 0x00001706, 0x00001954,
|
||||
0x00001BDC, 0x00001EA5, 0x000021B6, 0x00002515, 0x000028CA, 0x00002CDF, 0x0000315B, 0x0000364B,
|
||||
0x00003BB9, 0x000041B2, 0x00004844, 0x00004F7E, 0x00005771, 0x0000602F, 0x000069CE, 0x00007462,
|
||||
0x00007FFF
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// CompressWave
|
||||
|
||||
// 1500EF70
|
||||
int CompressADPCM(unsigned char * pbOutBuffer, int dwOutLength, short * pwInBuffer, int dwInLength, int nChannels, int nCmpLevel)
|
||||
// ECX EDX
|
||||
{
|
||||
WORD_AND_BYTE_ARRAY Wcmp;
|
||||
BYTE_AND_WORD_PTR out; // Pointer to the output buffer
|
||||
long SInt32Array1[2];
|
||||
long SInt32Array2[2];
|
||||
long SInt32Array3[2];
|
||||
long nBytesRemains = dwOutLength; // Number of bytes remaining
|
||||
long nWordsRemains; // Number of words remaining
|
||||
// unsigned char * pbSaveOutBuffer; // Copy of output buffer (actually not used)
|
||||
unsigned long dwBitBuff;
|
||||
unsigned long dwStopBit;
|
||||
unsigned long dwBit;
|
||||
unsigned long ebx;
|
||||
unsigned long esi;
|
||||
long nTableValue;
|
||||
long nOneWord;
|
||||
long var_1C;
|
||||
long var_2C;
|
||||
int nLength;
|
||||
int nIndex;
|
||||
int nValue;
|
||||
int i, chnl;
|
||||
|
||||
// If less than 2 bytes remain, don't decompress anything
|
||||
// pbSaveOutBuffer = pbOutBuffer;
|
||||
out.pb = pbOutBuffer;
|
||||
if(nBytesRemains < 2)
|
||||
return 2;
|
||||
|
||||
Wcmp.b[1] = (unsigned char)(nCmpLevel - 1);
|
||||
Wcmp.b[0] = (unsigned char)0;
|
||||
|
||||
*out.pw++ = BSWAP_INT16_SIGNED(Wcmp.w);
|
||||
if((out.pb - pbOutBuffer + (nChannels * 2)) > nBytesRemains)
|
||||
return (int)(out.pb - pbOutBuffer + (nChannels * 2));
|
||||
|
||||
SInt32Array1[0] = SInt32Array1[1] = 0x2C;
|
||||
|
||||
for(i = 0; i < nChannels; i++)
|
||||
{
|
||||
nOneWord = BSWAP_INT16_SIGNED(*pwInBuffer++);
|
||||
*out.pw++ = BSWAP_INT16_SIGNED((short)nOneWord);
|
||||
SInt32Array2[i] = nOneWord;
|
||||
}
|
||||
|
||||
// Weird. But it's there
|
||||
nLength = dwInLength;
|
||||
if(nLength < 0) // mov eax, dwInLength; cdq; sub eax, edx;
|
||||
nLength++;
|
||||
|
||||
nLength = (nLength / 2) - (int)(out.pb - pbOutBuffer);
|
||||
nLength = (nLength < 0) ? 0 : nLength;
|
||||
|
||||
nIndex = nChannels - 1; // edi
|
||||
nWordsRemains = dwInLength / 2; // eax
|
||||
|
||||
// ebx - nChannels
|
||||
// ecx - pwOutPos
|
||||
for(chnl = nChannels; chnl < nWordsRemains; chnl++)
|
||||
{
|
||||
// 1500F030
|
||||
if((out.pb - pbOutBuffer + 2) > nBytesRemains)
|
||||
return (int)(out.pb - pbOutBuffer + 2);
|
||||
|
||||
// Switch index
|
||||
if(nChannels == 2)
|
||||
nIndex = (nIndex == 0) ? 1 : 0;
|
||||
|
||||
// Load one word from the input stream
|
||||
nOneWord = BSWAP_INT16_SIGNED(*pwInBuffer++); // ecx - nOneWord
|
||||
SInt32Array3[nIndex] = nOneWord;
|
||||
|
||||
// esi - SInt32Array2[nIndex]
|
||||
// eax - nValue
|
||||
nValue = nOneWord - SInt32Array2[nIndex];
|
||||
nValue = (nValue < 0) ? ((nValue ^ 0xFFFFFFFF) + 1) : nValue;
|
||||
|
||||
ebx = (nOneWord >= SInt32Array2[nIndex]) ? 0 : 0x40;
|
||||
|
||||
// esi - SInt32Array2[nIndex]
|
||||
// edx - step_table[SInt32Array2[nIndex]]
|
||||
// edi - (step_table[SInt32Array1[nIndex]] >> nCmpLevel)
|
||||
nTableValue = step_table[SInt32Array1[nIndex]];
|
||||
dwStopBit = (unsigned long)nCmpLevel;
|
||||
|
||||
// edi - nIndex;
|
||||
if(nValue < (nTableValue >> nCmpLevel))
|
||||
{
|
||||
if(SInt32Array1[nIndex] != 0)
|
||||
SInt32Array1[nIndex]--;
|
||||
*out.pb++ = 0x80;
|
||||
}
|
||||
else
|
||||
{
|
||||
while(nValue > nTableValue * 2)
|
||||
{
|
||||
if(SInt32Array1[nIndex] >= 0x58 || nLength == 0)
|
||||
break;
|
||||
|
||||
SInt32Array1[nIndex] += 8;
|
||||
if(SInt32Array1[nIndex] > 0x58)
|
||||
SInt32Array1[nIndex] = 0x58;
|
||||
|
||||
nTableValue = step_table[SInt32Array1[nIndex]];
|
||||
*out.pb++ = 0x81;
|
||||
nLength--;
|
||||
}
|
||||
|
||||
var_2C = nTableValue >> Wcmp.b[1];
|
||||
dwBitBuff = 0;
|
||||
|
||||
esi = (1 << (dwStopBit - 2));
|
||||
dwStopBit = (esi <= 0x20) ? esi : 0x20;
|
||||
|
||||
for(var_1C = 0, dwBit = 1; ; dwBit <<= 1)
|
||||
{
|
||||
// esi = var_1C + nTableValue;
|
||||
if((var_1C + nTableValue) <= nValue)
|
||||
{
|
||||
var_1C += nTableValue;
|
||||
dwBitBuff |= dwBit;
|
||||
}
|
||||
if(dwBit == dwStopBit)
|
||||
break;
|
||||
|
||||
nTableValue >>= 1;
|
||||
}
|
||||
|
||||
nValue = SInt32Array2[nIndex];
|
||||
if(ebx != 0)
|
||||
{
|
||||
nValue -= (var_1C + var_2C);
|
||||
if(nValue < -32768)
|
||||
nValue = -32768;
|
||||
}
|
||||
else
|
||||
{
|
||||
nValue += (var_1C + var_2C);
|
||||
if(nValue > 32767)
|
||||
nValue = 32767;
|
||||
}
|
||||
|
||||
SInt32Array2[nIndex] = nValue;
|
||||
*out.pb++ = (unsigned char)(dwBitBuff | ebx);
|
||||
nTableValue = Table1503F120[dwBitBuff & 0x1F];
|
||||
SInt32Array1[nIndex] = SInt32Array1[nIndex] + nTableValue;
|
||||
if(SInt32Array1[nIndex] < 0)
|
||||
SInt32Array1[nIndex] = 0;
|
||||
else if(SInt32Array1[nIndex] > 0x58)
|
||||
SInt32Array1[nIndex] = 0x58;
|
||||
}
|
||||
}
|
||||
|
||||
return (int)(out.pb - pbOutBuffer);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// DecompressADPCM
|
||||
|
||||
// 1500F230
|
||||
int DecompressADPCM(unsigned char * pbOutBuffer, int dwOutLength, unsigned char * pbInBuffer, int dwInLength, int nChannels)
|
||||
{
|
||||
BYTE_AND_WORD_PTR out; // Output buffer
|
||||
BYTE_AND_WORD_PTR in;
|
||||
unsigned char * pbInBufferEnd = (pbInBuffer + dwInLength);
|
||||
long SInt32Array1[2];
|
||||
long SInt32Array2[2];
|
||||
long nOneWord;
|
||||
int nIndex;
|
||||
int i;
|
||||
|
||||
SInt32Array1[0] = SInt32Array1[1] = 0x2C;
|
||||
out.pb = pbOutBuffer;
|
||||
in.pb = pbInBuffer;
|
||||
in.pw++;
|
||||
|
||||
// Fill the Uint32Array2 array by channel values.
|
||||
for(i = 0; i < nChannels; i++)
|
||||
{
|
||||
nOneWord = BSWAP_INT16_SIGNED(*in.pw++);
|
||||
SInt32Array2[i] = nOneWord;
|
||||
if(dwOutLength < 2)
|
||||
return (int)(out.pb - pbOutBuffer);
|
||||
|
||||
*out.pw++ = BSWAP_INT16_SIGNED((short)nOneWord);
|
||||
dwOutLength -= sizeof(short);
|
||||
}
|
||||
|
||||
// Get the initial index
|
||||
nIndex = nChannels - 1;
|
||||
|
||||
// Perform the decompression
|
||||
while(in.pb < pbInBufferEnd)
|
||||
{
|
||||
unsigned char nOneByte = *in.pb++;
|
||||
|
||||
// Switch index
|
||||
if(nChannels == 2)
|
||||
nIndex = (nIndex == 0) ? 1 : 0;
|
||||
|
||||
// 1500F2A2: Get one byte from input buffer
|
||||
if(nOneByte & 0x80)
|
||||
{
|
||||
switch(nOneByte & 0x7F)
|
||||
{
|
||||
case 0: // 1500F315
|
||||
if(SInt32Array1[nIndex] != 0)
|
||||
SInt32Array1[nIndex]--;
|
||||
|
||||
if(dwOutLength < 2)
|
||||
return (int)(out.pb - pbOutBuffer);
|
||||
|
||||
*out.pw++ = BSWAP_INT16_SIGNED((unsigned short)SInt32Array2[nIndex]);
|
||||
dwOutLength -= sizeof(unsigned short);
|
||||
break;
|
||||
|
||||
case 1: // 1500F2E8
|
||||
SInt32Array1[nIndex] += 8;
|
||||
if(SInt32Array1[nIndex] > 0x58)
|
||||
SInt32Array1[nIndex] = 0x58;
|
||||
|
||||
if(nChannels == 2)
|
||||
nIndex = (nIndex == 0) ? 1 : 0;
|
||||
break;
|
||||
|
||||
case 2: // 1500F41E
|
||||
break;
|
||||
|
||||
default: // 1500F2C4
|
||||
SInt32Array1[nIndex] -= 8;
|
||||
if(SInt32Array1[nIndex] < 0)
|
||||
SInt32Array1[nIndex] = 0;
|
||||
|
||||
if(nChannels == 2)
|
||||
nIndex = (nIndex == 0) ? 1 : 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 1500F349
|
||||
long temp1 = step_table[SInt32Array1[nIndex]]; // EDI
|
||||
long temp2 = temp1 >> pbInBuffer[1]; // ESI
|
||||
long temp3 = SInt32Array2[nIndex]; // ECX
|
||||
|
||||
if(nOneByte & 0x01) // EBX = nOneByte
|
||||
temp2 += (temp1 >> 0);
|
||||
|
||||
if(nOneByte & 0x02)
|
||||
temp2 += (temp1 >> 1);
|
||||
|
||||
if(nOneByte & 0x04)
|
||||
temp2 += (temp1 >> 2);
|
||||
|
||||
if(nOneByte & 0x08)
|
||||
temp2 += (temp1 >> 3);
|
||||
|
||||
if(nOneByte & 0x10)
|
||||
temp2 += (temp1 >> 4);
|
||||
|
||||
if(nOneByte & 0x20)
|
||||
temp2 += (temp1 >> 5);
|
||||
|
||||
if(nOneByte & 0x40)
|
||||
{
|
||||
temp3 = temp3 - temp2;
|
||||
if(temp3 <= -32768)
|
||||
temp3 = -32768;
|
||||
}
|
||||
else
|
||||
{
|
||||
temp3 = temp3 + temp2;
|
||||
if(temp3 >= 32767)
|
||||
temp3 = 32767;
|
||||
}
|
||||
|
||||
SInt32Array2[nIndex] = temp3;
|
||||
if(dwOutLength < 2)
|
||||
break;
|
||||
|
||||
// Store the output 16-bit value
|
||||
*out.pw++ = BSWAP_INT16_SIGNED((short)SInt32Array2[nIndex]);
|
||||
dwOutLength -= 2;
|
||||
|
||||
SInt32Array1[nIndex] += Table1503F120[nOneByte & 0x1F];
|
||||
|
||||
if(SInt32Array1[nIndex] < 0)
|
||||
SInt32Array1[nIndex] = 0;
|
||||
else if(SInt32Array1[nIndex] > 0x58)
|
||||
SInt32Array1[nIndex] = 0x58;
|
||||
}
|
||||
}
|
||||
return (int)(out.pb - pbOutBuffer);
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
/*****************************************************************************/
|
||||
/* adpcm.h Copyright (c) Ladislav Zezula 2003 */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Header file for adpcm decompress functions */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Date Ver Who Comment */
|
||||
/* -------- ---- --- ------- */
|
||||
/* 31.03.03 1.00 Lad The first version of adpcm.h */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef __ADPCM_H__
|
||||
#define __ADPCM_H__
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Functions
|
||||
|
||||
#include <StormPort.h>
|
||||
|
||||
int CompressADPCM (unsigned char * pbOutBuffer, int dwOutLength, short * pwInBuffer, int dwInLength, int nCmpType, int nChannels);
|
||||
int DecompressADPCM(unsigned char * pbOutBuffer, int dwOutLength, unsigned char * pbInBuffer, int dwInLength, int nChannels);
|
||||
|
||||
#endif // __ADPCM_H__
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "../../headers/tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file der_encode_bit_string.c
|
||||
ASN.1 DER, encode a BIT STRING, Tom St Denis
|
||||
*/
|
||||
|
||||
|
||||
#ifdef LTC_DER
|
||||
|
||||
/**
|
||||
Store a BIT STRING
|
||||
@param in The array of bits to store (one per char)
|
||||
@param inlen The number of bits tostore
|
||||
@param out [out] The destination for the DER encoded BIT STRING
|
||||
@param outlen [in/out] The max size and resulting size of the DER BIT STRING
|
||||
@return CRYPT_OK if successful
|
||||
*/
|
||||
int der_encode_bit_string(const unsigned char *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen)
|
||||
{
|
||||
unsigned long len, x, y;
|
||||
unsigned char buf;
|
||||
int err;
|
||||
|
||||
LTC_ARGCHK(in != NULL);
|
||||
LTC_ARGCHK(out != NULL);
|
||||
LTC_ARGCHK(outlen != NULL);
|
||||
|
||||
/* avoid overflows */
|
||||
if ((err = der_length_bit_string(inlen, &len)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if (len > *outlen) {
|
||||
*outlen = len;
|
||||
return CRYPT_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
/* store header (include bit padding count in length) */
|
||||
x = 0;
|
||||
y = (inlen >> 3) + ((inlen&7) ? 1 : 0) + 1;
|
||||
|
||||
out[x++] = 0x03;
|
||||
if (y < 128) {
|
||||
out[x++] = (unsigned char)y;
|
||||
} else if (y < 256) {
|
||||
out[x++] = 0x81;
|
||||
out[x++] = (unsigned char)y;
|
||||
} else if (y < 65536) {
|
||||
out[x++] = 0x82;
|
||||
out[x++] = (unsigned char)((y>>8)&255);
|
||||
out[x++] = (unsigned char)(y&255);
|
||||
}
|
||||
|
||||
/* store number of zero padding bits */
|
||||
out[x++] = (unsigned char)((8 - inlen) & 7);
|
||||
|
||||
/* store the bits in big endian format */
|
||||
for (y = buf = 0; y < inlen; y++) {
|
||||
buf |= (in[y] ? 1 : 0) << (7 - (y & 7));
|
||||
if ((y & 7) == 7) {
|
||||
out[x++] = buf;
|
||||
buf = 0;
|
||||
}
|
||||
}
|
||||
/* store last byte */
|
||||
if (inlen & 7) {
|
||||
out[x++] = buf;
|
||||
}
|
||||
*outlen = x;
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/bit/der_encode_bit_string.c,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/12/28 01:27:24 $ */
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "../../headers/tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file der_encode_boolean.c
|
||||
ASN.1 DER, encode a BOOLEAN, Tom St Denis
|
||||
*/
|
||||
|
||||
|
||||
#ifdef LTC_DER
|
||||
|
||||
/**
|
||||
Store a BOOLEAN
|
||||
@param in The boolean to encode
|
||||
@param out [out] The destination for the DER encoded BOOLEAN
|
||||
@param outlen [in/out] The max size and resulting size of the DER BOOLEAN
|
||||
@return CRYPT_OK if successful
|
||||
*/
|
||||
int der_encode_boolean(int in,
|
||||
unsigned char *out, unsigned long *outlen)
|
||||
{
|
||||
LTC_ARGCHK(outlen != NULL);
|
||||
LTC_ARGCHK(out != NULL);
|
||||
|
||||
if (*outlen < 3) {
|
||||
*outlen = 3;
|
||||
return CRYPT_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
*outlen = 3;
|
||||
out[0] = 0x01;
|
||||
out[1] = 0x01;
|
||||
out[2] = in ? 0xFF : 0x00;
|
||||
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/boolean/der_encode_boolean.c,v $ */
|
||||
/* $Revision: 1.4 $ */
|
||||
/* $Date: 2006/12/28 01:27:24 $ */
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "../../headers/tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file der_encode_ia5_string.c
|
||||
ASN.1 DER, encode a IA5 STRING, Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef LTC_DER
|
||||
|
||||
/**
|
||||
Store an IA5 STRING
|
||||
@param in The array of IA5 to store (one per char)
|
||||
@param inlen The number of IA5 to store
|
||||
@param out [out] The destination for the DER encoded IA5 STRING
|
||||
@param outlen [in/out] The max size and resulting size of the DER IA5 STRING
|
||||
@return CRYPT_OK if successful
|
||||
*/
|
||||
int der_encode_ia5_string(const unsigned char *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen)
|
||||
{
|
||||
unsigned long x, y, len;
|
||||
int err;
|
||||
|
||||
LTC_ARGCHK(in != NULL);
|
||||
LTC_ARGCHK(out != NULL);
|
||||
LTC_ARGCHK(outlen != NULL);
|
||||
|
||||
/* get the size */
|
||||
if ((err = der_length_ia5_string(in, inlen, &len)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
/* too big? */
|
||||
if (len > *outlen) {
|
||||
*outlen = len;
|
||||
return CRYPT_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
/* encode the header+len */
|
||||
x = 0;
|
||||
out[x++] = 0x16;
|
||||
if (inlen < 128) {
|
||||
out[x++] = (unsigned char)inlen;
|
||||
} else if (inlen < 256) {
|
||||
out[x++] = 0x81;
|
||||
out[x++] = (unsigned char)inlen;
|
||||
} else if (inlen < 65536UL) {
|
||||
out[x++] = 0x82;
|
||||
out[x++] = (unsigned char)((inlen>>8)&255);
|
||||
out[x++] = (unsigned char)(inlen&255);
|
||||
} else if (inlen < 16777216UL) {
|
||||
out[x++] = 0x83;
|
||||
out[x++] = (unsigned char)((inlen>>16)&255);
|
||||
out[x++] = (unsigned char)((inlen>>8)&255);
|
||||
out[x++] = (unsigned char)(inlen&255);
|
||||
} else {
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* store octets */
|
||||
for (y = 0; y < inlen; y++) {
|
||||
out[x++] = der_ia5_char_encode(in[y]);
|
||||
}
|
||||
|
||||
/* retun length */
|
||||
*outlen = x;
|
||||
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/ia5/der_encode_ia5_string.c,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/12/28 01:27:24 $ */
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "../../headers/tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file der_encode_integer.c
|
||||
ASN.1 DER, encode an integer, Tom St Denis
|
||||
*/
|
||||
|
||||
|
||||
#ifdef LTC_DER
|
||||
|
||||
/* Exports a positive bignum as DER format (upto 2^32 bytes in size) */
|
||||
/**
|
||||
Store a mp_int integer
|
||||
@param num The first mp_int to encode
|
||||
@param out [out] The destination for the DER encoded integers
|
||||
@param outlen [in/out] The max size and resulting size of the DER encoded integers
|
||||
@return CRYPT_OK if successful
|
||||
*/
|
||||
int der_encode_integer(void *num, unsigned char *out, unsigned long *outlen)
|
||||
{
|
||||
unsigned long tmplen, y;
|
||||
int err, leading_zero;
|
||||
|
||||
LTC_ARGCHK(num != NULL);
|
||||
LTC_ARGCHK(out != NULL);
|
||||
LTC_ARGCHK(outlen != NULL);
|
||||
|
||||
/* find out how big this will be */
|
||||
if ((err = der_length_integer(num, &tmplen)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if (*outlen < tmplen) {
|
||||
*outlen = tmplen;
|
||||
return CRYPT_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
if (mp_cmp_d(num, 0) != LTC_MP_LT) {
|
||||
/* we only need a leading zero if the msb of the first byte is one */
|
||||
if ((mp_count_bits(num) & 7) == 0 || mp_iszero(num) == LTC_MP_YES) {
|
||||
leading_zero = 1;
|
||||
} else {
|
||||
leading_zero = 0;
|
||||
}
|
||||
|
||||
/* get length of num in bytes (plus 1 since we force the msbyte to zero) */
|
||||
y = mp_unsigned_bin_size(num) + leading_zero;
|
||||
} else {
|
||||
leading_zero = 0;
|
||||
y = mp_count_bits(num);
|
||||
y = y + (8 - (y & 7));
|
||||
y = y >> 3;
|
||||
if (((mp_cnt_lsb(num)+1)==mp_count_bits(num)) && ((mp_count_bits(num)&7)==0)) --y;
|
||||
}
|
||||
|
||||
/* now store initial data */
|
||||
*out++ = 0x02;
|
||||
if (y < 128) {
|
||||
/* short form */
|
||||
*out++ = (unsigned char)y;
|
||||
} else if (y < 256) {
|
||||
*out++ = 0x81;
|
||||
*out++ = (unsigned char)y;
|
||||
} else if (y < 65536UL) {
|
||||
*out++ = 0x82;
|
||||
*out++ = (unsigned char)((y>>8)&255);
|
||||
*out++ = (unsigned char)y;
|
||||
} else if (y < 16777216UL) {
|
||||
*out++ = 0x83;
|
||||
*out++ = (unsigned char)((y>>16)&255);
|
||||
*out++ = (unsigned char)((y>>8)&255);
|
||||
*out++ = (unsigned char)y;
|
||||
} else {
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* now store msbyte of zero if num is non-zero */
|
||||
if (leading_zero) {
|
||||
*out++ = 0x00;
|
||||
}
|
||||
|
||||
/* if it's not zero store it as big endian */
|
||||
if (mp_cmp_d(num, 0) == LTC_MP_GT) {
|
||||
/* now store the mpint */
|
||||
if ((err = mp_to_unsigned_bin(num, out)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
} else if (mp_iszero(num) != LTC_MP_YES) {
|
||||
void *tmp;
|
||||
|
||||
/* negative */
|
||||
if (mp_init(&tmp) != CRYPT_OK) {
|
||||
return CRYPT_MEM;
|
||||
}
|
||||
|
||||
/* 2^roundup and subtract */
|
||||
y = mp_count_bits(num);
|
||||
y = y + (8 - (y & 7));
|
||||
if (((mp_cnt_lsb(num)+1)==mp_count_bits(num)) && ((mp_count_bits(num)&7)==0)) y -= 8;
|
||||
if (mp_2expt(tmp, y) != CRYPT_OK || mp_add(tmp, num, tmp) != CRYPT_OK) {
|
||||
mp_clear(tmp);
|
||||
return CRYPT_MEM;
|
||||
}
|
||||
if ((err = mp_to_unsigned_bin(tmp, out)) != CRYPT_OK) {
|
||||
mp_clear(tmp);
|
||||
return err;
|
||||
}
|
||||
mp_clear(tmp);
|
||||
}
|
||||
|
||||
/* we good */
|
||||
*outlen = tmplen;
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/integer/der_encode_integer.c,v $ */
|
||||
/* $Revision: 1.9 $ */
|
||||
/* $Date: 2006/12/28 01:27:24 $ */
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "../../headers/tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file der_encode_object_identifier.c
|
||||
ASN.1 DER, Encode Object Identifier, Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef LTC_DER
|
||||
/**
|
||||
Encode an OID
|
||||
@param words The words to encode (upto 32-bits each)
|
||||
@param nwords The number of words in the OID
|
||||
@param out [out] Destination of OID data
|
||||
@param outlen [in/out] The max and resulting size of the OID
|
||||
@return CRYPT_OK if successful
|
||||
*/
|
||||
int der_encode_object_identifier(unsigned long *words, unsigned long nwords,
|
||||
unsigned char *out, unsigned long *outlen)
|
||||
{
|
||||
unsigned long i, x, y, z, t, mask, wordbuf;
|
||||
int err;
|
||||
|
||||
LTC_ARGCHK(words != NULL);
|
||||
LTC_ARGCHK(out != NULL);
|
||||
LTC_ARGCHK(outlen != NULL);
|
||||
|
||||
/* check length */
|
||||
if ((err = der_length_object_identifier(words, nwords, &x)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
if (x > *outlen) {
|
||||
*outlen = x;
|
||||
return CRYPT_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
/* compute length to store OID data */
|
||||
z = 0;
|
||||
wordbuf = words[0] * 40 + words[1];
|
||||
for (y = 1; y < nwords; y++) {
|
||||
t = der_object_identifier_bits(wordbuf);
|
||||
z += t/7 + ((t%7) ? 1 : 0) + (wordbuf == 0 ? 1 : 0);
|
||||
if (y < nwords - 1) {
|
||||
wordbuf = words[y + 1];
|
||||
}
|
||||
}
|
||||
|
||||
/* store header + length */
|
||||
x = 0;
|
||||
out[x++] = 0x06;
|
||||
if (z < 128) {
|
||||
out[x++] = (unsigned char)z;
|
||||
} else if (z < 256) {
|
||||
out[x++] = 0x81;
|
||||
out[x++] = (unsigned char)z;
|
||||
} else if (z < 65536UL) {
|
||||
out[x++] = 0x82;
|
||||
out[x++] = (unsigned char)((z>>8)&255);
|
||||
out[x++] = (unsigned char)(z&255);
|
||||
} else {
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* store first byte */
|
||||
wordbuf = words[0] * 40 + words[1];
|
||||
for (i = 1; i < nwords; i++) {
|
||||
/* store 7 bit words in little endian */
|
||||
t = wordbuf & 0xFFFFFFFF;
|
||||
if (t) {
|
||||
y = x;
|
||||
mask = 0;
|
||||
while (t) {
|
||||
out[x++] = (unsigned char)((t & 0x7F) | mask);
|
||||
t >>= 7;
|
||||
mask |= 0x80; /* upper bit is set on all but the last byte */
|
||||
}
|
||||
/* now swap bytes y...x-1 */
|
||||
z = x - 1;
|
||||
while (y < z) {
|
||||
t = out[y]; out[y] = out[z]; out[z] = (unsigned char)t;
|
||||
++y;
|
||||
--z;
|
||||
}
|
||||
} else {
|
||||
/* zero word */
|
||||
out[x++] = 0x00;
|
||||
}
|
||||
|
||||
if (i < nwords - 1) {
|
||||
wordbuf = words[i + 1];
|
||||
}
|
||||
}
|
||||
|
||||
*outlen = x;
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/object_identifier/der_encode_object_identifier.c,v $ */
|
||||
/* $Revision: 1.7 $ */
|
||||
/* $Date: 2006/12/28 01:27:24 $ */
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "../../headers/tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file der_encode_octet_string.c
|
||||
ASN.1 DER, encode a OCTET STRING, Tom St Denis
|
||||
*/
|
||||
|
||||
|
||||
#ifdef LTC_DER
|
||||
|
||||
/**
|
||||
Store an OCTET STRING
|
||||
@param in The array of OCTETS to store (one per char)
|
||||
@param inlen The number of OCTETS to store
|
||||
@param out [out] The destination for the DER encoded OCTET STRING
|
||||
@param outlen [in/out] The max size and resulting size of the DER OCTET STRING
|
||||
@return CRYPT_OK if successful
|
||||
*/
|
||||
int der_encode_octet_string(const unsigned char *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen)
|
||||
{
|
||||
unsigned long x, y, len;
|
||||
int err;
|
||||
|
||||
LTC_ARGCHK(in != NULL);
|
||||
LTC_ARGCHK(out != NULL);
|
||||
LTC_ARGCHK(outlen != NULL);
|
||||
|
||||
/* get the size */
|
||||
if ((err = der_length_octet_string(inlen, &len)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
/* too big? */
|
||||
if (len > *outlen) {
|
||||
*outlen = len;
|
||||
return CRYPT_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
/* encode the header+len */
|
||||
x = 0;
|
||||
out[x++] = 0x04;
|
||||
if (inlen < 128) {
|
||||
out[x++] = (unsigned char)inlen;
|
||||
} else if (inlen < 256) {
|
||||
out[x++] = 0x81;
|
||||
out[x++] = (unsigned char)inlen;
|
||||
} else if (inlen < 65536UL) {
|
||||
out[x++] = 0x82;
|
||||
out[x++] = (unsigned char)((inlen>>8)&255);
|
||||
out[x++] = (unsigned char)(inlen&255);
|
||||
} else if (inlen < 16777216UL) {
|
||||
out[x++] = 0x83;
|
||||
out[x++] = (unsigned char)((inlen>>16)&255);
|
||||
out[x++] = (unsigned char)((inlen>>8)&255);
|
||||
out[x++] = (unsigned char)(inlen&255);
|
||||
} else {
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* store octets */
|
||||
for (y = 0; y < inlen; y++) {
|
||||
out[x++] = in[y];
|
||||
}
|
||||
|
||||
/* retun length */
|
||||
*outlen = x;
|
||||
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/octet/der_encode_octet_string.c,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/12/28 01:27:24 $ */
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "../../headers/tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file der_encode_printable_string.c
|
||||
ASN.1 DER, encode a printable STRING, Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef LTC_DER
|
||||
|
||||
/**
|
||||
Store an printable STRING
|
||||
@param in The array of printable to store (one per char)
|
||||
@param inlen The number of printable to store
|
||||
@param out [out] The destination for the DER encoded printable STRING
|
||||
@param outlen [in/out] The max size and resulting size of the DER printable STRING
|
||||
@return CRYPT_OK if successful
|
||||
*/
|
||||
int der_encode_printable_string(const unsigned char *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen)
|
||||
{
|
||||
unsigned long x, y, len;
|
||||
int err;
|
||||
|
||||
LTC_ARGCHK(in != NULL);
|
||||
LTC_ARGCHK(out != NULL);
|
||||
LTC_ARGCHK(outlen != NULL);
|
||||
|
||||
/* get the size */
|
||||
if ((err = der_length_printable_string(in, inlen, &len)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
/* too big? */
|
||||
if (len > *outlen) {
|
||||
*outlen = len;
|
||||
return CRYPT_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
/* encode the header+len */
|
||||
x = 0;
|
||||
out[x++] = 0x13;
|
||||
if (inlen < 128) {
|
||||
out[x++] = (unsigned char)inlen;
|
||||
} else if (inlen < 256) {
|
||||
out[x++] = 0x81;
|
||||
out[x++] = (unsigned char)inlen;
|
||||
} else if (inlen < 65536UL) {
|
||||
out[x++] = 0x82;
|
||||
out[x++] = (unsigned char)((inlen>>8)&255);
|
||||
out[x++] = (unsigned char)(inlen&255);
|
||||
} else if (inlen < 16777216UL) {
|
||||
out[x++] = 0x83;
|
||||
out[x++] = (unsigned char)((inlen>>16)&255);
|
||||
out[x++] = (unsigned char)((inlen>>8)&255);
|
||||
out[x++] = (unsigned char)(inlen&255);
|
||||
} else {
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* store octets */
|
||||
for (y = 0; y < inlen; y++) {
|
||||
out[x++] = der_printable_char_encode(in[y]);
|
||||
}
|
||||
|
||||
/* retun length */
|
||||
*outlen = x;
|
||||
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/printable_string/der_encode_printable_string.c,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/12/28 01:27:24 $ */
|
||||
|
|
@ -1,335 +0,0 @@
|
|||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "../../headers/tomcrypt.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
/**
|
||||
@file der_encode_sequence_ex.c
|
||||
ASN.1 DER, encode a SEQUENCE, Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef LTC_DER
|
||||
|
||||
/**
|
||||
Encode a SEQUENCE
|
||||
@param list The list of items to encode
|
||||
@param inlen The number of items in the list
|
||||
@param out [out] The destination
|
||||
@param outlen [in/out] The size of the output
|
||||
@param type_of LTC_ASN1_SEQUENCE or LTC_ASN1_SET/LTC_ASN1_SETOF
|
||||
@return CRYPT_OK on success
|
||||
*/
|
||||
int der_encode_sequence_ex(ltc_asn1_list *list, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen, int type_of)
|
||||
{
|
||||
int err, type;
|
||||
unsigned long size, x, y, z, i;
|
||||
void *data;
|
||||
|
||||
LTC_ARGCHK(list != NULL);
|
||||
LTC_ARGCHK(out != NULL);
|
||||
LTC_ARGCHK(outlen != NULL);
|
||||
|
||||
/* get size of output that will be required */
|
||||
y = 0;
|
||||
for (i = 0; i < inlen; i++) {
|
||||
type = list[i].type;
|
||||
size = list[i].size;
|
||||
data = list[i].data;
|
||||
|
||||
if (type == LTC_ASN1_EOL) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case LTC_ASN1_BOOLEAN:
|
||||
if ((err = der_length_boolean(&x)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
y += x;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_INTEGER:
|
||||
if ((err = der_length_integer(data, &x)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
y += x;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_SHORT_INTEGER:
|
||||
if ((err = der_length_short_integer(*((unsigned long*)data), &x)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
y += x;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_BIT_STRING:
|
||||
if ((err = der_length_bit_string(size, &x)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
y += x;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_OCTET_STRING:
|
||||
if ((err = der_length_octet_string(size, &x)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
y += x;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_NULL:
|
||||
y += 2;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_OBJECT_IDENTIFIER:
|
||||
if ((err = der_length_object_identifier(data, size, &x)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
y += x;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_IA5_STRING:
|
||||
if ((err = der_length_ia5_string(data, size, &x)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
y += x;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_PRINTABLE_STRING:
|
||||
if ((err = der_length_printable_string(data, size, &x)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
y += x;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_UTF8_STRING:
|
||||
if ((err = der_length_utf8_string(data, size, &x)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
y += x;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_UTCTIME:
|
||||
if ((err = der_length_utctime(data, &x)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
y += x;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_SET:
|
||||
case LTC_ASN1_SETOF:
|
||||
case LTC_ASN1_SEQUENCE:
|
||||
if ((err = der_length_sequence(data, size, &x)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
y += x;
|
||||
break;
|
||||
|
||||
default:
|
||||
err = CRYPT_INVALID_ARG;
|
||||
goto LBL_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
/* calc header size */
|
||||
z = y;
|
||||
if (y < 128) {
|
||||
y += 2;
|
||||
} else if (y < 256) {
|
||||
/* 0x30 0x81 LL */
|
||||
y += 3;
|
||||
} else if (y < 65536UL) {
|
||||
/* 0x30 0x82 LL LL */
|
||||
y += 4;
|
||||
} else if (y < 16777216UL) {
|
||||
/* 0x30 0x83 LL LL LL */
|
||||
y += 5;
|
||||
} else {
|
||||
err = CRYPT_INVALID_ARG;
|
||||
goto LBL_ERR;
|
||||
}
|
||||
|
||||
/* too big ? */
|
||||
if (*outlen < y) {
|
||||
*outlen = y;
|
||||
err = CRYPT_BUFFER_OVERFLOW;
|
||||
goto LBL_ERR;
|
||||
}
|
||||
|
||||
/* store header */
|
||||
x = 0;
|
||||
out[x++] = (type_of == LTC_ASN1_SEQUENCE) ? 0x30 : 0x31;
|
||||
|
||||
if (z < 128) {
|
||||
out[x++] = (unsigned char)z;
|
||||
} else if (z < 256) {
|
||||
out[x++] = 0x81;
|
||||
out[x++] = (unsigned char)z;
|
||||
} else if (z < 65536UL) {
|
||||
out[x++] = 0x82;
|
||||
out[x++] = (unsigned char)((z>>8UL)&255);
|
||||
out[x++] = (unsigned char)(z&255);
|
||||
} else if (z < 16777216UL) {
|
||||
out[x++] = 0x83;
|
||||
out[x++] = (unsigned char)((z>>16UL)&255);
|
||||
out[x++] = (unsigned char)((z>>8UL)&255);
|
||||
out[x++] = (unsigned char)(z&255);
|
||||
}
|
||||
|
||||
/* store data */
|
||||
*outlen -= x;
|
||||
for (i = 0; i < inlen; i++) {
|
||||
type = list[i].type;
|
||||
size = list[i].size;
|
||||
data = list[i].data;
|
||||
|
||||
if (type == LTC_ASN1_EOL) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case LTC_ASN1_BOOLEAN:
|
||||
z = *outlen;
|
||||
if ((err = der_encode_boolean(*((int *)data), out + x, &z)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
x += z;
|
||||
*outlen -= z;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_INTEGER:
|
||||
z = *outlen;
|
||||
if ((err = der_encode_integer(data, out + x, &z)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
x += z;
|
||||
*outlen -= z;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_SHORT_INTEGER:
|
||||
z = *outlen;
|
||||
if ((err = der_encode_short_integer(*((unsigned long*)data), out + x, &z)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
x += z;
|
||||
*outlen -= z;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_BIT_STRING:
|
||||
z = *outlen;
|
||||
if ((err = der_encode_bit_string(data, size, out + x, &z)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
x += z;
|
||||
*outlen -= z;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_OCTET_STRING:
|
||||
z = *outlen;
|
||||
if ((err = der_encode_octet_string(data, size, out + x, &z)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
x += z;
|
||||
*outlen -= z;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_NULL:
|
||||
out[x++] = 0x05;
|
||||
out[x++] = 0x00;
|
||||
*outlen -= 2;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_OBJECT_IDENTIFIER:
|
||||
z = *outlen;
|
||||
if ((err = der_encode_object_identifier(data, size, out + x, &z)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
x += z;
|
||||
*outlen -= z;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_IA5_STRING:
|
||||
z = *outlen;
|
||||
if ((err = der_encode_ia5_string(data, size, out + x, &z)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
x += z;
|
||||
*outlen -= z;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_PRINTABLE_STRING:
|
||||
z = *outlen;
|
||||
if ((err = der_encode_printable_string(data, size, out + x, &z)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
x += z;
|
||||
*outlen -= z;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_UTF8_STRING:
|
||||
z = *outlen;
|
||||
if ((err = der_encode_utf8_string(data, size, out + x, &z)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
x += z;
|
||||
*outlen -= z;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_UTCTIME:
|
||||
z = *outlen;
|
||||
if ((err = der_encode_utctime(data, out + x, &z)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
x += z;
|
||||
*outlen -= z;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_SET:
|
||||
z = *outlen;
|
||||
if ((err = der_encode_set(data, size, out + x, &z)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
x += z;
|
||||
*outlen -= z;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_SETOF:
|
||||
z = *outlen;
|
||||
if ((err = der_encode_setof(data, size, out + x, &z)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
x += z;
|
||||
*outlen -= z;
|
||||
break;
|
||||
|
||||
case LTC_ASN1_SEQUENCE:
|
||||
z = *outlen;
|
||||
if ((err = der_encode_sequence_ex(data, size, out + x, &z, type)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
x += z;
|
||||
*outlen -= z;
|
||||
break;
|
||||
|
||||
default:
|
||||
err = CRYPT_INVALID_ARG;
|
||||
goto LBL_ERR;
|
||||
}
|
||||
}
|
||||
*outlen = x;
|
||||
err = CRYPT_OK;
|
||||
|
||||
LBL_ERR:
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,138 +0,0 @@
|
|||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "../../headers/tomcrypt.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
/**
|
||||
@file der_encode_sequence_multi.c
|
||||
ASN.1 DER, encode a SEQUENCE, Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef LTC_DER
|
||||
|
||||
/**
|
||||
Encode a SEQUENCE type using a VA list
|
||||
@param out [out] Destination for data
|
||||
@param outlen [in/out] Length of buffer and resulting length of output
|
||||
@remark <...> is of the form <type, size, data> (int, unsigned long, void*)
|
||||
@return CRYPT_OK on success
|
||||
*/
|
||||
int der_encode_sequence_multi(unsigned char *out, unsigned long *outlen, ...)
|
||||
{
|
||||
int err, type;
|
||||
unsigned long size, x;
|
||||
void *data;
|
||||
va_list args;
|
||||
ltc_asn1_list *list;
|
||||
|
||||
LTC_ARGCHK(out != NULL);
|
||||
LTC_ARGCHK(outlen != NULL);
|
||||
|
||||
/* get size of output that will be required */
|
||||
va_start(args, outlen);
|
||||
x = 0;
|
||||
for (;;) {
|
||||
type = va_arg(args, int);
|
||||
size = va_arg(args, unsigned long);
|
||||
data = va_arg(args, void*);
|
||||
|
||||
if (type == LTC_ASN1_EOL) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case LTC_ASN1_BOOLEAN:
|
||||
case LTC_ASN1_INTEGER:
|
||||
case LTC_ASN1_SHORT_INTEGER:
|
||||
case LTC_ASN1_BIT_STRING:
|
||||
case LTC_ASN1_OCTET_STRING:
|
||||
case LTC_ASN1_NULL:
|
||||
case LTC_ASN1_OBJECT_IDENTIFIER:
|
||||
case LTC_ASN1_IA5_STRING:
|
||||
case LTC_ASN1_PRINTABLE_STRING:
|
||||
case LTC_ASN1_UTF8_STRING:
|
||||
case LTC_ASN1_UTCTIME:
|
||||
case LTC_ASN1_SEQUENCE:
|
||||
case LTC_ASN1_SET:
|
||||
case LTC_ASN1_SETOF:
|
||||
++x;
|
||||
break;
|
||||
|
||||
default:
|
||||
va_end(args);
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
va_end(args);
|
||||
|
||||
/* allocate structure for x elements */
|
||||
if (x == 0) {
|
||||
return CRYPT_NOP;
|
||||
}
|
||||
|
||||
list = XCALLOC(sizeof(*list), x);
|
||||
if (list == NULL) {
|
||||
return CRYPT_MEM;
|
||||
}
|
||||
|
||||
/* fill in the structure */
|
||||
va_start(args, outlen);
|
||||
x = 0;
|
||||
for (;;) {
|
||||
type = va_arg(args, int);
|
||||
size = va_arg(args, unsigned long);
|
||||
data = va_arg(args, void*);
|
||||
|
||||
if (type == LTC_ASN1_EOL) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case LTC_ASN1_BOOLEAN:
|
||||
case LTC_ASN1_INTEGER:
|
||||
case LTC_ASN1_SHORT_INTEGER:
|
||||
case LTC_ASN1_BIT_STRING:
|
||||
case LTC_ASN1_OCTET_STRING:
|
||||
case LTC_ASN1_NULL:
|
||||
case LTC_ASN1_OBJECT_IDENTIFIER:
|
||||
case LTC_ASN1_IA5_STRING:
|
||||
case LTC_ASN1_PRINTABLE_STRING:
|
||||
case LTC_ASN1_UTF8_STRING:
|
||||
case LTC_ASN1_UTCTIME:
|
||||
case LTC_ASN1_SEQUENCE:
|
||||
case LTC_ASN1_SET:
|
||||
case LTC_ASN1_SETOF:
|
||||
list[x].type = type;
|
||||
list[x].size = size;
|
||||
list[x++].data = data;
|
||||
break;
|
||||
|
||||
default:
|
||||
va_end(args);
|
||||
err = CRYPT_INVALID_ARG;
|
||||
goto LBL_ERR;
|
||||
}
|
||||
}
|
||||
va_end(args);
|
||||
|
||||
err = der_encode_sequence(list, x, out, outlen);
|
||||
LBL_ERR:
|
||||
XFREE(list);
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_multi.c,v $ */
|
||||
/* $Revision: 1.12 $ */
|
||||
/* $Date: 2006/12/28 01:27:24 $ */
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "../../headers/tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file der_encode_set.c
|
||||
ASN.1 DER, Encode a SET, Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef LTC_DER
|
||||
|
||||
/* LTC define to ASN.1 TAG */
|
||||
static int ltc_to_asn1(int v)
|
||||
{
|
||||
switch (v) {
|
||||
case LTC_ASN1_BOOLEAN: return 0x01;
|
||||
case LTC_ASN1_INTEGER:
|
||||
case LTC_ASN1_SHORT_INTEGER: return 0x02;
|
||||
case LTC_ASN1_BIT_STRING: return 0x03;
|
||||
case LTC_ASN1_OCTET_STRING: return 0x04;
|
||||
case LTC_ASN1_NULL: return 0x05;
|
||||
case LTC_ASN1_OBJECT_IDENTIFIER: return 0x06;
|
||||
case LTC_ASN1_UTF8_STRING: return 0x0C;
|
||||
case LTC_ASN1_PRINTABLE_STRING: return 0x13;
|
||||
case LTC_ASN1_IA5_STRING: return 0x16;
|
||||
case LTC_ASN1_UTCTIME: return 0x17;
|
||||
case LTC_ASN1_SEQUENCE: return 0x30;
|
||||
case LTC_ASN1_SET:
|
||||
case LTC_ASN1_SETOF: return 0x31;
|
||||
default: return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int qsort_helper(const void *a, const void *b)
|
||||
{
|
||||
ltc_asn1_list *A = (ltc_asn1_list *)a, *B = (ltc_asn1_list *)b;
|
||||
int r;
|
||||
|
||||
r = ltc_to_asn1(A->type) - ltc_to_asn1(B->type);
|
||||
|
||||
/* for QSORT the order is UNDEFINED if they are "equal" which means it is NOT DETERMINISTIC. So we force it to be :-) */
|
||||
if (r == 0) {
|
||||
/* their order in the original list now determines the position */
|
||||
return A->used - B->used;
|
||||
} else {
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Encode a SET type
|
||||
@param list The list of items to encode
|
||||
@param inlen The number of items in the list
|
||||
@param out [out] The destination
|
||||
@param outlen [in/out] The size of the output
|
||||
@return CRYPT_OK on success
|
||||
*/
|
||||
int der_encode_set(ltc_asn1_list *list, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen)
|
||||
{
|
||||
ltc_asn1_list *copy;
|
||||
unsigned long x;
|
||||
int err;
|
||||
|
||||
/* make copy of list */
|
||||
copy = XCALLOC(inlen, sizeof(*copy));
|
||||
if (copy == NULL) {
|
||||
return CRYPT_MEM;
|
||||
}
|
||||
|
||||
/* fill in used member with index so we can fully sort it */
|
||||
for (x = 0; x < inlen; x++) {
|
||||
copy[x] = list[x];
|
||||
copy[x].used = x;
|
||||
}
|
||||
|
||||
/* sort it by the "type" field */
|
||||
XQSORT(copy, inlen, sizeof(*copy), &qsort_helper);
|
||||
|
||||
/* call der_encode_sequence_ex() */
|
||||
err = der_encode_sequence_ex(copy, inlen, out, outlen, LTC_ASN1_SET);
|
||||
|
||||
/* free list */
|
||||
XFREE(copy);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/set/der_encode_set.c,v $ */
|
||||
/* $Revision: 1.12 $ */
|
||||
/* $Date: 2006/12/28 01:27:24 $ */
|
||||
|
|
@ -1,162 +0,0 @@
|
|||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "../../headers/tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file der_encode_setof.c
|
||||
ASN.1 DER, Encode SET OF, Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef LTC_DER
|
||||
|
||||
struct edge {
|
||||
unsigned char *start;
|
||||
unsigned long size;
|
||||
};
|
||||
|
||||
static int qsort_helper(const void *a, const void *b)
|
||||
{
|
||||
struct edge *A = (struct edge *)a, *B = (struct edge *)b;
|
||||
int r;
|
||||
unsigned long x;
|
||||
|
||||
/* compare min length */
|
||||
r = XMEMCMP(A->start, B->start, MIN(A->size, B->size));
|
||||
|
||||
if (r == 0 && A->size != B->size) {
|
||||
if (A->size > B->size) {
|
||||
for (x = B->size; x < A->size; x++) {
|
||||
if (A->start[x]) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (x = A->size; x < B->size; x++) {
|
||||
if (B->start[x]) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
Encode a SETOF stucture
|
||||
@param list The list of items to encode
|
||||
@param inlen The number of items in the list
|
||||
@param out [out] The destination
|
||||
@param outlen [in/out] The size of the output
|
||||
@return CRYPT_OK on success
|
||||
*/
|
||||
int der_encode_setof(ltc_asn1_list *list, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen)
|
||||
{
|
||||
unsigned long x, y, z, hdrlen;
|
||||
int err;
|
||||
struct edge *edges;
|
||||
unsigned char *ptr, *buf;
|
||||
|
||||
/* check that they're all the same type */
|
||||
for (x = 1; x < inlen; x++) {
|
||||
if (list[x].type != list[x-1].type) {
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
|
||||
/* alloc buffer to store copy of output */
|
||||
buf = XCALLOC(1, *outlen);
|
||||
if (buf == NULL) {
|
||||
return CRYPT_MEM;
|
||||
}
|
||||
|
||||
/* encode list */
|
||||
if ((err = der_encode_sequence_ex(list, inlen, buf, outlen, LTC_ASN1_SETOF)) != CRYPT_OK) {
|
||||
XFREE(buf);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* allocate edges */
|
||||
edges = XCALLOC(inlen, sizeof(*edges));
|
||||
if (edges == NULL) {
|
||||
XFREE(buf);
|
||||
return CRYPT_MEM;
|
||||
}
|
||||
|
||||
/* skip header */
|
||||
ptr = buf + 1;
|
||||
|
||||
/* now skip length data */
|
||||
x = *ptr++;
|
||||
if (x >= 0x80) {
|
||||
ptr += (x & 0x7F);
|
||||
}
|
||||
|
||||
/* get the size of the static header */
|
||||
hdrlen = (unsigned long)((size_t)ptr - (size_t)buf);
|
||||
|
||||
|
||||
/* scan for edges */
|
||||
x = 0;
|
||||
while (ptr < (buf + *outlen)) {
|
||||
/* store start */
|
||||
edges[x].start = ptr;
|
||||
|
||||
/* skip type */
|
||||
z = 1;
|
||||
|
||||
/* parse length */
|
||||
y = ptr[z++];
|
||||
if (y < 128) {
|
||||
edges[x].size = y;
|
||||
} else {
|
||||
y &= 0x7F;
|
||||
edges[x].size = 0;
|
||||
while (y--) {
|
||||
edges[x].size = (edges[x].size << 8) | ((unsigned long)ptr[z++]);
|
||||
}
|
||||
}
|
||||
|
||||
/* skip content */
|
||||
edges[x].size += z;
|
||||
ptr += edges[x].size;
|
||||
++x;
|
||||
}
|
||||
|
||||
/* sort based on contents (using edges) */
|
||||
XQSORT(edges, inlen, sizeof(*edges), &qsort_helper);
|
||||
|
||||
/* copy static header */
|
||||
XMEMCPY(out, buf, hdrlen);
|
||||
|
||||
/* copy+sort using edges+indecies to output from buffer */
|
||||
for (y = hdrlen, x = 0; x < inlen; x++) {
|
||||
XMEMCPY(out+y, edges[x].start, edges[x].size);
|
||||
y += edges[x].size;
|
||||
}
|
||||
|
||||
#ifdef LTC_CLEAN_STACK
|
||||
zeromem(buf, *outlen);
|
||||
#endif
|
||||
|
||||
/* free buffers */
|
||||
XFREE(edges);
|
||||
XFREE(buf);
|
||||
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/set/der_encode_setof.c,v $ */
|
||||
/* $Revision: 1.12 $ */
|
||||
/* $Date: 2006/12/28 01:27:24 $ */
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "../../headers/tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file der_encode_short_integer.c
|
||||
ASN.1 DER, encode an integer, Tom St Denis
|
||||
*/
|
||||
|
||||
|
||||
#ifdef LTC_DER
|
||||
|
||||
/**
|
||||
Store a short integer in the range (0,2^32-1)
|
||||
@param num The integer to encode
|
||||
@param out [out] The destination for the DER encoded integers
|
||||
@param outlen [in/out] The max size and resulting size of the DER encoded integers
|
||||
@return CRYPT_OK if successful
|
||||
*/
|
||||
int der_encode_short_integer(unsigned long num, unsigned char *out, unsigned long *outlen)
|
||||
{
|
||||
unsigned long len, x, y, z;
|
||||
int err;
|
||||
|
||||
LTC_ARGCHK(out != NULL);
|
||||
LTC_ARGCHK(outlen != NULL);
|
||||
|
||||
/* force to 32 bits */
|
||||
num &= 0xFFFFFFFFUL;
|
||||
|
||||
/* find out how big this will be */
|
||||
if ((err = der_length_short_integer(num, &len)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if (*outlen < len) {
|
||||
*outlen = len;
|
||||
return CRYPT_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
/* get len of output */
|
||||
z = 0;
|
||||
y = num;
|
||||
while (y) {
|
||||
++z;
|
||||
y >>= 8;
|
||||
}
|
||||
|
||||
/* handle zero */
|
||||
if (z == 0) {
|
||||
z = 1;
|
||||
}
|
||||
|
||||
/* see if msb is set */
|
||||
z += (num&(1UL<<((z<<3) - 1))) ? 1 : 0;
|
||||
|
||||
/* adjust the number so the msB is non-zero */
|
||||
for (x = 0; (z <= 4) && (x < (4 - z)); x++) {
|
||||
num <<= 8;
|
||||
}
|
||||
|
||||
/* store header */
|
||||
x = 0;
|
||||
out[x++] = 0x02;
|
||||
out[x++] = (unsigned char)z;
|
||||
|
||||
/* if 31st bit is set output a leading zero and decrement count */
|
||||
if (z == 5) {
|
||||
out[x++] = 0;
|
||||
--z;
|
||||
}
|
||||
|
||||
/* store values */
|
||||
for (y = 0; y < z; y++) {
|
||||
out[x++] = (unsigned char)((num >> 24) & 0xFF);
|
||||
num <<= 8;
|
||||
}
|
||||
|
||||
/* we good */
|
||||
*outlen = x;
|
||||
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/short_integer/der_encode_short_integer.c,v $ */
|
||||
/* $Revision: 1.8 $ */
|
||||
/* $Date: 2006/12/28 01:27:24 $ */
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "../../headers/tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file der_encode_utctime.c
|
||||
ASN.1 DER, encode a UTCTIME, Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef LTC_DER
|
||||
|
||||
static const char *baseten = "0123456789";
|
||||
|
||||
#define STORE_V(y) \
|
||||
out[x++] = der_ia5_char_encode(baseten[(y/10) % 10]); \
|
||||
out[x++] = der_ia5_char_encode(baseten[y % 10]);
|
||||
|
||||
/**
|
||||
Encodes a UTC time structure in DER format
|
||||
@param utctime The UTC time structure to encode
|
||||
@param out The destination of the DER encoding of the UTC time structure
|
||||
@param outlen [in/out] The length of the DER encoding
|
||||
@return CRYPT_OK if successful
|
||||
*/
|
||||
int der_encode_utctime(ltc_utctime *utctime,
|
||||
unsigned char *out, unsigned long *outlen)
|
||||
{
|
||||
unsigned long x, tmplen;
|
||||
int err;
|
||||
|
||||
LTC_ARGCHK(utctime != NULL);
|
||||
LTC_ARGCHK(out != NULL);
|
||||
LTC_ARGCHK(outlen != NULL);
|
||||
|
||||
if ((err = der_length_utctime(utctime, &tmplen)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
if (tmplen > *outlen) {
|
||||
*outlen = tmplen;
|
||||
return CRYPT_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
/* store header */
|
||||
out[0] = 0x17;
|
||||
|
||||
/* store values */
|
||||
x = 2;
|
||||
STORE_V(utctime->YY);
|
||||
STORE_V(utctime->MM);
|
||||
STORE_V(utctime->DD);
|
||||
STORE_V(utctime->hh);
|
||||
STORE_V(utctime->mm);
|
||||
STORE_V(utctime->ss);
|
||||
|
||||
if (utctime->off_mm || utctime->off_hh) {
|
||||
out[x++] = der_ia5_char_encode(utctime->off_dir ? '-' : '+');
|
||||
STORE_V(utctime->off_hh);
|
||||
STORE_V(utctime->off_mm);
|
||||
} else {
|
||||
out[x++] = der_ia5_char_encode('Z');
|
||||
}
|
||||
|
||||
/* store length */
|
||||
out[1] = (unsigned char)(x - 2);
|
||||
|
||||
/* all good let's return */
|
||||
*outlen = x;
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/utctime/der_encode_utctime.c,v $ */
|
||||
/* $Revision: 1.10 $ */
|
||||
/* $Date: 2006/12/28 01:27:24 $ */
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "../../headers/tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file der_encode_utf8_string.c
|
||||
ASN.1 DER, encode a UTF8 STRING, Tom St Denis
|
||||
*/
|
||||
|
||||
|
||||
#ifdef LTC_DER
|
||||
|
||||
/**
|
||||
Store an UTF8 STRING
|
||||
@param in The array of UTF8 to store (one per wchar_t)
|
||||
@param inlen The number of UTF8 to store
|
||||
@param out [out] The destination for the DER encoded UTF8 STRING
|
||||
@param outlen [in/out] The max size and resulting size of the DER UTF8 STRING
|
||||
@return CRYPT_OK if successful
|
||||
*/
|
||||
int der_encode_utf8_string(const wchar_t *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen)
|
||||
{
|
||||
unsigned long x, y, len;
|
||||
|
||||
LTC_ARGCHK(in != NULL);
|
||||
LTC_ARGCHK(out != NULL);
|
||||
LTC_ARGCHK(outlen != NULL);
|
||||
|
||||
/* get the size */
|
||||
for (x = len = 0; x < inlen; x++) {
|
||||
if (in[x] < 0 || in[x] > 0x1FFFF) {
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
len += der_utf8_charsize(in[x]);
|
||||
}
|
||||
|
||||
if (len < 128) {
|
||||
y = 2 + len;
|
||||
} else if (len < 256) {
|
||||
y = 3 + len;
|
||||
} else if (len < 65536UL) {
|
||||
y = 4 + len;
|
||||
} else if (len < 16777216UL) {
|
||||
y = 5 + len;
|
||||
} else {
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* too big? */
|
||||
if (y > *outlen) {
|
||||
*outlen = len;
|
||||
return CRYPT_BUFFER_OVERFLOW;
|
||||
}
|
||||
|
||||
/* encode the header+len */
|
||||
x = 0;
|
||||
out[x++] = 0x0C;
|
||||
if (len < 128) {
|
||||
out[x++] = (unsigned char)len;
|
||||
} else if (len < 256) {
|
||||
out[x++] = 0x81;
|
||||
out[x++] = (unsigned char)len;
|
||||
} else if (len < 65536UL) {
|
||||
out[x++] = 0x82;
|
||||
out[x++] = (unsigned char)((len>>8)&255);
|
||||
out[x++] = (unsigned char)(len&255);
|
||||
} else if (len < 16777216UL) {
|
||||
out[x++] = 0x83;
|
||||
out[x++] = (unsigned char)((len>>16)&255);
|
||||
out[x++] = (unsigned char)((len>>8)&255);
|
||||
out[x++] = (unsigned char)(len&255);
|
||||
} else {
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
|
||||
/* store UTF8 */
|
||||
for (y = 0; y < inlen; y++) {
|
||||
switch (der_utf8_charsize(in[y])) {
|
||||
case 1: out[x++] = (unsigned char)in[y]; break;
|
||||
case 2: out[x++] = 0xC0 | ((in[y] >> 6) & 0x1F); out[x++] = 0x80 | (in[y] & 0x3F); break;
|
||||
case 3: out[x++] = 0xE0 | ((in[y] >> 12) & 0x0F); out[x++] = 0x80 | ((in[y] >> 6) & 0x3F); out[x++] = 0x80 | (in[y] & 0x3F); break;
|
||||
case 4: out[x++] = 0xF0 | ((in[y] >> 18) & 0x07); out[x++] = 0x80 | ((in[y] >> 12) & 0x3F); out[x++] = 0x80 | ((in[y] >> 6) & 0x3F); out[x++] = 0x80 | (in[y] & 0x3F); break;
|
||||
}
|
||||
}
|
||||
|
||||
/* retun length */
|
||||
*outlen = x;
|
||||
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/utf8/der_encode_utf8_string.c,v $ */
|
||||
/* $Revision: 1.9 $ */
|
||||
/* $Date: 2006/12/28 01:27:24 $ */
|
||||
|
|
@ -1,175 +0,0 @@
|
|||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "../../headers/tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file pkcs_1_pss_encode.c
|
||||
LTC_PKCS #1 PSS Signature Padding, Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef LTC_PKCS_1
|
||||
|
||||
/**
|
||||
LTC_PKCS #1 v2.00 Signature Encoding
|
||||
@param msghash The hash to encode
|
||||
@param msghashlen The length of the hash (octets)
|
||||
@param saltlen The length of the salt desired (octets)
|
||||
@param prng An active PRNG context
|
||||
@param prng_idx The index of the PRNG desired
|
||||
@param hash_idx The index of the hash desired
|
||||
@param modulus_bitlen The bit length of the RSA modulus
|
||||
@param out [out] The destination of the encoding
|
||||
@param outlen [in/out] The max size and resulting size of the encoded data
|
||||
@return CRYPT_OK if successful
|
||||
*/
|
||||
int pkcs_1_pss_encode(const unsigned char *msghash, unsigned long msghashlen,
|
||||
unsigned long saltlen, prng_state *prng,
|
||||
int prng_idx, int hash_idx,
|
||||
unsigned long modulus_bitlen,
|
||||
unsigned char *out, unsigned long *outlen)
|
||||
{
|
||||
unsigned char *DB, *mask, *salt, *hash;
|
||||
unsigned long x, y, hLen, modulus_len;
|
||||
int err;
|
||||
hash_state md;
|
||||
|
||||
LTC_ARGCHK(msghash != NULL);
|
||||
LTC_ARGCHK(out != NULL);
|
||||
LTC_ARGCHK(outlen != NULL);
|
||||
|
||||
/* ensure hash and PRNG are valid */
|
||||
if ((err = hash_is_valid(hash_idx)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
if ((err = prng_is_valid(prng_idx)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
hLen = hash_descriptor[hash_idx].hashsize;
|
||||
modulus_len = (modulus_bitlen>>3) + (modulus_bitlen & 7 ? 1 : 0);
|
||||
|
||||
/* check sizes */
|
||||
if ((saltlen > modulus_len) || (modulus_len < hLen + saltlen + 2)) {
|
||||
return CRYPT_PK_INVALID_SIZE;
|
||||
}
|
||||
|
||||
/* allocate ram for DB/mask/salt/hash of size modulus_len */
|
||||
DB = XMALLOC(modulus_len);
|
||||
mask = XMALLOC(modulus_len);
|
||||
salt = XMALLOC(modulus_len);
|
||||
hash = XMALLOC(modulus_len);
|
||||
if (DB == NULL || mask == NULL || salt == NULL || hash == NULL) {
|
||||
if (DB != NULL) {
|
||||
XFREE(DB);
|
||||
}
|
||||
if (mask != NULL) {
|
||||
XFREE(mask);
|
||||
}
|
||||
if (salt != NULL) {
|
||||
XFREE(salt);
|
||||
}
|
||||
if (hash != NULL) {
|
||||
XFREE(hash);
|
||||
}
|
||||
return CRYPT_MEM;
|
||||
}
|
||||
|
||||
|
||||
/* generate random salt */
|
||||
if (saltlen > 0) {
|
||||
if (prng_descriptor[prng_idx].read(salt, saltlen, prng) != saltlen) {
|
||||
err = CRYPT_ERROR_READPRNG;
|
||||
goto LBL_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
/* M = (eight) 0x00 || msghash || salt, hash = H(M) */
|
||||
if ((err = hash_descriptor[hash_idx].init(&md)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
zeromem(DB, 8);
|
||||
if ((err = hash_descriptor[hash_idx].process(&md, DB, 8)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
if ((err = hash_descriptor[hash_idx].process(&md, msghash, msghashlen)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
if ((err = hash_descriptor[hash_idx].process(&md, salt, saltlen)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
if ((err = hash_descriptor[hash_idx].done(&md, hash)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
|
||||
/* generate DB = PS || 0x01 || salt, PS == modulus_len - saltlen - hLen - 2 zero bytes */
|
||||
x = 0;
|
||||
XMEMSET(DB + x, 0, modulus_len - saltlen - hLen - 2);
|
||||
x += modulus_len - saltlen - hLen - 2;
|
||||
DB[x++] = 0x01;
|
||||
XMEMCPY(DB + x, salt, saltlen);
|
||||
x += saltlen;
|
||||
|
||||
/* generate mask of length modulus_len - hLen - 1 from hash */
|
||||
if ((err = pkcs_1_mgf1(hash_idx, hash, hLen, mask, modulus_len - hLen - 1)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
|
||||
/* xor against DB */
|
||||
for (y = 0; y < (modulus_len - hLen - 1); y++) {
|
||||
DB[y] ^= mask[y];
|
||||
}
|
||||
|
||||
/* output is DB || hash || 0xBC */
|
||||
if (*outlen < modulus_len) {
|
||||
*outlen = modulus_len;
|
||||
err = CRYPT_BUFFER_OVERFLOW;
|
||||
goto LBL_ERR;
|
||||
}
|
||||
|
||||
/* DB len = modulus_len - hLen - 1 */
|
||||
y = 0;
|
||||
XMEMCPY(out + y, DB, modulus_len - hLen - 1);
|
||||
y += modulus_len - hLen - 1;
|
||||
|
||||
/* hash */
|
||||
XMEMCPY(out + y, hash, hLen);
|
||||
y += hLen;
|
||||
|
||||
/* 0xBC */
|
||||
out[y] = 0xBC;
|
||||
|
||||
/* now clear the 8*modulus_len - modulus_bitlen most significant bits */
|
||||
out[0] &= 0xFF >> ((modulus_len<<3) - (modulus_bitlen-1));
|
||||
|
||||
/* store output size */
|
||||
*outlen = modulus_len;
|
||||
err = CRYPT_OK;
|
||||
LBL_ERR:
|
||||
#ifdef LTC_CLEAN_STACK
|
||||
zeromem(DB, modulus_len);
|
||||
zeromem(mask, modulus_len);
|
||||
zeromem(salt, modulus_len);
|
||||
zeromem(hash, modulus_len);
|
||||
#endif
|
||||
|
||||
XFREE(hash);
|
||||
XFREE(salt);
|
||||
XFREE(mask);
|
||||
XFREE(DB);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif /* LTC_PKCS_1 */
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/pk/pkcs1/pkcs_1_pss_encode.c,v $ */
|
||||
/* $Revision: 1.9 $ */
|
||||
/* $Date: 2007/05/12 14:32:35 $ */
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "../../headers/tomcrypt.h"
|
||||
|
||||
/*! \file pkcs_1_v1_5_encode.c
|
||||
*
|
||||
* LTC_PKCS #1 v1.5 Padding (Andreas Lange)
|
||||
*/
|
||||
|
||||
#ifdef LTC_PKCS_1
|
||||
|
||||
/*! \brief LTC_PKCS #1 v1.5 encode.
|
||||
*
|
||||
* \param msg The data to encode
|
||||
* \param msglen The length of the data to encode (octets)
|
||||
* \param block_type Block type to use in padding (\sa ltc_pkcs_1_v1_5_blocks)
|
||||
* \param modulus_bitlen The bit length of the RSA modulus
|
||||
* \param prng An active PRNG state (only for LTC_LTC_PKCS_1_EME)
|
||||
* \param prng_idx The index of the PRNG desired (only for LTC_LTC_PKCS_1_EME)
|
||||
* \param out [out] The destination for the encoded data
|
||||
* \param outlen [in/out] The max size and resulting size of the encoded data
|
||||
*
|
||||
* \return CRYPT_OK if successful
|
||||
*/
|
||||
int pkcs_1_v1_5_encode(const unsigned char *msg,
|
||||
unsigned long msglen,
|
||||
int block_type,
|
||||
unsigned long modulus_bitlen,
|
||||
prng_state *prng,
|
||||
int prng_idx,
|
||||
unsigned char *out,
|
||||
unsigned long *outlen)
|
||||
{
|
||||
unsigned long modulus_len, ps_len, i;
|
||||
unsigned char *ps;
|
||||
int result;
|
||||
|
||||
/* valid block_type? */
|
||||
if ((block_type != LTC_LTC_PKCS_1_EMSA) &&
|
||||
(block_type != LTC_LTC_PKCS_1_EME)) {
|
||||
return CRYPT_PK_INVALID_PADDING;
|
||||
}
|
||||
|
||||
if (block_type == LTC_LTC_PKCS_1_EME) { /* encryption padding, we need a valid PRNG */
|
||||
if ((result = prng_is_valid(prng_idx)) != CRYPT_OK) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
modulus_len = (modulus_bitlen >> 3) + (modulus_bitlen & 7 ? 1 : 0);
|
||||
|
||||
/* test message size */
|
||||
if ((msglen + 11) > modulus_len) {
|
||||
return CRYPT_PK_INVALID_SIZE;
|
||||
}
|
||||
|
||||
if (*outlen < modulus_len) {
|
||||
*outlen = modulus_len;
|
||||
result = CRYPT_BUFFER_OVERFLOW;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* generate an octets string PS */
|
||||
ps = &out[2];
|
||||
ps_len = modulus_len - msglen - 3;
|
||||
|
||||
if (block_type == LTC_LTC_PKCS_1_EME) {
|
||||
/* now choose a random ps */
|
||||
if (prng_descriptor[prng_idx].read(ps, ps_len, prng) != ps_len) {
|
||||
result = CRYPT_ERROR_READPRNG;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* transform zero bytes (if any) to non-zero random bytes */
|
||||
for (i = 0; i < ps_len; i++) {
|
||||
while (ps[i] == 0) {
|
||||
if (prng_descriptor[prng_idx].read(&ps[i], 1, prng) != 1) {
|
||||
result = CRYPT_ERROR_READPRNG;
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
XMEMSET(ps, 0xFF, ps_len);
|
||||
}
|
||||
|
||||
/* create string of length modulus_len */
|
||||
out[0] = 0x00;
|
||||
out[1] = (unsigned char)block_type; /* block_type 1 or 2 */
|
||||
out[2 + ps_len] = 0x00;
|
||||
XMEMCPY(&out[2 + ps_len + 1], msg, msglen);
|
||||
*outlen = modulus_len;
|
||||
|
||||
result = CRYPT_OK;
|
||||
bail:
|
||||
return result;
|
||||
} /* pkcs_1_v1_5_encode */
|
||||
|
||||
#endif /* #ifdef LTC_PKCS_1 */
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_encode.c,v $ */
|
||||
/* $Revision: 1.4 $ */
|
||||
/* $Date: 2007/05/12 14:32:35 $ */
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue