From 178ca1ee777158b38393235faa076786c47fc30d Mon Sep 17 00:00:00 2001 From: Darren Alton Date: Wed, 27 Aug 2008 04:23:38 +0000 Subject: [PATCH] Clean up. --- Makefile.ds | 32 +- include/SDL_endian.h | 4 +- src/SDL_compat.c | 1 + src/SDL_error.c | 4 +- src/audio/SDL_audio.c | 7 + src/audio/alsa/SDL_alsa_audio.c | 3 + src/audio/dart/SDL_dart.c | 17 +- src/audio/nds/SDL_ndsaudio.c | 49 ++- src/audio/nds/SDL_ndsaudio.h | 2 +- src/audio/windib/SDL_dibaudio.c | 4 +- src/audio/windx5/SDL_dx5audio.c | 5 +- src/cdrom/SDL_cdrom.c | 1 + src/cdrom/macosx/AudioFileReaderThread.c | 8 +- src/events/SDL_events.c | 1 + src/events/default_cursor.h | 2 + src/file/SDL_rwops.c | 17 +- src/joystick/darwin/SDL_sysjoystick.c | 4 +- src/joystick/linux/SDL_sysjoystick.c | 27 +- src/joystick/nds/SDL_sysjoystick.c | 71 ++-- src/joystick/win32/SDL_dxjoystick.c | 25 +- src/loadso/macosx/SDL_dlcompat.c | 5 +- src/stdlib/SDL_stdlib.c | 8 + src/thread/irix/SDL_syssem.c | 2 + src/timer/nds/SDL_systimer.c | 13 +- src/video/SDL_blit_0.c | 3 + src/video/SDL_blit_1.c | 2 + src/video/SDL_blit_A.c | 8 +- src/video/SDL_blit_N.c | 13 +- src/video/SDL_gamma.c | 1 + src/video/SDL_pixels.c | 1 + src/video/SDL_renderer_sw.c | 32 +- src/video/SDL_surface.c | 6 +- src/video/ataricommon/SDL_atarigl.c | 14 +- src/video/bwindow/SDL_sysvideo.cc | 4 +- src/video/dc/SDL_dcevents.c | 6 +- src/video/dc/SDL_dcvideo.c | 2 + src/video/directfb/SDL_DirectFB_events.c | 28 +- src/video/directfb/SDL_DirectFB_mouse.c | 35 +- src/video/directfb/SDL_DirectFB_render.c | 105 +++--- src/video/directfb/SDL_DirectFB_video.c | 73 ++-- src/video/fbcon/SDL_fb3dfx.c | 1 + src/video/fbcon/SDL_fbevents.c | 2 + src/video/fbcon/SDL_fbmatrox.c | 1 + src/video/fbcon/SDL_fbriva.c | 2 + src/video/fbcon/SDL_fbvideo.c | 5 + src/video/gapi/SDL_gapivideo.c | 4 +- src/video/ipod/SDL_ipodvideo.c | 11 +- src/video/nds/SDL_ndsevents.c | 6 +- src/video/nds/SDL_ndsrender.c | 319 ++++++++---------- src/video/nds/SDL_ndsvideo.c | 55 +-- src/video/os2fslib/SDL_os2fslib.c | 178 +++++----- src/video/photon/SDL_ph_gl.c | 19 +- src/video/photon/SDL_ph_image.c | 5 +- src/video/photon/SDL_phyuv.c | 4 +- src/video/ps2gs/SDL_gsvideo.c | 4 + src/video/riscos/SDL_riscosvideo.c | 1 + src/video/svga/SDL_svgavideo.c | 2 + src/video/vgl/SDL_vglvideo.c | 2 + src/video/win32/SDL_d3drender.c | 9 +- src/video/win32/SDL_gdirender.c | 5 +- src/video/win32/SDL_win32keyboard.c | 1 + src/video/win32/SDL_win32opengl.c | 3 +- src/video/wscons/SDL_wsconsvideo.c | 1 + src/video/x11/SDL_x11opengl.c | 4 +- src/video/xbios/SDL_xbiosmodes.c | 8 +- test/nds-test-progs/general/source/main.c | 151 +++++---- .../nds-test-progs/sprite/source/testsprite.c | 5 +- .../sprite2/source/testsprite2.c | 11 +- 68 files changed, 739 insertions(+), 725 deletions(-) diff --git a/Makefile.ds b/Makefile.ds index cabe0a3f6..64e84d7ef 100644 --- a/Makefile.ds +++ b/Makefile.ds @@ -101,31 +101,10 @@ src/video/SDL_yuv_sw.c \ 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 @@ install: $(TARGET) @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 --git a/include/SDL_endian.h b/include/SDL_endian.h index b04e92976..b5aa4c9d0 100644 --- a/include/SDL_endian.h +++ b/include/SDL_endian.h @@ -156,8 +156,8 @@ SDL_Swap64(Uint64 x) } 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 --git a/src/SDL_compat.c b/src/SDL_compat.c index 0d29b44d4..17b53ebc1 100644 --- a/src/SDL_compat.c +++ b/src/SDL_compat.c @@ -693,6 +693,7 @@ SDL_UpdateRect(SDL_Surface * screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h) SDL_UpdateRects(screen, 1, &rect); } } + void SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects) { diff --git a/src/SDL_error.c b/src/SDL_error.c index a447a125d..372763817 100644 --- a/src/SDL_error.c +++ b/src/SDL_error.c @@ -180,8 +180,8 @@ SDL_GetErrorMsg(char *errstr, unsigned int maxlen) 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 --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 672939522..6e641f4ea 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -171,31 +171,38 @@ SDL_AudioDetectDevices_Default(int iscapture) { 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 --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c index d774c4f18..473b2e14f 100644 --- a/src/audio/alsa/SDL_alsa_audio.c +++ b/src/audio/alsa/SDL_alsa_audio.c @@ -259,16 +259,19 @@ swizzle_alsa_channels_6_64bit(_THIS) { 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 --git a/src/audio/dart/SDL_dart.c b/src/audio/dart/SDL_dart.c index d0549fffe..56ba77e65 100644 --- a/src/audio/dart/SDL_dart.c +++ b/src/audio/dart/SDL_dart.c @@ -62,8 +62,8 @@ DARTEventFunc(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, ULONG ulFlags) 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 @@ DART_PlayDevice(_THIS) (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 @@ DART_GetDeviceBuf(_THIS) 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 --git a/src/audio/nds/SDL_ndsaudio.c b/src/audio/nds/SDL_ndsaudio.c index fbe6197a5..13ba2584f 100644 --- a/src/audio/nds/SDL_ndsaudio.c +++ b/src/audio/nds/SDL_ndsaudio.c @@ -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 @@ NDSAUD_OpenDevice(_THIS, const char *devname, int iscapture) 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 @@ NDSAUD_PlayDevice(_THIS) // 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 @@ NDSAUD_Init(SDL_AudioDriverImpl * impl) 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 --git a/src/audio/nds/SDL_ndsaudio.h b/src/audio/nds/SDL_ndsaudio.h index edf0529d7..0109a3c55 100644 --- a/src/audio/nds/SDL_ndsaudio.h +++ b/src/audio/nds/SDL_ndsaudio.h @@ -32,7 +32,7 @@ struct SDL_PrivateAudioData { - TransferSoundData* sound; + TransferSoundData *sound; /* The file descriptor for the audio device */ Uint8 *mixbuf; Uint32 mixlen; diff --git a/src/audio/windib/SDL_dibaudio.c b/src/audio/windib/SDL_dibaudio.c index ade0eb96d..e48fced54 100644 --- a/src/audio/windib/SDL_dibaudio.c +++ b/src/audio/windib/SDL_dibaudio.c @@ -107,8 +107,8 @@ WINWAVEOUT_WaitDevice(_THIS) 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 --git a/src/audio/windx5/SDL_dx5audio.c b/src/audio/windx5/SDL_dx5audio.c index 1edaef1e7..4cac5bad4 100644 --- a/src/audio/windx5/SDL_dx5audio.c +++ b/src/audio/windx5/SDL_dx5audio.c @@ -278,8 +278,9 @@ DSOUND_GetDeviceBuf(_THIS) 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 --git a/src/cdrom/SDL_cdrom.c b/src/cdrom/SDL_cdrom.c index afb75c9e3..5ff5bf3ee 100644 --- a/src/cdrom/SDL_cdrom.c +++ b/src/cdrom/SDL_cdrom.c @@ -44,6 +44,7 @@ struct CDcaps SDL_CDcaps = { NULL, /* Eject */ NULL, /* Close */ }; + int SDL_numcds; int diff --git a/src/cdrom/macosx/AudioFileReaderThread.c b/src/cdrom/macosx/AudioFileReaderThread.c index fb9f45b58..272a78616 100644 --- a/src/cdrom/macosx/AudioFileReaderThread.c +++ b/src/cdrom/macosx/AudioFileReaderThread.c @@ -335,9 +335,8 @@ FileReaderThread_ReadNextChunk(FileReaderThread * frt) } /* 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 @@ AudioFileManager_GetFileData(AudioFileManager * afm, void **inOutData, } else { *inOutDataSize = afm->mChunkSize; *inOutData = - afm->mReadFromFirstBuffer ? afm->mFileBuffer : (afm-> - mFileBuffer + + afm->mReadFromFirstBuffer ? afm->mFileBuffer : (afm->mFileBuffer + afm->mChunkSize); } diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index 364182eb3..d9d80ecb1 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -73,6 +73,7 @@ SDL_Lock_EventThread(void) } } } + void SDL_Unlock_EventThread(void) { diff --git a/src/events/default_cursor.h b/src/events/default_cursor.h index 1fcc19e09..b61dc6549 100644 --- a/src/events/default_cursor.h +++ b/src/events/default_cursor.h @@ -51,6 +51,7 @@ static unsigned char default_cdata[] = { 0x03, 0x00, 0x00, 0x00 }; + static unsigned char default_cmask[] = { 0xC0, 0x00, 0xE0, 0x00, @@ -90,6 +91,7 @@ static unsigned char default_cdata[] = { 0x03, 0x00, 0x00, 0x00 }; + static unsigned char default_cmask[] = { 0x40, 0x00, 0xE0, 0x00, diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c index 3fa33bd30..b1e9b94e3 100644 --- a/src/file/SDL_rwops.c +++ b/src/file/SDL_rwops.c @@ -136,6 +136,7 @@ win32_file_open(SDL_RWops * context, const char *filename, const char *mode) return 0; /* ok */ } + static long SDLCALL win32_file_seek(SDL_RWops * context, long offset, int whence) { @@ -177,6 +178,7 @@ win32_file_seek(SDL_RWops * context, long offset, int whence) 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 @@ win32_file_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum) } 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 @@ win32_file_write(SDL_RWops * context, const void *ptr, size_t size, nwritten = byte_written / size; return nwritten; } + static int SDLCALL win32_file_close(SDL_RWops * context) { @@ -302,6 +306,7 @@ stdio_seek(SDL_RWops * context, long offset, int whence) return (-1); } } + static size_t SDLCALL stdio_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum) { @@ -313,6 +318,7 @@ stdio_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum) } return (nread); } + static size_t SDLCALL stdio_write(SDL_RWops * context, const void *ptr, size_t size, size_t num) { @@ -324,6 +330,7 @@ stdio_write(SDL_RWops * context, const void *ptr, size_t size, size_t num) } return (nwrote); } + static int SDLCALL stdio_close(SDL_RWops * context) { @@ -372,6 +379,7 @@ mem_seek(SDL_RWops * context, long offset, int whence) 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 @@ mem_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum) 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 @@ mem_write(SDL_RWops * context, const void *ptr, size_t size, size_t num) 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_RWFromFP(FILE * fp, SDL_bool autoclose) { 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 --git a/src/joystick/darwin/SDL_sysjoystick.c b/src/joystick/darwin/SDL_sysjoystick.c index bd0f68746..cdbd425cb 100644 --- a/src/joystick/darwin/SDL_sysjoystick.c +++ b/src/joystick/darwin/SDL_sysjoystick.c @@ -194,8 +194,8 @@ HIDCreateOpenDeviceInterface(io_object_t hidDevice, recDevice * pDevice) (*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 --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index faec85383..2c72b3471 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -91,6 +91,7 @@ struct joystick_logical_mapping 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 @@ static struct joystick_logical_mapping mp88xx_2_logical_axismap[] = { {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 @@ static struct joystick_logical_mapping mp88xx_3_logical_axismap[] = { {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 @@ static struct joystick_logical_mapping mp88xx_4_logical_axismap[] = { {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 @@ struct joystick_logical_layout 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 @@ HandleHat(SDL_Joystick * stick, Uint8 hat, int axis, int value) #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 @@ EV_HandleEvents(SDL_Joystick * joystick) 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_HandleEvents(SDL_Joystick * joystick) 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 --git a/src/joystick/nds/SDL_sysjoystick.c b/src/joystick/nds/SDL_sysjoystick.c index 85763ed3b..498edae8a 100644 --- a/src/joystick/nds/SDL_sysjoystick.c +++ b/src/joystick/nds/SDL_sysjoystick.c @@ -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 @@ int 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 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick) * 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 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) 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 @@ void SDL_SYS_JoystickQuit(void) { } -#endif /* SDL_JOYSTICK_NDS */ +#endif /* SDL_JOYSTICK_NDS */ diff --git a/src/joystick/win32/SDL_dxjoystick.c b/src/joystick/win32/SDL_dxjoystick.c index 0392eb6c8..d799e420d 100644 --- a/src/joystick/win32/SDL_dxjoystick.c +++ b/src/joystick/win32/SDL_dxjoystick.c @@ -226,8 +226,8 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick) 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 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick) /* 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 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick) /* 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 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick) /* reset all accuators. */ result = - IDirectInputDevice2_SendForceFeedbackCommand(joystick->hwdata-> - InputDevice, + IDirectInputDevice2_SendForceFeedbackCommand(joystick-> + hwdata->InputDevice, DISFFC_RESET); if (FAILED(result)) { @@ -481,9 +481,8 @@ SDL_SYS_JoystickUpdate_Polled(SDL_Joystick * joystick) 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 @@ SDL_SYS_JoystickUpdate_Buffered(SDL_Joystick * joystick) 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 --git a/src/loadso/macosx/SDL_dlcompat.c b/src/loadso/macosx/SDL_dlcompat.c index 980c08af3..951061ab3 100644 --- a/src/loadso/macosx/SDL_dlcompat.c +++ b/src/loadso/macosx/SDL_dlcompat.c @@ -616,8 +616,8 @@ search_linked_libs(const struct mach_header *mh, const char *symbol) || (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 @@ dlsym_auto_underscore(void *handle, const char *symbol) return answer; } + static void * dlsym_auto_underscore_intern(void *handle, const char *symbol) { diff --git a/src/stdlib/SDL_stdlib.c b/src/stdlib/SDL_stdlib.c index de17663af..7aacad88d 100644 --- a/src/stdlib/SDL_stdlib.c +++ b/src/stdlib/SDL_stdlib.c @@ -135,6 +135,7 @@ _allmul() } /* *INDENT-ON* */ } + void __declspec(naked) _alldiv() @@ -222,6 +223,7 @@ _alldiv() } /* *INDENT-ON* */ } + void __declspec(naked) _aulldiv() @@ -279,6 +281,7 @@ _aulldiv() } /* *INDENT-ON* */ } + void __declspec(naked) _allrem() @@ -365,6 +368,7 @@ _allrem() } /* *INDENT-ON* */ } + void __declspec(naked) _aullrem() @@ -423,6 +427,7 @@ _aullrem() } /* *INDENT-ON* */ } + void __declspec(naked) _alldvrm() @@ -532,6 +537,7 @@ _alldvrm() } /* *INDENT-ON* */ } + void __declspec(naked) _aulldvrm() @@ -604,6 +610,7 @@ _aulldvrm() } /* *INDENT-ON* */ } + void __declspec(naked) _allshl() @@ -630,6 +637,7 @@ _allshl() } /* *INDENT-ON* */ } + void __declspec(naked) _aullshr() diff --git a/src/thread/irix/SDL_syssem.c b/src/thread/irix/SDL_syssem.c index d7992ed50..82f9ae7a7 100644 --- a/src/thread/irix/SDL_syssem.c +++ b/src/thread/irix/SDL_syssem.c @@ -55,9 +55,11 @@ union semun { 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 --git a/src/timer/nds/SDL_systimer.c b/src/timer/nds/SDL_systimer.c index 23775c5a0..54cd173f3 100644 --- a/src/timer/nds/SDL_systimer.c +++ b/src/timer/nds/SDL_systimer.c @@ -37,7 +37,7 @@ static Uint32 timer_ticks; void SDL_StartTicks(void) { - if(!timer_alive) { + if (!timer_alive) { SDL_SYS_TimerInit(); SDL_SYS_StartTimer(); } @@ -55,8 +55,9 @@ void 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 @@ RunTimer(void *unused) 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 --git a/src/video/SDL_blit_0.c b/src/video/SDL_blit_0.c index 0b04ee4b2..6c82ccfe9 100644 --- a/src/video/SDL_blit_0.c +++ b/src/video/SDL_blit_0.c @@ -80,6 +80,7 @@ BlitBto1(SDL_BlitInfo * info) } } } + static void BlitBto2(SDL_BlitInfo * info) { @@ -116,6 +117,7 @@ BlitBto2(SDL_BlitInfo * info) dst += dstskip; } } + static void BlitBto3(SDL_BlitInfo * info) { @@ -154,6 +156,7 @@ BlitBto3(SDL_BlitInfo * info) dst += dstskip; } } + static void BlitBto4(SDL_BlitInfo * info) { diff --git a/src/video/SDL_blit_1.c b/src/video/SDL_blit_1.c index 7319850ab..617693502 100644 --- a/src/video/SDL_blit_1.c +++ b/src/video/SDL_blit_1.c @@ -184,6 +184,7 @@ Blit1to2(SDL_BlitInfo * info) } #endif /* USE_DUFFS_LOOP */ } + static void Blit1to3(SDL_BlitInfo * info) { @@ -232,6 +233,7 @@ Blit1to3(SDL_BlitInfo * info) dst += dstskip; } } + static void Blit1to4(SDL_BlitInfo * info) { diff --git a/src/video/SDL_blit_A.c b/src/video/SDL_blit_A.c index e8d8c7155..1bba55d5b 100644 --- a/src/video/SDL_blit_A.c +++ b/src/video/SDL_blit_A.c @@ -283,8 +283,8 @@ BlitRGBtoRGBSurfaceAlphaMMX(SDL_BlitInfo * info) 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 @@ calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt) /* 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 --git a/src/video/SDL_blit_N.c b/src/video/SDL_blit_N.c index 38fba803e..8d21085af 100644 --- a/src/video/SDL_blit_N.c +++ b/src/video/SDL_blit_N.c @@ -141,8 +141,8 @@ calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt) /* 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 @@ static const Uint32 RGB565_ARGB8888_LUT[512] = { 0x00001ce6, 0xffff8100, 0x00001cee, 0xffffa100, 0x00001cf6, 0xffffc200, 0x00001cff, 0xffffe200 }; + static void Blit_RGB565_ARGB8888(SDL_BlitInfo * info) { @@ -1572,6 +1573,7 @@ static const Uint32 RGB565_ABGR8888_LUT[512] = { 0xffe61c00, 0x000081ff, 0xffee1c00, 0x0000a1ff, 0xfff61c00, 0x0000c2ff, 0xffff1c00, 0x0000e2ff }; + static void Blit_RGB565_ABGR8888(SDL_BlitInfo * info) { @@ -1709,6 +1711,7 @@ static const Uint32 RGB565_RGBA8888_LUT[512] = { 0x001ce6ff, 0xff810000, 0x001ceeff, 0xffa10000, 0x001cf6ff, 0xffc20000, 0x001cffff, 0xffe20000, }; + static void Blit_RGB565_RGBA8888(SDL_BlitInfo * info) { @@ -1846,6 +1849,7 @@ static const Uint32 RGB565_BGRA8888_LUT[512] = { 0xe61c0000, 0x0081ffff, 0xee1c0000, 0x00a1ffff, 0xf61c0000, 0x00c2ffff, 0xff1c0000, 0x00e2ffff }; + static void Blit_RGB565_BGRA8888(SDL_BlitInfo * info) { @@ -1930,6 +1934,7 @@ Blit_RGB888_index8_map(SDL_BlitInfo * info) } #endif /* USE_DUFFS_LOOP */ } + static void BlitNto1(SDL_BlitInfo * info) { @@ -2340,6 +2345,7 @@ static const struct blit_table normal_blit_1[] = { /* 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 @@ static const struct blit_table normal_blit_2[] = { /* 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 @@ static const struct blit_table normal_blit_4[] = { /* 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 --git a/src/video/SDL_gamma.c b/src/video/SDL_gamma.c index cd1dd1bc2..92bc5d2f7 100644 --- a/src/video/SDL_gamma.c +++ b/src/video/SDL_gamma.c @@ -70,6 +70,7 @@ CalculateGammaRamp(float gamma, Uint16 * ramp) } } } + static void CalculateGammaFromRamp(float *gamma, Uint16 * ramp) { diff --git a/src/video/SDL_pixels.c b/src/video/SDL_pixels.c index 3f922562c..550eddc17 100644 --- a/src/video/SDL_pixels.c +++ b/src/video/SDL_pixels.c @@ -752,6 +752,7 @@ SDL_InvalidateMap(SDL_BlitMap * map) map->info.table = NULL; } } + int SDL_MapSurface(SDL_Surface * src, SDL_Surface * dst) { diff --git a/src/video/SDL_renderer_sw.c b/src/video/SDL_renderer_sw.c index 2c4133078..a0aef99bf 100644 --- a/src/video/SDL_renderer_sw.c +++ b/src/video/SDL_renderer_sw.c @@ -388,8 +388,9 @@ SW_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture, 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 @@ SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, 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 @@ SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, 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 @@ SW_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a, 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 @@ SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, 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 --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index 3d7a68c70..6102ce680 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -409,9 +409,9 @@ SDL_GetSurfaceBlendMode(SDL_Surface * surface, int *blendMode) 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 --git a/src/video/ataricommon/SDL_atarigl.c b/src/video/ataricommon/SDL_atarigl.c index 03df3755b..2c4fd9482 100644 --- a/src/video/ataricommon/SDL_atarigl.c +++ b/src/video/ataricommon/SDL_atarigl.c @@ -349,9 +349,9 @@ SDL_AtariGL_MakeCurrent(_THIS) } 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 @@ InitNew(_THIS, SDL_Surface * current) 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 --git a/src/video/bwindow/SDL_sysvideo.cc b/src/video/bwindow/SDL_sysvideo.cc index 77970afbc..752d59883 100644 --- a/src/video/bwindow/SDL_sysvideo.cc +++ b/src/video/bwindow/SDL_sysvideo.cc @@ -670,8 +670,8 @@ extern "C" _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 --git a/src/video/dc/SDL_dcevents.c b/src/video/dc/SDL_dcevents.c index e39b538e5..20855fdf7 100644 --- a/src/video/dc/SDL_dcevents.c +++ b/src/video/dc/SDL_dcevents.c @@ -135,8 +135,7 @@ keyboard_update(void) 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 @@ keyboard_update(void) 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 --git a/src/video/dc/SDL_dcvideo.c b/src/video/dc/SDL_dcvideo.c index 7a4d4d993..bceb009af 100644 --- a/src/video/dc/SDL_dcvideo.c +++ b/src/video/dc/SDL_dcvideo.c @@ -158,6 +158,7 @@ DC_VideoInit(_THIS, SDL_PixelFormat * vformat) 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 @@ DC_AllocHWSurface(_THIS, SDL_Surface * surface) { return (-1); } + static void DC_FreeHWSurface(_THIS, SDL_Surface * surface) { diff --git a/src/video/directfb/SDL_DirectFB_events.c b/src/video/directfb/SDL_DirectFB_events.c index 94ab2d92b..33a9dac9e 100644 --- a/src/video/directfb/SDL_DirectFB_events.c +++ b/src/video/directfb/SDL_DirectFB_events.c @@ -311,33 +311,25 @@ DirectFB_PumpEvents(_THIS) 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 --git a/src/video/directfb/SDL_DirectFB_mouse.c b/src/video/directfb/SDL_DirectFB_mouse.c index 9d4586b1f..82e643e41 100644 --- a/src/video/directfb/SDL_DirectFB_mouse.c +++ b/src/video/directfb/SDL_DirectFB_mouse.c @@ -85,14 +85,15 @@ DirectFB_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) 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 @@ DirectFB_ShowCursor(SDL_Cursor * cursor) 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 @@ DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_WindowID windowID, int x, int y) 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 --git a/src/video/directfb/SDL_DirectFB_render.c b/src/video/directfb/SDL_DirectFB_render.c index 6512ccb05..60e9a5837 100644 --- a/src/video/directfb/SDL_DirectFB_render.c +++ b/src/video/directfb/SDL_DirectFB_render.c @@ -315,23 +315,22 @@ DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) 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 @@ DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) 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 @@ DirectFB_SetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture, 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 @@ DirectFB_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture, 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 @@ DirectFB_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, 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 @@ DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, 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 @@ DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, 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 @@ DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, 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 @@ DirectFB_RenderPresent(SDL_Renderer * renderer) 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 --git a/src/video/directfb/SDL_DirectFB_video.c b/src/video/directfb/SDL_DirectFB_video.c index c8b56a423..2a7386227 100644 --- a/src/video/directfb/SDL_DirectFB_video.c +++ b/src/video/directfb/SDL_DirectFB_video.c @@ -323,8 +323,8 @@ DirectFB_VideoInit(_THIS) 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 @@ DirectFB_VideoInit(_THIS) 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 @@ DirectFB_VideoInit(_THIS) /* 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 @@ DirectFB_VideoQuit(_THIS) 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 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode) 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 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode) 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 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window) 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 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window) 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 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window) 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 @@ DirectFB_SetWindowTitle(_THIS, SDL_Window * window) //return -1; } + static void DirectFB_SetWindowPosition(_THIS, SDL_Window * window) { @@ -805,6 +808,7 @@ DirectFB_SetWindowSize(_THIS, SDL_Window * window) 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 @@ DirectFB_HideWindow(_THIS, SDL_Window * window) windata->window->SetOpacity(windata->window, 0); } + static void DirectFB_RaiseWindow(_THIS, SDL_Window * window) { @@ -848,6 +853,7 @@ DirectFB_MaximizeWindow(_THIS, SDL_Window * window) SDL_Unsupported(); } + static void DirectFB_MinimizeWindow(_THIS, SDL_Window * window) { @@ -869,6 +875,7 @@ DirectFB_RestoreWindow(_THIS, SDL_Window * window) SDL_Unsupported(); } + static void DirectFB_SetWindowGrab(_THIS, SDL_Window * window) { @@ -1097,8 +1104,8 @@ DirectFB_GL_SwapWindow(_THIS, SDL_Window * window) 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 --git a/src/video/fbcon/SDL_fb3dfx.c b/src/video/fbcon/SDL_fb3dfx.c index a40cf2534..7a927050a 100644 --- a/src/video/fbcon/SDL_fb3dfx.c +++ b/src/video/fbcon/SDL_fb3dfx.c @@ -37,6 +37,7 @@ WaitVBL(_THIS) /* wait until we're past the start */ while ((tdfx_in32(TDFX_STATUS) & STATUS_RETRACE) == 0); } + static void WaitIdle(_THIS) { diff --git a/src/video/fbcon/SDL_fbevents.c b/src/video/fbcon/SDL_fbevents.c index 0549d9b1a..4e5551786 100644 --- a/src/video/fbcon/SDL_fbevents.c +++ b/src/video/fbcon/SDL_fbevents.c @@ -969,6 +969,7 @@ switch_vt_prep(_THIS) ioctl(keyboard_fd, KDSETMODE, KD_TEXT); ioctl(keyboard_fd, VT_UNLOCKSWITCH, 1); } + static void switch_vt_done(_THIS) { @@ -994,6 +995,7 @@ switch_vt_done(_THIS) (SDL_APPACTIVE | SDL_APPINPUTFOCUS | SDL_APPMOUSEFOCUS)); } + static void switch_vt(_THIS, unsigned short which) { diff --git a/src/video/fbcon/SDL_fbmatrox.c b/src/video/fbcon/SDL_fbmatrox.c index bcf774602..22cde3827 100644 --- a/src/video/fbcon/SDL_fbmatrox.c +++ b/src/video/fbcon/SDL_fbmatrox.c @@ -41,6 +41,7 @@ WaitVBL(_THIS) count = mga_in32(0x1E20) + 2; while (mga_in32(0x1E20) < count); } + static void WaitIdle(_THIS) { diff --git a/src/video/fbcon/SDL_fbriva.c b/src/video/fbcon/SDL_fbriva.c index 6c1044832..a1bcc0806 100644 --- a/src/video/fbcon/SDL_fbriva.c +++ b/src/video/fbcon/SDL_fbriva.c @@ -40,6 +40,7 @@ WaitVBL(_THIS) while ((*port & 0x08)); while (!(*port & 0x08)); } + static void NV3WaitIdle(_THIS) { @@ -47,6 +48,7 @@ NV3WaitIdle(_THIS) while ((Rop->FifoFree < FifoEmptyCount) || (*(mapped_io + PGRAPH_OFFSET + 0x000006B0) & 0x01)); } + static void NV4WaitIdle(_THIS) { diff --git a/src/video/fbcon/SDL_fbvideo.c b/src/video/fbcon/SDL_fbvideo.c index 521d9f4fc..738ced323 100644 --- a/src/video/fbcon/SDL_fbvideo.c +++ b/src/video/fbcon/SDL_fbvideo.c @@ -82,6 +82,7 @@ static const SDL_Rect checkres[] = { {0, 0, 320, 240}, {0, 0, 320, 200} }; + static const struct { int xres; @@ -822,6 +823,7 @@ print_vinfo(struct fb_var_screeninfo *vinfo) 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 @@ FB_InitHWSurfaces(_THIS, SDL_Surface * screen, char *base, int size) screen->hwdata = (struct private_hwdata *) &surfaces; return (0); } + static void FB_FreeHWSurfaces(_THIS) { @@ -1279,6 +1282,7 @@ FB_AllocHWSurface(_THIS, SDL_Surface * surface) surface->hwdata = (struct private_hwdata *) bucket; return (0); } + static void FB_FreeHWSurface(_THIS, SDL_Surface * surface) { @@ -1348,6 +1352,7 @@ FB_LockHWSurface(_THIS, SDL_Surface * surface) } return (0); } + static void FB_UnlockHWSurface(_THIS, SDL_Surface * surface) { diff --git a/src/video/gapi/SDL_gapivideo.c b/src/video/gapi/SDL_gapivideo.c index 40da2afef..58cf807fd 100644 --- a/src/video/gapi/SDL_gapivideo.c +++ b/src/video/gapi/SDL_gapivideo.c @@ -340,8 +340,7 @@ GAPI_CreateDevice(int devindex) 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 @@ GAPI_AllocHWSurface(_THIS, SDL_Surface * surface) { return (-1); } + static void GAPI_FreeHWSurface(_THIS, SDL_Surface * surface) { diff --git a/src/video/ipod/SDL_ipodvideo.c b/src/video/ipod/SDL_ipodvideo.c index 2442a36c0..90e9ad993 100644 --- a/src/video/ipod/SDL_ipodvideo.c +++ b/src/video/ipod/SDL_ipodvideo.c @@ -682,6 +682,7 @@ C_lcd_wait_write(void) } while (C_timer_check(start, 1000) == 0); } } + static void C_lcd_cmd_data(int cmd, int data) { @@ -776,11 +777,13 @@ iPod_UpdateRects(_THIS, int nrects, SDL_Rect * rects) ~(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 --git a/src/video/nds/SDL_ndsevents.c b/src/video/nds/SDL_ndsevents.c index ac43e8d4c..99ebf11c3 100644 --- a/src/video/nds/SDL_ndsevents.c +++ b/src/video/nds/SDL_ndsevents.c @@ -40,12 +40,12 @@ NDS_PumpEvents(_THIS) { 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 --git a/src/video/nds/SDL_ndsrender.c b/src/video/nds/SDL_ndsrender.c index e35ac204c..9e5e2ba90 100644 --- a/src/video/nds/SDL_ndsrender.c +++ b/src/video/nds/SDL_ndsrender.c @@ -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 @@ NDS_OAM_RotateSprite(SpriteRotation *spriteRotation, u16 angle) } 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 @@ NDS_OAM_Init(tOAM *oam, int sub) } 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_ActivateRenderer(SDL_Renderer * renderer); 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); -static int NDS_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture); +static int NDS_SetTextureBlendMode(SDL_Renderer * renderer, + 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 @@ NDS_CreateRenderer(SDL_Window * window, Uint32 flags) 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 @@ NDS_CreateRenderer(SDL_Window * window, Uint32 flags) 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_CreateRenderer(SDL_Window * window, Uint32 flags) NDS_OAM_Init(&(data->oam_copy), data->sub); /* init sprites. */ - TRACE("-NDS_CreateRenderer\n"); return renderer; } @@ -288,7 +281,7 @@ static int NDS_ActivateRenderer(SDL_Renderer * renderer) { NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; - TRACE("!NDS_ActivateRenderer\n"); + return 0; } @@ -296,7 +289,7 @@ static int NDS_DisplayModeChanged(SDL_Renderer * renderer) { NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; - TRACE("!NDS_DisplayModeChanged\n"); + return 0; } @@ -309,7 +302,6 @@ NDS_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) 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 @@ NDS_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) /* 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 @@ NDS_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) /* 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 @@ NDS_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) /* 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 @@ NDS_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) 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 @@ NDS_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) SDL_SetError("Texture too big for NDS hardware."); } - TRACE("-NDS_CreateTexture\n"); if (!texture->driverdata) { return -1; } @@ -444,35 +440,33 @@ NDS_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) 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 @@ NDS_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, } } - 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 @@ NDS_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, 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 @@ NDS_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, 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 @@ NDS_RenderPresent(SDL_Renderer * renderer) 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 @@ NDS_DestroyRenderer(SDL_Renderer * renderer) 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 @@ NDS_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture) static int NDS_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture) { - TRACE("!NDS_SetTextureAlphaMod\n"); /* stub! */ return 0; } @@ -679,7 +646,6 @@ NDS_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture) static int NDS_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture) { - TRACE("!NDS_SetTextureBlendMode\n"); /* stub! */ return 0; } @@ -687,7 +653,6 @@ NDS_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture) 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 --git a/src/video/nds/SDL_ndsvideo.c b/src/video/nds/SDL_ndsvideo.c index 8d67911e4..a09267a95 100644 --- a/src/video/nds/SDL_ndsvideo.c +++ b/src/video/nds/SDL_ndsvideo.c @@ -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 void NDS_VideoQuit(_THIS); 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 @@ static SDL_VideoDevice * 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 @@ NDS_CreateDevice(int devindex) device->free = NDS_DeleteDevice; - TRACE("-NDS_CreateDevice\n"); return device; } @@ -115,7 +103,6 @@ NDS_VideoInit(_THIS) SDL_DisplayMode mode; int i; - TRACE("+NDS_VideoInit\n"); /* simple 256x192x16x60 for now */ mode.w = 256; mode.h = 192; @@ -125,62 +112,49 @@ NDS_VideoInit(_THIS) 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 @@ NDS_VideoQuit(_THIS) vramSetBankG(VRAM_G_LCD); vramSetBankH(VRAM_H_LCD); vramSetBankI(VRAM_I_LCD); - TRACE("-NDS_VideoQuit\n"); } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/os2fslib/SDL_os2fslib.c b/src/video/os2fslib/SDL_os2fslib.c index ab5d3d58b..732663839 100644 --- a/src/video/os2fslib/SDL_os2fslib.c +++ b/src/video/os2fslib/SDL_os2fslib.c @@ -440,8 +440,8 @@ WndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 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 @@ WndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { 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 @@ WndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 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 @@ WndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 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 @@ WndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 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 @@ WndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 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 @@ WndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) &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 @@ WndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) &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 @@ WndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) &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 @@ WndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) &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 @@ memnot(Uint8 * dst, Uint8 * src, int len) while (len-- > 0) *dst++ = ~*src++; } + static void memxor(Uint8 * dst, Uint8 * src1, Uint8 * src2, int len) { @@ -1635,6 +1631,7 @@ os2fslib_AllocHWSurface(_THIS, SDL_Surface * surface) { return (-1); } + static void os2fslib_FreeHWSurface(_THIS, SDL_Surface * surface) { @@ -2505,23 +2502,22 @@ os2fslib_SetVideoMode(_THIS, SDL_Surface * current, 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 @@ os2fslib_SetVideoMode(_THIS, SDL_Surface * current, // 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 @@ os2fslib_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags) 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 @@ os2fslib_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags) // 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 @@ os2fslib_VideoInit(_THIS, SDL_PixelFormat * vformat) 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 @@ os2fslib_VideoInit(_THIS, SDL_PixelFormat * vformat) 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 --git a/src/video/photon/SDL_ph_gl.c b/src/video/photon/SDL_ph_gl.c index 09c0495c1..f2cb3978c 100644 --- a/src/video/photon/SDL_ph_gl.c +++ b/src/video/photon/SDL_ph_gl.c @@ -315,14 +315,17 @@ ph_SetupOpenGLContext(_THIS, int width, int height, int bpp, Uint32 flags) && (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 --git a/src/video/photon/SDL_ph_image.c b/src/video/photon/SDL_ph_image.c index 12bcc2a1c..211170d21 100644 --- a/src/video/photon/SDL_ph_image.c +++ b/src/video/photon/SDL_ph_image.c @@ -244,9 +244,8 @@ ph_SetupFullScreenImage(_THIS, SDL_Surface * screen) } 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 --git a/src/video/photon/SDL_phyuv.c b/src/video/photon/SDL_phyuv.c index 32c7f612d..609a70cf1 100644 --- a/src/video/photon/SDL_phyuv.c +++ b/src/video/photon/SDL_phyuv.c @@ -149,8 +149,8 @@ ph_CreateYUVOverlay(_THIS, int width, int height, Uint32 format, &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 --git a/src/video/ps2gs/SDL_gsvideo.c b/src/video/ps2gs/SDL_gsvideo.c index cef67b120..12bd8c5d5 100644 --- a/src/video/ps2gs/SDL_gsvideo.c +++ b/src/video/ps2gs/SDL_gsvideo.c @@ -232,6 +232,7 @@ static unsigned long long tex_tags[] __attribute__ ((aligned(16))) = { 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 @@ GS_AllocHWSurface(_THIS, SDL_Surface * surface) { return (-1); } + static void GS_FreeHWSurface(_THIS, SDL_Surface * surface) { return; } + static int GS_LockHWSurface(_THIS, SDL_Surface * surface) { @@ -606,6 +609,7 @@ GS_LockHWSurface(_THIS, SDL_Surface * surface) } return (0); } + static void GS_UnlockHWSurface(_THIS, SDL_Surface * surface) { diff --git a/src/video/riscos/SDL_riscosvideo.c b/src/video/riscos/SDL_riscosvideo.c index cda29f07c..06d092e97 100644 --- a/src/video/riscos/SDL_riscosvideo.c +++ b/src/video/riscos/SDL_riscosvideo.c @@ -286,6 +286,7 @@ RISCOS_AllocHWSurface(_THIS, SDL_Surface * surface) { return (-1); } + static void RISCOS_FreeHWSurface(_THIS, SDL_Surface * surface) { diff --git a/src/video/svga/SDL_svgavideo.c b/src/video/svga/SDL_svgavideo.c index 93d664c6e..cb05b2d08 100644 --- a/src/video/svga/SDL_svgavideo.c +++ b/src/video/svga/SDL_svgavideo.c @@ -467,6 +467,7 @@ SVGA_AllocHWSurface(_THIS, SDL_Surface * surface) { return (-1); } + static void SVGA_FreeHWSurface(_THIS, SDL_Surface * surface) { @@ -480,6 +481,7 @@ SVGA_LockHWSurface(_THIS, SDL_Surface * surface) /* The waiting is done in SVGA_FlipHWSurface() */ return (0); } + static void SVGA_UnlockHWSurface(_THIS, SDL_Surface * surface) { diff --git a/src/video/vgl/SDL_vglvideo.c b/src/video/vgl/SDL_vglvideo.c index 3dee9f12e..1c3f81aac 100644 --- a/src/video/vgl/SDL_vglvideo.c +++ b/src/video/vgl/SDL_vglvideo.c @@ -409,6 +409,7 @@ VGL_AllocHWSurface(_THIS, SDL_Surface * surface) { return -1; } + static void VGL_FreeHWSurface(_THIS, SDL_Surface * surface) { @@ -424,6 +425,7 @@ VGL_LockHWSurface(_THIS, SDL_Surface * surface) } return 0; } + static void VGL_UnlockHWSurface(_THIS, SDL_Surface * surface) { diff --git a/src/video/win32/SDL_d3drender.c b/src/video/win32/SDL_d3drender.c index b17ad2542..503c80acb 100644 --- a/src/video/win32/SDL_d3drender.c +++ b/src/video/win32/SDL_d3drender.c @@ -596,8 +596,8 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, 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 @@ D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, } 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 --git a/src/video/win32/SDL_gdirender.c b/src/video/win32/SDL_gdirender.c index 90e5c5776..b32a90e48 100644 --- a/src/video/win32/SDL_gdirender.c +++ b/src/video/win32/SDL_gdirender.c @@ -620,9 +620,8 @@ GDI_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, 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 --git a/src/video/win32/SDL_win32keyboard.c b/src/video/win32/SDL_win32keyboard.c index b050d89bc..871e6a25f 100644 --- a/src/video/win32/SDL_win32keyboard.c +++ b/src/video/win32/SDL_win32keyboard.c @@ -41,6 +41,7 @@ BYTE alpha_scancodes[26] = { 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 --git a/src/video/win32/SDL_win32opengl.c b/src/video/win32/SDL_win32opengl.c index 66184e2ec..550316ad4 100644 --- a/src/video/win32/SDL_win32opengl.c +++ b/src/video/win32/SDL_win32opengl.c @@ -500,8 +500,7 @@ WIN_GL_SetupWindow(_THIS, SDL_Window * window) 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 --git a/src/video/wscons/SDL_wsconsvideo.c b/src/video/wscons/SDL_wsconsvideo.c index 3ca86e5ee..126ec6bbc 100644 --- a/src/video/wscons/SDL_wsconsvideo.c +++ b/src/video/wscons/SDL_wsconsvideo.c @@ -399,6 +399,7 @@ WSCONS_AllocHWSurface(_THIS, SDL_Surface * surface) { return -1; } + static void WSCONS_FreeHWSurface(_THIS, SDL_Surface * surface) { diff --git a/src/video/x11/SDL_x11opengl.c b/src/video/x11/SDL_x11opengl.c index 6e131e4ea..2d4dcc321 100644 --- a/src/video/x11/SDL_x11opengl.c +++ b/src/video/x11/SDL_x11opengl.c @@ -420,8 +420,8 @@ X11_GL_CreateContext(_THIS, SDL_Window * window) 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 --git a/src/video/xbios/SDL_xbiosmodes.c b/src/video/xbios/SDL_xbiosmodes.c index a2736d3d5..9fd491a14 100644 --- a/src/video/xbios/SDL_xbiosmodes.c +++ b/src/video/xbios/SDL_xbiosmodes.c @@ -277,8 +277,8 @@ SDL_XBIOS_InitModes(_THIS) 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_InitModes(_THIS) 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 --git a/test/nds-test-progs/general/source/main.c b/test/nds-test-progs/general/source/main.c index 4f02b8872..2bc5e3102 100755 --- a/test/nds-test-progs/general/source/main.c +++ b/test/nds-test-progs/general/source/main.c @@ -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; - 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"); + 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"); + + /*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; + } + return 0; + } - 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; -} diff --git a/test/nds-test-progs/sprite/source/testsprite.c b/test/nds-test-progs/sprite/source/testsprite.c index 9139721c3..4134de581 100755 --- a/test/nds-test-progs/sprite/source/testsprite.c +++ b/test/nds-test-progs/sprite/source/testsprite.c @@ -163,7 +163,8 @@ main(int argc, char *argv[]) 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 @@ main(int argc, char *argv[]) puts("* initialized SDL"); numsprites = NUM_SPRITES; - videoflags = SDL_SWSURFACE /*| SDL_ANYFORMAT*/; + videoflags = SDL_SWSURFACE /*| SDL_ANYFORMAT */ ; width = 256; height = 192; video_bpp = 15; diff --git a/test/nds-test-progs/sprite2/source/testsprite2.c b/test/nds-test-progs/sprite2/source/testsprite2.c index ae548b56f..1db283c78 100755 --- a/test/nds-test-progs/sprite2/source/testsprite2.c +++ b/test/nds-test-progs/sprite2/source/testsprite2.c @@ -81,9 +81,11 @@ LoadSprite(char *file) 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 @@ int LoadSprite2(const u8* ptr, int size) { 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 @@ main(int argc, char *argv[]) SDL_Event event; Uint32 then, now, frames; - consoleDemoInit(); puts("Hello world! Initializing FAT..."); + consoleDemoInit(); + puts("Hello world! Initializing FAT..."); fatInitDefault(); /* Initialize parameters */