更新skill

This commit is contained in:
wuwenbo 2026-06-13 00:38:49 +08:00
parent fc71b72763
commit 8f89fc8cad
4 changed files with 51 additions and 4 deletions

View File

@ -110,6 +110,23 @@ pwsh -NoProfile -ExecutionPolicy Bypass -File Tools\DecodeOnlineError.ps1 -Input
Then locate code with `rg` and decoded symbols. Prefer exact decoded class/method names first, then stable message strings. Do not base root cause on obfuscated names alone. Then locate code with `rg` and decoded symbols. Prefer exact decoded class/method names first, then stable message strings. Do not base root cause on obfuscated names alone.
## Hotfix And Obfuscation Notes
Current TH1 hot-update runtime maps to the `TH1.Hotfix` assembly:
- Treat CrashSight frames from `TH1.Hotfix`, `TH1.Hotfix.dll`, `TH1.Hotfix.dll.bytes`, `HybridCLR`, or `Assets/StreamingAssets/HybridCLR/HotfixDlls` as hotfix code, not as old `Assembly-CSharp` player code.
- Hotfix source still lives under `Unity/Assets/Scripts` (`TH1_Logic`, `TH1_Data`, `TH1_UI`, `TH1_Renderer`, etc.). After decoding a hotfix frame, search those source folders normally with `rg`.
- The AOT bootstrap path is `TH1_AOT.AotHotfixPreloader` -> `TH1_Logic.Hotfix.HotfixBootstrap` -> `TH1_Hotfix.HotfixEntry.Initialize` -> hotfix `TH1_Logic.Core.Main`.
- Release packages obfuscate only `TH1.Hotfix.dll`; `Assembly-CSharp` is intentionally not processed. Debug packages only match Release obfuscation behavior when the Debug Hotfix-obfuscation option is enabled, in which case they also use IL2CPP.
- OPS global Player Build hook should remain disabled; Hotfix obfuscation happens after HybridCLR builds the hotfix DLL and before it is copied to `StreamingAssets`.
- The existing OPS mapping/log file path remains the source of truth for decoding so existing decode tools continue to apply. Always run `Tools\DecodeOnlineError.ps1` before searching hotfix obfuscated stacks.
When classifying hotfix-related issues:
- `MissingMethodException`, `TypeLoadException`, or reflected-entry failures around `HotfixEntry.Initialize`, `Main`, achievement condition types, or HybridCLR loading are usually blocking and may indicate a Hotfix preserve/obfuscation rule problem.
- AOT metadata failures around `LoadMetadataForAOTAssembly`, missing `AOTAssemblies/*.dll.bytes`, or IL2CPP generic sharing are blocking packaging/runtime issues, not ordinary business logic crashes.
- If a crash only reproduces in obfuscated Release or Debug+Hotfix-obfuscation builds, do not dismiss it because Mono Debug works. Compare against the IL2CPP Hotfix-obfuscated smoke path.
Write reports: Write reports:
```powershell ```powershell

View File

