HPB_bot2_i486.so, HPBot2 ver 0.5 release 106 |
HPB_bot2_i486.so, HPBot2 ver 0.5 release 106 |
bir3yk |
Jul 21 2009, 12:03 PM
Post
#1
|
RCBot Fan Group: Members Posts: 107 Joined: 4-June 09 Member No.: 1,566 |
I compiled a linux RCBot2 0.5
1. Folder Structure : .../hl2 .../orangebox <-- srcds_run is here (for TF2 and Orange-Box games) .../orangebox/bin <-- HPB_bot2_i486.so files copied here .../rcbot2/ .../rcbot2/config/ .../rcbot2/profiles/ .../rcbot2/waypoints/ .../rcbot2/waypoints/orangebox/tf/ <-- waypoint and scripts files copied here .../steam 2. Edit .../rcbot2/config/bot_mods.ini mod = TF2 steamdir = orangebox gamedir = tf bot = TF2 3. Add ./srcds_run ..............+plugin_load ../bin/HPB_bot2 146 SVN revisions 119 SVN revisions RCbot2 0.52 121 SVN revisions 121 SVN revisions RCbot2 0.53 122 SVN revisions 122 SVN revisions 124 SVN revisions 124 SVN revisions 126 SVN revisions 126 SVN revisions 146 SVN revisions 146 SVN revisions |
Cheeseh |
Mar 22 2013, 12:18 AM
Post
#2
|
Admin Group: Admin Posts: 3,066 Joined: 11-September 03 From: uk Member No.: 1 |
have a look at sourcemod to see if its the same
CODE void Protect(void *addr, size_t length, int prot) { # if defined PLATFORM_WINDOWS DWORD ignore; VirtualProtect(addr, length, prot, &ignore); # else uintptr_t startPage = AddrToPage(uintptr_t(addr)); length += (uintptr_t(addr) - startPage); mprotect((void*)startPage, length, prot); # endif } static inline uintptr_t AddrToPage(uintptr_t address) { return (address & ~(uintptr_t(sysconf(_SC_PAGE_SIZE) - 1))); } |
Ted |
Mar 22 2013, 11:20 PM
Post
#3
|
Member Group: Members Posts: 13 Joined: 20-February 13 Member No.: 2,257 |
have a look at sourcemod to see if its the same CODE void Protect(void *addr, size_t length, int prot) { # if defined PLATFORM_WINDOWS DWORD ignore; VirtualProtect(addr, length, prot, &ignore); # else uintptr_t startPage = AddrToPage(uintptr_t(addr)); length += (uintptr_t(addr) - startPage); mprotect((void*)startPage, length, prot); # endif } static inline uintptr_t AddrToPage(uintptr_t address) { return (address & ~(uintptr_t(sysconf(_SC_PAGE_SIZE) - 1))); } I believe that does the same as what I posted. An address is page aligned if it is a multiple of the page size. Mprotect will throw an EINVAL if a none-page aligned address is given as the input. To page align the address you want to supply mprotect, you decrease the address by the address modulus page size: addr - (addr % page_size). The snippet from SourceMod uses a bit operator trick to get the same result. For example: CODE address = 6 = 0110 page_size = 4 = 0100 page_size - 1 = 3 = 0011 ~(page_size - 1) = 1100 address & ~(page_size -1) = 4 = 0100 6 - 6 % 4 = 4 = 0100 I believe the reason that they chose this (if I remember correctly from my assembler class) method is that it's an optimized way of getting this calculation because modulus requires more CPU cycles to perform. But the result of this optimization will probably be not noticeable for your case as the calculation is done at most 31 times per game. |
Cheeseh |
Mar 29 2013, 12:03 PM
Post
#4
|
Admin Group: Admin Posts: 3,066 Joined: 11-September 03 From: uk Member No.: 1 |
Hey Ted. Yeah I thought so too. I've been trying to compile myself on linux so I can test it myself. I've edited the rcbot files so that it compiles under linux however running into frustrations compiling the latest sdk from http://hg.alliedmods.net/hl2sdks/hl2sdk-ob-valve/
had to put CODE #if defined(_LINUX) || defined(__APPLE__) #define NO_MALLOC_OVERRIDE #endif in memoverride.cpp as it came up with g_pMemAlloc not defined errors now coming up with errors in memstack.cpp CODE ./utils/RCBot2/../../tier1/memstack.cpp <command-line>:0:8: warning: extra tokens at end of #undef directive [enabled by default] <command-line>:0:8: warning: extra tokens at end of #undef directive [enabled by default] <command-line>:0:6: warning: extra tokens at end of #undef directive [enabled by default] ../utils/RCBot2/../../tier1/memstack.cpp:29:48: error: expected constructor, destructor, or type conversion before ‘;’ token ../utils/RCBot2/../../tier1/memstack.cpp: In member function ‘bool CMemoryStack::Init(unsigned int, unsigned int, unsigned int, unsigned int)’: ../utils/RCBot2/../../tier1/memstack.cpp:120:80: error: ‘MemAlloc_AllocAligned’ was not declared in this scope ../utils/RCBot2/../../tier1/memstack.cpp: In member function ‘void CMemoryStack::Term()’: ../utils/RCBot2/../../tier1/memstack.cpp:170:33: error: ‘MemAlloc_FreeAligned’ was not declared in this scope make[1]: *** [obj/HPB_bot2_i486/us/RCBot2/tier1/memstack.o] Error 1 I don't really want to be editing non-rcbot files as I'm not sure about all this tier stuff |
Ted |
Mar 30 2013, 12:04 AM
Post
#5
|
Member Group: Members Posts: 13 Joined: 20-February 13 Member No.: 2,257 |
Actually, I found that you don't really need to include the memoverride and memstack objects for compilation. The current LINUX RCBot2 code base does not use any of the functions from those objects.
Also I found it easier to just specify the project as a plugin object rather than go through the mod project route as specified by the Makefile posted in the forum. This allows you skip building vcpm project, which is severely outdated. The only draw back is that you will have to manually update the Makeifle.plugin file. Hey Ted. Yeah I thought so too. I've been trying to compile myself on linux so I can test it myself. I've edited the rcbot files so that it compiles under linux however running into frustrations compiling the latest sdk from http://hg.alliedmods.net/hl2sdks/hl2sdk-ob-valve/ had to put CODE #if defined(_LINUX) || defined(__APPLE__) #define NO_MALLOC_OVERRIDE #endif in memoverride.cpp as it came up with g_pMemAlloc not defined errors now coming up with errors in memstack.cpp CODE ./utils/RCBot2/../../tier1/memstack.cpp <command-line>:0:8: warning: extra tokens at end of #undef directive [enabled by default] <command-line>:0:8: warning: extra tokens at end of #undef directive [enabled by default] <command-line>:0:6: warning: extra tokens at end of #undef directive [enabled by default] ../utils/RCBot2/../../tier1/memstack.cpp:29:48: error: expected constructor, destructor, or type conversion before ‘;’ token ../utils/RCBot2/../../tier1/memstack.cpp: In member function ‘bool CMemoryStack::Init(unsigned int, unsigned int, unsigned int, unsigned int)’: ../utils/RCBot2/../../tier1/memstack.cpp:120:80: error: ‘MemAlloc_AllocAligned’ was not declared in this scope ../utils/RCBot2/../../tier1/memstack.cpp: In member function ‘void CMemoryStack::Term()’: ../utils/RCBot2/../../tier1/memstack.cpp:170:33: error: ‘MemAlloc_FreeAligned’ was not declared in this scope make[1]: *** [obj/HPB_bot2_i486/us/RCBot2/tier1/memstack.o] Error 1 I don't really want to be editing non-rcbot files as I'm not sure about all this tier stuff |
Cheeseh |
Apr 4 2013, 11:53 AM
Post
#6
|
Admin Group: Admin Posts: 3,066 Joined: 11-September 03 From: uk Member No.: 1 |
Actually, I found that you don't really need to include the memoverride and memstack objects for compilation. The current LINUX RCBot2 code base does not use any of the functions from those objects. Also I found it easier to just specify the project as a plugin object rather than go through the mod project route as specified by the Makefile posted in the forum. This allows you skip building vcpm project, which is severely outdated. The only draw back is that you will have to manually update the Makeifle.plugin file. well i've updated the source files on the svn to fix the linux compile issues, and removed dependencies on the tier1 source, (just use the lib). I've run into compile problems yet again where it says "libtier0_srv.so could not read symbols: File in wrong format " garrh, I'm compiling in 64-bit ubuntu but using lib32 libs with -m32 flag, dunno what else I need to check. |
Ted |
Apr 10 2013, 09:25 AM
Post
#7
|
Member Group: Members Posts: 13 Joined: 20-February 13 Member No.: 2,257 |
well i've updated the source files on the svn to fix the linux compile issues, and removed dependencies on the tier1 source, (just use the lib). I've run into compile problems yet again where it says "libtier0_srv.so could not read symbols: File in wrong format " garrh, I'm compiling in 64-bit ubuntu but using lib32 libs with -m32 flag, dunno what else I need to check. Here is my Makefile: CODE # # SDK Makefile for x86 Linux # # ############################################################################# # Developer configurable items ############################################################################# # the name of the mod binary (_i486.so is appended to the end) NAME = HPB_bot2 # the location of the vcproj that builds the mod MOD_PROJ = ../utils/RCBot2/HPB_Bot2.vcproj # the name of the mod configuration (typically <proj name>_<build type><build target>) MOD_CONFIG = HPB_bot2_ReleaseWin32 # the directory the base binaries (tier0_i486.so, etc) are located # this should point to your orange box subfolder of where you have srcds installed. SRCDS_DIR = ~/srcds/orangebox # the path to your mods directory # set this so that 'make install' or 'make installrelease' will copy your binary over automatically. GAME_DIR = $(SRCDS_DIR)/ GCC_VER = 4.7 # compiler options (gcc 3.4.1 or above is required - 4.1.2+ recommended) CC = /usr/bin/gcc-$(GCC_VER) CPLUS = /usr/bin/gcc-$(GCC_VER) CLINK = /usr/bin/gcc-$(GCC_VER) CPP_LIB_DIR = /usr/lib/gcc/x86_64-linux-gnu/4.7/32 CPP_LIB = #"$(CPP_LIB_DIR)/libstdc++.a $(CPP_LIB_DIR)/libgcc_eh.a" VSTD_LIB=libvstdlib_srv.so STEAM_LIB=libsteam.so TIER0_LIB=libtier0_srv.so # put any compiler flags you want passed here USER_CFLAGS = # link flags for your mod, make sure to include any special libraries here LDFLAGS = "-lm -ldl $(LIB_DIR)/particles_i486.a $(LIB_DIR)/dmxloader_i486.a $(LIB_DIR)/mathlib_i486.a $(TIER0_LIB) $(VSTD_LIB) $(LIB_DIR)/tier1_i486.a $(LIB_DIR)/tier2_i486.a $(LIB_DIR)/tier3_i486.a $(LIB_DIR)/choreoobjects_i486.a $(STEAM_LIB)" # XERCES 2.6.0 or above ( http://xml.apache.org/xerces-c/ ) is used by the vcproj to makefile converter # it must be installed before being able to run this makefile # if you have xerces installed already you should be able to use the two lines below XERCES_INC_DIR = /usr/include XERCES_LIB_DIR = /usr/lib # Change this to true if you want to build debug binaries for everything # The only exception is the mod/game as MOD_CONFIG determines if it's a debug build or not DEBUG = false ############################################################################# # Things below here shouldn't need to be altered ############################################################################# MAKE = make AR = "ar rvs" # the dir we want to put binaries we build into BUILD_DIR = . # the place to put object files BUILD_OBJ_DIR = $(BUILD_DIR)/obj # the location of the source code SRC_DIR = .. # the location of the Linux static libraries LIB_DIR = $(SRC_DIR)/lib/linux # the CPU target for the build, must be i486 for now ARCH = i486 ARCH_CFLAGS = -mtune=i686 -march=pentium3 -mmmx -m32 DEFINES = -D_LINUX -DLINUX -DVPROF_LEVEL=1 -DSWDS -D_finite=finite -Dstricmp=strcasecmp -D_stricmp=strcasecmp \ -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -DGNUC UNDEF = -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE BASE_CFLAGS = -fno-strict-aliasing -Wall -Wconversion -Wno-non-virtual-dtor -Wno-invalid-offsetof SHLIBEXT = so SHLIBCFLAGS = -fPIC SHLIBLDFLAGS = -shared -Wl,-Map,$@_map.txt -Wl # Flags passed to the c compiler CFLAGS = $(DEFINES) $(ARCH_CFLAGS) -g $(BASE_CFLAGS) ifdef USER_CFLAGS CFLAGS += $(USER_CFLAGS) endif CFLAGS += $(UNDEF) # Debug flags DBG_DEFINES = "-D_DEBUG -DDEBUG" DBG_CFLAGS = "$(DEFINES) $(ARCH_CFLAGS) -g -ggdb $(BASE_CFLAGS) $(UNDEF)" # define list passed to make for the sub makefile BASE_DEFINES = CC=$(CC) AR=$(AR) CPLUS=$(CPLUS) CPP_LIB=$(CPP_LIB) DEBUG=$(DEBUG) \ BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) SRC_DIR=$(SRC_DIR) \ LIB_DIR=$(LIB_DIR) SHLIBLDFLAGS=$(SHLIBLDFLAGS) SHLIBEXT=$(SHLIBEXT) \ CLINK=$(CLINK) CFLAGS="$(CFLAGS)" DBG_CFLAGS=$(DBG_CFLAGS) LDFLAGS=$(LDFLAGS) \ DEFINES="$(DEFINES)" DBG_DEFINES=$(DBG_DEFINES) \ ARCH=$(ARCH) SRCDS_DIR=$(SRCDS_DIR) MOD_CONFIG=$(MOD_CONFIG) NAME=$(NAME) \ XERCES_INC_DIR=$(XERCES_INC_DIR) XERCES_LIB_DIR=$(XERCES_LIB_DIR) \ TIER0_LIB=$(TIER0_LIB) VSTD_LIB=$(VSTD_LIB) # Project Makefile MAKE_SERVER = Makefile.server MAKE_VCPM = Makefile.vcpm MAKE_PLUGIN = Makefile.plugin MAKE_TIER1 = Makefile.tier1 MAKE_MATH = Makefile.mathlib MAKE_CHOREO = Makefile.choreo all: check vcpm mod check: $(TIER0_LIB) $(STEAM_LIB) $(VSTD_LIB) tier1 mathlib choreo if [ -x "$(CC)" ]; then echo "Compiler not defined."; exit; fi if [ ! -d $(BUILD_DIR) ];then mkdir -p $(BUILD_DIR);fi # cd $(BUILD_DIR) # if [ ! -e "$(LIB_DIR)/tier1_i486.a" ]; then $(MAKE) tier1;fi # if [ ! -e "$(LIB_DIR)/mathlib_i486.a" ]; then $(MAKE) mathlib;fi # if [ ! -e "$(LIB_DIR)/choreoobjects_i486.a" ]; then $(MAKE) choreo;fi %.so: $(SRCDS_DIR)/bin/%.so ln -s $(SRCDS_DIR)/bin/$@ vcpm: $(MAKE) -f $(MAKE_VCPM) $(BASE_DEFINES) mod: check vcpm export LD_LIBRARY_PATH=./ && ./vcpm $(MOD_PROJ) $(MAKE) -f $(MAKE_SERVER) $(BASE_DEFINES) plugin: check $(MAKE) -f $(MAKE_PLUGIN) $(BASE_DEFINES) tier1: $(LIB_DIR)/tier1_i486.a $(MAKE) -f $(MAKE_TIER1) $(BASE_DEFINES) mathlib: $(LIB_DIR)/mathlib_i486.a $(MAKE) -f $(MAKE_MATH) $(BASE_DEFINES) choreo: $(LIB_DIR)/choreoobjects_i486.a $(MAKE) -f $(MAKE_CHOREO) $(BASE_DEFINES) install: cp -f $(NAME)_$(ARCH).$(SHLIBEXT) $(GAME_DIR)/bin/$(NAME)_$(ARCH).$(SHLIBEXT) installrelease: cp -f $(NAME)_$(ARCH).$(SHLIBEXT) $(GAME_DIR)/bin/$(NAME)_$(ARCH).$(SHLIBEXT) strip $(GAME_DIR)/bin/$(NAME)_$(ARCH).$(SHLIBEXT) clean: $(MAKE) -f $(MAKE_VCPM) $(BASE_DEFINES) clean $(MAKE) -f $(MAKE_PLUGIN) $(BASE_DEFINES) clean $(MAKE) -f $(MAKE_SERVER) $(BASE_DEFINES) clean $(MAKE) -f $(MAKE_TIER1) $(BASE_DEFINES) clean $(MAKE) -f $(MAKE_MATH) $(BASE_DEFINES) clean $(MAKE) -f $(MAKE_CHOREO) $(BASE_DEFINES) clean rm $(TIER0_LIB) $(STEAM_LIB) $(VSTD_LIB) rmdir obj Makefile.plugin CODE # # Sample server plugin for SRC engine # # October 2004, alfred@valvesoftware.com # NAME = HPB_Bot2 PLUGIN_SRC_DIR = $(SRC_DIR)/utils/RCBot2 PUBLIC_SRC_DIR = $(SRC_DIR)/public TIER0_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier0 TIER1_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier1 PLUGIN_OBJ_DIR = $(BUILD_OBJ_DIR)/$(NAME)_$(ARCH) TIER0_OBJ_DIR = $(PLUGIN_OBJ_DIR)/tier0 INCLUDEDIRS = -I$(PUBLIC_SRC_DIR) -I$(TIER0_PUBLIC_SRC_DIR) -I$(TIER1_PUBLIC_SRC_DIR) -I$(PUBLIC_SRC_DIR)/mathlib -I$(SRC_DIR)/game/shared -I$(SRC_DIR)/game/server -I$(PUBLIC_SRC_DIR)/game/server -I$(PUBLIC_SRC_DIR)/engine LDFLAGS_PLG = -lm -ldl $(TIER0_LIB) $(VSTD_LIB) $(LIB_DIR)/mathlib_i486.a $(LIB_DIR)/tier1_i486.a $(LIB_DIR)/tier2_i486.a DO_CC = $(CPLUS) $(INCLUDEDIRS) -DARCH=$(ARCH) ifeq "$(DEBUG)" "true" DO_CC += $(DBG_DEFINES) $(DBG_CFLAGS) else DO_CC += -DNDEBUG $(CFLAGS) endif DO_CC += -o $@ -c $< ##################################################################### PLUGIN_OBJS = \ $(PLUGIN_OBJ_DIR)/bot.o \ $(PLUGIN_OBJ_DIR)/bot_accessclient.o \ $(PLUGIN_OBJ_DIR)/bot_buttons.o \ $(PLUGIN_OBJ_DIR)/bot_client.o \ $(PLUGIN_OBJ_DIR)/bot_commands.o \ $(PLUGIN_OBJ_DIR)/bot_configfile.o \ $(PLUGIN_OBJ_DIR)/bot_coop.o \ $(PLUGIN_OBJ_DIR)/bot_css_bot.o \ $(PLUGIN_OBJ_DIR)/bot_dod_bot.o \ $(PLUGIN_OBJ_DIR)/bot_events.o \ $(PLUGIN_OBJ_DIR)/bot_fortress.o \ $(PLUGIN_OBJ_DIR)/bot_ga.o \ $(PLUGIN_OBJ_DIR)/bot_ga_ind.o \ $(PLUGIN_OBJ_DIR)/bot_getprop.o \ $(PLUGIN_OBJ_DIR)/bot_globals.o \ $(PLUGIN_OBJ_DIR)/bot_hl1dmsrc.o \ $(PLUGIN_OBJ_DIR)/bot_hldm_bot.o \ $(PLUGIN_OBJ_DIR)/bot_kv.o \ $(PLUGIN_OBJ_DIR)/bot_main.o \ $(PLUGIN_OBJ_DIR)/bot_mods.o \ $(PLUGIN_OBJ_DIR)/bot_mtrand.o \ $(PLUGIN_OBJ_DIR)/bot_navmesh.o \ $(PLUGIN_OBJ_DIR)/bot_perceptron.o \ $(PLUGIN_OBJ_DIR)/bot_profile.o \ $(PLUGIN_OBJ_DIR)/bot_profiling.o \ $(PLUGIN_OBJ_DIR)/bot_schedule.o \ $(PLUGIN_OBJ_DIR)/bot_script.o \ $(PLUGIN_OBJ_DIR)/bot_som.o \ $(PLUGIN_OBJ_DIR)/bot_strings.o \ $(PLUGIN_OBJ_DIR)/bot_task.o \ $(PLUGIN_OBJ_DIR)/bot_usercmd.o \ $(PLUGIN_OBJ_DIR)/bot_utility.o \ $(PLUGIN_OBJ_DIR)/bot_visibles.o \ $(PLUGIN_OBJ_DIR)/bot_waypoint.o \ $(PLUGIN_OBJ_DIR)/bot_waypoint_locations.o \ $(PLUGIN_OBJ_DIR)/bot_waypoint_visibility.o \ $(PLUGIN_OBJ_DIR)/bot_weapons.o \ $(PLUGIN_OBJ_DIR)/bot_wpt_dist.o \ $(PLUGIN_OBJ_DIR)/bot_zombie.o \ TIER0_OBJS = all: dirs $(NAME)_$(ARCH).$(SHLIBEXT) dirs: -mkdir -p $(BUILD_OBJ_DIR) -mkdir -p $(PLUGIN_OBJ_DIR) -mkdir -p $(TIER0_OBJ_DIR) $(NAME)_$(ARCH).$(SHLIBEXT): $(PLUGIN_OBJS) $(TIER0_OBJS) $(CLINK) -o $(BUILD_DIR)/$@ -m32 $(SHLIBLDFLAGS) $(PLUGIN_OBJS) $(TIER0_OBJS) $(PUBLIC_OBJS) $(CPP_LIB) $(LDFLAGS_PLG) $(CPP_LIB) $(PLUGIN_OBJ_DIR)/%.o: $(PLUGIN_SRC_DIR)/%.cpp $(DO_CC) $(TIER0_OBJ_DIR)/%.o: $(TIER0_PUBLIC_SRC_DIR)/%.cpp $(DO_CC) clean: -rm -rf $(PLUGIN_OBJ_DIR) -rm -f $(NAME)_$(ARCH).$(SHLIBEXT) I turned off the compiler optimzer -O3 in order to debug and turned on debugging flags. |
Cheeseh |
Apr 13 2013, 12:16 AM
Post
#8
|
Admin Group: Admin Posts: 3,066 Joined: 11-September 03 From: uk Member No.: 1 |
cheers Ted, I had to make a few changes though, and for some reason says "gcc-4.7 -shared false -o ..." unknown command false . obv something missing, and couldn't find that in the makefile. Anyway I just copied and pasted it into the terminal and removed 'false' and it compiled.
Would anyone care to try? For dods in linux: the rcbot_runplayer_cmd_dods must be 415 for non steampipe otherwise it will crash http://rcbot.bots-united.com/downloads/HPB..._i486.so.tar.gz |
Lo-Fi Version | Time is now: 5th November 2024 - 03:03 AM |