Switch build to msvc for windows.

Switch build to clang for linux.

Mingw binaries isn't working with vanilla hlds / listenserver. And i'm too lazy to debug them.

For consistency reason, linux switched clang, so we're only have clang for linux & osx and msvc for windows.
This commit is contained in:
ds 2020-11-13 19:16:56 +03:00
commit 655693582a
6 changed files with 99 additions and 94 deletions

View file

@ -8,12 +8,6 @@ jobs:
runs-on: self-hosted
steps:
- name: Runner Cleanup
shell: bash
run: |
echo "Cleaning up previous run"
rm -rf "${{ github.workspace }}/*"
- uses: actions/checkout@v2
with:
submodules: true
@ -22,9 +16,9 @@ jobs:
- name: Setup Meson
shell: bash
run: |
meson setup build_x86_win32 --cross-file=/actions/meson/linux-mingw-w64-32bit.txt
meson setup build_x86_win32 --cross-file=/actions/meson/windows-msvc-32bit.txt -Db_vscrt=mt
meson setup build_x86_macos --cross-file=/actions/meson/darwin-clang-32bit.txt
meson setup build_x86_linux
CXX=clang meson setup build_x86_linux
- name: Build Bot
shell: bash

View file

@ -213,6 +213,9 @@ public:
// this function is checking that pointed by ent pointer obstacle, can be destroyed
bool isShootableBreakable (edict_t *ent);
// print the version to server console on startup
void printBotVersion ();
// public inlines
public:
// get the current time on server

View file

@ -197,7 +197,15 @@ if isWindows and (isVC or isIntel)
]
if isOptimize
ccflags += '/GL'
ccflags += [
'/GL',
'/arch:SSE2',
'/GS-',
'/Ob2',
'/Oy',
'/Oi'
]
ldflags += '/LTCG'
endif

View file

