+static int find_property_offset(JoystickImpl *This, LPCDIPROPHEADER ph)
+{
+ int i,c;
+ switch (ph->dwHow) {
+ case DIPH_BYOFFSET:
+ for (i=0; i<This->df->dwNumObjs; i++) {
+ if (This->df->rgodf[i].dwOfs == ph->dwObj) {
+ return i;
+ }
+ }
+ break;
+ case DIPH_BYID:
+ /* XXX: this is a hack - see below */
+ c = DIDFT_GETINSTANCE(ph->dwObj)>>WINE_JOYSTICK_AXIS_BASE;
+ for (i=0; (c&1)==0 && i<0x0F; i++) {
+ c >>= 1;
+ }
+ if (i<0x0F) {
+ return i;
+ }
+
+ /* XXX - the following part wont work with LiveForSpeed
+ * - the game sets the dwTypes to something else then
+ * the ddoi.dwType set in EnumObjects
+ */
+#if 0
+ for (i=0; i<This->df->dwNumObjs; i++) {
+ TRACE("dwType='%08x'\n", This->df->rgodf[i].dwType);
+ if ((This->df->rgodf[i].dwType & 0x00ffffff) == (ph->dwObj & 0x00ffffff)) {
+ return i;
+ }
+ }
+#endif
+ break;
+ default:
+ FIXME("Unhandled ph->dwHow=='%04X'\n", (unsigned int)ph->dwHow);
+ }
+
+ return -1;
+}
+