Raised This Month: $51 Target: $400
 12% 

Patch gpGlobals data


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 08-25-2012 , 01:20   Patch gpGlobals data
Reply With Quote #1

hey guys I want to share something to you,
It's very simple.and memory hack is necessary
and then get the gpGlobals address and patch it.
and I patch the mapname and work

Code:
void ServerActivate_Post(edict_t *pEdictList, int edictCount, int clientMax) {     char buffer[64];     sprintf(buffer, "Current map name is %s", STRING(gpGlobals->mapname));     SERVER_PRINT(buffer);     cell address = reinterpret_cast<cell>((const char *)(gpGlobals->pStringBase + (int)gpGlobals->mapname));     char szNewMap[] = "de_dust2(\xE6\xB5\x8B\xE8\xAF\x95)";     for (int i = 0; i <= (int)strlen(szNewMap); i++)     {         UTIL_PatchMemory_UnsignedByte(NULL, address + i, szNewMap[i], MEMTYPE_DATA);     }     RETURN_META(MRES_IGNORED); }

have fun

edited:
add photo
Attached Thumbnails
Click image for larger version

Name:	photo.jpg
Views:	1536
Size:	30.2 KB
ID:	108448  
__________________
QQ:116268742

Last edited by K.K.Lv; 08-25-2012 at 01:25.
K.K.Lv is offline
Send a message via MSN to K.K.Lv
kiki33hun
Veteran Member
Join Date: Jul 2011
Location: Magyarország
Old 08-25-2012 , 04:45   Re: Patch gpGlobals data
Reply With Quote #2

Nice found!
__________________
kiki33hun is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 08-25-2012 , 06:14   Re: Patch gpGlobals data
Reply With Quote #3

May you publish also that function:

PHP Code:
UTIL_PatchMemory_UnsignedByteintintintint ); 
Is it working on Linux?

Last edited by claudiuhks; 08-25-2012 at 06:15.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 08-25-2012 , 07:47   Re: Patch gpGlobals data
Reply With Quote #4

should work on Linux
about that function please take a look at Memhack source.
__________________
QQ:116268742
K.K.Lv is offline
Send a message via MSN to K.K.Lv
f55z55p
BANNED
Join Date: Sep 2012
Old 09-23-2012 , 17:07   Re: Patch gpGlobals data
Reply With Quote #5

Wait, it will also show that for client console ( client look to favorites and see that what you done ) ?

Last edited by f55z55p; 09-23-2012 at 17:07.
f55z55p is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 09-24-2012 , 06:58   Re: Patch gpGlobals data
Reply With Quote #6

Quote:
Originally Posted by f55z55p View Post
Wait, it will also show that for client console ( client look to favorites and see that what you done ) ?
Of course it will.
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 09-24-2012 , 11:15   Re: Patch gpGlobals data
Reply With Quote #7

So, for better understanding, the code from MemHack is here:

PHP Code:
#include <stdlib.h> /* malloc, free */

class Memory_Hack {
private: 
/* Inaccessible */
    
int Address;

    
template typename Type void Patchint RealAddressType Patch ) {
        *( 
Type * ) RealAddress Patch;
    }

public: 
/* Accessible */
    
void FixAddresschar pString ) {
        
Address reinterpret_cast int > ( pString );
    }

    
void PatchMapnamechar pString ) {
        for( 
int i 0<= ( int ) strlenpString ); i++ )
            
PatchAddress i, ( unsigned char pString] );
    }
};

void ServerActivate_Postedict_t *, intint ) {
    
Memory_Hack pHack = ( Memory_Hack * ) mallocsizeofMemory_Hack ) );
    
char pNewMapName = ( char * ) malloc128 /* 128 characters is a good size to set */ );

    
sprintfpNewMapName"%s Bombardier"STRINGgpGlobals -> mapname ) );

    
pHack -> FixAddress( ( char * ) gpGlobals -> pStringBase gpGlobals -> mapname ); /* Conversion from ( const char * ) to ( char * ) is possible! */
    
pHack -> PatchMapnamepNewMapName );

    
freepHack );
    
freepNewMapName );

    
RETURN_METAMRES_IGNORED );

K.K.Lv, it's just impressive!
Thanks for that! 謝謝

Output:

Code:
de_dust2 Bombardier
cs_italy Bombardier
as_oilrig Bombardier
__________________

Last edited by claudiuhks; 09-25-2012 at 00:19.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 09-24-2012 , 11:29   Re: Patch gpGlobals data
Reply With Quote #8

Could be useful to replace de_dust2 with Dust 2, cs_assault with Assault, etc.

Make a module with a native to set custom map name!

Last edited by hleV; 09-24-2012 at 11:30.
hleV is offline
kiki33hun
Veteran Member
Join Date: Jul 2011
Location: Magyarország
Old 09-24-2012 , 11:30   Re: Patch gpGlobals data
Reply With Quote #9

Quote:
Originally Posted by hleV View Post
Could be useful to replace de_dust2 with Dust 2, cs_assault with Assault, etc.

Make a module with a native to set custom map name!
Yes
__________________
kiki33hun is offline
K.K.Lv
Veteran Member
Join Date: Aug 2008
Location: GameFolder
Old 09-24-2012 , 12:48   Re: Patch gpGlobals data
Reply With Quote #10

More clear claudiuhks

edited:
native are unnecessary, use a file system is enough
I think you have to free the memory claudiuhks !
__________________
QQ:116268742

Last edited by K.K.Lv; 09-24-2012 at 12:54.
K.K.Lv is offline
Send a message via MSN to K.K.Lv
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:59.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode