1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 02:13:29 +08:00

reformat code

This commit is contained in:
2024-11-12 15:02:22 +08:00
parent 5b725ff94f
commit bbab36bc35
2 changed files with 16 additions and 15 deletions

View File

@@ -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;
}
}

View File

@@ -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;
}
}
}