- make OpenAL and the decoder libraries delay loaded so that ZDoom can still start without them being present.

This required the addition of a few exception handlers so to avoid #ifdef overuse I also added some #defines for non-Windows systems that allow using __try and __except directly in the code without #ifdef'ing them out.
This commit is contained in:
Christoph Oelckers 2015-04-25 12:25:10 +02:00
commit d880783784
8 changed files with 151 additions and 89 deletions

View file

@ -1,3 +1,10 @@
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define USE_WINDOWS_DWORD
#endif
#include "except.h"
#include "mpg123_decoder.h"
#include "files.h"
@ -49,9 +56,17 @@ bool MPG123Decoder::open(FileReader *reader)
{
if(!inited)
{
if(mpg123_init() != MPG123_OK)
return false;
inited = true;
__try
{
if(mpg123_init() != MPG123_OK)
return false;
inited = true;
}
__except (CheckException(GetExceptionCode()))
{
// this means that the delay loaded decoder DLL was not found.
return false;
}
}
Reader = reader;