It is currently Thu Aug 22, 2019 4:31 pm



Reply to topic  [ 9 posts ] 
 External Plugins 
Author Message
Petrif-Eyed
User avatar

Joined: Sat Sep 17, 2011 9:23 pm
Posts: 2220
Location: Menlo Park, CA
Reply with quote
I have a couple of plugins that I compile locally into the core that I want to distribute separately from the core. CyberVillain, can you give me a quick guide for what I need to do to compile plugins separately and install them into FreePIE?


Wed Jan 30, 2013 9:13 am
Profile
Petrif-Eyed

Joined: Mon Jun 22, 2009 8:36 am
Posts: 2160
Location: Stockholm, Sweden
Reply with quote
Just reference FreePIE.Core.Contracts from your Standalone Plugin project.

You cant Inherit from Plugin cause thats part of the FreePIE.Core.Plugin project.

So instead Implement IPlugin, the rest should just be like doing it from the Core project.

If you want to debug your project change the output path of the class library to the Plugin folder of FreePIE, then choose to start the class libray by using FreePIE.exe (From teh project settings)

Just let me know if you run into problems

_________________
FreePIE
My blog


Wed Jan 30, 2013 5:13 pm
Profile
Petrif-Eyed
User avatar

Joined: Sat Sep 17, 2011 9:23 pm
Posts: 2220
Location: Menlo Park, CA
Reply with quote
How do you install it so that FreePIE recognizes it as a plugin and not just some auxiliary dll ?


Wed Jan 30, 2013 5:34 pm
Profile
Petrif-Eyed

Joined: Mon Jun 22, 2009 8:36 am
Posts: 2160
Location: Stockholm, Sweden
Reply with quote
It will iterate all DLL's in the Plugin folder of FreePIE and look for Classes that implement IPlugin. So other than implementing IPlugin you shouldnt need todo anything.

_________________
FreePIE
My blog


Thu Jan 31, 2013 2:15 am
Profile
Petrif-Eyed

Joined: Mon Jun 22, 2009 8:36 am
Posts: 2160
Location: Stockholm, Sweden
Reply with quote
Did it went well Brantlew?

I updated the Plugin dev doc's with how to debug external plugins

https://github.com/AndersMalmgren/FreeP ... evelopment

_________________
FreePIE
My blog


Mon Feb 11, 2013 6:40 am
Profile
Petrif-Eyed
User avatar

Joined: Sat Sep 17, 2011 9:23 pm
Posts: 2220
Location: Menlo Park, CA
Reply with quote
I haven't tried it yet. I sent adoral84 my interface code to drive his HL2 mod from FreePIE, but I never got the chance to properly separate it from the core. My new duties at Oculus have taken all of my free time away from me. Hopefully he can finish this and offer FreePIE integration as an external plugin.


Mon Feb 11, 2013 8:52 am
Profile
Binocular Vision CONFIRMED!
User avatar

Joined: Wed Mar 31, 2010 3:35 pm
Posts: 273
Location: Thornton, CO USA
Reply with quote
Dumb questions time. These are general external plugins. Please see my Big Button Controller thread for specific dumb questions.

First, an answer. If you have VS express as I do, the option to debug externally is not available. Except that it is if you edit the .csproj.user file. Add this block inside your <Project> element:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<StartAction>Program</StartAction>
<StartProgram>C:\Program Files (x86)\FreePIE\FreePIE.exe</StartProgram>
</PropertyGroup>

Adjust the path of FreePIE.exe as necessary.

1-
If I have an external .dll (which I do) does it also need to be in the plugins directory? If I put it in there, it seems to break FreePIE. Do I need the FreePIE.Contracts.dll in there too? Adding any and/or all of my .dlls (even to debug) breaks FreePIE and it crashes upon launch.

2-
What is the meaning of GetProperty and SetProperty. I see that the properties have an integer indexing system... But what properties? Are "buttons" and "sticks" the properties, or "rumble at 50%"? I have a smattering of buttons and things I would like to make public, but I don't think these count as "properties".

EDIT: Oh, I see... they are for ports and stuff like that. Or default start values or something like that. I don't think I have any of those.

