diff options
author | Joost Peters | 2006-05-29 18:06:02 +0000 |
---|---|---|
committer | Joost Peters | 2006-05-29 18:06:02 +0000 |
commit | e1844e485f19d5abb260b5eb821f9ce38658b2ad (patch) | |
tree | 77d1a8ab49837de703b7579db570348a27c4f67c /backends | |
parent | e4e145b5bcede09efcd4fa77a44364e7a9f942c5 (diff) | |
download | scummvm-rg350-e1844e485f19d5abb260b5eb821f9ce38658b2ad.tar.gz scummvm-rg350-e1844e485f19d5abb260b5eb821f9ce38658b2ad.tar.bz2 scummvm-rg350-e1844e485f19d5abb260b5eb821f9ce38658b2ad.zip |
some cleanup
svn-id: r22753
Diffstat (limited to 'backends')
-rw-r--r-- | backends/psp/osys_psp.cpp | 64 | ||||
-rw-r--r-- | backends/psp/osys_psp_gu.cpp | 188 |
2 files changed, 96 insertions, 156 deletions
diff --git a/backends/psp/osys_psp.cpp b/backends/psp/osys_psp.cpp index 56d7e270b1..9db5e10b5d 100644 --- a/backends/psp/osys_psp.cpp +++ b/backends/psp/osys_psp.cpp @@ -80,43 +80,35 @@ OSystem_PSP::~OSystem_PSP() { if (_mouseBuf) free(_mouseBuf); } -bool OSystem_PSP::hasFeature(Feature f) -{ +bool OSystem_PSP::hasFeature(Feature f) { return false; } -void OSystem_PSP::setFeatureState(Feature f, bool enable) -{ +void OSystem_PSP::setFeatureState(Feature f, bool enable) { } -bool OSystem_PSP::getFeatureState(Feature f) -{ +bool OSystem_PSP::getFeatureState(Feature f) { return false; } -const OSystem::GraphicsMode* OSystem_PSP::getSupportedGraphicsModes() const -{ +const OSystem::GraphicsMode* OSystem_PSP::getSupportedGraphicsModes() const { return s_supportedGraphicsModes; } -int OSystem_PSP::getDefaultGraphicsMode() const -{ +int OSystem_PSP::getDefaultGraphicsMode() const { return -1; } -bool OSystem_PSP::setGraphicsMode(int mode) -{ +bool OSystem_PSP::setGraphicsMode(int mode) { return true; } -bool OSystem_PSP::setGraphicsMode(const char *name) -{ +bool OSystem_PSP::setGraphicsMode(const char *name) { return true; } -int OSystem_PSP::getGraphicsMode() const -{ +int OSystem_PSP::getGraphicsMode() const { return -1; } @@ -240,29 +232,24 @@ void OSystem_PSP::setShakePos(int shakeOffset) { _shakePos = shakeOffset; } -void OSystem_PSP::showOverlay () -{ +void OSystem_PSP::showOverlay() { _overlayVisible = true; } -void OSystem_PSP::hideOverlay () -{ +void OSystem_PSP::hideOverlay() { PSPDebugTrace("OSystem_PSP::hideOverlay called\n"); _overlayVisible = false; } -void OSystem_PSP::clearOverlay () -{ +void OSystem_PSP::clearOverlay() { PSPDebugTrace("clearOverlay\n"); bzero(_overlayBuffer, _overlayWidth * _overlayHeight * sizeof(OverlayColor)); } -void OSystem_PSP::grabOverlay (OverlayColor *buf, int pitch) -{ +void OSystem_PSP::grabOverlay(OverlayColor *buf, int pitch) { } -void OSystem_PSP::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) -{ +void OSystem_PSP::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) { PSPDebugTrace("copyRectToOverlay\n"); //Clip the coordinates @@ -302,30 +289,25 @@ void OSystem_PSP::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, i } } -int16 OSystem_PSP::getOverlayWidth() -{ +int16 OSystem_PSP::getOverlayWidth() { return _overlayWidth; } -int16 OSystem_PSP::getOverlayHeight() -{ +int16 OSystem_PSP::getOverlayHeight() { return _overlayHeight; } -OverlayColor OSystem_PSP::RGBToColor(uint8 r, uint8 g, uint8 b) -{ +OverlayColor OSystem_PSP::RGBToColor(uint8 r, uint8 g, uint8 b) { return (((r >> 3) & 0x1F) | (((g >> 3) & 0x1F) << 5) | (((b >> 3) & 0x1F) << 10 ) ) | 0x8000; } -void OSystem_PSP::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) -{ +void OSystem_PSP::colorToRGB(OverlayColor color, uint8 &r, uint8 &g, uint8 &b) { r = ((color & 0x1F) << 3); g = (((color >> 5) & 0x1F) << 3); b = (((color >> 10) & 0x1F) << 3); } -OverlayColor OSystem_PSP::ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) -{ +OverlayColor OSystem_PSP::ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) { OverlayColor color = RGBToColor(r, g, b); if(a == 255) @@ -334,8 +316,7 @@ OverlayColor OSystem_PSP::ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) return color; } -void OSystem_PSP::colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) -{ +void OSystem_PSP::colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) { colorToRGB(color, r, g, b); if(color & 0x8000) a = 255; @@ -343,13 +324,11 @@ void OSystem_PSP::colorToARGB(OverlayColor color, uint8 &a, uint8 &r, uint8 &g, a = 0; } -void OSystem_PSP::grabPalette(byte *colors, uint start, uint num) -{ +void OSystem_PSP::grabPalette(byte *colors, uint start, uint num) { uint i; uint16 color; - for(i=start; i < start+num; i++) - { + for (i = start; i < start + num; i++) { color = _palette[i]; *colors++ = ((color & 0x1F) << 3); *colors++ = (((color >> 5) & 0x1F) << 3); @@ -530,7 +509,6 @@ uint32 OSystem_PSP::getMillis() { } void OSystem_PSP::delayMillis(uint msecs) { - sceKernelDelayThread(1); // Sleep thread for 1 millionth of a second to allow callback threads to run SDL_Delay(msecs); } diff --git a/backends/psp/osys_psp_gu.cpp b/backends/psp/osys_psp_gu.cpp index 367f053b65..7553140118 100644 --- a/backends/psp/osys_psp_gu.cpp +++ b/backends/psp/osys_psp_gu.cpp @@ -114,13 +114,9 @@ OSystem_PSP_GU::OSystem_PSP_GU() { _graphicMode = STRETCHED_480X272; _keySelected = 1; _keyboardMode = 0; - //_graphicMode = CENTERED_435X272; - //_graphicMode = CENTERED_320X200; - //_graphicMode = CENTERED_362X272; } -OSystem_PSP_GU::~OSystem_PSP_GU() -{ +OSystem_PSP_GU::~OSystem_PSP_GU() { free(keyboard_symbols_shift); free(keyboard_symbols); free(keyboard_letters_shift); @@ -155,25 +151,20 @@ void OSystem_PSP_GU::initSize(uint width, uint height) { sceKernelDcacheWritebackAll(); } -int OSystem_PSP_GU::getDefaultGraphicsMode() const -{ +int OSystem_PSP_GU::getDefaultGraphicsMode() const { return STRETCHED_480X272; } -bool OSystem_PSP_GU::setGraphicsMode(int mode) -{ +bool OSystem_PSP_GU::setGraphicsMode(int mode) { _graphicMode = mode; return true; } -bool OSystem_PSP_GU::setGraphicsMode(const char *name) -{ +bool OSystem_PSP_GU::setGraphicsMode(const char *name) { int i = 0; - while(s_supportedGraphicsModes[i].name) - { - if(!strcmpi(s_supportedGraphicsModes[i].name, name)) - { + while(s_supportedGraphicsModes[i].name) { + if(!strcmpi(s_supportedGraphicsModes[i].name, name)) { _graphicMode = s_supportedGraphicsModes[i].id; return true; } @@ -183,8 +174,7 @@ bool OSystem_PSP_GU::setGraphicsMode(const char *name) return false; } -int OSystem_PSP_GU::getGraphicsMode() const -{ +int OSystem_PSP_GU::getGraphicsMode() const { return _graphicMode; } @@ -225,8 +215,7 @@ void OSystem_PSP_GU::setPalette(const byte *colors, uint start, uint num) { } -void OSystem_PSP_GU::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) -{ +void OSystem_PSP_GU::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) { //Clip the coordinates if (x < 0) { w += x; @@ -275,9 +264,7 @@ void OSystem_PSP_GU::copyRectToScreen(const byte *buf, int pitch, int x, int y, } } -void -OSystem_PSP_GU::updateScreen() -{ +void OSystem_PSP_GU::updateScreen() { float scale; sceGuStart(0,list); @@ -300,24 +287,23 @@ OSystem_PSP_GU::updateScreen() struct Vertex* vertices = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex)); vertices[0].u = 0.5; vertices[0].v = 0.5; - vertices[1].u = _screenWidth-0.5; vertices[1].v = _screenHeight-0.5; - switch(_graphicMode) - { + vertices[1].u = _screenWidth - 0.5; vertices[1].v = _screenHeight - 0.5; + switch(_graphicMode) { case CENTERED_320X200: - vertices[0].x = (PSP_SCREEN_WIDTH-320)/2; vertices[0].y = (PSP_SCREEN_HEIGHT-200)/2; vertices[0].z = 0; - vertices[1].x = PSP_SCREEN_WIDTH-(PSP_SCREEN_WIDTH-320)/2; vertices[1].y = PSP_SCREEN_HEIGHT-(PSP_SCREEN_HEIGHT-200)/2; vertices[1].z = 0; + vertices[0].x = (PSP_SCREEN_WIDTH - 320) / 2; vertices[0].y = (PSP_SCREEN_HEIGHT - 200) / 2; vertices[0].z = 0; + vertices[1].x = PSP_SCREEN_WIDTH - (PSP_SCREEN_WIDTH - 320) / 2; vertices[1].y = PSP_SCREEN_HEIGHT - (PSP_SCREEN_HEIGHT - 200) / 2; vertices[1].z = 0; break; case CENTERED_435X272: - vertices[0].x = (PSP_SCREEN_WIDTH-435)/2; vertices[0].y = 0; vertices[0].z = 0; - vertices[1].x = PSP_SCREEN_WIDTH-(PSP_SCREEN_WIDTH-435)/2; vertices[1].y = PSP_SCREEN_HEIGHT; vertices[1].z = 0; + vertices[0].x = (PSP_SCREEN_WIDTH - 435) / 2; vertices[0].y = 0; vertices[0].z = 0; + vertices[1].x = PSP_SCREEN_WIDTH - (PSP_SCREEN_WIDTH - 435) / 2; vertices[1].y = PSP_SCREEN_HEIGHT; vertices[1].z = 0; break; case STRETCHED_480X272: vertices[0].x = 0; vertices[0].y = 0; vertices[0].z = 0; vertices[1].x = PSP_SCREEN_WIDTH; vertices[1].y = PSP_SCREEN_HEIGHT; vertices[1].z = 0; break; case CENTERED_362X272: - vertices[0].x = (PSP_SCREEN_WIDTH-362)/2; vertices[0].y = 0; vertices[0].z = 0; - vertices[1].x = PSP_SCREEN_WIDTH-(PSP_SCREEN_WIDTH-362)/2; vertices[1].y = PSP_SCREEN_HEIGHT; vertices[1].z = 0; + vertices[0].x = (PSP_SCREEN_WIDTH - 362) / 2; vertices[0].y = 0; vertices[0].z = 0; + vertices[1].x = PSP_SCREEN_WIDTH - (PSP_SCREEN_WIDTH - 362) / 2; vertices[1].y = PSP_SCREEN_HEIGHT; vertices[1].z = 0; break; } @@ -326,25 +312,23 @@ OSystem_PSP_GU::updateScreen() vertices[1].y += _shakePos; } - sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,vertices); - if(_screenWidth==640) - { + sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices); + if(_screenWidth == 640) { sceGuTexImage(0, 512, 512, _screenWidth, _offscreen+512); - vertices[0].u = 512 + 0.5; vertices[1].v = _screenHeight - 0.5; - vertices[0].x += (vertices[1].x-vertices[0].x)*511/640; vertices[0].y = 0; vertices[0].z = 0; - sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,vertices); + vertices[0].u = 512 + 0.5; vertices[1].v = _screenHeight - 0.5; + vertices[0].x += (vertices[1].x - vertices[0].x) * 511 / 640; vertices[0].y = 0; vertices[0].z = 0; + sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices); } // draw overlay - if(_overlayVisible) - { + if(_overlayVisible) { vertices[0].x = 0; vertices[0].y = 0; vertices[0].z = 0; vertices[1].x = PSP_SCREEN_WIDTH; vertices[1].y = PSP_SCREEN_HEIGHT; vertices[1].z = 0; vertices[0].u = 0.5; vertices[0].v = 0.5; - vertices[1].u = _overlayWidth-0.5; vertices[1].v = _overlayHeight-0.5; + vertices[1].u = _overlayWidth - 0.5; vertices[1].v = _overlayHeight - 0.5; sceGuTexMode(GU_PSM_5551, 0, 0, 0); // 16-bit image - sceGuAlphaFunc(GU_GREATER,0,0xff); + sceGuAlphaFunc(GU_GREATER, 0, 0xff); sceGuEnable(GU_ALPHA_TEST); if (_overlayWidth > 320) sceGuTexImage(0, 512, 512, _overlayWidth, _overlayBuffer); @@ -354,18 +338,16 @@ OSystem_PSP_GU::updateScreen() sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA); sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,vertices); // need to render twice for textures > 512 - if( _overlayWidth > 512) - { - sceGuTexImage(0, 512, 512, _overlayWidth, _overlayBuffer+512); + if( _overlayWidth > 512) { + sceGuTexImage(0, 512, 512, _overlayWidth, _overlayBuffer + 512); vertices[0].u = 512 + 0.5; vertices[1].v = _overlayHeight - 0.5; - vertices[0].x = PSP_SCREEN_WIDTH*512/640; vertices[0].y = 0; vertices[0].z = 0; - sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,vertices); + vertices[0].x = PSP_SCREEN_WIDTH * 512 / 640; vertices[0].y = 0; vertices[0].z = 0; + sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices); } } // draw mouse - if (_mouseVisible) - { + if (_mouseVisible) { sceGuTexMode(GU_PSM_T8, 0, 0, 0); // 8-bit image sceGuClutMode(GU_PSM_5551, 0, 0xff, 0); sceGuClutLoad(32, mouseClut); // upload 32*8 entries (256) @@ -375,72 +357,67 @@ OSystem_PSP_GU::updateScreen() sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA); vertices[0].u = 0.5; vertices[0].v = 0.5; - vertices[1].u = _mouseWidth-0.5; vertices[1].v = _mouseHeight-0.5; + vertices[1].u = _mouseWidth - 0.5; vertices[1].v = _mouseHeight - 0.5; //adjust cursor position int mX = _mouseX - _mouseHotspotX; int mY = _mouseY - _mouseHotspotY; - if(_overlayVisible) - { + if(_overlayVisible) { float scalex, scaley; - scalex = (float)PSP_SCREEN_WIDTH/_overlayWidth; - scaley = (float)PSP_SCREEN_HEIGHT/_overlayHeight; + scalex = (float)PSP_SCREEN_WIDTH /_overlayWidth; + scaley = (float)PSP_SCREEN_HEIGHT /_overlayHeight; - vertices[0].x = mX*scalex; vertices[0].y = mY*scaley; vertices[0].z = 0; - vertices[1].x = vertices[0].x+_mouseWidth*scalex; vertices[1].y = vertices[0].y + _mouseHeight*scaley; vertices[0].z = 0; - } - else - switch(_graphicMode) - { + vertices[0].x = mX * scalex; vertices[0].y = mY * scaley; vertices[0].z = 0; + vertices[1].x = vertices[0].x + _mouseWidth * scalex; vertices[1].y = vertices[0].y + _mouseHeight * scaley; vertices[0].z = 0; + } else + switch(_graphicMode) { case CENTERED_320X200: - vertices[0].x = (PSP_SCREEN_WIDTH-320)/2+mX; vertices[0].y = (PSP_SCREEN_HEIGHT-200)/2+mY; vertices[0].z = 0; + vertices[0].x = (PSP_SCREEN_WIDTH - 320) / 2 + mX; vertices[0].y = (PSP_SCREEN_HEIGHT - 200) / 2 + mY; vertices[0].z = 0; vertices[1].x = vertices[0].x+_mouseWidth; vertices[1].y = vertices[0].y + _mouseHeight; vertices[1].z = 0; break; case CENTERED_435X272: { - scale = 435.0f/_screenWidth; - vertices[0].x = (PSP_SCREEN_WIDTH-435)/2 +mX*scale; vertices[0].y = mY*scale; vertices[0].z = 0; - vertices[1].x = vertices[0].x+_mouseWidth*scale; vertices[1].y = vertices[0].y + _mouseHeight*scale; vertices[0].z = 0; + scale = 435.0f / _screenWidth; + vertices[0].x = (PSP_SCREEN_WIDTH - 435) / 2 + mX * scale; vertices[0].y = mY * scale; vertices[0].z = 0; + vertices[1].x = vertices[0].x + _mouseWidth * scale; vertices[1].y = vertices[0].y + _mouseHeight * scale; vertices[0].z = 0; } break; case CENTERED_362X272: { float scalex, scaley; - scalex = 362.0f/_screenWidth; - scaley = 272.0f/_screenHeight; + scalex = 362.0f / _screenWidth; + scaley = 272.0f / _screenHeight; - vertices[0].x = (PSP_SCREEN_WIDTH-362)/2 +mX*scalex; vertices[0].y = mY*scaley; vertices[0].z = 0; - vertices[1].x = vertices[0].x+_mouseWidth*scalex; vertices[1].y = vertices[0].y + _mouseHeight*scaley; vertices[0].z = 0; + vertices[0].x = (PSP_SCREEN_WIDTH - 362) / 2 + mX * scalex; vertices[0].y = mY * scaley; vertices[0].z = 0; + vertices[1].x = vertices[0].x + _mouseWidth * scalex; vertices[1].y = vertices[0].y + _mouseHeight * scaley; vertices[0].z = 0; } break; case STRETCHED_480X272: { float scalex, scaley; - scalex = (float)PSP_SCREEN_WIDTH/_screenWidth; - scaley = (float)PSP_SCREEN_HEIGHT/_screenHeight; + scalex = (float)PSP_SCREEN_WIDTH / _screenWidth; + scaley = (float)PSP_SCREEN_HEIGHT / _screenHeight; - vertices[0].x = mX*scalex; vertices[0].y = mY*scaley; vertices[0].z = 0; - vertices[1].x = vertices[0].x+_mouseWidth*scalex; vertices[1].y = vertices[0].y + _mouseHeight*scaley; vertices[0].z = 0; + vertices[0].x = mX * scalex; vertices[0].y = mY * scaley; vertices[0].z = 0; + vertices[1].x = vertices[0].x + _mouseWidth * scalex; vertices[1].y = vertices[0].y + _mouseHeight * scaley; vertices[0].z = 0; } break; } - sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D,2,0,vertices); + sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITF|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices); } - if(_keyboardVisible) - { + if(_keyboardVisible) { sceGuTexMode(GU_PSM_T8, 0, 0, 0); // 8-bit image sceGuClutMode(GU_PSM_4444, 0, 0xff, 0); sceGuClutLoad(32, kbClut); // upload 32*8 entries (256) sceGuDisable(GU_ALPHA_TEST); sceGuEnable(GU_BLEND); sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0); - switch(_keyboardMode) - { + switch(_keyboardMode) { case 0: sceGuTexImage(0, 512, 512, 480, keyboard_letters); break; @@ -484,8 +461,7 @@ bool OSystem_PSP_GU::pollEvent(Event &event) { uint32 buttonsChanged = pad.Buttons ^ _prevButtons; - if ((buttonsChanged & PSP_CTRL_SELECT) || (pad.Buttons & PSP_CTRL_SELECT)) - { + if ((buttonsChanged & PSP_CTRL_SELECT) || (pad.Buttons & PSP_CTRL_SELECT)) { if( !(pad.Buttons & PSP_CTRL_SELECT) ) _keyboardVisible = !_keyboardVisible; _prevButtons = pad.Buttons; @@ -501,8 +477,7 @@ bool OSystem_PSP_GU::pollEvent(Event &event) { if ( (buttonsChanged & PSP_CTRL_LTRIGGER) && !(pad.Buttons & PSP_CTRL_LTRIGGER)) _keyboardMode ^= SYMBOLS; - if ( (buttonsChanged & PSP_CTRL_LEFT) && !(pad.Buttons & PSP_CTRL_LEFT)) - { + if ( (buttonsChanged & PSP_CTRL_LEFT) && !(pad.Buttons & PSP_CTRL_LEFT)) { event.kbd.flags = 0; event.kbd.ascii = 0; event.kbd.keycode = SDLK_LEFT; @@ -510,8 +485,7 @@ bool OSystem_PSP_GU::pollEvent(Event &event) { return true; } - if ( (buttonsChanged & PSP_CTRL_RIGHT) && !(pad.Buttons & PSP_CTRL_RIGHT)) - { + if ( (buttonsChanged & PSP_CTRL_RIGHT) && !(pad.Buttons & PSP_CTRL_RIGHT)) { event.kbd.flags = 0; event.kbd.ascii = 0; event.kbd.keycode = SDLK_RIGHT; @@ -519,8 +493,7 @@ bool OSystem_PSP_GU::pollEvent(Event &event) { return true; } - if ( (buttonsChanged & PSP_CTRL_UP) && !(pad.Buttons & PSP_CTRL_UP)) - { + if ( (buttonsChanged & PSP_CTRL_UP) && !(pad.Buttons & PSP_CTRL_UP)) { event.kbd.flags = 0; event.kbd.ascii = 0; event.kbd.keycode = SDLK_UP; @@ -528,8 +501,7 @@ bool OSystem_PSP_GU::pollEvent(Event &event) { return true; } - if ( (buttonsChanged & PSP_CTRL_DOWN) && !(pad.Buttons & PSP_CTRL_DOWN)) - { + if ( (buttonsChanged & PSP_CTRL_DOWN) && !(pad.Buttons & PSP_CTRL_DOWN)) { event.kbd.flags = 0; event.kbd.ascii = 0; event.kbd.keycode = SDLK_DOWN; @@ -538,49 +510,41 @@ bool OSystem_PSP_GU::pollEvent(Event &event) { } // compute nub direction - // x = pad.Lx-128; y = pad.Ly-128; _kbdClut[_keySelected] = 0xf888; - if(x*x + y*y > 10000) - { + if(x*x + y*y > 10000) { nub_angle = atan2(y, x); - _keySelected = (int)(1+(M_PI+nub_angle)*30/(2*M_PI)); + _keySelected = (int)(1 + (M_PI + nub_angle) * 30 / (2 * M_PI)); _keySelected -= 2; if(_keySelected < 1) _keySelected += 30; _kbdClut[_keySelected] = 0xffff; - if (buttonsChanged & PSP_CTRL_CROSS) - { + if (buttonsChanged & PSP_CTRL_CROSS) { event.type = (pad.Buttons & PSP_CTRL_CROSS) ? OSystem::EVENT_KEYDOWN : OSystem::EVENT_KEYUP; - if(_keySelected >26) - { + if(_keySelected > 26) { event.kbd.flags = 0; - switch(_keySelected) - { + switch(_keySelected) { case 27: - event.kbd.ascii = ' '; - event.kbd.keycode = SDLK_SPACE; + event.kbd.ascii = ' '; + event.kbd.keycode = SDLK_SPACE; break; case 28: - event.kbd.ascii = 127; - event.kbd.keycode = SDLK_DELETE; + event.kbd.ascii = 127; + event.kbd.keycode = SDLK_DELETE; break; case 29: - event.kbd.ascii = 8; - event.kbd.keycode = SDLK_BACKSPACE; + event.kbd.ascii = 8; + event.kbd.keycode = SDLK_BACKSPACE; break; case 30: - event.kbd.ascii = 13; - event.kbd.keycode = SDLK_RETURN; + event.kbd.ascii = 13; + event.kbd.keycode = SDLK_RETURN; break; } - } - else - { - switch( _keyboardMode) - { + } else { + switch( _keyboardMode) { case 0: event.kbd.flags = 0; event.kbd.ascii = 'a'+_keySelected-1; @@ -592,16 +556,14 @@ bool OSystem_PSP_GU::pollEvent(Event &event) { event.kbd.flags = KBD_SHIFT; break; case SYMBOLS: - if(_keySelected < 21) - { + if (_keySelected < 21) { event.kbd.flags = 0; event.kbd.ascii = kbd_ascii[_keySelected-1]; event.kbd.keycode = kbd_code[ _keySelected-1]; } break; case (SYMBOLS|CAPS_LOCK): - if(_keySelected < 21) - { + if(_keySelected < 21) { event.kbd.flags = 0; event.kbd.ascii = kbd_ascii_cl[_keySelected-1]; event.kbd.keycode = kbd_code_cl[ _keySelected-1]; |