Decompiled source of Crawlspace2MP v1.0.0
BepInEx/patchers/MultiplayerMod/Crawlspace2MP.Preload.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Microsoft.CodeAnalysis; using Mono.Cecil; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("Crawlspace2MP.Preload")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+04ba420edd24f6ad9427ad739cc11da0d600d4ce")] [assembly: AssemblyProduct("Crawlspace2MP.Preload")] [assembly: AssemblyTitle("Crawlspace2MP.Preload")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Crawlspace2MP { public static class SteamAPIPatcher { public static IEnumerable<string> TargetDLLs { get; } = Array.Empty<string>(); public static void Initialize() { try { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string directoryName2 = Path.GetDirectoryName(Path.GetDirectoryName(directoryName)); Log("SteamAPIPatcher initializing..."); Log("Patcher directory: " + directoryName); Log("Game directory: " + directoryName2); string[] array = new string[2] { "steam_api64.dll", "steam_appid.txt" }; string[] array2 = array; foreach (string text in array2) { string text2 = Path.Combine(directoryName, text); string text3 = Path.Combine(directoryName2, text); if (!File.Exists(text2)) { Log(" " + text + ": Not found in patcher folder, skipping"); continue; } if (File.Exists(text3)) { FileInfo fileInfo = new FileInfo(text2); FileInfo fileInfo2 = new FileInfo(text3); if (fileInfo.Length == fileInfo2.Length) { Log(" " + text + ": Already exists and matches, skipping"); continue; } Log(" " + text + ": Exists but different, updating..."); } try { File.Copy(text2, text3, overwrite: true); Log(" " + text + ": Copied successfully!"); } catch (Exception ex) { Log(" " + text + ": Failed to copy - " + ex.Message); } } Log("SteamAPIPatcher complete!"); } catch (Exception arg) { Log($"SteamAPIPatcher error: {arg}"); } } public static void Patch(AssemblyDefinition assembly) { } private static void Log(string message) { Console.WriteLine("[SteamAPIPatcher] " + message); } } }
BepInEx/plugins/Crawlspace2MP/Crawlspace2MP.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
#define DEBUG using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading.Tasks; using BepInEx; using BepInEx.Logging; using GorillaLocomotion; using HarmonyLib; using Microsoft.CodeAnalysis; using Steamworks; using Steamworks.Data; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.SceneManagement; using UnityEngine.Video; using UnityEngine.XR.Interaction.Toolkit; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("Crawlspace2MP")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+04ba420edd24f6ad9427ad739cc11da0d600d4ce")] [assembly: AssemblyProduct("Crawlspace2MP")] [assembly: AssemblyTitle("Crawlspace2MP")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Crawlspace2MP { public class PacketWriter { private byte[] _buffer; private int _position; public int Length => _position; public PacketWriter(int initialCapacity = 256) { _buffer = new byte[initialCapacity]; _position = 0; } public void Reset() { _position = 0; } public byte[] GetBytes() { byte[] array = new byte[_position]; Array.Copy(_buffer, array, _position); return array; } private void EnsureCapacity(int additionalBytes) { if (_position + additionalBytes > _buffer.Length) { byte[] array = new byte[Math.Max(_buffer.Length * 2, _position + additionalBytes)]; Array.Copy(_buffer, array, _position); _buffer = array; } } public void Put(byte value) { EnsureCapacity(1); _buffer[_position++] = value; } public void Put(bool value) { Put((byte)(value ? 1u : 0u)); } public void Put(int value) { EnsureCapacity(4); _buffer[_position++] = (byte)value; _buffer[_position++] = (byte)(value >> 8); _buffer[_position++] = (byte)(value >> 16); _buffer[_position++] = (byte)(value >> 24); } public void Put(long value) { byte[] bytes = BitConverter.GetBytes(value); EnsureCapacity(8); Array.Copy(bytes, 0, _buffer, _position, 8); _position += 8; } public void Put(float value) { byte[] bytes = BitConverter.GetBytes(value); EnsureCapacity(4); Array.Copy(bytes, 0, _buffer, _position, 4); _position += 4; } public void Put(double value) { byte[] bytes = BitConverter.GetBytes(value); EnsureCapacity(8); Array.Copy(bytes, 0, _buffer, _position, 8); _position += 8; } public void Put(string value) { if (string.IsNullOrEmpty(value)) { Put(0); return; } byte[] bytes = Encoding.UTF8.GetBytes(value); Put(bytes.Length); EnsureCapacity(bytes.Length); Array.Copy(bytes, 0, _buffer, _position, bytes.Length); _position += bytes.Length; } } public class PacketReader { private byte[] _buffer; private int _position; private int _length; public int AvailableBytes => _length - _position; public PacketReader(byte[] data) { _buffer = data; _position = 0; _length = data.Length; } public byte GetByte() { return _buffer[_position++]; } public bool GetBool() { return GetByte() != 0; } public int GetInt() { int result = _buffer[_position] | (_buffer[_position + 1] << 8) | (_buffer[_position + 2] << 16) | (_buffer[_position + 3] << 24); _position += 4; return result; } public long GetLong() { long result = BitConverter.ToInt64(_buffer, _position); _position += 8; return result; } public float GetFloat() { float result = BitConverter.ToSingle(_buffer, _position); _position += 4; return result; } public double GetDouble() { double result = BitConverter.ToDouble(_buffer, _position); _position += 8; return result; } public string GetString() { int @int = GetInt(); if (@int == 0) { return string.Empty; } string @string = Encoding.UTF8.GetString(_buffer, _position, @int); _position += @int; return @string; } } public class PlayerSync { public class RemoteBatteryState { public float Charge; public int LocationID; public bool InBackpack; public bool LeftHolding; public bool RightHolding; } private class PendingPuzzleInit { public bool[] ActiveStates; public int[] PresetIDs; public bool[] CompletedStates; public int[][] BlockStates; public int TotalCompleted; public int RequiredPuzzles; } private const byte PACKET_PLAYER_POSITION = 1; private const byte PACKET_FLASHLIGHT = 2; private const byte PACKET_SCENE_CHANGE = 3; private const byte PACKET_NIGHT_SELECTED = 4; private const byte PACKET_TV_SYNC = 5; private const byte PACKET_PAINTING_SYNC = 6; private const byte PACKET_PAINTING_FLASH = 7; private const byte PACKET_MONSTER_SYNC = 8; private const byte PACKET_JEFF_FLASH = 9; private const byte PACKET_BATTERY_SYNC = 10; private const byte PACKET_PAINTING_ENTITY = 11; private const byte PACKET_PUZZLE_INIT = 12; private const byte PACKET_PUZZLE_COMPLETE = 13; private const byte PACKET_PUZZLE_BLOCK = 14; private const byte PACKET_CLOWN_HONK = 15; private const byte PACKET_VENT_SOUND = 16; private const byte PACKET_CLOWN_STATE = 25; private const byte PACKET_CLOWN_ATTACK = 26; private const byte PACKET_SMILE_TRIGGER = 27; private const byte PACKET_VENT_DOOR = 28; private const byte PACKET_PAINTING_DEATH = 29; private const byte PACKET_END_PROGRESS = 40; private const byte PACKET_INTERACTION_LOCK = 17; private const byte PACKET_EXIT_DOOR_PROGRESS = 18; private const byte PACKET_CRANK_SYNC = 19; private const byte PACKET_DEATH_GHOST = 20; private const byte PACKET_VERSION_CHECK = 21; private const byte PACKET_PING = 22; private const byte PACKET_PONG = 23; private const byte PACKET_HOST_MIGRATION = 24; private const byte PACKET_EAR_COVERING = 41; private Dictionary<int, RemotePlayer> _remotePlayers = new Dictionary<int, RemotePlayer>(); private bool _remotePlayerCoveringEars = false; private Dictionary<int, string> _peerVersions = new Dictionary<int, string>(); private Dictionary<int, float> _peerPings = new Dictionary<int, float>(); private Dictionary<int, float> _pendingPings = new Dictionary<int, float>(); private float _lastPingTime = 0f; private const float PING_INTERVAL = 2f; private Vector3 _levelSpawnPoint = Vector3.zero; private Quaternion _levelSpawnRotation = Quaternion.identity; private bool _spawnPointCaptured = false; private HashSet<int> _connectedPeerIds = new HashSet<int>(); private bool _localIsGhost = false; private bool _pendingGhostTeleport = false; private bool _pendingHomeLoad = false; private string _ghostSceneToReload = null; public static bool IsGhostSceneReload = false; private Player _gorillaPlayer; private MoveTypeController _moveController; private HandControl _handControl; private Camera _mainCamera; private Transform _playerTransform; private Transform _ovrLeftHand; private Transform _ovrRightHand; private Transform _ovrHead; private float _syncInterval = 0.033f; private float _lastSyncTime; private Flashlight _localFlashlight; private FlashlightControl _localFlashlightControl; private bool _lastFlashlightState = false; private string _lastScene = ""; public static bool IsLoadingFromSync = false; private int _lastNightSelected = -1; private VideoPlayer _tvVideoPlayer; private float _lastTvSyncTime = 0f; private float _tvSyncInterval = 5f; private paintingControl _paintingControl; private float _lastPaintingSyncTime = 0f; private float _paintingSyncInterval = 1f; private sparkyBrain _sparky; private jeffBrain _jeff; private SmileBrain _smile; private henryBrain _henry; private mapEnBrain _harold; private clownRandom _clown; private float _lastMonsterSyncTime = 0f; private float _monsterSyncInterval = 0.1f; private bool _hostDiedInLevel = false; private float _lastBatterySyncTime = 0f; private float _batterySyncInterval = 0.1f; private int _lastBatteryLocationID = -999; private bool _lastBatteryInBackpack = false; private float _lastBatteryCharge = -1f; private bool _lastLeftHolding = false; private bool _lastRightHolding = false; private Dictionary<int, RemoteBatteryState> _remoteBatteryStates = new Dictionary<int, RemoteBatteryState>(); private crankControl _crankControl; private float _lastCrankSyncTime = 0f; private float _crankSyncInterval = 0.2f; private float _lastCrankCharge = -1f; private bool _lastCrankHasBattery = false; private static Dictionary<string, int> _interactionLocks = new Dictionary<string, int>(); private static Dictionary<string, float> _lockTimestamps = new Dictionary<string, float>(); private const float LOCK_TIMEOUT = 5f; private float _lastLockCleanupTime = 0f; private HashSet<string> _localActiveLocks = new HashSet<string>(); private float _sceneLoadDelayTimer = 0f; private const float SCENE_LOAD_DELAY = 0.5f; private PuzzleMaster _puzzleMaster; private bool _puzzleInitSent = false; private LeaveDoorControl _leaveDoor; private int _lastDoorLeaveTimer = 0; private float _lastDoorSyncTime = 0f; private PacketWriter _writer = new PacketWriter(1024); private SteamTransport _steam; private bool _recreateRemotePlayersNextFrame = false; private int _updateCount = 0; private int _sendCount = 0; private string _pendingSceneLoad = null; private bool _isReceivingPaintingFlash = false; private bool _isReceivingJeffFlash = false; private Quaternion _lastCrankRotation = Quaternion.identity; private bool _remoteCrankHasBattery = false; private float _lastPuzzleStateSyncTime = 0f; private float _puzzleStateSyncInterval = 2f; private int _lastTotalCompletedPuzzles = -1; private PendingPuzzleInit _pendingPuzzleInit = null; private HashSet<int> _completedPuzzleIDs = new HashSet<int>(); private bool _isReceivingPuzzleBlock = false; private bool _isReceivingHonk = false; private clownRandom _clownRandom; private bool _isReceivingVentSound = false; private GameObject _ghostVisionLight; private float _ghostTeleportDelay = 0f; private Dictionary<int, float> _ventDoorTimers = new Dictionary<int, float>(); private EndControl _endControl; private int _lastEndImageID = -1; private float _lastEndBarFill = -1f; private bool _lastEarCoveringState = false; public bool IsAnyPlayerCoveringEars => earMaster.isCoveringEars || _remotePlayerCoveringEars; public float AveragePing => (_peerPings.Count > 0) ? GetAveragePing() : (-1f); public bool IsLocalGhost => _localIsGhost; public bool ShouldControlMonsters => _steam != null && (_steam.IsHost || _hostDiedInLevel); public bool IsReceivingPaintingFlash => _isReceivingPaintingFlash; public bool IsReceivingJeffFlash => _isReceivingJeffFlash; public bool RemoteHasBatteryInCrank => _remoteCrankHasBattery; public bool IsReceivingPuzzleBlock => _isReceivingPuzzleBlock; public bool IsReceivingHonk => _isReceivingHonk; public bool IsReceivingVentSound => _isReceivingVentSound; public event Action<int, string> OnVersionMismatch; public event Action OnBecameHost; public float GetPing(int peerId) { float value; return _peerPings.TryGetValue(peerId, out value) ? value : (-1f); } private float GetAveragePing() { if (_peerPings.Count == 0) { return -1f; } float num = 0f; foreach (float value in _peerPings.Values) { num += value; } return num / (float)_peerPings.Count; } public static bool IsLockedByOther(string interactionId) { if (_interactionLocks.TryGetValue(interactionId, out var value)) { if (_lockTimestamps.TryGetValue(interactionId, out var value2) && Time.time - value2 > 5f) { _interactionLocks.Remove(interactionId); _lockTimestamps.Remove(interactionId); return false; } return value != -1; } return false; } public static bool IsLockedByUs(string interactionId) { if (_interactionLocks.TryGetValue(interactionId, out var value)) { return value == -1; } return false; } public void RefreshLock(string interactionId) { if (_interactionLocks.TryGetValue(interactionId, out var value) && value != -1) { if (_lockTimestamps.TryGetValue(interactionId, out var value2) && Time.time - value2 > 5f) { _interactionLocks[interactionId] = -1; _lockTimestamps[interactionId] = Time.time; _localActiveLocks.Add(interactionId); SendInteractionLock(interactionId, locked: true); Plugin.Log.LogInfo((object)("[Lock] Acquired expired lock: " + interactionId)); } return; } bool flag = !_interactionLocks.ContainsKey(interactionId) || _interactionLocks[interactionId] != -1; _interactionLocks[interactionId] = -1; _lockTimestamps[interactionId] = Time.time; if (flag) { _localActiveLocks.Add(interactionId); SendInteractionLock(interactionId, locked: true); Plugin.Log.LogInfo((object)("[Lock] Acquired lock: " + interactionId)); } } public bool TryAcquireLock(string interactionId) { if (IsLockedByOther(interactionId)) { return false; } RefreshLock(interactionId); return true; } public void ReleaseLock(string interactionId) { if (_interactionLocks.TryGetValue(interactionId, out var value) && value == -1) { _interactionLocks.Remove(interactionId); _lockTimestamps.Remove(interactionId); _localActiveLocks.Remove(interactionId); SendInteractionLock(interactionId, locked: false); Plugin.Log.LogInfo((object)("[Lock] Released lock: " + interactionId)); } } private void CleanupExpiredLocks() { if (Time.time - _lastLockCleanupTime < 1f) { return; } _lastLockCleanupTime = Time.time; List<string> list = new List<string>(); foreach (KeyValuePair<string, float> lockTimestamp in _lockTimestamps) { if (Time.time - lockTimestamp.Value > 10f) { list.Add(lockTimestamp.Key); } } foreach (string item in list) { _interactionLocks.Remove(item); _lockTimestamps.Remove(item); _localActiveLocks.Remove(item); } } public void ClearAllLocks() { _interactionLocks.Clear(); _lockTimestamps.Clear(); _localActiveLocks.Clear(); } public void Initialize(SteamTransport steam) { _steam = steam; _steam.OnPeerConnected += OnPeerConnected; _steam.OnPeerDisconnected += OnPeerDisconnected; _steam.OnDataReceived += OnDataReceived; SceneManager.sceneLoaded += OnSceneLoaded; Plugin.Log.LogInfo((object)"PlayerSync initialized (Steam)"); } private void OnPeerConnected(int peerId) { Plugin.Log.LogInfo((object)$"Peer connected: {peerId}"); _connectedPeerIds.Add(peerId); if (!_remotePlayers.ContainsKey(peerId)) { RemotePlayer value = new RemotePlayer(peerId); _remotePlayers[peerId] = value; Plugin.Log.LogInfo((object)$"Created remote player for peer {peerId}"); } SendVersionCheck(peerId); SendBatterySync(); } private void OnPeerDisconnected(int peerId) { Plugin.Log.LogInfo((object)$"Peer disconnected: {peerId}"); _connectedPeerIds.Remove(peerId); _peerVersions.Remove(peerId); _peerPings.Remove(peerId); _pendingPings.Remove(peerId); if (_remotePlayers.TryGetValue(peerId, out var value)) { value.Destroy(); _remotePlayers.Remove(peerId); } MPManager.Instance?.VoiceChat?.OnPeerDisconnected(peerId); MPManager.Instance?.Spectate?.StopReceiving(); MPManager.Instance?.Spectate?.StopSending(); } private void OnDataReceived(int peerId, PacketReader reader) { if (reader.AvailableBytes >= 1) { byte @byte = reader.GetByte(); switch (@byte) { case 1: HandlePositionPacket(peerId, reader); break; case 2: HandleFlashlightPacket(peerId, reader); break; case 3: HandleSceneChangePacket(reader); break; case 4: HandleNightSelectedPacket(reader); break; case 5: HandleTvSyncPacket(reader); break; case 6: HandlePaintingSyncPacket(reader); break; case 7: HandlePaintingFlashPacket(reader); break; case 8: HandleMonsterSyncPacket(reader); break; case 9: HandleJeffFlashPacket(); break; case 10: HandleBatterySync(reader); break; case 11: HandlePaintingEntity(reader); break; case 12: HandlePuzzleInit(reader); break; case 13: HandlePuzzleCompletePacket(reader); break; case 14: HandlePuzzleBlock(reader); break; case 15: HandleClownHonkPacket(); break; case 16: HandleVentSoundPacket(reader); break; case 17: HandleInteractionLockPacket(reader); break; case 18: HandleExitDoorProgressPacket(reader); break; case 19: HandleCrankSyncPacket(reader); break; case 20: HandleDeathGhostPacket(peerId, reader); break; case 21: HandleVersionCheck(peerId, reader); break; case 22: HandlePing(peerId, reader); break; case 23: HandlePong(peerId, reader); break; case 24: HandleHostMigration(peerId, reader); break; case 25: HandleClownState(reader); break; case 26: HandleClownAttack(reader); break; case 27: HandleSmileTrigger(reader); break; case 28: HandleVentDoor(reader); break; case 29: HandlePaintingDeath(); break; case 40: HandleEndProgress(reader); break; case 41: HandleEarCovering(reader); break; case 200: MPManager.Instance?.VoiceChat?.OnVoiceDataReceived(peerId, reader); break; case 30: case 31: case 32: MPManager.Instance?.Spectate?.OnPacketReceived(@byte, reader); break; default: Plugin.Log.LogWarning((object)$"Unknown packet type: {@byte}"); break; } } } private void HandlePositionPacket(int peerId, PacketReader reader) { //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) if (_remotePlayers.TryGetValue(peerId, out var value)) { bool @bool = reader.GetBool(); Vector3 bodyPos = default(Vector3); ((Vector3)(ref bodyPos))..ctor(reader.GetFloat(), reader.GetFloat(), reader.GetFloat()); Quaternion bodyRot = default(Quaternion); ((Quaternion)(ref bodyRot))..ctor(reader.GetFloat(), reader.GetFloat(), reader.GetFloat(), reader.GetFloat()); Vector3 headPos = default(Vector3); ((Vector3)(ref headPos))..ctor(reader.GetFloat(), reader.GetFloat(), reader.GetFloat()); Quaternion headRot = default(Quaternion); ((Quaternion)(ref headRot))..ctor(reader.GetFloat(), reader.GetFloat(), reader.GetFloat(), reader.GetFloat()); Vector3 leftHandPos = default(Vector3); ((Vector3)(ref leftHandPos))..ctor(reader.GetFloat(), reader.GetFloat(), reader.GetFloat()); Quaternion leftHandRot = default(Quaternion); ((Quaternion)(ref leftHandRot))..ctor(reader.GetFloat(), reader.GetFloat(), reader.GetFloat(), reader.GetFloat()); Vector3 rightHandPos = default(Vector3); ((Vector3)(ref rightHandPos))..ctor(reader.GetFloat(), reader.GetFloat(), reader.GetFloat()); Quaternion rightHandRot = default(Quaternion); ((Quaternion)(ref rightHandRot))..ctor(reader.GetFloat(), reader.GetFloat(), reader.GetFloat(), reader.GetFloat()); float @float = reader.GetFloat(); float float2 = reader.GetFloat(); float float3 = reader.GetFloat(); float float4 = reader.GetFloat(); value.SetTargets(@bool, bodyPos, bodyRot, headPos, headRot, leftHandPos, leftHandRot, rightHandPos, rightHandRot, @float, float2, float3, float4); } } private void HandleFlashlightPacket(int peerId, PacketReader reader) { bool @bool = reader.GetBool(); if (_remotePlayers.TryGetValue(peerId, out var value)) { value.SetFlashlightState(@bool); } } private void HandleSceneChangePacket(PacketReader reader) { string @string = reader.GetString(); int @int = reader.GetInt(); Plugin.Log.LogInfo((object)$"Received scene change: {@string}, night={@int}"); if (!_steam.IsHost) { calenderControl.nightSelected = @int; IsLoadingFromSync = true; SceneManager.LoadScene(@string); } } private void HandleNightSelectedPacket(PacketReader reader) { int @int = reader.GetInt(); Plugin.Log.LogInfo((object)$"Received night selection: {@int}"); calenderControl.nightSelected = @int; calenderControl val = Object.FindObjectOfType<calenderControl>(); if ((Object)(object)val != (Object)null) { val.setNightText(); } } private void HandleTvSyncPacket(PacketReader reader) { long @long = reader.GetLong(); if ((Object)(object)_tvVideoPlayer == (Object)null) { tvControl val = Object.FindObjectOfType<tvControl>(); if ((Object)(object)val != (Object)null && (Object)(object)val.TVVP != (Object)null) { _tvVideoPlayer = val.TVVP; } } if ((Object)(object)_tvVideoPlayer != (Object)null && _tvVideoPlayer.isPrepared) { long num = Math.Abs(_tvVideoPlayer.frame - @long); if (num > 30) { _tvVideoPlayer.frame = @long; Plugin.Log.LogInfo((object)$"[Client] TV synced to frame {@long} (was off by {num} frames)"); } } } private void HandlePaintingSyncPacket(PacketReader reader) { if ((Object)(object)_paintingControl == (Object)null) { _paintingControl = Object.FindObjectOfType<paintingControl>(); } if (!((Object)(object)_paintingControl == (Object)null)) { int @int = reader.GetInt(); int int2 = reader.GetInt(); int int3 = reader.GetInt(); int int4 = reader.GetInt(); int int5 = reader.GetInt(); int int6 = reader.GetInt(); _paintingControl.intpaintingTall1 = @int; _paintingControl.intpaintingTall2 = int2; _paintingControl.intpaintingTall3 = int3; _paintingControl.intpaintingSquare1 = int4; _paintingControl.intpaintingSquare2 = int5; _paintingControl.intpaintingSquare3 = int6; _paintingControl.setPaintingMatSquare(_paintingControl.paintingTall1, @int, false, true); _paintingControl.setPaintingMatSquare(_paintingControl.paintingTall2, int2, false, true); _paintingControl.setPaintingMatSquare(_paintingControl.paintingTall3, int3, false, true); _paintingControl.setPaintingMatSquare(_paintingControl.paintingSquare1, int4, false, false); _paintingControl.setPaintingMatSquare(_paintingControl.paintingSquare2, int5, false, false); _paintingControl.setPaintingMatSquare(_paintingControl.paintingSquare3, int6, false, false); Plugin.Log.LogInfo((object)$"[Painting] Synced paintings: T={@int},{int2},{int3} S={int4},{int5},{int6}"); } } private void HandlePaintingFlashPacket(PacketReader reader) { int @int = reader.GetInt(); _isReceivingPaintingFlash = true; paintingControl paintingControl = _paintingControl; if (paintingControl != null) { paintingControl.onPaintingFlash(@int); } _isReceivingPaintingFlash = false; } private void HandleMonsterSyncPacket(PacketReader reader) { //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) if (_steam.IsHost) { return; } FindMonsters(); if (reader.GetBool()) { int @int = reader.GetInt(); if ((Object)(object)_sparky != (Object)null) { FieldInfo field = typeof(sparkyBrain).GetField("currentState", BindingFlags.Instance | BindingFlags.NonPublic); int num = ((!(field != null)) ? 1 : ((int)field.GetValue(_sparky))); if (@int == 2 && num == 1) { field?.SetValue(_sparky, @int); } } } if (reader.GetBool()) { bool @bool = reader.GetBool(); int int2 = reader.GetInt(); int int3 = reader.GetInt(); if ((Object)(object)_jeff != (Object)null) { FieldInfo field2 = typeof(jeffBrain).GetField("currentState", BindingFlags.Instance | BindingFlags.NonPublic); int num2 = ((!(field2 != null)) ? 1 : ((int)field2.GetValue(_jeff))); if (int2 == 2 && num2 == 1) { field2?.SetValue(_jeff, 2); } } } if (reader.GetBool()) { bool bool2 = reader.GetBool(); int int4 = reader.GetInt(); if ((Object)(object)_smile != (Object)null) { FieldInfo field3 = typeof(SmileBrain).GetField("isChasing", BindingFlags.Instance | BindingFlags.NonPublic); bool flag = field3 != null && (bool)field3.GetValue(_smile); if (bool2 && !flag) { typeof(SmileBrain).GetField("chaseTime", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(_smile, int4); } } } if (reader.GetBool()) { Vector3 position = ReadVector3(reader); Quaternion rotation = ReadQuaternion(reader); bool bool3 = reader.GetBool(); bool bool4 = reader.GetBool(); if ((Object)(object)_henry != (Object)null) { if ((Object)(object)_henry.agent != (Object)null && ((Behaviour)_henry.agent).enabled) { ((Behaviour)_henry.agent).enabled = false; } ((Component)_henry).transform.position = position; ((Component)_henry).transform.rotation = rotation; typeof(henryBrain).GetField("resetSwitch", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(_henry, bool3); typeof(henryBrain).GetField("chaseSwitch", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(_henry, bool4); } } if (reader.GetBool()) { Vector3 position2 = ReadVector3(reader); Quaternion rotation2 = ReadQuaternion(reader); if ((Object)(object)_harold != (Object)null) { if ((Object)(object)_harold.agent != (Object)null && ((Behaviour)_harold.agent).enabled) { ((Behaviour)_harold.agent).enabled = false; } ((Component)_harold).transform.position = position2; ((Component)_harold).transform.rotation = rotation2; } } if (!reader.GetBool()) { return; } int int5 = reader.GetInt(); if ((Object)(object)_clown != (Object)null) { if ((Object)(object)_clown.clown1 != (Object)null) { _clown.clown1.SetActive(int5 == 0); } if ((Object)(object)_clown.clown2 != (Object)null) { _clown.clown2.SetActive(int5 == 1); } if ((Object)(object)_clown.clown3 != (Object)null) { _clown.clown3.SetActive(int5 == 2); } if ((Object)(object)_clown.clown4 != (Object)null) { _clown.clown4.SetActive(int5 == 3); } if ((Object)(object)_clown.clown5 != (Object)null) { _clown.clown5.SetActive(int5 == 4); } if ((Object)(object)_clown.clown6 != (Object)null) { _clown.clown6.SetActive(int5 == 5); } if ((Object)(object)_clown.clown7 != (Object)null) { _clown.clown7.SetActive(int5 == 6); } } } private void HandleJeffFlashPacket() { _isReceivingJeffFlash = true; jeffBrain jeff = _jeff; if (jeff != null) { jeff.onFlash(); } _isReceivingJeffFlash = false; } private void HandleBatterySyncPacket(int peerId, PacketReader reader) { int @int = reader.GetInt(); bool @bool = reader.GetBool(); float @float = reader.GetFloat(); if (!_remoteBatteryStates.ContainsKey(peerId)) { _remoteBatteryStates[peerId] = new RemoteBatteryState(); } _remoteBatteryStates[peerId].LocationID = @int; _remoteBatteryStates[peerId].InBackpack = @bool; _remoteBatteryStates[peerId].Charge = @float; } private void HandlePuzzleCompletePacket(PacketReader reader) { int @int = reader.GetInt(); int int2 = reader.GetInt(); Plugin.Log.LogInfo((object)$"Received puzzle complete: puzzleID={@int}, total={int2}"); PuzzleMaster.totalCompletedPuzzles = int2; if ((Object)(object)_puzzleMaster == (Object)null) { _puzzleMaster = Object.FindObjectOfType<PuzzleMaster>(); } if (!((Object)(object)_puzzleMaster != (Object)null)) { return; } PuzzleController[] array = (PuzzleController[])(object)new PuzzleController[9] { _puzzleMaster.pCon1, _puzzleMaster.pCon2, _puzzleMaster.pCon3, _puzzleMaster.pCon4, _puzzleMaster.pCon5, _puzzleMaster.pCon6, _puzzleMaster.pCon7, _puzzleMaster.pCon8, _puzzleMaster.pCon9 }; PuzzleController[] array2 = array; foreach (PuzzleController val in array2) { if ((Object)(object)val != (Object)null && val.thisPuzzleID == @int) { Type typeFromHandle = typeof(PuzzleController); FieldInfo field = typeFromHandle.GetField("puzzleHasCompleted", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(val, true); } if ((Object)(object)val.fanspin != (Object)null) { val.fanspin.isOn = true; } GameObject thisMapIndicator = val.thisMapIndicator; if (thisMapIndicator != null) { thisMapIndicator.SetActive(true); } AudioSource winAudio = val.winAudio; if (winAudio != null) { winAudio.Play(); } Plugin.Log.LogInfo((object)$"[Client] Marked puzzle {@int} as complete"); break; } } } private void HandlePuzzleBlockPacket(PacketReader reader) { int @int = reader.GetInt(); int int2 = reader.GetInt(); } private void HandleClownHonkPacket() { clownNose val = Object.FindObjectOfType<clownNose>(); if ((Object)(object)val != (Object)null && (Object)(object)val.honkSound != (Object)null) { _isReceivingHonk = true; val.honkSound.Play(); _isReceivingHonk = false; } } private void HandleVentSoundPacket(PacketReader reader) { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(reader.GetFloat(), reader.GetFloat(), reader.GetFloat()); int @int = reader.GetInt(); } private void HandleInteractionLockPacket(PacketReader reader) { string @string = reader.GetString(); if (reader.GetBool()) { _interactionLocks[@string] = 1; } else { _interactionLocks.Remove(@string); } } private void HandleExitDoorProgressPacket(PacketReader reader) { int @int = reader.GetInt(); int int2 = reader.GetInt(); if (BackpackControl.batteryLocationID == 100 && BackpackControl.batteryCharge >= 0.1f) { return; } if ((Object)(object)_leaveDoor == (Object)null) { _leaveDoor = Object.FindObjectOfType<LeaveDoorControl>(); } if (!((Object)(object)_leaveDoor != (Object)null)) { return; } typeof(LeaveDoorControl).GetField("doorLeaveTimer", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(_leaveDoor, @int); typeof(LeaveDoorControl).GetField("loadingBarLock", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(_leaveDoor, @int > 0); if ((Object)(object)_leaveDoor.fillImg != (Object)null && int2 > 0) { _leaveDoor.fillImg.fillAmount = (float)@int / (float)int2; } if ((Object)(object)_leaveDoor.fillIcon != (Object)null) { _leaveDoor.fillIcon.SetActive(@int > 0); } FieldInfo field = typeof(LeaveDoorControl).GetField("puzzleCount", BindingFlags.Instance | BindingFlags.Public); if (field != null && @int > 0 && int2 > 0) { object value = field.GetValue(_leaveDoor); if (value != null) { PropertyInfo property = value.GetType().GetProperty("text"); if (property != null) { int num = (int)Math.Round((float)@int / (float)int2 * 100f); if (@int >= int2) { property.SetValue(value, "100%"); if ((Object)(object)_leaveDoor.doorLeaveHitbox != (Object)null) { _leaveDoor.doorLeaveHitbox.SetActive(true); } } else { property.SetValue(value, num + "%"); } } } } if (@int > 0) { if ((Object)(object)_leaveDoor.greenIcon != (Object)null) { _leaveDoor.greenIcon.SetActive(false); } if ((Object)(object)_leaveDoor.redIcon != (Object)null) { _leaveDoor.redIcon.SetActive(false); } } } private void HandleCrankSyncPacket(PacketReader reader) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) bool @bool = reader.GetBool(); float @float = reader.GetFloat(); Quaternion rotation = ReadQuaternion(reader); _remoteCrankHasBattery = @bool; if ((Object)(object)_crankControl == (Object)null) { _crankControl = Object.FindObjectOfType<crankControl>(); } if ((Object)(object)_crankControl == (Object)null) { return; } if (BackpackControl.batteryLocationID != 1) { if ((Object)(object)_crankControl.batteryFill != (Object)null) { _crankControl.batteryFill.fillAmount = @float / 55f; } if ((Object)(object)_crankControl.batteryIMG != (Object)null) { _crankControl.batteryIMG.SetActive(@bool); } } ((Component)_crankControl).transform.rotation = rotation; } private void HandleDeathGhostPacket(int peerId, PacketReader reader) { //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) bool @bool = reader.GetBool(); int @int = reader.GetInt(); Plugin.Log.LogInfo((object)$"[Death] Received death packet from peer {peerId}: isGhost={@bool}, deathType={@int}"); if (_remotePlayers.TryGetValue(peerId, out var value)) { value.SetGhostState(@bool); Plugin.Log.LogInfo((object)$"[Death] Set peer {peerId} ghost state to {@bool}"); } if (@bool && _remoteBatteryStates.ContainsKey(peerId)) { _remoteBatteryStates[peerId].LocationID = 0; _remoteBatteryStates[peerId].LeftHolding = false; _remoteBatteryStates[peerId].RightHolding = false; _remoteBatteryStates[peerId].InBackpack = false; Plugin.Log.LogInfo((object)$"[Death] Cleared remote player {peerId}'s battery state"); } _remoteCrankHasBattery = false; Scene activeScene; if (@bool && _localIsGhost) { activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (name.Contains("Night")) { Plugin.Log.LogInfo((object)"[Ghost] Partner also died - all players dead, scheduling Home load"); _pendingHomeLoad = true; return; } } Plugin.Log.LogInfo((object)$"[Death] Partner death handled - LocalGhost={_localIsGhost}, RemoteGhost={@bool}"); activeScene = SceneManager.GetActiveScene(); string name2 = ((Scene)(ref activeScene)).name; if (!@bool || _localIsGhost || !name2.Contains("Night")) { return; } MPManager.Instance?.Spectate?.StartSending(); if (_steam.IsHost) { return; } _hostDiedInLevel = true; Plugin.Log.LogInfo((object)"[Client] Host died - taking over monster control!"); FindMonsters(); if ((Object)(object)_sparky != (Object)null) { NavMeshAgent component = ((Component)_sparky).GetComponent<NavMeshAgent>(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = true; } } if ((Object)(object)_jeff != (Object)null) { NavMeshAgent component2 = ((Component)_jeff).GetComponent<NavMeshAgent>(); if ((Object)(object)component2 != (Object)null) { ((Behaviour)component2).enabled = true; } } if ((Object)(object)_smile != (Object)null) { NavMeshAgent component3 = ((Component)_smile).GetComponent<NavMeshAgent>(); if ((Object)(object)component3 != (Object)null) { ((Behaviour)component3).enabled = true; } } if ((Object)(object)_henry != (Object)null) { NavMeshAgent component4 = ((Component)_henry).GetComponent<NavMeshAgent>(); if ((Object)(object)component4 != (Object)null) { ((Behaviour)component4).enabled = true; } } if ((Object)(object)_harold != (Object)null) { NavMeshAgent component5 = ((Component)_harold).GetComponent<NavMeshAgent>(); if ((Object)(object)component5 != (Object)null) { ((Behaviour)component5).enabled = true; } } } private void SendToAllPeers(bool reliable = true) { if (_steam != null && _steam.IsRunning) { byte[] bytes = _writer.GetBytes(); _steam.SendToAll(bytes, reliable); } } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { Plugin.Log.LogInfo((object)$"OnSceneLoaded: {((Scene)(ref scene)).name}, lastScene={_lastScene}, IsLoadingFromSync={IsLoadingFromSync}, IsGhost={_localIsGhost}"); MinimapFriendPatch.Cleanup(); ClearAllLocks(); _spawnPointCaptured = false; _hostDiedInLevel = false; if (_localIsGhost && _pendingGhostTeleport && ((Scene)(ref scene)).name.Contains("Night")) { Plugin.Log.LogInfo((object)"[Ghost] Scene loaded as ghost, preparing teleport"); HandleGhostSceneLoaded(); } if (((Scene)(ref scene)).name.Equals("Home", StringComparison.OrdinalIgnoreCase) && _localIsGhost) { Plugin.Log.LogInfo((object)"[Ghost] Entered Home, resetting ghost state"); ResetGhostState(); } if (((Scene)(ref scene)).name.Equals("Home", StringComparison.OrdinalIgnoreCase) || !((Scene)(ref scene)).name.Contains("Night")) { MPManager.Instance?.Spectate?.StopSending(); MPManager.Instance?.Spectate?.StopReceiving(); } if (((Scene)(ref scene)).name == _lastScene && !IsLoadingFromSync) { Plugin.Log.LogInfo((object)"Same scene loaded again, not clearing remote players"); return; } Plugin.Log.LogInfo((object)("Scene loaded: " + ((Scene)(ref scene)).name + ", resetting IsLoadingFromSync, recreating remote players")); IsLoadingFromSync = false; _lastScene = ((Scene)(ref scene)).name; foreach (RemotePlayer value in _remotePlayers.Values) { value.Destroy(); } _remotePlayers.Clear(); _remoteBatteryStates.Clear(); _pendingPuzzleInit = null; if (_steam != null && _steam != null && _steam.IsRunning) { _recreateRemotePlayersNextFrame = true; } } public void Cleanup() { SceneManager.sceneLoaded -= OnSceneLoaded; ClearRemotePlayers(); ClearAllLocks(); ResetGhostState(); _connectedPeerIds.Clear(); _remoteBatteryStates.Clear(); _pendingPuzzleInit = null; Plugin.Log.LogInfo((object)"PlayerSync cleaned up"); } public void Update() { //IL_06d5: Unknown result type (might be due to invalid IL or missing references) //IL_0838: Unknown result type (might be due to invalid IL or missing references) _updateCount++; if (_steam == null) { return; } if (_steam.IsRunning && _steam.IsConnected && Time.realtimeSinceStartup - _lastPingTime > 2f) { _lastPingTime = Time.realtimeSinceStartup; SendPingToAll(); } if (_pendingHomeLoad) { _pendingHomeLoad = false; Plugin.Log.LogInfo((object)"[Ghost] EXECUTING DEFERRED HOME LOAD - all players dead"); ResetGhostState(); SceneManager.LoadScene("Home"); return; } if (_pendingSceneLoad != null) { if (_sceneLoadDelayTimer > 0f) { _sceneLoadDelayTimer -= Time.deltaTime; return; } string pendingSceneLoad = _pendingSceneLoad; _pendingSceneLoad = null; _sceneLoadDelayTimer = 0f; Plugin.Log.LogInfo((object)("[Client] EXECUTING DEFERRED SCENE LOAD: " + pendingSceneLoad)); try { TriggerClientFade(); SceneManager.LoadScene(pendingSceneLoad); Plugin.Log.LogInfo((object)("[Client] SceneManager.LoadScene(" + pendingSceneLoad + ") called successfully")); } catch (Exception arg) { Plugin.Log.LogError((object)$"[Client] SceneManager.LoadScene FAILED: {arg}"); } } if (_recreateRemotePlayersNextFrame) { _recreateRemotePlayersNextFrame = false; RecreateRemotePlayers(); } UpdateGhostTeleport(); foreach (RemotePlayer value in _remotePlayers.Values) { value.UpdateInterpolation(); } if (!_steam.IsRunning || (!_steam.IsHost && !_steam.IsConnected && !_steam.IsInLobby)) { return; } if (!_spawnPointCaptured && _updateCount > 10) { CaptureSpawnPoint(); } if (_updateCount % 300 == 0) { Plugin.LogDebug($"PlayerSync.Update: gorillaPlayer={(Object)(object)_gorillaPlayer != (Object)null}, remotePlayers={_remotePlayers.Count}, ping={AveragePing:F0}ms"); } if ((Object)(object)_gorillaPlayer == (Object)null && (Object)(object)_handControl == (Object)null && (Object)(object)_mainCamera == (Object)null && (Object)(object)_ovrHead == (Object)null) { Plugin.LogDebug("=== SEARCHING FOR TRACKING REFERENCES ==="); _gorillaPlayer = Player.Instance; _handControl = Object.FindObjectOfType<HandControl>(); _moveController = Object.FindObjectOfType<MoveTypeController>(); _mainCamera = Camera.main; Plugin.Log.LogInfo((object)"Searching for OVRCameraRig..."); MonoBehaviour[] array = Object.FindObjectsOfType<MonoBehaviour>(); foreach (MonoBehaviour val in array) { Type type = ((object)val).GetType(); if (type.Name == "OVRCameraRig") { Plugin.LogDebug("Found OVRCameraRig: " + ((Object)((Component)val).gameObject).name); object? obj = type.GetProperty("centerEyeAnchor")?.GetValue(val); Transform val2 = (Transform)((obj is Transform) ? obj : null); object? obj2 = type.GetProperty("leftHandAnchor")?.GetValue(val); Transform val3 = (Transform)((obj2 is Transform) ? obj2 : null); object? obj3 = type.GetProperty("rightHandAnchor")?.GetValue(val); Transform val4 = (Transform)((obj3 is Transform) ? obj3 : null); Plugin.LogDebug(" centerEyeAnchor: " + (((Object)(object)val2 != (Object)null) ? ((Object)val2).name : "NULL")); Plugin.LogDebug(" leftHandAnchor: " + (((Object)(object)val3 != (Object)null) ? ((Object)val3).name : "NULL")); Plugin.LogDebug(" rightHandAnchor: " + (((Object)(object)val4 != (Object)null) ? ((Object)val4).name : "NULL")); if ((Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null && (Object)(object)val4 != (Object)null) { _ovrHead = val2; _ovrLeftHand = val3; _ovrRightHand = val4; Plugin.LogDebug("SUCCESS: Using OVRCameraRig for tracking!"); } break; } } if ((Object)(object)_ovrLeftHand == (Object)null || (Object)(object)_ovrRightHand == (Object)null) { Plugin.Log.LogInfo((object)"Searching for BackpackControl..."); BackpackControl val5 = Object.FindObjectOfType<BackpackControl>(); if ((Object)(object)val5 != (Object)null) { Plugin.LogDebug("Found BackpackControl on: " + ((Object)((Component)val5).gameObject).name); Plugin.LogDebug(" leftHand field: " + (((Object)(object)val5.leftHand != (Object)null) ? ((Object)val5.leftHand).name : "NULL")); Plugin.LogDebug(" rightHand field: " + (((Object)(object)val5.rightHand != (Object)null) ? ((Object)val5.rightHand).name : "NULL")); Plugin.LogDebug(" cam field: " + (((Object)(object)val5.cam != (Object)null) ? ((Object)val5.cam).name : "NULL")); if ((Object)(object)val5.leftHand != (Object)null) { _ovrLeftHand = val5.leftHand.transform; } if ((Object)(object)val5.rightHand != (Object)null) { _ovrRightHand = val5.rightHand.transform; } if ((Object)(object)val5.cam != (Object)null && (Object)(object)_ovrHead == (Object)null) { _ovrHead = val5.cam.transform; } if ((Object)(object)_ovrLeftHand != (Object)null && (Object)(object)_ovrRightHand != (Object)null) { Plugin.LogDebug("SUCCESS: Using BackpackControl for hand tracking!"); } } else { Plugin.Log.LogInfo((object)"BackpackControl NOT FOUND in scene!"); } } if ((Object)(object)_ovrLeftHand == (Object)null || (Object)(object)_ovrRightHand == (Object)null) { Plugin.Log.LogInfo((object)"Searching for ActionBasedController components..."); ActionBasedController[] array2 = Object.FindObjectsOfType<ActionBasedController>(); ActionBasedController[] array3 = array2; foreach (ActionBasedController val6 in array3) { Plugin.LogDebug($" Found ActionBasedController: {((Object)((Component)val6).gameObject).name}, pos={((Component)val6).transform.position}"); string text = ((Object)((Component)val6).gameObject).name.ToLower(); if (text.Contains("left") && (Object)(object)_ovrLeftHand == (Object)null) { _ovrLeftHand = ((Component)val6).transform; Plugin.LogDebug(" -> Using as LEFT hand"); } else if (text.Contains("right") && (Object)(object)_ovrRightHand == (Object)null) { _ovrRightHand = ((Component)val6).transform; Plugin.LogDebug(" -> Using as RIGHT hand"); } } } if ((Object)(object)_ovrLeftHand == (Object)null || (Object)(object)_ovrRightHand == (Object)null) { Plugin.Log.LogInfo((object)"Searching for any GameObjects with 'hand' in name..."); Transform[] array4 = Object.FindObjectsOfType<Transform>(); int num = 0; Transform[] array5 = array4; foreach (Transform val7 in array5) { string text2 = ((Object)val7).name.ToLower(); if (text2.Contains("hand") || text2.Contains("controller")) { num++; if (num <= 20) { Plugin.LogDebug(string.Format(" Found: {0} at {1} (parent: {2})", ((Object)val7).name, val7.position, ((Object)(object)val7.parent != (Object)null) ? ((Object)val7.parent).name : "none")); } } } Plugin.LogDebug($"Total hand/controller objects found: {num}"); } if ((Object)(object)_ovrLeftHand == (Object)null || (Object)(object)_ovrRightHand == (Object)null) { Plugin.Log.LogInfo((object)"Searching for crankControl..."); crankControl val8 = Object.FindObjectOfType<crankControl>(); if ((Object)(object)val8 != (Object)null) { Plugin.LogDebug("Found crankControl on: " + ((Object)((Component)val8).gameObject).name); Plugin.LogDebug(" handLeft field: " + (((Object)(object)val8.handLeft != (Object)null) ? ((Object)val8.handLeft).name : "NULL")); Plugin.LogDebug(" handRight field: " + (((Object)(object)val8.handRight != (Object)null) ? ((Object)val8.handRight).name : "NULL")); if ((Object)(object)val8.handLeft != (Object)null && (Object)(object)_ovrLeftHand == (Object)null) { _ovrLeftHand = val8.handLeft.transform; Plugin.LogDebug(" -> Using handLeft as LEFT hand"); } if ((Object)(object)val8.handRight != (Object)null && (Object)(object)_ovrRightHand == (Object)null) { _ovrRightHand = val8.handRight.transform; Plugin.LogDebug(" -> Using handRight as RIGHT hand"); } if ((Object)(object)_ovrLeftHand != (Object)null && (Object)(object)_ovrRightHand != (Object)null) { Plugin.LogDebug("SUCCESS: Using crankControl for hand tracking!"); } } else { Plugin.Log.LogInfo((object)"crankControl NOT FOUND in scene (only exists in gameplay scenes with charger)"); } } Plugin.Log.LogInfo((object)"=== TRACKING SEARCH RESULTS ==="); Plugin.Log.LogInfo((object)("GorillaPlayer: " + (((Object)(object)_gorillaPlayer != (Object)null) ? "FOUND" : "NOT FOUND"))); Plugin.Log.LogInfo((object)("HandControl: " + (((Object)(object)_handControl != (Object)null) ? "FOUND" : "NOT FOUND"))); Plugin.Log.LogInfo((object)("MoveController: " + (((Object)(object)_moveController != (Object)null) ? "FOUND" : "NOT FOUND"))); Plugin.Log.LogInfo((object)("MainCamera: " + (((Object)(object)_mainCamera != (Object)null) ? ((Object)_mainCamera).name : "NOT FOUND"))); Plugin.Log.LogInfo((object)("OVR Head: " + (((Object)(object)_ovrHead != (Object)null) ? ((Object)_ovrHead).name : "NOT FOUND"))); Plugin.Log.LogInfo((object)("OVR LeftHand: " + (((Object)(object)_ovrLeftHand != (Object)null) ? ((Object)_ovrLeftHand).name : "NOT FOUND"))); Plugin.Log.LogInfo((object)("OVR RightHand: " + (((Object)(object)_ovrRightHand != (Object)null) ? ((Object)_ovrRightHand).name : "NOT FOUND"))); if ((Object)(object)_gorillaPlayer != (Object)null) { _playerTransform = ((Component)_gorillaPlayer).transform; ManualLogSource log = Plugin.Log; Transform leftHandTransform = _gorillaPlayer.leftHandTransform; string obj4 = ((leftHandTransform != null) ? ((Object)leftHandTransform).name : null); Transform rightHandTransform = _gorillaPlayer.rightHandTransform; log.LogInfo((object)("GorillaPlayer hands: L=" + obj4 + ", R=" + ((rightHandTransform != null) ? ((Object)rightHandTransform).name : null))); } if ((Object)(object)_handControl != (Object)null) { Plugin.Log.LogInfo((object)$"HandControl: Head={(Object)(object)_handControl.Head != (Object)null}, LTarget={(Object)(object)_handControl.LTarget != (Object)null}, RTarget={(Object)(object)_handControl.RTarget != (Object)null}"); } } if (!((Object)(object)_gorillaPlayer == (Object)null) || !((Object)(object)_handControl == (Object)null) || !((Object)(object)_mainCamera == (Object)null)) { if (Time.time - _lastSyncTime >= _syncInterval) { SendPositionUpdate(); _lastSyncTime = Time.time; } CheckFlashlightState(); CheckSceneChange(); CheckCalendarChange(); CheckTvSync(); CheckPaintingSync(); CheckMonsterSync(); CheckBatterySync(); CheckCrankSync(); CheckPuzzleInitSync(); if (_pendingPuzzleInit != null && !_steam.IsHost) { TryApplyPuzzleInit(); } CheckExitDoorSync(); CheckEndSceneSync(); CheckEarCoveringSync(); CleanupExpiredLocks(); } } private void CheckCalendarChange() { if (_steam.IsHost) { int nightSelected = calenderControl.nightSelected; if (nightSelected != _lastNightSelected) { _lastNightSelected = nightSelected; SendNightSelected(nightSelected); } } } private void CheckTvSync() { if (!_steam.IsHost || Time.time - _lastTvSyncTime < _tvSyncInterval) { return; } _lastTvSyncTime = Time.time; if ((Object)(object)_tvVideoPlayer == (Object)null) { tvControl val = Object.FindObjectOfType<tvControl>(); if ((Object)(object)val != (Object)null && (Object)(object)val.TVVP != (Object)null) { _tvVideoPlayer = val.TVVP; Plugin.LogDebug("Found TV VideoPlayer"); } else { MoviePlayerSample val2 = Object.FindObjectOfType<MoviePlayerSample>(); if ((Object)(object)val2 != (Object)null) { _tvVideoPlayer = ((Component)val2).GetComponent<VideoPlayer>(); if ((Object)(object)_tvVideoPlayer != (Object)null) { Plugin.LogDebug("Found MoviePlayerSample VideoPlayer"); } } } } if ((Object)(object)_tvVideoPlayer != (Object)null && _tvVideoPlayer.isPlaying) { SendTvSync(_tvVideoPlayer.frame); } } private void SendTvSync(long frame) { _writer.Reset(); _writer.Put((byte)5); _writer.Put(frame); SendToAllPeers(); Plugin.Log.LogInfo((object)$"[Host] Sent TV sync: frame {frame}"); } private void CheckPaintingSync() { if (!_steam.IsHost || Time.time - _lastPaintingSyncTime < _paintingSyncInterval) { return; } _lastPaintingSyncTime = Time.time; if ((Object)(object)_paintingControl == (Object)null) { _paintingControl = Object.FindObjectOfType<paintingControl>(); if ((Object)(object)_paintingControl != (Object)null) { Plugin.Log.LogInfo((object)"Found paintingControl"); } } if ((Object)(object)_paintingControl != (Object)null) { SendPaintingSync(); } } private void SendPaintingSync() { _writer.Reset(); _writer.Put((byte)6); _writer.Put(_paintingControl.intpaintingTall1); _writer.Put(_paintingControl.intpaintingTall2); _writer.Put(_paintingControl.intpaintingTall3); _writer.Put(_paintingControl.intpaintingSquare1); _writer.Put(_paintingControl.intpaintingSquare2); _writer.Put(_paintingControl.intpaintingSquare3); SendToAllPeers(); } private void SendNightSelected(int night) { _writer.Reset(); _writer.Put((byte)4); _writer.Put(night); SendToAllPeers(); Plugin.Log.LogInfo((object)$"[Host] Sent night selection: {night}"); } private void CheckSceneChange() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; if (!(name != _lastScene)) { return; } Plugin.Log.LogInfo((object)("Scene changed from " + _lastScene + " to " + name)); string lastScene = _lastScene; _lastScene = name; if (_steam.IsHost && !IsLoadingFromSync) { SendSceneChange(name); Plugin.Log.LogInfo((object)("[Host] Scene changed to: " + name + ", broadcasting to clients")); } _gorillaPlayer = null; _handControl = null; _mainCamera = null; _moveController = null; _ovrHead = null; _ovrLeftHand = null; _ovrRightHand = null; _localFlashlight = null; _localFlashlightControl = null; _tvVideoPlayer = null; _paintingControl = null; _sparky = null; _jeff = null; _smile = null; _henry = null; _harold = null; _clown = null; _puzzleMaster = null; _puzzleInitSent = false; _completedPuzzleIDs.Clear(); _leaveDoor = null; _lastDoorLeaveTimer = 0; _crankControl = null; _lastCrankCharge = -1f; _lastCrankHasBattery = false; if (_steam == null || !_steam.IsRunning || _connectedPeerIds.Count <= 0 || (_remotePlayers.Count != 0 && (_remotePlayers.Count <= 0 || AnyRemotePlayerValid()))) { return; } Plugin.Log.LogInfo((object)$"[Fallback] OnSceneLoaded may not have fired - recreating {_connectedPeerIds.Count} remote players"); foreach (RemotePlayer value in _remotePlayers.Values) { value.Destroy(); } _remotePlayers.Clear(); _remoteBatteryStates.Clear(); _recreateRemotePlayersNextFrame = true; } private bool AnyRemotePlayerValid() { foreach (RemotePlayer value in _remotePlayers.Values) { if ((Object)(object)value.Head != (Object)null) { return true; } } return false; } private void ClearRemotePlayers() { foreach (RemotePlayer value in _remotePlayers.Values) { value.Destroy(); } _remotePlayers.Clear(); } private void RecreateRemotePlayers() { if (_steam == null || _steam == null) { return; } foreach (int connectedPeerId in _connectedPeerIds) { if (!_remotePlayers.ContainsKey(connectedPeerId)) { Plugin.Log.LogInfo((object)$"Recreating remote player for peer {connectedPeerId} after scene load"); RemotePlayer value = new RemotePlayer(connectedPeerId); _remotePlayers[connectedPeerId] = value; } else { _remotePlayers[connectedPeerId].TryUpgradeVisuals(); } } Plugin.Log.LogInfo((object)$"Remote players after recreation: {_remotePlayers.Count}"); } public void SendSceneChange(string sceneName) { _writer.Reset(); _writer.Put((byte)3); _writer.Put(sceneName); _writer.Put(calenderControl.nightSelected); SendToAllPeers(); Plugin.Log.LogInfo((object)$"Sent scene change: {sceneName}, night={calenderControl.nightSelected}"); } private void CheckFlashlightState() { bool flag = false; bool flag2 = false; if ((Object)(object)_localFlashlightControl == (Object)null) { _localFlashlightControl = Object.FindObjectOfType<FlashlightControl>(); if ((Object)(object)_localFlashlightControl != (Object)null) { Plugin.Log.LogInfo((object)"Found FlashlightControl"); } } if ((Object)(object)_localFlashlightControl != (Object)null && (Object)(object)_localFlashlightControl.flashlight != (Object)null) { flag = _localFlashlightControl.flashlight.activeSelf; flag2 = true; } if (!flag2) { if ((Object)(object)_localFlashlight == (Object)null) { _localFlashlight = Object.FindObjectOfType<Flashlight>(); if ((Object)(object)_localFlashlight != (Object)null) { Plugin.Log.LogInfo((object)"Found Flashlight class"); } } if ((Object)(object)_localFlashlight != (Object)null && (Object)(object)_localFlashlight.spotlight != (Object)null) { flag = ((Behaviour)_localFlashlight.spotlight).enabled; flag2 = true; } } if (flag2 && flag != _lastFlashlightState) { _lastFlashlightState = flag; SendFlashlightState(flag); Plugin.Log.LogInfo((object)$"Flashlight toggled: {flag}, battery={BackpackControl.batteryCharge:F1}, inBackpack={BackpackControl.batteryIsInBackpack}"); } } private void SendFlashlightState(bool isOn) { _writer.Reset(); _writer.Put((byte)2); _writer.Put(isOn); SendToAllPeers(); } private void CaptureHandPoses(ref float leftGrip, ref float leftTrigger, ref float rightGrip, ref float rightTrigger) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) BackpackControl val = Object.FindObjectOfType<BackpackControl>(); if (!((Object)(object)val != (Object)null)) { return; } InputActionProperty val2; if ((Object)(object)val.controllerLeft != (Object)null) { try { val2 = val.controllerLeft.selectActionValue; leftGrip = ((InputActionProperty)(ref val2)).action.ReadValue<float>(); val2 = val.controllerLeft.uiPressActionValue; leftTrigger = ((InputActionProperty)(ref val2)).action.ReadValue<float>(); } catch (Exception ex) { Plugin.LogDebug("Failed to read left hand pose: " + ex.Message); } } if ((Object)(object)val.controllerRight != (Object)null) { try { val2 = val.controllerRight.selectActionValue; rightGrip = ((InputActionProperty)(ref val2)).action.ReadValue<float>(); val2 = val.controllerRight.uiPressActionValue; rightTrigger = ((InputActionProperty)(ref val2)).action.ReadValue<float>(); } catch (Exception ex2) { Plugin.LogDebug("Failed to read right hand pose: " + ex2.Message); } } } private void SendPositionUpdate() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) _writer.Reset(); _writer.Put((byte)1); bool value = (Object)(object)_moveController != (Object)null && _moveController.debugSwitch; _sendCount++; string text = "none"; Vector3 position; Quaternion rotation; Vector3 val; Quaternion q; Vector3 val2; Quaternion q2; if ((Object)(object)_ovrHead != (Object)null && (Object)(object)_ovrLeftHand != (Object)null && (Object)(object)_ovrRightHand != (Object)null) { text = "OVR/BackpackControl"; position = _ovrHead.position; rotation = _ovrHead.rotation; val = _ovrLeftHand.position; q = _ovrLeftHand.rotation; val2 = _ovrRightHand.position; q2 = _ovrRightHand.rotation; } else if ((Object)(object)_gorillaPlayer != (Object)null && (Object)(object)_gorillaPlayer.leftHandTransform != (Object)null && (Object)(object)_gorillaPlayer.rightHandTransform != (Object)null) { text = "GorillaPlayer"; position = ((Component)_gorillaPlayer.headCollider).transform.position; rotation = ((Component)_gorillaPlayer.headCollider).transform.rotation; val = _gorillaPlayer.leftHandTransform.position; q = _gorillaPlayer.leftHandTransform.rotation; val2 = _gorillaPlayer.rightHandTransform.position; q2 = _gorillaPlayer.rightHandTransform.rotation; } else if ((Object)(object)_handControl != (Object)null && (Object)(object)_handControl.LTarget != (Object)null && (Object)(object)_handControl.RTarget != (Object)null) { text = "HandControl"; position = _handControl.Head.transform.position; rotation = _handControl.Head.transform.rotation; val = _handControl.LTarget.transform.position; q = _handControl.LTarget.transform.rotation; val2 = _handControl.RTarget.transform.position; q2 = _handControl.RTarget.transform.rotation; } else { if (!((Object)(object)_mainCamera != (Object)null)) { return; } text = "MainCamera-NoHands"; position = ((Component)_mainCamera).transform.position; rotation = ((Component)_mainCamera).transform.rotation; val = position + ((Component)_mainCamera).transform.right * -0.3f + ((Component)_mainCamera).transform.forward * 0.2f; q = rotation; val2 = position + ((Component)_mainCamera).transform.right * 0.3f + ((Component)_mainCamera).transform.forward * 0.2f; q2 = rotation; } Vector3 v = position - Vector3.up * 0.5f; Quaternion q3 = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f); float leftGrip = 0f; float leftTrigger = 0f; float rightGrip = 0f; float rightTrigger = 0f; CaptureHandPoses(ref leftGrip, ref leftTrigger, ref rightGrip, ref rightTrigger); _writer.Put(value); WriteVector3(_writer, v); WriteQuaternion(_writer, q3); WriteVector3(_writer, position); WriteQuaternion(_writer, rotation); WriteVector3(_writer, val); WriteQuaternion(_writer, q); WriteVector3(_writer, val2); WriteQuaternion(_writer, q2); _writer.Put(leftGrip); _writer.Put(leftTrigger); _writer.Put(rightGrip); _writer.Put(rightTrigger); if (_sendCount % 100 == 1) { Plugin.LogDebug($"[Send] src={text} head={position}, lHand={val}, rHand={val2}"); } SendToAllPeers(reliable: false); } private void WriteVector3(PacketWriter writer, Vector3 v) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) writer.Put(v.x); writer.Put(v.y); writer.Put(v.z); } private void WriteQuaternion(PacketWriter writer, Quaternion q) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) writer.Put(q.x); writer.Put(q.y); writer.Put(q.z); writer.Put(q.w); } private Vector3 ReadVector3(PacketReader reader) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) return new Vector3(reader.GetFloat(), reader.GetFloat(), reader.GetFloat()); } private Quaternion ReadQuaternion(PacketReader reader) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) return new Quaternion(reader.GetFloat(), reader.GetFloat(), reader.GetFloat(), reader.GetFloat()); } private void SendInteractionLock(string interactionId, bool locked) { if (_steam != null && _steam.IsRunning) { _writer.Reset(); _writer.Put((byte)17); _writer.Put(interactionId); _writer.Put(locked); SendToAllPeers(); } } private void HandleSceneChange(PacketReader reader) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) string @string = reader.GetString(); Plugin.Log.LogInfo((object)("[Client] Received scene change from host: " + @string)); if (!_steam.IsHost) { Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; Plugin.Log.LogInfo((object)("[Client] Current scene check: GetActiveScene=" + name + ", _lastScene=" + _lastScene)); if (name != @string) { Plugin.Log.LogInfo((object)("[Client] Scheduling scene load: " + @string + " (currently in " + name + ")")); IsLoadingFromSync = true; _lastScene = @string; TriggerClientFade(); _sceneLoadDelayTimer = 0.5f; _pendingSceneLoad = @string; } else { Plugin.Log.LogInfo((object)("[Client] Already in scene " + @string + ", ignoring")); } } } private void TriggerClientFade() { try { Type type = Type.GetType("fadeControl, Assembly-CSharp"); if (type == null) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { type = assembly.GetType("fadeControl"); if (type != null) { break; } } } if (!(type != null)) { return; } Object val = Object.FindObjectOfType(type); if (val != (Object)null) { MethodInfo method = type.GetMethod("fadeOut", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(val, null); Plugin.Log.LogInfo((object)"[Client] Triggered fade effect"); } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("[Client] Could not trigger fade: " + ex.Message)); } } private void HandleTvSync(PacketReader reader) { long @long = reader.GetLong(); if (_steam.IsHost) { return; } Plugin.Log.LogInfo((object)$"[Client] Received TV sync: frame {@long}"); if ((Object)(object)_tvVideoPlayer == (Object)null) { tvControl val = Object.FindObjectOfType<tvControl>(); if ((Object)(object)val != (Object)null && (Object)(object)val.TVVP != (Object)null) { _tvVideoPlayer = val.TVVP; } else { MoviePlayerSample val2 = Object.FindObjectOfType<MoviePlayerSample>(); if ((Object)(object)val2 != (Object)null) { _tvVideoPlayer = ((Component)val2).GetComponent<VideoPlayer>(); } } } if ((Object)(object)_tvVideoPlayer != (Object)null) { long num = Math.Abs(_tvVideoPlayer.frame - @long); if (num > 30) { _tvVideoPlayer.frame = @long; Plugin.Log.LogInfo((object)$"[Client] TV synced to frame {@long} (was off by {num} frames)"); } } } private void HandlePaintingSync(PacketReader reader) { if (_steam.IsHost) { return; } int @int = reader.GetInt(); int int2 = reader.GetInt(); int int3 = reader.GetInt(); int int4 = reader.GetInt(); int int5 = reader.GetInt(); int int6 = reader.GetInt(); if ((Object)(object)_paintingControl == (Object)null) { _paintingControl = Object.FindObjectOfType<paintingControl>(); } if ((Object)(object)_paintingControl != (Object)null) { bool flag = false; if (_paintingControl.intpaintingTall1 != @int) { _paintingControl.intpaintingTall1 = @int; _paintingControl.setPaintingMatSquare(_paintingControl.paintingTall1, @int, false, true); flag = true; } if (_paintingControl.intpaintingTall2 != int2) { _paintingControl.intpaintingTall2 = int2; _paintingControl.setPaintingMatSquare(_paintingControl.paintingTall2, int2, false, true); flag = true; } if (_paintingControl.intpaintingTall3 != int3) { _paintingControl.intpaintingTall3 = int3; _paintingControl.setPaintingMatSquare(_paintingControl.paintingTall3, int3, false, true); flag = true; } if (_paintingControl.intpaintingSquare1 != int4) { _paintingControl.intpaintingSquare1 = int4; _paintingControl.setPaintingMatSquare(_paintingControl.paintingSquare1, int4, false, false); flag = true; } if (_paintingControl.intpaintingSquare2 != int5) { _paintingControl.intpaintingSquare2 = int5; _paintingControl.setPaintingMatSquare(_paintingControl.paintingSquare2, int5, false, false); flag = true; } if (_paintingControl.intpaintingSquare3 != int6) { _paintingControl.intpaintingSquare3 = int6; _paintingControl.setPaintingMatSquare(_paintingControl.paintingSquare3, int6, false, false); flag = true; } if (flag) { Plugin.Log.LogInfo((object)$"[Client] Paintings synced: T1={@int}, T2={int2}, T3={int3}, S1={int4}, S2={int5}, S3={int6}"); } } } public void SendPaintingFlash(int paintingId) { if (_steam != null && _steam.IsRunning) { _writer.Reset(); _writer.Put((byte)7); _writer.Put(paintingId); SendToAllPeers(); Plugin.Log.LogInfo((object)$"Sent painting flash: {paintingId}"); } } public void SendPaintingEntityState(paintingControl pc) { if (_steam != null && _steam.IsRunning && ShouldControlMonsters) { Type typeFromHandle = typeof(paintingControl); bool value = (bool)typeFromHandle.GetField("boolpaintingTall1", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(pc); bool value2 = (bool)typeFromHandle.GetField("boolpaintingTall2", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(pc); bool value3 = (bool)typeFromHandle.GetField("boolpaintingTall3", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(pc); bool value4 = (bool)typeFromHandle.GetField("boolpaintingSquare1", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(pc); bool value5 = (bool)typeFromHandle.GetField("boolpaintingSquare2", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(pc); bool value6 = (bool)typeFromHandle.GetField("boolpaintingSquare3", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(pc); _writer.Reset(); _writer.Put((byte)11); _writer.Put(value); _writer.Put(value2); _writer.Put(value3); _writer.Put(value4); _writer.Put(value5); _writer.Put(value6); _writer.Put(pc.intpaintingTall1); _writer.Put(pc.intpaintingTall2); _writer.Put(pc.intpaintingTall3); _writer.Put(pc.intpaintingSquare1); _writer.Put(pc.intpaintingSquare2); _writer.Put(pc.intpaintingSquare3); SendToAllPeers(); Plugin.Log.LogInfo((object)"[Host] Sent painting entity state"); } } private void HandlePaintingEntity(PacketReader reader) { bool @bool = reader.GetBool(); bool bool2 = reader.GetBool(); bool bool3 = reader.GetBool(); bool bool4 = reader.GetBool(); bool bool5 = reader.GetBool(); bool bool6 = reader.GetBool(); int @int = reader.GetInt(); int int2 = reader.GetInt(); int int3 = reader.GetInt(); int int4 = reader.GetInt(); int int5 = reader.GetInt(); int int6 = reader.GetInt(); if ((Object)(object)_paintingControl == (Object)null) { _paintingControl = Object.FindObjectOfType<paintingControl>(); } if ((Object)(object)_paintingControl != (Object)null) { Type typeFromHandle = typeof(paintingControl); typeFromHandle.GetField("boolpaintingTall1", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(_paintingControl, @bool); typeFromHandle.GetField("boolpaintingTall2", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(_paintingControl, bool2); typeFromHandle.GetField("boolpaintingTall3", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(_paintingControl, bool3); typeFromHandle.GetField("boolpaintingSquare1", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(_paintingControl, bool4); typeFromHandle.GetField("boolpaintingSquare2", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(_paintingControl, bool5); typeFromHandle.GetField("boolpaintingSquare3", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(_paintingControl, bool6); _paintingControl.setPaintingMatSquare(_paintingControl.paintingTall1, @int, @bool, true); _paintingControl.setPaintingMatSquare(_paintingControl.paintingTall2, int2, bool2, true); _paintingControl.setPaintingMatSquare(_paintingControl.paintingTall3, int3, bool3, true); _paintingControl.setPaintingMatSquare(_paintingControl.paintingSquare1, int4, bool4, false); _paintingControl.setPaintingMatSquare(_paintingControl.paintingSquare2, int5, bool5, false); _paintingControl.setPaintingMatSquare(_paintingControl.paintingSquare3, int6, bool6, false); Plugin.Log.LogInfo((object)"[Client] Applied painting entity state"); } } public List<Vector3> GetRemotePlayerPositions() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(); foreach (RemotePlayer value in _remotePlayers.Values) { if ((Object)(object)value.Head != (Object)null) { list.Add(value.Head.transform.position); } } return list; } public Vector3? GetRemotePlayerPosition(int peerId) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (_remotePlayers.TryGetValue(peerId, out var value) && (Object)(object)value.Head != (Object)null) { return value.Head.transform.position; } return null; } public List<Vector3> GetRemotePlayerPositionsNonGhost() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(); foreach (RemotePlayer value in _remotePlayers.Values) { if ((Object)(object)value.Head != (Object)null && !value.IsGhost) { list.Add(value.Head.transform.position); } } return list; } private void CheckMonsterSync() { if (ShouldControlMonsters && !(Time.time - _lastMonsterSyncTime < _monsterSyncInterval)) { _lastMonsterSyncTime = Time.time; FindMonsters(); SendMonsterSync(); } } private void FindMonsters() { if ((Object)(object)_sparky == (Object)null) { _sparky = Object.FindObjectOfType<sparkyBrain>(); } if ((Object)(object)_jeff == (Object)null) { _jeff = Object.FindObjectOfType<jeffBrain>(); } if ((Object)(object)_smile == (Object)null) { _smile = Object.FindObjectOfType<SmileBrain>(); } if ((Object)(object)_henry == (Object)null) { _henry = Object.FindObjectOfType<henryBrain>(); } if ((Object)(object)_harold == (Object)null) { _harold = Object.FindObjectOfType<mapEnBrain>(); } if ((Object)(object)_clown == (Object)null) { _clown = Object.FindObjectOfType<clownRandom>(); } } private void SendMonsterSync() { //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) _writer.Reset(); _writer.Put((byte)8); bool flag = (Object)(object)_sparky != (Object)null; _writer.Put(flag); if (flag) { FieldInfo field = typeof(sparkyBrain).GetField("currentState", BindingFlags.Instance | BindingFlags.NonPublic); int value = ((!(field != null)) ? 1 : ((int)field.GetValue(_sparky))); _writer.Put(value); } bool flag2 = (Object)(object)_jeff != (Object)null; _writer.Put(flag2); if (flag2) { _writer.Put((Object)(object)_jeff.jeffBody != (Object)null && _jeff.jeffBody.activeSelf); FieldInfo field2 = typeof(jeffBrain).GetField("currentState", BindingFlags.Instance | BindingFlags.NonPublic); int value2 = ((!(field2 != null)) ? 1 : ((int)field2.GetValue(_jeff))); _writer.Put(value2); FieldInfo field3 = typeof(jeffBrain).GetField("totalFlashes", BindingFlags.Instance | BindingFlags.NonPublic); int value3 = ((field3 != null) ? ((int)field3.GetValue(_jeff)) : 0); _writer.Put(value3); } bool flag3 = (Object)(object)_smile != (Object)null; _writer.Put(flag3); if (flag3) { FieldInfo field4 = typeof(SmileBrain).GetField("isChasing", BindingFlags.Instance | BindingFlags.NonPublic); bool value4 = field4 != null && (bool)field4.GetValue(_smile); _writer.Put(value4); FieldInfo field5 = typeof(SmileBrain).GetField("chaseTime", BindingFlags.Instance | BindingFlags.NonPublic); int value5 = ((field5 != null) ? ((int)field5.GetValue(_smile)) : 0); _writer.Put(value5); } bool flag4 = (Object)(object)_henry != (Object)null; _writer.Put(flag4); if (flag4) { WriteVector3(_writer, ((Component)_henry).transform.position); WriteQuaternion(_writer, ((Component)_henry).transform.rotation); FieldInfo field6 = typeof(henryBrain).GetField("resetSwitch", BindingFlags.Instance | BindingFlags.NonPublic); bool value6 = field6 != null && (bool)field6.GetValue(_henry); _writer.Put(value6); FieldInfo field7 = typeof(henryBrain).GetField("chaseSwitch", BindingFlags.Instance | BindingFlags.NonPublic); bool value7 = field7 != null && (bool)field7.GetValue(_henry); _writer.Put(value7); } bool flag5 = (Object)(object)_harold != (Object)null; _writer.Put(flag5); if (flag5) { WriteVector3(_writer, ((Component)_harold).transform.position); WriteQuaternion(_writer, ((Component)_harold).transform.rotation); } bool flag6 = (Object)(object)_clown != (Object)null; _writer.Put(flag6); if (flag6) { int value8 = -1; if ((Object)(object)_clown.clown1 != (Object)null && _clown.clown1.activeSelf) { value8 = 0; } else if ((Object)(object)_clown.clown2 != (Object)null && _clown.clown2.activeSelf) { value8 = 1; } else if ((Object)(object)_clown.clown3 != (Object)null && _clown.clown3.activeSelf) { value8 = 2; } else if ((Object)(object)_clown.clown4 != (Object)null && _clown.clown4.activeSelf) { value8 = 3; } else if ((Object)(object)_clown.clown5 != (Object)null && _clown.clown5.activeSelf) { value8 = 4; } else if ((Object)(object)_clown.clown6 != (Object)null && _clown.clown6.activeSelf) { value8 = 5; } else if ((Object)(object)_clown.clown7 != (Object)null && _clown.clown7.activeSelf) { value8 = 6; } _writer.Put(value8); } SendToAllPeers(reliable: false); } public void SendJeffFlash() { if (_steam != null && _steam.IsRunning) { _writer.Reset(); _writer.Put((byte)9); SendToAllPeers(); Plugin.Log.LogInfo((object)"Sent Jeff flash"); } } private void CheckBatterySync() { if (Time.time - _lastBatterySyncTime < _batterySyncInterval) { return; } _lastBatterySyncTime = Time.time; BackpackControl val = Object.FindObjectOfType<BackpackControl>(); bool flag = false; bool flag2 = false; if ((Object)(object)val != (Object)null) { FieldInfo field = typeof(BackpackControl).GetField("leftHoldingBattery", BindingFlags.Instance | BindingFlags.NonPublic); FieldInfo field2 = typeof(BackpackControl).GetField("rightHoldingBattery", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { flag = (bool)field.GetValue(val); } if (field2 != null) { flag2 = (bool)field2.GetValue(val); } } bool flag3 = BackpackControl.batteryLocationID != _lastBatteryLocationID; bool flag4 = BackpackControl.batteryIsInBackpack != _lastBatteryInBackpack; bool flag5 = Mathf.Abs(BackpackControl.batteryCharge - _lastBatteryCharge) > 2f; bool flag6 = flag != _lastLeftHolding || flag2 != _lastRightHolding; if (flag3 || flag4 || flag5 || flag6) { if (flag3) { Plugin.LogDebug($"[Battery] Location changed: {_lastBatteryLocationID} -> {BackpackControl.batteryLocationID}"); } if (flag4) { Plugin.LogDebug($"[Battery] Backpack changed: {_lastBatteryInBackpack} -> {BackpackControl.batteryIsInBackpack}"); } if (flag6) { Plugin.LogDebug($"[Battery] Holding changed: L={_lastLeftHolding}->{flag}, R={_lastRightHolding}->{flag2}"); } _lastBatteryLocationID = BackpackControl.batteryLocationID; _lastBatteryInBackpack = BackpackControl.batteryIsInBackpack; _lastBatteryCharge = BackpackControl.batteryCharge; _lastLeftHolding = flag; _lastRightHolding = flag2; SendBatterySync(); } } private void SendBatterySync() { _writer.Reset(); _writer.Put((byte)10); _writer.Put(BackpackControl.batteryCharge); _writer.Put(BackpackControl.batteryLocationID); _writer.Put(BackpackControl.batteryIsInBackpack); BackpackControl val = Object.FindObjectOfType<BackpackControl>(); bool value = false; bool value2 = false; if ((Object)(object)val != (Object)null) { FieldInfo field = typeof(BackpackControl).GetField("leftHoldingBattery", BindingFlags.Instance | BindingFlags.NonPublic); FieldInfo field2 = typeof(BackpackControl).GetField("rightHoldingBattery", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { value = (bool)field.GetValue(val); } if (field2 != null) { value2 = (bool)field2.GetValue(val); } } _writer.Put(value); _writer.Put(value2); SendToAllPeers(); } private void HandleBatterySync(PacketReader reader) { float @float = reader.GetFloat(); int @int = reader.GetInt(); bool @bool = reader.GetBool(); bool bool2 = reader.GetBool(); bool bool3 = reader.GetBool(); Plugin.LogDebug($"[Battery] Remote player: charge={@float:F1}, loc={@int}, backpack={@bool}, L={bool2}, R={bool3}"); if (_remotePlayers.Count <= 0) { return; } using Dictionary<int, RemotePlayer>.Enumerator enumerator = _remotePlayers.GetEnumerator(); if (enumerator.MoveNext()) { KeyValuePair<int, RemotePlayer> current = enumerator.Current; if (!_remoteBatteryStates.ContainsKey(current.Key)) { _remoteBatteryStates[current.Key] = new RemoteBatteryState(); } _remoteBatteryStates[current.Key].Charge = @float; _remoteBatteryStates[current.Key].LocationID = @int; _remoteBatteryStates[current.Key].InBackpack = @bool; _remoteBatteryStates[current.Key].LeftHolding = bool2; _remoteBatteryStates[current.Key].RightHolding = bool3; current.Value.SetBatteryState(bool2, bool3); } } public RemoteBatteryState GetRemoteBatteryState(int peerId) { if (_remoteBatteryStates.TryGetValue(peerId, out var value)) { return value; } return null; } public float GetRemoteBatteryCharge() { using (Dictionary<int, RemoteBatteryState>.ValueCollection.Enumerator enumerator = _remoteBatteryStates.Values.GetEnumerator()) { if (enumerator.MoveNext()) { RemoteBatteryState current = enumerator.Current; return current.Charge; } } return -1f; } public int GetRemoteBatteryLocationID() { using (Dictionary<int, RemoteBatteryState>.ValueCollection.Enumerator enumerator = _remoteBatteryStates.Values.GetEnumerator()) { if (enumerator.MoveNext()) { RemoteBatteryState current = enumerator.Current; return current.LocationID; } } return 0; } public bool IsRemoteBatteryAtExit() { foreach (RemoteBatteryState value in _remoteBatteryStates.Values) { if (value.LocationID == 100 && value.Charge >= 0.1f) { return true; } } return false; } public RemoteBatteryState GetFirstRemoteBatteryState() { using (Dictionary<int, RemoteBatteryState>.ValueCollection.Enumerator enumerator = _remoteBatteryStates.Values.GetEnumerator()) { if (enumerator.MoveNext()) { return enumerator.Current; } } return null; } public RemoteBatteryState GetRemoteBatteryAtLocation(int locationID) { foreach (RemoteBatteryState value in _remoteBatteryStates.Values) { if (value.LocationID == locationID) { return value; } } return null; } private void CheckCrankSync() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_crankControl == (Object)null) { _crankControl = Object.FindObjectOfType<crankControl>(); } if ((Object)(object)_crankControl == (Object)null) { return; } bool flag = BackpackControl.batteryLocationID == 1; float batteryCharge = BackpackControl.batteryCharge; Quaternion rotation = ((Component)_crankControl).transform.rotation; bool flag2 = crankControl.holdTimer > 0; float num = (flag2 ? 0.05f : _crankSyncInterval); if (!(Time.time - _lastCrankSyncTime < num)) { _lastCrankSyncTime = Time.time; bool flag3 = flag && Mathf.Abs(batteryCharge - _lastCrankCharge) > 0.5f; bool flag4 = flag2 && Quaternion.Angle(_lastCrankRotation, rotation) > 2f; if (flag != _lastCrankHasBattery || flag3 || flag4) { _lastCrankHasBattery = flag; _lastCrankCharge = batteryCharge; _lastCrankRotation = rotation; SendCrankSync(flag, batteryCharge, rotation); } } } private void SendCrankSync(bool hasBattery, float charge, Quaternion rotation) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) _writer.Reset(); _writer.Put((byte)19); _writer.Put(hasBattery); _writer.Put(charge); WriteQuaternion(_writer, rotation); SendToAllPeers(); } private void CheckPuzzleInitSync() { if (!_steam.IsHost) { return; } if ((Object)(object)_puzzleMaster == (Object)null) { _puzzleMaster = Object.FindObjectOfType<PuzzleMaster>(); } if ((Object)(object)_puzzleMaster == (Object)null) { return; } if (!_puzzleInitSent) { SendPuzzleInit(); _puzzleInitSent = true; _lastTotalCompletedPuzzles = PuzzleMaster.totalCompletedPuzzles; } if (Time.time - _lastPuzzleStateSyncTime >= _puzzleStateSyncInterval) { _lastPuzzleStateSyncTime = Time.time; if (PuzzleMaster.totalCompletedPuzzles != _lastTotalCompletedPuzzles) { _lastTotalCompletedPuzzles = PuzzleMaster.totalCompletedPuzzles; SendPuzzleInit(); Plugin.Log.LogInfo((object)$"[Host] Re-synced puzzle state: completed={PuzzleMaster.totalCompletedPuzzles}"); } } } private void SendPuzzleInit() { if ((Object)(object)_puzzleMaster == (Object)null) { return; } _writer.Reset(); _writer.Put((byte)12); Type typeFromHandle = typeof(PuzzleMaster); Type typeFromHandle2 = typeof(PuzzleController); bool[] array = new bool[9]; int[] array2 = new int[9]; bool[] array3 = new bool[9]; PuzzleController[] array4 = (PuzzleController[])(object)new PuzzleController[9] { _puzzleMaster.pCon1, _puzzleMaster.pCon2, _puzzleMaster.pCon3, _puzzleMaster.pCon4, _puzzleMaster.pCon5, _puzzleMaster.pCon6, _puzzleMaster.pCon7, _puzzleMaster.pCon8, _puzzleMaster.pCon9 }; string[] array5 = new string[9] { "ps1", "ps2", "ps3", "ps4", "ps5", "ps6", "ps7", "ps8", "ps9" }; for (int i = 0; i < 9; i++) { FieldInfo field = typeFromHandle.GetField(array5[i], BindingFlags.Instance | BindingFlags.NonPublic); array[i] = (bool)field.GetValue(_puzzleMaster); if ((Object)(object)array4[i] != (Object)null) { FieldInfo field2 = typeFromHandle2.GetField("puzzlePresetID", BindingFlags.Instance | BindingFlags.NonPublic); array2[i] = (int)field2.GetValue(array4[i]); FieldInfo field3 = typeFromHandle2.GetField("puzzleHasCompleted", BindingFlags.Instance | BindingFlags.NonPublic); array3[i] = (bool)field3.GetValue(array4[i]); } } Type typeFromHandle3 = typeof(PuzzleBlock); for (int j = 0; j < 9; j++) { _writer.Put(array[j]); _writer.Put(array2[j]); _writer.Put(array3[j]); if ((Object)(object)array4[j] != (Object)null && array4[j].cubeList != null) { _writer.Put(array4[j].cubeList.Length); PuzzleBlock[] cubeList = array4[j].cubeList; foreach (PuzzleBlock val in cubeList) { _writer.Put(val.blockIDValue); } } else { _writer.Put(0); } } _writer.Put(PuzzleMaster.totalCompletedPuzzles); _writer.Put(PuzzleMaster.requiredPuzzles); SendToAllPeers(); Plugin.Log.LogInfo((object)$"[Host] Sent puzzle init: required={PuzzleMaster.requiredPuzzles}, completed={PuzzleMaster.totalCompletedPuzzles}"); } private void HandlePuzzleInit(PacketReader reader) { if (_steam.IsHost) { return; } Plugin.Log.LogInfo((object)"[Client] Received puzzle init"); bool[] array = new bool[9]; int[] array2 = new int[9]; bool[] array3 = new bool[9]; int[][] array4 = new int[9][]; for (int i = 0; i < 9; i++) { array[i] = reader.GetBool(); array2[i] = reader.GetInt(); array3[i] = reader.GetBool(); int @int = reader.GetInt(); array4[i] = new int[@int]; for (int j = 0; j < @int; j++) { array4[i][j] = reader.GetInt(); } } int int2 = reader.GetInt(); int int3 = reader.GetInt(); _pendingPuzzleInit = new PendingPuzzleInit { ActiveStates = array, PresetIDs = array2, CompletedStates = array3, BlockStates = array4, TotalCompleted = int2, RequiredPuzzles = int3 }; TryApplyPuzzleInit(); } private void TryApplyPuzzleInit() { if (_pendingPuzzleInit == null) { return; } if ((Object)(object)_puzzleMaster == (Object)null) { _puzzleMaster = Object.FindObjectOfType<PuzzleMaster>(); } if ((Object)(object)_puzzleMaster == (Object)null) { Plugin.Log.LogWarning((object)"[Client] PuzzleMaster not found, will retry later"); return; } Type typeFromHandle = typeof(PuzzleMaster); Type typeFromHandle2 = typeof(PuzzleController); PuzzleController[] array = (PuzzleController[])(object)new PuzzleController[9] { _puzzleMaster.pCon1, _puzzleMaster.pCon2, _puzzleMaster.pCon3, _puzzleMaster.pCon4, _puzzleMaster.pCon5, _puzzleMaster.pCon6, _puzzleMaster.pCon7, _puzzleMaster.pCon8, _puzzleMaster.pCon9 }; string[] array2 = new string[9] { "ps1", "ps2", "ps3", "ps4", "ps5", "ps6", "ps7", "ps8", "ps9" }; _isReceivingPuzzleBlock = true; for (int i = 0; i < 9; i++) { bool flag = _pendingPuzzleInit.ActiveStates[i]; int num = _pendingPuzzleInit.PresetIDs[i]; bool flag2 = _pendingPuzzleInit.CompletedStates[i]; typeFromHandle.GetField(array2[i], BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(_puzzleMaster, flag); if (!((Object)(object)array[i] != (Object)null)) { continue; } typeFromHandle2.GetField("puzzlePresetID", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(array[i], num); FieldInfo field = typeFromHandle2.GetField("puzzleHasCompleted", BindingFlags.Instance | BindingFlags.NonPublic); field?.SetValue(array[i], flag2); if (flag2) { if ((Object)(object)array[i].fanspin != (Object)null) { array[i].fanspin.isOn = true; } GameObject thisMapIndicator = array[i].thisMapIndicator; if (thisMapIndicator != null) { thisMapIndicator.SetActive(true); } } else if (!flag) { field?.SetValue(array[i], true); if ((Object)(object)array[i].fanspin != (Object)null) { array[i].fanspin.isOn = true; } GameObject thisMapIndicator2 = array[i].thisMapIndicator; if (thisMapIndicator2 != null) { thisMapIndicator2.SetActive(true); } } else { GameObject thisMapIndicator3 = array[i].thisMapIndicator; if (thisMapIndicator3 != null) { thisMapIndicator3.SetActive(false); } } int[] array3 = _pendingPuzzleInit.BlockStates[
BepInEx/plugins/Crawlspace2MP/Facepunch.Steamworks.Win64.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net; using System.Net.Sockets; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Steamworks.Data; using Steamworks.Ugc; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: AssemblyCompany("Garry Newman")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Facepunch.Steamworks.Win64")] [assembly: AssemblyTitle("Facepunch.Steamworks.Win64")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class IsReadOnlyAttribute : Attribute { } } namespace Steamworks { internal struct CallResult<T> : INotifyCompletion where T : struct, ICallbackData { private SteamAPICall_t call; private ISteamUtils utils; private bool server; public bool IsCompleted { get { bool pbFailed = false; if (utils.IsAPICallCompleted(call, ref pbFailed) || pbFailed) { return true; } return false; } } public CallResult(SteamAPICall_t call, bool server) { this.call = call; this.server = server; utils = (server ? SteamSharedClass<SteamUtils>.InterfaceServer : SteamSharedClass<SteamUtils>.InterfaceClient) as ISteamUtils; if (utils == null) { utils = SteamSharedClass<SteamUtils>.Interface as ISteamUtils; } } public void OnCompleted(Action continuation) { Dispatch.OnCallComplete<T>(call, continuation, server); } public T? GetResult() { bool pbFailed = false; if (!utils.IsAPICallCompleted(call, ref pbFailed) || pbFailed) { return null; } T val = default(T); int dataSize = val.DataSize; IntPtr intPtr = Marshal.AllocHGlobal(dataSize); try { if (!utils.GetAPICallResult(call, intPtr, dataSize, (int)val.CallbackType, ref pbFailed) || pbFailed) { Dispatch.OnDebugCallback?.Invoke(val.CallbackType, "!GetAPICallResult or failed", server); return null; } Dispatch.OnDebugCallback?.Invoke(val.CallbackType, Dispatch.CallbackToString(val.CallbackType, intPtr, dataSize), server); return (T)Marshal.PtrToStructure(intPtr, typeof(T)); } finally { Marshal.FreeHGlobal(intPtr); } } internal CallResult<T> GetAwaiter() { return this; } } internal interface ICallbackData { CallbackType CallbackType { get; } int DataSize { get; } } public class AuthTicket : IDisposable { public byte[] Data; public uint Handle; public void Cancel() { if (Handle != 0) { SteamUser.Internal.CancelAuthTicket(Handle); } Handle = 0u; Data = null; } public void Dispose() { Cancel(); } } public static class Dispatch { [StructLayout(LayoutKind.Sequential, Pack = 8)] internal struct CallbackMsg_t { public HSteamUser m_hSteamUser; public CallbackType Type; public IntPtr Data; public int DataSize; } private struct ResultCallback { public Action continuation; public bool server; } private struct Callback { public Action<IntPtr> action; public bool server; } public static Action<CallbackType, string, bool> OnDebugCallback; public static Action<Exception> OnException; private static bool runningFrame = false; private static List<Action<IntPtr>> actionsToCall = new List<Action<IntPtr>>(); private static Dictionary<ulong, ResultCallback> ResultCallbacks = new Dictionary<ulong, ResultCallback>(); private static Dictionary<CallbackType, List<Callback>> Callbacks = new Dictionary<CallbackType, List<Callback>>(); internal static HSteamPipe ClientPipe { get; set; } internal static HSteamPipe ServerPipe { get; set; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] internal static extern void SteamAPI_ManualDispatch_Init(); [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] internal static extern void SteamAPI_ManualDispatch_RunFrame(HSteamPipe pipe); [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)] internal static extern bool SteamAPI_ManualDispatch_GetNextCallback(HSteamPipe pipe, [In][Out] ref CallbackMsg_t msg); [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)] internal static extern bool SteamAPI_ManualDispatch_FreeLastCallback(HSteamPipe pipe); internal static void Init() { SteamAPI_ManualDispatch_Init(); } internal static void Frame(HSteamPipe pipe) { if (runningFrame) { return; } try { runningFrame = true; SteamAPI_ManualDispatch_RunFrame(pipe); SteamNetworkingUtils.OutputDebugMessages(); CallbackMsg_t msg = default(CallbackMsg_t); while (SteamAPI_ManualDispatch_GetNextCallback(pipe, ref msg)) { try { ProcessCallback(msg, pipe == ServerPipe); } finally { SteamAPI_ManualDispatch_FreeLastCallback(pipe); } } } catch (Exception obj) { OnException?.Invoke(obj); } finally { runningFrame = false; } } private static void ProcessCallback(CallbackMsg_t msg, bool isServer) { OnDebugCallback?.Invoke(msg.Type, CallbackToString(msg.Type, msg.Data, msg.DataSize), isServer); if (msg.Type == CallbackType.SteamAPICallCompleted) { ProcessResult(msg); } else { if (!Callbacks.TryGetValue(msg.Type, out var value)) { return; } actionsToCall.Clear(); foreach (Callback item in value) { if (item.server == isServer) { actionsToCall.Add(item.action); } } foreach (Action<IntPtr> item2 in actionsToCall) { item2(msg.Data); } actionsToCall.Clear(); } } internal static string CallbackToString(CallbackType type, IntPtr data, int expectedsize) { if (!CallbackTypeFactory.All.TryGetValue(type, out var value)) { return $"[{type} not in sdk]"; } object obj = data.ToType(value); if (obj == null) { return "[null]"; } string text = ""; FieldInfo[] fields = value.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (fields.Length == 0) { return "[no fields]"; } int num = fields.Max((FieldInfo x) => x.Name.Length) + 1; if (num < 10) { num = 10; } FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { int num2 = num - fieldInfo.Name.Length; if (num2 < 0) { num2 = 0; } text += $"{new string(' ', num2)}{fieldInfo.Name}: {fieldInfo.GetValue(obj)}\n"; } return text.Trim(new char[1] { '\n' }); } private static void ProcessResult(CallbackMsg_t msg) { SteamAPICallCompleted_t steamAPICallCompleted_t = msg.Data.ToType<SteamAPICallCompleted_t>(); if (!ResultCallbacks.TryGetValue(steamAPICallCompleted_t.AsyncCall, out var value)) { OnDebugCallback?.Invoke((CallbackType)steamAPICallCompleted_t.Callback, "[no callback waiting/required]", arg3: false); return; } ResultCallbacks.Remove(steamAPICallCompleted_t.AsyncCall); value.continuation(); } internal static async void LoopClientAsync() { while (ClientPipe != 0) { Frame(ClientPipe); await Task.Delay(16); } } internal static async void LoopServerAsync() { while (ServerPipe != 0) { Frame(ServerPipe); await Task.Delay(32); } } internal static void OnCallComplete<T>(SteamAPICall_t call, Action continuation, bool server) where T : struct, ICallbackData { ResultCallbacks[call.Value] = new ResultCallback { continuation = continuation, server = server }; } internal static void Install<T>(Action<T> p, bool server = false) where T : ICallbackData { CallbackType callbackType = default(T).CallbackType; if (!Callbacks.TryGetValue(callbackType, out var value)) { value = new List<Callback>(); Callbacks[callbackType] = value; } value.Add(new Callback { action = delegate(IntPtr x) { p(x.ToType<T>()); }, server = server }); } internal static void ShutdownServer() { ServerPipe = 0; foreach (KeyValuePair<CallbackType, List<Callback>> callback in Callbacks) { Callbacks[callback.Key].RemoveAll((Callback x) => x.server); } ResultCallbacks = ResultCallbacks.Where((KeyValuePair<ulong, ResultCallback> x) => !x.Value.server).ToDictionary((KeyValuePair<ulong, ResultCallback> x) => x.Key, (KeyValuePair<ulong, ResultCallback> x) => x.Value); } internal static void ShutdownClient() { ClientPipe = 0; foreach (KeyValuePair<CallbackType, List<Callback>> callback in Callbacks) { Callbacks[callback.Key].RemoveAll((Callback x) => !x.server); } ResultCallbacks = ResultCallbacks.Where((KeyValuePair<ulong, ResultCallback> x) => x.Value.server).ToDictionary((KeyValuePair<ulong, ResultCallback> x) => x.Key, (KeyValuePair<ulong, ResultCallback> x) => x.Value); } } internal static class SteamAPI { internal static class Native { [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool SteamAPI_Init(); [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] public static extern void SteamAPI_Shutdown(); [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] public static extern HSteamPipe SteamAPI_GetHSteamPipe(); [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool SteamAPI_RestartAppIfNecessary(uint unOwnAppID); } internal static bool Init() { return Native.SteamAPI_Init(); } internal static void Shutdown() { Native.SteamAPI_Shutdown(); } internal static HSteamPipe GetHSteamPipe() { return Native.SteamAPI_GetHSteamPipe(); } internal static bool RestartAppIfNecessary(uint unOwnAppID) { return Native.SteamAPI_RestartAppIfNecessary(unOwnAppID); } } internal static class SteamGameServer { internal static class Native { [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] public static extern void SteamGameServer_RunCallbacks(); [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] public static extern void SteamGameServer_Shutdown(); [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] public static extern HSteamPipe SteamGameServer_GetHSteamPipe(); } internal static void RunCallbacks() { Native.SteamGameServer_RunCallbacks(); } internal static void Shutdown() { Native.SteamGameServer_Shutdown(); } internal static HSteamPipe GetHSteamPipe() { return Native.SteamGameServer_GetHSteamPipe(); } } internal static class SteamInternal { internal static class Native { [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] [return: MarshalAs(UnmanagedType.I1)] public static extern bool SteamInternal_GameServer_Init(uint unIP, ushort usPort, ushort usGamePort, ushort usQueryPort, int eServerMode, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersionString); } internal static bool GameServer_Init(uint unIP, ushort usPort, ushort usGamePort, ushort usQueryPort, int eServerMode, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersionString) { return Native.SteamInternal_GameServer_Init(unIP, usPort, usGamePort, usQueryPort, eServerMode, pchVersionString); } } public enum CallbackType { SteamServersConnected = 101, SteamServerConnectFailure = 102, SteamServersDisconnected = 103, ClientGameServerDeny = 113, GSPolicyResponse = 115, IPCFailure = 117, LicensesUpdated = 125, ValidateAuthTicketResponse = 143, MicroTxnAuthorizationResponse = 152, EncryptedAppTicketResponse = 154, GetAuthSessionTicketResponse = 163, GameWebCallback = 164, StoreAuthURLResponse = 165, MarketEligibilityResponse = 166, DurationControl = 167, GSClientApprove = 201, GSClientDeny = 202, GSClientKick = 203, GSClientAchievementStatus = 206, GSGameplayStats = 207, GSClientGroupStatus = 208, GSReputation = 209, AssociateWithClanResult = 210, ComputeNewPlayerCompatibilityResult = 211, PersonaStateChange = 304, GameOverlayActivated = 331, GameServerChangeRequested = 332, GameLobbyJoinRequested = 333, AvatarImageLoaded = 334, ClanOfficerListResponse = 335, FriendRichPresenceUpdate = 336, GameRichPresenceJoinRequested = 337, GameConnectedClanChatMsg = 338, GameConnectedChatJoin = 339, GameConnectedChatLeave = 340, DownloadClanActivityCountsResult = 341, JoinClanChatRoomCompletionResult = 342, GameConnectedFriendChatMsg = 343, FriendsGetFollowerCount = 344, FriendsIsFollowing = 345, FriendsEnumerateFollowingList = 346, SetPersonaNameResponse = 347, UnreadChatMessagesChanged = 348, FavoritesListChanged = 502, LobbyInvite = 503, LobbyEnter = 504, LobbyDataUpdate = 505, LobbyChatUpdate = 506, LobbyChatMsg = 507, LobbyGameCreated = 509, LobbyMatchList = 510, LobbyKicked = 512, LobbyCreated = 513, PSNGameBootInviteResult = 515, FavoritesListAccountsUpdated = 516, IPCountry = 701, LowBatteryPower = 702, SteamAPICallCompleted = 703, SteamShutdown = 704, CheckFileSignature = 705, GamepadTextInputDismissed = 714, DlcInstalled = 1005, RegisterActivationCodeResponse = 1008, NewUrlLaunchParameters = 1014, AppProofOfPurchaseKeyResponse = 1021, FileDetailsResult = 1023, UserStatsReceived = 1101, UserStatsStored = 1102, UserAchievementStored = 1103, LeaderboardFindResult = 1104, LeaderboardScoresDownloaded = 1105, LeaderboardScoreUploaded = 1106, NumberOfCurrentPlayers = 1107, UserStatsUnloaded = 1108, GSStatsUnloaded = 1108, UserAchievementIconFetched = 1109, GlobalAchievementPercentagesReady = 1110, LeaderboardUGCSet = 1111, GlobalStatsReceived = 1112, P2PSessionRequest = 1202, P2PSessionConnectFail = 1203, SteamNetConnectionStatusChangedCallback = 1221, SteamNetAuthenticationStatus = 1222, SteamRelayNetworkStatus = 1281, RemoteStorageAppSyncedClient = 1301, RemoteStorageAppSyncedServer = 1302, RemoteStorageAppSyncProgress = 1303, RemoteStorageAppSyncStatusCheck = 1305, RemoteStorageFileShareResult = 1307, RemoteStoragePublishFileResult = 1309, RemoteStorageDeletePublishedFileResult = 1311, RemoteStorageEnumerateUserPublishedFilesResult = 1312, RemoteStorageSubscribePublishedFileResult = 1313, RemoteStorageEnumerateUserSubscribedFilesResult = 1314, RemoteStorageUnsubscribePublishedFileResult = 1315, RemoteStorageUpdatePublishedFileResult = 1316, RemoteStorageDownloadUGCResult = 1317, RemoteStorageGetPublishedFileDetailsResult = 1318, RemoteStorageEnumerateWorkshopFilesResult = 1319, RemoteStorageGetPublishedItemVoteDetailsResult = 1320, RemoteStoragePublishedFileSubscribed = 1321, RemoteStoragePublishedFileUnsubscribed = 1322, RemoteStoragePublishedFileDeleted = 1323, RemoteStorageUpdateUserPublishedItemVoteResult = 1324, RemoteStorageUserVoteDetails = 1325, RemoteStorageEnumerateUserSharedWorkshopFilesResult = 1326, RemoteStorageSetUserPublishedFileActionResult = 1327, RemoteStorageEnumeratePublishedFilesByUserActionResult = 1328, RemoteStoragePublishFileProgress = 1329, RemoteStoragePublishedFileUpdated = 1330, RemoteStorageFileWriteAsyncComplete = 1331, RemoteStorageFileReadAsyncComplete = 1332, GSStatsReceived = 1800, GSStatsStored = 1801, HTTPRequestCompleted = 2101, HTTPRequestHeadersReceived = 2102, HTTPRequestDataReceived = 2103, ScreenshotReady = 2301, ScreenshotRequested = 2302, SteamUGCQueryCompleted = 3401, SteamUGCRequestUGCDetailsResult = 3402, CreateItemResult = 3403, SubmitItemUpdateResult = 3404, ItemInstalled = 3405, DownloadItemResult = 3406, UserFavoriteItemsListChanged = 3407, SetUserItemVoteResult = 3408, GetUserItemVoteResult = 3409, StartPlaytimeTrackingResult = 3410, StopPlaytimeTrackingResult = 3411, AddUGCDependencyResult = 3412, RemoveUGCDependencyResult = 3413, AddAppDependencyResult = 3414, RemoveAppDependencyResult = 3415, GetAppDependenciesResult = 3416, DeleteItemResult = 3417, SteamAppInstalled = 3901, SteamAppUninstalled = 3902, PlaybackStatusHasChanged = 4001, VolumeHasChanged = 4002, MusicPlayerWantsVolume = 4011, MusicPlayerSelectsQueueEntry = 4012, MusicPlayerSelectsPlaylistEntry = 4013, MusicPlayerRemoteWillActivate = 4101, MusicPlayerRemoteWillDeactivate = 4102, MusicPlayerRemoteToFront = 4103, MusicPlayerWillQuit = 4104, MusicPlayerWantsPlay = 4105, MusicPlayerWantsPause = 4106, MusicPlayerWantsPlayPrevious = 4107, MusicPlayerWantsPlayNext = 4108, MusicPlayerWantsShuffled = 4109, MusicPlayerWantsLooped = 4110, MusicPlayerWantsPlayingRepeatStatus = 4114, HTML_BrowserReady = 4501, HTML_NeedsPaint = 4502, HTML_StartRequest = 4503, HTML_CloseBrowser = 4504, HTML_URLChanged = 4505, HTML_FinishedRequest = 4506, HTML_OpenLinkInNewTab = 4507, HTML_ChangedTitle = 4508, HTML_SearchResults = 4509, HTML_CanGoBackAndForward = 4510, HTML_HorizontalScroll = 4511, HTML_VerticalScroll = 4512, HTML_LinkAtPosition = 4513, HTML_JSAlert = 4514, HTML_JSConfirm = 4515, HTML_FileOpenDialog = 4516, HTML_NewWindow = 4521, HTML_SetCursor = 4522, HTML_StatusText = 4523, HTML_ShowToolTip = 4524, HTML_UpdateToolTip = 4525, HTML_HideToolTip = 4526, HTML_BrowserRestarted = 4527, BroadcastUploadStart = 4604, BroadcastUploadStop = 4605, GetVideoURLResult = 4611, GetOPFSettingsResult = 4624, SteamInventoryResultReady = 4700, SteamInventoryFullUpdate = 4701, SteamInventoryDefinitionUpdate = 4702, SteamInventoryEligiblePromoItemDefIDs = 4703, SteamInventoryStartPurchaseResult = 4704, SteamInventoryRequestPricesResult = 4705, SteamParentalSettingsChanged = 5001, SearchForGameProgressCallback = 5201, SearchForGameResultCallback = 5202, RequestPlayersForGameProgressCallback = 5211, RequestPlayersForGameResultCallback = 5212, RequestPlayersForGameFinalResultCallback = 5213, SubmitPlayerResultResultCallback = 5214, EndGameResultCallback = 5215, JoinPartyCallback = 5301, CreateBeaconCallback = 5302, ReservationNotificationCallback = 5303, ChangeNumOpenSlotsCallback = 5304, AvailableBeaconLocationsUpdated = 5305, ActiveBeaconsUpdated = 5306, SteamRemotePlaySessionConnected = 5701, SteamRemotePlaySessionDisconnected = 5702 } internal static class CallbackTypeFactory { internal static Dictionary<CallbackType, Type> All = new Dictionary<CallbackType, Type> { { CallbackType.SteamServersConnected, typeof(SteamServersConnected_t) }, { CallbackType.SteamServerConnectFailure, typeof(SteamServerConnectFailure_t) }, { CallbackType.SteamServersDisconnected, typeof(SteamServersDisconnected_t) }, { CallbackType.ClientGameServerDeny, typeof(ClientGameServerDeny_t) }, { CallbackType.GSPolicyResponse, typeof(GSPolicyResponse_t) }, { CallbackType.IPCFailure, typeof(IPCFailure_t) }, { CallbackType.LicensesUpdated, typeof(LicensesUpdated_t) }, { CallbackType.ValidateAuthTicketResponse, typeof(ValidateAuthTicketResponse_t) }, { CallbackType.MicroTxnAuthorizationResponse, typeof(MicroTxnAuthorizationResponse_t) }, { CallbackType.EncryptedAppTicketResponse, typeof(EncryptedAppTicketResponse_t) }, { CallbackType.GetAuthSessionTicketResponse, typeof(GetAuthSessionTicketResponse_t) }, { CallbackType.GameWebCallback, typeof(GameWebCallback_t) }, { CallbackType.StoreAuthURLResponse, typeof(StoreAuthURLResponse_t) }, { CallbackType.MarketEligibilityResponse, typeof(MarketEligibilityResponse_t) }, { CallbackType.DurationControl, typeof(DurationControl_t) }, { CallbackType.GSClientApprove, typeof(GSClientApprove_t) }, { CallbackType.GSClientDeny, typeof(GSClientDeny_t) }, { CallbackType.GSClientKick, typeof(GSClientKick_t) }, { CallbackType.GSClientAchievementStatus, typeof(GSClientAchievementStatus_t) }, { CallbackType.GSGameplayStats, typeof(GSGameplayStats_t) }, { CallbackType.GSClientGroupStatus, typeof(GSClientGroupStatus_t) }, { CallbackType.GSReputation, typeof(GSReputation_t) }, { CallbackType.AssociateWithClanResult, typeof(AssociateWithClanResult_t) }, { CallbackType.ComputeNewPlayerCompatibilityResult, typeof(ComputeNewPlayerCompatibilityResult_t) }, { CallbackType.PersonaStateChange, typeof(PersonaStateChange_t) }, { CallbackType.GameOverlayActivated, typeof(GameOverlayActivated_t) }, { CallbackType.GameServerChangeRequested, typeof(GameServerChangeRequested_t) }, { CallbackType.GameLobbyJoinRequested, typeof(GameLobbyJoinRequested_t) }, { CallbackType.AvatarImageLoaded, typeof(AvatarImageLoaded_t) }, { CallbackType.ClanOfficerListResponse, typeof(ClanOfficerListResponse_t) }, { CallbackType.FriendRichPresenceUpdate, typeof(FriendRichPresenceUpdate_t) }, { CallbackType.GameRichPresenceJoinRequested, typeof(GameRichPresenceJoinRequested_t) }, { CallbackType.GameConnectedClanChatMsg, typeof(GameConnectedClanChatMsg_t) }, { CallbackType.GameConnectedChatJoin, typeof(GameConnectedChatJoin_t) }, { CallbackType.GameConnectedChatLeave, typeof(GameConnectedChatLeave_t) }, { CallbackType.DownloadClanActivityCountsResult, typeof(DownloadClanActivityCountsResult_t) }, { CallbackType.JoinClanChatRoomCompletionResult, typeof(JoinClanChatRoomCompletionResult_t) }, { CallbackType.GameConnectedFriendChatMsg, typeof(GameConnectedFriendChatMsg_t) }, { CallbackType.FriendsGetFollowerCount, typeof(FriendsGetFollowerCount_t) }, { CallbackType.FriendsIsFollowing, typeof(FriendsIsFollowing_t) }, { CallbackType.FriendsEnumerateFollowingList, typeof(FriendsEnumerateFollowingList_t) }, { CallbackType.SetPersonaNameResponse, typeof(SetPersonaNameResponse_t) }, { CallbackType.UnreadChatMessagesChanged, typeof(UnreadChatMessagesChanged_t) }, { CallbackType.FavoritesListChanged, typeof(FavoritesListChanged_t) }, { CallbackType.LobbyInvite, typeof(LobbyInvite_t) }, { CallbackType.LobbyEnter, typeof(LobbyEnter_t) }, { CallbackType.LobbyDataUpdate, typeof(LobbyDataUpdate_t) }, { CallbackType.LobbyChatUpdate, typeof(LobbyChatUpdate_t) }, { CallbackType.LobbyChatMsg, typeof(LobbyChatMsg_t) }, { CallbackType.LobbyGameCreated, typeof(LobbyGameCreated_t) }, { CallbackType.LobbyMatchList, typeof(LobbyMatchList_t) }, { CallbackType.LobbyKicked, typeof(LobbyKicked_t) }, { CallbackType.LobbyCreated, typeof(LobbyCreated_t) }, { CallbackType.PSNGameBootInviteResult, typeof(PSNGameBootInviteResult_t) }, { CallbackType.FavoritesListAccountsUpdated, typeof(FavoritesListAccountsUpdated_t) }, { CallbackType.IPCountry, typeof(IPCountry_t) }, { CallbackType.LowBatteryPower, typeof(LowBatteryPower_t) }, { CallbackType.SteamAPICallCompleted, typeof(SteamAPICallCompleted_t) }, { CallbackType.SteamShutdown, typeof(SteamShutdown_t) }, { CallbackType.CheckFileSignature, typeof(CheckFileSignature_t) }, { CallbackType.GamepadTextInputDismissed, typeof(GamepadTextInputDismissed_t) }, { CallbackType.DlcInstalled, typeof(DlcInstalled_t) }, { CallbackType.RegisterActivationCodeResponse, typeof(RegisterActivationCodeResponse_t) }, { CallbackType.NewUrlLaunchParameters, typeof(NewUrlLaunchParameters_t) }, { CallbackType.AppProofOfPurchaseKeyResponse, typeof(AppProofOfPurchaseKeyResponse_t) }, { CallbackType.FileDetailsResult, typeof(FileDetailsResult_t) }, { CallbackType.UserStatsReceived, typeof(UserStatsReceived_t) }, { CallbackType.UserStatsStored, typeof(UserStatsStored_t) }, { CallbackType.UserAchievementStored, typeof(UserAchievementStored_t) }, { CallbackType.LeaderboardFindResult, typeof(LeaderboardFindResult_t) }, { CallbackType.LeaderboardScoresDownloaded, typeof(LeaderboardScoresDownloaded_t) }, { CallbackType.LeaderboardScoreUploaded, typeof(LeaderboardScoreUploaded_t) }, { CallbackType.NumberOfCurrentPlayers, typeof(NumberOfCurrentPlayers_t) }, { CallbackType.UserStatsUnloaded, typeof(UserStatsUnloaded_t) }, { CallbackType.UserAchievementIconFetched, typeof(UserAchievementIconFetched_t) }, { CallbackType.GlobalAchievementPercentagesReady, typeof(GlobalAchievementPercentagesReady_t) }, { CallbackType.LeaderboardUGCSet, typeof(LeaderboardUGCSet_t) }, { CallbackType.GlobalStatsReceived, typeof(GlobalStatsReceived_t) }, { CallbackType.P2PSessionRequest, typeof(P2PSessionRequest_t) }, { CallbackType.P2PSessionConnectFail, typeof(P2PSessionConnectFail_t) }, { CallbackType.SteamNetConnectionStatusChangedCallback, typeof(SteamNetConnectionStatusChangedCallback_t) }, { CallbackType.SteamNetAuthenticationStatus, typeof(SteamNetAuthenticationStatus_t) }, { CallbackType.SteamRelayNetworkStatus, typeof(SteamRelayNetworkStatus_t) }, { CallbackType.RemoteStorageAppSyncedClient, typeof(RemoteStorageAppSyncedClient_t) }, { CallbackType.RemoteStorageAppSyncedServer, typeof(RemoteStorageAppSyncedServer_t) }, { CallbackType.RemoteStorageAppSyncProgress, typeof(RemoteStorageAppSyncProgress_t) }, { CallbackType.RemoteStorageAppSyncStatusCheck, typeof(RemoteStorageAppSyncStatusCheck_t) }, { CallbackType.RemoteStorageFileShareResult, typeof(RemoteStorageFileShareResult_t) }, { CallbackType.RemoteStoragePublishFileResult, typeof(RemoteStoragePublishFileResult_t) }, { CallbackType.RemoteStorageDeletePublishedFileResult, typeof(RemoteStorageDeletePublishedFileResult_t) }, { CallbackType.RemoteStorageEnumerateUserPublishedFilesResult, typeof(RemoteStorageEnumerateUserPublishedFilesResult_t) }, { CallbackType.RemoteStorageSubscribePublishedFileResult, typeof(RemoteStorageSubscribePublishedFileResult_t) }, { CallbackType.RemoteStorageEnumerateUserSubscribedFilesResult, typeof(RemoteStorageEnumerateUserSubscribedFilesResult_t) }, { CallbackType.RemoteStorageUnsubscribePublishedFileResult, typeof(RemoteStorageUnsubscribePublishedFileResult_t) }, { CallbackType.RemoteStorageUpdatePublishedFileResult, typeof(RemoteStorageUpdatePublishedFileResult_t) }, { CallbackType.RemoteStorageDownloadUGCResult, typeof(RemoteStorageDownloadUGCResult_t) }, { CallbackType.RemoteStorageGetPublishedFileDetailsResult, typeof(RemoteStorageGetPublishedFileDetailsResult_t) }, { CallbackType.RemoteStorageEnumerateWorkshopFilesResult, typeof(RemoteStorageEnumerateWorkshopFilesResult_t) }, { CallbackType.RemoteStorageGetPublishedItemVoteDetailsResult, typeof(RemoteStorageGetPublishedItemVoteDetailsResult_t) }, { CallbackType.RemoteStoragePublishedFileSubscribed, typeof(RemoteStoragePublishedFileSubscribed_t) }, { CallbackType.RemoteStoragePublishedFileUnsubscribed, typeof(RemoteStoragePublishedFileUnsubscribed_t) }, { CallbackType.RemoteStoragePublishedFileDeleted, typeof(RemoteStoragePublishedFileDeleted_t) }, { CallbackType.RemoteStorageUpdateUserPublishedItemVoteResult, typeof(RemoteStorageUpdateUserPublishedItemVoteResult_t) }, { CallbackType.RemoteStorageUserVoteDetails, typeof(RemoteStorageUserVoteDetails_t) }, { CallbackType.RemoteStorageEnumerateUserSharedWorkshopFilesResult, typeof(RemoteStorageEnumerateUserSharedWorkshopFilesResult_t) }, { CallbackType.RemoteStorageSetUserPublishedFileActionResult, typeof(RemoteStorageSetUserPublishedFileActionResult_t) }, { CallbackType.RemoteStorageEnumeratePublishedFilesByUserActionResult, typeof(RemoteStorageEnumeratePublishedFilesByUserActionResult_t) }, { CallbackType.RemoteStoragePublishFileProgress, typeof(RemoteStoragePublishFileProgress_t) }, { CallbackType.RemoteStoragePublishedFileUpdated, typeof(RemoteStoragePublishedFileUpdated_t) }, { CallbackType.RemoteStorageFileWriteAsyncComplete, typeof(RemoteStorageFileWriteAsyncComplete_t) }, { CallbackType.RemoteStorageFileReadAsyncComplete, typeof(RemoteStorageFileReadAsyncComplete_t) }, { CallbackType.GSStatsReceived, typeof(GSStatsReceived_t) }, { CallbackType.GSStatsStored, typeof(GSStatsStored_t) }, { CallbackType.HTTPRequestCompleted, typeof(HTTPRequestCompleted_t) }, { CallbackType.HTTPRequestHeadersReceived, typeof(HTTPRequestHeadersReceived_t) }, { CallbackType.HTTPRequestDataReceived, typeof(HTTPRequestDataReceived_t) }, { CallbackType.ScreenshotReady, typeof(ScreenshotReady_t) }, { CallbackType.ScreenshotRequested, typeof(ScreenshotRequested_t) }, { CallbackType.SteamUGCQueryCompleted, typeof(SteamUGCQueryCompleted_t) }, { CallbackType.SteamUGCRequestUGCDetailsResult, typeof(SteamUGCRequestUGCDetailsResult_t) }, { CallbackType.CreateItemResult, typeof(CreateItemResult_t) }, { CallbackType.SubmitItemUpdateResult, typeof(SubmitItemUpdateResult_t) }, { CallbackType.ItemInstalled, typeof(ItemInstalled_t) }, { CallbackType.DownloadItemResult, typeof(DownloadItemResult_t) }, { CallbackType.UserFavoriteItemsListChanged, typeof(UserFavoriteItemsListChanged_t) }, { CallbackType.SetUserItemVoteResult, typeof(SetUserItemVoteResult_t) }, { CallbackType.GetUserItemVoteResult, typeof(GetUserItemVoteResult_t) }, { CallbackType.StartPlaytimeTrackingResult, typeof(StartPlaytimeTrackingResult_t) }, { CallbackType.StopPlaytimeTrackingResult, typeof(StopPlaytimeTrackingResult_t) }, { CallbackType.AddUGCDependencyResult, typeof(AddUGCDependencyResult_t) }, { CallbackType.RemoveUGCDependencyResult, typeof(RemoveUGCDependencyResult_t) }, { CallbackType.AddAppDependencyResult, typeof(AddAppDependencyResult_t) }, { CallbackType.RemoveAppDependencyResult, typeof(RemoveAppDependencyResult_t) }, { CallbackType.GetAppDependenciesResult, typeof(GetAppDependenciesResult_t) }, { CallbackType.DeleteItemResult, typeof(DeleteItemResult_t) }, { CallbackType.SteamAppInstalled, typeof(SteamAppInstalled_t) }, { CallbackType.SteamAppUninstalled, typeof(SteamAppUninstalled_t) }, { CallbackType.PlaybackStatusHasChanged, typeof(PlaybackStatusHasChanged_t) }, { CallbackType.VolumeHasChanged, typeof(VolumeHasChanged_t) }, { CallbackType.MusicPlayerWantsVolume, typeof(MusicPlayerWantsVolume_t) }, { CallbackType.MusicPlayerSelectsQueueEntry, typeof(MusicPlayerSelectsQueueEntry_t) }, { CallbackType.MusicPlayerSelectsPlaylistEntry, typeof(MusicPlayerSelectsPlaylistEntry_t) }, { CallbackType.MusicPlayerRemoteWillActivate, typeof(MusicPlayerRemoteWillActivate_t) }, { CallbackType.MusicPlayerRemoteWillDeactivate, typeof(MusicPlayerRemoteWillDeactivate_t) }, { CallbackType.MusicPlayerRemoteToFront, typeof(MusicPlayerRemoteToFront_t) }, { CallbackType.MusicPlayerWillQuit, typeof(MusicPlayerWillQuit_t) }, { CallbackType.MusicPlayerWantsPlay, typeof(MusicPlayerWantsPlay_t) }, { CallbackType.MusicPlayerWantsPause, typeof(MusicPlayerWantsPause_t) }, { CallbackType.MusicPlayerWantsPlayPrevious, typeof(MusicPlayerWantsPlayPrevious_t) }, { CallbackType.MusicPlayerWantsPlayNext, typeof(MusicPlayerWantsPlayNext_t) }, { CallbackType.MusicPlayerWantsShuffled, typeof(MusicPlayerWantsShuffled_t) }, { CallbackType.MusicPlayerWantsLooped, typeof(MusicPlayerWantsLooped_t) }, { CallbackType.MusicPlayerWantsPlayingRepeatStatus, typeof(MusicPlayerWantsPlayingRepeatStatus_t) }, { CallbackType.HTML_BrowserReady, typeof(HTML_BrowserReady_t) }, { CallbackType.HTML_NeedsPaint, typeof(HTML_NeedsPaint_t) }, { CallbackType.HTML_StartRequest, typeof(HTML_StartRequest_t) }, { CallbackType.HTML_CloseBrowser, typeof(HTML_CloseBrowser_t) }, { CallbackType.HTML_URLChanged, typeof(HTML_URLChanged_t) }, { CallbackType.HTML_FinishedRequest, typeof(HTML_FinishedRequest_t) }, { CallbackType.HTML_OpenLinkInNewTab, typeof(HTML_OpenLinkInNewTab_t) }, { CallbackType.HTML_ChangedTitle, typeof(HTML_ChangedTitle_t) }, { CallbackType.HTML_SearchResults, typeof(HTML_SearchResults_t) }, { CallbackType.HTML_CanGoBackAndForward, typeof(HTML_CanGoBackAndForward_t) }, { CallbackType.HTML_HorizontalScroll, typeof(HTML_HorizontalScroll_t) }, { CallbackType.HTML_VerticalScroll, typeof(HTML_VerticalScroll_t) }, { CallbackType.HTML_LinkAtPosition, typeof(HTML_LinkAtPosition_t) }, { CallbackType.HTML_JSAlert, typeof(HTML_JSAlert_t) }, { CallbackType.HTML_JSConfirm, typeof(HTML_JSConfirm_t) }, { CallbackType.HTML_FileOpenDialog, typeof(HTML_FileOpenDialog_t) }, { CallbackType.HTML_NewWindow, typeof(HTML_NewWindow_t) }, { CallbackType.HTML_SetCursor, typeof(HTML_SetCursor_t) }, { CallbackType.HTML_StatusText, typeof(HTML_StatusText_t) }, { CallbackType.HTML_ShowToolTip, typeof(HTML_ShowToolTip_t) }, { CallbackType.HTML_UpdateToolTip, typeof(HTML_UpdateToolTip_t) }, { CallbackType.HTML_HideToolTip, typeof(HTML_HideToolTip_t) }, { CallbackType.HTML_BrowserRestarted, typeof(HTML_BrowserRestarted_t) }, { CallbackType.BroadcastUploadStart, typeof(BroadcastUploadStart_t) }, { CallbackType.BroadcastUploadStop, typeof(BroadcastUploadStop_t) }, { CallbackType.GetVideoURLResult, typeof(GetVideoURLResult_t) }, { CallbackType.GetOPFSettingsResult, typeof(GetOPFSettingsResult_t) }, { CallbackType.SteamInventoryResultReady, typeof(SteamInventoryResultReady_t) }, { CallbackType.SteamInventoryFullUpdate, typeof(SteamInventoryFullUpdate_t) }, { CallbackType.SteamInventoryDefinitionUpdate, typeof(SteamInventoryDefinitionUpdate_t) }, { CallbackType.SteamInventoryEligiblePromoItemDefIDs, typeof(SteamInventoryEligiblePromoItemDefIDs_t) }, { CallbackType.SteamInventoryStartPurchaseResult, typeof(SteamInventoryStartPurchaseResult_t) }, { CallbackType.SteamInventoryRequestPricesResult, typeof(SteamInventoryRequestPricesResult_t) }, { CallbackType.SteamParentalSettingsChanged, typeof(SteamParentalSettingsChanged_t) }, { CallbackType.SearchForGameProgressCallback, typeof(SearchForGameProgressCallback_t) }, { CallbackType.SearchForGameResultCallback, typeof(SearchForGameResultCallback_t) }, { CallbackType.RequestPlayersForGameProgressCallback, typeof(RequestPlayersForGameProgressCallback_t) }, { CallbackType.RequestPlayersForGameResultCallback, typeof(RequestPlayersForGameResultCallback_t) }, { CallbackType.RequestPlayersForGameFinalResultCallback, typeof(RequestPlayersForGameFinalResultCallback_t) }, { CallbackType.SubmitPlayerResultResultCallback, typeof(SubmitPlayerResultResultCallback_t) }, { CallbackType.EndGameResultCallback, typeof(EndGameResultCallback_t) }, { CallbackType.JoinPartyCallback, typeof(JoinPartyCallback_t) }, { CallbackType.CreateBeaconCallback, typeof(CreateBeaconCallback_t) }, { CallbackType.ReservationNotificationCallback, typeof(ReservationNotificationCallback_t) }, { CallbackType.ChangeNumOpenSlotsCallback, typeof(ChangeNumOpenSlotsCallback_t) }, { CallbackType.AvailableBeaconLocationsUpdated, typeof(AvailableBeaconLocationsUpdated_t) }, { CallbackType.ActiveBeaconsUpdated, typeof(ActiveBeaconsUpdated_t) }, { CallbackType.SteamRemotePlaySessionConnected, typeof(SteamRemotePlaySessionConnected_t) }, { CallbackType.SteamRemotePlaySessionDisconnected, typeof(SteamRemotePlaySessionDisconnected_t) } }; } internal class ISteamAppList : SteamInterface { internal ISteamAppList(bool IsGameServer) { SetupInterface(IsGameServer); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr SteamAPI_SteamAppList_v001(); public override IntPtr GetUserInterfacePointer() { return SteamAPI_SteamAppList_v001(); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamAppList_GetNumInstalledApps")] private static extern uint _GetNumInstalledApps(IntPtr self); internal uint GetNumInstalledApps() { return _GetNumInstalledApps(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamAppList_GetInstalledApps")] private static extern uint _GetInstalledApps(IntPtr self, [In][Out] AppId[] pvecAppID, uint unMaxAppIDs); internal uint GetInstalledApps([In][Out] AppId[] pvecAppID, uint unMaxAppIDs) { return _GetInstalledApps(Self, pvecAppID, unMaxAppIDs); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamAppList_GetAppName")] private static extern int _GetAppName(IntPtr self, AppId nAppID, IntPtr pchName, int cchNameMax); internal int GetAppName(AppId nAppID, out string pchName) { IntPtr intPtr = Helpers.TakeMemory(); int result = _GetAppName(Self, nAppID, intPtr, 32768); pchName = Helpers.MemoryToString(intPtr); return result; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamAppList_GetAppInstallDir")] private static extern int _GetAppInstallDir(IntPtr self, AppId nAppID, IntPtr pchDirectory, int cchNameMax); internal int GetAppInstallDir(AppId nAppID, out string pchDirectory) { IntPtr intPtr = Helpers.TakeMemory(); int result = _GetAppInstallDir(Self, nAppID, intPtr, 32768); pchDirectory = Helpers.MemoryToString(intPtr); return result; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamAppList_GetAppBuildId")] private static extern int _GetAppBuildId(IntPtr self, AppId nAppID); internal int GetAppBuildId(AppId nAppID) { return _GetAppBuildId(Self, nAppID); } } internal class ISteamApps : SteamInterface { internal ISteamApps(bool IsGameServer) { SetupInterface(IsGameServer); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr SteamAPI_SteamApps_v008(); public override IntPtr GetUserInterfacePointer() { return SteamAPI_SteamApps_v008(); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr SteamAPI_SteamGameServerApps_v008(); public override IntPtr GetServerInterfacePointer() { return SteamAPI_SteamGameServerApps_v008(); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_BIsSubscribed")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _BIsSubscribed(IntPtr self); internal bool BIsSubscribed() { return _BIsSubscribed(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_BIsLowViolence")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _BIsLowViolence(IntPtr self); internal bool BIsLowViolence() { return _BIsLowViolence(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_BIsCybercafe")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _BIsCybercafe(IntPtr self); internal bool BIsCybercafe() { return _BIsCybercafe(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_BIsVACBanned")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _BIsVACBanned(IntPtr self); internal bool BIsVACBanned() { return _BIsVACBanned(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_GetCurrentGameLanguage")] private static extern Utf8StringPointer _GetCurrentGameLanguage(IntPtr self); internal string GetCurrentGameLanguage() { Utf8StringPointer utf8StringPointer = _GetCurrentGameLanguage(Self); return utf8StringPointer; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_GetAvailableGameLanguages")] private static extern Utf8StringPointer _GetAvailableGameLanguages(IntPtr self); internal string GetAvailableGameLanguages() { Utf8StringPointer utf8StringPointer = _GetAvailableGameLanguages(Self); return utf8StringPointer; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_BIsSubscribedApp")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _BIsSubscribedApp(IntPtr self, AppId appID); internal bool BIsSubscribedApp(AppId appID) { return _BIsSubscribedApp(Self, appID); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_BIsDlcInstalled")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _BIsDlcInstalled(IntPtr self, AppId appID); internal bool BIsDlcInstalled(AppId appID) { return _BIsDlcInstalled(Self, appID); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_GetEarliestPurchaseUnixTime")] private static extern uint _GetEarliestPurchaseUnixTime(IntPtr self, AppId nAppID); internal uint GetEarliestPurchaseUnixTime(AppId nAppID) { return _GetEarliestPurchaseUnixTime(Self, nAppID); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_BIsSubscribedFromFreeWeekend")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _BIsSubscribedFromFreeWeekend(IntPtr self); internal bool BIsSubscribedFromFreeWeekend() { return _BIsSubscribedFromFreeWeekend(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_GetDLCCount")] private static extern int _GetDLCCount(IntPtr self); internal int GetDLCCount() { return _GetDLCCount(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_BGetDLCDataByIndex")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _BGetDLCDataByIndex(IntPtr self, int iDLC, ref AppId pAppID, [MarshalAs(UnmanagedType.U1)] ref bool pbAvailable, IntPtr pchName, int cchNameBufferSize); internal bool BGetDLCDataByIndex(int iDLC, ref AppId pAppID, [MarshalAs(UnmanagedType.U1)] ref bool pbAvailable, out string pchName) { IntPtr intPtr = Helpers.TakeMemory(); bool result = _BGetDLCDataByIndex(Self, iDLC, ref pAppID, ref pbAvailable, intPtr, 32768); pchName = Helpers.MemoryToString(intPtr); return result; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_InstallDLC")] private static extern void _InstallDLC(IntPtr self, AppId nAppID); internal void InstallDLC(AppId nAppID) { _InstallDLC(Self, nAppID); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_UninstallDLC")] private static extern void _UninstallDLC(IntPtr self, AppId nAppID); internal void UninstallDLC(AppId nAppID) { _UninstallDLC(Self, nAppID); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_RequestAppProofOfPurchaseKey")] private static extern void _RequestAppProofOfPurchaseKey(IntPtr self, AppId nAppID); internal void RequestAppProofOfPurchaseKey(AppId nAppID) { _RequestAppProofOfPurchaseKey(Self, nAppID); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_GetCurrentBetaName")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _GetCurrentBetaName(IntPtr self, IntPtr pchName, int cchNameBufferSize); internal bool GetCurrentBetaName(out string pchName) { IntPtr intPtr = Helpers.TakeMemory(); bool result = _GetCurrentBetaName(Self, intPtr, 32768); pchName = Helpers.MemoryToString(intPtr); return result; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_MarkContentCorrupt")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _MarkContentCorrupt(IntPtr self, [MarshalAs(UnmanagedType.U1)] bool bMissingFilesOnly); internal bool MarkContentCorrupt([MarshalAs(UnmanagedType.U1)] bool bMissingFilesOnly) { return _MarkContentCorrupt(Self, bMissingFilesOnly); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_GetInstalledDepots")] private static extern uint _GetInstalledDepots(IntPtr self, AppId appID, [In][Out] DepotId_t[] pvecDepots, uint cMaxDepots); internal uint GetInstalledDepots(AppId appID, [In][Out] DepotId_t[] pvecDepots, uint cMaxDepots) { return _GetInstalledDepots(Self, appID, pvecDepots, cMaxDepots); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_GetAppInstallDir")] private static extern uint _GetAppInstallDir(IntPtr self, AppId appID, IntPtr pchFolder, uint cchFolderBufferSize); internal uint GetAppInstallDir(AppId appID, out string pchFolder) { IntPtr intPtr = Helpers.TakeMemory(); uint result = _GetAppInstallDir(Self, appID, intPtr, 32768u); pchFolder = Helpers.MemoryToString(intPtr); return result; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_BIsAppInstalled")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _BIsAppInstalled(IntPtr self, AppId appID); internal bool BIsAppInstalled(AppId appID) { return _BIsAppInstalled(Self, appID); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_GetAppOwner")] private static extern SteamId _GetAppOwner(IntPtr self); internal SteamId GetAppOwner() { return _GetAppOwner(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_GetLaunchQueryParam")] private static extern Utf8StringPointer _GetLaunchQueryParam(IntPtr self, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchKey); internal string GetLaunchQueryParam([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchKey) { Utf8StringPointer utf8StringPointer = _GetLaunchQueryParam(Self, pchKey); return utf8StringPointer; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_GetDlcDownloadProgress")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _GetDlcDownloadProgress(IntPtr self, AppId nAppID, ref ulong punBytesDownloaded, ref ulong punBytesTotal); internal bool GetDlcDownloadProgress(AppId nAppID, ref ulong punBytesDownloaded, ref ulong punBytesTotal) { return _GetDlcDownloadProgress(Self, nAppID, ref punBytesDownloaded, ref punBytesTotal); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_GetAppBuildId")] private static extern int _GetAppBuildId(IntPtr self); internal int GetAppBuildId() { return _GetAppBuildId(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_RequestAllProofOfPurchaseKeys")] private static extern void _RequestAllProofOfPurchaseKeys(IntPtr self); internal void RequestAllProofOfPurchaseKeys() { _RequestAllProofOfPurchaseKeys(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_GetFileDetails")] private static extern SteamAPICall_t _GetFileDetails(IntPtr self, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pszFileName); internal CallResult<FileDetailsResult_t> GetFileDetails([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pszFileName) { SteamAPICall_t call = _GetFileDetails(Self, pszFileName); return new CallResult<FileDetailsResult_t>(call, base.IsServer); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_GetLaunchCommandLine")] private static extern int _GetLaunchCommandLine(IntPtr self, IntPtr pszCommandLine, int cubCommandLine); internal int GetLaunchCommandLine(out string pszCommandLine) { IntPtr intPtr = Helpers.TakeMemory(); int result = _GetLaunchCommandLine(Self, intPtr, 32768); pszCommandLine = Helpers.MemoryToString(intPtr); return result; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamApps_BIsSubscribedFromFamilySharing")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _BIsSubscribedFromFamilySharing(IntPtr self); internal bool BIsSubscribedFromFamilySharing() { return _BIsSubscribedFromFamilySharing(Self); } } internal class ISteamClient : SteamInterface { internal ISteamClient(bool IsGameServer) { SetupInterface(IsGameServer); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_CreateSteamPipe")] private static extern HSteamPipe _CreateSteamPipe(IntPtr self); internal HSteamPipe CreateSteamPipe() { return _CreateSteamPipe(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_BReleaseSteamPipe")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _BReleaseSteamPipe(IntPtr self, HSteamPipe hSteamPipe); internal bool BReleaseSteamPipe(HSteamPipe hSteamPipe) { return _BReleaseSteamPipe(Self, hSteamPipe); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_ConnectToGlobalUser")] private static extern HSteamUser _ConnectToGlobalUser(IntPtr self, HSteamPipe hSteamPipe); internal HSteamUser ConnectToGlobalUser(HSteamPipe hSteamPipe) { return _ConnectToGlobalUser(Self, hSteamPipe); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_CreateLocalUser")] private static extern HSteamUser _CreateLocalUser(IntPtr self, ref HSteamPipe phSteamPipe, AccountType eAccountType); internal HSteamUser CreateLocalUser(ref HSteamPipe phSteamPipe, AccountType eAccountType) { return _CreateLocalUser(Self, ref phSteamPipe, eAccountType); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_ReleaseUser")] private static extern void _ReleaseUser(IntPtr self, HSteamPipe hSteamPipe, HSteamUser hUser); internal void ReleaseUser(HSteamPipe hSteamPipe, HSteamUser hUser) { _ReleaseUser(Self, hSteamPipe, hUser); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamUser")] private static extern IntPtr _GetISteamUser(IntPtr self, HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamUser(HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamUser(Self, hSteamUser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamGameServer")] private static extern IntPtr _GetISteamGameServer(IntPtr self, HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamGameServer(HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamGameServer(Self, hSteamUser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_SetLocalIPBinding")] private static extern void _SetLocalIPBinding(IntPtr self, ref SteamIPAddress unIP, ushort usPort); internal void SetLocalIPBinding(ref SteamIPAddress unIP, ushort usPort) { _SetLocalIPBinding(Self, ref unIP, usPort); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamFriends")] private static extern IntPtr _GetISteamFriends(IntPtr self, HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamFriends(HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamFriends(Self, hSteamUser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamUtils")] private static extern IntPtr _GetISteamUtils(IntPtr self, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamUtils(HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamUtils(Self, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamMatchmaking")] private static extern IntPtr _GetISteamMatchmaking(IntPtr self, HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamMatchmaking(HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamMatchmaking(Self, hSteamUser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamMatchmakingServers")] private static extern IntPtr _GetISteamMatchmakingServers(IntPtr self, HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamMatchmakingServers(HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamMatchmakingServers(Self, hSteamUser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamGenericInterface")] private static extern IntPtr _GetISteamGenericInterface(IntPtr self, HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamGenericInterface(HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamGenericInterface(Self, hSteamUser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamUserStats")] private static extern IntPtr _GetISteamUserStats(IntPtr self, HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamUserStats(HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamUserStats(Self, hSteamUser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamGameServerStats")] private static extern IntPtr _GetISteamGameServerStats(IntPtr self, HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamGameServerStats(HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamGameServerStats(Self, hSteamuser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamApps")] private static extern IntPtr _GetISteamApps(IntPtr self, HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamApps(HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamApps(Self, hSteamUser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamNetworking")] private static extern IntPtr _GetISteamNetworking(IntPtr self, HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamNetworking(HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamNetworking(Self, hSteamUser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamRemoteStorage")] private static extern IntPtr _GetISteamRemoteStorage(IntPtr self, HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamRemoteStorage(HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamRemoteStorage(Self, hSteamuser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamScreenshots")] private static extern IntPtr _GetISteamScreenshots(IntPtr self, HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamScreenshots(HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamScreenshots(Self, hSteamuser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamGameSearch")] private static extern IntPtr _GetISteamGameSearch(IntPtr self, HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamGameSearch(HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamGameSearch(Self, hSteamuser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetIPCCallCount")] private static extern uint _GetIPCCallCount(IntPtr self); internal uint GetIPCCallCount() { return _GetIPCCallCount(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_SetWarningMessageHook")] private static extern void _SetWarningMessageHook(IntPtr self, IntPtr pFunction); internal void SetWarningMessageHook(IntPtr pFunction) { _SetWarningMessageHook(Self, pFunction); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_BShutdownIfAllPipesClosed")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _BShutdownIfAllPipesClosed(IntPtr self); internal bool BShutdownIfAllPipesClosed() { return _BShutdownIfAllPipesClosed(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamHTTP")] private static extern IntPtr _GetISteamHTTP(IntPtr self, HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamHTTP(HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamHTTP(Self, hSteamuser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamController")] private static extern IntPtr _GetISteamController(IntPtr self, HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamController(HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamController(Self, hSteamUser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamUGC")] private static extern IntPtr _GetISteamUGC(IntPtr self, HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamUGC(HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamUGC(Self, hSteamUser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamAppList")] private static extern IntPtr _GetISteamAppList(IntPtr self, HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamAppList(HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamAppList(Self, hSteamUser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamMusic")] private static extern IntPtr _GetISteamMusic(IntPtr self, HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamMusic(HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamMusic(Self, hSteamuser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamMusicRemote")] private static extern IntPtr _GetISteamMusicRemote(IntPtr self, HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamMusicRemote(HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamMusicRemote(Self, hSteamuser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamHTMLSurface")] private static extern IntPtr _GetISteamHTMLSurface(IntPtr self, HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamHTMLSurface(HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamHTMLSurface(Self, hSteamuser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamInventory")] private static extern IntPtr _GetISteamInventory(IntPtr self, HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamInventory(HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamInventory(Self, hSteamuser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamVideo")] private static extern IntPtr _GetISteamVideo(IntPtr self, HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamVideo(HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamVideo(Self, hSteamuser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamParentalSettings")] private static extern IntPtr _GetISteamParentalSettings(IntPtr self, HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamParentalSettings(HSteamUser hSteamuser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamParentalSettings(Self, hSteamuser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamInput")] private static extern IntPtr _GetISteamInput(IntPtr self, HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamInput(HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamInput(Self, hSteamUser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamParties")] private static extern IntPtr _GetISteamParties(IntPtr self, HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamParties(HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamParties(Self, hSteamUser, hSteamPipe, pchVersion); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamRemotePlay")] private static extern IntPtr _GetISteamRemotePlay(IntPtr self, HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion); internal IntPtr GetISteamRemotePlay(HSteamUser hSteamUser, HSteamPipe hSteamPipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchVersion) { return _GetISteamRemotePlay(Self, hSteamUser, hSteamPipe, pchVersion); } } internal class ISteamController : SteamInterface { internal ISteamController(bool IsGameServer) { SetupInterface(IsGameServer); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr SteamAPI_SteamController_v007(); public override IntPtr GetUserInterfacePointer() { return SteamAPI_SteamController_v007(); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_Init")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _Init(IntPtr self); internal bool Init() { return _Init(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_Shutdown")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _Shutdown(IntPtr self); internal bool Shutdown() { return _Shutdown(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_RunFrame")] private static extern void _RunFrame(IntPtr self); internal void RunFrame() { _RunFrame(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetConnectedControllers")] private static extern int _GetConnectedControllers(IntPtr self, [In][Out] ControllerHandle_t[] handlesOut); internal int GetConnectedControllers([In][Out] ControllerHandle_t[] handlesOut) { return _GetConnectedControllers(Self, handlesOut); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetActionSetHandle")] private static extern ControllerActionSetHandle_t _GetActionSetHandle(IntPtr self, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pszActionSetName); internal ControllerActionSetHandle_t GetActionSetHandle([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pszActionSetName) { return _GetActionSetHandle(Self, pszActionSetName); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_ActivateActionSet")] private static extern void _ActivateActionSet(IntPtr self, ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle); internal void ActivateActionSet(ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle) { _ActivateActionSet(Self, controllerHandle, actionSetHandle); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetCurrentActionSet")] private static extern ControllerActionSetHandle_t _GetCurrentActionSet(IntPtr self, ControllerHandle_t controllerHandle); internal ControllerActionSetHandle_t GetCurrentActionSet(ControllerHandle_t controllerHandle) { return _GetCurrentActionSet(Self, controllerHandle); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_ActivateActionSetLayer")] private static extern void _ActivateActionSetLayer(IntPtr self, ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle); internal void ActivateActionSetLayer(ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle) { _ActivateActionSetLayer(Self, controllerHandle, actionSetLayerHandle); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_DeactivateActionSetLayer")] private static extern void _DeactivateActionSetLayer(IntPtr self, ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle); internal void DeactivateActionSetLayer(ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetLayerHandle) { _DeactivateActionSetLayer(Self, controllerHandle, actionSetLayerHandle); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_DeactivateAllActionSetLayers")] private static extern void _DeactivateAllActionSetLayers(IntPtr self, ControllerHandle_t controllerHandle); internal void DeactivateAllActionSetLayers(ControllerHandle_t controllerHandle) { _DeactivateAllActionSetLayers(Self, controllerHandle); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetActiveActionSetLayers")] private static extern int _GetActiveActionSetLayers(IntPtr self, ControllerHandle_t controllerHandle, [In][Out] ControllerActionSetHandle_t[] handlesOut); internal int GetActiveActionSetLayers(ControllerHandle_t controllerHandle, [In][Out] ControllerActionSetHandle_t[] handlesOut) { return _GetActiveActionSetLayers(Self, controllerHandle, handlesOut); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetDigitalActionHandle")] private static extern ControllerDigitalActionHandle_t _GetDigitalActionHandle(IntPtr self, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pszActionName); internal ControllerDigitalActionHandle_t GetDigitalActionHandle([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pszActionName) { return _GetDigitalActionHandle(Self, pszActionName); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetDigitalActionData")] private static extern DigitalState _GetDigitalActionData(IntPtr self, ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle); internal DigitalState GetDigitalActionData(ControllerHandle_t controllerHandle, ControllerDigitalActionHandle_t digitalActionHandle) { return _GetDigitalActionData(Self, controllerHandle, digitalActionHandle); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetDigitalActionOrigins")] private static extern int _GetDigitalActionOrigins(IntPtr self, ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerDigitalActionHandle_t digitalActionHandle, ref ControllerActionOrigin originsOut); internal int GetDigitalActionOrigins(ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerDigitalActionHandle_t digitalActionHandle, ref ControllerActionOrigin originsOut) { return _GetDigitalActionOrigins(Self, controllerHandle, actionSetHandle, digitalActionHandle, ref originsOut); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetAnalogActionHandle")] private static extern ControllerAnalogActionHandle_t _GetAnalogActionHandle(IntPtr self, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pszActionName); internal ControllerAnalogActionHandle_t GetAnalogActionHandle([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pszActionName) { return _GetAnalogActionHandle(Self, pszActionName); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetAnalogActionData")] private static extern AnalogState _GetAnalogActionData(IntPtr self, ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle); internal AnalogState GetAnalogActionData(ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t analogActionHandle) { return _GetAnalogActionData(Self, controllerHandle, analogActionHandle); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetAnalogActionOrigins")] private static extern int _GetAnalogActionOrigins(IntPtr self, ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerAnalogActionHandle_t analogActionHandle, ref ControllerActionOrigin originsOut); internal int GetAnalogActionOrigins(ControllerHandle_t controllerHandle, ControllerActionSetHandle_t actionSetHandle, ControllerAnalogActionHandle_t analogActionHandle, ref ControllerActionOrigin originsOut) { return _GetAnalogActionOrigins(Self, controllerHandle, actionSetHandle, analogActionHandle, ref originsOut); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetGlyphForActionOrigin")] private static extern Utf8StringPointer _GetGlyphForActionOrigin(IntPtr self, ControllerActionOrigin eOrigin); internal string GetGlyphForActionOrigin(ControllerActionOrigin eOrigin) { Utf8StringPointer utf8StringPointer = _GetGlyphForActionOrigin(Self, eOrigin); return utf8StringPointer; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetStringForActionOrigin")] private static extern Utf8StringPointer _GetStringForActionOrigin(IntPtr self, ControllerActionOrigin eOrigin); internal string GetStringForActionOrigin(ControllerActionOrigin eOrigin) { Utf8StringPointer utf8StringPointer = _GetStringForActionOrigin(Self, eOrigin); return utf8StringPointer; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_StopAnalogActionMomentum")] private static extern void _StopAnalogActionMomentum(IntPtr self, ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t eAction); internal void StopAnalogActionMomentum(ControllerHandle_t controllerHandle, ControllerAnalogActionHandle_t eAction) { _StopAnalogActionMomentum(Self, controllerHandle, eAction); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetMotionData")] private static extern MotionState _GetMotionData(IntPtr self, ControllerHandle_t controllerHandle); internal MotionState GetMotionData(ControllerHandle_t controllerHandle) { return _GetMotionData(Self, controllerHandle); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_TriggerHapticPulse")] private static extern void _TriggerHapticPulse(IntPtr self, ControllerHandle_t controllerHandle, SteamControllerPad eTargetPad, ushort usDurationMicroSec); internal void TriggerHapticPulse(ControllerHandle_t controllerHandle, SteamControllerPad eTargetPad, ushort usDurationMicroSec) { _TriggerHapticPulse(Self, controllerHandle, eTargetPad, usDurationMicroSec); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_TriggerRepeatedHapticPulse")] private static extern void _TriggerRepeatedHapticPulse(IntPtr self, ControllerHandle_t controllerHandle, SteamControllerPad eTargetPad, ushort usDurationMicroSec, ushort usOffMicroSec, ushort unRepeat, uint nFlags); internal void TriggerRepeatedHapticPulse(ControllerHandle_t controllerHandle, SteamControllerPad eTargetPad, ushort usDurationMicroSec, ushort usOffMicroSec, ushort unRepeat, uint nFlags) { _TriggerRepeatedHapticPulse(Self, controllerHandle, eTargetPad, usDurationMicroSec, usOffMicroSec, unRepeat, nFlags); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_TriggerVibration")] private static extern void _TriggerVibration(IntPtr self, ControllerHandle_t controllerHandle, ushort usLeftSpeed, ushort usRightSpeed); internal void TriggerVibration(ControllerHandle_t controllerHandle, ushort usLeftSpeed, ushort usRightSpeed) { _TriggerVibration(Self, controllerHandle, usLeftSpeed, usRightSpeed); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_SetLEDColor")] private static extern void _SetLEDColor(IntPtr self, ControllerHandle_t controllerHandle, byte nColorR, byte nColorG, byte nColorB, uint nFlags); internal void SetLEDColor(ControllerHandle_t controllerHandle, byte nColorR, byte nColorG, byte nColorB, uint nFlags) { _SetLEDColor(Self, controllerHandle, nColorR, nColorG, nColorB, nFlags); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_ShowBindingPanel")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _ShowBindingPanel(IntPtr self, ControllerHandle_t controllerHandle); internal bool ShowBindingPanel(ControllerHandle_t controllerHandle) { return _ShowBindingPanel(Self, controllerHandle); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetInputTypeForHandle")] private static extern InputType _GetInputTypeForHandle(IntPtr self, ControllerHandle_t controllerHandle); internal InputType GetInputTypeForHandle(ControllerHandle_t controllerHandle) { return _GetInputTypeForHandle(Self, controllerHandle); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetControllerForGamepadIndex")] private static extern ControllerHandle_t _GetControllerForGamepadIndex(IntPtr self, int nIndex); internal ControllerHandle_t GetControllerForGamepadIndex(int nIndex) { return _GetControllerForGamepadIndex(Self, nIndex); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetGamepadIndexForController")] private static extern int _GetGamepadIndexForController(IntPtr self, ControllerHandle_t ulControllerHandle); internal int GetGamepadIndexForController(ControllerHandle_t ulControllerHandle) { return _GetGamepadIndexForController(Self, ulControllerHandle); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetStringForXboxOrigin")] private static extern Utf8StringPointer _GetStringForXboxOrigin(IntPtr self, XboxOrigin eOrigin); internal string GetStringForXboxOrigin(XboxOrigin eOrigin) { Utf8StringPointer utf8StringPointer = _GetStringForXboxOrigin(Self, eOrigin); return utf8StringPointer; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetGlyphForXboxOrigin")] private static extern Utf8StringPointer _GetGlyphForXboxOrigin(IntPtr self, XboxOrigin eOrigin); internal string GetGlyphForXboxOrigin(XboxOrigin eOrigin) { Utf8StringPointer utf8StringPointer = _GetGlyphForXboxOrigin(Self, eOrigin); return utf8StringPointer; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetActionOriginFromXboxOrigin")] private static extern ControllerActionOrigin _GetActionOriginFromXboxOrigin(IntPtr self, ControllerHandle_t controllerHandle, XboxOrigin eOrigin); internal ControllerActionOrigin GetActionOriginFromXboxOrigin(ControllerHandle_t controllerHandle, XboxOrigin eOrigin) { return _GetActionOriginFromXboxOrigin(Self, controllerHandle, eOrigin); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_TranslateActionOrigin")] private static extern ControllerActionOrigin _TranslateActionOrigin(IntPtr self, InputType eDestinationInputType, ControllerActionOrigin eSourceOrigin); internal ControllerActionOrigin TranslateActionOrigin(InputType eDestinationInputType, ControllerActionOrigin eSourceOrigin) { return _TranslateActionOrigin(Self, eDestinationInputType, eSourceOrigin); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamController_GetControllerBindingRevision")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _GetControllerBindingRevision(IntPtr self, ControllerHandle_t controllerHandle, ref int pMajor, ref int pMinor); internal bool GetControllerBindingRevision(ControllerHandle_t controllerHandle, ref int pMajor, ref int pMinor) { return _GetControllerBindingRevision(Self, controllerHandle, ref pMajor, ref pMinor); } } internal class ISteamFriends : SteamInterface { internal ISteamFriends(bool IsGameServer) { SetupInterface(IsGameServer); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr SteamAPI_SteamFriends_v017(); public override IntPtr GetUserInterfacePointer() { return SteamAPI_SteamFriends_v017(); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetPersonaName")] private static extern Utf8StringPointer _GetPersonaName(IntPtr self); internal string GetPersonaName() { Utf8StringPointer utf8StringPointer = _GetPersonaName(Self); return utf8StringPointer; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_SetPersonaName")] private static extern SteamAPICall_t _SetPersonaName(IntPtr self, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchPersonaName); internal CallResult<SetPersonaNameResponse_t> SetPersonaName([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchPersonaName) { SteamAPICall_t call = _SetPersonaName(Self, pchPersonaName); return new CallResult<SetPersonaNameResponse_t>(call, base.IsServer); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetPersonaState")] private static extern FriendState _GetPersonaState(IntPtr self); internal FriendState GetPersonaState() { return _GetPersonaState(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetFriendCount")] private static extern int _GetFriendCount(IntPtr self, int iFriendFlags); internal int GetFriendCount(int iFriendFlags) { return _GetFriendCount(Self, iFriendFlags); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetFriendByIndex")] private static extern SteamId _GetFriendByIndex(IntPtr self, int iFriend, int iFriendFlags); internal SteamId GetFriendByIndex(int iFriend, int iFriendFlags) { return _GetFriendByIndex(Self, iFriend, iFriendFlags); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetFriendRelationship")] private static extern Relationship _GetFriendRelationship(IntPtr self, SteamId steamIDFriend); internal Relationship GetFriendRelationship(SteamId steamIDFriend) { return _GetFriendRelationship(Self, steamIDFriend); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetFriendPersonaState")] private static extern FriendState _GetFriendPersonaState(IntPtr self, SteamId steamIDFriend); internal FriendState GetFriendPersonaState(SteamId steamIDFriend) { return _GetFriendPersonaState(Self, steamIDFriend); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetFriendPersonaName")] private static extern Utf8StringPointer _GetFriendPersonaName(IntPtr self, SteamId steamIDFriend); internal string GetFriendPersonaName(SteamId steamIDFriend) { Utf8StringPointer utf8StringPointer = _GetFriendPersonaName(Self, steamIDFriend); return utf8StringPointer; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetFriendGamePlayed")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _GetFriendGamePlayed(IntPtr self, SteamId steamIDFriend, ref FriendGameInfo_t pFriendGameInfo); internal bool GetFriendGamePlayed(SteamId steamIDFriend, ref FriendGameInfo_t pFriendGameInfo) { return _GetFriendGamePlayed(Self, steamIDFriend, ref pFriendGameInfo); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetFriendPersonaNameHistory")] private static extern Utf8StringPointer _GetFriendPersonaNameHistory(IntPtr self, SteamId steamIDFriend, int iPersonaName); internal string GetFriendPersonaNameHistory(SteamId steamIDFriend, int iPersonaName) { Utf8StringPointer utf8StringPointer = _GetFriendPersonaNameHistory(Self, steamIDFriend, iPersonaName); return utf8StringPointer; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetFriendSteamLevel")] private static extern int _GetFriendSteamLevel(IntPtr self, SteamId steamIDFriend); internal int GetFriendSteamLevel(SteamId steamIDFriend) { return _GetFriendSteamLevel(Self, steamIDFriend); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetPlayerNickname")] private static extern Utf8StringPointer _GetPlayerNickname(IntPtr self, SteamId steamIDPlayer); internal string GetPlayerNickname(SteamId steamIDPlayer) { Utf8StringPointer utf8StringPointer = _GetPlayerNickname(Self, steamIDPlayer); return utf8StringPointer; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetFriendsGroupCount")] private static extern int _GetFriendsGroupCount(IntPtr self); internal int GetFriendsGroupCount() { return _GetFriendsGroupCount(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetFriendsGroupIDByIndex")] private static extern FriendsGroupID_t _GetFriendsGroupIDByIndex(IntPtr self, int iFG); internal FriendsGroupID_t GetFriendsGroupIDByIndex(int iFG) { return _GetFriendsGroupIDByIndex(Self, iFG); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetFriendsGroupName")] private static extern Utf8StringPointer _GetFriendsGroupName(IntPtr self, FriendsGroupID_t friendsGroupID); internal string GetFriendsGroupName(FriendsGroupID_t friendsGroupID) { Utf8StringPointer utf8StringPointer = _GetFriendsGroupName(Self, friendsGroupID); return utf8StringPointer; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetFriendsGroupMembersCount")] private static extern int _GetFriendsGroupMembersCount(IntPtr self, FriendsGroupID_t friendsGroupID); internal int GetFriendsGroupMembersCount(FriendsGroupID_t friendsGroupID) { return _GetFriendsGroupMembersCount(Self, friendsGroupID); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetFriendsGroupMembersList")] private static extern void _GetFriendsGroupMembersList(IntPtr self, FriendsGroupID_t friendsGroupID, [In][Out] SteamId[] pOutSteamIDMembers, int nMembersCount); internal void GetFriendsGroupMembersList(FriendsGroupID_t friendsGroupID, [In][Out] SteamId[] pOutSteamIDMembers, int nMembersCount) { _GetFriendsGroupMembersList(Self, friendsGroupID, pOutSteamIDMembers, nMembersCount); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_HasFriend")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _HasFriend(IntPtr self, SteamId steamIDFriend, int iFriendFlags); internal bool HasFriend(SteamId steamIDFriend, int iFriendFlags) { return _HasFriend(Self, steamIDFriend, iFriendFlags); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetClanCount")] private static extern int _GetClanCount(IntPtr self); internal int GetClanCount() { return _GetClanCount(Self); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetClanByIndex")] private static extern SteamId _GetClanByIndex(IntPtr self, int iClan); internal SteamId GetClanByIndex(int iClan) { return _GetClanByIndex(Self, iClan); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetClanName")] private static extern Utf8StringPointer _GetClanName(IntPtr self, SteamId steamIDClan); internal string GetClanName(SteamId steamIDClan) { Utf8StringPointer utf8StringPointer = _GetClanName(Self, steamIDClan); return utf8StringPointer; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetClanTag")] private static extern Utf8StringPointer _GetClanTag(IntPtr self, SteamId steamIDClan); internal string GetClanTag(SteamId steamIDClan) { Utf8StringPointer utf8StringPointer = _GetClanTag(Self, steamIDClan); return utf8StringPointer; } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetClanActivityCounts")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _GetClanActivityCounts(IntPtr self, SteamId steamIDClan, ref int pnOnline, ref int pnInGame, ref int pnChatting); internal bool GetClanActivityCounts(SteamId steamIDClan, ref int pnOnline, ref int pnInGame, ref int pnChatting) { return _GetClanActivityCounts(Self, steamIDClan, ref pnOnline, ref pnInGame, ref pnChatting); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_DownloadClanActivityCounts")] private static extern SteamAPICall_t _DownloadClanActivityCounts(IntPtr self, [In][Out] SteamId[] psteamIDClans, int cClansToRequest); internal CallResult<DownloadClanActivityCountsResult_t> DownloadClanActivityCounts([In][Out] SteamId[] psteamIDClans, int cClansToRequest) { SteamAPICall_t call = _DownloadClanActivityCounts(Self, psteamIDClans, cClansToRequest); return new CallResult<DownloadClanActivityCountsResult_t>(call, base.IsServer); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetFriendCountFromSource")] private static extern int _GetFriendCountFromSource(IntPtr self, SteamId steamIDSource); internal int GetFriendCountFromSource(SteamId steamIDSource) { return _GetFriendCountFromSource(Self, steamIDSource); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_GetFriendFromSourceByIndex")] private static extern SteamId _GetFriendFromSourceByIndex(IntPtr self, SteamId steamIDSource, int iFriend); internal SteamId GetFriendFromSourceByIndex(SteamId steamIDSource, int iFriend) { return _GetFriendFromSourceByIndex(Self, steamIDSource, iFriend); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_IsUserInSource")] [return: MarshalAs(UnmanagedType.I1)] private static extern bool _IsUserInSource(IntPtr self, SteamId steamIDUser, SteamId steamIDSource); internal bool IsUserInSource(SteamId steamIDUser, SteamId steamIDSource) { return _IsUserInSource(Self, steamIDUser, steamIDSource); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_SetInGameVoiceSpeaking")] private static extern void _SetInGameVoiceSpeaking(IntPtr self, SteamId steamIDUser, [MarshalAs(UnmanagedType.U1)] bool bSpeaking); internal void SetInGameVoiceSpeaking(SteamId steamIDUser, [MarshalAs(UnmanagedType.U1)] bool bSpeaking) { _SetInGameVoiceSpeaking(Self, steamIDUser, bSpeaking); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_ActivateGameOverlay")] private static extern void _ActivateGameOverlay(IntPtr self, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchDialog); internal void ActivateGameOverlay([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchDialog) { _ActivateGameOverlay(Self, pchDialog); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_ActivateGameOverlayToUser")] private static extern void _ActivateGameOverlayToUser(IntPtr self, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchDialog, SteamId steamID); internal void ActivateGameOverlayToUser([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchDialog, SteamId steamID) { _ActivateGameOverlayToUser(Self, pchDialog, steamID); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage")] private static extern void _ActivateGameOverlayToWebPage(IntPtr self, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchURL, ActivateGameOverlayToWebPageMode eMode); internal void ActivateGameOverlayToWebPage([MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "Steamworks.Utf8StringToNative")] string pchURL, ActivateGameOverlayToWebPageMode eMode) { _ActivateGameOverlayToWebPage(Self, pchURL, eMode); } [DllImport("steam_api64", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamFriends_ActivateGameOverlayToStore")] private static extern void _ActivateGameOverlayToStore(IntPtr self, AppId nAppID, OverlayToStoreFlag eFlag); inte