static int LoadPAD2plugin(const char *PAD2dll) { void *drv; hPAD2Driver = SysLoadLibrary(PAD2dll); if (hPAD2Driver == NULL) { PAD2_configure = NULL; SysMessage (_("Could not load Controller 2 plugin %s!\n%s"), PAD2dll, SysLibError()); return -1; } drv = hPAD2Driver; LoadPad2Sym1(init, "PADinit"); LoadPad2Sym1(shutdown, "PADshutdown"); LoadPad2Sym1(open, "PADopen"); LoadPad2Sym1(close, "PADclose"); LoadPad2Sym0(query, "PADquery"); LoadPad2Sym1(readPort2, "PADreadPort2"); LoadPad2Sym0(configure, "PADconfigure"); LoadPad2Sym0(test, "PADtest"); LoadPad2Sym0(about, "PADabout"); LoadPad2Sym0(keypressed, "PADkeypressed"); LoadPad2Sym0(startPoll, "PADstartPoll"); LoadPad2Sym0(poll, "PADpoll"); LoadPad2SymN(setSensitive, "PADsetSensitive"); LoadPad2Sym0(registerVibration, "PADregisterVibration"); LoadPad2Sym0(registerCursor, "PADregisterCursor"); return 0; }
static int LoadSPUplugin(const char *SPUdll) { void *drv; hSPUDriver = SysLoadLibrary(SPUdll); if (hSPUDriver == NULL) { SPU_configure = NULL; SysMessage (_("Could not load SPU plugin %s!\n%s"), SPUdll, SysLibError()); return -1; } drv = hSPUDriver; LoadSpuSym1(init, "SPUinit"); LoadSpuSym1(shutdown, "SPUshutdown"); LoadSpuSym1(open, "SPUopen"); LoadSpuSym1(close, "SPUclose"); LoadSpuSym0(configure, "SPUconfigure"); LoadSpuSym0(about, "SPUabout"); LoadSpuSym0(test, "SPUtest"); LoadSpuSym1(writeRegister, "SPUwriteRegister"); LoadSpuSym1(readRegister, "SPUreadRegister"); LoadSpuSym1(writeDMA, "SPUwriteDMA"); LoadSpuSym1(readDMA, "SPUreadDMA"); LoadSpuSym1(writeDMAMem, "SPUwriteDMAMem"); LoadSpuSym1(readDMAMem, "SPUreadDMAMem"); LoadSpuSym1(playADPCMchannel, "SPUplayADPCMchannel"); LoadSpuSym1(freeze, "SPUfreeze"); LoadSpuSym1(registerCallback, "SPUregisterCallback"); LoadSpuSymN(async, "SPUasync"); LoadSpuSymN(playCDDAchannel, "SPUplayCDDAchannel"); return 0; }
static int LoadNETplugin(const char *NETdll) { void *drv; hNETDriver = SysLoadLibrary(NETdll); if (hNETDriver == NULL) { SysMessage (_("Could not load NetPlay plugin %s!\n%s"), NETdll, SysLibError()); return -1; } drv = hNETDriver; LoadNetSym1(init, "NETinit"); LoadNetSym1(shutdown, "NETshutdown"); LoadNetSym1(open, "NETopen"); LoadNetSym1(close, "NETclose"); LoadNetSymN(sendData, "NETsendData"); LoadNetSymN(recvData, "NETrecvData"); LoadNetSym1(sendPadData, "NETsendPadData"); LoadNetSym1(recvPadData, "NETrecvPadData"); LoadNetSym1(queryPlayer, "NETqueryPlayer"); LoadNetSym1(pause, "NETpause"); LoadNetSym1(resume, "NETresume"); LoadNetSym0(setInfo, "NETsetInfo"); LoadNetSym0(keypressed, "NETkeypressed"); LoadNetSym0(configure, "NETconfigure"); LoadNetSym0(test, "NETtest"); LoadNetSym0(about, "NETabout"); return 0; }
static int LoadSIO1plugin(const char *SIO1dll) { void *drv; hSIO1Driver = SysLoadLibrary(SIO1dll); if (hSIO1Driver == NULL) { SysMessage (_("Could not load SIO1 plugin %s!\n%s"), SIO1dll, SysLibError()); return -1; } drv = hSIO1Driver; LoadSio1Sym0(init, "SIO1init"); LoadSio1Sym0(shutdown, "SIO1shutdown"); LoadSio1Sym0(open, "SIO1open"); LoadSio1Sym0(close, "SIO1close"); LoadSio1Sym0(pause, "SIO1pause"); LoadSio1Sym0(resume, "SIO1resume"); LoadSio1Sym0(keypressed, "SIO1keypressed"); LoadSio1Sym0(configure, "SIO1configure"); LoadSio1Sym0(test, "SIO1test"); LoadSio1Sym0(about, "SIO1about"); LoadSio1Sym0(writeData8, "SIO1writeData8"); LoadSio1Sym0(writeData16, "SIO1writeData16"); LoadSio1Sym0(writeData32, "SIO1writeData32"); LoadSio1Sym0(writeStat16, "SIO1writeStat16"); LoadSio1Sym0(writeStat32, "SIO1writeStat32"); LoadSio1Sym0(writeMode16, "SIO1writeMode16"); LoadSio1Sym0(writeMode32, "SIO1writeMode32"); LoadSio1Sym0(writeCtrl16, "SIO1writeCtrl16"); LoadSio1Sym0(writeCtrl32, "SIO1writeCtrl32"); LoadSio1Sym0(writeBaud16, "SIO1writeBaud16"); LoadSio1Sym0(writeBaud32, "SIO1writeBaud32"); LoadSio1Sym0(readData8, "SIO1readData8"); LoadSio1Sym0(readData16, "SIO1readData16"); LoadSio1Sym0(readData32, "SIO1readData32"); LoadSio1Sym0(readStat16, "SIO1readStat16"); LoadSio1Sym0(readStat32, "SIO1readStat32"); LoadSio1Sym0(readMode16, "SIO1readMode16"); LoadSio1Sym0(readMode32, "SIO1readMode32"); LoadSio1Sym0(readCtrl16, "SIO1readCtrl16"); LoadSio1Sym0(readCtrl32, "SIO1readCtrl32"); LoadSio1Sym0(readBaud16, "SIO1readBaud16"); LoadSio1Sym0(readBaud32, "SIO1readBaud32"); LoadSio1Sym0(update, "SIO1update"); LoadSio1Sym0(registerCallback, "SIO1registerCallback"); return 0; }
static int LoadGPUplugin(const char *GPUdll) { void *drv; hGPUDriver = SysLoadLibrary(GPUdll); if (hGPUDriver == NULL) { GPU_configure = NULL; SysMessage (_("Could not load GPU plugin %s!\n%s"), GPUdll, SysLibError()); return -1; } drv = hGPUDriver; LoadGpuSym1(init, "GPUinit"); LoadGpuSym1(shutdown, "GPUshutdown"); LoadGpuSym1(open, "GPUopen"); LoadGpuSym1(close, "GPUclose"); LoadGpuSym1(readData, "GPUreadData"); LoadGpuSym1(readDataMem, "GPUreadDataMem"); LoadGpuSym1(readStatus, "GPUreadStatus"); LoadGpuSym1(writeData, "GPUwriteData"); LoadGpuSym1(writeDataMem, "GPUwriteDataMem"); LoadGpuSym1(writeStatus, "GPUwriteStatus"); LoadGpuSym1(dmaChain, "GPUdmaChain"); LoadGpuSym1(updateLace, "GPUupdateLace"); LoadGpuSym0(keypressed, "GPUkeypressed"); LoadGpuSym0(displayText, "GPUdisplayText"); LoadGpuSym0(makeSnapshot, "GPUmakeSnapshot"); LoadGpuSym1(freeze, "GPUfreeze"); LoadGpuSym0(getScreenPic, "GPUgetScreenPic"); LoadGpuSym0(showScreenPic, "GPUshowScreenPic"); LoadGpuSym0(clearDynarec, "GPUclearDynarec"); LoadGpuSym0(hSync, "GPUhSync"); LoadGpuSym0(vBlank, "GPUvBlank"); LoadGpuSym0(visualVibration, "GPUvisualVibration"); LoadGpuSym0(cursor, "GPUcursor"); LoadGpuSym0(addVertex, "GPUaddVertex"); LoadGpuSym0(configure, "GPUconfigure"); LoadGpuSym0(test, "GPUtest"); LoadGpuSym0(about, "GPUabout"); return 0; }
static int LoadCDRplugin(const char *CDRdll) { void *drv; if (CDRdll == NULL) { cdrIsoInit(); return 0; } hCDRDriver = SysLoadLibrary(CDRdll); if (hCDRDriver == NULL) { CDR_configure = NULL; SysMessage (_("Could not load CD-ROM plugin %s!\n%s"), CDRdll, SysLibError()); return -1; } drv = hCDRDriver; LoadCdrSym1(init, "CDRinit"); LoadCdrSym1(shutdown, "CDRshutdown"); LoadCdrSym1(open, "CDRopen"); LoadCdrSym1(close, "CDRclose"); LoadCdrSym1(getTN, "CDRgetTN"); LoadCdrSym1(getTD, "CDRgetTD"); LoadCdrSym1(readTrack, "CDRreadTrack"); LoadCdrSym1(getBuffer, "CDRgetBuffer"); LoadCdrSym1(getBufferSub, "CDRgetBufferSub"); LoadCdrSym0(play, "CDRplay"); LoadCdrSym0(stop, "CDRstop"); LoadCdrSym0(getStatus, "CDRgetStatus"); LoadCdrSym0(getDriveLetter, "CDRgetDriveLetter"); LoadCdrSym0(configure, "CDRconfigure"); LoadCdrSym0(test, "CDRtest"); LoadCdrSym0(about, "CDRabout"); LoadCdrSym0(setfilename, "CDRsetfilename"); LoadCdrSymN(readCDDA, "CDRreadCDDA"); LoadCdrSymN(getTE, "CDRgetTE"); return 0; }
int LoadPlugins() { int ret; char Plugin[MAXPATHLEN]; ReleasePlugins(); SysLibError(); if (UsingIso()) { LoadCDRplugin(NULL); } else { sprintf(Plugin, "%s/%s", Config.PluginsDir, Config.Cdr); if (LoadCDRplugin(Plugin) == -1) return -1; } sprintf(Plugin, "%s/%s", Config.PluginsDir, Config.Gpu); if (LoadGPUplugin(Plugin) == -1) return -1; sprintf(Plugin, "%s/%s", Config.PluginsDir, Config.Spu); if (LoadSPUplugin(Plugin) == -1) return -1; sprintf(Plugin, "%s/%s", Config.PluginsDir, Config.Pad1); if (LoadPAD1plugin(Plugin) == -1) return -1; sprintf(Plugin, "%s/%s", Config.PluginsDir, Config.Pad2); if (LoadPAD2plugin(Plugin) == -1) return -1; if (strcmp("Disabled", Config.Net) == 0 || strcmp("", Config.Net) == 0) Config.UseNet = FALSE; else { Config.UseNet = TRUE; sprintf(Plugin, "%s/%s", Config.PluginsDir, Config.Net); if (LoadNETplugin(Plugin) == -1) Config.UseNet = FALSE; } #ifdef ENABLE_SIO1API sprintf(Plugin, "%s/%s", Config.PluginsDir, Config.Sio1); if (LoadSIO1plugin(Plugin) == -1) return -1; #endif ret = CDR_init(); if (ret < 0) { SysMessage (_("Error initializing CD-ROM plugin: %d"), ret); return -1; } ret = GPU_init(); if (ret < 0) { SysMessage (_("Error initializing GPU plugin: %d"), ret); return -1; } ret = SPU_init(); if (ret < 0) { SysMessage (_("Error initializing SPU plugin: %d"), ret); return -1; } ret = PAD1_init(1); if (ret < 0) { SysMessage (_("Error initializing Controller 1 plugin: %d"), ret); return -1; } ret = PAD2_init(2); if (ret < 0) { SysMessage (_("Error initializing Controller 2 plugin: %d"), ret); return -1; } if (Config.UseNet) { ret = NET_init(); if (ret < 0) { SysMessage (_("Error initializing NetPlay plugin: %d"), ret); return -1; } } #ifdef ENABLE_SIO1API ret = SIO1_init(); if (ret < 0) { SysMessage (_("Error initializing SIO1 plugin: %d"), ret); return -1; } #endif SysPrintf(_("Plugins loaded.\n")); return 0; }