Merge branch 'master' of github.com:badvision/lawless-legends

This commit is contained in:
Martin Haye 2020-07-28 07:35:39 -07:00
commit e6f16f608f
5 changed files with 59 additions and 38 deletions

View File

@ -7,7 +7,6 @@
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.badvision.outlaweditor.ui;
import java.net.URL;
@ -15,6 +14,8 @@ import java.util.ListResourceBundle;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;
import javafx.application.Platform;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker.State;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
@ -22,6 +23,7 @@ import javafx.fxml.Initializable;
import javafx.scene.control.MenuItem;
import javafx.scene.web.PromptData;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import netscape.javascript.JSObject;
import org.badvision.outlaweditor.MythosEditor;
@ -117,6 +119,16 @@ public class MythosScriptEditorController
});
}
// JavaFX8 has a bug where stage maximize events do not trigger resize events to webview components
Platform.runLater(() -> {
Stage stage = (Stage) editorView.getScene().getWindow();
if (stage != null) {
stage.maximizedProperty().addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
Platform.runLater(()->editorView.getEngine().executeScript("window.dispatchEvent(new Event('resize'));"));
});
}
});
//TODO: Verify the path conversion works in Win7 with a jar file
// Affected by https://bugs.openjdk.java.net/browse/JDK-8136466
editorView.getEngine().load(getClass().getResource(MYTHOS_EDITOR).toExternalForm());

View File

@ -780,6 +780,5 @@
window.addEventListener('resize', onresize, false);
onresize();
</script>
</body>
</html>

View File

@ -5,15 +5,14 @@
*/
package jace;
import jace.apple2e.VideoNTSC;
import jace.config.Configuration;
import jace.core.RAMEvent;
import jace.core.RAMListener;
import jace.core.Utility;
import jace.hardware.CardDiskII;
import jace.hardware.CardMockingboard;
import jace.hardware.CardRamFactor;
import jace.hardware.CardRamworks;
import jace.hardware.PassportMidiInterface;
import jace.hardware.massStorage.CardMassStorage;
import jace.lawless.LawlessHacks;
import jace.lawless.LawlessImageTool;
@ -155,11 +154,12 @@ public class LawlessLegends extends Application {
Emulator.computer.card7.setValue(CardMassStorage.class);
Emulator.computer.card6.setValue(CardDiskII.class);
Emulator.computer.card5.setValue(CardRamFactor.class);
Emulator.computer.card4.setValue(CardMockingboard.class);
Emulator.computer.card2.setValue(PassportMidiInterface.class);
Emulator.computer.card4.setValue(null);
Emulator.computer.card2.setValue(null);
Emulator.computer.cheatEngine.setValue(LawlessHacks.class);
Configuration.buildTree();
Emulator.computer.reconfigure();
VideoNTSC.setVideoMode(VideoNTSC.VideoMode.TextFriendly, false);
((LawlessImageTool) Emulator.computer.getUpgradeHandler()).loadGame();
}
}

View File

@ -20,7 +20,6 @@ package jace.apple2e;
import jace.Emulator;
import jace.EmulatorUILogic;
import static jace.apple2e.VideoDHGR.BLACK;
import jace.config.ConfigurableField;
import jace.config.InvokableAction;
import jace.core.Computer;
@ -34,6 +33,8 @@ import javafx.scene.image.PixelWriter;
import javafx.scene.image.WritableImage;
import javafx.scene.paint.Color;
import static jace.apple2e.VideoDHGR.BLACK;
/**
* Provides a clean color monitor simulation, complete with text-friendly
* palette and mixed color/bw (mode 7) rendering. This class extends the
@ -81,25 +82,28 @@ public class VideoNTSC extends VideoDHGR {
Greenscreen("Green"),
Amber("Amber");
String name;
VideoMode(String n) {
name = n;
}
}
static int currentMode = -1;
@InvokableAction(name = "Toggle video mode",
category = "video",
alternatives = "Gfx mode;color;b&w;monochrome",
defaultKeyMapping = {"ctrl+shift+g"})
public static void changeVideoMode() {
VideoNTSC thiss = (VideoNTSC) Emulator.computer.video;
currentMode++;
if (currentMode >= VideoMode.values().length) {
currentMode = 0;
currentMode = (currentMode + 1) % VideoMode.values().length;
setVideoMode(VideoMode.values()[currentMode], true);
}
public static void setVideoMode(VideoMode newMode, boolean showNotification) {
VideoNTSC thiss = (VideoNTSC) Emulator.computer.video;
thiss.monochomeMode = false;
WHITE = Color.WHITE;
switch (VideoMode.values()[currentMode]) {
switch (newMode) {
case Amber:
thiss.monochomeMode = true;
WHITE = Color.web("ff8000");
@ -129,7 +133,9 @@ public class VideoNTSC extends VideoDHGR {
break;
}
thiss.activePalette = thiss.useTextPalette ? TEXT_PALETTE : SOLID_PALETTE;
EmulatorUILogic.notify("Video mode: "+VideoMode.values()[currentMode].name);
if (showNotification) {
EmulatorUILogic.notify("Video mode: " + newMode.name);
}
forceRefresh();
}
@ -235,6 +241,7 @@ public class VideoNTSC extends VideoDHGR {
}
boolean monochomeMode = false;
private void renderScanline(WritableImage screen, int y) {
int p = 0;
if (rowStart != 0) {

View File

@ -44,6 +44,9 @@ public class LawlessVideo extends VideoNTSC {
0, 0, 39, 191,
39, 130, 78, 191
}),
TITLE(new int[]{
56, 162, 224, 190
}),
UNKNOWN;
boolean[][] colorMask;