It's now possible to build SDL without any C runtime at all on Windows,

using Visual C++ 2005

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401334
This commit is contained in:
Sam Lantinga 2006-02-06 08:28:51 +00:00
parent 5372bfd326
commit 6c3f928cd8
101 changed files with 8882 additions and 601 deletions

View file

@ -21,14 +21,12 @@
*/
/* Allow access to a raw mixing buffer */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "SDL.h"
#include "SDL_audio.h"
#include "SDL_timer.h"
#include "SDL_error.h"
#include "SDL_string.h"
#include "SDL_audio_c.h"
#include "SDL_audiomem.h"
#include "SDL_sysaudio.h"
@ -456,7 +454,12 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
D(bug("Locking semaphore..."));
SDL_mutexP(audio->mixer_lock);
#if (defined(_WIN32) && !defined(_WIN32_WCE)) && !defined(HAVE_LIBC)
#undef SDL_CreateThread
audio->thread = SDL_CreateThread(SDL_RunAudio, audio, NULL, NULL);
#else
audio->thread = SDL_CreateThread(SDL_RunAudio, audio);
#endif
D(bug("Created thread...\n"));
if ( audio->thread == NULL ) {
@ -516,7 +519,12 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
switch (audio->opened) {
case 1:
/* Start the audio thread */
#if (defined(_WIN32) && !defined(_WIN32_WCE)) && !defined(HAVE_LIBC)
#undef SDL_CreateThread
audio->thread = SDL_CreateThread(SDL_RunAudio, audio, NULL, NULL);
#else
audio->thread = SDL_CreateThread(SDL_RunAudio, audio);
#endif
if ( audio->thread == NULL ) {
SDL_CloseAudio();
SDL_SetError("Couldn't create audio thread");

View file

@ -22,8 +22,6 @@
/* Functions for audio drivers to perform runtime conversion of audio format */
#include <stdio.h>
#include "SDL_error.h"
#include "SDL_audio.h"

View file

@ -24,7 +24,6 @@
(necessary because SDL audio emulates threads with fork()
*/
#include <stdlib.h>
#ifdef FORK_HACK
#include <sys/types.h>
#include <sys/ipc.h>
@ -33,6 +32,7 @@
#endif
#include "SDL_audiomem.h"
#include "SDL_stdlib.h"
/* Allocate memory that will be shared between threads (freed on exit) */
void *SDL_AllocAudioMem(int size)

View file

@ -22,10 +22,6 @@
/* This provides the default mixing callback for the SDL audio routines */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SDL_audio.h"
#include "SDL_mutex.h"
#include "SDL_timer.h"

View file

@ -1,3 +1,6 @@
#include "SDL_mixer_MMX_VC.h"
#if defined(USE_ASM_MIXER_VC)
// MMX assembler version of SDL_MixAudio for signed little endian 16 bit samples and signed 8 bit samples
// Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr)
@ -12,11 +15,6 @@
// Mixing for 16 bit signed buffers
////////////////////////////////////////////////
#ifndef __WATCOMC__
#include <windows.h>
#include <stdio.h>
#endif
void SDL_MixAudio_MMX_S16_VC(char* dst,char* src,unsigned int nSize,int volume)
{
__asm

View file

@ -1,3 +1,6 @@
#ifdef _MSC_VER
#define USE_ASM_MIXER_VC
#endif
#if defined(USE_ASM_MIXER_VC)
// headers for MMX assembler version of SDL_MixAudio
// Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr)

View file

@ -24,17 +24,13 @@
/* Microsoft WAVE file loading routines */
#include <stdlib.h>
#include <string.h>
#include "SDL_error.h"
#include "SDL_audio.h"
#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_wave.h"
#include "SDL_endian.h"
#ifndef NELEMS
#define NELEMS(array) ((sizeof array)/(sizeof array[0]))
#endif
static int ReadChunk(SDL_RWops *src, Chunk *chunk);
@ -342,9 +338,9 @@ static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
/* Check to make sure we have enough variables in the state array */
channels = IMA_ADPCM_state.wavefmt.channels;
if ( channels > NELEMS(IMA_ADPCM_state.state) ) {
if ( channels > SDL_arraysize(IMA_ADPCM_state.state) ) {
SDL_SetError("IMA ADPCM decoder can only handle %d channels",
NELEMS(IMA_ADPCM_state.state));
SDL_arraysize(IMA_ADPCM_state.state));
return(-1);
}
state = IMA_ADPCM_state.state;
@ -564,7 +560,7 @@ done:
}
else {
// seek to the end of the file (given by the RIFF chunk)
SDL_RWseek(src, wavelen - chunk.length - headerDiff, SEEK_CUR);
SDL_RWseek(src, wavelen - chunk.length - headerDiff, RW_SEEK_CUR);
}
if ( was_error ) {
spec = NULL;

View file

@ -22,14 +22,14 @@
/* Allow access to a raw mixing buffer */
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include "SDL_windows.h"
#include <mmsystem.h>
#include "SDL_audio.h"
#include "SDL_mutex.h"
#include "SDL_timer.h"
#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_audio_c.h"
#include "SDL_dibaudio.h"
#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
@ -125,7 +125,7 @@ static void SetMMerror(char *function, MMRESULT code)
wchar_t werrbuf[MAXERRORLENGTH];
#endif
sprintf(errbuf, "%s: ", function);
snprintf(errbuf, SDL_arraysize(errbuf), "%s: ", function);
len = strlen(errbuf);
#ifdef _WIN32_WCE

View file

@ -22,12 +22,12 @@
/* Allow access to a raw mixing buffer */
#include <stdio.h>
#include "SDL_types.h"
#include "SDL_error.h"
#include "SDL_timer.h"
#include "SDL_audio.h"
#include "SDL_stdlib.h"
#include "SDL_string.h"
#include "SDL_audio_c.h"
#include "SDL_dx5audio.h"
@ -223,12 +223,13 @@ static void SetDSerror(const char *function, int code)
error = "Function not supported";
break;
default:
sprintf(errbuf, "%s: Unknown DirectSound error: 0x%x",
snprintf(errbuf, SDL_arraysize(errbuf),
"%s: Unknown DirectSound error: 0x%x",
function, code);
break;
}
if ( ! errbuf[0] ) {
sprintf(errbuf, "%s: %s", function, error);
snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function, error);
}
SDL_SetError("%s", errbuf);
return;

View file

@ -4,7 +4,7 @@
/* Include all of the DirectX 5.0 headers and adds any necessary tweaks */
#include <windows.h>
#include "SDL_windows.h"
#include <mmsystem.h>
#ifndef WIN32
#define WIN32