mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 07:55:45 -04:00
Initial community commit
This commit is contained in:
559
Src/Plugins/Input/in_wv/wasabi/bfc/dispatch.h
Normal file
559
Src/Plugins/Input/in_wv/wasabi/bfc/dispatch.h
Normal file
@ -0,0 +1,559 @@
|
||||
#pragma once
|
||||
//#include <bfc/platform/platform.h>
|
||||
#include "platform/types.h"
|
||||
#include "platform/guid.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef NOVTABLE
|
||||
#define NOVTABLE __declspec(novtable)
|
||||
#endif
|
||||
#else
|
||||
#define NOVTABLE
|
||||
#endif
|
||||
class DispatchableCallback;
|
||||
|
||||
#pragma warning(disable: 4786)
|
||||
#pragma warning(disable: 4275)
|
||||
#pragma warning(disable: 4100)
|
||||
|
||||
enum
|
||||
{
|
||||
DISPATCH_SUCCESS=0,
|
||||
DISPATCH_FAILURE=1,
|
||||
};
|
||||
|
||||
// TODO: define this to stdcall for linux, win64, mac
|
||||
#define WASABICALL
|
||||
|
||||
class NOVTABLE Dispatchable {
|
||||
public:
|
||||
// // fake virtual destructor
|
||||
// void destruct() { _voidcall(DESTRUCT); }
|
||||
|
||||
// this is virtual so it is visible across modules
|
||||
virtual int WASABICALL _dispatch(int msg, void *retval, void **params=0, int nparam=0)=0;
|
||||
|
||||
|
||||
/* added 22 May 2007. these aren't used yet. To be used in the future
|
||||
in the meantime, don't use negative numbers for your msg values */
|
||||
size_t AddRef();
|
||||
size_t Release();
|
||||
int QueryInterface(GUID interface_guid, void **object);
|
||||
enum
|
||||
{
|
||||
ADDREF=-1,
|
||||
RELEASE=-2,
|
||||
QUERYINTERFACE=-3,
|
||||
};
|
||||
protected:
|
||||
// // protected real destructor
|
||||
// ~Dispatchable() {}
|
||||
// helper templates to implement client-side methods
|
||||
int _voidcall(int msg) {
|
||||
return _dispatch(msg, 0);
|
||||
}
|
||||
|
||||
template<class PARAM1>
|
||||
int _voidcall(int msg, PARAM1 param1) {
|
||||
void *params[1] = { ¶m1 };
|
||||
return _dispatch(msg, 0, params, 1);
|
||||
}
|
||||
|
||||
template<class PARAM1, class PARAM2>
|
||||
int _voidcall(int msg, PARAM1 param1, PARAM2 param2) {
|
||||
void *params[2] = { ¶m1, ¶m2 };
|
||||
return _dispatch(msg, 0, params, 2);
|
||||
}
|
||||
|
||||
template<class PARAM1, class PARAM2, class PARAM3>
|
||||
int _voidcall(int msg, PARAM1 param1, PARAM2 param2, PARAM3 param3) {
|
||||
void *params[3] = { ¶m1, ¶m2, ¶m3 };
|
||||
return _dispatch(msg, 0, params, 3);
|
||||
}
|
||||
|
||||
template<class PARAM1, class PARAM2, class PARAM3, class PARAM4>
|
||||
int _voidcall(int msg, PARAM1 param1, PARAM2 param2, PARAM3 param3, PARAM4 param4) {
|
||||
void *params[4] = { ¶m1, ¶m2, ¶m3, ¶m4 };
|
||||
return _dispatch(msg, 0, params, 4);
|
||||
}
|
||||
|
||||
template<class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5>
|
||||
int _voidcall(int msg, PARAM1 param1, PARAM2 param2, PARAM3 param3, PARAM4 param4, PARAM5 param5) {
|
||||
// void *params[4] = { ¶m1, ¶m2, ¶m3, ¶m4, ¶m5 }; // mig found another bug
|
||||
void *params[5] = { ¶m1, ¶m2, ¶m3, ¶m4, ¶m5 };
|
||||
return _dispatch(msg, 0, params, 5);
|
||||
}
|
||||
|
||||
template<class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6>
|
||||
int _voidcall(int msg, PARAM1 param1, PARAM2 param2, PARAM3 param3, PARAM4 param4, PARAM5 param5, PARAM6 param6) {
|
||||
// void *params[4] = { ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6 }; // mig found another bug
|
||||
void *params[6] = { ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6 };
|
||||
return _dispatch(msg, 0, params, 6);
|
||||
}
|
||||
|
||||
template<class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7>
|
||||
int _voidcall(int msg, PARAM1 param1, PARAM2 param2, PARAM3 param3, PARAM4 param4, PARAM5 param5, PARAM6 param6, PARAM7 param7) {
|
||||
void *params[7] = { ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6 , ¶m7 };
|
||||
return _dispatch(msg, 0, params, 7);
|
||||
}
|
||||
|
||||
template<class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8>
|
||||
int _voidcall(int msg, PARAM1 param1, PARAM2 param2, PARAM3 param3, PARAM4 param4, PARAM5 param5, PARAM6 param6, PARAM7 param7, PARAM8 param8) {
|
||||
void *params[8] = { ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6 , ¶m7 , ¶m8 };
|
||||
return _dispatch(msg, 0, params, 8);
|
||||
}
|
||||
|
||||
template<class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8, class PARAM9>
|
||||
int _voidcall(int msg, PARAM1 param1, PARAM2 param2, PARAM3 param3, PARAM4 param4, PARAM5 param5, PARAM6 param6, PARAM7 param7, PARAM8 param8, PARAM9 param9) {
|
||||
void *params[9] = { ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6 , ¶m7 , ¶m8 , ¶m9 };
|
||||
return _dispatch(msg, 0, params, 9);
|
||||
}
|
||||
|
||||
template<class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8, class PARAM9, class PARAM10>
|
||||
int _voidcall(int msg, PARAM1 param1, PARAM2 param2, PARAM3 param3, PARAM4 param4, PARAM5 param5, PARAM6 param6, PARAM7 param7, PARAM8 param8, PARAM9 param9, PARAM10 param10) {
|
||||
void *params[10] = { ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6 , ¶m7 , ¶m8 , ¶m9 , ¶m10 };
|
||||
return _dispatch(msg, 0, params, 10);
|
||||
}
|
||||
|
||||
template<class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8, class PARAM9, class PARAM10, class PARAM11, class PARAM12, class PARAM13, class PARAM14>
|
||||
int _voidcall(int msg, PARAM1 param1, PARAM2 param2, PARAM3 param3, PARAM4 param4, PARAM5 param5, PARAM6 param6, PARAM7 param7, PARAM8 param8, PARAM9 param9, PARAM10 param10, PARAM11 param11, PARAM12 param12, PARAM13 param13, PARAM14 param14) {
|
||||
void *params[14] = { ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6 , ¶m7 , ¶m8 , ¶m9 , ¶m10 , ¶m11 , ¶m12 , ¶m13 , ¶m14 };
|
||||
return _dispatch(msg, 0, params, 14);
|
||||
}
|
||||
|
||||
template<class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8, class PARAM9, class PARAM10, class PARAM11, class PARAM12, class PARAM13, class PARAM14, class PARAM15, class PARAM16>
|
||||
int _voidcall(int msg, PARAM1 param1, PARAM2 param2, PARAM3 param3, PARAM4 param4, PARAM5 param5, PARAM6 param6, PARAM7 param7, PARAM8 param8, PARAM9 param9, PARAM10 param10, PARAM11 param11, PARAM12 param12, PARAM13 param13, PARAM14 param14, PARAM15 param15, PARAM16 param16) {
|
||||
void *params[16] = { ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6 , ¶m7 , ¶m8 , ¶m9 , ¶m10 , ¶m11 , ¶m12 , ¶m13 , ¶m14 , ¶m15 , ¶m16 };
|
||||
return _dispatch(msg, 0, params, 16);
|
||||
}
|
||||
|
||||
template<class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8, class PARAM9, class PARAM10, class PARAM11, class PARAM12, class PARAM13, class PARAM14, class PARAM15, class PARAM16, class PARAM17>
|
||||
int _voidcall(int msg, PARAM1 param1, PARAM2 param2, PARAM3 param3, PARAM4 param4, PARAM5 param5, PARAM6 param6, PARAM7 param7, PARAM8 param8, PARAM9 param9, PARAM10 param10, PARAM11 param11, PARAM12 param12, PARAM13 param13, PARAM14 param14, PARAM15 param15, PARAM16 param16, PARAM17 param17) {
|
||||
void *params[17] = { ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6 , ¶m7 , ¶m8 , ¶m9 , ¶m10 , ¶m11 , ¶m12 , ¶m13 , ¶m14 , ¶m15 , ¶m16 , ¶m17 };
|
||||
return _dispatch(msg, 0, params, 17);
|
||||
}
|
||||
|
||||
|
||||
template<class RETURN_TYPE>
|
||||
RETURN_TYPE _call(int msg, RETURN_TYPE defval) {
|
||||
RETURN_TYPE retval;
|
||||
if (_dispatch(msg, &retval)) return retval;
|
||||
return defval;
|
||||
}
|
||||
|
||||
template<class RETURN_TYPE, class PARAM1>
|
||||
RETURN_TYPE _call(int msg, RETURN_TYPE defval, PARAM1 param1) {
|
||||
void *params[1] = { ¶m1 };
|
||||
RETURN_TYPE retval;
|
||||
if (_dispatch(msg, &retval, params, 1)) return retval;
|
||||
return defval;
|
||||
}
|
||||
|
||||
template<class RETURN_TYPE, class PARAM1, class PARAM2>
|
||||
RETURN_TYPE _call(int msg, RETURN_TYPE defval, PARAM1 param1, PARAM2 param2) {
|
||||
void *params[2] = { ¶m1, ¶m2 };
|
||||
RETURN_TYPE retval;
|
||||
if (_dispatch(msg, &retval, params, 2)) return retval;
|
||||
return defval;
|
||||
}
|
||||
|
||||
template<class RETURN_TYPE, class PARAM1, class PARAM2, class PARAM3>
|
||||
RETURN_TYPE _call(int msg, RETURN_TYPE defval, PARAM1 param1, PARAM2 param2, PARAM3 param3) {
|
||||
void *params[3] = { ¶m1, ¶m2, ¶m3 };
|
||||
RETURN_TYPE retval;
|
||||
if (_dispatch(msg, &retval, params, 3)) return retval;
|
||||
return defval;
|
||||
}
|
||||
|
||||
template<class RETURN_TYPE, class PARAM1, class PARAM2, class PARAM3, class PARAM4>
|
||||
RETURN_TYPE _call(int msg, RETURN_TYPE defval, PARAM1 param1, PARAM2 param2, PARAM3 param3, PARAM4 param4) {
|
||||
void *params[4] = { ¶m1, ¶m2, ¶m3, ¶m4 };
|
||||
RETURN_TYPE retval;
|
||||
if (_dispatch(msg, &retval, params, 4)) return retval;
|
||||
return defval;
|
||||
}
|
||||
|
||||
template<class RETURN_TYPE, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5>
|
||||
RETURN_TYPE _call(int msg, RETURN_TYPE defval, PARAM1 param1, PARAM2 param2, PARAM3 param3, PARAM4 param4, PARAM5 param5) {
|
||||
void *params[5] = { ¶m1, ¶m2, ¶m3, ¶m4, ¶m5 };
|
||||
RETURN_TYPE retval;
|
||||
if (_dispatch(msg, &retval, params, 5)) return retval;
|
||||
return defval;
|
||||
}
|
||||
|
||||
template<class RETURN_TYPE, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6>
|
||||
RETURN_TYPE _call(int msg, RETURN_TYPE defval, PARAM1 param1, PARAM2 param2, PARAM3 param3, PARAM4 param4, PARAM5 param5, PARAM6 param6) {
|
||||
void *params[6] = { ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6 };
|
||||
RETURN_TYPE retval;
|
||||
if (_dispatch(msg, &retval, params, 6)) return retval;
|
||||
return defval;
|
||||
}
|
||||
|
||||
template<class RETURN_TYPE, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7>
|
||||
RETURN_TYPE _call(int msg, RETURN_TYPE defval, PARAM1 param1, PARAM2 param2, PARAM3 param3, PARAM4 param4, PARAM5 param5, PARAM6 param6, PARAM7 param7) {
|
||||
void *params[7] = { ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6, ¶m7 };
|
||||
RETURN_TYPE retval;
|
||||
if (_dispatch(msg, &retval, params, 7)) return retval;
|
||||
return defval;
|
||||
}
|
||||
|
||||
template<class RETURN_TYPE, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8>
|
||||
RETURN_TYPE _call(int msg, RETURN_TYPE defval, PARAM1 param1, PARAM2 param2, PARAM3 param3, PARAM4 param4, PARAM5 param5, PARAM6 param6, PARAM7 param7, PARAM8 param8) {
|
||||
void *params[8] = { ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6, ¶m7, ¶m8 };
|
||||
RETURN_TYPE retval;
|
||||
if (_dispatch(msg, &retval, params, 8)) return retval;
|
||||
return defval;
|
||||
}
|
||||
|
||||
template<class RETURN_TYPE, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8, class PARAM9>
|
||||
RETURN_TYPE _call(int msg, RETURN_TYPE defval, PARAM1 param1, PARAM2 param2, PARAM3 param3, PARAM4 param4, PARAM5 param5, PARAM6 param6, PARAM7 param7, PARAM8 param8, PARAM9 param9) {
|
||||
void *params[9] = { ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6, ¶m7, ¶m8, ¶m9 };
|
||||
RETURN_TYPE retval;
|
||||
if (_dispatch(msg, &retval, params, 9)) return retval;
|
||||
return defval;
|
||||
}
|
||||
|
||||
template<class RETURN_TYPE, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8, class PARAM9, class PARAM10>
|
||||
RETURN_TYPE _call(int msg, RETURN_TYPE defval, PARAM1 param1, PARAM2 param2, PARAM3 param3, PARAM4 param4, PARAM5 param5, PARAM6 param6, PARAM7 param7, PARAM8 param8, PARAM9 param9, PARAM10 param10) {
|
||||
void *params[10] = { ¶m1, ¶m2, ¶m3, ¶m4, ¶m5, ¶m6, ¶m7, ¶m8, ¶m9, ¶m10 };
|
||||
RETURN_TYPE retval;
|
||||
if (_dispatch(msg, &retval, params, 10)) return retval;
|
||||
return defval;
|
||||
}
|
||||
|
||||
template <class CLASSNAME, class RETVAL>
|
||||
void cb(RETVAL (CLASSNAME::*fn)(), void *retval, void **params) {
|
||||
*static_cast<RETVAL*>(retval) = (static_cast<CLASSNAME *>(this)->*fn)();
|
||||
}
|
||||
|
||||
template <class CLASSNAME>
|
||||
void vcb(void (CLASSNAME::*fn)(), void *retval, void **params) {
|
||||
(static_cast<CLASSNAME *>(this)->*fn)();
|
||||
}
|
||||
|
||||
template <class CLASSNAME, class RETVAL, class PARAM1>
|
||||
void cb(RETVAL (CLASSNAME::*fn)(PARAM1), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
*static_cast<RETVAL*>(retval) = (static_cast<CLASSNAME *>(this)->*fn)(*p1);
|
||||
}
|
||||
|
||||
template <class CLASSNAME, class PARAM1>
|
||||
void vcb(void (CLASSNAME::*fn)(PARAM1), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
(static_cast<CLASSNAME *>(this)->*fn)(*p1);
|
||||
}
|
||||
|
||||
template <class CLASSNAME, class PARAM1, class PARAM2>
|
||||
void vcb(void (CLASSNAME::*fn)(PARAM1, PARAM2), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
(static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2);
|
||||
}
|
||||
|
||||
template <class CLASSNAME, class RETVAL, class PARAM1, class PARAM2>
|
||||
void cb(RETVAL (CLASSNAME::*fn)(PARAM1, PARAM2), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
*static_cast<RETVAL*>(retval) = (static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2);
|
||||
}
|
||||
|
||||
// 3 params
|
||||
template <class CLASSNAME, class PARAM1, class PARAM2, class PARAM3>
|
||||
void vcb(void (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
(static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3);
|
||||
}
|
||||
|
||||
template <class CLASSNAME, class RETVAL, class PARAM1, class PARAM2, class PARAM3>
|
||||
void cb(RETVAL (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
*static_cast<RETVAL*>(retval) = (static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3);
|
||||
}
|
||||
|
||||
// 4 params
|
||||
template <class CLASSNAME, class PARAM1, class PARAM2, class PARAM3, class PARAM4>
|
||||
void vcb(void (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3, PARAM4), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
PARAM4 *p4 = static_cast<PARAM4*>(params[3]);
|
||||
(static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3, *p4);
|
||||
}
|
||||
|
||||
template <class CLASSNAME, class RETVAL, class PARAM1, class PARAM2, class PARAM3, class PARAM4>
|
||||
void cb(RETVAL (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3, PARAM4), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
PARAM4 *p4 = static_cast<PARAM4*>(params[3]);
|
||||
*static_cast<RETVAL*>(retval) = (static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3, *p4);
|
||||
}
|
||||
|
||||
// 5 params
|
||||
template <class CLASSNAME, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5>
|
||||
void vcb(void (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3, PARAM4, PARAM5), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
PARAM4 *p4 = static_cast<PARAM4*>(params[3]);
|
||||
PARAM5 *p5 = static_cast<PARAM5*>(params[4]);
|
||||
(static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3, *p4, *p5);
|
||||
}
|
||||
|
||||
template <class CLASSNAME, class RETVAL, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5>
|
||||
void cb(RETVAL (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3, PARAM4, PARAM5), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
PARAM4 *p4 = static_cast<PARAM4*>(params[3]);
|
||||
PARAM5 *p5 = static_cast<PARAM5*>(params[4]);
|
||||
*static_cast<RETVAL*>(retval) = (static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3, *p4, *p5);
|
||||
}
|
||||
|
||||
// 6 params
|
||||
template <class CLASSNAME, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6>
|
||||
void vcb(void (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3, PARAM4, PARAM5, PARAM6), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
PARAM4 *p4 = static_cast<PARAM4*>(params[3]);
|
||||
PARAM5 *p5 = static_cast<PARAM5*>(params[4]);
|
||||
PARAM6 *p6 = static_cast<PARAM6*>(params[5]);
|
||||
(static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3, *p4, *p5, *p6);
|
||||
}
|
||||
|
||||
template <class CLASSNAME, class RETVAL, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6>
|
||||
void cb(RETVAL (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3, PARAM4, PARAM5, PARAM6), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
PARAM4 *p4 = static_cast<PARAM4*>(params[3]);
|
||||
PARAM5 *p5 = static_cast<PARAM5*>(params[4]);
|
||||
PARAM6 *p6 = static_cast<PARAM6*>(params[5]);
|
||||
*static_cast<RETVAL*>(retval) = (static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3, *p4, *p5, *p6);
|
||||
}
|
||||
|
||||
// 7 params
|
||||
template <class CLASSNAME, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7>
|
||||
void vcb(void (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3, PARAM4, PARAM5, PARAM6, PARAM7), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
PARAM4 *p4 = static_cast<PARAM4*>(params[3]);
|
||||
PARAM5 *p5 = static_cast<PARAM5*>(params[4]);
|
||||
PARAM6 *p6 = static_cast<PARAM6*>(params[5]);
|
||||
PARAM7 *p7 = static_cast<PARAM7*>(params[6]);
|
||||
(static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3, *p4, *p5, *p6, *p7);
|
||||
}
|
||||
|
||||
template <class CLASSNAME, class RETVAL, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7>
|
||||
void cb(RETVAL (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3, PARAM4, PARAM5, PARAM6, PARAM7), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
PARAM4 *p4 = static_cast<PARAM4*>(params[3]);
|
||||
PARAM5 *p5 = static_cast<PARAM5*>(params[4]);
|
||||
PARAM6 *p6 = static_cast<PARAM6*>(params[5]);
|
||||
PARAM7 *p7 = static_cast<PARAM7*>(params[6]);
|
||||
*static_cast<RETVAL*>(retval) = (static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3, *p4, *p5, *p6, *p7);
|
||||
}
|
||||
|
||||
// 8 params
|
||||
template <class CLASSNAME, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8>
|
||||
void vcb(void (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3, PARAM4, PARAM5, PARAM6, PARAM7, PARAM8), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
PARAM4 *p4 = static_cast<PARAM4*>(params[3]);
|
||||
PARAM5 *p5 = static_cast<PARAM5*>(params[4]);
|
||||
PARAM6 *p6 = static_cast<PARAM6*>(params[5]);
|
||||
PARAM7 *p7 = static_cast<PARAM7*>(params[6]);
|
||||
PARAM8 *p8 = static_cast<PARAM8*>(params[7]);
|
||||
(static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8);
|
||||
}
|
||||
|
||||
template <class CLASSNAME, class RETVAL, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8>
|
||||
void cb(RETVAL (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3, PARAM4, PARAM5, PARAM6, PARAM7, PARAM8), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
PARAM4 *p4 = static_cast<PARAM4*>(params[3]);
|
||||
PARAM5 *p5 = static_cast<PARAM5*>(params[4]);
|
||||
PARAM6 *p6 = static_cast<PARAM6*>(params[5]);
|
||||
PARAM7 *p7 = static_cast<PARAM7*>(params[6]);
|
||||
PARAM8 *p8 = static_cast<PARAM8*>(params[7]);
|
||||
*static_cast<RETVAL*>(retval) = (static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8);
|
||||
}
|
||||
|
||||
// 9 params
|
||||
template <class CLASSNAME, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8, class PARAM9>
|
||||
void vcb(void (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3, PARAM4, PARAM5, PARAM6, PARAM7, PARAM8, PARAM9), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
PARAM4 *p4 = static_cast<PARAM4*>(params[3]);
|
||||
PARAM5 *p5 = static_cast<PARAM5*>(params[4]);
|
||||
PARAM6 *p6 = static_cast<PARAM6*>(params[5]);
|
||||
PARAM7 *p7 = static_cast<PARAM7*>(params[6]);
|
||||
PARAM8 *p8 = static_cast<PARAM8*>(params[7]);
|
||||
PARAM9 *p9 = static_cast<PARAM9*>(params[8]);
|
||||
(static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9);
|
||||
}
|
||||
|
||||
template <class CLASSNAME, class RETVAL, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8, class PARAM9>
|
||||
void cb(RETVAL (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3, PARAM4, PARAM5, PARAM6, PARAM7, PARAM8, PARAM9), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
PARAM4 *p4 = static_cast<PARAM4*>(params[3]);
|
||||
PARAM5 *p5 = static_cast<PARAM5*>(params[4]);
|
||||
PARAM6 *p6 = static_cast<PARAM6*>(params[5]);
|
||||
PARAM7 *p7 = static_cast<PARAM7*>(params[6]);
|
||||
PARAM8 *p8 = static_cast<PARAM8*>(params[7]);
|
||||
PARAM9 *p9 = static_cast<PARAM9*>(params[8]);
|
||||
*static_cast<RETVAL*>(retval) = (static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9);
|
||||
}
|
||||
|
||||
// 10 params
|
||||
template <class CLASSNAME, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8, class PARAM9, class PARAM10>
|
||||
void vcb(void (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3, PARAM4, PARAM5, PARAM6, PARAM7, PARAM8, PARAM9, PARAM10), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
PARAM4 *p4 = static_cast<PARAM4*>(params[3]);
|
||||
PARAM5 *p5 = static_cast<PARAM5*>(params[4]);
|
||||
PARAM6 *p6 = static_cast<PARAM6*>(params[5]);
|
||||
PARAM7 *p7 = static_cast<PARAM7*>(params[6]);
|
||||
PARAM8 *p8 = static_cast<PARAM8*>(params[7]);
|
||||
PARAM9 *p9 = static_cast<PARAM9*>(params[8]);
|
||||
PARAM10 *p10 = static_cast<PARAM10*>(params[9]);
|
||||
(static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9, *p10);
|
||||
}
|
||||
|
||||
template <class CLASSNAME, class RETVAL, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8, class PARAM9, class PARAM10>
|
||||
void cb(RETVAL (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3, PARAM4, PARAM5, PARAM6, PARAM7, PARAM8, PARAM9, PARAM10), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
PARAM4 *p4 = static_cast<PARAM4*>(params[3]);
|
||||
PARAM5 *p5 = static_cast<PARAM5*>(params[4]);
|
||||
PARAM6 *p6 = static_cast<PARAM6*>(params[5]);
|
||||
PARAM7 *p7 = static_cast<PARAM7*>(params[6]);
|
||||
PARAM8 *p8 = static_cast<PARAM8*>(params[7]);
|
||||
PARAM9 *p9 = static_cast<PARAM9*>(params[8]);
|
||||
PARAM10 *p10 = static_cast<PARAM10*>(params[9]);
|
||||
*static_cast<RETVAL*>(retval) = (static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9, *p10);
|
||||
}
|
||||
|
||||
// 14 params
|
||||
template <class CLASSNAME, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8, class PARAM9, class PARAM10, class PARAM11, class PARAM12, class PARAM13, class PARAM14>
|
||||
void vcb(void (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3, PARAM4, PARAM5, PARAM6, PARAM7, PARAM8, PARAM9, PARAM10, PARAM11, PARAM12, PARAM13, PARAM14), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
PARAM4 *p4 = static_cast<PARAM4*>(params[3]);
|
||||
PARAM5 *p5 = static_cast<PARAM5*>(params[4]);
|
||||
PARAM6 *p6 = static_cast<PARAM6*>(params[5]);
|
||||
PARAM7 *p7 = static_cast<PARAM7*>(params[6]);
|
||||
PARAM8 *p8 = static_cast<PARAM8*>(params[7]);
|
||||
PARAM9 *p9 = static_cast<PARAM9*>(params[8]);
|
||||
PARAM10 *p10 = static_cast<PARAM10*>(params[9]);
|
||||
PARAM11 *p11 = static_cast<PARAM11*>(params[10]);
|
||||
PARAM12 *p12 = static_cast<PARAM12*>(params[11]);
|
||||
PARAM13 *p13 = static_cast<PARAM13*>(params[12]);
|
||||
PARAM14 *p14 = static_cast<PARAM14*>(params[13]);
|
||||
(static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9, *p10, *p11, *p12, *p13, *p14);
|
||||
}
|
||||
|
||||
// 16 params
|
||||
template <class CLASSNAME, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8, class PARAM9, class PARAM10, class PARAM11, class PARAM12, class PARAM13, class PARAM14, class PARAM15, class PARAM16>
|
||||
void vcb(void (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3, PARAM4, PARAM5, PARAM6, PARAM7, PARAM8, PARAM9, PARAM10, PARAM11, PARAM12, PARAM13, PARAM14, PARAM15, PARAM16), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
PARAM4 *p4 = static_cast<PARAM4*>(params[3]);
|
||||
PARAM5 *p5 = static_cast<PARAM5*>(params[4]);
|
||||
PARAM6 *p6 = static_cast<PARAM6*>(params[5]);
|
||||
PARAM7 *p7 = static_cast<PARAM7*>(params[6]);
|
||||
PARAM8 *p8 = static_cast<PARAM8*>(params[7]);
|
||||
PARAM9 *p9 = static_cast<PARAM9*>(params[8]);
|
||||
PARAM10 *p10 = static_cast<PARAM10*>(params[9]);
|
||||
PARAM11 *p11 = static_cast<PARAM11*>(params[10]);
|
||||
PARAM12 *p12 = static_cast<PARAM12*>(params[11]);
|
||||
PARAM13 *p13 = static_cast<PARAM13*>(params[12]);
|
||||
PARAM14 *p14 = static_cast<PARAM14*>(params[13]);
|
||||
PARAM15 *p15 = static_cast<PARAM15*>(params[14]);
|
||||
PARAM16 *p16 = static_cast<PARAM16*>(params[15]);
|
||||
(static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9, *p10, *p11, *p12, *p13, *p14, *p15, *p16);
|
||||
}
|
||||
|
||||
// 17 params
|
||||
template <class CLASSNAME, class PARAM1, class PARAM2, class PARAM3, class PARAM4, class PARAM5, class PARAM6, class PARAM7, class PARAM8, class PARAM9, class PARAM10, class PARAM11, class PARAM12, class PARAM13, class PARAM14, class PARAM15, class PARAM16, class PARAM17>
|
||||
void vcb(void (CLASSNAME::*fn)(PARAM1, PARAM2, PARAM3, PARAM4, PARAM5, PARAM6, PARAM7, PARAM8, PARAM9, PARAM10, PARAM11, PARAM12, PARAM13, PARAM14, PARAM15, PARAM16, PARAM17), void *retval, void **params) {
|
||||
PARAM1 *p1 = static_cast<PARAM1*>(params[0]);
|
||||
PARAM2 *p2 = static_cast<PARAM2*>(params[1]);
|
||||
PARAM3 *p3 = static_cast<PARAM3*>(params[2]);
|
||||
PARAM4 *p4 = static_cast<PARAM4*>(params[3]);
|
||||
PARAM5 *p5 = static_cast<PARAM5*>(params[4]);
|
||||
PARAM6 *p6 = static_cast<PARAM6*>(params[5]);
|
||||
PARAM7 *p7 = static_cast<PARAM7*>(params[6]);
|
||||
PARAM8 *p8 = static_cast<PARAM8*>(params[7]);
|
||||
PARAM9 *p9 = static_cast<PARAM9*>(params[8]);
|
||||
PARAM10 *p10 = static_cast<PARAM10*>(params[9]);
|
||||
PARAM11 *p11 = static_cast<PARAM11*>(params[10]);
|
||||
PARAM12 *p12 = static_cast<PARAM12*>(params[11]);
|
||||
PARAM13 *p13 = static_cast<PARAM13*>(params[12]);
|
||||
PARAM14 *p14 = static_cast<PARAM14*>(params[13]);
|
||||
PARAM15 *p15 = static_cast<PARAM15*>(params[14]);
|
||||
PARAM16 *p16 = static_cast<PARAM16*>(params[15]);
|
||||
PARAM17 *p17 = static_cast<PARAM17*>(params[16]);
|
||||
(static_cast<CLASSNAME *>(this)->*fn)(*p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9, *p10, *p11, *p12, *p13, *p14, *p15, *p16, *p17);
|
||||
}
|
||||
|
||||
|
||||
enum { DESTRUCT=0xffff };
|
||||
};
|
||||
#define CB(x, y) case (x): cb(&CBCLASS::y, retval, params); break;
|
||||
#define VCB(x, y) case (x): vcb(&CBCLASS::y, retval, params); break;
|
||||
|
||||
#define RECVS_DISPATCH virtual int WASABICALL _dispatch(int msg, void *retval, void **params=0, int nparam=0)
|
||||
|
||||
#define START_DISPATCH \
|
||||
int CBCLASS::_dispatch(int msg, void *retval, void **params, int nparam) { \
|
||||
switch (msg) {
|
||||
#define START_DISPATCH_INLINE \
|
||||
int WASABICALL CBCLASS::_dispatch(int msg, void *retval, void **params, int nparam) { \
|
||||
switch (msg) {
|
||||
|
||||
//FINISH case DESTRUCT: delete this; return 1;
|
||||
#define END_DISPATCH \
|
||||
default: return 0; \
|
||||
} \
|
||||
return 1; \
|
||||
}
|
||||
#define FORWARD_DISPATCH(x) \
|
||||
default: return x::_dispatch(msg, retval, params, nparam); \
|
||||
} \
|
||||
return 1; \
|
||||
}
|
||||
|
||||
#define DISPATCH_CODES enum
|
||||
|
||||
inline size_t Dispatchable::AddRef()
|
||||
{
|
||||
return _call(Dispatchable::ADDREF, 0);
|
||||
}
|
||||
|
||||
inline size_t Dispatchable::Release()
|
||||
{
|
||||
return _call(Dispatchable::RELEASE, 0);
|
||||
}
|
||||
|
||||
inline int Dispatchable::QueryInterface(GUID interface_guid, void **object)
|
||||
{
|
||||
return _call(Dispatchable::QUERYINTERFACE, 0, interface_guid, object);
|
||||
}
|
37
Src/Plugins/Input/in_wv/wasabi/bfc/nsguid.h
Normal file
37
Src/Plugins/Input/in_wv/wasabi/bfc/nsguid.h
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef _NSGUID_H
|
||||
#define _NSGUID_H
|
||||
|
||||
#include "platform/guid.h"
|
||||
//#include <bfc/common.h>
|
||||
|
||||
// Some conversion functions to allow
|
||||
// us to have GUIDs translatable to and from other data types.
|
||||
class nsGUID {
|
||||
public:
|
||||
// To the "Human Readable" character format.
|
||||
// {1B3CA60C-DA98-4826-B4A9-D79748A5FD73}
|
||||
static char *toChar(const GUID &guid, char *target);
|
||||
static wchar_t *toCharW(const GUID &guid, wchar_t *target);
|
||||
static GUID fromCharW(const wchar_t *source);
|
||||
// To the "C Structure" character format.
|
||||
// { 0x1b3ca60c, 0xda98, 0x4826, { 0xb4, 0xa9, 0xd7, 0x97, 0x48, 0xa5, 0xfd, 0x73 } };
|
||||
static char *toCode(const GUID &guid, char *target);
|
||||
static GUID fromCode(const char *source);
|
||||
|
||||
// Compare function, returns -1, 0, 1
|
||||
static int compare(const GUID &a, const GUID &b);
|
||||
|
||||
// strlen("{xx xxx xxx-xxxx-xxxx-xxxx-xxx xxx xxx xxx}"
|
||||
enum { GUID_STRLEN = 38 };
|
||||
|
||||
#ifdef WASABI_COMPILE_CREATEGUID
|
||||
static void createGuid(GUID *g);
|
||||
#endif
|
||||
};
|
||||
|
||||
inline
|
||||
int operator <(const GUID &a, const GUID &b) {
|
||||
return (nsGUID::compare(a, b) < 0);
|
||||
}
|
||||
|
||||
#endif //_NSGUID_H
|
24
Src/Plugins/Input/in_wv/wasabi/bfc/platform/guid.h
Normal file
24
Src/Plugins/Input/in_wv/wasabi/bfc/platform/guid.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef _GUID_H
|
||||
#define _GUID_H
|
||||
|
||||
#include "types.h"
|
||||
#include "platform.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifndef GUID_EQUALS_DEFINED
|
||||
#define GUID_EQUALS_DEFINED
|
||||
#include <memory.h>
|
||||
static __inline int operator ==(const GUID &a, const GUID &b) {
|
||||
return !memcmp(&a, &b, sizeof(GUID));
|
||||
}
|
||||
static __inline int operator !=(const GUID &a, const GUID &b) {
|
||||
return !!memcmp(&a, &b, sizeof(GUID));
|
||||
}
|
||||
#endif //GUID_EQUALS_DEFINED
|
||||
#endif //__cplusplus
|
||||
|
||||
static const GUID INVALID_GUID = { 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0} };
|
||||
static const GUID GENERIC_GUID = { 0xFFFFFFFF, 0xFFFF, 0xFFFF, {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} };
|
||||
|
||||
#endif
|
500
Src/Plugins/Input/in_wv/wasabi/bfc/platform/platform.h
Normal file
500
Src/Plugins/Input/in_wv/wasabi/bfc/platform/platform.h
Normal file
@ -0,0 +1,500 @@
|
||||
#ifndef _PLATFORM_H
|
||||
#define _PLATFORM_H
|
||||
|
||||
#include "types.h"
|
||||
#include "../std_mkncc.h" // for MKnCC
|
||||
|
||||
#ifdef WIN32
|
||||
# include "win32.h"
|
||||
|
||||
#define OSMODULEHANDLE HINSTANCE
|
||||
#define INVALIDOSMODULEHANDLE ((OSMODULEHANDLE)0)
|
||||
#define OSWINDOWHANDLE HWND
|
||||
#define INVALIDOSWINDOWHANDLE ((OSWINDOWHANDLE)0)
|
||||
#define OSICONHANDLE HICON
|
||||
#define INVALIDOSICONHANDLE ((OSICONHANDLE)0)
|
||||
#define OSCURSORHANDLE HICON
|
||||
#define INVALIDOSCURSORHANDLE ((OSCURSORHANDLE)0)
|
||||
#define OSTHREADHANDLE HANDLE
|
||||
#define INVALIDOSTHREADHANDLE ((OSTHREADHANDLE)0)
|
||||
#define OSREGIONHANDLE HRGN
|
||||
#define INVALIDOSREGIONHANDLE ((OSREGIONHANDLE)0)
|
||||
typedef HMENU OSMENUHANDLE;
|
||||
|
||||
#define RGBA(r,g,b,a) ((ARGB32)((uint8_t)(r) | ((uint8_t)(g) << 8) | ((uint8_t)(b) << 16) | ((uint8_t)(a) << 24)))
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX MAX_PATH
|
||||
#endif
|
||||
|
||||
#elif defined(LINUX)
|
||||
# include <bfc/platform/linux.h>
|
||||
#elif defined(__APPLE__)
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
typedef HIShapeRef OSREGIONHANDLE;
|
||||
typedef int OSCURSOR; // TODO: find a good one for this
|
||||
typedef int OSCURSORHANDLE; // TODO: find a good one for this
|
||||
typedef HIWindowRef OSWINDOWHANDLE;
|
||||
typedef void *OSMODULEHANDLE; // TODO:
|
||||
typedef CGContextRef HDC; // TODO: find a better name
|
||||
typedef MenuRef OSMENUHANDLE;
|
||||
typedef CGImageRef OSICONHANDLE;
|
||||
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
#define RGBA(r,g,b,a) ((ARGB32)((uint8_t)(r) | ((uint8_t)(g) << 8) | ((uint8_t)(b) << 16) | ((uint8_t)(a) << 24)))
|
||||
#elif defined(__BIG_ENDIAN__)
|
||||
#define RGBA(r,g,b,a) ((ARGB32)((uint8_t)(a) | ((uint8_t)(r) << 8) | ((uint8_t)(g) << 16) | ((uint8_t)(b) << 24)))
|
||||
#else
|
||||
#error endian preprocessor symbol not defined
|
||||
#endif
|
||||
|
||||
#define RGB(r,g,b) RGBA(r,g,b,0xFF)
|
||||
|
||||
static const HIWindowRef INVALIDOSWINDOWHANDLE = 0; // TODO: maybe there's an apple-defined name for this
|
||||
#define INVALIDOSMODULEHANDLE 0
|
||||
#define INVALIDOSCURSORHANDLE 0
|
||||
|
||||
typedef char OSFNCHAR;
|
||||
typedef char *OSFNSTR;
|
||||
|
||||
typedef const char OSFNCCHAR;
|
||||
typedef const char *OSFNCSTR;
|
||||
|
||||
#define FNT(x) x
|
||||
|
||||
typedef struct tagRECT
|
||||
{
|
||||
int left;
|
||||
int top;
|
||||
int right;
|
||||
int bottom;
|
||||
}
|
||||
RECT;
|
||||
typedef RECT * LPRECT;
|
||||
|
||||
inline RECT RECTFromHIRect(const HIRect *r)
|
||||
{
|
||||
RECT rect;
|
||||
rect.left = r->origin.x;
|
||||
rect.right = r->origin.x + r->size.width;
|
||||
rect.top = r->origin.y;
|
||||
rect.bottom = r->origin.y + r->size.height;
|
||||
return rect;
|
||||
}
|
||||
|
||||
inline HIRect HIRectFromRECT(const RECT *r)
|
||||
{
|
||||
HIRect rect;
|
||||
rect.origin.x = r->left;
|
||||
rect.origin.y = r->top;
|
||||
rect.size.width = r->right - r->left;
|
||||
rect.size.height = r->bottom - r->top;
|
||||
return rect;
|
||||
}
|
||||
|
||||
typedef struct tagPOINT
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
}
|
||||
POINT;
|
||||
typedef struct tagPOINT * LPPOINT;
|
||||
|
||||
inline HIPoint HIPointFromPOINT(const POINT *pt)
|
||||
{
|
||||
HIPoint p;
|
||||
p.x = pt->x;
|
||||
p.y = pt->y;
|
||||
return p;
|
||||
}
|
||||
|
||||
inline int MulDiv(int a, int b, int c)
|
||||
{
|
||||
int s;
|
||||
int v;
|
||||
|
||||
s = 0;
|
||||
if (a < 0)
|
||||
{
|
||||
s = !s;
|
||||
a = -a;
|
||||
}
|
||||
if (b < 0)
|
||||
{
|
||||
s = !s;
|
||||
b = -b;
|
||||
}
|
||||
if (c < 0)
|
||||
{
|
||||
s = !s;
|
||||
c = -c;
|
||||
}
|
||||
double d;
|
||||
d = ((double)a * (double)b) / (double)c;
|
||||
if (d >= 4294967296.)
|
||||
return -1;
|
||||
v = d;
|
||||
if (s)
|
||||
v = -v;
|
||||
return v;
|
||||
}
|
||||
|
||||
#else
|
||||
#error port me
|
||||
// Windows API dependant definitions for non-windows platforms
|
||||
|
||||
#define __cdecl
|
||||
#define __stdcall
|
||||
#define WINAPI
|
||||
#define WINBASEAPI
|
||||
#define WINUSERAPI
|
||||
#define WINGDIAPI
|
||||
#define WINOLEAPI
|
||||
#define CALLBACK
|
||||
#define FARPROC void *
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
#define ERROR 0
|
||||
|
||||
#define CONST const
|
||||
#define VOID void
|
||||
|
||||
typedef unsigned long DWORD;
|
||||
typedef unsigned short WORD;
|
||||
typedef unsigned char BYTE;
|
||||
typedef long LONG;
|
||||
typedef int INT;
|
||||
typedef int BOOL;
|
||||
typedef short SHORT;
|
||||
typedef void * PVOID;
|
||||
typedef void * LPVOID;
|
||||
|
||||
typedef char CHAR;
|
||||
typedef unsigned short WCHAR;
|
||||
typedef char * LPSTR;
|
||||
typedef WCHAR * LPWSTR;
|
||||
typedef const char * LPCSTR;
|
||||
typedef const WCHAR * LPCWSTR;
|
||||
typedef LPWSTR PTSTR, LPTSTR;
|
||||
typedef LPCWSTR LPCTSTR;
|
||||
typedef char TCHAR;
|
||||
typedef WCHAR OLECHAR;
|
||||
|
||||
typedef void * HANDLE;
|
||||
typedef void * HWND;
|
||||
typedef void * HDC;
|
||||
typedef void * HFONT;
|
||||
typedef void * HBITMAP;
|
||||
typedef void * HINSTANCE;
|
||||
typedef void * HICON;
|
||||
typedef void * HRGN;
|
||||
typedef void * HPEN;
|
||||
typedef void * HBRUSH;
|
||||
typedef void * HRSRC;
|
||||
typedef void * HGLOBAL;
|
||||
typedef void * HACCEL;
|
||||
typedef void * HMODULE;
|
||||
typedef void * HMENU;
|
||||
typedef void * HGDIOBJ;
|
||||
|
||||
typedef void * ATOM;
|
||||
typedef void * CRITICAL_SECTION;
|
||||
typedef void * LPCRITICAL_SECTION;
|
||||
|
||||
typedef UINT WPARAM;
|
||||
typedef UINT LPARAM;
|
||||
typedef LONG LRESULT;
|
||||
typedef UINT COLORREF;
|
||||
|
||||
typedef LRESULT(*WNDPROC)(HWND, UINT, WPARAM, LPARAM);
|
||||
typedef BOOL CALLBACK WNDENUMPROC(HWND, LPARAM);
|
||||
typedef VOID CALLBACK *TIMERPROC(HWND, UINT, UINT, DWORD);
|
||||
|
||||
typedef struct tagPOINT
|
||||
{
|
||||
LONG x;
|
||||
LONG y;
|
||||
}
|
||||
POINT;
|
||||
typedef struct tagPOINT * LPPOINT;
|
||||
|
||||
typedef struct tagSIZE
|
||||
{
|
||||
LONG cx;
|
||||
LONG cy;
|
||||
}
|
||||
SIZE;
|
||||
|
||||
|
||||
typedef struct tagRECT
|
||||
{
|
||||
LONG left;
|
||||
LONG top;
|
||||
LONG right;
|
||||
LONG bottom;
|
||||
}
|
||||
RECT;
|
||||
typedef RECT * LPRECT;
|
||||
|
||||
typedef struct _COORD
|
||||
{
|
||||
SHORT X;
|
||||
SHORT Y;
|
||||
}
|
||||
COORD, *PCOORD;
|
||||
|
||||
typedef struct tagPAINTSTRUCT
|
||||
{
|
||||
HDC hdc;
|
||||
BOOL fErase;
|
||||
RECT rcPaint;
|
||||
BOOL fRestore;
|
||||
BOOL fIncUpdate;
|
||||
BYTE rgbReserved[32];
|
||||
}
|
||||
PAINTSTRUCT;
|
||||
|
||||
typedef struct tagBITMAP
|
||||
{ /* bm */
|
||||
int bmType;
|
||||
int bmWidth;
|
||||
int bmHeight;
|
||||
int bmWidthBytes;
|
||||
BYTE bmPlanes;
|
||||
BYTE bmBitsPixel;
|
||||
LPVOID bmBits;
|
||||
}
|
||||
BITMAP;
|
||||
|
||||
typedef struct tagRGBQUAD
|
||||
{
|
||||
BYTE rgbRed;
|
||||
BYTE rgbGreen;
|
||||
BYTE rgbBlue;
|
||||
BYTE rgbReserved;
|
||||
}
|
||||
RGBQUAD;
|
||||
|
||||
typedef struct tagBITMAPINFOHEADER
|
||||
{
|
||||
DWORD biSize;
|
||||
LONG biWidth;
|
||||
LONG biHeight;
|
||||
WORD biPlanes;
|
||||
WORD biBitCount;
|
||||
DWORD biCompression;
|
||||
DWORD biSizeImage;
|
||||
LONG biXPelsPerMeter;
|
||||
LONG biYPelsPerMeter;
|
||||
DWORD biClrUsed;
|
||||
DWORD biClrImportant;
|
||||
}
|
||||
BITMAPINFOHEADER;
|
||||
|
||||
typedef struct tagBITMAPINFO
|
||||
{
|
||||
BITMAPINFOHEADER bmiHeader;
|
||||
RGBQUAD bmiColors[1];
|
||||
}
|
||||
BITMAPINFO, *LPBITMAPINFO;
|
||||
|
||||
typedef struct tagMSG
|
||||
{
|
||||
HWND hwnd;
|
||||
UINT message;
|
||||
WPARAM wParam;
|
||||
LPARAM lParam;
|
||||
DWORD time;
|
||||
POINT pt;
|
||||
}
|
||||
MSG;
|
||||
|
||||
typedef MSG * LPMSG;
|
||||
|
||||
typedef struct _RGNDATAHEADER
|
||||
{
|
||||
DWORD dwSize;
|
||||
DWORD iType;
|
||||
DWORD nCount;
|
||||
DWORD nRgnSize;
|
||||
RECT rcBound;
|
||||
}
|
||||
RGNDATAHEADER, *PRGNDATAHEADER;
|
||||
|
||||
typedef struct _RGNDATA
|
||||
{
|
||||
RGNDATAHEADER rdh;
|
||||
char Buffer[1];
|
||||
}
|
||||
RGNDATA, *PRGNDATA;
|
||||
|
||||
// Windows messages
|
||||
|
||||
#define WM_SYSCOMMAND 0x112
|
||||
#define WM_LBUTTONDOWN 0x201
|
||||
#define WM_LBUTTONUP 0x202
|
||||
#define WM_RBUTTONDOWN 0x204
|
||||
#define WM_RBUTTONUP 0x205
|
||||
|
||||
#define WM_USER 0x400
|
||||
|
||||
#define WS_EX_TOOLWINDOW 0x00000080L
|
||||
|
||||
#define WS_OVERLAPPED 0x00000000L
|
||||
#define WS_MAXIMIZEBOX 0x00010000L
|
||||
#define WS_MINIMIZEBOX 0x00020000L
|
||||
#define WS_SYSMENU 0x00080000L
|
||||
#define WS_CAPTION 0x00C00000L
|
||||
#define WS_CLIPCHILDREN 0x02000000L
|
||||
#define WS_CLIPSIBLINGS 0x04000000L
|
||||
#define WS_VISIBLE 0x10000000L
|
||||
#define WS_CHILD 0x40000000L
|
||||
#define WS_POPUP 0x80000000L
|
||||
|
||||
#define HWND_TOP ((HWND)0)
|
||||
#define HWND_TOPMOST ((HWND)-1)
|
||||
#define HWND_NOTOPMOST ((HWND)-2)
|
||||
|
||||
#define GWL_STYLE (-16)
|
||||
|
||||
#define GW_HWNDFIRST 0
|
||||
#define GW_HWNDNEXT 2
|
||||
|
||||
#define SWP_NOMOVE 0x0002
|
||||
#define SWP_NOSIZE 0x0001
|
||||
#define SWP_SHOWWINDOW 0x0040
|
||||
#define SWP_DEFERERASE 0x2000
|
||||
#define SWP_NOZORDER 0x0004
|
||||
#define SWP_NOACTIVATE 0x0010
|
||||
|
||||
#define SW_SHOW 5
|
||||
|
||||
#define SC_MINIMIZE 0xF020
|
||||
#define SC_MAXIMIZE 0xF030
|
||||
#define SC_RESTORE 0xF120
|
||||
|
||||
#define GCL_HICONSM (-34)
|
||||
#define GCL_HICON (-14)
|
||||
|
||||
#define MB_OK 0
|
||||
#define MB_OKCANCEL 1
|
||||
#define MB_TASKMODAL 0x2000L
|
||||
|
||||
#define IDOK 1
|
||||
#define IDCANCEL 2
|
||||
|
||||
#define VK_SHIFT 0x10
|
||||
#define VK_CONTROL 0x11
|
||||
#define VK_MENU 0x12
|
||||
|
||||
#define RT_RCDATA 10
|
||||
|
||||
#define IMAGE_BITMAP 0
|
||||
|
||||
#define LR_LOADFROMFILE 0x0010
|
||||
|
||||
#define DIB_RGB_COLORS 0
|
||||
|
||||
#define MAX_PATH 1024
|
||||
#define _MAX_PATH MAX_PATH
|
||||
#define _MAX_DRIVE 3
|
||||
#define _MAX_DIR 256
|
||||
#define _MAX_FNAME 256
|
||||
#define _MAX_EXT 256
|
||||
|
||||
#define GMEM_FIXED 0x0
|
||||
#define GMEM_ZEROINIT 0x40
|
||||
#define GPTR (GMEM_FIXED | GMEM_ZEROINIT)
|
||||
|
||||
#define SPI_GETWORKAREA 48
|
||||
|
||||
#define SM_CXDOUBLECLK 36
|
||||
#define SM_CYDOUBLECLK 37
|
||||
|
||||
#define COLORONCOLOR 3
|
||||
|
||||
#define SRCCOPY (DWORD)0x00CC0020
|
||||
|
||||
#define BI_RGB 0L
|
||||
|
||||
#define NULLREGION 1
|
||||
|
||||
#define DT_LEFT 0x00000000
|
||||
#define DT_CENTER 0x00000001
|
||||
#define DT_RIGHT 0x00000002
|
||||
#define DT_VCENTER 0x00000004
|
||||
#define DT_WORDBREAK 0x00000010
|
||||
#define DT_SINGLELINE 0x00000020
|
||||
#define DT_CALCRECT 0x00000400
|
||||
#define DT_NOPREFIX 0x00000800
|
||||
#define DT_PATH_ELLIPSIS 0x00004000
|
||||
#define DT_END_ELLIPSIS 0x00008000
|
||||
#define DT_MODIFYSTRING 0x00010000
|
||||
|
||||
#define FW_NORMAL 400
|
||||
#define FW_BOLD 700
|
||||
|
||||
#define FF_DONTCARE (0<<4)
|
||||
|
||||
#define BLACK_BRUSH 4
|
||||
#define NULL_BRUSH 5
|
||||
|
||||
#define PS_SOLID 0
|
||||
#define PS_DOT 2
|
||||
|
||||
#define TRANSPARENT 1
|
||||
#define OPAQUE 2
|
||||
|
||||
#define ANSI_CHARSET 0
|
||||
#define ANSI_VAR_FONT 12
|
||||
|
||||
#define OUT_DEFAULT_PRECIS 0
|
||||
#define CLIP_DEFAULT_PRECIS 0
|
||||
|
||||
#define PROOF_QUALITY 2
|
||||
|
||||
#define VARIABLE_PITCH 2
|
||||
|
||||
#define RGN_AND 1
|
||||
#define RGN_OR 2
|
||||
#define RGN_DIFF 4
|
||||
#define RGN_COPY 5
|
||||
|
||||
#define RDH_RECTANGLES 1
|
||||
|
||||
#define MAXLONG 0x7fffffff
|
||||
|
||||
// define GUID
|
||||
#include <bfc/platform/guid.h>
|
||||
|
||||
#endif /* not WIN32 */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef __cplusplus
|
||||
#include <new>
|
||||
#else
|
||||
#include <new.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#define OSPIPE HANDLE
|
||||
#define OSPROCESSID int
|
||||
#endif
|
||||
|
||||
// Ode macro keyworkds
|
||||
#define DISPATCH_ // makes a method dispatchable, automatically assigns a free ID (requires Interface)
|
||||
#define DISPATCH(x) // makes a method dispatchable and specifies its ID (not duplicate check, requires Interface)
|
||||
#define NODISPATCH // prevents a method from being dispatched if the class is marked for dispatching by default
|
||||
#define EVENT // marks a method as being an event to which other classes can connect to receive notification (used by Script and DependentItem helpers)
|
||||
#define SCRIPT // exposes a method to script interfaces (requires Script helper)
|
||||
#define IN // Input parameter
|
||||
#define OUT // Output parameter
|
||||
#define INOUT // Input/Output parameter
|
||||
|
||||
#endif
|
78
Src/Plugins/Input/in_wv/wasabi/bfc/platform/types.h
Normal file
78
Src/Plugins/Input/in_wv/wasabi/bfc/platform/types.h
Normal file
@ -0,0 +1,78 @@
|
||||
#ifndef __WASABI_TYPES_H
|
||||
#define __WASABI_TYPES_H
|
||||
|
||||
// first, some standard int types
|
||||
typedef unsigned int UINT;
|
||||
typedef signed int SINT;
|
||||
|
||||
typedef unsigned char UCHAR;
|
||||
typedef signed char SCHAR;
|
||||
|
||||
typedef unsigned long ARGB32;
|
||||
typedef unsigned long RGB32;
|
||||
|
||||
typedef unsigned long ARGB24;
|
||||
typedef unsigned long RGB24;
|
||||
|
||||
typedef unsigned short ARGB16;
|
||||
typedef unsigned short RGB16;
|
||||
|
||||
typedef unsigned long FOURCC;
|
||||
|
||||
#ifndef GUID_DEFINED
|
||||
#define GUID_DEFINED
|
||||
|
||||
typedef struct _GUID
|
||||
{
|
||||
unsigned long Data1;
|
||||
unsigned short Data2;
|
||||
unsigned short Data3;
|
||||
unsigned char Data4[8];
|
||||
} GUID;
|
||||
/*
|
||||
#ifndef _REFCLSID_DEFINED
|
||||
#define REFGUID const GUID &
|
||||
#define _REFCLSID_DEFINED
|
||||
#endif
|
||||
*/
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(__GNUC__)
|
||||
#include <stddef.h>
|
||||
// since windows doesn't have stdint.h
|
||||
typedef unsigned __int64 uint64_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef __int8 int8_t;
|
||||
typedef size_t ssize_t;
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
// this is for GUID == and !=
|
||||
#include <objbase.h>
|
||||
#ifndef GUID_EQUALS_DEFINED
|
||||
#define GUID_EQUALS_DEFINED
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef NULL
|
||||
#undef NULL
|
||||
#endif
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
typedef int intptr_t;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
38
Src/Plugins/Input/in_wv/wasabi/bfc/platform/win32.h
Normal file
38
Src/Plugins/Input/in_wv/wasabi/bfc/platform/win32.h
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef _WIN32_H
|
||||
#define _WIN32_H
|
||||
|
||||
#ifndef WIN32
|
||||
#error this file is only for win32
|
||||
#endif
|
||||
|
||||
#ifndef _PLATFORM_H
|
||||
#error this file should only be included from platform.h
|
||||
#endif
|
||||
|
||||
// this should be the *only* place windows.h gets included!
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifndef _WIN32_WCE
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) // msvc
|
||||
# define WASABIDLLEXPORT __declspec(dllexport)
|
||||
# if _MSC_VER >= 1100
|
||||
# define NOVTABLE __declspec(novtable)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define _TRY __try
|
||||
#define _EXCEPT(x) __except(x)
|
||||
|
||||
#define OSPIPE HANDLE
|
||||
|
||||
|
||||
typedef WCHAR OSFNCHAR;
|
||||
typedef LPWSTR OSFNSTR;
|
||||
typedef LPCWSTR OSFNCSTR;
|
||||
|
||||
#endif
|
11
Src/Plugins/Input/in_wv/wasabi/bfc/std_mkncc.h
Normal file
11
Src/Plugins/Input/in_wv/wasabi/bfc/std_mkncc.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef _STD_MKNCC
|
||||
#define _STD_MKNCC
|
||||
|
||||
// note: this is endian-incompatible with win32's MAKEFOURCC
|
||||
// otoh, it shows up nicely in a debug register ;)
|
||||
|
||||
#define MK4CC(a, b, c, d) ( (((unsigned long)a)<<24)|(((unsigned long)b)<<16)|(((unsigned long)c)<<8)|((unsigned long)d) )
|
||||
#define MK3CC(b, c, d) ( (((unsigned long)b)<<16)|(((unsigned long)c)<<8)|((unsigned long)d) )
|
||||
#define MK2CC(c, d) ( (((unsigned long)c)<<8)|((unsigned long)d) )
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user