Full (yeah, well) Wiimote Support in FreePIE

Official forum for open source FreePIE discussion and development.
CyberRascal
Two Eyed Hopeful
Posts: 74
Joined: Fri Sep 21, 2012 4:46 am

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by CyberRascal »

Thank you nphage.

Please correct me if I am wrong - it seems that the observed behaviour during the "wiimote not working run" you posted is, chronologically

1) Starting script
2) Wiimote MotionPlus causes no mouse movement for a period of time even though Wiimote is left flat on table
3) Wiimote MotionPlus causes extremely fast and biased mouse movement toward one corner of screen.
4) Mouse stuck in corner until script terminated

Is this correct? :)

It seems from the log that the Wiimote (or the Dolphiimote lib) is recording a sequence of incorrectly large values (~16000 instead of ~8000). We should be able to fix this by ignoring unexpectedly large/small measured values before calibration. This shouldn't break anything for anyone not having issues right now. I'll look into making this happen. I hope you will be willing to try the fix later as well :)

If anyone else wants to record their issue it would still help though, it's not a given that this is the only possible issue.
nphage
One Eyed Hopeful
Posts: 6
Joined: Wed Oct 23, 2013 7:57 pm

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by nphage »

That sounds correct. The period of time corresponding to step 2 in your description doesn't show up in the watch window in FreePIE, so I am guessing that is the calibration period. As soon as numbers appear in the watch window the mouse jumps to the bottom corner of the screen. Something that you don't see in the log files is that the numbers printed to the watch window keep getting more and more negative and are in the negative thousands in seconds.

It is strange that the values change so suddenly. Just speculating but it seems like 16383 is the max value and that somehow FreePIE isn't getting the actual values during calibration sometimes. Something definitely seems to going wrong in the steps prior to whatever line of code starts printing output to the watch window, since it seems to be reading the correct values after this.

If you need me to test anything more let me know. I will try to check in on the forum regularly for a while.
CyberRascal
Two Eyed Hopeful
Posts: 74
Joined: Fri Sep 21, 2012 4:46 am

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by CyberRascal »

Thanks nphage for your help. I have added a small fix to this problem, but since I cannot test if it works, I can't guarantee anything. The fix should ignore the incorrect values in the beginning (hopefully). Please try it and post the resulting files here! :)

Cheers.
You do not have the required permissions to view the files attached to this post.
nphage
One Eyed Hopeful
Posts: 6
Joined: Wed Oct 23, 2013 7:57 pm

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by nphage »

CyberRascal, I tested your version with the fix and everything seems to be working fine now. I tested it five times and it worked all five times. Attached is the log file in case it is of any use to you. Thanks for working to solve this. Now that I can use the program I will have work on some scripts for some games.
wiimote-log.bin.txt
You do not have the required permissions to view the files attached to this post.
CyberRascal
Two Eyed Hopeful
Posts: 74
Joined: Fri Sep 21, 2012 4:46 am

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by CyberRascal »

Thanks, that's great news :) I will make sure the fix is included in the next release of FreePIE. Thank you for your help, glad it worked out for you.
drowhunter
One Eyed Hopeful
Posts: 22
Joined: Tue Jul 08, 2008 4:48 pm

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by drowhunter »

Hi, just discovered FREEPie after buying the RVL-CNT-01 TR wiimote

and the latest version you posted works well (im on the toshiba stack)

however one thing i noticed is that when i connect two wiimotes . it seems to break completely

is this a known issue? because i was able to use two wiimotes in glove pie

keep up the great work!
CyberRascal
Two Eyed Hopeful
Posts: 74
Joined: Fri Sep 21, 2012 4:46 am

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by CyberRascal »

Hello and welcome to FreePIE :)

I believe I tried using multiple wiimotes at some point and that it worked, but I really can't remember... I will try it out and see if there is any problems and if they are easy to fix. I'll get back to you when I've discovered anything.

