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!

How to solve the problem that the equipment ID greater than 65535 is not visible

Junior Spellweaver
Joined
Jan 29, 2015
Messages
118
Reaction score
5
I added a lot of equipment to element. data, but found that when the equipment ID was greater than 65535, the characters could not see each other's equipment, that is to say, the equipment could only be seen by themselves. How to solve this problem?
 
Newbie Spellweaver
Joined
Aug 25, 2018
Messages
46
Reaction score
4
The problem is not the id of the element, you have added an element that is used by something else.
 
Upvote 0
Junior Spellweaver
Joined
Jan 29, 2015
Messages
118
Reaction score
5
The problem is not the id of the element, you have added an element that is used by something else.
It doesn't seem to be due to tools. I used sELedit to modify the ID of a device, and used Ultra Compare to make hexadecimal comparisons, and found no problem.
 
Upvote 0
Experienced Elementalist
Joined
Nov 1, 2015
Messages
280
Reaction score
174
rodysoft tools are well worth the cost, the elements editor even checks for id conflicts for you
 
Upvote 0
Junior Spellweaver
Joined
Jan 29, 2015
Messages
118
Reaction score
5
rodysoft tools are well worth the cost, the elements editor even checks for id conflicts for you
In v496 and previous versions, the ID will not be greater than 60,000, so if the ID of a piece of equipment or fashion is greater than 65,535, there will never be conflict.
 
Upvote 0
Newbie Spellweaver
Joined
Nov 11, 2015
Messages
36
Reaction score
14
this is a problem with the way packets are sent to and from the game to the server, anything greater then 65535 will not be seen by other players because of the way packets are sent, this is an intentional hard cap to the game
 
Upvote 0
Experienced Elementalist
Joined
Nov 1, 2015
Messages
280
Reaction score
174
Well, it seems that this problem is hard to solve.

probably the only way to fix it would be to learn intel x86 assembly and edit the client, and certain parts of the server to remove this limitation. good luck
 
Upvote 0
Newbie Spellweaver
Joined
Nov 11, 2015
Messages
36
Reaction score
14
probably the only way to fix it would be to learn intel x86 assembly and edit the client, and certain parts of the server to remove this limitation. good luck

you would be somewhat correct, live debugging with the source code would help alot too
 
Upvote 0
Experienced Elementalist
Joined
Nov 1, 2015
Messages
280
Reaction score
174
you would be somewhat correct, live debugging with the source code would help alot too

problem is i only know one person that has the source code, and he is not sharing. so that only leaves decompiling the binary. and the game.exe has several protections in it to prevent that.
Gothic i would send you this in pm but sadly we have that silly 1 msg every 30minutes limit, i'll just say you are still on my steam friend list, look for Mirarora.
 
Last edited:
Upvote 0
Experienced Elementalist
Joined
Oct 24, 2007
Messages
243
Reaction score
362
Okay. I am going to teach all of you how to increase the MAX_ITEM_INDEX to a number greater than 65535.
If you have IDA Pro, this is very easy to do -- even if you do not have a working knowledge of ASM.
Place the 'gs' into x86 Ida and let it disassemble, this may take some time.
We are looking for two functions:
Code:
static inline void SetCashItem(size_t citem_id)
{
    ASSERT(citem_id < MAX_ITEM_INDEX);
    _cash_item_flag[citem_id] = 1;
}
static inline bool IsCashItem(size_t item_id)
{
   if(item_id >= MAX_ITEM_INDEX) return false;
   return _cash_item_flag[item_id];
}

and lastly the constructor for the item_manager class, which will not be returned in our imm search.
These functions are right on top of one another in the game server.
So... to do this really easily, do as follows:
In the IDA View-A window. Press ALT I ..

search_imm - How to solve the problem that the equipment ID greater than 65535 is not visible - RaGEZONE Forums

Enter 0xFFFE and check the "Final all occurrences" option.
The result will look like:

immresult - How to solve the problem that the equipment ID greater than 65535 is not visible - RaGEZONE Forums

Click on:
Code:
.text:0820C4E8    _ZN12item_manager11SetCashItemEj    cmp     dword ptr [ebp+8], 0FFFEh
look at the asm code. where you see:

Code:
cmp     dword ptr [ebp+8], 0FFFEh
we need to change this 0xfffeh (655535) to another value. Let's just go as high as we can...
to 99999
place your cursor besides the instruction:
Code:
cmp     dword ptr [ebp+8], 0FFFEh
from the Edit menu, select Patch Program -> Change Bytes...
you should see:
Code:
81 7D 08 FE FF 00 00 76 1D 83 EC 04 6A 1E 68 86
we will change this to:
Code:
81 7D 08 9F 86 01 00 76 1D 83 EC 04 6A 1E 68 86
99999 in hex is: 0x1869F[/CODE]
Next we modify....
Code:
.text:0820C522    _ZN12item_manager10IsCashItemEj    cmp     dword ptr [ebp+8], 0FFFEh
Again you will see:
Code:
81 7D 08 FE FF 00 00 76 09 C7 45 FC 00 00 00 00
and change it to:
81 7D 08 9F 86 01 00 76 09 C7 45 FC 00 00 00 00

