Merge branch 'master' into next

This commit is contained in:
Alam Ed Arias 2016-02-25 18:33:29 -05:00
commit b3b5521e1b
12 changed files with 55 additions and 95 deletions

View file

@ -28,7 +28,7 @@ macro(add_framework fwname appname)
${CMAKE_OSX_SYSROOT}/Library
/System/Library
/Library
PATH_SUFFIXES Frameworks
ATH_SUFFIXES Frameworks
NO_DEFAULT_PATH)
if( ${FRAMEWORK_${fwname}} STREQUAL FRAMEWORK_${fwname}-NOTFOUND)
MESSAGE(ERROR ": Framework ${fwname} not found")

View file

@ -210,13 +210,6 @@ extern FILE *logstream;
// Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1".
#define MODVERSION 19
// some tests, enable or disable it if it run or not
#define SPLITSCREEN
// =========================================================================
// The maximum number of players, multiplayer/networking.
@ -352,11 +345,7 @@ void CONS_Debug(INT32 debugflags, const char *fmt, ...) FUNCDEBUG;
#include "m_swap.h"
// Things that used to be in dstrings.h
#define DEVMAPS "devmaps"
#define DEVDATA "devdata"
#define SAVEGAMENAME "srb2sav"
char savegamename[256];
// m_misc.h

View file

@ -45,9 +45,6 @@ typedef DWORD (WINAPI *p_timeGetTime) (void);
typedef UINT (WINAPI *p_timeEndPeriod) (UINT);
typedef HANDLE (WINAPI *p_OpenFileMappingA) (DWORD, BOOL, LPCSTR);
typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
typedef HANDLE (WINAPI *p_GetCurrentProcess) (VOID);
typedef BOOL (WINAPI *p_GetProcessAffinityMask) (HANDLE, PDWORD_PTR, PDWORD_PTR);
typedef BOOL (WINAPI *p_SetProcessAffinityMask) (HANDLE, DWORD_PTR);
#endif
#endif
#include <stdio.h>
@ -2779,7 +2776,6 @@ static const char *locateWad(void)
{
return returnWadPath;
}
#endif
// examine default dirs
@ -3070,52 +3066,6 @@ const CPUInfoFlags *I_CPUInfo(void)
#endif
}
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
static void CPUAffinity_OnChange(void);
static consvar_t cv_cpuaffinity = {"cpuaffinity", "-1", CV_SAVE | CV_CALL, NULL, CPUAffinity_OnChange, 0, NULL, NULL, 0, 0, NULL};
static p_GetCurrentProcess pfnGetCurrentProcess = NULL;
static p_GetProcessAffinityMask pfnGetProcessAffinityMask = NULL;
static p_SetProcessAffinityMask pfnSetProcessAffinityMask = NULL;
static inline VOID GetAffinityFuncs(VOID)
{
HMODULE h = GetModuleHandleA("kernel32.dll");
pfnGetCurrentProcess = (p_GetCurrentProcess)GetProcAddress(h, "GetCurrentProcess");
pfnGetProcessAffinityMask = (p_GetProcessAffinityMask)GetProcAddress(h, "GetProcessAffinityMask");
pfnSetProcessAffinityMask = (p_SetProcessAffinityMask)GetProcAddress(h, "SetProcessAffinityMask");
}
static void CPUAffinity_OnChange(void)
{
DWORD_PTR dwProcMask, dwSysMask;
HANDLE selfpid;
if (!pfnGetCurrentProcess || !pfnGetProcessAffinityMask || !pfnSetProcessAffinityMask)
return;
else
selfpid = pfnGetCurrentProcess();
pfnGetProcessAffinityMask(selfpid, &dwProcMask, &dwSysMask);
/* If resulting mask is zero, don't change anything and fall back to
* actual mask.
*/
if(dwSysMask & cv_cpuaffinity.value)
{
pfnSetProcessAffinityMask(selfpid, dwSysMask & cv_cpuaffinity.value);
CV_StealthSetValue(&cv_cpuaffinity, (INT32)(dwSysMask & cv_cpuaffinity.value));
}
else
CV_StealthSetValue(&cv_cpuaffinity, (INT32)dwProcMask);
}
#endif
void I_RegisterSysCommands(void)
{
#if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX)
GetAffinityFuncs();
CV_RegisterVar(&cv_cpuaffinity);
#endif
}
// note CPUAFFINITY code used to reside here
void I_RegisterSysCommands(void) {}
#endif

