Potential problem with DInput code, and solution

View: New views
5 Messages — Rating Filter:   Alert me  

Potential problem with DInput code, and solution

by Megan Fox :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

By default, in ndi8server.h, the buffer size is set as follows:

INPUT_BUFFER_SIZE = 128


... in our testing, this is by far too low, and misses a great deal of
input.  By setting the value to 512, all of our lag issues were
removed entirely.

Another issue I corrected at the same time was the addition of the
buffer specification to the Keyboard device code (in
di8EnumDevicesCallback):

        case nDI8Device::KEYBOARD:
            diDev->SetDataFormat(&c_dfDIKeyboard);
            di8SetDWordProp(diDev, DIPROP_BUFFERSIZE,
nDI8Server::INPUT_BUFFER_SIZE);
            break;

... before, nothing was setting the BUFFERSIZE for the keyboard
device, though this could be redundant for all I know.

--
-Megan Fox
Idyllon, LLC
http://shalinor.circustent.us/megan/resume/

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

*** NOTE: To reply to the list use "reply to all",  ***
***       to reply direct to the sender use "reply" ***
_______________________________________________
Nebuladevice-discuss mailing list
Nebuladevice-discuss@...
https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss

Re: Potential problem with DInput code, and solution

by pangu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

thanks megan, i commited your patch it to svn.

Megan Fox wrote:
By default, in ndi8server.h, the buffer size is set as follows:

INPUT_BUFFER_SIZE = 128


... in our testing, this is by far too low, and misses a great deal of
input.  By setting the value to 512, all of our lag issues were
removed entirely.

Another issue I corrected at the same time was the addition of the
buffer specification to the Keyboard device code (in
di8EnumDevicesCallback):

        case nDI8Device::KEYBOARD:
            diDev->SetDataFormat(&c_dfDIKeyboard);
            di8SetDWordProp(diDev, DIPROP_BUFFERSIZE,
nDI8Server::INPUT_BUFFER_SIZE);
            break;

... before, nothing was setting the BUFFERSIZE for the keyboard
device, though this could be redundant for all I know.

--
-Megan Fox
Idyllon, LLC
http://shalinor.circustent.us/megan/resume/

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

*** NOTE: To reply to the list use "reply to all",  ***
***       to reply direct to the sender use "reply" ***
_______________________________________________
Nebuladevice-discuss mailing list
Nebuladevice-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss

Re: Potential problem with DInput code, and solution

by Megan Fox :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Note - further testing suggests that adding the DIPROP_BUFFERSIZE to
keyboard causes strange crashing.  It works, but for instance,
pressing the up arrow is causing an assert wherein Nebula is assuming
there are only 128 keys (bizarre).

More testing is necessary to figure out what the cause of this is, but
removing the PROP line bandaid fixes it.

On 10/13/06, pangu <johndotsmith@...> wrote:

>
> thanks megan, i commited your patch it to svn.
>
>
> Megan Fox wrote:
> >
> > By default, in ndi8server.h, the buffer size is set as follows:
> >
> > INPUT_BUFFER_SIZE = 128
> >
> >
> > ... in our testing, this is by far too low, and misses a great deal of
> > input.  By setting the value to 512, all of our lag issues were
> > removed entirely.
> >
> > Another issue I corrected at the same time was the addition of the
> > buffer specification to the Keyboard device code (in
> > di8EnumDevicesCallback):
> >
> >         case nDI8Device::KEYBOARD:
> >             diDev->SetDataFormat(&c_dfDIKeyboard);
> >             di8SetDWordProp(diDev, DIPROP_BUFFERSIZE,
> > nDI8Server::INPUT_BUFFER_SIZE);
> >             break;
> >
> > ... before, nothing was setting the BUFFERSIZE for the keyboard
> > device, though this could be redundant for all I know.
> >
> > --
> > -Megan Fox
> > Idyllon, LLC
> > http://shalinor.circustent.us/megan/resume/
> >
> > -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > your
> > opinions on IT & business topics through brief surveys -- and earn cash
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> >
> > *** NOTE: To reply to the list use "reply to all",  ***
> > ***       to reply direct to the sender use "reply" ***
> > _______________________________________________
> > Nebuladevice-discuss mailing list
> > Nebuladevice-discuss@...
> > https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Potential-problem-with-DInput-code%2C-and-solution-tf2412838.html#a6807178
> Sent from the nebuladevice-discuss mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>
> *** NOTE: To reply to the list use "reply to all",  ***
> ***       to reply direct to the sender use "reply" ***
> _______________________________________________
> Nebuladevice-discuss mailing list
> Nebuladevice-discuss@...
> https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss
>


