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. |
Lo-Fi Version | Time is now: 9th October 2024 - 06:03 PM |