Просмотр исходного кода

【文档】拆分技术文档到 docs 并精简自述

技术内容移入 docs/,README 仅保留简介、安装、快速上手与文档索引,风格对齐参考仓库 spt-potato-graphics。

- docs/principle.md:镜内 PiP 管线、逆向符号表、prefix 方案与超分限制。
- docs/configuration.md:配置表与三种取值方式的语义。
- docs/development.md:构建、测试、打包与发布。
- docs/verification.md:实机验证与排查。
- docs/compatibility.md:与其它模组的交互、已知限制与风险。
- docs/README.md:文档索引。
- 新增 LICENSE(MIT),README 许可证小节改为指向该文件。
- 全部文档沿用「中文整段 + English 整段」的双语块结构。
PJ568 1 месяц назад
Родитель
Сommit
532a485a20
8 измененных файлов с 516 добавлено и 224 удалено
  1. 21 0
      LICENSE
  2. 35 224
      README.md
  3. 21 0
      docs/README.md
  4. 45 0
      docs/compatibility.md
  5. 69 0
      docs/configuration.md
  6. 105 0
      docs/development.md
  7. 167 0
      docs/principle.md
  8. 53 0
      docs/verification.md

+ 21 - 0
LICENSE

@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2026 PJ568
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 35 - 224
README.md

@@ -4,135 +4,41 @@
 
 > 调整《逃离塔科夫》光学瞄具**镜内放大(PiP)相机**渲染分辨率的 SPT 客户端插件。
 
-镜内画中画(PiP)是原生瞄具最吃 GPU 的部分:游戏会为瞄具单独创建一台相机,把一个 `N×N` 的方形 RenderTexture(默认 `1024²`)贴到镜片上。本插件让这个 `N` 可配置,从而在画质与帧数之间自行取舍。
-
-## 原理
-
-客户端反编译(EFT 0.16 / SPT 4.1.x)确认:
-
-- `EFT.CameraControl.OpticCameraManager` 中字段 `public int OpticFinalResolution = 1024;`,方法 `SetResolution(int)` 会销毁并重建一个 `N×N` 方形 `RenderTexture`(`name = "SSAAOpticCurrent"`),赋给 `Camera.targetTexture` 并 `Shader.SetGlobalTexture("_CamTex")`。
-- 该值在当前版本**没有任何设置项暴露**,唯一调用点是 `Init()`。
-- 体积光(`VolumetricLightRenderer`)、草地运动矢量(`GPUInstancer`)、远距阴影(`DistantShadow`)、MBOIT(`WindowsManager`)都会在下一帧检测到尺寸变化并自动重建,无需插件干预。
-
-因此本插件用 Harmony **prefix** 覆盖 `SetResolution` 的入参,使游戏自身的 `Init()` 就直接建到目标分辨率,避免二次重建造成的闪烁。
-
-镜内画面最终由主相机的 `SSAA`/`SSAAImpl` 随整帧上采样到屏幕——**本插件不改变超分(DLSS/FSR)设置**,只调整镜内源分辨率。
-
-## 支持版本
-
-- SPT `4.1.x`(EFT 客户端 `0.16`)。
-- 客户端插件依赖 `Assembly-CSharp.dll` 中的具体类型与方法,跨版本可能失效。
+镜内画中画(PiP)是原生瞄具最吃 GPU 的部分:游戏会为瞄具单独创建一台相机,把一张 `N×N` 的方形 RenderTexture(默认 `1024²`)贴到镜片上。本插件让这个 `N` 可配置,从而在画质与帧数之间自行取舍。
 
 ## 安装
 
-1. 构建或下载 `PerformanceScope-v{版本}.zip`。
+1. 下载 Releases 中的 `PerformanceScope-v{版本}.zip`。
 2. 解压到游戏根目录,使 dll 位于
    `BepInEx/plugins/PerformanceScope/PerformanceScope.dll`。
 3. 启动游戏。
 