3-
Here's a bit of an odd one. My BBC driver exposes 4 controllers all at once. I was thinking that the plugin would just pass this along and that the script would be responsible for assigning the different players to different joysticks or keyboard commands. I have seen the [] brackets on some controllers to specify an indexed controller. Should I try to use that?

4-
What's the best/most standard way to expose the buttons? Currently, my top level object is a group of controllers, which has 4 controllers in it (see above). That doesn't really matter, except that it puts the buttons several layers down. For example this.bbstate.Player1.Buttons.A Still, I think this is going to be okay. Maybe this isn't a question.

That's it for now. Oh, I think I found a typo in the instructions:
property.Choices.Add(1, "This is option one in dropdown");
should be:
property.Choices.Add("This is option one in dropdown",1);

Right?


Sun Jun 09, 2013 10:58 pm
Profile
Binocular Vision CONFIRMED!
User avatar

Joined: Wed Mar 31, 2010 3:35 pm
Posts: 273
Location: Thornton, CO USA
Reply with quote
5-
Do I need the get/set properties functions if I have no properties? Best to leave them as "return false;"?

6-
My original .dll contains an enum called BButtonState. It's either "pressed" or "released". Will I have trouble referring to the states of this enum in the script? The enum is public. UPDATE: Yep... having trouble with this one. Do I need to somehow pass a reference from within the plugin class? I'm not sure how to do that with enums.

EDIT-
Answered some of my own questions-
Answer 1- I changed the .dll references inside my browser to "copy local: false" and put them in a good location. Not sure if that is the best plan, but it keeps FreePIE from crashing.

Answer 1a- Changing the permissions on the plugin directory seemed to be a bad idea. I'm running VS as root now, so permissions aren't an issue anymore. But open permissions on the plugins directory/contents seems to give FreePIE fits.

Problem 7-
Xbox_BBC shows up as intellisense now, and so does Xbox_BBC.bbstate... but the next layer of objects/properties below are not. Anyway to fix that? Full reference looks like this: Xbox_BBC.bbstate.Player2.Buttons.A.


Sun Jun 09, 2013 11:26 pm
Profile
Petrif-Eyed

Joined: Mon Jun 22, 2009 8:36 am
Posts: 2160
Location: Stockholm, Sweden
Reply with quote
xhonzi wrote:
...


1) I do not think its such good thing debigging from Program files, that folder has special security applied, Its better to copy FreePIE to a seperate folder. Set your build output to \FreePIE\plugins you do not need the contracts dll under plugins, it needs to be on the same lever as FreePIE.exe.

2) If you dont need custom settings for a plugin just let them return false

3) If your plugin needs to be indexed then you have to take this into account, first configure it like
Code:
    [GlobalType(Type = typeof(MyPluginGlobal), IsIndexed = true)]
    public class MyPlugin : IPlugin

Also, give the plugin and pluginglobal better names ;)
Next, your create global method needs to return an array or IList of some sort so that scripts can access it using myglobal[0].property. Look at the Core plugins for help here.

4) The standard way of exposing api level function is to have properties and methods on the plugin global. In current installer version you cant have more than one level of code completion (The script will work however). In next version of FreePIE we will have unlimited levels of code completion (This is to support the new WiiMote plugin). If you have enums and want those to be code completed then you need to mark them with the GlobalEnum attribute.

5) See 2

6) It should work as the Jit compiler will resolve all types, but the code completion in FreePIE wont find them, mark BButtonState with the GlobalEnum attriibute.

1- and 1a) I don know about express but in full version you right click project, Project properties / Build / Output path. Set that to the plugins folder of FreePIE, and do not use the version of FreePIE under program files.

7) As said in point 4 deep levels of code completion is not currently supported, but will be in next version. That said I think you should abstract bbstate and create a indexed plugin (As mentioned in point 3). Keep bbstate hidden from the scrips and have properties and methods on the plugin global as a bridge.


Thanks for finding that Typo, will fix.

_________________
FreePIE
My blog


Mon Jun 10, 2013 1:34 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 9 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by STSoftware.