Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
3.2 KiB

  1. /*****************************************************************************
  2. *
  3. * diquv.c
  4. *
  5. * The dialog box that tinkers with joystick user values.
  6. *
  7. *****************************************************************************/
  8. #include "diquick.h"
  9. #include "dinputd.h"
  10. //#ifdef DEBUG
  11. /*****************************************************************************
  12. *
  13. * Joystick user values dialog instance data
  14. *
  15. * Instance data for control panel joystick user values dialog box.
  16. *
  17. *****************************************************************************/
  18. typedef struct UVDLGINFO {
  19. IDirectInputJoyConfig *pdjc;/* The thing we created */
  20. DIJOYUSERVALUES juv;
  21. } UVDLGINFO, *PUVDLGINFO;
  22. /*****************************************************************************
  23. *
  24. * Uv_OnInitDialog
  25. *
  26. *****************************************************************************/
  27. BOOL INTERNAL
  28. Uv_OnInitDialog(HWND hdlg, LPARAM lp)
  29. {
  30. PUVDLGINFO puvi = (PV)lp;
  31. HRESULT hres;
  32. TCHAR tsz[MAX_JOYSTRING];
  33. SetDialogPtr(hdlg, puvi);
  34. puvi->juv.dwSize = cbX(puvi->juv);
  35. hres = puvi->pdjc->lpVtbl->GetUserValues(puvi->pdjc, &puvi->juv,
  36. DIJU_USERVALUES |
  37. DIJU_GLOBALDRIVER |
  38. DIJU_GAMEPORTEMULATOR);
  39. if (SUCCEEDED(hres)) {
  40. HWND hwnd;
  41. int ids;
  42. hwnd = GetDlgItem(hdlg, IDC_JOYUV_AXIS);
  43. for (ids = IDS_AXIS_MIN; ids < IDS_AXIS_MAX; ids++) {
  44. int iItem;
  45. LoadString(g_hinst, ids, tsz, cA(tsz));
  46. iItem = ListBox_AddString(hwnd, tsz);
  47. if (iItem >= 0) {
  48. ListBox_SetItemData(hwnd, iItem, ids - IDS_AXIS_MIN);
  49. }
  50. }
  51. ConvertString(TRUE, puvi->juv.wszGlobalDriver, tsz, cA(tsz));
  52. SetDlgItemText(hdlg, IDC_JOYUV_CALLOUT, tsz);
  53. ConvertString(TRUE, puvi->juv.wszGameportEmulator, tsz, cA(tsz));
  54. SetDlgItemText(hdlg, IDC_JOYUV_EMULATOR, tsz);
  55. #if 0
  56. #define IDC_JOYUV_AXIS 16
  57. #define IDC_JOYUV_MIN 17
  58. #define IDC_JOYUV_CENTER 18
  59. #define IDC_JOYUV_MAX 19
  60. #define IDC_JOYUV_DEADZONE 20
  61. $$$
  62. #endif
  63. }
  64. return 1;
  65. }
  66. /*****************************************************************************
  67. *
  68. * Uv_DlgProc
  69. *
  70. *****************************************************************************/
  71. INT_PTR INTERNAL
  72. Uv_DlgProc(HWND hdlg, UINT wm, WPARAM wp, LPARAM lp)
  73. {
  74. switch (wm) {
  75. case WM_INITDIALOG:
  76. return Uv_OnInitDialog(hdlg, lp);
  77. case WM_CLOSE:
  78. EndDialog(hdlg, TRUE);
  79. return TRUE;
  80. }
  81. return 0;
  82. }
  83. /*****************************************************************************
  84. *
  85. * Uv_Create
  86. *
  87. * Display the user values.
  88. *
  89. *****************************************************************************/
  90. INT_PTR EXTERNAL
  91. Uv_Create(HWND hdlg, struct IDirectInputJoyConfig *pdjc)
  92. {
  93. UVDLGINFO tdi;
  94. tdi.pdjc = pdjc;
  95. return DialogBoxParam(g_hinst, MAKEINTRESOURCE(IDD_JOYUV),
  96. hdlg, Uv_DlgProc, (LPARAM)&tdi);
  97. }
  98. //#endif