static pascal OSStatus NPServerDialogEventHandler (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData) { OSStatus err, result = eventNotHandledErr; WindowRef tWindowRef = (WindowRef) inUserData; switch (GetEventClass(inEvent)) { case kEventClassCommand: switch (GetEventKind(inEvent)) { HICommand tHICommand; case kEventCommandUpdateStatus: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr && tHICommand.commandID == 'clos') { UpdateMenuCommandStatus(false); result = noErr; } break; case kEventCommandProcess: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr) { switch (tHICommand.commandID) { case 'OKAY': HIViewRef ctl, root; HIViewID cid; root = HIViewGetRoot(tWindowRef); cid.id = 0; cid.signature = 'OKAY'; HIViewFindByID(root, cid, &ctl); DeactivateControl(ctl); cid.signature = 'CNSL'; HIViewFindByID(root, cid, &ctl); DeactivateControl(ctl); npserver.dialogprocess = kNPSDialogProcess; result = noErr; break; case 'CNSL': npserver.dialogprocess = kNPSDialogCancel; result = noErr; break; } } break; } break; } return (result); }
static pascal OSStatus RomInfoEventHandler (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData) { OSStatus err, result = eventNotHandledErr; WindowRef tWindowRef = (WindowRef) inUserData; switch (GetEventClass(inEvent)) { case kEventClassWindow: switch (GetEventKind(inEvent)) { case kEventWindowClose: QuitAppModalLoopForWindow(tWindowRef); result = noErr; } break; case kEventClassCommand: switch (GetEventKind(inEvent)) { HICommand tHICommand; case kEventCommandUpdateStatus: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr && tHICommand.commandID == 'clos') { UpdateMenuCommandStatus(true); result = noErr; } break; case kEventCommandProcess: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr) { switch (tHICommand.commandID) { case 'Clip': RomInfoCopyToClipboard(); result = noErr; } } } } return (result); }
static pascal OSStatus NPClientSheetEventHandler (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData) { if (!npclient.dialogsheet) return (eventNotHandledErr); OSStatus err, result = eventNotHandledErr; switch (GetEventClass(inEvent)) { case kEventClassCommand: switch (GetEventKind(inEvent)) { HICommand tHICommand; case kEventCommandUpdateStatus: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr && tHICommand.commandID == 'clos') { UpdateMenuCommandStatus(false); result = noErr; } break; case kEventCommandProcess: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr) { switch (tHICommand.commandID) { case 'ok ': npclient.dialogprocess = kNPCDialogDone; result = noErr; break; } } break; } break; } return (result); }
static pascal OSStatus MusicBoxEventHandler(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *userData) { #pragma unused (inHandlerCallRef) OSStatus err, result = eventNotHandledErr; WindowRef tWindowRef = (WindowRef) userData; switch (GetEventClass(inEvent)) { case kEventClassCommand: switch (GetEventKind(inEvent)) { HICommand cmd; case kEventCommandUpdateStatus: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, nil, sizeof(HICommand), nil, &cmd); if (err == noErr && cmd.commandID == 'clos') { UpdateMenuCommandStatus(false); result = noErr; } break; case kEventCommandProcess: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, nil, sizeof(HICommand), nil, &cmd); if (err == noErr) { HIViewRef root, c1, c2, c3, c4; HIViewID cid; Rect rct; switch (cmd.commandID) { case 'bar1': so.stereo_switch ^= (1 << 0); result = noErr; break; case 'bar2': so.stereo_switch ^= (1 << 1); result = noErr; break; case 'bar3': so.stereo_switch ^= (1 << 2); result = noErr; break; case 'bar4': so.stereo_switch ^= (1 << 3); result = noErr; break; case 'bar5': so.stereo_switch ^= (1 << 4); result = noErr; break; case 'bar6': so.stereo_switch ^= (1 << 5); result = noErr; break; case 'bar7': so.stereo_switch ^= (1 << 6); result = noErr; break; case 'bar8': so.stereo_switch ^= (1 << 7); result = noErr; break; case 'bar9': so.stereo_switch ^= (1 << 8); result = noErr; break; case 'bara': so.stereo_switch ^= (1 << 9); result = noErr; break; case 'barb': so.stereo_switch ^= (1 << 10); result = noErr; break; case 'barc': so.stereo_switch ^= (1 << 11); result = noErr; break; case 'bard': so.stereo_switch ^= (1 << 12); result = noErr; break; case 'bare': so.stereo_switch ^= (1 << 13); result = noErr; break; case 'barf': so.stereo_switch ^= (1 << 14); result = noErr; break; case 'bar0': so.stereo_switch ^= (1 << 15); result = noErr; break; case 'Paus': mboxPause = !mboxPause; S9xSetSoundMute(mboxPause); result = noErr; break; case 'Tr_i': showIndicator = !showIndicator; root = HIViewGetRoot(tWindowRef); cid.id = 0; cid.signature = 'Pane'; HIViewFindByID(root, cid, &c1); HIViewSetVisible(c1, false); cid.signature = 'iMaG'; HIViewFindByID(root, cid, &c2); HIViewSetVisible(c2, false); cid.signature = 'rCTL'; HIViewFindByID(root, cid, &c3); HIViewSetVisible(c3, false); cid.signature = 'bCTL'; HIViewFindByID(root, cid, &c4); HIViewSetVisible(c4, false); GetWindowBounds(tWindowRef, kWindowStructureRgn, &rct); rct.bottom = rct.top + (showIndicator ? mbxOpenedHeight : mbxClosedHeight); err = TransitionWindow(tWindowRef, kWindowSlideTransitionEffect, kWindowResizeTransitionAction, &rct); HIViewSetVisible(c1, true); HIViewSetVisible(c2, true); HIViewSetVisible(c3, true); HIViewSetVisible(c4, true); result = noErr; break; case 'DONE': QuitAppModalLoopForWindow(tWindowRef); result = noErr; break; case 'HEAD': showIndicator = !showIndicator; SPCPlayDefrost(); showIndicator = !showIndicator; result = noErr; break; case 'S_EF': HideWindow(tWindowRef); showIndicator = !showIndicator; ConfigureSoundEffects(); showIndicator = !showIndicator; ShowWindow(tWindowRef); result = noErr; } } } } return result; }
static pascal OSStatus MultiCartEventHandler (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData) { OSStatus err, result = eventNotHandledErr; WindowRef window = (WindowRef) inUserData; static int index = -1; switch (GetEventClass(inEvent)) { case kEventClassCommand: { switch (GetEventKind(inEvent)) { HICommand tHICommand; case kEventCommandUpdateStatus: { err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr && tHICommand.commandID == 'clos') { UpdateMenuCommandStatus(false); result = noErr; } break; } case kEventCommandProcess: { err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr) { HIViewRef ctl, root; HIViewID cid; FSRef ref; bool8 r; root = HIViewGetRoot(window); switch (tHICommand.commandID) { case 'Cho0': case 'Cho1': { index = (tHICommand.commandID & 0xFF) - '0'; r = NavBeginOpenROMImageSheet(window, NULL); result = noErr; break; } case 'NvDn': { r = NavEndOpenROMImageSheet(&ref); if (r) { CFStringRef str; CFURLRef url; url = CFURLCreateFromFSRef(kCFAllocatorDefault, &ref); str = CFURLCopyLastPathComponent(url); cid.signature = 'MNAM'; cid.id = index; HIViewFindByID(root, cid, &ctl); SetStaticTextCFString(ctl, str, true); CFRelease(str); str = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle); if (multiCartPath[index]) CFRelease(multiCartPath[index]); multiCartPath[index] = str; CFRelease(url); } index = -1; result = noErr; break; } case 'Cle0': case 'Cle1': { index = (tHICommand.commandID & 0xFF) - '0'; cid.signature = 'MNAM'; cid.id = index; HIViewFindByID(root, cid, &ctl); SetStaticTextCFString(ctl, CFSTR(""), true); if (multiCartPath[index]) { CFRelease(multiCartPath[index]); multiCartPath[index] = NULL; } index = -1; result = noErr; break; } case 'SWAP': { CFStringRef str; CFURLRef url; str = multiCartPath[0]; multiCartPath[0] = multiCartPath[1]; multiCartPath[1] = str; cid.signature = 'MNAM'; for (int i = 0; i < 2; i++) { cid.id = i; HIViewFindByID(root, cid, &ctl); if (multiCartPath[i]) { url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, multiCartPath[i], kCFURLPOSIXPathStyle, false); str = CFURLCopyLastPathComponent(url); SetStaticTextCFString(ctl, str, true); CFRelease(str); CFRelease(url); } else SetStaticTextCFString(ctl, CFSTR(""), true); } result = noErr; break; } case 'ok ': { QuitAppModalLoopForWindow(window); multiCartDialogResult = true; result = noErr; break; } case 'not!': { QuitAppModalLoopForWindow(window); multiCartDialogResult = false; result = noErr; break; } } } } } } } return (result); }
static pascal OSStatus CheatEventHandler (EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData) { OSStatus err, result = eventNotHandledErr; WindowRef tWindowRef; tWindowRef = (WindowRef) inUserData; switch (GetEventClass(inEvent)) { case kEventClassWindow: switch (GetEventKind(inEvent)) { case kEventWindowClose: QuitAppModalLoopForWindow(tWindowRef); result = noErr; break; } break; case kEventClassCommand: switch (GetEventKind(inEvent)) { HICommand tHICommand; case kEventCommandUpdateStatus: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr && tHICommand.commandID == 'clos') { UpdateMenuCommandStatus(true); result = noErr; } break; case kEventCommandProcess: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr) { switch (tHICommand.commandID) { case kNewButton: AddCheatItem(); result = noErr; break; case kDelButton: DeleteCheatItem(); result = noErr; break; case kAllButton: EnableAllCheatItems(); result = noErr; } } } } return (result); }
static pascal OSStatus NPClientDialogEventHandler (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData) { OSStatus err, result = eventNotHandledErr; switch (GetEventClass(inEvent)) { case kEventClassCommand: switch (GetEventKind(inEvent)) { HICommand tHICommand; case kEventCommandUpdateStatus: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr && tHICommand.commandID == 'clos') { UpdateMenuCommandStatus(false); result = noErr; } break; case kEventCommandProcess: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr) { switch (tHICommand.commandID) { case 'OK__': CFStringRef ref; HIViewRef ctl, root; HIViewID cid; root = HIViewGetRoot(mRef); cid.id = 0; cid.signature = 'SVIP'; HIViewFindByID(root, cid, &ctl); GetEditTextCStr(ctl, npclient.serverIP); DeactivateControl(ctl); if (npclient.serverIP[0] == 0) strcpy(npclient.serverIP, "127.0.0.1"); strcpy(npServerIP, npclient.serverIP); printf("%s\n", npServerIP); cid.signature = 'CLNM'; HIViewFindByID(root, cid, &ctl); CopyEditTextCFString(ctl, &ref); DeactivateControl(ctl); if (ref) { Boolean r; r = CFStringGetCString(ref, npclient.name, 256, kCFStringEncodingUTF8); if (!r) strcpy(npclient.name, "unknown"); else if (npclient.name[0] == 0) strcpy(npclient.name, "Guest"); CFRelease(ref); } else strcpy(npclient.name, "unknown"); strcpy(npName, npclient.name); printf("%s\n", npName); cid.signature = 'OK__'; HIViewFindByID(root, cid, &ctl); DeactivateControl(ctl); cid.signature = 'NOT_'; HIViewFindByID(root, cid, &ctl); DeactivateControl(ctl); npclient.dialogcancel = false; npclient.dialogprocess = kNPCDialogConnect; result = noErr; break; case 'NOT_': npclient.dialogcancel = true; npclient.dialogprocess = kNPCDialogCancel; result = noErr; break; case 'NvDn': npclient.dialogcancel = false; npclient.dialogprocess = kNPCDialogOpenEnd; result = noErr; break; } } break; } break; } return (result); }
static pascal OSStatus PreferencesEventHandler (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData) { OSStatus err, result = eventNotHandledErr; WindowRef tWindowRef = (WindowRef) inUserData; switch (GetEventClass(inEvent)) { case kEventClassWindow: { switch (GetEventKind(inEvent)) { case kEventWindowClose: { QuitAppModalLoopForWindow(tWindowRef); result = noErr; break; } } break; } case kEventClassCommand: { switch (GetEventKind(inEvent)) { HICommand tHICommand; case kEventCommandUpdateStatus: { err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr && tHICommand.commandID == 'clos') { UpdateMenuCommandStatus(true); result = noErr; } break; } case kEventCommandProcess: { HIViewRef ctl, root; HIViewID cid; SInt32 value; FSRef ref; bool8 r; root = HIViewGetRoot(tWindowRef); err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr) { switch (tHICommand.commandID) { case 'S_EF': { HideWindow(tWindowRef); ConfigureSoundEffects(); ShowWindow(tWindowRef); result = noErr; break; } case 'G_FL': { if (systemVersion >= 0x1040) { HideWindow(tWindowRef); ConfigureCoreImageFilter(); ShowWindow(tWindowRef); } result = noErr; break; } case 'G__7': { cid.signature = 'grap'; cid.id = iNibGGLStretch; HIViewFindByID(root, cid, &ctl); value = GetControl32BitValue(ctl); cid.id = iNibGAspectRatio; HIViewFindByID(root, cid, &ctl); if (value) ActivateControl(ctl); else DeactivateControl(ctl); result = noErr; break; } case 'G_13': { cid.signature = 'grap'; cid.id = iNibGScreenCurvature; HIViewFindByID(root, cid, &ctl); value = GetControl32BitValue(ctl); cid.id = iNibGCurvatureWarp; HIViewFindByID(root, cid, &ctl); if (value) ActivateControl(ctl); else DeactivateControl(ctl); result = noErr; break; } case 'S__3': { cid.signature = 'snd_'; cid.id = iNibSStereo; HIViewFindByID(root, cid, &ctl); value = GetControl32BitValue(ctl); cid.id = iNibSReverseStereo; HIViewFindByID(root, cid, &ctl); if (value) ActivateControl(ctl); else DeactivateControl(ctl); result = noErr; break; } case 'F_FL': { UInt32 modifierkey; err = GetEventParameter(inEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifierkey); if (err == noErr) { if (modifierkey & optionKey) { CFStringRef str; MenuRef menu; str = CFCopyLocalizedString(CFSTR("NoneSelected"), "NoneSelected"); cid.signature = 'othe'; cid.id = iNibOSaveFolder; HIViewFindByID(root, cid, &ctl); SetControl32BitValue(ctl, 3); err = GetControlData(ctl, kControlMenuPart, kControlPopupButtonMenuRefTag, sizeof(MenuRef), &menu, NULL); err = SetMenuItemTextWithCFString(menu, iNibSaveFolderNameMenuItem, str); DisableMenuItem(menu, iNibSaveFolderNameMenuItem); HIViewSetNeedsDisplay(ctl, true); CFRelease(str); if (saveFolderPath) CFRelease(saveFolderPath); saveFolderPath = NULL; } else r = NavBeginChooseFolderSheet(tWindowRef); } result = noErr; break; } case 'NvDn': { r = NavEndChooseFolderSheet(&ref); if (r) { CFStringRef str; CFURLRef url; MenuRef menu; url = CFURLCreateFromFSRef(kCFAllocatorDefault, &ref); str = CFURLCopyLastPathComponent(url); cid.signature = 'othe'; cid.id = iNibOSaveFolder; HIViewFindByID(root, cid, &ctl); SetControl32BitValue(ctl, iNibSaveFolderNameMenuItem); err = GetControlData(ctl, kControlMenuPart, kControlPopupButtonMenuRefTag, sizeof(MenuRef), &menu, NULL); err = SetMenuItemTextWithCFString(menu, iNibSaveFolderNameMenuItem, str); EnableMenuItem(menu, iNibSaveFolderNameMenuItem); HIViewSetNeedsDisplay(ctl, true); CFRelease(str); str = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle); if (saveFolderPath) CFRelease(saveFolderPath); saveFolderPath = str; CFRelease(url); } result = noErr; break; } } } break; } } break; } } return (result); }
static pascal OSStatus AutofireWindowEventHandler (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData) { OSStatus err, result = eventNotHandledErr; WindowRef tWindowRef = (WindowRef) inUserData; switch (GetEventClass(inEvent)) { case kEventClassWindow: switch (GetEventKind(inEvent)) { case kEventWindowClose: QuitAppModalLoopForWindow(tWindowRef); result = noErr; } break; case kEventClassCommand: switch (GetEventKind(inEvent)) { HICommand tHICommand; case kEventCommandUpdateStatus: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr && tHICommand.commandID == 'clos') { UpdateMenuCommandStatus(true); result = noErr; } break; case kEventCommandProcess: HIViewRef root; int player = -1; root = HIViewGetRoot(tWindowRef); err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr) { switch (tHICommand.commandID) { case 'DEF1': player = 0; break; case 'DEF2': player = 1; break; } if (player != -1) { autofireRec[player].buttonMask = 0x0000; autofireRec[player].toggleMask = 0xFFF0; autofireRec[player].tcMask = 0x0000; autofireRec[player].invertMask = 0x0000; autofireRec[player].frequency = 10; AutofireReadAllSettings(player + 1, root); result = noErr; } } } } return (result); }
static pascal OSStatus ControllerEventHandler (EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData) { OSStatus err, result = eventNotHandledErr; WindowRef tWindowRef; tWindowRef = (WindowRef) inUserData; switch (GetEventClass(inEvent)) { case kEventClassWindow: switch (GetEventKind(inEvent)) { case kEventWindowClose: QuitAppModalLoopForWindow(tWindowRef); result = noErr; break; } break; case kEventClassCommand: switch (GetEventKind(inEvent)) { HICommand tHICommand; case kEventCommandUpdateStatus: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr && tHICommand.commandID == 'clos') { UpdateMenuCommandStatus(true); result = noErr; } break; case kEventCommandProcess: err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand); if (err == noErr) { if (tHICommand.commandID == 'CLRa') { ClearPadSetting(); result = noErr; } else { SInt32 command = -1, count; for (count = 0; count < kNeedCount; count++) if (tHICommand.commandID == gControlIDs[count].signature) command = count; if (command >= 0) { pRecDevice pDevice; pRecElement pElement; FlushEventQueue(GetCurrentEventQueue()); if (HIDConfigureAction(&pDevice, &pElement, 2.5f)) { if (command < MAC_MAX_PLAYERS * 4) // Direction { int i = command >> 2; // Player long curv = HIDGetElementValue(pDevice, pElement); if (pElement->usage == kHIDUsage_GD_Hatswitch) // Hat Switch { gActionRecs[kUp(i)].fDevice = gActionRecs[kDn(i)].fDevice = gActionRecs[kLf(i)].fDevice = gActionRecs[kRt(i)].fDevice = pDevice; gActionRecs[kUp(i)].fElement = gActionRecs[kDn(i)].fElement = gActionRecs[kLf(i)].fElement = gActionRecs[kRt(i)].fElement = pElement; if (pDevice->vendorID == 1103) // Thrustmaster gDirectionInfo[i].type = (pElement->max > 4) ? kPadElemTypeOtherHat8 : kPadElemTypeOtherHat4; else { if (pElement->max > 4) { if (((command % 4 == 0) && (curv == 0)) || // Up : 0 ((command % 4 == 1) && (curv == 4)) || // Down : 4 ((command % 4 == 2) && (curv == 6)) || // Left : 6 ((command % 4 == 3) && (curv == 2))) // Right : 2 gDirectionInfo[i].type = kPadElemTypeOtherHat8; else gDirectionInfo[i].type = kPadElemTypeHat8; } else { if (((command % 4 == 0) && (curv == 0)) || // Up : 0 ((command % 4 == 1) && (curv == 2)) || // Down : 2 ((command % 4 == 2) && (curv == 3)) || // Left : 3 ((command % 4 == 3) && (curv == 1))) // Right : 1 gDirectionInfo[i].type = kPadElemTypeOtherHat4; else gDirectionInfo[i].type = kPadElemTypeHat4; } } gDirectionInfo[i].device [kPadHat] = pDevice; gDirectionInfo[i].element[kPadHat] = pElement; gDirectionInfo[i].max [kPadHat] = pElement->max; gDirectionInfo[i].min [kPadHat] = pElement->min; } else if (pElement->max - pElement->min > 1) // Axis (maybe) { if ((command % 4 == 0) || (command % 4 == 1)) // Up or Dn { gActionRecs[kUp(i)].fDevice = gActionRecs[kDn(i)].fDevice = pDevice; gActionRecs[kUp(i)].fElement = gActionRecs[kDn(i)].fElement = pElement; gDirectionInfo[i].type = kPadElemTypeAxis; gDirectionInfo[i].device [kPadYAxis] = pDevice; gDirectionInfo[i].element[kPadYAxis] = pElement; gDirectionInfo[i].max [kPadYAxis] = pElement->max; gDirectionInfo[i].min [kPadYAxis] = pElement->min; gDirectionInfo[i].mid [kPadYAxis] = (gDirectionInfo[i].max[kPadYAxis] + gDirectionInfo[i].min[kPadYAxis]) >> 1; gDirectionInfo[i].maxmid [kPadYAxis] = (gDirectionInfo[i].max[kPadYAxis] + gDirectionInfo[i].mid[kPadYAxis]) >> 1; gDirectionInfo[i].midmin [kPadYAxis] = (gDirectionInfo[i].mid[kPadYAxis] + gDirectionInfo[i].min[kPadYAxis]) >> 1; } else // Lf or Rt { gActionRecs[kLf(i)].fDevice = gActionRecs[kRt(i)].fDevice = pDevice; gActionRecs[kLf(i)].fElement = gActionRecs[kRt(i)].fElement = pElement; gDirectionInfo[i].type = kPadElemTypeAxis; gDirectionInfo[i].device [kPadXAxis] = pDevice; gDirectionInfo[i].element[kPadXAxis] = pElement; gDirectionInfo[i].max [kPadXAxis] = pElement->max; gDirectionInfo[i].min [kPadXAxis] = pElement->min; gDirectionInfo[i].mid [kPadXAxis] = (gDirectionInfo[i].max[kPadXAxis] + gDirectionInfo[i].min[kPadXAxis]) >> 1; gDirectionInfo[i].maxmid [kPadXAxis] = (gDirectionInfo[i].max[kPadXAxis] + gDirectionInfo[i].mid[kPadXAxis]) >> 1; gDirectionInfo[i].midmin [kPadXAxis] = (gDirectionInfo[i].mid[kPadXAxis] + gDirectionInfo[i].min[kPadXAxis]) >> 1; } } else // Button (maybe) { gActionRecs[command].fDevice = pDevice; gActionRecs[command].fElement = pElement; gDirectionInfo[i].type = kPadElemTypeButton; } gDirectionHint[i] = gDirectionInfo[i].type; } else { gActionRecs[command].fDevice = pDevice; gActionRecs[command].fElement = pElement; } }