@ -1,6 +1,6 @@
--- ---
name: th1-ios-migration name: th1-ios-migration
description: "TH1 project-specific iOS migration guide for same-mainline dual-platform support: HybridCLR hot update foundation, iOS/IL2CPP compile isolation, Steamworks/Steam SDK platform abstraction without Steam regressions, touch input adaptation, YooAsset AssetBundle/resource migration, BundleResources DataAssets -> Export packaging sync, iOS build settings, unified PC/iOS build window flow, and verification that existing online Steam builds and gameplay behavior remain unaffected. Use whenever Codex works on TH1 iOS packaging, mobile porting, HybridCLR, YooAsset AB/resource loading, removing direct Steamworks references for iOS, platform services, touch controls, or build pipeline changes that must preserve the current Steam version." description: "TH1 project-specific iOS migration guide for same-mainline dual-platform support: HybridCLR hot update foundation, Hotfix DLL obfuscation, iOS/IL2CPP compile isolation, Steamworks/Steam SDK platform abstraction without Steam regressions, touch input adaptation, YooAsset AssetBundle/resource migration, BundleResources DataAssets-to-Export packaging sync, iOS build settings, unified PC/iOS build window flow, and verification that existing online Steam builds and gameplay behavior remain unaffected. Use whenever Codex works on TH1 iOS packaging, mobile porting, HybridCLR, TH1.Hotfix.dll obfuscation, YooAsset AB/resource loading, removing direct Steamworks references for iOS, platform services, touch controls, or build pipeline changes that must preserve the current Steam version."
--- ---
# TH1 iOS Migration # TH1 iOS Migration
@ -89,6 +89,13 @@ Preferred first scope:
- Put low-risk UI, presentation helpers, non-networked bug fixes, or feature flags into hotfix first. - Put low-risk UI, presentation helpers, non-networked bug fixes, or feature flags into hotfix first.
- Generate and commit required AOT metadata/link preservation files only through the documented HybridCLR workflow. - Generate and commit required AOT metadata/link preservation files only through the documented HybridCLR workflow.
- Ensure the Steam build can still run without downloading any hotfix package when using local/editor mode. - Ensure the Steam build can still run without downloading any hotfix package when using local/editor mode.
- Obfuscate only `TH1.Hotfix.dll` in the HybridCLR artifact step. Do not obfuscate `Assembly-CSharp` or run OPS through the Player Build hook for the whole player.
- Keep OPS global obfuscation disabled by default. Temporarily enable OPS only while processing the copied hotfix DLL, then restore the previous setting before `BuildPipeline.BuildPlayer`.
- Use the existing OPS mapping/log file path so existing decode tools keep working.
- Keep stable reflection/serialization names: `TH1_Hotfix.HotfixEntry.Initialize`, the runtime `Main` type and serialized/lifecycle members used from Unity or reflection, and Serializable achievement condition classes. Prefer `[DoNotRename]` or `[DoNotObfuscateClass]` over broad config churn.
- Keep the hotfix obfuscation mode conservative: namespaces, classes, and fields stay unrenamed; method/property/event obfuscation is acceptable after smoke testing.
- Verify the obfuscated hotfix DLL before copying it to `StreamingAssets`: load it with Cecil, confirm the reflected entry points and required stable types are still present, and fail the build early if any required name is missing.
- Debug packages that enable Hotfix obfuscation must use IL2CPP, matching Release. Plain Debug packages may remain Mono when Hotfix obfuscation is off. On non-IL2CPP backends, skip HybridCLR AOT metadata loading.
iOS constraints: iOS constraints:
@ -103,6 +110,7 @@ Checks:
- Hotfix assembly does not reference Steamworks or editor-only assemblies. - Hotfix assembly does not reference Steamworks or editor-only assemblies.
- `link.xml`/preserve additions are minimal and justified. - `link.xml`/preserve additions are minimal and justified.
- `HybridCLRData/AssembliesPostIl2CppStrip/<BuildTarget>` exists after Generate All, and required AOT metadata has been copied to `Assets/StreamingAssets/HybridCLR/AOTAssemblies`. - `HybridCLRData/AssembliesPostIl2CppStrip/<BuildTarget>` exists after Generate All, and required AOT metadata has been copied to `Assets/StreamingAssets/HybridCLR/AOTAssemblies`.
- Obfuscated `TH1.Hotfix.dll.bytes` exists under `Assets/StreamingAssets/HybridCLR/HotfixDlls` for Release and for Debug packages whose Hotfix obfuscation option is enabled.
- If `HybridCLR/Generate/All` failed because HybridCLR was not installed, do not continue into AB packaging. Fix the installer/generate step first. - If `HybridCLR/Generate/All` failed because HybridCLR was not installed, do not continue into AB packaging. Fix the installer/generate step first.
## Phase 2: iOS Compile Isolation And Steam Boundary ## Phase 2: iOS Compile Isolation And Steam Boundary
@ -226,13 +234,23 @@ Prefer `Tools/TH1/一体化出包工具` for manual PC/iOS packaging. The one-cl
3. Configure HybridCLR. 3. Configure HybridCLR.
4. Configure YooAsset collector. 4. Configure YooAsset collector.
5. HybridCLR `GenerateAll`. 5. HybridCLR `GenerateAll`.
6. Build hotfix DLL/AOT metadata. 6. Build hotfix DLL/AOT metadata, and if selected, run Hotfix-only OPS obfuscation before copying the DLL to `StreamingAssets`.
7. Build YooAsset built-in AB. 7. Build YooAsset built-in AB unless the user explicitly skips it because resources are unchanged and valid existing `StreamingAssets/Bundles` are present.
8. Check build blockers. 8. Check build blockers.
9. Build Player. 9. Build Player.
The confirmation dialog should show the selected version and whether the multilingual export/import step is enabled. The confirmation dialog should show the selected version and whether the multilingual export/import step is enabled.
Current unified-build defaults:
- Default to PC Release.
- Default-enable the pre-build HybridCLR/YooAsset preparation, `Build Player`, output-folder cleanup, multilingual export/import, and YooAsset AB build checkboxes.
- Output to repository-root `Pack/<platform>_<package>_<version>`; keep `/Pack/` ignored by git. Do not delete local package outputs when updating source unless the user asks.
- Open the output folder automatically after a successful interactive `Build Player`.
- For Release, force IL2CPP and Hotfix DLL obfuscation. For Debug, enable IL2CPP only when the Debug Hotfix obfuscation option is checked.
When diagnosing slow Debug obfuscated builds, remember the bottleneck is usually IL2CPP Development/AllowDebugging `GameAssembly.dll` compile/link time, not OPS itself. Use plain Mono Debug without Hotfix obfuscation for fast code iteration, and use Debug+IL2CPP+Hotfix obfuscation only when reproducing obfuscated-runtime issues.
Release branches may exist for stabilization only: Release branches may exist for stabilization only:
- `release/steam-*` and `release/ios-*` may freeze and cherry-pick fixes. - `release/steam-*` and `release/ios-*` may freeze and cherry-pick fixes.
@ -258,11 +276,13 @@ Also verify the relevant Unity builds when possible:
- Steam Editor/Standalone smoke test. - Steam Editor/Standalone smoke test.
- iOS switch-platform compile or Xcode export. - iOS switch-platform compile or Xcode export.
- HybridCLR generate/compile hotfix artifacts. - HybridCLR generate/compile hotfix artifacts.
- Hotfix-only OPS obfuscation: verify OPS reports method/property/event obfuscation, `Assembly-CSharp` is not processed, required reflection names survive, and the final player contains `StreamingAssets/HybridCLR/HotfixDlls/TH1.Hotfix.dll.bytes`.
- YooAsset build for the touched package/platform. - YooAsset build for the touched package/platform.
Manual smoke checklist: Manual smoke checklist:
- Steam: start game, create/join lobby if network touched, Workshop/mod page if Workshop touched, bug report/upload if backend touched. - Steam: start game, create/join lobby if network touched, Workshop/mod page if Workshop touched, bug report/upload if backend touched.
- PC Hotfix obfuscation: launch the built player for several minutes; confirm AOT metadata loads, `TH1.Hotfix` loads, `HotfixEntry.Initialize` runs, YooAsset initializes `DefaultPackage`, `SampleScene` loads, hotfix `Main` starts, and no `MissingMethod`, `TypeLoad`, `NullReference`, or obfuscation-related exception appears.
- iOS/mobile: launch, start single-player, touch select/move/action/end turn, save/load, rotate/aspect/safe area check. - iOS/mobile: launch, start single-player, touch select/move/action/end turn, save/load, rotate/aspect/safe area check.
- Shared: config load/save, localization, achievements/local progress, no hardcoded game-facing text added. - Shared: config load/save, localization, achievements/local progress, no hardcoded game-facing text added.

