From 3dd8f8118b5486e07ac2108b1e58a47d05792d3a Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Tue, 26 Feb 2013 18:18:11 +0000 Subject: [PATCH] ps3: fix a bug and add better error reporting in the image loader. --- src/image/codec/ps3-image.cpp | 40 +++++++++++------------------------ 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/src/image/codec/ps3-image.cpp b/src/image/codec/ps3-image.cpp index 7361b29e..e1cf7d3a 100644 --- a/src/image/codec/ps3-image.cpp +++ b/src/image/codec/ps3-image.cpp @@ -57,18 +57,14 @@ bool Ps3ImageData::Open(char const *path) err = cellSysmoduleLoadModule(CELL_SYSMODULE_FS); if (err != CELL_OK) { -#if !LOL_RELEASE - Log::Error("could not open Fs sysmodule\n"); -#endif + Log::Error("could not open Fs sysmodule (0x%08x)\n", err); return false; } err = cellSysmoduleLoadModule(CELL_SYSMODULE_PNGDEC); if (err != CELL_OK) { -#if !LOL_RELEASE - Log::Error("could not open PngDec sysmodule\n"); -#endif + Log::Error("could not open PngDec sysmodule (0x%08x)\n", err); return false; } @@ -84,9 +80,7 @@ bool Ps3ImageData::Open(char const *path) err = cellPngDecCreate(&hmain, &in_param, &out_param); if (err != CELL_OK) { -#if !LOL_RELEASE - Log::Error("could not create PngDec library\n"); -#endif + Log::Error("could not create PngDec library (0x%08x)\n", err); return false; } @@ -104,17 +98,17 @@ bool Ps3ImageData::Open(char const *path) Array pathlist = System::GetPathList(path); for (int i = 0; i < pathlist.Count(); ++i) { - dec_src.fileName = (String("/app_home") + pathlist[i]).C(); + String name = String("/app_home/") + pathlist[i]; + dec_src.fileName = name.C(); err = cellPngDecOpen(hmain, &hsub, &dec_src, &open_info); if (err == CELL_OK) break; + cellPngDecClose(hmain, hsub); } if (err != CELL_OK) { -#if !LOL_RELEASE - Log::Error("could not open %s for decoding\n", path); -#endif + Log::Error("could not open %s for decoding (0x%08x)\n", path, err); return false; } @@ -122,9 +116,7 @@ bool Ps3ImageData::Open(char const *path) err = cellPngDecReadHeader(hmain, hsub, &info); if (err != CELL_OK) { -#if !LOL_RELEASE - Log::Error("could not read image header in %s\n", path); -#endif + Log::Error("could not read image header in %s (0x%08x)\n", path, err); return false; } @@ -140,9 +132,7 @@ bool Ps3ImageData::Open(char const *path) err = cellPngDecSetParameter(hmain, hsub, &in_dec_param, &out_dec_param); if (err != CELL_OK) { -#if !LOL_RELEASE - Log::Error("could not configure PngDec decoder\n"); -#endif + Log::Error("could not configure PngDec decoder (0x%08x)\n", err); return false; } @@ -157,9 +147,7 @@ bool Ps3ImageData::Open(char const *path) &data_ctrl_param, &data_out_info); if (err != CELL_OK) { -#if !LOL_RELEASE - Log::Error("could not run PngDec decoder on %s\n", path); -#endif + Log::Error("could not run PngDec decoder on %s (0x%08x)\n", path, err); return false; } @@ -167,9 +155,7 @@ bool Ps3ImageData::Open(char const *path) err = cellPngDecClose(hmain, hsub); if (err != CELL_OK) { -#if !LOL_RELEASE - Log::Error("could not close PngDec decoder\n"); -#endif + Log::Error("could not close PngDec decoder (0x%08x)\n", err); return false; } @@ -177,9 +163,7 @@ bool Ps3ImageData::Open(char const *path) err = cellPngDecDestroy(hmain); if (err != CELL_OK) { -#if !LOL_RELEASE - Log::Error("could not destroy PngDec decoder\n"); -#endif + Log::Error("could not destroy PngDec decoder (0x%08x)\n", err); return false; } err = cellSysmoduleUnloadModule(CELL_SYSMODULE_PNGDEC);