[Scummvm-cvs-logs] SF.net SVN: scummvm:[39141] scummvm/trunk/backends/platform/ps2
sunmax at users.sourceforge.net
sunmax at users.sourceforge.net
Fri Mar 6 01:21:06 CET 2009
Revision: 39141
http://scummvm.svn.sourceforge.net/scummvm/?rev=39141&view=rev
Author: sunmax
Date: 2009-03-06 00:21:06 +0000 (Fri, 06 Mar 2009)
Log Message:
-----------
Implemented _overlayFormat in Gs2dScreen
Modified PS2FSNode openForReading -> createReadStream
openForWriting -> createWriteStream
Started Common::EventManager *OSystem::getEventManager()
on backend side...
Modified Paths:
--------------
scummvm/trunk/backends/platform/ps2/Gs2dScreen.cpp
scummvm/trunk/backends/platform/ps2/Gs2dScreen.h
scummvm/trunk/backends/platform/ps2/savefilemgr.cpp
scummvm/trunk/backends/platform/ps2/systemps2.cpp
scummvm/trunk/backends/platform/ps2/systemps2.h
Modified: scummvm/trunk/backends/platform/ps2/Gs2dScreen.cpp
===================================================================
--- scummvm/trunk/backends/platform/ps2/Gs2dScreen.cpp 2009-03-05 23:27:02 UTC (rev 39140)
+++ scummvm/trunk/backends/platform/ps2/Gs2dScreen.cpp 2009-03-06 00:21:06 UTC (rev 39141)
@@ -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 @@
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 @@
_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 @@
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 @@
_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 @@
}
uint8 Gs2dScreen::tvMode(void) {
- return _videoMode;
+ return _tvMode;
}
uint16 Gs2dScreen::getWidth(void) {
@@ -647,7 +671,7 @@
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) },
Modified: scummvm/trunk/backends/platform/ps2/Gs2dScreen.h
===================================================================
--- scummvm/trunk/backends/platform/ps2/Gs2dScreen.h 2009-03-05 23:27:02 UTC (rev 39140)
+++ scummvm/trunk/backends/platform/ps2/Gs2dScreen.h 2009-03-06 00:21:06 UTC (rev 39141)
@@ -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 @@
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 @@
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 @@
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 @@
uint16 *_overlayBuf;
uint8 *_screenBuf;
uint32 *_clut;
+ Graphics::PixelFormat _overlayFormat;
int _screenSema;
int _vblankStartId, _vblankEndId, _dmacId, _animTid;
Modified: scummvm/trunk/backends/platform/ps2/savefilemgr.cpp
===================================================================
--- scummvm/trunk/backends/platform/ps2/savefilemgr.cpp 2009-03-05 23:27:02 UTC (rev 39140)
+++ scummvm/trunk/backends/platform/ps2/savefilemgr.cpp 2009-03-06 00:21:06 UTC (rev 39141)
@@ -24,8 +24,10 @@
*/
#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>
#endif
@@ -124,7 +126,7 @@
if(!file.exists())
return NULL;
- sf = file.openForReading();
+ sf = file.createReadStream();
} else {
Common::FSNode file = savePath.getChild(filename);
@@ -132,12 +134,12 @@
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::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) {
Modified: scummvm/trunk/backends/platform/ps2/systemps2.cpp
===================================================================
--- scummvm/trunk/backends/platform/ps2/systemps2.cpp 2009-03-05 23:27:02 UTC (rev 39140)
+++ scummvm/trunk/backends/platform/ps2/systemps2.cpp 2009-03-06 00:21:06 UTC (rev 39141)
@@ -327,6 +327,7 @@
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 @@
return _scummTimerManager;
}
+Common::EventManager *OSystem_PS2::getEventManager() {
+ return _scummEventManager;
+}
+
Audio::Mixer *OSystem_PS2::getMixer() {
return _scummMixer;
}
@@ -643,11 +648,24 @@
_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 @@
_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();
}
Modified: scummvm/trunk/backends/platform/ps2/systemps2.h
===================================================================
--- scummvm/trunk/backends/platform/ps2/systemps2.h 2009-03-05 23:27:02 UTC (rev 39140)
+++ scummvm/trunk/backends/platform/ps2/systemps2.h 2009-03-06 00:21:06 UTC (rev 39141)
@@ -29,6 +29,7 @@
#include "common/system.h"
class DefaultTimerManager;
+class DefaultEventManager;
class DefaultSaveFileManager;
class Gs2dScreen;
@@ -71,13 +72,19 @@
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 @@
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 @@
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 @@
void readRtcTime(void);
DefaultTimerManager *_scummTimerManager;
+ DefaultEventManager *_scummEventManager;
Audio::MixerImpl *_scummMixer;
-
bool _mouseVisible;
bool _useMouse, _useKbd, _useHdd, _usbMassLoaded, _useNet;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list