MCPcopy Create free account
hub / github.com/GrapheneCt/NetStream / AddLocal

Method AddLocal

NetStream/source/tex_pool.cpp:318–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

316}
317
318bool TexPool::AddLocal(IDParam const& id, const char *path)
319{
320 if (!m_alive)
321 {
322 return false;
323 }
324 int32_t res = -1;
325 common::SharedPtr<LocalFile> lfile = LocalFile::Open(path, File::RDONLY, 0, &res);
326 if (res != SCE_PAF_OK)
327 {
328 Remove(id);
329 return false;
330 }
331
332 if (!m_alive)
333 {
334 lfile.reset();
335 return false;
336 }
337 intrusive_ptr<graph::Surface> tex = graph::Surface::Load(gutil::GetDefaultSurfacePool(), reinterpret_cast<common::SharedPtr<File>&>(lfile));
338 if (tex.get())
339 {
340 m_storMtx->Lock();
341 RemoveForReplace(id);
342 m_stor[id.GetIDHash()] = tex;
343 m_storMtx->Unlock();
344 return true;
345 }
346
347 Remove(id);
348
349 return false;
350}

Callers

nothing calls this directly

Calls 2

LockMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected