diff options
-rw-r--r-- | backends/platform/ps2/Gs2dScreen.cpp | 48 | ||||
-rw-r--r-- | backends/platform/ps2/Gs2dScreen.h | 29 | ||||
-rw-r--r-- | backends/platform/ps2/savefilemgr.cpp | 16 | ||||
-rw-r--r-- | backends/platform/ps2/systemps2.cpp | 28 | ||||
-rw-r--r-- | backends/platform/ps2/systemps2.h | 18 |
5 files changed, 109 insertions, 30 deletions
diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp index 050c0d56f9..380e28952f 100644 --- a/backends/platform/ps2/Gs2dScreen.cpp +++ b/backends/platform/ps2/Gs2dScreen.cpp @@ -1,4 +1,4 @@ -/* ScummVM - Graphic Adventure Engine +/* ScummVM - Graphic Adventure Engin * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -148,24 +148,24 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) { fioClose(fd); if (romver[4] == 'E') - _videoMode = TV_PAL; + _tvMode = TV_PAL; else - _videoMode = TV_NTSC; + _tvMode = TV_NTSC; #else if (PAL_NTSC_FLAG == 'E') - _videoMode = TV_PAL; + _tvMode = TV_PAL; else - _videoMode = TV_NTSC; + _tvMode = TV_NTSC; #endif } else - _videoMode = tvMode; + _tvMode = tvMode; - // _videoMode = TV_NTSC; - printf("Setting up %s mode\n", (_videoMode == TV_PAL) ? "PAL" : "NTSC"); + // _tvMode = TV_NTSC; + printf("Setting up %s mode\n", (_tvMode == TV_PAL) ? "PAL" : "NTSC"); // set screen size, 640x512 for pal, 640x448 for ntsc _tvWidth = 640; - _tvHeight = ((_videoMode == TV_PAL) ? 512 /*544*/ : 448); + _tvHeight = ((_tvMode == TV_PAL) ? 512 /*544*/ : 448); kFullScreen[0].z = kFullScreen[1].z = 0; kFullScreen[0].x = ORIGIN_X; kFullScreen[0].y = ORIGIN_Y; @@ -199,6 +199,18 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) { _mTraCol = 255; _shakePos = 0; + _overlayFormat.bytesPerPixel = 2; + + _overlayFormat.rLoss = 3; + _overlayFormat.gLoss = 3; + _overlayFormat.bLoss = 3; + _overlayFormat.aLoss = 7; + + _overlayFormat.rShift = 0; + _overlayFormat.gShift = 5; + _overlayFormat.bShift = 10; + _overlayFormat.aShift = 15; + // setup hardware now. GS_CSR = CSR_RESET; // Reset GS asm ("sync.p"); @@ -207,7 +219,7 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) { uint16 dispPosX, dispPosY; - if (_videoMode == TV_PAL) { + if (_tvMode == TV_PAL) { SetGsCrt(GS_INTERLACED, 3, 0); dispPosX = DEFAULT_PAL_X; dispPosY = DEFAULT_PAL_Y; @@ -524,6 +536,18 @@ void Gs2dScreen::hideOverlay(void) { _showOverlay = false; } +Graphics::PixelFormat Gs2dScreen::getOverlayFormat(void) { + return _overlayFormat; +} + +int16 Gs2dScreen::getOverlayWidth(void) { + return _videoMode.overlayWidth; +} + +int16 Gs2dScreen::getOverlayHeight(void) { + return _videoMode.overlayHeight; +} + void Gs2dScreen::setShakePos(int shake) { _shakePos = (shake * _mouseScaleY) >> 8; _blitCoords[0].y = SCALE(_shakePos) + ORIGIN_Y; @@ -622,7 +646,7 @@ void Gs2dScreen::setMouseXy(int16 x, int16 y) { } uint8 Gs2dScreen::tvMode(void) { - return _videoMode; + return _tvMode; } uint16 Gs2dScreen::getWidth(void) { @@ -647,7 +671,7 @@ void Gs2dScreen::animThread(void) { g_RunAnim = false; float yPos = 0.0; uint8 texSta = 0; - float scrlSpeed = (_videoMode == TV_PAL) ? (_tvHeight / (SCRL_TIME * 50.0)) : (_tvHeight / (SCRL_TIME * 60.0)); + float scrlSpeed = (_tvMode == TV_PAL) ? (_tvHeight / (SCRL_TIME * 50.0)) : (_tvHeight / (SCRL_TIME * 60.0)); uint8 texMax = (_tvHeight / LINE_SPACE) + (ORG_Y / LINE_SPACE); TexVertex texNodes[4] = { { SCALE(1), SCALE(1) }, { SCALE(1), SCALE(14) }, diff --git a/backends/platform/ps2/Gs2dScreen.h b/backends/platform/ps2/Gs2dScreen.h index 94ef218a40..1c4de6ef5a 100644 --- a/backends/platform/ps2/Gs2dScreen.h +++ b/backends/platform/ps2/Gs2dScreen.h @@ -27,9 +27,12 @@ #define __GS2DSCREEN_H__ #include "sysdefs.h" +#include "backends/base-backend.h" + #include "backends/platform/ps2/DmaPipe.h" #include "graphics/surface.h" + enum TVMode { TV_DONT_CARE = 0, TV_PAL, @@ -73,6 +76,10 @@ public: void clearOverlay(void); void showOverlay(void); void hideOverlay(void); + Graphics::PixelFormat getOverlayFormat(void); + int16 getOverlayWidth(void); + int16 getOverlayHeight(void); + //- mouse routines void setMouseOverlay(const uint8 *buf, uint16 width, uint16 height, uint16 hotSpotX, uint16 hotSpotY, uint8 transpCol); void showMouse(bool show); @@ -83,12 +90,13 @@ public: void wantAnim(bool runIt); void quit(void); + private: void uploadToVram(void); void createAnimTextures(void); DmaPipe *_dmaPipe; - uint8 _videoMode; + uint8 _tvMode; uint16 _tvWidth, _tvHeight; GsVertex _blitCoords[2]; TexVertex _texCoords[2]; @@ -99,6 +107,24 @@ private: uint32 _texPtrs[4]; // Graphics::Surface _framebuffer; + + /* TODO : check if we do need this */ + struct VideoState { + bool setup; + + bool fullscreen; + bool aspectRatio; + + int mode; + int scaleFactor; + + int screenWidth, screenHeight; + int overlayWidth, overlayHeight; + }; + + VideoState _videoMode; + /* */ + uint16 _width, _height, _pitch; int16 _mouseX, _mouseY, _hotSpotX, _hotSpotY; uint32 _mouseScaleX, _mouseScaleY; @@ -110,6 +136,7 @@ private: uint16 *_overlayBuf; uint8 *_screenBuf; uint32 *_clut; + Graphics::PixelFormat _overlayFormat; int _screenSema; int _vblankStartId, _vblankEndId, _dmacId, _animTid; diff --git a/backends/platform/ps2/savefilemgr.cpp b/backends/platform/ps2/savefilemgr.cpp index 410d209d12..d15beb418a 100644 --- a/backends/platform/ps2/savefilemgr.cpp +++ b/backends/platform/ps2/savefilemgr.cpp @@ -24,7 +24,9 @@ */ #include "common/config-manager.h" -#include "backends/saves/compressed/compressed-saves.h" +#include "common/zlib.h" + +// #include "backends/saves/compressed/compressed-saves.h" #ifdef __USE_LIBMC__ #include <libmc.h> @@ -124,7 +126,7 @@ Common::InSaveFile *Ps2SaveFileManager::openForLoading(const char *filename) { if(!file.exists()) return NULL; - sf = file.openForReading(); + sf = file.createReadStream(); } else { Common::FSNode file = savePath.getChild(filename); @@ -132,12 +134,12 @@ Common::InSaveFile *Ps2SaveFileManager::openForLoading(const char *filename) { if(!file.exists()) return NULL; - sf = file.openForReading(); + sf = file.createReadStream(); } // _screen->wantAnim(false); - return wrapInSaveFile(sf); + return Common::wrapCompressedReadStream(sf); } Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const char *filename) { @@ -177,16 +179,16 @@ Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const char *filename) { } Common::FSNode file(path); - sf = file.openForWriting(); + sf = file.createWriteStream(); free(game); free(ext); } else { Common::FSNode file = savePath.getChild(filename); - sf = file.openForWriting(); + sf = file.createWriteStream(); } _screen->wantAnim(false); - return wrapOutSaveFile(sf); + return Common::wrapCompressedWriteStream(sf); } bool Ps2SaveFileManager::removeSavefile(const char *filename) { diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index 5b24f5bb3e..1a69e5377a 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -327,6 +327,7 @@ 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->setReady(true); @@ -574,6 +575,10 @@ Common::TimerManager *OSystem_PS2::getTimerManager() { return _scummTimerManager; } +Common::EventManager *OSystem_PS2::getEventManager() { + return _scummEventManager; +} + Audio::Mixer *OSystem_PS2::getMixer() { return _scummMixer; } @@ -643,11 +648,24 @@ void OSystem_PS2::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, i _screen->copyOverlayRect((uint16*)buf, (uint16)pitch, (uint16)x, (uint16)y, (uint16)w, (uint16)h); } +Graphics::PixelFormat OSystem_PS2::getOverlayFormat(void) const { + return _screen->getOverlayFormat(); +} + + +int16 OSystem_PS2::getOverlayWidth(void) { + return _screen->getOverlayWidth(); +} + +int16 OSystem_PS2::getOverlayHeight(void) { + return _screen->getOverlayHeight(); +} + Graphics::Surface *OSystem_PS2::lockScreen() { return _screen->lockScreen(); } -void OSystem_PS2::unlockScreen() { +void OSystem_PS2::unlockScreen(void) { _screen->unlockScreen(); } @@ -945,12 +963,12 @@ void OSystem_PS2::makeConfigPath() { _configFile = strdup(path); } -Common::SeekableReadStream *OSystem_PS2::openConfigFileForReading() { +Common::SeekableReadStream *OSystem_PS2::createConfigReadStream() { Common::FSNode file(_configFile); - return file.openForReading(); + return file.createReadStream(); } -Common::WriteStream *OSystem_PS2::openConfigFileForWriting() { +Common::WriteStream *OSystem_PS2::createConfigWriteStream() { Common::FSNode file(_configFile); - return file.openForWriting(); + return file.createWriteStream(); } diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h index ba3fc1b7ff..67f3078f59 100644 --- a/backends/platform/ps2/systemps2.h +++ b/backends/platform/ps2/systemps2.h @@ -29,6 +29,7 @@ #include "common/system.h" class DefaultTimerManager; +class DefaultEventManager; class DefaultSaveFileManager; class Gs2dScreen; @@ -71,13 +72,19 @@ public: virtual Graphics::Surface *lockScreen(); virtual void unlockScreen(); virtual void updateScreen(); + /* TODO : check */ + virtual void fillScreen(unsigned int i) { printf("fillScreen %d\n", i); }; + virtual void displayMessageOnOSD(const char *msg) { printf("displayMessageOnOSD: %s\n", msg); }; + /* */ virtual void showOverlay(); virtual void hideOverlay(); virtual void clearOverlay(); virtual void grabOverlay(OverlayColor *buf, int pitch); virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h); - + virtual int16 getOverlayWidth(void); + virtual int16 getOverlayHeight(void); + virtual bool showMouse(bool visible); virtual void warpMouse(int x, int y); @@ -86,6 +93,7 @@ public: virtual uint32 getMillis(); virtual void delayMillis(uint msecs); virtual Common::TimerManager *getTimerManager(); + virtual Common::EventManager *getEventManager(); virtual bool pollEvent(Common::Event &event); virtual Audio::Mixer *getMixer(); @@ -108,10 +116,10 @@ public: virtual void quit(); - virtual Common::SeekableReadStream *openConfigFileForReading(); - virtual Common::WriteStream *openConfigFileForWriting(); + virtual Common::SeekableReadStream *createConfigReadStream(); + virtual Common::WriteStream *createConfigWriteStream(); - virtual Graphics::PixelFormat getOverlayFormat() const { return Graphics::createPixelFormat<1555>(); } + virtual Graphics::PixelFormat getOverlayFormat() const; virtual Common::SaveFileManager *getSavefileManager(); virtual FilesystemFactory *getFilesystemFactory(); @@ -142,9 +150,9 @@ private: void readRtcTime(void); DefaultTimerManager *_scummTimerManager; + DefaultEventManager *_scummEventManager; Audio::MixerImpl *_scummMixer; - bool _mouseVisible; bool _useMouse, _useKbd, _useHdd, _usbMassLoaded, _useNet; |