Please, can anybody produce a dump of the c_dfDIMouse2 and c_rgodfDIMouse2 structures present into DInput.LIB?
Posted on 2003-03-06 08:12:56 by Maverick


_DIOBJECTDATAFORMAT STRUC
pguid DWORD ?
dwOfs DWORD ?
dwType DWORD ?
dwFlags03 DWORD ?
ENDS

DIOBJECTDATAFORMAT TYPEDEF _DIOBJECTDATAFORMAT
LPDIOBJECTDATAFORMAT TYPEDEF PTR _DIOBJECTDATAFORMAT



;=======================================
; Data Format Structure
;=======================================
_DIDATAFORMAT STRUC
dwSize DWORD ?
dwObjSize DWORD ?
dwFlags02 DWORD ?
dwDataSize DWORD ?
dwNumObjs DWORD ?
rgodf LPDIOBJECTDATAFORMAT ? ;LPDIOBJECTDATAFORMAT
ENDS

DIDATAFORMAT TYPEDEF _DIDATAFORMAT

EXTERNDEF C c_dfDIMouse:_DIDATAFORMAT
EXTERNDEF C c_dfDIKeyboard:_DIDATAFORMAT
Posted on 2003-03-06 09:33:54 by BogdanOntanu

Hi Bogdan,
I know the structures.. I need the actual values contained in DInput.LIB.. e.g. c_dfDIMouse and c_rgodfDIMouse are:


DIOBJECTDATAFORMAT c_rgodfDIMouse[7] =
{
{ &GUID_XAxis, 0, 0xFFFF03, 0 },
{ &GUID_YAxis, 4, 0xFFFF03, 0 },
{ &GUID_ZAxis, 8, 0x80FFFF03, 0 },
{ NULL, 12, 0xFFFF0C, 0 },
{ NULL, 13, 0xFFFF0C, 0 },
{ NULL, 14, 0x80FFFF0C, 0 },
{ NULL, 15, 0x80FFFF0C, 0 }
};
const DIDATAFORMAT c_dfDIMouse = { 24, 16, 0x2, 16, 7, c_rgodfDIMouse };

Anyway.. neverminds, soon I'll be back home and extract them myself.. it was not a wasted afternoon though, fortunately I found some other stuff to use my development time on. :)

Thx anyway. :)
Posted on 2003-03-06 11:29:20 by Maverick

oooops.. forgot to post the "solution":

The following structures are useful for anybody who wants to use buffered input with DirectInput.
The c_dfDIMouse2 (that I was looking for) allows you to read the buttons of those mice with more than 4 buttons.

You can easily convert the structures in any assembler syntax you require.



DIOBJECTDATAFORMAT c_rgodfDIMouse[7] = {
{ &GUID_XAxis, 0, 0x00FFFF03, 0 },
{ &GUID_YAxis, 4, 0x00FFFF03, 0 },
{ &GUID_ZAxis, 8, 0x80FFFF03, 0 },
{ NULL, 12, 0x00FFFF0C, 0 },
{ NULL, 13, 0x00FFFF0C, 0 },
{ NULL, 14, 0x80FFFF0C, 0 },
{ NULL, 15, 0x80FFFF0C, 0 }
};
const DIDATAFORMAT c_dfDIMouse = { 24, 16, 0x2, 16, 7, c_rgodfDIMouse };




DIOBJECTDATAFORMAT c_rgodfDIMouse2[11] = {
{ &GUID_XAxis, 0, 0x00FFFF03, 0 },
{ &GUID_YAxis, 4, 0x00FFFF03, 0 },
{ &GUID_ZAxis, 8, 0x80FFFF03, 0 },
{ NULL, 12, 0x00FFFF0C, 0 },
{ NULL, 13, 0x00FFFF0C, 0 },
{ NULL, 14, 0x80FFFF0C, 0 },
{ NULL, 15, 0x80FFFF0C, 0 },
{ NULL, 16, 0x80FFFF0C, 0 },
{ NULL, 17, 0x80FFFF0C, 0 },
{ NULL, 18, 0x80FFFF0C, 0 },
{ NULL, 19, 0x80FFFF0C, 0 }
};
const DIDATAFORMAT c_dfDIMouse2 = { 24, 16, 0x2, 20, 11, c_rgodfDIMouse2 };




