static int init_joysticks (void) { int i; int success = 0; if (!joystickContext) { if (openAmigaInput ()) { joystickContext = AIN_CreateContext (1, NULL); if (joystickContext) { struct enumPacket packet = { joystickContext, &joystickCount, &joystickList[0] }; AIN_EnumDevices (joystickContext, enumerateJoysticks, &packet); write_log ("Found %d joysticks\n", joystickCount); success = 1; } } } return success; }
static int ai_init(void) { if (!amigainput_lib_loaded) { return -1; } if ((ai_port = CreateMsgPort())) { struct TagItem tags[] = { { AINCC_Port, (ULONG)ai_port}, { TAG_DONE, TAG_DONE } }; CTX = AIN_CreateContext(1, tags); if (CTX != NULL) { return 0; } } ai_exit(); return -1; }
static int ai_init(void) { if (!amigainput_lib_loaded) { return -1; } /* load_libs is called by ui_init_finish, which is too late for us */ if ((AIN_Base = OpenLibrary("AmigaInput.library", 51))) { if ((IAIN = GetInterface(AIN_Base, "main", 1, NULL))) { if ((ai_port = CreateMsgPort())) { struct TagItem tags[] = { { AINCC_Port, (ULONG)ai_port}, { TAG_DONE, TAG_DONE } }; CTX = AIN_CreateContext(1, tags); if (CTX != NULL) { return 0; } } } } ai_exit(); return -1; }