Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Coding Corner
You last visited: Today at 17:19

  • Please register to post and access all features, it's quick, easy and FREE!




[WIP] Get SRO Source Code - by re-writing it

Discussion on [WIP] Get SRO Source Code - by re-writing it within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old 02/22/2019, 19:54   #46
 
elite*gold: 0
Join Date: May 2018
Posts: 84
Received Thanks: 36
Quote:
Originally Posted by florian0 View Post
As @ said, it could be that the Dll is not loaded (pretty obvious if the ImGui Windows arent visible) or if your ginterface.txt is malformed. It may not be obvious from the ginterface.txt-changes file itself, but you need to add the additional lines in the section named "Create". I've seen ppl append the lines at the end of the file, which is not correct.

To make it easier to troubleshoot, I'd like to ask everyone who is experiencing errors or crashes to supply:
1. the error message being thrown
2. the address (and/or the source line) the debugger stopped at
3. if available, a crash dump of the client

"My client is crashing" leaves too many possibilities open.
The dll is loaded and the console is visible, also i can see the ImGui windows in login screen and the character select screen, the crash come when i select the character to enter the game world this is the debugger screenshot display the where the client stopped

epvpImg: *burp*, images are delicious.

the client crash dump show nothing, totally nothing!

Code:
Number of Messages: 0
22.02.2019 21:35:21
Just those two lines only, i'm using a clean client i didn't make any edit except your edits, and yeah i added the ginterface.txt in the "Create" section and here is an img to proof it

epvpImg: superb image hosting.

when i remove the additional lines from the file and start the client with the dll it work without problem and i would be able to see the ImGui after selecting the character in the game world



Klito* is offline  
Old 02/22/2019, 19:58   #47
 
elite*gold: 15
Join Date: Sep 2011
Posts: 695
Received Thanks: 140
Quote:
Originally Posted by Klito* View Post
The dll is loaded and the console is visible, also i can see the ImGui windows in login screen and the character select screen, the crash come when i select the character to enter the game world this is the debugger screenshot display the where the client stopped

epvpImg: *burp*, images are delicious.

the client crash dump show nothing, totally nothing!

Code:
Number of Messages: 0
22.02.2019 21:35:21
Just those two lines only, i'm using a clean client i didn't make any edit except your edits, and yeah i added the ginterface.txt in the "Create" section and here is an img to proof it

epvpImg: superb image hosting.

when i remove the additional lines from the file and start the client with the dll it work without problem and i would be able to see the ImGui after selecting the character in the game world
Insert this into ginterface.txt on line 315 right after GDR_SYSTEM:CIFSystemWnd
Code:
	GDR_FLORIAN0GUIDE:CIFflorian0Guide
	{
		ClientRect=RECT,"0,0,0,0"
		Color=COLOR,"255,250,48,127"
		DDJ=STRING,"icon\\etc\\eventguide_1.ddj"
		FontColor=COLOR,"255,239,153,255"
		FontIndex=INTEGER,"0"
		HAlign=INTEGER,"1"
		ID=INTEGER,"1337"
		Rect=RECT,"5000,250,40,40"
		Style=INTEGER,"0"
		SubSection=STRING,""
		Text=STRING,""
		UV_LB=POINT,"0,1"
		UV_LT=POINT,"0,0"
		UV_RB=POINT,"1,1"
		UV_RT=POINT,"1,0"
		VAlign=INTEGER,"1"
	}
	GDR_FLORIAN0:CIFflorian0
	{
		ClientRect=RECT,"0,0,0,0"
		Color=COLOR,"255,8,214,78"
		DDJ=STRING,"interface\\frame\\mframe_wnd_"
		FontColor=COLOR,"255,255,255,255"
		FontIndex=INTEGER,"0"
		HAlign=INTEGER,"0"
		ID=INTEGER,"1338"
		Rect=RECT,"600,200,400,300"
		Style=INTEGER,"64"
		SubSection=STRING,""
		Text=STRING,"UIIT_PAG_FLORIAN0"
		UV_LB=POINT,"0,1"
		UV_LT=POINT,"0,0"
		UV_RB=POINT,"1,1"
		UV_RT=POINT,"1,0"
		VAlign=INTEGER,"0"
	}


b0ykoe is online now  
Old 02/23/2019, 04:16   #48
 
elite*gold: 100
Join Date: Apr 2008
Posts: 641
Received Thanks: 828
Thanks for your answer. It clarified a much ... and is really weird ... 00B3E585 is right inside the parser, after looking for the ":"-separator ...
I know the parser has quite a lot of limitations. But that doesn't make any sense.

