Restructured sourcce tree and rewrote build system using CMake.
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is failing Details

This commit is contained in:
Daniel Wolf 2022-04-26 13:45:49 -04:00
parent 0f373bcb6c
commit 6b7bbaa73f
Signed by: nephatrine
GPG Key ID: 59D70EC2E4AAB4D0
57 changed files with 1288 additions and 639 deletions

97
.clang-format Normal file
View File

@ -0,0 +1,97 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Allman
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 200
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 6
ContinuationIndentWidth: 6
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '$'
IndentCaseLabels: true
IndentPPDirectives: AfterHash
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 200
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 60
PenaltyReturnTypeOnItsOwnLine: 1000000
PointerAlignment: Middle
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Never
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: true
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: ForIndentation
...

View File

@ -7,40 +7,42 @@ platform:
arch: amd64
steps:
- name: submodules
image: nephatrine/nxbuilder:alpine
commands:
- sudo chown -R packager .
- git submodule update --init --recursive
- name: build-alpine
image: nephatrine/nxbuilder:alpine
commands:
- sudo apk --update add curl-dev
- make
- tar -czvf q2admin-nxmod_x86_64-alpine-linux-musl.tar.gz -C release game.so
- tar -czvf q2admin-nxmod_noarch.tar.gz q2*.txt q2*.json
- make clean
depends_on:
- submodules
- sudo mkdir build-alpine
- sudo chown -R packager build-alpine
- cd build-alpine
- cmake -GNinja -DNXPACKAGE_TRIPLET="x86_64-alpine-linux-musl" -DQ2ADMIN_NAME="game" ..
- ninja orca
- ninja
- tar -czvf q2admin-nxmod_x86_64-alpine-linux-musl.tar.gz game.so
- cd ../data
- tar -czvf ../build-alpine/q2admin-nxmod_noarch.tar.gz *.txt *.json
- name: build-ubuntu
image: nephatrine/nxbuilder:ubuntu
commands:
- sudo apt-get update
- sudo apt-get install -y libcurl4-openssl-dev
- CFLAGS="-D_GNU_SOURCE" make
- tar -czvf q2admin-nxmod_x86_64-ubuntu-linux-gnu.tar.gz -C release game.so
- make clean
depends_on:
- build-alpine
- sudo mkdir build-ubuntu
- sudo chown -R packager build-ubuntu
- cd build-ubuntu
- cmake -GNinja -DNXPACKAGE_TRIPLET="x86_64-ubuntu-linux-gnu" -DQ2ADMIN_NAME="game" ..
- ninja orca
- ninja
- tar -czvf q2admin-nxmod_x86_64-ubuntu-linux-gnu.tar.gz game.so
- name: build-redhat
image: nephatrine/nxbuilder:almalinux
commands:
- sudo dnf -y install libcurl-devel
- CFLAGS="-D_GNU_SOURCE -m64" LDFLAGS="-m64" make
- tar -czvf q2admin-nxmod_x86_64-redhat-linux-gnu.tar.gz -C release game.so
- make clean
depends_on:
- build-ubuntu
- sudo mkdir build-redhat
- sudo chown -R packager build-redhat
- cd build-redhat
- cmake -GNinja -DNXPACKAGE_TRIPLET="x86_64-redhat-linux-gnu" -DQ2ADMIN_NAME="game" ..
- ninja orca
- ninja
- tar -czvf q2admin-nxmod_x86_64-redhat-linux-gnu.tar.gz game.so
- name: publish-web
image: alpine/curl
environment:
@ -49,10 +51,16 @@ steps:
WEBDAV_PASSWORD:
from_secret: webdav-pass
commands:
- curl -T 'q2admin-nxmod_{x86_64-alpine-linux-musl,x86_64-redhat-linux-gnu,x86_64-ubuntu-linux-gnu,noarch}.tar.gz' --user "$WEBDAV_USERNAME:$WEBDAV_PASSWORD" 'https://files.nephatrine.net/archives/'
- curl -T 'build-alpine/q2admin-nxmod_{x86_64-alpine-linux-musl,noarch}.tar.gz' --user "$WEBDAV_USERNAME:$WEBDAV_PASSWORD" 'https://files.nephatrine.net/archives/'
- curl -T 'build-redhat/q2admin-nxmod_x86_64-redhat-linux-gnu.tar.gz' --user "$WEBDAV_USERNAME:$WEBDAV_PASSWORD" 'https://files.nephatrine.net/archives/'
- curl -T 'build-ubuntu/q2admin-nxmod_x86_64-ubuntu-linux-gnu.tar.gz' --user "$WEBDAV_USERNAME:$WEBDAV_PASSWORD" 'https://files.nephatrine.net/archives/'
depends_on:
- build-alpine
- build-redhat
- build-ubuntu
when:
branch:
- master
event:
exclude:
- pull_request
@ -63,12 +71,14 @@ steps:
from_secret: gitea-api
base_url: https://code.nephatrine.net
files:
- q2admin-nxmod_x86_64-alpine-linux-musl.tar.gz
- q2admin-nxmod_x86_64-redhat-linux-gnu.tar.gz
- q2admin-nxmod_x86_64-ubuntu-linux-gnu.tar.gz
- q2admin-nxmod_noarch.tar.gz
- build-alpine/q2admin-nxmod_x86_64-alpine-linux-musl.tar.gz
- build-redhat/q2admin-nxmod_x86_64-redhat-linux-gnu.tar.gz
- build-ubuntu/q2admin-nxmod_x86_64-ubuntu-linux-gnu.tar.gz
- build-alpine/q2admin-nxmod_noarch.tar.gz
depends_on:
- build-alpine
- build-redhat
- build-ubuntu
when:
event:
- tag
@ -100,6 +110,6 @@ trigger:
---
kind: signature
hmac: 23fddf073a44c56aeee1589e9174551b95cc52f650bd95df022441d042675615
hmac: 7c1ddf40e6d7e5ee8578c877f1ab78930b4bd4cfdc06f9c67d5ea4faedaeceee
...

