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. |
Lo-Fi Version | Time is now: 10th November 2024 - 06:19 PM |