-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Underlords GC messages (#697)
* Update Protobufs submodule to pull in Underlords protos. * Generate Underlords proto classes. * Add Underlords specializations to NHA2. * Add GC ConnectionStatus msg type overrides to other games. * Add missing NHA2 project change for added Underlords specialization files.
- Loading branch information
Showing
21 changed files
with
31,318 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...etHookAnalyzer2/Specializations/Underlords/UnderlordsSOCacheSubscribedGCSpecialization.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using ProtoBuf; | ||
using ProtoBuf.Meta; | ||
using SteamKit2.GC.Underlords.Internal; | ||
|
||
namespace NetHookAnalyzer2.Specializations | ||
{ | ||
class UnderlordsCacheSubscribedGCSpecialization : IGameCoordinatorSpecialization | ||
{ | ||
public IEnumerable<KeyValuePair<string, object>> GetExtraObjects(object body, uint appID) | ||
{ | ||
if (appID != WellKnownAppIDs.Underlords) | ||
{ | ||
yield break; | ||
} | ||
|
||
var cacheSubscribed = body as CMsgSOCacheSubscribed; | ||
if (cacheSubscribed == null) | ||
{ | ||
yield break; | ||
} | ||
|
||
foreach (var bucket in cacheSubscribed.objects) | ||
{ | ||
int typeId = bucket.type_id; | ||
foreach (var singleObject in bucket.object_data) | ||
{ | ||
var extraNode = ReadExtraObject(singleObject, typeId); | ||
if (extraNode != null) | ||
{ | ||
yield return new KeyValuePair<string, object>(string.Format("SO ({0})", extraNode.GetType().Name), extraNode); | ||
} | ||
} | ||
} | ||
} | ||
|
||
object ReadExtraObject(byte[] sharedObject, int typeId) | ||
{ | ||
try | ||
{ | ||
using (var ms = new MemoryStream(sharedObject)) | ||
{ | ||
Type t; | ||
if (UnderlordsSOHelper.SOTypes.TryGetValue(typeId, out t)) | ||
{ | ||
return RuntimeTypeModel.Default.Deserialize(ms, null, t); | ||
} | ||
} | ||
} | ||
catch (ProtoException ex) | ||
{ | ||
return "Error parsing SO data: " + ex.Message; | ||
} | ||
catch (EndOfStreamException ex) | ||
{ | ||
return "Error parsing SO data: " + ex.Message; | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
Resources/NetHookAnalyzer2/NetHookAnalyzer2/Specializations/Underlords/UnderlordsSOHelper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using SteamKit2.GC.Underlords.Internal; | ||
|
||
namespace NetHookAnalyzer2.Specializations | ||
{ | ||
static class UnderlordsSOHelper | ||
{ | ||
public static Dictionary<int, Type> SOTypes = new Dictionary<int, Type>() | ||
{ | ||
{1, typeof(CSOEconItem)}, | ||
{3, typeof(CSOEconClaimCode)}, | ||
{5, typeof(CSOItemRecipe)}, | ||
{7, typeof(CSOEconGameAccountClient)}, | ||
{38, typeof(CSOEconItemDropRateBonus)}, | ||
{39, typeof(CSOEconItemLeagueViewPass)}, | ||
{40, typeof(CSOEconItemEventTicket)}, | ||
{42, typeof(CSOEconItemTournamentPassport)}, | ||
|
||
{101, typeof(CSODACLobby)}, | ||
{102, typeof(CSODACServerDynamicLobby)}, | ||
{103, typeof(CSOGameAccountClient)}, | ||
{104, typeof(CSODACParty)}, | ||
{105, typeof(CSODACServerStaticLobby)}, | ||
}; | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
...etHookAnalyzer2/Specializations/Underlords/UnderlordsSOMultipleObjectsGCSpecialization.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using ProtoBuf; | ||
using ProtoBuf.Meta; | ||
using SteamKit2.GC.Underlords.Internal; | ||
|
||
namespace NetHookAnalyzer2.Specializations | ||
{ | ||
class UnderlordsSOMultipleObjectsGCSpecialization : IGameCoordinatorSpecialization | ||
{ | ||
public IEnumerable<KeyValuePair<string, object>> GetExtraObjects(object body, uint appID) | ||
{ | ||
if (appID != WellKnownAppIDs.Underlords) | ||
{ | ||
yield break; | ||
} | ||
|
||
var updateMultiple = body as CMsgSOMultipleObjects; | ||
if (updateMultiple == null) | ||
{ | ||
yield break; | ||
} | ||
|
||
foreach(var singleObject in updateMultiple.objects_added) | ||
{ | ||
var extraNode = ReadExtraObject(singleObject); | ||
if (extraNode != null) | ||
{ | ||
yield return new KeyValuePair<string, object>(string.Format("New SO ({0})", extraNode.GetType().Name), extraNode); | ||
} | ||
} | ||
|
||
foreach (var singleObject in updateMultiple.objects_modified) | ||
{ | ||
var extraNode = ReadExtraObject(singleObject); | ||
if (extraNode != null) | ||
{ | ||
yield return new KeyValuePair<string, object>(string.Format("Modified SO ({0})", extraNode.GetType().Name), extraNode); | ||
} | ||
} | ||
|
||
foreach (var singleObject in updateMultiple.objects_removed) | ||
{ | ||
var extraNode = ReadExtraObject(singleObject); | ||
if (extraNode != null) | ||
{ | ||
yield return new KeyValuePair<string, object>(string.Format("Removed SO ({0})", extraNode.GetType().Name), extraNode); | ||
} | ||
} | ||
} | ||
|
||
object ReadExtraObject(CMsgSOMultipleObjects.SingleObject sharedObject) | ||
{ | ||
try | ||
{ | ||
using (var ms = new MemoryStream(sharedObject.object_data)) | ||
{ | ||
Type t; | ||
if (UnderlordsSOHelper.SOTypes.TryGetValue(sharedObject.type_id, out t)) | ||
{ | ||
return RuntimeTypeModel.Default.Deserialize(ms, null, t); | ||
} | ||
} | ||
} | ||
catch (ProtoException ex) | ||
{ | ||
return "Error parsing SO data: " + ex.Message; | ||
} | ||
catch (EndOfStreamException ex) | ||
{ | ||
return "Error parsing SO data: " + ex.Message; | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...2/NetHookAnalyzer2/Specializations/Underlords/UnderlordsSOSingleObjectGCSpecialization.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using ProtoBuf; | ||
using ProtoBuf.Meta; | ||
using SteamKit2.GC.Underlords.Internal; | ||
|
||
namespace NetHookAnalyzer2.Specializations | ||
{ | ||
class UnderlordsSOSingleObjectGCSpecialization : IGameCoordinatorSpecialization | ||
{ | ||
public IEnumerable<KeyValuePair<string, object>> GetExtraObjects(object body, uint appID) | ||
{ | ||
if (appID != WellKnownAppIDs.Underlords) | ||
{ | ||
yield break; | ||
} | ||
|
||
var updateSingle = body as CMsgSOSingleObject; | ||
if (updateSingle == null) | ||
{ | ||
yield break; | ||
} | ||
|
||
var extraNode = ReadExtraObject(updateSingle); | ||
if (extraNode != null) | ||
{ | ||
yield return new KeyValuePair<string, object>(string.Format("SO ({0})", extraNode.GetType().Name), extraNode); | ||
} | ||
} | ||
|
||
object ReadExtraObject(CMsgSOSingleObject sharedObject) | ||
{ | ||
try | ||
{ | ||
using (var ms = new MemoryStream(sharedObject.object_data)) | ||
{ | ||
Type t; | ||
if (UnderlordsSOHelper.SOTypes.TryGetValue(sharedObject.type_id, out t)) | ||
{ | ||
return RuntimeTypeModel.Default.Deserialize(ms, null, t); | ||
} | ||
} | ||
} | ||
catch (ProtoException ex) | ||
{ | ||
return "Error parsing SO data: " + ex.Message; | ||
} | ||
catch (EndOfStreamException ex) | ||
{ | ||
return "Error parsing SO data: " + ex.Message; | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.