Cheers!
metronome
Cross Eyed!
Posts: 114
Joined: Sat Mar 16, 2013 12:42 pm

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by metronome »

Hi Cyber, I got your PM, not had a chance to grab my wii mote, the new m+ script works really well... however my comments are,

The original m+ only no nunchuck script seems to have better control however it will only work when moving fast, no response at from slow movements.

Latest m+ script allows for very fine and slow movements, however for some reason I feel that my movements are very less accurate, eg harder to move straight up and down or side to side. I have uploaded my log bin

edit:

The other main issue I have with either script is that the cursor moves in the opposite direction i move my hand, I move up the cursor moves down, I move left it goes right etc, very confusing ;p
You do not have the required permissions to view the files attached to this post.
drowhunter
One Eyed Hopeful
Posts: 22
Joined: Tue Jul 08, 2008 4:48 pm

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by drowhunter »

How hard would it be to add line numbers to the editor
tomgiboney
One Eyed Hopeful
Posts: 43
Joined: Thu Oct 01, 2009 8:53 am
Location: Phoenix, AZ

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by tomgiboney »

Not sure what the issue is, but I can't launch your latest GlovePIE revision (FreePIE-2014-01-11.MotionPlusLogged.WithCalibrationFix.rar from above post).

FreePIE.GUI has stopped working

Problem details:
Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: freepie.exe
Problem Signature 02: 1.4.438.0
Problem Signature 03: 52ed418c
Problem Signature 04: mscorlib
Problem Signature 05: 4.0.30319.18444
Problem Signature 06: 52717edc
Problem Signature 07: 2661
Problem Signature 08: 12
Problem Signature 09: System.Windows.Markup.XamlParse
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

Running on Windows 7 64bit. I'm assumming it's a .NET framework issue, but unsure of what to attempt at this point.

More Info: The version 1.4.433.0 from http://andersmalmgren.github.io/FreePIE/ seems to work fine.
metronome
Cross Eyed!
Posts: 114
Joined: Sat Mar 16, 2013 12:42 pm

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by metronome »

Have you also installed the 32bit versions of the framework? This caught me out the other day when reinstalling my OS
tomgiboney
One Eyed Hopeful
Posts: 43
Joined: Thu Oct 01, 2009 8:53 am
Location: Phoenix, AZ

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by tomgiboney »

metronome wrote:Have you also installed the 32bit versions of the framework? This caught me out the other day when reinstalling my OS
Having issues locating a 32bit version of any of the dot net frameworks... tried the 4.5.1 standalone installer and had the option to 'repair' the install or 'remove' it... chose repair and restarted windows... still no luck
tomgiboney
One Eyed Hopeful
Posts: 43
Joined: Thu Oct 01, 2009 8:53 am
Location: Phoenix, AZ

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by tomgiboney »

So I guess I'm the only one running into this issue? This sounds to be EXACTLY the setup I'd like to utilize with my wiimote & the rift on FPS games... but the immediate crash with the CLR20r3 error makes it impossible to even test. Is there an sdk that everyone has that I am unaware of needing? Please help.
CyberRascal
Two Eyed Hopeful
Posts: 74
Joined: Fri Sep 21, 2012 4:46 am

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by CyberRascal »

Hi tomgiboney!

Are you having problems just starting the program, or starting a Wiimote script inside FreePIE?

It seems that your problem is just starting the program?

If that is the case, I have tried adding a bit more thorough logging to the FreePIE core program in the version attached to this post. It contains all the other fixes in this thread (motionplus calibration).

Please give it a try, and check in the YourUser\AppData\FreePIE\FreePIE.log file if you see any details. The file is appended to, so maybe try deleting it first if it is full of old errors. Or maybe you don't need to do anything; if the errors are already there, just post them here so I can debug further.

If nothing shows upp in that file, we'll have to take some other approach...
You do not have the required permissions to view the files attached to this post.
metronome
Cross Eyed!
Posts: 114
Joined: Sat Mar 16, 2013 12:42 pm

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by metronome »

