PS2: Made it quieter unless -DLOGORRHEIC is set

This commit is contained in:
Max Lingua 2014-01-23 18:15:42 -05:00
parent 6487c362a1
commit 5e36716be5
9 changed files with 95 additions and 85 deletions

View File

@ -21,9 +21,9 @@
#if defined(__PLAYSTATION2__)
// 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/fs/ps2/ps2-fs.h"
@ -57,13 +57,13 @@ const char *_lastPathComponent(const Common::String &str) {
cur++;
// printf("lastPathComponent path=%s token=%s\n", start, cur);
// dbg_printf("lastPathComponent path=%s token=%s\n", start, cur);
return cur;
}
Ps2FilesystemNode::Ps2FilesystemNode() {
printf("NEW FSNODE()\n");
dbg_printf("NEW FSNODE()\n");
_isHere = true;
_isDirectory = true;
@ -74,7 +74,7 @@ Ps2FilesystemNode::Ps2FilesystemNode() {
}
Ps2FilesystemNode::Ps2FilesystemNode(const Common::String &path) {
printf("NEW FSNODE(%s)\n", path.c_str());
dbg_printf("NEW FSNODE(%s)\n", path.c_str());
_path = path;
@ -106,7 +106,7 @@ Ps2FilesystemNode::Ps2FilesystemNode(const Common::String &path) {
}
Ps2FilesystemNode::Ps2FilesystemNode(const Common::String &path, bool verify) {
printf("NEW FSNODE(%s, %d)\n", path.c_str(), verify);
dbg_printf("NEW FSNODE(%s, %d)\n", path.c_str(), verify);
_path = path;
@ -163,24 +163,24 @@ void Ps2FilesystemNode::doverify(void) {
_verified = true;
printf(" verify: %s -> ", _path.c_str());
dbg_printf(" verify: %s -> ", _path.c_str());
#if 0
if (_path.empty()) {
printf("PlayStation 2 Root !\n");
dbg_printf("PlayStation 2 Root !\n");
_verified = true;
return;
}
if (_path.lastChar() == ':') {
printf("Dev: %s\n", _path.c_str());
dbg_printf("Dev: %s\n", _path.c_str());
_verified = true;
return;
}
#endif
if (_path[3] != ':' && _path[4] != ':') {
printf("relative path !\n");
dbg_printf("relative path !\n");
_isHere = false;
_isDirectory = false;
return;
@ -203,7 +203,7 @@ void Ps2FilesystemNode::doverify(void) {
fileXioWaitAsync(FXIO_WAIT, &fd);
if (!fd) {
printf(" yes [stat]\n");
dbg_printf(" yes [stat]\n");
return true;
}
break;
@ -217,11 +217,11 @@ void Ps2FilesystemNode::doverify(void) {
#if 1
fd = fio.open(_path.c_str(), O_RDONLY);
printf("_path = %s -- fio.open -> %d\n", _path.c_str(), fd);
dbg_printf("_path = %s -- fio.open -> %d\n", _path.c_str(), fd);
if (fd >=0) {
fio.close(fd);
printf(" yes [open]\n");
dbg_printf(" yes [open]\n");
_isHere = true;
if (medium==MC_DEV && _path.lastChar()=='/')
_isDirectory = true;
@ -233,7 +233,7 @@ void Ps2FilesystemNode::doverify(void) {
fd = fio.dopen(_path.c_str());
if (fd >=0) {
fio.dclose(fd);
printf(" yes [dopen]\n");
dbg_printf(" yes [dopen]\n");
_isHere = true;
_isDirectory = true;
return;
@ -266,13 +266,13 @@ void Ps2FilesystemNode::doverify(void) {
_isHere = false;
_isDirectory = false;
printf(" no\n");
dbg_printf(" no\n");
return;
}
AbstractFSNode *Ps2FilesystemNode::getChild(const Common::String &n) const {
printf("getChild : %s\n", n.c_str());
dbg_printf("getChild : %s\n", n.c_str());
if (!_isDirectory)
return NULL;
@ -327,7 +327,7 @@ AbstractFSNode *Ps2FilesystemNode::getChild(const Common::String &n) const {
bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hidden) const {
//TODO: honor the hidden flag
// printf("getChildren\n");
// dbg_printf("getChildren\n");
if (!_isDirectory)
return false;
@ -357,7 +357,7 @@ bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hi
else
fd = fio.dopen(_path.c_str());
// printf("dopen = %d\n", fd);
// dbg_printf("dopen = %d\n", fd);
if (fd >= 0) {
iox_dirent_t dirent;
@ -399,7 +399,7 @@ bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hi
}
AbstractFSNode *Ps2FilesystemNode::getParent() const {
// printf("Ps2FilesystemNode::getParent : path = %s\n", _path.c_str());
// dbg_printf("Ps2FilesystemNode::getParent : path = %s\n", _path.c_str());
if (_isRoot)
return new Ps2FilesystemNode(this); // FIXME : 0 ???
@ -411,7 +411,7 @@ AbstractFSNode *Ps2FilesystemNode::getParent() const {
const char *end = _lastPathComponent(_path);
Common::String str(start, end - start);
// printf(" parent = %s\n", str.c_str());
// dbg_printf(" parent = %s\n", str.c_str());
return new Ps2FilesystemNode(str, true);
}

View File

@ -69,12 +69,12 @@ public:
virtual Common::String getPath() const { return _path; }
virtual bool exists() const {
// printf("%s : is %d\n", _path.c_str(), _isHere);
// dbg_printf("%s : is %d\n", _path.c_str(), _isHere);
return _isHere;
}
virtual bool isDirectory() const {
// printf("%s : dir %d\n", _path.c_str(), _isDirectory);
// dbg_printf("%s : dir %d\n", _path.c_str(), _isDirectory);
return _isDirectory;
}

View File

@ -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))

View File

@ -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);

View File

@ -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;

View File

@ -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
}

View File

@ -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, ...);

View File

@ -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());
}
}
}

View File

@ -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);
}