MCPcopy Create free account
hub / github.com/TASEmulators/fceux / setInputUsingPattern

Method setInputUsingPattern

src/drivers/win/taseditor/editor.cpp:185–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183 }
184}
185void EDITOR::setInputUsingPattern(int start, int end, int joy, int button, int consecutivenessTag)
186{
187 if (joy < 0 || joy >= joysticksPerFrame[getInputType(currMovieData)]) return;
188
189 if (start > end)
190 {
191 // swap
192 int temp_start = start;
193 start = end;
194 end = temp_start;
195 }
196 if (start < 0) start = end;
197 if (end >= currMovieData.getNumRecords())
198 return;
199
200 int pattern_offset = 0, current_pattern = taseditorConfig.currentPattern;
201 bool changes_made = false;
202 bool value;
203
204 for (int i = start; i <= end; ++i)
205 {
206 // skip lag frames
207 if (taseditorConfig.autofirePatternSkipsLag && greenzone.lagLog.getLagInfoAtFrame(i) == LAGGED_YES)
208 continue;
209 value = (patterns[current_pattern][pattern_offset] != 0);
210 if (currMovieData.records[i].checkBit(joy, button) != value)
211 {
212 changes_made = true;
213 currMovieData.records[i].setBitValue(joy, button, value);
214 }
215 pattern_offset++;
216 if (pattern_offset >= (int)patterns[current_pattern].size())
217 pattern_offset -= patterns[current_pattern].size();
218 }
219 if (changes_made)
220 greenzone.invalidateAndUpdatePlayback(history.registerChanges(MODTYPE_PATTERN, start, end, 0, patternsNames[current_pattern].c_str(), consecutivenessTag));
221}
222
223// following functions use current Selection to determine range of frames
224bool EDITOR::handleColumnSet()

Callers 2

updateMethod · 0.45
listWndProcFunction · 0.45

Calls 8

getNumRecordsMethod · 0.80
checkBitMethod · 0.80
setBitValueMethod · 0.80
getInputTypeFunction · 0.50
getLagInfoAtFrameMethod · 0.45
sizeMethod · 0.45
registerChangesMethod · 0.45

Tested by

no test coverage detected