The parser lands there if it parsed the Section = Name, ... stuff correctly.

And the parser code you are facing issues with looks like this:
Code:
  IF::ReadLine(NumberOfBytesRead, hFile, &ctrl_name);
  if ( v5 )
  {
    do
    {
      if ( ctrl_name )
      {
        if ( !memcmp(&ctrl_name, &c_closingCurlyBrace, 2u) )
          return;
        separator_pos = strchr(&ctrl_name + 1, ':');
        *separator_pos = 0; // <- you crash here
        type_name = separator_pos + 1;
        sub_B3DEA0(a1, v8, &ctrl_name + 1);
        v10 = v9;
        std::string::assign((v9 + 32), type_name, strlen(type_name));
        CIFTControl::ParseBody(v10, NumberOfBytesRead, hFile);
      }
      IF::ReadLine(NumberOfBytesRead, hFile, &ctrl_name);
    }
    while ( v11 );
  }
The only reason it would crash there is if it doesn't find the ':'-separator. But since your ginterface.txt file looks correct ...

At the Stack-View in x64dbg (bottom right) you can still see the "0,0,0,0","0" from the section header (these are discarded) so i'm assuming it crashes at the first pass ... but that might be a false assumption ...
florian0 is offline  
Old 02/24/2019, 12:54   #49
 
elite*gold: 0
Join Date: Mar 2012
Posts: 642
Received Thanks: 23
Hello


I tried a lot, but I didn't manage to run Visual studio 2010
Is there an ideal visual studio 2010 link?

visual studio 2010 open
but there is no response when I open .bat files

Can you help with this?


ILowe is offline  
Old 02/24/2019, 14:51   #50
 
elite*gold: 100
Join Date: Apr 2008
Posts: 641
Received Thanks: 828
Just run the bat file for visual studio 2010 in the explorer (just double click on it). It will create the Visual Studio Project Files. Then you can open the project (SRO_DevKit.sln) in Visual Studio.
florian0 is offline  
Old 02/25/2019, 01:18   #51
 
elite*gold: 0
Join Date: Mar 2012
Posts: 642
Received Thanks: 23
Quote:
Originally Posted by florian0 View Post
Just run the bat file for visual studio 2010 in the explorer (just double click on it). It will create the Visual Studio Project Files. Then you can open the project (SRO_DevKit.sln) in Visual Studio.
vs 2010 open, it doesn't do anything when you click .bat
please help me, I've been dealing for days
ILowe is offline  
Old 02/25/2019, 14:41   #52
 
elite*gold: 100
Join Date: Apr 2008
Posts: 641
Received Thanks: 828
Did you install CMake? Open the make_project_vs2010.cmd with the editor of your choice, then put "pause" in a new line at the end. Whats the output?
florian0 is offline  
Old 03/28/2019, 11:39   #53
 
elite*gold: 0
Join Date: Feb 2013
Posts: 49
Received Thanks: 1
amazing as always @

i got some notices about florianguide class
1- the GUI id in our case is 30007 it's dynamically created right?
2- some of silkroad's classes in the notification area like CIFOpenMarketAlramGuide is static id and not even defined by any txt or 2dt (yes it use the NIF new *****) but it has static id, i remember it's 198
3- our notification icon now doesn't have a fixed position on the screen so when you change the resolution , the x and y coordinates become meaningless
4- why not using sub_425AE0 instead of sub_634470 and TB_Func_13 to load the icon
5- i noticed a crash while moving the mouse under the imgui window next to the left of zerk button
ZeonNETWORK is offline  
Old 03/28/2019, 12:01   #54
 
elite*gold: 100
Join Date: Apr 2008
Posts: 641
Received Thanks: 828
Quote:
Originally Posted by ZeonNETWORK View Post
amazing as always @

i got some notices about florianguide class
1- the GUI id in our case is 30007 it's dynamically created right?
2- some of silkroad's classes in the notification area like CIFOpenMarketAlramGuide is static id and not even defined by any txt or 2dt (yes it use the NIF new *****) but it has static id, i remember it's 198
3- our notification icon now doesn't have a fixed position on the screen so when you change the resolution , the x and y coordinates become meaningless
4- why not using sub_425AE0 instead of sub_634470 and TB_Func_13 to load the icon
5- i noticed a crash while moving the mouse under the imgui window next to the left of zerk button
All GUI elements listed in ginterface.txt (and the ones included by files used in here) are created dynamically, but the ID seems to be static, at least for txt.
I'm not sure how the notification area is managed internally. I just managed to create a notification icon. It might create notification icons by itself. If you want it to move with the resolution you have to move it by calling MoveGWnd (i think thats the correct name) for now. I haven't found the notification-alignment code, yet.