DIOBJECTDATAFORMAT c_rgodfDIKeyboard[256] = {
{ &GUID_Key, 0, 0x8000000C, 0 },
{ &GUID_Key, 1, 0x8000010C, 0 },
{ &GUID_Key, 2, 0x8000020C, 0 },
{ &GUID_Key, 3, 0x8000030C, 0 },
{ &GUID_Key, 4, 0x8000040C, 0 },
{ &GUID_Key, 5, 0x8000050C, 0 },
{ &GUID_Key, 6, 0x8000060C, 0 },
{ &GUID_Key, 7, 0x8000070C, 0 },
{ &GUID_Key, 8, 0x8000080C, 0 },
{ &GUID_Key, 9, 0x8000090C, 0 },
{ &GUID_Key, 10, 0x80000A0C, 0 },
{ &GUID_Key, 11, 0x80000B0C, 0 },
{ &GUID_Key, 12, 0x80000C0C, 0 },
{ &GUID_Key, 13, 0x80000D0C, 0 },
{ &GUID_Key, 14, 0x80000E0C, 0 },
{ &GUID_Key, 15, 0x80000F0C, 0 },
{ &GUID_Key, 16, 0x8000100C, 0 },
{ &GUID_Key, 17, 0x8000110C, 0 },
{ &GUID_Key, 18, 0x8000120C, 0 },
{ &GUID_Key, 19, 0x8000130C, 0 },
{ &GUID_Key, 20, 0x8000140C, 0 },
{ &GUID_Key, 21, 0x8000150C, 0 },
{ &GUID_Key, 22, 0x8000160C, 0 },
{ &GUID_Key, 23, 0x8000170C, 0 },
{ &GUID_Key, 24, 0x8000180C, 0 },
{ &GUID_Key, 25, 0x8000190C, 0 },
{ &GUID_Key, 26, 0x80001A0C, 0 },
{ &GUID_Key, 27, 0x80001B0C, 0 },
{ &GUID_Key, 28, 0x80001C0C, 0 },
{ &GUID_Key, 29, 0x80001D0C, 0 },
{ &GUID_Key, 30, 0x80001E0C, 0 },
{ &GUID_Key, 31, 0x80001F0C, 0 },
{ &GUID_Key, 32, 0x8000200C, 0 },
{ &GUID_Key, 33, 0x8000210C, 0 },
{ &GUID_Key, 34, 0x8000220C, 0 },
{ &GUID_Key, 35, 0x8000230C, 0 },
{ &GUID_Key, 36, 0x8000240C, 0 },
{ &GUID_Key, 37, 0x8000250C, 0 },
{ &GUID_Key, 38, 0x8000260C, 0 },
{ &GUID_Key, 39, 0x8000270C, 0 },
{ &GUID_Key, 40, 0x8000280C, 0 },
{ &GUID_Key, 41, 0x8000290C, 0 },
{ &GUID_Key, 42, 0x80002A0C, 0 },
{ &GUID_Key, 43, 0x80002B0C, 0 },
{ &GUID_Key, 44, 0x80002C0C, 0 },
{ &GUID_Key, 45, 0x80002D0C, 0 },
{ &GUID_Key, 46, 0x80002E0C, 0 },
{ &GUID_Key, 47, 0x80002F0C, 0 },
{ &GUID_Key, 48, 0x8000300C, 0 },
{ &GUID_Key, 49, 0x8000310C, 0 },
{ &GUID_Key, 50, 0x8000320C, 0 },
{ &GUID_Key, 51, 0x8000330C, 0 },
{ &GUID_Key, 52, 0x8000340C, 0 },
{ &GUID_Key, 53, 0x8000350C, 0 },
{ &GUID_Key, 54, 0x8000360C, 0 },
{ &GUID_Key, 55, 0x8000370C, 0 },
{ &GUID_Key, 56, 0x8000380C, 0 },
{ &GUID_Key, 57, 0x8000390C, 0 },
{ &GUID_Key, 58, 0x80003A0C, 0 },
{ &GUID_Key, 59, 0x80003B0C, 0 },
{ &GUID_Key, 60, 0x80003C0C, 0 },
{ &GUID_Key, 61, 0x80003D0C, 0 },
{ &GUID_Key, 62, 0x80003E0C, 0 },
{ &GUID_Key, 63, 0x80003F0C, 0 },
{ &GUID_Key, 64, 0x8000400C, 0 },
{ &GUID_Key, 65, 0x8000410C, 0 },
{ &GUID_Key, 66, 0x8000420C, 0 },
{ &GUID_Key, 67, 0x8000430C, 0 },
{ &GUID_Key, 68, 0x8000440C, 0 },
{ &GUID_Key, 69, 0x8000450C, 0 },
{ &GUID_Key, 70, 0x8000460C, 0 },
{ &GUID_Key, 71, 0x8000470C, 0 },
{ &GUID_Key, 72, 0x8000480C, 0 },
{ &GUID_Key, 73, 0x8000490C, 0 },
{ &GUID_Key, 74, 0x80004A0C, 0 },
{ &GUID_Key, 75, 0x80004B0C, 0 },
{ &GUID_Key, 76, 0x80004C0C, 0 },
{ &GUID_Key, 77, 0x80004D0C, 0 },
{ &GUID_Key, 78, 0x80004E0C, 0 },
{ &GUID_Key, 79, 0x80004F0C, 0 },
{ &GUID_Key, 80, 0x8000500C, 0 },
{ &GUID_Key, 81, 0x8000510C, 0 },
{ &GUID_Key, 82, 0x8000520C, 0 },
{ &GUID_Key, 83, 0x8000530C, 0 },
{ &GUID_Key, 84, 0x8000540C, 0 },
{ &GUID_Key, 85, 0x8000550C, 0 },
{ &GUID_Key, 86, 0x8000560C, 0 },
{ &GUID_Key, 87, 0x8000570C, 0 },
{ &GUID_Key, 88, 0x8000580C, 0 },
{ &GUID_Key, 89, 0x8000590C, 0 },
{ &GUID_Key, 90, 0x80005A0C, 0 },
{ &GUID_Key, 91, 0x80005B0C, 0 },
{ &GUID_Key, 92, 0x80005C0C, 0 },
{ &GUID_Key, 93, 0x80005D0C, 0 },
{ &GUID_Key, 94, 0x80005E0C, 0 },
{ &GUID_Key, 95, 0x80005F0C, 0 },
{ &GUID_Key, 96, 0x8000600C, 0 },
{ &GUID_Key, 97, 0x8000610C, 0 },
{ &GUID_Key, 98, 0x8000620C, 0 },
{ &GUID_Key, 99, 0x8000630C, 0 },
{ &GUID_Key, 100, 0x8000640C, 0 },
{ &GUID_Key, 101, 0x8000650C, 0 },
{ &GUID_Key, 102, 0x8000660C, 0 },
{ &GUID_Key, 103, 0x8000670C, 0 },
{ &GUID_Key, 104, 0x8000680C, 0 },
{ &GUID_Key, 105, 0x8000690C, 0 },
{ &GUID_Key, 106, 0x80006A0C, 0 },
{ &GUID_Key, 107, 0x80006B0C, 0 },
{ &GUID_Key, 108, 0x80006C0C, 0 },
{ &GUID_Key, 109, 0x80006D0C, 0 },
{ &GUID_Key, 110, 0x80006E0C, 0 },
{ &GUID_Key, 111, 0x80006F0C, 0 },
{ &GUID_Key, 112, 0x8000700C, 0 },
{ &GUID_Key, 113, 0x8000710C, 0 },
{ &GUID_Key, 114, 0x8000720C, 0 },
{ &GUID_Key, 115, 0x8000730C, 0 },
{ &GUID_Key, 116, 0x8000740C, 0 },
{ &GUID_Key, 117, 0x8000750C, 0 },
{ &GUID_Key, 118, 0x8000760C, 0 },
{ &GUID_Key, 119, 0x8000770C, 0 },
{ &GUID_Key, 120, 0x8000780C, 0 },
{ &GUID_Key, 121, 0x8000790C, 0 },
{ &GUID_Key, 122, 0x80007A0C, 0 },
{ &GUID_Key, 123, 0x80007B0C, 0 },
{ &GUID_Key, 124, 0x80007C0C, 0 },
{ &GUID_Key, 125, 0x80007D0C, 0 },
{ &GUID_Key, 126, 0x80007E0C, 0 },
{ &GUID_Key, 127, 0x80007F0C, 0 },
{ &GUID_Key, 128, 0x8000800C, 0 },
{ &GUID_Key, 129, 0x8000810C, 0 },
{ &GUID_Key, 130, 0x8000820C, 0 },
{ &GUID_Key, 131, 0x8000830C, 0 },
{ &GUID_Key, 132, 0x8000840C, 0 },
{ &GUID_Key, 133, 0x8000850C, 0 },
{ &GUID_Key, 134, 0x8000860C, 0 },
{ &GUID_Key, 135, 0x8000870C, 0 },
{ &GUID_Key, 136, 0x8000880C, 0 },
{ &GUID_Key, 137, 0x8000890C, 0 },
{ &GUID_Key, 138, 0x80008A0C, 0 },
{ &GUID_Key, 139, 0x80008B0C, 0 },
{ &GUID_Key, 140, 0x80008C0C, 0 },
{ &GUID_Key, 141, 0x80008D0C, 0 },
{ &GUID_Key, 142, 0x80008E0C, 0 },
{ &GUID_Key, 143, 0x80008F0C, 0 },
{ &GUID_Key, 144, 0x8000900C, 0 },
{ &GUID_Key, 145, 0x8000910C, 0 },
{ &GUID_Key, 146, 0x8000920C, 0 },
{ &GUID_Key, 147, 0x8000930C, 0 },
{ &GUID_Key, 148, 0x8000940C, 0 },
{ &GUID_Key, 149, 0x8000950C, 0 },
{ &GUID_Key, 150, 0x8000960C, 0 },
{ &GUID_Key, 151, 0x8000970C, 0 },
{ &GUID_Key, 152, 0x8000980C, 0 },
{ &GUID_Key, 153, 0x8000990C, 0 },
{ &GUID_Key, 154, 0x80009A0C, 0 },
{ &GUID_Key, 155, 0x80009B0C, 0 },
{ &GUID_Key, 156, 0x80009C0C, 0 },
{ &GUID_Key, 157, 0x80009D0C, 0 },
{ &GUID_Key, 158, 0x80009E0C, 0 },
{ &GUID_Key, 159, 0x80009F0C, 0 },
{ &GUID_Key, 160, 0x8000A00C, 0 },
{ &GUID_Key, 161, 0x8000A10C, 0 },
{ &GUID_Key, 162, 0x8000A20C, 0 },
{ &GUID_Key, 163, 0x8000A30C, 0 },
{ &GUID_Key, 164, 0x8000A40C, 0 },
{ &GUID_Key, 165, 0x8000A50C, 0 },
{ &GUID_Key, 166, 0x8000A60C, 0 },
{ &GUID_Key, 167, 0x8000A70C, 0 },
{ &GUID_Key, 168, 0x8000A80C, 0 },
{ &GUID_Key, 169, 0x8000A90C, 0 },
{ &GUID_Key, 170, 0x8000AA0C, 0 },
{ &GUID_Key, 171, 0x8000AB0C, 0 },
{ &GUID_Key, 172, 0x8000AC0C, 0 },
{ &GUID_Key, 173, 0x8000AD0C, 0 },
{ &GUID_Key, 174, 0x8000AE0C, 0 },
{ &GUID_Key, 175, 0x8000AF0C, 0 },
{ &GUID_Key, 176, 0x8000B00C, 0 },
{ &GUID_Key, 177, 0x8000B10C, 0 },
{ &GUID_Key, 178, 0x8000B20C, 0 },
{ &GUID_Key, 179, 0x8000B30C, 0 },
{ &GUID_Key, 180, 0x8000B40C, 0 },
{ &GUID_Key, 181, 0x8000B50C, 0 },
{ &GUID_Key, 182, 0x8000B60C, 0 },
{ &GUID_Key, 183, 0x8000B70C, 0 },
{ &GUID_Key, 184, 0x8000B80C, 0 },
{ &GUID_Key, 185, 0x8000B90C, 0 },
{ &GUID_Key, 186, 0x8000BA0C, 0 },
{ &GUID_Key, 187, 0x8000BB0C, 0 },
{ &GUID_Key, 188, 0x8000BC0C, 0 },
{ &GUID_Key, 189, 0x8000BD0C, 0 },
{ &GUID_Key, 190, 0x8000BE0C, 0 },
{ &GUID_Key, 191, 0x8000BF0C, 0 },
{ &GUID_Key, 192, 0x8000C00C, 0 },
{ &GUID_Key, 193, 0x8000C10C, 0 },
{ &GUID_Key, 194, 0x8000C20C, 0 },
{ &GUID_Key, 195, 0x8000C30C, 0 },
{ &GUID_Key, 196, 0x8000C40C, 0 },
{ &GUID_Key, 197, 0x8000C50C, 0 },
{ &GUID_Key, 198, 0x8000C60C, 0 },
{ &GUID_Key, 199, 0x8000C70C, 0 },
{ &GUID_Key, 200, 0x8000C80C, 0 },
{ &GUID_Key, 201, 0x8000C90C, 0 },
{ &GUID_Key, 202, 0x8000CA0C, 0 },
{ &GUID_Key, 203, 0x8000CB0C, 0 },
{ &GUID_Key, 204, 0x8000CC0C, 0 },
{ &GUID_Key, 205, 0x8000CD0C, 0 },
{ &GUID_Key, 206, 0x8000CE0C, 0 },
{ &GUID_Key, 207, 0x8000CF0C, 0 },
{ &GUID_Key, 208, 0x8000D00C, 0 },
{ &GUID_Key, 209, 0x8000D10C, 0 },
{ &GUID_Key, 210, 0x8000D20C, 0 },
{ &GUID_Key, 211, 0x8000D30C, 0 },
{ &GUID_Key, 212, 0x8000D40C, 0 },
{ &GUID_Key, 213, 0x8000D50C, 0 },
{ &GUID_Key, 214, 0x8000D60C, 0 },
{ &GUID_Key, 215, 0x8000D70C, 0 },
{ &GUID_Key, 216, 0x8000D80C, 0 },
{ &GUID_Key, 217, 0x8000D90C, 0 },
{ &GUID_Key, 218, 0x8000DA0C, 0 },
{ &GUID_Key, 219, 0x8000DB0C, 0 },
{ &GUID_Key, 220, 0x8000DC0C, 0 },
{ &GUID_Key, 221, 0x8000DD0C, 0 },
{ &GUID_Key, 222, 0x8000DE0C, 0 },
{ &GUID_Key, 223, 0x8000DF0C, 0 },
{ &GUID_Key, 224, 0x8000E00C, 0 },
{ &GUID_Key, 225, 0x8000E10C, 0 },
{ &GUID_Key, 226, 0x8000E20C, 0 },
{ &GUID_Key, 227, 0x8000E30C, 0 },
{ &GUID_Key, 228, 0x8000E40C, 0 },
{ &GUID_Key, 229, 0x8000E50C, 0 },
{ &GUID_Key, 230, 0x8000E60C, 0 },
{ &GUID_Key, 231, 0x8000E70C, 0 },
{ &GUID_Key, 232, 0x8000E80C, 0 },
{ &GUID_Key, 233, 0x8000E90C, 0 },
{ &GUID_Key, 234, 0x8000EA0C, 0 },
{ &GUID_Key, 235, 0x8000EB0C, 0 },
{ &GUID_Key, 236, 0x8000EC0C, 0 },
{ &GUID_Key, 237, 0x8000ED0C, 0 },
{ &GUID_Key, 238, 0x8000EE0C, 0 },
{ &GUID_Key, 239, 0x8000EF0C, 0 },
{ &GUID_Key, 240, 0x8000F00C, 0 },
{ &GUID_Key, 241, 0x8000F10C, 0 },
{ &GUID_Key, 242, 0x8000F20C, 0 },
{ &GUID_Key, 243, 0x8000F30C, 0 },
{ &GUID_Key, 244, 0x8000F40C, 0 },
{ &GUID_Key, 245, 0x8000F50C, 0 },
{ &GUID_Key, 246, 0x8000F60C, 0 },
{ &GUID_Key, 247, 0x8000F70C, 0 },
{ &GUID_Key, 248, 0x8000F80C, 0 },
{ &GUID_Key, 249, 0x8000F90C, 0 },
{ &GUID_Key, 250, 0x8000FA0C, 0 },
{ &GUID_Key, 251, 0x8000FB0C, 0 },
{ &GUID_Key, 252, 0x8000FC0C, 0 },
{ &GUID_Key, 253, 0x8000FD0C, 0 },
{ &GUID_Key, 254, 0x8000FE0C, 0 },
{ &GUID_Key, 255, 0x8000FF0C, 0 }
};
const DIDATAFORMAT c_dfDIKeyboard = { 24, 16, 0x2, 256, 256, c_rgodfDIKeyboard };




