MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / InitJoystickChoices

Method InitJoystickChoices

source/Configuration/PageInput.cpp:223–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221}
222
223void CPageInput::InitJoystickChoices(HWND hWnd, const int joyNum)
224{
225 char* pnzJoystickChoices;
226 int *pnJoyTranslationTbl;
227 int nJoyTranslationTblSize;
228 unsigned short nJC_DISABLED, nJC_JOYSTICK, nJC_KEYBD_CURSORS, nJC_KEYBD_NUMPAD, nJC_MOUSE, nJC_MAX;
229 char** ppszJoyChoices;
230
231 if (joyNum == JN_JOYSTICK0)
232 {
233 pnzJoystickChoices = m_joystick0choices;
234 pnJoyTranslationTbl = m_nJoy0ChoiceTranlationTbl;
235 nJoyTranslationTblSize = sizeof(m_nJoy0ChoiceTranlationTbl);
236 nJC_DISABLED = J0C_DISABLED;
237 nJC_JOYSTICK = J0C_JOYSTICK1;
238 nJC_KEYBD_CURSORS = J0C_KEYBD_CURSORS;
239 nJC_KEYBD_NUMPAD = J0C_KEYBD_NUMPAD;
240 nJC_MOUSE = J0C_MOUSE;
241 nJC_MAX = J0C_MAX;
242 ppszJoyChoices = (char**) m_pszJoy0Choices;
243 }
244 else
245 {
246 pnzJoystickChoices = m_joystick1choices;
247 pnJoyTranslationTbl = m_nJoy1ChoiceTranlationTbl;
248 nJoyTranslationTblSize = sizeof(m_nJoy1ChoiceTranlationTbl);
249 nJC_DISABLED = J1C_DISABLED;
250 nJC_JOYSTICK = J1C_JOYSTICK2;
251 nJC_KEYBD_CURSORS = J1C_KEYBD_CURSORS;
252 nJC_KEYBD_NUMPAD = J1C_KEYBD_NUMPAD;
253 nJC_MOUSE = J1C_MOUSE;
254 nJC_MAX = J1C_MAX;
255 ppszJoyChoices = (char**) m_pszJoy1Choices;
256 }
257
258 char* pszMem = pnzJoystickChoices;
259 int nIdx = 0;
260 memset(pnJoyTranslationTbl, -1, nJoyTranslationTblSize);
261
262 // Build the Joystick choices string list. These first 2 are always selectable.
263 memcpy(pszMem, ppszJoyChoices[nJC_DISABLED], strlen(ppszJoyChoices[nJC_DISABLED])+1);
264 pszMem += strlen(ppszJoyChoices[nJC_DISABLED])+1;
265 pnJoyTranslationTbl[nIdx++] = nJC_DISABLED;
266
267 memcpy(pszMem, ppszJoyChoices[nJC_JOYSTICK], strlen(ppszJoyChoices[nJC_JOYSTICK])+1);
268 pszMem += strlen(ppszJoyChoices[nJC_JOYSTICK])+1;
269 pnJoyTranslationTbl[nIdx++] = nJC_JOYSTICK;
270
271 const bool bHasMouseCard = IsMouseCardInAnySlot();
272
273 // Now exclude:
274 // . the other Joystick type (if it exists) from this new list
275 // . the mouse if the mousecard is plugged in
276 const uint32_t joyType = m_PropertySheetHelper.GetConfigNew().m_joystickType[joyNum];
277 const uint32_t otherJoyType = m_PropertySheetHelper.GetConfigNew().m_joystickType[joyNum == JN_JOYSTICK0 ? JN_JOYSTICK1 : JN_JOYSTICK0];
278
279 int removedItemCompensation = 0;
280 for (UINT i=nJC_KEYBD_CURSORS; i<nJC_MAX; i++)

Callers

nothing calls this directly

Calls 1

FillComboBoxMethod · 0.80

Tested by

no test coverage detected