diff --git a/UXAssist/Common/WinApi.cs b/UXAssist/Common/WinApi.cs index e2543c5..d9f3814 100644 --- a/UXAssist/Common/WinApi.cs +++ b/UXAssist/Common/WinApi.cs @@ -136,7 +136,7 @@ public static class WinApi [DllImport("kernel32", ExactSpelling = true)] public static extern int GetCurrentProcessId(); - + [DllImport("kernel32", ExactSpelling = true)] public static extern IntPtr GetConsoleWindow(); @@ -204,16 +204,11 @@ public static class WinApi [StructLayout(LayoutKind.Explicit)] public struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_UNION { - [FieldOffset(0)] - public PROCESSORCORE ProcessorCore; - [FieldOffset(0)] - public NUMANODE NumaNode; - [FieldOffset(0)] - public CACHE_DESCRIPTOR Cache; - [FieldOffset(0)] - private UInt64 Reserved1; - [FieldOffset(8)] - private UInt64 Reserved2; + [FieldOffset(0)] public PROCESSORCORE ProcessorCore; + [FieldOffset(0)] public NUMANODE NumaNode; + [FieldOffset(0)] public CACHE_DESCRIPTOR Cache; + [FieldOffset(0)] private UInt64 Reserved1; + [FieldOffset(8)] private UInt64 Reserved2; } public struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION @@ -223,7 +218,7 @@ public static class WinApi public SYSTEM_LOGICAL_PROCESSOR_INFORMATION_UNION ProcessorInformation; } - [DllImport(@"kernel32", SetLastError=true)] + [DllImport(@"kernel32", SetLastError = true)] private static extern bool GetLogicalProcessorInformation( IntPtr buffer, ref uint returnLength @@ -264,12 +259,12 @@ public static class WinApi result.ThreadCount += tcount; if (tcount > 1) { - result.PerformanceCoreCount ++; + result.PerformanceCoreCount++; result.PerformanceCoreMask |= (ulong)buffer.ProcessorMask; } else { - result.EfficiencyCoreCount ++; + result.EfficiencyCoreCount++; result.EfficiencyCoreMask |= (ulong)buffer.ProcessorMask; } } @@ -278,6 +273,7 @@ public static class WinApi { Marshal.FreeHGlobal(ptr); } + return result; int CountBitsSet(ulong mask) @@ -288,6 +284,7 @@ public static class WinApi mask &= mask - 1; count++; } + return count; } } diff --git a/UXAssist/Functions/WindowFunctions.cs b/UXAssist/Functions/WindowFunctions.cs index 1e120f6..faeb26b 100644 --- a/UXAssist/Functions/WindowFunctions.cs +++ b/UXAssist/Functions/WindowFunctions.cs @@ -113,6 +113,7 @@ public static class WindowFunctions { WinApi.SetWindowLongPtr(_gameWindowHandle, WinApi.GWLP_WNDPROC, _oldWndProc); } + break; case WinApi.WM_SYSCOMMAND: switch ((long)wParam & 0xFFF0L) @@ -121,6 +122,7 @@ public static class WindowFunctions if (GamePatch.LoadLastWindowRectEnabled.Value && !_gameLoaded) return (IntPtr)1L; break; } + break; case WinApi.WM_MOVING: if (!GamePatch.LoadLastWindowRectEnabled.Value || _gameLoaded) break; @@ -149,6 +151,7 @@ public static class WindowFunctions Marshal.StructureToPtr(rect2, lParam, false); break; } + return WinApi.CallWindowProc(_oldWndProc, hWnd, uMsg, wParam, lParam); } @@ -253,7 +256,8 @@ public static class WindowFunctions if (pid == currentProcessId) break; } + _gameWindowHandle = wnd; return _gameWindowHandle; } -} +} \ No newline at end of file