Skip to content

Commit 157eb2b

Browse files
committed
Add Deadlock protos
1 parent f5c8254 commit 157eb2b

21 files changed

+25995
-2
lines changed

Resources/NetHookAnalyzer2/NetHookAnalyzer2/EMsgExtensions.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using CSGO = SteamKit2.GC.CSGO.Internal;
77
using Dota = SteamKit2.GC.Dota.Internal;
88
using TF2 = SteamKit2.GC.TF2.Internal;
9+
using Deadlock = SteamKit2.GC.Deadlock.Internal;
910

1011
namespace NetHookAnalyzer2
1112
{
@@ -54,7 +55,15 @@ static IEnumerable<Type> GetGCEMsgEnums(uint appId)
5455
yield return typeof(CSGO.EGCSystemMsg);
5556
yield return typeof(CSGO.EGCItemMsg);
5657
yield return typeof(CSGO.EGCBaseClientMsg);
57-
break;
58+
break;
59+
60+
case WellKnownAppIDs.Deadlock:
61+
yield return typeof(Deadlock.EGCCitadelClientMessages);
62+
yield return typeof(Deadlock.EGCBaseMsg);
63+
yield return typeof(Deadlock.ESOMsg);
64+
yield return typeof(Deadlock.EGCItemMsg);
65+
yield return typeof(Deadlock.EGCBaseClientMsg);
66+
break;
5867
}
5968
}
6069
}

Resources/NetHookAnalyzer2/NetHookAnalyzer2/MainForm.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,18 @@ static ISpecialization[] LoadMessageObjectSpecializations()
4848
new CSGOCacheSubscribedGCSpecialization(),
4949
new CSGOSOMultipleObjectsGCSpecialization(),
5050
new CSGOSOSingleObjectGCSpecialization(),
51+
5152
new Dota2CacheSubscribedGCSpecialization(),
5253
new Dota2SOSingleObjectGCSpecialization(),
5354
new Dota2SOMultipleObjectsGCSpecialization(),
55+
5456
new TF2CacheSubscribedGCSpecialization(),
5557
new TF2SOMultipleObjectsGCSpecialization(),
5658
new TF2SOSingleObjectGCSpecialization(),
59+
60+
new DeadlockCacheSubscribedGCSpecialization(),
61+
new DeadlockSOMultipleObjectsGCSpecialization(),
62+
new DeadlockSOSingleObjectGCSpecialization(),
5763
]
5864
}
5965
];

Resources/NetHookAnalyzer2/NetHookAnalyzer2/MessageTypeFinder.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@ static IEnumerable<string> GetPossibleGCTypePrefixes(uint appid)
128128

129129
case WellKnownAppIDs.CounterStrike2:
130130
yield return "SteamKit2.GC.CSGO.Internal.CMsg";
131-
break;
131+
break;
132+
133+
case WellKnownAppIDs.Deadlock:
134+
yield return "SteamKit2.GC.Deadlock.Internal.CMsg";
135+
break;
132136
}
133137
}
134138
}

Resources/NetHookAnalyzer2/NetHookAnalyzer2/MessageTypeOverrides.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using CSGO = SteamKit2.GC.CSGO.Internal;
77
using Dota = SteamKit2.GC.Dota.Internal;
88
using TF2 = SteamKit2.GC.TF2.Internal;
9+
using Deadlock = SteamKit2.GC.Deadlock.Internal;
910

