Xbox support

This commit is contained in:
linmeideli committed 2026-10-18 08:54:27 +08:00
1 parent 8ea0dc98e9
commit 846ccb19e3
3 files changed
+27 -3

No files matched your search

@@ -17,7 +17,7 @@ namespace Empostor.Api.Innersloth
Platform = (Platforms)reader.Tag;
PlatformName = reader.ReadString();
XboxPlatformId = Platform == Platforms.Xbox ? reader.ReadUInt64() : null;
XboxPlatformId = Platform is Platforms.StandaloneWin10 or Platforms.Xbox ? reader.ReadUInt64() : null;
PsnPlatformId = Platform == Platforms.Playstation ? reader.ReadUInt64() : null;
}
@@ -35,8 +35,9 @@ namespace Empostor.Api.Innersloth
writer.Write(PlatformName);
switch (Platform)
{
case Platforms.StandaloneWin10:
case Platforms.Xbox:
writer.Write(XboxPlatformId ?? throw new NullReferenceException($"{nameof(XboxPlatformId)} shouldn't be null when {nameof(Platform)} is Xbox"));
writer.Write(XboxPlatformId ?? throw new NullReferenceException($"{nameof(XboxPlatformId)} shouldn't be null when {nameof(Platform)} is {Platform}"));
break;
case Platforms.Playstation:
writer.Write(PsnPlatformId ?? throw new NullReferenceException($"{nameof(PsnPlatformId)} shouldn't be null when {nameof(Platform)} is Playstation"));
+18 -1
View File
@@ -1,4 +1,6 @@
namespace Empostor.Server.Net.Inner
using System.Collections.Generic;
namespace Empostor.Server.Net.Inner
{
public static class GameDataTag
{
@@ -11,5 +13,20 @@
public const byte ChangeSettingsFlag = 8;
public const byte ConsoleDeclareClientPlatformFlag = 205;
public const byte PS4RoomRequest = 206;
public const byte XboxDeclareXuid = 207;
public static readonly HashSet<byte> ValidTags = new()
{
DataFlag,
RpcFlag,
SpawnFlag,
DespawnFlag,
SceneChangeFlag,
ReadyFlag,
ChangeSettingsFlag,
ConsoleDeclareClientPlatformFlag,
PS4RoomRequest,
XboxDeclareXuid,
};
}
}
@@ -383,6 +383,12 @@ namespace Empostor.Server.Net.State
default:
{
if (GameDataTag.ValidTags.Contains(reader.Tag))
{
_logger.LogDebug("{Code} - Get vanilla GameData tag {Tag} that isn't handled.", Code, reader.Tag);
return GameDataResult.Continue;
}
_logger.LogWarning("{Code} - Bad GameData tag {Tag}", Code, reader.Tag);
if (await sender.Client.ReportCheatAsync(