PSP: Fix code formatting using astyle
svn-id: r48634
This commit is contained in:
parent
98d7ba281c
commit
87028c546f
28 changed files with 840 additions and 832 deletions
|
@ -103,7 +103,7 @@ PSPFilesystemNode::PSPFilesystemNode(const Common::String &p, bool verify) {
|
|||
|
||||
if (verify) {
|
||||
struct stat st;
|
||||
if (PowerMan.beginCriticalSection()==PowerManager::Blocked)
|
||||
if (PowerMan.beginCriticalSection() == PowerManager::Blocked)
|
||||
PSP_DEBUG_PRINT_FUNC("Suspended\n");
|
||||
_isValid = (0 == stat(_path.c_str(), &st));
|
||||
PowerMan.endCriticalSection();
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "backends/platform/psp/trace.h"
|
||||
|
||||
PSPIoStream::PSPIoStream(const Common::String &path, bool writeMode)
|
||||
: StdioStream((void *)1), _path(path), _writeMode(writeMode) {
|
||||
: StdioStream((void *)1), _path(path), _writeMode(writeMode) {
|
||||
DEBUG_ENTER_FUNC();
|
||||
|
||||
assert(!path.empty());
|
||||
|
@ -155,8 +155,7 @@ bool PSPIoStream::seek(int32 offs, int whence) {
|
|||
clearerr((FILE *)_handle);
|
||||
_feof = feof((FILE *)_handle);
|
||||
_errorSource = 3;
|
||||
}
|
||||
else { // everything ok
|
||||
} else { // everything ok
|
||||
_feof = false; // Reset eof flag since we know it was ok
|
||||
}
|
||||
|
||||
|
|
|
@ -214,8 +214,8 @@ bool Cursor::increaseXY(int32 incX, int32 incY) {
|
|||
|
||||
// Set limits on the movement of the cursor ie. screen size
|
||||
void Cursor::setLimits(uint32 width, uint32 height) {
|
||||
#define PSP_SCREEN_WIDTH 480
|
||||
#define PSP_SCREEN_HEIGHT 272
|
||||
#define PSP_SCREEN_WIDTH 480
|
||||
#define PSP_SCREEN_HEIGHT 272
|
||||
DEBUG_ENTER_FUNC();
|
||||
|
||||
PSP_DEBUG_PRINT("width[%u], height[%u]\n", width, height);
|
||||
|
|
|
@ -43,8 +43,7 @@ bool DefaultDisplayClient::allocate(bool bufferInVram /* = false */, bool palett
|
|||
return false;
|
||||
}
|
||||
|
||||
if (_buffer.hasPalette())
|
||||
{
|
||||
if (_buffer.hasPalette()) {
|
||||
PSP_DEBUG_PRINT("_palette[%p]\n", &_palette);
|
||||
|
||||
if (!_palette.allocate()) {
|
||||
|
|
|
@ -75,13 +75,13 @@ void Palette::setColorPositionAlpha(uint32 position, bool alpha) {
|
|||
|
||||
switch (_pixelFormat.bitsPerPixel) {
|
||||
case 16: {
|
||||
uint16 *shortVal = (uint16 *)&_values[_pixelFormat.pixelsToBytes(position)];
|
||||
*shortVal = _pixelFormat.setColorAlpha((uint32)*shortVal, alpha ? 255 : 0);
|
||||
uint16 *shortVal = (uint16 *) & _values[_pixelFormat.pixelsToBytes(position)];
|
||||
*shortVal = _pixelFormat.setColorAlpha((uint32) * shortVal, alpha ? 255 : 0);
|
||||
}
|
||||
break;
|
||||
case 32: {
|
||||
uint32 *wordVal = (uint32 *)&_values[_pixelFormat.pixelsToBytes(position)];
|
||||
*wordVal = _pixelFormat.setColorAlpha((uint32)*wordVal, alpha ? 255 : 0);
|
||||
uint32 *wordVal = (uint32 *) & _values[_pixelFormat.pixelsToBytes(position)];
|
||||
*wordVal = _pixelFormat.setColorAlpha((uint32) * wordVal, alpha ? 255 : 0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -114,8 +114,7 @@ void Palette::setPartial(const byte *colors, uint32 start, uint32 num, bool supp
|
|||
src += 4;
|
||||
palette++;
|
||||
}
|
||||
}
|
||||
else if (_pixelFormat.bitsPerPixel == 32) {
|
||||
} else if (_pixelFormat.bitsPerPixel == 32) {
|
||||
uint32 *palette = (uint32 *)_values;
|
||||
palette += start;
|
||||
|
||||
|
@ -164,7 +163,7 @@ bool Palette::allocate() {
|
|||
PSP_DEBUG_PRINT("_pixelFormat: format[%u], bpp[%u]\n", _pixelFormat.format, _pixelFormat.bitsPerPixel);
|
||||
|
||||
if (_values) {
|
||||
free (CACHED(_values));
|
||||
free(CACHED(_values));
|
||||
_values = 0;
|
||||
}
|
||||
|
||||
|
@ -194,7 +193,7 @@ bool Palette::allocate() {
|
|||
void Palette::deallocate() {
|
||||
DEBUG_ENTER_FUNC();
|
||||
|
||||
free (CACHED(_values));
|
||||
free(CACHED(_values));
|
||||
_values = 0;
|
||||
_numOfEntries = 0;
|
||||
|
||||
|
@ -250,8 +249,8 @@ void Palette::setSingleColorRGBA(uint32 num, byte r, byte g, byte b, byte a) {
|
|||
uint16 *shortValues;
|
||||
uint32 *wordValues;
|
||||
|
||||
assert (_values);
|
||||
assert (num < _numOfEntries);
|
||||
assert(_values);
|
||||
assert(num < _numOfEntries);
|
||||
|
||||
switch (_pixelFormat.bitsPerPixel) {
|
||||
case 16:
|
||||
|
@ -272,14 +271,14 @@ void Palette::setSingleColorRGBA(uint32 num, byte r, byte g, byte b, byte a) {
|
|||
// Print to screen
|
||||
void Palette::print(uint32 numToPrint /* = 0 */) {
|
||||
if (_numOfEntries > 0) {
|
||||
assert (_values);
|
||||
assert(_values);
|
||||
|
||||
if (numToPrint > _numOfEntries || numToPrint == 0)
|
||||
numToPrint = _numOfEntries;
|
||||
|
||||
PSP_INFO_PRINT("cursor palette:\n");
|
||||
|
||||
for (unsigned int i=0; i<numToPrint; i++) {
|
||||
for (unsigned int i = 0; i < numToPrint; i++) {
|
||||
byte *pcolor = &_values[_pixelFormat.pixelsToBytes(i)];
|
||||
uint32 color = _pixelFormat.getColorValueAt(pcolor);
|
||||
|
||||
|
@ -335,7 +334,7 @@ void Buffer::copyFromArray(const byte *buffer, int pitch) {
|
|||
void Buffer::copyFromRect(const byte *buf, uint32 pitch, int destX, int destY, uint32 recWidth, uint32 recHeight) {
|
||||
// Removed silly clipping code
|
||||
DEBUG_ENTER_FUNC();
|
||||
assert (_pixels);
|
||||
assert(_pixels);
|
||||
|
||||
if (recWidth > _sourceSize.width - destX) {
|
||||
recWidth = _sourceSize.width - destX;
|
||||
|
@ -373,7 +372,7 @@ void Buffer::copyFromRect(const byte *buf, uint32 pitch, int destX, int destY, u
|
|||
/* pitch is in bytes */
|
||||
void Buffer::copyToArray(byte *dst, int pitch) {
|
||||
DEBUG_ENTER_FUNC();
|
||||
assert (_pixels);
|
||||
assert(_pixels);
|
||||
|
||||
uint32 h = _height;
|
||||
byte *src = _pixels;
|
||||
|
@ -405,8 +404,7 @@ void Buffer::setSize(uint32 width, uint32 height, HowToSize textureOrSource/*=kS
|
|||
if (textureOrSource == kSizeByTextureSize) {
|
||||
_width = _textureSize.width;
|
||||
_height = _textureSize.height;
|
||||
}
|
||||
else { /* kSizeBySourceSize */
|
||||
} else { /* kSizeBySourceSize */
|
||||
_width = _sourceSize.width;
|
||||
_height = _sourceSize.height;
|
||||
}
|
||||
|
@ -446,7 +444,7 @@ bool Buffer::allocate(bool inVram/*=false*/) {
|
|||
if (VramAllocator::isAddressInVram(_pixels)) // Check if in VRAM
|
||||
VramAllocator::instance().deallocate(_pixels);
|
||||
else // not in VRAM
|
||||
free (CACHED(_pixels));
|
||||
free(CACHED(_pixels));
|
||||
|
||||
_pixels = 0;
|
||||
}
|
||||
|
@ -533,8 +531,8 @@ void Buffer::print(uint32 mask, uint32 numToPrint /*=0*/) {
|
|||
PSP_INFO_PRINT("buffer: \n");
|
||||
PSP_INFO_PRINT("width[%u], height[%u]\n\n", _sourceSize.width, _sourceSize.height);
|
||||
|
||||
for (unsigned int i=0; i < _sourceSize.height; i++) {
|
||||
for (unsigned int j=0; j < _sourceSize.width; j++) {
|
||||
for (unsigned int i = 0; i < _sourceSize.height; i++) {
|
||||
for (unsigned int j = 0; j < _sourceSize.width; j++) {
|
||||
if (numToPrint <= 0) // check if done
|
||||
break;
|
||||
|
||||
|
@ -733,7 +731,7 @@ void GuRenderer::fillVertices(Vertex *vertices) {
|
|||
|
||||
float imageStartX, imageStartY, imageEndX, imageEndY;
|
||||
|
||||
imageStartX = gapX + ( scaleSourceToOutputX(_maxTextureOffset.x) );
|
||||
imageStartX = gapX + (scaleSourceToOutputX(_maxTextureOffset.x));
|
||||
imageStartY = gapY;
|
||||
|
||||
imageStartX += scaleSourceToOutputX(_offsetOnScreen.x);
|
||||
|
@ -796,7 +794,7 @@ inline float GuRenderer::scaleSourceToOutputY(float offset) {
|
|||
inline void GuRenderer::guDrawVertices(Vertex *vertices) {
|
||||
DEBUG_ENTER_FUNC();
|
||||
|
||||
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);
|
||||
DEBUG_EXIT_FUNC();
|
||||
}
|
||||
|
||||
|
|
|
@ -55,8 +55,8 @@ public:
|
|||
* Vertex used for GU rendering
|
||||
*/
|
||||
struct Vertex {
|
||||
float u,v;
|
||||
float x,y,z;
|
||||
float u, v;
|
||||
float x, y, z;
|
||||
};
|
||||
|
||||
struct Point {
|
||||
|
@ -124,7 +124,7 @@ public:
|
|||
virtual ~Buffer() { deallocate(); }
|
||||
|
||||
// setters
|
||||
void setSize(uint32 width, uint32 height, HowToSize textureOrSource=kSizeByTextureSize);
|
||||
void setSize(uint32 width, uint32 height, HowToSize textureOrSource = kSizeByTextureSize);
|
||||
void setBitsPerPixel(uint32 bits) { _pixelFormat.bitsPerPixel = bits; }
|
||||
void setBytesPerPixel(uint32 bytes) { setBitsPerPixel(bytes << 3); }
|
||||
void setPixelFormat(PSPPixelFormat::Type type, bool swapRedBlue = false);
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
uint32 __attribute__((aligned(16))) MasterGuRenderer::_displayList[2048];
|
||||
|
||||
const OSystem::GraphicsMode DisplayManager::_supportedModes[] = {
|
||||
const OSystem::GraphicsMode DisplayManager::_supportedModes[] = {
|
||||
{ "320x200 (centered)", "320x200 16-bit centered", CENTERED_320X200 },
|
||||
{ "435x272 (best-fit, centered)", "435x272 16-bit centered", CENTERED_435X272 },
|
||||
{ "480x272 (full screen)", "480x272 16-bit stretched", STRETCHED_480X272 },
|
||||
|
@ -67,7 +67,7 @@ void MasterGuRenderer::guInit() {
|
|||
|
||||
guProgramDisplayBufferSizes();
|
||||
|
||||
sceGuOffset(2048 - (PSP_SCREEN_WIDTH/2), 2048 - (PSP_SCREEN_HEIGHT/2));
|
||||
sceGuOffset(2048 - (PSP_SCREEN_WIDTH / 2), 2048 - (PSP_SCREEN_HEIGHT / 2));
|
||||
sceGuViewport(2048, 2048, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
|
||||
sceGuDepthRange(0xC350, 0x2710);
|
||||
sceGuDisable(GU_DEPTH_TEST); // We'll use depth buffer area
|
||||
|
@ -77,9 +77,9 @@ void MasterGuRenderer::guInit() {
|
|||
sceGuFrontFace(GU_CW);
|
||||
sceGuEnable(GU_TEXTURE_2D);
|
||||
|
||||
sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
|
||||
sceGuClear(GU_COLOR_BUFFER_BIT | GU_DEPTH_BUFFER_BIT);
|
||||
sceGuFinish();
|
||||
sceGuSync(0,0);
|
||||
sceGuSync(0, 0);
|
||||
|
||||
sceDisplayWaitVblankStart();
|
||||
sceGuDisplay(1);
|
||||
|
@ -125,7 +125,7 @@ inline void MasterGuRenderer::guPreRender() {
|
|||
|
||||
sceGuAmbientColor(0xFFFFFFFF);
|
||||
sceGuColor(0xFFFFFFFF);
|
||||
sceGuTexOffset(0,0);
|
||||
sceGuTexOffset(0, 0);
|
||||
sceGuTexFilter(GU_LINEAR, GU_LINEAR);
|
||||
|
||||
sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA); // Also good enough for all purposes
|
||||
|
@ -138,7 +138,7 @@ inline void MasterGuRenderer::guPostRender() {
|
|||
DEBUG_ENTER_FUNC();
|
||||
|
||||
sceGuFinish();
|
||||
sceGuSync(0,0);
|
||||
sceGuSync(0, 0);
|
||||
|
||||
#ifdef ENABLE_RENDER_MEASURE
|
||||
uint32 now = g_system->getMillis();
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef BACKENDS_ELF_H
|
||||
#define BACKENDS_ELF_H
|
||||
#ifndef BACKENDS_ELF_H
|
||||
#define BACKENDS_ELF_H
|
||||
|
||||
/* ELF stuff */
|
||||
/* ELF stuff */
|
||||
|
||||
typedef unsigned short Elf32_Half, Elf32_Section;
|
||||
typedef unsigned int Elf32_Word, Elf32_Addr, Elf32_Off;
|
||||
|
@ -39,8 +39,7 @@ typedef Elf32_Half Elf32_Versym;
|
|||
/* ELF File format structures. Look up ELF structure for more details */
|
||||
|
||||
// ELF header (contains info about the file)
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
|
||||
Elf32_Half e_type; /* Object file type */
|
||||
Elf32_Half e_machine; /* Architecture */
|
||||
|
@ -72,8 +71,7 @@ typedef struct
|
|||
|
||||
|
||||
// Program header (contains info about segment)
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
Elf32_Word p_type; /* Segment type */
|
||||
Elf32_Off p_offset; /* Segment file offset */
|
||||
Elf32_Addr p_vaddr; /* Segment virtual address */
|
||||
|
@ -100,8 +98,7 @@ typedef struct
|
|||
#define PF_R 4 /* read */
|
||||
|
||||
// Section header (contains info about section)
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
Elf32_Word sh_name; /* Section name (string tbl index) */
|
||||
Elf32_Word sh_type; /* Section type */
|
||||
Elf32_Word sh_flags; /* Section flags */
|
||||
|
@ -139,8 +136,7 @@ typedef struct
|
|||
|
||||
|
||||
// Symbol entry (contain info about a symbol)
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
Elf32_Word st_name; /* Symbol name (string tbl index) */
|
||||
Elf32_Addr st_value; /* Symbol value */
|
||||
Elf32_Word st_size; /* Symbol size */
|
||||
|
@ -175,8 +171,7 @@ typedef struct
|
|||
#define SHN_HIRESERVE 0xFFFF
|
||||
|
||||
// Relocation entry (info about how to relocate)
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
Elf32_Addr r_offset; /* Address */
|
||||
Elf32_Word r_info; /* Relocation type and symbol index */
|
||||
} Elf32_Rel;
|
||||
|
@ -211,4 +206,4 @@ typedef struct
|
|||
__valgp; \
|
||||
})
|
||||
|
||||
#endif /* BACKENDS_ELF_H */
|
||||
#endif /* BACKENDS_ELF_H */
|
||||
|
|
|
@ -73,8 +73,7 @@ bool InputHandler::getAllInputs(Common::Event &event) {
|
|||
else
|
||||
haveEvent = getEvent(event, pad);
|
||||
|
||||
if (haveEvent)
|
||||
{
|
||||
if (haveEvent) {
|
||||
PSP_DEBUG_PRINT("Have event[%s]\n", haveEvent ? "true" : "false");
|
||||
PSP_DEBUG_PRINT("event.type[%d]\n", event.type);
|
||||
}
|
||||
|
@ -139,8 +138,7 @@ bool InputHandler::getDpadEvent(Common::Event &event, SceCtrlData &pad) {
|
|||
event.kbd.ascii = event.kbd.keycode - Common::KEYCODE_KP0 + '0'; // Get ascii
|
||||
_dpadX = newDpadX;
|
||||
_dpadY = newDpadY;
|
||||
}
|
||||
else if (newDpadX == 0 && newDpadY == 0) {// We're now centered so we unpressed dpad
|
||||
} else if (newDpadX == 0 && newDpadY == 0) {// We're now centered so we unpressed dpad
|
||||
event.type = Common::EVENT_KEYUP;
|
||||
event.kbd.keycode = translateDpad(_dpadX, _dpadY);
|
||||
event.kbd.ascii = event.kbd.keycode - Common::KEYCODE_KP0 + '0';
|
||||
|
@ -234,7 +232,7 @@ bool InputHandler::getButtonEvent(Common::Event &event, SceCtrlData &pad) {
|
|||
} else if (DOWN(PSP_CTRL_RTRIGGER)) { // An event
|
||||
event.kbd.flags |= Common::KBD_SHIFT;
|
||||
}
|
||||
PSP_DEBUG_PRINT("Ascii[%d]. Key %s.\n", event.kbd.ascii, event.type == Common::EVENT_KEYDOWN ? "down" : "up" );
|
||||
PSP_DEBUG_PRINT("Ascii[%d]. Key %s.\n", event.kbd.ascii, event.type == Common::EVENT_KEYDOWN ? "down" : "up");
|
||||
}
|
||||
|
||||
haveEvent = true;
|
||||
|
|
|
@ -112,7 +112,7 @@ test:
|
|||
#ifdef __PSP_DEBUG_PRINT__
|
||||
bool mismatch = false;
|
||||
|
||||
for (uint32 i=0; i<debugBytes; i++) {
|
||||
for (uint32 i = 0; i < debugBytes; i++) {
|
||||
if (debugDst[i] != debugSrc[i]) {
|
||||
if (mismatch == false) {
|
||||
PSP_DEBUG_PRINT_SAMELN("mismatch in copy:\n");
|
||||
|
@ -172,7 +172,7 @@ DECLARE_SINGLETON(VramAllocator)
|
|||
|
||||
void *VramAllocator::allocate(int32 size, bool smallAllocation /* = false */) {
|
||||
DEBUG_ENTER_FUNC();
|
||||
assert (size > 0);
|
||||
assert(size > 0);
|
||||
|
||||
byte *lastAddress = smallAllocation ? (byte *)VRAM_SMALL_ADDRESS : (byte *)VRAM_START_ADDRESS;
|
||||
Common::List<Allocation>::iterator i;
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
if ((uint32)(CACHED(address)) >= VRAM_START_ADDRESS && (uint32)(CACHED(address)) < VRAM_END_ADDRESS)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
@ -71,7 +71,7 @@ private:
|
|||
enum {
|
||||
VRAM_START_ADDRESS = 0x04000000,
|
||||
VRAM_END_ADDRESS = 0x04200000,
|
||||
VRAM_SMALL_ADDRESS = VRAM_END_ADDRESS - (4*1024) // 4K in the end for small allocations
|
||||
VRAM_SMALL_ADDRESS = VRAM_END_ADDRESS - (4 * 1024) // 4K in the end for small allocations
|
||||
};
|
||||
Common::List <Allocation> _allocList; // List of allocations
|
||||
uint32 _bytesAllocated;
|
||||
|
|
|
@ -337,7 +337,7 @@ bool OSystem_PSP::showMouse(bool v) {
|
|||
void OSystem_PSP::warpMouse(int x, int y) {
|
||||
DEBUG_ENTER_FUNC();
|
||||
|
||||
_cursor.setXY(x,y);
|
||||
_cursor.setXY(x, y);
|
||||
|
||||
DEBUG_EXIT_FUNC();
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ inline void PowerManager::debugPM() {
|
|||
}
|
||||
|
||||
|
||||
/*******************************************
|
||||
/*******************************************
|
||||
*
|
||||
* Constructor
|
||||
*
|
||||
|
@ -85,7 +85,7 @@ PowerManager::PowerManager() {
|
|||
_error = 0;
|
||||
|
||||
DEBUG_EXIT_FUNC();
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************
|
||||
*
|
||||
|
@ -140,14 +140,14 @@ int PowerManager::unregisterSuspend(Suspendable *item) {
|
|||
|
||||
DEBUG_EXIT_FUNC();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************
|
||||
/*******************************************
|
||||
*
|
||||
* Destructor
|
||||
*
|
||||
********************************************/
|
||||
PowerManager::~PowerManager() {
|
||||
PowerManager::~PowerManager() {
|
||||
DEBUG_ENTER_FUNC();
|
||||
|
||||
PMStatusSet(kDestroyPM);
|
||||
|
@ -165,7 +165,7 @@ int PowerManager::unregisterSuspend(Suspendable *item) {
|
|||
_listMutex = 0;
|
||||
|
||||
DEBUG_EXIT_FUNC();
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************
|
||||
*
|
||||
|
@ -186,8 +186,7 @@ void PowerManager::pollPauseEngine() {
|
|||
g_engine->pauseEngine(true);
|
||||
PSP_DEBUG_PRINT_FUNC("Pausing engine\n");
|
||||
_pauseClientState = PowerManager::Paused; // Tell PM we're done pausing
|
||||
}
|
||||
else if (!pause && _pauseClientState == PowerManager::Paused) {
|
||||
} else if (!pause && _pauseClientState == PowerManager::Paused) {
|
||||
g_engine->pauseEngine(false);
|
||||
PSP_DEBUG_PRINT_FUNC("Unpausing for resume\n");
|
||||
_pauseClientState = PowerManager::Unpaused; // Tell PM we're in the middle of pausing
|
||||
|
@ -290,7 +289,7 @@ int PowerManager::endCriticalSection() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*******************************************
|
||||
/*******************************************
|
||||
*
|
||||
* Callback function to be called to put every Suspendable to suspend
|
||||
*
|
||||
|
|
|
@ -31,25 +31,25 @@
|
|||
#include "common/singleton.h"
|
||||
#include "common/list.h"
|
||||
|
||||
/*
|
||||
/*
|
||||
* Implement this class (interface) if you want to use PowerManager's suspend callback functionality
|
||||
*
|
||||
*/
|
||||
class Suspendable {
|
||||
public:
|
||||
class Suspendable {
|
||||
public:
|
||||
virtual ~Suspendable() {}
|
||||
virtual int suspend() = 0;
|
||||
virtual int resume() = 0;
|
||||
};
|
||||
};
|
||||
|
||||
/******************************************************************************************************
|
||||
*
|
||||
* This class will call a Suspendable when the PSP goes to suspend/resumes. It also provides the ability to block
|
||||
* a thread when the PSP is going to suspend/suspending, and to wake it up when the PSP is resumed.
|
||||
* This ability is very useful for managing the PSPIoStream class, but may be found useful by other classes as well.
|
||||
*
|
||||
*******************************************************************************************************/
|
||||
class PowerManager: public Common::Singleton<PowerManager> {
|
||||
/******************************************************************************************************
|
||||
*
|
||||
* This class will call a Suspendable when the PSP goes to suspend/resumes. It also provides the ability to block
|
||||
* a thread when the PSP is going to suspend/suspending, and to wake it up when the PSP is resumed.
|
||||
* This ability is very useful for managing the PSPIoStream class, but may be found useful by other classes as well.
|
||||
*
|
||||
*******************************************************************************************************/
|
||||
class PowerManager: public Common::Singleton<PowerManager> {
|
||||
|
||||
public:
|
||||
int blockOnSuspend(); /* block if suspending */
|
||||
|
@ -76,7 +76,7 @@ public:
|
|||
Paused
|
||||
};
|
||||
|
||||
private:
|
||||
private:
|
||||
friend class Common::Singleton<PowerManager>;
|
||||
PowerManager();
|
||||
~PowerManager();
|
||||
|
@ -125,12 +125,12 @@ public:
|
|||
void PMStatusSet(PMState s) { _PMStatus = s; }
|
||||
volatile int _PMStatus; /* What the PM is doing */
|
||||
|
||||
public:
|
||||
public:
|
||||
int getPMStatus() { return _PMStatus; }
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
// For easy access
|
||||
// For easy access
|
||||
#define PowerMan PowerManager::instance()
|
||||
|
||||
#endif /* POWERMAN_H */
|
||||
|
|
|
@ -26,10 +26,10 @@
|
|||
#define USERSPACE_ONLY //don't use kernel mode features
|
||||
|
||||
#ifndef USERSPACE_ONLY
|
||||
#include <pspkernel.h>
|
||||
#include <pspdebug.h>
|
||||
#include <pspkernel.h>
|
||||
#include <pspdebug.h>
|
||||
#else
|
||||
#include <pspuser.h>
|
||||
#include <pspuser.h>
|
||||
#endif
|
||||
|
||||
#include <psppower.h>
|
||||
|
@ -87,7 +87,7 @@ void MyExceptionHandler(PspDebugRegBlock *regs) {
|
|||
* Function that is called from _init in kernelmode before the
|
||||
* main thread is started in usermode.
|
||||
*/
|
||||
__attribute__ ((constructor))
|
||||
__attribute__((constructor))
|
||||
void loaderInit() {
|
||||
pspKernelSetKernelPC();
|
||||
pspDebugInstallErrorHandler(MyExceptionHandler);
|
||||
|
@ -150,7 +150,7 @@ int main(void) {
|
|||
SetupCallbacks();
|
||||
|
||||
static const char *argv[] = { "scummvm", NULL };
|
||||
static int argc = sizeof(argv)/sizeof(char *)-1;
|
||||
static int argc = sizeof(argv) / sizeof(char *) - 1;
|
||||
|
||||
g_system = new OSystem_PSP();
|
||||
assert(g_system);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
//#define PSP_KB_SHELL /* Need a hack to properly load the keyboard from the PSP shell */
|
||||
|
||||
#ifdef PSP_KB_SHELL
|
||||
#define PSP_KB_SHELL_PATH "ms0:/psp/game4xx/scummvm-solid/" /* path to kbd.zip */
|
||||
#define PSP_KB_SHELL_PATH "ms0:/psp/game4xx/scummvm-solid/" /* path to kbd.zip */
|
||||
#endif
|
||||
|
||||
//#define __PSP_DEBUG_FUNCS__ /* For debugging the stack */
|
||||
|
@ -80,7 +80,7 @@ short PSPKeyboard::_modeChar[MODE_COUNT][5][6] = {
|
|||
},
|
||||
{ //symbols
|
||||
{ K('!'), K(')'), K('?'), K('('), K('<'), K('>') },
|
||||
{ K('+'), K('/'), K('='), K('\\'),K('\''),K('"') },
|
||||
{ K('+'), K('/'), K('='), K('\\'), K('\''), K('"') },
|
||||
{ K(':'), K(']'), K(';'), K('['), K('@'), K('#') },
|
||||
{ K('-'), K('}'), K('_'), K('{'), K('*'), K('$') },
|
||||
{ K('\b'), K('.'), K(' '), K(','), K(0), K(0) }
|
||||
|
@ -150,8 +150,7 @@ void PSPKeyboard::setVisible(bool val) {
|
|||
if (val && _state == kInvisible && _init) { // Check also that were loaded correctly
|
||||
_lastState = _state;
|
||||
_state = kMove;
|
||||
}
|
||||
else if ( !val && _state != kInvisible) {
|
||||
} else if (!val && _state != kInvisible) {
|
||||
_lastState = _state;
|
||||
_state = kInvisible;
|
||||
}
|
||||
|
@ -205,7 +204,7 @@ void PSPKeyboard::increaseKeyboardLocationY(int amount) {
|
|||
void PSPKeyboard::render() {
|
||||
DEBUG_ENTER_FUNC();
|
||||
|
||||
unsigned int currentBuffer = _mode<<1;
|
||||
unsigned int currentBuffer = _mode << 1;
|
||||
|
||||
// Draw the background letters
|
||||
// Set renderer to current buffer & palette
|
||||
|
@ -235,7 +234,7 @@ void PSPKeyboard::render() {
|
|||
}
|
||||
|
||||
inline void PSPKeyboard::convertCursorToXY(CursorDirections cur, int &x, int &y) {
|
||||
switch(cur) {
|
||||
switch (cur) {
|
||||
case kUp:
|
||||
x = 1;
|
||||
y = 0;
|
||||
|
@ -332,7 +331,7 @@ bool PSPKeyboard::load() {
|
|||
_buffers[i].setPixelFormat(PSPPixelFormat::Type_Palette_4bit);
|
||||
_palettes[i].setPixelFormats(PSPPixelFormat::Type_4444, PSPPixelFormat::Type_Palette_4bit);
|
||||
paletteSize = 16;
|
||||
} else if (paletteSize <= 256){ // 8-bit image
|
||||
} else if (paletteSize <= 256) { // 8-bit image
|
||||
paletteSize = 256;
|
||||
_buffers[i].setPixelFormat(PSPPixelFormat::Type_Palette_8bit);
|
||||
_palettes[i].setPixelFormats(PSPPixelFormat::Type_4444, PSPPixelFormat::Type_Palette_8bit);
|
||||
|
@ -361,8 +360,7 @@ bool PSPKeyboard::load() {
|
|||
|
||||
delete file;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
PSP_ERROR("couldn't obtain PNG image size\n");
|
||||
goto ERROR;
|
||||
}
|
||||
|
@ -480,7 +478,7 @@ int PSPKeyboard::loadPngImage(Common::SeekableReadStream *file, Buffer &buffer,
|
|||
if (color_type == PNG_COLOR_TYPE_PALETTE) {
|
||||
// Copy the palette
|
||||
png_colorp srcPal = info_ptr->palette;
|
||||
for(int i=0; i < info_ptr->num_palette; i++) {
|
||||
for (int i = 0; i < info_ptr->num_palette; i++) {
|
||||
unsigned char alphaVal = (i < info_ptr->num_trans) ? info_ptr->trans[i] : 0xFF; // Load alpha if it's there
|
||||
palette.setSingleColorRGBA(i, srcPal->red, srcPal->green, srcPal->blue, alphaVal);
|
||||
srcPal++;
|
||||
|
@ -546,8 +544,7 @@ bool PSPKeyboard::processInput(Common::Event &event, SceCtrlData &pad) {
|
|||
if (_state != kMove && PRESSED(PSP_CTRL_SELECT)) {
|
||||
_lastState = _state;
|
||||
_state = kMove; // Check for move or visible state
|
||||
}
|
||||
else if (CHANGED(PSP_CTRL_START)) { // Handle start button: enter, make KB invisible
|
||||
} else if (CHANGED(PSP_CTRL_START)) { // Handle start button: enter, make KB invisible
|
||||
event.kbd.ascii = '\r';
|
||||
event.kbd.keycode = Common::KEYCODE_RETURN;
|
||||
event.type = DOWN(PSP_CTRL_START) ? Common::EVENT_KEYDOWN : Common::EVENT_KEYUP;
|
||||
|
@ -670,13 +667,13 @@ bool PSPKeyboard::getInputChoice(Common::Event &event, SceCtrlData &pad) {
|
|||
} else if (PRESSED(PSP_CTRL_LTRIGGER) && _state == kCornersSelected) {
|
||||
innerChoice = 4;
|
||||
event.type = Common::EVENT_KEYDOWN; // We give priority to key_up
|
||||
} else /* (PRESSED(PSP_CTRL_RTRIGGER)) && _state == kCornersSelected */ {
|
||||
} else { /* (PRESSED(PSP_CTRL_RTRIGGER)) && _state == kCornersSelected */
|
||||
innerChoice = 5;
|
||||
event.type = Common::EVENT_KEYDOWN; // We give priority to key_up
|
||||
}
|
||||
|
||||
#define IS_UPPERCASE(x) ((x) >= (unsigned short)'A' && (x) <= (unsigned short)'Z')
|
||||
#define TO_LOWER(x) ((x) += 'a'-'A')
|
||||
#define IS_UPPERCASE(x) ((x) >= (unsigned short)'A' && (x) <= (unsigned short)'Z')
|
||||
#define TO_LOWER(x) ((x) += 'a'-'A')
|
||||
|
||||
//Now grab the value out of the array
|
||||
short choice = _modeChar[_mode][_oldCursor][innerChoice];
|
||||
|
@ -729,7 +726,7 @@ void PSPKeyboard::handleLTriggerDownState(SceCtrlData &pad) {
|
|||
if (UNPRESSED(PSP_CTRL_LTRIGGER)) {
|
||||
_dirty = true;
|
||||
|
||||
if(_mode < 2)
|
||||
if (_mode < 2)
|
||||
_mode = 2;
|
||||
else
|
||||
_mode = (_mode == 2) ? 3 : 2;
|
||||
|
@ -744,7 +741,7 @@ void PSPKeyboard::handleRTriggerDownState(SceCtrlData &pad) {
|
|||
if (UNPRESSED(PSP_CTRL_RTRIGGER)) {
|
||||
_dirty = true;
|
||||
|
||||
if(_mode > 1)
|
||||
if (_mode > 1)
|
||||
_mode = 0;
|
||||
else
|
||||
_mode = (_mode == 0) ? 1 : 0;
|
||||
|
|
|
@ -134,7 +134,7 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size, void *
|
|||
|
||||
case R_MIPS_HI16: // Absolute addressing.
|
||||
if (sym->st_shndx < SHN_LOPROC && // Only shift for plugin section (ie. has a real section index)
|
||||
firstHi16 < 0 ) { // Only process first in block of HI16s
|
||||
firstHi16 < 0) { // Only process first in block of HI16s
|
||||
firstHi16 = i; // Keep the first Hi16 we saw
|
||||
seenHi16 = true;
|
||||
ahl = (*target & 0xffff) << 16; // Take lower 16 bits shifted up
|
||||
|
@ -174,8 +174,7 @@ bool DLObject::relocate(int fd, unsigned long offset, unsigned long size, void *
|
|||
// Fix: we can have LO16 access to the short segment sometimes
|
||||
if (lo16InShorts) {
|
||||
relocation = ahl + _shortsSegment->getOffset(); // Add in the short segment offset
|
||||
}
|
||||
else // It's in the regular segment
|
||||
} else // It's in the regular segment
|
||||
relocation = ahl + (Elf32_Addr)_segment; // Add in the new offset for the segment
|
||||
|
||||
if (firstHi16 >= 0) { // We haven't treated the HI16s yet so do it now
|
||||
|
|
|
@ -124,26 +124,50 @@ void PSPPixelFormat::convertFromScummvmPixelFormat(const Graphics::PixelFormat *
|
|||
Graphics::PixelFormat PSPPixelFormat::convertToScummvmPixelFormat(PSPPixelFormat::Type type) {
|
||||
Graphics::PixelFormat pf;
|
||||
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case Type_4444:
|
||||
pf.bytesPerPixel = 2;
|
||||
pf.aLoss = 4; pf.rLoss = 4; pf.gLoss = 4; pf.bLoss = 4;
|
||||
pf.aShift = 12; pf.rShift = 0; pf.gShift = 4; pf.bShift = 8;
|
||||
pf.aLoss = 4;
|
||||
pf.rLoss = 4;
|
||||
pf.gLoss = 4;
|
||||
pf.bLoss = 4;
|
||||
pf.aShift = 12;
|
||||
pf.rShift = 0;
|
||||
pf.gShift = 4;
|
||||
pf.bShift = 8;
|
||||
break;
|
||||
case Type_5551:
|
||||
pf.bytesPerPixel = 2;
|
||||
pf.aLoss = 7; pf.rLoss = 3; pf.gLoss = 3; pf.bLoss = 3;
|
||||
pf.aShift = 15; pf.rShift = 0; pf.gShift = 5; pf.bShift = 10;
|
||||
pf.aLoss = 7;
|
||||
pf.rLoss = 3;
|
||||
pf.gLoss = 3;
|
||||
pf.bLoss = 3;
|
||||
pf.aShift = 15;
|
||||
pf.rShift = 0;
|
||||
pf.gShift = 5;
|
||||
pf.bShift = 10;
|
||||
break;
|
||||
case Type_5650:
|
||||
pf.bytesPerPixel = 2;
|
||||
pf.aLoss = 8; pf.rLoss = 3; pf.gLoss = 2; pf.bLoss = 3;
|
||||
pf.aShift = 0; pf.rShift = 0; pf.gShift = 5; pf.bShift = 11;
|
||||
pf.aLoss = 8;
|
||||
pf.rLoss = 3;
|
||||
pf.gLoss = 2;
|
||||
pf.bLoss = 3;
|
||||
pf.aShift = 0;
|
||||
pf.rShift = 0;
|
||||
pf.gShift = 5;
|
||||
pf.bShift = 11;
|
||||
break;
|
||||
case Type_8888:
|
||||
pf.bytesPerPixel = 4;
|
||||
pf.aLoss = 0; pf.rLoss = 0; pf.gLoss = 0; pf.bLoss = 0;
|
||||
pf.aShift = 24; pf.rShift = 0; pf.gShift = 8; pf.bShift = 16;
|
||||
pf.aLoss = 0;
|
||||
pf.rLoss = 0;
|
||||
pf.gLoss = 0;
|
||||
pf.bLoss = 0;
|
||||
pf.aShift = 24;
|
||||
pf.rShift = 0;
|
||||
pf.gShift = 8;
|
||||
pf.bShift = 16;
|
||||
break;
|
||||
default:
|
||||
PSP_ERROR("Unhandled PSPPixelFormat[%u]\n", type);
|
||||
|
@ -155,7 +179,7 @@ Graphics::PixelFormat PSPPixelFormat::convertToScummvmPixelFormat(PSPPixelFormat
|
|||
|
||||
uint32 PSPPixelFormat::convertTo32BitColor(uint32 color) {
|
||||
DEBUG_ENTER_FUNC();
|
||||
uint32 r,g,b,a, output;
|
||||
uint32 r, g, b, a, output;
|
||||
|
||||
colorToRgba(color, r, g, b, a);
|
||||
output = ((b << 16) | (g << 8) | (r << 0) | (a << 24));
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
* Also provides accurate color conversion (needed for color masking)
|
||||
* As well as swapping of red and blue channels (needed by HE games, for example)
|
||||
*/
|
||||
struct PSPPixelFormat{
|
||||
struct PSPPixelFormat {
|
||||
enum Type {
|
||||
Type_None,
|
||||
Type_4444,
|
||||
|
@ -63,7 +63,7 @@ struct PSPPixelFormat{
|
|||
inline uint32 rgbaToColor(uint32 r, uint32 g, uint32 b, uint32 a) {
|
||||
uint32 color;
|
||||
|
||||
switch(format) {
|
||||
switch (format) {
|
||||
case Type_4444:
|
||||
color = (((b >> 4) << 8) | ((g >> 4) << 4) | ((r >> 4) << 0) | ((a >> 4) << 12));
|
||||
break;
|
||||
|
@ -84,7 +84,7 @@ struct PSPPixelFormat{
|
|||
}
|
||||
|
||||
inline void colorToRgba(uint32 color, uint32 &r, uint32 &g, uint32 &b, uint32 &a) {
|
||||
switch(format) {
|
||||
switch (format) {
|
||||
case Type_4444:
|
||||
a = (color >> 12) & 0xF; // Interpolate to get true colors
|
||||
b = (color >> 8) & 0xF;
|
||||
|
@ -126,7 +126,7 @@ struct PSPPixelFormat{
|
|||
}
|
||||
|
||||
inline uint32 setColorAlpha(uint32 color, byte alpha) {
|
||||
switch(format) {
|
||||
switch (format) {
|
||||
case Type_4444:
|
||||
color = (color & 0x0FFF) | (((uint32)alpha >> 4) << 12);
|
||||
break;
|
||||
|
@ -168,13 +168,13 @@ struct PSPPixelFormat{
|
|||
|
||||
switch (format) {
|
||||
case Type_4444:
|
||||
output = (color & 0xf0f0) | ((color & 0x000f)<<8) | ((color & 0x0f00)>>8);
|
||||
output = (color & 0xf0f0) | ((color & 0x000f) << 8) | ((color & 0x0f00) >> 8);
|
||||
break;
|
||||
case Type_5551:
|
||||
output = (color & 0x83e0) | ((color & 0x001f)<<10) | ((color & 0x7c00)>>10);
|
||||
output = (color & 0x83e0) | ((color & 0x001f) << 10) | ((color & 0x7c00) >> 10);
|
||||
break;
|
||||
case Type_5650:
|
||||
output = (color & 0x07e0) | ((color & 0x001f)<<11) | ((color & 0xf800)>>11);
|
||||
output = (color & 0x07e0) | ((color & 0x001f) << 11) | ((color & 0xf800) >> 11);
|
||||
break;
|
||||
default:
|
||||
PSP_ERROR("invalid format[%u] for swapping\n", format);
|
||||
|
@ -190,19 +190,19 @@ struct PSPPixelFormat{
|
|||
switch (format) {
|
||||
case Type_4444:
|
||||
output = (color & 0xf0f0f0f0) |
|
||||
((color & 0x000f000f)<<8) | ((color & 0x0f000f00)>>8);
|
||||
((color & 0x000f000f) << 8) | ((color & 0x0f000f00) >> 8);
|
||||
break;
|
||||
case Type_5551:
|
||||
output = (color & 0x83e083e0) |
|
||||
((color & 0x001f001f)<<10) | ((color & 0x7c007c00)>>10);
|
||||
((color & 0x001f001f) << 10) | ((color & 0x7c007c00) >> 10);
|
||||
break;
|
||||
case Type_5650:
|
||||
output = (color & 0x07e007e0) |
|
||||
((color & 0x001f001f)<<11) | ((color & 0xf800f800)>>11);
|
||||
((color & 0x001f001f) << 11) | ((color & 0xf800f800) >> 11);
|
||||
break;
|
||||
case Type_8888:
|
||||
output = (color & 0xff00ff00) |
|
||||
((color & 0x000000ff)<<16) | ((color & 0x00ff0000)>>16);
|
||||
((color & 0x000000ff) << 16) | ((color & 0x00ff0000) >> 16);
|
||||
break;
|
||||
default:
|
||||
PSP_ERROR("invalid format[%u] for swapping\n", format);
|
||||
|
@ -220,10 +220,10 @@ struct PSPPixelFormat{
|
|||
switch (bitsPerPixel) {
|
||||
case 4: // We can't distinguish a 4 bit color with a pointer
|
||||
case 8:
|
||||
result = (uint32)*pointer;
|
||||
result = (uint32) * pointer;
|
||||
break;
|
||||
case 16:
|
||||
result = (uint32)*(uint16 *)pointer;
|
||||
result = (uint32) * (uint16 *)pointer;
|
||||
break;
|
||||
case 32:
|
||||
result = *(uint32 *)pointer;
|
||||
|
|
|
@ -31,14 +31,14 @@
|
|||
|
||||
int psp_debug_indent = 0;
|
||||
|
||||
void PSPDebugTrace (bool alsoToScreen, const char *format, ...) {
|
||||
void PSPDebugTrace(bool alsoToScreen, const char *format, ...) {
|
||||
va_list opt;
|
||||
char buffer[2048];
|
||||
int bufsz;
|
||||
FILE *fd = 0;
|
||||
|
||||
va_start(opt, format);
|
||||
bufsz = vsnprintf( buffer, (size_t) sizeof(buffer), format, opt);
|
||||
bufsz = vsnprintf(buffer, (size_t) sizeof(buffer), format, opt);
|
||||
va_end(opt);
|
||||
|
||||
//fd = fopen("MS0:/SCUMMTRACE.TXT", "ab");
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
//#define __PSP_DEBUG_FUNCS__ /* can put this locally too */
|
||||
//#define __PSP_DEBUG_PRINT__
|
||||
|
||||
void PSPDebugTrace (bool alsoToScreen, const char *format, ...);
|
||||
void PSPDebugTrace(bool alsoToScreen, const char *format, ...);
|
||||
|
||||
#ifndef TRACE_C
|
||||
extern int psp_debug_indent;
|
||||
|
@ -62,11 +62,11 @@ extern int psp_debug_indent;
|
|||
|
||||
/* Choose to print to file/screen/both */
|
||||
#ifdef __PSP_PRINT_TO_FILE__
|
||||
#define __PSP_PRINT__(format,...) PSPDebugTrace(false, format, ## __VA_ARGS__)
|
||||
#define __PSP_PRINT__(format,...) PSPDebugTrace(false, format, ## __VA_ARGS__)
|
||||
#elif defined __PSP_PRINT_TO_FILE_AND_SCREEN__
|
||||
#define __PSP_PRINT__(format,...) PSPDebugTrace(true, format, ## __VA_ARGS__)
|
||||
#define __PSP_PRINT__(format,...) PSPDebugTrace(true, format, ## __VA_ARGS__)
|
||||
#else /* default - print to screen */
|
||||
#define __PSP_PRINT__(format,...) fprintf(stderr, format, ## __VA_ARGS__)
|
||||
#define __PSP_PRINT__(format,...) fprintf(stderr, format, ## __VA_ARGS__)
|
||||
#endif /* PSP_PRINT_TO_FILE/SCREEN */
|
||||
|
||||
/* Error function */
|
||||
|
@ -83,36 +83,36 @@ extern int psp_debug_indent;
|
|||
__PSP_PRINT__(format, ## __VA_ARGS__); }
|
||||
|
||||
#ifdef __PSP_DEBUG_PRINT__
|
||||
/* printf with indents */
|
||||
#define PSP_DEBUG_PRINT_SAMELN(format,...) __PSP_PRINT__(format, ## __VA_ARGS__)
|
||||
#define PSP_DEBUG_PRINT(format,...) { __PSP_INDENT__; \
|
||||
/* printf with indents */
|
||||
#define PSP_DEBUG_PRINT_SAMELN(format,...) __PSP_PRINT__(format, ## __VA_ARGS__)
|
||||
#define PSP_DEBUG_PRINT(format,...) { __PSP_INDENT__; \
|
||||
__PSP_PRINT__(format, ## __VA_ARGS__); }
|
||||
#define PSP_DEBUG_PRINT_FUNC(format,...) { __PSP_INDENT__; \
|
||||
#define PSP_DEBUG_PRINT_FUNC(format,...) { __PSP_INDENT__; \
|
||||
__PSP_PRINT__("In %s: " format, __PRETTY_FUNCTION__, ## __VA_ARGS__); }
|
||||
#define PSP_DEBUG_DO(x) (x)
|
||||
#define PSP_DEBUG_DO(x) (x)
|
||||
|
||||
#else /* no debug print */
|
||||
#define PSP_DEBUG_PRINT_SAMELN(format,...)
|
||||
#define PSP_DEBUG_PRINT(format,...)
|
||||
#define PSP_DEBUG_PRINT_FUNC(format,...)
|
||||
#define PSP_DEBUG_DO(x)
|
||||
#define PSP_DEBUG_PRINT_SAMELN(format,...)
|
||||
#define PSP_DEBUG_PRINT(format,...)
|
||||
#define PSP_DEBUG_PRINT_FUNC(format,...)
|
||||
#define PSP_DEBUG_DO(x)
|
||||
#endif /* __PSP_DEBUG_PRINT__ */
|
||||
|
||||
/* Debugging function calls */
|
||||
#ifdef __PSP_DEBUG_FUNCS__
|
||||
#define DEBUG_ENTER_FUNC() PSP_INFO_PRINT_INDENT("++ %s\n", __PRETTY_FUNCTION__); \
|
||||
#define DEBUG_ENTER_FUNC() PSP_INFO_PRINT_INDENT("++ %s\n", __PRETTY_FUNCTION__); \
|
||||
psp_debug_indent++
|
||||
|
||||
#define DEBUG_EXIT_FUNC() 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 */
|
||||
#define INLINE /* don't want to inline so we get function names properly */
|
||||
|
||||
#else /* Don't debug function calls */
|
||||
#define DEBUG_ENTER_FUNC()
|
||||
#define DEBUG_EXIT_FUNC()
|
||||
#define INLINE inline
|
||||
#define DEBUG_ENTER_FUNC()
|
||||
#define DEBUG_EXIT_FUNC()
|
||||
#define INLINE inline
|
||||
#endif /* __PSP_DEBUG_FUNCS__ */
|
||||
|
||||
// Undef the main defines for next time
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue