| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580 |
- /*
- * WARNING: this is an autogenerated file and will be overwritten by
- * the extension interface script.
- */
- #include "s3eExt.h"
- #include "IwDebug.h"
- #include "s3eDevice.h"
- #include "openalext.h"
- #ifndef S3E_EXT_SKIP_LOADER_CALL_LOCK
- // For MIPs (and WP8) platform we do not have asm code for stack switching
- // implemented. So we make LoaderCallStart call manually to set GlobalLock
- #if defined __mips || defined S3E_ANDROID_X86 || (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP))
- #define LOADER_CALL_LOCK
- #endif
- #endif
- /**
- * Definitions for functions types passed to/from s3eExt interface
- */
- typedef unsigned int(*_alGetError_t)();
- typedef void(*_alSourceQueueBuffers_t)(_ALuint sid, _ALsizei numEntries, const _ALuint* bids);
- typedef void(*_alSourceUnqueueBuffers_t)(_ALuint sid, _ALsizei numEntries, _ALuint* bids);
- typedef void(*_alGetSourcei_t)(_ALuint sid, _ALenum param, _ALint* value);
- typedef void(*_alGetSourcef_t)(_ALuint sid, _ALenum param, _ALfloat* value);
- typedef void(*_alSourcef_t)(_ALuint sid, _ALenum param, _ALfloat value);
- typedef void(*_alSourcei_t)(_ALuint sid, _ALenum param, _ALint value);
- typedef void(*_alSourcePlay_t)(_ALuint sid);
- typedef void(*_alSourceStop_t)(_ALuint sid);
- typedef void(*_alSourcePause_t)(_ALuint sid);
- typedef void(*_alGenSources_t)(_ALsizei n, _ALuint* sources);
- typedef void(*_alDeleteSources_t)(_ALsizei n, const _ALuint* sources);
- typedef void(*_alGenBuffers_t)(_ALsizei n, _ALuint* buffers);
- typedef void(*_alDeleteBuffers_t)(_ALsizei n, const _ALuint* buffers);
- typedef void(*_alBufferData_t)(_ALuint bid, _ALenum format, const _ALvoid* data, _ALsizei size, _ALsizei freq);
- typedef _ALCdevice*(*_alcOpenDevice_t)(const char* devicename);
- typedef void(*_alcCloseDevice_t)(_ALCdevice* device);
- typedef _ALCcontext *(*_alcCreateContext_t)(_ALCdevice* device, const _ALCint* attrlist);
- typedef _ALCboolean(*_alcMakeContextCurrent_t)(_ALCcontext* context);
- typedef void(*_alcProcessContext_t)(_ALCcontext* context);
- typedef void(*_alcSuspendContext_t)(_ALCcontext* context);
- typedef void(*_alcDestroyContext_t)(_ALCcontext* context);
- typedef _ALCcontext *(*_alcGetCurrentContext_t)();
- /**
- * struct that gets filled in by openalextRegister
- */
- typedef struct openalextFuncs
- {
- _alGetError_t m__alGetError;
- _alSourceQueueBuffers_t m__alSourceQueueBuffers;
- _alSourceUnqueueBuffers_t m__alSourceUnqueueBuffers;
- _alGetSourcei_t m__alGetSourcei;
- _alGetSourcef_t m__alGetSourcef;
- _alSourcef_t m__alSourcef;
- _alSourcei_t m__alSourcei;
- _alSourcePlay_t m__alSourcePlay;
- _alSourceStop_t m__alSourceStop;
- _alSourcePause_t m__alSourcePause;
- _alGenSources_t m__alGenSources;
- _alDeleteSources_t m__alDeleteSources;
- _alGenBuffers_t m__alGenBuffers;
- _alDeleteBuffers_t m__alDeleteBuffers;
- _alBufferData_t m__alBufferData;
- _alcOpenDevice_t m__alcOpenDevice;
- _alcCloseDevice_t m__alcCloseDevice;
- _alcCreateContext_t m__alcCreateContext;
- _alcMakeContextCurrent_t m__alcMakeContextCurrent;
- _alcProcessContext_t m__alcProcessContext;
- _alcSuspendContext_t m__alcSuspendContext;
- _alcDestroyContext_t m__alcDestroyContext;
- _alcGetCurrentContext_t m__alcGetCurrentContext;
- } openalextFuncs;
- static openalextFuncs g_Ext;
- static bool g_GotExt = false;
- static bool g_TriedExt = false;
- static bool g_TriedNoMsgExt = false;
- static bool _extLoad()
- {
- if (!g_GotExt && !g_TriedExt)
- {
- s3eResult res = s3eExtGetHash(0x37485935, &g_Ext, sizeof(g_Ext));
- if (res == S3E_RESULT_SUCCESS)
- g_GotExt = true;
- else
- s3eDebugAssertShow(S3E_MESSAGE_CONTINUE_STOP_IGNORE, "error loading extension: openalext");
- g_TriedExt = true;
- g_TriedNoMsgExt = true;
- }
- return g_GotExt;
- }
- static bool _extLoadNoMsg()
- {
- if (!g_GotExt && !g_TriedNoMsgExt)
- {
- s3eResult res = s3eExtGetHash(0x37485935, &g_Ext, sizeof(g_Ext));
- if (res == S3E_RESULT_SUCCESS)
- g_GotExt = true;
- g_TriedNoMsgExt = true;
- if (g_TriedExt)
- g_TriedExt = true;
- }
- return g_GotExt;
- }
- s3eBool openalextAvailable()
- {
- _extLoadNoMsg();
- return g_GotExt ? S3E_TRUE : S3E_FALSE;
- }
- unsigned int _alGetError()
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[0] func: _alGetError"));
- if (!_extLoad())
- return 0;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- unsigned int ret = g_Ext.m__alGetError();
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return ret;
- }
- void _alSourceQueueBuffers(_ALuint sid, _ALsizei numEntries, const _ALuint* bids)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[1] func: _alSourceQueueBuffers"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alSourceQueueBuffers(sid, numEntries, bids);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- void _alSourceUnqueueBuffers(_ALuint sid, _ALsizei numEntries, _ALuint* bids)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[2] func: _alSourceUnqueueBuffers"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alSourceUnqueueBuffers(sid, numEntries, bids);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- void _alGetSourcei(_ALuint sid, _ALenum param, _ALint* value)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[3] func: _alGetSourcei"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alGetSourcei(sid, param, value);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- void _alGetSourcef(_ALuint sid, _ALenum param, _ALfloat* value)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[4] func: _alGetSourcef"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alGetSourcef(sid, param, value);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- void _alSourcef(_ALuint sid, _ALenum param, _ALfloat value)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[5] func: _alSourcef"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alSourcef(sid, param, value);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- void _alSourcei(_ALuint sid, _ALenum param, _ALint value)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[6] func: _alSourcei"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alSourcei(sid, param, value);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- void _alSourcePlay(_ALuint sid)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[7] func: _alSourcePlay"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alSourcePlay(sid);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- void _alSourceStop(_ALuint sid)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[8] func: _alSourceStop"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alSourceStop(sid);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- void _alSourcePause(_ALuint sid)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[9] func: _alSourcePause"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alSourcePause(sid);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- void _alGenSources(_ALsizei n, _ALuint* sources)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[10] func: _alGenSources"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alGenSources(n, sources);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- void _alDeleteSources(_ALsizei n, const _ALuint* sources)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[11] func: _alDeleteSources"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alDeleteSources(n, sources);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- void _alGenBuffers(_ALsizei n, _ALuint* buffers)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[12] func: _alGenBuffers"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alGenBuffers(n, buffers);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- void _alDeleteBuffers(_ALsizei n, const _ALuint* buffers)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[13] func: _alDeleteBuffers"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alDeleteBuffers(n, buffers);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- void _alBufferData(_ALuint bid, _ALenum format, const _ALvoid* data, _ALsizei size, _ALsizei freq)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[14] func: _alBufferData"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alBufferData(bid, format, data, size, freq);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- _ALCdevice* _alcOpenDevice(const char* devicename)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[15] func: _alcOpenDevice"));
- if (!_extLoad())
- return 0;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- _ALCdevice* ret = g_Ext.m__alcOpenDevice(devicename);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return ret;
- }
- void _alcCloseDevice(_ALCdevice* device)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[16] func: _alcCloseDevice"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alcCloseDevice(device);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- _ALCcontext * _alcCreateContext(_ALCdevice* device, const _ALCint* attrlist)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[17] func: _alcCreateContext"));
- if (!_extLoad())
- return 0;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- _ALCcontext * ret = g_Ext.m__alcCreateContext(device, attrlist);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return ret;
- }
- _ALCboolean _alcMakeContextCurrent(_ALCcontext* context)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[18] func: _alcMakeContextCurrent"));
- if (!_extLoad())
- return 0;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- _ALCboolean ret = g_Ext.m__alcMakeContextCurrent(context);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return ret;
- }
- void _alcProcessContext(_ALCcontext* context)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[19] func: _alcProcessContext"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alcProcessContext(context);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- void _alcSuspendContext(_ALCcontext* context)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[20] func: _alcSuspendContext"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alcSuspendContext(context);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- void _alcDestroyContext(_ALCcontext* context)
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[21] func: _alcDestroyContext"));
- if (!_extLoad())
- return;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- g_Ext.m__alcDestroyContext(context);
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return;
- }
- _ALCcontext * _alcGetCurrentContext()
- {
- IwTrace(OPENALEXT_VERBOSE, ("calling openalext[22] func: _alcGetCurrentContext"));
- if (!_extLoad())
- return 0;
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallStart(S3E_TRUE, NULL);
- #endif
- _ALCcontext * ret = g_Ext.m__alcGetCurrentContext();
- #ifdef LOADER_CALL_LOCK
- s3eDeviceLoaderCallDone(S3E_TRUE, NULL);
- #endif
- return ret;
- }
|