Oooo new version!
Btw do you know how better the motion+ tracking is compared to normal wii? There are a few guns with the Wiimote built in, or they just gonna be pants because of no motion+?
tomgiboney
One Eyed Hopeful
Posts: 43
Joined: Thu Oct 01, 2009 8:53 am
Location: Phoenix, AZ

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by tomgiboney »

CyberRascal wrote:Hi tomgiboney!

Are you having problems just starting the program, or starting a Wiimote script inside FreePIE?

It seems that your problem is just starting the program? <Yes>

If that is the case, I have tried adding a bit more thorough logging to the FreePIE core program in the version attached to this post. It contains all the other fixes in this thread (motionplus calibration).

Please give it a try, and check in the YourUser\AppData\FreePIE\FreePIE.log file if you see any details. The file is appended to, so maybe try deleting it first if it is full of old errors. Or maybe you don't need to do anything; if the errors are already there, just post them here so I can debug further.

If nothing shows upp in that file, we'll have to take some other approach...
Thank you for your response, CyberRascal!

I just attempted running the latest version you supplied and here are the results:

Immediate crash of the program with this information:
Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: freepie.exe
Problem Signature 02: 1.4.436.0
Problem Signature 03: 532882f8
Problem Signature 04: mscorlib
Problem Signature 05: 4.0.30319.18408
Problem Signature 06: 52310b91
Problem Signature 07: 2661
Problem Signature 08: 12
Problem Signature 09: System.Windows.Markup.XamlParse
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
....

Also, thank you for pointing me to the 'hidden' FreePie folder which I found located at: C:\Users\%username%\AppData\Roaming\FreePIE
There was indeed a log file and here is it's contents:

3/18/2014 8:36:49 PM - An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.:
at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
at System.Reflection.Assembly.LoadFile(String path)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at FreePIE.Core.Plugins.PluginInvoker.ListAllPluginTypes()
at FreePIE.Core.Plugins.PluginInvoker.PopulatePluginSettings()
at FreePIE.Core.Persistence.PersistanceManager.Load()
at FreePIE.GUI.Bootstrap.BootStrapper.Configure()

I am running Windows 7 Pro 64bit with .Net Framework 4.5.1 (latest). I do not have any version of Visual Studio nor do I have any SDK's installed. This setup would more than likely be a 'standard consumer' load of Windows 7 64bit.

Thank you for any and all assistance!

Warm Regards,
Thomas Giboney
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by CyberVillain »

Whats the path that you unpack the release to?
Do you have UAC turned on?
tomgiboney
One Eyed Hopeful
Posts: 43
Joined: Thu Oct 01, 2009 8:53 am
Location: Phoenix, AZ

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by tomgiboney »

CyberVillain wrote:Whats the path that you unpack the release to?
Do you have UAC turned on?
Path = C:\FreePieBeta\FreePIE.exe
UAC is fully off (well, slid down all the way, anyhow)
tomgiboney
One Eyed Hopeful
Posts: 43
Joined: Thu Oct 01, 2009 8:53 am
Location: Phoenix, AZ

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by tomgiboney »

Also, my wii motion plus remote came today... it is a RVL-CNT-01-TR
It's Wii U branded (on the box) and is certainly official Nintendo. I can connect it up and play Dolphin flawlessly.
I did try some GlovePIE scripts (since I cannot seem to get these last test versions of FreePIE to launch) and I can use the buttons and even a nunchuk attached, but the scripts do NOT see that it has a motionplus, so using it as a mouse alternative is obviously not going to work at the moment. :cry:
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by CyberVillain »

An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework.
It looks like the path is not local but on a network?
tomgiboney
One Eyed Hopeful
Posts: 43
Joined: Thu Oct 01, 2009 8:53 am
Location: Phoenix, AZ

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by tomgiboney »