@ -825,48 +825,6 @@ bool Game::postload () {
// initialize weapons
conf.initWeapons ();
// print game detection info
auto displayCSVersion = [&] () {
String gameVersionStr;
StringArray gameVersionFlags;
if (is (GameFlags::Legacy)) {
gameVersionStr.assign ("Legacy");
}
else if (is (GameFlags::ConditionZero)) {
gameVersionStr.assign ("Condition Zero");
}
else if (is (GameFlags::Modern)) {
gameVersionStr.assign ("v1.6");
}
if (is (GameFlags::Xash3D)) {
gameVersionStr.append (" @ Xash3D Engine");
if (is (GameFlags::Mobility)) {
gameVersionStr.append (" Mobile");
}
gameVersionStr.replace ("Legacy", "1.6 Limited");
}
if (is (GameFlags::HasBotVoice)) {
gameVersionFlags.push ("BotVoice");
}
if (is (GameFlags::ReGameDLL)) {
gameVersionFlags.push ("ReGameDLL");
}
if (is (GameFlags::HasFakePings)) {
gameVersionFlags.push ("FakePing");
}
if (is (GameFlags::Metamod)) {
gameVersionFlags.push ("Metamod");
}
ctrl.msg ("\n%s v%s successfully loaded for game: Counter-Strike %s.\n\tFlags: %s.\n", product.name, product.version, gameVersionStr, gameVersionFlags.empty () ? "None" : String::join (gameVersionFlags, ", "));
};
if (plat.android) {
m_gameFlags |= (GameFlags::Xash3D | GameFlags::Mobility | GameFlags::HasBotVoice | GameFlags::ReGameDLL);
@ -878,7 +836,6 @@ bool Game::postload () {
if (!m_gameLib.load (gamedll)) {
logger.fatal ("Unable to load gamedll \"%s\". Exiting... (gamedir: %s)", gamedll, getRunningModName ());
}
displayCSVersion ();
}
else {
bool binaryLoaded = loadCSBinary ();
@ -886,7 +843,6 @@ bool Game::postload () {
if (!binaryLoaded && !is (GameFlags::Metamod)) {
logger.fatal ("Mod that you has started, not supported by this bot (gamedir: %s)", getRunningModName ());
}
displayCSVersion ();
if (is (GameFlags::Metamod)) {
m_gameLib.unload ();
@ -1026,6 +982,47 @@ bool Game::isShootableBreakable (edict_t *ent) {
return false;
}
void Game::printBotVersion () {
String gameVersionStr;
StringArray gameVersionFlags;
if (is (GameFlags::Legacy)) {
gameVersionStr.assign ("Legacy");
}
else if (is (GameFlags::ConditionZero)) {
gameVersionStr.assign ("Condition Zero");
}
else if (is (GameFlags::Modern)) {
gameVersionStr.assign ("v1.6");
}
if (is (GameFlags::Xash3D)) {
gameVersionStr.append (" @ Xash3D Engine");
if (is (GameFlags::Mobility)) {
gameVersionStr.append (" Mobile");
}
gameVersionStr.replace ("Legacy", "1.6 Limited");
}
if (is (GameFlags::HasBotVoice)) {
gameVersionFlags.push ("BotVoice");
}
if (is (GameFlags::ReGameDLL)) {
gameVersionFlags.push ("ReGameDLL");
}
if (is (GameFlags::HasFakePings)) {
gameVersionFlags.push ("FakePing");
}
if (is (GameFlags::Metamod)) {
gameVersionFlags.push ("Metamod");
}
ctrl.msg ("\n%s v%s successfully loaded for game: Counter-Strike %s.\n\tFlags: %s.\n", product.name, product.version, gameVersionStr, gameVersionFlags.empty () ? "None" : String::join (gameVersionFlags, ", "));
}
void LightMeasure::initializeLightstyles () {
// this function initializes lighting information...
@ -1204,43 +1201,3 @@ float LightMeasure::getLightLevel (const Vector &point) {
float LightMeasure::getSkyColor () {
return static_cast <float> (Color (sv_skycolor_r.int_ (), sv_skycolor_g.int_ (), sv_skycolor_b.int_ ()).avg ());
}
DETOUR_RETURN EntityLinkage::lookup (SharedLibrary::Handle module, const char *function) {
static const auto &gamedll = game.lib ().handle ();
static const auto &self = m_self.handle ();
const auto resolve = [&] (SharedLibrary::Handle handle) {
return reinterpret_cast <DETOUR_RETURN> (m_dlsym (static_cast <DETOUR_HANDLE> (handle), function));
};
// if requested module is yapb module, put in cache the looked up symbol
if (self != module || (plat.win32 && (static_cast <uint16> (reinterpret_cast <uint32> (function) >> 16) & 0xffff) == 0)) {
return resolve (module);
}
if (m_exports.has (function)) {
return m_exports[function];
}
auto botAddr = resolve (self);
if (!botAddr) {
auto gameAddr = resolve (gamedll);
if (gameAddr) {
return m_exports[function] = gameAddr;
}
}
else {
return m_exports[function] = botAddr;
}
return nullptr;
}
void EntityLinkage::initialize () {
if (plat.arm) {
return;
}
m_dlsym.install (reinterpret_cast <void *> (EntityLinkage::replacement), true);
m_self.locate (&engfuncs);
}

View file

@ -120,6 +120,9 @@ CR_EXPORT int GetEntityAPI (gamefuncs_t *table, int) {
conf.loadMainConfig (true);
conf.adjustWeaponPrices ();
// print info about dll
game.printBotVersion ();
if (game.is (GameFlags::Metamod)) {
RETURN_META (MRES_IGNORED);
}
@ -793,7 +796,6 @@ CR_EXPORT int GetNewDLLFunctions (newgamefuncs_t *table, int *interfaceVersion)
logger.error ("Could not resolve symbol \"%s\" in the game dll. Continuing...", __FUNCTION__);
return HLFalse;
}
dllfuncs.newapi_table = table;
return HLTrue;
}
@ -945,5 +947,45 @@ DLL_GIVEFNPTRSTODLL GiveFnptrsToDll (enginefuncs_t *functionTable, globalvars_t
api_GiveFnptrsToDll (functionTable, glob);
}
DETOUR_RETURN EntityLinkage::lookup (SharedLibrary::Handle module, const char *function) {
static const auto &gamedll = game.lib ().handle ();
static const auto &self = m_self.handle ();
const auto resolve = [&] (SharedLibrary::Handle handle) {
return reinterpret_cast <DETOUR_RETURN> (m_dlsym (static_cast <DETOUR_HANDLE> (handle), function));
};
// if requested module is yapb module, put in cache the looked up symbol
if (self != module || (plat.win32 && (static_cast <uint16> (reinterpret_cast <uint32> (function) >> 16) & 0xffff) == 0)) {
return resolve (module);
}
if (m_exports.has (function)) {
return m_exports[function];
}
auto botAddr = resolve (self);
if (!botAddr) {
auto gameAddr = resolve (gamedll);
if (gameAddr) {
return m_exports[function] = gameAddr;
}
}
else {
return m_exports[function] = botAddr;
}
return nullptr;
}
void EntityLinkage::initialize () {
if (plat.arm) {
return;
}
m_dlsym.install (reinterpret_cast <void *> (EntityLinkage::replacement), true);
m_self.locate (&engfuncs);
}
// add linkents for android
#include "android.cpp"

View file

@ -4,6 +4,7 @@ YAPB_ABI_1.0 {
GiveFnptrsToDll;
GetBotAPI;
GetEntityAPI;
GetNewDLLFunctions;
local:
*;
};