3
.gitattributes vendored Normal file
View File

@ -0,0 +1,3 @@
* text=auto eol=lf
*.rc text eol=crlf
*.rc.in text eol=crlf

26
.gitignore vendored
View File

@ -1,12 +1,14 @@
Debug/
Release/
x64/
build/
ipch/
*.o
*.opensdf
*.sdf
*.so
*.suo
*.vcxproj.user
.vs/
.kdev4/*
.vs/*
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
GitInfo.cmake
build*/*
sign-build.sh
*.code-workspace
*.kate-swp
*.kdev4
*.swp

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "external/orca"]
path = external/orca
url = https://github.com/cee-studio/orca.git

View File

@ -1,11 +0,0 @@
language: c
os:
- linux
- osx
compiler: gcc
script:
- make all

7
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,7 @@
{
"recommendations": [
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"eamodio.gitlens"
]
}

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
}

170
CMakeLists.txt Normal file
View File

@ -0,0 +1,170 @@
# -------------------------------
# SPDX-License-Identifier: ISC
#
# Copyright © 2022 Daniel Wolf <<nephatrine@gmail.com>>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# -------------------------------
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
project(
Q2Admin
VERSION 1.18.0
DESCRIPTION "Quake II Game Proxy Mod"
HOMEPAGE_URL "https://code.nephatrine.net/nephatrine/q2admin-nxmod"
LANGUAGES C)
# ==== Include NXBuild ====
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tools")
set(NX_INSTALL_IS_FLAT ON)
include(NXBuild)
include(NXProject)
include(NXFormat)
include(NXTarget)
# ==== Q2Admin Project ====
nx_project_begin(
MAINTAINER "Daniel Wolf"
CONTACT "nephatrine@gmail.com"
SUPPORT "${PROJECT_HOMEPAGE_URL}/issues"
VENDOR "NephNET")
set(Q2ADMIN_SOURCES
"src/g_local.h"
"src/g_main.c"
"src/game.h"
"src/q_shared.h"
"src/zb_ban.c"
"src/zb_checkvar.c"
"src/zb_cmd.c"
"src/zb_disable.c"
"src/zb_flood.c"
"src/zb_init.c"
"src/zb_log.c"
"src/zb_lrcon.c"
"src/zb_msgqueue.c"
"src/zb_spawn.c"
"src/zb_util.c"
"src/zb_vote.c"
"src/zb_zbot.c"
"src/zb_zbotcheck.c"
"src/zbot.rc.in")
# ==== Q2Admin Configuration ====
if(COMMAND nx_default_flags)
nx_default_flags()
endif()
unset(Q2ADMIN_DEPENDENCIES)
if(NX_TARGET_PLATFORM_WINDOWS)
if(NX_HOST_COMPILER_MSVC)
list(APPEND Q2ADMIN_SOURCES "src/regex.c" "src/regex.h")
else()
list(APPEND Q2ADMIN_DEPENDENCIES "regex")
endif()
endif()
# Module Name
if(NOT DEFINED Q2ADMIN_NAME)
set(Q2ADMIN_NAME "game")
if(NX_TARGET_ARCHITECTURE_AMD64)
if(NX_TARGET_PLATFORM_WINDOWS)
set(Q2ADMIN_NAME "gamex64")
else()
set(Q2ADMIN_NAME "gamex86_64")
endif()
elseif(NX_TARGET_ARCHITECTURE_IA32)
if(NX_TARGET_PLATFORM_WINDOWS)
set(Q2ADMIN_NAME "gamex86")
else()
set(Q2ADMIN_NAME "gamei386")
endif()
elseif(NX_TARGET_ARCHITECTURE_ARMV7)
set(Q2ADMIN_NAME "gamearm")
elseif(NX_TARGET_ARCHITECTURE_ARM64)
if(NX_TARGET_PLATFORM_WINDOWS)
set(Q2ADMIN_NAME "gamearm64")
else()
set(Q2ADMIN_NAME "gameaarch64")
endif()
endif()
endif()
set(Q2ADMIN_DEFINES "GAMENAME=\"${Q2ADMIN_NAME}\"" "GAMEEXT=\"${CMAKE_SHARED_MODULE_SUFFIX}\"")
# Discord Support
set(bCanDiscord OFF)
if(NX_TARGET_PLATFORM_POSIX AND NX_TARGET_ARCHITECTURE_NATIVE)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
if(Threads_FOUND AND CMAKE_USE_PTHREADS_INIT)
set(bCanDiscord ON)
endif()
endif()
cmake_dependent_option(WITH_DISCORD "Enable Discord Support" ON "bCanDiscord" OFF)
# ==== Orca Target ====
unset(ORCA_DISCORD_INCLUDE_DIR)
unset(ORCA_DISCORD_LIBRARY)
if(WITH_DISCORD)
list(APPEND Q2ADMIN_SOURCES "src/zb_discord.c" "src/zb_discord.h")
list(APPEND Q2ADMIN_DEFINES "USE_DISCORD=1")
include(ExternalProject)
ExternalProject_Add(
orca
GIT_REPOSITORY "https://github.com/cee-studio/orca.git"
GIT_TAG "ef7cc8d1eca1468c75fde7ba9f183b41c26ef1bc"
GIT_SHALLOW ON
GIT_PROGRESS ON
CONFIGURE_COMMAND ""
BUILD_COMMAND make discord github
BUILD_IN_SOURCE ON
INSTALL_COMMAND "${CMAKE_COMMAND}" -E env PREFIX="<INSTALL_DIR>" make install)
ExternalProject_Get_Property(orca INSTALL_DIR)
set(ORCA_DISCORD_INCLUDE_DIR "${INSTALL_DIR}/include")
set(ORCA_DISCORD_LIBRARY "${INSTALL_DIR}/lib/libdiscord.a")
set(ORCA_DISCORD_DEPENDENCIES "curl" "Threads::Threads")
endif()
# ==== Q2Admin Target ====
nx_target(
Q2ADMIN_TARGETS "q2admin" SHARED_MODULE
OUTPUT_NAME "${Q2ADMIN_NAME}"
GENERATE_EXPORT "generated/g_export.h" Q2ADMIN
GENERATE_VERSION "generated/g_version.h" Q2ADMIN
DEFINES PRIVATE ${Q2ADMIN_DEFINES}
DEPENDS PRIVATE "${ORCA_DISCORD_LIBRARY}" ${ORCA_DISCORD_DEPENDENCIES} ${CMAKE_DL_LIBS}
FEATURES PRIVATE "c_std_99"
INCLUDES PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/generated" "${ORCA_DISCORD_INCLUDE_DIR}"
SOURCES PRIVATE ${Q2ADMIN_SOURCES})
if(WITH_DISCORD)
add_dependencies("${Q2ADMIN_TARGETS}" "orca")
endif()
# ==== Project End ====
nx_format_clang(FILES "src/zb_discord.c" "src/zb_discord.h")
nx_project_end()

