[Guide] Handling Client Networking @ Any State Process

07/28/2020 17:11 thaidu0ngpr0#16
Quote:
Originally Posted by #HB View Post
Hey there,

I've been hella busy lately, some guy asked me about handling messages in client-side like a week ago, I told 'em I'll make a guide and I totally got busy & forgot.

Anyways, lets get into this.

[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

Note: Structures don't really have to be 100% correct, that's just analyzing & guesses.

How To Hook State Process: Since OnPacketRecv is a virtual function, its a different function with a different address per state process.

The main place where OnPacketRecv is called should be at:
Code:
00BA8FB1 | FF D0                  | call eax                                         | OnPacketRecv
So basically, you can set a breakpoint there in different state processes & get the address of the function.

For example, I want the address of CPSTitle::OnPacketRecv, so I set a breakpoint on that address above during login section, when the breakpoint hits, get the value of EAX, thats your function address.

I made an example as for CPSMission, which handles msgs after selecting your character.

[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

Code:
replaceAddr(0x00DD440C, addr_from_this(&CPSMission::OnPacketRecv));
And that's all.

Note: If you're planning to use ReadStringA or ReadStringW functions, you need to ensure you're using VC80 compiler, AKA Visual Studio 2005.

Special thanks to: florian0 :rolleyes:
I have included it in sro_dev but it shows nothing
Can you guide how to help it work. I really need it
07/28/2020 19:09 Laag#82#17
Quote:
Originally Posted by thaidu0ngpr0 View Post
I have included it in sro_dev but it shows nothing
Can you guide how to help it work. I really need it
hello again

this can help you


[Only registered and activated users can see links. Click Here To Register...]
07/28/2020 23:03 #HB#18
Modification:-
-Fixed few bugs with string functions at CMsgStreamBuffer and updated code to be more readable.

Quote:
Originally Posted by thaidu0ngpr0 View Post
I have included it in sro_dev but it shows nothing
Can you guide how to help it work. I really need it
What do you mean it shows nothing?
08/02/2020 23:13 thaidu0ngpr0#19
Quote:
Originally Posted by #HB View Post
Modification:-
-Fixed few bugs with string functions at CMsgStreamBuffer and updated code to be more readable.



What do you mean it shows nothing?

How can I combine it with sro_devkit
08/03/2020 02:55 #HB#20
Quote:
Originally Posted by thaidu0ngpr0 View Post
How can I combine it with sro_devkit
You can't combine it, DevKit has its own CMsgStreamBuffer just with different labels and maybe better parse.

You can use both already by renaming the class.
08/03/2020 08:09 thaidu0ngpr0#21
Quote:
Originally Posted by #HB View Post
You can't combine it, DevKit has its own CMsgStreamBuffer just with different labels and maybe better parse.

You can use both already by renaming the class.

I tried, but it didn't work, I tried calling GUI with opcode 0xB070 but GUI didn't appear
I need to do something else for it to work
CPSMission.cpp
PHP Code:
#include "CPSMission.h"
#include "ClientNet/MsgStreamBuffer.h"
#include "GInterface.h"





int CPSMission::OnPacketRecv(CMsgStreamBufferMsgBuffer)
{
    if (
MsgBuffer->msgid() == 0xB070)//Show Form
    
{
        
int FormID 5004;
        
byte ShowHide = -1;
        *
MsgBuffer >> FormID >> ShowHide;

        if (
FormID != )
        {
            
g_pCGInterface->m_IRM.GetResObj(FormID1)->ShowGWnd(true);
        }

        
MsgBuffer->FlushRemaining();
    }
    
//Returning 1 means packet is accepted & read, 0 means fail & afair client may crash if you do return 0
    //Also, if you're planning to read original packets, set TotalReadBytes to 0 after you finish reading, because sro_client will re-read this stuff and if any byte were read before, it'll crash because it attempts to read over max bytes limit.
    
return reinterpret_cast<int(__thiscall*)(CPSMission*, CMsgStreamBuffer*)>(0x0084CAB0)(thisMsgBuffer);

08/03/2020 22:19 #HB#22
Are you sure you're hooking?
08/04/2020 05:46 thaidu0ngpr0#23
Quote:
Originally Posted by #HB View Post
Are you sure you're hooking?
florian0 he told me to need a vftable hook. but I don't know where to get the vftable hook. Can you guide me to hook it.
thank you for sharing
my discord : Thaidu0ngpr0#3327
08/04/2020 14:57 #HB#24
Quote:
Originally Posted by thaidu0ngpr0 View Post
Can you guide me to hook it.
Did you read main post? :3
08/04/2020 16:24 thaidu0ngpr0#25
Quote:
Originally Posted by #HB View Post
Did you read main post? :3

thank you very much . I did it
08/05/2020 09:06 #HB#26
.

Quote:
Originally Posted by #HB View Post
How To Hook State Process: Since OnPacketRecv is a virtual function, its a different function with a different address per state process.

The main place where OnPacketRecv is called should be at:
Code:
00BA8FB1 | FF D0                  | call eax                                         | OnPacketRecv
So basically, you can set a breakpoint there in different state processes & get the address of the function.

For example, I want the address of CPSTitle::OnPacketRecv, so I set a breakpoint on that address above during login section, when the breakpoint hits, get the value of EAX, thats your function address.

CPSMission example:
Code:
replaceAddr(0x00DD440C, addr_from_this(&CPSMission::OnPacketRecv));
11/13/2020 18:10 d4rk123#27
Quote:
Originally Posted by #HB View Post
Hey there,

I've been hella busy lately, some guy asked me about handling messages in client-side like a week ago, I told 'em I'll make a guide and I totally got busy & forgot.

Anyways, lets get into this.

[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

Note: Structures don't really have to be 100% correct, that's just analyzing & guesses.

How To Hook State Process: Since OnPacketRecv is a virtual function, its a different function with a different address per state process.

The main place where OnPacketRecv is called should be at:
Code:
00BA8FB1 | FF D0                  | call eax                                         | OnPacketRecv
So basically, you can set a breakpoint there in different state processes & get the address of the function.

For example, I want the address of CPSTitle::OnPacketRecv, so I set a breakpoint on that address above during login section, when the breakpoint hits, get the value of EAX, thats your function address.

I made an example as for CPSMission, which handles msgs after selecting your character.

[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

Code:
replaceAddr(0x00DD440C, addr_from_this(&CPSMission::OnPacketRecv));
And that's all.

Note: If you're planning to use ReadStringA or ReadStringW functions, you need to ensure you're using VC80 compiler, AKA Visual Studio 2005.

Special thanks to: florian0 :rolleyes:


Linkleri yenilermisiniz? sayfalar açılmıyor
11/13/2020 18:57 florian0#28
Quote:
Originally Posted by d4rk123 View Post
Linkleri yenilermisiniz? sayfalar açılmıyor
Links are fine
11/14/2020 06:14 d4rk123#29
Quote:
Originally Posted by florian0 View Post
Links are fine
opened thanks to vpn. thank you
07/26/2021 19:33 kotsh23#30
Quote:
Originally Posted by sarkoplata View Post
you can hook: 0x008418D0
the first arg pushed into the stack is a CMsgStreamBuffer*.
Please boss add my discord i need your help
Kotsh#5187