Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Enabling debug console only for a unique roleid

Shh, quiet, you might piss somebody off
Developer
Joined
Dec 23, 2011
Messages
1,795
Reaction score
2,140
Hello ragezoners, i'm glad to bring to this forum a guide showing how to enable debug console for a Unique Roleid (Gamemaster or normal player).
be aware this method will replace Logging instruction so you will lost a small part of logging.

you will need a IDA Pro for x86 applications.

To start working you will have to find a method called "gplayer_controller::DebugCommandHandler", to find it you need to load gs from which version you want to create this function, and after done select method box and press ALT Key + T Key at same time, insert inside the box the function name above and press ok.

so you gonna find the function we are looking for, Press F5 to have a pseudo C++ code overview.
if you go down a little bit you're going to find this instruction to Log the DebugCommand, we gonna erase it and replace with our instruction.

XyTKki0 - Enabling debug console only for a unique roleid - RaGEZONE Forums


set your mouse pointer and click on the middle of string "this->_imp->_parent_ID.id", then press TAB.
you will see a instruction like this in the IDA, where Yellow is the instruction mov the roleid to EAX memory block and one line after yellow block, the instruction of system pull roleid from pointer EAX+30h.



Make sure to remember the entire yellow block instructions plus the pointer EAX+30h ( can be other depending on gs version ).

set your mouse pointer on the instruction "push [ebp+cmd_type]" and go on menu bar in top of IDA Pro, select Edit -> Patch Program -> Assemble.
you gonna write the word "NOP" until you reach the instruction "mov eax, [ebp+cmd_type]".
after you done, it will looks like this.


now you need to know where your method "DebugCommandHandler" finish it, my trick for this is click on next method in the method box and then go a little bit above the function , you will find the end of debughandler and then you need copy the locale instruction to a notepad or kind of, in my example the locale in on left-top of instruction, "loc_812B8D1".


so now you can build the new instructions code as you have the old code plus the compare to the roleid number, for my example i'll have those instructions.
remember to replace the mov eax and pointer eax 30h to match with the one of your gs, also replace myroleid with the ID of your desired character and also replace in last line the Loc that you find in the ending of the method.

Code:
mov     eax, [ebp+this]
mov     eax, [eax+4]
mov     eax, [eax+8]
cmp     dword ptr [eax+30h], MYROLEIDHERE
jnz     loc_812B8D1

Go to the first NOP in instructions and patch again but now with each line above, after done you will have to transfer the code to your gs again, so go to the menu bar from IDA, select Edit -> Patch Program -> Apply Patches, then select your original gs file loaded in the IDA previous, then replace in your server with this patched GS and test, Debug should works fine only for the designed roleid.

The final instruction will looks like this:

ohCag2 - Enabling debug console only for a unique roleid - RaGEZONE Forums


credits: me
 

Attachments

You must be registered for see attachments list
Last edited:
Newbie Spellweaver
Joined
Aug 11, 2011
Messages
25
Reaction score
0
Wow, very nice Bola, thanks!
Almost paid for this in another forúm :blush:
 
Newbie Spellweaver
Joined
Feb 24, 2016
Messages
12
Reaction score
2
Thank you for sharing with us those kind of stuff people would normally charge for... really, thank you!
 
Elite Diviner
Joined
Jun 26, 2013
Messages
486
Reaction score
91
It is interesting to note your methods here to maintain GS file-length. At the cost of logging but that is repayed for in production server safety in c2scmd. Great guide.:love:
 
Shh, quiet, you might piss somebody off
Developer
Joined
Dec 23, 2011
Messages
1,795
Reaction score
2,140
It is interesting to note your methods here to maintain GS file-length. At the cost of logging but that is repayed for in production server safety in c2scmd. Great guide.:love:

yeah there many things in GS "useless" somehow that you can erase and rewrite new instructions to add new behaviors, for example, inside gs you find a big function to save elements.data to a binary file again, since we know GS is not able to edit elements.data, we can override all entire code with our own functions and call it from somewhere in the gs to add custom behaviors.
 
Newbie Spellweaver
Joined
Feb 14, 2016
Messages
25
Reaction score
2
I followed the tutorial, however when using "c2scmd" gs falls



Bump, anyone?
 
Last edited:
Elite Diviner
Joined
Jun 26, 2013
Messages
486
Reaction score
91
I followed the tutorial, however when using "c2scmd" gs falls



Bump, anyone?

It means your modifications are not executing right for one reason or another.

You are basically causing the execute-able ELF file aka GS to crash with faulty code. Double check your edits to make sure it emulates the same thing here and if the code is similar enough when checking role for it and such for it to work the same
 
Newbie Spellweaver
Joined
Feb 14, 2016
Messages
25
Reaction score
2
The code is correct and working, the problem is when using the code "c2scmd", nothing more! But it doesn't matter anymore, I corrected it in another way!

Thanks!
 
Elite Diviner
Joined
Jun 26, 2013
Messages
486
Reaction score
91
The code is correct and working, the problem is when using the code "c2scmd", nothing more! But it doesn't matter anymore, I corrected it in another way!

Thanks!

If the modification was to allow c2scmd access for only one single role and your GS crashed on invoking that functionality then the modification caused the issue one way or another. If its causing your GS to crash then its not 'fine and working' The literal debug console is c2scmd. Hence the name... But glad its solved.
 
Back
Top