1
Commit Graph

15 Commits

Author SHA1 Message Date
lzrdblzzrd 0e8d7333c1 Rewrite: simplify to strict algorithm, remove promoted map
- Remove promoted map entirely — processes are demoted when RSS < -mem
  and promoted when RSS >= -mem, no permanent state
- Remove trySetPrio closure — use setPrio directly for simplicity
- Remove curPrioWithHandle helper — inline procGetPriority.Call
- Remove GAME ... tracked as game (blocked) repeated log — log once
  on detection via GAME DETECT, silently skip on subsequent scans
- Game mode: log GAME DETECT once when process first exceeds game-mem
- gameSaved stores original priority before IDLE demote, restores on
  GAME MODE OFF or shutdown
- Delay between priority changes: 100ms
- Delete TZ.md (was a test for other AI)
2026-06-23 11:16:51 +03:00
lzrdblzzrd da13a6d549 Demote promoted processes when RSS drops below threshold
Previously, once a process was promoted to HIGH, it stayed HIGH forever
even if its RSS dropped well below the -mem threshold. Now promoted
processes are demoted back to NORMAL when RSS < -mem, and removed from
the promoted map.

Also: added TZ.md with full technical specification of the project.
2026-06-23 08:58:11 +03:00
lzrdblzzrd ea914101bb Fix: blocked processes still measured for game-mem detection
Previously, when SetPriorityClass failed for a process (e.g. anti-cheat),
it was added to 'blocked' and completely skipped in future scans —
including RSS measurement. This meant a game that started below game-mem
threshold and got blocked before reaching it would never trigger game mode.

Now pass 1 measures RSS for ALL processes (including blocked ones) and
adds them to gameProcs if they exceed game-mem. Pass 2 skips priority
changes for blocked processes but still tracks them as game processes.

In game mode, blocked game procs log 'tracked as game (blocked)' instead
of trying SetPriorityClass again.
2026-06-22 17:41:10 +03:00
lzrdblzzrd 565b751195 Rewrite game mode: two-pass scan, priority restoration, LimitedInformation access
- Use PROCESS_QUERY_LIMITED_INFORMATION instead of PROCESS_QUERY_INFORMATION
  to open processes (fixes Access Denied for KeePassXC, HD-Player, etc.)
- Separate query handle from set handle: trySetPrio reopens with
  PROCESS_SET_INFORMATION only when needed
- Two-pass scan: pass 1 collects RSS and detects game processes,
  pass 2 applies priorities with correct hasGame state
- Game mode saves original priorities in gameSaved map, restores them
  on GAME MODE OFF (not just NORMAL)
- Demote ALL non-game processes to IDLE in game mode (not just promoted)
- 50ms delay between priority changes for smooth transitions
- Replace isAlive/procName with pidMap from allProcs snapshot
- Replace mutex/MessageBox single-instance with killOtherInstances
- Defaults: -mem=512M, -game-mem=4G
- Fix double CloseHandle and handle leak in trySetPrio
- Update README with new defaults and game mode restoration behavior
2026-06-22 17:24:21 +03:00
lzrdblzzrd b5885791fa Fix process entry struct, add demote logic, block protected processes, improve logging 2026-06-21 15:11:15 +03:00
lzrdblzzrd d4da33ca5e fix: ErrorAlreadyExists 1832->183, wrap syscall errors, signal handling, mutex cleanup, log sync 2026-06-20 23:41:59 +03:00
lzrdblzzrd 33dfd4b4c5 fix: processEntry32 DefaultHeapID uint32 instead of uintptr 2026-06-19 23:24:01 +03:00
lzrdblzzrd b999b7ec4f refactor: error handling, single rss call, stale PID cleanup, utf16 trim, O_APPEND log 2026-06-19 23:20:10 +03:00
lzrdblzzrd d0cafe1332 log: move log file to temp directory with fallback 2026-06-19 21:39:45 +03:00
lzrdblzzrd c3cb8ae847 rewrite: single file, zero deps, Windows API, logging, CLI flags 2026-06-19 21:37:01 +03:00
lzrdblzzrd c8648da296 updated with opencode 2026-06-17 02:15:43 +03:00
lzrdblzzrd 0b714dd3ef added a check for a running instance of the program 1.1 2023-01-15 16:08:01 +03:00
lzrdblzzrd 39030102b4 go.sum has been cleaned up 1.0 2023-01-15 09:55:58 +03:00
lzrdblzzrd 6e1d1da239 initial commit 2023-01-15 03:28:39 +03:00
lzrdblzzrd 0876ff81db Initial commit 2023-01-15 03:25:23 +03:00