}
plugins_opened = 1;
- NetOpened = 0;
if (OpenPlugins() == -1)
{
strcpy(Config.Spu, "builtin_spu");
strcpy(Config.Pad1, "builtin_pad");
strcpy(Config.Pad2, "builtin_pad");
- strcpy(Config.Net, "Disabled");
}
void emu_set_default_config(void)
set_cd_image(cdimg);
LoadPlugins();
pcnt_hook_plugins();
- NetOpened = 0;
if (OpenPlugins() == -1) {
menu_update_msg("failed to open plugins");
return -1;
return 0;
}
-// NET Function Helpers
-
-int SendPcsxInfo() {
- if (NET_recvData == NULL || NET_sendData == NULL)
- return 0;
-
- boolean Sio_old = 0;
- boolean SpuIrq_old = 0;
- boolean RCntFix_old = 0;
- NET_sendData(&Config.Xa, sizeof(Config.Xa), PSE_NET_BLOCKING);
- NET_sendData(&Sio_old, sizeof(Sio_old), PSE_NET_BLOCKING);
- NET_sendData(&SpuIrq_old, sizeof(SpuIrq_old), PSE_NET_BLOCKING);
- NET_sendData(&RCntFix_old, sizeof(RCntFix_old), PSE_NET_BLOCKING);
- NET_sendData(&Config.PsxType, sizeof(Config.PsxType), PSE_NET_BLOCKING);
- NET_sendData(&Config.Cpu, sizeof(Config.Cpu), PSE_NET_BLOCKING);
-
- return 0;
-}
-
-int RecvPcsxInfo() {
- int tmp;
-
- if (NET_recvData == NULL || NET_sendData == NULL)
- return 0;
-
- boolean Sio_old = 0;
- boolean SpuIrq_old = 0;
- boolean RCntFix_old = 0;
- NET_recvData(&Config.Xa, sizeof(Config.Xa), PSE_NET_BLOCKING);
- NET_recvData(&Sio_old, sizeof(Sio_old), PSE_NET_BLOCKING);
- NET_recvData(&SpuIrq_old, sizeof(SpuIrq_old), PSE_NET_BLOCKING);
- NET_recvData(&RCntFix_old, sizeof(RCntFix_old), PSE_NET_BLOCKING);
- NET_recvData(&Config.PsxType, sizeof(Config.PsxType), PSE_NET_BLOCKING);
-
- tmp = Config.Cpu;
- NET_recvData(&Config.Cpu, sizeof(Config.Cpu), PSE_NET_BLOCKING);
- if (tmp != Config.Cpu) {
- psxCpu->Shutdown();
-#ifndef DRC_DISABLE
- if (Config.Cpu == CPU_INTERPRETER) psxCpu = &psxInt;
- else psxCpu = &psxRec;
-#else
- psxCpu = &psxInt;
-#endif
- if (psxCpu->Init() == -1) {
- SysClose(); return -1;
- }
- psxCpu->Reset();
- psxCpu->Notify(R3000ACPU_NOTIFY_AFTER_LOAD, NULL);
- }
-
- return 0;
-}
-
// remove the leading and trailing spaces in a string
void trim(char *str) {
int pos = 0;
int LoadState(const char *file);
int CheckState(const char *file);
-int SendPcsxInfo();
-int RecvPcsxInfo();
-
void trim(char *str);
u16 calcCrc(const u8 *d, int len);
PADpoll PAD2_poll;
PADsetSensitive PAD2_setSensitive;
-NETinit NET_init;
-NETshutdown NET_shutdown;
-NETopen NET_open;
-NETclose NET_close;
-NETtest NET_test;
-NETconfigure NET_configure;
-NETabout NET_about;
-NETpause NET_pause;
-NETresume NET_resume;
-NETqueryPlayer NET_queryPlayer;
-NETsendData NET_sendData;
-NETrecvData NET_recvData;
-NETsendPadData NET_sendPadData;
-NETrecvPadData NET_recvPadData;
-NETsetInfo NET_setInfo;
-NETkeypressed NET_keypressed;
-
#ifdef ENABLE_SIO1API
SIO1init SIO1_init;
return r;
}
-
-void *hNETDriver = NULL;
-
-void CALLBACK NET__setInfo(netInfo *info) {}
-void CALLBACK NET__keypressed(int key) {}
-long CALLBACK NET__configure(void) { return 0; }
-long CALLBACK NET__test(void) { return 0; }
-void CALLBACK NET__about(void) {}
-
-#define LoadNetSym1(dest, name) \
- LoadSym(NET_##dest, NET##dest, name, TRUE);
-
-#define LoadNetSymN(dest, name) \
- LoadSym(NET_##dest, NET##dest, name, FALSE);
-
-#define LoadNetSym0(dest, name) \
- LoadSym(NET_##dest, NET##dest, name, FALSE); \
- if (NET_##dest == NULL) NET_##dest = (NET##dest) NET__##dest;
-
-static int LoadNETplugin(const char *NETdll) {
- void *drv;
-
- hNETDriver = SysLoadLibrary(NETdll);
- if (hNETDriver == NULL) {
- SysMessage (_("Could not load NetPlay plugin %s!"), NETdll); 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;
-}
-
#ifdef ENABLE_SIO1API
void *hSIO1Driver = NULL;
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;
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; }
}
void ReleasePlugins() {
- if (Config.UseNet) {
- int ret = NET_close();
- if (ret < 0) Config.UseNet = FALSE;
- }
- NetOpened = FALSE;
-
cdra_shutdown();
if (hGPUDriver != NULL) GPU_shutdown();
if (hSPUDriver != NULL) SPU_shutdown();
if (hPAD1Driver != NULL) PAD1_shutdown();
if (hPAD2Driver != NULL) PAD2_shutdown();
- if (Config.UseNet && hNETDriver != NULL) NET_shutdown();
-
if (hGPUDriver != NULL) { SysCloseLibrary(hGPUDriver); hGPUDriver = NULL; }
if (hSPUDriver != NULL) { SysCloseLibrary(hSPUDriver); hSPUDriver = NULL; }
if (hPAD1Driver != NULL) { SysCloseLibrary(hPAD1Driver); hPAD1Driver = NULL; }
if (hPAD2Driver != NULL) { SysCloseLibrary(hPAD2Driver); hPAD2Driver = NULL; }
- if (Config.UseNet && hNETDriver != NULL) {
- SysCloseLibrary(hNETDriver); hNETDriver = NULL;
- }
-
#ifdef ENABLE_SIO1API
if (hSIO1Driver != NULL) {
SIO1_shutdown();
typedef long (CALLBACK *GPUopen)(unsigned long *, char *, char *);\r
typedef long (CALLBACK *SPUopen)(void);\r
typedef long (CALLBACK *PADopen)(unsigned long *);\r
-typedef long (CALLBACK *NETopen)(unsigned long *);\r
typedef long (CALLBACK *SIO1open)(unsigned long *);\r
\r
#include "spu.h"\r
extern PADpoll PAD2_poll;\r
extern PADsetSensitive PAD2_setSensitive;\r
\r
-// NET Functions\r
-typedef long (CALLBACK* NETinit)(void);\r
-typedef long (CALLBACK* NETshutdown)(void);\r
-typedef long (CALLBACK* NETclose)(void);\r
-typedef long (CALLBACK* NETconfigure)(void);\r
-typedef long (CALLBACK* NETtest)(void);\r
-typedef void (CALLBACK* NETabout)(void);\r
-typedef void (CALLBACK* NETpause)(void);\r
-typedef void (CALLBACK* NETresume)(void);\r
-typedef long (CALLBACK* NETqueryPlayer)(void);\r
-typedef long (CALLBACK* NETsendData)(void *, int, int);\r
-typedef long (CALLBACK* NETrecvData)(void *, int, int);\r
-typedef long (CALLBACK* NETsendPadData)(void *, int);\r
-typedef long (CALLBACK* NETrecvPadData)(void *, int);\r
-\r
-typedef struct {\r
- char EmuName[32];\r
- char CdromID[9]; // ie. 'SCPH12345', no \0 trailing character\r
- char CdromLabel[11];\r
- void *psxMem;\r
- PADsetSensitive PAD_setSensitive;\r
- char GPUpath[256]; // paths must be absolute\r
- char SPUpath[256];\r
- char CDRpath[256];\r
- char MCD1path[256];\r
- char MCD2path[256];\r
- char BIOSpath[256]; // 'HLE' for internal bios\r
- char Unused[1024];\r
-} netInfo;\r
-\r
-typedef long (CALLBACK* NETsetInfo)(netInfo *);\r
-typedef long (CALLBACK* NETkeypressed)(int);\r
-\r
-// NET function pointers \r
-extern NETinit NET_init;\r
-extern NETshutdown NET_shutdown;\r
-extern NETopen NET_open;\r
-extern NETclose NET_close; \r
-extern NETtest NET_test;\r
-extern NETconfigure NET_configure;\r
-extern NETabout NET_about;\r
-extern NETpause NET_pause;\r
-extern NETresume NET_resume;\r
-extern NETqueryPlayer NET_queryPlayer;\r
-extern NETsendData NET_sendData;\r
-extern NETrecvData NET_recvData;\r
-extern NETsendPadData NET_sendPadData;\r
-extern NETrecvPadData NET_recvPadData;\r
-extern NETsetInfo NET_setInfo;\r
-extern NETkeypressed NET_keypressed;\r
-\r
#ifdef ENABLE_SIO1API\r
\r
// SIO1 Functions (link cable)\r
char Spu[MAXPATHLEN];
char Pad1[MAXPATHLEN];
char Pad2[MAXPATHLEN];
- char Net[MAXPATHLEN];
char Sio1[MAXPATHLEN];
char Mcd1[MAXPATHLEN];
char Mcd2[MAXPATHLEN];
boolean SlowBoot;
boolean Debug;
boolean PsxOut;
- boolean UseNet;
boolean icache_emulation;
boolean DisableStalls;
boolean PreciseExceptions;
} PcsxConfig;
extern PcsxConfig Config;
-extern boolean NetOpened;
struct PcsxSaveFuncs {
void *(*open)(const char *name, const char *mode);