Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@ public class Runner implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(Runner.class);
// if a command is being run, default behavior is: do nothing
private static boolean runsSomeCommand;

@CommandLine.ArgGroup(heading = "Virtual computer%n")
public Exclusive exclusive;

@CommandLine.Option(names = {"-i", "--input-file"}, description = "input file name (source code)", paramLabel = "FILE")
public Path inputFile;

@CommandLine.Option(names = {"-cl", "--computers-list"}, description = "list all existing virtual computers")
private boolean listConfigs;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
SPDX-License-Identifier: GPL-3.0-or-later */
package net.emustudio.application.gui.dialogs;

import net.emustudio.application.Constants;
import net.emustudio.application.gui.actions.CompileAction;
import net.emustudio.application.gui.actions.editor.*;
import net.emustudio.application.gui.editor.Editor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.MissingResourceException;
Expand Down Expand Up @@ -95,7 +97,7 @@ public void compile(Path inputPath, Optional<Path> outputPath) {
notifyInfo(getTitle() + ", version " + getVersion());

Path finalOutputPath = outputPath.orElse(convertInputToOutputPath(inputPath, ".hex"));
try (Reader reader = new FileReader(inputPath.toFile())) {
try (Reader reader = Files.newBufferedReader(inputPath, StandardCharsets.UTF_8)) {
org.antlr.v4.runtime.Lexer lexer = createLexer(CharStreams.fromReader(reader));
lexer.addErrorListener(new ParserErrorListener(inputPath.toString()));
CommonTokenStream tokens = new CommonTokenStream(lexer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import java.io.IOException;
import java.io.Reader;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.MissingResourceException;
Expand Down Expand Up @@ -72,7 +74,7 @@ public void compile(Path inputPath, Optional<Path> outputPath) {
notifyInfo(getTitle() + ", version " + getVersion());

Path finalOutputPath = outputPath.orElse(convertInputToOutputPath(inputPath, ".bssem"));
try (Reader reader = new FileReader(inputPath.toFile())) {
try (Reader reader = Files.newBufferedReader(inputPath, StandardCharsets.UTF_8)) {
Lexer lexer = createLexer(CharStreams.fromReader(reader));
lexer.addErrorListener(new ParserErrorListener(inputPath.toString()));
CommonTokenStream tokens = new CommonTokenStream(lexer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.MissingResourceException;
Expand Down Expand Up @@ -95,7 +97,7 @@ public void compile(Path inputPath, Optional<Path> outputPath) {
notifyInfo(getTitle() + ", version " + getVersion());

Path finalOutputPath = outputPath.orElse(convertInputToOutputPath(inputPath, ".hex"));
try (Reader reader = new FileReader(inputPath.toFile())) {
try (Reader reader = Files.newBufferedReader(inputPath, StandardCharsets.UTF_8)) {
AsZ80Lexer lexer = createLexer(CharStreams.fromReader(reader));
lexer.addErrorListener(new ParserErrorListener(inputPath.toString()));
CommonTokenStream tokens = new CommonTokenStream(lexer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

import java.io.FileReader;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;

Expand Down Expand Up @@ -119,7 +121,7 @@ private IntelHEX compileToHex(Path inputPath) throws Exception {
Objects.requireNonNull(inputPath);
notifyInfo(getTitle() + ", version " + getVersion());

try (Reader reader = new FileReader(inputPath.toFile())) {
try (Reader reader = Files.newBufferedReader(inputPath, StandardCharsets.UTF_8)) {
org.antlr.v4.runtime.Lexer lexer = createLexer(CharStreams.fromReader(reader));
lexer.addErrorListener(new ParserErrorListener());
CommonTokenStream tokens = new CommonTokenStream(lexer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

import java.io.FileReader;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.MissingResourceException;
Expand Down Expand Up @@ -74,7 +76,7 @@ public void compile(Path inputPath, Optional<Path> outputPath) {
notifyInfo(getTitle() + ", version " + getVersion());

Path finalOutputPath = outputPath.orElse(convertInputToOutputPath(inputPath, ".bram"));
try (Reader reader = new FileReader(inputPath.toFile())) {
try (Reader reader = Files.newBufferedReader(inputPath, StandardCharsets.UTF_8)) {
org.antlr.v4.runtime.Lexer lexer = createLexer(CharStreams.fromReader(reader));
lexer.addErrorListener(new ParserErrorListener());
CommonTokenStream tokens = new CommonTokenStream(lexer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

import java.io.FileReader;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;

Expand Down Expand Up @@ -60,7 +62,7 @@ public void compile(Path inputPath, Optional<Path> outputPathX) {
notifyInfo(getTitle() + ", version " + getVersion());

Path finalOutputPath = outputPathX.orElse(convertInputToOutputPath(inputPath, ".brasp"));
try (Reader reader = new FileReader(inputPath.toFile())) {
try (Reader reader = Files.newBufferedReader(inputPath, StandardCharsets.UTF_8)) {
org.antlr.v4.runtime.Lexer lexer = createLexer(CharStreams.fromReader(reader));
lexer.addErrorListener(new ParserErrorListener());
CommonTokenStream tokens = new CommonTokenStream(lexer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import picocli.CommandLine.ParentCommand;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.List;
import java.util.Locale;

Expand Down Expand Up @@ -67,7 +69,7 @@ public void copy(@Parameters(paramLabel = "SRC_FILE", index = "0", description =
if (srcInCpm) {
content.append(cpmfs.readFile(realSrc));
} else {
try (Reader reader = new FileReader(realSrc)) {
try (Reader reader = Files.newBufferedReader(new File(realSrc).toPath(), StandardCharsets.UTF_8)) {
reader.transferTo(content);
}
}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ private String readURL(String theUrl) {
try {
URL url = new URL(theUrl);
URLConnection urlConnection = url.openConnection();
urlConnection.setConnectTimeout(10_000);
urlConnection.setReadTimeout(10_000);

BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
String line;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
import net.emustudio.emulib.plugins.annotations.PluginRoot;
import net.emustudio.emulib.plugins.device.AbstractDevice;
import net.emustudio.emulib.runtime.ApplicationApi;
import net.emustudio.emulib.runtime.interaction.GuiUtils;
import net.emustudio.emulib.runtime.settings.PluginSettings;
import net.emustudio.plugins.device.zxspectrum.bus.api.ZxSpectrumBus;
import net.emustudio.plugins.device.zxspectrum.ula.gui.Keyboard;
import net.emustudio.plugins.device.zxspectrum.ula.gui.DisplayWindow;

import javax.swing.*;
Expand All @@ -23,7 +21,6 @@
public class DeviceImpl extends AbstractDevice {

private final boolean guiSupported;
private final Keyboard keyboard = new Keyboard();
private boolean guiIOset = false;

private ULA ula;
Expand All @@ -42,7 +39,6 @@ public void initialize() throws PluginInitializationException {
this.ula = new ULA(bus);
this.passedCyclesMediator = new PassedCyclesMediator(ula);
bus.addPassedCyclesListener(passedCyclesMediator);
keyboard.addOnKeyListener(ula);
bus.attachDevice(0xFE, ula);
}

Expand All @@ -53,7 +49,6 @@ public void reset() {

@Override
public void destroy() {
keyboard.close();
if (guiIOset || gui != null) {
gui.destroy();
gui = null;
Expand All @@ -75,9 +70,8 @@ public boolean isShowSettingsSupported() {
public void showGUI(JFrame parent) {
if (guiSupported) {
if (!guiIOset) {
this.gui = new DisplayWindow(parent, ula, keyboard);
this.gui = new DisplayWindow(parent, ula);
passedCyclesMediator.setCanvas(gui.getCanvas());
GuiUtils.addKeyListener(gui, keyboard);
guiIOset = true;
this.gui.setVisible(true);
}
Expand Down
Loading