--
-Megan Fox
Idyllon, LLC
http://shalinor.circustent.us/megan/resume/

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

*** NOTE: To reply to the list use "reply to all",  ***
***       to reply direct to the sender use "reply" ***
_______________________________________________
Nebuladevice-discuss mailing list
Nebuladevice-discuss@...
https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss

Re: Potential problem with DInput code, and solution

by Megan Fox :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

More on this... I'm not sure why, but this has something to do with
making DInput allow for non-instantaneous button presses.  Certain
commands, in buffered mode, appear to be flagged as instant (like
control commands), and they appear with a higher than normal number.

Subtracting numButtons from any incoming input > numButtons works in
this case, but I suspect there's a better fix.

On 10/20/06, Megan Fox <shalinor@...> wrote:

> Note - further testing suggests that adding the DIPROP_BUFFERSIZE to
> keyboard causes strange crashing.  It works, but for instance,
> pressing the up arrow is causing an assert wherein Nebula is assuming
> there are only 128 keys (bizarre).
>
> More testing is necessary to figure out what the cause of this is, but
> removing the PROP line bandaid fixes it.
>
> On 10/13/06, pangu <johndotsmith@...> wrote:
> >
> > thanks megan, i commited your patch it to svn.
> >
> >
> > Megan Fox wrote:
> > >
> > > By default, in ndi8server.h, the buffer size is set as follows:
> > >
> > > INPUT_BUFFER_SIZE = 128
> > >
> > >
> > > ... in our testing, this is by far too low, and misses a great deal of
> > > input.  By setting the value to 512, all of our lag issues were
> > > removed entirely.
> > >
> > > Another issue I corrected at the same time was the addition of the
> > > buffer specification to the Keyboard device code (in
> > > di8EnumDevicesCallback):
> > >
> > >         case nDI8Device::KEYBOARD:
> > >             diDev->SetDataFormat(&c_dfDIKeyboard);
> > >             di8SetDWordProp(diDev, DIPROP_BUFFERSIZE,
> > > nDI8Server::INPUT_BUFFER_SIZE);
> > >             break;
> > >
> > > ... before, nothing was setting the BUFFERSIZE for the keyboard
> > > device, though this could be redundant for all I know.
> > >
> > > --
> > > -Megan Fox
> > > Idyllon, LLC
> > > http://shalinor.circustent.us/megan/resume/
> > >
> > > -------------------------------------------------------------------------
> > > Take Surveys. Earn Cash. Influence the Future of IT
> > > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > > your
> > > opinions on IT & business topics through brief surveys -- and earn cash
> > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > >
> > > *** NOTE: To reply to the list use "reply to all",  ***
> > > ***       to reply direct to the sender use "reply" ***
> > > _______________________________________________
> > > Nebuladevice-discuss mailing list
> > > Nebuladevice-discuss@...
> > > https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss
> > >
> > >
> >
> > --
> > View this message in context: http://www.nabble.com/Potential-problem-with-DInput-code%2C-and-solution-tf2412838.html#a6807178
> > Sent from the nebuladevice-discuss mailing list archive at Nabble.com.
> >
> >
> > -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> >
> > *** NOTE: To reply to the list use "reply to all",  ***
> > ***       to reply direct to the sender use "reply" ***
> > _______________________________________________
> > Nebuladevice-discuss mailing list
> > Nebuladevice-discuss@...
> > https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss
> >
>
>
> --
> -Megan Fox
> Idyllon, LLC
> http://shalinor.circustent.us/megan/resume/
>


--
-Megan Fox
Idyllon, LLC
http://shalinor.circustent.us/megan/resume/

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

*** NOTE: To reply to the list use "reply to all",  ***
***       to reply direct to the sender use "reply" ***
_______________________________________________
Nebuladevice-discuss mailing list
Nebuladevice-discuss@...
https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss

Re: Potential problem with DInput code, and solution

by Megan Fox :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Oh, wait, I see...

The solution is to remove the assert from nkeyboarddevice.cc.

Instead of:

