diff options
author | Max Lingua | 2014-01-23 18:15:42 -0500 |
---|---|---|
committer | Max Lingua | 2014-01-23 18:34:58 -0500 |
commit | 5e36716be5dc55d2fbf0d417b03e065bd09f7946 (patch) | |
tree | c46d9dbf2281eeb303014d9dc5a468ffb67f6457 /backends/platform/ps2 | |
parent | 6487c362a1909b10886ee95f4f91109a7808fd33 (diff) | |
download | scummvm-rg350-5e36716be5dc55d2fbf0d417b03e065bd09f7946.tar.gz scummvm-rg350-5e36716be5dc55d2fbf0d417b03e065bd09f7946.tar.bz2 scummvm-rg350-5e36716be5dc55d2fbf0d417b03e065bd09f7946.zip |
PS2: Made it quieter unless -DLOGORRHEIC is set
Diffstat (limited to 'backends/platform/ps2')
-rw-r--r-- | backends/platform/ps2/Makefile.ps2 | 1 | ||||
-rw-r--r-- | backends/platform/ps2/asyncfio.h | 3 | ||||
-rw-r--r-- | backends/platform/ps2/fileio.cpp | 45 | ||||
-rw-r--r-- | backends/platform/ps2/ps2debug.cpp | 3 | ||||
-rw-r--r-- | backends/platform/ps2/ps2debug.h | 8 | ||||
-rw-r--r-- | backends/platform/ps2/savefilemgr.cpp | 25 | ||||
-rw-r--r-- | backends/platform/ps2/systemps2.cpp | 49 |
7 files changed, 72 insertions, 62 deletions
diff --git a/backends/platform/ps2/Makefile.ps2 b/backends/platform/ps2/Makefile.ps2 index 7b010e8440..3631c653f6 100644 --- a/backends/platform/ps2/Makefile.ps2 +++ b/backends/platform/ps2/Makefile.ps2 @@ -100,6 +100,7 @@ CXXFLAGS = $(FLAGS) -Wnon-virtual-dtor -Wno-reorder -fno-exceptions -fno-rtti DEFINES = -D_EE -D__PLAYSTATION2__ -D__NEW_PS2SDK__ -DUSE_ZLIB -DFORCE_RTL -DDATA_PATH=\"host:data\" DEFINES += -DDISABLE_SAVEGAME_SORTING -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DDISABLE_DOSBOX_OPL -DDISABLE_SID -DDISABLE_NES_APU +# DEFINES += -DLOGORRHEIC INCDIR := $(PS2SDK)/ee/include $(PS2SDK)/common/include $(PS2SDK)/ports/include . $(srcdir) $(srcdir)/engines INCLUDES := $(addprefix -I, $(INCDIR)) diff --git a/backends/platform/ps2/asyncfio.h b/backends/platform/ps2/asyncfio.h index 31684d4349..fbc0005373 100644 --- a/backends/platform/ps2/asyncfio.h +++ b/backends/platform/ps2/asyncfio.h @@ -23,6 +23,9 @@ #define MAX_HANDLES 32 #include <sys/stat.h> +#undef chdir // we define our own +#undef mkdir + class AsyncFio { public: AsyncFio(void); diff --git a/backends/platform/ps2/fileio.cpp b/backends/platform/ps2/fileio.cpp index cc1da2e511..b204d3f8bb 100644 --- a/backends/platform/ps2/fileio.cpp +++ b/backends/platform/ps2/fileio.cpp @@ -20,8 +20,9 @@ * */ -// Disable symbol overrides so that we can use system headers. -#define FORBIDDEN_SYMBOL_ALLOW_ALL +// Disable symbol overrides so that we can use "FILE" +#define FORBIDDEN_SYMBOL_EXCEPTION_FILE +#define FORBIDDEN_SYMBOL_EXCEPTION_printf #include "backends/platform/ps2/fileio.h" @@ -78,12 +79,12 @@ Ps2File::~Ps2File() { fio.seek(_fd, 0, SEEK_SET); fio.write(_fd, _cacheBuf, _filePos); w = fio.sync(_fd); - printf("flushed wbuf: %x of %x\n", w, _filePos); + dbg_printf("flushed wbuf: %x of %x\n", w, _filePos); } fio.close(_fd); uint32 r = fio.sync(_fd); - printf("close [%d] - sync'd = %d\n", _fd, r); + dbg_printf("close [%d] - sync'd = %d\n", _fd, r); } free(_cacheBuf); @@ -97,7 +98,7 @@ bool Ps2File::open(const char *name, int mode) { #if 1 _fd = fio.open(name, mode); - printf("open %s [%d]\n", name, _fd); + dbg_printf("open %s [%d]\n", name, _fd); if (_fd >= 0) { _mode = mode; @@ -110,9 +111,9 @@ bool Ps2File::open(const char *name, int mode) { else _fileSize = 0; - printf(" _mode = %x\n", _mode); - printf(" _fileSize = %d\n", _fileSize); - // printf(" _filePos = %d\n", _filePos); + dbg_printf(" _mode = %x\n", _mode); + dbg_printf(" _fileSize = %d\n", _fileSize); + // dbg_printf(" _filePos = %d\n", _filePos); return true; } @@ -130,7 +131,7 @@ bool Ps2File::open(const char *name, int mode) { if (_fileSize && mode != O_RDONLY) { fio.read(_fd, _cacheBuf, _fileSize); r = fio.sync(_fd); - printf(" sz=%d, read=%d\n", _fileSize, r); + dbg_printf(" sz=%d, read=%d\n", _fileSize, r); assert(r == _fileSize); } @@ -141,7 +142,7 @@ bool Ps2File::open(const char *name, int mode) { _fd = fio.open(name, mode); - printf("open %s [%d]\n", name, _fd); + dbg_printf("open %s [%d]\n", name, _fd); if (_fd >= 0) { _mode = mode; @@ -160,16 +161,16 @@ bool Ps2File::open(const char *name, int mode) { if (mode != O_RDONLY) { fio.read(_fd, _cacheBuf, _fileSize); r = fio.sync(_fd); - printf(" sz=%d, read=%d\n", _fileSize, r); + dbg_printf(" sz=%d, read=%d\n", _fileSize, r); assert(r == _fileSize); // _fileSize = fio.seek(_fd, 0, SEEK_END); } #endif } - printf(" _mode = %x\n", _mode); - printf(" _fileSize = %d\n", _fileSize); - printf(" _filePos = %d\n", _filePos); + dbg_printf(" _mode = %x\n", _mode); + dbg_printf(" _fileSize = %d\n", _fileSize); + dbg_printf(" _filePos = %d\n", _filePos); return true; } else @@ -208,7 +209,7 @@ bool Ps2File::eof() { #ifdef __PS2_FILE_SEMA__ SignalSema(_sema); - // printf(" EOF [%d] : %d of %d -> %d\n", _fd, _filePos, _fileSize, res); + // dbg_printf(" EOF [%d] : %d of %d -> %d\n", _fd, _filePos, _fileSize, res); #endif return res; } @@ -255,8 +256,8 @@ int Ps2File::seek(int32 offset, int origin) { _eof = true; } - // printf("seek [%d] %d %d\n", _fd, offset, origin); - // printf(" res = %d\n", res); + // dbg_printf("seek [%d] %d %d\n", _fd, offset, origin); + // dbg_printf(" res = %d\n", res); #ifdef __PS2_FILE_SEMA__ SignalSema(_sema); @@ -338,8 +339,8 @@ uint32 Ps2File::read(void *dest, uint32 len) { #endif #ifdef __PS2_FILE_DEBUG__ - printf("read (1) : _filePos = %d\n", _filePos); - printf("read (1) : _cachePos = %d\n", _cachePos); + dbg_printf("read (1) : _filePos = %d\n", _filePos); + dbg_printf("read (1) : _cachePos = %d\n", _cachePos); #endif if (len == 0) { @@ -476,7 +477,7 @@ uint32 PS2FileStream::write(const void *ptr, uint32 len) { } bool PS2FileStream::flush() { - // printf("flush not implemented\n"); + // dbg_printf("flush not implemented\n"); return true; } @@ -484,7 +485,7 @@ bool PS2FileStream::err() const { bool errVal = _handle->getErr(); if (errVal) { - printf("ferror -> %d\n", errVal); + dbg_printf("ferror -> %d\n", errVal); } return errVal; @@ -504,7 +505,7 @@ FILE *ps2_fopen(const char *fname, const char *mode) { Ps2File *file = new Ps2File(); int _mode = O_RDONLY; - printf("fopen(%s, %s)\n", fname, mode); + dbg_printf("fopen(%s, %s)\n", fname, mode); if (mode[0] == 'r' && mode [1] == 'w') _mode = O_RDWR; diff --git a/backends/platform/ps2/ps2debug.cpp b/backends/platform/ps2/ps2debug.cpp index 300e18316f..3e689f53e1 100644 --- a/backends/platform/ps2/ps2debug.cpp +++ b/backends/platform/ps2/ps2debug.cpp @@ -22,10 +22,10 @@ #include "ps2debug.h" #include <stdio.h> -#include <stdlib.h> #include <sio.h> void sioprintf(const char *zFormat, ...) { + #if 0 // doesn't seem to work with ps2link... va_list ap; char resStr[2048]; @@ -43,4 +43,5 @@ void sioprintf(const char *zFormat, ...) { sio_putc(*pos); pos++; } + #endif } diff --git a/backends/platform/ps2/ps2debug.h b/backends/platform/ps2/ps2debug.h index 02831e0623..1d29274d91 100644 --- a/backends/platform/ps2/ps2debug.h +++ b/backends/platform/ps2/ps2debug.h @@ -23,7 +23,13 @@ #ifndef __PS2DEBUG_H__ #define __PS2DEBUG_H__ -#define dbg_printf printf +#ifdef LOGORRHEIC + #define FORBIDDEN_SYMBOL_EXCEPTION_printf + // #define dbg_printf sio_printf + #define dbg_printf printf +#else + #define dbg_printf(...) /* ... */ +#endif void sioprintf(const char *zFormat, ...); diff --git a/backends/platform/ps2/savefilemgr.cpp b/backends/platform/ps2/savefilemgr.cpp index 2bd4bcba45..e1bb7d178d 100644 --- a/backends/platform/ps2/savefilemgr.cpp +++ b/backends/platform/ps2/savefilemgr.cpp @@ -21,8 +21,6 @@ */ #define FORBIDDEN_SYMBOL_EXCEPTION_printf -#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir -#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h #include "common/config-manager.h" #include "common/zlib.h" @@ -37,6 +35,7 @@ #include "savefilemgr.h" #include "Gs2dScreen.h" #include "ps2temp.h" +#include "ps2debug.h" extern AsyncFio fio; @@ -57,20 +56,20 @@ bool Ps2SaveFileManager::mcCheck(const char *path) { // int res; - printf("mcCheck\n"); + dbg_printf("mcCheck\n"); if (!dir.exists()) { - printf("! exist -> create : "); + dbg_printf("! exist -> create : "); #ifdef __USE_LIBMC__ - printf("%s\n", path+4); + dbg_printf("%s\n", path+4); // WaitSema(_sema); mcSync(0, NULL, NULL); mcMkDir(0 /*port*/, 0 /*slot*/, path+4); mcSync(0, NULL, &res); - printf("sync : %d\n", res); + dbg_printf("sync : %d\n", res); // SignalSema(_sema); #else - printf("%s\n", path); + dbg_printf("%s\n", path); fio.mkdir(path); #endif } @@ -108,7 +107,7 @@ Common::InSaveFile *Ps2SaveFileManager::openForLoading(const Common::String &fil } else { char temp[32]; - printf("MC : filename = %s\n", filename.c_str()); + dbg_printf("MC : filename = %s\n", filename.c_str()); strcpy(temp, filename.c_str()); // mcSplit(temp, game, ext); @@ -149,7 +148,7 @@ Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const Common::String &fil Common::FSNode savePath(ConfMan.get("savepath")); // TODO: is this fast? Common::WriteStream *sf; - printf("openForSaving : %s\n", filename.c_str()); + dbg_printf("openForSaving : %s\n", filename.c_str()); if (!savePath.exists() || !savePath.isDirectory()) return NULL; @@ -240,7 +239,7 @@ Common::StringArray Ps2SaveFileManager::listSavefiles(const Common::String &patt if (!savePath.exists() || !savePath.isDirectory()) return Common::StringArray(); - printf("listSavefiles = %s\n", pattern.c_str()); + dbg_printf("listSavefiles = %s\n", pattern.c_str()); if (_mc) { strcpy(temp, pattern.c_str()); @@ -263,7 +262,7 @@ Common::StringArray Ps2SaveFileManager::listSavefiles(const Common::String &patt Common::ArchiveMemberList savefiles; Common::StringArray results; - printf("dir = %s --- reg = %s\n", _dir.c_str(), search.c_str()); + dbg_printf("dir = %s --- reg = %s\n", _dir.c_str(), search.c_str()); if (dir.listMatchingMembers(savefiles, search) > 0) { for (Common::ArchiveMemberList::const_iterator file = savefiles.begin(); file != savefiles.end(); ++file) { @@ -272,11 +271,11 @@ Common::StringArray Ps2SaveFileManager::listSavefiles(const Common::String &patt temp[3] = '\0'; sprintf(path, "%s.%s", game, temp); results.push_back(path); - printf(" --> found = %s -> %s\n", (*file)->getName().c_str(), path); + dbg_printf(" --> found = %s -> %s\n", (*file)->getName().c_str(), path); } else { results.push_back((*file)->getName()); - printf(" --> found = %s\n", (*file)->getName().c_str()); + dbg_printf(" --> found = %s\n", (*file)->getName().c_str()); } } } diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index 5f3edd345a..cbb1c47191 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -20,8 +20,9 @@ * */ -// Disable symbol overrides so that we can use system headers. -#define FORBIDDEN_SYMBOL_ALLOW_ALL +// Disable symbol overrides so that we can use "FILE" +#define FORBIDDEN_SYMBOL_EXCEPTION_FILE +#define FORBIDDEN_SYMBOL_EXCEPTION_printf #include <kernel.h> #include <stdio.h> @@ -640,18 +641,18 @@ bool OSystem_PS2::hddMount(const char *partition) { strcpy(name+6, partition); if (fio.mount("pfs0:", name, 0) >= 0) { - printf("Successfully mounted (%s)!\n", name); + dbg_printf("Successfully mounted (%s)!\n", name); return true; } else { - printf("Failed to mount (%s).\n", name); + dbg_printf("Failed to mount (%s).\n", name); _useHdd = false; return false; } } void OSystem_PS2::initSize(uint width, uint height, const Graphics::PixelFormat *format) { - printf("initializing new size: (%d/%d)...", width, height); + dbg_printf("initializing new size: (%d/%d)...", width, height); /* ugly hack: we know we can parse ScummVM.ini now */ if (!_screenChangeCount) { // first round @@ -670,7 +671,7 @@ void OSystem_PS2::initSize(uint width, uint height, const Graphics::PixelFormat _modeChanged = true; _screenChangeCount++; - printf("done\n"); + dbg_printf("done\n"); } void OSystem_PS2::setPalette(const byte *colors, uint start, uint num) { @@ -695,7 +696,7 @@ void OSystem_PS2::updateScreen(void) { void OSystem_PS2::displayMessageOnOSD(const char *msg) { /* TODO : check */ - printf("displayMessageOnOSD: %s\n", msg); + dbg_printf("displayMessageOnOSD: %s\n", msg); } uint32 OSystem_PS2::getMillis(bool skipRecord) { @@ -895,15 +896,14 @@ void OSystem_PS2::powerOffCallback(void) { } void OSystem_PS2::quit(void) { - printf("OSystem_PS2::quit called\n"); + dbg_printf("OSystem_PS2::quit called\n"); if (_bootDevice == HOST_DEV) { - printf("OSystem_PS2::quit (HOST)\n"); + dbg_printf("OSystem_PS2::quit (HOST)\n"); #ifndef ENABLE_PROFILING SleepThread(); #endif - // exit(0); } else { - printf("OSystem_PS2::quit (bootdev=%d)\n", _bootDevice); + dbg_printf("OSystem_PS2::quit (bootdev=%d)\n", _bootDevice); if (_useHdd) { driveStandby(); fio.umount("pfs0:"); @@ -916,17 +916,17 @@ void OSystem_PS2::quit(void) { #else ee_thread_t statSound, statTimer; #endif - printf("Waiting for timer and sound thread to end\n"); + dbg_printf("Waiting for timer and sound thread to end\n"); do { // wait until both threads called ExitThread() ReferThreadStatus(_timerTid, &statTimer); ReferThreadStatus(_soundTid, &statSound); } while ((statSound.status != 0x10) || (statTimer.status != 0x10)); - printf("Done\n"); + dbg_printf("Done\n"); DeleteThread(_timerTid); DeleteThread(_soundTid); free(_timerStack); free(_soundStack); - printf("Stopping timer\n"); + dbg_printf("Stopping timer\n"); DisableIntc(INT_TIMER0); RemoveIntcHandler(INT_TIMER0, _intrId); @@ -935,7 +935,7 @@ void OSystem_PS2::quit(void) { padEnd(); // stop pad library cdvdInit(CDVD_EXIT); - printf("resetting iop\n"); + dbg_printf("resetting iop\n"); SifIopReset(NULL, 0); SifExitRpc(); while (!SifIopSync()); @@ -973,7 +973,7 @@ void OSystem_PS2::quit(void) { */ #else // reset + load ELF from CD - printf("Restarting ScummVM\n"); + dbg_printf("Restarting ScummVM\n"); LoadExecPS2("cdrom0:\\SCUMMVM.ELF", 0, NULL); #endif } @@ -990,12 +990,12 @@ bool OSystem_PS2::prepMC() { if (!mcPresent()) return prep; - printf("prepMC 0\n"); + dbg_printf("prepMC 0\n"); // Common::String str("mc0:ScummVM/") // Common::FSNode scumDir(str); Common::FSNode scumDir("mc0:ScummVM/"); - printf("prepMC 00\n"); + dbg_printf("prepMC 00\n"); if (!scumDir.exists()) { uint16 *data, size; @@ -1003,11 +1003,11 @@ bool OSystem_PS2::prepMC() { PS2Icon _ico; mcIcon icon; - printf("prepMC I\n"); + dbg_printf("prepMC I\n"); size = _ico.decompressData(&data); - printf("prepMC II\n"); + dbg_printf("prepMC II\n"); _ico.setup(&icon); @@ -1022,21 +1022,21 @@ bool OSystem_PS2::prepMC() { fio.mkdir("mc0:ScummVM"); f = ps2_fopen("mc0:ScummVM/scummvm.icn", "w"); - printf("f = %p\n", (const void *)f); + dbg_printf("f = %p\n", (const void *)f); ps2_fwrite(data, size, 2, f); ps2_fclose(f); f = ps2_fopen("mc0:ScummVM/icon.sys", "w"); - printf("f = %p\n", (const void *)f); + dbg_printf("f = %p\n", (const void *)f); ps2_fwrite(&icon, sizeof(icon), 1, f); ps2_fclose(f); #endif free(data); - printf("prepMC II\n"); + dbg_printf("prepMC II\n"); prep = true; } @@ -1104,6 +1104,5 @@ Common::String OSystem_PS2::getDefaultConfigFileName() { } void OSystem_PS2::logMessage(LogMessageType::Type type, const char *message) { - printf("%s", message); - sioprintf("%s", message); + dbg_printf("%s", message); } |