[Scummvm-cvs-logs] SF.net SVN: scummvm:[43519] scummvm/trunk/backends/platform/psp

joostp at users.sourceforge.net joostp at users.sourceforge.net
Tue Aug 18 20:06:55 CEST 2009


Revision: 43519
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43519&view=rev
Author:   joostp
Date:     2009-08-18 18:06:50 +0000 (Tue, 18 Aug 2009)

Log Message:
-----------
Implement setCursorPalette(), correct hasFeature() <-> getFeatureState() mixup.

Modified Paths:
--------------
    scummvm/trunk/backends/platform/psp/osys_psp.cpp
    scummvm/trunk/backends/platform/psp/osys_psp.h
    scummvm/trunk/backends/platform/psp/osys_psp_gu.cpp
    scummvm/trunk/backends/platform/psp/osys_psp_gu.h

Modified: scummvm/trunk/backends/platform/psp/osys_psp.cpp
===================================================================
--- scummvm/trunk/backends/platform/psp/osys_psp.cpp	2009-08-18 17:20:28 UTC (rev 43518)
+++ scummvm/trunk/backends/platform/psp/osys_psp.cpp	2009-08-18 18:06:50 UTC (rev 43519)
@@ -79,6 +79,8 @@
 
 	memset(_palette, 0, sizeof(_palette));
 
+	_cursorPaletteDisabled = true;
+
 	_samplesPerSec = 0;
 
 	//init SDL
@@ -110,14 +112,14 @@
 
 
 bool OSystem_PSP::hasFeature(Feature f) {
-	return false;
+	return (f == kFeatureOverlaySupportsAlpha || f == kFeatureCursorHasPalette);
 }
 
 void OSystem_PSP::setFeatureState(Feature f, bool enable) {
 }
 
 bool OSystem_PSP::getFeatureState(Feature f) {
-	return (f == kFeatureOverlaySupportsAlpha);
+	return false;
 }
 
 const OSystem::GraphicsMode* OSystem_PSP::getSupportedGraphicsModes() const {

Modified: scummvm/trunk/backends/platform/psp/osys_psp.h
===================================================================
--- scummvm/trunk/backends/platform/psp/osys_psp.h	2009-08-18 17:20:28 UTC (rev 43518)
+++ scummvm/trunk/backends/platform/psp/osys_psp.h	2009-08-18 18:06:50 UTC (rev 43519)
@@ -68,6 +68,7 @@
 	int	_mouseHotspotX, _mouseHotspotY;
 	byte	_mouseKeyColour;
 	byte	*_mouseBuf;
+	bool	_cursorPaletteDisabled;
 
 	uint32	_prevButtons;
 	uint32	_lastPadCheck;

Modified: scummvm/trunk/backends/platform/psp/osys_psp_gu.cpp
===================================================================
--- scummvm/trunk/backends/platform/psp/osys_psp_gu.cpp	2009-08-18 17:20:28 UTC (rev 43518)
+++ scummvm/trunk/backends/platform/psp/osys_psp_gu.cpp	2009-08-18 18:06:50 UTC (rev 43519)
@@ -41,6 +41,7 @@
 unsigned int __attribute__((aligned(16))) list[262144];
 unsigned short __attribute__((aligned(16))) clut256[256];
 unsigned short __attribute__((aligned(16))) mouseClut[256];
+unsigned short __attribute__((aligned(16))) cursorPalette[256];
 unsigned short __attribute__((aligned(16))) kbClut[256];
 //unsigned int __attribute__((aligned(16))) offscreen256[640*480];
 //unsigned int __attribute__((aligned(16))) overlayBuffer256[640*480*2];
@@ -225,7 +226,25 @@
 	sceKernelDcacheWritebackAll();
 }
 
+void OSystem_PSP_GU::setCursorPalette(const byte *colors, uint start, uint num) {
+	const byte *b = colors;
 
+	for (uint i = 0; i < num; ++i) {
+		cursorPalette[start + i] = RGBToColour(b[0], b[1], b[2]);
+		b += 4;
+	}
+
+	cursorPalette[0] = 0;
+
+	_cursorPaletteDisabled = false;
+	
+	sceKernelDcacheWritebackAll();
+}
+
+void OSystem_PSP_GU::disableCursorPalette(bool disable) {
+	_cursorPaletteDisabled = disable;
+}
+
 void OSystem_PSP_GU::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
 	//Clip the coordinates
 	if (x < 0) {
@@ -364,7 +383,7 @@
 	if (_mouseVisible) {
 		sceGuTexMode(GU_PSM_T8, 0, 0, 0); // 8-bit image
 		sceGuClutMode(GU_PSM_5551, 0, 0xff, 0);
-		sceGuClutLoad(32, mouseClut); // upload 32*8 entries (256)
+		sceGuClutLoad(32, _cursorPaletteDisabled ? mouseClut : cursorPalette); // upload 32*8 entries (256)
 		sceGuAlphaFunc(GU_GREATER,0,0xff);
 		sceGuEnable(GU_ALPHA_TEST);
 		sceGuTexImage(0, MOUSE_SIZE, MOUSE_SIZE, MOUSE_SIZE, _mouseBuf);

Modified: scummvm/trunk/backends/platform/psp/osys_psp_gu.h
===================================================================
--- scummvm/trunk/backends/platform/psp/osys_psp_gu.h	2009-08-18 17:20:28 UTC (rev 43518)
+++ scummvm/trunk/backends/platform/psp/osys_psp_gu.h	2009-08-18 18:06:50 UTC (rev 43519)
@@ -47,6 +47,8 @@
 	void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, byte keycolor, int cursorTargetScale);
 	void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) ;
 	void setPalette(const byte *colors, uint start, uint num);
+	void setCursorPalette(const byte *colors, uint start, uint num);
+	void disableCursorPalette(bool disable);
 	bool pollEvent(Common::Event &event);
 	int _graphicMode;
 	struct Vertex *_vertices;


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