LRESULT CALLBACK GetMsgProc(int code, WPARAM wParam, LPARAM lParam){ PMSG pMsg=(PMSG)lParam; char* lpAddr; if(wParam==0){ switch (pMsg->message){ case 0x801: hGame_LOL=pMsg->hwnd; g_hGetMsg=(HHOOK)(pMsg->lParam); if(!bInitLOLClient) { bInitLOLClient=TRUE; CreateThread(NULL,NULL,&dwWaitThread,NULL,NULL,NULL); } break; case 0x802: g_hMemFile=OpenFileMappingA(FILE_MAP_ALL_ACCESS,FALSE,FILE_CFG); if(g_hMemFile){ lpAddr=(char*)MapViewOfFile(g_hMemFile,FILE_MAP_ALL_ACCESS,0,0,255); DbgPrintA("[Hook]GetCFG PATH %s",lpAddr); LoadCFG(lpAddr,&cfgEXE); UnmapViewOfFile(lpAddr); CloseHandle(g_hMemFile); }else{ DbgPrintA("[Hook] OpenFileFILE_CFG Error"); } break; case 0x803: g_hGetMsg=(HHOOK)(pMsg->lParam); if(!bInitLOL) { DbgPrintA("[Hook]Init"); bInitLOL=TRUE; CreateThread(NULL,NULL,&dwWaitThread,NULL,NULL,NULL); } else { DbgPrintA("[Hook]has been Inited"); } break; case 0x805: if (!bInitLOL) { bInitLOL = TRUE; CreateThread(NULL, NULL, &dwWaitThread, NULL, NULL, NULL); } break; } } return CallNextHookEx(g_hGetMsg,code,wParam,lParam); }
Revolver::Revolver() { m_Addr = 0; m_currentFilter = -1; char str[80]; // Inicializamos m_RPF_parameters.nfw = 1; m_RPF_parameters.nfilt = MAX_FILTROS_DTA; // filter steps m_RPF_parameters.step = 800 / m_RPF_parameters.nfilt; m_RPF_parameters.com = COM5; m_RPF_parameters.baud = Baud19200; m_RPF_parameters.hold = 1; m_RPF_parameters.torque = 15984; m_RPF_parameters.offset = 0; m_RPF_parameters.calspd = 20000; m_RPF_parameters.slope = 255; m_RPF_parameters.stspd = 65535; m_RPF_parameters.enspd = 6144; m_RPF_parameters.feed = 1; m_RPF_parameters.dly = 125; //Cargamos LoadCFG(m_RPF_parameters); int er = SioReset(m_RPF_parameters.com, 64, 64); if (er != 0) { if (er == IE_BADID) error_fatal("Init Revolver", "Imposible abrir COM: Puerto inexistente", 0); if (er == IE_OPEN) error_fatal("Init Revolver", "Imposible abrir COM: Puerto ya abierto", 0); if (er == IE_MEMORY) error_fatal("Init Revolver", "Imposible abrir COM: No hay memoria suficiente", 0); else error_fatal("Init Revolver", "Imposible abrir COM", 0); return; } er = SioBaud(m_RPF_parameters.com, m_RPF_parameters.baud); if (er == IE_BAUDRATE ) { error_fatal("Init Revolver", "Unsupported boud rate", 0); return; } for(int n = 0; n < m_RPF_parameters.nfw; n++) { m_Addr = n; // Hold sprintf(str, "9%d", m_RPF_parameters.hold); if (Cmd(str) == false) { AfxMessageBox("*** Init Revolver: No hay respuesta por el puerto COM, asegurese que el dispositivo esta conectado"); exit(-1); } // Torque value sprintf(str, "3%04X", m_RPF_parameters.torque); Cmd(str); // Offset value sprintf(str, "4%02X", m_RPF_parameters.offset + 127); Cmd(str); // Num. of filters sprintf(str, "5%02X", m_RPF_parameters.nfilt); Cmd(str); // Num. of filters sprintf(str, "6%03X", m_RPF_parameters.step); Cmd(str); // Calibration speed sprintf(str, "8%04X", m_RPF_parameters.calspd); Cmd(str); // Slope sprintf(str, "A%02X", m_RPF_parameters.slope); Cmd(str); // Start speed sprintf(str, "B%04X", m_RPF_parameters.stspd); Cmd(str); // End speed sprintf(str, "C%04X", m_RPF_parameters.enspd); Cmd(str); // Enable feedback sprintf(str, "L%d", m_RPF_parameters.feed); Cmd(str); // Delay after pos. sprintf(str, "K%04X", m_RPF_parameters.dly); Cmd(str); // Calibrate Calibrate(); } }