n_assert((btnNum >= 0) && (btnNum < this->numButtons));

Just have:

n_assert(btnNum >= 0);

I would appreciate someone verifying the safety of this, but it
actually works perfectly.  No crashes, and all inputs are properly
registered - the assert appears to have been in error in this case.

On 10/20/06, Megan Fox <shalinor@...> wrote:

> More on this... I'm not sure why, but this has something to do with
> making DInput allow for non-instantaneous button presses.  Certain
> commands, in buffered mode, appear to be flagged as instant (like
> control commands), and they appear with a higher than normal number.
>
> Subtracting numButtons from any incoming input > numButtons works in
> this case, but I suspect there's a better fix.
>
> On 10/20/06, Megan Fox <shalinor@...> wrote:
> > Note - further testing suggests that adding the DIPROP_BUFFERSIZE to
> > keyboard causes strange crashing.  It works, but for instance,
> > pressing the up arrow is causing an assert wherein Nebula is assuming
> > there are only 128 keys (bizarre).
> >
> > More testing is necessary to figure out what the cause of this is, but
> > removing the PROP line bandaid fixes it.
> >
> > On 10/13/06, pangu <johndotsmith@...> wrote:
> > >
> > > thanks megan, i commited your patch it to svn.
> > >
> > >
> > > Megan Fox wrote:
> > > >
> > > > By default, in ndi8server.h, the buffer size is set as follows:
> > > >
> > > > INPUT_BUFFER_SIZE = 128
> > > >
> > > >
> > > > ... in our testing, this is by far too low, and misses a great deal of
> > > > input.  By setting the value to 512, all of our lag issues were
> > > > removed entirely.
> > > >
> > > > Another issue I corrected at the same time was the addition of the
> > > > buffer specification to the Keyboard device code (in
> > > > di8EnumDevicesCallback):
> > > >
> > > >         case nDI8Device::KEYBOARD:
> > > >             diDev->SetDataFormat(&c_dfDIKeyboard);
> > > >             di8SetDWordProp(diDev, DIPROP_BUFFERSIZE,
> > > > nDI8Server::INPUT_BUFFER_SIZE);
> > > >             break;
> > > >
> > > > ... before, nothing was setting the BUFFERSIZE for the keyboard
> > > > device, though this could be redundant for all I know.
> > > >
> > > > --
> > > > -Megan Fox
> > > > Idyllon, LLC
> > > > http://shalinor.circustent.us/megan/resume/
> > > >
> > > > -------------------------------------------------------------------------
> > > > Take Surveys. Earn Cash. Influence the Future of IT
> > > > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > > > your
> > > > opinions on IT & business topics through brief surveys -- and earn cash
> > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > >
> > > > *** NOTE: To reply to the list use "reply to all",  ***
> > > > ***       to reply direct to the sender use "reply" ***
> > > > _______________________________________________
> > > > Nebuladevice-discuss mailing list
> > > > Nebuladevice-discuss@...
> > > > https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss
> > > >
> > > >
> > >
> > > --
> > > View this message in context: http://www.nabble.com/Potential-problem-with-DInput-code%2C-and-solution-tf2412838.html#a6807178
> > > Sent from the nebuladevice-discuss mailing list archive at Nabble.com.
> > >
> > >
> > > -------------------------------------------------------------------------
> > > Using Tomcat but need to do more? Need to support web services, security?
> > > Get stuff done quickly with pre-integrated technology to make your job easier
> > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > >
> > > *** NOTE: To reply to the list use "reply to all",  ***
> > > ***       to reply direct to the sender use "reply" ***
> > > _______________________________________________
> > > Nebuladevice-discuss mailing list
> > > Nebuladevice-discuss@...
> > > https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss
> > >
> >
> >
> > --
> > -Megan Fox
> > Idyllon, LLC
> > http://shalinor.circustent.us/megan/resume/
> >
>
>
> --
> -Megan Fox
> Idyllon, LLC
> http://shalinor.circustent.us/megan/resume/
>


--
-Megan Fox
Idyllon, LLC
http://shalinor.circustent.us/megan/resume/

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

*** NOTE: To reply to the list use "reply to all",  ***
***       to reply direct to the sender use "reply" ***
_______________________________________________
Nebuladevice-discuss mailing list
Nebuladevice-discuss@...
https://lists.sourceforge.net/lists/listinfo/nebuladevice-discuss