DIOBJECTDATAFORMAT c_rgodfDIJoystick[44] = {
{ &GUID_XAxis, 0, 0x80FFFF03, 256 },
{ &GUID_YAxis, 4, 0x80FFFF03, 256 },
{ &GUID_ZAxis, 8, 0x80FFFF03, 256 },
{ &GUID_RxAxis, 12, 0x80FFFF03, 256 },
{ &GUID_RyAxis, 16, 0x80FFFF03, 256 },
{ &GUID_RzAxis, 20, 0x80FFFF03, 256 },
{ &GUID_Slider, 24, 0x80FFFF03, 256 },
{ &GUID_Slider, 28, 0x80FFFF03, 256 },
{ &GUID_POV, 32, 0x80FFFF10, 0 },
{ &GUID_POV, 36, 0x80FFFF10, 0 },
{ &GUID_POV, 40, 0x80FFFF10, 0 },
{ &GUID_POV, 44, 0x80FFFF10, 0 },
{ NULL, 48, 0x80FFFF0C, 0 },
{ NULL, 49, 0x80FFFF0C, 0 },
{ NULL, 50, 0x80FFFF0C, 0 },
{ NULL, 51, 0x80FFFF0C, 0 },
{ NULL, 52, 0x80FFFF0C, 0 },
{ NULL, 53, 0x80FFFF0C, 0 },
{ NULL, 54, 0x80FFFF0C, 0 },
{ NULL, 55, 0x80FFFF0C, 0 },
{ NULL, 56, 0x80FFFF0C, 0 },
{ NULL, 57, 0x80FFFF0C, 0 },
{ NULL, 58, 0x80FFFF0C, 0 },
{ NULL, 59, 0x80FFFF0C, 0 },
{ NULL, 60, 0x80FFFF0C, 0 },
{ NULL, 61, 0x80FFFF0C, 0 },
{ NULL, 62, 0x80FFFF0C, 0 },
{ NULL, 63, 0x80FFFF0C, 0 },
{ NULL, 64, 0x80FFFF0C, 0 },
{ NULL, 65, 0x80FFFF0C, 0 },
{ NULL, 66, 0x80FFFF0C, 0 },
{ NULL, 67, 0x80FFFF0C, 0 },
{ NULL, 68, 0x80FFFF0C, 0 },
{ NULL, 69, 0x80FFFF0C, 0 },
{ NULL, 70, 0x80FFFF0C, 0 },
{ NULL, 71, 0x80FFFF0C, 0 },
{ NULL, 72, 0x80FFFF0C, 0 },
{ NULL, 73, 0x80FFFF0C, 0 },
{ NULL, 74, 0x80FFFF0C, 0 },
{ NULL, 75, 0x80FFFF0C, 0 },
{ NULL, 76, 0x80FFFF0C, 0 },
{ NULL, 77, 0x80FFFF0C, 0 },
{ NULL, 78, 0x80FFFF0C, 0 },
{ NULL, 79, 0x80FFFF0C, 0 }
};
const DIDATAFORMAT c_dfDIJoystick = { 24, 16, 0x1, 80, 44, c_rgodfDIJoystick };




