aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/psp
diff options
context:
space:
mode:
authorJoost Peters2009-08-18 18:06:50 +0000
committerJoost Peters2009-08-18 18:06:50 +0000
commita35056b55531edcd384c3fa0dafc9a4ee6bfb6ee (patch)
tree98a7c1464a7e04fd11298a7c725cc804a9f35a7f /backends/platform/psp
parented2a733b2a9841f00e8ea2559193044cc4fca8b0 (diff)
downloadscummvm-rg350-a35056b55531edcd384c3fa0dafc9a4ee6bfb6ee.tar.gz
scummvm-rg350-a35056b55531edcd384c3fa0dafc9a4ee6bfb6ee.tar.bz2
scummvm-rg350-a35056b55531edcd384c3fa0dafc9a4ee6bfb6ee.zip
Implement setCursorPalette(), correct hasFeature() <-> getFeatureState() mixup.
svn-id: r43519
Diffstat (limited to 'backends/platform/psp')
-rw-r--r--backends/platform/psp/osys_psp.cpp6
-rw-r--r--backends/platform/psp/osys_psp.h1
-rw-r--r--backends/platform/psp/osys_psp_gu.cpp21
-rw-r--r--backends/platform/psp/osys_psp_gu.h2
4 files changed, 27 insertions, 3 deletions
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index d1886c253f..566db3014b 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -79,6 +79,8 @@ OSystem_PSP::OSystem_PSP() : _screenWidth(0), _screenHeight(0), _overlayWidth(0)
memset(_palette, 0, sizeof(_palette));
+ _cursorPaletteDisabled = true;
+
_samplesPerSec = 0;
//init SDL
@@ -110,14 +112,14 @@ void OSystem_PSP::initBackend() {
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 {
diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h
index 46607dac34..310efdc7d4 100644
--- a/backends/platform/psp/osys_psp.h
+++ b/backends/platform/psp/osys_psp.h
@@ -68,6 +68,7 @@ protected:
int _mouseHotspotX, _mouseHotspotY;
byte _mouseKeyColour;
byte *_mouseBuf;
+ bool _cursorPaletteDisabled;
uint32 _prevButtons;
uint32 _lastPadCheck;
diff --git a/backends/platform/psp/osys_psp_gu.cpp b/backends/platform/psp/osys_psp_gu.cpp
index 76f6b42e37..0fb1b4aded 100644
--- a/backends/platform/psp/osys_psp_gu.cpp
+++ b/backends/platform/psp/osys_psp_gu.cpp
@@ -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,6 +226,24 @@ void OSystem_PSP_GU::setPalette(const byte *colors, uint start, uint num) {
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
@@ -364,7 +383,7 @@ void OSystem_PSP_GU::updateScreen() {
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);
diff --git a/backends/platform/psp/osys_psp_gu.h b/backends/platform/psp/osys_psp_gu.h
index e828a36b7d..c221971fc8 100644
--- a/backends/platform/psp/osys_psp_gu.h
+++ b/backends/platform/psp/osys_psp_gu.h
@@ -47,6 +47,8 @@ public:
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;