MCPcopy Create free account
hub / github.com/badvision/jace / processMemoryEvent

Method processMemoryEvent

src/main/java/jace/cheat/MetaCheat.java:334–399  ·  view source on GitHub ↗
(RAMEvent e)

Source from the content-addressed store, hash-verified

332 }
333
334 private void processMemoryEvent(RAMEvent e) {
335 MemoryCell cell = getMemoryCell(e.getAddress());
336 if (cell != null) {
337 Emulator.withComputer(c -> {
338 CPU cpu = c.getCpu();
339 int pc = cpu.getProgramCounter();
340 String trace = cpu.getLastTrace();
341 switch (e.getType()) {
342 case EXECUTE:
343 cell.execInstructionsDisassembly.add(trace);
344 if (cell.execInstructionsDisassembly.size() > historyLength) {
345 cell.execInstructionsDisassembly.remove(0);
346 }
347 case READ_OPERAND:
348 cell.execCount.set(Math.min(255, cell.execCount.get() + lightRate));
349 break;
350 case WRITE:
351 cell.writeCount.set(Math.min(255, cell.writeCount.get() + lightRate));
352 if (ui.isInspecting(cell.address)) {
353 if (pendingInspectorUpdates.incrementAndGet() < 5) {
354 Platform.runLater(() -> {
355 pendingInspectorUpdates.decrementAndGet();
356 cell.writeInstructions.add(pc);
357 cell.writeInstructionsDisassembly.add(trace);
358 if (cell.writeInstructions.size() > historyLength) {
359 cell.writeInstructions.remove(0);
360 cell.writeInstructionsDisassembly.remove(0);
361 }
362 });
363 }
364 } else {
365 cell.writeInstructions.add(cpu.getProgramCounter());
366 cell.writeInstructionsDisassembly.add(cpu.getLastTrace());
367 if (cell.writeInstructions.size() > historyLength) {
368 cell.writeInstructions.remove(0);
369 cell.writeInstructionsDisassembly.remove(0);
370 }
371 }
372 break;
373 default:
374 cell.readCount.set(Math.min(255, cell.readCount.get() + lightRate));
375 if (ui.isInspecting(cell.address)) {
376 if (pendingInspectorUpdates.incrementAndGet() < 5) {
377 Platform.runLater(() -> {
378 pendingInspectorUpdates.decrementAndGet();
379 cell.readInstructions.add(pc);
380 cell.readInstructionsDisassembly.add(trace);
381 if (cell.readInstructions.size() > historyLength) {
382 cell.readInstructions.remove(0);
383 cell.readInstructionsDisassembly.remove(0);
384 }
385 });
386 }
387 } else {
388 cell.readInstructions.add(cpu.getProgramCounter());
389 cell.readInstructionsDisassembly.add(cpu.getLastTrace());
390 if (cell.readInstructions.size() > historyLength) {
391 cell.readInstructions.remove(0);

Callers

nothing calls this directly

Calls 13

getMemoryCellMethod · 0.95
withComputerMethod · 0.95
getProgramCounterMethod · 0.95
getLastTraceMethod · 0.95
addMethod · 0.80
removeMethod · 0.80
setMethod · 0.80
isInspectingMethod · 0.80
getNewValueMethod · 0.80
getAddressMethod · 0.45
getCpuMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected