From bd46a03bfc9987d4f04d5aca8f3a8cc6930c0848 Mon Sep 17 00:00:00 2001 From: gumi Date: Fri, 21 Sep 2018 11:31:58 -0400 Subject: add an auto-setup script for mariadb on windows --- tools/install_mariadb.bat | 7 ++++ tools/setup_mariadb.ps1 | 90 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 tools/install_mariadb.bat create mode 100644 tools/setup_mariadb.ps1 (limited to 'tools') diff --git a/tools/install_mariadb.bat b/tools/install_mariadb.bat new file mode 100644 index 000000000..cfe2ce3b7 --- /dev/null +++ b/tools/install_mariadb.bat @@ -0,0 +1,7 @@ +@echo off + +:: this file installs the mariadb service + +if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b) +mysqld.exe --install "MySQL" +net start MySQL diff --git a/tools/setup_mariadb.ps1 b/tools/setup_mariadb.ps1 new file mode 100644 index 000000000..709a5cf93 --- /dev/null +++ b/tools/setup_mariadb.ps1 @@ -0,0 +1,90 @@ +#Requires -Version 5.1 + +function Ask-Continue { Write-Output ""; pause; Write-Output "" } + +Write-Output "This script will automatically install MariaDB and configure it for you." +Write-Output "You may interrupt the installation by pressing CTRL+C or closing this window." +Ask-Continue + +if (-Not (Select-String -Quiet -SimpleMatch -Pattern "db_password: ""ragnarok""" -LiteralPath "$PSScriptRoot\..\conf\global\sql_connection.conf")) { + Write-Output "WARNING: It seems you already configured the sql connection for your server." + Write-Output "If you decide to continue, your settings will be overwritten." + Ask-Continue +} + +# step 1: install scoop +if (-Not (Get-Command scoop -errorAction SilentlyContinue)) { + Set-ExecutionPolicy RemoteSigned -scope Process -Force # <= this will trigger a yes/no prompt if not already authorized + Invoke-Expression (new-object net.webclient).downloadstring('https://get.scoop.sh') + scoop update +} + +# step 2: install mariadb +if (Test-Path $env:USERPROFILE\scoop\apps\mariadb) { + # usually we'd want to capture the output of "scoop list mariadb", but it uses + # Write-Host, so we can't, hence why we check manually for the folder + Write-Output "WARNING: MariaDB is already installed!" + Write-Output "If you decide to continue, your hercules user password will be overwritten." + Ask-Continue +} elseif (Get-Command mysqld -errorAction SilentlyContinue) { + Write-Output "ERROR: You already have a MySQL provider installed. To avoid conflict, MariaDB will not be installed." + Write-Output "If you wish to continue you will have to uninstall your current MySQL provider." + exit 1 +} else { + scoop install mariadb +} + +# step 3: add the herc user, set up the new database +$userpw = -join ((48..57) + (97..122) | Get-Random -Count 32 | % {[char]$_}) +$rootpw = -join ((48..57) + (97..122) | Get-Random -Count 32 | % {[char]$_}) +$maria_job = Start-Process -NoNewWindow -FilePath "mysqld.exe" -ArgumentList "--console" -PassThru -RedirectStandardError "$PSScriptRoot\maria.out" + +while (-Not $maria_job.HasExited) { + if ($lt -Lt 1 -And (Select-String -Quiet -SimpleMatch -Pattern "ready for connections" -LiteralPath "$PSScriptRoot\maria.out")) { +@" +CREATE DATABASE IF NOT EXISTS hercules; +DROP USER IF EXISTS 'hercules'@'localhost'; +DROP USER IF EXISTS 'hercules'@'127.0.0.1'; +CREATE USER 'hercules'@'localhost' IDENTIFIED BY '$userpw'; +CREATE USER 'hercules'@'127.0.0.1' IDENTIFIED BY '$userpw'; +-- ALTER USER 'root'@'localhost' IDENTIFIED BY '$rootpw'; +GRANT ALTER,CREATE,SELECT,INSERT,UPDATE,DELETE,DROP,INDEX ON `hercules`.* TO 'hercules'@'localhost'; +GRANT ALTER,CREATE,SELECT,INSERT,UPDATE,DELETE,DROP,INDEX ON `hercules`.* TO 'hercules'@'127.0.0.1'; +FLUSH PRIVILEGES; +USE `hercules`; +\. $PSScriptRoot\..\sql-files\main.sql +\. $PSScriptRoot\..\sql-files\logs.sql +shutdown; +\q +"@ | mysql.exe -u root + $lt++ + } + Start-Sleep 1 +} + +if ($lt -Lt 1) { + Write-Output "ERROR: MariaDB could not execute the query." + Write-Output "This might happen if your root user already has a password, or if the MySQL service is currently running." + $maria_job.close() + exit 1 +} + +# step 4: finish up +@" +sql_connection: { + db_username: "hercules" + db_password: "$userpw" + db_database: "hercules" +} +"@ | Out-File -Encoding UTF8 -LiteralPath "$PSScriptRoot\..\conf\global\sql_connection.conf" +Remove-Item -Force -errorAction SilentlyContinue "$PSScriptRoot\maria.out" +& "$PSScriptRoot\install_mariadb.bat" # <= we need admin permissions, so we use an external script +Write-Output "========= ALL DONE =========" +Write-Output "" +Write-Output "Your hercules installation is now configured to use MariaDB." +Write-Output "You can find the password in conf\global\sql_connection.conf." +Write-Output "" +Write-Output "If you want to start MariaDB on boot, use services.msc and set ""MySQL"" to Automatic." +Write-Output "" +Write-Output "Make sure you set a password for the root user. You can do this from the command line or from HeidiSQL." +Write-Output "You can obtain HeidiSQL at https://www.microsoft.com/store/productId/9NXPRT2T0ZJF" -- cgit v1.2.3-70-g09d2 From 794ce3c89497a17bd64eacbc82bce22f07f00acb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 17 Dec 2018 04:29:15 +0300 Subject: Fix HPM generation for old packet versions. From now HPM generated for 20031028 main packet version. --- src/common/HPMDataCheck.h | 10 ---------- src/map/clif.c | 2 +- src/map/packets_struct.h | 4 ++-- tools/HPMHookGen/doxygen.conf | 4 +++- 4 files changed, 6 insertions(+), 14 deletions(-) (limited to 'tools') diff --git a/src/common/HPMDataCheck.h b/src/common/HPMDataCheck.h index bfd01ec30..3c544a955 100644 --- a/src/common/HPMDataCheck.h +++ b/src/common/HPMDataCheck.h @@ -132,11 +132,6 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { #else #define CHAR_MAPIF_H #endif // CHAR_MAPIF_H - #ifdef CHAR_PACKETS_HC_STRUCT_H - { "PACKET_HC_ACK_CHARINFO_PER_PAGE", sizeof(struct PACKET_HC_ACK_CHARINFO_PER_PAGE), SERVER_TYPE_CHAR }, - #else - #define CHAR_PACKETS_HC_STRUCT_H - #endif // CHAR_PACKETS_HC_STRUCT_H #ifdef CHAR_PINCODE_H { "pincode_interface", sizeof(struct pincode_interface), SERVER_TYPE_CHAR }, #else @@ -680,11 +675,9 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "PACKET_ZC_ADD_ITEM_TO_MAIL", sizeof(struct PACKET_ZC_ADD_ITEM_TO_MAIL), SERVER_TYPE_MAP }, { "PACKET_ZC_ADD_ITEM_TO_STORE", sizeof(struct PACKET_ZC_ADD_ITEM_TO_STORE), SERVER_TYPE_MAP }, { "PACKET_ZC_ADD_MEMBER_TO_GROUP", sizeof(struct PACKET_ZC_ADD_MEMBER_TO_GROUP), SERVER_TYPE_MAP }, - { "PACKET_ZC_AUTOSPELLLIST", sizeof(struct PACKET_ZC_AUTOSPELLLIST), SERVER_TYPE_MAP }, { "PACKET_ZC_CASH_ITEM_DELETE", sizeof(struct PACKET_ZC_CASH_ITEM_DELETE), SERVER_TYPE_MAP }, { "PACKET_ZC_CASH_TIME_COUNTER", sizeof(struct PACKET_ZC_CASH_TIME_COUNTER), SERVER_TYPE_MAP }, { "PACKET_ZC_CHECKNAME", sizeof(struct PACKET_ZC_CHECKNAME), SERVER_TYPE_MAP }, - { "PACKET_ZC_CLANINFO", sizeof(struct PACKET_ZC_CLANINFO), SERVER_TYPE_MAP }, { "PACKET_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER", sizeof(struct PACKET_ZC_FAILED_TRADE_BUYING_STORE_TO_SELLER), SERVER_TYPE_MAP }, { "PACKET_ZC_FEED_MER", sizeof(struct PACKET_ZC_FEED_MER), SERVER_TYPE_MAP }, { "PACKET_ZC_FEED_PET", sizeof(struct PACKET_ZC_FEED_PET), SERVER_TYPE_MAP }, @@ -715,8 +708,6 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "PACKET_ZC_NOTIFY_UNREADMAIL", sizeof(struct PACKET_ZC_NOTIFY_UNREADMAIL), SERVER_TYPE_MAP }, { "PACKET_ZC_NOTIFY_WEAPONITEMLIST", sizeof(struct PACKET_ZC_NOTIFY_WEAPONITEMLIST), SERVER_TYPE_MAP }, { "PACKET_ZC_NOTIFY_WEAPONITEMLIST_sub", sizeof(struct PACKET_ZC_NOTIFY_WEAPONITEMLIST_sub), SERVER_TYPE_MAP }, - { "PACKET_ZC_NPC_MARKET_OPEN", sizeof(struct PACKET_ZC_NPC_MARKET_OPEN), SERVER_TYPE_MAP }, - { "PACKET_ZC_NPC_MARKET_OPEN_sub", sizeof(struct PACKET_ZC_NPC_MARKET_OPEN_sub), SERVER_TYPE_MAP }, { "PACKET_ZC_OPEN_UI", sizeof(struct PACKET_ZC_OPEN_UI), SERVER_TYPE_MAP }, { "PACKET_ZC_OVERWEIGHT_PERCENT", sizeof(struct PACKET_ZC_OVERWEIGHT_PERCENT), SERVER_TYPE_MAP }, { "PACKET_ZC_PC_CASH_POINT_ITEMLIST", sizeof(struct PACKET_ZC_PC_CASH_POINT_ITEMLIST), SERVER_TYPE_MAP }, @@ -728,7 +719,6 @@ HPExport const struct s_HPMDataCheck HPMDataCheck[] = { { "PACKET_ZC_PC_PURCHASE_MYITEMLIST", sizeof(struct PACKET_ZC_PC_PURCHASE_MYITEMLIST), SERVER_TYPE_MAP }, { "PACKET_ZC_PC_PURCHASE_MYITEMLIST_sub", sizeof(struct PACKET_ZC_PC_PURCHASE_MYITEMLIST_sub), SERVER_TYPE_MAP }, { "PACKET_ZC_PRIVATE_AIRSHIP_RESPONSE", sizeof(struct PACKET_ZC_PRIVATE_AIRSHIP_RESPONSE), SERVER_TYPE_MAP }, - { "PACKET_ZC_PROPERTY_HOMUN", sizeof(struct PACKET_ZC_PROPERTY_HOMUN), SERVER_TYPE_MAP }, { "PACKET_ZC_READ_MAIL", sizeof(struct PACKET_ZC_READ_MAIL), SERVER_TYPE_MAP }, { "PACKET_ZC_REMOVE_EFFECT", sizeof(struct PACKET_ZC_REMOVE_EFFECT), SERVER_TYPE_MAP }, { "PACKET_ZC_REPAIRITEMLIST", sizeof(struct PACKET_ZC_REPAIRITEMLIST), SERVER_TYPE_MAP }, diff --git a/src/map/clif.c b/src/map/clif.c index e8780c6ff..28b953de5 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1628,7 +1628,7 @@ static bool clif_spawn(struct block_list *bl) /// 022e .24B .B .W .W .W .W .W .W .W .W .W .W .W .W .W .W .W .W .L .L .W .W static void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) { -#if PACKETVER_MAIN_NUM >= 20101005 || PACKETVER_RE_NUM >= 20080827 || defined(PACKETVER_ZERO_NUM) +#if PACKETVER_MAIN_NUM >= 20101005 || PACKETVER_RE_NUM >= 20080827 || defined(PACKETVER_ZERO) struct status_data *hstatus; enum homun_type htype; struct PACKET_ZC_PROPERTY_HOMUN p; diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index f9b5fab0d..d648d262e 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -2270,7 +2270,7 @@ struct PACKET_ZC_ACK_WEAPONREFINE { #endif } __attribute__((packed)); -#if PACKETVER_MAIN_NUM >= 20131230 || PACKETVER_RE_NUM >= 20131230 || defined(PACKETVER_ZERO_NUM) +#if PACKETVER_MAIN_NUM >= 20131230 || PACKETVER_RE_NUM >= 20131230 || defined(PACKETVER_ZERO) // PACKET_ZC_PROPERTY_HOMUN2 struct PACKET_ZC_PROPERTY_HOMUN { int16 packetType; @@ -2303,7 +2303,7 @@ struct PACKET_ZC_PROPERTY_HOMUN { uint16 range; } __attribute__((packed)); DEFINE_PACKET_HEADER(ZC_PROPERTY_HOMUN, 0x09f7); -#elif PACKETVER_MAIN_NUM >= 20101005 || PACKETVER_RE_NUM >= 20080827 || defined(PACKETVER_ZERO_NUM) +#elif PACKETVER_MAIN_NUM >= 20101005 || PACKETVER_RE_NUM >= 20080827 || defined(PACKETVER_ZERO) // PACKET_ZC_PROPERTY_HOMUN1 struct PACKET_ZC_PROPERTY_HOMUN { int16 packetType; diff --git a/tools/HPMHookGen/doxygen.conf b/tools/HPMHookGen/doxygen.conf index ec55967b1..c302f7f2f 100644 --- a/tools/HPMHookGen/doxygen.conf +++ b/tools/HPMHookGen/doxygen.conf @@ -269,7 +269,9 @@ INCLUDE_PATH = ../../src \ ../../3rdparty INCLUDE_FILE_PATTERNS = PREDEFINED = __attribute__(x)= \ - HPMHOOKGEN + HPMHOOKGEN \ + PACKETVER=20031028 \ + PACKETVER_MAIN_NUM=20031028 EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = NO #--------------------------------------------------------------------------- -- cgit v1.2.3-70-g09d2 From ab72d50b10b382d1256ccef6c945df0e1562b4a8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 25 Feb 2019 00:40:12 +0300 Subject: Show crash dump in travis --- .travis.yml | 11 +++++++++++ tools/ci/travis.sh | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/.travis.yml b/.travis.yml index a9bea834d..f5f11e19b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ install: before_script: - uname -a + - ulimit -c unlimited -S - ./tools/ci/travis.sh createdb ragnarok root - ./tools/ci/travis.sh importdb ragnarok root - ./tools/ci/travis.sh adduser ragnarok travis travis root @@ -44,6 +45,7 @@ matrix: sources: - ubuntu-toolchain-r-test packages: + - gdb - gcc-6 - doxygen - libxml-simple-perl @@ -57,6 +59,7 @@ matrix: - llvm-toolchain-trusty-5.0 - ubuntu-toolchain-r-test packages: + - gdb - clang-5.0 - compiler: clang env: CONFIGURE_FLAGS="--enable-debug CC=clang-5.0 --disable-renewal --enable-Werror --enable-buildbot" @@ -66,6 +69,7 @@ matrix: - llvm-toolchain-trusty-5.0 - ubuntu-toolchain-r-test packages: + - gdb - clang-5.0 - compiler: clang env: CONFIGURE_FLAGS="--enable-debug CC=clang-4.0 --enable-Werror --enable-packetver=20190123 --enable-packetver-re --enable-buildbot" @@ -75,6 +79,7 @@ matrix: - llvm-toolchain-trusty-4.0 - ubuntu-toolchain-r-test packages: + - gdb - clang-4.0 - compiler: clang env: CONFIGURE_FLAGS="--enable-debug CC=clang-4.0 --enable-Werror --enable-packetver=20130724 --enable-packetver-re --enable-buildbot" @@ -84,6 +89,7 @@ matrix: - llvm-toolchain-trusty-4.0 - ubuntu-toolchain-r-test packages: + - gdb - clang-4.0 - compiler: clang env: CONFIGURE_FLAGS="--enable-debug CC=clang-4.0 --disable-renewal --enable-Werror --enable-buildbot" @@ -93,6 +99,7 @@ matrix: - llvm-toolchain-trusty-4.0 - ubuntu-toolchain-r-test packages: + - gdb - clang-4.0 - compiler: clang env: CONFIGURE_FLAGS="--enable-debug --enable-Werror --enable-buildbot" @@ -109,6 +116,7 @@ matrix: sources: - ubuntu-toolchain-r-test packages: + - gdb - gcc-5 - compiler: gcc env: LDFLAGS="-fuse-ld=gold" CONFIGURE_FLAGS="--enable-debug --enable-sanitize=full CC=gcc-5 --disable-manager --disable-renewal --enable-Werror --enable-buildbot" @@ -117,6 +125,7 @@ matrix: sources: - ubuntu-toolchain-r-test packages: + - gdb - gcc-5 - compiler: gcc env: LDFLAGS="-fuse-ld=gold" CONFIGURE_FLAGS="--enable-debug --enable-sanitize=full CC=gcc-6 --disable-manager --enable-Werror --enable-packetver=20190123 --enable-packetver-re --enable-buildbot" @@ -125,6 +134,7 @@ matrix: sources: - ubuntu-toolchain-r-test packages: + - gdb - gcc-6 - compiler: gcc env: LDFLAGS="-fuse-ld=gold" CONFIGURE_FLAGS="--enable-debug --enable-sanitize=full CC=gcc-6 --disable-manager --disable-renewal --enable-Werror --enable-buildbot" @@ -133,6 +143,7 @@ matrix: sources: - ubuntu-toolchain-r-test packages: + - gdb - gcc-6 notifications: diff --git a/tools/ci/travis.sh b/tools/ci/travis.sh index fa7d5be93..22f523bdf 100755 --- a/tools/ci/travis.sh +++ b/tools/ci/travis.sh @@ -47,7 +47,8 @@ function aborterror { function run_server { echo "Running: $1 --run-once $2" - $1 --run-once $2 2>runlog.txt + rm -rf core* || true + CRASH_PLEASE=1 $1 --run-once $2 2>runlog.txt export errcode=$? export teststr=$(head -c 10000 runlog.txt) if [[ -n "${teststr}" ]]; then @@ -59,12 +60,17 @@ function run_server { fi if [ ${errcode} -ne 0 ]; then echo "server $1 terminated with exit code ${errcode}" + COREFILE=$(find . -maxdepth 1 -name "core*" | head -n 1) + if [[ -f "$COREFILE" ]]; then + gdb -c "$COREFILE" $1 -ex "thread apply all bt" -ex "set pagination 0" -batch + fi aborterror "Test failed" fi } function run_test { echo "Running: test_$1" + sysctl -w kernel.core_pattern=core || true ./test_$1 2>runlog.txt export errcode=$? export teststr=$(head -c 10000 runlog.txt) -- cgit v1.2.3-70-g09d2 From c9abf7108f3bd2bde0a7fa2a54eaec6898710195 Mon Sep 17 00:00:00 2001 From: Phong Truong Date: Tue, 16 Apr 2019 08:34:18 +0700 Subject: Fixed issue with Perl v5.26.1 Issue: - Unescaped left brace in regex is illegal here in regex; --- tools/itemdbconverter.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/itemdbconverter.pl b/tools/itemdbconverter.pl index 58cb08bc1..fe30ce24e 100755 --- a/tools/itemdbconverter.pl +++ b/tools/itemdbconverter.pl @@ -109,9 +109,9 @@ sub parsedb (@) { (?[0-9]*)[^,:]*(?:[\s\t]*(?[0-9]*))?[^,]*,[\s\t]* (?[0-9]*)[^,]*,[\s\t]* (?[0-9]*)[^,]*,[\s\t]* - {(?