private IEnumerator CaptureWindowProc() { while (this.hMainWindow == IntPtr.Zero) { this.hMainWindow = SoundLibWndProc.FindWindow((string)null, Application.productName); if (this.hMainWindow != IntPtr.Zero) { this.newWndProc = new WndProcDelegate(this.WndProc); this.newWndProcPtr = Marshal.GetFunctionPointerForDelegate(this.newWndProc); if (this.Is64Bit()) { this.oldWndProcPtr = SoundLibWndProc.SetWindowLongPtr(this.hMainWindow, -4, this.newWndProcPtr); } else { this.oldWndProcPtr = SoundLibWndProc.SetWindowLong(this.hMainWindow, -4, this.newWndProcPtr); } } else { yield return(new WaitForEndOfFrame()); } } yield break; }
private IntPtr WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) { if (msg == 161u && (Int64)wParam.ToInt32() == 2L) { ISdLibAPIProxy.Instance.SdSoundSystem_Suspend(); this.isSEADSuspendedByTitleBar = true; } if (msg == 260u && (Int64)wParam.ToInt32() == 13L) { msg = 0u; } return(SoundLibWndProc.CallWindowProc(this.oldWndProcPtr, hWnd, msg, wParam, lParam)); }
private void OnDisable() { if (this.Is64Bit()) { SoundLibWndProc.SetWindowLongPtr(this.hMainWindow, -4, this.oldWndProcPtr); } else { SoundLibWndProc.SetWindowLong(this.hMainWindow, -4, this.oldWndProcPtr); } this.hMainWindow = IntPtr.Zero; this.oldWndProcPtr = IntPtr.Zero; this.newWndProcPtr = IntPtr.Zero; this.newWndProc = (WndProcDelegate)null; }
private Boolean InitializePlugin() { if (this.m_isInitialized) { return(true); } SoundLib.Log("InitializePlugin()"); Int32 num = ISdLibAPIProxy.Instance.SdSoundSystem_Create(String.Empty); if (num < 0) { return(false); } this.m_isInitialized = true; GameObject gameObject = new GameObject("SoundLibWndProc"); SoundLibWndProc soundLibWndProc = gameObject.AddComponent <SoundLibWndProc>(); gameObject.transform.parent = base.transform; return(true); }
public static IntPtr GetWindowHandle() { return(SoundLibWndProc.GetActiveWindow()); }