From 4be5ebd8b3f7abe1986478967d60324f98175eab Mon Sep 17 00:00:00 2001 From: Sam Hocevar <sam@hocevar.net> Date: Thu, 31 Jan 2013 17:55:52 +0000 Subject: [PATCH] ps3: use network fallback for image files. --- src/image/codec/ps3-image.cpp | 13 ++++++------- src/lol/sys/init.h | 4 ++-- src/sys/init.cpp | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/image/codec/ps3-image.cpp b/src/image/codec/ps3-image.cpp index d0ed48d0..6a307bff 100644 --- a/src/image/codec/ps3-image.cpp +++ b/src/image/codec/ps3-image.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net> +// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> // This program is free software; you can redistribute it and/or // modify it under the terms of the Do What The Fuck You Want To // Public License, Version 2, as published by Sam Hocevar. See @@ -93,12 +93,11 @@ bool Ps3ImageData::Open(char const *path) /* Create decoder */ CellPngDecSubHandle hsub; - char file[1024]; - sprintf(file, "/app_home/c:/Users/s.hocevar/le/%s", path); + String fullpath = String("/app_home/") + String(System::GetDataDir()) + String(path); CellPngDecSrc dec_src; dec_src.srcSelect = CELL_PNGDEC_FILE; - dec_src.fileName = file; + dec_src.fileName = &fullpath[0]; dec_src.fileOffset = 0; dec_src.fileSize = 0; dec_src.streamPtr = NULL; @@ -109,7 +108,7 @@ bool Ps3ImageData::Open(char const *path) if (err != CELL_OK) { #if !LOL_RELEASE - Log::Error("could not open %s for decoding\n", file); + Log::Error("could not open %s for decoding\n", &fullpath[0]); #endif return false; } @@ -119,7 +118,7 @@ bool Ps3ImageData::Open(char const *path) if (err != CELL_OK) { #if !LOL_RELEASE - Log::Error("could not read image header\n"); + Log::Error("could not read image header in %s\n", &fullpath[0]); #endif return false; } @@ -154,7 +153,7 @@ bool Ps3ImageData::Open(char const *path) if (err != CELL_OK) { #if !LOL_RELEASE - Log::Error("could not run PngDec decoder\n"); + Log::Error("could not run PngDec decoder on %s\n", &fullpath[0]); #endif return false; } diff --git a/src/lol/sys/init.h b/src/lol/sys/init.h index 539bc9a7..b6a83448 100644 --- a/src/lol/sys/init.h +++ b/src/lol/sys/init.h @@ -43,8 +43,8 @@ namespace System { extern void Init(int argc, char *argv[], - String const projectdir = LOL_CONFIG_PROJECTDIR, - String const solutiondir = LOL_CONFIG_SOLUTIONDIR); + String const &projectdir = LOL_CONFIG_PROJECTDIR, + String const &solutiondir = LOL_CONFIG_SOLUTIONDIR); extern void SetDataDir(char const *dir); extern char const *GetDataDir(); diff --git a/src/sys/init.cpp b/src/sys/init.cpp index d2575771..53e99baf 100644 --- a/src/sys/init.cpp +++ b/src/sys/init.cpp @@ -36,7 +36,7 @@ namespace System #endif void Init(int argc, char *argv[], - String const projectdir, String const solutiondir) + String const &projectdir, String const &solutiondir) { using namespace std;