# HG changeset patch # User Darren Alton # Date 1219811018 0 # Node ID e1da92da346c305888e84a98a0c3347de81e4142 # Parent c9121b04cffa7810929ee4113edd32c963c647dc Clean up. diff -r c9121b04cffa -r e1da92da346c Makefile.ds --- a/Makefile.ds Thu Aug 21 12:38:21 2008 +0000 +++ b/Makefile.ds Wed Aug 27 04:23:38 2008 +0000 @@ -101,31 +101,10 @@ OBJS = $(SRCS:.c=.o) TEST = \ - test/checkkeys.c \ - test/graywin.c \ - test/loopwave.c \ - test/testalpha.c \ - test/testbitmap.c \ - test/testcdrom.c \ - test/testerror.c \ - test/testgamma.c \ - test/testgl.c \ - test/testhread.c \ - test/testjoystick.c \ - test/testkeys.c \ - test/testlock.c \ - test/testoverlay.c \ - test/testpalette.c \ - test/testsem.c \ - test/testsprite.c \ - test/testtimer.c \ - test/testtypes.c \ - test/testver.c \ - test/testvidinfo.c \ - test/testwin.c \ - test/testwm.c \ - test/threadwin.c \ - test/torturethread.c \ +test/nds-test-progs/general/general.nds \ +test/nds-test-progs/sprite/sprite.nds \ +test/nds-test-progs/sprite2/sprite2.nds \ + all: $(TARGET) @@ -139,6 +118,9 @@ @mkdir -p $(DEVKITPRO)/libnds/include/SDL/ @cp include/*.h $(DEVKITPRO)/libnds/include/SDL/ +nds_test: + $(MAKE) -C test/nds-test-progs + copy_config: @cp include/SDL_config.h.default include/SDL_config.h diff -r c9121b04cffa -r e1da92da346c include/SDL_endian.h --- a/include/SDL_endian.h Thu Aug 21 12:38:21 2008 +0000 +++ b/include/SDL_endian.h Wed Aug 27 04:23:38 2008 +0000 @@ -156,8 +156,8 @@ } v; v.u = x; __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1": "=r"(v.s.a), "=r"(v.s.b):"0"(v.s.a), - "1"(v.s. - b)); + "1"(v. + s.b)); return v.u; } #elif defined(__GNUC__) && defined(__x86_64__) diff -r c9121b04cffa -r e1da92da346c src/SDL_compat.c --- a/src/SDL_compat.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/SDL_compat.c Wed Aug 27 04:23:38 2008 +0000 @@ -693,6 +693,7 @@ SDL_UpdateRects(screen, 1, &rect); } } + void SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects) { diff -r c9121b04cffa -r e1da92da346c src/SDL_error.c --- a/src/SDL_error.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/SDL_error.c Wed Aug 27 04:23:38 2008 +0000 @@ -180,8 +180,8 @@ case 's': len = SDL_snprintf(msg, maxlen, tmp, - SDL_LookupString(error-> - args[argi++].buf)); + SDL_LookupString(error->args[argi++]. + buf)); msg += len; maxlen -= len; break; diff -r c9121b04cffa -r e1da92da346c src/audio/SDL_audio.c --- a/src/audio/SDL_audio.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/audio/SDL_audio.c Wed Aug 27 04:23:38 2008 +0000 @@ -171,31 +171,38 @@ { return -1; } + static void SDL_AudioThreadInit_Default(_THIS) { /* no-op. */ } + static void SDL_AudioWaitDevice_Default(_THIS) { /* no-op. */ } + static void SDL_AudioPlayDevice_Default(_THIS) { /* no-op. */ } + static Uint8 * SDL_AudioGetDeviceBuf_Default(_THIS) { return NULL; } + static void SDL_AudioWaitDone_Default(_THIS) { /* no-op. */ } + static void SDL_AudioCloseDevice_Default(_THIS) { /* no-op. */ } + static void SDL_AudioDeinitialize_Default(void) { /* no-op. */ diff -r c9121b04cffa -r e1da92da346c src/audio/alsa/SDL_alsa_audio.c --- a/src/audio/alsa/SDL_alsa_audio.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/audio/alsa/SDL_alsa_audio.c Wed Aug 27 04:23:38 2008 +0000 @@ -259,16 +259,19 @@ { SWIZ6(Uint64); } + static __inline__ void swizzle_alsa_channels_6_32bit(_THIS) { SWIZ6(Uint32); } + static __inline__ void swizzle_alsa_channels_6_16bit(_THIS) { SWIZ6(Uint16); } + static __inline__ void swizzle_alsa_channels_6_8bit(_THIS) { diff -r c9121b04cffa -r e1da92da346c src/audio/dart/SDL_dart.c --- a/src/audio/dart/SDL_dart.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/audio/dart/SDL_dart.c Wed Aug 27 04:23:38 2008 +0000 @@ -62,8 +62,8 @@ pBufDesc->iBufferUsage = BUFFER_EMPTY; // And notify DART feeder thread that it will have to work a bit. if (pSDLAudioDevice) - DosPostEventSem(pSDLAudioDevice->hidden-> - hevAudioBufferPlayed); + DosPostEventSem(pSDLAudioDevice-> + hidden->hevAudioBufferPlayed); } } } @@ -312,10 +312,11 @@ (pMixBufferDesc) _this->hidden->pMixBuffers[iFreeBuf].ulUserParm; pBufDesc->iBufferUsage = BUFFER_USED; // Send it to DART to be queued - _this->hidden->MixSetupParms.pmixWrite(_this->hidden->MixSetupParms. - ulMixHandle, - &(_this->hidden-> - pMixBuffers[iFreeBuf]), 1); + _this->hidden->MixSetupParms.pmixWrite(_this->hidden-> + MixSetupParms.ulMixHandle, + &(_this-> + hidden->pMixBuffers[iFreeBuf]), + 1); _this->hidden->iLastPlayedBuf = iFreeBuf; iFreeBuf = (iFreeBuf + 1) % _this->hidden->iCurrNumBufs; @@ -333,8 +334,8 @@ if (_this->hidden) { iFreeBuf = _this->hidden->iNextFreeBuffer; pBufDesc = - (pMixBufferDesc) _this->hidden->pMixBuffers[iFreeBuf]. - ulUserParm; + (pMixBufferDesc) _this->hidden-> + pMixBuffers[iFreeBuf].ulUserParm; if (pBufDesc) { if (pBufDesc->iBufferUsage == BUFFER_EMPTY) { diff -r c9121b04cffa -r e1da92da346c src/audio/nds/SDL_ndsaudio.c --- a/src/audio/nds/SDL_ndsaudio.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/audio/nds/SDL_ndsaudio.c Wed Aug 27 04:23:38 2008 +0000 @@ -31,8 +31,6 @@ #include "../SDL_audio_c.h" #include "SDL_ndsaudio.h" -#define TRACE printf - static int NDSAUD_OpenDevice(_THIS, const char *devname, int iscapture) { @@ -40,48 +38,44 @@ int valid_datatype = 0; this->hidden = SDL_malloc(sizeof(*(this->hidden))); - if(!this->hidden) { + if (!this->hidden) { SDL_OutOfMemory(); return 0; } SDL_memset(this->hidden, 0, (sizeof *this->hidden)); - TRACE("+NDSAUD_OpenDevice\n"); while ((!valid_datatype) && (test_format)) { this->spec.format = test_format; switch (test_format) { - case AUDIO_S8: - /*case AUDIO_S16LSB:*/ - valid_datatype = 1; - break; - default: - test_format = SDL_NextAudioFormat(); - break; + case AUDIO_S8: + /*case AUDIO_S16LSB: */ + valid_datatype = 1; + break; + default: + test_format = SDL_NextAudioFormat(); + break; } } /* set the generic sound parameters */ - setGenericSound(22050, /* sample rate */ - 127, /* volume */ - 64, /* panning/balance */ - 0); /* sound format*/ + setGenericSound(22050, /* sample rate */ + 127, /* volume */ + 64, /* panning/balance */ + 0); /* sound format */ - TRACE("-NDSAUD_OpenDevice\n"); return 1; } static void NDSAUD_PlayDevice(_THIS) { - TransferSoundData* sound = SDL_malloc(sizeof(TransferSoundData)); - if(!sound) { + TransferSoundData *sound = SDL_malloc(sizeof(TransferSoundData)); + if (!sound) { SDL_OutOfMemory(); } - TRACE("+NDSAUD_PlayDevice\n"); playGenericSound(this->hidden->mixbuf, this->hidden->mixlen); - - TRACE("-NDSAUD_PlayDevice\n"); +#if 0 // sound->data = this->hidden->mixbuf;/* pointer to raw audio data */ // sound->len = this->hidden->mixlen; /* size of raw data pointed to above */ // sound->rate = 22050; /* sample rate = 22050Hz */ @@ -89,35 +83,31 @@ // sound->pan = 64; /* balance [0..127] for [left..right] */ // sound->format = 0; /* 0 for 16-bit, 1 for 8-bit */ // playSound(sound); +#endif } static Uint8 * NDSAUD_GetDeviceBuf(_THIS) -{ /* is this right? */ - TRACE("!NDSAUD_GetDeviceBuf\n"); - return this->hidden->mixbuf; +{ + return this->hidden->mixbuf; /* is this right? */ } static void NDSAUD_WaitDevice(_THIS) { /* stub */ - TRACE("!NDSAUD_WaitDevice\n"); } static void NDSAUD_CloseDevice(_THIS) { /* stub */ - TRACE("!NDSAUD_CloseDevice\n"); } static int NDSAUD_Init(SDL_AudioDriverImpl * impl) { - TRACE("+NDSAUD_Init\n"); - /* Set the function pointers */ impl->OpenDevice = NDSAUD_OpenDevice; impl->PlayDevice = NDSAUD_PlayDevice; @@ -130,12 +120,11 @@ impl->OnlyHasDefaultOutputDevice = 1; impl->OnlyHasDefaultInputDevice = 1; - TRACE("-NDSAUD_Init\n"); return 1; } AudioBootStrap NDSAUD_bootstrap = { - "nds", "SDL NDS audio driver", NDSAUD_Init, 0 /*1?*/ + "nds", "SDL NDS audio driver", NDSAUD_Init, 0 /*1? */ }; /* vi: set ts=4 sw=4 expandtab: */ diff -r c9121b04cffa -r e1da92da346c src/audio/nds/SDL_ndsaudio.h --- a/src/audio/nds/SDL_ndsaudio.h Thu Aug 21 12:38:21 2008 +0000 +++ b/src/audio/nds/SDL_ndsaudio.h Wed Aug 27 04:23:38 2008 +0000 @@ -32,7 +32,7 @@ struct SDL_PrivateAudioData { - TransferSoundData* sound; + TransferSoundData *sound; /* The file descriptor for the audio device */ Uint8 *mixbuf; Uint32 mixlen; diff -r c9121b04cffa -r e1da92da346c src/audio/windib/SDL_dibaudio.c --- a/src/audio/windib/SDL_dibaudio.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/audio/windib/SDL_dibaudio.c Wed Aug 27 04:23:38 2008 +0000 @@ -107,8 +107,8 @@ Uint8 * WINWAVEOUT_GetDeviceBuf(_THIS) { - return (Uint8 *) (this->hidden->wavebuf[this->hidden->next_buffer]. - lpData); + return (Uint8 *) (this->hidden-> + wavebuf[this->hidden->next_buffer].lpData); } void diff -r c9121b04cffa -r e1da92da346c src/audio/windx5/SDL_dx5audio.c --- a/src/audio/windx5/SDL_dx5audio.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/audio/windx5/SDL_dx5audio.c Wed Aug 27 04:23:38 2008 +0000 @@ -278,8 +278,9 @@ IDirectSoundBuffer_Restore(this->hidden->mixbuf); result = IDirectSoundBuffer_Lock(this->hidden->mixbuf, cursor, this->hidden->mixlen, - (LPVOID *) & this->hidden-> - locked_buf, &rawlen, NULL, &junk, 0); + (LPVOID *) & this-> + hidden->locked_buf, &rawlen, NULL, + &junk, 0); } if (result != DS_OK) { SetDSerror("DirectSound Lock", result); diff -r c9121b04cffa -r e1da92da346c src/cdrom/SDL_cdrom.c --- a/src/cdrom/SDL_cdrom.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/cdrom/SDL_cdrom.c Wed Aug 27 04:23:38 2008 +0000 @@ -44,6 +44,7 @@ NULL, /* Eject */ NULL, /* Close */ }; + int SDL_numcds; int diff -r c9121b04cffa -r e1da92da346c src/cdrom/macosx/AudioFileReaderThread.c --- a/src/cdrom/macosx/AudioFileReaderThread.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/cdrom/macosx/AudioFileReaderThread.c Wed Aug 27 04:23:38 2008 +0000 @@ -335,9 +335,8 @@ } /* construct pointer */ char *writePtr = (char *) (theItem->GetFileBuffer(theItem) + - (theItem-> - mWriteToFirstBuffer ? 0 : theItem-> - mChunkSize)); + (theItem->mWriteToFirstBuffer ? 0 : + theItem->mChunkSize)); /* read data */ result = theItem->Read(theItem, writePtr, &dataChunkSize); @@ -486,8 +485,7 @@ } else { *inOutDataSize = afm->mChunkSize; *inOutData = - afm->mReadFromFirstBuffer ? afm->mFileBuffer : (afm-> - mFileBuffer + + afm->mReadFromFirstBuffer ? afm->mFileBuffer : (afm->mFileBuffer + afm->mChunkSize); } diff -r c9121b04cffa -r e1da92da346c src/events/SDL_events.c --- a/src/events/SDL_events.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/events/SDL_events.c Wed Aug 27 04:23:38 2008 +0000 @@ -73,6 +73,7 @@ } } } + void SDL_Unlock_EventThread(void) { diff -r c9121b04cffa -r e1da92da346c src/events/default_cursor.h --- a/src/events/default_cursor.h Thu Aug 21 12:38:21 2008 +0000 +++ b/src/events/default_cursor.h Wed Aug 27 04:23:38 2008 +0000 @@ -51,6 +51,7 @@ 0x03, 0x00, 0x00, 0x00 }; + static unsigned char default_cmask[] = { 0xC0, 0x00, 0xE0, 0x00, @@ -90,6 +91,7 @@ 0x03, 0x00, 0x00, 0x00 }; + static unsigned char default_cmask[] = { 0x40, 0x00, 0xE0, 0x00, diff -r c9121b04cffa -r e1da92da346c src/file/SDL_rwops.c --- a/src/file/SDL_rwops.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/file/SDL_rwops.c Wed Aug 27 04:23:38 2008 +0000 @@ -136,6 +136,7 @@ return 0; /* ok */ } + static long SDLCALL win32_file_seek(SDL_RWops * context, long offset, int whence) { @@ -177,6 +178,7 @@ SDL_Error(SDL_EFSEEK); return -1; /* error */ } + static size_t SDLCALL win32_file_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum) { @@ -230,6 +232,7 @@ } return (total_read / size); } + static size_t SDLCALL win32_file_write(SDL_RWops * context, const void *ptr, size_t size, size_t num) @@ -269,6 +272,7 @@ nwritten = byte_written / size; return nwritten; } + static int SDLCALL win32_file_close(SDL_RWops * context) { @@ -302,6 +306,7 @@ return (-1); } } + static size_t SDLCALL stdio_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum) { @@ -313,6 +318,7 @@ } return (nread); } + static size_t SDLCALL stdio_write(SDL_RWops * context, const void *ptr, size_t size, size_t num) { @@ -324,6 +330,7 @@ } return (nwrote); } + static int SDLCALL stdio_close(SDL_RWops * context) { @@ -372,6 +379,7 @@ context->hidden.mem.here = newpos; return (context->hidden.mem.here - context->hidden.mem.base); } + static size_t SDLCALL mem_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum) { @@ -394,6 +402,7 @@ return (total_bytes / size); } + static size_t SDLCALL mem_write(SDL_RWops * context, const void *ptr, size_t size, size_t num) { @@ -404,12 +413,14 @@ context->hidden.mem.here += num * size; return (num); } + static size_t SDLCALL mem_writeconst(SDL_RWops * context, const void *ptr, size_t size, size_t num) { SDL_SetError("Can't write to read-only memory"); return (-1); } + static int SDLCALL mem_close(SDL_RWops * context) { @@ -467,9 +478,9 @@ { SDL_RWops *rwops = NULL; #if 0 -ifdef __NDS__ - /* set it up so we can use stdio file function */ - fatInitDefault(); + ifdef __NDS__ + /* set it up so we can use stdio file function */ + fatInitDefault(); printf("called fatInitDefault()"); #endif /* __NDS__ */ rwops = SDL_AllocRW(); diff -r c9121b04cffa -r e1da92da346c src/joystick/darwin/SDL_sysjoystick.c --- a/src/joystick/darwin/SDL_sysjoystick.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/joystick/darwin/SDL_sysjoystick.c Wed Aug 27 04:23:38 2008 +0000 @@ -194,8 +194,8 @@ (*ppPlugInInterface)->QueryInterface(ppPlugInInterface, CFUUIDGetUUIDBytes (kIOHIDDeviceInterfaceID), - (void *) &(pDevice-> - interface)); + (void *) + &(pDevice->interface)); if (S_OK != plugInResult) HIDReportErrorNum ("CouldnŐt query HID class device interface from plugInInterface", diff -r c9121b04cffa -r e1da92da346c src/joystick/linux/SDL_sysjoystick.c --- a/src/joystick/linux/SDL_sysjoystick.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/joystick/linux/SDL_sysjoystick.c Wed Aug 27 04:23:38 2008 +0000 @@ -91,6 +91,7 @@ static struct joystick_logical_mapping mp88xx_1_logical_axismap[] = { {0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5} }; + static struct joystick_logical_mapping mp88xx_1_logical_buttonmap[] = { {0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 6}, {0, 7}, {0, 8}, {0, 9}, {0, 10}, {0, 11} @@ -100,6 +101,7 @@ {0, 0}, {0, 1}, {0, 2}, {1, 0}, {1, 1}, {0, 3}, {1, 2}, {1, 3}, {0, 4}, {0, 5}, {1, 4}, {1, 5} }; + static struct joystick_logical_mapping mp88xx_2_logical_buttonmap[] = { {0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 6}, {0, 7}, {0, 8}, {0, 9}, {0, 10}, {0, 11}, @@ -112,6 +114,7 @@ {1, 2}, {1, 3}, {2, 0}, {2, 1}, {2, 2}, {2, 3}, {0, 4}, {0, 5}, {1, 4}, {1, 5}, {2, 4}, {2, 5} }; + static struct joystick_logical_mapping mp88xx_3_logical_buttonmap[] = { {0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 6}, {0, 7}, {0, 8}, {0, 9}, {0, 10}, {0, 11}, @@ -127,6 +130,7 @@ {3, 0}, {3, 1}, {3, 2}, {3, 3}, {0, 4}, {0, 5}, {1, 4}, {1, 5}, {2, 4}, {2, 5}, {3, 4}, {3, 5} }; + static struct joystick_logical_mapping mp88xx_4_logical_buttonmap[] = { {0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 6}, {0, 7}, {0, 8}, {0, 9}, {0, 10}, {0, 11}, @@ -149,15 +153,18 @@ static struct joystick_logical_layout mp88xx_1_logical_layout[] = { {6, 0, 0, 12} }; + static struct joystick_logical_layout mp88xx_2_logical_layout[] = { {6, 0, 0, 12}, {6, 0, 0, 12} }; + static struct joystick_logical_layout mp88xx_3_logical_layout[] = { {6, 0, 0, 12}, {6, 0, 0, 12}, {6, 0, 0, 12} }; + static struct joystick_logical_layout mp88xx_4_logical_layout[] = { {6, 0, 0, 12}, {6, 0, 0, 12}, @@ -979,8 +986,8 @@ #endif /* USE_LOGICAL_JOYSTICKS */ SDL_PrivateJoystickHat(stick, hat, - position_map[the_hat->axis[1]][the_hat-> - axis[0]]); + position_map[the_hat-> + axis[1]][the_hat->axis[0]]); } } @@ -1111,13 +1118,13 @@ code -= BTN_MISC; #ifndef NO_LOGICAL_JOYSTICKS if (!LogicalJoystickButton(joystick, - joystick->hwdata-> - key_map[code], + joystick-> + hwdata->key_map[code], events[i].value)) #endif SDL_PrivateJoystickButton(joystick, - joystick->hwdata-> - key_map[code], + joystick-> + hwdata->key_map[code], events[i].value); } break; @@ -1139,12 +1146,12 @@ EV_AxisCorrect(joystick, code, events[i].value); #ifndef NO_LOGICAL_JOYSTICKS if (!LogicalJoystickAxis(joystick, - joystick->hwdata-> - abs_map[code], events[i].value)) + joystick->hwdata->abs_map[code], + events[i].value)) #endif SDL_PrivateJoystickAxis(joystick, - joystick->hwdata-> - abs_map[code], + joystick-> + hwdata->abs_map[code], events[i].value); break; } diff -r c9121b04cffa -r e1da92da346c src/joystick/nds/SDL_sysjoystick.c --- a/src/joystick/nds/SDL_sysjoystick.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/joystick/nds/SDL_sysjoystick.c Wed Aug 27 04:23:38 2008 +0000 @@ -20,18 +20,12 @@ slouken@devolution.com */ -#ifdef SAVE_RCSID -static char rcsid = - "@(#) $Id: SDL_sysjoystick.c,v 1.2 2001/04/26 16:50:17 hercules Exp $"; -#endif - #include "SDL_config.h" #ifdef SDL_JOYSTICK_NDS /* This is the system specific header for the SDL joystick API */ #include -//#include #include /* For the definition of NULL */ #include "SDL_error.h" @@ -51,8 +45,7 @@ SDL_SYS_JoystickInit(void) { SDL_numjoysticks = 1; - /* keysInit();*/ - return (1); + return (1); } /* Function to get the device-dependent name of a joystick */ @@ -86,13 +79,14 @@ * but instead should call SDL_PrivateJoystick*() to deliver events * and update joystick device state. */ -void + void SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) { u32 keysd, keysu; - int magnitude = 16384; - /*scanKeys();*/ - keysd = keysDown(); + int magnitude = 16384; + + /*scanKeys(); */ + keysd = keysDown(); keysu = keysUp(); if ((keysd & KEY_UP)) { @@ -107,50 +101,61 @@ if ((keysd & KEY_RIGHT)) { SDL_PrivateJoystickAxis(joystick, 0, magnitude); } - if ((keysu & (KEY_UP|KEY_DOWN))) { + if ((keysu & (KEY_UP | KEY_DOWN))) { SDL_PrivateJoystickAxis(joystick, 1, 0); - } - if ((keysu & (KEY_LEFT|KEY_RIGHT))) { + } + if ((keysu & (KEY_LEFT | KEY_RIGHT))) { SDL_PrivateJoystickAxis(joystick, 0, 0); } - if ((keysd & KEY_A)) { + if ((keysd & KEY_A)) { SDL_PrivateJoystickButton(joystick, 0, SDL_PRESSED); - } if ((keysd & KEY_B)) { + } + if ((keysd & KEY_B)) { SDL_PrivateJoystickButton(joystick, 1, SDL_PRESSED); - } if ((keysd & KEY_X)) { + } + if ((keysd & KEY_X)) { SDL_PrivateJoystickButton(joystick, 2, SDL_PRESSED); - } if ((keysd & KEY_Y)) { + } + if ((keysd & KEY_Y)) { SDL_PrivateJoystickButton(joystick, 3, SDL_PRESSED); } - if ((keysd & KEY_L)) { + if ((keysd & KEY_L)) { SDL_PrivateJoystickButton(joystick, 4, SDL_PRESSED); - } if ((keysd & KEY_R)) { + } + if ((keysd & KEY_R)) { SDL_PrivateJoystickButton(joystick, 5, SDL_PRESSED); } - if ((keysd & KEY_SELECT)) { + if ((keysd & KEY_SELECT)) { SDL_PrivateJoystickButton(joystick, 6, SDL_PRESSED); - } if ((keysd & KEY_START)) { + } + if ((keysd & KEY_START)) { SDL_PrivateJoystickButton(joystick, 7, SDL_PRESSED); } - if ((keysu & KEY_A)) { + if ((keysu & KEY_A)) { SDL_PrivateJoystickButton(joystick, 0, SDL_RELEASED); - } if ((keysu & KEY_B)) { + } + if ((keysu & KEY_B)) { SDL_PrivateJoystickButton(joystick, 1, SDL_RELEASED); - } if ((keysu & KEY_X)) { + } + if ((keysu & KEY_X)) { SDL_PrivateJoystickButton(joystick, 2, SDL_RELEASED); - } if ((keysu & KEY_Y)) { + } + if ((keysu & KEY_Y)) { SDL_PrivateJoystickButton(joystick, 3, SDL_RELEASED); } - if ((keysu & KEY_L)) { + if ((keysu & KEY_L)) { SDL_PrivateJoystickButton(joystick, 4, SDL_RELEASED); - } if ((keysu & KEY_R)) { + } + if ((keysu & KEY_R)) { SDL_PrivateJoystickButton(joystick, 5, SDL_RELEASED); } - if ((keysu & KEY_SELECT)) { + if ((keysu & KEY_SELECT)) { SDL_PrivateJoystickButton(joystick, 6, SDL_RELEASED); - } if ((keysu & KEY_START)) { + } + if ((keysu & KEY_START)) { SDL_PrivateJoystickButton(joystick, 7, SDL_RELEASED); - } } + } + } /* Function to close a joystick after use */ void @@ -163,5 +168,5 @@ SDL_SYS_JoystickQuit(void) { } + #endif /* SDL_JOYSTICK_NDS */ - diff -r c9121b04cffa -r e1da92da346c src/joystick/win32/SDL_dxjoystick.c --- a/src/joystick/win32/SDL_dxjoystick.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/joystick/win32/SDL_dxjoystick.c Wed Aug 27 04:23:38 2008 +0000 @@ -226,8 +226,8 @@ result = IDirectInput_CreateDevice(dinput, - &SYS_Joystick[joystick->index]. - guidInstance, &device, NULL); + &SYS_Joystick[joystick->index].guidInstance, + &device, NULL); if (FAILED(result)) { SetDIerror("IDirectInput::CreateDevice", result); return (-1); @@ -236,8 +236,8 @@ /* Now get the IDirectInputDevice2 interface, instead. */ result = IDirectInputDevice_QueryInterface(device, &IID_IDirectInputDevice2, - (LPVOID *) & joystick-> - hwdata->InputDevice); + (LPVOID *) & joystick->hwdata-> + InputDevice); /* We are done with this object. Use the stored one from now on. */ IDirectInputDevice_Release(device); @@ -249,8 +249,8 @@ /* Aquire shared access. Exclusive access is required for forces, * though. */ result = - IDirectInputDevice2_SetCooperativeLevel(joystick->hwdata-> - InputDevice, SDL_Window, + IDirectInputDevice2_SetCooperativeLevel(joystick->hwdata->InputDevice, + SDL_Window, DISCL_EXCLUSIVE | DISCL_BACKGROUND); if (FAILED(result)) { @@ -289,8 +289,8 @@ /* reset all accuators. */ result = - IDirectInputDevice2_SendForceFeedbackCommand(joystick->hwdata-> - InputDevice, + IDirectInputDevice2_SendForceFeedbackCommand(joystick-> + hwdata->InputDevice, DISFFC_RESET); if (FAILED(result)) { @@ -481,9 +481,8 @@ case BUTTON: SDL_PrivateJoystickButton_Int(joystick, in->num, - (Uint8) (state. - rgbButtons[in->ofs - - DIJOFS_BUTTON0] + (Uint8) (state.rgbButtons[in->ofs - + DIJOFS_BUTTON0] ? SDL_PRESSED : SDL_RELEASED)); break; @@ -539,8 +538,8 @@ break; case BUTTON: SDL_PrivateJoystickButton(joystick, in->num, - (Uint8) (evtbuf[i]. - dwData ? SDL_PRESSED : + (Uint8) (evtbuf[i].dwData ? + SDL_PRESSED : SDL_RELEASED)); break; case HAT: diff -r c9121b04cffa -r e1da92da346c src/loadso/macosx/SDL_dlcompat.c --- a/src/loadso/macosx/SDL_dlcompat.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/loadso/macosx/SDL_dlcompat.c Wed Aug 27 04:23:38 2008 +0000 @@ -616,8 +616,8 @@ || (LC_LOAD_WEAK_DYLIB == lc->cmd)) { if ((wh = (struct mach_header *) my_find_image((char - *) (((struct dylib_command *) lc)-> - dylib.name.offset + (char *) lc)))) { + *) (((struct dylib_command *) lc)->dylib. + name.offset + (char *) lc)))) { if (dyld_NSIsSymbolNameDefinedInImage(wh, symbol)) { nssym = dyld_NSLookupSymbolInImage(wh, symbol, @@ -1067,6 +1067,7 @@ return answer; } + static void * dlsym_auto_underscore_intern(void *handle, const char *symbol) { diff -r c9121b04cffa -r e1da92da346c src/stdlib/SDL_stdlib.c --- a/src/stdlib/SDL_stdlib.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/stdlib/SDL_stdlib.c Wed Aug 27 04:23:38 2008 +0000 @@ -135,6 +135,7 @@ } /* *INDENT-ON* */ } + void __declspec(naked) _alldiv() @@ -222,6 +223,7 @@ } /* *INDENT-ON* */ } + void __declspec(naked) _aulldiv() @@ -279,6 +281,7 @@ } /* *INDENT-ON* */ } + void __declspec(naked) _allrem() @@ -365,6 +368,7 @@ } /* *INDENT-ON* */ } + void __declspec(naked) _aullrem() @@ -423,6 +427,7 @@ } /* *INDENT-ON* */ } + void __declspec(naked) _alldvrm() @@ -532,6 +537,7 @@ } /* *INDENT-ON* */ } + void __declspec(naked) _aulldvrm() @@ -604,6 +610,7 @@ } /* *INDENT-ON* */ } + void __declspec(naked) _allshl() @@ -630,6 +637,7 @@ } /* *INDENT-ON* */ } + void __declspec(naked) _aullshr() diff -r c9121b04cffa -r e1da92da346c src/thread/irix/SDL_syssem.c --- a/src/thread/irix/SDL_syssem.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/thread/irix/SDL_syssem.c Wed Aug 27 04:23:38 2008 +0000 @@ -55,9 +55,11 @@ static struct sembuf op_trywait[2] = { {0, -1, (IPC_NOWAIT | SEM_UNDO)} /* Decrement semaphore, no block */ }; + static struct sembuf op_wait[2] = { {0, -1, SEM_UNDO} /* Decrement semaphore */ }; + static struct sembuf op_post[1] = { {0, 1, (IPC_NOWAIT | SEM_UNDO)} /* Increment semaphore */ }; diff -r c9121b04cffa -r e1da92da346c src/timer/nds/SDL_systimer.c --- a/src/timer/nds/SDL_systimer.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/timer/nds/SDL_systimer.c Wed Aug 27 04:23:38 2008 +0000 @@ -37,7 +37,7 @@ void SDL_StartTicks(void) { - if(!timer_alive) { + if (!timer_alive) { SDL_SYS_TimerInit(); SDL_SYS_StartTimer(); } @@ -55,8 +55,9 @@ SDL_Delay(Uint32 ms) { Uint32 start = SDL_GetTicks(); - while(timer_alive) { - if((SDL_GetTicks() - start) >= ms) break; + while (timer_alive) { + if ((SDL_GetTicks() - start) >= ms) + break; } } @@ -71,8 +72,10 @@ return (0); } -void NDS_TimerInterrupt(void) { - timer_ticks++; +void +NDS_TimerInterrupt(void) +{ + timer_ticks++; } /* This is only called if the event thread is not running */ diff -r c9121b04cffa -r e1da92da346c src/video/SDL_blit_0.c --- a/src/video/SDL_blit_0.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/SDL_blit_0.c Wed Aug 27 04:23:38 2008 +0000 @@ -80,6 +80,7 @@ } } } + static void BlitBto2(SDL_BlitInfo * info) { @@ -116,6 +117,7 @@ dst += dstskip; } } + static void BlitBto3(SDL_BlitInfo * info) { @@ -154,6 +156,7 @@ dst += dstskip; } } + static void BlitBto4(SDL_BlitInfo * info) { diff -r c9121b04cffa -r e1da92da346c src/video/SDL_blit_1.c --- a/src/video/SDL_blit_1.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/SDL_blit_1.c Wed Aug 27 04:23:38 2008 +0000 @@ -184,6 +184,7 @@ } #endif /* USE_DUFFS_LOOP */ } + static void Blit1to3(SDL_BlitInfo * info) { @@ -232,6 +233,7 @@ dst += dstskip; } } + static void Blit1to4(SDL_BlitInfo * info) { diff -r c9121b04cffa -r e1da92da346c src/video/SDL_blit_A.c --- a/src/video/SDL_blit_A.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/SDL_blit_A.c Wed Aug 27 04:23:38 2008 +0000 @@ -283,8 +283,8 @@ amult = alpha | (alpha << 8); amult = amult | (amult << 16); chanmask = - (0xff << df->Rshift) | (0xff << df->Gshift) | (0xff << df-> - Bshift); + (0xff << df->Rshift) | (0xff << df-> + Gshift) | (0xff << df->Bshift); mm_alpha = _mm_set_pi32(0, amult & chanmask); /* 0000AAAA -> mm_alpha, minus 1 chan */ mm_alpha = _mm_unpacklo_pi8(mm_alpha, mm_zero); /* 0A0A0A0A -> mm_alpha, minus 1 chan */ /* at this point mm_alpha can be 000A0A0A or 0A0A0A00 or another combo */ @@ -526,8 +526,8 @@ /* Use zero for alpha if either surface doesn't have alpha */ if (dstfmt->Amask) { amask = - ((srcfmt->Amask) ? RESHIFT(srcfmt->Ashift) : 0x10) << (dstfmt-> - Ashift); + ((srcfmt->Amask) ? RESHIFT(srcfmt-> + Ashift) : 0x10) << (dstfmt->Ashift); } else { amask = 0x10101010 & ((dstfmt->Rmask | dstfmt->Gmask | dstfmt->Bmask) ^ diff -r c9121b04cffa -r e1da92da346c src/video/SDL_blit_N.c --- a/src/video/SDL_blit_N.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/SDL_blit_N.c Wed Aug 27 04:23:38 2008 +0000 @@ -141,8 +141,8 @@ /* Use zero for alpha if either surface doesn't have alpha */ if (dstfmt->Amask) { amask = - ((srcfmt->Amask) ? RESHIFT(srcfmt->Ashift) : 0x10) << (dstfmt-> - Ashift); + ((srcfmt->Amask) ? RESHIFT(srcfmt-> + Ashift) : 0x10) << (dstfmt->Ashift); } else { amask = 0x10101010 & ((dstfmt->Rmask | dstfmt->Gmask | dstfmt->Bmask) ^ @@ -1435,6 +1435,7 @@ 0x00001ce6, 0xffff8100, 0x00001cee, 0xffffa100, 0x00001cf6, 0xffffc200, 0x00001cff, 0xffffe200 }; + static void Blit_RGB565_ARGB8888(SDL_BlitInfo * info) { @@ -1572,6 +1573,7 @@ 0xffe61c00, 0x000081ff, 0xffee1c00, 0x0000a1ff, 0xfff61c00, 0x0000c2ff, 0xffff1c00, 0x0000e2ff }; + static void Blit_RGB565_ABGR8888(SDL_BlitInfo * info) { @@ -1709,6 +1711,7 @@ 0x001ce6ff, 0xff810000, 0x001ceeff, 0xffa10000, 0x001cf6ff, 0xffc20000, 0x001cffff, 0xffe20000, }; + static void Blit_RGB565_RGBA8888(SDL_BlitInfo * info) { @@ -1846,6 +1849,7 @@ 0xe61c0000, 0x0081ffff, 0xee1c0000, 0x00a1ffff, 0xf61c0000, 0x00c2ffff, 0xff1c0000, 0x00e2ffff }; + static void Blit_RGB565_BGRA8888(SDL_BlitInfo * info) { @@ -1930,6 +1934,7 @@ } #endif /* USE_DUFFS_LOOP */ } + static void BlitNto1(SDL_BlitInfo * info) { @@ -2340,6 +2345,7 @@ /* Default for 8-bit RGB source, an invalid combination */ {0, 0, 0, 0, 0, 0, 0, 0, NULL}, }; + static const struct blit_table normal_blit_2[] = { #if SDL_ALTIVEC_BLITTERS /* has-altivec */ @@ -2366,10 +2372,12 @@ /* Default for 16-bit RGB source, used if no other blitter matches */ {0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0} }; + static const struct blit_table normal_blit_3[] = { /* Default for 24-bit RGB source, never optimized */ {0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0} }; + static const struct blit_table normal_blit_4[] = { #if SDL_ALTIVEC_BLITTERS /* has-altivec | dont-use-prefetch */ @@ -2396,6 +2404,7 @@ /* Default for 32-bit RGB source, used if no other blitter matches */ {0, 0, 0, 0, 0, 0, 0, 0, BlitNtoN, 0} }; + static const struct blit_table *normal_blit[] = { normal_blit_1, normal_blit_2, normal_blit_3, normal_blit_4 }; diff -r c9121b04cffa -r e1da92da346c src/video/SDL_gamma.c --- a/src/video/SDL_gamma.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/SDL_gamma.c Wed Aug 27 04:23:38 2008 +0000 @@ -70,6 +70,7 @@ } } } + static void CalculateGammaFromRamp(float *gamma, Uint16 * ramp) { diff -r c9121b04cffa -r e1da92da346c src/video/SDL_pixels.c --- a/src/video/SDL_pixels.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/SDL_pixels.c Wed Aug 27 04:23:38 2008 +0000 @@ -752,6 +752,7 @@ map->info.table = NULL; } } + int SDL_MapSurface(SDL_Surface * src, SDL_Surface * dst) { diff -r c9121b04cffa -r e1da92da346c src/video/SDL_renderer_sw.c --- a/src/video/SDL_renderer_sw.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/SDL_renderer_sw.c Wed Aug 27 04:23:38 2008 +0000 @@ -388,8 +388,9 @@ void **pixels, int *pitch) { if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { - return SDL_SW_QueryYUVTexturePixels((SDL_SW_YUVTexture *) texture-> - driverdata, pixels, pitch); + return SDL_SW_QueryYUVTexturePixels((SDL_SW_YUVTexture *) + texture->driverdata, pixels, + pitch); } else { SDL_Surface *surface = (SDL_Surface *) texture->driverdata; @@ -464,8 +465,9 @@ const SDL_Rect * rect, const void *pixels, int pitch) { if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { - return SDL_SW_UpdateYUVTexture((SDL_SW_YUVTexture *) texture-> - driverdata, rect, pixels, pitch); + return SDL_SW_UpdateYUVTexture((SDL_SW_YUVTexture *) + texture->driverdata, rect, pixels, + pitch); } else { SDL_Surface *surface = (SDL_Surface *) texture->driverdata; Uint8 *src, *dst; @@ -492,9 +494,9 @@ int *pitch) { if (SDL_ISPIXELFORMAT_FOURCC(texture->format)) { - return SDL_SW_LockYUVTexture((SDL_SW_YUVTexture *) texture-> - driverdata, rect, markDirty, pixels, - pitch); + return SDL_SW_LockYUVTexture((SDL_SW_YUVTexture *) + texture->driverdata, rect, markDirty, + pixels, pitch); } else { SDL_Surface *surface = (SDL_Surface *) texture->driverdata; @@ -535,10 +537,10 @@ color = SDL_MapRGBA(data->surface.format, r, g, b, a); - if (data->renderer-> - LockTexture(data->renderer, data->texture[data->current_texture], - rect, 1, &data->surface.pixels, - &data->surface.pitch) < 0) { + if (data->renderer->LockTexture(data->renderer, + data->texture[data->current_texture], + rect, 1, &data->surface.pixels, + &data->surface.pitch) < 0) { return -1; } data->surface.w = rect->w; @@ -566,10 +568,10 @@ SDL_AddDirtyRect(&data->dirty, dstrect); } - if (data->renderer-> - LockTexture(data->renderer, data->texture[data->current_texture], - dstrect, 1, &data->surface.pixels, - &data->surface.pitch) < 0) { + if (data->renderer->LockTexture(data->renderer, + data->texture[data->current_texture], + dstrect, 1, &data->surface.pixels, + &data->surface.pitch) < 0) { return -1; } diff -r c9121b04cffa -r e1da92da346c src/video/SDL_surface.c --- a/src/video/SDL_surface.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/SDL_surface.c Wed Aug 27 04:23:38 2008 +0000 @@ -409,9 +409,9 @@ return 0; } - switch (surface->map->info. - flags & (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | - SDL_COPY_MOD)) { + switch (surface->map-> + info.flags & (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | + SDL_COPY_MOD)) { case SDL_COPY_MASK: *blendMode = SDL_TEXTUREBLENDMODE_MASK; break; diff -r c9121b04cffa -r e1da92da346c src/video/ataricommon/SDL_atarigl.c --- a/src/video/ataricommon/SDL_atarigl.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/ataricommon/SDL_atarigl.c Wed Aug 27 04:23:38 2008 +0000 @@ -349,9 +349,9 @@ } if (! - (_this->gl_data-> - OSMesaMakeCurrent(gl_ctx, surface->pixels, type, surface->w, - surface->h))) { + (_this-> + gl_data->OSMesaMakeCurrent(gl_ctx, surface->pixels, type, surface->w, + surface->h))) { SDL_SetError("Can not make OpenGL context current"); return -1; } @@ -512,10 +512,10 @@ gl_ctx = _this->gl_data->OSMesaCreateContextExt(osmesa_format, - _this->gl_config. - depth_size, - _this->gl_config. - stencil_size, + _this-> + gl_config.depth_size, + _this-> + gl_config.stencil_size, newaccumsize, NULL); if (gl_ctx) { diff -r c9121b04cffa -r e1da92da346c src/video/bwindow/SDL_sysvideo.cc --- a/src/video/bwindow/SDL_sysvideo.cc Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/bwindow/SDL_sysvideo.cc Wed Aug 27 04:23:38 2008 +0000 @@ -670,8 +670,8 @@ _this->gl_config.driver_loaded = 1; SDL_strlcpy(_this->gl_config.driver_path, "libGL.so", - SDL_arraysize(_this->gl_config. - driver_path)); + SDL_arraysize(_this-> + gl_config.driver_path)); } } } diff -r c9121b04cffa -r e1da92da346c src/video/dc/SDL_dcevents.c --- a/src/video/dc/SDL_dcevents.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/dc/SDL_dcevents.c Wed Aug 27 04:23:38 2008 +0000 @@ -135,8 +135,7 @@ for (i = 0; i < sizeof(sdl_shift); i++) { if ((shiftkeys >> i) & 1) { keysym.sym = sdl_shift[i]; - SDL_PrivateKeyboard(((state-> - shift_keys >> i) & 1) ? SDL_PRESSED : + SDL_PrivateKeyboard(((state->shift_keys >> i) & 1) ? SDL_PRESSED : SDL_RELEASED, &keysym); } } @@ -146,8 +145,7 @@ int key = sdl_key[i]; if (key) { keysym.sym = key; - SDL_PrivateKeyboard(state-> - matrix[i] ? SDL_PRESSED : + SDL_PrivateKeyboard(state->matrix[i] ? SDL_PRESSED : SDL_RELEASED, &keysym); } } diff -r c9121b04cffa -r e1da92da346c src/video/dc/SDL_dcvideo.c --- a/src/video/dc/SDL_dcvideo.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/dc/SDL_dcvideo.c Wed Aug 27 04:23:38 2008 +0000 @@ -158,6 +158,7 @@ const static SDL_Rect RECT_800x600 = { 0, 0, 800, 600 }, RECT_640x480 = { 0, 0, 640, 480}, RECT_320x240 = { 0, 0, 320, 240}; + const static SDL_Rect *vid_modes[] = { &RECT_800x600, &RECT_640x480, @@ -296,6 +297,7 @@ { return (-1); } + static void DC_FreeHWSurface(_THIS, SDL_Surface * surface) { diff -r c9121b04cffa -r e1da92da346c src/video/directfb/SDL_DirectFB_events.c --- a/src/video/directfb/SDL_DirectFB_events.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/directfb/SDL_DirectFB_events.c Wed Aug 27 04:23:38 2008 +0000 @@ -311,33 +311,25 @@ switch (evt.type) { case DIET_BUTTONPRESS: posted += SDL_PrivateMouseButton(SDL_PRESSED, - DirectFB_TranslateButton(evt. - button), - 0, 0); + DirectFB_TranslateButton + (evt.button), 0, 0); break; case DIET_BUTTONRELEASE: posted += SDL_PrivateMouseButton(SDL_RELEASED, - DirectFB_TranslateButton(evt. - button), - 0, 0); + DirectFB_TranslateButton + (evt.button), 0, 0); break; case DIET_KEYPRESS: posted += SDL_PrivateKeyboard(SDL_PRESSED, - DirectFB_TranslateKey(evt. - key_id, - evt. - key_symbol, - mod, - &keysym)); + DirectFB_TranslateKey + (evt.key_id, evt.key_symbol, + mod, &keysym)); break; case DIET_KEYRELEASE: posted += SDL_PrivateKeyboard(SDL_RELEASED, - DirectFB_TranslateKey(evt. - key_id, - evt. - key_symbol, - mod, - &keysym)); + DirectFB_TranslateKey + (evt.key_id, evt.key_symbol, + mod, &keysym)); break; case DIET_AXISMOTION: if (evt.flags & DIEF_AXISREL) { diff -r c9121b04cffa -r e1da92da346c src/video/directfb/SDL_DirectFB_mouse.c --- a/src/video/directfb/SDL_DirectFB_mouse.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/directfb/SDL_DirectFB_mouse.c Wed Aug 27 04:23:38 2008 +0000 @@ -85,14 +85,15 @@ dsc.height = surface->h; dsc.pixelformat = DSPF_ARGB; - SDL_DFB_CHECKERR(devdata->dfb-> - CreateSurface(devdata->dfb, &dsc, &curdata->surf)); + SDL_DFB_CHECKERR(devdata-> + dfb->CreateSurface(devdata->dfb, &dsc, &curdata->surf)); curdata->hotx = hot_x; curdata->hoty = hot_y; cursor->driverdata = curdata; - SDL_DFB_CHECKERR(curdata->surf-> - Lock(curdata->surf, DSLF_WRITE, (void *) &dest, &pitch)); + SDL_DFB_CHECKERR(curdata-> + surf->Lock(curdata->surf, DSLF_WRITE, (void *) &dest, + &pitch)); //FIXME: Implies a lot of things, e.g. rgba format for SDL_SURFACE .... p = surface->pixels; @@ -133,19 +134,19 @@ DFB_WindowData *windata = (DFB_WindowData *) window->driverdata; if (cursor) - SDL_DFB_CHECKERR(windata->window-> - SetCursorShape(windata->window, curdata->surf, - curdata->hotx, curdata->hoty)); + SDL_DFB_CHECKERR(windata->window->SetCursorShape(windata->window, + curdata->surf, + curdata->hotx, + curdata->hoty)); //FIXME: This is somehow a directfb issue //TODO: Check administrative - SDL_DFB_CHECKERR(dispdata->layer-> - SetCooperativeLevel(dispdata->layer, - DLSCL_ADMINISTRATIVE)); - SDL_DFB_CHECKERR(dispdata->layer-> - SetCursorOpacity(dispdata->layer, - cursor ? 0xC0 : 0x00)); - SDL_DFB_CHECKERR(dispdata->layer-> - SetCooperativeLevel(dispdata->layer, DLSCL_SHARED)); + SDL_DFB_CHECKERR(dispdata->layer->SetCooperativeLevel(dispdata->layer, + DLSCL_ADMINISTRATIVE)); + SDL_DFB_CHECKERR(dispdata->layer->SetCursorOpacity(dispdata->layer, + cursor ? 0xC0 : + 0x00)); + SDL_DFB_CHECKERR(dispdata->layer->SetCooperativeLevel(dispdata->layer, + DLSCL_SHARED)); } return 0; @@ -185,8 +186,8 @@ int cx, cy; SDL_DFB_CHECKERR(windata->window->GetPosition(windata->window, &cx, &cy)); - SDL_DFB_CHECKERR(dispdata->layer-> - WarpCursor(dispdata->layer, cx + x, cy + y)); + SDL_DFB_CHECKERR(dispdata-> + layer->WarpCursor(dispdata->layer, cx + x, cy + y)); error: return; diff -r c9121b04cffa -r e1da92da346c src/video/directfb/SDL_DirectFB_render.c --- a/src/video/directfb/SDL_DirectFB_render.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/directfb/SDL_DirectFB_render.c Wed Aug 27 04:23:38 2008 +0000 @@ -315,23 +315,22 @@ data->vidlayer = NULL; if (renddata->isyuvdirect && (dispdata->vidID >= 0) && SDL_ISPIXELFORMAT_FOURCC(data->format)) { - SDL_DFB_CHECKERR(devdata->dfb-> - GetDisplayLayer(devdata->dfb, dispdata->vidID, - &data->vidlayer)); + SDL_DFB_CHECKERR(devdata-> + dfb->GetDisplayLayer(devdata->dfb, dispdata->vidID, + &data->vidlayer)); layconf.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT; layconf.width = texture->w; layconf.height = texture->h; layconf.pixelformat = SDLToDFBPixelFormat(data->format); - SDL_DFB_CHECKERR(data->vidlayer-> - SetCooperativeLevel(data->vidlayer, - DLSCL_EXCLUSIVE)); - SDL_DFB_CHECKERR(data->vidlayer-> - SetConfiguration(data->vidlayer, &layconf)); - SDL_DFB_CHECKERR(data->vidlayer-> - GetSurface(data->vidlayer, &data->surface)); - SDL_DFB_CHECKERR(data->vidlayer-> - GetDescription(data->vidlayer, &laydsc)); + SDL_DFB_CHECKERR(data->vidlayer->SetCooperativeLevel(data->vidlayer, + DLSCL_EXCLUSIVE)); + SDL_DFB_CHECKERR(data->vidlayer->SetConfiguration(data->vidlayer, + &layconf)); + SDL_DFB_CHECKERR(data->vidlayer->GetSurface(data->vidlayer, + &data->surface)); + SDL_DFB_CHECKERR(data-> + vidlayer->GetDescription(data->vidlayer, &laydsc)); SDL_DFB_DEBUG("Created HW YUV surface\n"); } if (!data->vidlayer) { @@ -356,12 +355,12 @@ data->pixels = NULL; /* Create the surface */ - SDL_DFB_CHECKERR(devdata->dfb-> - CreateSurface(devdata->dfb, &dsc, &data->surface)); + SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc, + &data->surface)); if (SDL_ISPIXELFORMAT_INDEXED(data->format) && !SDL_ISPIXELFORMAT_FOURCC(data->format)) { - SDL_DFB_CHECKERR(data->surface-> - GetPalette(data->surface, &data->palette)); + SDL_DFB_CHECKERR(data->surface->GetPalette(data->surface, + &data->palette)); } } @@ -408,9 +407,9 @@ entries[i].b = colors[i].b; entries[i].a = 0xFF; } - SDL_DFB_CHECKERR(data->palette-> - SetEntries(data->palette, entries, ncolors, - firstcolor)); + SDL_DFB_CHECKERR(data-> + palette->SetEntries(data->palette, entries, ncolors, + firstcolor)); return 0; } else { SDL_SetError("YUV textures don't have a palette"); @@ -432,9 +431,9 @@ DFBColor entries[256]; int i; - SDL_DFB_CHECKERR(data->palette-> - GetEntries(data->palette, entries, ncolors, - firstcolor)); + SDL_DFB_CHECKERR(data-> + palette->GetEntries(data->palette, entries, ncolors, + firstcolor)); for (i = 0; i < ncolors; ++i) { colors[i].r = entries[i].r; @@ -596,9 +595,9 @@ DFBResult ret; SDL_DFB_CHECKERR(data->surface->SetColor(data->surface, r, g, b, a)); - SDL_DFB_CHECKERR(data->surface-> - FillRectangle(data->surface, rect->x, rect->y, rect->w, - rect->h)); + SDL_DFB_CHECKERR(data-> + surface->FillRectangle(data->surface, rect->x, rect->y, + rect->w, rect->h)); return 0; error: @@ -622,15 +621,18 @@ DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; SDL_DFB_WINDOWDATA(window); - SDL_DFB_CHECKERR(texturedata->vidlayer-> - SetSourceRectangle(texturedata->vidlayer, srcrect->x, - srcrect->y, srcrect->w, - srcrect->h)); + SDL_DFB_CHECKERR(texturedata-> + vidlayer->SetSourceRectangle(texturedata->vidlayer, + srcrect->x, srcrect->y, + srcrect->w, + srcrect->h)); windata->window->GetPosition(windata->window, &px, &py); - SDL_DFB_CHECKERR(texturedata->vidlayer-> - SetScreenRectangle(texturedata->vidlayer, - px + dstrect->x, py + dstrect->y, - dstrect->w, dstrect->h)); + SDL_DFB_CHECKERR(texturedata-> + vidlayer->SetScreenRectangle(texturedata->vidlayer, + px + dstrect->x, + py + dstrect->y, + dstrect->w, + dstrect->h)); } else { DFBRectangle sr, dr; DFBSurfaceBlittingFlags flags = 0; @@ -645,16 +647,16 @@ dr.w = dstrect->w; dr.h = dstrect->h; - if (texture-> - modMode & (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA)) - { + if (texture->modMode & + (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA)) { u8 alpha = 0xFF; if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) alpha = texture->a; if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) - SDL_DFB_CHECKERR(data->surface-> - SetColor(data->surface, texture->r, - texture->g, texture->b, alpha)); + SDL_DFB_CHECKERR(data-> + surface->SetColor(data->surface, texture->r, + texture->g, texture->b, + alpha)); else SDL_DFB_CHECKERR(data->surface->SetColor(data->surface, 0xFF, 0xFF, 0xFF, alpha)); @@ -662,23 +664,22 @@ flags |= DSBLIT_COLORIZE | DSBLIT_SRC_PREMULTCOLOR; } - if (texture-> - blendMode & (SDL_TEXTUREBLENDMODE_MASK | - SDL_TEXTUREBLENDMODE_BLEND)) { + if (texture->blendMode & (SDL_TEXTUREBLENDMODE_MASK | + SDL_TEXTUREBLENDMODE_BLEND)) { flags |= DSBLIT_BLEND_ALPHACHANNEL; } else { flags |= DSBLIT_NOFX; } - SDL_DFB_CHECKERR(data->surface-> - SetBlittingFlags(data->surface, flags)); + SDL_DFB_CHECKERR(data-> + surface->SetBlittingFlags(data->surface, flags)); if (srcrect->w == dstrect->w && srcrect->h == dstrect->h) { - SDL_DFB_CHECKERR(data->surface-> - Blit(data->surface, texturedata->surface, &sr, - dr.x, dr.y)); + SDL_DFB_CHECKERR(data->surface->Blit(data->surface, + texturedata->surface, &sr, + dr.x, dr.y)); } else { - SDL_DFB_CHECKERR(data->surface-> - StretchBlit(data->surface, texturedata->surface, - &sr, &dr)); + SDL_DFB_CHECKERR(data->surface->StretchBlit(data->surface, + texturedata->surface, + &sr, &dr)); } } return 0; @@ -702,8 +703,8 @@ sr.h = window->h; /* Send the data to the display */ - SDL_DFB_CHECKERR(data->surface-> - Flip(data->surface, NULL, data->flipflags)); + SDL_DFB_CHECKERR(data-> + surface->Flip(data->surface, NULL, data->flipflags)); return; error: diff -r c9121b04cffa -r e1da92da346c src/video/directfb/SDL_DirectFB_video.c --- a/src/video/directfb/SDL_DirectFB_video.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/directfb/SDL_DirectFB_video.c Wed Aug 27 04:23:38 2008 +0000 @@ -323,8 +323,8 @@ SDL_DFB_CHECKERR(dfb->GetScreen(dfb, devdata->screenid[i], &screen)); devdata->aux = i; - SDL_DFB_CHECKERR(screen-> - EnumDisplayLayers(screen, &cbLayers, devdata)); + SDL_DFB_CHECKERR(screen->EnumDisplayLayers + (screen, &cbLayers, devdata)); screen->GetSize(screen, &tcw[i], &tch[i]); screen->Release(screen); } @@ -339,12 +339,12 @@ for (i = 0; i < devdata->numscreens; i++) { //SDL_DFB_CHECKERR( dfb->GetDisplayLayer (dfb, DLID_PRIMARY, &layer) ); - SDL_DFB_CHECKERR(dfb-> - GetDisplayLayer(dfb, devdata->gralayer[i], &layer)); + SDL_DFB_CHECKERR(dfb->GetDisplayLayer + (dfb, devdata->gralayer[i], &layer)); //SDL_DFB_CHECKERR( dfb->CreateInputEventBuffer (dfb, DICAPS_ALL, DFB_FALSE, &events) ); - SDL_DFB_CHECKERR(layer-> - SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE)); + SDL_DFB_CHECKERR(layer->SetCooperativeLevel + (layer, DLSCL_ADMINISTRATIVE)); layer->EnableCursor(layer, 1); SDL_DFB_CHECKERR(layer->SetCursorOpacity(layer, 0xC0)); SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer, DLSCL_SHARED)); @@ -379,8 +379,8 @@ /* Enumerate the available fullscreen modes */ SDL_DFB_CALLOC(dispdata->modelist, DFB_MAX_MODES, sizeof(SDL_DisplayMode)); - SDL_DFB_CHECKERR(dfb-> - EnumVideoModes(dfb, EnumModesCallback, &display)); + SDL_DFB_CHECKERR(dfb->EnumVideoModes + (dfb, EnumModesCallback, &display)); SDL_AddVideoDisplay(&display); } @@ -434,13 +434,14 @@ DFB_DisplayData *dispdata = (DFB_DisplayData *) _this->displays[i].driverdata; if (dispdata->layer) { - SDL_DFB_CHECK(dispdata->layer-> - SetCooperativeLevel(dispdata->layer, - DLSCL_ADMINISTRATIVE)); - SDL_DFB_CHECK(dispdata->layer-> - SetCursorOpacity(dispdata->layer, 0x00)); - SDL_DFB_CHECK(dispdata->layer-> - SetCooperativeLevel(dispdata->layer, DLSCL_SHARED)); + SDL_DFB_CHECK(dispdata-> + layer->SetCooperativeLevel(dispdata->layer, + DLSCL_ADMINISTRATIVE)); + SDL_DFB_CHECK(dispdata-> + layer->SetCursorOpacity(dispdata->layer, 0x00)); + SDL_DFB_CHECK(dispdata-> + layer->SetCooperativeLevel(dispdata->layer, + DLSCL_SHARED)); } SDL_DFB_RELEASE(dispdata->layer); @@ -580,8 +581,8 @@ DFBDisplayLayerConfigFlags fail = 0; DFBResult ret; - SDL_DFB_CHECKERR(data->layer-> - SetCooperativeLevel(data->layer, DLSCL_ADMINISTRATIVE)); + SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer, + DLSCL_ADMINISTRATIVE)); SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &config)); config.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_BUFFERMODE; @@ -606,8 +607,8 @@ SDL_DFB_DEBUG("Trace\n"); config.flags &= ~fail; SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config)); - SDL_DFB_CHECKERR(data->layer-> - SetCooperativeLevel(data->layer, DLSCL_ADMINISTRATIVE)); + SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer, + DLSCL_ADMINISTRATIVE)); /* Double check */ SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &rconfig)); @@ -653,11 +654,11 @@ SDL_DFB_CALLOC(window->driverdata, 1, sizeof(DFB_WindowData)); windata = (DFB_WindowData *) window->driverdata; - SDL_DFB_CHECKERR(devdata->dfb-> - SetCooperativeLevel(devdata->dfb, DFSCL_NORMAL)); - SDL_DFB_CHECKERR(dispdata->layer-> - SetCooperativeLevel(dispdata->layer, - DLSCL_ADMINISTRATIVE)); + SDL_DFB_CHECKERR(devdata-> + dfb->SetCooperativeLevel(devdata->dfb, DFSCL_NORMAL)); + SDL_DFB_CHECKERR(dispdata-> + layer->SetCooperativeLevel(dispdata->layer, + DLSCL_ADMINISTRATIVE)); /* Fill the window description. */ if (window->x == SDL_WINDOWPOS_CENTERED) { @@ -697,8 +698,8 @@ desc.surface_caps = DSCAPS_DOUBLE | DSCAPS_TRIPLE; //| DSCAPS_PREMULTIPLIED; /* Create the window. */ - SDL_DFB_CHECKERR(dispdata->layer-> - CreateWindow(dispdata->layer, &desc, &windata->window)); + SDL_DFB_CHECKERR(dispdata->layer->CreateWindow(dispdata->layer, &desc, + &windata->window)); windata->window->GetOptions(windata->window, &wopts); #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 0) @@ -716,12 +717,13 @@ windata->window->SetOptions(windata->window, wopts); /* Get the window's surface. */ - SDL_DFB_CHECKERR(windata->window-> - GetSurface(windata->window, &windata->surface)); + SDL_DFB_CHECKERR(windata-> + window->GetSurface(windata->window, &windata->surface)); windata->window->SetOpacity(windata->window, 0xFF); - SDL_DFB_CHECKERR(windata->window-> - CreateEventBuffer(windata->window, - &(windata->eventbuffer))); + SDL_DFB_CHECKERR(windata->window->CreateEventBuffer(windata->window, + & + (windata-> + eventbuffer))); SDL_DFB_CHECKERR(windata->window-> EnableEvents(windata->window, DWET_POSITION | DWET_SIZE | DWET_CLOSE | @@ -784,6 +786,7 @@ //return -1; } + static void DirectFB_SetWindowPosition(_THIS, SDL_Window * window) { @@ -805,6 +808,7 @@ if (!(window->flags & SDL_WINDOW_FULLSCREEN)) windata->window->Resize(windata->window, window->w, window->h); } + static void DirectFB_ShowWindow(_THIS, SDL_Window * window) { @@ -827,6 +831,7 @@ windata->window->SetOpacity(windata->window, 0); } + static void DirectFB_RaiseWindow(_THIS, SDL_Window * window) { @@ -848,6 +853,7 @@ SDL_Unsupported(); } + static void DirectFB_MinimizeWindow(_THIS, SDL_Window * window) { @@ -869,6 +875,7 @@ SDL_Unsupported(); } + static void DirectFB_SetWindowGrab(_THIS, SDL_Window * window) { @@ -1097,8 +1104,8 @@ devdata->glFlush(); SDL_DFB_CHECKERR(windata->gl_context->Unlock(windata->gl_context)); - SDL_DFB_CHECKERR(windata->surface-> - Flip(windata->surface, ®ion, DSFLIP_ONSYNC)); + SDL_DFB_CHECKERR(windata-> + surface->Flip(windata->surface, ®ion, DSFLIP_ONSYNC)); SDL_DFB_CHECKERR(windata->gl_context->Lock(windata->gl_context)); return; diff -r c9121b04cffa -r e1da92da346c src/video/fbcon/SDL_fb3dfx.c --- a/src/video/fbcon/SDL_fb3dfx.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/fbcon/SDL_fb3dfx.c Wed Aug 27 04:23:38 2008 +0000 @@ -37,6 +37,7 @@ /* wait until we're past the start */ while ((tdfx_in32(TDFX_STATUS) & STATUS_RETRACE) == 0); } + static void WaitIdle(_THIS) { diff -r c9121b04cffa -r e1da92da346c src/video/fbcon/SDL_fbevents.c --- a/src/video/fbcon/SDL_fbevents.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/fbcon/SDL_fbevents.c Wed Aug 27 04:23:38 2008 +0000 @@ -969,6 +969,7 @@ ioctl(keyboard_fd, KDSETMODE, KD_TEXT); ioctl(keyboard_fd, VT_UNLOCKSWITCH, 1); } + static void switch_vt_done(_THIS) { @@ -994,6 +995,7 @@ (SDL_APPACTIVE | SDL_APPINPUTFOCUS | SDL_APPMOUSEFOCUS)); } + static void switch_vt(_THIS, unsigned short which) { diff -r c9121b04cffa -r e1da92da346c src/video/fbcon/SDL_fbmatrox.c --- a/src/video/fbcon/SDL_fbmatrox.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/fbcon/SDL_fbmatrox.c Wed Aug 27 04:23:38 2008 +0000 @@ -41,6 +41,7 @@ count = mga_in32(0x1E20) + 2; while (mga_in32(0x1E20) < count); } + static void WaitIdle(_THIS) { diff -r c9121b04cffa -r e1da92da346c src/video/fbcon/SDL_fbriva.c --- a/src/video/fbcon/SDL_fbriva.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/fbcon/SDL_fbriva.c Wed Aug 27 04:23:38 2008 +0000 @@ -40,6 +40,7 @@ while ((*port & 0x08)); while (!(*port & 0x08)); } + static void NV3WaitIdle(_THIS) { @@ -47,6 +48,7 @@ while ((Rop->FifoFree < FifoEmptyCount) || (*(mapped_io + PGRAPH_OFFSET + 0x000006B0) & 0x01)); } + static void NV4WaitIdle(_THIS) { diff -r c9121b04cffa -r e1da92da346c src/video/fbcon/SDL_fbvideo.c --- a/src/video/fbcon/SDL_fbvideo.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/fbcon/SDL_fbvideo.c Wed Aug 27 04:23:38 2008 +0000 @@ -82,6 +82,7 @@ {0, 0, 320, 240}, {0, 0, 320, 200} }; + static const struct { int xres; @@ -822,6 +823,7 @@ fprintf(stderr, "\talpha: %d/%d\n", vinfo->transp.length, vinfo->transp.offset); } + static void print_finfo(struct fb_fix_screeninfo *finfo) { @@ -1189,6 +1191,7 @@ screen->hwdata = (struct private_hwdata *) &surfaces; return (0); } + static void FB_FreeHWSurfaces(_THIS) { @@ -1279,6 +1282,7 @@ surface->hwdata = (struct private_hwdata *) bucket; return (0); } + static void FB_FreeHWSurface(_THIS, SDL_Surface * surface) { @@ -1348,6 +1352,7 @@ } return (0); } + static void FB_UnlockHWSurface(_THIS, SDL_Surface * surface) { diff -r c9121b04cffa -r e1da92da346c src/video/gapi/SDL_gapivideo.c --- a/src/video/gapi/SDL_gapivideo.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/gapi/SDL_gapivideo.c Wed Aug 27 04:23:38 2008 +0000 @@ -340,8 +340,7 @@ gx.GXSuspend, "?GXSuspend@@YAHXZ") LINK(GXResume, gx.GXResume, "?GXResume@@YAHXZ") LINK(GXSetViewport, - gx. - GXSetViewport, + gx.GXSetViewport, "?GXSetViewport@@YAHKKKK@Z") LINK(GXIsDisplayDRAMBuffer, gx.GXIsDisplayDRAMBuffer, "?GXIsDisplayDRAMBuffer@@YAHXZ") @@ -807,6 +806,7 @@ { return (-1); } + static void GAPI_FreeHWSurface(_THIS, SDL_Surface * surface) { diff -r c9121b04cffa -r e1da92da346c src/video/ipod/SDL_ipodvideo.c --- a/src/video/ipod/SDL_ipodvideo.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/ipod/SDL_ipodvideo.c Wed Aug 27 04:23:38 2008 +0000 @@ -682,6 +682,7 @@ } while (C_timer_check(start, 1000) == 0); } } + static void C_lcd_cmd_data(int cmd, int data) { @@ -776,11 +777,13 @@ ~(3 << (2 * (x % 4))); ipod_scr[y * (lcd_width / 4) + x / 4] |= (((Uint8 *) (SDL_VideoSurface->pixels))[y * - SDL_VideoSurface-> - pitch + SDL_VideoSurface->pitch + - x] & - 3) << (2 * (x % 4)); + x] & 3) << (2 + * + (x + % + 4)); } } } diff -r c9121b04cffa -r e1da92da346c src/video/nds/SDL_ndsevents.c --- a/src/video/nds/SDL_ndsevents.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/nds/SDL_ndsevents.c Wed Aug 27 04:23:38 2008 +0000 @@ -40,12 +40,12 @@ { scanKeys(); /* TODO: defer click-age */ - if(keysDown() & KEY_TOUCH) { + if (keysDown() & KEY_TOUCH) { SDL_SendMouseButton(0, SDL_PRESSED, 0); - } else if(keysUp() & KEY_TOUCH) { + } else if (keysUp() & KEY_TOUCH) { SDL_SendMouseButton(0, SDL_RELEASED, 0); } - if(keysHeld() & KEY_TOUCH) { + if (keysHeld() & KEY_TOUCH) { touchPosition t = touchReadXY(); SDL_SendMouseMotion(0, 0, t.px, t.py); } diff -r c9121b04cffa -r e1da92da346c src/video/nds/SDL_ndsrender.c --- a/src/video/nds/SDL_ndsrender.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/nds/SDL_ndsrender.c Wed Aug 27 04:23:38 2008 +0000 @@ -34,23 +34,20 @@ #include "../SDL_yuv_sw_c.h" #include "../SDL_renderer_sw.h" -#define TRACE -//#define TRACE printf - /* NDS sprite-related functions */ #define SPRITE_DMA_CHANNEL 3 #define SPRITE_ANGLE_MASK 0x01FF void -NDS_OAM_Update(tOAM *oam, int sub) +NDS_OAM_Update(tOAM * oam, int sub) { DC_FlushAll(); - dmaCopyHalfWords(SPRITE_DMA_CHANNEL, oam->spriteBuffer, sub?OAM_SUB:OAM, - SPRITE_COUNT * sizeof(SpriteEntry)); + dmaCopyHalfWords(SPRITE_DMA_CHANNEL, oam->spriteBuffer, + sub ? OAM_SUB : OAM, SPRITE_COUNT * sizeof(SpriteEntry)); } void -NDS_OAM_RotateSprite(SpriteRotation *spriteRotation, u16 angle) +NDS_OAM_RotateSprite(SpriteRotation * spriteRotation, u16 angle) { s16 s = SIN[angle & SPRITE_ANGLE_MASK] >> 4; s16 c = COS[angle & SPRITE_ANGLE_MASK] >> 4; @@ -62,15 +59,15 @@ } void -NDS_OAM_Init(tOAM *oam, int sub) +NDS_OAM_Init(tOAM * oam, int sub) { int i; - for(i = 0; i < SPRITE_COUNT; i++) { + for (i = 0; i < SPRITE_COUNT; i++) { oam->spriteBuffer[i].attribute[0] = ATTR0_DISABLED; oam->spriteBuffer[i].attribute[1] = 0; oam->spriteBuffer[i].attribute[2] = 0; } - for(i = 0; i < MATRIX_COUNT; i++) { + for (i = 0; i < MATRIX_COUNT; i++) { NDS_OAM_RotateSprite(&(oam->matrixBuffer[i]), 0); } swiWaitForVBlank(); @@ -78,14 +75,14 @@ } void -NDS_OAM_HideSprite(SpriteEntry *spriteEntry) +NDS_OAM_HideSprite(SpriteEntry * spriteEntry) { spriteEntry->isRotoscale = 0; spriteEntry->isHidden = 1; } void -NDS_OAM_ShowSprite(SpriteEntry *spriteEntry, int affine, int double_bound) +NDS_OAM_ShowSprite(SpriteEntry * spriteEntry, int affine, int double_bound) { if (affine) { spriteEntry->isRotoscale = 1; @@ -103,85 +100,83 @@ static int NDS_DisplayModeChanged(SDL_Renderer * renderer); static int NDS_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int NDS_QueryTexturePixels(SDL_Renderer * renderer, - SDL_Texture * texture, void **pixels, - int *pitch); + SDL_Texture * texture, void **pixels, + int *pitch); static int NDS_SetTexturePalette(SDL_Renderer * renderer, - SDL_Texture * texture, - const SDL_Color * colors, int firstcolor, - int ncolors); + SDL_Texture * texture, + const SDL_Color * colors, int firstcolor, + int ncolors); static int NDS_GetTexturePalette(SDL_Renderer * renderer, - SDL_Texture * texture, SDL_Color * colors, - int firstcolor, int ncolors); + SDL_Texture * texture, SDL_Color * colors, + int firstcolor, int ncolors); static int NDS_SetTextureColorMod(SDL_Renderer * renderer, - SDL_Texture * texture); + SDL_Texture * texture); static int NDS_SetTextureAlphaMod(SDL_Renderer * renderer, - SDL_Texture * texture); + SDL_Texture * texture); static int NDS_SetTextureBlendMode(SDL_Renderer * renderer, - SDL_Texture * texture); + SDL_Texture * texture); static int NDS_SetTextureScaleMode(SDL_Renderer * renderer, - SDL_Texture * texture); + SDL_Texture * texture); static int NDS_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, - const SDL_Rect * rect, const void *pixels, - int pitch); + const SDL_Rect * rect, const void *pixels, + int pitch); static int NDS_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, - const SDL_Rect * rect, int markDirty, void **pixels, - int *pitch); + const SDL_Rect * rect, int markDirty, + void **pixels, int *pitch); static void NDS_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); static void NDS_DirtyTexture(SDL_Renderer * renderer, - SDL_Texture * texture, int numrects, - const SDL_Rect * rects); + SDL_Texture * texture, int numrects, + const SDL_Rect * rects); static int NDS_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, - Uint8 b, Uint8 a, const SDL_Rect * rect); + Uint8 b, Uint8 a, const SDL_Rect * rect); static int NDS_RenderCopy(SDL_Renderer * renderer, - SDL_Texture * texture, - const SDL_Rect * srcrect, - const SDL_Rect * dstrect); + SDL_Texture * texture, + const SDL_Rect * srcrect, const SDL_Rect * dstrect); static void NDS_RenderPresent(SDL_Renderer * renderer); -static void NDS_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static void NDS_DestroyTexture(SDL_Renderer * renderer, + SDL_Texture * texture); static void NDS_DestroyRenderer(SDL_Renderer * renderer); SDL_RenderDriver NDS_RenderDriver = { NDS_CreateRenderer, - { "nds", /* char* name */ - (SDL_RENDERER_SINGLEBUFFER | - SDL_RENDERER_ACCELERATED | - SDL_RENDERER_PRESENTDISCARD | - SDL_RENDERER_PRESENTVSYNC), /* u32 flags */ - (SDL_TEXTUREMODULATE_NONE), /* u32 mod_modes */ - (SDL_TEXTUREBLENDMODE_MASK), /* u32 blend_modes */ - (SDL_TEXTURESCALEMODE_FAST), /* u32 scale_modes */ - 3, /* u32 num_texture_formats */ - { - SDL_PIXELFORMAT_INDEX8, - SDL_PIXELFORMAT_ABGR1555, - SDL_PIXELFORMAT_BGR555, - }, /* u32 texture_formats[20] */ - (256), /* int max_texture_width */ - (256), /* int max_texture_height */ - } + {"nds", /* char* name */ + (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC), /* u32 flags */ + (SDL_TEXTUREMODULATE_NONE), /* u32 mod_modes */ + (SDL_TEXTUREBLENDMODE_MASK), /* u32 blend_modes */ + (SDL_TEXTURESCALEMODE_FAST), /* u32 scale_modes */ + 3, /* u32 num_texture_formats */ + { + SDL_PIXELFORMAT_INDEX8, + SDL_PIXELFORMAT_ABGR1555, + SDL_PIXELFORMAT_BGR555, + }, /* u32 texture_formats[20] */ + (256), /* int max_texture_width */ + (256), /* int max_texture_height */ + } }; typedef struct { - bg_attribute *bg; /* backgrounds */ - tOAM oam_copy; /* sprites */ + bg_attribute *bg; /* backgrounds */ + tOAM oam_copy; /* sprites */ u8 bg_taken[4]; int sub; } NDS_RenderData; typedef struct { - enum { NDSTX_BG, NDSTX_SPR } type; /* represented in a bg or sprite. */ - int hw_index; /* sprite: index in the OAM. / bg: 2 or 3. */ + enum + { NDSTX_BG, NDSTX_SPR } type; /* represented in a bg or sprite. */ + int hw_index; /* sprite: index in the OAM. / bg: 2 or 3. */ struct { int hdx, hdy, vdx, vdy; /* affine transformation, used for scaling. */ - int pitch, bpp; /* some useful info */ + int pitch, bpp; /* some useful info */ } dim; - u16 *vram_pixels; /* where the pixel data is stored (a pointer into VRAM) */ - u16 *vram_palette; /* where the palette data is stored if it's indexed.*/ - /*int size;*/ + u16 *vram_pixels; /* where the pixel data is stored (a pointer into VRAM) */ + u16 *vram_palette; /* where the palette data is stored if it's indexed. */ + /*int size; */ } NDS_TextureData; @@ -197,26 +192,25 @@ int bpp; Uint32 Rmask, Gmask, Bmask, Amask; - TRACE("+NDS_CreateRenderer\n"); if (!SDL_PixelFormatEnumToMasks(displayMode->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) { SDL_SetError("Unknown display format"); return NULL; } - switch(displayMode->format) { - case SDL_PIXELFORMAT_INDEX8: - case SDL_PIXELFORMAT_ABGR1555: - case SDL_PIXELFORMAT_BGR555: - /* okay */ - break; - case SDL_PIXELFORMAT_RGB555: - case SDL_PIXELFORMAT_RGB565: - case SDL_PIXELFORMAT_ARGB1555: - /* we'll take these too for now */ - break; - default: - printf("DEBUG: wrong display format!\n"); - break; + switch (displayMode->format) { + case SDL_PIXELFORMAT_INDEX8: + case SDL_PIXELFORMAT_ABGR1555: + case SDL_PIXELFORMAT_BGR555: + /* okay */ + break; + case SDL_PIXELFORMAT_RGB555: + case SDL_PIXELFORMAT_RGB565: + case SDL_PIXELFORMAT_ARGB1555: + /* we'll take these too for now */ + break; + default: + SDL_SetError("Warning: wrong display format for NDS!\n"); + break; } renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); @@ -268,10 +262,10 @@ renderer->info.max_texture_height = NDS_RenderDriver.info.max_texture_height; - data->sub = 0; /* TODO: this is hard-coded to the "main" screen. - figure out how to detect whether to set it to - "sub" screen. window->id, perhaps? */ - if(!data->sub) { + data->sub = 0; /* TODO: this is hard-coded to the "main" screen. + figure out how to detect whether to set it to + "sub" screen. window->id, perhaps? */ + if (!data->sub) { data->bg = &BACKGROUND; } else { data->bg = &BACKGROUND_SUB; @@ -280,7 +274,6 @@ NDS_OAM_Init(&(data->oam_copy), data->sub); /* init sprites. */ - TRACE("-NDS_CreateRenderer\n"); return renderer; } @@ -288,7 +281,7 @@ NDS_ActivateRenderer(SDL_Renderer * renderer) { NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; - TRACE("!NDS_ActivateRenderer\n"); + return 0; } @@ -296,7 +289,7 @@ NDS_DisplayModeChanged(SDL_Renderer * renderer) { NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; - TRACE("!NDS_DisplayModeChanged\n"); + return 0; } @@ -309,7 +302,6 @@ int bpp; Uint32 Rmask, Gmask, Bmask, Amask; - TRACE("+NDS_CreateTexture\n"); if (!SDL_PixelFormatEnumToMasks (texture->format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) { SDL_SetError("Unknown texture format"); @@ -318,44 +310,45 @@ /* conditional statements on w/h to place it as bg/sprite depending on which one it fits. */ - if(texture->w <= 64 && texture->h <= 64) { + if (texture->w <= 64 && texture->h <= 64) { int whichspr = -1; printf("Tried to make a sprite.\n"); txdat->type = NDSTX_SPR; - for(i = 0; i < SPRITE_COUNT; ++i) { - if(data->oam_copy.spriteBuffer[i].attribute[0] & ATTR0_DISABLED) { + for (i = 0; i < SPRITE_COUNT; ++i) { + if (data->oam_copy.spriteBuffer[i].attribute[0] & ATTR0_DISABLED) { whichspr = i; break; } } - if(whichspr >= 0) { + if (whichspr >= 0) { SpriteEntry *sprent = &(data->oam_copy.spriteBuffer[whichspr]); int maxside = texture->w > texture->h ? texture->w : texture->h; int pitch; texture->driverdata = SDL_calloc(1, sizeof(NDS_TextureData)); - txdat = (NDS_TextureData*)texture->driverdata; - if(!txdat) { + txdat = (NDS_TextureData *) texture->driverdata; + if (!txdat) { SDL_OutOfMemory(); return -1; } sprent->objMode = OBJMODE_BITMAP; - sprent->posX = 0; sprent->posY = 0; - sprent->colMode = OBJCOLOR_16; /* OBJCOLOR_256 for INDEX8 */ + sprent->posX = 0; + sprent->posY = 0; + sprent->colMode = OBJCOLOR_16; /* OBJCOLOR_256 for INDEX8 */ /* the first 32 sprites get transformation matrices. first come, first served */ - if(whichspr < MATRIX_COUNT) { + if (whichspr < MATRIX_COUNT) { sprent->isRotoscale = 1; sprent->rsMatrixIdx = whichspr; } /* containing shape (square or 2:1 rectangles) */ sprent->objShape = OBJSHAPE_SQUARE; - if(texture->w/2 >= texture->h) { + if (texture->w / 2 >= texture->h) { sprent->objShape = OBJSHAPE_WIDE; - } else if(texture->h/2 >= texture->w) { + } else if (texture->h / 2 >= texture->w) { sprent->objShape = OBJSHAPE_TALL; } @@ -363,13 +356,13 @@ /* FIXME: "pitch" is hardcoded for 2bytes per pixel. */ sprent->objSize = OBJSIZE_64; pitch = 128; - if(maxside <= 8) { + if (maxside <= 8) { sprent->objSize = OBJSIZE_8; pitch = 16; - } else if(maxside <= 16) { + } else if (maxside <= 16) { sprent->objSize = OBJSIZE_16; pitch = 32; - } else if(maxside <= 32) { + } else if (maxside <= 32) { sprent->objSize = OBJSIZE_32; pitch = 64; } @@ -382,28 +375,29 @@ /* now for the texture data */ txdat->type = NDSTX_SPR; txdat->hw_index = whichspr; - txdat->dim.hdx = 0x100; txdat->dim.hdy = 0; - txdat->dim.vdx = 0; txdat->dim.vdy = 0x100; + txdat->dim.hdx = 0x100; + txdat->dim.hdy = 0; + txdat->dim.vdx = 0; + txdat->dim.vdy = 0x100; txdat->dim.pitch = pitch; txdat->dim.bpp = bpp; - txdat->vram_pixels = (u16*)(data->sub ? - SPRITE_GFX_SUB : SPRITE_GFX); /* FIXME: use tileIdx*boundary - to point to proper location */ + txdat->vram_pixels = (u16 *) (data->sub ? SPRITE_GFX_SUB : SPRITE_GFX); /* FIXME: use tileIdx*boundary + to point to proper location */ } else { SDL_SetError("Out of NDS sprites."); } - } else if(texture->w <= 256 && texture->h <= 256) { + } else if (texture->w <= 256 && texture->h <= 256) { int whichbg = -1, base = 0; - if(!data->bg_taken[2]) { + if (!data->bg_taken[2]) { whichbg = 2; - } else if(!data->bg_taken[3]) { + } else if (!data->bg_taken[3]) { whichbg = 3; base = 4; } - if(whichbg >= 0) { + if (whichbg >= 0) { texture->driverdata = SDL_calloc(1, sizeof(NDS_TextureData)); - txdat = (NDS_TextureData*)texture->driverdata; - if(!txdat) { + txdat = (NDS_TextureData *) texture->driverdata; + if (!txdat) { SDL_OutOfMemory(); return -1; } @@ -419,14 +413,17 @@ txdat->type = NDSTX_BG; txdat->hw_index = whichbg; - txdat->dim.hdx = 0x100; txdat->dim.hdy = 0; - txdat->dim.vdx = 0; txdat->dim.vdy = 0x100; + txdat->dim.hdx = 0x100; + txdat->dim.hdy = 0; + txdat->dim.vdx = 0; + txdat->dim.vdy = 0x100; txdat->dim.pitch = 512; txdat->dim.bpp = bpp; - txdat->vram_pixels = (u16*)(data->sub ? - BG_BMP_RAM_SUB(base) : BG_BMP_RAM(base)); + txdat->vram_pixels = (u16 *) (data->sub ? + BG_BMP_RAM_SUB(base) : + BG_BMP_RAM(base)); - /*txdat->size = txdat->dim.pitch * texture->h;*/ + /*txdat->size = txdat->dim.pitch * texture->h; */ } else { SDL_SetError("Out of NDS backgrounds."); } @@ -434,7 +431,6 @@ SDL_SetError("Texture too big for NDS hardware."); } - TRACE("-NDS_CreateTexture\n"); if (!texture->driverdata) { return -1; } @@ -444,35 +440,33 @@ static int NDS_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture, - void **pixels, int *pitch) + void **pixels, int *pitch) { NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; - TRACE("+NDS_QueryTexturePixels\n"); *pixels = txdat->vram_pixels; *pitch = txdat->dim.pitch; - TRACE("-NDS_QueryTexturePixels\n"); return 0; } static int NDS_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, - const SDL_Rect * rect, const void *pixels, int pitch) + const SDL_Rect * rect, const void *pixels, int pitch) { NDS_TextureData *txdat; Uint8 *src, *dst; - int row; size_t length; - TRACE("+NDS_UpdateTexture\n"); + int row; + size_t length; txdat = (NDS_TextureData *) texture->driverdata; src = (Uint8 *) pixels; dst = (Uint8 *) txdat->vram_pixels + rect->y * txdat->dim.pitch + - rect->x * ((txdat->dim.bpp+1)/8); - length = rect->w * ((txdat->dim.bpp+1)/8); + rect->x * ((txdat->dim.bpp + 1) / 8); + length = rect->w * ((txdat->dim.bpp + 1) / 8); - if(rect->w == texture->w) { - dmaCopy(src, dst, length*rect->h); + if (rect->w == texture->w) { + dmaCopy(src, dst, length * rect->h); } else { for (row = 0; row < rect->h; ++row) { dmaCopy(src, dst, length); @@ -481,68 +475,62 @@ } } - TRACE("-NDS_UpdateTexture\n"); return 0; } static int NDS_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, - const SDL_Rect * rect, int markDirty, void **pixels, - int *pitch) + const SDL_Rect * rect, int markDirty, void **pixels, + int *pitch) { NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; - TRACE("+NDS_LockTexture\n"); - *pixels = (void *) ((u8 *)txdat->vram_pixels + rect->y - * txdat->dim.pitch + rect->x * ((txdat->dim.bpp+1)/8)); + *pixels = (void *) ((u8 *) txdat->vram_pixels + rect->y + * txdat->dim.pitch + + rect->x * ((txdat->dim.bpp + 1) / 8)); *pitch = txdat->dim.pitch; - TRACE("-NDS_LockTexture\n"); return 0; } static void NDS_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) { - TRACE("+NDS_UnlockTexture\n"); - TRACE("-NDS_UnlockTexture\n"); + /* stub! */ } static void NDS_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, - int numrects, const SDL_Rect * rects) + int numrects, const SDL_Rect * rects) { - /* stub */ - TRACE("!NDS_DirtyTexture\n"); + /* stub! */ } static int NDS_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, - Uint8 a, const SDL_Rect * rect) + Uint8 a, const SDL_Rect * rect) { NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; SDL_Rect real_rect = *rect; u16 color; int i, j; - TRACE("+NDS_RenderFill\n"); - color = RGB8(r,g,b); /* <-- macro in libnds that makes an ARGB1555 pixel */ + color = RGB8(r, g, b); /* <-- macro in libnds that makes an ARGB1555 pixel */ /* TODO: make a single-color sprite and stretch it. calculate the "HDX" width modifier of the sprite by: - let S be the actual sprite's width (like, 32 pixels for example) - let R be the rectangle's width (maybe 50 pixels) - HDX = (R<<8) / S; - (it's fixed point, hence the bit shift. same goes for vertical. - be sure to use 32-bit int's for the bit shift before the division!) + let S be the actual sprite's width (like, 32 pixels for example) + let R be the rectangle's width (maybe 50 pixels) + HDX = (R<<8) / S; + (it's fixed point, hence the bit shift. same goes for vertical. + be sure to use 32-bit int's for the bit shift before the division!) */ - TRACE("-NDS_RenderFill\n"); return 0; } static int NDS_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, - const SDL_Rect * srcrect, const SDL_Rect * dstrect) + const SDL_Rect * srcrect, const SDL_Rect * dstrect) { NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; @@ -552,8 +540,7 @@ int bpp = SDL_BYTESPERPIXEL(texture->format); int pitch = txdat->dim.pitch; - TRACE("+NDS_RenderCopy\n"); - if(txdat->type == NDSTX_BG) { + if (txdat->type == NDSTX_BG) { bg_rotation *bgrot = (txdat->hw_index == 2) ? &(data->bg->bg2_rotation) : &(data->bg->bg3_rotation); bgrot->xdx = txdat->dim.hdx; @@ -570,16 +557,15 @@ SpriteEntry *spr = &(data->oam_copy.spriteBuffer[txdat->hw_index]); spr->posX = dstrect->x; spr->posY = dstrect->y; - if(txdat->hw_index < MATRIX_COUNT && spr->isRotoscale) { - SpriteRotation *sprot = &(data->oam_copy.matrixBuffer[txdat->hw_index]); + if (txdat->hw_index < MATRIX_COUNT && spr->isRotoscale) { + SpriteRotation *sprot = + &(data->oam_copy.matrixBuffer[txdat->hw_index]); sprot->hdx = txdat->dim.hdx; sprot->hdy = txdat->dim.hdy; sprot->vdx = txdat->dim.vdx; sprot->vdy = txdat->dim.vdy; } - printf("tried to RenderCopy a sprite.\n"); } - TRACE("-NDS_RenderCopy\n"); return 0; } @@ -592,25 +578,20 @@ SDL_Window *window = SDL_GetWindowFromID(renderer->window); SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); - TRACE("+NDS_RenderPresent\n"); /* update sprites */ NDS_OAM_Update(&(data->oam_copy), data->sub); /* vsync for NDS */ if (renderer->info.flags & SDL_RENDERER_PRESENTVSYNC) { swiWaitForVBlank(); } - TRACE("-NDS_RenderPresent\n"); } static void NDS_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) { NDS_TextureData *txdat = texture->driverdata; - TRACE("+NDS_DestroyTexture\n"); /* free anything else allocated for texture */ - /*SDL_FreeDirtyRects(&txdat->dirty);*/ SDL_free(txdat); - TRACE("-NDS_DestroyTexture\n"); } static void @@ -621,49 +602,36 @@ SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); int i; - TRACE("+NDS_DestroyRenderer\n"); if (data) { - /* TODO: free anything else relevant. */ - /*if (data->surface.format) { - SDL_SetSurfacePalette(&data->surface, NULL); - SDL_FreeFormat(data->surface.format); - } - if (display->palette) { - SDL_DelPaletteWatch(display->palette, DisplayPaletteChanged, - data); - }*/ - /*SDL_FreeDirtyRects(&data->dirty);*/ + /* free anything else relevant if anything else is allocated. */ SDL_free(data); } SDL_free(renderer); - TRACE("-NDS_DestroyRenderer\n"); } static int NDS_SetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture, - const SDL_Color * colors, int firstcolor, int ncolors) + const SDL_Color * colors, int firstcolor, int ncolors) { NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; - TRACE("+NDS_SetTexturePalette\n"); /* set 8-bit modes in the background control registers for backgrounds, BGn_CR |= BG_256_COLOR */ - TRACE("-NDS_SetTexturePalette\n"); + return 0; } static int NDS_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture, - SDL_Color * colors, int firstcolor, int ncolors) + SDL_Color * colors, int firstcolor, int ncolors) { NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; - TRACE("!NDS_GetTexturePalette\n"); + /* stub! */ return 0; } static int NDS_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture) { - TRACE("!NDS_SetTextureColorMod\n"); /* stub! */ return 0; } @@ -671,7 +639,6 @@ static int NDS_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture) { - TRACE("!NDS_SetTextureAlphaMod\n"); /* stub! */ return 0; } @@ -679,7 +646,6 @@ static int NDS_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture) { - TRACE("!NDS_SetTextureBlendMode\n"); /* stub! */ return 0; } @@ -687,7 +653,6 @@ static int NDS_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture) { - TRACE("!NDS_SetTextureScaleMode\n"); /* stub! (note: NDS hardware scaling is nearest neighbor.) */ return 0; } diff -r c9121b04cffa -r e1da92da346c src/video/nds/SDL_ndsvideo.c --- a/src/video/nds/SDL_ndsvideo.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/nds/SDL_ndsvideo.c Wed Aug 27 04:23:38 2008 +0000 @@ -23,7 +23,7 @@ /* SDL Nintendo DS video driver implementation * based on dummy driver: - * Initial work by Ryan C. Gordon (icculus@icculus.org). A good portion + * Initial work by Ryan C. Gordon (icculus@icculus.org). A good portion * of this was cut-and-pasted from Stephane Peter's work in the AAlib * SDL video driver. Renamed to "DUMMY" by Sam Lantinga. */ @@ -43,13 +43,6 @@ #include "SDL_ndsevents_c.h" #include "SDL_ndsrender_c.h" - - -#define TRACE -//#define TRACE printf - - - #define NDSVID_DRIVER_NAME "nds" /* Initialization/Query functions */ @@ -62,9 +55,7 @@ static int NDS_Available(void) { - /*const char *envr = SDL_getenv("SDL_VIDEODRIVER");*/ - /*printf("NDS_Available()\n"); */ - return (1); + return (1); /* always here */ } static void @@ -77,9 +68,7 @@ NDS_CreateDevice(int devindex) { SDL_VideoDevice *device; - /*printf("NDS_CreateDevice(%d)\n", devindex); */ - TRACE("+NDS_CreateDevice\n"); /* Initialize all variables that we clean on shutdown */ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); if (!device) { @@ -100,7 +89,6 @@ device->free = NDS_DeleteDevice; - TRACE("-NDS_CreateDevice\n"); return device; } @@ -115,7 +103,6 @@ SDL_DisplayMode mode; int i; - TRACE("+NDS_VideoInit\n"); /* simple 256x192x16x60 for now */ mode.w = 256; mode.h = 192; @@ -125,62 +112,49 @@ SDL_AddBasicVideoDisplay(&mode); SDL_AddRenderDriver(0, &NDS_RenderDriver); - /*SDL_AddBasicVideoDisplay(&mode); two screens, same mode. uncomment later - SDL_AddRenderDriver(1, &NDS_RenderDriver);*/ SDL_zero(mode); SDL_AddDisplayMode(0, &mode); - /* hackish stuff to get things up and running for now, and for a console */ - powerON(POWER_ALL_2D); irqInit(); - irqEnable(IRQ_VBLANK); + powerON(POWER_ALL_2D); + irqInit(); + irqEnable(IRQ_VBLANK); NDS_SetDisplayMode(_this, &mode); - TRACE("-NDS_VideoInit\n"); return 0; } static int NDS_SetDisplayMode(_THIS, SDL_DisplayMode * mode) { - TRACE("+NDS_SetDisplayMode\n"); /* right now this function is just hard-coded for 256x192 ABGR1555 */ - videoSetMode(MODE_5_2D | - DISPLAY_BG2_ACTIVE | - DISPLAY_BG3_ACTIVE | - DISPLAY_BG_EXT_PALETTE | - DISPLAY_SPR_1D_LAYOUT | - DISPLAY_SPR_1D_BMP | - DISPLAY_SPR_1D_BMP_SIZE_256 | /* try 128 if 256 is trouble. */ - DISPLAY_SPR_ACTIVE | - DISPLAY_SPR_EXT_PALETTE); /* display on main core - with lots of flags set for - flexibility/capacity to render */ + videoSetMode(MODE_5_2D | DISPLAY_BG2_ACTIVE | DISPLAY_BG3_ACTIVE | DISPLAY_BG_EXT_PALETTE | DISPLAY_SPR_1D_LAYOUT | DISPLAY_SPR_1D_BMP | DISPLAY_SPR_1D_BMP_SIZE_256 | /* (try 128 if 256 is trouble.) */ + DISPLAY_SPR_ACTIVE | DISPLAY_SPR_EXT_PALETTE); /* display on main core + with lots of flags set for + flexibility/capacity to render */ /* hopefully these cover all the various things we might need to do */ vramSetBankA(VRAM_A_MAIN_BG_0x06000000); vramSetBankB(VRAM_B_MAIN_BG_0x06020000); vramSetBankC(VRAM_C_SUB_BG_0x06200000); - vramSetBankD(VRAM_D_MAIN_BG_0x06040000); /* not a typo. vram d can't sub */ + vramSetBankD(VRAM_D_MAIN_BG_0x06040000); /* not a typo. vram d can't sub */ vramSetBankE(VRAM_E_MAIN_SPRITE); vramSetBankF(VRAM_F_OBJ_EXT_PALETTE); vramSetBankG(VRAM_G_BG_EXT_PALETTE); vramSetBankH(VRAM_H_SUB_BG_EXT_PALETTE); vramSetBankI(VRAM_I_SUB_SPRITE); - videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); /* debug text on sub - TODO: this will change - when multi-head is - introduced in render */ + videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); /* debug text on sub + TODO: this will change + when multi-head is + introduced in render */ - TRACE("-NDS_SetDisplayMode\n"); return 0; } void NDS_VideoQuit(_THIS) { - TRACE("+NDS_VideoQuit\n"); videoSetMode(DISPLAY_SCREEN_OFF); videoSetModeSub(DISPLAY_SCREEN_OFF); vramSetMainBanks(VRAM_A_LCD, VRAM_B_LCD, VRAM_C_LCD, VRAM_D_LCD); @@ -189,7 +163,6 @@ vramSetBankG(VRAM_G_LCD); vramSetBankH(VRAM_H_LCD); vramSetBankI(VRAM_I_LCD); - TRACE("-NDS_VideoQuit\n"); } /* vi: set ts=4 sw=4 expandtab: */ diff -r c9121b04cffa -r e1da92da346c src/video/os2fslib/SDL_os2fslib.c --- a/src/video/os2fslib/SDL_os2fslib.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/os2fslib/SDL_os2fslib.c Wed Aug 27 04:23:38 2008 +0000 @@ -440,8 +440,8 @@ if ((!pVideo->hidden->pSDLSurface) || ((pVideo->hidden->pSDLSurface) && - ((pVideo->hidden->pSDLSurface-> - flags & SDL_RESIZABLE) == 0))) + ((pVideo->hidden-> + pSDLSurface->flags & SDL_RESIZABLE) == 0))) FSLib_ToggleFSMode(hwnd, !FSLib_QueryFSMode(hwnd)); #ifdef DEBUG_BUILD else @@ -552,11 +552,11 @@ { iXScaleError = - (pVideo->hidden->SrcBufferDesc. - uiXResolution - 1) / swp.cx; + (pVideo->hidden->SrcBufferDesc.uiXResolution - + 1) / swp.cx; iYScaleError = - (pVideo->hidden->SrcBufferDesc. - uiYResolution - 1) / swp.cy; + (pVideo->hidden->SrcBufferDesc.uiYResolution - + 1) / swp.cy; if (iXScaleError < 0) iXScaleError = 0; if (iYScaleError < 0) @@ -577,24 +577,22 @@ iTop = (swp.cy - rcl.yTop) * - pVideo->hidden->SrcBufferDesc. - uiYResolution / swp.cy - iYScaleError; + pVideo->hidden->SrcBufferDesc.uiYResolution / + swp.cy - iYScaleError; iLeft = rcl.xLeft * - pVideo->hidden->SrcBufferDesc. - uiXResolution / swp.cx - iXScaleError; + pVideo->hidden->SrcBufferDesc.uiXResolution / + swp.cx - iXScaleError; iWidth = ((rcl.xRight - rcl.xLeft) * - pVideo->hidden->SrcBufferDesc. - uiXResolution + swp.cx - 1) / swp.cx + - 2 * iXScaleError; + pVideo->hidden->SrcBufferDesc.uiXResolution + + swp.cx - 1) / swp.cx + 2 * iXScaleError; iHeight = ((rcl.yTop - rcl.yBottom) * - pVideo->hidden->SrcBufferDesc. - uiYResolution + swp.cy - 1) / swp.cy + - 2 * iYScaleError; + pVideo->hidden->SrcBufferDesc.uiYResolution + + swp.cy - 1) / swp.cy + 2 * iYScaleError; iWidth += iXScaleError2; iHeight += iYScaleError2; @@ -606,20 +604,19 @@ if (iTop + iHeight > pVideo->hidden->SrcBufferDesc.uiYResolution) iHeight = - pVideo->hidden->SrcBufferDesc. - uiYResolution - iTop; + pVideo->hidden->SrcBufferDesc.uiYResolution - + iTop; if (iLeft + iWidth > pVideo->hidden->SrcBufferDesc.uiXResolution) iWidth = - pVideo->hidden->SrcBufferDesc. - uiXResolution - iLeft; + pVideo->hidden->SrcBufferDesc.uiXResolution - + iLeft; #ifdef DEBUG_BUILD printf ("WM_PAINT : BitBlt: %d %d -> %d %d (Buf %d x %d)\n", iTop, iLeft, iWidth, iHeight, - pVideo->hidden->SrcBufferDesc. - uiXResolution, + pVideo->hidden->SrcBufferDesc.uiXResolution, pVideo->hidden->SrcBufferDesc.uiYResolution); fflush(stdout); #endif @@ -693,15 +690,15 @@ WinQueryWindowPos(hwnd, &swp); if ((!pVideo->hidden->pSDLSurface) || ((pVideo->hidden->pSDLSurface) && - (pVideo->hidden->pSDLSurface-> - flags & SDL_RESIZABLE) + (pVideo->hidden-> + pSDLSurface->flags & SDL_RESIZABLE) && ((swp.cx != - pVideo->hidden->SrcBufferDesc. - uiXResolution) + pVideo->hidden-> + SrcBufferDesc.uiXResolution) || (swp.cy != - pVideo->hidden-> - SrcBufferDesc.uiYResolution)) + pVideo->hidden->SrcBufferDesc. + uiYResolution)) && (!FSLib_QueryFSMode(hwnd)))) { // Resizable surface and in resizing! // So, don't blit now! @@ -718,14 +715,12 @@ fflush(stdout); #endif FSLIB_BITBLT(hwnd, - pVideo->hidden-> - pchSrcBuffer, 0, + pVideo->hidden->pchSrcBuffer, 0, 0, pVideo->hidden-> - SrcBufferDesc. - uiXResolution, - pVideo->hidden-> - SrcBufferDesc.uiYResolution); + SrcBufferDesc.uiXResolution, + pVideo->hidden->SrcBufferDesc. + uiYResolution); } } #ifdef DEBUG_BUILD @@ -773,8 +768,8 @@ &swpClient); ptl.x = 0; ptl.y = 0; - WinMapWindowPoints(pVideo->hidden-> - hwndClient, HWND_DESKTOP, &ptl, 1); + WinMapWindowPoints(pVideo->hidden->hwndClient, + HWND_DESKTOP, &ptl, 1); pVideo->hidden->iSkipWMMOUSEMOVE++; /* Don't take next WM_MOUSEMOVE into account! */ WinSetPointerPos(HWND_DESKTOP, ptl.x + swpClient.cx / 2, @@ -825,8 +820,8 @@ &swpClient); ptl.x = 0; ptl.y = 0; - WinMapWindowPoints(pVideo->hidden-> - hwndClient, HWND_DESKTOP, &ptl, 1); + WinMapWindowPoints(pVideo->hidden->hwndClient, + HWND_DESKTOP, &ptl, 1); pVideo->hidden->iSkipWMMOUSEMOVE++; /* Don't take next WM_MOUSEMOVE into account! */ WinSetPointerPos(HWND_DESKTOP, ptl.x + swpClient.cx / 2, @@ -867,8 +862,8 @@ &swpClient); ptl.x = 0; ptl.y = 0; - WinMapWindowPoints(pVideo->hidden-> - hwndClient, HWND_DESKTOP, &ptl, 1); + WinMapWindowPoints(pVideo->hidden->hwndClient, + HWND_DESKTOP, &ptl, 1); pVideo->hidden->iSkipWMMOUSEMOVE++; /* Don't take next WM_MOUSEMOVE into account! */ WinSetPointerPos(HWND_DESKTOP, ptl.x + swpClient.cx / 2, @@ -910,8 +905,8 @@ &swpClient); ptl.x = 0; ptl.y = 0; - WinMapWindowPoints(pVideo->hidden-> - hwndClient, HWND_DESKTOP, &ptl, 1); + WinMapWindowPoints(pVideo->hidden->hwndClient, + HWND_DESKTOP, &ptl, 1); pVideo->hidden->iSkipWMMOUSEMOVE++; /* Don't take next WM_MOUSEMOVE into account! */ WinSetPointerPos(HWND_DESKTOP, ptl.x + swpClient.cx / 2, @@ -1378,6 +1373,7 @@ while (len-- > 0) *dst++ = ~*src++; } + static void memxor(Uint8 * dst, Uint8 * src1, Uint8 * src2, int len) { @@ -1635,6 +1631,7 @@ { return (-1); } + static void os2fslib_FreeHWSurface(_THIS, SDL_Surface * surface) { @@ -2505,23 +2502,22 @@ pResult = SDL_CreateRGBSurface(SDL_SWSURFACE, pModeInfoFound->uiXResolution, pModeInfoFound->uiYResolution, - pModeInfoFound->uiBPP, - ((unsigned int) pModeInfoFound-> - PixelFormat. - ucRedMask) << pModeInfoFound-> - PixelFormat.ucRedPosition, - ((unsigned int) pModeInfoFound-> - PixelFormat. - ucGreenMask) << pModeInfoFound-> - PixelFormat.ucGreenPosition, - ((unsigned int) pModeInfoFound-> - PixelFormat. - ucBlueMask) << pModeInfoFound-> - PixelFormat.ucBluePosition, - ((unsigned int) pModeInfoFound-> - PixelFormat. - ucAlphaMask) << pModeInfoFound-> - PixelFormat.ucAlphaPosition); + pModeInfoFound->uiBPP, ((unsigned int) + pModeInfoFound->PixelFormat.ucRedMask) + << pModeInfoFound->PixelFormat. + ucRedPosition, ((unsigned int) + pModeInfoFound-> + PixelFormat.ucGreenMask) + << pModeInfoFound->PixelFormat. + ucGreenPosition, ((unsigned int) + pModeInfoFound-> + PixelFormat.ucBlueMask) + << pModeInfoFound->PixelFormat. + ucBluePosition, ((unsigned int) + pModeInfoFound-> + PixelFormat.ucAlphaMask) + << pModeInfoFound->PixelFormat. + ucAlphaPosition); if (pResult == NULL) { DosReleaseMutexSem(_this->hidden->hmtxUseSrcBuffer); @@ -2535,23 +2531,27 @@ // Adjust pixel format mask! pResult->format->Rmask = - ((unsigned int) pModeInfoFound->PixelFormat. - ucRedMask) << pModeInfoFound->PixelFormat.ucRedPosition; + ((unsigned int) pModeInfoFound-> + PixelFormat.ucRedMask) << pModeInfoFound->PixelFormat. + ucRedPosition; pResult->format->Rshift = pModeInfoFound->PixelFormat.ucRedPosition; pResult->format->Rloss = pModeInfoFound->PixelFormat.ucRedAdjust; pResult->format->Gmask = - ((unsigned int) pModeInfoFound->PixelFormat. - ucGreenMask) << pModeInfoFound->PixelFormat.ucGreenPosition; + ((unsigned int) pModeInfoFound-> + PixelFormat.ucGreenMask) << pModeInfoFound->PixelFormat. + ucGreenPosition; pResult->format->Gshift = pModeInfoFound->PixelFormat.ucGreenPosition; pResult->format->Gloss = pModeInfoFound->PixelFormat.ucGreenAdjust; pResult->format->Bmask = - ((unsigned int) pModeInfoFound->PixelFormat. - ucBlueMask) << pModeInfoFound->PixelFormat.ucBluePosition; + ((unsigned int) pModeInfoFound-> + PixelFormat.ucBlueMask) << pModeInfoFound->PixelFormat. + ucBluePosition; pResult->format->Bshift = pModeInfoFound->PixelFormat.ucBluePosition; pResult->format->Bloss = pModeInfoFound->PixelFormat.ucBlueAdjust; pResult->format->Amask = - ((unsigned int) pModeInfoFound->PixelFormat. - ucAlphaMask) << pModeInfoFound->PixelFormat.ucAlphaPosition; + ((unsigned int) pModeInfoFound-> + PixelFormat.ucAlphaMask) << pModeInfoFound->PixelFormat. + ucAlphaPosition; pResult->format->Ashift = pModeInfoFound->PixelFormat.ucAlphaPosition; pResult->format->Aloss = pModeInfoFound->PixelFormat.ucAlphaAdjust; @@ -2738,10 +2738,8 @@ for (i = 0; _this->hidden->pListModesResult[i]; i++) { iNumOfSlots++; if (iPlace == -1) { - if ((_this->hidden-> - pListModesResult[i]->w * - _this->hidden-> - pListModesResult[i]->h) < + if ((_this->hidden->pListModesResult[i]->w * + _this->hidden->pListModesResult[i]->h) < (pRect->w * pRect->h)) { iPlace = i; } @@ -2754,14 +2752,10 @@ // printf("!!! From %d slots, it will be at %d\n", iNumOfSlots, iPlace); #endif - pNewList = - (SDL_Rect **) SDL_realloc(_this-> - hidden-> - pListModesResult, - (iNumOfSlots - + - 1) * - sizeof(SDL_Rect *)); + pNewList = (SDL_Rect **) + SDL_realloc(_this->hidden->pListModesResult, + (iNumOfSlots + + 1) * sizeof(SDL_Rect *)); if (pNewList) { for (i = iNumOfSlots; i > iPlace; i--) pNewList[i] = pNewList[i - 1]; @@ -2816,23 +2810,25 @@ vformat->BytesPerPixel = (vformat->BitsPerPixel + 7) / 8; vformat->Rmask = - ((unsigned int) pDesktopMode->PixelFormat.ucRedMask) << pDesktopMode-> - PixelFormat.ucRedPosition; + ((unsigned int) pDesktopMode->PixelFormat. + ucRedMask) << pDesktopMode->PixelFormat.ucRedPosition; vformat->Rshift = pDesktopMode->PixelFormat.ucRedPosition; vformat->Rloss = pDesktopMode->PixelFormat.ucRedAdjust; vformat->Gmask = - ((unsigned int) pDesktopMode->PixelFormat. - ucGreenMask) << pDesktopMode->PixelFormat.ucGreenPosition; + ((unsigned int) pDesktopMode-> + PixelFormat.ucGreenMask) << pDesktopMode->PixelFormat. + ucGreenPosition; vformat->Gshift = pDesktopMode->PixelFormat.ucGreenPosition; vformat->Gloss = pDesktopMode->PixelFormat.ucGreenAdjust; vformat->Bmask = - ((unsigned int) pDesktopMode->PixelFormat. - ucBlueMask) << pDesktopMode->PixelFormat.ucBluePosition; + ((unsigned int) pDesktopMode-> + PixelFormat.ucBlueMask) << pDesktopMode->PixelFormat.ucBluePosition; vformat->Bshift = pDesktopMode->PixelFormat.ucBluePosition; vformat->Bloss = pDesktopMode->PixelFormat.ucBlueAdjust; vformat->Amask = - ((unsigned int) pDesktopMode->PixelFormat. - ucAlphaMask) << pDesktopMode->PixelFormat.ucAlphaPosition; + ((unsigned int) pDesktopMode-> + PixelFormat.ucAlphaMask) << pDesktopMode->PixelFormat. + ucAlphaPosition; vformat->Ashift = pDesktopMode->PixelFormat.ucAlphaPosition; vformat->Aloss = pDesktopMode->PixelFormat.ucAlphaAdjust; @@ -2937,10 +2933,10 @@ sizeof(_this->hidden->SrcBufferDesc)); // Allocate new video buffer! _this->hidden->pchSrcBuffer = - (char *) SDL_malloc(_this->hidden->pAvailableFSLibVideoModes-> - uiScanLineSize * - _this->hidden->pAvailableFSLibVideoModes-> - uiYResolution); + (char *) SDL_malloc(_this->hidden-> + pAvailableFSLibVideoModes->uiScanLineSize * + _this->hidden-> + pAvailableFSLibVideoModes->uiYResolution); if (!_this->hidden->pchSrcBuffer) { #ifdef DEBUG_BUILD printf diff -r c9121b04cffa -r e1da92da346c src/video/photon/SDL_ph_gl.c --- a/src/video/photon/SDL_ph_gl.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/photon/SDL_ph_gl.c Wed Aug 27 04:23:38 2008 +0000 @@ -315,14 +315,17 @@ && (this->gl_config.accum_blue_size != 0) && (this->gl_config.accum_green_size != 0)) { qnxgl_attribs_slide = qnxgl_attrib_set_accum(qnxgl_attribs_slide, - this->gl_config. - accum_red_size + - this->gl_config. - accum_blue_size + - this->gl_config. - accum_green_size + - this->gl_config. - accum_alpha_size); + this-> + gl_config.accum_red_size + + + this-> + gl_config.accum_blue_size + + + this-> + gl_config.accum_green_size + + + this-> + gl_config.accum_alpha_size); } /* Stereo mode */ diff -r c9121b04cffa -r e1da92da346c src/video/photon/SDL_ph_image.c --- a/src/video/photon/SDL_ph_image.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/photon/SDL_ph_image.c Wed Aug 27 04:23:38 2008 +0000 @@ -244,9 +244,8 @@ } if ((screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) { - OCImage.FrameData1 = - (unsigned char *) PdGetOffscreenContextPtr(OCImage. - offscreen_backcontext); + OCImage.FrameData1 = (unsigned char *) + PdGetOffscreenContextPtr(OCImage.offscreen_backcontext); if (OCImage.FrameData1 == NULL) { SDL_SetError ("ph_SetupFullScreenImage(back): PdGetOffscreenContextPtr() function failed !\n"); diff -r c9121b04cffa -r e1da92da346c src/video/photon/SDL_phyuv.c --- a/src/video/photon/SDL_phyuv.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/photon/SDL_phyuv.c Wed Aug 27 04:23:38 2008 +0000 @@ -149,8 +149,8 @@ &overlay->hwdata->caps); if (rtncode == 0) { if (overlay->hwdata->caps.format == format) { - if ((overlay->hwdata->caps. - flags & Pg_SCALER_CAP_DST_CHROMA_KEY) == + if ((overlay->hwdata-> + caps.flags & Pg_SCALER_CAP_DST_CHROMA_KEY) == Pg_SCALER_CAP_DST_CHROMA_KEY) { overlay->hwdata->ischromakey = 1; } diff -r c9121b04cffa -r e1da92da346c src/video/ps2gs/SDL_gsvideo.c --- a/src/video/ps2gs/SDL_gsvideo.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/ps2gs/SDL_gsvideo.c Wed Aug 27 04:23:38 2008 +0000 @@ -232,6 +232,7 @@ 0x0e, /* A+D */ 0, /* 2 */ PS2_GS_TEX0_1, (1 << 5) + (1 << 6), PS2_GS_TEX1_1, 0, PS2_GS_TEXFLUSH}; + static unsigned long long scale_tags[] __attribute__ ((aligned(16))) = { 5 | (1LL << 60), /* GIFtag */ 0x0e, /* A+D */ @@ -573,11 +574,13 @@ { return (-1); } + static void GS_FreeHWSurface(_THIS, SDL_Surface * surface) { return; } + static int GS_LockHWSurface(_THIS, SDL_Surface * surface) { @@ -606,6 +609,7 @@ } return (0); } + static void GS_UnlockHWSurface(_THIS, SDL_Surface * surface) { diff -r c9121b04cffa -r e1da92da346c src/video/riscos/SDL_riscosvideo.c --- a/src/video/riscos/SDL_riscosvideo.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/riscos/SDL_riscosvideo.c Wed Aug 27 04:23:38 2008 +0000 @@ -286,6 +286,7 @@ { return (-1); } + static void RISCOS_FreeHWSurface(_THIS, SDL_Surface * surface) { diff -r c9121b04cffa -r e1da92da346c src/video/svga/SDL_svgavideo.c --- a/src/video/svga/SDL_svgavideo.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/svga/SDL_svgavideo.c Wed Aug 27 04:23:38 2008 +0000 @@ -467,6 +467,7 @@ { return (-1); } + static void SVGA_FreeHWSurface(_THIS, SDL_Surface * surface) { @@ -480,6 +481,7 @@ /* The waiting is done in SVGA_FlipHWSurface() */ return (0); } + static void SVGA_UnlockHWSurface(_THIS, SDL_Surface * surface) { diff -r c9121b04cffa -r e1da92da346c src/video/vgl/SDL_vglvideo.c --- a/src/video/vgl/SDL_vglvideo.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/vgl/SDL_vglvideo.c Wed Aug 27 04:23:38 2008 +0000 @@ -409,6 +409,7 @@ { return -1; } + static void VGL_FreeHWSurface(_THIS, SDL_Surface * surface) { @@ -424,6 +425,7 @@ } return 0; } + static void VGL_UnlockHWSurface(_THIS, SDL_Surface * surface) { diff -r c9121b04cffa -r e1da92da346c src/video/win32/SDL_d3drender.c --- a/src/video/win32/SDL_d3drender.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/win32/SDL_d3drender.c Wed Aug 27 04:23:38 2008 +0000 @@ -596,8 +596,8 @@ result = IDirect3DDevice9_UpdateTexture(renderdata->device, (IDirect3DBaseTexture9 *) temp, - (IDirect3DBaseTexture9 *) data-> - texture); + (IDirect3DBaseTexture9 *) + data->texture); IDirect3DTexture9_Release(temp); if (FAILED(result)) { D3D_SetError("UpdateTexture()", result); @@ -805,9 +805,8 @@ } result = - IDirect3DDevice9_SetTexture(data->device, 0, - (IDirect3DBaseTexture9 *) texturedata-> - texture); + IDirect3DDevice9_SetTexture(data->device, 0, (IDirect3DBaseTexture9 *) + texturedata->texture); if (FAILED(result)) { D3D_SetError("SetTexture()", result); return -1; diff -r c9121b04cffa -r e1da92da346c src/video/win32/SDL_gdirender.c --- a/src/video/win32/SDL_gdirender.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/win32/SDL_gdirender.c Wed Aug 27 04:23:38 2008 +0000 @@ -620,9 +620,8 @@ SelectPalette(data->memory_hdc, texturedata->hpal, TRUE); RealizePalette(data->memory_hdc); } - if (texture-> - blendMode & (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND)) - { + if (texture->blendMode & + (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND)) { BLENDFUNCTION blendFunc = { AC_SRC_OVER, 0, diff -r c9121b04cffa -r e1da92da346c src/video/win32/SDL_win32keyboard.c --- a/src/video/win32/SDL_win32keyboard.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/win32/SDL_win32keyboard.c Wed Aug 27 04:23:38 2008 +0000 @@ -41,6 +41,7 @@ 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38, 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 21, 44 }; + BYTE keypad_scancodes[10] = { 82, 79, 80, 81, 75, 76, 77, 71, 72, 73 }; diff -r c9121b04cffa -r e1da92da346c src/video/win32/SDL_win32opengl.c --- a/src/video/win32/SDL_win32opengl.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/win32/SDL_win32opengl.c Wed Aug 27 04:23:38 2008 +0000 @@ -500,8 +500,7 @@ if (_this->gl_config.accelerated >= 0) { *iAttr++ = WGL_ACCELERATION_ARB; *iAttr++ = - (_this->gl_config. - accelerated ? WGL_GENERIC_ACCELERATION_ARB : + (_this->gl_config.accelerated ? WGL_GENERIC_ACCELERATION_ARB : WGL_NO_ACCELERATION_ARB); } diff -r c9121b04cffa -r e1da92da346c src/video/wscons/SDL_wsconsvideo.c --- a/src/video/wscons/SDL_wsconsvideo.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/wscons/SDL_wsconsvideo.c Wed Aug 27 04:23:38 2008 +0000 @@ -399,6 +399,7 @@ { return -1; } + static void WSCONS_FreeHWSurface(_THIS, SDL_Surface * surface) { diff -r c9121b04cffa -r e1da92da346c src/video/x11/SDL_x11opengl.c --- a/src/video/x11/SDL_x11opengl.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/x11/SDL_x11opengl.c Wed Aug 27 04:23:38 2008 +0000 @@ -420,8 +420,8 @@ SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; int screen = - ((SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata)-> - screen; + ((SDL_DisplayData *) SDL_GetDisplayFromWindow(window)-> + driverdata)->screen; XWindowAttributes xattr; XVisualInfo v, *vinfo; int n; diff -r c9121b04cffa -r e1da92da346c src/video/xbios/SDL_xbiosmodes.c --- a/src/video/xbios/SDL_xbiosmodes.c Thu Aug 21 12:38:21 2008 +0000 +++ b/src/video/xbios/SDL_xbiosmodes.c Wed Aug 27 04:23:38 2008 +0000 @@ -277,8 +277,8 @@ SDL_XBIOS_AddMode(_this, falcon_rgb_modes[i].width, falcon_rgb_modes[i].height, falcon_rgb_modes[i].bpp, - falcon_rgb_modes[i]. - modecode & modecodemask, SDL_FALSE); + falcon_rgb_modes[i].modecode & + modecodemask, SDL_FALSE); } break; case MONITOR_VGA: @@ -288,8 +288,8 @@ SDL_XBIOS_AddMode(_this, falcon_vga_modes[i].width, falcon_vga_modes[i].height, falcon_vga_modes[i].bpp, - falcon_vga_modes[i]. - modecode & modecodemask, SDL_FALSE); + falcon_vga_modes[i].modecode & + modecodemask, SDL_FALSE); } break; } diff -r c9121b04cffa -r e1da92da346c test/nds-test-progs/general/source/main.c --- a/test/nds-test-progs/general/source/main.c Thu Aug 21 12:38:21 2008 +0000 +++ b/test/nds-test-progs/general/source/main.c Wed Aug 27 04:23:38 2008 +0000 @@ -4,82 +4,93 @@ #include #include #else -#define swiWaitForVBlank() -#define consoleDemoInit() -#define fatInitDefault() +#define swiWaitForVBlank() +#define consoleDemoInit() +#define fatInitDefault() #define RGB15(r,g,b) SDL_MapRGB(screen->format,((r)<<3),((g)<<3),((b)<<3)) #endif - -void splash(SDL_Surface *screen, int s) { - SDL_Surface *logo; - SDL_Rect area = {0,0,256,192}; + void +splash(SDL_Surface * screen, int s) +{ + SDL_Surface *logo; + SDL_Rect area = { 0, 0, 256, 192 }; - logo = SDL_LoadBMP("sdl.bmp"); - if(!logo) { - printf("Couldn't splash.\n"); - return; - } - /*logo->flags &= ~SDL_PREALLOC;*/ - SDL_BlitSurface(logo, NULL, screen, &area); - SDL_Flip(screen); - while(s-- > 0) { - int i = 60; - while(--i) swiWaitForVBlank(); - } + logo = SDL_LoadBMP("sdl.bmp"); + if (!logo) { + printf("Couldn't splash.\n"); + return; + } + /*logo->flags &= ~SDL_PREALLOC; */ + SDL_BlitSurface(logo, NULL, screen, &area); + SDL_Flip(screen); + while (s-- > 0) { + int i = 60; + while (--i) + swiWaitForVBlank(); + } } - -int main(void) { - SDL_Surface *screen; - SDL_Joystick *stick; - SDL_Event event; - SDL_Rect rect = {0,0,256,192}; - int i; + + int +main(void) +{ + SDL_Surface *screen; + SDL_Joystick *stick; + SDL_Event event; + SDL_Rect rect = { 0, 0, 256, 192 }; + int i; - consoleDemoInit(); puts("Hello world! Initializing FAT..."); - fatInitDefault(); - if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) < 0) { - puts("# error initializing SDL"); - puts(SDL_GetError()); - return 1; - } - puts("* initialized SDL"); - screen = SDL_SetVideoMode(256, 192, 15, SDL_SWSURFACE); - if(!screen) { - puts("# error setting video mode"); - puts(SDL_GetError()); - return 2; - } - screen->flags &= ~SDL_PREALLOC; - puts("* set video mode"); - stick = SDL_JoystickOpen(0); - if(stick == NULL) { - puts("# error opening joystick"); - puts(SDL_GetError()); -// return 3; - } - puts("* opened joystick"); + consoleDemoInit(); + puts("Hello world! Initializing FAT..."); + fatInitDefault(); + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) { + puts("# error initializing SDL"); + puts(SDL_GetError()); + return 1; + } + puts("* initialized SDL"); + screen = SDL_SetVideoMode(256, 192, 15, SDL_SWSURFACE); + if (!screen) { + puts("# error setting video mode"); + puts(SDL_GetError()); + return 2; + } + screen->flags &= ~SDL_PREALLOC; + puts("* set video mode"); + stick = SDL_JoystickOpen(0); + if (stick == NULL) { + puts("# error opening joystick"); + puts(SDL_GetError()); +// return 3; + } + puts("* opened joystick"); + + /*splash(screen, 3); */ - /*splash(screen, 3);*/ - - SDL_FillRect(screen, &rect, RGB15(0,0,31)|0x8000); - SDL_Flip(screen); + SDL_FillRect(screen, &rect, RGB15(0, 0, 31) | 0x8000); + SDL_Flip(screen); - while(1) - while(SDL_PollEvent(&event)) - switch(event.type) { - case SDL_JOYBUTTONDOWN: - SDL_FillRect(screen, &rect, (u16)rand()|0x8000); - SDL_Flip(screen); - if(rect.w > 8) { - rect.x += 4; rect.y += 3; - rect.w -= 8; rect.h -= 6; - } - printf("button %d pressed at %d ticks\n", - event.jbutton.which, SDL_GetTicks()); - break; - case SDL_QUIT: SDL_Quit(); return 0; - default: break; - } + while (1) + while (SDL_PollEvent(&event)) + switch (event.type) { + case SDL_JOYBUTTONDOWN: + SDL_FillRect(screen, &rect, (u16) rand() | 0x8000); + SDL_Flip(screen); + if (rect.w > 8) { + rect.x += 4; + rect.y += 3; + rect.w -= 8; + rect.h -= 6; + } + printf("button %d pressed at %d ticks\n", + event.jbutton.which, SDL_GetTicks()); + break; + case SDL_QUIT: + SDL_Quit(); + return 0; + default: + break; + } + return 0; + } + - return 0; -} diff -r c9121b04cffa -r e1da92da346c test/nds-test-progs/sprite/source/testsprite.c --- a/test/nds-test-progs/sprite/source/testsprite.c Thu Aug 21 12:38:21 2008 +0000 +++ b/test/nds-test-progs/sprite/source/testsprite.c Wed Aug 27 04:23:38 2008 +0000 @@ -163,7 +163,8 @@ SDL_Event event; Uint32 then, now, frames; - consoleDemoInit(); puts("Hello world! Initializing FAT..."); + consoleDemoInit(); + puts("Hello world! Initializing FAT..."); fatInitDefault(); /* Initialize SDL */ if (SDL_Init(SDL_INIT_VIDEO) < 0) { @@ -173,7 +174,7 @@ puts("* initialized SDL"); numsprites = NUM_SPRITES; - videoflags = SDL_SWSURFACE /*| SDL_ANYFORMAT*/; + videoflags = SDL_SWSURFACE /*| SDL_ANYFORMAT */ ; width = 256; height = 192; video_bpp = 15; diff -r c9121b04cffa -r e1da92da346c test/nds-test-progs/sprite2/source/testsprite2.c --- a/test/nds-test-progs/sprite2/source/testsprite2.c Thu Aug 21 12:38:21 2008 +0000 +++ b/test/nds-test-progs/sprite2/source/testsprite2.c Wed Aug 27 04:23:38 2008 +0000 @@ -81,9 +81,11 @@ return (0); } -int LoadSprite2(const u8* ptr, int size) { +int +LoadSprite2(const u8 * ptr, int size) +{ int i; - SDL_Rect r = {0,0,32,32}; + SDL_Rect r = { 0, 0, 32, 32 }; for (i = 0; i < state->num_windows; ++i) { SDL_SelectRenderer(state->windows[i]); sprites[i] = SDL_CreateTexture(SDL_PIXELFORMAT_ABGR1555, @@ -92,7 +94,7 @@ fprintf(stderr, "Couldn't create texture: %s\n", SDL_GetError()); return -1; } - SDL_UpdateTexture(sprites[i], &r, ptr, r.w*2); + SDL_UpdateTexture(sprites[i], &r, ptr, r.w * 2); SDL_SetTextureBlendMode(sprites[i], blendMode); SDL_SetTextureScaleMode(sprites[i], scaleMode); } @@ -170,7 +172,8 @@ SDL_Event event; Uint32 then, now, frames; - consoleDemoInit(); puts("Hello world! Initializing FAT..."); + consoleDemoInit(); + puts("Hello world! Initializing FAT..."); fatInitDefault(); /* Initialize parameters */