View file

@ -1701,22 +1701,12 @@ void I_StartupGraphics(void)
keyboard_started = true;
#if !defined(HAVE_TTF)
#ifdef _WIN32 // Initialize Audio as well, otherwise Win32's DirectX can not use audio
if (SDL_InitSubSystem(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0)
#else //SDL_OpenAudio will do SDL_InitSubSystem(SDL_INIT_AUDIO)
// Previously audio was init here for questionable reasons?
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
#endif
{
#ifdef _WIN32
if (SDL_WasInit(SDL_INIT_AUDIO)==0)
CONS_Printf(M_GetText("Couldn't initialize SDL's Audio System with Video System: %s\n"), SDL_GetError());
if (SDL_WasInit(SDL_INIT_VIDEO)==0)
#endif
{
CONS_Printf(M_GetText("Couldn't initialize SDL's Video System: %s\n"), SDL_GetError());
return;
}
}
#endif
{
char vd[100]; //stack space for video name

View file

@ -77,7 +77,16 @@ static INT32 current_track;
void I_StartupSound(void)
{
I_Assert(!sound_started);
sound_started = true;
// EE inits audio first so we're following along.
if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO)
CONS_Printf("SDL Audio already started\n");
else if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
{
CONS_Alert(CONS_ERROR, "Error initializing SDL Audio: %s\n", SDL_GetError());
// call to start audio failed -- we do not have it
return;
}
midimode = false;
music = NULL;
@ -86,19 +95,31 @@ void I_StartupSound(void)
#if SDL_MIXER_VERSION_ATLEAST(1,2,11)
Mix_Init(MIX_INIT_FLAC|MIX_INIT_MOD|MIX_INIT_MP3|MIX_INIT_OGG);
#endif
Mix_OpenAudio(44100, AUDIO_S16LSB, 2, 2048);
if (Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 2048) < 0)
{
CONS_Alert(CONS_ERROR, "Error starting SDL_Mixer: %s\n", Mix_GetError());
// call to start audio failed -- we do not have it
return;
}
sound_started = true;
Mix_AllocateChannels(256);
}
void I_ShutdownSound(void)
{
I_Assert(sound_started);
if (!sound_started)
return; // not an error condition
sound_started = false;
Mix_CloseAudio();
#if SDL_MIXER_VERSION_ATLEAST(1,2,11)
Mix_Quit();
#endif
SDL_QuitSubSystem(SDL_INIT_AUDIO);
#ifdef HAVE_LIBGME
if (gme)
gme_delete(gme);

View file

@ -1213,6 +1213,16 @@ void I_StartupSound(void)
// Configure sound device
CONS_Printf("I_StartupSound:\n");
// EE inits audio first so we're following along.
if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO)
CONS_Printf("SDL Audio already started\n");
else if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
{
CONS_Alert(CONS_ERROR, "Error initializing SDL Audio: %s\n", SDL_GetError());
// call to start audio failed -- we do not have it
return;
}
// Open the audio device
if (M_CheckParm ("-freq") && M_IsNextParm())
{

View file

@ -3656,7 +3656,7 @@ const CPUInfoFlags *I_CPUInfo(void)
}
static void CPUAffinity_OnChange(void);
static consvar_t cv_cpuaffinity = {"cpuaffinity", "1", CV_SAVE | CV_CALL, NULL, CPUAffinity_OnChange, 0, NULL, NULL, 0, 0, NULL};
static consvar_t cv_cpuaffinity = {"cpuaffinity", "-1", CV_CALL, NULL, CPUAffinity_OnChange, 0, NULL, NULL, 0, 0, NULL};
typedef HANDLE (WINAPI *p_GetCurrentProcess) (VOID);
static p_GetCurrentProcess pfnGetCurrentProcess = NULL;