On Thu, Jan 11, 2007 at 10:25:51AM -0700, Vitaliy Margolen wrote:
@@ -128,11 +122,20 @@ struct JoystickImpl /* The 'parent' DInput */ IDirectInputImpl *dinput;
- /* autodetecting ranges per axe by following movement */
- LONG havemax[8];
- LONG havemin[8];
I could never understood why we need these? In other joystick_linux the range assumed to be 0 - 0xffff.
linux/input.h reports us the proper ranges from the device. these numbers will also be used as teh want(min|max). so what this numbers are good for. apps that want the input as "pure" as it gets dont SetProperty some something and just get what the hardware tells them (e.g. RBR does so).
/* joystick private */ /* what range and deadzone the game wants */
- LONG wantmin[ABS_MAX];
- LONG wantmax[ABS_MAX];
- LONG deadz[ABS_MAX];
- LONG wantmin[8];
- LONG wantmax[8];
- LONG deadz[8];
Can we move these into separate struct like it's done in joystick_linux? It's much cleaner end eventually will allow a better integration of two.
i will do this.
And can you use spaces instead of tabs please?
of course
@@ -395,19 +373,29 @@ static JoystickImpl *alloc_device(REFGUID rguid, const void *jvt, IDirectInputIm /* Supported Axis & POVs should map 1-to-1 */ for (i = 0; i < 8; i++) {
if (!test_bit(newDevice->joydev->absbits, i)) continue;
if (!test_bit(newDevice->joydev->absbits, i)) {
newDevice->axes[i] = -1;
continue;
}
Can you please don't brake the good readable style? Please put that curly bracket into separate line, and use 4 space indentation.
sorry - to a K&R guy that uses ts=8 as default this all is unreadable gibberish; i will try my best here.
- fake_current_js_state(newDevice);
Can you explain what this suppose to do? Why do we need to "fake current state" everywhere?
after e.g. SetProperties and initializing the device we have to put the values of the DIJOYSTATE2 in a sane state. e.g. GPL set the ranges to 1000-25k; where my pedals are in 0..512; so the app gets in the next step after the setting a default value of 512 (clutch not pressed) and gets nuts.
int axe = This->axes[ie.code];
It's an "axis" not an "axe" :)
it was 0300 and i guess i wished for an axe there ;)