You are not logged in.

Read the FAQ and Knowledge Base before posting.
WiFi not emulated and not supported!!
We won't make a 3DS/2DS emulator.



#1 2010-02-13 17:28:07

Digiku
Member
Registered: 2010-01-09
Posts: 1

RealTimeStylus support? (for tablet PCs) -- Looks like a trivial fix

Desmume on a touch-screen tablet PC is a positively awesome idea, but touch events don't register 100% of the time. In fact, I have to scribble on an area to get Desmume to register a single touch -- and this doesn't work when you have to draw letters a la Scribblenauts, or even press buttons on Phoenix Wright. It gets annoying and tiring scribbling on a button, and I'd like Desmume to support RealTimeStylus.

http://msdn.microsoft.com/en-us/library … tylus.aspx

See, what happens on tablets is that there's an "invisible window" layer that captures/manages your touches, and sends WM_LBUTTON events to whichever window you clicked. But since desmume is processor-intensive, it doesn't receive the generated WM_LBUTTON events all the time. NoGBA behaves the same. To circumvent this, you'd add a RealTimeStylus class to the window, so the window handles touch events directly. Therefore, you'd only need to click a DS button once, not scribble.

I tried adding it myself, but I can't figure out C/++ for the life of me (I'm PHP and C#, sorry!) Anybody mind figuring this out?
I think this should be relatively simple -- the basic idea is that RealTimeStylus captures your x and y coordinates and feeds that to ToDSScreenRelativeCoords(x,y,0) and NDS_setTouchPos(x, y) in main.cpp

-----------------------------------------

TL;DR You need at least Windows SDK v6.0. (For my info, I use SDK v7.0)

API Doc: http://msdn.microsoft.com/en-us/library … tylus.aspx

Relevant RealTimeStylus sample: C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\tabletpc\realtimestylusplugin\cpp
More specifically: COMRTSDlg.cpp (can't link, it triggers spam filter)

I think what happens is that you init RealTimeStylus first (line 129), and then you init "plugins" that go into RTS -- starting with PacketFilter. Not sure if CustomRenderer, GestureRecognizer, and DynamicRenderer are needed.

InitPacketFilter (line 234) is inited, at which point you feed it the ClientRect so that pen events aren't recorded outside the window. Then it gets plugged into the "plugin collection"

And that's all I know so far. If someone were to supply me with MFC headers (VS2008 Express doesn't include them, so I can't compile,) I can figure out more smile

Last edited by Digiku (2010-02-13 17:29:44)

Offline

#2 2010-02-13 19:39:58

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 4,930

Re: RealTimeStylus support? (for tablet PCs) -- Looks like a trivial fix

Before wasting too much time on this, you should know that post-0.9.5 the svn received code which is intended to address this. (r3188 and r3189). It works for me in xp tablet edition but I heard it might not be working in windows 7 for some reason. However, lacking a windows 7, I can't test it.

The receipt of WM_LBUTTONDOWN has nothing to do with desmume processor intensiveness. The problem is that windows does not even send the WM_LBUTTONDOWN until it has analyze more stylus data to determine whether it should interpret it as a WM_LBUTTONDOWN event. It will then send a big batch of messages. The code added in r3188 and r3189 is supposed to disable that logic, but for some reason it doesn't always work for other people.

Your approach might work where mine doesn't. Who knows? I think I tried your approach and ran into some problem with it and so ended up doing it the way I did it.

You seem to know a lot about the topic. This would be a good time to learn c++. Come on IRC if you need help.

Offline

Board footer

Powered by FluxBB