sub_425AE0 is std::string::assign. Calling it would cause a crash because there is no memory for it. sub_634470 loads the icon. I'm not entirely sure what it does exactly, but it's kinda different to TB_Func_13. Also, the game loads the icon without a virtual call irrc, so I just mimicked that. I guess you can also just call TB_Func_13 with a string.

I'll look into the crash. Maybe I can reproduce it.
florian0 is offline  
Thanks
1 User
Old 03/28/2019, 23:04   #55
 
elite*gold: 0
Join Date: Feb 2013
Posts: 49
Received Thanks: 1
Quote:
Originally Posted by florian0 View Post
All GUI elements listed in ginterface.txt (and the ones included by files used in here) are created dynamically, but the ID seems to be static, at least for txt.
exactly they are created dynamically but the id is static, so where to determine that ID if i created more GUI elements?
already tried different IDs on the CIFFlorian0Guide in GInterface.txt which off course crashes eventually

Quote:
Originally Posted by florian0 View Post
sub_425AE0 is std::string::assign. Calling it would cause a crash because there is no memory for it. sub_634470 loads the icon. I'm not entirely sure what it does exactly, but it's kinda different to TB_Func_13. Also, the game loads the icon without a virtual call irrc, so I just mimicked that. I guess you can also just call TB_Func_13 with a string.
i got it, and back to the main post you said the current available controls are the button and static
so if i want more controls how can i get the class members at the first place?
are there any ida plugins which manage to do that?
ZeonNETWORK is offline  
Old 03/29/2019, 00:10   #56
 
elite*gold: 100
Join Date: Apr 2008
Posts: 641
Received Thanks: 828
Quote:
Originally Posted by ZeonNETWORK View Post
exactly they are created dynamically but the id is static, so where to determine that ID if i created more GUI elements?
already tried different IDs on the CIFFlorian0Guide in GInterface.txt which off course crashes eventually
You choose the IDs by yourself. They can be any number, starting from about 5 (lower numbers are reserved for closebtn, titletext and drag handle). IDs have to be unique inside a window e.g. every ID should only appear once in CIFflorian0.txt, but can still be used in other GUIs. Same applies for ginterface.txt. Every entry needs to have it's own, unique ID.

Duplicate IDs do not ultimately lead to crashing. Mostly only weird behaviour. What leads to crashing is the fact that almost no code in Silkroad checks if GUI-Elements are actually existing. If you change the ID of CIFflorian0Guide and some code still uses that old ID, it might crash. These crashes usually happen because GetResObj will return 0 if the GUI Element/Window could not be found and the game doesn't check for that.

Code:
// This is fine, as long as 32001 is an existing ID, but will lead to an unavoidable crash if not
g_CGInterface->m_IRM.GetResObj(32001, 1)->SetVisibile(true);
Code:
// Failsafe, but also longer
CIFWnd* obj = g_CGInterface->m_IRM.GetResObj(32001, 1);
if (obj)
    obj->SetVisibile(true);
Quote:
Originally Posted by ZeonNETWORK View Post
i got it, and back to the main post you said the current available controls are the button and static
so if i want more controls how can i get the class members at the first place?
are there any ida plugins which manage to do that?
Button and Static are the ones that have their own classes. Other controls work aswell, but have some limitations. Visually, probably all controls can be used. You can place fancy headers, fake scrollbars and such. The problem is the interaction. Some, like the textbox, don't require their own class to be accessed. You can just treat them as CIFWnd and call GetText to get the content.

So in theory, creating classes for all the different UI Elements is not necessary unless you need some special feature.

But If you're still up to create one: In general, a "working" silkroad class consists of four main parts: A constructor, a destructor, a virtual function table and their runtimeclass stuff. Most of the time, just having the virtual function table is enough since you are not going to construct the object.

I've used ClassInformer for IDA and now Ghidra to find the virtual function tables via RTTI in the sro_client.

Start by figuring out if there are any virtual functions aside from the ones in the base class. Since the game is heavily based on virtuals, you may find interesting stuff there. You don't need to reconstruct the functions you have found. Simply adding the declaration is enough to call it.

Then do the runtimeclass stuff. The RuntimeClass of the object is referenced in the very first entry of the virtual function table (GetRuntimeClass). My code has macros for generating these functions.

