summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-11-02 20:44:46 +0100
committerHaru <haru@dotalux.com>2013-11-03 21:07:31 +0100
commit2ea51e2b2ac4e39d748e1ec24e34364746e43a8f (patch)
treeea5b74270dc9ac6329d7b795430d08785e7c1568
parent3b0cd11f980a48b903262c857fde1cd9c784c2e0 (diff)
downloadhercules-2ea51e2b2ac4e39d748e1ec24e34364746e43a8f.tar.gz
hercules-2ea51e2b2ac4e39d748e1ec24e34364746e43a8f.tar.bz2
hercules-2ea51e2b2ac4e39d748e1ec24e34364746e43a8f.tar.xz
hercules-2ea51e2b2ac4e39d748e1ec24e34364746e43a8f.zip
Added some packetver-related flags to the UNIX build script
- The --disable-packetver-re (or --enable-packetver-re=no) flag prevents the definition of PACKETVER_RE (without editing mmo.h) - The --with-key1=, --with-key2=, --with-key3= flags override the encryption key defined by the current packetver. All three flags are required if at least one is used, or they'll be ignored. - These options are mostly useful for buildbots, developers who often use git bisect, or users who want to minimize their diffs and still want to override those settings. - (unrelated minor tweak) Silenced an unnecessarily verbose STDERR message caused by the $CC shipped with clang-5 during the MinGW check.
-rwxr-xr-xconfigure110
-rw-r--r--configure.in96
-rw-r--r--src/common/mmo.h14
-rw-r--r--src/map/packets.h4
4 files changed, 211 insertions, 13 deletions
diff --git a/configure b/configure
index 919d6f883..bf0a4d8ea 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in c4af60e.
+# From configure.in 0219c4d.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69.
#
@@ -691,6 +691,10 @@ ac_user_opts='
enable_option_checking
enable_manager
enable_packetver
+enable_packetver_re
+with_key1
+with_key2
+with_key3
enable_debug
enable_buildbot
enable_rdtsc
@@ -1323,8 +1327,9 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-manager=ARG memory managers: no, builtin, memwatch, dmalloc,
gcollect, bcheck (defaults to builtin)
- --enable-packetver=ARG Sets the PACKETVER define of the map-server. (see
- src/map/clif.h)
+ --enable-packetver=ARG Sets the PACKETVER define. (see src/common/mmo.h)
+ --disable-packetver-re Sets or unsets the PACKETVER_RE define - see
+ src/common/mmo.h (currently enabled by default)
--enable-debug[=ARG] Compiles extra debug code. (disabled by default)
(available options: yes, no, gdb)
--enable-buildbot[=ARG] (available options: yes, no)
@@ -1352,6 +1357,12 @@ Optional Features:
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-key1[=ARG] Set the first obfuscation key (ignored unless the
+ other two are also specified)
+ --with-key2[=ARG] Set the second obfuscation key (ignored unless the
+ other two are also specified)
+ --with-key3[=ARG] Set the third obfuscation key (ignored unless the
+ other two are also specified)
--with-maxconn[=ARG] optionally set the maximum connections the core can
handle (default: 16384) NOT USED YET - EXPERIMENTAL
--with-mysql[=ARG] optionally specify the path to the mysql_config
@@ -3461,6 +3472,79 @@ fi
#
+# packetver-RE
+#
+# Check whether --enable-packetver-re was given.
+if test "${enable_packetver_re+set}" = set; then :
+ enableval=$enable_packetver_re;
+ enable_packetver_re="$enableval"
+ case $enableval in
+ "no");;
+ "yes");;
+ *) as_fn_error $? "invalid argument --enable-packetver-re=$enableval... stopping" "$LINENO" 5;;
+ esac
+
+else
+ enable_packetver_re="yes"
+
+fi
+
+
+
+#
+# Obfuscation keys
+#
+
+# Check whether --with-key1 was given.
+if test "${with_key1+set}" = set; then :
+ withval=$with_key1;
+ obfuscationkey1="$( expr "0x$withval" : '0*x*\(0x[A-Fa-f0-9]\{8\}\)' )"
+ if ! expr "x$obfuscationkey1" : 'x0x[A-Fa-f0-9]\{8\}' >/dev/null 2>&1; then
+ obfuscationkey1=""
+ fi
+
+else
+
+ obfuscationkey1=""
+
+
+fi
+
+
+# Check whether --with-key2 was given.
+if test "${with_key2+set}" = set; then :
+ withval=$with_key2;
+ obfuscationkey2="$( expr "0x$withval" : '0*x*\(0x[A-Fa-f0-9]\{8\}\)' )"
+ if ! expr "x$obfuscationkey2" : 'x0x[A-Fa-f0-9]\{8\}' >/dev/null 2>&1; then
+ obfuscationkey2=""
+ fi
+
+else
+
+ obfuscationkey2=""
+
+
+fi
+
+
+# Check whether --with-key3 was given.
+if test "${with_key3+set}" = set; then :
+ withval=$with_key3;
+ obfuscationkey3="$( expr "0x$withval" : '0*x*\(0x[A-Fa-f0-9]\{8\}\)' )"
+ if ! expr "x$obfuscationkey3" : 'x0x[A-Fa-f0-9]\{8\}' >/dev/null 2>&1; then
+ obfuscationkey3=""
+ fi
+
+else
+
+ obfuscationkey3=""
+
+
+fi
+
+
+
+#
# debug
#
# Check whether --enable-debug was given.
@@ -5361,6 +5445,24 @@ if test -n "$enable_packetver" ; then
CFLAGS="$CFLAGS -DPACKETVER=$enable_packetver"
fi
+#
+# Packetver-RE
+#
+case $enable_packetver_re in
+ "yes")
+ # default value
+ CFLAGS="$CFLAGS -DDISABLE_PACKETVER_RE"
+ ;;
+ "no")
+ ;;
+esac
+
+#
+# Obfuscation keys
+#
+if test -n "$obfuscationkey1" -a -n "$obfuscationkey2" -a -n "$obfuscationkey3"; then
+ CFLAGS="$CFLAGS -DOBFUSCATIONKEY1=$obfuscationkey1 -DOBFUSCATIONKEY2=$obfuscationkey2 -DOBFUSCATIONKEY3=$obfuscationkey3"
+fi
#
# Debug
@@ -6376,7 +6478,7 @@ esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MinGW" >&5
$as_echo_n "checking for MinGW... " >&6; }
-if test -n "`$CC --version | grep -i mingw`" ; then
+if test -n "`$CC --version 2>/dev/null | grep -i mingw`" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
CPPFLAGS="$CPPFLAGS -DMINGW"
diff --git a/configure.in b/configure.in
index b79e51f6d..98c493a03 100644
--- a/configure.in
+++ b/configure.in
@@ -46,7 +46,7 @@ AC_ARG_ENABLE(
[packetver],
AC_HELP_STRING(
[--enable-packetver=ARG],
- [Sets the PACKETVER define of the map-server. (see src/map/clif.h)]
+ [Sets the PACKETVER define. (see src/common/mmo.h)]
),
[enable_packetver="$enableval"],
[enable_packetver=""]
@@ -54,6 +54,80 @@ AC_ARG_ENABLE(
#
+# packetver-RE
+#
+AC_ARG_ENABLE(
+ [packetver-re],
+ AC_HELP_STRING(
+ [--disable-packetver-re],
+ [Sets or unsets the PACKETVER_RE define - see src/common/mmo.h (currently enabled by default)]
+ ),
+ [
+ enable_packetver_re="$enableval"
+ case $enableval in
+ "no");;
+ "yes");;
+ *) AC_MSG_ERROR([[invalid argument --enable-packetver-re=$enableval... stopping]]);;
+ esac
+ ],
+ [enable_packetver_re="yes"]
+)
+
+
+#
+# Obfuscation keys
+#
+AC_ARG_WITH(
+ [key1],
+ AC_HELP_STRING(
+ [--with-key1@<:@=ARG@:>@],
+ [Set the first obfuscation key (ignored unless the other two are also specified)]
+ ),
+ [
+ obfuscationkey1="$( expr "0x$withval" : '0*x*\(0x@<:@A-Fa-f0-9@:>@\{8\}\)' )"
+ if ! expr "x$obfuscationkey1" : 'x0x@<:@A-Fa-f0-9@:>@\{8\}' >/dev/null 2>&1; then
+ obfuscationkey1=""
+ fi
+ ],
+ [
+ obfuscationkey1=""
+ ]
+)
+AC_ARG_WITH(
+ [key2],
+ AC_HELP_STRING(
+ [--with-key2@<:@=ARG@:>@],
+ [Set the second obfuscation key (ignored unless the other two are also specified)]
+ ),
+ [
+ obfuscationkey2="$( expr "0x$withval" : '0*x*\(0x@<:@A-Fa-f0-9@:>@\{8\}\)' )"
+ if ! expr "x$obfuscationkey2" : 'x0x@<:@A-Fa-f0-9@:>@\{8\}' >/dev/null 2>&1; then
+ obfuscationkey2=""
+ fi
+ ],
+ [
+ obfuscationkey2=""
+ ]
+)
+AC_ARG_WITH(
+ [key3],
+ AC_HELP_STRING(
+ [--with-key3@<:@=ARG@:>@],
+ [Set the third obfuscation key (ignored unless the other two are also specified)]
+ ),
+ [
+ obfuscationkey3="$( expr "0x$withval" : '0*x*\(0x@<:@A-Fa-f0-9@:>@\{8\}\)' )"
+ if ! expr "x$obfuscationkey3" : 'x0x@<:@A-Fa-f0-9@:>@\{8\}' >/dev/null 2>&1; then
+ obfuscationkey3=""
+ fi
+ ],
+ [
+ obfuscationkey3=""
+ ]
+)
+
+
+#
# debug
#
AC_ARG_ENABLE(
@@ -771,6 +845,24 @@ if test -n "$enable_packetver" ; then
CFLAGS="$CFLAGS -DPACKETVER=$enable_packetver"
fi
+#
+# Packetver-RE
+#
+case $enable_packetver_re in
+ "yes")
+ # default value
+ CFLAGS="$CFLAGS -DDISABLE_PACKETVER_RE"
+ ;;
+ "no")
+ ;;
+esac
+
+#
+# Obfuscation keys
+#
+if test -n "$obfuscationkey1" -a -n "$obfuscationkey2" -a -n "$obfuscationkey3"; then
+ CFLAGS="$CFLAGS -DOBFUSCATIONKEY1=$obfuscationkey1 -DOBFUSCATIONKEY2=$obfuscationkey2 -DOBFUSCATIONKEY3=$obfuscationkey3"
+fi
#
# Debug
@@ -1035,7 +1127,7 @@ esac
AC_SUBST([DLLEXT])
AC_MSG_CHECKING([for MinGW])
-if test -n "`$CC --version | grep -i mingw`" ; then
+if test -n "`$CC --version 2>/dev/null | grep -i mingw`" ; then
AC_MSG_RESULT([yes])
CPPFLAGS="$CPPFLAGS -DMINGW"
if test -z "$fd_setsize" ; then
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 349912a39..5f4da6eb0 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -48,18 +48,18 @@
// 20120307 - 2012-03-07aRagexeRE+ - 0x970
#ifndef PACKETVER
- #define PACKETVER 20120418
-#endif
+#define PACKETVER 20120418
+#endif // PACKETVER
+#ifndef DISABLE_PACKETVER_RE
// Comment the following line if your client is NOT ragexeRE (required because of conflicting packets in ragexe vs ragexeRE).
#define PACKETVER_RE
+#endif // DISABLE_PACKETVER_RE
// Client support for experimental RagexeRE UI present in 2012-04-10 and 2012-04-18
-#ifdef PACKETVER_RE
-#if (PACKETVER == 20120410) || (PACKETVER == 20120418)
- #define PARTY_RECRUIT
-#endif
-#endif
+#if defined(PACKETVER_RE) && ( PACKETVER == 20120410 || PACKETVER == 20120418 )
+#define PARTY_RECRUIT
+#endif // PACKETVER_RE && (PACKETVER == 20120410 || PACKETVER == 10120418)
// Comment the following line to disable sc_data saving. [Skotlex]
#define ENABLE_SC_SAVING
diff --git a/src/map/packets.h b/src/map/packets.h
index 918f0a10f..55a85e182 100644
--- a/src/map/packets.h
+++ b/src/map/packets.h
@@ -2646,4 +2646,8 @@ packet(0x020d,-1);
packetKeys(0x7E241DE0,0x5E805580,0x3D807D80); /* Thanks to Shakto */
#endif
+#if defined(OBFUSCATIONKEY1) && defined(OBFUSCATIONKEY2) && defined(OBFUSCATIONKEY3)
+ packetKeys(OBFUSCATIONKEY1,OBFUSCATIONKEY2,OBFUSCATIONKEY3);
+#endif
+
#endif /* _PACKETS_H_ */