aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/ps2
diff options
context:
space:
mode:
authorMax Lingua2009-07-12 05:38:08 +0000
committerMax Lingua2009-07-12 05:38:08 +0000
commit55cda3aa258e2c214e0442ad726d964bb787cd0e (patch)
tree4c392a2f5073d6c6c1a4218fadfac7bae1ba879c /backends/platform/ps2
parent17b1c6d0aed188b400c87b2959ef7339d874b913 (diff)
downloadscummvm-rg350-55cda3aa258e2c214e0442ad726d964bb787cd0e.tar.gz
scummvm-rg350-55cda3aa258e2c214e0442ad726d964bb787cd0e.tar.bz2
scummvm-rg350-55cda3aa258e2c214e0442ad726d964bb787cd0e.zip
ScummVM/PS2 bugs fixed by this commit:
- general file write corruption (eg. ScummVM.ini, etc.) - COMI specific save crash / corruption (added option in engines/scumm/saveload.cpp to disable thumbnails on PS2, as emergency fallback in case the fix should prove to be insufficient) - implemented _screenChange logic (fixes grabOverlay & COMI popup menu) - fixed higher pitch (chipmunk fx) - made NET IRXs optional to allow it to work on fat PS2 without net+hd - fixed cursor restore on RTL - added "." as R2 to skip single lines of dialog - added write cache svn-id: r42404
Diffstat (limited to 'backends/platform/ps2')
-rw-r--r--backends/platform/ps2/Gs2dScreen.cpp15
-rw-r--r--backends/platform/ps2/Gs2dScreen.h1
-rw-r--r--backends/platform/ps2/Makefile.gdb94
-rw-r--r--backends/platform/ps2/Makefile.ps210
-rw-r--r--backends/platform/ps2/fileio.cpp109
-rw-r--r--backends/platform/ps2/fileio.h2
-rw-r--r--backends/platform/ps2/irxboot.cpp9
-rw-r--r--backends/platform/ps2/ps2input.cpp34
-rw-r--r--backends/platform/ps2/savefilemgr.cpp6
-rw-r--r--backends/platform/ps2/systemps2.cpp44
-rw-r--r--backends/platform/ps2/systemps2.h15
11 files changed, 267 insertions, 72 deletions
diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index e9a846f659..a9f1d7c51d 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -337,6 +337,7 @@ void Gs2dScreen::newScreenSize(uint16 width, uint16 height) {
memset(_screenBuf, 0, _width * height);
memset(_overlayBuf, 0, _width * height * 2);
memset(_clut, 0, 256 * sizeof(uint32));
+ _clut[1] = GS_RGBA(0xC0, 0xC0, 0xC0, 0);
// clear video ram
_dmaPipe->uploadTex(_clutPtrs[MOUSE], 64, 0, 0, GS_PSMCT32, _clut, 16, 16);
@@ -345,7 +346,8 @@ void Gs2dScreen::newScreenSize(uint16 width, uint16 height) {
_dmaPipe->flush();
_dmaPipe->waitForDma();
- _clutChanged = _screenChanged = _overlayChanged = false;
+ /*_clutChanged = */ _screenChanged = _overlayChanged = false;
+ _clutChanged = true; // reload palette on scr change
_texCoords[1].u = SCALE(_width);
_texCoords[1].v = SCALE(_height);
@@ -396,6 +398,13 @@ void Gs2dScreen::clearScreen(void) {
SignalSema(g_DmacSema);
}
+void Gs2dScreen::fillScreen(uint32 col) {
+ WaitSema(g_DmacSema);
+ memset(_screenBuf, col, _width * _height);
+ _screenChanged = true;
+ SignalSema(g_DmacSema);
+}
+
Graphics::Surface *Gs2dScreen::lockScreen() {
WaitSema(g_DmacSema);
@@ -541,11 +550,11 @@ Graphics::PixelFormat Gs2dScreen::getOverlayFormat(void) {
}
int16 Gs2dScreen::getOverlayWidth(void) {
- return _videoMode.overlayWidth;
+ return _width; // _videoMode.overlayWidth;
}
int16 Gs2dScreen::getOverlayHeight(void) {
- return _videoMode.overlayHeight;
+ return _height; // _videoMode.overlayHeight;
}
void Gs2dScreen::setShakePos(int shake) {
diff --git a/backends/platform/ps2/Gs2dScreen.h b/backends/platform/ps2/Gs2dScreen.h
index 91dfc9d327..4657ab02d9 100644
--- a/backends/platform/ps2/Gs2dScreen.h
+++ b/backends/platform/ps2/Gs2dScreen.h
@@ -61,6 +61,7 @@ public:
void copyPrintfOverlay(const uint8* buf);
void clearPrintfOverlay(void);
void clearScreen(void);
+ void fillScreen(uint32 col);
Graphics::Surface *lockScreen();
void unlockScreen();
diff --git a/backends/platform/ps2/Makefile.gdb b/backends/platform/ps2/Makefile.gdb
new file mode 100644
index 0000000000..7177275830
--- /dev/null
+++ b/backends/platform/ps2/Makefile.gdb
@@ -0,0 +1,94 @@
+# $Header: Exp $
+ include $(PS2SDK)/Defs.make
+
+PS2_EXTRA = /media/disk/nw8240/extras/scummvm/ports
+PS2_EXTRA_INCS = /zlib/include /libmad/ee/include /SjPcm/ee/src /tremor
+PS2_EXTRA_LIBS = /zlib/lib /libmad/ee/lib /SjPcm/ee/lib /tremor/tremor
+
+ENABLED=STATIC_PLUGIN
+
+#control build
+DISABLE_SCALERS = true
+DISABLE_HQ_SCALERS = true
+
+ENABLE_SCUMM = $(ENABLED)
+ENABLE_SCUMM_7_8 = $(ENABLED)
+#ENABLE_HE = $(ENABLED)
+#ENABLE_AGI = $(ENABLED)
+#ENABLE_AGOS = $(ENABLED)
+#ENABLE_CINE = $(ENABLED)
+#ENABLE_CRUISE = $(ENABLED)
+#ENABLE_DRASCULA = $(ENABLED)
+#ENABLE_GOB = $(ENABLED)
+#ENABLE_IGOR = $(ENABLED)
+#ENABLE_KYRA = $(ENABLED)
+#ENABLE_LURE = $(ENABLED)
+ # ENABLE_M4 = $(ENABLED)
+#ENABLE_MADE = $(ENABLED)
+#ENABLE_PARALLACTION = $(ENABLED)
+#ENABLE_QUEEN = $(ENABLED)
+#ENABLE_SAGA = $(ENABLED)
+#ENABLE_SAGA2 = $(ENABLED)
+#ENABLE_IHNM = $(ENABLED)
+#ENABLE_SKY = $(ENABLED)
+#ENABLE_SWORD1 = $(ENABLED)
+#ENABLE_SWORD2 = $(ENABLED)
+ # ENABLE_TINSEL = $(ENABLED)
+#ENABLE_TOUCHE = $(ENABLED)
+
+HAVE_GCC3 = true
+
+CC = ee-gcc
+CXX = ee-g++
+AS = ee-gcc
+LD = ee-gcc
+AR = ee-ar cru
+RANLIB = ee-ranlib
+STRIP = ee-strip
+MKDIR = mkdir -p
+RM = rm -f
+
+srcdir = ../../..
+VPATH = $(srcdir)
+INCDIR = ../../../
+# DEPDIR = .deps
+
+DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -D_EE -D__PLAYSTATION2__ -D__PS2_DEBUG__ -g -Wall -Wno-multichar
+
+
+INCLUDES = $(addprefix -I$(PS2_EXTRA),$(PS2_EXTRA_INCS))
+INCLUDES += -I $(PS2GDB)/ee -I $(PS2SDK)/ee/include -I $(PS2SDK)/common/include -I ./common -I . -I $(srcdir) -I $(srcdir)/engines
+
+TARGET = elf/scummvm.elf
+
+OBJS := backends/platform/ps2/DmaPipe.o \
+ backends/platform/ps2/Gs2dScreen.o \
+ backends/platform/ps2/irxboot.o \
+ backends/platform/ps2/ps2input.o \
+ backends/platform/ps2/ps2pad.o \
+ backends/platform/ps2/savefilemgr.o \
+ backends/platform/ps2/fileio.o \
+ backends/platform/ps2/asyncfio.o \
+ backends/platform/ps2/icon.o \
+ backends/platform/ps2/cd.o \
+ backends/platform/ps2/eecodyvdfs.o \
+ backends/platform/ps2/rpckbd.o \
+ backends/platform/ps2/systemps2.o \
+ backends/platform/ps2/ps2mutex.o \
+ backends/platform/ps2/ps2time.o \
+ backends/platform/ps2/ps2debug.o
+
+MODULE_DIRS += .
+
+include $(srcdir)/Makefile.common
+
+LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfile
+LDFLAGS += -L $(PS2GDB)/lib -L $(PS2SDK)/ee/lib -L .
+LDFLAGS += $(addprefix -L$(PS2_EXTRA),$(PS2_EXTRA_LIBS))
+LDFLAGS += -lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm -lmad -ltremor -lz -lm -lc -lfileXio -lps2gdbStub -lps2ip -ldebug -lkernel -lstdc++
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+ $(LD) $^ $(LDFLAGS) -o $@
+
diff --git a/backends/platform/ps2/Makefile.ps2 b/backends/platform/ps2/Makefile.ps2
index 812599d0c0..5abeae5fb5 100644
--- a/backends/platform/ps2/Makefile.ps2
+++ b/backends/platform/ps2/Makefile.ps2
@@ -1,7 +1,7 @@
# $Header: Exp $
include $(PS2SDK)/Defs.make
-PS2_EXTRA = /media/disk-1/nw8240/extras/scummvm/ports
+PS2_EXTRA = /media/disk/nw8240/extras/scummvm/ports
PS2_EXTRA_INCS = /zlib/include /libmad/ee/include /SjPcm/ee/src /tremor
PS2_EXTRA_LIBS = /zlib/lib /libmad/ee/lib /SjPcm/ee/lib /tremor/tremor
@@ -45,15 +45,15 @@ LD = ee-gcc
AR = ee-ar cru
RANLIB = ee-ranlib
STRIP = ee-strip
-MKDIR = mkdir -p
-RM = rm -f
+MKDIR = mkdir -p
+RM = rm -f
srcdir = ../../..
VPATH = $(srcdir)
INCDIR = ../../../
# DEPDIR = .deps
-DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -D_EE -D__PLAYSTATION2__ -O2 -Wall -Wno-multichar
+DEFINES = -DUSE_VORBIS -DUSE_TREMOR -DUSE_MAD -DUSE_ZLIB -DFORCE_RTL -D_EE -D__PLAYSTATION2__ -O2 -Wall -Wno-multichar
INCLUDES = $(addprefix -I$(PS2_EXTRA),$(PS2_EXTRA_INCS))
@@ -86,7 +86,7 @@ LDFLAGS += -mno-crt0 $(PS2SDK)/ee/startup/crt0.o -T $(PS2SDK)/ee/startup/linkfil
LDFLAGS += -L $(PS2SDK)/ee/lib -L .
LDFLAGS += $(addprefix -L$(PS2_EXTRA),$(PS2_EXTRA_LIBS))
LDFLAGS += -lmc -lpad -lmouse -lhdd -lpoweroff -lsjpcm -lmad -ltremor -lz -lm -lc -lfileXio -lkernel -lstdc++
-# LDFLAGS += -s
+LDFLAGS += -s
all: $(TARGET)
diff --git a/backends/platform/ps2/fileio.cpp b/backends/platform/ps2/fileio.cpp
index fc35306907..8e5dc1255f 100644
--- a/backends/platform/ps2/fileio.cpp
+++ b/backends/platform/ps2/fileio.cpp
@@ -61,7 +61,7 @@ Ps2File::Ps2File(void) {
// _cache = (uint8 *)malloc(PS2_CACHE_MAX);
- _cacheBuf = (uint8*)memalign(64, CACHE_SIZE);
+ _cacheBuf = (uint8*)memalign(64, CACHE_SIZE * 2);
_cacheOpRunning = 0;
_filePos = _physFilePos = _cachePos = 0;
@@ -80,7 +80,16 @@ Ps2File::Ps2File(void) {
}
Ps2File::~Ps2File(void) {
+ uint32 w;
if (_fd >= 0) {
+
+ if (_mode != O_RDONLY) {
+ fio.seek(_fd, 0, SEEK_SET);
+ fio.write(_fd, _cacheBuf, _filePos);
+ w = fio.sync(_fd);
+ 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);
@@ -95,24 +104,87 @@ Ps2File::~Ps2File(void) {
}
bool Ps2File::open(const char *name, int mode) {
- assert(_fd < 0);
-
+#if 1
_fd = fio.open(name, mode);
printf("open %s [%d]\n", name, _fd);
if (_fd >= 0) {
- _fileSize = fio.seek(_fd, 0, SEEK_END);
- if (mode == O_RDONLY)
- // if (!(mode & O_APPEND))
+ _mode = mode;
+ _filePos = 0;
+
+ if (_mode == O_RDONLY) {
+ _fileSize = fio.seek(_fd, 0, SEEK_END);
fio.seek(_fd, 0, SEEK_SET);
+ }
+ else
+ _fileSize = 0;
+ printf(" _mode = %x\n", _mode);
+ printf(" _fileSize = %d\n", _fileSize);
+ // printf(" _filePos = %d\n", _filePos);
+
+ return true;
+ }
+
+ return false;
+#else
+ uint32 r;
+
+ // hack: FIO does not reports size for RW (?)
+ _fd = fio.open(name, O_RDONLY);
+ if (_fd >= 0) {
+ _fileSize = fio.seek(_fd, 0, SEEK_END);
+ fio.seek(_fd, 0, SEEK_SET); /* rewind ! */
+
+ if (_fileSize && mode != O_RDONLY) {
+ fio.read(_fd, _cacheBuf, _fileSize);
+ r = fio.sync(_fd);
+ printf(" sz=%d, read=%d\n", _fileSize, r);
+ assert(r == _fileSize);
+ }
+
+ fio.close(_fd);
+ }
+ else
+ _fileSize = 0; /* new file */
+
+ _fd = fio.open(name, mode);
+
+ printf("open %s [%d]\n", name, _fd);
+
+ if (_fd >= 0) {
+ _mode = mode;
+ _filePos = 0;
+
+ if (_fileSize) { /* existing data */
+ if (mode == O_RDONLY) {
+ /* DANGER: for w* modes it will truncate your fine files */
+ fio.seek(_fd, 0, SEEK_SET);
+ }
+ else if (_mode & O_APPEND) {
+ fio.seek(_fd, 0, _fileSize);
+ _filePos = _fileSize;
+ }
+ #if 0 /* file already trunc'd when opened as w* -> moved up */
+ if (mode != O_RDONLY) {
+ fio.read(_fd, _cacheBuf, _fileSize);
+ r = fio.sync(_fd);
+ 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);
return true;
} else
return false;
+#endif
}
int32 Ps2File::tell(void) {
@@ -225,7 +297,7 @@ void Ps2File::cacheReadAhead(void) {
_cachePos = cachePosEnd = _filePos & ~READ_ALIGN_MASK;
assert(_filePos == _physFilePos);
} else {
- uint32 cacheDiff = _filePos - _cachePos;
+ uint32 cacheDiff = _filePos - _cachePos;
assert(_bytesInCache >= cacheDiff);
cacheDiff &= ~READ_ALIGN_MASK;
_bytesInCache -= cacheDiff;
@@ -344,32 +416,18 @@ uint32 Ps2File::read(void *dest, uint32 len) {
}
uint32 Ps2File::write(const void *src, uint32 len) {
- uint32 w;
#ifdef __PS2_FILE_SEMA__
WaitSema(_sema);
#endif
- _cacheSize = 0;
- w = fio.sync(_fd);
- assert(w==0);
-
- fio.seek(_fd, _filePos, SEEK_SET);
- fio.write(_fd, src, len);
-
- w = fio.sync(_fd);
+ memcpy(&_cacheBuf[_filePos], src, len);
+ _filePos += len;
#ifdef __PS2_FILE_SEMA__
SignalSema(_sema);
#endif
- if (w) {
- _filePos += w;
- if (w < len)
- _eof = true;
- return w;
- }
-
- return 0;
+ return len;
}
FILE *ps2_fopen(const char *fname, const char *mode) {
@@ -471,7 +529,8 @@ int ps2_ferror(FILE *stream) {
if (err)
printf("ferror -> %d\n", err);
- return err;
+ return 0; // kyra temp
+ // return err;
}
void ps2_clearerr(FILE *stream) {
diff --git a/backends/platform/ps2/fileio.h b/backends/platform/ps2/fileio.h
index e793c29d4b..b481979388 100644
--- a/backends/platform/ps2/fileio.h
+++ b/backends/platform/ps2/fileio.h
@@ -62,12 +62,12 @@ private:
void cacheReadSync(void);
int _fd;
+ uint32 _mode;
uint32 _fileSize;
uint32 _filePos;
uint32 _cacheSize;
uint32 _cachePos;
- // uint8 cache[2048];
uint8 *_cache;
int _eof;
diff --git a/backends/platform/ps2/irxboot.cpp b/backends/platform/ps2/irxboot.cpp
index daa592522a..15cb816c31 100644
--- a/backends/platform/ps2/irxboot.cpp
+++ b/backends/platform/ps2/irxboot.cpp
@@ -55,15 +55,16 @@ IrxFile irxFiles[] = {
{ "USB_MASS.IRX", USB | OPTIONAL, MASS_DRIVER, NULL, 0 },
{ "PS2MOUSE.IRX", USB | OPTIONAL, MOUSE_DRIVER, NULL, 0 },
{ "RPCKBD.IRX", USB | OPTIONAL, KBD_DRIVER, NULL, 0 },
-
+#ifndef NO_ADAPTOR
{ "POWEROFF.IRX", HDD | OPTIONAL | NOT_HOST | DEPENDANCY, HDD_DRIVER, NULL, 0 },
{ "PS2DEV9.IRX", HDD | OPTIONAL | NOT_HOST | DEPENDANCY, HDD_DRIVER, NULL, 0 },
{ "PS2ATAD.IRX", HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, NULL, 0 },
{ "PS2HDD.IRX", HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, hddArg, sizeof(hddArg) },
{ "PS2FS.IRX", HDD | OPTIONAL | DEPENDANCY, HDD_DRIVER, pfsArg, sizeof(pfsArg) },
- { "PS2IP.IRX", NET | NOT_HOST, NET_DRIVER, NULL, 0 },
- { "PS2SMAP.IRX", NET | NOT_HOST, NET_DRIVER, netArg, sizeof(netArg) },
- { "PS2HOST.IRX", NET | NOT_HOST, NET_DRIVER, NULL, 0 }
+ { "PS2IP.IRX", NET | OPTIONAL | NOT_HOST | DEPENDANCY, NET_DRIVER, NULL, 0 },
+ { "PS2SMAP.IRX", NET | OPTIONAL | NOT_HOST | DEPENDANCY, NET_DRIVER, netArg, sizeof(netArg) },
+ { "PS2HOST.IRX", NET | OPTIONAL | NOT_HOST | DEPENDANCY, NET_DRIVER, NULL, 0 }
+#endif
};
static const int numIrxFiles = sizeof(irxFiles) / sizeof(irxFiles[0]);
diff --git a/backends/platform/ps2/ps2input.cpp b/backends/platform/ps2/ps2input.cpp
index c320e79eed..964a773f7e 100644
--- a/backends/platform/ps2/ps2input.cpp
+++ b/backends/platform/ps2/ps2input.cpp
@@ -510,22 +510,22 @@ const Common::KeyCode Ps2Input::_usbToSdlk[0x100] = {
};
const Common::KeyCode Ps2Input::_padCodes[16] = {
- Common::KEYCODE_1, // Select
- Common::KEYCODE_INVALID, // L3
- Common::KEYCODE_INVALID, // R3
- Common::KEYCODE_F5, // Start
- Common::KEYCODE_INVALID, // Up
- Common::KEYCODE_INVALID, // Right
- Common::KEYCODE_INVALID, // Down
- Common::KEYCODE_INVALID, // Left
- Common::KEYCODE_KP0, // L2
- Common::KEYCODE_INVALID, // R2
- Common::KEYCODE_n, // L1
- Common::KEYCODE_y, // R1
- Common::KEYCODE_ESCAPE, // Triangle
- Common::KEYCODE_INVALID, // Circle => Right mouse button
- Common::KEYCODE_INVALID, // Cross => Left mouse button
- Common::KEYCODE_RETURN // Square
+ Common::KEYCODE_1, // Select
+ Common::KEYCODE_INVALID, // L3
+ Common::KEYCODE_INVALID, // R3
+ Common::KEYCODE_F5, // Start
+ Common::KEYCODE_INVALID, // Up
+ Common::KEYCODE_INVALID, // Right
+ Common::KEYCODE_INVALID, // Down
+ Common::KEYCODE_INVALID, // Left
+ Common::KEYCODE_KP0, // L2
+ Common::KEYCODE_PERIOD, // R2
+ Common::KEYCODE_n, // L1
+ Common::KEYCODE_y, // R1
+ Common::KEYCODE_ESCAPE, // Triangle
+ Common::KEYCODE_INVALID, // Circle => Right mouse button
+ Common::KEYCODE_INVALID, // Cross => Left mouse button
+ Common::KEYCODE_RETURN // Square
};
const Common::KeyCode Ps2Input::_padFlags[16] = {
@@ -544,7 +544,7 @@ const Common::KeyCode Ps2Input::_padFlags[16] = {
Common::KEYCODE_INVALID, // Triangle
Common::KEYCODE_INVALID, // Circle
Common::KEYCODE_INVALID, // Cross
- Common::KEYCODE_INVALID // Square
+ Common::KEYCODE_INVALID // Square
};
diff --git a/backends/platform/ps2/savefilemgr.cpp b/backends/platform/ps2/savefilemgr.cpp
index 1271a43d42..1613863530 100644
--- a/backends/platform/ps2/savefilemgr.cpp
+++ b/backends/platform/ps2/savefilemgr.cpp
@@ -239,10 +239,10 @@ Common::StringList Ps2SaveFileManager::listSavefiles(const Common::String &patte
if (!savePath.exists() || !savePath.isDirectory())
return Common::StringList();
- printf("listSavefiles = %s\n", pattern);
+ printf("listSavefiles = %s\n", pattern.c_str());
if (_mc) {
- strcpy(temp, pattern);
+ strcpy(temp, pattern.c_str());
// mcSplit(temp, game, ext);
game = strdup(strtok(temp, "."));
@@ -255,7 +255,7 @@ Common::StringList Ps2SaveFileManager::listSavefiles(const Common::String &patte
}
else {
_dir = Common::String(savePath.getPath());
- search = Common::String(pattern);
+ search = pattern;
}
Common::FSDirectory dir(_dir);
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index f29caf2279..57a03f777d 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -66,6 +66,10 @@
#include "icon.h"
#include "ps2temp.h"
+#ifdef __PS2_DEBUG__
+#include <debug.h>
+#endif
+
// asm("mfc0 %0, $9\n" : "=r"(tickStart));
extern void *_gp;
@@ -95,6 +99,11 @@ PS2Device detectBootPath(const char *elfPath, char *bootPath);
extern AsyncFio fio;
+#ifdef __PS2_DEBUG__
+extern "C" int gdb_stub_main(int argc, char *argv[]);
+extern "C" void breakpoint(void);
+#endif
+
extern "C" int scummvm_main(int argc, char *argv[]);
extern "C" int main(int argc, char *argv[]) {
@@ -117,6 +126,10 @@ extern "C" int main(int argc, char *argv[]) {
sioprintf("Result = %d\n", res);
}
+#ifdef __PS2_DEBUG__
+ gdb_stub_main(argc, argv);
+#endif
+
sioprintf("Creating system\n");
g_system = g_systemPs2 = new OSystem_PS2(argv[0]);
@@ -241,6 +254,8 @@ OSystem_PS2::OSystem_PS2(const char *elfPath) {
_printY = 0;
_msgClearTime = 0;
_systemQuit = false;
+ _modeChanged = false;
+ _screenChangeCount = 0;
_screen = new Gs2dScreen(320, 200, TV_DONT_CARE);
@@ -327,9 +342,8 @@ OSystem_PS2::OSystem_PS2(const char *elfPath) {
void OSystem_PS2::init(void) {
sioprintf("Timer...\n");
_scummTimerManager = new DefaultTimerManager();
- _scummEventManager = new DefaultEventManager();
_scummMixer = new Audio::MixerImpl(this);
- _scummMixer->setOutputRate(44100);
+ _scummMixer->setOutputRate(48000);
_scummMixer->setReady(true);
initTimer();
@@ -520,6 +534,9 @@ void OSystem_PS2::initSize(uint width, uint height) {
_oldMouseX = width / 2;
_oldMouseY = height / 2;
+
+ _modeChanged = true;
+ _screenChangeCount++;
printf("done\n");
}
@@ -574,11 +591,11 @@ void OSystem_PS2::delayMillis(uint msecs) {
Common::TimerManager *OSystem_PS2::getTimerManager() {
return _scummTimerManager;
}
-
+/*
Common::EventManager *OSystem_PS2::getEventManager() {
- return _scummEventManager;
+ return getEventManager();
}
-
+*/
Audio::Mixer *OSystem_PS2::getMixer() {
return _scummMixer;
}
@@ -661,7 +678,7 @@ int16 OSystem_PS2::getOverlayHeight(void) {
return _screen->getOverlayHeight();
}
-Graphics::Surface *OSystem_PS2::lockScreen() {
+Graphics::Surface *OSystem_PS2::lockScreen(void) {
return _screen->lockScreen();
}
@@ -669,6 +686,10 @@ void OSystem_PS2::unlockScreen(void) {
_screen->unlockScreen();
}
+void OSystem_PS2::fillScreen(uint32 col) {
+ _screen->fillScreen(col);
+}
+
const OSystem::GraphicsMode OSystem_PS2::_graphicsMode = { NULL, NULL, 0 };
const OSystem::GraphicsMode *OSystem_PS2::getSupportedGraphicsModes(void) const {
@@ -688,7 +709,16 @@ int OSystem_PS2::getDefaultGraphicsMode(void) const {
}
bool OSystem_PS2::pollEvent(Common::Event &event) {
- bool res = _input->pollEvent(&event);
+ bool res;
+
+ if (_modeChanged) {
+ _modeChanged = false;
+ event.type = Common::EVENT_SCREEN_CHANGED;
+ return true;
+ }
+
+ res = _input->pollEvent(&event);
+
if (res && (event.type == Common::EVENT_MOUSEMOVE))
_screen->setMouseXy(event.mouse.x, event.mouse.y);
return res;
diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h
index ab27d93574..24cd94f503 100644
--- a/backends/platform/ps2/systemps2.h
+++ b/backends/platform/ps2/systemps2.h
@@ -27,9 +27,9 @@
#define SYSTEMPS2_H
#include "common/system.h"
+#include "backends/base-backend.h"
class DefaultTimerManager;
-class DefaultEventManager;
class DefaultSaveFileManager;
class Gs2dScreen;
@@ -54,7 +54,7 @@ namespace Audio {
class MixerImpl;
};
-class OSystem_PS2 : public OSystem {
+class OSystem_PS2 : public BaseBackend {
public:
OSystem_PS2(const char *elfPath);
virtual ~OSystem_PS2(void);
@@ -72,6 +72,7 @@ public:
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
virtual void updateScreen();
+ virtual void fillScreen(uint32);
/* TODO : check */
virtual void displayMessageOnOSD(const char *msg) { printf("displayMessageOnOSD: %s\n", msg); };
/* */
@@ -92,7 +93,7 @@ public:
virtual uint32 getMillis();
virtual void delayMillis(uint msecs);
virtual Common::TimerManager *getTimerManager();
- virtual Common::EventManager *getEventManager();
+// virtual Common::EventManager *getEventManager();
virtual bool pollEvent(Common::Event &event);
virtual Audio::Mixer *getMixer();
@@ -112,14 +113,14 @@ public:
virtual int getDefaultGraphicsMode() const;
virtual bool setGraphicsMode(int mode);
virtual int getGraphicsMode() const;
+ virtual int getScreenChangeID() const { return _screenChangeCount; }
virtual void quit();
virtual Common::SeekableReadStream *createConfigReadStream();
virtual Common::WriteStream *createConfigWriteStream();
- virtual Graphics::PixelFormat getOverlayFormat() const;
-
+ virtual Graphics::PixelFormat getOverlayFormat() const;
virtual Common::SaveFileManager *getSavefileManager();
virtual FilesystemFactory *getFilesystemFactory();
@@ -149,7 +150,6 @@ private:
void readRtcTime(void);
DefaultTimerManager *_scummTimerManager;
- DefaultEventManager *_scummEventManager;
Audio::MixerImpl *_scummMixer;
bool _mouseVisible;
@@ -163,6 +163,8 @@ private:
uint16 _oldMouseX, _oldMouseY;
uint32 _msgClearTime;
uint16 _printY;
+ bool _modeChanged;
+ int _screenChangeCount;
int _mutexSema;
Ps2Mutex _mutex[MAX_MUTEXES];
@@ -179,4 +181,3 @@ private:
};
#endif // SYSTEMPS2_H
-