Quote from: Jeremy Collake on July 08, 2025, 11:33:26 AMI recommend stress testing the PC in a high performance power plan/mode. I suspect there are thermal control or other hardware instabilities that only manifest when you're in a high performance power plan. Let me know how it goes!
Quote from: Lifluke on July 08, 2025, 03:28:16 AMI had the same issue with high-performance mode causing crashes in another game. Try enabling ProBalance and CPU Limiter in Process Lasso instead, gives smoother performance without forcing max settings.
# =========================================================================
# Set-Remote-Timer.ps1: 使用 SetProcessInformation 远程修改进程的计时器精度
# 这是一个一次性的、设置后即退出的工具。
# 警告:必须以管理员身份运行!
# =========================================================================
# 步骤 1: 定义所有需要的 Win32 API 签名
try {
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public static class NativeMethods {
// --- API 函数签名 ---
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr OpenProcess(ProcessAccessFlags processAccess, bool bInheritHandle, int processId);
[DllImport("ntdll.dll", SetLastError = true)]
public static extern int NtSetInformationProcess(
IntPtr processHandle,
PROCESS_INFORMATION_CLASS ProcessInformationClass,
ref PROCESS_TIMER_RESOLUTION_INFORMATION ProcessInformation,
uint ProcessInformationLength
);
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool CloseHandle(IntPtr hObject);
// --- 枚举和结构体 ---
[Flags]
public enum ProcessAccessFlags : uint {
PROCESS_SET_INFORMATION = 0x0200
}
public enum PROCESS_INFORMATION_CLASS : int {
ProcessTimerResolution = 46
}
[StructLayout(LayoutKind.Sequential)]
public struct PROCESS_TIMER_RESOLUTION_INFORMATION {
public uint DesiredResolution;
public uint ActualResolution;
public uint SetResolution; // 1 to set, 0 to clear
}
}
"@ -PassThru -ErrorAction Stop | Out-Null
} catch { Write-Host "C# 编译失败: $($_.Exception.Message)" -ForegroundColor Red; return }
# 步骤 2: PowerShell 逻辑
# --- 在这里配置目标 ---
$processName = "MeasureSleep"
# true 表示设置,false 表示清除
$enable = $true
# 期望的精度 (5000 = 0.5ms)
[uint32]$desiredResolution = 5000
# -------------------------
Write-Host "正在查找进程 '$processName'..."
$process = Get-Process -Name $processName -ErrorAction SilentlyContinue
if (-not $process) { Write-Host "未找到进程 '$processName'。" -F Yellow; return }
$targetProcess = $process[0]
Write-Host "已找到进程! PID: $($targetProcess.Id)" -ForegroundColor Green
# 1. 打开目标进程的句柄,请求设置信息的权限
$hProcess = [NativeMethods]::OpenProcess([NativeMethods+ProcessAccessFlags]::PROCESS_SET_INFORMATION, $false, $targetProcess.Id)
if ($hProcess -eq [IntPtr]::Zero) { Write-Error "OpenProcess 失败!请确保以管理员身份运行。"; return }
try {
# 2. 准备数据结构
$timerInfo = New-Object NativeMethods+PROCESS_TIMER_RESOLUTION_INFORMATION
$timerInfo.DesiredResolution = $desiredResolution
$timerInfo.SetResolution = if ($enable) { 1 } else { 0 }
$action = if ($enable) { "设置" } else { "清除" }
Write-Host "正在尝试为 PID $($targetProcess.Id) $($action) 计时器精度..."
# 3. 调用 NtSetInformationProcess
$status = [NativeMethods]::NtSetInformationProcess(
$hProcess,
[NativeMethods+PROCESS_INFORMATION_CLASS]::ProcessTimerResolution,
[ref]$timerInfo,
[System.Runtime.InteropServices.Marshal]::SizeOf($timerInfo)
)
# 检查结果
if ($status -eq 0) {
Write-Host "成功!操作已完成。脚本将退出,但效果会持续存在。" -ForegroundColor Cyan
Write-Host "实际设置的精度为: $($timerInfo.ActualResolution / 10000) ms"
} else {
Write-Host "失败!NtSetInformationProcess 返回了非零的 NTSTATUS: 0x$($status.ToString('X'))" -ForegroundColor Red
}
}
finally {
# 4. 无论成功与否,都必须关闭句柄
[NativeMethods]::CloseHandle($hProcess)
}