339
COPYING Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

20
ChangeLog.md Normal file
View File

@ -0,0 +1,20 @@
# Changelog
All notable changes to this project will be documented in this file.
This format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [1.18.0]
### Added
- CVar `basepath` (base filesystem path to read configuration files)
- CVar `savepath` (base filesystem path to write log files)
- Experimental Discord<->Q2 Bridge
- Restored `quake2dirsupport` Functionality
## [1.17.48-tsmod-2]
The original version of Q2Admin that was forked to create this project.

336
LICENSE.md Normal file
View File

@ -0,0 +1,336 @@
GNU General Public License
==========================
_Version 2, June 1991_
_Copyright © 1989, 1991 Free Software Foundation, Inc.,_
_51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA_
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
### Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: **(1)** copyright the software, and
**(2)** offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
### TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
**0.** This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The “Program”, below,
refers to any such program or work, and a “work based on the Program”
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term “modification”.) Each licensee is addressed as “you”.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
**1.** You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
**2.** You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
* **a)** You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
* **b)** You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
* **c)** If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
**3.** You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
* **a)** Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
* **b)** Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
* **c)** Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
**4.** You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
**5.** You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
**6.** Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
**7.** If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
**8.** If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
**9.** The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and “any
later version”, you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
**10.** If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
### NO WARRANTY
**11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
**12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
### How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the “copyright” line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w` and `show c` should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w` and `show c`; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a “copyright disclaimer” for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

449
Makefile
View File

