Some help with developing plugin

Jan 21, 2012 at 5:58 PM
Edited Jan 21, 2012 at 5:59 PM


First of all, PCSX (Reloaded) is an awesome project! Thanks for some great work!

Second, I'm developing a plugin for PCSX and have some questions which I hope someone has an answer(s) to. 

So the blunt idea is to let controllers be connect over TCP, and so I have chosen Mongoose as a small HTTP server to work with.

I have set up a gcc compiler environment under Windows and am using the psemu_plugin_defs.h file to fill the shared library with functions. However, as it currently stands (and I have no real knowledge of the way controllers work in PCSX) my demo keeps crashing on the point where I click Ok in the configscreen. My demo consists of nothing much, it just wants to be excepted as a plugin (puberty). 

I have looked through the controller plugin deliverd with the PCSX source, but I don't really see whats significantly different. But it could be me being blind.. I have removed any config saving feature, so I'm thinking that might be it. I looked through the PCSX source and that seems to be about the only thing called on Ok click.

So, any help would be great.

And if you're wondering why I'm developing a controller plugin over TCP, it's a secret! :D Not meant for playing online though, can say that.

Jan 22, 2012 at 1:39 PM
Edited Jan 22, 2012 at 1:40 PM

It seems to crash on PAD_init according to the debugger. 

Which is simply this:

long PADinit(long flags) {


Error : Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call.  This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.



Jan 22, 2012 at 3:49 PM

long CALLBACK PADinit (long flags)

Jan 22, 2012 at 3:55 PM

CALLBACK is not being recognized, do I need to include some file for this?

Jan 22, 2012 at 4:13 PM

extern "C" __attribute__ ((dllexport)) long PADinit (long flags)

Jan 22, 2012 at 5:13 PM

I tried

__attribute__ ((__stdcall__)) char* PSEgetLibName(void) { return _("PSX-U");}

__attribute__ ((dllexport)) char* PSEgetLibName(void) { return _("PSX-U");}
extern __attribute__ ((__stdcall__)) char* PSEgetLibName(void) { return _("PSX-U");}
extern __attribute__ ((dllexport)) char* PSEgetLibName(void) { return _("PSX-U");}

All keep giving the same error.

These are my make commands:


MINGWOPT= -W -Wall -mthreads -Wl,--subsystem,windows $(MINGWDBG)

gcc $(MINGWOPT) mongoose.c main.c win32\res.o -lws2_32 -ladvapi32 \ -o $(PROG).exe

Jan 23, 2012 at 12:17 AM
Edited Jan 23, 2012 at 12:34 AM

try using dllwrap instead of linking directly for mingw

Jan 23, 2012 at 7:00 PM

Passing  -Wl,--add-stdcall-alias did the job while using stdcall.

Jan 25, 2012 at 8:57 AM

Is there a psemu plugin defs .h with the latest functions in the comments? In other words, I need to find the functions and variables which I can use in my controllerplugin, which I used to read from the comments in psemu plugin defs .h, but there seem to be standards which haven't been documented in the SVN version.

Jan 25, 2012 at 10:57 AM

Also, since I'm new to this; is it feasable to port PCSX2's multitap support to PCSX(1)? Or is multitap support added already?