bool MAPIContact::Create(MAPIEx &mapi, MAPIFolder &folder) { #ifdef _WIN32_WCE if(folder.IsOpened()) { m_pPOOM = pFolder->GetPOOM(); return m_pPOOM ? m_pPOOM->Create(pMAPI,*this) : false; } return false; #else if(!MAPIObject::Create(mapi, folder)) return false; SetMessageClass("IPM.Contact"); SetImportance(IMPORTANCE_NORMAL); SetSensitivity(SENSITIVITY_NONE); return true; #endif }
static Bitu INT33_Handler(void) { // LOG(LOG_MOUSE,LOG_NORMAL)("MOUSE: %04X %X %X %d %d",reg_ax,reg_bx,reg_cx,POS_X,POS_Y); switch (reg_ax) { case 0x00: /* Reset Driver and Read Status */ mouse_reset_hardware(); /* fallthrough */ case 0x21: /* Software Reset */ reg_ax=0xffff; reg_bx=MOUSE_BUTTONS; mouse_reset(); Mouse_AutoLock(true); break; case 0x01: /* Show Mouse */ mouse.shown++; Mouse_AutoLock(true); if (mouse.shown>0) mouse.shown=0; DrawCursor(); break; case 0x02: /* Hide Mouse */ { if (CurMode->type!=M_TEXT) RestoreCursorBackground(); else RestoreCursorBackgroundText(); mouse.shown--; } break; case 0x03: /* Return position and Button Status */ reg_bx=mouse.buttons; reg_cx=POS_X; reg_dx=POS_Y; break; case 0x04: /* Position Mouse */ /* If position isn't different from current position * don't change it then. (as position is rounded so numbers get * lost when the rounded number is set) (arena/simulation Wolf) */ if(reg_cx >= mouse.max_x) mouse.x = static_cast<float>(mouse.max_x); else if (mouse.min_x >= reg_cx) mouse.x = static_cast<float>(mouse.min_x); else if (reg_cx != POS_X) mouse.x = static_cast<float>(reg_cx); if(reg_dx >= mouse.max_y) mouse.y = static_cast<float>(mouse.max_y); else if (mouse.min_y >= reg_dx) mouse.y = static_cast<float>(mouse.min_y); else if (reg_dx != POS_Y) mouse.y = static_cast<float>(reg_dx); DrawCursor(); break; case 0x05: /* Return Button Press Data */ { Bit16u but=reg_bx; reg_ax=mouse.buttons; reg_bx++; if (but>=MOUSE_BUTTONS) break; reg_cx=mouse.last_pressed_x[but]; reg_dx=mouse.last_pressed_y[but]; reg_bx=mouse.times_pressed[but]; mouse.times_pressed[but]=0; break; } case 0x06: /* Return Button Release Data */ { Bit16u but=reg_bx; reg_ax=mouse.buttons; reg_bx++; if (but>=MOUSE_BUTTONS) break; reg_cx=mouse.last_released_x[but]; reg_dx=mouse.last_released_y[but]; reg_bx=mouse.times_released[but]; mouse.times_released[but]=0; break; } case 0x07: /* Define horizontal cursor range */ { //lemmings set 1-640 and wants that. iron seeds set 0-640 but doesn't like 640 //Iron seed works if newvideo mode with mode 13 sets 0-639 //Larry 6 actually wants newvideo mode with mode 13 to set it to 0-319 Bits max,min; if ((Bit16s)reg_cx<(Bit16s)reg_dx) { min=(Bit16s)reg_cx;max=(Bit16s)reg_dx;} else { min=(Bit16s)reg_dx;max=(Bit16s)reg_cx;} mouse.min_x=min; mouse.max_x=max; /* Battlechess wants this */ if(mouse.x > mouse.max_x) mouse.x = mouse.max_x; if(mouse.x < mouse.min_x) mouse.x = mouse.min_x; /* Or alternatively this: mouse.x = (mouse.max_x - mouse.min_x + 1)/2;*/ LOG(LOG_MOUSE,LOG_NORMAL)("Define Hortizontal range min:%d max:%d",min,max); } break; case 0x08: /* Define vertical cursor range */ { // not sure what to take instead of the CurMode (see case 0x07 as well) // especially the cases where sheight= 400 and we set it with the mouse_reset to 200 //disabled it at the moment. Seems to break syndicate who want 400 in mode 13 Bits max,min; if ((Bit16s)reg_cx<(Bit16s)reg_dx) { min=(Bit16s)reg_cx;max=(Bit16s)reg_dx;} else { min=(Bit16s)reg_dx;max=(Bit16s)reg_cx;} mouse.min_y=min; mouse.max_y=max; /* Battlechess wants this */ if(mouse.y > mouse.max_y) mouse.y = mouse.max_y; if(mouse.y < mouse.min_y) mouse.y = mouse.min_y; /* Or alternatively this: mouse.y = (mouse.max_y - mouse.min_y + 1)/2;*/ LOG(LOG_MOUSE,LOG_NORMAL)("Define Vertical range min:%d max:%d",min,max); } break; case 0x09: /* Define GFX Cursor */ { PhysPt src = SegPhys(es)+reg_dx; MEM_BlockRead(src ,userdefScreenMask,CURSORY*2); MEM_BlockRead(src+CURSORY*2,userdefCursorMask,CURSORY*2); mouse.screenMask = userdefScreenMask; mouse.cursorMask = userdefCursorMask; mouse.hotx = reg_bx; mouse.hoty = reg_cx; mouse.cursorType = 2; DrawCursor(); } break; case 0x0a: /* Define Text Cursor */ mouse.cursorType = reg_bx; mouse.textAndMask = reg_cx; mouse.textXorMask = reg_dx; break; case 0x0c: /* Define interrupt subroutine parameters */ mouse.sub_mask=reg_cx; mouse.sub_seg=SegValue(es); mouse.sub_ofs=reg_dx; Mouse_AutoLock(true); //Some games don't seem to reset the mouse before using break; case 0x0f: /* Define mickey/pixel rate */ SetMickeyPixelRate(reg_cx,reg_dx); break; case 0x0B: /* Read Motion Data */ reg_cx=(Bit16s)(mouse.mickey_x*mouse.mickeysPerPixel_x); reg_dx=(Bit16s)(mouse.mickey_y*mouse.mickeysPerPixel_y); mouse.mickey_x=0; mouse.mickey_y=0; break; case 0x10: /* Define screen region for updating */ mouse.updateRegion_x[0]=reg_cx; mouse.updateRegion_y[0]=reg_dx; mouse.updateRegion_x[1]=reg_si; mouse.updateRegion_y[1]=reg_di; break; case 0x11: /* Get number of buttons */ reg_ax=0xffff; reg_bx=MOUSE_BUTTONS; break; case 0x13: /* Set double-speed threshold */ mouse.doubleSpeedThreshold=(reg_bx ? reg_bx : 64); break; case 0x14: /* Exchange event-handler */ { Bit16u oldSeg = mouse.sub_seg; Bit16u oldOfs = mouse.sub_ofs; Bit16u oldMask= mouse.sub_mask; // Set new values mouse.sub_mask= reg_cx; mouse.sub_seg = SegValue(es); mouse.sub_ofs = reg_dx; // Return old values reg_cx = oldMask; reg_dx = oldOfs; SegSet16(es,oldSeg); } break; case 0x15: /* Get Driver storage space requirements */ reg_bx = sizeof(mouse); break; case 0x16: /* Save driver state */ { LOG(LOG_MOUSE,LOG_WARN)("Saving driver state..."); PhysPt dest = SegPhys(es)+reg_dx; MEM_BlockWrite(dest, &mouse, sizeof(mouse)); } break; case 0x17: /* load driver state */ { LOG(LOG_MOUSE,LOG_WARN)("Loading driver state..."); PhysPt src = SegPhys(es)+reg_dx; MEM_BlockRead(src, &mouse, sizeof(mouse)); } break; case 0x1a: /* Set mouse sensitivity */ SetSensitivity(reg_bx,reg_cx); LOG(LOG_MOUSE,LOG_WARN)("Set sensitivity used with %d %d",reg_bx,reg_cx); // ToDo : double mouse speed value break; case 0x1b: /* Get mouse sensitivity */ reg_bx = Bit16s((60.0* sqrt(mouse.senv_x- (1.0/3.0)) ) +1.0); reg_cx = Bit16s((60.0* sqrt(mouse.senv_y- (1.0/3.0)) ) +1.0); LOG(LOG_MOUSE,LOG_WARN)("Get sensitivity %d %d",reg_bx,reg_cx); // ToDo : double mouse speed value reg_dx = 64; break; case 0x1c: /* Set interrupt rate */ /* Can't really set a rate this is host determined */ break; case 0x1d: /* Set display page number */ mouse.page=reg_bl; break; case 0x1e: /* Get display page number */ reg_bx=mouse.page; break; case 0x1f: /* Disable Mousedriver */ /* ES:BX old mouse driver Zero at the moment TODO */ reg_bx=0; SegSet16(es,0); mouse.enabled=false; /* Just for reporting not doing a thing with it */ mouse.oldshown=mouse.shown; mouse.shown=-1; break; case 0x20: /* Enable Mousedriver */ mouse.enabled=true; mouse.shown=mouse.oldshown; break; case 0x22: /* Set language for messages */ /* * Values for mouse driver language: * * 00h English * 01h French * 02h Dutch * 03h German * 04h Swedish * 05h Finnish * 06h Spanish * 07h Portugese * 08h Italian * */ mouse.language=reg_bx; break; case 0x23: /* Get language for messages */ reg_bx=mouse.language; break; case 0x24: /* Get Software version and mouse type */ reg_bx=0x805; //Version 8.05 woohoo reg_ch=0x04; /* PS/2 type */ reg_cl=0;//MOUSE_IRQ; /* Hmm ps2 irq 0!!!! */ break; case 0x26: /* Get Maximum virtual coordinates */ reg_bx=(mouse.enabled ? 0x0000 : 0xffff); reg_cx=mouse.max_x; reg_dx=mouse.max_y; break; default: LOG(LOG_MOUSE,LOG_ERROR)("Mouse Function %04X not implemented!",reg_ax); } return CBRET_NONE; }
SmartGyro::SmartGyro(UINT32 port) : Gyro(port) { SetSensitivity(0.006f); }
void TiePieHS3::sample_after_external_trigger(double _rate, size_t _samples, double _sensitivity ,size_t _resolution) { ADC_Abort(); /* set autoranging off */ SetAutoRanging(Ch1,0); SetAutoRanging(Ch2,0); samples=_samples; if (samples==0 || _rate<=0) return; unsigned short int retval; //samples=1024*1024*1024; // impossible value... provoke error retval=SetRecordLength(samples); if (0!=retval) { char buffer[256]; snprintf(buffer, sizeof(buffer), "could not set record length: SetRecrodLength(%d) returned %d", samples, retval); throw ADC_exception(std::string(buffer)); } if (0!=SetPostSamples(samples)){ throw ADC_exception("could not set post sample number"); } fprintf(stderr,"set sample number to %d\n",samples); /* set sampling frequency */ unsigned int freq=(unsigned int)fabs(floor(_rate)+0.5); unsigned int freq_req=freq; SetSampleFrequency(&freq_req); if (freq!=freq_req) throw ADC_exception("requested frequency could not be set"); rate=freq_req; fprintf(stderr,"set rate to %g\n",rate); /* set resolution */ if (0!=SetResolution(_resolution)) throw ADC_exception("could not set resolution"); unsigned char resolution_set; GetResolution(&resolution_set); if (_resolution!=resolution_set) throw ADC_exception("requested resolution not supported"); resolution=_resolution; fprintf(stderr,"set resolution to %d\n",resolution); #if 0 /* set DC level value to zero */ const double dclevel_req=-2.0; if (E_NO_ERRORS!=SetDcLevel(1, dclevel_req)) throw ADC_exception("could not set dc level for channel 1"); if (E_NO_ERRORS!=SetDcLevel(2, dclevel_req)) throw ADC_exception("could not set dc level for channel 2"); #endif /* set input sensitivity for both channels */ double sensitivity_req1=_sensitivity; SetSensitivity(1,&sensitivity_req1); double sensitivity_req2=_sensitivity; SetSensitivity(2,&sensitivity_req2); if (sensitivity_req1!=_sensitivity || sensitivity_req2!=_sensitivity) throw ADC_exception("requested sensitivity could not be set"); sensitivity=_sensitivity; fprintf(stderr,"set sensitivity to %g\n",sensitivity); /* set input coupling to DC */ if (0!=SetCoupling(Ch1, ctDC) || 0!=SetCoupling(Ch2, ctDC)) throw ADC_exception("could not set coupling to dc"); /* what to measure */ if (E_NO_ERRORS!=SetMeasureMode(mmCh12)) /* Channel 1 and 2 */ throw ADC_exception("could not set measurement mode"); /* the trigger source */ if (E_NO_ERRORS!=SetTriggerSource(tsExternal)) /* external trigger */ throw ADC_exception("could not set trigger source"); /* which slope to trigger */ if (E_NO_ERRORS!=SetTriggerMode(tmRising)) /* 0=Rising slope */ throw ADC_exception("could not set trigger source"); /* set transfer mode */ if (E_NO_ERRORS!=SetTransferMode(tmBlock)) throw ADC_exception("could not set transfer mode"); /* finally start the measurement */ if (0!=ADC_Start()) throw ADC_exception("could not start triggered adc measurement"); fprintf(stderr,"started triggered adc measurement with %d samples, rate=%g, sensitivity=%g, resolution=%d\n",samples,rate,sensitivity,resolution); }