2010-04-12 06:49:05 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
* $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/backends/platform/psp/osys_psp.cpp $
|
|
|
|
* $Id: osys_psp.cpp 47541 2010-01-25 01:39:44Z lordhoto $
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <pspgu.h>
|
|
|
|
#include <pspdisplay.h>
|
2010-05-17 07:22:26 +00:00
|
|
|
#include <pspthreadman.h>
|
2010-04-12 06:49:05 +00:00
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "backends/base-backend.h"
|
2010-05-17 07:22:26 +00:00
|
|
|
#include "backends/platform/psp/psppixelformat.h"
|
2010-04-12 06:49:05 +00:00
|
|
|
#include "backends/platform/psp/display_client.h"
|
|
|
|
#include "backends/platform/psp/default_display_client.h"
|
|
|
|
#include "backends/platform/psp/cursor.h"
|
|
|
|
#include "backends/platform/psp/pspkeyboard.h"
|
2010-05-17 07:22:26 +00:00
|
|
|
|
2010-05-20 10:36:54 +00:00
|
|
|
#define USE_DISPLAY_CALLBACK // to use callback for finishing the render
|
2010-04-12 06:49:05 +00:00
|
|
|
#include "backends/platform/psp/display_manager.h"
|
|
|
|
|
|
|
|
#define PSP_BUFFER_WIDTH (512)
|
|
|
|
#define PSP_SCREEN_WIDTH 480
|
|
|
|
#define PSP_SCREEN_HEIGHT 272
|
|
|
|
#define PSP_FRAME_SIZE (PSP_BUFFER_WIDTH * PSP_SCREEN_HEIGHT)
|
|
|
|
|
2010-04-25 15:14:57 +00:00
|
|
|
//#define ENABLE_RENDER_MEASURE /* how long it takes to render a frame */
|
|
|
|
|
|
|
|
//#define __PSP_DEBUG_FUNCS__ /* For debugging function calls */
|
|
|
|
//#define __PSP_DEBUG_PRINT__ /* For debug printouts */
|
|
|
|
|
|
|
|
#include "backends/platform/psp/trace.h"
|
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
uint32 __attribute__((aligned(16))) MasterGuRenderer::_displayList[2048];
|
|
|
|
|
2010-04-12 07:28:54 +00:00
|
|
|
const OSystem::GraphicsMode DisplayManager::_supportedModes[] = {
|
2010-08-17 09:45:14 +00:00
|
|
|
{ "Original Resolution", "Original Resolution", ORIGINAL_RESOLUTION },
|
|
|
|
{ "Keep Aspect Ratio", "Keep Aspect Ratio", KEEP_ASPECT_RATIO },
|
|
|
|
{ "Full Screen", "Full Screen", STRETCHED_FULL_SCREEN },
|
2010-04-12 06:49:05 +00:00
|
|
|
{0, 0, 0}
|
|
|
|
};
|
|
|
|
|
|
|
|
// Class MasterGuRenderer ----------------------------------------------
|
|
|
|
|
2010-05-17 07:22:26 +00:00
|
|
|
void MasterGuRenderer::setupCallbackThread() {
|
|
|
|
DEBUG_ENTER_FUNC();
|
|
|
|
|
2010-08-03 12:29:08 +00:00
|
|
|
// start the thread that updates the display
|
|
|
|
threadCreateAndStart("DisplayCbThread", PRIORITY_DISPLAY_THREAD, STACK_DISPLAY_THREAD);
|
2010-05-17 07:22:26 +00:00
|
|
|
}
|
|
|
|
|
2010-08-03 12:29:08 +00:00
|
|
|
// this function gets called by PspThread when starting the new thread
|
|
|
|
void MasterGuRenderer::threadFunction() {
|
2010-05-17 07:22:26 +00:00
|
|
|
DEBUG_ENTER_FUNC();
|
|
|
|
|
2010-05-20 10:36:54 +00:00
|
|
|
// Create the callback. It should always get the pointer to MasterGuRenderer
|
2010-08-03 12:29:08 +00:00
|
|
|
_callbackId = sceKernelCreateCallback("Display Callback", guCallback, this);
|
|
|
|
if (_callbackId < 0) {
|
|
|
|
PSP_ERROR("failed to create display callback\n");
|
2010-05-17 07:22:26 +00:00
|
|
|
}
|
2010-05-20 10:36:54 +00:00
|
|
|
|
|
|
|
PSP_DEBUG_PRINT("created callback. Going to sleep\n");
|
2010-05-17 07:22:26 +00:00
|
|
|
|
2010-08-03 12:29:08 +00:00
|
|
|
sceKernelSleepThreadCB(); // sleep until we get a callback
|
2010-05-17 07:22:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// This callback is called when the render is finished. It swaps the buffers
|
2010-05-20 10:36:54 +00:00
|
|
|
int MasterGuRenderer::guCallback(int, int, void *__this) {
|
|
|
|
|
|
|
|
MasterGuRenderer *_this = (MasterGuRenderer *)__this;
|
|
|
|
|
|
|
|
sceGuSync(0, 0); // make sure we wait for GU to finish
|
|
|
|
sceDisplayWaitVblankStartCB(); // wait for v-blank without eating main thread cycles
|
|
|
|
sceGuSwapBuffers(); // swap the back and front buffers
|
|
|
|
|
|
|
|
_this->_renderFinished = true; // Only this thread can set the variable to true
|
|
|
|
|
|
|
|
return 0;
|
2010-05-17 07:22:26 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
void MasterGuRenderer::guInit() {
|
|
|
|
DEBUG_ENTER_FUNC();
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
sceGuInit();
|
|
|
|
sceGuStart(0, _displayList);
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
guProgramDisplayBufferSizes();
|
2010-04-12 07:28:54 +00:00
|
|
|
|
|
|
|
sceGuOffset(2048 - (PSP_SCREEN_WIDTH / 2), 2048 - (PSP_SCREEN_HEIGHT / 2));
|
2010-04-12 06:49:05 +00:00
|
|
|
sceGuViewport(2048, 2048, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
|
|
|
|
sceGuDepthRange(0xC350, 0x2710);
|
|
|
|
sceGuDisable(GU_DEPTH_TEST); // We'll use depth buffer area
|
|
|
|
sceGuDepthMask(GU_TRUE); // Prevent writes to depth buffer
|
|
|
|
sceGuScissor(0, 0, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
|
|
|
|
sceGuEnable(GU_SCISSOR_TEST);
|
|
|
|
sceGuFrontFace(GU_CW);
|
|
|
|
sceGuEnable(GU_TEXTURE_2D);
|
|
|
|
|
2010-04-12 07:28:54 +00:00
|
|
|
sceGuClear(GU_COLOR_BUFFER_BIT | GU_DEPTH_BUFFER_BIT);
|
2010-04-12 06:49:05 +00:00
|
|
|
sceGuFinish();
|
2010-04-12 07:28:54 +00:00
|
|
|
sceGuSync(0, 0);
|
2010-04-12 06:49:05 +00:00
|
|
|
|
|
|
|
sceDisplayWaitVblankStart();
|
|
|
|
sceGuDisplay(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MasterGuRenderer::guProgramDisplayBufferSizes() {
|
|
|
|
DEBUG_ENTER_FUNC();
|
|
|
|
|
|
|
|
PSP_DEBUG_PRINT("Outputbits[%u]\n", GuRenderer::_displayManager->getOutputBitsPerPixel());
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
switch (GuRenderer::_displayManager->getOutputBitsPerPixel()) {
|
|
|
|
case 16:
|
|
|
|
sceGuDrawBuffer(GU_PSM_4444, (void *)0, PSP_BUFFER_WIDTH);
|
|
|
|
sceGuDispBuffer(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT, (void*)(PSP_FRAME_SIZE * sizeof(uint16)), PSP_BUFFER_WIDTH);
|
|
|
|
sceGuDepthBuffer((void*)(PSP_FRAME_SIZE * sizeof(uint16) * 2), PSP_BUFFER_WIDTH);
|
|
|
|
VramAllocator::instance().allocate(PSP_FRAME_SIZE * sizeof(uint16) * 2);
|
|
|
|
break;
|
|
|
|
case 32:
|
|
|
|
sceGuDrawBuffer(GU_PSM_8888, (void *)0, PSP_BUFFER_WIDTH);
|
|
|
|
sceGuDispBuffer(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT, (void*)(PSP_FRAME_SIZE * sizeof(uint32)), PSP_BUFFER_WIDTH);
|
|
|
|
sceGuDepthBuffer((void*)(PSP_FRAME_SIZE * sizeof(uint32) * 2), PSP_BUFFER_WIDTH);
|
|
|
|
VramAllocator::instance().allocate(PSP_FRAME_SIZE * sizeof(uint32) * 2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// These are GU commands that should always stay the same
|
|
|
|
inline void MasterGuRenderer::guPreRender() {
|
|
|
|
DEBUG_ENTER_FUNC();
|
|
|
|
|
2010-05-17 07:22:26 +00:00
|
|
|
_renderFinished = false; // set to synchronize with callback thread
|
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
#ifdef ENABLE_RENDER_MEASURE
|
|
|
|
_lastRenderTime = g_system->getMillis();
|
2010-04-12 07:28:54 +00:00
|
|
|
#endif /* ENABLE_RENDER_MEASURE */
|
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
sceGuStart(0, _displayList);
|
|
|
|
|
|
|
|
sceGuClearColor(0xFF000000);
|
|
|
|
sceGuClear(GU_COLOR_BUFFER_BIT);
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
sceGuAmbientColor(0xFFFFFFFF);
|
|
|
|
sceGuColor(0xFFFFFFFF);
|
2010-04-12 07:28:54 +00:00
|
|
|
sceGuTexOffset(0, 0);
|
2010-04-12 06:49:05 +00:00
|
|
|
sceGuTexFilter(GU_LINEAR, GU_LINEAR);
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA); // Also good enough for all purposes
|
|
|
|
sceGuAlphaFunc(GU_GREATER, 0, 0xFF); // Also good enough for all purposes
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void MasterGuRenderer::guPostRender() {
|
|
|
|
DEBUG_ENTER_FUNC();
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
sceGuFinish();
|
2010-05-20 10:36:54 +00:00
|
|
|
#ifdef USE_DISPLAY_CALLBACK
|
|
|
|
if (_callbackId < 0)
|
|
|
|
PSP_ERROR("bad callbackId[%d]\n", _callbackId);
|
|
|
|
else
|
|
|
|
sceKernelNotifyCallback(_callbackId, 0); // notify the callback. Nothing extra to pass
|
|
|
|
#else
|
2010-05-17 07:22:26 +00:00
|
|
|
sceGuSync(0, 0);
|
2010-04-12 06:49:05 +00:00
|
|
|
|
|
|
|
#ifdef ENABLE_RENDER_MEASURE
|
|
|
|
uint32 now = g_system->getMillis();
|
|
|
|
PSP_INFO_PRINT("Render took %d milliseconds\n", now - _lastRenderTime);
|
|
|
|
#endif /* ENABLE_RENDER_MEASURE */
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
sceDisplayWaitVblankStart();
|
|
|
|
sceGuSwapBuffers();
|
2010-05-17 07:22:26 +00:00
|
|
|
_renderFinished = true;
|
|
|
|
#endif /* !USE_DISPLAY_CALLBACK */
|
2010-04-12 06:49:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MasterGuRenderer::guShutDown() {
|
|
|
|
sceGuTerm();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Class DisplayManager -----------------------------------------------------
|
|
|
|
|
|
|
|
DisplayManager::~DisplayManager() {
|
|
|
|
_masterGuRenderer.guShutDown();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DisplayManager::init() {
|
|
|
|
DEBUG_ENTER_FUNC();
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
_displayParams.outputBitsPerPixel = 32; // can be changed to produce 16-bit output
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
GuRenderer::setDisplayManager(this);
|
|
|
|
_screen->init();
|
|
|
|
_overlay->init();
|
|
|
|
_cursor->init();
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
_masterGuRenderer.guInit(); // start up the renderer
|
2010-05-17 07:22:26 +00:00
|
|
|
#ifdef USE_DISPLAY_CALLBACK
|
|
|
|
_masterGuRenderer.setupCallbackThread();
|
|
|
|
#endif
|
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DisplayManager::setSizeAndPixelFormat(uint width, uint height, const Graphics::PixelFormat *format) {
|
|
|
|
DEBUG_ENTER_FUNC();
|
|
|
|
PSP_DEBUG_PRINT("w[%u], h[%u], pformat[%p]\n", width, height, format);
|
|
|
|
|
|
|
|
_overlay->deallocate();
|
|
|
|
_screen->deallocate();
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
_screen->setScummvmPixelFormat(format);
|
|
|
|
_screen->setSize(width, height);
|
|
|
|
_screen->allocate();
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
_cursor->setScreenPaletteScummvmPixelFormat(format);
|
|
|
|
|
|
|
|
_overlay->setBytesPerPixel(sizeof(OverlayColor));
|
|
|
|
_overlay->setSize(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
|
|
|
|
_overlay->allocate();
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
_displayParams.screenSource.width = width;
|
|
|
|
_displayParams.screenSource.height = height;
|
|
|
|
calculateScaleParams();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DisplayManager::setGraphicsMode(const char *name) {
|
|
|
|
DEBUG_ENTER_FUNC();
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
while (_supportedModes[i].name) {
|
|
|
|
if (!strcmpi(_supportedModes[i].name, name)) {
|
|
|
|
setGraphicsMode(_supportedModes[i].id);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DisplayManager::setGraphicsMode(int mode) {
|
|
|
|
DEBUG_ENTER_FUNC();
|
|
|
|
|
|
|
|
_graphicsMode = mode;
|
|
|
|
|
2010-08-17 09:45:14 +00:00
|
|
|
calculateScaleParams();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DisplayManager::calculateScaleParams() {
|
|
|
|
|
|
|
|
if (!_displayParams.screenSource.width || !_displayParams.screenSource.height)
|
|
|
|
return; // we can't calculate anything without these
|
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
switch (_graphicsMode) {
|
2010-08-17 09:45:14 +00:00
|
|
|
case ORIGINAL_RESOLUTION:
|
|
|
|
// check if we can fit the original resolution inside the screen
|
|
|
|
if ((_displayParams.screenSource.width < PSP_SCREEN_WIDTH) &&
|
|
|
|
(_displayParams.screenSource.height < PSP_SCREEN_HEIGHT)) {
|
|
|
|
_displayParams.screenOutput.width = _displayParams.screenSource.width;
|
|
|
|
_displayParams.screenOutput.height = _displayParams.screenSource.height;
|
|
|
|
} else { // revert to stretch to fit
|
|
|
|
_displayParams.screenOutput.width = PSP_SCREEN_WIDTH;
|
|
|
|
_displayParams.screenOutput.height = PSP_SCREEN_HEIGHT;
|
|
|
|
}
|
2010-04-12 06:49:05 +00:00
|
|
|
break;
|
2010-08-17 09:45:14 +00:00
|
|
|
case KEEP_ASPECT_RATIO: { // maximize the height while keeping aspect ratio
|
|
|
|
float aspectRatio = (float)_displayParams.screenSource.width / (float)_displayParams.screenSource.height;
|
|
|
|
|
|
|
|
_displayParams.screenOutput.height = PSP_SCREEN_HEIGHT; // always full height
|
|
|
|
_displayParams.screenOutput.width = (uint32)(PSP_SCREEN_HEIGHT * aspectRatio);
|
|
|
|
|
|
|
|
if (_displayParams.screenOutput.width > PSP_SCREEN_WIDTH) // we can't have wider than the screen
|
|
|
|
_displayParams.screenOutput.width = PSP_SCREEN_WIDTH;
|
|
|
|
}
|
2010-04-12 06:49:05 +00:00
|
|
|
break;
|
2010-08-17 09:45:14 +00:00
|
|
|
case STRETCHED_FULL_SCREEN: // we simply stretch to the whole screen
|
|
|
|
_displayParams.screenOutput.width = PSP_SCREEN_WIDTH;
|
|
|
|
_displayParams.screenOutput.height = PSP_SCREEN_HEIGHT;
|
2010-04-12 06:49:05 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
PSP_ERROR("Unsupported graphics mode[%d].\n", _graphicsMode);
|
|
|
|
}
|
2010-08-17 09:45:14 +00:00
|
|
|
|
|
|
|
// calculate scale factors for X and Y
|
|
|
|
_displayParams.scaleX = ((float)_displayParams.screenOutput.width) / _displayParams.screenSource.width;
|
|
|
|
_displayParams.scaleY = ((float)_displayParams.screenOutput.height) / _displayParams.screenSource.height;
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
}
|
|
|
|
|
2010-06-09 14:15:51 +00:00
|
|
|
// return true if we really rendered or no dirty. False otherwise
|
|
|
|
bool DisplayManager::renderAll() {
|
2010-04-12 06:49:05 +00:00
|
|
|
DEBUG_ENTER_FUNC();
|
|
|
|
|
2010-05-17 07:22:26 +00:00
|
|
|
#ifdef USE_DISPLAY_CALLBACK
|
|
|
|
if (!_masterGuRenderer.isRenderFinished()) {
|
|
|
|
PSP_DEBUG_PRINT("Callback render not finished.\n");
|
2010-06-09 14:15:51 +00:00
|
|
|
return false; // didn't render
|
2010-05-17 07:22:26 +00:00
|
|
|
}
|
|
|
|
#endif /* USE_DISPLAY_CALLBACK */
|
|
|
|
|
2010-06-10 14:01:30 +00:00
|
|
|
// This is cheaper than checking time, so we do it first
|
2010-04-12 07:28:54 +00:00
|
|
|
if (!_screen->isDirty() &&
|
|
|
|
(!_overlay->isDirty()) &&
|
|
|
|
(!_cursor->isDirty()) &&
|
|
|
|
(!_keyboard->isDirty())) {
|
2010-04-12 06:49:05 +00:00
|
|
|
PSP_DEBUG_PRINT("Nothing dirty\n");
|
2010-06-09 14:15:51 +00:00
|
|
|
return true; // nothing to render
|
2010-04-12 06:49:05 +00:00
|
|
|
}
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-06-10 14:01:30 +00:00
|
|
|
if (!isTimeToUpdate())
|
|
|
|
return false; // didn't render
|
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
PSP_DEBUG_PRINT("screen[%s], overlay[%s], cursor[%s], keyboard[%s]\n",
|
2010-04-12 07:28:54 +00:00
|
|
|
_screen->isDirty() ? "true" : "false",
|
|
|
|
_overlay->isDirty() ? "true" : "false",
|
|
|
|
_cursor->isDirty() ? "true" : "false",
|
|
|
|
_keyboard->isDirty() ? "true" : "false"
|
|
|
|
);
|
2010-04-12 06:49:05 +00:00
|
|
|
|
|
|
|
_masterGuRenderer.guPreRender(); // Set up rendering
|
|
|
|
|
|
|
|
_screen->render();
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
_screen->setClean(); // clean out dirty bit
|
|
|
|
|
|
|
|
if (_overlay->isVisible())
|
|
|
|
_overlay->render();
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
_overlay->setClean();
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
if (_cursor->isVisible())
|
|
|
|
_cursor->render();
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
_cursor->setClean();
|
|
|
|
|
|
|
|
if (_keyboard->isVisible())
|
|
|
|
_keyboard->render();
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
_keyboard->setClean();
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
_masterGuRenderer.guPostRender();
|
2010-06-09 14:15:51 +00:00
|
|
|
|
|
|
|
return true; // rendered successfully
|
2010-04-12 06:49:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline bool DisplayManager::isTimeToUpdate() {
|
|
|
|
|
|
|
|
#define MAX_FPS 30
|
|
|
|
|
|
|
|
uint32 now = g_system->getMillis();
|
|
|
|
if (now - _lastUpdateTime < (1000 / MAX_FPS))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
_lastUpdateTime = now;
|
|
|
|
return true;
|
|
|
|
}
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-06-15 12:21:08 +00:00
|
|
|
Common::List<Graphics::PixelFormat> DisplayManager::getSupportedPixelFormats() const {
|
2010-04-12 06:49:05 +00:00
|
|
|
Common::List<Graphics::PixelFormat> list;
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
// In order of preference
|
|
|
|
list.push_back(PSPPixelFormat::convertToScummvmPixelFormat(PSPPixelFormat::Type_5650));
|
|
|
|
list.push_back(PSPPixelFormat::convertToScummvmPixelFormat(PSPPixelFormat::Type_5551));
|
|
|
|
list.push_back(PSPPixelFormat::convertToScummvmPixelFormat(PSPPixelFormat::Type_4444));
|
|
|
|
list.push_back(Graphics::PixelFormat::createFormatCLUT8());
|
2010-04-12 07:28:54 +00:00
|
|
|
|
2010-04-12 06:49:05 +00:00
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|