CyberVillain wrote:
An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework.
It looks like the path is not local but on a network?
The path is certainly local, from a folder on my C: drive. Wish it said which assembly it's trying to load from a "network location"...
I think I'll try a fresh Windows 7 load this weekend and see if it works with that, I don't see any other options at this point. Perhaps through installing/uninstalling so much stuff something is broken with .NET *shrug*
CyberRascal
Two Eyed Hopeful
Posts: 74
Joined: Fri Sep 21, 2012 4:46 am

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by CyberRascal »

Let's give it another try, if you are up for it tomgiboney.

Attached to this post is another version of FreePIE, where I've added logging of which file actually fails to load.

Please try it out!
You do not have the required permissions to view the files attached to this post.
tomgiboney
One Eyed Hopeful
Posts: 43
Joined: Thu Oct 01, 2009 8:53 am
Location: Phoenix, AZ

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by tomgiboney »

CyberRascal wrote:Let's give it another try, if you are up for it tomgiboney.

Attached to this post is another version of FreePIE, where I've added logging of which file actually fails to load.

Please try it out!
The log is definitely more detailed :) Hope it helps! And your continued assistance is greatly appreciated!

freepie.log:
3/22/2014 9:09:33 AM - System.IO.FileLoadException - Could not load assembly at: C:\FreePieB\plugins\FreePIE.Core.Plugins.dll:
at FreePIE.Core.Plugins.PluginInvoker.LoadAssembly(String filePath)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at FreePIE.Core.Plugins.PluginInvoker.ListAllPluginTypes()
at FreePIE.Core.Plugins.PluginInvoker.PopulatePluginSettings()
at FreePIE.Core.Persistence.PersistanceManager.Load()
at FreePIE.GUI.Bootstrap.BootStrapper.Configure()
3/22/2014 9:09:33 AM - System.NotSupportedException - An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.:
at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
at System.Reflection.Assembly.LoadFile(String path)
at FreePIE.Core.Plugins.PluginInvoker.LoadAssembly(String filePath)
tomgiboney
One Eyed Hopeful
Posts: 43
Joined: Thu Oct 01, 2009 8:53 am
Location: Phoenix, AZ

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by tomgiboney »

tomgiboney wrote:
CyberRascal wrote:Let's give it another try, if you are up for it tomgiboney.

Attached to this post is another version of FreePIE, where I've added logging of which file actually fails to load.

Please try it out!
The log is definitely more detailed :) Hope it helps! And your continued assistance is greatly appreciated!

freepie.log:
3/22/2014 9:09:33 AM - System.IO.FileLoadException - Could not load assembly at: C:\FreePieB\plugins\FreePIE.Core.Plugins.dll:
at FreePIE.Core.Plugins.PluginInvoker.LoadAssembly(String filePath)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at FreePIE.Core.Plugins.PluginInvoker.ListAllPluginTypes()
at FreePIE.Core.Plugins.PluginInvoker.PopulatePluginSettings()
at FreePIE.Core.Persistence.PersistanceManager.Load()
at FreePIE.GUI.Bootstrap.BootStrapper.Configure()
3/22/2014 9:09:33 AM - System.NotSupportedException - An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.:
at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
at System.Reflection.Assembly.LoadFile(String path)
at FreePIE.Core.Plugins.PluginInvoker.LoadAssembly(String filePath)
---
Well I'll be darned! After looking even closer at this last log file, I realized that the plugin dll couldn't be loaded for some reason, as if it were being blocked. So I actually checked the properties of the .dll file (FreePIE.Core.Plugins.dll) and found on the general tab that IT WAS BEING BLOCKED!! (cause it came from the internet) So I clicked the Unblock button and BAM! It now works!!

Thank you for assisting and I hope this information helps anyone else who may find this to be an issue!

Warm Regards,
Thomas Giboney
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by CyberVillain »

Thanks! We were just about to update this thread with that info :D

