This commit is contained in:
Christoph Oelckers 2015-04-27 08:58:06 +02:00
commit aedd8f89cb
4 changed files with 26 additions and 31 deletions

View file

@ -639,11 +639,11 @@ SoundDecoder *SoundRenderer::CreateDecoder(FileReader *reader)
TArray<char> SoundDecoder::readAll()
{
TArray<char> output;
size_t total = 0;
size_t got;
unsigned total = 0;
unsigned got;
output.Resize(total+32768);
while((got=read(&output[total], output.Size()-total)) > 0)
while((got=(unsigned)read(&output[total], output.Size()-total)) > 0)
{
total += got;
output.Resize(total*2);

View file

@ -1601,19 +1601,19 @@ unsigned int I_MakeRNGSeed()
FString I_GetLongPathName(FString shortpath)
{
static TOptWin32Proc<DWORD (WINAPI*)(LPCTSTR, LPTSTR, DWORD)>
GetLongPathName("kernel32.dll", "GetLongPathNameA", NULL);
GetLongPathNameA("kernel32.dll", "GetLongPathNameA");
// Doesn't exist on NT4
if (GetLongPathName == NULL)
return shortpath;
DWORD buffsize = GetLongPathName.Call(shortpath.GetChars(), NULL, 0);
DWORD buffsize = GetLongPathNameA.Call(shortpath.GetChars(), NULL, 0);
if (buffsize == 0)
{ // nothing to change (it doesn't exist, maybe?)
return shortpath;
}
TCHAR *buff = new TCHAR[buffsize];
DWORD buffsize2 = GetLongPathName.Call(shortpath.GetChars(), buff, buffsize);
DWORD buffsize2 = GetLongPathNameA.Call(shortpath.GetChars(), buff, buffsize);
if (buffsize2 >= buffsize)
{ // Failure! Just return the short path
delete[] buff;

View file

@ -56,25 +56,20 @@ extern os_t OSPlatform;
template<typename Proto>
class TOptWin32Proc
{
static Proto GetOptionalWin32Proc(const char* module, const char* function, const char* alt)
static Proto GetOptionalWin32Proc(const char* module, const char* function)
{
HMODULE hmodule = GetModuleHandle(module);
if (hmodule == NULL)
return NULL;
Proto ret = (Proto)GetProcAddress(hmodule, function);
if(ret != NULL || alt == NULL)
return ret;
// Lookup alternate function name (ex. ProcW -> ProcA)
return (Proto)GetProcAddress(hmodule, alt);
return (Proto)GetProcAddress(hmodule, function);
}
public:
const Proto Call;
TOptWin32Proc(const char* module, const char* function, const char* alt=NULL)
: Call(GetOptionalWin32Proc(module, function, alt)) {}
TOptWin32Proc(const char* module, const char* function)
: Call(GetOptionalWin32Proc(module, function)) {}
// Wrapper object can be tested against NULL, but not directly called.
operator const void*() const { return Call; }

View file

@ -57,7 +57,7 @@
OmitFramePointers="true"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="src\win32;src\sound;src;zlib;src\g_shared;src\g_doom;src\g_raven;src\g_heretic;src\g_hexen;src\g_strife;&quot;jpeg-6b&quot;;&quot;game-music-emu&quot;;gdtoa;bzip2;lzma\C"
PreprocessorDefinitions="NDEBUG,WIN32,_WIN32,_WINDOWS,HAVE_STRUPR,HAVE_FILELENGTH;NO_VA_COPY,BACKPATCH,HAVE_FLUIDSYNTH,DYN_FLUIDSYNTH"
PreprocessorDefinitions="NDEBUG,WIN32,_WIN32,_WINDOWS,HAVE_STRUPR,HAVE_FILELENGTH;NO_VA_COPY,BACKPATCH,HAVE_FLUIDSYNTH,DYN_FLUIDSYNTH,NO_OPENAL"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@ -180,7 +180,7 @@
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="src\win32;src\sound;src;zlib;src\g_shared;src\g_doom;src\g_raven;src\g_heretic;src\g_hexen;src\g_strife;&quot;jpeg-6b&quot;;game-music-emu;gdtoa;bzip2;lzma\C"
PreprocessorDefinitions="NDEBUG,WIN32,_WIN32,_WINDOWS,HAVE_STRUPR,HAVE_FILELENGTH;NO_VA_COPY"
PreprocessorDefinitions="NDEBUG,WIN32,_WIN32,_WINDOWS,HAVE_STRUPR,HAVE_FILELENGTH;NO_VA_COPY,NO_OPENAL"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="false"
@ -290,7 +290,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="src\win32;src\sound;src;zlib;src\g_shared;src\g_doom;src\g_raven;src\g_heretic;src\g_hexen;src\g_strife;&quot;jpeg-6b&quot;;&quot;game-music-emu&quot;;gdtoa;bzip2;lzma\C"
PreprocessorDefinitions="WIN32,_DEBUG,_WIN32,_WINDOWS,_CRTDBG_MAP_ALLOC,HAVE_STRUPR,HAVE_FILELENGTH;NO_VA_COPY,BACKPATCH,HAVE_FLUIDSYNTH,DYN_FLUIDSYNTH"
PreprocessorDefinitions="WIN32,_DEBUG,_WIN32,_WINDOWS,_CRTDBG_MAP_ALLOC,HAVE_STRUPR,HAVE_FILELENGTH;NO_VA_COPY,BACKPATCH,HAVE_FLUIDSYNTH,DYN_FLUIDSYNTH,NO_OPENAL"
MinimalRebuild="true"
RuntimeLibrary="1"
EnableFunctionLevelLinking="true"
@ -398,7 +398,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="src\win32;src\sound;src;zlib;src\g_shared;src\g_doom;src\g_raven;src\g_heretic;src\g_hexen;src\g_strife;&quot;jpeg-6b&quot;;game-music-emu;gdtoa;bzip2;lzma\C"
PreprocessorDefinitions="WIN32,_DEBUG,_WIN32,_WINDOWS,_CRTDBG_MAP_ALLOC,HAVE_STRUPR,HAVE_FILELENGTH;NO_VA_COPY"
PreprocessorDefinitions="WIN32,_DEBUG,_WIN32,_WINDOWS,_CRTDBG_MAP_ALLOC,HAVE_STRUPR,HAVE_FILELENGTH;NO_VA_COPY,NO_OPENAL"
MinimalRebuild="true"
RuntimeLibrary="1"
EnableFunctionLevelLinking="true"
@ -2481,6 +2481,10 @@
<Filter
Name="Audio Files"
>
<File
RelativePath=".\src\sound\efx.h"
>
</File>
<File
RelativePath=".\src\sound\fmod_wrap.h"
>
@ -2493,18 +2497,6 @@
RelativePath=".\src\sound\fmodsound.h"
>
</File>
<File
RelativePath=".\src\sound\oalsound.cpp"
>
</File>
<File
RelativePath=".\src\sound\oalsound.h"
>
</File>
<File
RelativePath=".\src\sound\efx.h"
>
</File>
<File
RelativePath="src\sound\i_music.cpp"
>
@ -2605,6 +2597,14 @@
RelativePath=".\src\sound\music_xmi_midiout.cpp"
>
</File>
<File
RelativePath=".\src\sound\oalsound.cpp"
>
</File>
<File
RelativePath=".\src\sound\oalsound.h"
>
</File>
<Filter
Name="OPL Synth"
>