From 14447c6061bd8dbd12638f9e2dc0283ba1ba224d Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sat, 9 Feb 2013 11:17:24 +0000 Subject: [PATCH] ps3: use System::GetPathList() to open images. --- src/image/codec/ps3-image.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/image/codec/ps3-image.cpp b/src/image/codec/ps3-image.cpp index 6a307bff..2784a019 100644 --- a/src/image/codec/ps3-image.cpp +++ b/src/image/codec/ps3-image.cpp @@ -91,24 +91,29 @@ bool Ps3ImageData::Open(char const *path) } /* Create decoder */ - CellPngDecSubHandle hsub; - - String fullpath = String("/app_home/") + String(System::GetDataDir()) + String(path); - CellPngDecSrc dec_src; dec_src.srcSelect = CELL_PNGDEC_FILE; - dec_src.fileName = &fullpath[0]; dec_src.fileOffset = 0; dec_src.fileSize = 0; dec_src.streamPtr = NULL; dec_src.streamSize = 0; dec_src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_ENABLE; + CellPngDecSubHandle hsub; CellPngDecOpnInfo open_info; - err = cellPngDecOpen(hmain, &hsub, &dec_src, &open_info); + + Array pathlist = System::GetPathList(path); + for (int i = 0; i < pathlist.Count(); ++i) + { + dec_src.fileName = (String("/app_home") + pathlist[i]).C(); + err = cellPngDecOpen(hmain, &hsub, &dec_src, &open_info); + if (err == CELL_OK) + break; + } + if (err != CELL_OK) { #if !LOL_RELEASE - Log::Error("could not open %s for decoding\n", &fullpath[0]); + Log::Error("could not open %s for decoding\n", path); #endif return false; } @@ -118,7 +123,7 @@ bool Ps3ImageData::Open(char const *path) if (err != CELL_OK) { #if !LOL_RELEASE - Log::Error("could not read image header in %s\n", &fullpath[0]); + Log::Error("could not read image header in %s\n", path); #endif return false; } @@ -153,7 +158,7 @@ bool Ps3ImageData::Open(char const *path) if (err != CELL_OK) { #if !LOL_RELEASE - Log::Error("could not run PngDec decoder on %s\n", &fullpath[0]); + Log::Error("could not run PngDec decoder on %s\n", path); #endif return false; }