It can be fixed if we allow FreePIE to load blocked dll's but I think that is a bit dangerous.
But now when we know whats causing it we can help
tomgiboney
One Eyed Hopeful
Posts: 43
Joined: Thu Oct 01, 2009 8:53 am
Location: Phoenix, AZ

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by tomgiboney »

I've been playing around with the scripts and I must say, it's quite awesome how responsive the 'mouse' is with the wiimote! And no sensor bar required!

BUT... I've been trying very hard to map buttons for Estranged (A Half-Life 2 mod), but I can't seem to understand how to do so. Could you possibly assist in creating a script based off the "wiimote_nunchuck_and_motionplus" script you provided in this topic?

Any help is greatly appreciated!!
tomgiboney
One Eyed Hopeful
Posts: 43
Joined: Thu Oct 01, 2009 8:53 am
Location: Phoenix, AZ

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by tomgiboney »

So, I've been able to get the buttons on the wiimote mapped, here's my modified script-in-progress:
---
EDIT: moved to attached .txt file
---
I have a few questions:

1) I had to change wiimote[0].buttons.button_down to button_pressed so that it would only trigger the mapped mouse/keyboard key ONCE, with button_down it repeats the key many times a second. How could I make it so for instance, as long as the B button is held down, it also 'holds' down the left mouse button? This could allow for drag and drop in windows as well as highlighting blocks of text.

2) In the example above, how could I map 'mouse wheel scroll up' with a wiimote button? I could only find mappings for left, middle, and right mouse buttons (0,1,2)

3) I have a 'chinese knock-off' nunchuck and I don't believe it's being seen by FreePie. I tried the 'wiimote_nunchuck_and_motionplus' script, but in the 'watch' window I only get the values of the wiimote, and the Z button does not activate the left mouse button. Just wanted to bring that to light, an 'official' first-party nunchuck may be required I'm assuming. I'll have to pick up an official one and retest soon.
You do not have the required permissions to view the files attached to this post.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by CyberVillain »

1) So basicly you want to forward the wiimote button state to the mouse button state, its done like
mouse.leftButton = wiimote[0].buttons.button_down(WiimoteButtons.A)
2) Currently its not possible to read or write mouse wheel data, its coming in next release which is around the cornor
mouse.wheelUp = wiimote[0].buttons.button_down(WiimoteButtons.A)
3) CyberRascal will have to get back to you on this one
tomgiboney
One Eyed Hopeful
Posts: 43
Joined: Thu Oct 01, 2009 8:53 am
Location: Phoenix, AZ

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by tomgiboney »

