dinput: Use internal data format for object lookups.

This commit is contained in:
Vitaliy Margolen 2007-01-09 13:44:54 -07:00 committed by Alexandre Julliard
parent 3d093256ca
commit da78a7af5e
2 changed files with 7 additions and 7 deletions

View File

@ -488,13 +488,14 @@ failed:
} }
/* find an object by it's offset in a data format */ /* find an object by it's offset in a data format */
int offset_to_object(LPCDIDATAFORMAT df, int offset) static int offset_to_object(DataFormat *df, int offset)
{ {
int i; int i;
for (i = 0; i < df->dwNumObjs; i++) if (!df->offsets) return -1;
if (dataformat_to_odf(df, i)->dwOfs == offset)
return i; for (i = 0; i < df->wine_df->dwNumObjs; i++)
if (df->offsets[i] == offset) return i;
return -1; return -1;
} }
@ -522,8 +523,8 @@ int find_property(DataFormat *df, LPCDIPROPHEADER ph)
{ {
switch (ph->dwHow) switch (ph->dwHow)
{ {
case DIPH_BYID: return id_to_object(df->user_df, ph->dwObj); case DIPH_BYID: return id_to_object(df->wine_df, ph->dwObj);
case DIPH_BYOFFSET: return offset_to_object(df->user_df, ph->dwObj); case DIPH_BYOFFSET: return offset_to_object(df, ph->dwObj);
} }
FIXME("Unhandled ph->dwHow=='%04X'\n", (unsigned int)ph->dwHow); FIXME("Unhandled ph->dwHow=='%04X'\n", (unsigned int)ph->dwHow);

View File

@ -73,7 +73,6 @@ extern HRESULT create_DataFormat(LPCDIDATAFORMAT asked_format, DataFormat *forma
extern void release_DataFormat(DataFormat *df) ; extern void release_DataFormat(DataFormat *df) ;
extern void queue_event(LPDIRECTINPUTDEVICE8A iface, int ofs, DWORD data, DWORD time, DWORD seq); extern void queue_event(LPDIRECTINPUTDEVICE8A iface, int ofs, DWORD data, DWORD time, DWORD seq);
/* Helper functions to work with data format */ /* Helper functions to work with data format */
extern int offset_to_object(LPCDIDATAFORMAT df, int offset);
extern int id_to_offset(DataFormat *df, int id); extern int id_to_offset(DataFormat *df, int id);
extern int find_property(DataFormat *df, LPCDIPROPHEADER ph); extern int find_property(DataFormat *df, LPCDIPROPHEADER ph);