From 88913c0139ac6d1dfb356d3048702b7bc8ef4079 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 20 Jun 2011 00:59:48 +0200 Subject: ALL: Remove trailing whitespaces This tries to make our code a bit more compliant with our code formatting conventions. For future use, this is the command I used: git ls-files "*.cpp" "*.h" | xargs sed -i -e 's/[ \t]*$//' --- backends/platform/dc/dcmain.cpp | 12 ++-- backends/platform/dc/plugins.cpp | 2 +- backends/platform/dingux/dingux.cpp | 2 +- backends/platform/ds/arm9/source/gbampsave.cpp | 4 +- backends/platform/n64/osys_n64.h | 2 +- backends/platform/n64/osys_n64_events.cpp | 2 +- backends/platform/psp/cursor.cpp | 10 +-- backends/platform/psp/display_client.cpp | 32 ++++----- backends/platform/psp/display_client.h | 10 +-- backends/platform/psp/display_manager.cpp | 8 +-- backends/platform/psp/display_manager.h | 6 +- backends/platform/psp/dummy.cpp | 12 ++-- backends/platform/psp/image_viewer.cpp | 90 +++++++++++++------------- backends/platform/psp/image_viewer.h | 28 ++++---- backends/platform/psp/input.cpp | 32 ++++----- backends/platform/psp/input.h | 20 +++--- backends/platform/psp/osys_psp.cpp | 2 +- backends/platform/psp/png_loader.cpp | 22 +++---- backends/platform/psp/png_loader.h | 2 +- backends/platform/psp/trace.cpp | 36 +++++------ backends/platform/sdl/macosx/macosx.cpp | 2 +- backends/platform/sdl/sdl-sys.h | 2 +- backends/platform/sdl/sdl.cpp | 2 +- backends/platform/sdl/sdl.h | 4 +- backends/platform/symbian/src/SymbianOS.cpp | 4 +- backends/platform/wince/wince-sdl.cpp | 2 +- 26 files changed, 175 insertions(+), 175 deletions(-) (limited to 'backends/platform') diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp index 3faf0185ad..06738a687d 100644 --- a/backends/platform/dc/dcmain.cpp +++ b/backends/platform/dc/dcmain.cpp @@ -234,7 +234,7 @@ void OSystem_Dreamcast::logMessage(LogMessageType::Type type, const char *messag namespace DC_Flash { static int syscall_info_flash(int sect, int *info) { - return (*(int (**)(int, void*, int, int))0x8c0000b8)(sect,info,0,0); + return (*(int (**)(int, void*, int, int))0x8c0000b8)(sect,info,0,0); } static int syscall_read_flash(int offs, void *buf, int cnt) @@ -255,24 +255,24 @@ namespace DC_Flash { } return (unsigned short)~n; } - + static int flash_read_sector(int partition, int sec, unsigned char *dst) { int s, r, n, b, bmb, got=0; int info[2]; char buf[64]; char bm[64]; - + if((r = syscall_info_flash(partition, info))<0) return r; - + if((r = syscall_read_flash(info[0], buf, 64))<0) return r; - + if(memcmp(buf, "KATANA_FLASH", 12) || buf[16] != partition || buf[17] != 0) return -2; - + n = (info[1]>>6)-1-((info[1] + 0x7fff)>>15); bmb = n+1; for(b = 0; b < n; b++) { diff --git a/backends/platform/dc/plugins.cpp b/backends/platform/dc/plugins.cpp index fff3c147ec..2942a4f155 100644 --- a/backends/platform/dc/plugins.cpp +++ b/backends/platform/dc/plugins.cpp @@ -51,7 +51,7 @@ static void drawPluginProgress(const Common::String &filename) ta_begin_frame(); draw_solid_quad(80.0, 270.0, 560.0, 300.0, 0xff808080, 0xff808080, 0xff808080, 0xff808080); - draw_solid_quad(85.0, 275.0, 555.0, 295.0, + draw_solid_quad(85.0, 275.0, 555.0, 295.0, 0xff202020, 0xff202020, 0xff202020, 0xff202020); draw_solid_quad(85.0, 275.0, 85.0+470.0*ffree, 295.0, fcol, fcol, fcol, fcol); diff --git a/backends/platform/dingux/dingux.cpp b/backends/platform/dingux/dingux.cpp index 1af53aeae1..674c2ea780 100644 --- a/backends/platform/dingux/dingux.cpp +++ b/backends/platform/dingux/dingux.cpp @@ -33,7 +33,7 @@ void OSystem_SDL_Dingux::initBackend() { // Create the graphics manager if (_graphicsManager == 0) { - _graphicsManager = new DINGUXSdlGraphicsManager(_eventSource); + _graphicsManager = new DINGUXSdlGraphicsManager(_eventSource); } // Call parent implementation of this method diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp index db9b1c2609..03729c5e6e 100644 --- a/backends/platform/ds/arm9/source/gbampsave.cpp +++ b/backends/platform/ds/arm9/source/gbampsave.cpp @@ -52,7 +52,7 @@ Common::OutSaveFile *GBAMPSaveFileManager::openForSaving(const Common::String &f fileSpec += filename; // consolePrintf("Opening the file: %s\n", fileSpec.c_str()); - + Common::WriteStream *stream = DS::DSFileStream::makeFromPath(fileSpec, true); // Use a write buffer stream = Common::wrapBufferedWriteStream(stream, SAVE_BUFFER_SIZE); @@ -66,7 +66,7 @@ Common::InSaveFile *GBAMPSaveFileManager::openForLoading(const Common::String &f fileSpec += filename; // consolePrintf("Opening the file: %s\n", fileSpec.c_str()); - + return DS::DSFileStream::makeFromPath(fileSpec, false); } diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h index 285e2afa55..354f25a1cf 100644 --- a/backends/platform/n64/osys_n64.h +++ b/backends/platform/n64/osys_n64.h @@ -107,7 +107,7 @@ protected: // FIXME: This must be left as "int" for now, to fix the sign-comparison problem // there is a little more work involved than an int->uint change int _cursorWidth, _cursorHeight; - + int _cursorKeycolor; uint16 _overlayHeight, _overlayWidth; diff --git a/backends/platform/n64/osys_n64_events.cpp b/backends/platform/n64/osys_n64_events.cpp index 2645cfea2a..62f11aef64 100644 --- a/backends/platform/n64/osys_n64_events.cpp +++ b/backends/platform/n64/osys_n64_events.cpp @@ -162,7 +162,7 @@ bool OSystem_N64::pollEvent(Common::Event &event) { uint16 newButtons = 0; if (_controllerPort >= 0) newButtons = _ctrlData.c[_controllerPort].buttons; // Read from controller - + uint16 newMouseButtons = 0; if (_mousePort >= 0) newMouseButtons = _ctrlData.c[_mousePort].buttons; diff --git a/backends/platform/psp/cursor.cpp b/backends/platform/psp/cursor.cpp index 18a61f3df4..b295507de1 100644 --- a/backends/platform/psp/cursor.cpp +++ b/backends/platform/psp/cursor.cpp @@ -324,18 +324,18 @@ inline void Cursor::setRendererModePalettized(bool palettized) { _renderer.setAlphaReverse(false); _renderer.setColorTest(false); } else { // 16 bits, no palette - // Color test is an easy way for the hardware to make our keycolor + // Color test is an easy way for the hardware to make our keycolor // transparent. - _renderer.setColorTest(true); - + _renderer.setColorTest(true); + // Alpha blending is not strictly required, but makes the cursor look // much better _renderer.setAlphaBlending(true); - + // Pixel formats without alpha (5650) are considered to have their alpha set. // Since pixel formats with alpha don't have their alpha bits set, we reverse // the alpha format for them so that 0 alpha is 1. - if (_buffer.getPixelFormat() != PSPPixelFormat::Type_5650) + if (_buffer.getPixelFormat() != PSPPixelFormat::Type_5650) _renderer.setAlphaReverse(true); else _renderer.setAlphaReverse(false); diff --git a/backends/platform/psp/display_client.cpp b/backends/platform/psp/display_client.cpp index 14b96d9cae..bc29166895 100644 --- a/backends/platform/psp/display_client.cpp +++ b/backends/platform/psp/display_client.cpp @@ -389,31 +389,31 @@ void Buffer::copyToArray(byte *dst, int pitch) { void Buffer::setSize(uint32 width, uint32 height, HowToSize textureOrSource/*=kSizeByTextureSize*/) { DEBUG_ENTER_FUNC(); - + // We can size the buffer either by texture size (multiple of 2^n) or source size. // At higher sizes, increasing the texture size to 2^n is a waste of space. At these sizes kSizeBySourceSize should be used. - + _sourceSize.width = width; _sourceSize.height = height; _textureSize.width = scaleUpToPowerOfTwo(width); // can only scale up to 512 _textureSize.height = scaleUpToPowerOfTwo(height); - + if (textureOrSource == kSizeByTextureSize) { _width = _textureSize.width; _height = _textureSize.height; } else { // sizeBySourceSize _width = _sourceSize.width; _height = _sourceSize.height; - - // adjust allocated width to be divisible by 32. + + // adjust allocated width to be divisible by 32. // The GU can only handle multiples of 16 bytes. A 4 bit image x 32 will give us 16 bytes // We don't necessarily know the depth of the pixels here. So just make it divisible by 32. uint32 checkDiv = _width & 31; if (checkDiv) _width += 32 - checkDiv; } - + PSP_DEBUG_PRINT("width[%u], height[%u], texW[%u], texH[%u], sourceW[%d], sourceH[%d] %s\n", _width, _height, _textureSize.width, _textureSize.height, _sourceSize.width, _sourceSize.height, textureOrSource ? "size by source" : "size by texture"); } @@ -558,10 +558,10 @@ void GuRenderer::render() { // Loop over patches of 512x512 pixel textures and draw them for (uint32 j = 0; j < _buffer->getSourceHeight(); j += 512) { _textureLoadOffset.y = j; - + for (uint32 i = 0; i < _buffer->getSourceWidth(); i += 512) { _textureLoadOffset.x = i; - + guLoadTexture(); Vertex *vertices = guGetVertices(); fillVertices(vertices); @@ -573,8 +573,8 @@ void GuRenderer::render() { inline void GuRenderer::guProgramDrawBehavior() { DEBUG_ENTER_FUNC(); - PSP_DEBUG_PRINT("blending[%s] colorTest[%s] reverseAlpha[%s] keyColor[%u]\n", - _blending ? "on" : "off", _colorTest ? "on" : "off", + PSP_DEBUG_PRINT("blending[%s] colorTest[%s] reverseAlpha[%s] keyColor[%u]\n", + _blending ? "on" : "off", _colorTest ? "on" : "off", _alphaReverse ? "on" : "off", _keyColor); if (_blending) { @@ -591,7 +591,7 @@ inline void GuRenderer::guProgramDrawBehavior() { if (_colorTest) { sceGuEnable(GU_COLOR_TEST); sceGuColorFunc(GU_NOTEQUAL, // show only colors not equal to this color - _keyColor, + _keyColor, 0x00ffffff); // match everything but alpha } else sceGuDisable(GU_COLOR_TEST); @@ -663,10 +663,10 @@ inline void GuRenderer::guLoadTexture() { byte *startPoint = _buffer->getPixels(); if (_textureLoadOffset.x) startPoint += _buffer->_pixelFormat.pixelsToBytes(_textureLoadOffset.x); - if (_textureLoadOffset.y) + if (_textureLoadOffset.y) startPoint += _buffer->getWidthInBytes() * _textureLoadOffset.y; - - sceGuTexImage(0, + + sceGuTexImage(0, _buffer->getTextureWidth(), // texture width (must be power of 2) _buffer->getTextureHeight(), // texture height (must be power of 2) _buffer->getWidth(), // width of a line of the image (to get to the next line) @@ -698,7 +698,7 @@ void GuRenderer::fillVertices(Vertex *vertices) { // These coordinates describe an area within the texture. ie. we already loaded a square of texture, // now the coordinates within it are 0 to the edge of the area of the texture we want to draw float textureStartX = textureFix + _offsetInBuffer.x; - float textureStartY = textureFix + _offsetInBuffer.y; + float textureStartY = textureFix + _offsetInBuffer.y; int textureLeftX = _drawSize.width - _textureLoadOffset.x; if (textureLeftX > 512) @@ -720,7 +720,7 @@ void GuRenderer::fillVertices(Vertex *vertices) { float imageStartY = gapY + scaledOffsetOnScreenY + (scaleSourceToOutput(false, stretch(false, _textureLoadOffset.y))); float imageEndX, imageEndY; - + imageEndX = imageStartX + scaleSourceToOutput(true, stretch(true, textureLeftX)); imageEndY = imageStartY + scaleSourceToOutput(false, stretch(false, textureLeftY)); diff --git a/backends/platform/psp/display_client.h b/backends/platform/psp/display_client.h index f190658a26..e384bfb82b 100644 --- a/backends/platform/psp/display_client.h +++ b/backends/platform/psp/display_client.h @@ -171,12 +171,12 @@ protected: class GuRenderer { public: // Constructors - GuRenderer() : _useGlobalScaler(false), _buffer(0), _palette(0), - _blending(false), _alphaReverse(false), _colorTest(false), + GuRenderer() : _useGlobalScaler(false), _buffer(0), _palette(0), + _blending(false), _alphaReverse(false), _colorTest(false), _keyColor(0), _fullScreen(false), _stretch(false), _stretchX(1.0f), _stretchY(1.0f) {} - GuRenderer(Buffer *buffer, Palette *palette) : - _useGlobalScaler(false), _buffer(buffer), _palette(palette), - _blending(false), _alphaReverse(false), _colorTest(false), + GuRenderer(Buffer *buffer, Palette *palette) : + _useGlobalScaler(false), _buffer(buffer), _palette(palette), + _blending(false), _alphaReverse(false), _colorTest(false), _keyColor(0), _fullScreen(false), _stretch(false), _stretchX(1.0f), _stretchY(1.0f) {} static void setDisplayManager(DisplayManager *dm) { _displayManager = dm; } // Called by the Display Manager diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp index 899b79727f..e945dca4a8 100644 --- a/backends/platform/psp/display_manager.cpp +++ b/backends/platform/psp/display_manager.cpp @@ -299,7 +299,7 @@ void DisplayManager::init() { #endif // Init overlay since we never change the size - _overlay->deallocate(); + _overlay->deallocate(); _overlay->setBytesPerPixel(sizeof(OverlayColor)); _overlay->setSize(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT); _overlay->allocate(); @@ -432,13 +432,13 @@ bool DisplayManager::renderAll() { _screen->render(); _screen->setClean(); // clean out dirty bit - + if (_imageViewer->isVisible()) _imageViewer->render(); _imageViewer->setClean(); if (_overlay->isVisible()) - _overlay->render(); + _overlay->render(); _overlay->setClean(); if (_cursor->isVisible()) @@ -448,7 +448,7 @@ bool DisplayManager::renderAll() { if (_keyboard->isVisible()) _keyboard->render(); _keyboard->setClean(); - + _masterGuRenderer.guPostRender(); return true; // rendered successfully diff --git a/backends/platform/psp/display_manager.h b/backends/platform/psp/display_manager.h index 5176bee3fe..38c43d60a3 100644 --- a/backends/platform/psp/display_manager.h +++ b/backends/platform/psp/display_manager.h @@ -72,7 +72,7 @@ private: */ class MasterGuRenderer : public PspThreadable { public: - MasterGuRenderer() : _lastRenderTime(0), _renderFinished(true), + MasterGuRenderer() : _lastRenderTime(0), _renderFinished(true), _renderSema(1, 1), _callbackId(-1) {} void guInit(); void guPreRender(); @@ -108,7 +108,7 @@ public: KEEP_ASPECT_RATIO, STRETCHED_FULL_SCREEN }; - DisplayManager() : _screen(0), _cursor(0), _overlay(0), _keyboard(0), + DisplayManager() : _screen(0), _cursor(0), _overlay(0), _keyboard(0), _imageViewer(0), _lastUpdateTime(0), _graphicsMode(0) {} ~DisplayManager(); @@ -127,7 +127,7 @@ public: void setOverlay(Overlay *overlay) { _overlay = overlay; } void setKeyboard(PSPKeyboard *keyboard) { _keyboard = keyboard; } void setImageViewer(ImageViewer *imageViewer) { _imageViewer = imageViewer; } - + void setSizeAndPixelFormat(uint width, uint height, const Graphics::PixelFormat *format); // Getters diff --git a/backends/platform/psp/dummy.cpp b/backends/platform/psp/dummy.cpp index 86ab30b3e2..748ac8cbf3 100644 --- a/backends/platform/psp/dummy.cpp +++ b/backends/platform/psp/dummy.cpp @@ -26,31 +26,31 @@ #include #include #include - + //void userWriteFn(png_structp png_ptr, png_bytep data, png_size_t length) { //} //void userFlushFn(png_structp png_ptr) { //} - + // Dummy functions are pulled in so that we don't need to build the plugins with certain libs - + int dummyFunc() { // For Broken Sword 2.5 volatile int i; i = clock(); rename("dummyA", "dummyB"); - + png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); png_set_write_fn(png_ptr, NULL, NULL, NULL); png_infop info_ptr; png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL); png_destroy_write_struct(&png_ptr, &info_ptr); - + // For lua's usage of libc: very heavy usage so it pulls in sockets? setsockopt(0, 0, 0, NULL, 0); getsockopt(0, 0, 0, NULL, NULL); - + return i; } \ No newline at end of file diff --git a/backends/platform/psp/image_viewer.cpp b/backends/platform/psp/image_viewer.cpp index 97d582b63a..1ed7698bc8 100644 --- a/backends/platform/psp/image_viewer.cpp +++ b/backends/platform/psp/image_viewer.cpp @@ -34,45 +34,45 @@ #include "backends/platform/psp/input.h" #include "backends/platform/psp/display_manager.h" #include "backends/platform/psp/display_client.h" -#include "backends/platform/psp/image_viewer.h" -#include "backends/platform/psp/png_loader.h" +#include "backends/platform/psp/image_viewer.h" +#include "backends/platform/psp/png_loader.h" #include "backends/platform/psp/thread.h" static const char *imageName = "psp_image"; #define PSP_SCREEN_HEIGHT 272 #define PSP_SCREEN_WIDTH 480 - + bool ImageViewer::load(int imageNum) { if (_init) unload(); - + // build string char number[8]; sprintf(number, "%d", imageNum); - Common::String imageNameStr(imageName); + Common::String imageNameStr(imageName); Common::String specificImageName = imageNameStr + Common::String(number) + Common::String(".png"); - + // search for image file if (!SearchMan.hasFile(specificImageName)) { PSP_ERROR("file %s not found\n", specificImageName.c_str()); return false; } - + Common::ScopedPtr file(SearchMan.createReadStreamForMember(specificImageName)); - + _buffer = new Buffer(); _palette = new Palette(); _renderer = new GuRenderer(); - + assert(_buffer); assert(_palette); assert(_renderer); - + // Load a PNG into our buffer and palette. Size it by the actual size of the image PngLoader image(file, *_buffer, *_palette, Buffer::kSizeBySourceSize); - + PngLoader::Status status = image.allocate(); // allocate the buffers for the file - + char error[100]; if (status == PngLoader::BAD_FILE) { sprintf(error, "Cannot display %s. Not a proper PNG file", specificImageName.c_str()); @@ -89,29 +89,29 @@ bool ImageViewer::load(int imageNum) { if (!image.load()) { sprintf(error, "Cannot display %s. Not a proper PNG file", specificImageName.c_str()); GUI::TimedMessageDialog dialog(error, 4000); - dialog.runModal(); + dialog.runModal(); return false; } - + setConstantRendererOptions(); setFullScreenImageParams(); // prepare renderer for full screen view - + _imageNum = imageNum; // now we can say we displayed this image _init = true; - + return true; } void ImageViewer::setConstantRendererOptions() { _renderer->setBuffer(_buffer); _renderer->setPalette(_palette); - + _renderer->setAlphaBlending(false); _renderer->setColorTest(false); _renderer->setUseGlobalScaler(false); _renderer->setStretch(true); _renderer->setOffsetInBuffer(0, 0); - _renderer->setDrawWholeBuffer(); + _renderer->setDrawWholeBuffer(); } void ImageViewer::unload() { @@ -130,32 +130,32 @@ void ImageViewer::resetOnEngineDone() { void ImageViewer::setVisible(bool visible) { DEBUG_ENTER_FUNC(); - + if (_visible == visible) return; - + // from here on, we're making the loader visible if (visible && g_engine) { // we can only run the image viewer when there's an engine g_engine->pauseEngine(true); - + load(_imageNum ? _imageNum : 1); // load the 1st image or the current } if (visible && _init) { // we managed to load _visible = true; setViewerButtons(true); - + { // so dialog goes out of scope, destroying all allocations GUI::TimedMessageDialog dialog("Image Viewer", 1000); dialog.runModal(); } - + runLoop(); // only listen to viewer events } else { // we were asked to make invisible or failed to load _visible = false; unload(); setViewerButtons(false); - + if (g_engine && g_engine->isPaused()) g_engine->pauseEngine(false); } @@ -175,7 +175,7 @@ void ImageViewer::runLoop() { void ImageViewer::setViewerButtons(bool active) { _inputHandler->setImageViewerMode(active); -} +} void ImageViewer::loadNextImage() { if (!load(_imageNum+1)) { // try to load the next image @@ -190,21 +190,21 @@ void ImageViewer::loadLastImage() { if (!load(_imageNum-1)) if (!load(_imageNum)) setVisible(false); // we can't even show the old image so hide - } + } setDirty(); } void ImageViewer::setFullScreenImageParams() { // we try to fit the image fullscreen at least in one dimension uint32 width = _buffer->getSourceWidth(); - uint32 height = _buffer->getSourceHeight(); + uint32 height = _buffer->getSourceHeight(); _centerX = PSP_SCREEN_WIDTH / 2.0f; _centerY = PSP_SCREEN_HEIGHT / 2.0f; - + // see if we fit width wise if (PSP_SCREEN_HEIGHT >= (int)((height * PSP_SCREEN_WIDTH) / (float)width)) { - setZoom(PSP_SCREEN_WIDTH / (float)width); + setZoom(PSP_SCREEN_WIDTH / (float)width); } else { setZoom(PSP_SCREEN_HEIGHT / (float)height); } @@ -233,32 +233,32 @@ void ImageViewer::render() { break; } _renderer->render(); - } + } } void ImageViewer::modifyZoom(bool up) { float factor = _zoomFactor; - if (up) + if (up) factor += 0.1f; else // down factor -= 0.1f; - - setZoom(factor); + + setZoom(factor); } -void ImageViewer::setZoom(float value) { +void ImageViewer::setZoom(float value) { if (value <= 0.0f) // don't want 0 or negative zoom return; _zoomFactor = value; - _renderer->setStretchXY(value, value); + _renderer->setStretchXY(value, value); setOffsetParams(); } void ImageViewer::moveImageX(float val) { float newVal = _centerX + val; - - if (newVal - (_visibleWidth / 2) > PSP_SCREEN_WIDTH - 4 || newVal + (_visibleWidth / 2) < 4) + + if (newVal - (_visibleWidth / 2) > PSP_SCREEN_WIDTH - 4 || newVal + (_visibleWidth / 2) < 4) return; _centerX = newVal; setOffsetParams(); @@ -266,22 +266,22 @@ void ImageViewer::moveImageX(float val) { void ImageViewer::moveImageY(float val) { float newVal = _centerY + val; - - if (newVal - (_visibleHeight / 2) > PSP_SCREEN_HEIGHT - 4 || newVal + (_visibleHeight / 2) < 4) + + if (newVal - (_visibleHeight / 2) > PSP_SCREEN_HEIGHT - 4 || newVal + (_visibleHeight / 2) < 4) return; _centerY = newVal; setOffsetParams(); } -// Set the renderer with the proper offset on the screen +// Set the renderer with the proper offset on the screen // void ImageViewer::setOffsetParams() { _visibleWidth = _zoomFactor * _buffer->getSourceWidth(); - _visibleHeight = _zoomFactor * _buffer->getSourceHeight(); - + _visibleHeight = _zoomFactor * _buffer->getSourceHeight(); + int offsetX = _centerX - (int)(_visibleWidth * 0.5f); int offsetY = _centerY - (int)(_visibleHeight * 0.5f); - + _renderer->setOffsetOnScreen(offsetX, offsetY); setDirty(); } @@ -290,8 +290,8 @@ void ImageViewer::setOffsetParams() { // void ImageViewer::handleEvent(uint32 event) { DEBUG_ENTER_FUNC(); - - switch (event) { + + switch (event) { case EVENT_HIDE: setVisible(false); break; diff --git a/backends/platform/psp/image_viewer.h b/backends/platform/psp/image_viewer.h index 4c3eaf7b4a..ad188536a3 100644 --- a/backends/platform/psp/image_viewer.h +++ b/backends/platform/psp/image_viewer.h @@ -54,10 +54,10 @@ private: float _visibleHeight, _visibleWidth; float _centerX, _centerY; Event _movement; - + InputHandler *_inputHandler; DisplayManager *_displayManager; - + void setFullScreenImageParams(); void loadNextImage(); void loadLastImage(); @@ -66,19 +66,19 @@ private: void moveImageX(float val); void moveImageY(float val); bool load(int imageNum); - void unload(); + void unload(); void runLoop(); // to get total pausing we have to do our own loop - + void setZoom(float value); void setOffsetParams(); void modifyZoom(bool up); // up or down void setVisible(bool visible); - + public: - ImageViewer() : _buffer(0), _palette(0), _visible(false), - _dirty(false), _init(false), _imageNum(0), - _zoomFactor(0.0f), _visibleHeight(0.0f), _visibleWidth(0.0f), + ImageViewer() : _buffer(0), _palette(0), _visible(false), + _dirty(false), _init(false), _imageNum(0), + _zoomFactor(0.0f), _visibleHeight(0.0f), _visibleWidth(0.0f), _centerX(0.0f), _centerY(0.0f), _movement(EVENT_MOVE_STOP), _inputHandler(0), _displayManager(0) {} ~ImageViewer() { unload(); } // deallocate images @@ -88,15 +88,15 @@ public: bool isDirty() { return _dirty; } void setDirty() { _dirty = true; } void setClean() { if (!_visible) // otherwise we want to keep rendering - _dirty = false; - } + _dirty = false; + } void resetOnEngineDone(); - + void handleEvent(uint32 event); - + // pointer setters - void setInputHandler(InputHandler *inputHandler) { _inputHandler = inputHandler; } + void setInputHandler(InputHandler *inputHandler) { _inputHandler = inputHandler; } void setDisplayManager(DisplayManager *displayManager) { _displayManager = displayManager; } }; -#endif /* PSP_IMAGE_VIEWER_H */ \ No newline at end of file +#endif /* PSP_IMAGE_VIEWER_H */ \ No newline at end of file diff --git a/backends/platform/psp/input.cpp b/backends/platform/psp/input.cpp index 17f8954e3b..a9ad441b4d 100644 --- a/backends/platform/psp/input.cpp +++ b/backends/platform/psp/input.cpp @@ -198,7 +198,7 @@ bool ButtonPad::getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData & uint32 curButtonState = PSP_ALL_BUTTONS & pad.Buttons; // we only care about these if (_combosEnabled) - modifyButtonsForCombos(pad); // change buttons for combos + modifyButtonsForCombos(pad); // change buttons for combos return getEventFromButtonState(event, pspEvent, curButtonState); } @@ -460,7 +460,7 @@ bool InputHandler::handlePspEvent(Common::Event &event, PspEvent &pspEvent) { /*case PSP_EVENT_CHANGE_SPEED: handleSpeedChange(pspEvent.data); break;*/ - case PSP_EVENT_IMAGE_VIEWER: + case PSP_EVENT_IMAGE_VIEWER: _imageViewer->handleEvent(pspEvent.data); break; case PSP_EVENT_IMAGE_VIEWER_SET_BUTTONS: @@ -530,7 +530,7 @@ void InputHandler::setImageViewerMode(bool active) { _nub.init(); _buttonPad.enableCombos(true); // re-enable combos _buttonPad.initButtons(); - } + } } void InputHandler::setButtonsForImageViewer() { @@ -538,32 +538,32 @@ void InputHandler::setButtonsForImageViewer() { // Dpad _buttonPad.clearButtons(); - _buttonPad.getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_IN, + _buttonPad.getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_IN, + PSP_EVENT_NONE, false); + _buttonPad.getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_OUT, PSP_EVENT_NONE, false); - _buttonPad.getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_ZOOM_OUT, + _buttonPad.getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_LAST_IMAGE, PSP_EVENT_NONE, false); - _buttonPad.getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_LAST_IMAGE, + _buttonPad.getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_NEXT_IMAGE, PSP_EVENT_NONE, false); - _buttonPad.getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_NEXT_IMAGE, - PSP_EVENT_NONE, false); - _buttonPad.getButton(ButtonPad::BTN_LTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE, + _buttonPad.getButton(ButtonPad::BTN_LTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE, PSP_EVENT_NONE, false); - _buttonPad.getButton(ButtonPad::BTN_RTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE, + _buttonPad.getButton(ButtonPad::BTN_RTRIGGER, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE, PSP_EVENT_NONE, false); - _buttonPad.getButton(ButtonPad::BTN_START, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE, + _buttonPad.getButton(ButtonPad::BTN_START, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE, PSP_EVENT_NONE, false); - _buttonPad.getButton(ButtonPad::BTN_SELECT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE, + _buttonPad.getButton(ButtonPad::BTN_SELECT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_HIDE, PSP_EVENT_NONE, false); //Nub _nub.getPad().clearButtons(); - _nub.getPad().getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_UP, + _nub.getPad().getButton(ButtonPad::BTN_UP, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_UP, PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP); - _nub.getPad().getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_DOWN, + _nub.getPad().getButton(ButtonPad::BTN_DOWN, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_DOWN, PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP); - _nub.getPad().getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_LEFT, + _nub.getPad().getButton(ButtonPad::BTN_LEFT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_LEFT, PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP); - _nub.getPad().getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_RIGHT, + _nub.getPad().getButton(ButtonPad::BTN_RIGHT, UNSHIFTED).setPspEvent(PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_RIGHT, PSP_EVENT_IMAGE_VIEWER, ImageViewer::EVENT_MOVE_STOP); } diff --git a/backends/platform/psp/input.h b/backends/platform/psp/input.h index 8315a3766c..ef2e1b84a4 100644 --- a/backends/platform/psp/input.h +++ b/backends/platform/psp/input.h @@ -122,16 +122,16 @@ public: ButtonPad(); void initButtons(); // set the buttons to the mode that's selected void clearButtons(); // empty the buttons of all events - + bool getEvent(Common::Event &event, PspEvent &pspEvent, SceCtrlData &pad); bool getEventFromButtonState(Common::Event &event, PspEvent &pspEvent, uint32 buttonState); - + void setShifted(ShiftMode shifted) { _shifted = shifted; } void setPadMode(PspPadMode mode) { _padMode = mode; } bool isButtonDown() { return _prevButtonState; } - + void enableCombos(bool value) { _combosEnabled = value; } - Button &getButton(ButtonType type, ShiftMode mode) { return _button[type][mode]; } + Button &getButton(ButtonType type, ShiftMode mode) { return _button[type][mode]; } }; class Nub { @@ -140,17 +140,17 @@ private: ShiftMode _shifted; bool _dpadMode; - + ButtonPad _buttonPad; // private buttonpad for dpad mode - + int32 modifyNubAxisMotion(int32 input); void translateToDpadState(int dpadX, int dpadY, uint32 &buttonState); // convert nub data to dpad data public: Nub() : _shifted(UNSHIFTED), _dpadMode(false) { } - void init() { _buttonPad.initButtons(); } + void init() { _buttonPad.initButtons(); } void setCursor(Cursor *cursor) { _cursor = cursor; } - + // setters void setDpadMode(bool active) { _dpadMode = active; } void setShifted(ShiftMode shifted) { _shifted = shifted; } @@ -163,7 +163,7 @@ public: class InputHandler { public: - InputHandler() : _keyboard(0), _cursor(0), _imageViewer(0), _padMode(PAD_MODE_NORMAL), + InputHandler() : _keyboard(0), _cursor(0), _imageViewer(0), _padMode(PAD_MODE_NORMAL), _lastPadCheckTime(0) {} // pointer setters void setKeyboard(PSPKeyboard *keyboard) { _keyboard = keyboard; } @@ -175,7 +175,7 @@ public: void setImageViewerMode(bool active); private: - Nub _nub; + Nub _nub; ButtonPad _buttonPad; // Pointers to relevant other classes diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp index 8c8180d04e..5fa5110684 100644 --- a/backends/platform/psp/osys_psp.cpp +++ b/backends/platform/psp/osys_psp.cpp @@ -83,7 +83,7 @@ void OSystem_PSP::initBackend() { _inputHandler.setKeyboard(&_keyboard); _inputHandler.setImageViewer(&_imageViewer); _inputHandler.init(); - + // Set pointers for image viewer _imageViewer.setInputHandler(&_inputHandler); _imageViewer.setDisplayManager(&_displayManager); diff --git a/backends/platform/psp/png_loader.cpp b/backends/platform/psp/png_loader.cpp index 2f4857569e..16377539c8 100644 --- a/backends/platform/psp/png_loader.cpp +++ b/backends/platform/psp/png_loader.cpp @@ -36,7 +36,7 @@ PngLoader::Status PngLoader::allocate() { DEBUG_ENTER_FUNC(); - + if (!findImageDimensions()) { PSP_ERROR("failed to get image dimensions\n"); return BAD_FILE; @@ -45,7 +45,7 @@ PngLoader::Status PngLoader::allocate() { _buffer->setSize(_width, _height, _sizeBy); uint32 bitsPerPixel = _bitDepth * _channels; - + if (_paletteSize) { // 8 or 4-bit image if (bitsPerPixel == 4) { _buffer->setPixelFormat(PSPPixelFormat::Type_Palette_4bit); @@ -130,7 +130,7 @@ bool PngLoader::basicImageLoad() { png_get_IHDR(_pngPtr, _infoPtr, (png_uint_32 *)&_width, (png_uint_32 *)&_height, &_bitDepth, &_colorType, &interlaceType, int_p_NULL, int_p_NULL); _channels = png_get_channels(_pngPtr, _infoPtr); - + if (_colorType & PNG_COLOR_MASK_PALETTE) _paletteSize = _infoPtr->num_palette; @@ -141,7 +141,7 @@ bool PngLoader::basicImageLoad() { bool PngLoader::findImageDimensions() { DEBUG_ENTER_FUNC(); - bool status = basicImageLoad(); + bool status = basicImageLoad(); PSP_DEBUG_PRINT("width[%d], height[%d], paletteSize[%d], bitDepth[%d], channels[%d], rowBytes[%d]\n", _width, _height, _paletteSize, _bitDepth, _channels, _infoPtr->rowbytes); png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL); @@ -157,7 +157,7 @@ bool PngLoader::loadImageIntoBuffer() { if (!basicImageLoad()) { png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL); return false; - } + } png_set_strip_16(_pngPtr); // Strip off 16 bit channels in case they occur if (_paletteSize) { @@ -178,16 +178,16 @@ bool PngLoader::loadImageIntoBuffer() { } uint32 rowBytes = png_get_rowbytes(_pngPtr, _infoPtr); - - // there seems to be a bug in libpng where it doesn't increase the rowbytes or the + + // there seems to be a bug in libpng where it doesn't increase the rowbytes or the // channel even after we add the alpha channel if (_channels == 3 && (rowBytes / _width) == 3) { _channels = 4; - rowBytes = _width * _channels; - } - + rowBytes = _width * _channels; + } + PSP_DEBUG_PRINT("rowBytes[%d], channels[%d]\n", rowBytes, _channels); - + unsigned char *line = (unsigned char*) malloc(rowBytes); if (!line) { png_destroy_read_struct(&_pngPtr, png_infopp_NULL, png_infopp_NULL); diff --git a/backends/platform/psp/png_loader.h b/backends/platform/psp/png_loader.h index 616a79405e..0ff9d8a65d 100644 --- a/backends/platform/psp/png_loader.h +++ b/backends/platform/psp/png_loader.h @@ -61,7 +61,7 @@ public: Buffer::HowToSize sizeBy = Buffer::kSizeByTextureSize) : _file(file), _buffer(&buffer), _palette(&palette), _width(0), _height(0), _paletteSize(0), - _bitDepth(0), _sizeBy(sizeBy), _pngPtr(0), + _bitDepth(0), _sizeBy(sizeBy), _pngPtr(0), _infoPtr(0), _colorType(0), _channels(0) {} PngLoader::Status allocate(); diff --git a/backends/platform/psp/trace.cpp b/backends/platform/psp/trace.cpp index 373e00415b..b799b4e870 100644 --- a/backends/platform/psp/trace.cpp +++ b/backends/platform/psp/trace.cpp @@ -75,38 +75,38 @@ void PspDebugTrace(bool alsoToScreen, const char *format, ...) { #define GET_RET(retAddr) \ asm volatile ("move %0,$ra\n\t" \ : "=&r" (retAddr) : ) - + #define GET_SP(stackPtr) \ asm volatile ("move %0,$sp\n\t" \ : "=&r" (stackPtr) : ) // Function to retrieve a backtrace for the MIPS processor -// This is not trivial since the MIPS doesn't use a frame pointer. +// This is not trivial since the MIPS doesn't use a frame pointer. // Takes the number of levels wanted above the calling function (included) and an array of void * -// +// void mipsBacktrace(uint32 levels, void **addresses) { - // get the current return address + // get the current return address register byte *retAddr; register byte *stackPointer; - GET_RET(retAddr); + GET_RET(retAddr); GET_SP(stackPointer); char string[100]; - + if (!levels) return; - + memset(addresses, 0, sizeof(void *) * levels); - + uint32 curLevel = 0; - + const uint32 SP_SUBTRACT = 0x27bd8000; // The instruction to subtract from the SP looks like this const uint32 SP_SUB_HIGH_MASK = 0xffff8000; // The mask to check for the subtract SP instruction const uint32 SP_SUB_LOW_MASK = 0x0000ffff; // The mask that gives us how much was subtracted - + // make sure we go out of the stack of this current level // we already have the return address for this level from the register if (curLevel < levels) { - void *thisFunc = (void *)mipsBacktrace; + void *thisFunc = (void *)mipsBacktrace; for (uint32 *seekPtr = (uint32 *)thisFunc; ; seekPtr++) { if ((*seekPtr & SP_SUB_HIGH_MASK) == SP_SUBTRACT) { // we found the $sp subtraction at the beginning of the function @@ -120,10 +120,10 @@ void mipsBacktrace(uint32 levels, void **addresses) { fputs(string, stderr); } break; - } - } + } + } } - + // keep scanning while more levels are requested while (curLevel < levels) { // now scan backwards from the return address to find the size of the stack @@ -139,13 +139,13 @@ void mipsBacktrace(uint32 levels, void **addresses) { sprintf(string, "invalid retAddr %p\n", retAddr); fputs(string, stderr); return; - } + } //sprintf(string, "retAddr[%p]\n", retAddr); //fputs(string, stderr); addresses[curLevel++] = retAddr; break; - } - } + } + } } -} +} diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp index 9b11eb2c09..817f61e864 100644 --- a/backends/platform/sdl/macosx/macosx.cpp +++ b/backends/platform/sdl/macosx/macosx.cpp @@ -74,7 +74,7 @@ void OSystem_MacOSX::addSysArchivesToSearchSet(Common::SearchSet &s, int priorit } void OSystem_MacOSX::setupIcon() { - // Don't set icon on OS X, as we use a nicer external icon there. + // Don't set icon on OS X, as we use a nicer external icon there. } bool OSystem_MacOSX::hasFeature(Feature f) { diff --git a/backends/platform/sdl/sdl-sys.h b/backends/platform/sdl/sdl-sys.h index 77515ff4e5..63bfc58617 100644 --- a/backends/platform/sdl/sdl-sys.h +++ b/backends/platform/sdl/sdl-sys.h @@ -47,7 +47,7 @@ typedef struct { int FAKE; } FAKE_FILE; // Finally forbid FILE again (if it was forbidden to start with) #if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_FILE) -#undef FILE +#undef FILE #define FILE FORBIDDEN_SYMBOL_REPLACEMENT #endif diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 4cca5792cb..ecaeabf4e1 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -376,7 +376,7 @@ void OSystem_SDL::setupIcon() { if (sscanf(scummvm_icon[0], "%d %d %d %d", &w, &h, &ncols, &nbytes) != 4) { warning("Wrong format of scummvm_icon[0] (%s)", scummvm_icon[0]); - + return; } if ((w > 512) || (h > 512) || (ncols > 255) || (nbytes > 1)) { diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h index 9c08752054..707ad8bc55 100644 --- a/backends/platform/sdl/sdl.h +++ b/backends/platform/sdl/sdl.h @@ -30,7 +30,7 @@ #include "backends/events/sdl/sdl-events.h" #include "backends/log/log.h" -/** +/** * Base OSystem class for all SDL ports. */ class OSystem_SDL : public ModularBackend { @@ -38,7 +38,7 @@ public: OSystem_SDL(); virtual ~OSystem_SDL(); - /** + /** * Pre-initialize backend. It should be called after * instantiating the backend. Early needed managers are * created here. diff --git a/backends/platform/symbian/src/SymbianOS.cpp b/backends/platform/symbian/src/SymbianOS.cpp index 9cccc81d19..b1bd976f9e 100644 --- a/backends/platform/symbian/src/SymbianOS.cpp +++ b/backends/platform/symbian/src/SymbianOS.cpp @@ -57,7 +57,7 @@ char *GetExecutablePath() { OSystem_SDL_Symbian::OSystem_SDL_Symbian() : _RFs(0) { - + } void OSystem_SDL_Symbian::init() { @@ -171,7 +171,7 @@ Common::String OSystem_SDL_Symbian::getDefaultConfigFileName() { } void OSystem_SDL_Symbian::setupIcon() { - // Don't for Symbian: it uses the EScummVM.aif file for the icon. + // Don't for Symbian: it uses the EScummVM.aif file for the icon. } RFs& OSystem_SDL_Symbian::FsSession() { diff --git a/backends/platform/wince/wince-sdl.cpp b/backends/platform/wince/wince-sdl.cpp index 54fa71cfd2..9b1ffe817c 100644 --- a/backends/platform/wince/wince-sdl.cpp +++ b/backends/platform/wince/wince-sdl.cpp @@ -621,7 +621,7 @@ Common::String OSystem_WINCE3::getSystemLanguage() const { GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVCTRYNAME, ctryNameW, sizeof(ctryNameW)) != 0) { WideCharToMultiByte(CP_ACP, 0, langNameW, -1, langName, (wcslen(langNameW) + 1), NULL, NULL); WideCharToMultiByte(CP_ACP, 0, ctryNameW, -1, ctryName, (wcslen(ctryNameW) + 1), NULL, NULL); - + debug(1, "Trying to find posix locale name for %s_%s", langName, ctryName); while (posixMappingTable[i][0] && !localeFound) { if ( (!strcmp(posixMappingTable[i][0], langName) || !strcmp(posixMappingTable[i][0], "*")) && -- cgit v1.2.3