New plugin API and onepad linux plugin
#1
Hi,

I am a long time pcsx2 user and I switched to linux while ago. I was very disappointed with the lack of 4/8 pad support by OnePad linux plugin (the only one I could compile), so I added it and it works quite well (i played an entire WE10 season with no problems), but, before release it, i was tempted by adding direct support for the menu checkbox "Multitap 1/2" which is handled by MainEmuFrame::Menu_MultitapToggle_Click (by load/applying/saving VM settings). After a while, i couldn't find out the "new plugin api" and added just an old legacy api for setting into the plugin space the multitap status, but it's very dirty and I don't want to pull request it. I was going to ask into the developers forum but i can't post a new thread.

So, is there any kind of documentation for the new plugin API? How I could get the values g_Conf->EmuOptions.MultitapPort0/1_Enabled directly from the plugin. I understand you are transitioning toward an adapter/listener interface in AppCorePlugins object, but still could not manage to find an example.

Thanks in advance for your help

P.S. I also enabled the plugin to map more than one controller on the same keyboard, in order to test it properly

UPDATE: i uploaded the code on https://github.com/aerisarn/pcsx2 if anyone could review

Build: Ubuntu 14.04 32bit binaries (executable + plugins): http://www15.zippyshare.com/v/86248632/file.html
Reply

Sponsored links

#2
What do you mean by new plugin API ?

Here the pad plugin current API.
Code:
static const LegacyApi_ReqMethod s_MethMessReq_PAD[] =
{
    {    "PADopen",            (vMeth**)&PADopen,        NULL },
    {    "PADstartPoll",        (vMeth**)&PADstartPoll,    NULL },
    {    "PADpoll",            (vMeth**)&PADpoll,        NULL },
    {    "PADquery",            (vMeth**)&PADquery,        NULL },
    {    "PADkeyEvent",        (vMeth**)&PADkeyEvent,    NULL },

    // fixme - Following functions are new as of some revison post-0.9.6, and
    // are for multitap support only.  They should either be optional or offer
    // NOP fallbacks, to allow older plugins to retain functionality.
    {    "PADsetSlot",        (vMeth**)&PADsetSlot,    (vMeth*)PAD_setSlot },
    {    "PADqueryMtap",        (vMeth**)&PADqueryMtap,    (vMeth*)PAD_queryMtap },
    { NULL },
};

I guess you need to implement PADsetSlot to support multi tap

Edit: if you mean the new API comment vs legacy API. Forget it, it isn't going to happen soon. The guy which start the work left the project few years ago. We are currently understaffed....
Reply
#3
(08-05-2014, 09:39 PM)gregory Wrote: What do you mean by new plugin API ?

Here the pad plugin current API.
Code:
static const LegacyApi_ReqMethod s_MethMessReq_PAD[] =
{
    {    "PADopen",            (vMeth**)&PADopen,        NULL },
    {    "PADstartPoll",        (vMeth**)&PADstartPoll,    NULL },
    {    "PADpoll",            (vMeth**)&PADpoll,        NULL },
    {    "PADquery",            (vMeth**)&PADquery,        NULL },
    {    "PADkeyEvent",        (vMeth**)&PADkeyEvent,    NULL },

    // fixme - Following functions are new as of some revison post-0.9.6, and
    // are for multitap support only.  They should either be optional or offer
    // NOP fallbacks, to allow older plugins to retain functionality.
    {    "PADsetSlot",        (vMeth**)&PADsetSlot,    (vMeth*)PAD_setSlot },
    {    "PADqueryMtap",        (vMeth**)&PADqueryMtap,    (vMeth*)PAD_queryMtap },
    { NULL },
};

I guess you need to implement PADsetSlot to support multi tap

Edit: if you mean the new API comment vs legacy API. Forget it, it isn't going to happen soon. The guy which start the work left the project few years ago. We are currently understaffed....

hmmm... not quite the point. The multitap itself is emulated and works well, the problem is getting the EmuOptions flags as they are embedded into the memory card / main frame logic. I found no way to get those booleans, so I added a "legacy" callback

Code:
typedef s32 (CALLBACK* _PADsetSlot)(u8 port, u8 slot);
typedef s32 (CALLBACK* _PADqueryMtap)(u8 port);
+typedef void (CALLBACK* _PADenableMtap)(u8 port, u8 enable);
typedef void (CALLBACK* _PADWriteEvent)(keyEvent &evt);

That function gets called by the App logic when the user selects multitap, by using this hack:

pcsx2/gui/AppCorePlugins.cpp

Code:
232,8 +232,16 @@ void AppCorePlugins::Load( PluginsEnum_t pid, const wxString& srcfile )
wxGetApp().ProcessAction( evt);
return;
}
-    
+
_parent::Load( pid, srcfile );
+
+ //dirty hack to set multitap status until new plugin API
+ //in order to reflect main gui multitap status with
+ //initial plugin internal status
+ switch (pid) {
+ case PluginId_PAD: sApp.SetPluginMultitapStatus(); break;
+ default: break;
+ }
}
Reply




Users browsing this thread: 1 Guest(s)