1011
namespace NetHookAnalyzer2
1112
{
@@ -79,6 +80,20 @@ static class MessageTypeOverrides
7980
[(uint)CSGO.ESOMsg.k_ESOMsg_Update] = typeof(CSGO.CMsgSOSingleObject),
8081
[(uint)CSGO.ESOMsg.k_ESOMsg_UpdateMultiple] = typeof(CSGO.CMsgSOMultipleObjects),
8182
},
83+
[WellKnownAppIDs.Deadlock] = new Dictionary<uint, Type>
84+
{
85+
[(uint)Deadlock.EGCBaseClientMsg.k_EMsgGCClientHello] = typeof(Deadlock.CMsgClientHello),
86+
[(uint)Deadlock.EGCBaseClientMsg.k_EMsgGCClientWelcome] = typeof(Deadlock.CMsgClientWelcome),
87+
[(uint)Deadlock.EGCBaseClientMsg.k_EMsgGCServerHello] = typeof(Deadlock.CMsgClientHello),
88+
[(uint)Deadlock.EGCBaseClientMsg.k_EMsgGCServerWelcome] = typeof(Deadlock.CMsgClientWelcome),
89+
[(uint)Deadlock.EGCBaseClientMsg.k_EMsgGCClientConnectionStatus] = typeof(Deadlock.CMsgConnectionStatus),
90+
[(uint)Deadlock.EGCBaseClientMsg.k_EMsgGCServerConnectionStatus] = typeof(Deadlock.CMsgConnectionStatus),
91+
92+
[(uint)Deadlock.ESOMsg.k_ESOMsg_Create] = typeof(Deadlock.CMsgSOSingleObject),
93+
[(uint)Deadlock.ESOMsg.k_ESOMsg_Destroy] = typeof(Deadlock.CMsgSOSingleObject),
94+
[(uint)Deadlock.ESOMsg.k_ESOMsg_Update] = typeof(Deadlock.CMsgSOSingleObject),
95+
[(uint)Deadlock.ESOMsg.k_ESOMsg_UpdateMultiple] = typeof(Deadlock.CMsgSOMultipleObjects),
96+
},
8297
};
8398
}
8499
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using ProtoBuf;
5+
using ProtoBuf.Meta;
6+
using SteamKit2.GC.Deadlock.Internal;
7+
8+
namespace NetHookAnalyzer2.Specializations
9+
{
10+
class DeadlockSOSingleObjectGCSpecialization : IGameCoordinatorSpecialization
11+
{
12+
public IEnumerable<KeyValuePair<string, object>> GetExtraObjects(object body, uint appID)
13+
{
14+
if (appID != WellKnownAppIDs.Deadlock)
15+
{
16+
yield break;
17+
}
18+
19+
var updateSingle = body as CMsgSOSingleObject;
20+
if (updateSingle == null)
21+
{
22+
yield break;
23+
}
24+
25+
var extraNode = ReadExtraObject(updateSingle);
26+
if (extraNode != null)
27+
{
28+
yield return new KeyValuePair<string, object>(string.Format("SO ({0})", extraNode.GetType().Name), extraNode);
29+
}
30+
}
31+
32+
static object ReadExtraObject(CMsgSOSingleObject sharedObject)
33+
{
34+
try
35+
{
36+
using var ms = new MemoryStream( sharedObject.object_data );
37+
if ( DeadlockSOHelper.SOTypes.TryGetValue( sharedObject.type_id, out var t ) )
38+
{
39+
return RuntimeTypeModel.Default.Deserialize( ms, null, t );
40+
}
41+
}
42+
catch (ProtoException ex)
43+
{
44+
return "Error parsing SO data: " + ex.Message;
45+
}
46+
catch (EndOfStreamException ex)
47+
{
48+
return "Error parsing SO data: " + ex.Message;
49+
}
50+
51+
return null;
52+
}
53+
}
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using ProtoBuf;
5+
using ProtoBuf.Meta;
6+
using SteamKit2.GC.Deadlock.Internal;
7+
8+
namespace NetHookAnalyzer2.Specializations
9+
{
10+
class DeadlockCacheSubscribedGCSpecialization : IGameCoordinatorSpecialization
11+
{
12+
public IEnumerable<KeyValuePair<string, object>> GetExtraObjects(object body, uint appID)
13+
{
14+
if (appID != WellKnownAppIDs.Deadlock)
15+
{
16+
yield break;
17+
}
18+
19+
var cacheSubscribed = body as CMsgSOCacheSubscribed;
20+
if (cacheSubscribed == null)
21+
{
22+
yield break;
23+
}
24+
25+
foreach (var bucket in cacheSubscribed.objects)
26+
{
27+
int typeId = bucket.type_id;
28+
foreach (var singleObject in bucket.object_data)
29+
{
30+
var extraNode = ReadExtraObject(singleObject, typeId);
31+
if (extraNode != null)
32+
{
33+
yield return new KeyValuePair<string, object>(string.Format("SO ({0})", extraNode.GetType().Name), extraNode);
34+
}
35+
}
36+
}
37+
}
38+
39+
static object ReadExtraObject(byte[] sharedObject, int typeId)
40+
{
41+
try
42+
{
43+
using var ms = new MemoryStream( sharedObject );
44+
if ( DeadlockSOHelper.SOTypes.TryGetValue( typeId, out var t ) )
45+
{
46+
return RuntimeTypeModel.Default.Deserialize( ms, null, t );
47+
}
48+
}
49+
catch (ProtoException ex)
50+
{
51+
return "Error parsing SO data: " + ex.Message;
52+
}
53+
catch (EndOfStreamException ex)
54+
{
55+
return "Error parsing SO data: " + ex.Message;
56+
}
57+
58+
return null;
59+
}
60+
}
61+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using SteamKit2.GC.Deadlock.Internal;
4+
5+
namespace NetHookAnalyzer2.Specializations
6+
{
7+
static class DeadlockSOHelper
8+
{
9+
public static Dictionary<int, Type> SOTypes = new()
10+
{
11+
{101, typeof(CSOCitadelLobby)},
12+
{105, typeof(CSOCitadelParty)},
13+
};
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using ProtoBuf;
5+
using ProtoBuf.Meta;
6+
using SteamKit2.GC.Deadlock.Internal;
7+
8+
namespace NetHookAnalyzer2.Specializations
9+
{
10+
class DeadlockSOMultipleObjectsGCSpecialization : IGameCoordinatorSpecialization
11+
{
12+
public IEnumerable<KeyValuePair<string, object>> GetExtraObjects(object body, uint appID)
13+
{
14+
if (appID != WellKnownAppIDs.Deadlock)
15+
{
16+
yield break;
17+
}
18+
19+
var updateMultiple = body as CMsgSOMultipleObjects;
20+
if (updateMultiple == null)
21+
{
22+
yield break;
23+
}
24+
25+
foreach(var singleObject in updateMultiple.objects_added)
26+
{
27+
var extraNode = ReadExtraObject(singleObject);
28+
if (extraNode != null)
29+
{
30+
yield return new KeyValuePair<string, object>(string.Format("New SO ({0})", extraNode.GetType().Name), extraNode);
31+
}
32+
}
33+
34+
foreach (var singleObject in updateMultiple.objects_modified)
35+
{
36+
var extraNode = ReadExtraObject(singleObject);
37+
if (extraNode != null)
38+
{
39+
yield return new KeyValuePair<string, object>(string.Format("Modified SO ({0})", extraNode.GetType().Name), extraNode);
40+
}
41+
}
42+
43+
foreach (var singleObject in updateMultiple.objects_removed)
44+
{
45+
var extraNode = ReadExtraObject(singleObject);
46+
if (extraNode != null)
47+
{
48+
yield return new KeyValuePair<string, object>(string.Format("Removed SO ({0})", extraNode.GetType().Name), extraNode);
49+
}
50+
}
51+
}
52+
53+
static object ReadExtraObject(CMsgSOMultipleObjects.SingleObject sharedObject)
54+
{
55+
try
56+
{
57+
using var ms = new MemoryStream(sharedObject.object_data);
58+
if (DeadlockSOHelper.SOTypes.TryGetValue(sharedObject.type_id, out var t))
59+
{
60+
return RuntimeTypeModel.Default.Deserialize(ms, null, t);
61+
}
62+
}
63+
catch (ProtoException ex)
64+
{
65+
return "Error parsing SO data: " + ex.Message;
66+
}
67+
catch (EndOfStreamException ex)
68+
{
69+
return "Error parsing SO data: " + ex.Message;
70+
}
71+
72+
return null;
73+
}
74+
}
75+
}

Resources/NetHookAnalyzer2/NetHookAnalyzer2/WellKnownAppIDs.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ static class WellKnownAppIDs
55
public const uint CounterStrike2 = 730;
66
public const uint Dota2 = 570;
77
public const uint TeamFortress2 = 440;
8+
public const uint Deadlock = 1422450;
89
}
910
}

Resources/ProtobufGen/protos.csv

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ csgo,engine_gcmessages.proto,GC\CSGO\SteamMsgGCEngine.cs,SteamKit2.GC.CSGO.Inter
7676
csgo,gcsdk_gcmessages.proto,GC\CSGO\SteamMsgGCSDK.cs,SteamKit2.GC.CSGO.Internal
7777
csgo,gcsystemmsgs.proto,GC\CSGO\SteamMsgGCSystem.cs,SteamKit2.GC.CSGO.Internal
7878
csgo,steammessages.proto,GC\CSGO\SteamMsgBase.cs,SteamKit2.GC.CSGO.Internal
79+
deadlock,base_gcmessages.proto,GC\Deadlock\SteamMsgGC.cs,SteamKit2.GC.Deadlock.Internal
80+
deadlock,citadel_gcmessages_client.proto,GC\Deadlock\MsgGCClient.cs,SteamKit2.GC.Deadlock.Internal
81+
deadlock,citadel_gcmessages_common.proto,GC\Deadlock\MsgGCCommon.cs,SteamKit2.GC.Deadlock.Internal
82+
deadlock,citadel_gcmessages_server.proto,GC\Deadlock\MsgGCServer.cs,SteamKit2.GC.Deadlock.Internal
83+
deadlock,econ_gcmessages.proto,GC\Deadlock\SteamMsgGCEcon.cs,SteamKit2.GC.Deadlock.Internal
84+
deadlock,econ_shared_enums.proto,GC\Deadlock\SteamMsgGCEconSharedEnums.cs,SteamKit2.GC.Deadlock.Internal
85+
deadlock,engine_gcmessages.proto,GC\Deadlock\SteamMsgGCEngine.cs,SteamKit2.GC.Deadlock.Internal
86+
deadlock,gcsdk_gcmessages.proto,GC\Deadlock\SteamMsgGCSDK.cs,SteamKit2.GC.Deadlock.Internal
87+
deadlock,gcsystemmsgs.proto,GC\Deadlock\SteamMsgGCSystem.cs,SteamKit2.GC.Deadlock.Internal
88+
deadlock,steammessages_steamlearn.steamworkssdk.proto,GC\Deadlock\SteamMsgSteamLearnSteamworks.cs,SteamKit2.GC.Deadlock.Internal
89+
deadlock,steammessages.proto,GC\Deadlock\SteamMsgBase.cs,SteamKit2.GC.Deadlock.Internal
7990
dota2,base_gcmessages.proto,GC\Dota\SteamMsgGC.cs,SteamKit2.GC.Dota.Internal
8091
dota2,dota_client_enums.proto,GC\Dota\MsgClientEnums.cs,SteamKit2.GC.Dota.Internal
8192
dota2,dota_gcmessages_client.proto,GC\Dota\MsgGCClient.cs,SteamKit2.GC.Dota.Internal

0 commit comments

Comments
 (0)