About custom packets, PLS Help me, Thaks!

10/21/2020 18:25 halloway520#1
hi every one:

PHP Code:
void CNetProcessIn::OnB983(CMsgStreamBuffer &msg) {

    
DEBUG_PRINT_CALL()

    
std::n_string recvMsg;
    
msg >> recvMsg;
    
msg.FlushRemaining();

    
char *cstr = new char[recvMsg.length() + 1];
    
strcpy(cstrrecvMsg.c_str());

    
g_vRank.clear();
    
char *tmp strtok(cstr"#");
    while (
tmp != NULL)
    {
        
g_vRank.push_back(tmp);
        
tmp strtok(NULL"#");
    }

    
delete [] cstr;

    if (!
g_vRank.empty())
    {
        
CIFConvert cc;
        
g_Charname->SetText(cc.AnsiToUnicode(g_vRank[0].c_str()));
    }

    
reinterpret_cast<void (__thiscall *)(CNetProcessIn *, CMsgStreamBuffer &)>(0x0084CAB0)(thismsg);

The code does what I need, but the sro_client.exe will be crash once in a while. It happens every 3~5 times when i received 0xB983.


I know the problem is at

PHP Code:
reinterpret_cast<void (__thiscall *)(CNetProcessIn *, CMsgStreamBuffer &)>(0x0084CAB0)(thismsg); 

but, i do not know how to get a stable(safe)address,

I can not understand F0 or HB's guide.

I want to know which address I should hook up to and if someone can share that address with me, Thank you very much,

I do not know ASM, last, sorry for my english.:D
10/21/2020 21:47 florian0#2
The answer is simple: Don't call 0x0084CAB0 in the end. You don't need it.

Explanation:
That function looks like it belongs to the CNetProcessIn implementation I added to SRO_DevKit. B983 is not a standard msgid, therefore I guess it's a custom one.
CNetProcessIn will call your handler function if a message with that Id is received. Your handler has to read all bytes from the message, otherwise the game will think there was an error.

The redirection in the end is only required when a function is hooked. You redirect some function to your own function and call the original function in the end to close the loop.
Since your handler function is entirely your own creation and has no equivalent in the game, you don't need to call any original function in the end (since you don't have one). You can just leave the function without that. It'll work fine.
10/22/2020 04:00 halloway520#3
Quote:
Originally Posted by florian0 View Post
The answer is simple: Don't call 0x0084CAB0 in the end. You don't need it.

Explanation:
That function looks like it belongs to the CNetProcessIn implementation I added to SRO_DevKit. B983 is not a standard msgid, therefore I guess it's a custom one.
CNetProcessIn will call your handler function if a message with that Id is received. Your handler has to read all bytes from the message, otherwise the game will think there was an error.

The redirection in the end is only required when a function is hooked. You redirect some function to your own function and call the original function in the end to close the loop.
Since your handler function is entirely your own creation and has no equivalent in the game, you don't need to call any original function in the end (since you don't have one). You can just leave the function without that. It'll work fine.

You solved my confusion, The program is working perfectly.

Again, thank you for your great contribution. Thank epvp.

fix.
10/24/2020 04:30 devdash#4
It's sad when i see things looks shiny but i do not understand it still.
Will i be able to understand what are you guys talking about if i start learning C#?
i started already but i still can't understand anything, maybe on a higher level of C#?

i really wish someday i can understand what are you guys talking about here, because i feel i am not even in the trace race.

give me hints, so i can join the trace <3
10/24/2020 06:21 irockalone#5
Quote:
Originally Posted by alydandy View Post
It's sad when i see things looks shiny but i do not understand it still.
Will i be able to understand what are you guys talking about if i start learning C#?
i started already but i still can't understand anything, maybe on a higher level of C#?

i really wish someday i can understand what are you guys talking about here, because i feel i am not even in the trace race.

give me hints, so i can join the trace <3
ahaha, i felt like you're describing me.
10/24/2020 08:37 JellyBitz#6
Starts with basic knowledge.
[Only registered and activated users can see links. Click Here To Register...] is a good start, never is too late.