- Keep patches stable across Emby upgrades.
- Prefer exact signature matching over heuristic reflection.
EMBY_DOCS_DIRselects the active method-signature snapshot underDocs/.- Default:
emby_4.9.3.0 - Signature source of truth:
Docs/${EMBY_DOCS_DIR}/ - Primary inputs:
*_methods.txt
- DLL root directory:
/Users/honue/Documents/Emby/dlls - Versioned DLL directory:
/Users/honue/Documents/Emby/dlls/<emby_version> - Decompiled source directory:
/Users/honue/Documents/Emby/dlls/<emby_version>/source - Decompiled folder format:
<AssemblyName>_<version> - Default version suffix comes from
EMBY_DOCS_DIR, for exampleemby_4.9.3.0->4.9.3.0
- Read
Docs/${EMBY_DOCS_DIR}/<Assembly>_methods.txtfor exact method signatures. - Read decompiled source under
/Users/honue/Documents/Emby/dlls/<emby_version>/source/<AssemblyName>_<version>/for real behavior, access modifiers, inheritance, and usable entry points. - Use both before changing any patch that targets Emby internals.
- Do not stop at "file missing" if the repo scripts can populate the dependency.
- If a DLL is missing, fetch it with
bash Scripts/get_emby_dll.sh <DllName.dll>. - If decompiled source is missing, generate it with
bash Scripts/decompile_emby_dlls.sh <DllName.dll>. - Pass explicit DLL names by default. Do not use the full default set unless all default DLLs are actually needed.
- Invoke scripts with
bash Scripts/...by default. Do not assume the executable bit is present. Scripts/decompile_emby_dlls.shonly writes source folders under/Users/honue/Documents/Emby/dlls/<emby_version>/source/; it does not generate Markdown index files.
ilspycmdmay require .NET 8 even if newer runtimes are installed.- If
ilspycmd --versionfails with missingMicrosoft.NETCore.App 8.0, installdotnet@8. - Use this environment when running decompile commands:
export DOTNET_ROOT="/opt/homebrew/opt/dotnet@8/libexec"
export PATH="$DOTNET_ROOT:$PATH"
bash Scripts/decompile_emby_dlls.sh Emby.Providers.dll- Always use
PatchMethodResolver.Resolve(...)for patch targets. - Set explicit
ParameterTypeswhenever possible. - Set
ReturnTypewhen overload ambiguity is possible. - Use exact
BindingFlags. - Avoid
Predicateunless no stable type-based signature exists. - Do not use fallback
FindMethod(...)name-only matching in production paths. - When multiple overloads are valid across versions, resolve each exact overload and patch all of them.
- Keep prefix/postfix signatures compatible with every patched overload.
- Locate the target in
Docs/${EMBY_DOCS_DIR}/<Assembly>_methods.txt. - Copy the exact parameter type order from docs.
- Resolve dependent runtime types by full name, for example
Assembly.GetType("Namespace.Type"). - Build
MethodSignatureProfilewith exactBindingFlags,ParameterTypes, andReturnTypewhen needed. - If a prerequisite type is missing, log
PatchLog.InitFailed(...)with a clear reason and stop that patch. - Rely on existing
PatchLog.ResolveHitandPatchLog.ResolveFailedfor resolution outcomes. - Verify with
dotnet build MediaInfoKeeper.sln.
- External subtitle scanning usually starts from:
/Users/honue/Documents/Emby/dlls/4.9.3.0/source/Emby.Providers_4.9.3.0/Emby.Providers.MediaInfo/BaseTrackResolver.cs/Users/honue/Documents/Emby/dlls/4.9.3.0/source/Emby.Providers_4.9.3.0/Emby.Providers.MediaInfo/SubtitleResolver.cs/Users/honue/Documents/Emby/dlls/4.9.3.0/source/Emby.Providers_4.9.3.0/Emby.Providers.MediaInfo/FFProbeSubtitleInfo.cs
Patch/: Harmony patches and method-resolution logicPatch/PatchManager.cs: patch bootstrap and health trackingScheduledTask/: operational tasksServices/: runtime business servicesConfiguration/andOptions/: plugin config models and UI wiringDocs/${EMBY_DOCS_DIR}/: signature docsScripts/: dependency and helper scripts
- Don’t use parameter count as the primary matching strategy.
- Don’t keep dead reflection helpers.
- Don’t silently swallow missing type or signature failures.
- Don’t mix unrelated refactors into patch-signature updates.