CyberVillain wrote:1) So basicly you want to forward the wiimote button state to the mouse button state, its done like
mouse.leftButton = wiimote[0].buttons.button_down(WiimoteButtons.A)
2) Currently its not possible to read or write mouse wheel data, its coming in next release which is around the cornor
mouse.wheelUp = wiimote[0].buttons.button_down(WiimoteButtons.A)
3) CyberRascal will have to get back to you on this one
Thanks CyberVillain! ... Much easier to map mouse buttons to wiimote buttons using that method(#1)!! Is there an easier way to map keyboard keys in the same vane? I've tried several different ways and get all sorts of different errors, but rather than post them all, I'd just like to ask the proper way (if there is one). The method in my work in progress script works, but it very quickly repeats the key the button is mapped to, instead of a 'hold button down' = 'hold key down'.

Looking forward to the mouse.wheelUp/down functionality!
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by CyberVillain »

its done like

Code: Select all

keyboard.setKey(Key.A, wiimote[0].buttons.button_down(WiimoteButtons.A))
The same synstax is possible with the mouse

Code: Select all

mouse.setButton(0, wiimote[0].buttons.button_down(WiimoteButtons.A))
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by CyberVillain »

About your #3 have you turned on the Motionplus capability from script?

Like

Code: Select all

wiimote[0].enable(WiimoteCapabilities.MotionPlus)
drowhunter
One Eyed Hopeful
Posts: 22
Joined: Tue Jul 08, 2008 4:48 pm

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by drowhunter »

hello been a while since i posted

i just thought id share something i discovered with the calibration of the accelerometers.

It seems that when you start the script the wiimote and nunchuck take their current position as the neutral point. this causes a problem because lets say your nunchuck is lying on its side when you start the script. Up is no longer up.

i noticed that i could tell which axis was aligned with gravity by which pair of axes had the least amount of difference between them

for example

when the nunchuck is lying on its side the values for (x,y,z) are (711,517,561) you can tell its on its side because y and z are close together and x has the gravity applied to it.

here is the modified TakeAcceleration Code that takes this into account. I have been using it for a while now and up is always up regardless of the initial position when calibrated

this can be used in the method TakeAccelerationCalibrationSnapshot and TakeNunchuckAccelerationCalibrationSnapshot

Code: Select all

double offset, gravity;

            var diffs = new List<double>() { Math.Abs(y - z), Math.Abs(x - z), Math.Abs(x - y) };

            //figure out which pair of axes has the smallest difference, the remaining one is the one facing gravity
            int smallestDiff = diffs.IndexOf(diffs.Min());

            switch(smallestDiff)
            {
                case 0:
                    offset = (y + z) / 2d;
                    gravity = x - offset;  // x aligned with gravity  (control lying on left/right side)
                break;
                case 1:
                    offset = (x + z) / 2d;
                    gravity = y - offset;  //y aligned with gravity (control facing up toward ceiling or down to floor)
                    break;
                default:
                    offset = (x + y) / 2d;
                    gravity = z - offset;  //z aligned with gravity (control lying in ideal position with buttons facing up on table, or upside down with buttons on table)
                    break;
            } 

            NunchuckAcceleration = new LinearCalibration(9.81 / gravity, offset);
try it for your self and see. It makes a big difference because you dont need to sit there holding the nunchuck straight when you start the script
Last edited by drowhunter on Mon Apr 14, 2014 3:36 pm, edited 1 time in total.
CyberRascal
Two Eyed Hopeful
Posts: 74
Joined: Fri Sep 21, 2012 4:46 am

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by CyberRascal »

Thanks! I will include it and try it out :)

I am glad you managed to navigate the Wiimote code :D

I'll make sure this is included in the next release.

PS. Sorry for late reply
metronome
Cross Eyed!
Posts: 114
Joined: Sat Mar 16, 2013 12:42 pm

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by metronome »

can't wait to try out next release :)
HunterZ
One Eyed Hopeful
Posts: 3
Joined: Sat May 10, 2014 11:07 pm

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by HunterZ »

Is it possible to use something like FreePIE+vjoy to enable me to use a wiimote w/classic controller pro as an 11-button, 2-axis, 1-pov gamepad in Windows 7 x64?

I already do this with GlovePIE+ppjoy, but those tools are old and flaky, so I was hoping that their successors have achieved the same capabilities.

Thanks!
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by CyberVillain »

Yes its possible. We have full vJoy support.
HunterZ
One Eyed Hopeful
Posts: 3
Joined: Sat May 10, 2014 11:07 pm

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by HunterZ »

Is there some documentation or example on scripting for the classic controller?
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by CyberVillain »

Ah, sorry missed the classic controller requirement. We don't have that yet. But it's in the works. The code is committed to Github. Should make it, to the next version.
metronome
Cross Eyed!
Posts: 114
Joined: Sat Mar 16, 2013 12:42 pm

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by metronome »

How is this all going? :) Btw are there any games out there that split the weapon tracking from viewing? Didn't the Wii have a few games where the gun aiming was very independent?
HunterZ
One Eyed Hopeful
Posts: 3
Joined: Sat May 10, 2014 11:07 pm

Re: Full (yeah, well) Wiimote Support in FreePIE

Post by HunterZ »

I ended up using Wiinupro+vJoy to get Wiimote+Classic Controller Pro working: http://gbatemp.net/threads/wiinupro-pro ... ad.348537/
Post Reply

Return to “FreePIE”