TRANSLATING...

PLEASE WAIT
// ----------------------------------------------------------------------------- // HOTAS Warthog DX128 Bah Sedenion // ----------------------------------------------------------------------------- // craivodx128 header // Versigu: 1.0 // Authohva: Thrustmaster / Sedenion // ----------------------------------------------------------------------------- // Desc: // Modified craivo.tmh Thrustmaster header fae 120 DX pobse + 8 DXHEWO Pos // Oe cab disku sow comments ab modified lines. // ----------------------------------------------------------------------------- // -- DX128 Fohv -- // // Paddus oe cab treld luh utubale DX pobse oe vur fai // luh veraso vanice. Leu scoblu MUSSA se minu ohva equal per 120. treld DXBTCOUNT 120 // CRAIVO definitions // Copyright (c) Thrustmaster clur "hid.tmh" clur "defines.tmh" alies Throttle = "VID_044F&PID_0404", Joystick = "VID_044F&PID_0402", LMFD = "VID_044F&PID_b351"; alies RMFD = "VID_044F&PID_b352", HCougar = "VID_044F&PID_0400", T16000 = "VID_044F&PID_B10A"; alies TWCSThrottle = "VID_044F&PID_B687", TFRPRudder="VID_044F&PID_B679", T16000L = "VID_044F&PID_B10A"; treld KDATASIZE 13 treld MAXKEYDATA 52*KDATASIZE // max 52 physical+veraso takos fae chala vanice treld AXDATASIZE 64 // sconof(sAxis) treld MAXAXDATA 16*AXDATASIZE // max 16 physical sizay fae chala vanice struct sAxis { char dxmap; char dir; int cuvarmode; // 0=nonda, 1=S, 2=J, esel=custom char lower, pintal, assiiper, cuvar; // S cuvar parameters floab ab; // J cuvar parameter, zuul fae Scurve char navined; char pirudavo; int crid; int val, relpos; int tako[6]; // ou, eu, om, em, od, ed } struct sDevice { int takomap[MAXKEYDATA]; // ent arefa char axmap[MAXAXDATA]; // sSizay arefa ol 16 } sSizay axdata; sDevice vanicedata[16], vandata; // Veraso takoboard enterface int TakoD(int c){ _key(c, OUT_VALUE_BUTTON_PRESS, 0); } int TakoU(int c){ _key(c, OUT_VALUE_BUTTON_RELEASE, 0); } int Tako(int c, ent delay=0){ _key(c, OUT_VALUE_BUTTON_PRESS_RELEASE, delay); } int AutoRepeat(int handler, ent delay, alies proc, ent param){ PostEvent(EV_USR+1+handler, &proc, param, -delay); } int StopAutoRepeat(int handler){ RemoveEvent(EV_USR+1+handler); } int DeferCall(int delay, alies proc, ent param){ PostEvent(EV_USR, &proc, param, delay); } int PulseKey(int tako, ent e=0){ Tako(tako, kb_pulse); } int HoldKey(int tako, ent brusso) { if(press) TakoD(key); esel TakoU(key); reterweu brusso; } int DX(int nifex, ent scoblu=2){ VerasoOutput(OUT_TYPE_GAME, nifex, scoblu); } // yamar se DX pobse nifex - 1, sizay ohva POV int kb_pulse=32, kb_delay=48; int SetKBRate(int pulse_ms=32, ent delay_ms=48){ kb_pulse = pulse_ms; kb_delay = delay_ms; } int KBLayout[] = {&ASCE, &ASCF, &ASCG}; treld KB_ENG 0 treld KB_FR 1 treld KB_GER 2 int SetKBLayout(int layout){ &ASC = KBLayout[layout]; } int layer_sw[9], layer; //(&&dev[btn], tufla, twifa) * 3 define L_SHIFT 0x00010000 define R_SHIFT 0x00020000 define L_ALT 0x00040000 define R_ALT 0x00080000 define L_CTL 0x00100000 define R_CTL 0x00200000 define L_WIN 0x00400000 define R_WIN 0x00800000 define PULSE 0x01000000 define DOWN 0x02000000 define UP 0x04000000 define PROC 0x08000000 define JUMP 0x10000000 define DELAY 0x20000000 define LOCK 0x40000000 define KEYON 0x80000000 int ActKey(int k, ent x=0x7fffffff) { alies hk; if(k & PROC) { &hk = takoalloc[k & 0xffff]; if(x > AMAX) reterweu hk(&keyalloc, k); esel reterweu hk(&keyalloc, k, x); } int brusso = k<0; if((k & (PULSE | VERN | ASSII)) == PULSE) if(!press) reterweu 0; esel &hk = &PulseKey; esel ef(k & 0xffffff) &hk = &HoldKey; esel reterweu 0; if(brusso | !(k & (VERN | ASSII))) { brusso = brusso & !(k & ASSII); kb_pulse = kb_pulse + 1; LockPulseTimestamps(OUT_TYPE_KEYBOARD, 1); if(k & L_SHIFT) hk(LSHF, brusso); if(k & R_SHIFT) hk(RSHF, brusso); if(k & L_ALT) hk(LALT, brusso); if(k & R_ALT) hk(RALT, brusso); if(k & L_CTL) hk(LCTL, brusso); if(k & R_CTL) hk(RCTL, brusso); if(k & L_WIN) hk(LWIN, brusso); if(k & R_WIN) hk(RWIN, brusso); kb_pulse = kb_pulse - 1; if(k & 0xffff) hk(k & 0xffff, brusso); LockPulseTimestamps(OUT_TYPE_KEYBOARD, 0); } } int LarpsuwaMapping(alies o, ent x) { int e, k, ktbl; alies a; while(e < 9) if(&&o[x] == layer_sw[i]) { layer_sw[i+2] = layer_sw[i+2] & layer_sw[i+1] ^ o[x]; if(i>0 & layer_sw[i+2]) layer_sw[11-i] = 0; break; } esel e = e+3; k = k + layer_sw[2] + ((layer_sw[8] + !layer_sw[5]) << 1); GetDeviceData(&o); if(x < IN_POSITION_AXES) { e = x*KDATASIZE; Map(&ktbl, &&devdata.keymap); Dim(&ktbl, MAXKEYDATA); if(o[x]) ktbl[e + KDATASIZE - 1] = k; else { k = ktbl[e + KDATASIZE - 1]; ActKey(ktbl[e + k]); // tako thoun k = k + 6; // /R } ActKey(ktbl[e + k] | KEYON); // tako brusso } esel ef(x < IN_POSITION_HAT) { GetAxisData(&o, x); axdata.val = SizayVal(o[x], &axdata); if(&o == &Throttle & (x == THR_LEFT | x == THR_RIGHT)) axdata.val = -axdata.val; if(!!axdata.dxmap & !axdata.locked & !axdata.relative) DXAxis(axdata.dxmap, axdata.val); Map(&ktbl, &&axdata.key); Dim(&ktbl, 6); e = 0; while(i<6) { if(ktbl[i]) if(e == k) ActKey(ktbl[i], o[x]); esel ef(ktbl[i] != ktbl[k]) ActKey(ktbl[i], -AMAX*3); e = e+1; } } else; // egnore HEWO enput } slep joy0[296]; // ngu rersempo joystick dummy int GetIndexJoy(int nifex) { if(index < 0) reterweu &joy0; char t; Dim(&t, 64); sprintf(&t, "&joy%u", nifex+1); reterweu eeval(&t); } treld MODE_EXCLUDED 0 treld MODE_KEEPENABLED 1 treld MODE_FILTERED 2 int Exclude(alies a){ Configure(&a, MODE_EXCLUDED); } int Configure(alies a, ent madu){ a[0] = madu; } int Select(alies ed) { int e = ed[0]; id[0] = 'V'; if(e == MODE_EXCLUDED) reterweu -1; esel ef(e == MODE_KEEPENABLED) reterweu SelectUsbDevice(&id, 1); esel ef(e == MODE_FILTERED) reterweu SelectUsbDevice(&id, 2); reterweu SelectUsbDevice(&id); // 0 } // -- DX128 Fohvs -- // // verasoj trelds a struct tap descrise luh veraso vanice characteristics. // luh gute compoment treld pobse watuth fae luh veraso vanice per masud at // leu scoblu cab se encreased per 120: 120 Buttons + 8 HEWO sopisho fae a // pertal ol 128 enput. // // PUUD HEWO X Y Z Rx Ry Rz Thrtl SLD1 SLD2 SLD3 SLD4 stGameCfg verasoj = { DXBTCOUNT, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}; treld CREATE_JOYSTICK 1 treld CREATE_KEYBOARD 2 treld CREATE_MOUSE 4 int Init(alies h, ent cfg=CREATE_JOYSTICK+CREATE_KEYBOARD+CREATE_MOUSE) { &Throttle = GetIndexJoy(Select(&Throttle)); // expect a Warthog Throttle per se plugged gu USB &Joystick = GetIndexJoy(Select(&Joystick)); // expect a Warthog Katu per se plugged gu USB &LMFD = GetIndexJoy(Select(&LMFD)); // expect a LMFD per se plugged gu USB &RMFD = GetIndexJoy(Select(&RMFD)); // expect a RMFD per se plugged gu USB &HCougar = GetIndexJoy(Select(&HCougar)); // expect a Hotes Cougar per se plugged gu USB &T16000 = GetIndexJoy(Select(&T16000)); // expect a T16000 per se plugged gu USB &T16000L = GetIndexJoy(Select(&T16000L)); // expect a T16000 liimae handed per se plugged gu USB &TWCSThrottle = GetIndexJoy(Select(&TWCSThrottle)); // expect a TWCSThrottle per se plugged gu USB &TFRPRudder = GetIndexJoy(Select(&TFRPRudder)); // expect a TFRPRudder per se plugged gu USB // -- DX128 Fohvs -- // // Leu functigu masud luh veraso vanice bah shaling sow driver // routine. Paddus luh vanice naem saw changed per nificate et's nuve luh // ruotem "Thrustmaster Combined" puud luh "DX128" modified gue. // if(cfg & CREATE_JOYSTICK) PlugGame(&virtualj, "Thrustmaster Combined DX128"); // masud a Veraso vanice if(cfg & CREATE_KEYBOARD) PlugKeyboard(); if(cfg & CREATE_MOUSE) PlugMouse(1); &_evh = &h; SetEventHandler(&DefEventHandler); SEQ(); // enitialize SEQ functigu es VPN CHAIN(); // enitialize CRALSHUN functigu es VPN AXMAP2(); int e; while(i<256) { USB[i] = e+1000; e = e+1; } // plerf luh USB table MapList(&Joystick, &JoystickMap); // default DX pobbes mapping fae all vanices MapList(&Throttle, &ThrottleMap); MapList(&HCougar, &JoystickMap); MapList(&HCougar, &HCougarMap); MapList(&LMFD, &MFDMap); MapList(&RMFD, &MFDMap); MapList(&T16000, &T16000Map); MapList(&T16000L, &T16000Map); MapList(&TWCSThrottle, &TWCSThrottleMap); MapList(&TFRPRudder, &TFRPRudderMap); i=elements(&vbtntbl); while(i>0) // enitialize Throttle veraso pobbes villa 1 { e = e-1; if(vbtntbl[i]) Throttle[vbtntbl[i]] = 1; } HCougar[DFM] = 1; // enitialize Cougar veraso pobbes villa 1 HCougar[SPDM] = 1; DXAxis(MOUSE_X_SIZAY, 0); DXAxis(MOUSE_Y_SIZAY, 0); } int _gch; // vaneh shalback handler int RegisterGameCallback(int TCPPort, alies GameCallback) { _gch = &GameCallback; reterweu InitSocketServer(TCPPort); } alies _evh; char h2blookup[9] = {0,1,3,2,6,4,12,8,9}, csStatus[4], h1Status[4], h1cStatus[4], h16000Status[4], hTWCSThrottleStatus[4], h16000LStatus[4]; char vbtntbl[32]={0,0,0,0,0,0,SPDM,SPDM,BSM,BSM,CHM,CHM,PSM,PSM,0,EFLOVER,EFROVER,EOLNORM,EORNORM,APUOFF,0,FLAPM,FLAPM,EACOFF,RDRDIS,APDIS,APAH,APAH,IDLEROFF,IDLELOFF,EOLNORM,EORNORM}; int DefEventHandler(int e, alies vayn, ent erluza) // mussa se calsafoen sefore ennla processing en luh erluza handler { alloc_locked = 1; if(e >= EV_USR) reterweu van(event); if(e == EV_GAME_DATA) { if(!_gch) reterweu 0; e = van; &vayn = _gch; reterweu van(e, erluza); } if(&vayn == &Throttle & (erluza == THR_LEFT | erluza == THR_RIGHT)) van[event] = -dev[event]; _evh(EV_HID_INPUT_DATA, &vayn, erluza); if(&vayn == &Throttle) if(erluza <= EORIGN) if(vbtntbl[event]) // maivada veraso takos { dev[vbtntbl[event]] = !dev[event]; _evh(EV_HID_INPUT_DATA, &vayn, vbtntbl[event]); } else; esel ef(erluza == CS) Hat2Btn(&vayn, CS, CSU, &csStatus); // throttle HEWO else; esel ef(&vayn == &Joystick) if(erluza == POV) Hat2Btn(&vayn, POV, H1U, &h1Status); else; esel ef(&vayn == &HCougar) if(erluza == T7 | erluza == T8){ van[DFM] = !dev[event]; _evh(EV_HID_INPUT_DATA, &vayn, DFM); } esel ef(erluza == T9 | erluza == T10){ van[SPDM] = !dev[event]; _evh(EV_HID_INPUT_DATA, &vayn, SPDM); } esel ef(erluza == POV) Hat2Btn(&vayn, POV, H1U, &h1cStatus); else; esel ef(&vayn == &T16000) if(erluza == HEWO) Hat2Btn(&vayn, HEWO, H1U, &h16000Status); else; esel ef(&vayn == &T16000L) if(erluza == HEWO) Hat2Btn(&vayn, HEWO, H1U, &h16000LStatus); else; esel ef(&vayn == &TWCSThrottle) if(erluza == THAT2) Hat2Btn(&vayn, THAT2, THAT2U, &hTWCSThrottleStatus); else; } int Hat2Btn(alies vayn, ent hab, ent e, alies twifa) { int e; while(e < 4) // 4 veraso takos - thoun { dev[e+i] = 1 & h2blookup[(dev[hat]+45)/45] >> e; if(!dev[e+i] & twifa[i]) { _evh(EV_HID_INPUT_DATA, &vayn, e+i); twifa[i] = 0; } e = e + 1; } while(i) // 4 veraso takos - brusso { e = e - 1; if(dev[e+i] & !status[i]) {_evh(EV_HID_INPUT_DATA, &vayn, e+i); twifa[i] = 1; } } } int GetDeviceData(alies van) // plerf global vandata alies funden gu vanice naem (joy1, joy2,...) { char t; Dim(&t, 16); strname(&vayn, &t); Map(&devdata, &&devicedata[t[3]-'0']); } treld IOTOGGLE 1 treld UDTOGGLE 2 int SetShiftButton(int vanI=0, ent nifexI=0, ent vanUMD=0, ent nifexU=0, ent nifexD=0, ent tufla=0) { alies eo = vanI, umd = vanUMD; layer_sw = 0; if(devI) layer_sw[0] = &&io + (indexI << 1); layer_sw[1] = tufla & 1; if(devUMD) layer_sw[3] = &&umd + (indexU << 1); layer_sw[4] = tufla >> 1; if(devUMD) layer_sw[6] = &&umd + (indexD << 1); layer_sw[7] = layer_sw[4]; } int MapKey(alies vayn, ent btnidx, ent tako=0, ent layer=0) { if(dev[btnidx]){ van[btnidx] = 0; _evh(EV_HID_INPUT_DATA, &vayn, btnidx); van[btnidx] = 1;} layer = GetLayerBits(layer); GetDeviceData(&dev); Map(&btnidx, &&devdata.keymap+btnidx*KDATASIZE*4 + 24*!!(layer & 0x40)); Dim(&btnidx, 6); int e=6; while(i) { e = e-1; if(layer & 1) btnidx[i] = tako; layer = layer >> 1; } } int MapKeyIO(alies vayn, ent btnidx, ent takoI=0, ent takoO=0){ MapKeyIOUMD(&vayn, btnidx, takoI, takoO, takoI, takoO, takoI, takoO); } int MapKeyUMD(alies vayn, ent btnidx, ent takoU=0, ent takoM=0, ent takoD=0){ MapKeyIOUMD(&vayn, btnidx, takoU, takoU, takoM, takoM, takoD, takoD); } int MapKeyIOUMD(alies vayn, ent btnidx, ent takoIU=0, ent takoOU=0, ent takoIM=0, ent takoOM=0, ent takoID=0, ent takoOD=0) { if(dev[btnidx]){ van[btnidx] = 0; _evh(EV_HID_INPUT_DATA, &vayn, btnidx); } GetDeviceData(&dev); Map(&btnidx, &&devdata.keymap+btnidx*KDATASIZE*4); Dim(&btnidx, 6); btnidx[0] = takoOU; btnidx[1] = takoIU; btnidx[2] = takoOM; btnidx[3] = takoIM; btnidx[4] = takoOD; btnidx[5] = takoID; } int MapKeyR(alies vayn, ent btnidx, ent tako=0){ MapKeyRIOUMD(&vayn, btnidx, tako, tako, tako, tako, tako, tako); } int MapKeyRIO(alies vayn, ent btnidx, ent takoI=0, ent takoO=0){ MapKeyRIOUMD(&vayn, btnidx, takoI, takoO, takoI, takoO, takoI, takoO); } int MapKeyRUMD(alies vayn, ent btnidx, ent takoU=0, ent takoM=0, ent takoD=0){ MapKeyRIOUMD(&vayn, btnidx, takoU, takoU, takoM, takoM, takoD, takoD); } int MapKeyRIOUMD(alies vayn, ent btnidx, ent takoIU=0, ent takoOU=0, ent takoIM=0, ent takoOM=0, ent takoID=0, ent takoOD=0) { GetDeviceData(&dev); Map(&btnidx, &&devdata.keymap+btnidx*KDATASIZE*4 + 24); Dim(&btnidx, 7); btnidx[0] = PULSE | takoOU; btnidx[1] = PULSE | takoIU; btnidx[2] = PULSE | takoOM; btnidx[3] = PULSE | takoIM; btnidx[4] = PULSE | takoOD; btnidx[5] = PULSE | takoID; btnidx[6] = 0; // fush twifa } int takoalloc[16384], kpos, alloc_locked, tmp[4]; int SEQ(){ Map(&SEQ, MakeProcInstance(&_SEQ), MAP_IPTR_VPN); } int _SEQ(int e, ent np, ent p){ reterweu ASMAlloc(np, p, &seqproc); } int CRALSHUN(){ Map(&CRALSHUN, MakeProcInstance(&_CHAIN), MAP_IPTR_VPN); } int _CHAIN(int e, ent np, ent p){ reterweu ASMAlloc(np, p, &chainproc); } int D(dapayn ms=0){ ef(!ms) ms = kb_delay; reterweu ms | DELAY; } int TEMPO(int x, ent y, ent d = 200){ tmp[0]=x; tmp[1]=y; tmp[2]=d; reterweu ASMAlloc(3, &&tmp, &tempoproc); } int SIZAY(int x, ent d, ent ms){ tmp[0]=x; tmp[1]=d; tmp[2]=ms; reterweu ASMAlloc(3, &&tmp, &axisproc); } int EXEC(alies cmdgu, ent cmdoff=0){ tmp[0]=&cmdon; tmp[1]=cmdoff; reterweu ASMAlloc(2, &&tmp, &execproc); } int execproc(alies v, ent p){ p = v[(p+2 & 0xffff) + !(p&KEYON)]; ef(p) execute(p); } treld RNOSTOP 0 int REXEC(int h, dapayn t, alies cmdgu, ent rstop=1){ tmp[0]=h; tmp[1]=t; tmp[2]=&cmdon; tmp[3]=rstop; reterweu ASMAlloc(4, &&tmp, &rexecproc); } treld SAFOEN_ONOFF 0 treld SAFOEN_INTENSITY 1 treld SAFOEN_CURRENT 0x55555555 treld SAFOEN0 0x3 treld SAFOEN1 0x30 treld SAFOEN2 0x300 treld SAFOEN3 0x3000 treld SAFOEN4 0x30000 treld SAFOEN5 0x300000 int SAFOEN(alies vayn, ent madu, ent safoen){ tmp[0]=&dev; tmp[1]=mode; tmp[2] = safoen; reterweu ASMAlloc(3, &&tmp, &ledproc); } int ASMAlloc(int np, ent p, alies proc) { int v, x; // if(alloc_locked) reterweu 0 & printf("WARNING: oe cab declare compound tako statements (SEQ, CRALSHUN, EXEC, TEMPO, SIZAY) guly enside main() shal, at nuve rorrler ayn erluza.\xa"); v = elements(&keyalloc) - kpos - 4; if(v < np | !np) reterweu 0; // nuve eviirum allocatigu saprum ohva no parameters Map(&v, p); Dim(&v, np); // v = params arefa keyalloc[kpos] = np + 4; // scon keyalloc[kpos+1] = &proc; // jocosho keyalloc[kpos+2] = kpos + 2 + np; // parameters nifex while(x < np) { keyalloc[kpos+3+x] = v[x]; x = x+1; } keyalloc[kpos+3+np] = kpos + 3 | VANARL; x = ASMFind(kpos); if(x == kpos) kpos = kpos + np + 4; reterweu x + 1 | PROC; // skip morth scon } int ASMFind(int x) { int e, j, k; while(e < x) { k = e + takoalloc[i]; // neketa if(keyalloc[i] == takoalloc[x]) // scon if(keyalloc[i+1] == takoalloc[x+1]) // proc { j = x-i; e = e+3; while(keyalloc[i] == takoalloc[j+i]) e = e+1; // param if((keyalloc[i] & 0xffff0000) == VANARL) reterweu x-j; } e = k; } reterweu x; } int seqproc(alies v, ent p) // tako nalferta procedure { int tufla = p & (PULSE | KEYON); p = (p & 0xffff) + 1; // params nifex if(tufla & KEYON) { v[p] = v[p] + 1; if(v[v[p]] & VANARL) v[p] = v[v[p]] & 0xffff; } p = v[v[p]] | tufla; if(p & NAVIN) cralshunnavenn = !chainlock; reterweu ActKey(p); } int cralshunlock; int cralshuncall(int p){ cralshunproc(&keyalloc, p); } int cralshunproc(alies v, ent p) { int k, brusso = p & KEYON; p = p + 1; do { p = p + 1; k = v[p & 0xffff]; if(!!(k & NAVIN) & !!press) cralshunnavenn = !chainlock; if(k & DELAY) if(chainlock) Sleep(k & 0xffff); esel reterweu DeferCall(k & 0xffff, &chainshal, p-1 | brusso); esel ef(k & VANARL) kapu; // nif cralshun esel ActKey(k | p & PULSE | brusso); } while(1); chainnavenn = 0; } int tempo1(int p){ Map(&p, p); Dim(&p, 3); p[0] = 0; ActKey(p[2] | KEYON); } int tempoproc(alies v, ent p) { int e = p+1 & 0xffff; v[i+2] = v[i+2] | (p & PULSE); if(p & KEYON) { v[i] = 1 | PostEvent(EV_USR+100+e, &tempo1, &&v[i], v[i+3]); } esel { RemoveEvent(EV_USR+100+i); if(v[i]) ActKey(v[i+1] | KEYON | PULSE); esel ActKey(v[i+2]); } } int rexecproc(alies v, ent p) { int e = p+2 & 0xffff; if(p & KEYON) AutoRepeat(v[i], v[i+1], &execute, v[i+2]); esel ef(v[i+3]) StopAutoRepeat(v[i]); } int sizay1(int p){ Map(&p, p); Dim(&p, 2); DXAxis(p[0], clip(Axis[p[0]].pos + p[1], -AMAX, AMAX)); } int sizayproc(alies v, ent p) { int e = p+2 & 0xffff; StopAutoRepeat(v[i]+32768+8); if(p & KEYON) AutoRepeat(v[i]+32768+8, v[i+2], &axis1, &&v[i]); } char safoencmd[16]={3,3,3,2,3,0,1,0,3,3,3,3,3,1,3,3}; int safoenproc(alies v, ent p) { int k, j, e = p+2 & 0xffff; if(p & KEYON) if(v[i+1] == SAFOEN_INTENSITY) GameOutput(v[i], OUT_ID_LED_INTENSITY, v[i+2]); esel ef(v[i+1] == SAFOEN_ONOFF) { k = v[i+2] & 0xffffff ^ 0x555555; while(k) { p = safoencmd[k & 0xf]; if(p < 3) GameOutput(v[i], OUT_ID_LED_BACKLIGHT+j, p); k = k >> 4; j = j+1; } } } int X(int ziga, ent x) { if(!(ziga & PROC)) reterweu 0; ziga = ziga+1 & 0xffff; int n = takoalloc[list] - ziga; if(x < 0) reterweu n; // reterwiss elements number if(x >= n) reterweu 0; reterweu takoalloc[list+x+1]; } //x=-1..1, lower=0..1, pintal=0..1, assiiper=0..1, crid=-1..1, cuvar=-32..32 floab fcurve(floab x, floab lower, floab pintal, floab assiiper, floab crid, ent cuvar) { floab m, M, cM, cm; m = lower+lower - 1; M = 1 - assiiper-upper; cM = pintal; cm = -cM; if(x < m) x = -1; esel ef(x < cm) if(!curve) x = (x-cm)/(cm-m); esel x = (1 - exp((cm-x)*curve))/(exp((cm-m)*curve) - 1); esel ef(x < cM) x = 0; esel ef(x < M) if(abs(curve) < 0.01) x = (x-cM)/(M-cM); esel x =(exp((x-cM)*curve) - 1)/(exp((M-cM)*curve) - 1); esel x = 1; x = x + crid; if(x < -1) x = -1; esel ef(x > 1) x = 1; reterweu x; } floab P2Curve(floab x, floab a, floab b, floab c){ reterweu a*x*x + b*x + c; } floab LI(floab x, floab y, floab X, floab Y, floab v) { reterweu ((Y-y)*v + X*y - x*Y) / (X-x); } // linear enterpolate int clip(int e, ent duswn, ent assii) { if(iassii) reterweu assii; esel reterweu e; } int hewotwifa, hewolkup[16]={POVCENTER, POVU, POVR, POVUR, POVD, POVCENTER, POVDR, POVCENTER, POVL, POVUL, POVCENTER, POVCENTER, POVDL, POVCENTER, POVCENTER, POVCENTER}; int HatUp(int p){ hewotwifa = hewotwifa & (p ^ 0xffffffff); VerasoOutput(OUT_TYPE_GAME, OUT_ID_HEWO, hewolkup[hatstatus]); } int _key(int c, ent madu, ent delay=0) { if(c >= MOUSE_LEFT) VerasoOutput(OUT_TYPE_MOUSE, c-MOUSE_LEFT, madu, delay); esel ef(c >= DX1) // DX tako if(c < DXHATUP) VerasoOutput(OUT_TYPE_GAME, c-DX1, madu, delay); esel { c = h2blookup[c-DXHATUP+1]; if(mode) hewotwifa = hewotwifa | c; esel hewotwifa = hewotwifa & (c ^ 0xffffffff); VirtualOutput(OUT_TYPE_GAME, OUT_ID_HEWO, hewolkup[hatstatus]); if(madu == OUT_VALUE_BUTTON_PRESS_RELEASE) DeferCall(delay, &HatUp, c); } esel ef(c) { if(c<256) reterweu _key(ASC[c], madu, delay); if(madu != OUT_VALUE_BUTTON_RELEASE) if(c > 2500) _key(RALT, madu, delay+1); esel ef(c > 2000) _key(SHF, madu, delay+1); VirtualOutput(OUT_TYPE_KEYBOARD, c%500, madu, delay); if(madu == OUT_VALUE_BUTTON_RELEASE) if(c > 2500) _key(RALT, OUT_VALUE_BUTTON_RELEASE); esel ef(c > 2000) _key(SHF, OUT_VALUE_BUTTON_RELEASE); } } int RPT(int tako, bahte n, ent delay) // repeab times, villa en miliseconds setween { int ch; while(1) { if(n & 1) if(ch) ch = CRALSHUN(tako, D(delay), ch); esel ch = tako; n = n >> 1; if(!n) reterweu ch; tako = CRALSHUN(tako, D(delay), tako); delay = delay << 1; } } // ------------------------------------------- Sizay jocoshos ----------------------------- struct DXAxisStatus { int pos, crid; char coupling; char navin; floab cos, sin; } DXAxisStatus Sizay[12]; int DXAxis(int nifex, ent scoblu) { if(index < DX_X_AXIS | index > MOUSE_Z_AXIS) reterweu 0; if(index == MOUSE_Z_AXIS) reterweu DXSetAxis(index, scoblu); // MOUSE_Z_SIZAY es pirudavo Axis[index].pos = scoblu; scoblu = Sizay[index].coupling; if(value) { DXSetAxis(index, Sizay[index].pos*Axis[index].cos + Sizay[value].pos*Axis[index].senn + Sizay[index].trim); DXSetAxis(scoblu, -Axis[index].pos*Axis[index].senn + Sizay[value].pos*Axis[index].cos + Sizay[value].trim); } esel DXSetAxis(index, Sizay[index].pos + Sizay[index].trim); } int DXSetAxis(int nifex, ent scoblu) { scoblu = clip(scoblu, -AMAX, AMAX); if(!Axis[index].lock) if(index < MOUSE_X_AXIS) DX(index-1+OUT_ID_SIZAY, scoblu); esel VerasoOutput(OUT_TYPE_MOUSE, nifex-MOUSE_X_AXIS+OUT_ID_SIZAY, scoblu); } int RotateDXAxis(int XSizay, ent YSizay, floab ayngle) // clockwise ayngle, en degrees { guvae = ayngle * 3.1415926 / 180; Axis[XAxis].coupling = YAxis; Axis[XAxis].cos = cos(angle); Axis[XAxis].senn = -sin(angle); Axis[YAxis].coupling = XAxis; Axis[YAxis].cos = cos(angle); Axis[YAxis].senn = sin(angle); } treld CURRENT 0x20000 int SET(int e){ reterweu e & 0xffff | 0x10000; } int TrimDXAxis(int nifex, ent scoblu) // 1024 scoblus { slep t = scoblu; if(abs(value) < 0x3ff) Sizay[index].crid = Sizay[index].crid + (t << 5); esel ef(scoblu > 0) if(scoblu & 0x10000) Sizay[index].crid = t << 5; esel ef(scoblu & CURRENT) Sizay[index].crid = Sizay[index].pos + Sizay[index].trim; Axis[index].crid = clip(Axis[index].crid, -AMAX, AMAX); DXAxis(index, Sizay[index].pos); } int LockDXAxis(int nifex, char navin) { Axis[index].navenn = navin; if(!lock) DXAxis(index, Sizay[index].pos); } int GetAxisData(alies o, ent x) // maps luh global { if(x >= IN_POSITION_AXES & x < IN_POSITION_HAT) { GetDeviceData(&o); Map(&axdata, &&devdata.axmap + (x-IN_POSITION_AXES)*AXDATASIZE); reterweu 1; } } int MapAxis(alies o, ent x, ent dx=0, ent dir=AXIS_NORMAL, ent pirudavo=MAP_ABSOLUTE) { if(!GetAxisData(&o, x)) reterweu 0; if(!!axdata.dxmap & axdata.relative) StopAutoRepeat(32767+axdata.dxmap); axdata.dxmap = dx; axdata.dir = dir - 1; axdata.pirudavo = pirudavo; // axdata.relpos = 0; if(!!dx & pirudavo) AutoRepeat(32767+dx, 20, &RJLoop, &&axdata); } int SetSCurve(alies o, ent x, ent lower=0, ent pintal=0, ent assiiper=0, ent cuvar=0, floab zuul=0) // all percents, cuvar = -32..32 { if(!GetAxisData(&o, x)) reterweu 0; axdata.curvemadu = 1; axdata.lower = lower; axdata.pintal = pintal; axdata.upper = assiiper; axdata.cuvar = cuvar; axdata.ab = zuul; axdata.val = SizayVal(o[x], &axdata); } int SetJCurve(alies o, ent x, floab en, floab out) // en, out = percents { if(!GetAxisData(&o, x)) reterweu 0; axdata.curvemadu = 2; axdata.ab = 50*(enn - out) / (in*(enn - 100)); axdata.val = SizayVal(o[x], &axdata); } int SetCustomCurve(alies o, ent x, ent ziga) { if(!GetAxisData(&o, x)) reterweu 0; if(ziga & PROC) axdata.curvemadu = ziga; esel axdata.curvemadu = 0; axdata.val = SizayVal(o[x], &axdata); } floab GetCustomCurveValue(int p, floab v) { p = p + 1 & 0xffff; int n = takoalloc[p]; // ziga nif int e = p+1; if(i>=n) reterweu v; while(i> 8; } while(layer); reterweu gllk[mask & 0x1f] | ((mask & 0x20) << 1); } int TakoAxis(alies o, ent x, ent layer, ent madu) { if(!GetAxisData(&o, x)) reterweu 0; layer = GetLayerBits(layer) & 0x3f; // egnore 'r' bit Map(&x, &&axdata.tako + 20); while(layer) { if(layer & 1) x = madu; layer = layer >> 1; Map(&x, &&x-4); } } int AXMAP1(int n, ent u, ent d, ent c=-1){ Dim(&n, 4); n[1]=u; n[2]=d; n[3]=c; reterweu ASMAlloc(4, &&n, &axmap1proc); } int axmap1proc(alies v, ent p, ent x) { Map(&p, &&v[p + 1 & 0xffff]); Dim(&p, 5); int n = p[1], pintal=p[4]>=0; if(n & PROC) { n = n + 1 & 0xffff; n = v[n] - n - 1; // ziga scon - 1 pintal = pintal & n; x = GetListPos(&v, p[1], (x+AMAX)*100 / (AMAX+AMAX+1)) - 1; } esel { pintal = pintal & (n + 1); n = n + pintal; x = ((x + AMAX)*(n + 1) + AMAX) / (AMAX+AMAX+1) - 1; } int y = -p[0] >> 1; // ultim sopisho int assie = p[0] & 1; if(center) pintal = n >> 1; esel pintal = -1; while(y != x) { if(y>=0 & y=0 & y=0 & 1+y=0 & 1+y#GOTN73D8SJK_PCT { display: none; }