//loads the waveform and duplicates it. int32_t WaveformAna3Tcell::loadResetWaveform( int64_t nRows, double timeOffset, vector<float> timeArray, vector<float> amplitudeArray) { // cout << "WaveformAna3Tcell::loadResetWaveform" << endl; // cout << "Size of Time Reset Array = " << timeArray.size() << endl; // cout << "Size of Amplitude Reset Array = " << amplitudeArray.size() << endl; //add time offset to timeArray for (int32_t i = 0; i < timeArray.size(); i++) timeArray.at(i)+= (float)timeOffset; //if a waveform exists in the memory, delete it. if (_resetWave != NULL) delete _resetWave; if (_resetWaveOrig != NULL) delete _resetWaveOrig; _resetWave = new Waveform(timeArray, amplitudeArray); _resetWaveOrig = new Waveform(timeArray, amplitudeArray); _resetExists = false; _resetStart = 0; _resetEnd = 0; checkReset(); // showWaveform(_waveOrig); return 0; }
void MakeSmartPtrCheck::check(const MatchFinder::MatchResult &Result) { // 'smart_ptr' refers to 'std::shared_ptr' or 'std::unique_ptr' or other // pointer, 'make_smart_ptr' refers to 'std::make_shared' or // 'std::make_unique' or other function that creates smart_ptr. SourceManager &SM = *Result.SourceManager; const auto *Construct = Result.Nodes.getNodeAs<CXXConstructExpr>(ConstructorCall); const auto *Reset = Result.Nodes.getNodeAs<CXXMemberCallExpr>(ResetCall); const auto *Type = Result.Nodes.getNodeAs<QualType>(PointerType); const auto *New = Result.Nodes.getNodeAs<CXXNewExpr>(NewExpression); if (New->getNumPlacementArgs() != 0) return; if (Construct) checkConstruct(SM, Construct, Type, New); else if (Reset) checkReset(SM, Reset, New); }
t_stat dp_reset(DEVICE *dptr) { t_stat r; if (IOFWinitialized) if ((dptr->flags & DEV_DIS) == 0) if ((r = checkReset(dptr, DPdev.iod_equip)) != SCPE_OK) return r; DPbusy = FALSE; /* * Cancel any existing unit selection. */ DPdev.iod_unit = NULL; /* * Clear on-cylinder status */ DPdev.STATUS &= ~IO_1738_ONCYL; return SCPE_OK; }
u8 BackupDevice::data_command(u8 val, u8 PROCNUM) { //printf("MC%c : cmd %02X, val %02X\n", PROCNUM?'7':'9', com, val); #ifdef _ENABLE_MOTION //motion: some guessing here... hope it doesn't break anything if(com == BM_CMD_READLOW && motionInitState == MOTION_INIT_STATE_RECEIVED_4_B && val == 0) { motionInitState = MOTION_INIT_STATE_IDLE; motionFlag |= MOTION_FLAG_ENABLED; //return 0x04; //return 0x04 to enable motion!!!!! return 0; //but we return 0 to disable it! since we don't emulate it anyway } //if the game firmly believes we have motion support, then ignore all motion commands, since theyre not emulated. if(motionFlag & MOTION_FLAG_SENSORMODE) { return 0; } #endif switch (com) { case BM_CMD_WRITESTATUS: //printf("MC%c: write status %02X\n", PROCNUM?'7':'9', val); write_protect = (val & 0xFC); break; case BM_CMD_WRITELOW: case BM_CMD_READLOW: //handle data or address if(state == DETECTING) { if(com == BM_CMD_WRITELOW) printf("MC%c: Unexpected backup device initialization sequence using writes!\n", PROCNUM?'7':'9'); //just buffer the data until we're no longer detecting data_autodetect.push_back(val); detect(); val = 0xFF; } else { if(addr_counter<addr_size) { //continue building address addr <<= 8; addr |= val; addr_counter++; val = 0xFF; //if we just finished building the address, seek the FP if (addr_counter == addr_size) fpMC->fseek(addr, SEEK_SET); } else { //why does tomb raider underworld access 0x180 and go clear through to 0x280? //should this wrap around at 0 or at 0x100? //TODO - dont other backup memory types have similar wraparound issues? if(addr_size == 1) { addr &= 0x1FF; //since we changed the address unexpectedly (non-sequentially), be sure to seek the FP fpMC->fseek(addr, SEEK_SET); } //if we're writing a byte at address 0, we need to ensure that we have at least 1 byte in the file (IOW, ensure to size addr+1 == 0+1) ensure(addr+1); if(com == BM_CMD_READLOW) { val = read(); //MCLOG("BACKUP: Read at 0x%08X, value 0x%02X\n", addr, val); } else if(write_enable) { write(val); //MCLOG("BACKUP: Write to %08X, value %02Xh\n", addr, val); } addr++; } } break; case BM_CMD_READSTATUS: //handle request to read status //LOG("Backup Memory Read Status: %02X\n", write_enable << 1); val = (write_enable << 1) | write_protect; break; case BM_CMD_IRDA: printf("MC%c: Unverified Backup Memory command: %02X FROM %08X\n", PROCNUM?'7':'9', com, PROCNUM?NDS_ARM7.instruct_adr:NDS_ARM9.instruct_adr); val = 0xAA; break; default: if (com != 0) { printf("MC%c: Unhandled Backup Memory command %02X, value %02X (PC:%08X)\n", PROCNUM?'7':'9', com, val, PROCNUM?NDS_ARM7.instruct_adr:NDS_ARM9.instruct_adr); break; } com = val; val = 0xFF; //there is no current command. receive one switch (com) { case BM_CMD_NOP: break; case BM_CMD_WRITESTATUS: break; #ifdef _ENABLE_MOTION case 0xFE: if(motionInitState == MOTION_INIT_STATE_IDLE) { motionInitState = MOTION_INIT_STATE_FE; return 0; } break; case 0xFD: if(motionInitState == MOTION_INIT_STATE_FE) { motionInitState = MOTION_INIT_STATE_FD; return 0; } break; case 0xFB: if(motionInitState == MOTION_INIT_STATE_FD) { motionInitState = MOTION_INIT_STATE_FB; return 0; } break; case 0xF8: //enable sensor mode if(motionInitState == MOTION_INIT_STATE_FD) { motionInitState = MOTION_INIT_STATE_IDLE; motionFlag |= MOTION_FLAG_SENSORMODE; return 0; } break; case 0xF9: //disable sensor mode if(motionInitState == MOTION_INIT_STATE_FD) { motionInitState = MOTION_INIT_STATE_IDLE; motionFlag &= ~MOTION_FLAG_SENSORMODE; return 0; } break; #endif case BM_CMD_IRDA: printf("MC%c: Unverified Backup Memory command: %02X FROM %08X\n", PROCNUM?'7':'9', com, PROCNUM?NDS_ARM7.instruct_adr:NDS_ARM9.instruct_adr); val = 0xAA; break; case BM_CMD_WRITEDISABLE: //printf("MC%c: write disable\n", PROCNUM?'7':'9'); #ifdef _ENABLE_MOTION switch (motionInitState) { case MOTION_INIT_STATE_IDLE: motionInitState = MOTION_INIT_STATE_RECEIVED_4; break; case MOTION_INIT_STATE_RECEIVED_4: motionInitState = MOTION_INIT_STATE_RECEIVED_4_B; break; } #endif write_enable = FALSE; break; case BM_CMD_READSTATUS: break; case BM_CMD_WRITEENABLE: //printf("MC%c: write enable\n", PROCNUM?'7':'9'); write_enable = TRUE; break; case BM_CMD_WRITELOW: case BM_CMD_READLOW: //printf("XLO: %08X\n",addr); addr_counter = 0; addr = 0; break; case BM_CMD_WRITEHIGH: case BM_CMD_READHIGH: //printf("XHI: %08X\n",addr); if(com == BM_CMD_WRITEHIGH) com = BM_CMD_WRITELOW; if(com == BM_CMD_READHIGH) com = BM_CMD_READLOW; addr_counter = 0; addr = 0; if(addr_size==1) { //"write command that's only available on ST M95040-W that I know of" //this makes sense, since this device would only have a 256 bytes address space with writelow //and writehigh would allow access to the upper 256 bytes //but it was detected in pokemon diamond also during the main save process addr = 0x1; } break; default: printf("MC%c: Unhandled Backup Memory command: %02X FROM %08X\n", PROCNUM?'7':'9', com, PROCNUM?NDS_ARM7.instruct_adr:NDS_ARM9.instruct_adr); break; } //switch(val) break; } //switch (com) #ifdef _ENABLE_MOTION //motion control state machine broke, return to ground motionInitState = MOTION_INIT_STATE_IDLE; #endif checkReset(); return val; }