M2CacheGetShared
function · models · primitive
- Address
0x706a50· 638 bytes, up to0x706ccd- Meaning
- Finds a loaded shared model by file name or opens the file and starts loading a new one
- Confidence
- verified, proof one
- Finding
- models/cache#shared-model-lookup
Finding: Shared model lookup in models: the cache
0x706a50 returns the shared model of a file, loading it on first use. The extension is the path
from its last dot: .mdl and .mdx (without case) become .m2, .m2 passes as it is, and any
other extension or a path with no dot fails; so does a file that does not open. The key is
the name the opened file reports, up to its last dot: h = h·19 + tolower(c) over its bytes, each
sign-extended, in 32-bit arithmetic; the bucket is h mod 1021, unsigned. A bucket's chain is sorted by hash, then by name without case; a match adds a reference
and closes the file, a miss inserts a new 0x164-byte shared model and starts its load.
The derivation is in the doc.
Callers 1
- CreateModelFromPath models
Callees 14
- tolower crt
- DebugPrintStub unassigned
- SMemAlloc storm
- SMemFree storm
- SFile::OpenEx storm
- SFile::Close storm
- SFileGetFileName storm
- SStrCmpI storm
- SStrCopy storm
- CM2Shared::CM2Shared models
- CM2Shared::~CM2Shared models
- CM2Shared::AddRef models
- CM2Shared::Load models
- strrchr crt
Calls and jumps by a bare address, from tables/calls.tsv.