Search in sources :

Example 1 with ConsoleState

use of org.javatari.atari.console.savestate.ConsoleState in project javatari by ppeccin.

the class CartridgeSavestate method getConsoleState.

public ConsoleState getConsoleState() {
    try {
        ByteArrayInputStream byteStream = new ByteArrayInputStream(rom.content);
        byteStream.skip(contentIdentifier.length);
        ObjectInputStream objStream = new ObjectInputStream(byteStream);
        return (ConsoleState) objStream.readObject();
    } catch (Exception ex) {
        // Cast or IO errors
        ex.printStackTrace();
        return null;
    }
}
Also used : ConsoleState(org.javatari.atari.console.savestate.ConsoleState) ByteArrayInputStream(java.io.ByteArrayInputStream) ObjectInputStream(java.io.ObjectInputStream)

Example 2 with ConsoleState

use of org.javatari.atari.console.savestate.ConsoleState in project javatari by ppeccin.

the class Console method pauseAndSaveState.

private ConsoleState pauseAndSaveState() {
    pause();
    ConsoleState state = saveState();
    go();
    return state;
}
Also used : ConsoleState(org.javatari.atari.console.savestate.ConsoleState)

Example 3 with ConsoleState

use of org.javatari.atari.console.savestate.ConsoleState in project javatari by ppeccin.

the class ServerConsole method clockPulse.

@Override
public synchronized void clockPulse() {
    Boolean powerChange = null;
    ConsoleState state = null;
    if (stateUpdateRequested) {
        powerChange = powerOn;
        state = saveState();
        stateUpdateRequested = false;
    }
    List<ControlChange> controlChanges = ((ServerConsoleControlsSocketAdapter) controlsSocket).commitAndGetChangesToSend();
    if (powerOn)
        tia.clockPulse();
    if (remoteTransmitter != null && remoteTransmitter.isClientConnected()) {
        ServerUpdate update = new ServerUpdate();
        update.powerChange = powerChange;
        update.consoleState = state;
        update.controlChanges = controlChanges;
        remoteTransmitter.sendUpdate(update);
    }
}
Also used : ConsoleState(org.javatari.atari.console.savestate.ConsoleState)

Aggregations

ConsoleState (org.javatari.atari.console.savestate.ConsoleState)3 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ObjectInputStream (java.io.ObjectInputStream)1