UOKR research

dagid4

Member
Sep 27, 2015
10
0
28
Hello,

is there somebody working on Kingdom Reborn client support? I'm trying to make it work with old RunUO 1.0 and willing to share some info.

Currently i have got it partially working. I can connect and move, lot of information about connection mechanism can be found here: https://github.com/LeonG-ZA/JustUO-KR.

The huge problem is Gump support, it is described here: http://ruosi.org/publ/1-1-0-2 I have an idea how tu use current gump system from RunUO without rewriting it. I think, there can be a way with encapsulating gump strings into gump label and then parse it from LUA scripts in client. UOKR uses LuaPlus (http://wwhiz.com/LuaPlus/LuaPlus.html) engine, all scripts are packed in Interface.uop and can be replaced with Mythic Package Editor (http://www.runuo.com/community/threads/editing-uop-files-for-the-enhanced-client.103469/). I have succesfully sent gumps strings to client, now i'm trying to wirte a parser:Untitled.png

Anyway, if there is somebody with some new info about getting gumps work, i would be glad to read it. Thanks :)
 

Dexter_Lexia

Moderator
ServUO Developer
Jul 3, 2014
3,955
169
43
Shard Name
Alexandria
Donate
Donate money to this user
I've diddle'd around with KR a bit, and I didn't notice anything out of the ordinary with the gumps. The exception to that is the fact that you cannot put elements on top of a button.
 

dagid4

Member
Sep 27, 2015
10
0
28
Was it truly KR? Beacuse there is difference between KR client and Enhanced client. Enhanced client uses classical UO gump structure, so there is no need to change anything.
 

Dexter_Lexia

Moderator
ServUO Developer
Jul 3, 2014
3,955
169
43
Shard Name
Alexandria
Donate
Donate money to this user
Good question. Which is still supported by broadsword?
 

dagid4

Member
Sep 27, 2015
10
0
28
KR client is discountinued since 2009 i think, but Enhanced client may still work.
 

Dexter_Lexia

Moderator
ServUO Developer
Jul 3, 2014
3,955
169
43
Shard Name
Alexandria
Donate
Donate money to this user
Oh ok, I don't think anyone is still dicking around with KR then.
 

dagid4

Member
Sep 27, 2015
10
0
28
From what i know Enhanced client uses old CC graphic, but KR client uses it's own high resolution textures. This is why i think that KR is better and can bring new players. New players won't start playing a game with outdated graphics. You can run KR on Windows 10 with 4k resolution and it still looks good.
 

dagid4

Member
Sep 27, 2015
10
0
28
I've decided to start from the beginning... so here is the first part:

How to connect with UOKR (2.58.0.6) client
First, we have to somehow change the IP of server. There is no login.cfg. We can find out what address the client is trying to connect:
ip.png
Now we can look into client.exe and try to find this IP:
login.png
As we can see, there is a routine which load the IP address and port. We can change it in HEX editor:
login-hex.png
For example localhost, ip: 127.0.0.1 => 7F 00 00 01, port: 2593 => 0A21. Now we can connect.

How to login with UOKR (2.58.0.6) client
If you try to login to RunUO or ServUO you will get error, because the connection is encrypted. Login mechanism should be like this:
  1. Client -> 0xEF: Login Server Seed
  2. Client -> 0x80: Account Login
  3. Server -> 0xA8: Account Login Ack
  4. Client -> 0xD9: Hardware Info
  5. Client -> 0xA0: Play Server
  6. Server -> 0x8C: Play Server Ack
But, you can only get first packet:
seed.png

There are some useful info in this packet, you can see:
  • seed: C0 A8 11 01 => 192.168.17.1 (client LAN address)
  • major version: 42
  • minor version: 37
  • patch version: 34
  • build version: 0
The encryption is based on seed, it uses following keys:
Code:
key0 = ( ( ( ~seed ) ^ 0x00001357 ) << 16 ) | ( ( seed ^ 0xffffaaaa ) & 0x0000ffff );
key1 = ( ( seed ^ 0x43210000 ) >> 16 ) | ( ( ( ~seed ) ^ 0xabcdffff ) & 0xffff0000 );
If we look into client, we can find the encryption routine, which is using these keys in [esi+4] and [esi+8]:
keys.png

