diff options
author | Travis Howell | 2009-07-12 23:54:46 +0000 |
---|---|---|
committer | Travis Howell | 2009-07-12 23:54:46 +0000 |
commit | 7d1badc5d53c4540cfa82f361f92a151a0f2c078 (patch) | |
tree | 4d84a4de922d68b1b1fdb1459db0d6b16a46155b /backends/platform | |
parent | 6e45d0c4aee7d129d6f68013c3f09e8a7087f552 (diff) | |
parent | 3427fb3100c84af0d63c8f8136615489fe0c7d47 (diff) | |
download | scummvm-rg350-7d1badc5d53c4540cfa82f361f92a151a0f2c078.tar.gz scummvm-rg350-7d1badc5d53c4540cfa82f361f92a151a0f2c078.tar.bz2 scummvm-rg350-7d1badc5d53c4540cfa82f361f92a151a0f2c078.zip |
Merged revisions 42398,42402-42406,42418-42421,42423,42428-42430 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk
........
r42398 | thebluegr | 2009-07-12 09:45:54 +1000 (Sun, 12 Jul 2009) | 1 line
Moved the kernel and the vocabulary outside of the engine state (they're static data, which never changes during a game)
........
r42402 | sunmax | 2009-07-12 15:34:46 +1000 (Sun, 12 Jul 2009) | 8 lines
Added a temporary work-around for PS2 backend in common/array.h
cause its vintage compiler does not support "new T[newCapacity]()"
but only "new T[newCapacity]", this will let it compile through.
It's ifdef'd as __PLAYSTATION2__, so it won't make a difference
for other backends with more modern tools.
........
r42403 | sunmax | 2009-07-12 15:35:56 +1000 (Sun, 12 Jul 2009) | 5 lines
I am re-commiting the FORCE_RTL as a temporary solution
in trunk, so that trunk/1.0rc is au pair feature-wise
with 0.13.x.
........
r42404 | sunmax | 2009-07-12 15:38:08 +1000 (Sun, 12 Jul 2009) | 24 lines
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
........
r42405 | dreammaster | 2009-07-12 17:23:50 +1000 (Sun, 12 Jul 2009) | 1 line
Added support for sub-relation message types - this fixes trying to attach the chain to the hook on the deck
........
r42406 | lordhoto | 2009-07-12 18:51:57 +1000 (Sun, 12 Jul 2009) | 1 line
Add missing quotation mark to error message.
........
r42418 | lordhoto | 2009-07-13 00:29:59 +1000 (Mon, 13 Jul 2009) | 1 line
Fix typo, which in fact fixes bug #2820353 "GUI: Search doesn't handle uppercase properly".
........
r42419 | knakos | 2009-07-13 01:59:27 +1000 (Mon, 13 Jul 2009) | 1 line
Apply patch 2802544: WINCE: Implement OSystem::engineInit to remove hack
........
r42420 | knakos | 2009-07-13 01:59:56 +1000 (Mon, 13 Jul 2009) | 1 line
fix build with arm-asm routines
........
r42421 | knakos | 2009-07-13 02:40:10 +1000 (Mon, 13 Jul 2009) | 1 line
oops, fix props
........
r42423 | sev | 2009-07-13 04:52:38 +1000 (Mon, 13 Jul 2009) | 2 lines
Patch #1936137: "Speech for Mac BS1 english"
........
r42428 | sunmax | 2009-07-13 07:58:00 +1000 (Mon, 13 Jul 2009) | 6 lines
Split _eof vs. _err.
Latter defaults to false for now, there are hooks
for possible future implementation.
........
r42429 | sunmax | 2009-07-13 08:00:47 +1000 (Mon, 13 Jul 2009) | 4 lines
On PS2 use "fprintf" (as in 0.13.x ) to print error messages to stderr,
rather than "fputs", which is buggy in the PS2 implementation.
........
r42430 | wjpalenstijn | 2009-07-13 08:08:10 +1000 (Mon, 13 Jul 2009) | 1 line
Remove double endline
........
svn-id: r42432
Diffstat (limited to 'backends/platform')
-rw-r--r-- | backends/platform/ps2/Gs2dScreen.cpp | 15 | ||||
-rw-r--r-- | backends/platform/ps2/Gs2dScreen.h | 1 | ||||
-rw-r--r-- | backends/platform/ps2/Makefile.gdb | 94 | ||||
-rw-r--r-- | backends/platform/ps2/Makefile.ps2 | 10 | ||||
-rw-r--r-- | backends/platform/ps2/fileio.cpp | 126 | ||||
-rw-r--r-- | backends/platform/ps2/fileio.h | 5 | ||||
-rw-r--r-- | backends/platform/ps2/irxboot.cpp | 9 | ||||
-rw-r--r-- | backends/platform/ps2/ps2input.cpp | 34 | ||||
-rw-r--r-- | backends/platform/ps2/savefilemgr.cpp | 6 | ||||
-rw-r--r-- | backends/platform/ps2/systemps2.cpp | 44 | ||||
-rw-r--r-- | backends/platform/ps2/systemps2.h | 15 | ||||
-rw-r--r-- | backends/platform/wince/wince-sdl.cpp | 7 | ||||
-rw-r--r-- | backends/platform/wince/wince-sdl.h | 3 |
13 files changed, 285 insertions, 84 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..864f840e8a 100644 --- a/backends/platform/ps2/fileio.cpp +++ b/backends/platform/ps2/fileio.cpp @@ -58,10 +58,11 @@ Ps2File::Ps2File(void) { _cacheSize = 0; _cachePos = 0; _eof = false; + _err = false; // _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 +81,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 +105,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) { @@ -152,10 +225,11 @@ bool Ps2File::eof(void) { } bool Ps2File::getErr(void) { - return _eof; + return _err; } void Ps2File::setErr(bool err) { + _err = err; _eof = err; } @@ -189,7 +263,9 @@ int Ps2File::seek(int32 offset, int origin) { _eof = false; res = 0; } - else _eof = true; + else { + _eof = true; + } // printf("seek [%d] %d %d\n", _fd, offset, origin); // printf(" res = %d\n", res); @@ -225,7 +301,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; @@ -278,10 +354,17 @@ uint32 Ps2File::read(void *dest, uint32 len) { printf("read (1) : _cachePos = %d\n", _cachePos); #endif + if (len == 0) { +#ifdef __PS2_FILE_SEMA__ + SignalSema(_sema); +#endif + return 0; + } + if (_filePos >= _fileSize) { _eof = true; #ifdef __PS2_FILE_SEMA__ - SignalSema(_sema); + SignalSema(_sema); #endif return 0; } @@ -344,32 +427,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) { @@ -468,8 +537,9 @@ int ps2_fflush(FILE *stream) { int ps2_ferror(FILE *stream) { int err = ((Ps2File*)stream)->getErr(); - if (err) + if (err) { printf("ferror -> %d\n", err); + } return err; } diff --git a/backends/platform/ps2/fileio.h b/backends/platform/ps2/fileio.h index e793c29d4b..6838162e06 100644 --- a/backends/platform/ps2/fileio.h +++ b/backends/platform/ps2/fileio.h @@ -62,15 +62,16 @@ private: void cacheReadSync(void); int _fd; + uint32 _mode; uint32 _fileSize; uint32 _filePos; uint32 _cacheSize; uint32 _cachePos; - // uint8 cache[2048]; uint8 *_cache; - int _eof; + bool _eof; + bool _err; int _sema; 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 - diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index b8261d029e..9a4b312631 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -908,18 +908,13 @@ int OSystem_WINCE3::getOutputSampleRate() const { return _sampleRate; } -void OSystem_WINCE3::setWindowCaption(const char *caption) { +void OSystem_WINCE3::engineInit() { check_mappings(); // called here to initialize virtual keys handling //update_game_settings(); // finalize mixer init compute_sample_rate(); setupMixer(); - -FIXME: move check_mappings() etc. calls to engineInit() & engineDone() - - // handle the actual event - OSystem_SDL::setWindowCaption(caption); } bool OSystem_WINCE3::openCD(int drive) { diff --git a/backends/platform/wince/wince-sdl.h b/backends/platform/wince/wince-sdl.h index 13f20ecccf..cc2948f93d 100644 --- a/backends/platform/wince/wince-sdl.h +++ b/backends/platform/wince/wince-sdl.h @@ -84,7 +84,7 @@ public: // Overloaded from SDL backend (master volume and sample rate subtleties) void setupMixer(); // Overloaded from OSystem - //void engineInit(); + void engineInit(); void getTimeAndDate(struct tm &t) const; virtual Common::SeekableReadStream *createConfigReadStream(); virtual Common::WriteStream *createConfigWriteStream(); @@ -145,7 +145,6 @@ protected: //int getGraphicsMode() const; int getDefaultGraphicsMode() const; - void setWindowCaption(const char *caption); bool openCD(int drive); int getOutputSampleRate() const; |