Author Topic: Vista/XP 64bit Issues w Mouse control in WiimoteWhiteboard0.2 onwards (solved)  (Read 7464 times)

Offline takai

  • *
  • Posts: 27
  • Karma: +0/-0
    • View Profile
Ive been noticing a fair few people having issues with WW0.2 and all the mods based on these. Its always under vista, and involves the mouse control not working but calibration does.

Now the bit which threw me for a while, is that its actually not with Vista, but with Vista64bit. Which im guessing some people dont even know that they are running due to it being preinstalled on their computer.

Anyway, the problem lies in the fact that the pointers in x64 windows are 8bit pointers, rather than 4bit in x32. The INPUT struct is therefore offset by the wrong amount, so the mouse events fall into the "type" bit, and is ignored.

The quick fix for it is to simply replace this code:
Code: [Select]
[StructLayout(LayoutKind.Explicit, Size = 28)]
        public struct INPUT
        {
            [FieldOffset(0)]
            public int type;
            [FieldOffset(4)] //*
            public MOUSEINPUT mi;
            [FieldOffset(4)] //*
            public KEYBDINPUT ki;
            [FieldOffset(4)] //*
            public HARDWAREINPUT hi;
        }
with this
Code: [Select]
[StructLayout(LayoutKind.Explicit, Size = 28)]
        public struct INPUT
        {
            [FieldOffset(0)]
            public int type;
            [FieldOffset(8)] //*
            public MOUSEINPUT mi;
            [FieldOffset(8)] //*
            public KEYBDINPUT ki;
            [FieldOffset(8)] //*
            public HARDWAREINPUT hi;
        }

The longer term solution is a bit more complex, but because of the oddness of C# you cant just declare sizeof(IntPtr), and im trying to figure out a better solution than declaring two structs and using which ever one is appropriate for the platform.
Ill try and figure out a way to modify the struct sizing on load.
« Last Edit: June 10, 2008, 08:46:13 AM by takai »



Offline boonjin

  • *
  • Posts: 929
  • Karma: +28/-0
  • Smoothboard Developer
    • View Profile
    • Smoothboard
That's great!

I will insert your findings into the 0.2 with mouse smoothing soon for vista users.

Thanks for your great analysis :)

Smoothboard
Wii Whiteboard/Wiimote Whiteboard with annotation features and collaborate with multiple iPads and Android Tablets!

Smoothboard for Mac
Using a Mac? Now you can annotate on PowerPoint or Keynote slideshows!

BoonJin[/url


Offline takai

  • *
  • Posts: 27
  • Karma: +0/-0
    • View Profile
The problem is that under 32 bit systems you need a 4bit offset, but 64bit means you need an 8 bit offset. What we need is an easy way to switch between the offsets on the fly. Preferably on init.



Offline takai

  • *
  • Posts: 27
  • Karma: +0/-0
    • View Profile
Doubly solved

Code: [Select]
//[StructLayout(LayoutKind.Explicit, Size = 28)] *make sure you remove this*
        public struct INPUT
        {
            public int type;
            public MOUSEINPUT mi;
        }

Basically im just the LayoutKind and removing all the offsets. Because we only need the mouse control part of this structure C# will automatically calculate the offset on compilation and push the MOUSEINPUT out by 8bits under 64bit.

I just need someone to confirm this under 32bit.



Offline benpaddlejones

  • Support Admin
  • *
  • Posts: 1178
  • Karma: +49/-0
    • View Profile
    • Inter.Connect.Ed
Takai/Boonjin
I'm a 32bit XP user or do you need Vista 32bit?
If you need vista will check with a teacher at school who has just taken the project on with Vista, see if his is 32bit.

benpaddlejones


See my full profile and links on my Google Profile: http://www.google.com/profiles/benpaddlejones


Offline takai

  • *
  • Posts: 27
  • Karma: +0/-0
    • View Profile
Either Vista or XP should work, need the 32bit architecture...



Offline benpaddlejones

  • Support Admin
  • *
  • Posts: 1178
  • Karma: +49/-0
    • View Profile
    • Inter.Connect.Ed
Takai
When Boonjin updates Whiteboard Smoothing will test.

benpaddlejones


See my full profile and links on my Google Profile: http://www.google.com/profiles/benpaddlejones


Offline boonjin

  • *
  • Posts: 929
  • Karma: +28/-0
  • Smoothboard Developer
    • View Profile
    • Smoothboard
takai,
thanks!

I have just updated the Whiteboard 0.2 with smoothing.
Hope that it works 'smoothly' now.. hehe

http://www.wiimoteproject.com/index.php?topic=1007.0

Thanks again to takai!

Smoothboard
Wii Whiteboard/Wiimote Whiteboard with annotation features and collaborate with multiple iPads and Android Tablets!

Smoothboard for Mac
Using a Mac? Now you can annotate on PowerPoint or Keynote slideshows!

BoonJin[/url


Offline andre

  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
I use vista x32 bit, where I can introduce this code?? and Which code I have to introduce?


Thanks.



Offline takai

  • *
  • Posts: 27
  • Karma: +0/-0
    • View Profile
I use vista x32 bit, where I can introduce this code?? and Which code I have to introduce?


Thanks.

Did you actually read anything in this thread. Not only do i say in the original post multiple times that its 64bit specific, but i also say where to insert the code....



Offline andre

  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Pardon my ignorance on this subject, but you see I am doing a school project where I'm using this aplication and I still don't have an advanced level (especially on the specific aplication problems).. I'm trying to get it to function on Vista but I don't know very much.. if it's not much trouble just explain the way to do it as you would to a person who isn't fully specialized on the matter

ty



Offline benpaddlejones

  • Support Admin
  • *
  • Posts: 1178
  • Karma: +49/-0
    • View Profile
    • Inter.Connect.Ed
Andre
Do you have:
a) Wiimote
b) Bluetooth (Internal or USB) Radio
c) IR-Pen
d) Computer (laptop or desktop)

Benpaddlejones :)


See my full profile and links on my Google Profile: http://www.google.com/profiles/benpaddlejones