| 316 | } |
| 317 | |
| 318 | bool 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 | } |