After you have made the changes, return to the edit menu -> Patch Program -> Apply Patches to input file. Click "Create backup" just in case.
Now copy the patched 'gs' to your Linux system.
Congratulations .. you can now have items in the server side elements.data that are greater than the default of 65535... as in it will not segfault when loading.

Now, as for why other players cannot see equipment or fashion with an Id above 65535, is exactly the reason stated above.

The value of ItemId in the two packets that need modification are unsigned shorts, which have their limit at 65535... changing to unsigned int is a much bigger job. It is not as simple as changing the two structures in the change to unsigned int .. there are more functions in the 'gs' that require modification.
 

Attachments

You must be registered for see attachments list
Last edited:
Upvote 0
Experienced Elementalist
Joined
Nov 1, 2015
Messages
280
Reaction score
174
How different would the process be if using GHIDRA?
 
Upvote 0
Experienced Elementalist
Joined
Oct 24, 2007
Messages
243
Reaction score
362
How different would the process be if using GHIDRA?
Basically the same - not sure if Ghidra has Patch file, but I would get the file offset, and use a hex editor to make the modification. Let me know if you have any troubles.
 
Upvote 0
Junior Spellweaver
Joined
Jan 29, 2015
Messages
118
Reaction score
5
0617-02 - How to solve the problem that the equipment ID greater than 65535 is not visible - RaGEZONE Forums 0617-03 - How to solve the problem that the equipment ID greater than 65535 is not visible - RaGEZONE Forums 0617-01 - How to solve the problem that the equipment ID greater than 65535 is not visible - RaGEZONE Forums I've followed your steps to make changes, but there may be something wrong, GS can't start after being packed.GS is about 100M after compression. Can you share your modified GS file?
 

Attachments

You must be registered for see attachments list
Upvote 0
Experienced Elementalist
Joined
Oct 24, 2007
Messages
243
Reaction score
362
Hi,

I created using all open source tools a solution that will automatically modify your gs as required.

Here is a link:

It must be run from Linux or MacOS ... Python 2.7 needs to be installed. Please see the howto.txt inside of the elfpatch.7z for instructions
wxk0248

Undo the static initialize modification back to 0xffff .. sorry about that, memory is rusty =)
 
Upvote 0
Junior Spellweaver
Joined
Jan 29, 2015
Messages
118
Reaction score
5
Thank you for your help. I caught an exception while executing your tool. What caused it?
0618-01 - How to solve the problem that the equipment ID greater than 65535 is not visible - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Upvote 0
Junior Spellweaver
Joined
Jan 29, 2015
Messages
118
Reaction score
5
I know what the problem is. I tried to use your tool on the v458 GS file, which caused some exceptions. I realized that there might be a difference between v458 and v496, so I tried again with the v496 GS file and it worked. V458 is a version circulated by Chinese players. I compare the GS files, and the difference of their last modification time is one day.
 
Upvote 0
Junior Spellweaver
Joined
Jan 29, 2015
Messages
118
Reaction score
5
@Fyyre
It seems that this problem has nothing to do with the server. I tested using your method to modify gs. The GS modification was successful, but found that this method can not solve this problem. The client still can't see the equipment and time with ID greater than 65535. There is no big problem for the server to use items with ID greater than 65535, and attributes are normally added to the role. This seems to be a client problem.
 
Upvote 0
Newbie Spellweaver
Joined
Nov 11, 2015
Messages
36
Reaction score
14
After reverse engineering the client source code that was leaked by loko awhile back for version 000480x this problem lies within SMElementClient Network Protocol gamedatasend under this code here

bool SizePolicy(size_t size) const { return size <= 65535; }

if you can successfully hex edit the game.exe client file to allow this to be higher (havent done it myself yet, only identified it)
you can in theory fix this, this network protocol is what reads the elements.data ID's and other data, setting this to value 99999 would fix the problem entirely, just make sure the gs binary is also the same to prevent further issues

for same sex marriage you must identify this code here

unsigned long CCheckGender::Handle(const ATaskTempl* pTempl, TaskInterface* pTask)
{
bool bMale = pTask->IsMale(); if (pTempl->m_ulGender == TASK_GENDER_MALE && !bMale
|| pTempl->m_ulGender == TASK_GENDER_FEMALE && bMale)
return TASK_PREREQU_FAIL_WRONG_GENDER; return 0;
}

and disable the gender check in this file under TaskPremise, i have made the modifications to the server side and with developer client this works as the gender check is ignored with dev client

i hope this helps some people
 
Upvote 0
Back
Top