diff options
author | Yotam Barnoy | 2010-04-25 15:12:24 +0000 |
---|---|---|
committer | Yotam Barnoy | 2010-04-25 15:12:24 +0000 |
commit | f036b6b9d2a753c42354b78eb71ebfbd3d58cbc9 (patch) | |
tree | 6881c1687c807b49147d7ceb0a448fd3f4189b44 /backends/platform/psp | |
parent | aaaab9ec34bdb52d40b33295293fdbeab4568a93 (diff) | |
download | scummvm-rg350-f036b6b9d2a753c42354b78eb71ebfbd3d58cbc9.tar.gz scummvm-rg350-f036b6b9d2a753c42354b78eb71ebfbd3d58cbc9.tar.bz2 scummvm-rg350-f036b6b9d2a753c42354b78eb71ebfbd3d58cbc9.zip |
PSP:Implemented fingolfin's suggestion for cleaning up debugging code
svn-id: r48792
Diffstat (limited to 'backends/platform/psp')
-rw-r--r-- | backends/platform/psp/cursor.cpp | 32 | ||||
-rw-r--r-- | backends/platform/psp/default_display_client.cpp | 28 | ||||
-rw-r--r-- | backends/platform/psp/display_client.cpp | 48 | ||||
-rw-r--r-- | backends/platform/psp/display_manager.cpp | 19 | ||||
-rw-r--r-- | backends/platform/psp/input.cpp | 10 | ||||
-rw-r--r-- | backends/platform/psp/memory.cpp | 6 | ||||
-rw-r--r-- | backends/platform/psp/osys_psp.cpp | 94 | ||||
-rw-r--r-- | backends/platform/psp/powerman.cpp | 10 | ||||
-rw-r--r-- | backends/platform/psp/pspkeyboard.cpp | 35 | ||||
-rw-r--r-- | backends/platform/psp/psppixelformat.cpp | 2 | ||||
-rw-r--r-- | backends/platform/psp/trace.h | 32 |
11 files changed, 31 insertions, 285 deletions
diff --git a/backends/platform/psp/cursor.cpp b/backends/platform/psp/cursor.cpp index 8d1f6fec86..abd9166f7a 100644 --- a/backends/platform/psp/cursor.cpp +++ b/backends/platform/psp/cursor.cpp @@ -45,8 +45,6 @@ void Cursor::init() { _palette.setPixelFormats(PSPPixelFormat::Type_5551, PSPPixelFormat::Type_Palette_8bit); // default _screenPalette.setPixelFormats(PSPPixelFormat::Type_5551, PSPPixelFormat::Type_Palette_8bit); _buffer.setPixelFormat(PSPPixelFormat::Type_5551); - - DEBUG_EXIT_FUNC(); } void Cursor::deallocate() { @@ -55,8 +53,6 @@ void Cursor::deallocate() { _buffer.deallocate(); _palette.deallocate(); _screenPalette.deallocate(); - - DEBUG_EXIT_FUNC(); } void Cursor::setCursorPalette(const byte *colors, uint start, uint num) { @@ -73,8 +69,6 @@ void Cursor::setCursorPalette(const byte *colors, uint start, uint num) { _palette.setPartial(colors, start, num); setDirty(); - - DEBUG_EXIT_FUNC(); } void Cursor::setScreenPalette(const byte *colors, uint start, uint num) { @@ -86,8 +80,6 @@ void Cursor::setScreenPalette(const byte *colors, uint start, uint num) { _screenPalette.setPartial(colors, start, num); setDirty(); - - DEBUG_EXIT_FUNC(); } void Cursor::setKeyColor(uint32 color) { @@ -103,8 +95,6 @@ void Cursor::setKeyColor(uint32 color) { } // Don't need anything special for 16-bit _keyColor = color; - - DEBUG_EXIT_FUNC(); } void Cursor::clearKeyColor() { @@ -121,8 +111,6 @@ void Cursor::clearKeyColor() { _renderer.setKeyColor(_keyColor); } setDirty(); - - DEBUG_EXIT_FUNC(); } void Cursor::enableCursorPalette(bool enable) { @@ -136,7 +124,6 @@ void Cursor::enableCursorPalette(bool enable) { _renderer.setPalette(&_screenPalette); setDirty(); - DEBUG_EXIT_FUNC(); } inline void Cursor::setSize(uint32 width, uint32 height) { @@ -145,8 +132,6 @@ inline void Cursor::setSize(uint32 width, uint32 height) { _buffer.setSize(width, height, Buffer::kSizeByTextureSize); // we'll use texture size for mouse _renderer.setDrawWholeBuffer(); // We need to let the renderer know how much to draw - - DEBUG_EXIT_FUNC(); } void Cursor::copyFromArray(const byte *array) { @@ -161,9 +146,6 @@ void Cursor::copyFromArray(const byte *array) { // debug //PSP_DEBUG_DO(_buffer.print(0xF)); - - DEBUG_EXIT_FUNC(); - } void Cursor::setHotspot(int32 x, int32 y) { @@ -174,7 +156,6 @@ void Cursor::setHotspot(int32 x, int32 y) { updateRendererOffset(); // Important PSP_DEBUG_PRINT("hotspotX[%d], hotspotY[%d]\n", x, y); - DEBUG_EXIT_FUNC(); } // Returns true if change in x or y @@ -204,11 +185,9 @@ bool Cursor::increaseXY(int32 incX, int32 incY) { if (oldX != _x || oldY != _y) { updateRendererOffset(); setDirty(); - DEBUG_EXIT_FUNC(); return true; } - DEBUG_EXIT_FUNC(); return false; } @@ -221,8 +200,6 @@ void Cursor::setLimits(uint32 width, uint32 height) { PSP_DEBUG_PRINT("width[%u], height[%u]\n", width, height); _mouseLimitWidth = width; _mouseLimitHeight = height; - - DEBUG_EXIT_FUNC(); } // Adjust X,Y movement for the screen size to keep it consistent @@ -253,8 +230,6 @@ inline void Cursor::adjustXYForScreenSize(int32 &x, int32 &y) { x = newX; y = newY; } - - DEBUG_EXIT_FUNC(); } // This is only called when we have a new screen @@ -280,8 +255,6 @@ void Cursor::setScreenPaletteScummvmPixelFormat(const Graphics::PixelFormat *for _palette.setPixelFormats(paletteType, bufferType); setRendererModePalettized(true); // use palettized mechanism } - - DEBUG_EXIT_FUNC(); } // This is called many many times @@ -331,8 +304,6 @@ void Cursor::setSizeAndScummvmPixelFormat(uint32 width, uint32 height, const Gra // debug // PSP_DEBUG_DO(_palette.print(10)); // PSP_DEBUG_DO(_screenPalette.print(10)); - - DEBUG_EXIT_FUNC(); } void Cursor::setXY(int x, int y) { @@ -342,14 +313,11 @@ void Cursor::setXY(int x, int y) { _y = y; updateRendererOffset(); // Very important to let renderer know things changed setDirty(); - - DEBUG_EXIT_FUNC(); } inline void Cursor::updateRendererOffset() { DEBUG_ENTER_FUNC(); _renderer.setOffsetOnScreen(_x - _hotspotX, _y - _hotspotY); - DEBUG_EXIT_FUNC(); } inline void Cursor::setRendererModePalettized(bool palettized) { diff --git a/backends/platform/psp/default_display_client.cpp b/backends/platform/psp/default_display_client.cpp index 7f2529483c..b6ce08ca49 100644 --- a/backends/platform/psp/default_display_client.cpp +++ b/backends/platform/psp/default_display_client.cpp @@ -39,7 +39,6 @@ bool DefaultDisplayClient::allocate(bool bufferInVram /* = false */, bool palett if (!_buffer.allocate(bufferInVram)) { PSP_ERROR("Couldn't allocate buffer.\n"); - DEBUG_EXIT_FUNC(); return false; } @@ -47,13 +46,11 @@ bool DefaultDisplayClient::allocate(bool bufferInVram /* = false */, bool palett PSP_DEBUG_PRINT("_palette[%p]\n", &_palette); if (!_palette.allocate()) { - PSP_ERROR("Couldn't allocate pallette.\n"); - DEBUG_EXIT_FUNC(); + PSP_ERROR("Couldn't allocate palette.\n"); return false; } } - DEBUG_EXIT_FUNC(); return true; } @@ -68,34 +65,29 @@ void DefaultDisplayClient::clearBuffer() { DEBUG_ENTER_FUNC(); _buffer.clear(); setDirty(); - DEBUG_EXIT_FUNC(); } inline void DefaultDisplayClient::clearPalette() { DEBUG_ENTER_FUNC(); _palette.clear(); setDirty(); - DEBUG_EXIT_FUNC(); } void DefaultDisplayClient::init() { DEBUG_ENTER_FUNC(); _renderer.setBuffer(&_buffer); _renderer.setPalette(&_palette); - DEBUG_EXIT_FUNC(); } void DefaultDisplayClient::copyFromRect(const byte *buf, int pitch, int destX, int destY, int recWidth, int recHeight) { DEBUG_ENTER_FUNC(); _buffer.copyFromRect(buf, pitch, destX, destY, recWidth, recHeight); setDirty(); - DEBUG_EXIT_FUNC(); } void DefaultDisplayClient::copyToArray(byte *dst, int pitch) { DEBUG_ENTER_FUNC(); _buffer.copyToArray(dst, pitch); - DEBUG_EXIT_FUNC(); } // Class Overlay ------------------------------------------------------- @@ -108,8 +100,6 @@ void Overlay::init() { _renderer.setColorTest(false); _renderer.setUseGlobalScaler(false); _renderer.setFullScreen(true); // speeds up render slightly - - DEBUG_EXIT_FUNC(); } void Overlay::setBytesPerPixel(uint32 size) { @@ -127,21 +117,17 @@ void Overlay::setBytesPerPixel(uint32 size) { _buffer.setPixelFormat(PSPPixelFormat::Type_8888); break; } - - DEBUG_EXIT_FUNC(); } void Overlay::setSize(uint32 width, uint32 height) { DEBUG_ENTER_FUNC(); _buffer.setSize(width, height, Buffer::kSizeBySourceSize); _renderer.setDrawWholeBuffer(); // We need to let the renderer know how much to draw - DEBUG_EXIT_FUNC(); } void Overlay::copyToArray(OverlayColor *buf, int pitch) { DEBUG_ENTER_FUNC(); _buffer.copyToArray((byte *)buf, pitch * sizeof(OverlayColor)); // Change to bytes - DEBUG_EXIT_FUNC(); } void Overlay::copyFromRect(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { @@ -151,7 +137,6 @@ void Overlay::copyFromRect(const OverlayColor *buf, int pitch, int x, int y, int // debug //_buffer.print(0xFF); setDirty(); - DEBUG_EXIT_FUNC(); } bool Overlay::allocate() { @@ -159,7 +144,6 @@ bool Overlay::allocate() { bool ret = DefaultDisplayClient::allocate(true, false); // buffer in VRAM - DEBUG_EXIT_FUNC(); return ret; } @@ -173,8 +157,6 @@ void Screen::init() { _renderer.setColorTest(false); _renderer.setUseGlobalScaler(true); _renderer.setFullScreen(true); - - DEBUG_EXIT_FUNC(); } void Screen::setShakePos(int pos) { @@ -188,8 +170,6 @@ void Screen::setSize(uint32 width, uint32 height) { _buffer.setSize(width, height, Buffer::kSizeBySourceSize); _renderer.setDrawWholeBuffer(); // We need to let the renderer know how much to draw - - DEBUG_EXIT_FUNC(); } void Screen::setScummvmPixelFormat(const Graphics::PixelFormat *format) { @@ -209,8 +189,6 @@ void Screen::setScummvmPixelFormat(const Graphics::PixelFormat *format) { PSPPixelFormat::convertFromScummvmPixelFormat(format, bufferFormat, paletteFormat, swapRedBlue); _buffer.setPixelFormat(bufferFormat, swapRedBlue); _palette.setPixelFormats(paletteFormat, bufferFormat, swapRedBlue); - - DEBUG_EXIT_FUNC(); } Graphics::Surface *Screen::lockAndGetForEditing() { @@ -223,8 +201,6 @@ Graphics::Surface *Screen::lockAndGetForEditing() { _frameBuffer.bytesPerPixel = _buffer.getBytesPerPixel(); // We'll set to dirty once we unlock the screen - DEBUG_EXIT_FUNC(); - return &_frameBuffer; } @@ -232,6 +208,4 @@ bool Screen::allocate() { DEBUG_ENTER_FUNC(); return DefaultDisplayClient::allocate(true, false); // buffer in VRAM - - DEBUG_EXIT_FUNC(); } diff --git a/backends/platform/psp/display_client.cpp b/backends/platform/psp/display_client.cpp index 44998e4969..ab4e649708 100644 --- a/backends/platform/psp/display_client.cpp +++ b/backends/platform/psp/display_client.cpp @@ -53,8 +53,6 @@ void Palette::clear() { memset(_values, 0, getSizeInBytes()); PSP_DEBUG_PRINT("_values[%p]\n", _values); - - DEBUG_EXIT_FUNC(); } // Used to clear the specific keycolor @@ -87,8 +85,6 @@ void Palette::setColorPositionAlpha(uint32 position, bool alpha) { default: PSP_ERROR("Incorrect bits per pixel value[%u]\n", _pixelFormat.bitsPerPixel); } - - DEBUG_EXIT_FUNC(); } // Set some of the palette to color values in array @@ -125,8 +121,6 @@ void Palette::setPartial(const byte *colors, uint32 start, uint32 num, bool supp palette++; } } - - DEBUG_EXIT_FUNC(); } // Sets pixel format and number of entries by the buffer's pixel format */ @@ -153,8 +147,6 @@ void Palette::setPixelFormats(PSPPixelFormat::Type paletteType, PSPPixelFormat:: } _pixelFormat.set(paletteType, swapRedBlue); - - DEBUG_EXIT_FUNC(); } bool Palette::allocate() { @@ -179,14 +171,12 @@ bool Palette::allocate() { if (!_values) { PSP_ERROR("Couldn't allocate palette.\n"); - DEBUG_EXIT_FUNC(); return false; } PSP_DEBUG_PRINT("_values[%p]\n", _values); clear(); - DEBUG_EXIT_FUNC(); return true; } @@ -196,8 +186,6 @@ void Palette::deallocate() { free(CACHED(_values)); _values = 0; _numOfEntries = 0; - - DEBUG_EXIT_FUNC(); } // Copy some of the palette to an array of colors @@ -240,8 +228,6 @@ void Palette::getPartial(byte *colors, uint start, uint num) { palette++; } } - - DEBUG_EXIT_FUNC(); } void Palette::setSingleColorRGBA(uint32 num, byte r, byte g, byte b, byte a) { @@ -265,7 +251,6 @@ void Palette::setSingleColorRGBA(uint32 num, byte r, byte g, byte b, byte a) { PSP_ERROR("Incorrect bitsPerPixel[%d]\n", _pixelFormat.bitsPerPixel); break; } - // DEBUG_EXIT_FUNC(); } // Print to screen @@ -326,8 +311,6 @@ void Buffer::copyFromArray(const byte *buffer, int pitch) { // We use sourceSize because outside, they won't know what the true size is copyFromRect(buffer, pitch, 0, 0, _sourceSize.width, _sourceSize.height); - - DEBUG_EXIT_FUNC(); } /* pitch is in bytes */ @@ -345,7 +328,6 @@ void Buffer::copyFromRect(const byte *buf, uint32 pitch, int destX, int destY, u } if (recWidth <= 0 || recHeight <= 0) { - DEBUG_EXIT_FUNC(); return; } @@ -365,8 +347,6 @@ void Buffer::copyFromRect(const byte *buf, uint32 pitch, int destX, int destY, u dst += realWidthInBytes; } while (--recHeight); } - - DEBUG_EXIT_FUNC(); } /* pitch is in bytes */ @@ -385,8 +365,6 @@ void Buffer::copyToArray(byte *dst, int pitch) { src += realWidthInBytes; dst += pitch; } while (--h); - - DEBUG_EXIT_FUNC(); } /* We can size the buffer either by texture size (multiple of 2^n) or source size. The GU can @@ -408,8 +386,6 @@ void Buffer::setSize(uint32 width, uint32 height, HowToSize textureOrSource/*=kS _width = _sourceSize.width; _height = _sourceSize.height; } - - DEBUG_EXIT_FUNC(); } /* Scale a dimension (width/height) up to power of 2 for the texture */ @@ -462,7 +438,6 @@ bool Buffer::allocate(bool inVram/*=false*/) { if (!_pixels) { PSP_ERROR("couldn't allocate buffer.\n"); - DEBUG_EXIT_FUNC(); return false; } @@ -471,7 +446,6 @@ bool Buffer::allocate(bool inVram/*=false*/) { _pixels = UNCACHED(_pixels); clear(); - DEBUG_EXIT_FUNC(); return true; } @@ -487,8 +461,6 @@ void Buffer::deallocate() { free(CACHED(_pixels)); _pixels = 0; - - DEBUG_EXIT_FUNC(); } void Buffer::clear() { @@ -496,8 +468,6 @@ void Buffer::clear() { if (_pixels) memset(_pixels, 0, getSizeInBytes()); - - DEBUG_EXIT_FUNC(); } /* Convert 4 bit images to match weird PSP format */ @@ -517,8 +487,6 @@ void Buffer::flipNibbles() { *dest++ = ((val >> 4) & 0x0F0F0F0F) | ((val << 4) & 0xF0F0F0F0); } } - - DEBUG_EXIT_FUNC(); } // Print buffer contents to screen (only source size is printed out) @@ -585,8 +553,6 @@ void GuRenderer::render() { guDrawVertices(vertices); } - - DEBUG_EXIT_FUNC(); } inline void GuRenderer::setMaxTextureOffsetByIndex(uint32 x, uint32 y) { @@ -595,7 +561,6 @@ inline void GuRenderer::setMaxTextureOffsetByIndex(uint32 x, uint32 y) { _maxTextureOffset.x = x << maxTextureSizeShift; /* x times 512 */ _maxTextureOffset.y = y << maxTextureSizeShift; /* y times 512 */ - DEBUG_EXIT_FUNC(); } inline void GuRenderer::guProgramDrawBehavior() { @@ -618,8 +583,6 @@ inline void GuRenderer::guProgramDrawBehavior() { sceGuColorFunc(GU_NOTEQUAL, _keyColor, 0x00ffffff); } else sceGuDisable(GU_COLOR_TEST); - - DEBUG_EXIT_FUNC(); } inline void GuRenderer::guLoadPalette() { @@ -639,8 +602,6 @@ inline void GuRenderer::guLoadPalette() { sceGuClutMode(convertToGuPixelFormat(_palette->getPixelFormat()), 0, mask, 0); sceGuClutLoad(_palette->getNumOfEntries() >> 3, _palette->getRawValues()); - - DEBUG_EXIT_FUNC(); } inline void GuRenderer::guProgramTextureFormat() { @@ -648,7 +609,6 @@ inline void GuRenderer::guProgramTextureFormat() { PSP_DEBUG_PRINT("pixelFormat[%d]\n", _buffer->getPixelFormat()); sceGuTexMode(convertToGuPixelFormat(_buffer->getPixelFormat()), 0, 0, 0); - DEBUG_EXIT_FUNC(); } inline uint32 GuRenderer::convertToGuPixelFormat(PSPPixelFormat::Type format) { @@ -681,17 +641,13 @@ inline uint32 GuRenderer::convertToGuPixelFormat(PSPPixelFormat::Type format) { PSP_DEBUG_PRINT("Pixelformat[%d], guFormat[%d]\n", format, guFormat); - DEBUG_EXIT_FUNC(); return guFormat; - } inline void GuRenderer::guLoadTexture() { DEBUG_ENTER_FUNC(); sceGuTexImage(0, _buffer->getTextureWidth(), _buffer->getTextureHeight(), _buffer->getWidth(), _buffer->getPixels() + _buffer->_pixelFormat.pixelsToBytes(_maxTextureOffset.x)); - - DEBUG_EXIT_FUNC(); } inline Vertex *GuRenderer::guGetVertices() { @@ -699,7 +655,6 @@ inline Vertex *GuRenderer::guGetVertices() { Vertex *ret = (Vertex *)sceGuGetMemory(2 * sizeof(Vertex)); - DEBUG_EXIT_FUNC(); return ret; } @@ -759,8 +714,6 @@ void GuRenderer::fillVertices(Vertex *vertices) { PSP_DEBUG_PRINT("TextureStart: X[%f] Y[%f] TextureEnd: X[%.1f] Y[%.1f]\n", textureStartX, textureStartY, textureEndX, textureEndY); PSP_DEBUG_PRINT("ImageStart: X[%f] Y[%f] ImageEnd: X[%.1f] Y[%.1f]\n", imageStartX, imageStartY, imageEndX, imageEndY); - - DEBUG_EXIT_FUNC(); } /* Scale the input X offset to appear in proper position on the screen */ @@ -795,7 +748,6 @@ inline void GuRenderer::guDrawVertices(Vertex *vertices) { DEBUG_ENTER_FUNC(); sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF | GU_VERTEX_32BITF | GU_TRANSFORM_2D, 2, 0, vertices); - DEBUG_EXIT_FUNC(); } void GuRenderer::cacheInvalidate(void *pointer, uint32 size) { diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp index 0bec1c6278..890e683559 100644 --- a/backends/platform/psp/display_manager.cpp +++ b/backends/platform/psp/display_manager.cpp @@ -83,8 +83,6 @@ void MasterGuRenderer::guInit() { sceDisplayWaitVblankStart(); sceGuDisplay(1); - - DEBUG_EXIT_FUNC(); } void MasterGuRenderer::guProgramDisplayBufferSizes() { @@ -106,8 +104,6 @@ void MasterGuRenderer::guProgramDisplayBufferSizes() { VramAllocator::instance().allocate(PSP_FRAME_SIZE * sizeof(uint32) * 2); break; } - - DEBUG_EXIT_FUNC(); } // These are GU commands that should always stay the same @@ -130,8 +126,6 @@ inline void MasterGuRenderer::guPreRender() { sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA); // Also good enough for all purposes sceGuAlphaFunc(GU_GREATER, 0, 0xFF); // Also good enough for all purposes - - DEBUG_EXIT_FUNC(); } inline void MasterGuRenderer::guPostRender() { @@ -147,8 +141,6 @@ inline void MasterGuRenderer::guPostRender() { sceDisplayWaitVblankStart(); sceGuSwapBuffers(); - - DEBUG_EXIT_FUNC(); } void MasterGuRenderer::guShutDown() { @@ -173,8 +165,6 @@ void DisplayManager::init() { _cursor->init(); _masterGuRenderer.guInit(); // start up the renderer - - DEBUG_EXIT_FUNC(); } void DisplayManager::setSizeAndPixelFormat(uint width, uint height, const Graphics::PixelFormat *format) { @@ -198,8 +188,6 @@ void DisplayManager::setSizeAndPixelFormat(uint width, uint height, const Graphi _displayParams.screenSource.width = width; _displayParams.screenSource.height = height; calculateScaleParams(); - - DEBUG_EXIT_FUNC(); } bool DisplayManager::setGraphicsMode(const char *name) { @@ -210,13 +198,11 @@ bool DisplayManager::setGraphicsMode(const char *name) { while (_supportedModes[i].name) { if (!strcmpi(_supportedModes[i].name, name)) { setGraphicsMode(_supportedModes[i].id); - DEBUG_EXIT_FUNC(); return true; } i++; } - DEBUG_EXIT_FUNC(); return false; } @@ -248,7 +234,6 @@ bool DisplayManager::setGraphicsMode(int mode) { calculateScaleParams(); - DEBUG_EXIT_FUNC(); return true; } @@ -264,7 +249,6 @@ void DisplayManager::renderAll() { DEBUG_ENTER_FUNC(); if (!isTimeToUpdate()) { - DEBUG_EXIT_FUNC(); return; } @@ -273,7 +257,6 @@ void DisplayManager::renderAll() { (!_cursor->isDirty()) && (!_keyboard->isDirty())) { PSP_DEBUG_PRINT("Nothing dirty\n"); - DEBUG_EXIT_FUNC(); return; } @@ -306,8 +289,6 @@ void DisplayManager::renderAll() { _keyboard->setClean(); _masterGuRenderer.guPostRender(); - - DEBUG_EXIT_FUNC(); } inline bool DisplayManager::isTimeToUpdate() { diff --git a/backends/platform/psp/input.cpp b/backends/platform/psp/input.cpp index be0530ecf1..6e747a430f 100644 --- a/backends/platform/psp/input.cpp +++ b/backends/platform/psp/input.cpp @@ -55,7 +55,6 @@ bool InputHandler::getAllInputs(Common::Event &event) { uint32 time = g_system->getMillis(); // may not be necessary with read if (time - _lastPadCheckTime < PAD_CHECK_TIME) { - DEBUG_EXIT_FUNC(); return false; } @@ -78,8 +77,6 @@ bool InputHandler::getAllInputs(Common::Event &event) { PSP_DEBUG_PRINT("event.type[%d]\n", event.type); } - DEBUG_EXIT_FUNC(); - return haveEvent; } @@ -100,7 +97,6 @@ bool InputHandler::getEvent(Common::Event &event, SceCtrlData &pad) { _prevButtons = pad.Buttons; - DEBUG_EXIT_FUNC(); return haveEvent; } @@ -156,7 +152,6 @@ bool InputHandler::getDpadEvent(Common::Event &event, SceCtrlData &pad) { haveEvent = true; } - DEBUG_EXIT_FUNC(); return haveEvent; } @@ -185,7 +180,6 @@ inline Common::KeyCode InputHandler::translateDpad(int x, int y) { key = Common::KEYCODE_KP9; } - DEBUG_EXIT_FUNC(); return key; } @@ -238,7 +232,6 @@ bool InputHandler::getButtonEvent(Common::Event &event, SceCtrlData &pad) { haveEvent = true; } - DEBUG_EXIT_FUNC(); return haveEvent; } @@ -292,7 +285,6 @@ bool InputHandler::getNubEvent(Common::Event &event, SceCtrlData &pad) { PSP_DEBUG_PRINT("Nub event. X[%d], Y[%d]\n", newX, newY); } } - DEBUG_EXIT_FUNC(); return haveEvent; } @@ -309,7 +301,5 @@ inline int32 InputHandler::modifyNubAxisMotion(int32 input) { else // between these points, dampen the response to 0 input = 0; - - DEBUG_EXIT_FUNC(); return input; } diff --git a/backends/platform/psp/memory.cpp b/backends/platform/psp/memory.cpp index ba7645cf56..e134a7d0f4 100644 --- a/backends/platform/psp/memory.cpp +++ b/backends/platform/psp/memory.cpp @@ -72,7 +72,6 @@ void Copier::copy(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat *form if (bytes > prefixDst) // check that we can afford to subtract from bytes bytes -= prefixDst; else { - DEBUG_EXIT_FUNC(); return; } dst32 = (uint32 *)(dst + prefixDst); @@ -126,7 +125,7 @@ test: PSP_DEBUG_PRINT("\n"); #endif - DEBUG_EXIT_FUNC(); + return; // So we have something to jump to with the label } inline void Copier::copy8(byte *dst, const byte *src, uint32 bytes) { @@ -200,7 +199,6 @@ void *VramAllocator::allocate(int32 size, bool smallAllocation /* = false */) { PSP_DEBUG_PRINT("Allocated in VRAM, size %u at %p.\n", size, lastAddress); PSP_DEBUG_PRINT("Total allocated %u, remaining %u.\n", _bytesAllocated, (2 * 1024 * 1024) - _bytesAllocated); - DEBUG_EXIT_FUNC(); return lastAddress; } @@ -217,11 +215,9 @@ void VramAllocator::deallocate(void *address) { _bytesAllocated -= (*i).size; _allocList.erase(i); PSP_DEBUG_PRINT("Deallocated address[%p], size[%u]\n", (*i).address, (*i).size); - DEBUG_EXIT_FUNC(); return; } } PSP_DEBUG_PRINT("Address[%p] not allocated.\n", address); - DEBUG_EXIT_FUNC(); } diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index bd81c14072..db1f9fb716 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -97,8 +97,6 @@ void OSystem_PSP::initBackend() { setupMixer(); OSystem::initBackend(); - - DEBUG_EXIT_FUNC(); } bool OSystem_PSP::hasFeature(Feature f) { @@ -118,38 +116,22 @@ const OSystem::GraphicsMode* OSystem_PSP::getSupportedGraphicsModes() const { int OSystem_PSP::getDefaultGraphicsMode() const { DEBUG_ENTER_FUNC(); - - int ret = _displayManager.getDefaultGraphicsMode(); - - DEBUG_EXIT_FUNC(); - return ret; + return _displayManager.getDefaultGraphicsMode(); } bool OSystem_PSP::setGraphicsMode(int mode) { DEBUG_ENTER_FUNC(); - - int ret = _displayManager.setGraphicsMode(mode); - - DEBUG_EXIT_FUNC(); - return ret; + return _displayManager.setGraphicsMode(mode); } bool OSystem_PSP::setGraphicsMode(const char *name) { DEBUG_ENTER_FUNC(); - - int ret = _displayManager.setGraphicsMode(name); - - DEBUG_EXIT_FUNC(); - return ret; + return _displayManager.setGraphicsMode(name); } int OSystem_PSP::getGraphicsMode() const { DEBUG_ENTER_FUNC(); - - int ret = _displayManager.getGraphicsMode(); - - DEBUG_EXIT_FUNC(); - return ret; + return _displayManager.getGraphicsMode(); } #ifdef USE_RGB_COLOR @@ -166,144 +148,94 @@ Common::List<Graphics::PixelFormat> OSystem_PSP::getSupportedFormats() { void OSystem_PSP::initSize(uint width, uint height, const Graphics::PixelFormat *format) { DEBUG_ENTER_FUNC(); - _displayManager.setSizeAndPixelFormat(width, height, format); _cursor.setVisible(false); _cursor.setLimits(_screen.getWidth(), _screen.getHeight()); - - DEBUG_EXIT_FUNC(); } int16 OSystem_PSP::getWidth() { DEBUG_ENTER_FUNC(); - - int16 ret = (int16)_screen.getWidth(); - - DEBUG_EXIT_FUNC(); - return ret; + return (int16)_screen.getWidth(); } int16 OSystem_PSP::getHeight() { DEBUG_ENTER_FUNC(); - - int16 ret = (int16)_screen.getHeight(); - - DEBUG_EXIT_FUNC(); - return ret; + return (int16)_screen.getHeight(); } void OSystem_PSP::setPalette(const byte *colors, uint start, uint num) { DEBUG_ENTER_FUNC(); - _screen.setPartialPalette(colors, start, num); _cursor.setScreenPalette(colors, start, num); _cursor.clearKeyColor(); - - DEBUG_EXIT_FUNC(); } void OSystem_PSP::setCursorPalette(const byte *colors, uint start, uint num) { DEBUG_ENTER_FUNC(); - _cursor.setCursorPalette(colors, start, num); _cursor.enableCursorPalette(true); _cursor.clearKeyColor(); // Do we need this? - - DEBUG_EXIT_FUNC(); } void OSystem_PSP::disableCursorPalette(bool disable) { DEBUG_ENTER_FUNC(); - _cursor.enableCursorPalette(!disable); - - DEBUG_EXIT_FUNC(); } void OSystem_PSP::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { DEBUG_ENTER_FUNC(); - _screen.copyFromRect(buf, pitch, x, y, w, h); - - DEBUG_EXIT_FUNC(); } Graphics::Surface *OSystem_PSP::lockScreen() { DEBUG_ENTER_FUNC(); - - Graphics::Surface *ret = _screen.lockAndGetForEditing(); - - DEBUG_EXIT_FUNC(); - return ret; + return _screen.lockAndGetForEditing(); } void OSystem_PSP::unlockScreen() { DEBUG_ENTER_FUNC(); // The screen is always completely updated anyway, so we don't have to force a full update here. _screen.unlock(); - - DEBUG_EXIT_FUNC(); } void OSystem_PSP::updateScreen() { DEBUG_ENTER_FUNC(); - _displayManager.renderAll(); - - DEBUG_EXIT_FUNC(); } void OSystem_PSP::setShakePos(int shakeOffset) { DEBUG_ENTER_FUNC(); - _screen.setShakePos(shakeOffset); - - DEBUG_EXIT_FUNC(); } void OSystem_PSP::showOverlay() { DEBUG_ENTER_FUNC(); - _overlay.setVisible(true); _cursor.setLimits(_overlay.getWidth(), _overlay.getHeight()); _cursor.useGlobalScaler(false); // mouse with overlay is 1:1 - - DEBUG_EXIT_FUNC(); } void OSystem_PSP::hideOverlay() { DEBUG_ENTER_FUNC(); - _overlay.setVisible(false); _cursor.setLimits(_screen.getWidth(), _screen.getHeight()); _cursor.useGlobalScaler(true); // mouse needs to be scaled with screen - - DEBUG_EXIT_FUNC(); } void OSystem_PSP::clearOverlay() { DEBUG_ENTER_FUNC(); - _overlay.clearBuffer(); - - DEBUG_EXIT_FUNC(); } void OSystem_PSP::grabOverlay(OverlayColor *buf, int pitch) { DEBUG_ENTER_FUNC(); - _overlay.copyToArray(buf, pitch); - - DEBUG_EXIT_FUNC(); } void OSystem_PSP::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { DEBUG_ENTER_FUNC(); - _overlay.copyFromRect(buf, pitch, x, y, w, h); - - DEBUG_EXIT_FUNC(); } int16 OSystem_PSP::getOverlayWidth() { @@ -316,35 +248,25 @@ int16 OSystem_PSP::getOverlayHeight() { void OSystem_PSP::grabPalette(byte *colors, uint start, uint num) { DEBUG_ENTER_FUNC(); - _screen.getPartialPalette(colors, start, num); - - DEBUG_EXIT_FUNC(); } bool OSystem_PSP::showMouse(bool v) { DEBUG_ENTER_FUNC(); - PSP_DEBUG_PRINT("%s\n", v ? "true" : "false"); bool last = _cursor.isVisible(); _cursor.setVisible(v); - DEBUG_EXIT_FUNC(); - return last; } void OSystem_PSP::warpMouse(int x, int y) { DEBUG_ENTER_FUNC(); - _cursor.setXY(x, y); - - DEBUG_EXIT_FUNC(); } void OSystem_PSP::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) { DEBUG_ENTER_FUNC(); - PSP_DEBUG_PRINT("pbuf[%p], w[%u], h[%u], hotspot:X[%d], Y[%d], keycolor[%d], scale[%d], pformat[%p]\n", buf, w, h, hotspotX, hotspotY, keycolor, cursorTargetScale, format); if (format) { PSP_DEBUG_PRINT("format: bpp[%d], rLoss[%d], gLoss[%d], bLoss[%d], aLoss[%d], rShift[%d], gShift[%d], bShift[%d], aShift[%d]\n", format->bytesPerPixel, format->rLoss, format->gLoss, format->bLoss, format->aLoss, format->rShift, format->gShift, format->bShift, format->aShift); @@ -356,8 +278,6 @@ void OSystem_PSP::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, _cursor.setHotspot(hotspotX, hotspotY); _cursor.clearKeyColor(); _cursor.copyFromArray(buf); - - DEBUG_EXIT_FUNC(); } bool OSystem_PSP::pollEvent(Common::Event &event) { diff --git a/backends/platform/psp/powerman.cpp b/backends/platform/psp/powerman.cpp index 25afba4881..df8da12f6d 100644 --- a/backends/platform/psp/powerman.cpp +++ b/backends/platform/psp/powerman.cpp @@ -83,8 +83,6 @@ PowerManager::PowerManager() { _listCounter = 0; PMStatusSet(kInitDone); _error = 0; - - DEBUG_EXIT_FUNC(); } /******************************************* @@ -110,7 +108,6 @@ int PowerManager::registerSuspend(Suspendable *item) { debugPM(); - DEBUG_EXIT_FUNC(); return 0; } @@ -138,7 +135,6 @@ int PowerManager::unregisterSuspend(Suspendable *item) { PSP_DEBUG_PRINT("Out of unregisterSuspend\n"); debugPM(); - DEBUG_EXIT_FUNC(); return 0; } @@ -163,8 +159,6 @@ PowerManager::~PowerManager() { SDL_DestroyMutex(_listMutex); _listMutex = 0; - - DEBUG_EXIT_FUNC(); } /******************************************* @@ -247,7 +241,6 @@ int PowerManager::beginCriticalSection(bool justBlock) { ret = Error; } - DEBUG_EXIT_FUNC(); return ret; } @@ -285,7 +278,6 @@ int PowerManager::endCriticalSection() { ret = Error; } - DEBUG_EXIT_FUNC(); return ret; } @@ -377,7 +369,6 @@ int PowerManager::suspend() { scePowerUnlock(0); // Allow the PSP to go to sleep now - DEBUG_EXIT_FUNC(); return ret; } @@ -452,6 +443,5 @@ int PowerManager::resume() { scePowerUnlock(0); // Allow new suspends - DEBUG_EXIT_FUNC(); return ret; } diff --git a/backends/platform/psp/pspkeyboard.cpp b/backends/platform/psp/pspkeyboard.cpp index d349b514e2..5cd46789a8 100644 --- a/backends/platform/psp/pspkeyboard.cpp +++ b/backends/platform/psp/pspkeyboard.cpp @@ -124,8 +124,6 @@ PSPKeyboard::PSPKeyboard() { _renderer.setAlphaBlending(true); _renderer.setColorTest(false); _renderer.setUseGlobalScaler(false); - - DEBUG_EXIT_FUNC(); } // Destructor @@ -133,7 +131,6 @@ PSPKeyboard::~PSPKeyboard() { DEBUG_ENTER_FUNC(); if (!_init) { - DEBUG_EXIT_FUNC(); return; } @@ -142,8 +139,6 @@ PSPKeyboard::~PSPKeyboard() { _palettes[i].deallocate(); } _init = false; - - DEBUG_EXIT_FUNC(); } void PSPKeyboard::setVisible(bool val) { @@ -164,8 +159,6 @@ void PSPKeyboard::moveTo(const int newX, const int newY) { _movedX = newX; _movedY = newY; setDirty(); - - DEBUG_EXIT_FUNC(); } /* move the position the keyboard is currently drawn at */ @@ -175,13 +168,10 @@ void PSPKeyboard::increaseKeyboardLocationX(int amount) { int newX = _movedX + amount; if (newX > PSP_SCREEN_WIDTH - 5 || newX < 0 - 140) { // clamp - DEBUG_EXIT_FUNC(); return; } _movedX = newX; setDirty(); - - DEBUG_EXIT_FUNC(); } /* move the position the keyboard is currently drawn at */ @@ -191,13 +181,10 @@ void PSPKeyboard::increaseKeyboardLocationY(int amount) { int newY = _movedY + amount; if (newY > PSP_SCREEN_HEIGHT - 5 || newY < 0 - 140) { // clamp - DEBUG_EXIT_FUNC(); return; } _movedY = newY; setDirty(); - - DEBUG_EXIT_FUNC(); } /* draw the keyboard at the current position */ @@ -229,8 +216,6 @@ void PSPKeyboard::render() { _renderer.setOffsetInBuffer(x * OrangeBlockSize, y * OrangeBlockSize); _renderer.setDrawSize(OrangeBlockSize, OrangeBlockSize); _renderer.render(); - - DEBUG_EXIT_FUNC(); } inline void PSPKeyboard::convertCursorToXY(CursorDirections cur, int &x, int &y) { @@ -264,7 +249,6 @@ bool PSPKeyboard::load() { if (_init) { PSP_DEBUG_PRINT("keyboard already loaded into memory\n"); - DEBUG_EXIT_FUNC(); return true; } @@ -371,7 +355,6 @@ bool PSPKeyboard::load() { delete fileArchive; delete zipArchive; - DEBUG_EXIT_FUNC(); return true; ERROR: @@ -386,7 +369,6 @@ ERROR: } _init = false; - DEBUG_EXIT_FUNC(); return false; } @@ -406,14 +388,12 @@ int PSPKeyboard::getPngImageSize(Common::SeekableReadStream *file, uint32 *png_w png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr == NULL) { - DEBUG_EXIT_FUNC(); return -1; } png_set_error_fn(png_ptr, (png_voidp) NULL, (png_error_ptr) NULL, user_warning_fn); info_ptr = png_create_info_struct(png_ptr); if (info_ptr == NULL) { png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL); - DEBUG_EXIT_FUNC(); return -1; } // Set the png lib to use our read function @@ -432,7 +412,6 @@ int PSPKeyboard::getPngImageSize(Common::SeekableReadStream *file, uint32 *png_w *png_width = width; *png_height = height; - DEBUG_EXIT_FUNC(); return 0; } @@ -451,7 +430,6 @@ int PSPKeyboard::loadPngImage(Common::SeekableReadStream *file, Buffer &buffer, png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr == NULL) { PSP_ERROR("Couldn't create read struct to load keyboard\n"); - DEBUG_EXIT_FUNC(); return -1; } // Use dummy error function @@ -461,7 +439,6 @@ int PSPKeyboard::loadPngImage(Common::SeekableReadStream *file, Buffer &buffer, if (info_ptr == NULL) { PSP_ERROR("Couldn't create info struct to load keyboard\n"); png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL); - DEBUG_EXIT_FUNC(); return -1; } @@ -496,7 +473,6 @@ int PSPKeyboard::loadPngImage(Common::SeekableReadStream *file, Buffer &buffer, if (!line) { png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL); PSP_ERROR("Couldn't allocate line\n"); - DEBUG_EXIT_FUNC(); return -1; } @@ -511,7 +487,6 @@ int PSPKeyboard::loadPngImage(Common::SeekableReadStream *file, Buffer &buffer, png_read_end(png_ptr, info_ptr); png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL); - DEBUG_EXIT_FUNC(); return 0; } @@ -567,7 +542,6 @@ bool PSPKeyboard::processInput(Common::Event &event, SceCtrlData &pad) { _prevButtons = pad.Buttons; - DEBUG_EXIT_FUNC(); return haveEvent; } @@ -595,7 +569,6 @@ void PSPKeyboard::handleMoveState(SceCtrlData &pad) { else /* DOWN(PSP_CTRL_RIGHT) */ increaseKeyboardLocationX(5); } - DEBUG_EXIT_FUNC(); } bool PSPKeyboard::handleDefaultState(Common::Event &event, SceCtrlData &pad) { @@ -611,7 +584,6 @@ bool PSPKeyboard::handleDefaultState(Common::Event &event, SceCtrlData &pad) { else if (!DOWN(PSP_4BUTTONS)) // Must be up to move cursor getCursorMovement(pad); - DEBUG_EXIT_FUNC(); return haveEvent; } @@ -623,9 +595,8 @@ bool PSPKeyboard::handleCornersSelectedState(Common::Event &event, SceCtrlData & if (CHANGED(PSP_4BUTTONS | PSP_CTRL_RTRIGGER | PSP_CTRL_LTRIGGER)) haveEvent = getInputChoice(event, pad); if (!DOWN(PSP_4BUTTONS | PSP_CTRL_RTRIGGER | PSP_CTRL_LTRIGGER)) // Must be up to move cursor - getCursorMovement(pad) + getCursorMovement(pad); - DEBUG_EXIT_FUNC(); return haveEvent; } @@ -689,7 +660,6 @@ bool PSPKeyboard::getInputChoice(Common::Event &event, SceCtrlData &pad) { haveEvent = (choice != Common::KEYCODE_INVALID) ? true : false; // We have an event/don't if it's invalid - DEBUG_EXIT_FUNC(); return haveEvent; } @@ -718,7 +688,6 @@ void PSPKeyboard::getCursorMovement(SceCtrlData &pad) { _dirty = true; _oldCursor = cursor; } - DEBUG_EXIT_FUNC(); } void PSPKeyboard::handleLTriggerDownState(SceCtrlData &pad) { @@ -733,7 +702,6 @@ void PSPKeyboard::handleLTriggerDownState(SceCtrlData &pad) { _state = kDefault; } - DEBUG_EXIT_FUNC(); } void PSPKeyboard::handleRTriggerDownState(SceCtrlData &pad) { @@ -748,5 +716,4 @@ void PSPKeyboard::handleRTriggerDownState(SceCtrlData &pad) { _state = kDefault; } - DEBUG_EXIT_FUNC(); } diff --git a/backends/platform/psp/psppixelformat.cpp b/backends/platform/psp/psppixelformat.cpp index 10b5aa5a7f..0565867660 100644 --- a/backends/platform/psp/psppixelformat.cpp +++ b/backends/platform/psp/psppixelformat.cpp @@ -65,7 +65,6 @@ void PSPPixelFormat::set(Type type, bool swap /* = false */) { } PSP_DEBUG_PRINT("bitsPerPixel[%u]\n", bitsPerPixel); - DEBUG_EXIT_FUNC(); } // Convert from ScummVM general PixelFormat to our pixel format @@ -185,6 +184,5 @@ uint32 PSPPixelFormat::convertTo32BitColor(uint32 color) { output = ((b << 16) | (g << 8) | (r << 0) | (a << 24)); PSP_DEBUG_PRINT_FUNC("input color[%x], output[%x]\n", color, output); - DEBUG_EXIT_FUNC(); return output; } diff --git a/backends/platform/psp/trace.h b/backends/platform/psp/trace.h index 024da11373..4e2a20c199 100644 --- a/backends/platform/psp/trace.h +++ b/backends/platform/psp/trace.h @@ -100,19 +100,29 @@ extern int psp_debug_indent; /* Debugging function calls */ #ifdef __PSP_DEBUG_FUNCS__ -#define DEBUG_ENTER_FUNC() PSP_INFO_PRINT_INDENT("++ %s\n", __PRETTY_FUNCTION__); \ - psp_debug_indent++ - -#define DEBUG_EXIT_FUNC() psp_debug_indent--; \ - if (psp_debug_indent < 0) PSP_ERROR("debug indent < 0\n"); \ - PSP_INFO_PRINT_INDENT("-- %s\n", __PRETTY_FUNCTION__) - -#define INLINE /* don't want to inline so we get function names properly */ +// We use this class to print out function calls on the stack in an easy way. +// +class PSPStackDebugFuncs { + Common::String _name; + +public: + PSPStackDebugFuncs(const char *name) : _name(name) { + PSP_INFO_PRINT_INDENT("++ %s\n", _name.c_str()); \ + psp_debug_indent++; + } + + ~PSPStackDebugFuncs() { + psp_debug_indent--; \ + if (psp_debug_indent < 0) PSP_ERROR("debug indent < 0\n"); \ + PSP_INFO_PRINT_INDENT("-- %s\n", _name.c_str()); + } +} + +/* We don't need anything but this line at the beginning of each function to debug function calls */ + #define DEBUG_ENTER_FUNC() PSPStackDebugFuncs(__PRETTY_FUNCTION__) #else /* Don't debug function calls */ -#define DEBUG_ENTER_FUNC() -#define DEBUG_EXIT_FUNC() -#define INLINE inline + #define DEBUG_ENTER_FUNC() #endif /* __PSP_DEBUG_FUNCS__ */ // Undef the main defines for next time |