Skip to content

Commit c3e65a5

Browse files
committed
Tentative fix for 2020-11-25 update
1 parent fb9dbf4 commit c3e65a5

5 files changed

Lines changed: 29 additions & 24 deletions

File tree

‎Torch.Server/Managers/MultiplayerManagerDedicated.cs‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ public override void Detach()
156156

157157

158158
#pragma warning disable 649
159-
[ReflectedEventReplace(typeof(MySteamGameServer), nameof(MySteamGameServer.ValidateAuthTicketResponse),
159+
[ReflectedEventReplace("VRage.Steam.MySteamGameServer, VRage.Steam", "ValidateAuthTicketResponse",
160160
typeof(MyDedicatedServerBase), "GameServer_ValidateAuthTicketResponse")]
161161
private static Func<ReflectedEventReplacer> _gameServerValidateAuthTicketFactory;
162162

163-
[ReflectedEventReplace(typeof(MySteamGameServer), nameof(MySteamGameServer.UserGroupStatusResponse),
163+
[ReflectedEventReplace("VRage.Steam.MySteamGameServer, VRage.Steam", "UserGroupStatusResponse",
164164
typeof(MyDedicatedServerBase), "GameServer_UserGroupStatus")]
165165
private static Func<ReflectedEventReplacer> _gameServerUserGroupStatusFactory;
166166

@@ -216,15 +216,16 @@ public WaitingForGroup(ulong id, JoinResult response, ulong owner)
216216
//Largely copied from SE
217217
private void ValidateAuthTicketResponse(ulong steamId, JoinResult response, ulong steamOwner)
218218
{
219-
var state = new MyP2PSessionState();
220-
MySteamServiceWrapper.Static.Peer2Peer.GetSessionState(steamId, ref state);
221-
var ip = new IPAddress(BitConverter.GetBytes(state.RemoteIP).Reverse().ToArray());
219+
// TODO: Find another way to do this
220+
//var state = new MyP2PSessionState();
221+
//MySteamServiceWrapper.Static.Peer2Peer.GetSessionState(steamId, ref state);
222+
//var ip = new IPAddress(BitConverter.GetBytes(state.RemoteIP).Reverse().ToArray());
222223

223224
Torch.CurrentSession.KeenSession.PromotedUsers.TryGetValue(steamId, out MyPromoteLevel promoteLevel);
224225

225226
_log.Debug($"ValidateAuthTicketResponse(user={steamId}, response={response}, owner={steamOwner}, permissions={promoteLevel})");
226227

227-
_log.Info($"Connection attempt by {steamId} from {ip}");
228+
_log.Info($"Connection attempt by {steamId}");
228229

229230
if (IsProfiling(steamId))
230231
{

‎Torch.Server/ViewModels/CheckpointViewModel.cs‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,6 @@ public static implicit operator MyObjectBuilder_Checkpoint(CheckpointViewModel m
115115

116116
public DateTime InGameTime { get => _checkpoint.InGameTime; set => SetValue(ref _checkpoint.InGameTime, value); }
117117

118-
public MyObjectBuilder_SessionComponentMission MissionTriggers { get => _checkpoint.MissionTriggers; set => SetValue(ref _checkpoint.MissionTriggers, value); }
119-
120-
public string Briefing { get => _checkpoint.Briefing; set => SetValue(ref _checkpoint.Briefing, value); }
121-
122-
public string BriefingVideo { get => _checkpoint.BriefingVideo; set => SetValue(ref _checkpoint.BriefingVideo, value); }
123-
124-
public string CustomLoadingScreenImage { get => _checkpoint.CustomLoadingScreenImage; set => SetValue(ref _checkpoint.BriefingVideo, value); }
125-
126118
public string CustomLoadingScreenText { get => _checkpoint.CustomLoadingScreenText; set => SetValue(ref _checkpoint.CustomLoadingScreenText, value); }
127119

128120
public string CustomSkybox { get => _checkpoint.CustomSkybox; set => SetValue(ref _checkpoint.CustomSkybox, value); }

‎Torch/Commands/TorchCommands.cs‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@ public class TorchCommands : CommandModule
3737
[Permission(MyPromoteLevel.None)]
3838
public void GetIP(ulong steamId = 0)
3939
{
40-
if (steamId == 0)
41-
steamId = Context.Player.SteamUserId;
42-
43-
VRage.GameServices.MyP2PSessionState statehack = new VRage.GameServices.MyP2PSessionState();
44-
MySteamServiceWrapper.Static.Peer2Peer.GetSessionState(steamId, ref statehack);
45-
var ip = new IPAddress(BitConverter.GetBytes(statehack.RemoteIP).Reverse().ToArray());
46-
Context.Respond($"Your IP is {ip}");
40+
Context.Respond("Command no longer working!");
41+
//if (steamId == 0)
42+
// steamId = Context.Player.SteamUserId;
43+
//
44+
//VRage.GameServices.MyP2PSessionState statehack = new VRage.GameServices.MyP2PSessionState();
45+
//MySteamServiceWrapper.Static.Peer2Peer.GetSessionState(steamId, ref statehack);
46+
//var ip = new IPAddress(BitConverter.GetBytes(statehack.RemoteIP).Reverse().ToArray());
47+
//Context.Respond($"Your IP is {ip}");
4748
}
4849

4950
[Command("help", "Displays help for a command")]

‎Torch/Utils/Reflected/ReflectedEventReplaceAttribute.cs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,14 @@ public ReflectedEventReplaceAttribute(Type eventDeclaringType, string eventName,
4747
TargetDeclaringType = targetDeclaringType;
4848
TargetName = targetName;
4949
}
50+
51+
public ReflectedEventReplaceAttribute(string eventDeclaringType, string eventName, Type targetDeclaringType,
52+
string targetName)
53+
{
54+
EventDeclaringType = Type.GetType(eventDeclaringType);
55+
EventName = eventName;
56+
TargetDeclaringType = targetDeclaringType;
57+
TargetName = targetName;
58+
}
5059
}
5160
}

‎Torch/VRageGame.cs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,15 @@ private void Run()
135135

136136
private void Create()
137137
{
138-
bool dedicated = Sandbox.Engine.Platform.Game.IsDedicated;
138+
bool dedicated = true;
139139
Environment.SetEnvironmentVariable("SteamAppId", _appSteamId.ToString());
140-
var service = MySteamServiceWrapper.Init(dedicated, _appSteamId);
140+
var service = MySteamGameService.Create(true, _appSteamId);
141141
MyServiceManager.Instance.AddService<IMyGameService>(service);
142142
var serviceInstance = MySteamUgcService.Create(_appSteamId, service);
143143
MyServiceManager.Instance.AddService<IMyUGCService>(serviceInstance);
144-
if (dedicated && !MyGameService.HasGameServer)
144+
MyServiceManager.Instance.AddService(new MyNullMicrophone());
145+
MySteamGameService.InitNetworking(dedicated, service);
146+
if (!MyGameService.HasGameServer)
145147
{
146148
_log.Warn("Steam service is not running! Please reinstall dedicated server.");
147149
return;

0 commit comments

Comments
 (0)