Include windows.h in a single point in the source, so we can be consistent about the definition of UNICODE and have core utility functions for Windows that all modules can share.

I think this also fixes the bug relating to non-latin characters in filenames, since UNICODE wasn't defined in SDL_rwops.c

--HG--
rename : src/SDL_android.cpp => src/core/android/SDL_android.cpp
rename : src/SDL_android.h => src/core/android/SDL_android.h
This commit is contained in:
Sam Lantinga 2011-01-24 21:20:30 -08:00
parent 1775cf40fd
commit b4497865bd
37 changed files with 274 additions and 273 deletions

View file

@ -27,7 +27,7 @@
#include "../SDL_audio_c.h"
#include "SDL_androidaudio.h"
#include "../../SDL_android.h"
#include "../../core/android/SDL_android.h"
#include <android/log.h>

View file

@ -23,8 +23,7 @@
/* Allow access to a raw mixing buffer */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "../../core/windows/SDL_windows.h"
#include <mmsystem.h>
#include "SDL_timer.h"
@ -67,21 +66,14 @@ SetMMerror(char *function, MMRESULT code)
{
size_t len;
char errbuf[MAXERRORLENGTH];
#ifdef _WIN32_WCE
wchar_t werrbuf[MAXERRORLENGTH];
#endif
SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: ", function);
len = SDL_strlen(errbuf);
#ifdef _WIN32_WCE
/* UNICODE version */
waveOutGetErrorText(code, werrbuf, MAXERRORLENGTH - len);
WideCharToMultiByte(CP_ACP, 0, werrbuf, -1, errbuf + len,
MAXERRORLENGTH - len, NULL, NULL);
#else
waveOutGetErrorText(code, errbuf + len, (UINT) (MAXERRORLENGTH - len));
#endif
SDL_SetError("%s", errbuf);
}

View file

@ -24,6 +24,7 @@
/* Allow access to a raw mixing buffer */
#include "SDL_timer.h"
#include "SDL_loadso.h"
#include "SDL_audio.h"
#include "../SDL_audio_c.h"
#include "SDL_dx5audio.h"
@ -38,19 +39,19 @@
#endif
/* DirectX function pointers for audio */
static HINSTANCE DSoundDLL = NULL;
static void* DSoundDLL = NULL;
static HRESULT(WINAPI * DSoundCreate) (LPGUID, LPDIRECTSOUND *, LPUNKNOWN) =
NULL;
static void
DSOUND_Unload(void)
{
if (DSoundDLL != NULL) {
FreeLibrary(DSoundDLL);
}
DSoundCreate = NULL;
DSoundDLL = NULL;
if (DSoundDLL != NULL) {
SDL_UnloadObject(DSoundDLL);
DSoundDLL = NULL;
}
}
@ -61,17 +62,16 @@ DSOUND_Load(void)
DSOUND_Unload();
DSoundDLL = LoadLibrary(TEXT("DSOUND.DLL"));
DSoundDLL = SDL_LoadObject("DSOUND.DLL");
if (DSoundDLL == NULL) {
SDL_SetError("DirectSound: failed to load DSOUND.DLL");
} else {
/* Now make sure we have DirectX 5 or better... */
/* (DirectSoundCaptureCreate was added in DX5) */
if (!GetProcAddress(DSoundDLL, TEXT("DirectSoundCaptureCreate"))) {
if (!SDL_LoadFunction(DSoundDLL, "DirectSoundCaptureCreate")) {
SDL_SetError("DirectSound: System doesn't appear to have DX5.");
} else {
DSoundCreate = (void *) GetProcAddress(DSoundDLL,
TEXT("DirectSoundCreate"));
DSoundCreate = SDL_LoadFunction(DSoundDLL, "DirectSoundCreate");
}
if (!DSoundCreate) {

View file

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