===========================================================================
| 797 | |
| 798 | //=========================================================================== |
| 799 | BOOL JoySetEmulationType(HWND window, uint32_t newtype, int nJoystickNumber, const bool bMousecardActive) |
| 800 | { |
| 801 | if(joytype[nJoystickNumber] == newtype) |
| 802 | return 1; // Already set to this type. Return OK. |
| 803 | |
| 804 | if (joyinfo[newtype] == DEVICE_JOYSTICK || joyinfo[newtype] == DEVICE_JOYSTICK_THUMBSTICK2) |
| 805 | { |
| 806 | JOYCAPS caps; |
| 807 | int nJoy2ID = joyinfo[newtype] == DEVICE_JOYSTICK_THUMBSTICK2 ? JOYSTICK_1 : JOYSTICK_2; |
| 808 | int nJoyID = nJoystickNumber == JN_JOYSTICK0 ? JOYSTICK_1 : nJoy2ID; |
| 809 | if (nJoyID < 0 || joyGetDevCaps(nJoyID, &caps, sizeof(JOYCAPS)) != JOYERR_NOERROR) |
| 810 | { |
| 811 | MessageBox(window, |
| 812 | "The emulator is unable to read your PC joystick. " |
| 813 | "Ensure that your game port is configured properly, " |
| 814 | "that the joystick is firmly plugged in, and that " |
| 815 | "you have a joystick driver installed.", |
| 816 | "Configuration", |
| 817 | MB_ICONEXCLAMATION | MB_SETFOREGROUND); |
| 818 | return 0; |
| 819 | } |
| 820 | if ((joyinfo[newtype] == DEVICE_JOYSTICK_THUMBSTICK2) && (caps.wNumAxes < 4)) |
| 821 | { |
| 822 | MessageBox(window, |
| 823 | "The emulator is unable to read thumbstick 2. " |
| 824 | "Ensure that your game port is configured properly, " |
| 825 | "that the joystick is firmly plugged in, and that " |
| 826 | "you have a joystick driver installed.", |
| 827 | "Configuration", |
| 828 | MB_ICONEXCLAMATION | MB_SETFOREGROUND); |
| 829 | return 0; |
| 830 | } |
| 831 | } |
| 832 | else if ((joyinfo[newtype] == DEVICE_MOUSE) && |
| 833 | (joyinfo[joytype[nJoystickNumber]] != DEVICE_MOUSE)) |
| 834 | { |
| 835 | if (bMousecardActive) |
| 836 | { |
| 837 | // Shouldn't be necessary, since Property Sheet's logic should prevent this option being given to the user. |
| 838 | MessageBox(window, |
| 839 | "Mouse interface card is enabled - unable to use mouse for joystick emulation.", |
| 840 | "Configuration", |
| 841 | MB_ICONEXCLAMATION | MB_SETFOREGROUND); |
| 842 | return 0; |
| 843 | } |
| 844 | |
| 845 | MessageBox(window, |
| 846 | "To begin emulating a joystick with your mouse, move " |
| 847 | "the mouse cursor over the emulated screen of a running " |
| 848 | "program and click the left mouse button. During the " |
| 849 | "time the mouse is emulating a joystick, you will not " |
| 850 | "be able to use it to perform mouse functions, and the " |
| 851 | "mouse cursor will not be visible. To end joystick " |
| 852 | "emulation and regain the mouse cursor, click the left " |
| 853 | "mouse button while pressing Ctrl.", |
| 854 | "Configuration", |
| 855 | MB_ICONINFORMATION | MB_SETFOREGROUND); |
| 856 | } |
no test coverage detected