There are also client keys, which are constants here, but they can be calculated from client version. With the knowledge of client keys, we can simplify this routine to:
Code:
public void Decrypt( ref byte[] buffer int length )
{
  for( int i = 0; i < length; i++ )
  {
    buffer[i] = (byte)( key0 ^ buffer[i] );
    uint oldKey0 = key0;
    uint oldKey1 = key1;
    key0 = ( ( oldKey0 >> 1 ) | ( oldKey1 << 31 ) ) ^ clientKey1;
    key1 = ( ( ( ( ( oldKey1 >> 1 ) | ( oldKey0 << 31 ) ) ^ clientKey0 ) >> 1 ) | ( oldKey0 << 31 ) ) ^ clientKey0;
  }
}
Now we can decrypt packets and complete the login process. Next time I will focus to game encryption.
 

Khundar

New Member
Mar 23, 2015
1
0
34
Getting UOKR to work is my dream for years.

I can't believe we can't put high rez textures back in EC client. It's so much more beautiful.

I tried to make KR work with Sphere (Sphere is all I know...) without success.

I found RunUO and JustUO with basic KR support.

Indeed, you have to rework all the gumps to match lua to runuo.
I can't code RunUO so I could not make any progress.

I wish I had more time to help and learn how to make these gumps work one after the other...
[doublepost=1505414180][/doublepost]Sorry for double posting, couldn't edit.

RunUO Russian Edition (Wyatt) managed to get KR fully working : http://www.infinitetravel.ru/shard/features/

Couldn't find it anywhere.
[doublepost=1505414500][/doublepost]Lots of talks about KR at uodev.de too

https://uodev.de/viewforum.php?f=66&sid=2553275d5948744f4899574206107119
 

dagid4

Member
Sep 27, 2015
10
0
28
After sometime, I'm back working on game encryption. I have followed instructions from https://www.uodev.de/viewtopic.php?f=66&t=5330&sid=88cdbfcb5ad4c57eb495435fe1765342 and result is strange. Like if I try client 10 times, it successfully decrypt at least one time, but it's totally random.

I have coded the decryption in C# with BouncyCastle. And also tried the Java decryption example from site above. But they all have the same strange problem. At least they give same result.

If there is anybody interesting in getting decryption work. I will put here my source code for testing.
[doublepost=1542544934][/doublepost]Here is the source code.
 

Attachments

zerodowned

Moderator
ServUO Developer
Jun 28, 2014
1,770
221
I've diddle'd around with KR a bit, and I didn't notice anything out of the ordinary with the gumps. The exception to that is the fact that you cannot put elements on top of a button.
thats also true with moddern EC
makes me think that the base framework of EC is just copied from KR
 
  • Like
Reactions: Dexter_Lexia

Nikael

New Member
Jul 5, 2019
1
0
Hey guys! I am sorry because my question is a little bit offtopic. Is it possible to bring back KR graphics in to EC client?

There are two packed files in a folder named: "Texture.uop" and "LegacyTexture.uop".
Just for test i drag&drop "Texture.uop" out of game folder, and start the game... Turns out that all terrain tiles became pinky in colour. But buildings and trees were ok.
Then i bring that file back and did the same with "LegacyTexture.uop". It turns opposite. Terrrain were ok, buildings and other things became pink.

Using Mythic Package Editor i unpacked those two files in a different folders, and it turns out that "Texture.uop" still has all sprites from original KR client! ( i thought that i need to download KR client to get them...) And those files are named exactly like classic client sprites in "LegacyTexture.uop"!

In other 2D game Copy-Paste way of thinking could solve the problem. But i guess not in UO. I tried to replace files in a package using same Mythic Package Editor, but fail.

I was thinking, maybe there is a file of loading files somewhere in a client, which can be tweaked, to upload KR tiles and spites from "Texture.uop" entirely?

And i want to apologise for my poor english, and complete lack of understanding in scripting.
 

PyrO

Well-Known Member
Jan 27, 2015
1,172
95
Hmm, the ids itself cant be changed unless I guess you would change them all in the map files? Not sure

What definitly should work is when you copy the KR client graphics to the ids of the EC version