You can also figure out the size of the object pretty easy. For example if you want to know the size of CIFButton, you just make a string-search for "CIFButton". Once found, check the references to that string.

There may be multiple, the one with the PUSH is usually the correct one. If there is more than one, just look at all of them.
If it looks like this, you found the right one. Look slightly above and you see the total size of CIFButton: 0x3D4


(Applies to all objects used in the UI)

Everything is kinda cross-referenced at this point. You can see the address of the RuntimeClass of CIFButton in the screenshot aswell (0x00ee9828). So having either the RuntimeClass address or the typename will lead you to the object size and the virtual function table (Through GetRuntimeClass) and the typename. The screenshot also shows the RuntimeClass of the base-class (0x00ee9720 - CIFStatic).

Constructors and destructors are usually not needed and can be very complex to reverse engineer. I can't give any specific hint on that. It's just bare assembly to c++ conversion using your own (or someone elses) brain.

If you need special behaviour, e.g. like I said before, scrolling, you need to figure out how it works by reverse engineering existing (simple) windows that implement scroll.
florian0 is offline  
Thanks
2 Users
Old 04/02/2019, 13:58   #57
 
elite*gold: 0
Join Date: Dec 2007
Posts: 59
Received Thanks: 7
Quote:
Originally Posted by b0ykoe View Post
I've started 2 days ago with @ release and honestly this is fairly easy. Even for someone who has never worked with any C language before.

Huge thanks to him and keep going!

Just want to show some of my progress
nice job ! may you can share your code and txt for this scroll menu ?
LordCraft is offline  
Old 06/22/2019, 10:05   #58
 
elite*gold: 0
Join Date: Sep 2012
Posts: 160
Received Thanks: 41
@

florian0, how to read packet or send packet on this project ?

i cant include #include <cstdint>
concucu is offline  
Old 06/24/2019, 15:03   #59
 
elite*gold: 100
Join Date: Apr 2008
Posts: 641
Received Thanks: 828
Quote:
Originally Posted by concucu View Post
@

florian0, how to read packet or send packet on this project ?

i cant include #include <cstdint>
Networking support is not added yet.

Do you have any error message regarding cstdint? I don't have any issues with includes.
florian0 is offline  
Old 06/25/2019, 15:17   #60
 
elite*gold: 0
Join Date: Oct 2012
Posts: 98
Received Thanks: 23
Quote:
Originally Posted by concucu View Post
@

florian0, how to read packet or send packet on this project ?

i cant include #include <cstdint>
A simple way to solve this is copy the csdint from Vc100 or other to vc80 and reload the project


chipno0p is online now  
Thanks
1 User
Reply



« vSRO Old MainPop | SBot even lower range »

Similar Threads
[Release/WIP]EP6 Source code
04/15/2018 - Shaiya PServer Guides & Releases - 34 Replies
Hi guys, First of all, I want to say that this release is not recommended for public servers yet. Shortly ago I changed my server to ep6 using shen1l's pet.dll, the server crashed every day, after checking the dump files I discovered that the problem was in pet.dll, but without the source code it would be harder to find the cause of the problem. So I decided to start a project and release the source code for everyone, so that everyone can solve their problems more easily, and also so that...
[Source] Fix the old exp bar - by writing code!
04/23/2017 - SRO PServer Guides & Releases - 14 Replies
Hello beloved, dead community, its time for another release. Its more of a proof of concept and I hope it might inspire people to continue working on it. You don't need the source to accomplish cool things. Just write your own source. http://i.epvpimg.com/d7hJbab.png Ye, its super ugly looking. I choose to be a coder, not a designer. I'd be happy, if someone supplies me a proper version of the 2dt and ddj files so I can update this embarrassing screenshot. Anyway. It allows you to...
[C++ Source] My Free Farm Bot [WIP]
06/28/2011 - Browsergames - 0 Replies
I decided to release this on here as i have no more use for it and no intention to continue the project. I am releasing 2 projects: One basic library for mff called libmff(although it is not really a library) there is an example on how to use it in the package. And a helper with a fancy gui. Note that there is almost no error checking on the helper and that it crashes if you for example forget to select a product. You need libcurl and boost for both and GWEN(the gui toolkit by garry) for...



All times are GMT +2. The time now is 17:19.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

BTC: 33E6kMtxYa7dApCFzrS3Jb7U3NrVvo8nsK
ETH: 0xc6ec801B7563A4376751F33b0573308aDa611E05

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2019 elitepvpers All Rights Reserved.