DIOBJECTDATAFORMAT c_rgodfDIJoystick2[164] = {
{ &GUID_XAxis, 0, 0x80FFFF03, 256 },
{ &GUID_YAxis, 4, 0x80FFFF03, 256 },
{ &GUID_ZAxis, 8, 0x80FFFF03, 256 },
{ &GUID_RxAxis, 12, 0x80FFFF03, 256 },
{ &GUID_RyAxis, 16, 0x80FFFF03, 256 },
{ &GUID_RzAxis, 20, 0x80FFFF03, 256 },
{ &GUID_Slider, 24, 0x80FFFF03, 256 },
{ &GUID_Slider, 28, 0x80FFFF03, 256 },
{ &GUID_POV, 32, 0x80FFFF10, 0 },
{ &GUID_POV, 36, 0x80FFFF10, 0 },
{ &GUID_POV, 40, 0x80FFFF10, 0 },
{ &GUID_POV, 44, 0x80FFFF10, 0 },
{ &GUID_XAxis, 48, 0x80FFFF0C, 0 },
{ &GUID_YAxis, 49, 0x80FFFF0C, 0 },
{ &GUID_ZAxis, 50, 0x80FFFF0C, 0 },
{ &GUID_RxAxis, 51, 0x80FFFF0C, 0 },
{ &GUID_RyAxis, 52, 0x80FFFF0C, 0 },
{ &GUID_RzAxis, 53, 0x80FFFF0C, 0 },
{ &GUID_Slider, 54, 0x80FFFF0C, 0 },
{ &GUID_Slider, 55, 0x80FFFF0C, 0 },
{ &GUID_XAxis, 56, 0x80FFFF0C, 0 },
{ &GUID_YAxis, 57, 0x80FFFF0C, 0 },
{ &GUID_ZAxis, 58, 0x80FFFF0C, 0 },
{ &GUID_RxAxis, 59, 0x80FFFF0C, 0 },
{ &GUID_RyAxis, 60, 0x80FFFF0C, 0 },
{ &GUID_RzAxis, 61, 0x80FFFF0C, 0 },
{ &GUID_Slider, 62, 0x80FFFF0C, 0 },
{ &GUID_Slider, 63, 0x80FFFF0C, 0 },
{ &GUID_XAxis, 64, 0x80FFFF0C, 0 },
{ &GUID_YAxis, 65, 0x80FFFF0C, 0 },
{ &GUID_ZAxis, 66, 0x80FFFF0C, 0 },
{ &GUID_RxAxis, 67, 0x80FFFF0C, 0 },
{ &GUID_RyAxis, 68, 0x80FFFF0C, 0 },
{ &GUID_RzAxis, 69, 0x80FFFF0C, 0 },
{ &GUID_Slider, 70, 0x80FFFF0C, 0 },
{ &GUID_Slider, 71, 0x80FFFF0C, 0 },
{ NULL, 72, 0x80FFFF0C, 0 },
{ NULL, 73, 0x80FFFF0C, 0 },
{ NULL, 74, 0x80FFFF0C, 0 },
{ NULL, 75, 0x80FFFF0C, 0 },
{ NULL, 76, 0x80FFFF0C, 0 },
{ NULL, 77, 0x80FFFF0C, 0 },
{ NULL, 78, 0x80FFFF0C, 0 },
{ NULL, 79, 0x80FFFF0C, 0 },
{ NULL, 80, 0x80FFFF0C, 0 },
{ NULL, 81, 0x80FFFF0C, 0 },
{ NULL, 82, 0x80FFFF0C, 0 },
{ NULL, 83, 0x80FFFF0C, 0 },
{ NULL, 84, 0x80FFFF0C, 0 },
{ NULL, 85, 0x80FFFF0C, 0 },
{ NULL, 86, 0x80FFFF0C, 0 },
{ NULL, 87, 0x80FFFF0C, 0 },
{ NULL, 88, 0x80FFFF0C, 0 },
{ NULL, 89, 0x80FFFF0C, 0 },
{ NULL, 90, 0x80FFFF0C, 0 },
{ NULL, 91, 0x80FFFF0C, 0 },
{ NULL, 92, 0x80FFFF0C, 0 },
{ NULL, 93, 0x80FFFF0C, 0 },
{ NULL, 94, 0x80FFFF0C, 0 },
{ NULL, 95, 0x80FFFF0C, 0 },
{ NULL, 96, 0x80FFFF0C, 0 },
{ NULL, 97, 0x80FFFF0C, 0 },
{ NULL, 98, 0x80FFFF0C, 0 },
{ NULL, 99, 0x80FFFF0C, 0 },
{ NULL, 100, 0x80FFFF0C, 0 },
{ NULL, 101, 0x80FFFF0C, 0 },
{ NULL, 102, 0x80FFFF0C, 0 },
{ NULL, 103, 0x80FFFF0C, 0 },
{ NULL, 104, 0x80FFFF0C, 0 },
{ NULL, 105, 0x80FFFF0C, 0 },
{ NULL, 106, 0x80FFFF0C, 0 },
{ NULL, 107, 0x80FFFF0C, 0 },
{ NULL, 108, 0x80FFFF0C, 0 },
{ NULL, 109, 0x80FFFF0C, 0 },
{ NULL, 110, 0x80FFFF0C, 0 },
{ NULL, 111, 0x80FFFF0C, 0 },
{ NULL, 112, 0x80FFFF0C, 0 },
{ NULL, 113, 0x80FFFF0C, 0 },
{ NULL, 114, 0x80FFFF0C, 0 },
{ NULL, 115, 0x80FFFF0C, 0 },
{ NULL, 116, 0x80FFFF0C, 0 },
{ NULL, 117, 0x80FFFF0C, 0 },
{ NULL, 118, 0x80FFFF0C, 0 },
{ NULL, 119, 0x80FFFF0C, 0 },
{ NULL, 120, 0x80FFFF0C, 0 },
{ NULL, 121, 0x80FFFF0C, 0 },
{ NULL, 122, 0x80FFFF0C, 0 },
{ NULL, 123, 0x80FFFF0C, 0 },
{ NULL, 124, 0x80FFFF0C, 0 },
{ NULL, 125, 0x80FFFF0C, 0 },
{ NULL, 126, 0x80FFFF0C, 0 },
{ NULL, 127, 0x80FFFF0C, 0 },
{ NULL, 128, 0x80FFFF0C, 0 },
{ NULL, 129, 0x80FFFF0C, 0 },
{ NULL, 130, 0x80FFFF0C, 0 },
{ NULL, 131, 0x80FFFF0C, 0 },
{ NULL, 132, 0x80FFFF0C, 0 },
{ NULL, 133, 0x80FFFF0C, 0 },
{ NULL, 134, 0x80FFFF0C, 0 },
{ NULL, 135, 0x80FFFF0C, 0 },
{ NULL, 136, 0x80FFFF0C, 0 },
{ NULL, 137, 0x80FFFF0C, 0 },
{ NULL, 138, 0x80FFFF0C, 0 },
{ NULL, 139, 0x80FFFF0C, 0 },
{ NULL, 140, 0x80FFFF0C, 0 },
{ NULL, 141, 0x80FFFF0C, 0 },
{ NULL, 142, 0x80FFFF0C, 0 },
{ NULL, 143, 0x80FFFF0C, 0 },
{ NULL, 144, 0x80FFFF0C, 0 },
{ NULL, 145, 0x80FFFF0C, 0 },
{ NULL, 146, 0x80FFFF0C, 0 },
{ NULL, 147, 0x80FFFF0C, 0 },
{ NULL, 148, 0x80FFFF0C, 0 },
{ NULL, 149, 0x80FFFF0C, 0 },
{ NULL, 150, 0x80FFFF0C, 0 },
{ NULL, 151, 0x80FFFF0C, 0 },
{ NULL, 152, 0x80FFFF0C, 0 },
{ NULL, 153, 0x80FFFF0C, 0 },
{ NULL, 154, 0x80FFFF0C, 0 },
{ NULL, 155, 0x80FFFF0C, 0 },
{ NULL, 156, 0x80FFFF0C, 0 },
{ NULL, 157, 0x80FFFF0C, 0 },
{ NULL, 158, 0x80FFFF0C, 0 },
{ NULL, 159, 0x80FFFF0C, 0 },
{ NULL, 160, 0x80FFFF0C, 0 },
{ NULL, 161, 0x80FFFF0C, 0 },
{ NULL, 162, 0x80FFFF0C, 0 },
{ NULL, 163, 0x80FFFF0C, 0 },
{ NULL, 164, 0x80FFFF0C, 0 },
{ NULL, 165, 0x80FFFF0C, 0 },
{ NULL, 166, 0x80FFFF0C, 0 },
{ NULL, 167, 0x80FFFF0C, 0 },
{ NULL, 168, 0x80FFFF0C, 0 },
{ NULL, 169, 0x80FFFF0C, 0 },
{ NULL, 170, 0x80FFFF0C, 0 },
{ NULL, 171, 0x80FFFF0C, 0 },
{ NULL, 172, 0x80FFFF0C, 0 },
{ NULL, 173, 0x80FFFF0C, 0 },
{ NULL, 174, 0x80FFFF0C, 0 },
{ NULL, 175, 0x80FFFF0C, 0 },
{ NULL, 176, 0x80FFFF03, 512 },
{ NULL, 180, 0x80FFFF03, 512 },
{ NULL, 184, 0x80FFFF03, 512 },
{ NULL, 188, 0x80FFFF03, 512 },
{ NULL, 192, 0x80FFFF03, 512 },
{ NULL, 196, 0x80FFFF03, 512 },
{ NULL, 24, 0x80FFFF03, 512 },
{ NULL, 28, 0x80FFFF03, 512 },
{ NULL, 208, 0x80FFFF03, 768 },
{ NULL, 212, 0x80FFFF03, 768 },
{ NULL, 216, 0x80FFFF03, 768 },
{ NULL, 220, 0x80FFFF03, 768 },
{ NULL, 224, 0x80FFFF03, 768 },
{ NULL, 228, 0x80FFFF03, 768 },
{ NULL, 24, 0x80FFFF03, 768 },
{ NULL, 28, 0x80FFFF03, 768 },
{ NULL, 240, 0x80FFFF03, 1024 },
{ NULL, 244, 0x80FFFF03, 1024 },
{ NULL, 248, 0x80FFFF03, 1024 },
{ NULL, 252, 0x80FFFF03, 1024 },
{ NULL, 256, 0x80FFFF03, 1024 },
{ NULL, 260, 0x80FFFF03, 1024 },
{ NULL, 24, 0x80FFFF03, 1024 },
{ NULL, 28, 0x80FFFF03, 1024 }
};
const DIDATAFORMAT c_dfDIJoystick2 = { 24, 16, 0x1, 272, 164, c_rgodfDIJoystick2 };