View File

@ -27,6 +27,16 @@ pwsh -NoProfile -ExecutionPolicy Bypass -File Tools\DecodeOnlineError.ps1 -Input
Use `-Replace` only when the decoded output is easier to search without annotations. Use `-AggressiveShortNames` only for mostly-symbol stack traces; it can misread normal prose such as `to` or `in`. Use `-Replace` only when the decoded output is easier to search without annotations. Use `-AggressiveShortNames` only for mostly-symbol stack traces; it can misread normal prose such as `to` or `in`.
## Hotfix Runtime Mapping
Current hot-update code is `TH1.Hotfix`, not the old monolithic `Assembly-CSharp` path:
- Treat frames mentioning `TH1.Hotfix`, `TH1.Hotfix.dll`, `TH1.Hotfix.dll.bytes`, `HybridCLR`, or `StreamingAssets/HybridCLR/HotfixDlls` as hotfix runtime frames.
- Decode obfuscated hotfix stacks with the existing decode tools before search; Release obfuscates only `TH1.Hotfix.dll`, while `Assembly-CSharp` is intentionally not processed.
- Search decoded hotfix symbols in `Unity\Assets\Scripts` as usual. Source namespaces such as `TH1_Logic`, `TH1_Data`, `TH1_UI`, and `TH1_Renderer` may now be compiled into `TH1.Hotfix`.
- Recognize the bootstrap sequence: `TH1_AOT.AotHotfixPreloader` -> `TH1_Logic.Hotfix.HotfixBootstrap` -> `TH1_Hotfix.HotfixEntry.Initialize` -> `TH1_Logic.Core.Main`.
- For `MissingMethodException`, `TypeLoadException`, reflected entry failures, missing AOT metadata, or crashes that only happen in obfuscated Release/Debug+Hotfix-obfuscation builds, investigate Hotfix preserve/obfuscation/AOT packaging before assuming ordinary business logic.
## Investigation Workflow ## Investigation Workflow
1. Decode obfuscated text with `Tools\DecodeOnlineError.ps1`. 1. Decode obfuscated text with `Tools\DecodeOnlineError.ps1`.

View File

@ -13,7 +13,7 @@ PlayerSettings:
useOnDemandResources: 0 useOnDemandResources: 0
accelerometerFrequency: 60 accelerometerFrequency: 60
companyName: Remilia Command companyName: Remilia Command
productName: TOHOTOPIA v0.7.3f productName: TOHOTOPIA
defaultCursor: {fileID: 0} defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0} cursorHotspot: {x: 0, y: 0}
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}