Ejemplo n.º 1
0
static int load_dll()
{
#ifdef WINDOWS_VERSION
	HMODULE dll = NULL;
#else
	void * dll = NULL;
#endif

	if (dPa_OpenDefaultStream != NULL)
	{
		return 1;
	}

    dll = openDll();

    if (dll)
    {
		dPa_Initialize = (Pa_InitializeProc)getdllproc(dll,"Pa_Initialize");
		dPa_Terminate = (Pa_TerminateProc)getdllproc(dll,"Pa_Terminate");
		dPa_CloseStream = (Pa_CloseStreamProc)getdllproc(dll,"Pa_CloseStream");
		dPa_StartStream = (Pa_StartStreamProc)getdllproc(dll,"Pa_StartStream");
		dPa_OpenDefaultStream = (Pa_OpenDefaultStreamProc)getdllproc(dll,"Pa_OpenDefaultStream");

		if (dPa_Initialize == NULL ||
			dPa_Terminate == NULL ||
			dPa_CloseStream == NULL ||
			dPa_StartStream == NULL ||
			dPa_OpenDefaultStream == NULL)
		{
			dPa_OpenDefaultStream = NULL;
			return -1;
		}
	}
	return 0;	
}
Ejemplo n.º 2
0
PluginChip::PluginChip(DLLHANDLETYPE aDllHandle, const char *aChipname)
{
    memset(&mChipInfo,0,sizeof(mChipInfo));

    dllcreate = (createproc)getdllproc(aDllHandle, "create");
    dllupdate = (updateproc)getdllproc(aDllHandle, "update");
    dllrender = (renderproc)getdllproc(aDllHandle, "render");
    dllcleanup = (cleanupproc)getdllproc(aDllHandle, "cleanup");
    if (dllcreate == NULL ||
        dllupdate == NULL ||
        dllrender == NULL ||
        dllcleanup == NULL ||
        dllcreate(&mChipInfo, aChipname) == 0)
    {
        dllcreate = NULL;
        return;
    }
    
    set(0, 0, mChipInfo.mWidth, mChipInfo.mHeight, mChipInfo.mTooltip);

    int i;
    for (i = 0; i < mChipInfo.mPinCount; i++)
    {
        const char *tt = NULL;
        Pin *p = new Pin;
        mPin.push_back(p);
        if (mChipInfo.mPinTooltips)
            tt = mChipInfo.mPinTooltips[i];
        if (tt == NULL) 
            tt = "-";
        p->set(mChipInfo.mPinCoordinates[i*2+0], mChipInfo.mPinCoordinates[i*2+1], this, tt);
    }
    
    mTexture = 0;
    if (mChipInfo.mTextureFilename)
        mTexture = load_texture((char*)mChipInfo.mTextureFilename);

}