-## 调参方式
-
-安装 [BepInEx ConfigurationManager](https://github.com/BepInEx/BepInEx.ConfigurationManager) 后,
-游戏内按 **F1**(可在其配置文件中改键)打开菜单,在 `PerformanceScope` 分区调整。
-**本插件不自带任何自定义界面或热键**;改动在游戏内即时生效(由服务层每帧同步)。
-
-## 配置
-
-配置文件:`BepInEx/config/com.pj568.performancescope.cfg`(也可用 ConfigurationManager 修改)。
-
-| 节 | 键 | 默认值 | 说明 |
-| --- | --- | --- | --- |
-| 1. 通用 · General | 启用模组 \| Enable Mod | `true` | 总开关,关闭后恢复游戏默认分辨率。 |
-| 1. 通用 · General | 启用日志 \| Enable Logging | `false` | 输出常规/诊断/警告日志(错误日志始终输出)。 |
-| 1. 通用 · General | 详细日志 \| Verbose Logging | `false` | 更详细的诊断信息。 |
-| 2. 镜内分辨率 · Scope Resolution | 取值方式 \| Resolution Mode | `游戏默认` | 游戏默认 / 屏幕高度比例 / 绝对像素。 |
-| 2. 镜内分辨率 · Scope Resolution | 屏幕高度比例 \| Screen Height Ratio | `0.5` | 镜内边长 = round(屏幕高度 × 该值)。 |
-| 2. 镜内分辨率 · Scope Resolution | 绝对像素 \| Absolute Pixels | `1024` | 镜内方形 RenderTexture 的边长。 |
-| 2. 镜内分辨率 · Scope Resolution | 瞄准中立即应用 \| Apply While Scoped | `true` | 关闭时,瞄准期间的改动推迟到退出镜内后应用。 |
-
-> 默认取值方式为「游戏默认」,即安装后不改变游戏行为;请显式选择模式。
-> 注意:`屏幕高度比例` 在 4K(2160p)下 `0.7` 会得到 1512,**高于**游戏默认 1024,反而增加负载。
-
-## 构建
-
-前置:本机已安装 SPT 客户端(客户端程序集为专有文件,不随仓库分发)。
+## 快速上手
 
-```shellscript
-# 指定游戏根目录(未设置时回退到本机 Lutris 前缀默认路径)
-export SPT_DIR="/path/to/Escape from Tarkov"
-dotnet build src/PerformanceScope.Plugin/PerformanceScope.Plugin.csproj -c Release
-```
+1. 确认已安装 [BepInEx ConfigurationManager](https://github.com/BepInEx/BepInEx.ConfigurationManager)。
+2. 游戏内按 **F1**(可在其配置中改键)打开菜单,找到 `PerformanceScope` 分区。
+3. 把「取值方式 | Resolution Mode」设为「屏幕高度比例」或「绝对像素」——
+   默认是「游戏默认」,安装后不改变游戏行为。
+4. 进战局举镜查看效果;开启「启用日志」后可在
+   `BepInEx/LogOutput.log` 看到 `镜内分辨率 1024 → …`。
 
-Release 构建会自动把 dll 复制到 `$SPT_DIR/BepInEx/plugins/PerformanceScope/`;
-可用 `-p:DeployToGame=false` 关闭。
+> 注意:`屏幕高度比例` 在 4K(2160p)下取 `0.7` 会得到 1512,**高于**默认 1024,反而更吃性能。
 
-## 测试
+## 文档
 
-纯逻辑层(分辨率换算与应用决策)无游戏依赖,可直接测试:
+- [原理与逆向细节](docs/principle.md)
+- [配置参考](docs/configuration.md)
+- [构建、测试与发布](docs/development.md)
+- [实机验证](docs/verification.md)
+- [兼容性与限制](docs/compatibility.md)
 
-```shellscript
-dotnet test tests/PerformanceScope.Tests/PerformanceScope.Tests.csproj
-```
-
-## 打包与发布
-
-```shellscript
-# 仅打包
-scripts/package.sh
-# 产物:artifacts/PerformanceScope-v{版本}.zip
-
-# 一键发布:构建 → 打包 → 打 tag → 推送 → 创建 GitHub Release
-scripts/release.sh
-# 预演(只构建打包并打印将执行的命令,需工作区干净)
-scripts/release.sh --dry-run
-```
-
-发布前置:已安装并登录 GitHub CLI(`gh`),且仓库已配置 `remote origin`。
-`release.sh` 会校验工作区干净、tag 不存在,发布后自动创建带 zip 附件的 Release。
-
-## 部署(本机)
-
-```shellscript
-scripts/package.sh
-# 解压 zip 到游戏根目录,或直接依赖 Release 构建的自动复制
-```
-
-启动后 `BepInEx/LogOutput.log` 应出现:
-
-```
-[Info   :PerformanceScope] PerformanceScope 已加载(在 ConfigurationManager 菜单中调参)
-[Info   :PerformanceScope] 镜内分辨率 1024 → 720
-```
-
-## 验证
-
-1. 在 ConfigurationManager 里开启「启用日志」。
-2. 进入战局,按住右键进入瞄具。
-3. 打开 ConfigurationManager(默认 F1),把「取值方式」切到「屏幕高度比例」或「绝对像素」。
-4. 观察 `BepInEx/LogOutput.log` 的 `镜内分辨率 1024 → …` 与镜内画质/帧数变化。
-5. 关闭「瞄准中立即应用」后瞄准时改值,确认改动在退出镜内后才生效。
-
-## 与其它模组的交互
-
-- **PiP-Disabler**(`com.fiodor.pipdisabler`):它是对 `SetResolution` 的 **postfix 门控**(不改写入参、不改字段),与本插件共存;被它抑制的镜内渲染不会触发本插件的冲突重试。
-- **Fontaine's FOV Fix / Amands's Graphics**:patch 的是 `OpticComponentUpdater` 等与本插件不重叠的目标,无直接冲突。
-- **DERP(Dynamic External Resolution Patch)**:改的是**主相机/全局**分辨率与超分档,与本插件(镜内方形 RT 尺寸)机制不同;可同时使用,但两者都会影响分辨率,注意叠加效果。
-- **DLSS / FSR**:本插件**不切换超分档**;但开启超分时改变镜内 RT 尺寸可能产生一帧闪烁,可关闭「瞄准中立即应用」规避。SPT 官方亦记录过「DLSS/FSR 下进镜切换档位会黑屏闪烁」。
-
-> 本插件涉及的游戏符号(`OpticCameraManager.SetResolution`、`OpticFinalResolution`、`_CamTex`、`SSAAOpticCurrent` 等)均直接取自**本机安装的 SPT 4.1.x 实际 `Assembly-CSharp.dll`** 反编译结果,而非公开资料。
-
-## 已知限制与风险
+## 支持版本
 
-- **无法独立设置镜内超分档**:全游戏只有一套挂在主相机上的 `SSAA`/`SSAAImpl`,镜内画面是其一部分;独立的镜内 FSR/DLSS 需要另挂一套组件,本插件不做。
-- **瞄准中改分辨率可能有一帧闪烁**:因为会销毁并重建 RenderTexture;可将「瞄准中立即应用」关闭以规避。
-- **镜内低分辨率下纹理锯齿会更明显**:镜内相机的 mipmap bias 只在 `Init()` 时设置一次,插件不做补偿。
-- **与其它改 `SetResolution` 的模组可能冲突**:若第三方 prefix 改写同一入参,插件检测到目标未生效后会暂停重试直至你更改目标值,避免每帧重建 RenderTexture。
-- **版本敏感**:依赖具体类型与方法,EFT 更新后可能失效。
-- **CI 限制**:客户端插件必须引用专有程序集,公共 runner 无法构建,故仓库只保留 `test.yml`(跑纯逻辑单测);发行包用 `scripts/release.sh` 本地一键发布。
+SPT `4.1.x`(EFT 客户端 `0.16`)。
 
 ## 许可证
 
-(待定)
+[MIT](LICENSE)
 
 ===============================================================
 
@@ -142,131 +48,36 @@ scripts/package.sh
 
 Picture-in-picture (PiP) is the most GPU-hungry part of a magnified optic: the game creates a dedicated camera and renders an `N×N` square RenderTexture (default `1024²`) onto the lens. This plugin makes that `N` configurable, so you can trade image quality for frame rate.
 
-## How it works
-
-Client decompilation (EFT 0.16 / SPT 4.1.x) confirms:
-
-- `EFT.CameraControl.OpticCameraManager` has `public int OpticFinalResolution = 1024;`. Its `SetResolution(int)` destroys and recreates an `N×N` square `RenderTexture` (`name = "SSAAOpticCurrent"`), assigns it to `Camera.targetTexture`, and sets the global `Shader.SetGlobalTexture("_CamTex")`.
-- In the current version this value is **not exposed by any setting**; its only call site is `Init()`.
-- Volumetric lighting (`VolumetricLightRenderer`), grass motion vectors (`GPUInstancer`), distant shadows (`DistantShadow`) and MBOIT (`WindowsManager`) all detect the size change on the next frame and rebuild automatically — no plugin intervention needed.
-
-The plugin therefore uses a Harmony **prefix** to override the `resolution` argument of `SetResolution`, so the game's own `Init()` creates the RT at the target size directly, avoiding a double-rebuild flicker.
-
-The scoped image is finally upscaled to the screen together with the whole frame by the main camera's `SSAA`/`SSAAImpl` — **this plugin does not change any upscaler (DLSS/FSR) setting**; it only adjusts the in-scope source resolution.
-
-## Supported versions
-
-- SPT `4.1.x` (EFT client `0.16`).
-- The client plugin depends on specific types and methods in `Assembly-CSharp.dll`, so it may break across versions.
-
 ## Installation
 
-1. Build or download `PerformanceScope-v{version}.zip`.
+1. Download `PerformanceScope-v{version}.zip` from Releases.
 2. Extract it into the game root so the dll lands at
    `BepInEx/plugins/PerformanceScope/PerformanceScope.dll`.
 3. Launch the game.
 
-## Tuning
-
-Install [BepInEx ConfigurationManager](https://github.com/BepInEx/BepInEx.ConfigurationManager), then press **F1** in game (rebindable in its config) and adjust the `PerformanceScope` sections.
-**This plugin ships no custom UI or hotkeys**; changes apply immediately in game (synced every frame by the service layer).
-
-## Configuration
-
-Config file: `BepInEx/config/com.pj568.performancescope.cfg` (or edit through ConfigurationManager).
-
-| Section | Key | Default | Notes |
-| --- | --- | --- | --- |
-| 1. 通用 · General | 启用模组 \| Enable Mod | `true` | Master switch; when off the game default is restored. |
-| 1. 通用 · General | 启用日志 \| Enable Logging | `false` | Writes info/verbose/warning logs (errors are always logged). |
-| 1. 通用 · General | 详细日志 \| Verbose Logging | `false` | More detailed diagnostics. |
-| 2. 镜内分辨率 · Scope Resolution | 取值方式 \| Resolution Mode | `游戏默认` | Game default / screen-height ratio / absolute pixels. |
-| 2. 镜内分辨率 · Scope Resolution | 屏幕高度比例 \| Screen Height Ratio | `0.5` | Scope edge = round(screen height × value). |
-| 2. 镜内分辨率 · Scope Resolution | 绝对像素 \| Absolute Pixels | `1024` | Edge length of the square scope RenderTexture. |
-| 2. 镜内分辨率 · Scope Resolution | 瞄准中立即应用 \| Apply While Scoped | `true` | When off, changes made while scoped are deferred until you unscope. |
-
-> The default mode is "game default", so installing the plugin does not change anything until you pick a mode.
-> Note: with `屏幕高度比例`, `0.7` on a 4K (2160p) display yields 1512, which is **higher** than the game default 1024 and therefore costs more.
-
-## Build
-
-Prerequisite: a local SPT client install (the client assemblies are proprietary and not distributed with this repository).
+## Quick start
 
-```shellscript
-# Point at the game root (falls back to the local Lutris prefix by default)
-export SPT_DIR="/path/to/Escape from Tarkov"
-dotnet build src/PerformanceScope.Plugin/PerformanceScope.Plugin.csproj -c Release
-```
+1. Make sure [BepInEx ConfigurationManager](https://github.com/BepInEx/BepInEx.ConfigurationManager) is installed.
+2. Press **F1** in game (rebindable in its config) and find the `PerformanceScope` sections.
+3. Set "取值方式 | Resolution Mode" to "屏幕高度比例" (screen-height ratio) or "绝对像素" (absolute pixels) — the default is "游戏默认" (game default), which changes nothing.
+4. Enter a raid and aim down sights to see the effect; enable "启用日志 | Enable Logging" to watch `镜内分辨率 1024 → …` in `BepInEx/LogOutput.log`.
 
-A Release build copies the dll to `$SPT_DIR/BepInEx/plugins/PerformanceScope/` automatically;
-disable with `-p:DeployToGame=false`.
+> Note: with `屏幕高度比例`, a value of `0.7` on 4K (2160p) yields 1512, **higher** than the default 1024 and therefore more expensive.
 
-## Test
+## Documentation
 
-The pure-logic layer (resolution math and apply decisions) has no game dependency and can be tested directly:
+- [How it works & reversing notes](docs/principle.md)
+- [Configuration reference](docs/configuration.md)
+- [Build, test & release](docs/development.md)
+- [In-game verification](docs/verification.md)
+- [Compatibility & limitations](docs/compatibility.md)
 
-```shellscript
-dotnet test tests/PerformanceScope.Tests/PerformanceScope.Tests.csproj
-```
-
-## Packaging and release
-
-```shellscript
-# Package only
-scripts/package.sh
-# Output: artifacts/PerformanceScope-v{version}.zip
-
-# One-command release: build → package → tag → push → create GitHub Release
-scripts/release.sh
-# Dry run (builds/packages and prints the commands; requires a clean work tree)
-scripts/release.sh --dry-run
-```
-
-Release prerequisites: GitHub CLI (`gh`) installed and logged in, and a configured `remote origin`.
-`release.sh` verifies a clean work tree and a fresh tag, then creates a Release with the zip attached.
-
-## Deploy (local)
-
-```shellscript
-scripts/package.sh
-# Extract the zip into the game root, or rely on the automatic copy of Release builds
-```
-
-On startup `BepInEx/LogOutput.log` should show:
-
-```
-[Info   :PerformanceScope] PerformanceScope 已加载(在 ConfigurationManager 菜单中调参)
-[Info   :PerformanceScope] 镜内分辨率 1024 → 720
-```
-
-## Verification
-
-1. Enable "启用日志 | Enable Logging" in ConfigurationManager.
-2. Enter a raid and aim down sights through a magnified optic.
-3. Open ConfigurationManager (default F1) and switch "取值方式 | Resolution Mode" to "屏幕高度比例" or "绝对像素".
-4. Watch `BepInEx/LogOutput.log` for `镜内分辨率 1024 → …`, and check the scoped image quality / frame rate.
-5. Turn off "瞄准中立即应用 | Apply While Scoped", change the value while scoped, and confirm the change only applies after you unscope.
-
-## Interaction with other mods
-
-- **PiP-Disabler** (`com.fiodor.pipdisabler`): it is a **postfix gate** on `SetResolution` (it neither rewrites the argument nor the field), so it coexists with this plugin; suppressed scoped rendering does not trigger this plugin's conflict retry.
-- **Fontaine's FOV Fix / Amands's Graphics**: they patch targets (`OpticComponentUpdater`, etc.) that do not overlap this plugin, so there is no direct conflict.
-- **DERP (Dynamic External Resolution Patch)**: it changes the **main camera / global** resolution and upscaler mode, a different mechanism from this plugin (in-scope square RT size). Both can be used together, but note that their effects stack.
-- **DLSS / FSR**: this plugin **does not switch upscaler modes**; however, changing the scoped RT size while an upscaler is active may cause a one-frame flicker — turn off "瞄准中立即应用" to avoid it. SPT officially documents a black flicker when switching modes under DLSS/FSR.
-
-> Every game symbol used here (`OpticCameraManager.SetResolution`, `OpticFinalResolution`, `_CamTex`, `SSAAOpticCurrent`, …) was taken directly from decompiling the **SPT 4.1.x `Assembly-CSharp.dll` installed on this machine**, not from public sources.
-
-## Known limitations and risks
+## Supported versions
 
-- **No independent in-scope upscaler setting**: the game has a single `SSAA`/`SSAAImpl` on the main camera and the scoped image is part of it; a truly independent in-scope FSR/DLSS would require attaching a second component, which this plugin does not do.
-- **Changing resolution while scoped may flash for one frame** because the RenderTexture is destroyed and recreated; turn off "瞄准中立即应用" to avoid it.
-- **Texture aliasing becomes more visible at low in-scope resolutions**: the scope camera's mipmap bias is only set once in `Init()`, and the plugin does not compensate.
-- **Possible conflict with other mods that patch `SetResolution`**: if a third-party prefix rewrites the same argument, the plugin detects the target not taking effect and pauses retries until you change the target, avoiding per-frame RenderTexture rebuilds.
-- **Version sensitive**: it depends on specific types and methods and may break after an EFT update.
-- **CI limitation**: a client plugin must reference proprietary assemblies, which public runners cannot build, so the repository keeps only `test.yml` (pure-logic unit tests); release packages are produced locally with `scripts/release.sh`.
+SPT `4.1.x` (EFT client `0.16`).
 
 ## License
 
-(TBD)
+[MIT](LICENSE)
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

+ 21 - 0
docs/README.md

@@ -0,0 +1,21 @@
+# 文档索引
+
+本目录收录 PerformanceScope 的技术文档。README 保持精简,深入内容按主题拆分如下:
+
+- [原理与逆向细节](principle.md):镜内 PiP 管线、游戏符号表、Harmony patch 策略与尺寸联动机制。
+- [配置参考](configuration.md):完整配置表、三种取值方式的语义与边界、即时应用行为。
+- [构建、测试、打包与发布](development.md):`SPT_DIR`、构建与部署、单测、打包与发布脚本。
+- [实机验证](verification.md):进战局验证步骤与常见排查建议。
+- [兼容性与限制](compatibility.md):与其它模组的交互、已知限制与风险、符号来源说明。
+
+===============================================================
+
+# Documentation Index
+
+This directory holds the technical documentation for PerformanceScope. The README stays short; the in-depth material is split by topic below:
+
+- [Principles and reverse-engineering details](principle.md): the in-scope PiP pipeline, the game symbol table, the Harmony patch strategy, and how size consumers react.
+- [Configuration reference](configuration.md): the full config table, the semantics and bounds of the three resolution modes, and the immediate-apply behavior.
+- [Build, test, packaging and release](development.md): `SPT_DIR`, build and deploy, unit tests, and the packaging/release scripts.
+- [In-game verification](verification.md): the in-raid verification steps and common troubleshooting tips.
+- [Compatibility and limitations](compatibility.md): interaction with other mods, known limitations and risks, and the source of the symbols.

+ 45 - 0
docs/compatibility.md

@@ -0,0 +1,45 @@
+# 兼容性与限制
+
+## 与其它模组的交互
+
+- **PiP-Disabler**(`com.fiodor.pipdisabler`):它是对 `SetResolution` 的 **postfix 门控**(不改写入参、不改字段),与本插件共存;被它抑制的镜内渲染不会触发本插件的冲突重试。
+- **Fontaine's FOV Fix / Amands's Graphics**:patch 的是 `OpticComponentUpdater` 等与本插件不重叠的目标,无直接冲突。
+- **DERP(Dynamic External Resolution Patch)**:改的是**主相机/全局**分辨率与超分档,与本插件(镜内方形 RT 尺寸)机制不同;可同时使用,但两者都会影响分辨率,注意叠加效果。
+- **DLSS / FSR**:本插件**不切换超分档**;但开启超分时改变镜内 RT 尺寸可能产生一帧闪烁,可关闭「瞄准中立即应用」规避。SPT 官方亦记录过「DLSS/FSR 下进镜切换档位会黑屏闪烁」。
+
+## 已知限制与风险
+
+- **无法独立设置镜内超分档**:全游戏只有一套挂在主相机上的 `SSAA`/`SSAAImpl`,镜内画面是其一部分;独立的镜内 FSR/DLSS 需要另挂一套组件,本插件不做。
+- **瞄准中改分辨率可能有一帧闪烁**:因为会销毁并重建 RenderTexture;可将「瞄准中立即应用」关闭以规避。
+- **镜内低分辨率下纹理锯齿会更明显**:镜内相机的 mipmap bias 只在 `Init()` 时设置一次,插件不做补偿。
+- **与其它改 `SetResolution` 的模组可能冲突**:若第三方 prefix 改写同一入参,插件检测到目标未生效后会暂停重试直至你更改目标值,避免每帧重建 RenderTexture。
+- **版本敏感**:依赖具体类型与方法,EFT 更新后可能失效。
+- **CI 限制**:客户端插件必须引用专有程序集,公共 runner 无法构建,故仓库只保留 `test.yml`(跑纯逻辑单测);发行包用 `scripts/release.sh` 本地一键发布。
+
+## 符号来源
+
+> 本插件涉及的游戏符号(`OpticCameraManager.SetResolution`、`OpticFinalResolution`、`_CamTex`、`SSAAOpticCurrent` 等)均直接取自**本机安装的 SPT 4.1.x 实际 `Assembly-CSharp.dll`** 反编译结果,而非公开资料。
+
+===============================================================
+
+# Compatibility and Limitations
+
+## Interaction with Other Mods
+
+- **PiP-Disabler** (`com.fiodor.pipdisabler`): it is a **postfix gate** on `SetResolution` (it neither rewrites the argument nor the field), so it coexists with this plugin; suppressed scoped rendering does not trigger this plugin's conflict retry.
+- **Fontaine's FOV Fix / Amands's Graphics**: they patch targets (`OpticComponentUpdater`, etc.) that do not overlap this plugin, so there is no direct conflict.
+- **DERP (Dynamic External Resolution Patch)**: it changes the **main camera / global** resolution and upscaler mode, a different mechanism from this plugin (in-scope square RT size). Both can be used together, but note that their effects stack.
+- **DLSS / FSR**: this plugin **does not switch upscaler modes**; however, changing the scoped RT size while an upscaler is active may cause a one-frame flicker — turn off "瞄准中立即应用" to avoid it. SPT officially documents a black flicker when switching modes under DLSS/FSR.
+
+## Known Limitations and Risks
+
+- **No independent in-scope upscaler setting**: the game has a single `SSAA`/`SSAAImpl` on the main camera and the scoped image is part of it; a truly independent in-scope FSR/DLSS would require attaching a second component, which this plugin does not do.
+- **Changing resolution while scoped may flash for one frame** because the RenderTexture is destroyed and recreated; turn off "瞄准中立即应用" to avoid it.
+- **Texture aliasing becomes more visible at low in-scope resolutions**: the scope camera's mipmap bias is only set once in `Init()`, and the plugin does not compensate.
+- **Possible conflict with other mods that patch `SetResolution`**: if a third-party prefix rewrites the same argument, the plugin detects the target not taking effect and pauses retries until you change the target, avoiding per-frame RenderTexture rebuilds.
+- **Version sensitive**: it depends on specific types and methods and may break after an EFT update.
+- **CI limitation**: a client plugin must reference proprietary assemblies, which public runners cannot build, so the repository keeps only `test.yml` (pure-logic unit tests); release packages are produced locally with `scripts/release.sh`.
+
+## Source of the Symbols
+
+> Every game symbol used here (`OpticCameraManager.SetResolution`, `OpticFinalResolution`, `_CamTex`, `SSAAOpticCurrent`, …) was taken directly from decompiling the **SPT 4.1.x `Assembly-CSharp.dll` installed on this machine**, not from public sources.

+ 69 - 0
docs/configuration.md

@@ -0,0 +1,69 @@
+# 配置参考
+
+配置文件:`BepInEx/config/com.pj568.performancescope.cfg`(也可用 BepInEx ConfigurationManager 修改)。
+
+本插件不自带任何自定义界面或热键。安装 [BepInEx ConfigurationManager](https://github.com/BepInEx/BepInEx.ConfigurationManager) 后,游戏内按 **F1**(可在其配置文件中改键)打开菜单,在 `PerformanceScope` 分区调整;改动由服务层每帧同步,在游戏内即时生效。
+
+## 配置表
+
+| 节 | 键 | 默认值 | 说明 |
+| --- | --- | --- | --- |
+| 1. 通用 · General | 启用模组 \| Enable Mod | `true` | 总开关,关闭后恢复游戏默认分辨率。 |
+| 1. 通用 · General | 启用日志 \| Enable Logging | `false` | 输出常规/诊断/警告日志(错误日志始终输出)。 |
+| 1. 通用 · General | 详细日志 \| Verbose Logging | `false` | 更详细的诊断信息。 |
+| 2. 镜内分辨率 · Scope Resolution | 取值方式 \| Resolution Mode | `游戏默认` | 游戏默认 / 屏幕高度比例 / 绝对像素。 |
+| 2. 镜内分辨率 · Scope Resolution | 屏幕高度比例 \| Screen Height Ratio | `0.5` | 镜内边长 = round(屏幕高度 × 该值)。 |
+| 2. 镜内分辨率 · Scope Resolution | 绝对像素 \| Absolute Pixels | `1024` | 镜内方形 RenderTexture 的边长。 |
+| 2. 镜内分辨率 · Scope Resolution | 瞄准中立即应用 \| Apply While Scoped | `true` | 关闭时,瞄准期间的改动推迟到退出镜内后应用。 |
+
+## 三种取值方式
+
+- **游戏默认**:不改变游戏行为,插件按游戏硬编码的 `1024` 放行。安装后默认即此模式,需要显式选择其它模式才会生效。
+- **屏幕高度比例**:镜内边长 = `round(屏幕高度 × 该值)`。比例的有效范围为 `0.05`–`4.0`,超出会被夹取到边界。
+- **绝对像素**:直接指定镜内方形 RenderTexture 的边长,有效范围为 `64`–`4096`,超出会被夹取到边界。
+
+任一模式下若配置值非法(例如无法解析),回退为游戏默认 `1024`。
+
+## 瞄准中立即应用
+
+默认开启。开启时,你在瞄准期间改动目标值会立即重建镜内 RenderTexture;关闭时,瞄准期间的改动会推迟到退出镜内后才应用。因为重建会销毁并重新创建 RenderTexture,瞄准中改值可能产生一帧闪烁,关闭此项可规避。
+
+## 注意
+
+> `屏幕高度比例` 在 4K(2160p)下取 `0.7` 会得到 1512,**高于**游戏默认 1024,反而增加负载。降低镜内分辨率才有助于提升帧数。
+
+===============================================================
+
+# Configuration Reference
+
+Config file: `BepInEx/config/com.pj568.performancescope.cfg` (or edit through BepInEx ConfigurationManager).
+
+The plugin ships no custom UI or hotkeys. Install [BepInEx ConfigurationManager](https://github.com/BepInEx/BepInEx.ConfigurationManager), then press **F1** in game (rebindable in its config) and adjust the `PerformanceScope` sections; changes are synced every frame by the service layer and apply immediately in game.
+
+## Config Table
+
+| Section | Key | Default | Notes |
+| --- | --- | --- | --- |
+| 1. 通用 · General | 启用模组 \| Enable Mod | `true` | Master switch; when off the game default is restored. |
+| 1. 通用 · General | 启用日志 \| Enable Logging | `false` | Writes info/verbose/warning logs (errors are always logged). |
+| 1. 通用 · General | 详细日志 \| Verbose Logging | `false` | More detailed diagnostics. |
+| 2. 镜内分辨率 · Scope Resolution | 取值方式 \| Resolution Mode | `游戏默认` | Game default / screen-height ratio / absolute pixels. |
+| 2. 镜内分辨率 · Scope Resolution | 屏幕高度比例 \| Screen Height Ratio | `0.5` | Scope edge = round(screen height × value). |
+| 2. 镜内分辨率 · Scope Resolution | 绝对像素 \| Absolute Pixels | `1024` | Edge length of the square scope RenderTexture. |
+| 2. 镜内分辨率 · Scope Resolution | 瞄准中立即应用 \| Apply While Scoped | `true` | When off, changes made while scoped are deferred until you unscope. |
+
+## The Three Resolution Modes
+
+- **Game default**: changes nothing; the plugin passes through the game's hard-coded `1024`. This is the default on install, so the plugin has no effect until you pick another mode.
+- **Screen-height ratio**: scope edge = `round(screen height × value)`. The valid ratio range is `0.05`–`4.0`; out-of-range values are clamped to the bounds.
+- **Absolute pixels**: directly sets the edge length of the square scope RenderTexture. The valid range is `64`–`4096`; out-of-range values are clamped to the bounds.
+
+In any mode, an invalid value (for example one that cannot be parsed) falls back to the game default `1024`.
+
+## Apply While Scoped
+
+On by default. When on, changing the target value while scoped rebuilds the scope RenderTexture immediately; when off, changes made while scoped are deferred until you unscope. Because a rebuild destroys and recreates the RenderTexture, changing the value while scoped may cause a one-frame flicker — turn this off to avoid it.
+
+## Note
+
+> With `屏幕高度比例`, `0.7` on a 4K (2160p) display yields 1512, which is **higher** than the game default 1024 and therefore costs more. Only lowering the scope resolution helps frame rate.

+ 105 - 0
docs/development.md

@@ -0,0 +1,105 @@
+# 构建、测试、打包与发布
+
+## 前置
+
+本机需已安装 SPT 客户端。客户端程序集为专有文件,不随仓库分发。
+
+## `SPT_DIR`
+
+构建时通过环境变量 `SPT_DIR` 指定游戏根目录;未设置时回退到本机 Lutris 前缀的默认路径。
+
+```shellscript
+# 指定游戏根目录(未设置时回退到本机 Lutris 前缀默认路径)
+export SPT_DIR="/path/to/Escape from Tarkov"
+dotnet build src/PerformanceScope.Plugin/PerformanceScope.Plugin.csproj -c Release
+```
+
+Release 构建会自动把 dll 复制到 `$SPT_DIR/BepInEx/plugins/PerformanceScope/`;可用 `-p:DeployToGame=false` 关闭自动部署。
+
+## 测试
+
+纯逻辑层(分辨率换算与应用决策)无游戏依赖,可直接测试:
+
+```shellscript
+dotnet test tests/PerformanceScope.Tests/PerformanceScope.Tests.csproj
+```
+
+## 打包与发布
+
+```shellscript
+# 仅打包
+scripts/package.sh
+# 产物:artifacts/PerformanceScope-v{版本}.zip
+
+# 一键发布:构建 → 打包 → 打 tag → 推送 → 创建 GitHub Release
+scripts/release.sh
+# 预演(只构建打包并打印将执行的命令,需工作区干净)
+scripts/release.sh --dry-run
+```
+
+发布前置:已安装并登录 GitHub CLI(`gh`),且仓库已配置 `remote origin`。`release.sh` 会校验工作区干净、tag 不存在,发布后自动创建带 zip 附件的 Release。
+
+## 部署(本机)
+
+```shellscript
+scripts/package.sh
+# 解压 zip 到游戏根目录,或直接依赖 Release 构建的自动复制
+```
+
+## 为什么公共 CI 只跑纯逻辑单测
+
+客户端插件必须引用专有程序集(`Assembly-CSharp.dll`),公共 runner 无法构建,故仓库只保留 `test.yml`(跑纯逻辑单测);发行包用 `scripts/release.sh` 本地一键发布。
+
+===============================================================
+
+# Build, Test, Packaging and Release
+
+## Prerequisites
+
+A local SPT client install is required. The client assemblies are proprietary and are not distributed with this repository.
+
+## `SPT_DIR`
+
+Point at the game root with the `SPT_DIR` environment variable; when unset it falls back to the local Lutris prefix default path.
+
+```shellscript
+# Point at the game root (falls back to the local Lutris prefix by default)
+export SPT_DIR="/path/to/Escape from Tarkov"
+dotnet build src/PerformanceScope.Plugin/PerformanceScope.Plugin.csproj -c Release
+```
+
+A Release build copies the dll to `$SPT_DIR/BepInEx/plugins/PerformanceScope/` automatically; disable the automatic deploy with `-p:DeployToGame=false`.
+
+## Test
+
+The pure-logic layer (resolution math and apply decisions) has no game dependency and can be tested directly:
+
+```shellscript
+dotnet test tests/PerformanceScope.Tests/PerformanceScope.Tests.csproj
+```
+
+## Packaging and Release
+
+```shellscript
+# Package only
+scripts/package.sh
+# Output: artifacts/PerformanceScope-v{version}.zip
+
+# One-command release: build → package → tag → push → create GitHub Release
+scripts/release.sh
+# Dry run (builds/packages and prints the commands; requires a clean work tree)
+scripts/release.sh --dry-run
+```
+
+Release prerequisites: GitHub CLI (`gh`) installed and logged in, and a configured `remote origin`. `release.sh` verifies a clean work tree and a fresh tag, then creates a Release with the zip attached.
+
+## Deploy (Local)
+
+```shellscript
+scripts/package.sh
+# Extract the zip into the game root, or rely on the automatic copy of Release builds
+```
+
+## Why Public CI Runs Only Pure-Logic Unit Tests
+
+A client plugin must reference proprietary assemblies (`Assembly-CSharp.dll`), which public runners cannot build, so the repository keeps only `test.yml` (pure-logic unit tests); release packages are produced locally with `scripts/release.sh`.

+ 167 - 0
docs/principle.md

@@ -0,0 +1,167 @@
+# 原理与逆向细节
+
+> 本文记录 PerformanceScope 涉及的《逃离塔科夫》客户端渲染管线细节,全部来自对本机安装的 SPT 4.1.x `Assembly-CSharp.dll` 的实际反编译。
+
+## 镜内 PiP 管线
+
+镜内画中画(PiP)为瞄具单独创建一台相机:`EFT.CameraControl.OpticCameraManager` 持有自己的 `Camera`,并为它渲染一个 `N×N` 的方形 RenderTexture,再贴到镜片上。
+
+`SetResolution(int)` 是重建入口:每次调用先销毁旧 `_renderTexture`,随后按 `Camera.allowHDR` 在 `RenderTextureFormat.ARGBHalf` 与 `ARGB32` 之间二选一,新建边长 `N`、深度 24 的方形 RT,设置 `autoGenerateMips=false`、`useMipMap=false`、`name = "SSAAOpticCurrent"`,最后赋给 `Camera.targetTexture` 并 `Shader.SetGlobalTexture(_camTexId)`(`_CamTex`)。
+
+`OpticCameraManager` 通过 `OnOpticEnabled` / `OnOpticDisabled` 事件向外部广播瞄具的启用与停用。
+
+## 符号表
+
+### `EFT.CameraControl.OpticCameraManager`
+
+| 成员 | 形式 | 位置 |
+| --- | --- | --- |
+| `OpticFinalResolution` | `public int OpticFinalResolution = 1024;` | 行 17 |
+| `OpticRenderResolution` | `public int OpticRenderResolution => OpticFinalResolution;` | 行 55 |
+| `OpticNextRenderResolution` | `public int OpticNextRenderResolution => OpticFinalResolution;` | 行 57 |
+| `Camera` | `public Camera Camera { get; set; }` | — |
+| `IsAnyOpticCameraRendering` | `public bool IsAnyOpticCameraRendering => CurrentOpticSight != null;` | — |
+| `Init()` | 游戏侧唯一调用 `SetResolution(OpticFinalResolution)`;同时 `OpticSight.OpticSightState.Bind(...)` | 行 195、197 |
+| `SetResolution(int)` | 销毁旧 `_renderTexture`,按 `Camera.allowHDR` 选格式,新建方形 RT 并写入 `Camera.targetTexture` 与 `_CamTex` | 行 205–221 |
+| 事件 | `OnOpticEnabled` / `OnOpticDisabled` | — |
+
+### 全局贴图
+
+| 成员 | 形式 | 位置 |
+| --- | --- | --- |
+| `_CamTex` | `Shader.SetGlobalTexture(_camTexId)`,`_camTexId` 定义为 `_CamTex` | 行 53 |
+
+### `EFT.CameraControl.CameraManager`
+
+| 成员 | 形式 | 位置 |
+| --- | --- | --- |
+| `instance` | `public static CameraManager instance` | 行 62 |
+| `Instance` | `public static CameraManager Instance => instance ?? (instance = new CameraManager());` | 行 150 |
+| `OpticCameraManager` | 属性,返回 `OpticCameraManager` | 行 155 |
+| 构造函数 | `new OpticCameraManager()` | 行 1259–1261 |
+| 战局相机初始化 | 调用 `OpticCameraManager.Init()` | 行 550 |
+
+### `EFT.CameraControl.OpticSight`
+
+| 成员 | 形式 | 位置 |
+| --- | --- | --- |
+| `OpticSightState` | `public static BindableState<OpticSightStatus> OpticSightState` | 行 18 |
+| `OpticSightStatus` | `{ OpticSight OpticSight; bool IsEnabled; }` | — |
+| `OnEnable` / `OnDisable` | 写入 `OpticSightState.Value` | — |
+
+### 超分组件
+
+| 成员 | 形式 | 位置 |
+| --- | --- | --- |
+| `SSAA` / `SSAAImpl` | 仅挂在主相机上 | `CameraManager.cs:529-530` |
+| 超分入口 | `SetAntiAliasing` / `SetSuperSampling` / `SetFSR2` / `SetFSR3` | — |
+
+## 为什么用 Harmony prefix 覆盖入参
+
+游戏侧唯一调用 `SetResolution` 的地方是 `Init()`(行 195),且固定传入 `OpticFinalResolution`。如果在 postfix 里改写结果,游戏会先按默认 `1024` 建一次 RenderTexture,再被插件重建,造成一次可见的闪烁。
+
+因此本插件用 Harmony **prefix** 直接覆盖 `SetResolution` 的入参,让游戏自身的 `Init()` 一次性就建到目标分辨率,避免二次重建。
+
+## 尺寸消费方自动重建
+
+镜内尺寸变化不需要插件干预。以下子系统会在后续帧自检并重建:
+
+| 消费方 | 关注点 |
+| --- | --- |
+| `VolumetricLightRenderer` | 读 `OpticRenderResolution` |
+| `GPUInstancer` / `GPUInstancerManager` | `OpticResolution`、`OnResolutionChangeOptic` |
+| `DistantShadow` | 自检尺寸 |
+| `WindowsManager`(MBOIT) | `CameraRenderData` 尺寸比对 |
+
+## 超分限制
+
+镜内画面最终由主相机的 `SSAA` / `SSAAImpl` 随整帧一起上采样到屏幕。全游戏只有一套挂在主相机上的超分组件(`CameraManager.cs:529-530`),镜内**没有**独立的 SSAA / 超分实例。因此本插件**无法独立设置镜内超分档**,也不切换任何超分设置,只调整镜内源分辨率。
+
+## 1024 的来历
+
+游戏默认的 `1024` 是硬编码常量(`OpticFinalResolution = 1024`),与屏幕分辨率、画质档、瞄具倍率、镜型都无关。`OpticRenderResolution` 与 `OpticNextRenderResolution` 都只是回读 `OpticFinalResolution`;其中 `OpticNextRenderResolution` 是未接线的残留,没有实际消费方。
+
+===============================================================
+
+# Principles and Reverse-Engineering Details
+
+> This document records the Escape from Tarkov client rendering-pipeline details behind PerformanceScope, all taken from decompiling the SPT 4.1.x `Assembly-CSharp.dll` installed on this machine.
+
+## The In-Scope PiP Pipeline
+
+Picture-in-picture (PiP) creates a dedicated camera for the optic: `EFT.CameraControl.OpticCameraManager` owns its own `Camera` and renders an `N×N` square RenderTexture for it, then maps that onto the lens.
+
+`SetResolution(int)` is the rebuild entry point: each call first destroys the old `_renderTexture`, then picks `RenderTextureFormat.ARGBHalf` or `ARGB32` based on `Camera.allowHDR`, creates a square RT of edge length `N` and depth 24, sets `autoGenerateMips=false`, `useMipMap=false`, `name = "SSAAOpticCurrent"`, and finally assigns it to `Camera.targetTexture` and calls `Shader.SetGlobalTexture(_camTexId)` (`_CamTex`).
+
+`OpticCameraManager` broadcasts optic enable/disable through the `OnOpticEnabled` / `OnOpticDisabled` events.
+
+## Symbol Table
+
+### `EFT.CameraControl.OpticCameraManager`
+
+| Member | Form | Location |
+| --- | --- | --- |
+| `OpticFinalResolution` | `public int OpticFinalResolution = 1024;` | line 17 |
+| `OpticRenderResolution` | `public int OpticRenderResolution => OpticFinalResolution;` | line 55 |
+| `OpticNextRenderResolution` | `public int OpticNextRenderResolution => OpticFinalResolution;` | line 57 |
+| `Camera` | `public Camera Camera { get; set; }` | — |
+| `IsAnyOpticCameraRendering` | `public bool IsAnyOpticCameraRendering => CurrentOpticSight != null;` | — |
+| `Init()` | the only game-side call site of `SetResolution(OpticFinalResolution)`; also `OpticSight.OpticSightState.Bind(...)` | lines 195, 197 |
+| `SetResolution(int)` | destroys the old `_renderTexture`, picks the format from `Camera.allowHDR`, creates the square RT and writes `Camera.targetTexture` plus `_CamTex` | lines 205–221 |
+| Events | `OnOpticEnabled` / `OnOpticDisabled` | — |
+
+### Global texture
+
+| Member | Form | Location |
+| --- | --- | --- |
+| `_CamTex` | `Shader.SetGlobalTexture(_camTexId)`, where `_camTexId` is `_CamTex` | line 53 |
+
+### `EFT.CameraControl.CameraManager`
+
+| Member | Form | Location |
+| --- | --- | --- |
+| `instance` | `public static CameraManager instance` | line 62 |
+| `Instance` | `public static CameraManager Instance => instance ?? (instance = new CameraManager());` | line 150 |
+| `OpticCameraManager` | property returning `OpticCameraManager` | line 155 |
+| Constructor | `new OpticCameraManager()` | lines 1259–1261 |
+| Raid camera initialization | calls `OpticCameraManager.Init()` | line 550 |
+
+### `EFT.CameraControl.OpticSight`
+
+| Member | Form | Location |
+| --- | --- | --- |
+| `OpticSightState` | `public static BindableState<OpticSightStatus> OpticSightState` | line 18 |
+| `OpticSightStatus` | `{ OpticSight OpticSight; bool IsEnabled; }` | — |
+| `OnEnable` / `OnDisable` | write to `OpticSightState.Value` | — |
+
+### Upscaler components
+
+| Member | Form | Location |
+| --- | --- | --- |
+| `SSAA` / `SSAAImpl` | attached to the main camera only | `CameraManager.cs:529-530` |
+| Upscaler entries | `SetAntiAliasing` / `SetSuperSampling` / `SetFSR2` / `SetFSR3` | — |
+
+## Why a Harmony Prefix Overrides the Argument
+
+The only game-side call site of `SetResolution` is `Init()` (line 195), and it always passes `OpticFinalResolution`. If the result were rewritten in a postfix, the game would first build a RenderTexture at the default `1024` and then have it rebuilt by the plugin, causing a visible flicker.
+
+The plugin therefore uses a Harmony **prefix** to override the argument of `SetResolution`, so the game's own `Init()` creates the RT at the target resolution directly, avoiding a double rebuild.
+
+## Size Consumers Rebuild Automatically
+
+An in-scope size change needs no plugin intervention. The following subsystems detect it on a later frame and rebuild:
+
+| Consumer | Concern |
+| --- | --- |
+| `VolumetricLightRenderer` | reads `OpticRenderResolution` |
+| `GPUInstancer` / `GPUInstancerManager` | `OpticResolution`, `OnResolutionChangeOptic` |
+| `DistantShadow` | self-checks the size |
+| `WindowsManager` (MBOIT) | compares `CameraRenderData` size |
+
+## Upscaler Limitation
+
+The scoped image is finally upscaled to the screen together with the whole frame by the main camera's `SSAA` / `SSAAImpl`. The game has a single upscaler component attached to the main camera (`CameraManager.cs:529-530`); there is **no** independent in-scope SSAA / upscaler instance. The plugin therefore **cannot set an independent in-scope upscaler mode**, and it switches no upscaler setting; it only adjusts the in-scope source resolution.
+
+## Where 1024 Comes From
+
+The game default `1024` is a hard-coded constant (`OpticFinalResolution = 1024`), independent of screen resolution, quality preset, optic magnification, and optic type. Both `OpticRenderResolution` and `OpticNextRenderResolution` merely read back `OpticFinalResolution`; `OpticNextRenderResolution` is unwired residue with no actual consumer.

+ 53 - 0
docs/verification.md

@@ -0,0 +1,53 @@
+# 实机验证
+
+## 启动自检
+
+游戏启动后,`BepInEx/LogOutput.log` 应出现:
+
+```
+[Info   :PerformanceScope] PerformanceScope 已加载(在 ConfigurationManager 菜单中调参)
+[Info   :PerformanceScope] 镜内分辨率 1024 → 720
+```
+
+第二行示例表示镜内分辨率已从游戏默认 `1024` 切到 `720`。
+
+## 验证步骤
+
+1. 在 ConfigurationManager 里开启「启用日志」。
+2. 进入战局,按住右键进入瞄具。
+3. 打开 ConfigurationManager(默认 F1),把「取值方式」切到「屏幕高度比例」或「绝对像素」。
+4. 观察 `BepInEx/LogOutput.log` 的 `镜内分辨率 1024 → …` 与镜内画质/帧数变化。
+5. 关闭「瞄准中立即应用」后瞄准时改值,确认改动在退出镜内后才生效。
+
+## 排查建议
+
+- 所有运行日志(包括常规、诊断、警告与错误)都写入 `BepInEx/LogOutput.log`,遇到异常先看该文件。
+- 若插件检测到目标值未生效,会进入 `Conflict` 状态。该状态由冲突锁定产生(见[兼容性与限制](compatibility.md)),此时插件会暂停重试,直到你更改目标值。
+
+===============================================================
+
+# In-Game Verification
+
+## Startup Self-Check
+
+On startup `BepInEx/LogOutput.log` should show:
+
+```
+[Info   :PerformanceScope] PerformanceScope 已加载(在 ConfigurationManager 菜单中调参)
+[Info   :PerformanceScope] 镜内分辨率 1024 → 720
+```
+
+The second line means the scope resolution has switched from the game default `1024` to `720`.
+
+## Verification Steps
+
+1. Enable "启用日志 | Enable Logging" in ConfigurationManager.
+2. Enter a raid and aim down sights through a magnified optic.
+3. Open ConfigurationManager (default F1) and switch "取值方式 | Resolution Mode" to "屏幕高度比例" or "绝对像素".
+4. Watch `BepInEx/LogOutput.log` for `镜内分辨率 1024 → …`, and check the scoped image quality / frame rate.
+5. Turn off "瞄准中立即应用 | Apply While Scoped", change the value while scoped, and confirm the change only applies after you unscope.
+
+## Troubleshooting
+
+- Every runtime log (info, verbose, warning and error) is written to `BepInEx/LogOutput.log`; check that file first when something looks wrong.
+- If the plugin detects that the target value is not taking effect, it enters the `Conflict` state. That state is produced by the conflict lock (see [Compatibility and limitations](compatibility.md)); the plugin then pauses retries until you change the target value.