| 269 | } |
| 270 | |
| 271 | bool TexPool::AddHttp(IDParam const& id, const char *path) |
| 272 | { |
| 273 | int32_t res = -1; |
| 274 | CurlFile::OpenArg oarg; |
| 275 | oarg.ParseUrl(path); |
| 276 | oarg.SetOption(3000, CurlFile::OpenArg::OptionType_ConnectTimeOut); |
| 277 | oarg.SetOption(5000, CurlFile::OpenArg::OptionType_RecvTimeOut); |
| 278 | oarg.SetProxy(utils::GetGlobalProxy()); |
| 279 | if (m_share) |
| 280 | { |
| 281 | oarg.SetShare(m_share); |
| 282 | } |
| 283 | |
| 284 | if (!m_alive) |
| 285 | { |
| 286 | return false; |
| 287 | } |
| 288 | CurlFile *file = new CurlFile(); |
| 289 | res = file->Open(&oarg); |
| 290 | if (res != SCE_PAF_OK) |
| 291 | { |
| 292 | delete file; |
| 293 | Remove(id); |
| 294 | return false; |
| 295 | } |
| 296 | |
| 297 | if (!m_alive) |
| 298 | { |
| 299 | delete file; |
| 300 | return false; |
| 301 | } |
| 302 | common::SharedPtr<CurlFile> hfile(file); |
| 303 | intrusive_ptr<graph::Surface> tex = graph::Surface::Load(gutil::GetDefaultSurfacePool(), reinterpret_cast<common::SharedPtr<File>&>(hfile)); |
| 304 | if (tex.get()) |
| 305 | { |
| 306 | m_storMtx->Lock(); |
| 307 | RemoveForReplace(id); |
| 308 | m_stor[id.GetIDHash()] = tex; |
| 309 | m_storMtx->Unlock(); |
| 310 | return true; |
| 311 | } |
| 312 | |
| 313 | Remove(id); |
| 314 | |
| 315 | return false; |
| 316 | } |
| 317 | |
| 318 | bool TexPool::AddLocal(IDParam const& id, const char *path) |
| 319 | { |