@ -1,449 +0,0 @@
# q2admin.so linux makefile
# This builds in the native mode of the current OS by default.
# Note that you might need to install the 32-bit libc package
# if it isn't already installed on your platform.
# Examples:
# sudo apt-get install ia32-libs
# sudo apt-get install libc6-dev-i386
# On Ubuntu 16.x use sudo apt install libc6-dev-i386
WITH_DISCORD:=yes
# Stole This From Yamagi
# Detect the OS
ifdef SystemRoot
Q2A_OSTYPE ?= Windows
else
Q2A_OSTYPE ?= $(shell uname -s)
endif
# Special case for MinGW
ifneq (,$(findstring MINGW,$(Q2A_OSTYPE)))
Q2A_OSTYPE := Windows
endif
# Detect the architecture
ifeq ($(Q2A_OSTYPE), Windows)
ifdef MINGW_CHOST
ifeq ($(MINGW_CHOST), x86_64-w64-mingw32)
Q2A_ARCH ?= x86_64
else # i686-w64-mingw32
Q2A_ARCH ?= i386
endif
else # windows, but MINGW_CHOST not defined
ifdef PROCESSOR_ARCHITEW6432
# 64 bit Windows
Q2A_ARCH ?= $(PROCESSOR_ARCHITEW6432)
else
# 32 bit Windows
Q2A_ARCH ?= $(PROCESSOR_ARCHITECTURE)
endif
endif # windows but MINGW_CHOST not defined
else
ifneq ($(Q2A_OSTYPE), Darwin)
# Normalize some abiguous Q2A_ARCH strings
Q2A_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/amd64/x86_64/' -e 's/^arm.*/arm/')
else
Q2A_ARCH ?= $(shell uname -m)
endif
endif
# On Windows / MinGW $(CC) is undefined by default.
ifeq ($(Q2A_OSTYPE),Windows)
CC ?= gcc
endif
# Detect the compiler
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
COMPILER := clang
COMPILERVER := $(shell $(CC) -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/')
else ifeq ($(shell $(CC) -v 2>&1 | grep -c -E "(gcc version|gcc-Version)"), 1)
COMPILER := gcc
COMPILERVER := $(shell $(CC) -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/')
else
COMPILER := unknown
endif
# ASAN includes DEBUG
ifdef ASAN
DEBUG=1
endif
# UBSAN includes DEBUG
ifdef UBSAN
DEBUG=1
endif
# ----------
# Base CFLAGS. These may be overridden by the environment.
# Highest supported optimizations are -O2, higher levels
# will likely break this crappy code.
ifdef DEBUG
CFLAGS ?= -O0 -g -Wall -pipe
ifdef ASAN
override CFLAGS += -fsanitize=address -DUSE_SANITIZER
endif
ifdef UBSAN
override CFLAGS += -fsanitize=undefined -DUSE_SANITIZER
endif
else
CFLAGS ?= -O2 -Wall -pipe -fomit-frame-pointer
endif
# Always needed are:
# -fno-strict-aliasing since the source doesn't comply
# with strict aliasing rules and it's next to impossible
# to get it there...
# -fwrapv for defined integer wrapping. MSVC6 did this
# and the game code requires it.
# -fvisibility=hidden to keep symbols hidden. This is
# mostly best practice and not really necessary.
override CFLAGS += -std=gnu99 -fno-strict-aliasing -fwrapv -fvisibility=hidden
# -MMD to generate header dependencies. Unsupported by
# the Clang shipped with OS X.
ifneq ($(Q2A_OSTYPE), Darwin)
override CFLAGS += -MMD
endif
# OS X architecture.
ifeq ($(Q2A_OSTYPE), Darwin)
override CFLAGS += -arch $(Q2A_ARCH)
endif
# ----------
# ARM needs a sane minimum architecture. We need the `yield`
# opcode, arm6k is the first iteration that supports it. arm6k
# is also the first Raspberry PI generation and older hardware
# is likely too slow to run the game. We're not enforcing the
# minimum architecture, but if you're build for something older
# like arm5 the `yield` opcode isn't compiled in and the game
# (especially q2ded) will consume more CPU time than necessary.
ifeq ($(Q2A_ARCH), arm)
CFLAGS += -march=armv6k
endif
# ----------
# Switch of some annoying warnings.
ifeq ($(COMPILER), clang)
# -Wno-missing-braces because otherwise clang complains
# about totally valid 'vec3_t bla = {0}' constructs.
override CFLAGS += -Wno-missing-braces
else ifeq ($(COMPILER), gcc)
# GCC 8.0 or higher.
ifeq ($(shell test $(COMPILERVER) -ge 80000; echo $$?),0)
# -Wno-format-truncation and -Wno-format-overflow
# because GCC spams about 50 false positives.
override CFLAGS += -Wno-format-truncation -Wno-format-overflow
endif
endif
# ----------
# Defines the operating system and architecture
override CFLAGS += -DOSTYPE=\"$(Q2A_OSTYPE)\" -DARCH=\"$(Q2A_ARCH)\"
# ----------
# For reproduceable builds, look here for details:
# https://reproducible-builds.org/specs/source-date-epoch/
ifdef SOURCE_DATE_EPOCH
override CFLAGS += -DBUILD_DATE=\"$(shell date --utc --date="@${SOURCE_DATE_EPOCH}" +"%b %_d %Y" | sed -e 's/ /\\ /g')\"
endif
# ----------
# Using the default x87 float math on 32bit x86 causes rounding trouble
# -ffloat-store could work around that, but the better solution is to
# just enforce SSE - every x86 CPU since Pentium3 supports that
# and this should even improve the performance on old CPUs
ifeq ($(Q2A_ARCH), i386)
override CFLAGS += -msse -mfpmath=sse
endif
# Force SSE math on x86_64. All sane compilers should do this
# anyway, just to protect us from broken Linux distros.
ifeq ($(Q2A_ARCH), x86_64)
override CFLAGS += -mfpmath=sse
endif
# Disable floating-point expression contraction. While this shouldn't be
# a problem for C (only for C++) better be safe than sorry. See
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100839 for details.
ifeq ($(COMPILER), gcc)
override CFLAGS += -ffp-contract=off
endif
# ----------
# Base include path.
ifeq ($(Q2A_OSTYPE),Linux)
INCLUDE ?= -I/usr/include
else ifeq ($(Q2A_OSTYPE),FreeBSD)
INCLUDE ?= -I/usr/local/include
else ifeq ($(Q2A_OSTYPE),NetBSD)
INCLUDE ?= -I/usr/pkg/include
else ifeq ($(Q2A_OSTYPE),OpenBSD)
INCLUDE ?= -I/usr/local/include
else ifeq ($(Q2A_OSTYPE),Windows)
INCLUDE ?= -I/usr/include
endif
# ----------
# Base LDFLAGS. This is just the library path.
ifeq ($(Q2A_OSTYPE),Linux)
LDFLAGS ?= -L/usr/lib
else ifeq ($(Q2A_OSTYPE),FreeBSD)
LDFLAGS ?= -L/usr/local/lib
else ifeq ($(Q2A_OSTYPE),NetBSD)
LDFLAGS ?= -L/usr/pkg/lib -Wl,-R/usr/pkg/lib
else ifeq ($(Q2A_OSTYPE),OpenBSD)
LDFLAGS ?= -L/usr/local/lib
else ifeq ($(Q2A_OSTYPE),Windows)
LDFLAGS ?= -L/usr/lib
endif
# It's a shared library.
override LDFLAGS += -shared
# Link address sanitizer if requested.
ifdef ASAN
override LDFLAGS += -fsanitize=address
endif
# Link undefined behavior sanitizer if requested.
ifdef UBSAN
override LDFLAGS += -fsanitize=undefined
endif
# Required libraries.
ifeq ($(Q2A_OSTYPE),Linux)
ifeq ($(WITH_DISCORD),yes)
override CFLAGS += -DUSE_DISCORD
LDLIBS ?= -lcurl -lpthread -lm -ldl -rdynamic
else
LDLIBS ?= -lm -ldl -rdynamic
endif
else ifeq ($(Q2A_OSTYPE),FreeBSD)
LDLIBS ?= -lm
else ifeq ($(Q2A_OSTYPE),NetBSD)
LDLIBS ?= -lm
else ifeq ($(Q2A_OSTYPE),OpenBSD)
LDLIBS ?= -lm
else ifeq ($(Q2A_OSTYPE),Windows)
LDLIBS ?= -static-libgcc
else ifeq ($(Q2A_OSTYPE), Darwin)
LDLIBS ?= -arch $(Q2A_ARCH)
else ifeq ($(Q2A_OSTYPE), Haiku)
LDLIBS ?= -lm
else ifeq ($(Q2A_OSTYPE), SunOS)
LDLIBS ?= -lm
endif
# ASAN and UBSAN must not be linked
# with --no-undefined. OSX and OpenBSD
# don't support it at all.
ifndef ASAN
ifndef UBSAN
ifneq ($(Q2A_OSTYPE), Darwin)
ifneq ($(Q2A_OSTYPE), OpenBSD)
override LDFLAGS += -Wl,--no-undefined
endif
endif
endif
endif
# ----------
# When make is invoked by "make VERBOSE=1" print
# the compiler and linker commands.
ifdef VERBOSE
Q :=
else
Q := @
endif
# ----------
# Phony targets
.PHONY : all q2admin
# ----------
# Builds everything
all: q2admin
# ----------
# Print config values
config:
@echo "Build configuration"
@echo "============================"
@echo "Q2A_ARCH = $(Q2A_ARCH) COMPILER = $(COMPILER)"
@echo "WITH_DISCORD = $(WITH_DISCORD)"
@echo "============================"
@echo ""
# ----------
# Cleanup
clean:
@echo "===> CLEAN"
make -C external/orca clean
${Q}rm -Rf build orca release/*
cleanall:
@echo "===> CLEAN"
make -C external/orca clean
${Q}rm -Rf build orca release
# ----------
ORCA_HDRS = \
orca/specs-code/discord/one-specs.h \
orca/common.h \
orca/debug.h \
orca/discord.h \
orca/json-actor-boxed.h \
orca/log.h \
orca/logconf.h \
orca/ntl.h
discord: external/orca/lib/libdiscord.a ${ORCA_HDRS}
external/orca/lib/libdiscord.a:
make -C external/orca discord
orca/discord.h: external/orca/discord.h
${Q}mkdir -p $(@D)
${Q}cp $< $@
orca/debug.h: external/orca/cee-utils/debug.h
${Q}mkdir -p $(@D)
${Q}cp $< $@
orca/json-actor-boxed.h: external/orca/cee-utils/json-actor-boxed.h
${Q}mkdir -p $(@D)
${Q}cp $< $@
orca/log.h: external/orca/cee-utils/log.h
${Q}mkdir -p $(@D)
${Q}cp $< $@
orca/logconf.h: external/orca/cee-utils/logconf.h
${Q}mkdir -p $(@D)
${Q}cp $< $@
orca/ntl.h: external/orca/cee-utils/ntl.h
${Q}mkdir -p $(@D)
${Q}cp $< $@
orca/common.h: external/orca/common/common.h
${Q}mkdir -p $(@D)
${Q}cp $< $@
orca/specs-code/discord/one-specs.h: external/orca/specs-code/discord/one-specs.h
${Q}mkdir -p $(@D)
${Q}cp $< $@
# ----------
ifeq ($(Q2A_OSTYPE), Windows)
q2admin:
@echo "===> Building game.dll"
${Q}mkdir -p release
$(MAKE) release/game.dll
else ifeq ($(Q2A_OSTYPE), Darwin)
q2admin:
@echo "===> Building game.dylib"
${Q}mkdir -p release
$(MAKE) release/game.dylib
else
q2admin:
@echo "===> Building game.so"
${Q}mkdir -p release
$(MAKE) release/game.so
release/game.so : CFLAGS += -fPIC
endif
ifeq ($(Q2A_OSTYPE),Linux)
ifeq ($(WITH_DISCORD),yes)
build/zb_discord.o: zb_discord.c ${ORCA_HDRS}
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) -o $@ $<
endif
endif
build/%.o: %.c
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) -o $@ $<
# ----------
Q2A_OBJS_ = \
g_main.o \
zb_spawn.o \
zb_vote.o \
zb_ban.o \
zb_cmd.o \
zb_flood.o \
zb_init.o \
zb_log.o \
zb_lrcon.o \
zb_msgqueue.o \
zb_util.o \
zb_zbot.o \
zb_zbotcheck.o \
zb_disable.o \
zb_checkvar.o \
zb_discord.o
# ----------
# Rewrite paths to our object directory
Q2A_OBJS = $(patsubst %,build/%,$(Q2A_OBJS_))
# ----------
# Generate header dependencies
Q2A_DEPS = $(Q2A_OBJS:.o=.d)
# Suck header dependencies in
-include $(Q2A_DEPS)
# ----------
ifeq ($(Q2A_OSTYPE),Linux)
ifeq ($(WITH_DISCORD),yes)
Q2A_OBJS += external/orca/lib/libdiscord.a
endif
endif
# ----------
# release/quake2
ifeq ($(Q2A_OSTYPE), Windows)
release/game.dll : $(Q2A_OBJS) icon
@echo "===> LD $@"
${Q}$(CC) -o $@ $(Q2A_OBJS) $(LDFLAGS) $(LDLIBS)
else ifeq ($(Q2A_OSTYPE), Darwin)
release/game.dylib : $(Q2A_OBJS)
@echo "===> LD $@"
${Q}$(CC) -o $@ $(Q2A_OBJS) $(LDFLAGS) $(LDLIBS)
else
release/game.so : $(Q2A_OBJS)
@echo "===> LD $@"
${Q}$(CC) -o $@ $(Q2A_OBJS) $(LDFLAGS) $(LDLIBS)
endif
# ----------

61
README.md Normal file
View File

@ -0,0 +1,61 @@
# Q2Admin-NXMod
This is a fork of [Q2Admin](https://github.com/tastyspleen/q2admin-tsmod) with some compatibility tweaks and
experimental Discord support using the [Orca](https://github.com/cee-studio/orca) library.
[![Build Status](https://ci.nephatrine.net/api/badges/nephatrine/q2admin-nxmod/status.svg?ref=refs/heads/master)](https://ci.nephatrine.net/nephatrine/q2admin-nxmod)
## Discord Integration
**NOTE:** Feature is not supported for Windows builds.
The optional Discord integration passes many messages from Quake II to Discord automatically such as death
messages, client connections, and chat. There is currently no way to configure that more precisely.
Chat in the Discord channel is NOT automatically mirrored to Quake II outside of the `!say` command.
The following commands are implemented:
- `!say <message>`: Broadcasts a message to all players over in-game chat.
- `!rcon <command>`: Allows an whitelisted user or group to run Quake II server commands over Discord.
- `!ping`: Returns a *pong* from the bot. Just there to test connectivity.
Note that in most cases, any `!rcon` commands that rely on output being shown to the user will most likely
not have that output mirrored to Discord.
## Building
The simplest way to build is to perform the following from the source directory.
```bash
mkdir build
cd build
cmake -GNinja ..
ninja orca
ninja
```
If you are on a platform where the Discord support is not functional, you can skip the `ninja orca` command.
## Installation
In the mod directory you want to install the proxy in, rename the original game module from `game<arch>.so`
to `game<arch>.real.so` and then copy the q2admin `game<arch>.so` module into the same directory.
Place the various configuration files either into the base game folder (or `basepath` folder) or into the
chosen mod directory.
## Configuration
The `q2discord.json` file contains the bot token and additional configuration for the bot itself - such as
the command prefix.
Additionally, the following in-game console variables control some functionality:
- `discord_json`: Name of json file to read. Defaults to "*q2discord.json*".
- `discord_channel`: A single Discord channel ID to act in and listen to.
- `discord_thread`: If set, create a thread in the channel with this name.
- `discord_rcuser`: A single Discord user ID to allow the !rcon command.
- `discord_rcgroup`: A single Discord role ID to allow the !rcon command.
The standard Q2Admin configuration parameters are documented within the various configuration files.

View File

@ -25,7 +25,7 @@ zbotdetect "No"
; like the linux / solaris versions. For win32 the old mod dll must be called
; 'gamex86.real.dll' for this to work.
;
;quake2dirsupport "Yes"
;quake2dirsupport "No"
;
; MOTD file to display at client connect (and also happens on level changed as well)

View File

@ -1,47 +1,3 @@
Version: q2admin1.17.48-nxmod-1
This is q2admin1.17.48-tsmod-2 but with some tweaks to the file opening
routines to better work with Yamagi Quake II as well as optional and
experimental Discord support.
To test the Discord functionality, you will need the Orca library.
Configure the "q2discord.json" file with the Discord bot token.
The cvars available are:
- discord_json: Name of json file to read. Default is "q2discord.json".
- discord_channel: A single Discord channel ID# to act in and listen to.
- discord_thread: If set, create a thread in the channel with this name.
- discord_rcuser: A single Discord user ID# to allow the !rcon command.
- discord_rcgroup: A single Discord role ID# to allow the !rcon command.
The Discord integration passes many messages from Quake II to Discord
automatically such as death messages, client connections, and chat. There
is currently no way to configure that more precisely.
Chat in the Discord channel is NOT automatically mirrored to Quake II.
To broadcast a message into the game, you need to use the !say command.
Any user with access to the channel will be able to !say things to the
game.
The user and/or group specified in the cvars can use the !rcon command to
directly run commands as if via the server console. Unfortunately, there
isn't a great mechanism to provide command feedback/results back to Discord
so unless it produces a result that would normally be mirrored to Discord,
you won't get much in the way of feedback.
The main reason this is the case is that many of the results that would be
shown in the console are generated by the server itself rather than the game
dll and so would not be routed through q2admin in the first place.
**THIS IS NOT PRODUCTION-READY**
Original Q2Admin readme.txt follows:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*******************************************************
* *
* Q2Admin v1.17 for Quake2 *

1
external/orca vendored

@ -1 +0,0 @@
Subproject commit ef7cc8d1eca1468c75fde7ba9f183b41c26ef1bc

View File

@ -1,2 +0,0 @@
EXPORTS
GetGameAPI

View File

@ -42,11 +42,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <ctype.h>
/* Use our local regex.c and .h on Windows but
Posix library regex on *nix systems.
This makes it 64-bit clean on GNU Linux */
/* Added __GNUC__ condition for MinGW64 to use its own regex lib. //QW// */
#if defined _WIN32 && !defined __GNUC__
#ifdef _MSC_VER
#include "regex.h"
#else
#include <regex.h>
@ -1309,8 +1305,8 @@ typedef struct
int level;
} admin_type;
#define Q2ADMINVERSION "1.17.48-nxmod-1"
#define DEFAULTQ2AVER "1.0"
#include "g_version.h"
#define DEFAULTQ2AMSG "\nThis server requires %s anti cheat client.\n"
#define MAX_ADMINS 128
#define ADMIN_AUTH_LEVEL 1

View File

@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
#include "g_local.h"
#include "g_export.h"
#if defined(WIN32)
#include <windows.h>
@ -37,11 +38,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#if defined(WIN32)
HINSTANCE hdll;
#define DLLNAME "game.real.dll"
#define DLLNAMEMODDIR "game.real.dll"
#elif defined(__GNUC__)
void *hdll = NULL;
#define DLLNAME "game.real.so"
#endif
typedef game_export_t *GAMEAPI (game_import_t *import);
@ -134,7 +132,7 @@ Returns a pointer to the structure with all entry points
and global variables
=================
*/
Q2_DLL_EXPORTED game_export_t *GetGameAPI(game_import_t *import)
Q2ADMIN_EXPORT game_export_t *GetGameAPI(game_import_t *import)
{
GAMEAPI *getapi;
#ifdef __GNUC__
@ -236,27 +234,28 @@ Q2_DLL_EXPORTED game_export_t *GetGameAPI(game_import_t *import)
zbot_testchar1 = '0' + (int)(9.9 * random());
zbot_testchar2 = '0' + (int)(9.9 * random());
#if defined(WIN32)
if (quake2dirsupport)
{
sprintf(dllname, "%s/%s", moddir, DLLNAME);
}
else
{
sprintf(dllname, "%s/%s", moddir, DLLNAMEMODDIR);
}
if (quake2dirsupport) sprintf(dllname, "%s/%s%s", moddir, GAMENAME, GAMEEXT);
else sprintf(dllname, "%s/%s.real%s", moddir, GAMENAME, GAMEEXT);
#if defined(WIN32)
hdll = LoadLibrary(dllname);
#elif defined(__GNUC__)
loadtype = soloadlazy ? RTLD_LAZY : RTLD_NOW;
sprintf(dllname, "%s/%s", moddir, DLLNAME);
hdll = dlopen(dllname, loadtype);
#endif
if (hdll == NULL)
{
#if defined(WIN32)
unsigned long stat = GetLastError();
gi.dprintf("Unable to load %s, error %u. Trying default game.\n", dllname, stat);
#else
gi.dprintf("Unable to load %s. Trying default game.\n", dllname);
#endif
// try the baseq2 directory...
sprintf(dllname, "baseq2/%s", DLLNAME);
if (quake2dirsupport) sprintf(dllname, "baseq2/%s%s", GAMENAME, GAMEEXT);
else sprintf(dllname, "baseq2/%s.real%s", GAMENAME, GAMEEXT);
#if defined(WIN32)
hdll = LoadLibrary(dllname);
@ -264,34 +263,17 @@ Q2_DLL_EXPORTED game_export_t *GetGameAPI(game_import_t *import)
hdll = dlopen(dllname, loadtype);
#endif
#if defined(WIN32)
if (quake2dirsupport)
{
sprintf(dllname, "%s/%s", moddir, DLLNAME);
}
else
{
sprintf(dllname, "%s/%s", moddir, DLLNAMEMODDIR);
}
#elif defined(__GNUC__)
sprintf(dllname, "%s/%s", moddir, DLLNAME);
#endif
if (hdll == NULL)
{
#if defined(WIN32)
unsigned long stat = GetLastError();
gi.dprintf("Unable to load DLL %s, error %u.\n", dllname, stat);
stat = GetLastError();
gi.dprintf("Unable to load %s, error %u.\n", dllname, stat);
return &globals;
#else
gi.dprintf("Unable to load DLL %s.\n", dllname);
gi.dprintf("Unable to load %s.\n", dllname);
return &globals;
#endif
}
else
{
gi.dprintf ("Unable to load DLL %s, loading baseq2 DLL.\n", dllname);
}
}
#if defined(WIN32)

View File

View File

@ -96,10 +96,8 @@ typedef enum{false, true} qboolean;
#ifdef _WIN32
#define MAX_OSPATH 256
#define Q2_DLL_EXPORTED __declspec(dllexport)
#else // not Win32 (Linux, BSD, Mac, ..)
#define MAX_OSPATH 4096
#define Q2_DLL_EXPORTED __attribute__((__visibility__("default")))
#endif
//

View File

@ -1,22 +1,38 @@
/*-------------------------------
# SPDX-License-Identifier: ISC
#
# Copyright © 2022 Daniel Wolf <<nephatrine@gmail.com>>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# -----------------------------*/
#include "zb_discord.h"
#ifdef USE_DISCORD
# include "orca/discord.h"
# include <pthread.h>
# include <stdlib.h>
# include <string.h>
# include <time.h>
# include <unistd.h>
#include <orca/discord.h>
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
//
// Thread Queue
//
# define Q2D_STATE_UNINITIALIZED 1
# define Q2D_STATE_CLOSED 2
# define Q2D_STATE_CLOSING 4
# define Q2D_STATE_READY 8
#define Q2D_STATE_UNINITIALIZED 1
#define Q2D_STATE_CLOSED 2
#define Q2D_STATE_CLOSING 4
#define Q2D_STATE_READY 8
typedef struct queue_cmd_s
{
@ -219,12 +235,12 @@ static void q2d_message_to_game( char * msg )
static void q2d_on_bot_ready( struct discord * client )
{
// set discord status
char * activity_json = "{"
"\"name\": \"Quake II\","
"\"type\": 0,"
"\"url\": \"https://fraglimit.nephatrine.net/\","
"\"details\": \"blah blah blah\""
"}\0";
char * activity_json = "{"
"\"name\": \"Quake II\","
"\"type\": 0,"
"\"url\": \"https://fraglimit.nephatrine.net/\","
"\"details\": \"blah blah blah\""
"}\0";
struct discord_activity activity_info;
discord_activity_from_json( activity_json, strlen( activity_json ), &activity_info );
@ -364,13 +380,13 @@ static void * q2d_main( void * arg )
// These *can* reference game code.
// =================================
# ifdef true
# undef true
# endif
# ifdef false
# undef false
# endif
# include "g_local.h"
#ifdef true
# undef true
#endif
#ifdef false
# undef false
#endif
#include "g_local.h"
void q2d_initialize()
{
@ -443,10 +459,7 @@ void q2d_message_to_discord2( int level, const char * s )
snprintf( q2d_buffer, ( cptr - s ) + 4, "**%s", s );
snprintf( q2d_buffer + ( cptr - s ) + 3, sizeof( q2d_buffer ) - ( cptr - s ) - 3, "**%s", cptr + 1 );
}
else
{
snprintf( q2d_buffer, sizeof( q2d_buffer ), "*%s*", s );
}
else { snprintf( q2d_buffer, sizeof( q2d_buffer ), "*%s*", s ); }
break;
default: return;
}
@ -499,5 +512,3 @@ void q2d_shutdown()
queue_destroy( q2d_incoming_queue );
queue_destroy( q2d_outgoing_queue );
}
#endif

34
src/zb_discord.h Normal file
View File

@ -0,0 +1,34 @@
/*-------------------------------
# SPDX-License-Identifier: ISC
#
# Copyright © 2022 Daniel Wolf <<nephatrine@gmail.com>>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# -----------------------------*/
#ifndef ZB_DISCORD_H
#define ZB_DISCORD_H 1
#ifdef USE_DISCORD
void q2d_initialize();
void q2d_shutdown();
void q2d_message_to_discord2( int level, const char * s );
void q2d_process_game_queue();
#else
# define q2d_initialize()
# define q2d_shutdown()
# define q2d_message_to_discord2( level, s )
# define q2d_process_game_queue()
#endif
#endif

View File

@ -66,7 +66,7 @@ game_export_t *dllglobals;
cvar_t *rcon_password, *gamedir, *maxclients, *logfile, *rconpassword, *port, *q2admintxt, *q2adminbantxt; // UPDATE
qboolean quake2dirsupport = TRUE;
qboolean quake2dirsupport = FALSE;
char dllname[512];
char gmapname[MAX_QPATH];
@ -164,7 +164,7 @@ int randomwaitreporttime = 55;
int maxMsgLevel = 3;
char *zbotversion = "==== Q2Admin Version " Q2ADMINVERSION " ====\n";
char *zbotversion = "==== Q2Admin Version " Q2ADMIN_VERSION_FULL " ====\n";
qboolean serverinfoenable = TRUE;
char zbotmotd[256];

View File

@ -500,7 +500,7 @@ void G_RunFrame(void)
if(serverinfoenable && (lframenum > 10))
{
// sprintf(buffer, "logfile 2;set Bot \"No Bots\" s\n");
sprintf(buffer, "set Q2Admin \"" Q2ADMINVERSION "\" s\n");
sprintf(buffer, "set Q2Admin \"" Q2ADMIN_VERSION_STRING "\" s\n");
gi.AddCommandString(buffer);
serverinfoenable = 0;
}

69
src/zbot.rc.in Normal file
View File

@ -0,0 +1,69 @@
/*-------------------------------
# SPDX-License-Identifier: ISC
#
# Copyright © 2022 Daniel Wolf <<nephatrine@gmail.com>>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# -----------------------------*/
#include "g_version.h"
// for constants
#include <winver.h>
#include <ntdef.h>
#ifdef RC_INVOKED
#ifdef NDEBUG
# define FLAG_DEBUG 0
#else
# define FLAG_DEBUG VS_FF_DEBUG
#endif
#if defined( Q2ADMIN_GIT_DIRTY ) && Q2ADMIN_GIT_DIRTY
# define FLAG_PATCHED VS_FF_PATCHED
#else
# define FLAG_PATCHED 0
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION Q2ADMIN_VERSION_MAJOR,Q2ADMIN_VERSION_MINOR,Q2ADMIN_VERSION_PATCH,0
PRODUCTVERSION Q2ADMIN_VERSION_MAJOR,Q2ADMIN_VERSION_MINOR,Q2ADMIN_VERSION_PATCH,0
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS (FLAG_DEBUG | FLAG_PATCHED)
FILEOS VOS_NT
FILETYPE VFT_DLL
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "Comments", "Game Proxy Module"
VALUE "CompanyName", "@_Q2ADMIN_PROJECT_VENDOR@"
VALUE "FileDescription", "@PROJECT_DESCRIPTION@"
VALUE "FileVersion", Q2ADMIN_VERSION_FULL
VALUE "InternalName", "@PROJECT_NAME@"
VALUE "LegalCopyright", "(C) @_CURRENT_YEAR@ @_Q2ADMIN_PROJECT_MAINTAINER@"
VALUE "OriginalFilename", "@Q2ADMIN_NAME@.dll"
VALUE "ProductName", "@NX_PROJECT_PARENT@"
VALUE "ProductVersion", Q2ADMIN_VERSION_FULL
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409,1252
END
END
#endif

32
tools/NXBuild.cmake Normal file
View File

@ -0,0 +1,32 @@
# -------------------------------
# SPDX-License-Identifier: ISC
#
# Copyright © 2022 Daniel Wolf <<nephatrine@gmail.com>>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# -------------------------------
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
if(NOT COMMAND nx_project_begin)
include(FetchContent)
FetchContent_Declare(
nxbuild
GIT_REPOSITORY "https://code.nephatrine.net/nephatrine/nxbuild-cmake.git"
GIT_TAG "master"
GIT_SHALLOW ON)
if(NOT nxbuild_POPULATED)
FetchContent_Populate(nxbuild)
endif()
list(APPEND CMAKE_MODULE_PATH "${nxbuild_SOURCE_DIR}/tools")
endif()

View File

@ -1,11 +0,0 @@
#ifndef ZB_DISCORD_H
#define ZB_DISCORD_H 1
#ifdef USE_DISCORD
void q2d_initialize();
void q2d_shutdown();
void q2d_message_to_discord2( int level, const char * s );
void q2d_process_game_queue();
#endif
#endif

BIN
zbot.rc

Binary file not shown.