and some GUIDs:



const U8 System_Host_PC_Win32_Device_DirectInput_GUID_XAxis[16]={
0xE0,0x02,0x6D,0xA3,
0xF3,0xC9,
0xCF,0x11,
0xBF,
0xC7,
0x44,
0x45,
0x53,
0x54,
0x00,
0x00
};

const U8 System_Host_PC_Win32_Device_DirectInput_GUID_YAxis[16]={
0xE1,0x02,0x6D,0xA3,
0xF3,0xC9,
0xCF,0x11,
0xBF,
0xC7,
0x44,
0x45,
0x53,
0x54,
0x00,
0x00
};

const U8 System_Host_PC_Win32_Device_DirectInput_GUID_ZAxis[16]={
0xE2,0x02,0x6D,0xA3,
0xF3,0xC9,
0xCF,0x11,
0xBF,
0xC7,
0x44,
0x45,
0x53,
0x54,
0x00,
0x00
};

const U8 System_Host_PC_Win32_Device_DirectInput_GUID_Key[16]={
0x20,0x82,0x72,0x55,
0x3C,0xD3,
0xCF,0x11,
0xBF,
0xC7,
0x44,
0x45,
0x53,
0x54,
0x00,
0x00
};


Having understood the mechanism behind it, you can extract all the other necessary information from dinput.h

