summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/HPMDataCheck.h3
-rw-r--r--src/common/Makefile.in27
-rw-r--r--src/common/atomic.h3
-rw-r--r--src/common/cbasetypes.h17
-rw-r--r--src/common/core.c2
-rw-r--r--src/common/hercules.h12
-rw-r--r--src/common/mmo.h44
-rw-r--r--src/common/nullpo.c133
-rw-r--r--src/common/nullpo.h7
-rw-r--r--src/common/packets/packets2020_len_main.h82
-rw-r--r--src/common/packets/packets2020_len_re.h82
-rw-r--r--src/common/packets/packets2020_len_zero.h82
-rw-r--r--src/common/packets/packets_len_main.h4
-rw-r--r--src/common/packets/packets_len_re.h4
-rw-r--r--src/common/packets/packets_len_zero.h4
15 files changed, 459 insertions, 47 deletions
diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h
index d2e491ad2..821d68569 100644
--- a/src/common/HPMDataCheck.h
+++ b/src/common/HPMDataCheck.h
@@ -738,7 +738,6 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
{ "PACKET_ZC_REPAIRITEMLIST", sizeof(struct PACKET_ZC_REPAIRITEMLIST), SERVER_TYPE_MAP },
{ "PACKET_ZC_REPAIRITEMLIST_sub", sizeof(struct PACKET_ZC_REPAIRITEMLIST_sub), SERVER_TYPE_MAP },
{ "PACKET_ZC_ROLE_CHANGE", sizeof(struct PACKET_ZC_ROLE_CHANGE), SERVER_TYPE_MAP },
- { "PACKET_ZC_SE_CASHSHOP_OPEN", sizeof(struct PACKET_ZC_SE_CASHSHOP_OPEN), SERVER_TYPE_MAP },
{ "PACKET_ZC_SEARCH_STORE_INFO_ACK", sizeof(struct PACKET_ZC_SEARCH_STORE_INFO_ACK), SERVER_TYPE_MAP },
{ "PACKET_ZC_SEARCH_STORE_INFO_ACK_sub", sizeof(struct PACKET_ZC_SEARCH_STORE_INFO_ACK_sub), SERVER_TYPE_MAP },
{ "PACKET_ZC_SKILL_SCALE", sizeof(struct PACKET_ZC_SKILL_SCALE), SERVER_TYPE_MAP },
@@ -859,6 +858,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
#define MAP_PC_GROUPS_H
#endif // MAP_PC_GROUPS_H
#ifdef MAP_PC_H
+ { "autocast_data", sizeof(struct autocast_data), SERVER_TYPE_MAP },
{ "autotrade_vending", sizeof(struct autotrade_vending), SERVER_TYPE_MAP },
{ "class_exp_group", sizeof(struct class_exp_group), SERVER_TYPE_MAP },
{ "class_exp_tables", sizeof(struct class_exp_tables), SERVER_TYPE_MAP },
@@ -966,6 +966,7 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = {
{ "skill_cd_entry", sizeof(struct skill_cd_entry), SERVER_TYPE_MAP },
{ "skill_condition", sizeof(struct skill_condition), SERVER_TYPE_MAP },
{ "skill_interface", sizeof(struct skill_interface), SERVER_TYPE_MAP },
+ { "skill_required_item_data", sizeof(struct skill_required_item_data), SERVER_TYPE_MAP },
{ "skill_timerskill", sizeof(struct skill_timerskill), SERVER_TYPE_MAP },
{ "skill_unit", sizeof(struct skill_unit), SERVER_TYPE_MAP },
{ "skill_unit_group", sizeof(struct skill_unit_group), SERVER_TYPE_MAP },
diff --git a/src/common/Makefile.in b/src/common/Makefile.in
index 033b26ae3..22b974cfd 100644
--- a/src/common/Makefile.in
+++ b/src/common/Makefile.in
@@ -33,6 +33,19 @@ LIBCONFIG_OBJ = $(addprefix $(LIBCONFIG_D)/, libconfig.o grammar.o scanctx.o \
LIBCONFIG_H = $(addprefix $(LIBCONFIG_D)/, libconfig.h grammar.h parsectx.h \
scanctx.h scanner.h strbuf.h wincompat.h)
+ifeq (@USE_LIBBACKTRACE@,yes)
+ LIBBACKTRACE_D = $(THIRDPARTY_D)/libbacktrace
+ LIBBACKTRACE_OBJ = $(addprefix $(LIBBACKTRACE_D)/, atomic.o backtrace.o \
+ dwarf.o @LIBBACKTRACE_FORMAT_FILE@ fileline.o mmapio.o mmap.o posix.o print.o \
+ simple.o sort.o state.o)
+ LIBBACKTRACE_H = $(addprefix $(LIBBACKTRACE_D)/, backtrace.h \
+ backtrace-supported.h config.h filenames.h internal.h)
+else
+ LIBBACKTRACE_D =
+ LIBBACKTRACE_OBJ =
+ LIBBACKTRACE_H =
+endif
+
MT19937AR_D = $(THIRDPARTY_D)/mt19937ar
MT19937AR_OBJ = $(MT19937AR_D)/mt19937ar.o
MT19937AR_H = $(MT19937AR_D)/mt19937ar.h
@@ -95,7 +108,7 @@ help:
Makefile: Makefile.in
@$(MAKE) -C ../.. src/common/Makefile
-$(SYSINFO_INC): $(COMMON_C) $(COMMON_PH) $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H)
+$(SYSINFO_INC): $(COMMON_C) $(COMMON_PH) $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) $(LIBBACKTRACE_H)
@echo " MAKE $@"
@$(MAKE) -C ../.. sysinfo
@@ -121,7 +134,7 @@ obj_sql/common_sql.a: $(COMMON_SQL_OBJ) Makefile
@echo " AR $@"
@@AR@ rcs obj_sql/common_sql.a $(COMMON_SQL_OBJ)
-common: $(COMMON_OBJ) $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) obj_all/common.a Makefile
+common: $(COMMON_OBJ) $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) $(LIBBACKTRACE_OBJ) obj_all/common.a Makefile
common_sql: $(COMMON_SQL_OBJ) obj_sql/common_sql.a Makefile
@@ -134,14 +147,18 @@ $(LIBCONFIG_OBJ):
@echo " MAKE $@"
@$(MAKE) -C $(LIBCONFIG_D)
+$(LIBBACKTRACE_OBJ):
+ @echo " MAKE $@"
+ @$(MAKE) -C $(LIBBACKTRACE_D)
+
.SECONDEXPANSION:
-obj_all/sysinfo.o: sysinfo.c $(filter sysinfo.p.h, $(COMMON_PH)) $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) $(SYSINFO_INC) | obj_all
+obj_all/sysinfo.o: sysinfo.c $(filter sysinfo.p.h, $(COMMON_PH)) $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) $(LIBBACKTRACE_H) $(SYSINFO_INC) | obj_all
-obj_all/%.o: %.c $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | $(SYSINFO_INC) obj_all
+obj_all/%.o: %.c $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) $(LIBBACKTRACE_H) | $(SYSINFO_INC) obj_all
@echo " CC $<"
@$(CC) @CFLAGS@ @DEFS@ $(COMMON_INCLUDE) $(THIRDPARTY_INCLUDE) @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
-obj_sql/%.o: %.c $$(filter %.p.h, $(COMMON_PH)) $(COMMON_H) $(COMMON_SQL_H) $(CONFIG_H) $(LIBCONFIG_H) | $(SYSINFO_INC) obj_sql
+obj_sql/%.o: %.c $$(filter %.p.h, $(COMMON_PH)) $(COMMON_H) $(COMMON_SQL_H) $(CONFIG_H) $(LIBCONFIG_H) $(LIBBACKTRACE_H) | $(SYSINFO_INC) obj_sql
@echo " CC $<"
@$(CC) @CFLAGS@ @DEFS@ $(COMMON_INCLUDE) $(THIRDPARTY_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
diff --git a/src/common/atomic.h b/src/common/atomic.h
index 518d2e6ab..b9157373f 100644
--- a/src/common/atomic.h
+++ b/src/common/atomic.h
@@ -103,8 +103,9 @@ forceinline volatile int64 InterlockedExchange64(volatile int64 *target, int64 v
// The __sync functions are available on x86 or ARMv6+
#if !defined(__x86_64__) && !defined(__i386__) \
+ && !defined(__ppc64__) && ! defined(__powerpc64__) \
&& ( !defined(__ARM_ARCH_VERSION__) || __ARM_ARCH_VERSION__ < 6 )
-#error Your Target Platfrom is not supported
+#error Target platform currently not supported
#endif
static forceinline int64 InterlockedExchangeAdd64(volatile int64 *addend, int64 increment){
diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h
index 0b5613316..06333a7b2 100644
--- a/src/common/cbasetypes.h
+++ b/src/common/cbasetypes.h
@@ -62,16 +62,24 @@
#endif
// Standardize the ARM platform version, if available (the only values we're interested in right now are >= ARMv6)
+#ifdef __ARM_ARCH
+#define __ARM_ARCH_VERSION__ __ARM_ARCH
+#else
#if defined(__ARMV6__) || defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) \
|| defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) // gcc ARMv6
#define __ARM_ARCH_VERSION__ 6
-#elif defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7S__) // gcc ARMv7
+#elif defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7S__) // gcc ARMv7
#define __ARM_ARCH_VERSION__ 7
+#elif defined(__ARM_ARCH_8__) || defined(__ARM_ARCH_8A__)
+#define __ARM_ARCH_VERSION__ 8
#elif defined(_M_ARM) // MSVC
#define __ARM_ARCH_VERSION__ _M_ARM
+#elif defined(__TARGET_ARCH_ARM) // RVCT
+#define __ARM_ARCH_VERSION__ __TARGET_ARCH_ARM
#else
#define __ARM_ARCH_VERSION__ 0
#endif
+#endif
// Necessary for __NetBSD_Version__ (defined as VVRR00PP00) on NetBSD
#ifdef __NETBSD__
@@ -95,7 +103,7 @@
// debug function name
#ifndef __NETBSD__
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
-# if __GNUC__ >= 2
+# if __GNUC__ >= 2 || defined(WIN32)
# define __func__ __FUNCTION__
# else
# define __func__ ""
@@ -410,13 +418,16 @@ typedef char bool;
#define ISALPHA(c) (isalpha((unsigned char)(c)))
#define ISCNTRL(c) (iscntrl((unsigned char)(c)))
#define ISDIGIT(c) (isdigit((unsigned char)(c)))
+#define ISXDIGIT(c) (isxdigit((unsigned char)(c)))
+#define ISBDIGIT(c) ((unsigned char)(c) == '0' || (unsigned char)(c) == '1')
+#define ISODIGIT(c) ((unsigned char)(c) >= '0' && (unsigned char)(c) <= '7')
+#define ISNSEPARATOR(c) ((unsigned char)(c) == '_')
#define ISGRAPH(c) (isgraph((unsigned char)(c)))
#define ISLOWER(c) (islower((unsigned char)(c)))
#define ISPRINT(c) (isprint((unsigned char)(c)))
#define ISPUNCT(c) (ispunct((unsigned char)(c)))
#define ISSPACE(c) (isspace((unsigned char)(c)))
#define ISUPPER(c) (isupper((unsigned char)(c)))
-#define ISXDIGIT(c) (isxdigit((unsigned char)(c)))
#define TOASCII(c) (toascii((unsigned char)(c)))
#define TOLOWER(c) (tolower((unsigned char)(c)))
#define TOUPPER(c) (toupper((unsigned char)(c)))
diff --git a/src/common/core.c b/src/common/core.c
index 54358b85c..5be90a411 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -489,6 +489,7 @@ int main(int argc, char **argv)
iMalloc->init();// needed for Show* in display_title() [FlavioJS]
showmsg->init();
+ nullpo->init();
cmdline->init();
@@ -552,6 +553,7 @@ int main(int argc, char **argv)
cmdline->final();
//sysinfo->final(); Called by iMalloc->final()
+ nullpo->final();
iMalloc->final();
showmsg->final(); // Should be after iMalloc->final()
diff --git a/src/common/hercules.h b/src/common/hercules.h
index 89ea761b4..e62656494 100644
--- a/src/common/hercules.h
+++ b/src/common/hercules.h
@@ -23,11 +23,15 @@
#include "config/core.h"
#include "common/cbasetypes.h"
+#ifdef HERCULES_CORE
+#define HPExport static
+#else // HERCULES_CORE
#ifdef WIN32
- #define HPExport __declspec(dllexport)
-#else
- #define HPExport __attribute__((visibility("default")))
-#endif
+#define HPExport __declspec(dllexport)
+#else // WIN32
+#define HPExport __attribute__((visibility("default")))
+#endif // WIN32
+#endif // HERCULES_CORE
#define HPShared extern
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 687f5a187..e4b5a8bd5 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -64,7 +64,7 @@
// 20120307 - 2012-03-07aRagexeRE+ - 0x970
#ifndef PACKETVER
- #define PACKETVER 20141022
+ #define PACKETVER 20190530
#endif // PACKETVER
//Uncomment the following line if your client is ragexeRE instead of ragexe (required because of conflicting packets in ragexe vs ragexeRE).
@@ -132,7 +132,9 @@
#endif // PACKETVER_RE && (PACKETVER == 20120410 || PACKETVER == 10120418)
// Comment the following line to disable sc_data saving. [Skotlex]
+#ifndef ENABLE_SC_SAVING
#define ENABLE_SC_SAVING
+#endif
#if PACKETVER_MAIN_NUM >= 20070711 || PACKETVER_RE_NUM >= 20080827 || PACKETVER_AD_NUM >= 20070711 || PACKETVER_SAK_NUM >= 20070628 || defined(PACKETVER_ZERO)
// Comment the following like to disable server-side hot-key saving support. [Skotlex]
@@ -174,7 +176,9 @@
#else
#define MAX_BASE_CARTS 5
#endif
+#ifndef MAX_CARTS
#define MAX_CARTS (MAX_BASE_CARTS + MAX_CARTDECORATION_CARTS)
+#endif
#ifndef MAX_INVENTORY
#if PACKETVER_MAIN_NUM >= 20181219 || PACKETVER_RE_NUM >= 20181219 || PACKETVER_ZERO_NUM >= 20181212
@@ -204,19 +208,31 @@
#endif
//Number of slots carded equipment can have. Never set to less than 4 as they are also used to keep the data of forged items/equipment. [Skotlex]
//Note: The client seems unable to receive data for more than 4 slots due to all related packets having a fixed size.
+#ifndef MAX_SLOTS
#define MAX_SLOTS 4
+#endif
//Max amount of a single stacked item
+#ifndef MAX_AMOUNT
#define MAX_AMOUNT 30000
+#endif
+#ifndef MAX_ZENY
#define MAX_ZENY INT_MAX
+#endif
//Official Limit: 2.1b ( the var that stores the money doesn't go much higher than this by default )
+#ifndef MAX_BANK_ZENY
#define MAX_BANK_ZENY INT_MAX
+#endif
#ifndef MAX_LEVEL
#define MAX_LEVEL 175
#endif
+#ifndef MAX_FAME
#define MAX_FAME 1000000000
+#endif
+#ifndef MAX_CART
#define MAX_CART 100
+#endif
#ifndef MAX_SKILL_DB
#define MAX_SKILL_DB 1314 ///< Maximum number of skills in the skill DB (compacted array size)
#endif
@@ -380,7 +396,10 @@ STATIC_ASSERT(MAX_ITEM_OPTIONS <= 5, "This value is limited by the client and da
#define JOBL_BABY 0x2000
#define JOBL_THIRD 0x4000
-#define SCRIPT_VARNAME_LENGTH 32 ///< Maximum length of a script variable
+#define SCRIPT_VARNAME_LENGTH 32 ///< Maximum length of a script variable's name including affixes and excluding NULL-terminator.
+STATIC_ASSERT(SCRIPT_VARNAME_LENGTH <= 32, "This value is limited by the inter-server communication and database layout and should only be increased if you know the consequences.");
+#define SCRIPT_STRING_VAR_LENGTH 255 ///< Maximum length of strings stored in script variables excluding NULL-terminator.
+STATIC_ASSERT(SCRIPT_STRING_VAR_LENGTH <= 255, "This value is limited by the inter-server communication and database layout and should only be increased if you know the consequences.");
#define INFINITE_DURATION (-1) // Infinite duration for status changes
@@ -1378,6 +1397,27 @@ enum questinfo_type {
QINFO_MERCENARY_CLASS
};
+/** Pet hunger level **/
+enum e_pet_hunger_level {
+ PET_HUNGER_STARVING = 0,
+ PET_HUNGER_VERY_HUNGRY = 10,
+ PET_HUNGER_HUNGRY = 25,
+ PET_HUNGER_NEUTRAL = 75,
+ PET_HUNGER_SATISFIED = 90,
+ PET_HUNGER_STUFFED = 100
+};
+
+/** Pet intimacy level **/
+enum e_pet_intimacy_level {
+ PET_INTIMACY_NONE = 0,
+ PET_INTIMACY_AWKWARD = 1,
+ PET_INTIMACY_SHY = 100,
+ PET_INTIMACY_NEUTRAL = 250,
+ PET_INTIMACY_CORDIAL = 750,
+ PET_INTIMACY_LOYAL = 900,
+ PET_INTIMACY_MAX = 1000
+};
+
/* packet size constant for itemlist */
#if MAX_INVENTORY > MAX_STORAGE && MAX_INVENTORY > MAX_CART
#define MAX_ITEMLIST MAX_INVENTORY
diff --git a/src/common/nullpo.c b/src/common/nullpo.c
index dfb938708..11741745c 100644
--- a/src/common/nullpo.c
+++ b/src/common/nullpo.c
@@ -23,18 +23,106 @@
#include "nullpo.h"
#include "common/showmsg.h"
+#include "common/strlib.h"
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
-#ifdef HAVE_EXECINFO
+#if defined(HAVE_LIBBACKTRACE)
+#include "libbacktrace/backtrace.h"
+#include "libbacktrace/backtrace-supported.h"
+# if defined(WIN32)
+# include <windows.h>
+# elif defined(__sun)
+# include <limits.h>
+# elif defined(__linux) || defined(__linux__)
+# include <unistd.h>
+# include <limits.h>
+# elif defined(__APPLE__) && defined(__MACH__)
+# include <mach-o/dyld.h>
+# elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__)
+# include <sys/types.h>
+# include <sys/sysctl.h>
+# endif
+#elif defined(HAVE_EXECINFO)
#include <execinfo.h>
-#endif // HAVE_EXECINFO
+#endif // HAVE_LIBBACKTRACE
+
static struct nullpo_interface nullpo_s;
struct nullpo_interface *nullpo;
+#ifdef HAVE_LIBBACKTRACE
+static char executable_path[PATH_MAX];
+
+static void nullpo_error_callback(void *data, const char *msg, int errnum)
+{
+ ShowError("Error: %s (%d)", msg, errnum);
+}
+
+static int nullpo_print_callback(void *data, uintptr_t pc, const char *filename, int lineno, const char *function)
+{
+ ShowError("0x%lx %s\n",
+ (unsigned long) pc,
+ function == NULL ? "???" : function);
+ ShowError("\t%s:%d\n",
+ filename == NULL ? "???" : filename,
+ lineno);
+ return 0;
+}
+
+static void nullpo_backtrace_print(struct backtrace_state *state)
+{
+ backtrace_full(state, 0, nullpo_print_callback, nullpo_error_callback, state);
+}
+
+static bool nullpo_backtrace_get_executable_path(char *buf, size_t length)
+{
+#if defined(WIN32)
+ char *exe_path = NULL;
+ if (_get_pgmptr(&exe_path) != 0)
+ return false;
+ safestrncpy(buf, exe_path, length);
+ return true;
+#elif defined(__sun)
+ if (length < MAX_PATH)
+ return false;
+ if (realpath(getexecname(), buf) == NULL)
+ return false;
+ buf[length - 1] = '\0';
+ return true;
+#elif defined(__linux) || defined(__linux__)
+ ssize_t len = readlink("/proc/self/exe", buf, length);
+ if (len <= 0 || len == length)
+ return false;
+ buf[len] = '\0';
+ return true;
+#elif defined(__APPLE__) && defined(__MACH__)
+ uint32_t len = (uint32_t)length;
+ if (_NSGetExecutablePath(buf, &len) != 0)
+ return false; // buffer too small (!)
+ // resolve symlinks, ., .. if possible
+ char *canonical_path = realpath(buf, NULL);
+ if (canonical_path != NULL) {
+ safestrncpy(buf, canonical_path, length);
+ free(canonical_path);
+ }
+ return true;
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__)
+ int mib[4];
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_PATHNAME;
+ mib[3] = -1;
+ if (sysctl(mib, 4, buf, &length, NULL, 0) != 0)
+ return false;
+ return true;
+#endif
+ return false;
+}
+#endif // HAVE_LIBBACKTRACE
+
/**
* Reports failed assertions or NULL pointers
*
@@ -46,12 +134,6 @@ struct nullpo_interface *nullpo;
*/
static void assert_report(const char *file, int line, const char *func, const char *targetname, const char *title)
{
-#ifdef HAVE_EXECINFO
- void *array[10];
- int size;
- char **strings;
- int i;
-#endif // HAVE_EXECINFO
if (file == NULL)
file = "??";
@@ -60,21 +142,46 @@ static void assert_report(const char *file, int line, const char *func, const ch
ShowError("--- %s --------------------------------------------\n", title);
ShowError("%s:%d: '%s' in function `%s'\n", file, line, targetname, func);
-#ifdef HAVE_EXECINFO
- size = (int)backtrace(array, 10);
- strings = backtrace_symbols(array, size);
- for (i = 0; i < size; i++)
+#ifdef HAVE_LIBBACKTRACE
+ if (nullpo->backtrace_state != NULL)
+ nullpo_backtrace_print(nullpo->backtrace_state);
+#elif defined(HAVE_EXECINFO)
+ void *array[10];
+ int size = (int)backtrace(array, 10);
+ char **strings = backtrace_symbols(array, size);
+ for (int i = 0; i < size; i++)
ShowError("%s\n", strings[i]);
free(strings);
-#endif // HAVE_EXECINFO
+#endif // HAVE_LIBBACKTRACE
ShowError("--- end %s ----------------------------------------\n", title);
}
+static void nullpo_init(void)
+{
+#ifdef HAVE_LIBBACKTRACE
+ if (!nullpo_backtrace_get_executable_path(executable_path, sizeof executable_path)) {
+ safestrncpy(executable_path, "hercules", sizeof executable_path);
+ }
+ nullpo->backtrace_state = backtrace_create_state(executable_path, BACKTRACE_SUPPORTS_THREADS, nullpo_error_callback, NULL);
+#endif
+}
+
+static void nullpo_final(void)
+{
+ // FIXME: libbacktrace doesn't provide a backtrace_free_state, and it's unsafe to pass the state to
+ // backtrace_free (the function itself uses the state internally). For the time being, we'll leave the state
+ // allocated until program termination as shown in their examples.
+}
+
/**
*
**/
void nullpo_defaults(void)
{
nullpo = &nullpo_s;
+ nullpo->init = nullpo_init;
+ nullpo->final = nullpo_final;
nullpo->assert_report = assert_report;
+
+ nullpo->backtrace_state = NULL;
}
diff --git a/src/common/nullpo.h b/src/common/nullpo.h
index fc5386243..3eb002834 100644
--- a/src/common/nullpo.h
+++ b/src/common/nullpo.h
@@ -28,6 +28,8 @@
// if need disable asserts checks this line can be commented
#define ASSERT_CHECK
+struct backtrace_state;
+
/** Assert */
#if defined(ASSERT_CHECK)
@@ -148,7 +150,12 @@
struct nullpo_interface {
+ void (*init) (void);
+ void (*final) (void);
+
void (*assert_report) (const char *file, int line, const char *func, const char *targetname, const char *title);
+
+ struct backtrace_state *backtrace_state;
};
#ifdef HERCULES_CORE
diff --git a/src/common/packets/packets2020_len_main.h b/src/common/packets/packets2020_len_main.h
index 3349c9872..215f59727 100644
--- a/src/common/packets/packets2020_len_main.h
+++ b/src/common/packets/packets2020_len_main.h
@@ -2,8 +2,8 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2018-2020 Hercules Dev Team
- * Copyright (C) 2018-2020 Andrei Karas (4144)
+ * Copyright (C) 2018-2020 Hercules Dev Team
+ * Copyright (C) 2018-2020 Andrei Karas (4144)
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -4617,7 +4617,9 @@ packetLen(0x0b6f, 177)
#endif
// Packet: 0x0b70
-#if PACKETVER >= 20200122
+#if PACKETVER >= 20200318
+packetLen(0x0b70, -1)
+#elif PACKETVER >= 20200122
packetLen(0x0b70, 8)
#endif
@@ -4627,9 +4629,81 @@ packetLen(0x0b71, 177)
#endif
// Packet: 0x0b72
-#if PACKETVER >= 20200122
+#if PACKETVER >= 20200318
+packetLen(0x0b72, -1)
+#elif PACKETVER >= 20200122
packetLen(0x0b72, 4)
#endif
+// Packet: 0x0b73
+#if PACKETVER >= 20200212
+packetLen(0x0b73, 8)
+#endif
+
+// Packet: 0x0b74
+#if PACKETVER >= 20200304
+packetLen(0x0b74, 1026)
+#endif
+
+// Packet: 0x0b75
+#if PACKETVER >= 20200304
+packetLen(0x0b75, 1026)
+#endif
+
+// Packet: 0x0b76
+#if PACKETVER >= 20200401
+packetLen(0x0b76, 77)
+#endif
+
+// Packet: 0x0b77
+#if PACKETVER >= 20200506
+packetLen(0x0b77, -1)
+#endif
+
+// Packet: 0x0b78
+#if PACKETVER >= 20200506
+packetLen(0x0b78, -1)
+#endif
+
+// Packet: 0x0b79
+#if PACKETVER >= 20200506
+packetLen(0x0b79, -1)
+#endif
+
+// Packet: 0x0b7a
+#if PACKETVER >= 20200506
+packetLen(0x0b7a, -1)
+#endif
+
+// Packet: 0x0b7b
+#if PACKETVER >= 20200701
+packetLen(0x0b7b, 118)
+#endif
+
+// Packet: 0x0b7c
+#if PACKETVER >= 20200701
+packetLen(0x0b7c, -1)
+#endif
+
+// Packet: 0x0b7d
+#if PACKETVER >= 20200701
+packetLen(0x0b7d, -1)
+#endif
+
+// Packet: 0x0b7e
+#if PACKETVER >= 20200701
+packetLen(0x0b7e, 60)
+#endif
+
+// Packet: 0x0b7f
+#if PACKETVER >= 20200701
+packetLen(0x0b7f, 10)
+#endif
+
+// Packet: 0x0b80
+#if PACKETVER >= 20200701
+packetLen(0x0b80, 10)
+#endif
+
#endif /* COMMON_PACKETS2020_LEN_MAIN_H */
diff --git a/src/common/packets/packets2020_len_re.h b/src/common/packets/packets2020_len_re.h
index b33278c1c..7296d86c5 100644
--- a/src/common/packets/packets2020_len_re.h
+++ b/src/common/packets/packets2020_len_re.h
@@ -2,8 +2,8 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2018-2020 Hercules Dev Team
- * Copyright (C) 2018-2020 Andrei Karas (4144)
+ * Copyright (C) 2018-2020 Hercules Dev Team
+ * Copyright (C) 2018-2020 Andrei Karas (4144)
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -4623,7 +4623,9 @@ packetLen(0x0b6f, 177)
#endif
// Packet: 0x0b70
-#if PACKETVER >= 20200122
+#if PACKETVER >= 20200709
+packetLen(0x0b70, -1)
+#elif PACKETVER >= 20200122
packetLen(0x0b70, 8)
#endif
@@ -4633,9 +4635,81 @@ packetLen(0x0b71, 177)
#endif
// Packet: 0x0b72
-#if PACKETVER >= 20200122
+#if PACKETVER >= 20200709
+packetLen(0x0b72, -1)
+#elif PACKETVER >= 20200122
packetLen(0x0b72, 4)
#endif
+// Packet: 0x0b73
+#if PACKETVER >= 20200212
+packetLen(0x0b73, 8)
+#endif
+
+// Packet: 0x0b74
+#if PACKETVER >= 20200304
+packetLen(0x0b74, 1026)
+#endif
+
+// Packet: 0x0b75
+#if PACKETVER >= 20200304
+packetLen(0x0b75, 1026)
+#endif
+
+// Packet: 0x0b76
+#if PACKETVER >= 20200709
+packetLen(0x0b76, 77)
+#endif
+
+// Packet: 0x0b77
+#if PACKETVER >= 20200709
+packetLen(0x0b77, -1)
+#endif
+
+// Packet: 0x0b78
+#if PACKETVER >= 20200709
+packetLen(0x0b78, -1)
+#endif
+
+// Packet: 0x0b79
+#if PACKETVER >= 20200709
+packetLen(0x0b79, -1)
+#endif
+
+// Packet: 0x0b7a
+#if PACKETVER >= 20200709
+packetLen(0x0b7a, -1)
+#endif
+
+// Packet: 0x0b7b
+#if PACKETVER >= 20200709
+packetLen(0x0b7b, 118)
+#endif
+
+// Packet: 0x0b7c
+#if PACKETVER >= 20200709
+packetLen(0x0b7c, -1)
+#endif
+
+// Packet: 0x0b7d
+#if PACKETVER >= 20200709
+packetLen(0x0b7d, -1)
+#endif
+
+// Packet: 0x0b7e
+#if PACKETVER >= 20200709
+packetLen(0x0b7e, 60)
+#endif
+
+// Packet: 0x0b7f
+#if PACKETVER >= 20200709
+packetLen(0x0b7f, 10)
+#endif
+
+// Packet: 0x0b80
+#if PACKETVER >= 20200709
+packetLen(0x0b80, 10)
+#endif
+
#endif /* COMMON_PACKETS2020_LEN_RE_H */
diff --git a/src/common/packets/packets2020_len_zero.h b/src/common/packets/packets2020_len_zero.h
index 153b66286..cba80e90c 100644
--- a/src/common/packets/packets2020_len_zero.h
+++ b/src/common/packets/packets2020_len_zero.h
@@ -2,8 +2,8 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2018-2020 Hercules Dev Team
- * Copyright (C) 2018-2020 Andrei Karas (4144)
+ * Copyright (C) 2018-2020 Hercules Dev Team
+ * Copyright (C) 2018-2020 Andrei Karas (4144)
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -4617,7 +4617,9 @@ packetLen(0x0b6f, 177)
#endif
// Packet: 0x0b70
-#if PACKETVER >= 20200129
+#if PACKETVER >= 20200401
+packetLen(0x0b70, -1)
+#elif PACKETVER >= 20200129
packetLen(0x0b70, 8)
#endif
@@ -4627,9 +4629,81 @@ packetLen(0x0b71, 177)
#endif
// Packet: 0x0b72
-#if PACKETVER >= 20200129
+#if PACKETVER >= 20200401
+packetLen(0x0b72, -1)
+#elif PACKETVER >= 20200129
packetLen(0x0b72, 4)
#endif
+// Packet: 0x0b73
+#if PACKETVER >= 20200212
+packetLen(0x0b73, 8)
+#endif
+
+// Packet: 0x0b74
+#if PACKETVER >= 20200304
+packetLen(0x0b74, 1026)
+#endif
+
+// Packet: 0x0b75
+#if PACKETVER >= 20200304
+packetLen(0x0b75, 1026)
+#endif
+
+// Packet: 0x0b76
+#if PACKETVER >= 20200401
+packetLen(0x0b76, 77)
+#endif
+
+// Packet: 0x0b77
+#if PACKETVER >= 20200506
+packetLen(0x0b77, -1)
+#endif
+
+// Packet: 0x0b78
+#if PACKETVER >= 20200506
+packetLen(0x0b78, -1)
+#endif
+
+// Packet: 0x0b79
+#if PACKETVER >= 20200506
+packetLen(0x0b79, -1)
+#endif
+
+// Packet: 0x0b7a
+#if PACKETVER >= 20200506
+packetLen(0x0b7a, -1)
+#endif
+
+// Packet: 0x0b7b
+#if PACKETVER >= 20200701
+packetLen(0x0b7b, 118)
+#endif
+
+// Packet: 0x0b7c
+#if PACKETVER >= 20200701
+packetLen(0x0b7c, -1)
+#endif
+
+// Packet: 0x0b7d
+#if PACKETVER >= 20200701
+packetLen(0x0b7d, -1)
+#endif
+
+// Packet: 0x0b7e
+#if PACKETVER >= 20200701
+packetLen(0x0b7e, 60)
+#endif
+
+// Packet: 0x0b7f
+#if PACKETVER >= 20200701
+packetLen(0x0b7f, 10)
+#endif
+
+// Packet: 0x0b80
+#if PACKETVER >= 20200701
+packetLen(0x0b80, 10)
+#endif
+
#endif /* COMMON_PACKETS2020_LEN_ZERO_H */
diff --git a/src/common/packets/packets_len_main.h b/src/common/packets/packets_len_main.h
index 7b93b35b0..365b0af6f 100644
--- a/src/common/packets/packets_len_main.h
+++ b/src/common/packets/packets_len_main.h
@@ -2,8 +2,8 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2018-2020 Hercules Dev Team
- * Copyright (C) 2018-2020 Andrei Karas (4144)
+ * Copyright (C) 2018-2020 Hercules Dev Team
+ * Copyright (C) 2018-2020 Andrei Karas (4144)
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/common/packets/packets_len_re.h b/src/common/packets/packets_len_re.h
index 23a507886..302381722 100644
--- a/src/common/packets/packets_len_re.h
+++ b/src/common/packets/packets_len_re.h
@@ -2,8 +2,8 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2018-2020 Hercules Dev Team
- * Copyright (C) 2018-2020 Andrei Karas (4144)
+ * Copyright (C) 2018-2020 Hercules Dev Team
+ * Copyright (C) 2018-2020 Andrei Karas (4144)
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/common/packets/packets_len_zero.h b/src/common/packets/packets_len_zero.h
index 9f1595459..c07f89e3f 100644
--- a/src/common/packets/packets_len_zero.h
+++ b/src/common/packets/packets_len_zero.h
@@ -2,8 +2,8 @@
* This file is part of Hercules.
* http://herc.ws - http://github.com/HerculesWS/Hercules
*
- * Copyright (C) 2018-2020 Hercules Dev Team
- * Copyright (C) 2018-2020 Andrei Karas (4144)
+ * Copyright (C) 2018-2020 Hercules Dev Team
+ * Copyright (C) 2018-2020 Andrei Karas (4144)
*
* Hercules is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by