A final note.. I suggest you NOT to use DInput notification functions.. they suffer from the same defects of DSound ones.
Instead use a multimedia timer (e.g. set to 10 ms) to check for buffered input via GetDeviceData()
Posted on 2003-03-11 14:46:16 by Maverick
Thank you man...

Ooops ...

What are the defects that affect DirectInput Notification functions and DirectSound Ones?
Posted on 2003-03-11 19:09:14 by BogdanOntanu

Hi Bogdan,
Thank you man...
You're always welcome. :)

Ooops ...

What are the defects that affect DirectInput Notification functions and DirectSound Ones?
Latency.. either directly or indirectly. If you want a quick response, then Win32 threading is not the right answer. Time slices are just too long (I measured in real conditions up to 30ms.. although I've read about slightly smaller figures). With Multimedia Timers you can get as low as 1 ms (not that you must do it, if unnecessary.. because it will load a bit the system on slow PCs. But 2 ms begins to be ok also in those).

How much latency can be considered acceptable in a program is subjective.. but only till a certain extent.
For example, in serious audio application 30 ms may be the very maximum your hear may find acceptable.
If you use DirectSound, then the normal, standard way (meaning double buffering) already mean half of the buffer's length, as latency. Then you add notification, which is done via threading, and you must add another 30 ms at least. Then Win2000/XP KMixer adds another 30 ms on top of that.
It clear that for any serious application you've to remove every one of those sources of latency. Assuming that you can (and you can), then imagine you were writing a realtime synth application (e.g. a "keyboard") and already fixed all the sound latency problems. With DInput notification, after pressing a key it may take 30 ms or more that your other thread gets notified.. vanishing all the efforts you already made to reduce (or eliminate) sound latency. Things are even worse if you want to use MIDI input, which is quite time-critical per definition.

The threading model of Win32 is just insufficient for anything too real-time oriented.. Multimedia Timers are a partial solution, though and can, in many cases, give overall decent results.
Posted on 2003-03-12 03:25:27 by Maverick
Huh there are DInput notfication functions?! I just used the GetDeviceState for the Keyb and Mouse. I feel that its better for the main app to sample the inputs when its ready for it. But in DOS I would use shared memory for keyboard input.

Are Multimedia Timers good? I hear they are the way to go and I may use them in game code. So how do they do with precision and timing? And what piece of hardware do they use for the high resolution timer if there are not using the PIT (I think its Intel 8255)?
Posted on 2003-03-12 14:00:04 by x86asm

Huh there are DInput notfication functions?! I just used the GetDeviceState for the Keyb and Mouse. I feel that its better for the main app to sample the inputs when its ready for it. But in DOS I would use shared memory for keyboard input.

Are Multimedia Timers good? I hear they are the way to go and I may use them in game code. So how do they do with precision and timing? And what piece of hardware do they use for the high resolution timer if there are not using the PIT (I think its Intel 8255)?
Sampling is bad.. you can miss events. You should really use buffered input, even better making use of the TimeStamp.

Multimedia Timers good? Well, all is relative. They're the best-implemented single feature of Windows anyway, IMHO.
My tests (on a variety of Windows 9x and NT-based versions, and on CPU's ranging from old Pentiums to Athlon XP) showed that they behave quite well. If you set them to 1 ms and request the maximum possible precision, they will have a consistency like:


Athlon TB 800 MHz, Windows 2000 SP3:


Delta = 789957
Delta = 816345
Delta = 772644
Delta = 818523
Delta = 803886
Delta = 801462
Delta = 778261
Delta = 830031
Delta = 775027
Delta = 803091
Delta = 808146
Delta = 802869
Delta = 788345
Delta = 820706
Delta = 774172
Delta = 817295
Delta = 801040
Delta = 796529
Delta = 786203
Delta = 815364
Delta = 775333
Delta = 816221
Delta = 801073
Delta = 803132
Delta = 788180
Delta = 830504
Delta = 770105
Delta = 812855
Delta = 796475
Delta = 796275
Delta = 795520
Delta = 823848
Delta = 767937
Delta = 810919
Delta = 820927
Delta = 786863
Delta = 784874
Delta = 824898
Delta = 768016
Delta = 817845
Delta = 796183
Delta = 799324
Delta = 796337
Delta = 825582
Delta = 769386
Delta = 814176
Delta = 797899
Delta = 796364
Delta = 798186
Delta = 822413
Delta = 766333
Delta = 811513
Delta = 810138
Delta = 795513
Delta = 784932
Delta = 823569
Delta = 784229
Delta = 810540
Delta = 792810
Delta = 798574
Delta = 795401
Delta = 829344
Delta = 780628
Delta = 805551
Delta = 792373
Delta = 810875
Delta = 775952
Delta = 830198
Delta = 774972
Delta = 814927
Delta = 788034
Delta = 801492
Delta = 789148
Delta = 833332
Delta = 763076
Delta = 823539
Delta = 790462
Delta = 805923
Delta = 789953
Delta = 818276
Delta = 772596
Delta = 820049
Delta = 802470
Delta = 791231
Delta = 796188
Delta = 1274821
Delta = 774023
Delta = 813281
Delta = 799821
Delta = 808721
Delta = 779167
Delta = 824606
Delta = 775087
Delta = 812974
Delta = 800356
Delta = 800463
Delta = 787115
Delta = 825073

the values shown are the delta of the TSC and the last TSC.


Pentium 166 MHz, Windows 98:


Delta = 216062
Delta = 129783
Delta = 157720
Delta = 189192
Delta = 146803
Delta = 151882
Delta = 171483
Delta = 171932
Delta = 171283
Delta = 151062
Delta = 174528
Delta = 166227
Delta = 171623
Delta = 171080
Delta = 157715
Delta = 166087
Delta = 174848
Delta = 151197
Delta = 185753
Delta = 157132
Delta = 171833
Delta = 165497
Delta = 174803
Delta = 152107
Delta = 171863
Delta = 171090
Delta = 171415
Delta = 150857
Delta = 174823
Delta = 166407
Delta = 171928
Delta = 172147
Delta = 157473
Delta = 165722
Delta = 175823
Delta = 151417
Delta = 186613
Delta = 156717
Delta = 171823
Delta = 166212
Delta = 175178
Delta = 152082
Delta = 171728
Delta = 171312
Delta = 161858
Delta = 165477
Delta = 175638
Delta = 151907
Delta = 171248
Delta = 172012
Delta = 173248
Delta = 161642
Delta = 175413
Delta = 151367
Delta = 172458
Delta = 171242
Delta = 156908
Delta = 166397
Delta = 184503
Delta = 152042
Delta = 172358
Delta = 172387
Delta = 304258
Delta = 373
Delta = 202714
Delta = 155978
Delta = 169655
Delta = 166717
Delta = 160258
Delta = 168477
Delta = 178553
Delta = 154282
Delta = 173308
Delta = 159602
Delta = 174678
Delta = 154302
Delta = 178228
Delta = 154572
Delta = 174293
Delta = 173750
Delta = 159640
Delta = 168607
Delta = 177758
Delta = 154357
Delta = 174693
Delta = 160372
Delta = 173908
Delta = 153912
Delta = 177688
Delta = 154482
Delta = 175358
Delta = 175135
Delta = 159880
Delta = 168822
Delta = 179013
Delta = 154452
Delta = 174968
Delta = 159867

As you can see, they are very acceptable, if we consider how Windows behaves for all the rest, real-time wise.

To answer to your last question, I think they use the CMOS IRQ (set to 1024 Hz).
Posted on 2003-03-12 15:15:44 by Maverick
Hey Maverick how would I enable buffered input in DI? I'm using VC++ but you can pass ASM code and I'll figure it out. But if a CPU can progress through the main game loop quickly enough I don't see how it would be a problem, but I would like to reduce the amount of problems I face.
Posted on 2003-03-12 19:46:44 by x86asm

The differences are subtle, and depend on how smooth is your main loop, of course.

It's just that 1) I'm a perfectionist and 2) sometimes I really needed (for top results of no jerkiness) this perfection, and once I wrote a module, I like to reuse it.. even if in another case the difference may not even be noticeable.

If in a slow PC your framerate suddenly drops, you may miss a quick event (e.g. a quick press/release of a button). I like to use TimeStamps because if something "freezes" I can reconstruct also the timing of the events.. it's complicate/advanced stuff though, or so it seems at least, I know, you don't have to bother if you don't meet yet the needs to do so. I have a certain real-multimedia background that has made me more sensitive on these issues than most PC users/developers.

That was about the keyboard.. the one that gives less problems.

For the mouse there are further limitations imposed by the PC hardware.

But I'm afraid I'm talking to the wrong audience, since the PC has never been good in this regard. Those of you that ever used an Amiga may have noticed how smooth it was to move screens around (a kind of hardware windows) with the mouse.. because the sampling of mouse coordinates was syncronized with the vertical blanking interrupt (and anything else you wished).
On the PC, serial mice (and most PS/2 as well) are sampled 40 times per second, and only when they move. This means that the sampling has nothing to do with the vertical blanking period, and when you move a window, it'll use mouse coordinates that don't reflect the reality of that instant, but of the past plus an unconstant error (because the two systems are completely separed and out of synch). This results in jerky movements (heavy aliasing and heavy time distortion, to talk in DSP terms).

The real, true mouse coordinates should be readable at any instant ideally (the Amiga had the counters inside the custom chips, so it was no problem.. it was not like on the PC that the counters are inside the mouse itself). Given the hardware limitations of the PC mice, the coordinates should at least be polled in a regular way, hopefully in syncro with the vbl. I successfully managed to do it in my OS, where (on PS/2 mice) I command the mouse to transfer the new coordinates, and at the same time read the input buffer. This causes one vbl period delay, but at least results in all being perfectly in synch and smooth. On serial mice or anyway in Windoze (where I've to use the standard, lame driver) I will (when I'll have the time, that is) write an interpolation routine to reduce as much as possible the aliasing and time distortion. It will result in more delay, but smooth movement as well. Some games are already providing such a "mouse filter", but I'm not sure it's anything state-of-the-art, for what I've seen/verifyed.

Regarding your other question: you use SetBufferSize to set the size of the DInput buffer (by default it's 0, so you must do it), and GetDeviceData to actually get the buffered data. It's all well explained in the SDK tutorial.

Sorry, gotta run now, my free time for today has almost totally expired. :(
Posted on 2003-03-13 02:06:55 by Maverick
Originally posted by Maverick

To answer to your last question, I think they use the CMOS IRQ (set to 1024 Hz).


You know, I kept getting problems when I was trying to work with CMOS clock back in the days of DOS. I wonder how in HECK they really ARE supposed to work.
Posted on 2003-03-18 00:37:04 by AmkG



You know, I kept getting problems when I was trying to work with CMOS clock back in the days of DOS. I wonder how in HECK they really ARE supposed to work.


I also was trying to mess around with them, but I just redesigned my dumb DOS game to use the VSync as timing (yes I know pretty stupid)
Posted on 2003-03-18 16:32:59 by x86asm

What is stupid? Use VSync as time base for a game? Not at all.. actually it's the smartest thing one can do.
Posted on 2003-03-18 18:35:36 by Maverick


What is stupid? Use VSync as time base for a game? Not at all.. actually it's the smartest thing one can do.


REALLY?!
Posted on 2003-03-18 19:15:11 by x86asm

Yes, I wish more PC coders understood that, and that we had a reliable VBlank "callback" (behaving with the usefulness and precision of a true IRQ) under Win32.

Under Dos you can program a PIT timer to be syncronized with the VBL period.. but Win32 is the most anti-realtime mainstream OS out there.
Posted on 2003-03-19 03:17:21 by Maverick
Hey Maverick you seem to know alot of this timing stuff, I need to ask you another question. Its a bout frame rate counters, I see alot of people doing it differently can you poiunt out whats wrong with my method? PLEASE?! :D

What I would do is this:

-Every time the program has finished drawing a frame, increment a frame counter
-Have a timer going in the background, and every second, take the counter and clear it out
-Display that as the frames per second (it won't have a decimal point of course :) )


Anyway I see a lot of people using the TSC under Windows I forgot how they would access it.

Is there anything wrong with it?
Posted on 2003-03-19 18:48:52 by x86asm
Hey Maverick you seem to know alot of this timing stuff, I need to ask you another question. Its a bout frame rate counters, I see alot of people doing it differently can you poiunt out whats wrong with my method? PLEASE?! :D

What I would do is this:

-Every time the program has finished drawing a frame, increment a frame counter
-Have a timer going in the background, and every second, take the counter and clear it out
-Display that as the frames per second (it won't have a decimal point of course )
That is a possible way.

Anyway I see a lot of people using the TSC under Windows I forgot how they would access it.
Use the RDTSC x86 instruction.

Is there anything wrong with it?
No, but you can do it better.
With your method, you'll get a FPS value only each second. Maybe it would be preferable to show an estimate in a continuos way. For that you may buffer the data.. or calculate the FPS each frame (as the inverse of the time it took since last frame), and then apply a "low-pass" filter to smooth the results.
Posted on 2003-03-20 04:07:07 by Maverick

What is stupid? Use VSync as time base for a game? Not at all.. actually it's the smartest thing one can do.


In the even older days of the Atari, Apple, Commodore, etc. the Vsync (or VBlank) was THE thing you should do. It was the best timer you could have, except perhaps for the HSync or HBlank, but those clocks were WAY too fast anyway.

And really IIRC in the old days of DOS most video cards were pretty consistent in their VBlank/VSync (60/sec). Nowadays, however, using the frame rate is less consistent: large deviations in the frame rate exist. On a computer with 100 frames/sec, for instance, Hostile Encounter runs pretty fast, and on a computer with just 60 frames/sec, Hostile Encounter runs slower.
Posted on 2003-03-20 18:11:39 by AmkG

And really IIRC in the old days of DOS most video cards were pretty consistent in their VBlank/VSync (60/sec). Nowadays, however, using the frame rate is less consistent: large deviations in the frame rate exist. On a computer with 100 frames/sec, for instance, Hostile Encounter runs pretty fast, and on a computer with just 60 frames/sec, Hostile Encounter runs slower.
Depending on the type of game you should:

1) syncronize the game simulation with the VBL (so to compensate for the problem above)

or (worse case IMHO)

2) run a fixed speed timer (e.g. a Multimedia Timer) for the game simulation. But this results in aliasing (jerking scrolling, etc..)

a better general solution is to:

run one game simulation each frame, but using buffered mouse/keyboard data to reconstruct when in time the events occurred, and thus execute more than one game simulation step per frame, when necessary, but "retro execute" it in the correct way, as if it was executed in the right, past time.
This removes some of the problem of 1) when you don't have a IRQ, but keeps some of the problem of 2) (time distortion aliasing), unless you use a filter (to guess where the objects will be during that frame).

IMO it's always better to design a game where you can sync it with a non-fixed VBL period.. scrolling games are good for this (expecially on subpixel scrolling capable hardware, such as the Amiga 1200/4000 and modern PC with 3D cards).
Posted on 2003-03-21 02:42:50 by Maverick
Afternoon, All.

I must have lost the plot on what's actually being discussed in this thread:tongue: .

It *seems* to have turned into a discussion on the best way to have keyboard input plus how to do the timing / display fps.

I always have the rendering done during the idle part of the message pump. This means that the updating of position/movement data and the rendering is done as fast as possible.

For input, I use a buffer to store whether a key is currently up or down. The buffer is updated during any WM_KEYUP/WM_KEYDWON messages.

Elapsed time is updated before repositioning/rendering. All movement is calculated based upon elapsed time.

If you lock the framerate at monitor refresh rate, then the game will seem less responsive. This would be fine in games like RTS games, howver it is plainly not acceptable for FPS/Arcade type games.

Cheers,
Scronty
Posted on 2003-03-21 04:22:12 by Scronty